smart-home-engine 1.20.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,234 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonMode-tUihOf0o.js","assets/monaco-langs-Dt8a9eeo.js","assets/monaco-langs-DyX1CsEw.css","assets/tsMode-BNcOSQVq.js"])))=>i.map(i=>d[i]);
2
+ var n3=Object.defineProperty;var kS=o=>{throw TypeError(o)};var s3=(o,e,t)=>e in o?n3(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var Un=(o,e,t)=>s3(o,typeof e!="symbol"?e+"":e,t),Gb=(o,e,t)=>e.has(o)||kS("Cannot "+t);var ke=(o,e,t)=>(Gb(o,e,"read from private field"),t?t.call(o):e.get(o)),In=(o,e,t)=>e.has(o)?kS("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Pn=(o,e,t,i)=>(Gb(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),vs=(o,e,t)=>(Gb(o,e,"access private method"),t);import{_ as lA,m as cA,l as Ei,A as Ko,C as Ue,I as bs,D as Tp,a as zs,g as dA,M as li,b as Ji,E as Sa,c as G,r as os,d as ia,e as S,f as o3,h as ps,R as Tn,S as Zi,i as Fo,j as na,k as Gn,n as En,o as Te,p as xt,K as qs,q as vi,s as Nt,t as Qs,u as te,v as Bn,O as nl,w as Ks,P as Si,x as Kb,y as Mp,z as uA,B as Pl,F as Da,G as ZC,H as po,U as rs,J as qf,L as Di,N as Hl,Q as r3,T as jo,V as XC,W as a3,X as hA,$ as xi,Y as Qn,Z as qn,a0 as Ds,a1 as cn,a2 as Er,a3 as Hg,a4 as Tt,a5 as tv,a6 as l3,a7 as c3,a8 as Ys,a9 as d3,aa as Aa,ab as Zo,ac as Bi,ad as fA,ae as ms,af as u3,ag as h3,ah as Uo,ai as E0,aj as Gs,ak as q_,al as Oo,am as dd,an as ww,ao as G_,ap as co,aq as Gf,ar as uo,as as K_,at as Z_,au as f3,av as Rp,aw as y0,ax as Xl,ay as g3,az as w0,aA as p3,aB as Sw,aC as x3,aD as v3,aE as BS,aF as Ws,aG as Tl,aH as Ho,aI as vn,aJ as Bl,aK as m3,aL as al,aM as _r,aN as ro,aO as ka,aP as Dw,aQ as Js,aR as Rs,aS as Fv,aT as xn,aU as gA,aV as _3,aW as Aw,aX as X_,aY as kw,aZ as Bw,a_ as Ud,a$ as b3,b0 as Fw,b1 as C3,b2 as Lw,b3 as Yl,b4 as Ql,b5 as Kf,b6 as Wg,b7 as or,b8 as Np,b9 as Lv,ba as Zb,bb as cs,bc as Iw,bd as Op,be as Y_,bf as E3,bg as pA,bh as zg,bi as Zf,bj as Vg,bk as Hp,bl as Q_,bm as Zn,bn as ud,bo as Wp,bp as y3,bq as w3,br as Pw,bs as S3,bt as Iv,bu as Tr,bv as Tw,bw as Xf,bx as Jl,by as S0,bz as kn,bA as Yf,bB as xA,bC as zp,bD as D3,bE as qd,bF as di,bG as FS,bH as iv,bI as vA,bJ as ra,bK as Ca,bL as hs,bM as Qf,bN as Xr,bO as Jf,bP as Ss,bQ as jg,bR as ch,bS as YC,bT as mA,bU as _A,bV as bA,bW as Mw,bX as Jo,bY as ns,bZ as Vp,b_ as CA,b$ as Ml,c0 as J_,c1 as A3,c2 as nf,c3 as LS,c4 as jp,c5 as EA,c6 as sf,c7 as k3,c8 as jr,c9 as eb,ca as B3,cb as Xo,cc as Ba,cd as $p,ce as $g,cf as yA,cg as Lr,ch as Up,ci as tb,cj as F3,ck as L3,cl as I3,cm as D0,cn as ll,co as ao,cp as P3,cq as Rw,cr as T3,cs as M3,ct as IS,cu as R3,cv as qp,cw as Wl,cx as QC,cy as ju,cz as zl,cA as N3,cB as sl,cC as Yr,cD as gr,cE as PS,cF as Io,cG as Gp,cH as td,cI as cl,cJ as O3,cK as Fa,cL as Ug,cM as ib,cN as wA,cO as H3,cP as W3,cQ as Nw,cR as z3,cS as qg,cT as V3,cU as kc,cV as Gg,cW as TS,cX as j3,cY as $3,cZ as hl,c_ as U3,c$ as Ow,d0 as SA,d1 as DA,d2 as AA,d3 as kA,d4 as q3,d5 as G3,d6 as BA,d7 as FA,d8 as K3,d9 as Hw,da as Z3,db as X3,dc as Fs,dd as Y3,de as Ww,df as Q3,dg as of,dh as MS,di as J3,dj as e4,dk as t4,dl as i4,dm as n4,dn as s4,dp as e0,dq as nb,dr as JC,ds as o4,dt as r4,du as RS,dv as e1,dw as a4,dx as NS,dy as Xb,dz as l4,dA as LA,dB as c4,dC as IA,dD as t1,dE as d4,dF as u4,dG as h4,dH as PA,dI as TA,dJ as f4,dK as Pv,dL as MA,dM as sb,dN as g4,dO as p4,dP as id,dQ as zw,dR as x4,dS as OS,dT as HS,dU as v4,dV as rf,dW as RA,dX as m4,dY as _4,dZ as b4,d_ as C4,d$ as NA,e0 as OA,e1 as HA,e2 as WA,e3 as E4,e4 as ol,e5 as WS,e6 as y4,e7 as Kp,e8 as w4,e9 as eg,ea as zA,eb as zS,ec as Kg,ed as VA,ee as Tv,ef as S4,eg as jA,eh as D4,ei as $A,ej as A4,ek as k4,el as UA,em as qA,en as Vl,eo as ob,ep as B4,eq as GA,er as br,es as Gd,et as KA,eu as F4,ev as L4,ew as ZA,ex as XA,ey as I4,ez as YA,eA as QA,eB as Zg,eC as P4,eD as T4,eE as M4,eF as R4,eG as j0,eH as VS,eI as N4,eJ as O4,eK as H4,eL as Mv,eM as _o,eN as W4,eO as i1,eP as dh,eQ as z4,eR as Al,eS as V4,eT as j4,eU as JA,eV as $4,eW as vg,eX as U4,eY as q4,eZ as G4,e_ as K4,e$ as jS,f0 as $S,f1 as US,f2 as uh,f3 as Vw,f4 as ek,f5 as n1,f6 as nv,f7 as tk,f8 as Rv,f9 as Z4,fa as X4,fb as Y4,fc as Q4,fd as jw,fe as ik,ff as J4,fg as Nv,fh as nk,fi as sk,fj as e7,fk as t7,fl as i7,fm as n7,fn as s7,fo as o7,fp as r7,fq as a7,fr as ok,fs as l7,ft as Ov,fu as rk,fv as c7,fw as ak,fx as d7,fy as lk,fz as ck,fA as u7,fB as qS,fC as dk,fD as GS,fE as h7,fF as Yb,fG as KS,fH as f7,fI as g7,fJ as p7,fK as Xa,fL as nd,fM as x7,fN as ZS,fO as sv,fP as v7,fQ as Fl,fR as rb,fS as s1,fT as m7,fU as uk,fV as hk,fW as Po,fX as XS,fY as Cx,fZ as $w,f_ as _7,f$ as b7,g0 as C7,g1 as E7,g2 as y7,g3 as w7,g4 as S7,g5 as D7,g6 as YS,g7 as A7,g8 as k7,g9 as B7,ga as t0,gb as mg,gc as fk,gd as F7,ge as Uw,gf as ov,gg as Ex,gh as Qb,gi as L7,gj as I7,gk,gl as P7,gm as qw,gn as T7,go as M7,gp as pk,gq as ab,gr as R7,gs as Hv,gt as Gw,gu as Kw,gv as Zw,gw as xk,gx as vk,gy as mk,gz as _k,gA as bk,gB as Ck,gC as Ek,gD as QS,gE as yk,gF as Ph,gG as N7,gH as O7,gI as H7,gJ as W7,gK as wk,gL as z7,gM as V7,gN as JS,gO as o1,gP as Mc,gQ as j7,gR as $7,gS as U7,gT as q7,gU as G7,gV as K7,gW as e8,gX as Xw,gY as r1,gZ as Z7,g_ as a1,g$ as X7,h0 as Y7,h1 as Q7,h2 as J7,h3 as Yw,h4 as Sk,h5 as t8,h6 as i8,h7 as eL,h8 as tL,h9 as iL,ha as n8,hb as Jb,hc as nL,hd as sL,he as oL,hf as eC,hg as Dk,hh as Ak,hi as kk,hj as Bk,hk as jl,hl as Fk,hm as Qw,hn as s8,ho as rL,hp as Lk,hq as aL,hr as lL,hs as lb,ht as cb,hu as hh,hv as db,hw as Zp,hx as cL,hy as ub,hz as dL,hA as uL,hB as hL,hC as Ik,hD as $0,hE as fL,hF as gL,hG as pL,hH as xL,hI as Xp,hJ as vL,hK as Pk,hL as Tk,hM as Mk,hN as l1,hO as mL,hP as _L,hQ as bL,hR as CL,hS as EL,hT as c1,hU as yL,hV as wL,hW as SL,hX as DL,hY as AL,hZ as kL,h_ as BL,h$ as FL,i0 as Rk,i1 as LL,i2 as IL,i3 as PL,i4 as o8,i5 as TL,i6 as ML,i7 as Ld,i8 as dr,i9 as d1,ia as Nk,ib as RL,ic as NL}from"./monaco-langs-Dt8a9eeo.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 Ok=!1;var Jw=Array.isArray,OL=Array.prototype.indexOf,Wv=Array.prototype.includes,hb=Array.from,HL=Object.defineProperty,yf=Object.getOwnPropertyDescriptor,WL=Object.getOwnPropertyDescriptors,zL=Object.prototype,VL=Array.prototype,Hk=Object.getPrototypeOf,r8=Object.isExtensible;const fb=()=>{};function jL(o){for(var e=0;e<o.length;e++)o[e]()}function Wk(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function $L(o,e,t=!1){return o===void 0?t?e():e:o}function a8(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 Ro=2,i0=4,gb=8,zk=1<<24,Ea=16,wa=32,sd=64,u1=128,ea=512,bo=1024,Ao=2048,dl=4096,tr=8192,ta=16384,A0=32768,h1=1<<25,n0=65536,zv=1<<17,UL=1<<18,k0=1<<19,qL=1<<20,el=1<<25,$u=65536,Vv=1<<21,wf=1<<22,Rc=1<<23,Kd=Symbol("$state"),GL=Symbol("legacy props"),KL=Symbol(""),rv=Symbol("attributes"),f1=Symbol("class"),g1=Symbol("style"),tg=Symbol("text"),av=Symbol("form reset"),pb=new class extends Error{constructor(){super(...arguments);Un(this,"name","StaleReactionError");Un(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var oA;const ZL=!!((oA=globalThis.document)!=null&&oA.contentType)&&globalThis.document.contentType.includes("xml");function Vk(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function XL(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function YL(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function QL(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function JL(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function eI(o){throw new Error("https://svelte.dev/e/effect_orphan")}function tI(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function iI(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function nI(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function sI(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function oI(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function rI(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const aI=1,lI=2,jk=4,cI=8,dI=16,uI=1,hI=4,fI=8,gI=16,pI=1,xI=2,mo=Symbol("uninitialized"),$k="http://www.w3.org/1999/xhtml",vI="http://www.w3.org/2000/svg",mI="http://www.w3.org/1998/Math/MathML";function _I(){console.warn("https://svelte.dev/e/derived_inert")}function bI(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function CI(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Uk(o){return o===this.v}function EI(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function qk(o){return!EI(o,this.v)}let yI=!1,Mo=null;function s0(o){Mo=o}function Zs(o,e=!1,t){Mo={p:Mo,i:!1,c:null,e:null,s:o,x:null,r:ss,l:null}}function Xs(o){var e=Mo,t=e.e;if(t!==null){e.e=null;for(var i of t)g6(i)}return o!==void 0&&(e.x=o),e.i=!0,Mo=e.p,o??{}}function Gk(){return!0}let Rd=[];function Kk(){var o=Rd;Rd=[],jL(o)}function Nc(o){if(Rd.length===0&&!bg){var e=Rd;queueMicrotask(()=>{e===Rd&&Kk()})}Rd.push(o)}function wI(){for(;Rd.length>0;)Kk()}function Zk(o){var e=ss;if(e===null)return is.f|=Rc,o;if((e.f&A0)===0&&(e.f&i0)===0)throw o;Bc(o,e)}function Bc(o,e){for(;e!==null;){if((e.f&u1)!==0){if((e.f&A0)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const SI=-7169;function no(o,e){o.f=o.f&SI|e}function e9(o){(o.f&ea)!==0||o.deps===null?no(o,bo):no(o,dl)}function Xk(o){if(o!==null)for(const e of o)(e.f&Ro)===0||(e.f&$u)===0||(e.f^=$u,Xk(e.deps))}function Yk(o,e,t){(o.f&Ao)!==0?e.add(o):(o.f&dl)!==0&&t.add(o),Xk(o.deps),no(o,bo)}let yx=!1;function DI(o){var e=yx;try{return yx=!1,[o(),yx]}finally{yx=e}}let tC=null,Th=null,fn=null,_g=null,Lo=null,p1=null,bg=!1,iC=!1,af=null,lv=null;var l8=0;let AI=1;var kf,Sc,Wd,Bf,Ff,Lf,yl,If,ur,kp,wl,ha,qa,Pf,zd,Ls,x1,ig,v1,Qk,Jk,Xh,kI,ng;const Jm=class Jm{constructor(){In(this,Ls);Un(this,"id",AI++);In(this,kf,!1);Un(this,"linked",!0);In(this,Sc,null);In(this,Wd,null);Un(this,"async_deriveds",new Map);Un(this,"current",new Map);Un(this,"previous",new Map);In(this,Bf,new Set);In(this,Ff,new Set);In(this,Lf,0);In(this,yl,new Map);In(this,If,null);In(this,ur,[]);In(this,kp,[]);In(this,wl,new Set);In(this,ha,new Set);In(this,qa,new Map);In(this,Pf,new Set);Un(this,"is_fork",!1);In(this,zd,!1);Th===null?tC=Th=this:(Pn(Th,Wd,this),Pn(this,Sc,Th)),Th=this}skip_effect(e){ke(this,qa).has(e)||ke(this,qa).set(e,{d:[],m:[]}),ke(this,Pf).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=ke(this,qa).get(e);if(i){ke(this,qa).delete(e);for(var n of i.d)no(n,Ao),t(n);for(n of i.m)no(n,dl),t(n)}ke(this,Pf).add(e)}capture(e,t,i=!1){e.v!==mo&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Rc)===0&&(this.current.set(e,[t,i]),Lo==null||Lo.set(e,t)),this.is_fork||(e.v=t)}activate(){fn=this}deactivate(){fn=null,Lo=null}flush(){try{iC=!0,fn=this,vs(this,Ls,ig).call(this)}finally{l8=0,p1=null,af=null,lv=null,iC=!1,fn=null,Lo=null,Zd.clear()}}discard(){var e;for(const t of ke(this,Ff))t(this);ke(this,Ff).clear(),vs(this,Ls,ng).call(this),(e=ke(this,If))==null||e.resolve()}register_created_effect(e){ke(this,kp).push(e)}increment(e,t){if(Pn(this,Lf,ke(this,Lf)+1),e){let i=ke(this,yl).get(t)??0;ke(this,yl).set(t,i+1)}}decrement(e,t){if(Pn(this,Lf,ke(this,Lf)-1),e){let i=ke(this,yl).get(t)??0;i===1?ke(this,yl).delete(t):ke(this,yl).set(t,i-1)}ke(this,zd)||(Pn(this,zd,!0),Nc(()=>{Pn(this,zd,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)ke(this,wl).add(i);for(const i of t)ke(this,ha).add(i);e.clear(),t.clear()}oncommit(e){ke(this,Bf).add(e)}ondiscard(e){ke(this,Ff).add(e)}settled(){return(ke(this,If)??Pn(this,If,Wk())).promise}static ensure(){if(fn===null){const e=fn=new Jm;!iC&&!bg&&Nc(()=>{ke(e,kf)||e.flush()})}return fn}apply(){{Lo=null;return}}schedule(e){var n;if(p1=e,(n=e.b)!=null&&n.is_pending&&(e.f&(i0|gb|zk))!==0&&(e.f&A0)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(af!==null&&t===ss&&(is===null||(is.f&Ro)===0))return;if((i&(sd|wa))!==0){if((i&bo)===0)return;t.f^=bo}}ke(this,ur).push(t)}};kf=new WeakMap,Sc=new WeakMap,Wd=new WeakMap,Bf=new WeakMap,Ff=new WeakMap,Lf=new WeakMap,yl=new WeakMap,If=new WeakMap,ur=new WeakMap,kp=new WeakMap,wl=new WeakMap,ha=new WeakMap,qa=new WeakMap,Pf=new WeakMap,zd=new WeakMap,Ls=new WeakSet,x1=function(){if(this.is_fork)return!0;for(const i of ke(this,yl).keys()){for(var e=i,t=!1;e.parent!==null;){if(ke(this,qa).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},ig=function(){var d,u,f,g;Pn(this,kf,!0),l8++>1e3&&(vs(this,Ls,ng).call(this),FI());for(const p of ke(this,wl))ke(this,ha).delete(p),no(p,Ao),this.schedule(p);for(const p of ke(this,ha))no(p,dl),this.schedule(p);const e=ke(this,ur);Pn(this,ur,[]),this.apply();var t=af=[],i=[],n=lv=[];for(const p of e)try{vs(this,Ls,v1).call(this,p,t,i)}catch(C){throw i6(p),vs(this,Ls,x1).call(this)||this.discard(),C}if(fn=null,n.length>0){var s=Jm.ensure();for(const p of n)s.schedule(p)}if(af=null,lv=null,vs(this,Ls,x1).call(this)){vs(this,Ls,Xh).call(this,i),vs(this,Ls,Xh).call(this,t);for(const[p,C]of ke(this,qa))t6(p,C);n.length>0&&vs(d=fn,Ls,ig).call(d);return}const r=vs(this,Ls,Qk).call(this);if(r){vs(this,Ls,Xh).call(this,i),vs(this,Ls,Xh).call(this,t),vs(u=r,Ls,Jk).call(u,this);return}ke(this,wl).clear(),ke(this,ha).clear();for(const p of ke(this,Bf))p(this);ke(this,Bf).clear(),_g=this,c8(i),c8(t),_g=null,(f=ke(this,If))==null||f.resolve();var a=fn;if(ke(this,Lf)===0&&(ke(this,ur).length===0||a!==null)&&vs(this,Ls,ng).call(this),ke(this,ur).length>0)if(a!==null){const p=a;ke(p,ur).push(...ke(this,ur).filter(C=>!ke(p,ur).includes(C)))}else a=this;a!==null&&vs(g=a,Ls,ig).call(g)},v1=function(e,t,i){e.f^=bo;for(var n=e.first;n!==null;){var s=n.f,r=(s&(wa|sd))!==0,a=r&&(s&bo)!==0,d=a||(s&tr)!==0||ke(this,qa).has(n);if(!d&&n.fn!==null){r?n.f^=bo:(s&i0)!==0?t.push(n):Qp(n)&&((s&Ea)!==0&&ke(this,ha).add(n),r0(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}}},Qk=function(){for(var e=ke(this,Sc);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=ke(e,Sc)}return null},Jk=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(ke(e,wl),ke(e,ha));const t=n=>{var s=n.reactions;if(s!==null)for(const d of s){var r=d.f;if((r&Ro)!==0)t(d);else{var a=d;r&(wf|Ea)&&!this.async_deriveds.has(a)&&(ke(this,ha).delete(a),no(a,Ao),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),vs(i=e,Ls,ng).call(i),fn=this,vs(this,Ls,ig).call(this)},Xh=function(e){for(var t=0;t<e.length;t+=1)Yk(e[t],ke(this,wl),ke(this,ha))},kI=function(){var f;for(let g=tC;g!==null;g=ke(g,Wd)){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(ke(g,kf)){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 ke(this,Pf))g.unskip_effect(p,C=>{var b;(C.f&(Ea|wf))!==0?g.schedule(C):vs(b=g,Ls,Xh).call(b,[C])});g.activate();var s=new Set,r=new Map;for(var a of t)e6(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 ke(this,kp))(p.f&(ta|tr|zv))===0&&t9(p,d,r)&&((p.f&(wf|Ea))!==0?(no(p,Ao),g.schedule(p)):ke(g,wl).add(p));if(ke(g,ur).length>0&&!ke(g,zd)){g.apply();for(var u of ke(g,ur))vs(f=g,Ls,v1).call(f,u,[],[]);Pn(g,ur,[])}g.deactivate()}}}},ng=function(){if(this.linked){var e=ke(this,Sc),t=ke(this,Wd);e===null?tC=t:Pn(e,Wd,t),t===null?Th=e:Pn(t,Sc,e),this.linked=!1}};let Uu=Jm;function BI(o){var e=bg;bg=!0;try{for(var t;;){if(wI(),fn===null)return t;fn.flush()}}finally{bg=e}}function FI(){try{tI()}catch(o){Bc(o,p1)}}let ca=null;function c8(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(ta|tr))===0&&Qp(i)&&(ca=new Set,r0(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&v6(i),(ca==null?void 0:ca.size)>0)){Zd.clear();for(const n of ca){if((n.f&(ta|tr))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)ca.has(r)&&(ca.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const d=s[a];(d.f&(ta|tr))===0&&r0(d)}}ca.clear()}}ca=null}}function e6(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&Ro)!==0?e6(n,e,t,i):(s&(wf|Ea))!==0&&(s&Ao)===0&&t9(n,e,i)&&(no(n,Ao),i9(n))}}function t9(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(Wv.call(e,n))return!0;if((n.f&Ro)!==0&&t9(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function i9(o){fn.schedule(o)}function t6(o,e){if(!((o.f&wa)!==0&&(o.f&bo)!==0)){(o.f&Ao)!==0?e.d.push(o):(o.f&dl)!==0&&e.m.push(o),no(o,bo);for(var t=o.first;t!==null;)t6(t,e),t=t.next}}function i6(o){no(o,bo);for(var e=o.first;e!==null;)i6(e),e=e.next}function LI(o){let e=0,t=qu(0),i;return()=>{r9()&&(l(t),vb(()=>(e===0&&(i=tc(()=>o(()=>Cg(t)))),e+=1,()=>{Nc(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Cg(t))})})))}}var II=n0|k0;function PI(o,e,t,i){new TI(o,e,t,i)}var Ur,yw,qr,Vd,hr,Gr,Yo,Ar,Sl,jd,Dc,Tf,Bp,Fp,Dl,e_,so,MI,RI,NI,m1,cv,dv,_1,b1;class TI{constructor(e,t,i,n){In(this,so);Un(this,"parent");Un(this,"is_pending",!1);Un(this,"transform_error");In(this,Ur);In(this,yw,null);In(this,qr);In(this,Vd);In(this,hr);In(this,Gr,null);In(this,Yo,null);In(this,Ar,null);In(this,Sl,null);In(this,jd,0);In(this,Dc,0);In(this,Tf,!1);In(this,Bp,new Set);In(this,Fp,new Set);In(this,Dl,null);In(this,e_,LI(()=>(Pn(this,Dl,qu(ke(this,jd))),()=>{Pn(this,Dl,null)})));var s;Pn(this,Ur,e),Pn(this,qr,t),Pn(this,Vd,r=>{var a=ss;a.b=this,a.f|=u1,i(r)}),this.parent=ss.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),Pn(this,hr,c9(()=>{vs(this,so,m1).call(this)},II))}defer_effect(e){Yk(e,ke(this,Bp),ke(this,Fp))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!ke(this,qr).pending}update_pending_count(e,t){vs(this,so,_1).call(this,e,t),Pn(this,jd,ke(this,jd)+e),!(!ke(this,Dl)||ke(this,Tf))&&(Pn(this,Tf,!0),Nc(()=>{Pn(this,Tf,!1),ke(this,Dl)&&o0(ke(this,Dl),ke(this,jd))}))}get_effect_pending(){return ke(this,e_).call(this),l(ke(this,Dl))}error(e){if(!ke(this,qr).onerror&&!ke(this,qr).failed)throw e;fn!=null&&fn.is_fork?(ke(this,Gr)&&fn.skip_effect(ke(this,Gr)),ke(this,Yo)&&fn.skip_effect(ke(this,Yo)),ke(this,Ar)&&fn.skip_effect(ke(this,Ar)),fn.oncommit(()=>{vs(this,so,b1).call(this,e)})):vs(this,so,b1).call(this,e)}}Ur=new WeakMap,yw=new WeakMap,qr=new WeakMap,Vd=new WeakMap,hr=new WeakMap,Gr=new WeakMap,Yo=new WeakMap,Ar=new WeakMap,Sl=new WeakMap,jd=new WeakMap,Dc=new WeakMap,Tf=new WeakMap,Bp=new WeakMap,Fp=new WeakMap,Dl=new WeakMap,e_=new WeakMap,so=new WeakSet,MI=function(){try{Pn(this,Gr,Kr(()=>ke(this,Vd).call(this,ke(this,Ur))))}catch(e){this.error(e)}},RI=function(e){const t=ke(this,qr).failed;t&&Pn(this,Ar,Kr(()=>{t(ke(this,Ur),()=>e,()=>()=>{})}))},NI=function(){const e=ke(this,qr).pending;e&&(this.is_pending=!0,Pn(this,Yo,Kr(()=>e(ke(this,Ur)))),Nc(()=>{var t=Pn(this,Sl,document.createDocumentFragment()),i=Rl();t.append(i),Pn(this,Gr,vs(this,so,dv).call(this,()=>Kr(()=>ke(this,Vd).call(this,i)))),ke(this,Dc)===0&&(ke(this,Ur).before(t),Pn(this,Sl,null),Yd(ke(this,Yo),()=>{Pn(this,Yo,null)}),vs(this,so,cv).call(this,fn))}))},m1=function(){try{if(this.is_pending=this.has_pending_snippet(),Pn(this,Dc,0),Pn(this,jd,0),Pn(this,Gr,Kr(()=>{ke(this,Vd).call(this,ke(this,Ur))})),ke(this,Dc)>0){var e=Pn(this,Sl,document.createDocumentFragment());u9(ke(this,Gr),e);const t=ke(this,qr).pending;Pn(this,Yo,Kr(()=>t(ke(this,Ur))))}else vs(this,so,cv).call(this,fn)}catch(t){this.error(t)}},cv=function(e){this.is_pending=!1,e.transfer_effects(ke(this,Bp),ke(this,Fp))},dv=function(e){var t=ss,i=is,n=Mo;ul(ke(this,hr)),sa(ke(this,hr)),s0(ke(this,hr).ctx);try{return Uu.ensure(),e()}catch(s){return Zk(s),null}finally{ul(t),sa(i),s0(n)}},_1=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&vs(i=this.parent,so,_1).call(i,e,t);return}Pn(this,Dc,ke(this,Dc)+e),ke(this,Dc)===0&&(vs(this,so,cv).call(this,t),ke(this,Yo)&&Yd(ke(this,Yo),()=>{Pn(this,Yo,null)}),ke(this,Sl)&&(ke(this,Ur).before(ke(this,Sl)),Pn(this,Sl,null)))},b1=function(e){ke(this,Gr)&&(Cr(ke(this,Gr)),Pn(this,Gr,null)),ke(this,Yo)&&(Cr(ke(this,Yo)),Pn(this,Yo,null)),ke(this,Ar)&&(Cr(ke(this,Ar)),Pn(this,Ar,null));var t=ke(this,qr).onerror;let i=ke(this,qr).failed;var n=!1,s=!1;const r=()=>{if(n){CI();return}n=!0,s&&rI(),ke(this,Ar)!==null&&Yd(ke(this,Ar),()=>{Pn(this,Ar,null)}),vs(this,so,dv).call(this,()=>{vs(this,so,m1).call(this)})},a=d=>{try{s=!0,t==null||t(d,r),s=!1}catch(u){Bc(u,ke(this,hr)&&ke(this,hr).parent)}i&&Pn(this,Ar,vs(this,so,dv).call(this,()=>{try{return Kr(()=>{var u=ss;u.b=this,u.f|=u1,i(ke(this,Ur),()=>d,()=>r)})}catch(u){return Bc(u,ke(this,hr).parent),null}}))};Nc(()=>{var d;try{d=this.transform_error(e)}catch(u){Bc(u,ke(this,hr)&&ke(this,hr).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(a,u=>Bc(u,ke(this,hr)&&ke(this,hr).parent)):a(d)})};function OI(o,e,t,i){const n=Xg;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=ss,a=HI(),d=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((r.f&ta)===0){a();try{i(p)}catch(C){Bc(C,r)}jv()}}var f=n6();if(t.length===0){d.then(()=>u(e.map(n))).finally(f);return}function g(){Promise.all(t.map(p=>WI(p))).then(p=>u([...e.map(n),...p])).catch(p=>Bc(p,r)).finally(f)}d?d.then(()=>{a(),g(),jv()}):g()}function HI(){var o=ss,e=is,t=Mo,i=fn;return function(s=!0){ul(o),sa(e),s0(t),s&&(o.f&ta)===0&&(i==null||i.activate(),i==null||i.apply())}}function jv(o=!0){ul(null),sa(null),s0(null),o&&(fn==null||fn.deactivate())}function n6(){var o=ss,e=o.b,t=fn,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 Xg(o){var e=Ro|Ao;return ss!==null&&(ss.f|=k0),{ctx:Mo,deps:null,effects:null,equals:Uk,f:e,fn:o,reactions:null,rv:0,v:mo,wv:0,parent:ss,ac:null}}const wx=Symbol("obsolete");function WI(o,e,t){let i=ss;i===null&&XL();var n=void 0,s=qu(mo),r=!is,a=new Set;return QI(()=>{var C,b;var d=ss,u=Wk();n=u.promise;try{Promise.resolve(o()).then(u.resolve,E=>{E!==pb&&u.reject(E)}).finally(jv)}catch(E){u.reject(E),jv()}var f=fn;if(r){if((d.f&A0)!==0)var g=n6();if((C=i.b)!=null&&C.is_rendered())(b=f.async_deriveds.get(d))==null||b.reject(wx);else for(const E of a.values())E.reject(wx);a.add(u),f.async_deriveds.set(d,u)}const p=(E,y=void 0)=>{g==null||g(),a.delete(u),y!==wx&&(f.activate(),y?(s.f|=Rc,o0(s,y)):((s.f&Rc)!==0&&(s.f^=Rc),o0(s,E)),f.deactivate())};u.promise.then(p,E=>p(null,E||"unknown"))}),a9(()=>{for(const d of a)d.reject(wx)}),new Promise(d=>{function u(f){function g(){f===n?d(s):u(n)}f.then(g,g)}u(n)})}function At(o){const e=Xg(o);return b6(e),e}function n9(o){const e=Xg(o);return e.equals=qk,e}function zI(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)Cr(e[t])}}function s9(o){var e,t=ss,i=o.parent;if(!$l&&i!==null&&o.v!==mo&&(i.f&(ta|tr))!==0)return _I(),o.v;ul(i);try{o.f&=~$u,zI(o),e=w6(o)}finally{ul(t)}return e}function s6(o){var e=s9(o);if(!o.equals(e)&&(o.wv=E6(),(!(fn!=null&&fn.is_fork)||o.deps===null)&&(fn!==null?(fn.capture(o,e,!0),_g==null||_g.capture(o,e,!0)):o.v=e,o.deps===null))){no(o,bo);return}$l||(Lo!==null?(r9()||fn!=null&&fn.is_fork)&&Lo.set(o,e):e9(o))}function VI(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(pb),i.fn!==null&&(i.teardown=fb),i.ac=null,Yg(i,0),d9(i))}function o6(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&r0(e)}let $v=new Set;const Zd=new Map;let r6=!1;function qu(o,e){var t={f:0,v:o,reactions:null,equals:Uk,rv:0,wv:0};return t}function B(o,e){const t=qu(o);return b6(t),t}function jI(o,e=!1,t=!0){const i=qu(o);return e||(i.equals=qk),i}function x(o,e,t=!1){is!==null&&(!ya||(is.f&zv)!==0)&&Gk()&&(is.f&(Ro|Ea|wf|zv))!==0&&(rl===null||!rl.has(o))&&oI();let i=t?_i(e):e;return o0(o,i,lv)}function o0(o,e,t=null){if(!o.equals(e)){Zd.set(o,$l?e:o.v);var i=Uu.ensure();if(i.capture(o,e),(o.f&Ro)!==0){const n=o;(o.f&Ao)!==0&&s9(n),Lo===null&&e9(n)}o.wv=E6(),a6(o,Ao,t),ss!==null&&(ss.f&bo)!==0&&(ss.f&(wa|sd))===0&&($r===null?eP([o]):$r.push(o)),!i.is_fork&&$v.size>0&&!r6&&$I()}return e}function $I(){r6=!1;for(const o of $v){(o.f&bo)!==0&&no(o,dl);let e;try{e=Qp(o)}catch{e=!0}e&&r0(o)}$v.clear()}function d8(o,e=1){var t=l(o),i=e===1?t++:t--;return x(o,t),i}function Cg(o){x(o,o.v+1)}function a6(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&Ao)===0;if(d&&no(r,e),(a&zv)!==0)$v.add(r);else if((a&Ro)!==0){var u=r;Lo==null||Lo.delete(u),(a&$u)===0&&(a&ea&&(ss===null||(ss.f&Vv)===0)&&(r.f|=$u),a6(u,dl,t))}else if(d){var f=r;(a&Ea)!==0&&ca!==null&&ca.add(f),t!==null?t.push(f):i9(f)}}}function _i(o){if(typeof o!="object"||o===null||Kd in o)return o;const e=Hk(o);if(e!==zL&&e!==VL)return o;var t=new Map,i=Jw(o),n=B(0),s=Qd,r=a=>{if(Qd===s)return a();var d=is,u=Qd;sa(null),g8(s);var f=a();return sa(d),g8(u),f};return i&&t.set("length",B(o.length)),new Proxy(o,{defineProperty(a,d,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&nI();var f=t.get(d);return f===void 0?r(()=>{var g=B(u.value);return t.set(d,g),g}):x(f,u.value,!0),!0},deleteProperty(a,d){var u=t.get(d);if(u===void 0){if(d in a){const f=r(()=>B(mo));t.set(d,f),Cg(n)}}else x(u,mo),Cg(n);return!0},get(a,d,u){var C;if(d===Kd)return o;var f=t.get(d),g=d in a;if(f===void 0&&(!g||(C=yf(a,d))!=null&&C.writable)&&(f=r(()=>{var b=_i(g?a[d]:mo),E=B(b);return E}),t.set(d,f)),f!==void 0){var p=l(f);return p===mo?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=l(f))}else if(u===void 0){var g=t.get(d),p=g==null?void 0:g.v;if(g!==void 0&&p!==mo)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(a,d){var p;if(d===Kd)return!0;var u=t.get(d),f=u!==void 0&&u.v!==mo||Reflect.has(a,d);if(u!==void 0||ss!==null&&(!f||(p=yf(a,d))!=null&&p.writable)){u===void 0&&(u=r(()=>{var C=f?_i(a[d]):mo,b=B(C);return b}),t.set(d,u));var g=l(u);if(g===mo)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?x(b,mo):C in a&&(b=r(()=>B(mo)),t.set(C+"",b))}if(g===void 0)(!p||(M=yf(a,d))!=null&&M.writable)&&(g=r(()=>B(void 0)),x(g,_i(u)),t.set(d,g));else{p=g.v!==mo;var E=r(()=>_i(u));x(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 A=t.get("length"),I=Number(d);Number.isInteger(I)&&I>=A.v&&x(A,I+1)}Cg(n)}return!0},ownKeys(a){l(n);var d=Reflect.ownKeys(a).filter(g=>{var p=t.get(g);return p===void 0||p.v!==mo});for(var[u,f]of t)f.v!==mo&&!(u in a)&&d.push(u);return d},setPrototypeOf(){sI()}})}function u8(o){try{if(o!==null&&typeof o=="object"&&Kd in o)return o[Kd]}catch{}return o}function UI(o,e){return Object.is(u8(o),u8(e))}var Xd,l6,c6,d6,u6;function qI(){if(Xd===void 0){Xd=window,l6=document,c6=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;d6=yf(e,"firstChild").get,u6=yf(e,"nextSibling").get,r8(o)&&(o[f1]=void 0,o[rv]=null,o[g1]=void 0,o.__e=void 0),r8(t)&&(t[tg]=void 0)}}function Rl(o=""){return document.createTextNode(o)}function tl(o){return d6.call(o)}function Yp(o){return u6.call(o)}function m(o,e){return tl(o)}function dt(o,e=!1){{var t=tl(o);return t instanceof Comment&&t.data===""?Yp(t):t}}function v(o,e=1,t=!1){let i=o;for(;e--;)i=Yp(i);return i}function GI(o){o.textContent=""}function h6(){return!1}function f6(o,e,t){return e==null||e===$k?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let h8=!1;function KI(){h8||(h8=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[av])==null||e.call(t)})},{capture:!0}))}function xb(o){var e=is,t=ss;sa(null),ul(null);try{return o()}finally{sa(e),ul(t)}}function o9(o,e,t,i=t){o.addEventListener(e,()=>xb(t));const n=o[av];n?o[av]=()=>{n(),i(!0)}:o[av]=()=>i(!0),KI()}function ZI(o){ss===null&&(is===null&&eI(),JL()),$l&&QL()}function XI(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function ec(o,e){var t=ss;t!==null&&(t.f&tr)!==0&&(o|=tr);var i={ctx:Mo,deps:null,nodes:null,f:o|Ao|ea,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};fn==null||fn.register_created_effect(i);var n=i;if((o&i0)!==0)af!==null?af.push(i):Uu.ensure().schedule(i);else if(e!==null){try{r0(i)}catch(r){throw Cr(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&k0)===0&&(n=n.first,(o&Ea)!==0&&(o&n0)!==0&&n!==null&&(n.f|=n0))}if(n!==null&&(n.parent=t,t!==null&&XI(n,t),is!==null&&(is.f&Ro)!==0&&(o&sd)===0)){var s=is;(s.effects??(s.effects=[])).push(n)}return i}function r9(){return is!==null&&!ya}function a9(o){const e=ec(gb,null);return no(e,bo),e.teardown=o,e}function us(o){ZI();var e=ss.f,t=!is&&(e&wa)!==0&&Mo!==null&&!Mo.i;if(t){var i=Mo;(i.e??(i.e=[])).push(o)}else return g6(o)}function g6(o){return ec(i0|qL,o)}function YI(o){Uu.ensure();const e=ec(sd|k0,o);return(t={})=>new Promise(i=>{t.outro?Yd(e,()=>{Cr(e),i(void 0)}):(Cr(e),i(void 0))})}function l9(o){return ec(i0,o)}function QI(o){return ec(wf|k0,o)}function vb(o,e=0){return ec(gb|e,o)}function z(o,e=[],t=[],i=[]){OI(i,e,t,n=>{ec(gb,()=>o(...n.map(l)))})}function c9(o,e=0){var t=ec(Ea|e,o);return t}function Kr(o){return ec(wa|k0,o)}function p6(o){var e=o.teardown;if(e!==null){const t=$l,i=is;f8(!0),sa(null);try{e.call(null)}finally{f8(t),sa(i)}}}function d9(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&xb(()=>{n.abort(pb)});var i=t.next;(t.f&sd)!==0?t.parent=null:Cr(t,e),t=i}}function JI(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&wa)===0&&Cr(e),e=t}}function Cr(o,e=!0){var t=!1;(e||(o.f&UL)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(x6(o.nodes.start,o.nodes.end),t=!0),no(o,h1),d9(o,e&&!t),Yg(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();p6(o),o.f^=h1,o.f|=ta;var n=o.parent;n!==null&&n.first!==null&&v6(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function x6(o,e){for(;o!==null;){var t=o===e?null:Yp(o);o.remove(),o=t}}function v6(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 Yd(o,e,t=!0){var i=[];m6(o,i,!0);var n=()=>{t&&Cr(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function m6(o,e,t){if((o.f&tr)===0){o.f^=tr;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&sd)===0){var r=(n.f&n0)!==0||(n.f&wa)!==0&&(o.f&Ea)!==0;m6(n,e,r?t:!1)}n=s}}}function Uv(o){_6(o,!0)}function _6(o,e){if((o.f&tr)!==0){o.f^=tr,(o.f&bo)===0&&(no(o,Ao),Uu.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&n0)!==0||(t.f&wa)!==0;_6(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 u9(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:Yp(t);e.append(t),t=n}}let uv=!1,$l=!1;function f8(o){$l=o}let is=null,ya=!1;function sa(o){is=o}let ss=null;function ul(o){ss=o}let rl=null;function b6(o){is!==null&&(rl??(rl=new Set)).add(o)}let fr=null,Sr=0,$r=null;function eP(o){$r=o}let C6=1,Nd=0,Qd=Nd;function g8(o){Qd=o}function E6(){return++C6}function Qp(o){var e=o.f;if((e&Ao)!==0)return!0;if(e&Ro&&(o.f&=~$u),(e&dl)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(Qp(s)&&s6(s),s.wv>o.wv)return!0}(e&ea)!==0&&Lo===null&&no(o,bo)}return!1}function y6(o,e,t=!0){var i=o.reactions;if(i!==null&&!(rl!==null&&rl.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&Ro)!==0?y6(s,e,!1):e===s&&(t?no(s,Ao):(s.f&bo)!==0&&no(s,dl),i9(s))}}function w6(o){var E;var e=fr,t=Sr,i=$r,n=is,s=rl,r=Mo,a=ya,d=Qd,u=o.f;fr=null,Sr=0,$r=null,is=(u&(wa|sd))===0?o:null,rl=null,s0(o.ctx),ya=!1,Qd=++Nd,o.ac!==null&&(xb(()=>{o.ac.abort(pb)}),o.ac=null);try{o.f|=Vv;var f=o.fn,g=f();o.f|=A0;var p=o.deps,C=fn==null?void 0:fn.is_fork;if(fr!==null){var b;if(C||Yg(o,Sr),p!==null&&Sr>0)for(p.length=Sr+fr.length,b=0;b<fr.length;b++)p[Sr+b]=fr[b];else o.deps=p=fr;if(r9()&&(o.f&ea)!==0)for(b=Sr;b<p.length;b++)((E=p[b]).reactions??(E.reactions=[])).push(o)}else!C&&p!==null&&Sr<p.length&&(Yg(o,Sr),p.length=Sr);if(Gk()&&$r!==null&&!ya&&p!==null&&(o.f&(Ro|dl|Ao))===0)for(b=0;b<$r.length;b++)y6($r[b],o);if(n!==null&&n!==o){if(Nd++,n.deps!==null)for(let y=0;y<t;y+=1)n.deps[y].rv=Nd;if(e!==null)for(const y of e)y.rv=Nd;$r!==null&&(i===null?i=$r:i.push(...$r))}return(o.f&Rc)!==0&&(o.f^=Rc),g}catch(y){return Zk(y)}finally{o.f^=Vv,fr=e,Sr=t,$r=i,is=n,rl=s,s0(r),ya=a,Qd=d}}function tP(o,e){let t=e.reactions;if(t!==null){var i=OL.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&Ro)!==0&&(fr===null||!Wv.call(fr,e))){var s=e;(s.f&ea)!==0&&(s.f^=ea,s.f&=~$u),s.v!==mo&&e9(s),VI(s),Yg(s,0)}}function Yg(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)tP(o,t[i])}function r0(o){var e=o.f;if((e&ta)===0){no(o,bo);var t=ss,i=uv;ss=o,uv=!0;try{(e&(Ea|zk))!==0?JI(o):d9(o),p6(o);var n=w6(o);o.teardown=typeof n=="function"?n:null,o.wv=C6;var s;Ok&&yI&&(o.f&Ao)!==0&&o.deps}finally{uv=i,ss=t}}}async function kl(){await Promise.resolve(),BI()}function l(o){var e=o.f,t=(e&Ro)!==0;if(is!==null&&!ya){var i=ss!==null&&(ss.f&ta)!==0;if(!i&&(rl===null||!rl.has(o))){var n=is.deps;if((is.f&Vv)!==0)o.rv<Nd&&(o.rv=Nd,fr===null&&n!==null&&n[Sr]===o?Sr++:fr===null?fr=[o]:fr.push(o));else{is.deps??(is.deps=[]),Wv.call(is.deps,o)||is.deps.push(o);var s=o.reactions;s===null?o.reactions=[is]:Wv.call(s,is)||s.push(is)}}}if($l&&Zd.has(o))return Zd.get(o);if(t){var r=o;if($l){var a=r.v;return((r.f&bo)===0&&r.reactions!==null||D6(r))&&(a=s9(r)),Zd.set(r,a),a}var d=(r.f&ea)===0&&!ya&&is!==null&&(uv||(is.f&ea)!==0),u=(r.f&A0)===0;Qp(r)&&(d&&(r.f|=ea),s6(r)),d&&!u&&(o6(r),S6(r))}if(Lo!=null&&Lo.has(o))return Lo.get(o);if((o.f&Rc)!==0)throw o.v;return o.v}function S6(o){if(o.f|=ea,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&Ro)!==0&&(e.f&ea)===0&&(o6(e),S6(e))}function D6(o){if(o.v===mo)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(Zd.has(e)||(e.f&Ro)!==0&&D6(e))return!0;return!1}function tc(o){var e=ya;try{return ya=!0,o()}finally{ya=e}}const iP=["touchstart","touchmove"];function nP(o){return iP.includes(o)}const Od=Symbol("events"),A6=new Set,C1=new Set;function sP(o,e,t,i={}){function n(s){if(i.capture||E1.call(e,s),!s.cancelBubble)return xb(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?Nc(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function Ts(o,e,t,i,n){var s={capture:i,passive:n},r=sP(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&a9(()=>{e.removeEventListener(o,r,s)})}function j(o,e,t){(e[Od]??(e[Od]={}))[o]=t}function lo(o){for(var e=0;e<o.length;e++)A6.add(o[e]);for(var t of C1)t(o)}let p8=null;function E1(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;p8=o;var r=0,a=p8===o&&o[Od];if(a){var d=n.indexOf(a);if(d!==-1&&(e===document||e===window)){o[Od]=e;return}var u=n.indexOf(e);if(u===-1)return;d<=u&&(r=d)}if(s=n[r]||o.target,s!==e){HL(o,"currentTarget",{configurable:!0,get(){return s||t}});var f=is,g=ss;sa(null),ul(null);try{for(var p,C=[];s!==null&&s!==e;){try{var b=(y=s[Od])==null?void 0:y[i];b!=null&&(!s.disabled||o.target===s)&&b.call(s,o)}catch(A){p?C.push(A):p=A}if(o.cancelBubble)break;r++,s=r<n.length?n[r]:null}if(p){for(let A of C)queueMicrotask(()=>{throw A});throw p}}finally{o[Od]=e,delete o.currentTarget,sa(f),ul(g)}}}var rA;const nC=((rA=globalThis==null?void 0:globalThis.window)==null?void 0:rA.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function oP(o){return(nC==null?void 0:nC.createHTML(o))??o}function k6(o){var e=f6("template");return e.innerHTML=oP(o.replaceAll("<!>","<!---->")),e.content}function Gu(o,e){var t=ss;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function F(o,e){var t=(e&pI)!==0,i=(e&xI)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=k6(s?o:"<!>"+o),t||(n=tl(n)));var r=i||c6?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=tl(r),d=r.lastChild;Gu(a,d)}else Gu(r,r);return r}}function rP(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=k6(n),a=tl(r);s=tl(a)}var d=s.cloneNode(!0);return Gu(d,d),d}}function mb(o,e){return rP(o,e,"svg")}function Co(o=""){{var e=Rl(o+"");return Gu(e,e),e}}function Us(){var o=document.createDocumentFragment(),e=document.createComment(""),t=Rl();return o.append(e,t),Gu(e,t),o}function D(o,e){o!==null&&o.before(e)}function N(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[tg]??(o[tg]=o.nodeValue))&&(o[tg]=t,o.nodeValue=`${t}`)}function aP(o,e){return lP(o,e)}const Sx=new Map;function lP(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){qI();var d=void 0,u=YI(()=>{var f=t??e.appendChild(Rl());PI(f,{pending:()=>{}},C=>{Zs({});var b=Mo;s&&(b.c=s),n&&(i.$$events=n),d=o(C,i)||{},Xs()},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=nP(E);for(const M of[e,document]){var A=Sx.get(M);A===void 0&&(A=new Map,Sx.set(M,A));var I=A.get(E);I===void 0?(M.addEventListener(E,E1,{passive:y}),A.set(E,1)):A.set(E,I+1)}}}};return p(hb(A6)),C1.add(p),()=>{var y;for(var C of g)for(const A of[e,document]){var b=Sx.get(A),E=b.get(C);--E==0?(A.removeEventListener(C,E1),b.delete(C),b.size===0&&Sx.delete(A)):b.set(C,E)}C1.delete(p),f!==t&&((y=f.parentNode)==null||y.removeChild(f))}});return cP.set(d,u),d}let cP=new WeakMap;var fa,Ga,kr,$d,Lp,Ip,t_;class dP{constructor(e,t=!0){Un(this,"anchor");In(this,fa,new Map);In(this,Ga,new Map);In(this,kr,new Map);In(this,$d,new Set);In(this,Lp,!0);In(this,Ip,e=>{if(ke(this,fa).has(e)){var t=ke(this,fa).get(e),i=ke(this,Ga).get(t);if(i)Uv(i),ke(this,$d).delete(t);else{var n=ke(this,kr).get(t);n&&(Uv(n.effect),ke(this,Ga).set(t,n.effect),ke(this,kr).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of ke(this,fa)){if(ke(this,fa).delete(s),s===e)break;const a=ke(this,kr).get(r);a&&(Cr(a.effect),ke(this,kr).delete(r))}for(const[s,r]of ke(this,Ga)){if(s===t||ke(this,$d).has(s))continue;const a=()=>{if(Array.from(ke(this,fa).values()).includes(s)){var u=document.createDocumentFragment();u9(r,u),u.append(Rl()),ke(this,kr).set(s,{effect:r,fragment:u})}else Cr(r);ke(this,$d).delete(s),ke(this,Ga).delete(s)};ke(this,Lp)||!i?(ke(this,$d).add(s),Yd(r,a,!1)):a()}}});In(this,t_,e=>{ke(this,fa).delete(e);const t=Array.from(ke(this,fa).values());for(const[i,n]of ke(this,kr))t.includes(i)||(Cr(n.effect),ke(this,kr).delete(i))});this.anchor=e,Pn(this,Lp,t)}ensure(e,t){var i=fn,n=h6();if(t&&!ke(this,Ga).has(e)&&!ke(this,kr).has(e))if(n){var s=document.createDocumentFragment(),r=Rl();s.append(r),ke(this,kr).set(e,{effect:Kr(()=>t(r)),fragment:s})}else ke(this,Ga).set(e,Kr(()=>t(this.anchor)));if(ke(this,fa).set(i,e),n){for(const[a,d]of ke(this,Ga))a===e?i.unskip_effect(d):i.skip_effect(d);for(const[a,d]of ke(this,kr))a===e?i.unskip_effect(d.effect):i.skip_effect(d.effect);i.oncommit(ke(this,Ip)),i.ondiscard(ke(this,t_))}else ke(this,Ip).call(this,i)}}fa=new WeakMap,Ga=new WeakMap,kr=new WeakMap,$d=new WeakMap,Lp=new WeakMap,Ip=new WeakMap,t_=new WeakMap;function O(o,e,t=!1){var i=new dP(o),n=t?n0:0;function s(r,a){i.ensure(r,a)}c9(()=>{var r=!1;e((a,d=0)=>{r=!0,s(d,a)}),r||s(-1,null)},n)}function zi(o,e){return e}function uP(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let g=e[a];Yd(g,()=>{if(s){if(s.pending.delete(g),s.done.add(g),s.pending.size===0){var p=o.outrogroups;y1(o,hb(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;GI(f),f.append(u),o.items.clear()}y1(o,e,!d)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function y1(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|=el;const r=document.createDocumentFragment();u9(s,r)}else Cr(e[n],t)}}var x8;function ti(o,e,t,i,n,s=null){var r=o,a=new Map,d=(e&jk)!==0;if(d){var u=o;r=u.appendChild(Rl())}var f=null,g=n9(()=>{var M=t();return Jw(M)?M:M==null?[]:hb(M)}),p,C=new Map,b=!0;function E(M){(I.effect.f&ta)===0&&(I.pending.delete(M),I.fallback=f,hP(I,p,r,e,i),f!==null&&(p.length===0?(f.f&el)===0?Uv(f):(f.f^=el,sg(f,null,r)):Yd(f,()=>{f=null})))}function y(M){I.pending.delete(M)}var A=c9(()=>{p=l(g);for(var M=p.length,R=new Set,P=fn,V=h6(),U=0;U<M;U+=1){var J=p[U],re=i(J,U),ae=b?null:a.get(re);ae?(ae.v&&o0(ae.v,J),ae.i&&o0(ae.i,U),V&&P.unskip_effect(ae.e)):(ae=fP(a,b?r:x8??(x8=Rl()),J,re,U,n,e,t),b||(ae.e.f|=el),a.set(re,ae)),R.add(re)}if(M===0&&s&&!f&&(b?f=Kr(()=>s(r)):(f=Kr(()=>s(x8??(x8=Rl()))),f.f|=el)),M>R.size&&YL(),!b)if(C.set(P,R),V){for(const[ie,ve]of a)R.has(ie)||P.skip_effect(ve.e);P.oncommit(E),P.ondiscard(y)}else E(P);l(g)}),I={effect:A,items:a,pending:C,outrogroups:null,fallback:f};b=!1}function U0(o){for(;o!==null&&(o.f&wa)===0;)o=o.next;return o}function hP(o,e,t,i,n){var ae,ie,ve,Se,Q,he,De,Fe,ge;var s=(i&cI)!==0,r=e.length,a=o.items,d=U0(o.effect.first),u,f=null,g,p=[],C=[],b,E,y,A;if(s)for(A=0;A<r;A+=1)b=e[A],E=n(b,A),y=a.get(E).e,(y.f&el)===0&&((ie=(ae=y.nodes)==null?void 0:ae.a)==null||ie.measure(),(g??(g=new Set)).add(y));for(A=0;A<r;A+=1){if(b=e[A],E=n(b,A),y=a.get(E).e,o.outrogroups!==null)for(const Ne of o.outrogroups)Ne.pending.delete(y),Ne.done.delete(y);if((y.f&tr)!==0&&(Uv(y),s&&((Se=(ve=y.nodes)==null?void 0:ve.a)==null||Se.unfix(),(g??(g=new Set)).delete(y))),(y.f&el)!==0)if(y.f^=el,y===d)sg(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),hc(o,f,y),hc(o,y,I),sg(y,I,t),f=y,p=[],C=[],d=U0(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 P=p[0],V=p[p.length-1];for(R=0;R<p.length;R+=1)sg(p[R],M,t);for(R=0;R<C.length;R+=1)u.delete(C[R]);hc(o,P.prev,V.next),hc(o,f,P),hc(o,V,M),d=M,f=V,A-=1,p=[],C=[]}else u.delete(y),sg(y,d,t),hc(o,y.prev,y.next),hc(o,y,f===null?o.effect.first:f.next),hc(o,f,y),f=y;continue}for(p=[],C=[];d!==null&&d!==y;)(u??(u=new Set)).add(d),C.push(d),d=U0(d.next);if(d===null)continue}(y.f&el)===0&&p.push(y),f=y,d=U0(y.next)}if(o.outrogroups!==null){for(const Ne of o.outrogroups)Ne.pending.size===0&&(y1(o,hb(Ne.done)),(Q=o.outrogroups)==null||Q.delete(Ne));o.outrogroups.size===0&&(o.outrogroups=null)}if(d!==null||u!==void 0){var U=[];if(u!==void 0)for(y of u)(y.f&tr)===0&&U.push(y);for(;d!==null;)(d.f&tr)===0&&d!==o.fallback&&U.push(d),d=U0(d.next);var J=U.length;if(J>0){var re=(i&jk)!==0&&r===0?t:null;if(s){for(A=0;A<J;A+=1)(De=(he=U[A].nodes)==null?void 0:he.a)==null||De.measure();for(A=0;A<J;A+=1)(ge=(Fe=U[A].nodes)==null?void 0:Fe.a)==null||ge.fix()}uP(o,U,re)}}s&&Nc(()=>{var Ne,Oe;if(g!==void 0)for(y of g)(Oe=(Ne=y.nodes)==null?void 0:Ne.a)==null||Oe.apply()})}function fP(o,e,t,i,n,s,r,a){var d=(r&aI)!==0?(r&dI)===0?jI(t,!1,!1):qu(t):null,u=(r&lI)!==0?qu(n):null;return{v:d,i:u,e:Kr(()=>(s(e,d??t,u??n,a),()=>{o.delete(i)}))}}function sg(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&el)===0?e.nodes.start:t;i!==null;){var r=Yp(i);if(s.before(i),i===n)return;i=r}}function hc(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function Fc(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var d=o;z(()=>{var u=ss;if(a!==(a=e()??"")){if(t){u.nodes=null,d.innerHTML=a,a!==""&&Gu(tl(d),d.lastChild);return}if(u.nodes!==null&&(x6(u.nodes.start,u.nodes.end),u.nodes=null),a!==""){var f=i?vI:n?mI:void 0,g=f6(i?"svg":n?"math":"template",f);g.innerHTML=a;var p=i||n?g:g.content;if(Gu(tl(p),p.lastChild),i||n)for(;tl(p);)r.before(tl(p));else r.before(p)}}})}function B6(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=B6(o[e]))&&(i&&(i+=" "),i+=t)}else for(t in o)o[t]&&(i&&(i+=" "),i+=t);return i}function gP(){for(var o,e,t=0,i="",n=arguments.length;t<n;t++)(o=arguments[t])&&(e=B6(o))&&(i&&(i+=" "),i+=e);return i}function Eg(o){return typeof o=="object"?gP(o):o??""}const v8=[...`
3
+ \r\f \v\uFEFF`];function pP(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||v8.includes(i[r-1]))&&(a===i.length||v8.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function m8(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 sC(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function xP(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(sC)),n&&d.push(...Object.keys(n).map(sC));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=sC(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+=m8(i)),n&&(t+=m8(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function Dt(o,e,t,i,n,s){var r=o[f1];if(r!==t||r===void 0){var a=pP(t,i,s);a==null?o.removeAttribute("class"):e?o.className=a:o.setAttribute("class",a),o[f1]=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 oC(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 Vo(o,e,t,i){var n=o[g1];if(n!==e){var s=xP(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[g1]=e}else i&&(Array.isArray(i)?(oC(o,t==null?void 0:t[0],i[0]),oC(o,t==null?void 0:t[1],i[1],"important")):oC(o,t,i));return i}function qv(o,e,t=!1){if(o.multiple){if(e==null)return;if(!Jw(e))return bI();for(var i of o.options)i.selected=e.includes(yg(i));return}for(i of o.options){var n=yg(i);if(UI(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function w1(o){var e=new MutationObserver(()=>{qv(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),a9(()=>{e.disconnect()})}function $s(o,e,t=e){var i=new WeakSet,n=!0;o9(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),yg);else{var d=o.querySelector(r)??o.querySelector("option:not([disabled])");a=d&&yg(d)}t(a),o.__value=a,fn!==null&&i.add(fn)}),l9(()=>{var s=e();if(o===document.activeElement){var r=fn;if(i.has(r))return}if(qv(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=yg(a),t(s))}o.__value=s,n=!1}),w1(o)}function yg(o){return"__value"in o?o.__value:o.value}const vP=Symbol("is custom element"),mP=Symbol("is html"),_P=ZL?"progress":"PROGRESS";function S1(o,e){var t=h9(o);t.value===(t.value=e??void 0)||o.value===e&&(e!==0||o.nodeName!==_P)||(o.value=e??"")}function vr(o,e){var t=h9(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function gn(o,e,t,i){var n=h9(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[KL]=t),t==null?o.removeAttribute(e):typeof t!="string"&&bP(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function h9(o){return o[rv]??(o[rv]={[vP]:o.nodeName.includes("-"),[mP]:o.namespaceURI===$k})}var _8=new Map;function bP(o){var e=o.getAttribute("is")||o.nodeName,t=_8.get(e);if(t)return t;_8.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=WL(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=Hk(n)}return t}function yt(o,e,t=e){var i=new WeakSet;o9(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=rC(o)?aC(s):s,t(s),fn!==null&&i.add(fn),await kl(),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))}}}),tc(e)==null&&o.value&&(t(rC(o)?aC(o.value):o.value),fn!==null&&i.add(fn)),vb(()=>{var n=e();if(o===document.activeElement){var s=fn;if(i.has(s))return}rC(o)&&n===aC(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function Ms(o,e,t=e){o9(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),tc(e)==null&&t(o.checked),vb(()=>{var i=e();o.checked=!!i})}function rC(o){var e=o.type;return e==="number"||e==="range"}function aC(o){return o===""?null:+o}var Ac,Mf,Pp,i_,F6;const n_=class n_{constructor(e){In(this,i_);In(this,Ac,new WeakMap);In(this,Mf);In(this,Pp);Pn(this,Pp,e)}observe(e,t){var i=ke(this,Ac).get(e)||new Set;return i.add(t),ke(this,Ac).set(e,i),vs(this,i_,F6).call(this).observe(e,ke(this,Pp)),()=>{var n=ke(this,Ac).get(e);n.delete(t),n.size===0&&(ke(this,Ac).delete(e),ke(this,Mf).unobserve(e))}}};Ac=new WeakMap,Mf=new WeakMap,Pp=new WeakMap,i_=new WeakSet,F6=function(){return ke(this,Mf)??Pn(this,Mf,new ResizeObserver(e=>{for(var t of e){n_.entries.set(t.target,t);for(var i of ke(this,Ac).get(t.target)||[])i(t)}}))},Un(n_,"entries",new WeakMap);let D1=n_;var CP=new D1({box:"border-box"});function EP(o,e,t){var i=CP.observe(o,()=>t(o[e]));l9(()=>(tc(()=>t(o[e])),i))}function lC(o,e){return o===e||(o==null?void 0:o[Kd])===e}function ks(o={},e,t,i){var n=Mo.r,s=ss;return l9(()=>{var r,a;return vb(()=>{r=a,a=[],tc(()=>{lC(t(...a),o)||(e(o,...a),r&&lC(t(...r),o)&&e(null,...r))})}),()=>{let d=s;for(;d!==n&&d.parent!==null&&d.parent.f&h1;)d=d.parent;const u=()=>{a&&lC(t(...a),o)&&e(null,...a)},f=d.teardown;d.teardown=()=>{u(),f==null||f()}}}),o}function Ku(o,e,t,i){var R;var n=!0,s=(t&fI)!==0,r=(t&gI)!==0,a=i,d=!0,u=void 0,f=()=>r&&n?(u??(u=Xg(i)),l(u)):(d&&(d=!1,a=r?tc(i):i),a);let g;if(s){var p=Kd in o||GL in o;g=((R=yf(o,e))==null?void 0:R.set)??(p&&e in o?P=>o[e]=P:void 0)}var C,b=!1;s?[C,b]=DI(()=>o[e]):C=o[e],C===void 0&&i!==void 0&&(C=f(),g&&(iI(),g(C)));var E;if(E=()=>{var P=o[e];return P===void 0?f():(d=!0,P)},(t&hI)===0)return E;if(g){var y=o.$$legacy;return(function(P,V){return arguments.length>0?((!V||y||b)&&g(V?E():P),P):E()})}var A=!1,I=((t&uI)!==0?Xg:n9)(()=>(A=!1,E()));s&&l(I);var M=ss;return(function(P,V){if(arguments.length>0){const U=V?l(I):s?_i(P):P;return x(I,U),A=!0,a!==void 0&&(a=U),P}return $l&&A||(M.f&ta)!==0?I.v:l(I)})}function oo(o){Mo===null&&Vk(),us(()=>{const e=tc(o);if(typeof e=="function")return e})}function B0(o){Mo===null&&Vk(),oo(()=>()=>tc(o))}const yP="5";var aA;typeof window<"u"&&((aA=window.__svelte??(window.__svelte={})).v??(aA.v=new Set)).add(yP);/*!-----------------------------------------------------------------------------
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 wP=Object.defineProperty,SP=Object.getOwnPropertyDescriptor,DP=Object.getOwnPropertyNames,AP=Object.prototype.hasOwnProperty,kP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of DP(e))!AP.call(o,n)&&n!==t&&wP(o,n,{get:()=>e[n],enumerable:!(i=SP(e,n))||i.enumerable});return o},BP=(o,e,t)=>(kP(o,e,"default"),t),Jp={};BP(Jp,cA);var FP=class{constructor(e,t,i){this._onDidChange=new Jp.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)}},LP={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},IP={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},L6=new FP("json",LP,IP),PP=()=>I6().then(o=>o.getWorker());Jp.languages.json={jsonDefaults:L6,getWorker:PP};function I6(){return lA(()=>import("./jsonMode-tUihOf0o.js"),__vite__mapDeps([0,1,2]))}Jp.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Jp.languages.onLanguage("json",()=>{I6().then(o=>o.setupMode(L6))});/*!-----------------------------------------------------------------------------
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 TP=Object.defineProperty,MP=Object.getOwnPropertyDescriptor,RP=Object.getOwnPropertyNames,NP=Object.prototype.hasOwnProperty,OP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of RP(e))!NP.call(o,n)&&n!==t&&TP(o,n,{get:()=>e[n],enumerable:!(i=MP(e,n))||i.enumerable});return o},HP=(o,e,t)=>(OP(o,e,"default"),t),WP="5.4.5",a0={};HP(a0,cA);var P6=(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))(P6||{}),T6=(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))(T6||{}),M6=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(M6||{}),R6=(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))(R6||{}),N6=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(N6||{}),O6=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)}},zP=WP,H6={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},W6=new O6({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},H6),z6=new O6({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},H6),VP=()=>_b().then(o=>o.getTypeScriptWorker()),jP=()=>_b().then(o=>o.getJavaScriptWorker());a0.languages.typescript={ModuleKind:P6,JsxEmit:T6,NewLineKind:M6,ScriptTarget:R6,ModuleResolutionKind:N6,typescriptVersion:zP,typescriptDefaults:W6,javascriptDefaults:z6,getTypeScriptWorker:VP,getJavaScriptWorker:jP};function _b(){return lA(()=>import("./tsMode-BNcOSQVq.js"),__vite__mapDeps([3,1,2]))}a0.languages.onLanguage("typescript",()=>_b().then(o=>o.setupTypeScript(W6)));a0.languages.onLanguage("javascript",()=>_b().then(o=>o.setupJavaScript(z6)));class $P extends Ko{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Ei("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Ji.map,toggled:Ue.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Ue.has("isInDiffEditor"),menu:{when:Ue.has("isInDiffEditor"),id:li.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(bs),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class V6 extends Ko{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Ei("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:Ue.has("isInDiffEditor")})}run(e,...t){const i=e.get(bs),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class j6 extends Ko{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Ei("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:Ue.has("isInDiffEditor")})}run(e,...t){const i=e.get(bs),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const ex=Ei("diffEditor","Diff Editor");class UP extends Sa{constructor(){super({id:"diffEditor.switchSide",title:Ei("switchSide","Switch Side"),icon:Ji.arrowSwap,precondition:Ue.has("isInDiffEditor"),f1:!0,category:ex})}runEditorCommand(e,t,i){const n=F0(e);if(n instanceof Tp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class qP extends Sa{constructor(){super({id:"diffEditor.exitCompareMove",title:Ei("exitCompareMove","Exit Compare Move"),icon:Ji.close,precondition:G.comparingMovedCode,f1:!1,category:ex,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=F0(e);n instanceof Tp&&n.exitCompareMove()}}class GP extends Sa{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Ei("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Ji.fold,precondition:Ue.has("isInDiffEditor"),f1:!0,category:ex})}runEditorCommand(e,t,...i){const n=F0(e);n instanceof Tp&&n.collapseAllUnchangedRegions()}}class KP extends Sa{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Ei("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Ji.unfold,precondition:Ue.has("isInDiffEditor"),f1:!0,category:ex})}runEditorCommand(e,t,...i){const n=F0(e);n instanceof Tp&&n.showAllUnchangedRegions()}}class A1 extends Ko{constructor(){super({id:"diffEditor.revert",title:Ei("revert","Revert"),f1:!1,category:ex})}run(e,t){const i=ZP(e,t.originalUri,t.modifiedUri);i instanceof Tp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const $6=Ei("accessibleDiffViewer","Accessible Diff Viewer"),s_=class s_ extends Ko{constructor(){super({id:s_.id,title:Ei("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:$6,precondition:Ue.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=F0(e);t==null||t.accessibleDiffViewerNext()}};s_.id="editor.action.accessibleDiffViewer.next";let Qg=s_;const o_=class o_ extends Ko{constructor(){super({id:o_.id,title:Ei("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:$6,precondition:Ue.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=F0(e);t==null||t.accessibleDiffViewerPrev()}};o_.id="editor.action.accessibleDiffViewer.prev";let Gv=o_;function ZP(o,e,t){return o.get(zs).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 F0(o){const t=o.get(zs).listDiffEditors(),i=dA();if(i)for(const n of t){const s=n.getContainerDomNode();if(XP(s,i))return n}return null}function XP(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}os($P);os(V6);os(j6);ia.appendMenuItem(li.EditorTitle,{command:{id:new j6().desc.id,title:S("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:Ue.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Ue.has("isInDiffEditor")},order:11,group:"1_diff",when:Ue.and(G.diffEditorRenderSideBySideInlineBreakpointReached,Ue.has("isInDiffEditor"))});ia.appendMenuItem(li.EditorTitle,{command:{id:new V6().desc.id,title:S("showMoves","Show Moved Code Blocks"),icon:Ji.move,toggled:o3.create("config.diffEditor.experimental.showMoves",!0),precondition:Ue.has("isInDiffEditor")},order:10,group:"1_diff",when:Ue.has("isInDiffEditor")});os(A1);for(const o of[{icon:Ji.arrowRight,key:G.diffEditorInlineMode.toNegated()},{icon:Ji.discard,key:G.diffEditorInlineMode}])ia.appendMenuItem(li.DiffEditorHunkToolbar,{command:{id:new A1().desc.id,title:S("revertHunk","Revert Block"),icon:o.icon},when:Ue.and(G.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),ia.appendMenuItem(li.DiffEditorSelectionToolbar,{command:{id:new A1().desc.id,title:S("revertSelection","Revert Selection"),icon:o.icon},when:Ue.and(G.diffEditorModifiedWritable,o.key),order:5,group:"primary"});os(UP);os(qP);os(GP);os(KP);ia.appendMenuItem(li.EditorTitle,{command:{id:Qg.id,title:S("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:Ue.has("isInDiffEditor")},order:10,group:"2_diff",when:Ue.and(G.accessibleDiffViewerVisible.negate(),Ue.has("isInDiffEditor"))});ps.registerCommandAlias("editor.action.diffReview.next",Qg.id);os(Qg);ps.registerCommandAlias("editor.action.diffReview.prev",Gv.id);os(Gv);var YP=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)}},k1;const bb=new Tn("selectionAnchorSet",!1);var iu;let od=(iu=class{static get(e){return e.getContribution(k1.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=bb.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(Zi.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Fo().appendText(S("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),na(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(Zi.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()}},k1=iu,iu.ID="editor.contrib.selectionAnchorController",iu);od=k1=YP([QP(1,Gn)],od);class JP extends xt{constructor(){super({id:"editor.action.setSelectionAnchor",label:S("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2080),weight:100}})}async run(e,t){var i;(i=od.get(t))==null||i.setSelectionAnchor()}}class eT extends xt{constructor(){super({id:"editor.action.goToSelectionAnchor",label:S("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:bb})}async run(e,t){var i;(i=od.get(t))==null||i.goToSelectionAnchor()}}class tT extends xt{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:S("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:bb,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2089),weight:100}})}async run(e,t){var i;(i=od.get(t))==null||i.selectFromAnchorToCursor()}}class iT extends xt{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:S("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:bb,kbOpts:{kbExpr:G.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=od.get(t))==null||i.cancelSelectionAnchor()}}En(od.ID,od,4);Te(JP);Te(eT);Te(tT);Te(iT);const nT=vi("editorOverviewRuler.bracketMatchForeground","#A0A0A0",S("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class sT extends xt{constructor(){super({id:"editor.action.jumpToBracket",label:S("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=Zu.get(t))==null||i.jumpToBracket()}}class oT extends xt{constructor(){super({id:"editor.action.selectToBracket",label:S("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Ei("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=Zu.get(t))==null||s.selectToBracket(n)}}class rT extends xt{constructor(){super({id:"editor.action.removeBrackets",label:S("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=Zu.get(t))==null||i.removeBrackets(this.id)}}class aT{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const bc=class bc extends Nt{static get(e){return e.getContribution(bc.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Qs(()=>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 Zi(r.lineNumber,r.column,r.lineNumber,r.column):new Zi(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(te.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 Zi(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(Si.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=bc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!b&&this._matchBrackets==="always"&&(b=t.bracketPairs.findEnclosingBrackets(C,20),E=bc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[d++]=new aT(C,b,E)}}this._lastBracketsData=a,this._lastVersionId=i}};bc.ID="editor.contrib.bracketMatchingController",bc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Bn.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Ks(nT),position:nl.Center}}),bc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Bn.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let Zu=bc;En(Zu.ID,Zu,1);Te(oT);Te(sT);Te(rT);ia.appendMenuItem(li.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:S({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class lT{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 te(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new te(i,s,i,s),a)}else{const r=new te(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new te(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new Zi(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Zi(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class U6 extends xt{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 lT(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class cT extends U6{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:S("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:G.writable})}}class dT extends U6{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:S("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:G.writable})}}Te(cT);Te(dT);class uT extends xt{constructor(){super({id:"editor.action.transposeLetters",label:S("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:G.writable,kbOpts:{kbExpr:G.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():Kb.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),g=Kb.leftPosition(i,f),p=Kb.leftPosition(i,g),C=i.getValueInRange(te.fromPositions(p,g)),b=i.getValueInRange(te.fromPositions(g,f)),E=te.fromPositions(p,f);n.push(new Mp(E,b+C))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Te(uT);const Cb=(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 f9(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function hT(o,e,t){const i={id:Cb(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class q6{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 Pl.some(this,([i,n])=>n.asFile())&&t.push("files"),K6(Kv(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 Kv(e)}}function Kv(o){return o.toLowerCase()}function G6(o,e){return K6(Kv(o),e.map(Kv))}function K6(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 Eb=Object.freeze({create:o=>uA(o.map(e=>e.toString())).join(`\r
14
+ `),split:o=>o.split(`\r
15
+ `),parse:o=>Eb.split(o).filter(e=>!e.startsWith("#"))}),Va=class Va{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+Va.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new Va((this.value?[this.value,...e]:e).join(Va.sep))}};Va.sep=".",Va.None=new Va("@@none@@"),Va.Empty=new Va("");let _s=Va;const b8={EDITORS:"CodeEditors",FILES:"CodeFiles"};class fT{}const gT={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Da.add(gT.DragAndDropContribution,new fT);const Mg=class Mg{constructor(){}static getInstance(){return Mg.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};Mg.INSTANCE=new Mg;let B1=Mg;function Z6(o){const e=new q6;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,f9(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,pT(n))}}return e}function pT(o){const e=o.path?rs.parse(o.path):void 0;return hT(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const xT=Object.freeze([b8.EDITORS,b8.FILES,ZC.RESOURCES,ZC.INTERNAL_URI_LIST]);function X6(o,e=!1){const t=Z6(o),i=t.get(ZC.INTERNAL_URI_LIST);if(i)t.replace(po.uriList,i);else if(e||!t.has(po.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(rs.file(a).toString()):n.push(rs.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(po.uriList,f9(Eb.create(n)))}for(const n of xT)t.delete(n);return t}var g9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jg=function(o,e){return function(t,i){e(t,i,o)}};class p9{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 Rg=class Rg extends p9{constructor(){super(...arguments),this.kind=Rg.kind,this.dropMimeTypes=[po.text],this.pasteMimeTypes=[po.text]}async getEdit(e,t){const i=e.get(po.text);if(!i||e.has(po.uriList))return;const n=await i.asString();return{handledMimeType:po.text,title:S("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};Rg.id="text",Rg.kind=new _s("text.plain");let Xu=Rg;class Y6 extends p9{constructor(){super(...arguments),this.kind=new _s("uri.absolute"),this.dropMimeTypes=[po.uriList],this.pasteMimeTypes=[po.uriList]}async getEdit(e,t){const i=await Q6(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:d})=>a.scheme===jo.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:po.uriList,insertText:s,title:r,kind:this.kind}}}let Zv=class extends p9{constructor(e){super(),this._workspaceContextService=e,this.kind=new _s("uri.relative"),this.dropMimeTypes=[po.uriList],this.pasteMimeTypes=[po.uriList]}async getEdit(e,t){const i=await Q6(e);if(!i.length||t.isCancellationRequested)return;const n=Hl(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?r3(r.uri,s):void 0}));if(n.length)return{handledMimeType:po.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}}};Zv=g9([Jg(0,qf)],Zv);class vT{constructor(){this.kind=new _s("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:po.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var d;if(n.triggerKind!==XC.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 Q6(o){const e=o.get(po.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of Eb.parse(t))try{i.push({uri:rs.parse(n),originalText:n})}catch{}return i}let F1=class extends Nt{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Xu)),this._register(e.documentDropEditProvider.register("*",new Y6)),this._register(e.documentDropEditProvider.register("*",new Zv(t)))}};F1=g9([Jg(0,Di),Jg(1,qf)],F1);let L1=class extends Nt{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Xu)),this._register(e.documentPasteEditProvider.register("*",new Y6)),this._register(e.documentPasteEditProvider.register("*",new Zv(t))),this._register(e.documentPasteEditProvider.register("*",new vT))}};L1=g9([Jg(0,Di),Jg(1,qf)],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 I1=Wr;class L0{constructor(){this._children=[]}appendChild(e){return e instanceof er&&this._children[this._children.length-1]instanceof er?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 tx)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let er=class J6 extends L0{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new J6(this.value)}};class e5 extends L0{}class Ir extends e5{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 I0?this._children[0]:void 0}clone(){const e=new Ir(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class I0 extends L0{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof er&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new I0;return this.options.forEach(e.appendChild,e),e}}class x9 extends L0{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 ga&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof ga){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new x9;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 ga extends L0{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 ga(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class ep extends e5{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 er(t)],!0):!1}clone(){const e=new ep(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function C8(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class tx extends L0{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Ir&&(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 C8([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Ir&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof ep&&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 tx;return this._children=this.children.map(t=>t.clone()),e}walk(e){C8(this.children,e)}}class Yu{constructor(){this._scanner=new I1,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 tx;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 Ir&&(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 Ir(d.index);g.transform=d.transform;for(const p of f){const C=p.clone();g.appendChild(C),C instanceof Ir&&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 Ir(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 er(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 Ir(Number(t)):new ep(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 Ir(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new er("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new I0;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 er(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 ep(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new er("${"+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 x9;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 er(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 ga(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new ga(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 ga(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new ga(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new ga(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 ga(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new ga(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new er(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function t5(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 a3(o,{range:s,text:typeof t.insertText=="string"?Yu.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function i5(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 mT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_T=function(o,e){return function(t,i){e(t,i,o)}};const bT=Bn.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:hA,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),r_=class r_ extends Nt{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=xi(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=xi("span.icon");this.domNode.append(t),t.classList.add(...Qn.asClassNameArray(Ji.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(qn(this.domNode,Ds.CLICK,n=>{this.delegate.cancel()}))}getId(){return r_.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)}};r_.baseId="editor.widget.inlineProgressWidget";let P1=r_,Xv=class extends Nt{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new Er),this._currentWidget=this._register(new Er),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=te.fromPositions(e);this._currentDecorations.set([{range:a,options:bT}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(P1,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()}};Xv=mT([_T(2,cn)],Xv);var CT=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},E8=function(o,e){return function(t,i){e(t,i,o)}},hv,Hc;let ir=(Hc=class{static get(e){return e.getContribution(hv.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Er,this._messageListeners=new Tt,this._mouseOverMessage=!1,this._editor=e,this._visible=hv.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){na(tv(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=tv(e)?l3(e,{actionHandler:{callback:n=>{this.closeMessage(),c3(this._openerService,n,tv(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new y8(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Ys.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&d3(dA(),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(qn(this._messageWidget.value.getDomNode(),Ds.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(qn(this._messageWidget.value.getDomNode(),Ds.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 te(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(y8.fadeOut(this._messageWidget.value))}},hv=Hc,Hc.ID="editor.contrib.messageController",Hc.MESSAGE_VISIBLE=new Tn("messageVisible",!1,S("messageVisible","Whether the editor is currently showing an inline message")),Hc);ir=hv=CT([E8(1,Gn),E8(2,Aa)],ir);const ET=Zo.bindToContribution(ir.get);Bi(new ET({id:"leaveEditorMessage",precondition:ir.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let y8=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)}};En(ir.ID,ir,4);function cC(o,e){return e&&(o.stack||o.stacktrace)?S("stackTrace.format","{0}: {1}",S8(o),w8(o.stack)||w8(o.stacktrace)):S8(o)}function w8(o){return Array.isArray(o)?o.join(`
16
+ `):o}function S8(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 Yv(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=Hl(o),i=Yv(t[0],e);return t.length>1?S("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(fA(o))return o;if(o.detail){const t=o.detail;if(t.error)return cC(t.error,e);if(t.exception)return cC(t.exception,e)}return o.stack?cC(o,e):o.message?o.message:S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var n5=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},Sf=function(o,e){return function(t,i){e(t,i,o)}},T1,nu;let M1=(nu=class extends Nt{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(ms(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(ms((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{s.containsPosition(g.position)||this.dispose()})),this._register(Ys.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=xi(".post-edit-widget"),this.button=this._register(new u3(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(qn(this.domNode,Ds.CLICK,()=>this.showSelector()))}getId(){return T1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=Uo(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>h3({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},T1=nu,nu.baseId="editor.widget.postEditWidget",nu);M1=T1=n5([Sf(7,E0),Sf(8,Gn),Sf(9,Gs)],M1);let Qv=class extends Nt{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 Er),this._register(Ys.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 A=this._editor.getModel();A&&(await A.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:y,allEdits:t.allEdits},i,n,s))},u=(y,A)=>{dd(y)||(this._notificationService.error(A),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,Yv(y)))}if(s.isCancellationRequested)return;const g=t5(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,Yv(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(M1,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()}};Qv=n5([Sf(4,cn),Sf(5,q_),Sf(6,Oo)],Qv);var yT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mh=function(o,e){return function(t,i){e(t,i,o)}},kd;const s5="editor.changePasteType",v9=new Tn("pasteWidgetVisible",!1,S("pasteWidgetVisible","Whether the paste widget is showing")),dC="application/vnd.code.copyMetadata";var su;let Ul=(su=class extends Nt{static get(e){return e.getContribution(kd.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(qn(d,"copy",u=>this.handleCopy(u))),this._register(qn(d,"cut",u=>this.handleCopy(u))),this._register(qn(d,"paste",u=>this.handlePaste(u),!0)),this._pasteProgressManager=this._register(new Xv("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Qv,"pasteIntoEditor",e,v9,{id:s5,label:S("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},ww().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,A,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 te(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=(A=this._editor._getViewModel())==null?void 0:A.getPlainTextToCopy(i,n,G_),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=Z6(e.clipboardData),p=f.flatMap(M=>M.copyMimeTypes??[]),C=Cb();this.setCopyMetadata(e.clipboardData,{id:C,providerCopyMimeTypes:p,defaultPastePayload:u});const b=co(async M=>{const R=Hl(await Promise.all(f.map(async P=>{try{return await P.prepareDocumentPaste(t,s,g,M)}catch(V){console.error(V);return}})));R.reverse();for(const P of R)for(const[V,U]of P)g.replace(V,U);return g});(I=kd._currentCopyOperation)==null||I.dataTransferPromise.cancel(),kd._currentCopyOperation={handle:C,dataTransferPromise:b}}async handlePaste(e){var d,u,f;if(!e.clipboardData||!this._editor.hasTextFocus())return;(d=ir.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=X6(e.clipboardData);s.delete(dC);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],po.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=>G6(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=ir.get(this._editor))==null||i.showMessage(S("pasteAsError","No paste edits for '{0}' found",t instanceof _s?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new Gf(r,3,void 0),d=co(async u=>{const f=this._editor;if(!f.hasModel())return;const g=f.getModel(),p=new Tt,C=p.add(new uo(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 Xu)return this.applyDefaultPasteHandler(i,n,b,s);const y={triggerKind:XC.Automatic},A=await this.getPasteEdits(E,i,g,t,y,b);if(p.add(A),b.isCancellationRequested)return;if(A.edits.length===1&&A.edits[0].provider instanceof Xu)return this.applyDefaultPasteHandler(i,n,b,s);if(A.edits.length){const I=f.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:A.edits},I,(M,R)=>new Promise((P,V)=>{(async()=>{var U,J;try{const re=(J=(U=M.provider).resolveDocumentPasteEdit)==null?void 0:J.call(U,M,R),ae=new K_,ie=re&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),S("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([ae.p,re]),{cancel:()=>(ae.cancel(),V(new Z_))},0);return ie&&(M.additionalEdit=ie.additionalEdit),P(M)}catch(re){return V(re)}})()}),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=co(async a=>{const d=this._editor;if(!d.hasModel())return;const u=d.getModel(),f=new Tt,g=f.add(new Gf(d,3,void 0,a));try{if(await this.mergeInDataFromCopy(n,s,g.token),g.token.isCancellationRequested)return;let p=t.filter(A=>this.isSupportedPasteProvider(A,n,e));e&&(p=p.filter(A=>this.providerMatchesPreference(A,e)));const C={triggerKind:XC.PasteAs,only:e&&e instanceof _s?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(A=>e instanceof _s?e.contains(A.kind):e.providerId===A.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 A=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=A==null?void 0:A.edit}if(!E)return;const y=t5(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(dC,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(dC);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=f3.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=kd._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await kd._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(po.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(po.uriList,f9(Eb.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new Tt,d=await Rp(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){dd(C)||console.error(C);return}})),r),u=Hl(d??[]).flat().filter(f=>!s.only||s.only.contains(f.kind));return{edits:i5(u),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(po.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 _s?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},kd=su,su.ID="editor.contrib.copyPasteActionController",su);Ul=kd=yT([Mh(1,cn),Mh(2,q_),Mh(3,y0),Mh(4,Di),Mh(5,Xl),Mh(6,g3)],Ul);const Qu="9_cutcopypaste",wT=w0||document.queryCommandSupported("cut"),o5=w0||document.queryCommandSupported("copy"),ST=typeof navigator.clipboard>"u"||p3?document.queryCommandSupported("paste"):!0;function m9(o){return o.register(),o}const DT=wT?m9(new Sw({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:w0?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:li.MenubarEditMenu,group:"2_ccp",title:S({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:li.EditorContext,group:Qu,title:S("actions.clipboard.cutLabel","Cut"),when:G.writable,order:1},{menuId:li.CommandPalette,group:"",title:S("actions.clipboard.cutLabel","Cut"),order:1},{menuId:li.SimpleEditorContext,group:Qu,title:S("actions.clipboard.cutLabel","Cut"),when:G.writable,order:1}]})):void 0,AT=o5?m9(new Sw({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:w0?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:li.MenubarEditMenu,group:"2_ccp",title:S({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:li.EditorContext,group:Qu,title:S("actions.clipboard.copyLabel","Copy"),order:2},{menuId:li.CommandPalette,group:"",title:S("actions.clipboard.copyLabel","Copy"),order:1},{menuId:li.SimpleEditorContext,group:Qu,title:S("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;ia.appendMenuItem(li.MenubarEditMenu,{submenu:li.MenubarCopy,title:Ei("copy as","Copy As"),group:"2_ccp",order:3});ia.appendMenuItem(li.EditorContext,{submenu:li.EditorContextCopy,title:Ei("copy as","Copy As"),group:Qu,order:3});ia.appendMenuItem(li.EditorContext,{submenu:li.EditorContextShare,title:Ei("share","Share"),group:"11_share",order:-1,when:Ue.and(Ue.notEquals("resourceScheme","output"),G.editorTextFocus)});ia.appendMenuItem(li.ExplorerContext,{submenu:li.ExplorerContextShare,title:Ei("share","Share"),group:"11_share",order:-1});const uC=ST?m9(new Sw({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:w0?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:li.MenubarEditMenu,group:"2_ccp",title:S({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:li.EditorContext,group:Qu,title:S("actions.clipboard.pasteLabel","Paste"),when:G.writable,order:4},{menuId:li.CommandPalette,group:"",title:S("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:li.SimpleEditorContext,group:Qu,title:S("actions.clipboard.pasteLabel","Paste"),when:G.writable,order:4}]})):void 0;class kT extends xt{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:G.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(BS.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),BS.forceCopyWithSyntaxHighlighting=!1)}}function r5(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(zs).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)=>(ww().execCommand(e),!0)))}r5(DT,"cut");r5(AT,"copy");uC&&(uC.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(zs),i=o.get(y0),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=Ul.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():x3?(async()=>{const a=await i.readText();if(a!==""){const d=v3.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}),uC.addImplementation(0,"generic-dom",(o,e)=>(ww().execCommand("paste"),!0)));o5&&Te(kT);const fs=new class{constructor(){this.QuickFix=new _s("quickfix"),this.Refactor=new _s("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 _s("notebook"),this.Source=new _s("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var rr;(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"})(rr||(rr={}));function BT(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>a5(e,t,o.include))||!o.includeSourceActions&&fs.Source.contains(e))}function FT(o,e){const t=e.kind?new _s(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>a5(t,i,o.include))||!o.includeSourceActions&&t&&fs.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function a5(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Ya{static fromUser(e,t){return!e||typeof e!="object"?new Ya(t.kind,t.apply,!1):new Ya(Ya.getKindFromUser(e,t.kind),Ya.getApplyFromUser(e,t.apply),Ya.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 _s(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 LT{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){Ws(n)}i&&(this.action.edit=i.edit)}return this}}const l5="editor.action.codeAction",_9="editor.action.quickFix",c5="editor.action.autoFix",d5="editor.action.refactor",u5="editor.action.sourceAction",R1="editor.action.organizeImports",N1="editor.action.fixAll";class wg extends Nt{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:_r(e.diagnostics)?_r(t.diagnostics)?wg.codeActionsPreferredComparator(e,t):-1:_r(t.diagnostics)?1:wg.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(wg.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&fs.QuickFix.contains(new _s(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 D8={actions:[],documentation:void 0};async function lf(o,e,t,i,n,s){var E;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],fs.Notebook]},d={only:(E=r.include)==null?void 0:E.value,trigger:i.type},u=new m3(e,s),f=i.type===2,g=IT(o,e,f?a:r),p=new Tt,C=g.map(async y=>{try{n.report(y);const A=await y.provideCodeActions(e,t,d,u.token);if(A&&p.add(A),u.token.isCancellationRequested)return D8;const I=((A==null?void 0:A.actions)||[]).filter(R=>R&&FT(r,R)),M=TT(y,I,r.include);return{actions:I.map(R=>new LT(R,y)),documentation:M}}catch(A){if(dd(A))throw A;return Ws(A),D8}}),b=o.onDidChange(()=>{const y=o.all(e);al(y,g)||u.cancel()});try{const y=await Promise.all(C),A=y.map(M=>M.actions).flat(),I=[...Hl(y.map(M=>M.documentation)),...PT(o,e,i,A)];return new wg(A,I,p)}finally{b.dispose(),u.dispose()}}function IT(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>BT(t,new _s(n))):!0)}function*PT(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 TT(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new _s(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 _s(n.kind)))return s.command}}var Hd;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(Hd||(Hd={}));async function MT(o,e,t,i,n=vn.None){var u;const s=o.get(q_),r=o.get(ro),a=o.get(ka),d=o.get(Oo);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!==Hd.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=RT(f);d.error(typeof g=="string"?g:S("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function RT(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}ps.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof rs))throw Tl();const{codeActionProvider:s}=o.get(Di),r=o.get(Ho).getModel(e);if(!r)throw Tl();const a=Zi.isISelection(t)?Zi.liftSelection(t):te.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Tl();const d=typeof i=="string"?new _s(i):void 0,u=await lf(s,r,a,{type:1,triggerAction:rr.Default,filter:{includeSourceActions:!0,include:d}},Bl.None,vn.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(vn.None));try{return await Promise.all(f),u.validActions.map(p=>p.action)}finally{setTimeout(()=>u.dispose(),100)}});var NT=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},OT=function(o,e){return function(t,i){e(t,i,o)}},O1,ou;let H1=(ou=class{constructor(e){this.keybindingService=e}getResolver(){const e=new Dw(()=>this.keybindingService.getKeybindings().filter(t=>O1.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===R1?i={kind:fs.SourceOrganizeImports.value}:t.command===N1&&(i={kind:fs.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Ya.fromUser(i,{kind:_s.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 _s(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)}},O1=ou,ou.codeActionCommands=[d5,l5,u5,R1,N1],ou);H1=O1=NT([OT(0,Gs)],H1);vi("symbolIcon.arrayForeground",Js,S("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.booleanForeground",Js,S("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("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."));vi("symbolIcon.colorForeground",Js,S("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.constantForeground",Js,S("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("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."));vi("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."));vi("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."));vi("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."));vi("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."));vi("symbolIcon.fileForeground",Js,S("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.folderForeground",Js,S("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("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."));vi("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."));vi("symbolIcon.keyForeground",Js,S("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.keywordForeground",Js,S("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("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."));vi("symbolIcon.moduleForeground",Js,S("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.namespaceForeground",Js,S("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.nullForeground",Js,S("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.numberForeground",Js,S("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.objectForeground",Js,S("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.operatorForeground",Js,S("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.packageForeground",Js,S("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.propertyForeground",Js,S("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.referenceForeground",Js,S("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.snippetForeground",Js,S("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.stringForeground",Js,S("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.structForeground",Js,S("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.textForeground",Js,S("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.typeParameterForeground",Js,S("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.unitForeground",Js,S("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("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 h5=Object.freeze({kind:_s.Empty,title:S("codeAction.widget.id.more","More Actions...")}),HT=Object.freeze([{kind:fs.QuickFix,title:S("codeAction.widget.id.quickfix","Quick Fix")},{kind:fs.RefactorExtract,title:S("codeAction.widget.id.extract","Extract"),icon:Ji.wrench},{kind:fs.RefactorInline,title:S("codeAction.widget.id.inline","Inline"),icon:Ji.wrench},{kind:fs.RefactorRewrite,title:S("codeAction.widget.id.convert","Rewrite"),icon:Ji.wrench},{kind:fs.RefactorMove,title:S("codeAction.widget.id.move","Move"),icon:Ji.wrench},{kind:fs.SurroundWith,title:S("codeAction.widget.id.surround","Surround With"),icon:Ji.surroundWith},{kind:fs.Source,title:S("codeAction.widget.id.source","Source Action"),icon:Ji.symbolFile},h5]);function WT(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:h5,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=HT.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new _s(s.action.kind):_s.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:Ji.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}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)}},Yh;const A8=Rs("gutter-lightbulb",Ji.lightBulb,S("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),k8=Rs("gutter-lightbulb-auto-fix",Ji.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.")),B8=Rs("gutter-lightbulb-sparkle",Ji.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.")),F8=Rs("gutter-lightbulb-aifix-auto-fix",Ji.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.")),L8=Rs("gutter-lightbulb-sparkle-filled",Ji.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 da;(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})(da||(da={}));var Ll;let tp=(Ll=class extends Nt{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new xn),this.onClick=this._onClick.event,this._state=da.Hidden,this._gutterState=da.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+A8.id,"codicon-"+F8.id,"codicon-"+k8.id,"codicon-"+B8.id,"codicon-"+L8.id],this.gutterDecoration=Yh.GUTTER_DECORATION,this._domNode=xi("div.lightBulbWidget"),this._domNode.role="listbox",this._register(gA.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(_3(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=Uo(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(qn(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(Ys.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(c5))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(_9))==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}=Uo(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=Aw(g,u),C=f.spaceWidth*p>22,b=P=>P>2&&this._editor.getTopForLineNumber(P)===this._editor.getTopForLineNumber(P-1),E=this._editor.getLineDecorations(a);let y=!1;if(E)for(const P of E){const V=P.options.glyphMarginClassName;if(V&&!this.lightbulbClasses.some(U=>V.includes(U))){y=!0;break}}let A=a,I=1;if(!C){const P=V=>{const U=r.getLineContent(V);return/^\s*$|^\s+/.test(U)||U.length<=I};if(a>1&&!b(a-1)){const V=r.getLineCount(),U=a===V,J=a>1&&P(a-1),re=!U&&P(a+1),ae=P(a),ie=!re&&!J;if(!re&&!J&&!y)return this.gutterState=new da.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Yh._posPref}),this.renderGutterLightbub(),this.hide();J||U||J&&!ae?A-=1:(re||ie&&ae)&&(A+=1)}else if(a===1&&(a===r.getLineCount()||!P(a+1)&&!P(a)))if(this.gutterState=new da.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Yh._posPref}),y)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!b(a+1))A+=1;else if(d*f.spaceWidth<22)return this.hide();I=/^\S\s*$/.test(r.getLineContent(A))?2:1}this.state=new da.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Yh._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!==da.Hidden&&(this.state=da.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==da.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=da.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=Ji.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Ji.lightbulbSparkleAutofix:e=Ji.lightbulbAutofix:this.state.actions.hasAIFix?e=Ji.lightbulbSparkle:e=Ji.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=Qn.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=L8,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=F8:e=k8:this.gutterState.actions.hasAIFix?e=B8:e=A8,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=Bn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Qn.asClassName(e),glyphMargin:{position:Fv.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 te(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 te(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}},Yh=Ll,Ll.GUTTER_DECORATION=Bn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Qn.asClassName(Ji.lightBulb),glyphMargin:{position:Fv.Left},stickiness:1}),Ll.ID="editor.contrib.lightbulbWidget",Ll._posPref=[0],Ll);tp=Yh=zT([VT(1,Gs)],tp);var f5=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},W1=function(o,e){return function(t,i){e(t,i,o)}};const g5="acceptSelectedCodeAction",p5="previewSelectedCodeAction";class jT{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 z1=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 kw(e,Bw);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=Qn.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Ud(e.group.icon.color.id))):(i.icon.className=Qn.asClassName(Ji.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=x5(e.label),i.keybinding.set(e.keybinding),b3(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(g5))==null?void 0:a.getLabel(),s=(d=this._keybindingService.lookupKeybinding(p5))==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()}};z1=f5([W1(1,Gs)],z1);class $T extends UIEvent{constructor(){super("acceptSelectedAction")}}class I8 extends UIEvent{constructor(){super("previewSelectedAction")}}function UT(o){if(o.kind==="action")return o.label}let V1=class extends Nt{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 uo),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 Fw(e,this.domNode,a,[new z1(t,this._keybindingService),new jT],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:UT},accessibilityProvider:{getAriaLabel:d=>{if(d.kind==="action"){let u=d.label?x5(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(C3),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 I8:new $T;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 I8):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=f5([W1(4,X_),W1(5,Gs)],V1);function x5(o){return o.replace(/\r\n|\r|\n/g," ")}var qT=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},hC=function(o,e){return function(t,i){e(t,i,o)}};vi("actionBar.toggledBackground",Lw,S("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Ju={Visible:new Tn("codeActionMenuVisible",!1,S("codeActionMenuVisible","Whether the action widget list is visible"))},fh=Yl("actionWidgetService");let eh=class extends Nt{get isVisible(){return Ju.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new Er)}show(e,t,i,n,s,r,a){const d=Ju.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 Tt,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(qn(a,Ds.MOUSE_DOWN,b=>b.stopPropagation()));const d=document.createElement("div"),u=e.appendChild(d);u.classList.add("context-view-pointerBlock"),s.add(qn(u,Ds.POINTER_MOVE,()=>u.remove())),s.add(qn(u,Ds.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(Kf(e));return s.add(p.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=xi(e),n=new Wg(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};eh=qT([hC(0,X_),hC(1,Gn),hC(2,cn)],eh);Ql(fh,eh,1);const ix=1100;os(class extends Ko{constructor(){super({id:"hideCodeActionWidget",title:Ei("hideCodeActionWidget.title","Hide action widget"),precondition:Ju.Visible,keybinding:{weight:ix,primary:9,secondary:[1033]}})}run(o){o.get(fh).hide(!0)}});os(class extends Ko{constructor(){super({id:"selectPrevCodeAction",title:Ei("selectPrevCodeAction.title","Select previous action"),precondition:Ju.Visible,keybinding:{weight:ix,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(fh);e instanceof eh&&e.focusPrevious()}});os(class extends Ko{constructor(){super({id:"selectNextCodeAction",title:Ei("selectNextCodeAction.title","Select next action"),precondition:Ju.Visible,keybinding:{weight:ix,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(fh);e instanceof eh&&e.focusNext()}});os(class extends Ko{constructor(){super({id:g5,title:Ei("acceptSelected.title","Accept selected action"),precondition:Ju.Visible,keybinding:{weight:ix,primary:3,secondary:[2137]}})}run(o){const e=o.get(fh);e instanceof eh&&e.acceptSelected()}});os(class extends Ko{constructor(){super({id:p5,title:Ei("previewSelected.title","Preview selected action"),precondition:Ju.Visible,keybinding:{weight:ix,primary:2051}})}run(o){const e=o.get(fh);e instanceof eh&&e.acceptSelected(!0)}});const v5=new Tn("supportedCodeAction",""),P8="_typescript.applyFixAllCodeAction";class GT extends Nt{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new Np),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=>Lv(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:rr.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!==Zb.Off){{if(i===Zb.On)return t;if(i===Zb.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 Id;(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(dd(r))return m5;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(Id||(Id={}));const m5=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class KT extends Nt{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 Er),this._state=Id.Empty,this._onDidChangeState=this._register(new xn),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=v5.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(Id.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(Id.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 GT(this._editor,this._markerService,i=>{var d;if(!i){this.setState(Id.Empty);return}const n=i.selection.getStartPosition(),s=co(async u=>{var f,g,p,C,b,E,y,A,I,M;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===rr.QuickFix||(g=(f=i.trigger.filter)==null?void 0:f.include)!=null&&g.contains(fs.QuickFix))){const R=await lf(this._registry,e,i.selection,i.trigger,Bl.None,u),P=[...R.allActions];if(u.isCancellationRequested)return m5;const V=(p=R.validActions)==null?void 0:p.some(J=>J.action.kind?fs.QuickFix.contains(new _s(J.action.kind)):!1),U=this._markerService.read({resource:e.uri});if(V){for(const J of R.validActions)(b=(C=J.action.command)==null?void 0:C.arguments)!=null&&b.some(re=>typeof re=="string"&&re.includes(P8))&&(J.action.diagnostics=[...U.filter(re=>re.relatedInformation)]);return{validActions:R.validActions,allActions:P,documentation:R.documentation,hasAutoFix:R.hasAutoFix,hasAIFix:R.hasAIFix,allAIFixes:R.allAIFixes,dispose:()=>{R.dispose()}}}else if(!V&&U.length>0){const J=i.selection.getPosition();let re=J,ae=Number.MAX_VALUE;const ie=[...R.validActions];for(const Se of U){const Q=Se.endColumn,he=Se.endLineNumber,De=Se.startLineNumber;if(he===J.lineNumber||De===J.lineNumber){re=new Si(he,Q);const Fe={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:fs.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((A=i.trigger.context)==null?void 0:A.notAvailableMessage)||"",position:re}},ge=new Zi(re.lineNumber,re.column,re.lineNumber,re.column),Ne=await lf(this._registry,e,ge,Fe,Bl.None,u);if(Ne.validActions.length!==0){for(const Oe of Ne.validActions)(M=(I=Oe.action.command)==null?void 0:I.arguments)!=null&&M.some(pe=>typeof pe=="string"&&pe.includes(P8))&&(Oe.action.diagnostics=[...U.filter(pe=>pe.relatedInformation)]);R.allActions.length===0&&P.push(...Ne.allActions),Math.abs(J.column-Q)<ae?ie.unshift(...Ne.validActions):ie.push(...Ne.validActions)}ae=Math.abs(J.column-Q)}}const ve=ie.filter((Se,Q,he)=>he.findIndex(De=>De.action.title===Se.action.title)===Q);return ve.sort((Se,Q)=>Se.action.isPreferred&&!Q.action.isPreferred?-1:!Se.action.isPreferred&&Q.action.isPreferred||Se.action.isAI&&!Q.action.isAI?1:!Se.action.isAI&&Q.action.isAI?-1:0),{validActions:ve,allActions:P,documentation:R.documentation,hasAutoFix:R.hasAutoFix,hasAIFix:R.hasAIFix,allAIFixes:R.allAIFixes,dispose:()=>{R.dispose()}}}}if(i.trigger.type===1){const R=new or,P=await lf(this._registry,e,i.selection,i.trigger,Bl.None,u);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:P.validActions.length,duration:R.elapsed()}),P}return lf(this._registry,e,i.selection,i.trigger,Bl.None,u)});i.trigger.type===1&&((d=this._progressService)==null||d.showWhile(s,250));const r=new Id.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:rr.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 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},Ra=function(o,e){return function(t,i){e(t,i,o)}},Qh;const XT="quickfix-edit-highlight";var Wc;let l0=(Wc=class extends Nt{static get(e){return e.getContribution(Qh.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 Er),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new KT(this._editor,s.codeActionProvider,t,i,r,d,this._telemetryService)),this._register(this._model.onDidChangeState(p=>this.update(p))),this._lightBulbWidget=new Dw(()=>{const p=this._editor.getContribution(tp.ID);return p&&this._register(p.onClick(C=>this.showCodeActionsFromLightbulb(C.actions,C))),p}),this._resolver=n.createInstance(H1),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,Hd.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=ir.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(MT,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:rr.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){cs(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,Hd.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const g=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(g&&g.action.disabled){(r=ir.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=ir.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=Si.isIPosition(t)?this.toCoords(t):t,d={onSelect:async(u,f)=>{this._applyCodeAction(u,!0,!!f,i.fromLightbulb?Hd.FromAILightbulb:Hd.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 _s(p);g=[fs.RefactorExtract,fs.RefactorInline,fs.RefactorRewrite,fs.RefactorMove,fs.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:Qh.DECORATION})):p.map(E=>({range:E,options:Qh.DECORATION}));n.set(b)}else if(C&&C.length>0){const b=C.map(y=>({range:y,options:Qh.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;Zf(S("editingNewSelection","Context: {0} at line {1} and column {2}.",y,E.startLineNumber,E.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,WT(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=Uo(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}},Qh=Wc,Wc.ID="editor.contrib.codeActionController",Wc.DECORATION=Bn.register({description:"quickfix-highlight",className:XT}),Wc);l0=Qh=ZT([Ra(1,Iw),Ra(2,Gn),Ra(3,cn),Ra(4,Di),Ra(5,Op),Ra(6,ro),Ra(7,bs),Ra(8,fh),Ra(9,cn),Ra(10,ka)],l0);Y_((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(E3));const i=o.getColor(pA);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${zg(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function nx(o){return Ue.regex(v5.keys()[0],new RegExp("(\\s|^)"+Vg(o.value)+"\\b"))}const b9={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 gh(o,e,t,i,n=rr.Default){if(o.hasModel()){const s=l0.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class YT extends xt{constructor(){super({id:_9,label:S("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:Ue.and(G.writable,G.hasCodeActionsProvider),kbOpts:{kbExpr:G.textInputFocus,primary:2137,weight:100}})}run(e,t){return gh(t,S("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,rr.QuickFix)}}class QT extends Zo{constructor(){super({id:l5,precondition:Ue.and(G.writable,G.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:b9}]}})}runEditorCommand(e,t,i){const n=Ya.fromUser(i,{kind:_s.Empty,apply:"ifSingle"});return gh(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 JT extends xt{constructor(){super({id:d5,label:S("refactor.label","Refactor..."),alias:"Refactor...",precondition:Ue.and(G.writable,G.hasCodeActionsProvider),kbOpts:{kbExpr:G.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Ue.and(G.writable,nx(fs.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:b9}]}})}run(e,t,i){const n=Ya.fromUser(i,{kind:fs.Refactor,apply:"never"});return gh(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:fs.Refactor.contains(n.kind)?n.kind:_s.None,onlyIncludePreferredActions:n.preferred},n.apply,rr.Refactor)}}class eM extends xt{constructor(){super({id:u5,label:S("source.label","Source Action..."),alias:"Source Action...",precondition:Ue.and(G.writable,G.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Ue.and(G.writable,nx(fs.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:b9}]}})}run(e,t,i){const n=Ya.fromUser(i,{kind:fs.Source,apply:"never"});return gh(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:fs.Source.contains(n.kind)?n.kind:_s.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,rr.SourceAction)}}class tM extends xt{constructor(){super({id:R1,label:S("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:Ue.and(G.writable,nx(fs.SourceOrganizeImports)),kbOpts:{kbExpr:G.textInputFocus,primary:1581,weight:100}})}run(e,t){return gh(t,S("editor.action.organize.noneMessage","No organize imports action available"),{include:fs.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",rr.OrganizeImports)}}class iM extends xt{constructor(){super({id:N1,label:S("fixAll.label","Fix All"),alias:"Fix All",precondition:Ue.and(G.writable,nx(fs.SourceFixAll))})}run(e,t){return gh(t,S("fixAll.noneMessage","No fix all action available"),{include:fs.SourceFixAll,includeSourceActions:!0},"ifSingle",rr.FixAll)}}class nM extends xt{constructor(){super({id:c5,label:S("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:Ue.and(G.writable,nx(fs.QuickFix)),kbOpts:{kbExpr:G.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return gh(t,S("editor.action.autoFix.noneMessage","No auto fixes available"),{include:fs.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",rr.AutoFix)}}En(l0.ID,l0,3);En(tp.ID,tp,4);Te(YT);Te(JT);Te(eM);Te(tM);Te(nM);Te(iM);Bi(new QT);Da.as(Hp.Configuration).registerConfiguration({...Q_,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:S("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Da.as(Hp.Configuration).registerConfiguration({...Q_,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}}});Da.as(Hp.Configuration).registerConfiguration({...Q_,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 j1{constructor(){this.lenses=[],this._disposables=new Tt}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 _5(o,e,t){const i=o.ordered(e),n=new Map,s=new j1,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){Ws(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}ps.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Zn(rs.isUri(t)),Zn(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Di),s=o.get(Ho).getModel(t);if(!s)throw Tl();const r=[],a=new Tt;return _5(n,s,vn.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,vn.None)).then(g=>r.push(g||f.symbol)));return Promise.all(u)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var sM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},oM=function(o,e){return function(t,i){e(t,i,o)}};const b5=Yl("ICodeLensCache");class T8{constructor(e,t){this.lineCount=e,this.data=t}}let $1=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Wp(20,.75);const t="codelens/cache";y3(w3,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=Ys.filter(e.onWillSaveState,r=>r.reason===Pw.SHUTDOWN);Ys.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 j1;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new T8(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 te(a,1,a,11)});const r=new j1;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new T8(n.lineCount,r))}}catch{}}};$1=sM([oM(0,ud)],$1);Ql(b5,$1,1);class rM{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 Ng=class Ng{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${Ng._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=S3(r.command.title.trim());if(r.command.id){const d=`c${Ng._idPool++}`;i.push(xi("a",{id:d,title:r.command.tooltip,role:"button"},...a)),this._commands.set(d,r.command)}else i.push(xi("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(xi("span",void 0," | "))}}n?(Iv(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Iv(this._domNode,xi("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}};Ng._idPool=0;let U1=Ng;class fC{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 M8=Bn.register({collapseOnReplaceEdit:!0,description:"codelens"});class R8{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:M8},g=>this._decorationIds[f]=g),a?a=te.plusRange(a,u.symbol.range):a=te.lift(u.symbol.range)}),this._viewZone=new rM(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 U1(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&&te.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:M8},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 aM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},q0=function(o,e){return function(t,i){e(t,i,o)}},Rf;let ip=(Rf=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 Tt,this._localToDispose=new Tt,this._lenses=[],this._oldCodeLensModels=new Tt,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Qs(()=>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",Tw.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 Qs(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=co(r=>_5(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()},cs)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(ms(()=>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 fC;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(ms(()=>{if(this._editor.getModel()){const n=Xf.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 fC;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=Xf.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(d=>{const u=new fC;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 R8(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 R8(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=co(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},Ws):(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=>{cs(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}},Rf.ID="css.editor.codeLens",Rf);ip=aM([q0(1,Di),q0(2,Tr),q0(3,ro),q0(4,Oo),q0(5,b5)],ip);En(ip.ID,ip,1);Te(class extends xt{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:G.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(Xl),n=e.get(ro),s=e.get(Oo),r=t.getSelection().positionLineNumber,a=t.getContribution(ip.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 C5=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},q1=function(o,e){return function(t,i){e(t,i,o)}};let np=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 kn(new Yf(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),d=r?kn.Format.CSS.formatRGB(a):kn.Format.CSS.formatRGBA(a),u=r?kn.Format.CSS.formatHSL(a):kn.Format.CSS.formatHSLA(a),f=r?kn.Format.CSS.formatHex(a):kn.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}};np=C5([q1(0,Jl)],np);let G1=class extends Nt{constructor(e,t){super(),this._register(e.colorProvider.register("*",new np(t)))}};G1=C5([q1(0,Di),q1(1,Jl)],G1);S0(G1);async function E5(o,e,t,i=!0){return C9(new lM,o,e,t,i)}function y5(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class lM{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 cM{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 dM{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,vn.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function C9(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 np)r=f;else try{await o.compute(f,t,i,a)&&(s=!0)}catch(g){Ws(g)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function w5(o,e){const{colorProvider:t}=o.get(Di),i=o.get(Ho).getModel(e);if(!i)throw Tl();const n=o.get(bs).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}ps.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof rs))throw Tl();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=w5(o,t);return C9(new cM,n,i,vn.None,s)});ps.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof rs)||!Array.isArray(t)||t.length!==4||!te.isIRange(s))throw Tl();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:d}=w5(o,n),[u,f,g,p]=t;return C9(new dM({range:s,color:{red:u,green:f,blue:g,alpha:p}}),a,r,vn.None,d)});var uM=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},gC=function(o,e){return function(t,i){e(t,i,o)}},K1;const S5=Object.create({});var zc;let c0=(zc=class extends Nt{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Tt),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new xA(this._editor),this._decoratorLimitReporter=new hM,this._colorDecorationClassRefs=this._register(new Tt),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:K1.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 Np,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=co(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new or(!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){cs(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:Bn.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 Yf(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:hA,inlineClassName:`${p.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:S5}}})}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(te.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)}},K1=zc,zc.ID="editor.contrib.colorDetector",zc.RECOMPUTE_TIME=1e3,zc);c0=K1=uM([gC(1,bs),gC(2,Di),gC(3,Tr)],c0);class hM{constructor(){this._onDidChange=new xn,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}En(c0.ID,c0,1);class fM{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 xn,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new xn,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new xn,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 xr=xi;class gM extends Nt{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=xr(".colorpicker-header"),di(e,this._domNode),this._pickedColorNode=di(this._domNode,xr(".picked-color")),di(this._pickedColorNode,xr("span.codicon.codicon-color-mode")),this._pickedColorPresentation=di(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=di(this._domNode,xr(".original-color")),this._originalColorNode.style.backgroundColor=kn.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(FS)||kn.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(FS)||kn.white})),this._register(qn(this._pickedColorNode,Ds.CLICK,()=>this.model.selectNextColorPresentation())),this._register(qn(this._originalColorNode,Ds.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=kn.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 pM(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=kn.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 pM extends Nt{constructor(e){super(),this._onClicked=this._register(new xn),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),di(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),di(this._button,t),di(t,xr(".button"+Qn.asCSSSelector(Rs("color-picker-close",Ji.close,S("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(qn(this._button,Ds.CLICK,()=>{this._onClicked.fire()}))}}class xM extends Nt{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=xr(".colorpicker-body"),di(e,this._domNode),this._saturationBox=new vM(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 mM(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 _M(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 bM(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 kn(new iv(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new kn(new iv(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new kn(new iv(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 vM extends Nt{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new xn,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new xn,this.onColorFlushed=this._onColorFlushed.event,this._domNode=xr(".saturation-wrap"),di(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",di(this._domNode,this._canvas),this.selection=xr(".saturation-selection"),di(this._domNode,this.selection),this.layout(),this._register(qn(this._domNode,Ds.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 vA);const t=Uo(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=qn(e.target.ownerDocument,Ds.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 kn(new iv(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=kn.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 D5 extends Nt{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new xn,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new xn,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=di(e,xr(".standalone-strip")),this.overlay=di(this.domNode,xr(".standalone-overlay"))):(this.domNode=di(e,xr(".strip")),this.overlay=di(this.domNode,xr(".overlay"))),this.slider=di(this.domNode,xr(".slider")),this.slider.style.top="0px",this._register(qn(this.domNode,Ds.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 vA),i=Uo(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=qn(e.target.ownerDocument,Ds.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 mM extends D5{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 kn(new Yf(t,i,n,1)),r=new kn(new Yf(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class _M extends D5{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class bM extends Nt{constructor(e){super(),this._onClicked=this._register(new xn),this.onClicked=this._onClicked.event,this._button=di(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(qn(this._button,Ds.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class CM extends zp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(D3.getInstance(qd(e)).onDidChange(()=>this.layout())),this._domNode=xr(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new gM(this._domNode,this.model,n,s)),this.body=this._register(new xM(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class pC{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 fv{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 th{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const ph=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var A5=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},k5=function(o,e){return function(t,i){e(t,i,o)}};class EM{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 sp=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return Ca.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=c0.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 B5(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=F5(this,this._editor,this._themeService,t,e);if(!i)return new th([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new th([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};sp=A5([k5(1,ra)],sp);class yM{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let op=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!c0.get(this._editor))return null;const s=await E5(i,this._editor.getModel(),vn.None);let r=null,a=null;for(const g of s){const p=g.colorInfo;te.containsRange(p.range,e.range)&&(r=p,a=g.provider)}const d=r??e,u=a??t,f=!!r;return{colorHover:await B5(this,this._editor.getModel(),d,u),foundInEditor:f}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new te(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await gv(this._editor.getModel(),t,this._color,i,e),i=L5(this._editor,i,t))}renderHoverParts(e,t){return F5(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};op=A5([k5(1,ra)],op);async function B5(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:d}=t.color,u=new Yf(Math.round(s*255),Math.round(r*255),Math.round(a*255),d),f=new kn(u),g=await y5(e,t,i,vn.None),p=new fM(f,[],0);return p.colorPresentations=g||[],p.guessColorPresentation(f,n),o instanceof sp?new EM(o,te.lift(t.range),p,i):new yM(o,te.lift(t.range),p,i)}function F5(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const p=e.getOption(67)+8;n.setMinimumDimensions(new hs(302,p))}const s=new Tt,r=i[0],a=e.getModel(),d=r.model,u=s.add(new CM(n.fragment,d,e.getOption(144),t,o instanceof op));let f=!1,g=new te(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof op){const p=r.model.color;o.color=p,gv(a,d,p,g,r),s.add(d.onColorFlushed(C=>{o.color=C}))}else s.add(d.onColorFlushed(async p=>{await gv(a,d,p,g,r),f=!0,g=L5(e,g,d)}));return s.add(d.onDidChangeColor(p=>{gv(a,d,p,g,r)})),s.add(e.onDidChangeModelContent(p=>{f?f=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:u,disposables:s}}function L5(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=te.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function gv(o,e,t,i,n){const s=await y5(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,vn.None);e.colorPresentations=s||[]}const I5="editor.action.showHover",wM="editor.action.showDefinitionPreviewHover",SM="editor.action.scrollUpHover",DM="editor.action.scrollDownHover",AM="editor.action.scrollLeftHover",kM="editor.action.scrollRightHover",BM="editor.action.pageUpHover",FM="editor.action.pageDownHover",LM="editor.action.goToTopHover",IM="editor.action.goToBottomHover",yb="editor.action.increaseHoverVerbosityLevel",PM=S({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),wb="editor.action.decreaseHoverVerbosityLevel",TM=S({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),P5="editor.action.inlineSuggest.commit",T5="editor.action.inlineSuggest.showPrevious",M5="editor.action.inlineSuggest.showNext";var E9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Zr=function(o,e){return function(t,i){e(t,i,o)}},pv;let Z1=class extends Nt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Jo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=ns(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 Si(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Vp((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=CA((u,f)=>{const g=f.add(this.instantiationService.createInstance(d0,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(g),f.add(ms(()=>e.removeContentWidget(g))),f.add(Ss(p=>{this.position.read(p)&&r.lastTriggerKind.read(p)!==Ml.Explicit&&r.triggerExplicitly()})),g}),d=J_(this,(u,f)=>!!this.position.read(u)||!!f);s.add(Ss(u=>{d.read(u)&&a.read(u)}))}))}};Z1=E9([Zr(2,cn)],Z1);const MM=Rs("inline-suggestion-hints-next",Ji.chevronRight,S("parameterHintsNextIcon","Icon for show next parameter hint.")),RM=Rs("inline-suggestion-hints-previous",Ji.chevronLeft,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Vc;let d0=(Vc=class extends Nt{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new Qf(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${pv.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Xr("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Xr("div@toolBar")]),this.previousAction=this.createCommandAction(T5,S("previous","Previous"),Qn.asClassName(RM)),this.availableSuggestionCountAction=new Qf("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(M5,S("next","Next"),Qn.asClassName(MM)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(li.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Qs(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Qs(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(d.createInstance(X1,this.nodes.toolBar,li.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:p=>p.startsWith("primary")},actionViewItemProvider:(p,C)=>{if(p instanceof Jf)return d.createInstance(OM,p,void 0);if(p===this.availableSuggestionCountAction){const b=new NM(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=>{pv._dropDownVisible=p})),this._register(Ss(p=>{this._position.read(p),this.editor.layoutContentWidget(this)})),this._register(Ss(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(Ss(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 A of y)A instanceof Jf&&b.push(A);b.length>0&&b.unshift(new jg),this.toolBar.setAdditionalSecondaryActions(b)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},pv=Vc,Vc._dropDownVisible=!1,Vc.id=0,Vc);d0=pv=E9([Zr(6,ro),Zr(7,cn),Zr(8,Gs),Zr(9,Gn),Zr(10,ch)],d0);class NM extends YC{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 OM=class extends mA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Xr("div.keybinding").root;this._register(new kw(t,Bw,{disableTitle:!0,..._A})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},X1=class extends bA{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=[];Mw(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){al(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){al(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};X1=E9([Zr(3,ch),Zr(4,Gn),Zr(5,E0),Zr(6,Gs),Zr(7,ro),Zr(8,ka)],X1);function Sb(o,e,t){const i=Uo(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let HM=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class R5 extends Nt{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new xn),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Qs(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Qs(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Qs(()=>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=A3(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){cs(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 HM(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 y9{constructor(){this._onDidWillResize=new xn,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new xn,this.onDidResize=this._onDidResize.event,this._sashListener=new Tt,this._size=new hs(0,0),this._minSize=new hs(0,0),this._maxSize=new hs(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new nf(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new nf(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new nf(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:LS.North}),this._southSash=new nf(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:LS.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(Ys.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(Ys.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(Ys.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(Ys.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 hs(t,e);hs.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 WM=30,zM=24;class VM extends Nt{constructor(e,t=new hs(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new y9),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=hs.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 hs(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?Si.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:Uo(t).top+i.top-WM}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=Uo(t),s=jp(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-zM}_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 jM=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)}},Wa;const N8=30,$M=6;var jc;let Y1=(jc=class extends VM{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 hs(a,r);super(e,d),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new EA),this._onDidResize=this._register(new xn),this.onDidResize=this._onDidResize.event,this._minimumSize=d,this._hoverVisibleKey=G.hoverVisible.bindTo(t),this._hoverFocusedKey=G.hoverFocused.bindTo(t),di(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(Kf(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 Wa.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 Wa._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Wa._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){Wa._applyMaxDimensions(this._hover.contentsDomNode,e,t),Wa._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 hs(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Wa._lastDimensions=new hs(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=$M;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?jp(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=Uo(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=O8(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=O8(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,Wa._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Wa._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=sf(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&&k3(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 hs(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 hs(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 hs(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=sf(e),i=jr(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=sf(e),i=jr(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=sf(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-N8})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+N8})}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})}},Wa=jc,jc.ID="editor.contrib.resizableContentHoverWidget",jc._lastDimensions=new hs(0,0),jc);Y1=Wa=jM([Dx(1,Gn),Dx(2,bs),Dx(3,eb),Dx(4,Gs)],Y1);function O8(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 Jv{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 Ca.EMPTY;const i=Jv._getLineDecorations(this._editor,t);return Ca.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):Ca.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=Jv._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Hl(t)}}class N5{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 UM(this,this.anchor,t,this.isComplete)}}class UM extends N5{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}var qM=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},GM=function(o,e){return function(t,i){e(t,i,o)}};const H8=xi;let em=class extends Nt{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=H8("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=di(this.hoverElement,H8("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(B3.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=di(this.actionsElement,e);return this._hasContent=!0,t}};em=qM([GM(0,Gs)],em);class KM{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function ZM(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(Ws);if(!(!s||!XM(s)))return new KM(o,s,e)}function w9(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,d)=>ZM(a,d,e,t,i));return Ca.fromPromises(r).coalesce()}function O5(o,e,t,i,n=!1){return w9(o,e,t,i,n).map(s=>s.hover).toPromise()}Xo("_executeHoverProvider",(o,e,t)=>{const i=o.get(Di);return O5(i.hoverProvider,e,t,vn.None)});Xo("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(Di);return O5(i.hoverProvider,e,t,vn.None,!0)});function XM(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var YM=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},wd=function(o,e){return function(t,i){e(t,i,o)}};const cf=xi,QM=Rs("hover-increase-verbosity",Ji.add,S("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),JM=Rs("hover-decrease-verbosity",Ji.remove,S("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Qr{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 H5{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case Lr.Increase:return this.hover.canIncreaseVerbosity??!1;case Lr.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let rp=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 Qr(this,e.range,[new Fo().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 Qr(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 Qr(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,A=b.options.hoverMessage;if(!A||$g(A))continue;b.options.beforeContentClassName&&(C=!0);const I=new te(e.range.startLineNumber,E,e.range.startLineNumber,y);r.push(new Qr(this,I,yA(A),C,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return Ca.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):Ca.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return w9(e,t,s,n).filter(d=>!$g(d.hover.contents)).map(d=>{const u=d.hover.range?te.lift(d.hover.range):i.range,f=new H5(d.hover,d.provider,s);return new Qr(this,u,d.hover.contents,!1,d.ordinal,f)})}renderHoverParts(e,t){return this._renderedHoverParts=new eR(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))}};rp=YM([wd(1,Ba),wd(2,Aa),wd(3,bs),wd(4,Di),wd(5,Gs),wd(6,$p),wd(7,ro)],rp);class Ax{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class eR{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 Tt,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(ms(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(Up(n=>n.ordinal,tb)),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 Tt;if(r.add(i),!s)return new Ax(e,n,r);const a=s.supportsVerbosityAction(Lr.Increase),d=s.supportsVerbosityAction(Lr.Decrease);if(!a&&!d)return new Ax(e,n,r);const u=cf("div.verbosity-actions");return n.prepend(u),r.add(this._renderHoverExpansionAction(u,Lr.Increase,a)),r.add(this._renderHoverExpansionAction(u,Lr.Decrease,d)),new Ax(e,n,r)}_renderMarkdownHover(e,t){return W5(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new Tt,s=t===Lr.Increase,r=di(e,cf(Qn.asCSSSelector(s?QM:JM)));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,iR(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const d=()=>this._commandService.executeCommand(t===Lr.Increase?yb:wb);return n.add(new L3(r,d)),n.add(new I3(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 H5(a,r.hoverProvider,r.hoverPosition),u=s.hoverPart,f=new Qr(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===Lr.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new uo;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){Ws(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 Ax(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 tR(o,e,t,i,n){e.sort(Up(r=>r.ordinal,tb));const s=[];for(const r of e)s.push(W5(t,r,i,n,o.onContentsChanged));return new th(s)}function W5(o,e,t,i,n){const s=new Tt,r=cf("div.hover-row"),a=cf("div.hover-row-contents");r.appendChild(a);const d=e.contents;for(const f of d){if($g(f))continue;const g=cf("div.markdown-hover"),p=di(g,cf("div.hover-contents")),C=s.add(new D0({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 iR(o,e){switch(e){case Lr.Increase:{const t=o.lookupKeybinding(yb);return t?S("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):S("increaseVerbosity","Increase Hover Verbosity")}case Lr.Decrease:{const t=o.lookupKeybinding(wb);return t?S("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):S("decreaseVerbosity","Decrease Hover Verbosity")}}}function Q1(o,e){return!!o[e]}class xC{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=Q1(e.event,t.triggerModifier),this.hasSideBySideModifier=Q1(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class W8{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=Q1(e,t.triggerModifier)}}class kx{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 z8(o){return o==="altKey"?ll?new kx(57,"metaKey",6,"altKey"):new kx(5,"ctrlKey",6,"altKey"):ll?new kx(6,"altKey",57,"metaKey"):new kx(6,"altKey",5,"ctrlKey")}class Db extends Nt{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new xn),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new xn),this.onExecute=this._onExecute.event,this._onCancel=this._register(new xn),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=z8(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=z8(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 xC(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new xC(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new xC(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new W8(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new W8(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 z5{constructor(e,t){this.range=e,this.direction=t}}class S9{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new S9(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){Ws(t),this._isResolved=!1}}}const mf=class mf{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??mf._emptyInlayHintList,a])}catch(u){Ws(u)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new Z_;return new mf(i,s,t)}constructor(e,t,i){this._disposables=new Tt,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=mf._getRangeAtPosition(i,d);let g;f.getStartPosition().isBefore(d)?(g=te.fromPositions(f.getStartPosition(),d),u="after"):(g=te.fromPositions(d,f.getEndPosition()),u="before"),n.push(new S9(a,new z5(g,u),r))}}this.items=n.sort((s,r)=>Si.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 te(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 te(i,d+1,i,u+1)}};mf._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let tm=mf;function nR(o){return rs.from({scheme:jo.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}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},vl=function(o,e){return function(t,i){e(t,i,o)}};let oa=class extends P3{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){Rw(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};oa=sR([vl(4,cn),vl(5,zs),vl(6,ro),vl(7,Gn),vl(8,ra),vl(9,Oo),vl(10,eb),vl(11,ao),vl(12,Di)],oa);const V8=new kn(new Yf(0,122,204)),oR={showArrow:!0,showFrame:!0,className:"",frameColor:V8,arrowColor:V8,keepEditorSelection:!1},rR="vs.editor.contrib.zoneWidget";class aR{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 lR{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const a_=class a_{constructor(e){this._editor=e,this._ruleName=a_._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),IS(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(){IS(this._ruleName),R3(`.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:te.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};a_._IdGenerator=new M3(".arrow-decoration-");let J1=a_;class cR{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Tt,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=T3(t),Rw(this.options,oR,!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 J1(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=te.isIRange(e)?te.lift(e):te.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:Bn.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 aR(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 lR(rR+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 te(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 nf(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 V5=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},j5=function(o,e){return function(t,i){e(t,i,o)}};const $5=Yl("IPeekViewService");Ql($5,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 qo;(function(o){o.inPeekEditor=new Tn("inReferenceSearchEditor",!0,S("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(qo||(qo={}));var Nf;let im=(Nf=class{constructor(e,t){e instanceof oa&&qo.inPeekEditor.bindTo(t)}dispose(){}},Nf.ID="editor.contrib.referenceController",Nf);im=V5([j5(1,Gn)],im);En(im.ID,im,0);function dR(o){const e=o.get(zs).getFocusedCodeEditor();return e instanceof oa?e.getParentEditor():e}const uR={headerBackgroundColor:kn.white,primaryHeadingColor:kn.fromHex("#333333"),secondaryHeadingColor:kn.fromHex("#6c6c6cb3")};let nm=class extends cR{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new xn,this.onDidClose=this._onDidClose.event,Rw(this.options,uR,!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=xi(".head"),this._bodyElement=xi(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=xi(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),zl(this._titleElement,"click",s=>this._onTitleClick(s))),di(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=xi("span.filename"),this._secondaryHeading=xi("span.dirname"),this._metaHeading=xi("span.meta"),di(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=xi(".peekview-actions");di(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Wg(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new Qf("peekview.close",S("label.close","Close"),Qn.asClassName(Ji.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:N3.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:sl(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Yr(this._metaHeading)):gr(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`)}};nm=V5([j5(2,cn)],nm);const hR=vi("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:kn.black,hcLight:kn.white},S("peekViewTitleBackground","Background color of the peek view title area.")),U5=vi("peekViewTitleLabel.foreground",{dark:kn.white,light:kn.black,hcDark:kn.white,hcLight:qp},S("peekViewTitleForeground","Color of the peek view title.")),q5=vi("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},S("peekViewTitleInfoForeground","Color of the peek view title info.")),fR=vi("peekView.border",{dark:QC,light:QC,hcDark:Wl,hcLight:Wl},S("peekViewBorder","Color of the peek view borders and arrow.")),gR=vi("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:kn.black,hcLight:kn.white},S("peekViewResultsBackground","Background color of the peek view result list."));vi("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:kn.white,hcLight:qp},S("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));vi("peekViewResult.fileForeground",{dark:kn.white,light:"#1E1E1E",hcDark:kn.white,hcLight:qp},S("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));vi("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},S("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));vi("peekViewResult.selectionForeground",{dark:kn.white,light:"#6C6C6C",hcDark:kn.white,hcLight:qp},S("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const G5=vi("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:kn.black,hcLight:kn.white},S("peekViewEditorBackground","Background color of the peek view editor."));vi("peekViewEditorGutter.background",G5,S("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));vi("peekViewEditorStickyScroll.background",G5,S("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));vi("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},S("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));vi("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},S("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));vi("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:ju,hcLight:ju},S("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class rd{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=O3.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,cl(this.uri),this.range.startLineNumber,this.range.startColumn):S("aria.oneReference","in {0} on line {1} at column {2}",cl(this.uri),this.range.startLineNumber,this.range.startColumn)}}class pR{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 te(n,d.startColumn,n,s),f=new te(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 ap{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new td}dispose(){Io(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}",cl(this.uri),this.uri.fsPath):S("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,cl(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 pR(i))}catch(i){cs(i)}return this}}class nr{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new xn,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(nr._compareReferences);let n;for(const s of e)if((!n||!PS.isEqual(n.uri,s.uri,!0))&&(n=new ap(this,s.uri),this.groups.push(n)),n.children.length===0||nr._compareReferences(s,n.children[n.children.length-1])!==0){const r=new rd(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){Io(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new nr(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:Gp(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()&&te.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 PS.compare(e.uri,t.uri)||te.compareRangesUsingStarts(e.range,t.range)}}var Ab=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kb=function(o,e){return function(t,i){e(t,i,o)}},eE;let tE=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof nr||e instanceof ap}getChildren(e){if(e instanceof nr)return e.groups;if(e instanceof ap)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};tE=Ab([kb(0,Fa)],tE);class xR{getHeight(){return 23}getTemplateId(e){return e instanceof ap?sm.id:om.id}}let iE=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof rd){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return cl(e.uri)}};iE=Ab([kb(0,Gs)],iE);class vR{getId(e){return e instanceof rd?e.id:e.uri}}let nE=class extends Nt{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new wA(i,{supportHighlights:!0})),this.badge=new H3(di(i,xi(".count")),{},W3),e.appendChild(i)}set(e,t){const i=Nw(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))}};nE=Ab([kb(1,Ug)],nE);var ru;let sm=(ru=class{constructor(e){this._instantiationService=e,this.templateId=eE.id}renderTemplate(e){return this._instantiationService.createInstance(nE,e)}renderElement(e,t,i){i.set(e.element,ib(e.filterData))}disposeTemplate(e){e.dispose()}},eE=ru,ru.id="FileReferencesRenderer",ru);sm=eE=Ab([kb(0,cn)],sm);class mR extends Nt{constructor(e){super(),this.label=this._register(new z3(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(`${cl(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!qg.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,ib(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 mR(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};l_.id="OneReferenceRenderer";let om=l_;class _R{getWidgetAriaLabel(){return S("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var bR=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)}};const c_=class c_{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Tt,this._callOnModelChange=new Tt,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:c_.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(!te.equalsRange(s,n.range)){if(te.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()}};c_.DecorationOptions=Bn.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let sE=c_;class CR{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 ER extends $3{}let oE=class extends nm{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 Tt,this._callOnDispose=new Tt,this._onDidSelectReference=new xn,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new hs(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(),Io(this._preview),Io(this._previewNotAvailableMessage),Io(this._tree),Io(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(fR)||kn.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(hR)||kn.transparent,primaryHeadingColor:e.getColor(U5),secondaryHeadingColor:e.getColor(q5)})}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=di(e,xi("div.messages")),gr(this._messageContainer),this._splitView=new V3(e,{orientation:1}),this._previewContainer=di(e,xi("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(oa,this._previewContainer,t,{},this.editor),gr(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(kc,S("missingPreviewMessage","no preview available"),Gg,kc.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=di(e,xi("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new _R,keyboardNavigationLabelProvider:this._instantiationService.createInstance(iE),identityProvider:new vR,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:gR}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(zl(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(ER,"ReferencesWidget",this._treeContainer,new xR,[this._instantiationService.createInstance(sm),this._instantiationService.createInstance(om)],this._instantiationService.createInstance(tE),i),this._splitView.addView({onDidChange:Ys.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},TS.Distribute),this._splitView.addView({onDidChange:Ys.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)}},TS.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 rd&&(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")})),gr(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new hs(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"),Yr(this._messageContainer),Promise.resolve(void 0)):(gr(this._messageContainer),this._decorationsManager=new sE(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"),Yr(this._treeContainer),Yr(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 rd)return e;if(e instanceof ap&&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!==jo.inMemory?this.setTitle(j3(e.uri),this._uriLabel.getUriLabel(Nw(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}Io(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=te.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()}};oE=bR([Rh(3,ra),Rh(4,Fa),Rh(5,cn),Rh(6,$5),Rh(7,Ug),Rh(8,Gs)],oE);var yR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nh=function(o,e){return function(t,i){e(t,i,o)}},xv;const xh=new Tn("referenceSearchVisible",!1,S("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var au;let ih=(au=class{static get(e){return e.getContribution(xv.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 Tt,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=xh.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=CR.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(oE,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 Si(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=te.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=xv.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,co(d=>Promise.resolve(a)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,cs(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)}},xv=au,au.ID="editor.contrib.referencesController",au);ih=xv=yR([Nh(2,Gn),Nh(3,zs),Nh(4,Oo),Nh(5,cn),Nh(6,ud),Nh(7,bs)],ih);function vh(o,e){const t=dR(o);if(!t)return;const i=ih.get(t);i&&e(i)}hl.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:qs(2089,60),when:Ue.or(xh,qo.inPeekEditor),handler(o){vh(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});hl.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Ue.or(xh,qo.inPeekEditor),handler(o){vh(o,e=>{e.goToNextOrPreviousReference(!0)})}});hl.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Ue.or(xh,qo.inPeekEditor),handler(o){vh(o,e=>{e.goToNextOrPreviousReference(!1)})}});ps.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");ps.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");ps.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");ps.registerCommand("closeReferenceSearch",o=>vh(o,e=>e.closeWidget()));hl.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Ue.and(qo.inPeekEditor,Ue.not("config.editor.stablePeek"))});hl.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Ue.and(xh,Ue.not("config.editor.stablePeek"),Ue.or(G.editorTextFocus,U3.negate()))});hl.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Ue.and(xh,SA,DA.negate(),AA.negate()),handler(o){var i;const t=(i=o.get(Ow).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof rd&&vh(o,n=>n.revealReference(t[0]))}});hl.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Ue.and(xh,SA,DA.negate(),AA.negate()),handler(o){var i;const t=(i=o.get(Ow).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof rd&&vh(o,n=>n.openReference(t[0],!0,!0))}});ps.registerCommand("openReference",o=>{var i;const t=(i=o.get(Ow).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof rd&&vh(o,n=>n.openReference(t[0],!1,!0))});var K5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},og=function(o,e){return function(t,i){e(t,i,o)}};const D9=new Tn("hasSymbols",!1,S("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),Bb=Yl("ISymbolNavigationService");let rE=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=D9.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 aE(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(Lv(g.uri,a.uri))u=!0,f=f||te.containsPosition(g.range,d);else if(u)break;(!u||!f)&&this.reset()});this._currentState=kA(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:te.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)}};rE=K5([og(0,Gn),og(1,zs),og(2,Oo),og(3,Gs)],rE);Ql(Bb,rE,1);Bi(new class extends Zo{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:D9,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(Bb).revealNext(e)}});hl.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:D9,primary:9,handler(o){o.get(Bb).reset()}});let aE=class{constructor(e){this._listener=new Map,this._disposables=new Tt,this._onDidChange=new xn,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(),Io(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,kA(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)}};aE=K5([og(0,zs)],aE);function lE(o,e){return e.uri.scheme===o.uri.scheme?!0:!q3(e.uri,jo.walkThroughSnippet,jo.vscodeChatCodeBlock,jo.vscodeChatCodeCompareBlock)}async function sx(o,e,t,i,n){const r=t.ordered(o,i).map(d=>Promise.resolve(n(d,o,e)).then(void 0,u=>{Ws(u)})),a=await Promise.all(r);return Hl(a.flat()).filter(d=>lE(o,d))}function ox(o,e,t,i,n){return sx(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function A9(o,e,t,i,n){return sx(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function k9(o,e,t,i,n){return sx(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function B9(o,e,t,i,n){return sx(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function rx(o,e,t,i,n,s){return sx(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=>lE(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=>lE(a,C));return f&&f.length===1?f:u})}async function fl(o){const e=await o(),t=new nr(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}Xo("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Di),n=ox(i.definitionProvider,e,t,!1,vn.None);return fl(()=>n)});Xo("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Di),n=ox(i.definitionProvider,e,t,!0,vn.None);return fl(()=>n)});Xo("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Di),n=B9(i.typeDefinitionProvider,e,t,!1,vn.None);return fl(()=>n)});Xo("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Di),n=B9(i.typeDefinitionProvider,e,t,!0,vn.None);return fl(()=>n)});Xo("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Di),n=A9(i.declarationProvider,e,t,!1,vn.None);return fl(()=>n)});Xo("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(Di),n=A9(i.declarationProvider,e,t,!0,vn.None);return fl(()=>n)});Xo("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Di),n=rx(i.referenceProvider,e,t,!1,!1,vn.None);return fl(()=>n)});Xo("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(Di),n=rx(i.referenceProvider,e,t,!1,!0,vn.None);return fl(()=>n)});Xo("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Di),n=k9(i.implementationProvider,e,t,!1,vn.None);return fl(()=>n)});Xo("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(Di),n=k9(i.implementationProvider,e,t,!0,vn.None);return fl(()=>n)});ia.appendMenuItem(li.EditorContext,{submenu:li.EditorContextPeek,title:S("peek.submenu","Peek"),group:"navigation",order:100});class u0{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof u0||Si.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const zr=class zr extends Sa{static all(){return zr._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of Pl.wrap(t.menu))(i.id===li.EditorContext||i.id===li.EditorContextPeek)&&(i.when=Ue.and(e.precondition,i.when));return t}constructor(e,t){super(zr._patchConfig(t)),this.configuration=e,zr._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Oo),r=e.get(zs),a=e.get(Op),d=e.get(Bb),u=e.get(Di),f=e.get(cn),g=t.getModel(),p=t.getPosition(),C=u0.is(i)?i:new u0(g,p),b=new Gf(t,5),E=Rp(this._getLocationModel(u,C.model,C.position,b.token),b.token).then(async y=>{var M;if(!y||b.token.isCancellationRequested)return;na(y.ariaMessage);let A;if(y.referenceAt(g.uri,p)){const R=this._getAlternativeCommand(t);!zr._activeAlternativeCommands.has(R)&&zr._allSymbolNavigationCommands.has(R)&&(A=zr._allSymbolNavigationCommands.get(R))}const I=y.references.length;if(I===0){if(!this.configuration.muteMessage){const R=g.getWordAtPosition(p);(M=ir.get(t))==null||M.showMessage(this._getNoResultFoundMessage(R),p)}}else if(I===1&&A)zr._activeAlternativeCommands.add(this.desc.id),f.invokeFunction(R=>A.runEditorCommand(R,t,i,n).finally(()=>{zr._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 oa)&&(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(G3(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:te.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=ih.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),co(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};zr._allSymbolNavigationCommands=new Map,zr._activeAlternativeCommands=new Set;let ql=zr;class ax extends ql{async _getLocationModel(e,t,i,n){return new nr(await ox(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 $c;os(($c=class extends ax{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:$c.id,title:{...Ei("actions.goToDecl.label","Go to Definition"),mnemonicTitle:S({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:G.hasDefinitionProvider,keybinding:[{when:G.editorTextFocus,primary:70,weight:100},{when:Ue.and(G.editorTextFocus,BA),primary:2118,weight:100}],menu:[{id:li.EditorContext,group:"navigation",order:1.1},{id:li.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),ps.registerCommandAlias("editor.action.goToDeclaration",$c.id)}},$c.id="editor.action.revealDefinition",$c));var Uc;os((Uc=class extends ax{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Uc.id,title:Ei("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:Ue.and(G.hasDefinitionProvider,G.isInEmbeddedEditor.toNegated()),keybinding:[{when:G.editorTextFocus,primary:qs(2089,70),weight:100},{when:Ue.and(G.editorTextFocus,BA),primary:qs(2089,2118),weight:100}]}),ps.registerCommandAlias("editor.action.openDeclarationToTheSide",Uc.id)}},Uc.id="editor.action.revealDefinitionAside",Uc));var qc;os((qc=class extends ax{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:qc.id,title:Ei("actions.previewDecl.label","Peek Definition"),precondition:Ue.and(G.hasDefinitionProvider,qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated()),keybinding:{when:G.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:li.EditorContextPeek,group:"peek",order:2}}),ps.registerCommandAlias("editor.action.previewDeclaration",qc.id)}},qc.id="editor.action.peekDefinition",qc));class Z5 extends ql{async _getLocationModel(e,t,i,n){return new nr(await A9(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 lu;os((lu=class extends Z5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:lu.id,title:{...Ei("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:S({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:Ue.and(G.hasDeclarationProvider,G.isInEmbeddedEditor.toNegated()),menu:[{id:li.EditorContext,group:"navigation",order:1.3},{id:li.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")}},lu.id="editor.action.revealDeclaration",lu));os(class extends Z5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Ei("actions.peekDecl.label","Peek Declaration"),precondition:Ue.and(G.hasDeclarationProvider,qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated()),menu:{id:li.EditorContextPeek,group:"peek",order:3}})}});class X5 extends ql{async _getLocationModel(e,t,i,n){return new nr(await B9(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 cu;os((cu=class extends X5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:cu.ID,title:{...Ei("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:S({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:G.hasTypeDefinitionProvider,keybinding:{when:G.editorTextFocus,primary:0,weight:100},menu:[{id:li.EditorContext,group:"navigation",order:1.4},{id:li.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},cu.ID="editor.action.goToTypeDefinition",cu));var du;os((du=class extends X5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:du.ID,title:Ei("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:Ue.and(G.hasTypeDefinitionProvider,qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated()),menu:{id:li.EditorContextPeek,group:"peek",order:4}})}},du.ID="editor.action.peekTypeDefinition",du));class Y5 extends ql{async _getLocationModel(e,t,i,n){return new nr(await k9(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 uu;os((uu=class extends Y5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:uu.ID,title:{...Ei("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:S({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:G.hasImplementationProvider,keybinding:{when:G.editorTextFocus,primary:2118,weight:100},menu:[{id:li.EditorContext,group:"navigation",order:1.45},{id:li.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},uu.ID="editor.action.goToImplementation",uu));var hu;os((hu=class extends Y5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:hu.ID,title:Ei("actions.peekImplementation.label","Peek Implementations"),precondition:Ue.and(G.hasImplementationProvider,qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated()),keybinding:{when:G.editorTextFocus,primary:3142,weight:100},menu:{id:li.EditorContextPeek,group:"peek",order:5}})}},hu.ID="editor.action.peekImplementation",hu));class Q5 extends ql{_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}}os(class extends Q5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Ei("goToReferences.label","Go to References"),mnemonicTitle:S({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:Ue.and(G.hasReferenceProvider,qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated()),keybinding:{when:G.editorTextFocus,primary:1094,weight:100},menu:[{id:li.EditorContext,group:"navigation",order:1.45},{id:li.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new nr(await rx(e.referenceProvider,t,i,!0,!1,n),S("ref.title","References"))}});os(class extends Q5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Ei("references.action.label","Peek References"),precondition:Ue.and(G.hasReferenceProvider,qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated()),menu:{id:li.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new nr(await rx(e.referenceProvider,t,i,!1,!1,n),S("ref.title","References"))}});class wR extends ql{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Ei("label.generic","Go to Any Symbol"),precondition:Ue.and(qo.notInPeekEditor,G.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new nr(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""}}ps.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:rs},{name:"position",description:"The position at which to start",constraint:Si.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)=>{Zn(rs.isUri(e)),Zn(Si.isIPosition(t)),Zn(Array.isArray(i)),Zn(typeof n>"u"||typeof n=="string"),Zn(typeof r>"u"||typeof r=="boolean");const a=o.get(zs),d=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(FA(d))return d.setPosition(t),d.revealPositionInCenterIfOutsideViewport(t,0),d.invokeWithinContext(u=>{const f=new class extends wR{_getNoResultFoundMessage(g){return s||super._getNoResultFoundMessage(g)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);u.get(cn).invokeFunction(f.run.bind(f),d)})}});ps.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:rs},{name:"position",description:"The position at which to start",constraint:Si.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(ro).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});ps.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Zn(rs.isUri(e)),Zn(Si.isIPosition(t));const i=o.get(Di),n=o.get(zs);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!FA(s)||!s.hasModel())return;const r=ih.get(s);if(!r)return;const a=co(u=>rx(i.referenceProvider,s.getModel(),Si.lift(t),!1,!1,u).then(f=>new nr(f,S("ref.title","References")))),d=new te(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(d,a,!1))})}});ps.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function SR(o,e,t,i){const n=o.get(Fa),s=o.get(E0),r=o.get(ro),a=o.get(cn),d=o.get(Oo);if(await i.item.resolve(vn.None),!i.part.location)return;const u=i.part.location,f=[],g=new Set(ia.getMenuItems(li.EditorContext).map(C=>K3(C)?C.command.id:Cb()));for(const C of ql.all())g.has(C.desc.id)&&f.push(new Qf(C.desc.id,Jf.label(C.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const b=await n.createModelReference(u.uri);try{const E=new u0(b.object.textEditorModel,te.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 jg),f.push(new Qf(C.id,C.title,void 0,!0,async()=>{try{await r.executeCommand(C.id,...C.arguments??[])}catch(b){d.notify({severity:Hw.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=Uo(t);return{x:C.left,y:C.top+C.height+8}},getActions:()=>f,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function J5(o,e,t,i){const s=await o.get(Fa).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,d=r.get(Gn),u=qo.inPeekEditor.getValue(d),f=!a&&t.getOption(89)&&!u;return new ax({openToSide:a,openInPeek:f,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new u0(s.object.textEditorModel,te.getStartPosition(i.range)),te.lift(i.range))}),s.dispose()}var DR=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)}},Jh;class rm{constructor(){this._entries=new Wp(50)}get(e){const t=rm._key(e);return this._entries.get(t)}set(e,t){const i=rm._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const eB=Yl("IInlayHintsCache");Ql(eB,rm,1);class cE{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 AR{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var Il;let lp=(Il=class{static get(e){return e.getContribution(Jh.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 Tt,this._sessionDisposables=new Tt,this._decorationsMetadata=new Map,this._ruleFactory=new xA(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(Z3.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(ms(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new Qs(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new uo;const d=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const u=n.token,f=await tm.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){cs(u)}finally{n.dispose(),d.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(ms(()=>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 Tt,t=e.add(new Db(this._editor)),i=new Tt;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 uo;i.add(ms(()=>d.dispose(!0))),r.item.resolve(d.token),this._activeInlayHintPart=r.part.command||r.part.location?new AR(r,s.hasTriggerModifier):void 0;const u=a.validatePosition(r.item.hint.position).lineNumber,f=new te(u,1,u,a.getLineMaxColumn(u)),g=this._getInlineHintsForRange(f);this._updateHintsDecorators([f],g),i.add(ms(()=>{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(J5,n,this._editor,r.location):X3.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(vn.None),_r(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>Fs.replace(te.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!Y3(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(SR,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 Ww&&(t==null?void 0:t.attachedData)instanceof cE)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:Hw.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 z5(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(te.compareRangesUsingStarts)){const r=t.validateRange(new te(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!te.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=te.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var b,E;const i=[],n=(y,A,I,M,R)=>{const P={content:I,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:A.className,cursorStops:M,attachedData:R};i.push({item:y,classNameRef:A,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?P:void 0}}})},s=(y,A)=>{const I=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(y,I," ",A?of.Right:of.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>Jh._MAX_LABEL_LEN)continue;y.hint.paddingLeft&&s(y,!1);const A=typeof y.hint.label=="string"?[{label:y.hint.label}]:y.hint.label;for(let I=0;I<A.length;I++){const M=A[I],R=I===0,P=I===A.length-1,V={fontSize:`${r}px`,fontFamily:`var(${f}), ${Tw.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};_r(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=Ks(Q3),V.cursor="pointer")),d&&(R&&P?(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`):P?(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 U=M.label;g.totalLen+=U.length;let J=!1;const re=g.totalLen-Jh._MAX_LABEL_LEN;if(re>0&&(U=U.slice(0,-re)+"…",J=!0),n(y,this._ruleFactory.createClassNameRef(V),kR(U),P&&!y.hint.paddingRight?of.Right:of.None,new cE(y,I)),J)break}if(y.hint.paddingRight&&s(y,!0),i.length>Jh._MAX_DECORATORS)break}const p=[];for(const[y,A]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),A.classNameRef.dispose(),this._decorationsMetadata.delete(y))}const C=Xf.capture(this._editor);this._editor.changeDecorations(y=>{const A=y.deltaDecorations(p,i.map(I=>I.decoration));for(let I=0;I<A.length;I++){const M=i[I];this._decorationsMetadata.set(A[I],M)}}),C.restore(this._editor)}_fillInColors(e,t){t.kind===MS.Parameter?(e.backgroundColor=Ks(J3),e.color=Ks(e4)):t.kind===MS.Type?(e.backgroundColor=Ks(t4),e.color=Ks(i4)):(e.backgroundColor=Ks(n4),e.color=Ks(s4))}_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()}},Jh=Il,Il.ID="editor.contrib.InlayHints",Il._MAX_DECORATORS=1500,Il._MAX_LABEL_LEN=43,Il);lp=Jh=DR([Oh(1,Di),Oh(2,Tr),Oh(3,eB),Oh(4,ro),Oh(5,Oo),Oh(6,cn)],lp);function kR(o){return o.replace(/[ \t]/g," ")}ps.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Zn(rs.isUri(t)),Zn(te.isIRange(i));const{inlayHintsProvider:n}=o.get(Di),s=await o.get(Fa).createModelReference(t);try{const r=await tm.create(n,s.object.textEditorModel,[te.lift(i)],vn.None),a=r.items.map(d=>d.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var BR=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},fc=function(o,e){return function(t,i){e(t,i,o)}};class j8 extends fv{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let am=class extends rp{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(!lp.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof Ww&&i.attachedData instanceof cE?new j8(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof j8?new Ca(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 Fo().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Qr(this,e.range,[r],!1,0)),_r(s.item.hint.textEdits)&&n.emitOne(new Qr(this,e.range,[new Fo().appendText(S("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new Fo().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Qr(this,e.range,[a],!1,1)),s.part.location||s.part.command){let u;const g=this._editor.getOption(78)==="altKey"?ll?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):ll?S("links.navigate.kb.alt.mac","option + click"):S("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?u=new Fo().appendText(S("hint.defAndCommand","Go to Definition ({0}), right click for more",g)):s.part.location?u=new Fo().appendText(S("hint.def","Go to Definition ({0})",g)):s.part.command&&(u=new Fo(`[${S("hint.cmd","Execute Command")}](${nR(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),u&&n.emitOne(new Qr(this,e.range,[u],!1,1e4))}const d=await this._resolveInlayHintLabelPartHover(s,i);for await(const u of d)n.emitOne(u)}):Ca.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return Ca.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)?w9(this._languageFeaturesService.hoverProvider,r,new Si(n.startLineNumber,n.startColumn),t).filter(a=>!$g(a.hover.contents)).map(a=>new Qr(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):Ca.EMPTY}finally{s.dispose()}}};am=BR([fc(1,Ba),fc(2,Aa),fc(3,Gs),fc(4,$p),fc(5,bs),fc(6,Fa),fc(7,Di),fc(8,ro)],am);class F9 extends Nt{constructor(e,t,i,n,s,r){super();const a=t.anchor,d=t.hoverParts;this._renderedHoverParts=this._register(new dE(e,i,d,r,s));const{showAtPosition:u,showAtSecondaryPosition:f}=F9.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 Si(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 Si(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 d_=class d_ extends Nt{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 Nt.None;let i=t[0].range;for(const s of t){const r=s.range;i=te.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:d_._DECORATION_OPTIONS}]),ms(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new em(n),r={fragment:this._fragment,statusBar:s,...i},a=new Tt;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})),ms(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new th([])}_renderStatusBar(e,t){if(t.hasContent)return new FR(e,t)}_registerListenersOnRenderedParts(){const e=new Tt;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(qn(n,Ds.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(qn(n,Ds.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof rp&&!(i instanceof am));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof sp)}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 e0;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};d_._DECORATION_OPTIONS=Bn.register({description:"content-hover-highlight",className:"hoverHighlight"});let dE=d_;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},$8=function(o,e){return function(t,i){e(t,i,o)}};let uE=class extends Nt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new xn),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(Y1,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new Jv(this._editor,this._participants),this._hoverOperation=this._register(new R5(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of ph.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 N5(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(zl(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(zl(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(nb.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 F9(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 pC(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 pC(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||!Sb(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new pC(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}};uE=LR([$8(1,cn),$8(2,Gs)],uE);var IR=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},U8=function(o,e){return function(t,i){e(t,i,o)}},hE,fu;let ko=(fu=class extends Nt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new xn),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Tt,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Qs(()=>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(hE.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?Sb(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===I5||t.commandId===yb||t.commandId===wb)&&((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)||d0.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(uE,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()}},hE=fu,fu.ID="editor.contrib.contentHover",fu);ko=hE=IR([U8(1,cn),U8(2,Gs)],ko);const bS=class bS extends Nt{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!==S5||!i.range)return;const n=this._editor.getContribution(ko.ID);if(n&&!n.isColorPickerVisible){const s=new te(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};bS.ID="editor.contrib.colorContribution";let lm=bS;En(lm.ID,lm,2);ph.register(sp);var tB=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},df=function(o,e){return function(t,i){e(t,i,o)}},fE,gE,gu;let nh=(gu=class extends Nt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=G.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=G.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(pE,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(fE.ID)}},fE=gu,gu.ID="editor.contrib.standaloneColorPickerController",gu);nh=fE=tB([df(1,Gn),df(2,cn)],nh);En(nh.ID,nh,1);const q8=8,PR=22;var pu;let pE=(pu=class extends Nt{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 xn),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(op,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(Kf(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 gE.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 TR(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 np(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 em(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-PR-q8,g=a.body.enterButton;g==null||g.onClicked(()=>{this.updateEditor(),this.hide()});const p=a.header,C=p.pickedColorNode;C.style.width=u+q8+"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)}},gE=pu,pu.ID="editor.contrib.standaloneColorPickerWidget",pu);pE=gE=tB([df(3,cn),df(4,Gs),df(5,Di),df(6,Jl)],pE);class TR{constructor(e,t){this.value=e,this.foundInEditor=t}}class MR extends Sa{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Ei("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:li.CommandPalette}],metadata:{description:Ei("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=nh.get(t))==null||i.showOrFocus()}}class RR extends xt{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:G.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Ei("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=nh.get(t))==null||i.hide()}}class NR extends xt{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:G.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Ei("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=nh.get(t))==null||i.insertColor()}}Te(RR);Te(NR);os(MR);class Lc{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),A=p.substring(0,b);(y.indexOf(i)>=0||A.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=Lc._createRemoveBlockCommentOperations(new te(a,C+t.length+1,u,b+1),t,i)):(E=Lc._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 te.isEmpty(e)?n.push(Fs.delete(new te(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(Fs.delete(new te(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(Fs.delete(new te(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return te.isEmpty(e)?s.push(Fs.replace(new te(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(Fs.insert(new Si(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(Fs.insert(new Si(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 Zi(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 Zi(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class bl{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=JC(E);if(y===-1){C.ignore=r,C.commentStrOffset=E.length;continue}if(u=!1,C.ignore=!1,C.commentStrOffset=y,f&&!Lc._haystackHasNeedleAtOffset(E,C.commentStr,y)&&(e===0?f=!1:e===1||(C.ignore=!0)),f&&t){const A=y+C.commentStrLength;A<E.length&&E.charCodeAt(A)===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=bl._gatherPreflightCommentStrings(i,n,s,d);return u===null?{supported:!1}:bl._analyzeLines(e,t,i,u,n,r,a,d)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=bl._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(bl._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new Si(n.positionLineNumber,n.positionColumn);for(let a=0,d=s.length;a<d;a++)t.addEditOperation(s[a].range,s[a].text),te.isEmpty(s[a].range)&&te.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?Lc._createRemoveBlockCommentOperations(new te(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=JC(u);f===-1&&(f=u.length),d=Lc._createAddBlockCommentOperations(new te(i.startLineNumber,f+1,i.startLineNumber,u.length+1),r,a,this._insertSpace)}else d=Lc._createAddBlockCommentOperations(new te(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 te(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=bl._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 Zi(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(Fs.delete(new te(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(Fs.insert(new Si(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=bl.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=bl.nextVisibleColumn(g,n,f.charCodeAt(r)===9,1);g>s?t[d].commentStrOffset=r-1:t[d].commentStrOffset=r}}}class L9 extends xt{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(ao);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)=>te.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 bl(i,f.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,f.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class OR extends L9{constructor(){super(0,{id:"editor.action.commentLine",label:S("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:li.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class HR extends L9{constructor(){super(1,{id:"editor.action.addCommentLine",label:S("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2081),weight:100}})}}class WR extends L9{constructor(){super(2,{id:"editor.action.removeCommentLine",label:S("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2099),weight:100}})}}class zR extends xt{constructor(){super({id:"editor.action.blockComment",label:S("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:li.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(ao);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new Lc(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}Te(OR);Te(HR);Te(WR);Te(zR);var VR=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},Sd=function(o,e){return function(t,i){e(t,i,o)}},xE,xu;let h0=(xu=class{static get(e){return e.getContribution(xE.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 Tt,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&&o4(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 r4){const u=this._getMenuActions(e,d.item.submenu);u.length>0&&(i.push(new RS(d.id,d.label,u)),a++)}else i.push(d),a++;a&&i.push(new jg)}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=Uo(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)&&!e1;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 YC(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const d=r;return typeof d.getActionViewItem=="function"?d.getActionViewItem():new YC(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()||a4(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 RS(`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 jg),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)&&!e1;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()}},xE=xu,xu.ID="editor.contrib.contextmenu",xu);h0=xE=VR([Sd(1,E0),Sd(2,X_),Sd(3,Gn),Sd(4,Gs),Sd(5,ch),Sd(6,bs),Sd(7,qf)],h0);class jR extends xt{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:G.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=h0.get(t))==null||i.showContextMenu()}}En(h0.ID,h0,2);Te(jR);class vC{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 mC{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const u_=class u_ extends Nt{static get(e){return e.getContribution(u_.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 vC(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new mC(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 mC(new vC(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 mC(new vC(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}};u_.ID="editor.contrib.cursorUndoRedoController";let f0=u_;class $R extends xt{constructor(){super({id:"cursorUndo",label:S("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:G.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=f0.get(t))==null||n.cursorUndo()}}class UR extends xt{constructor(){super({id:"cursorRedo",label:S("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=f0.get(t))==null||n.cursorRedo()}}En(f0.ID,f0,0);Te($R);Te(UR);class qR{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 te(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 Zi(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 Zi(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 Zi(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 Zi(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 Zi(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 Hh(o){return ll?o.altKey:o.ctrlKey}const Cc=class Cc extends Nt{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)||(Hh(e)&&(this._modifierPressed=!0),this._mouseDown&&Hh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Hh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Cc.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}Hh(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 Si(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 Zi(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new Zi(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(Hh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Cc.ID,new qR(this._dragSelection,t,Hh(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 te(e.lineNumber,e.column,e.lineNumber,e.column),options:Cc._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()}};Cc.ID="editor.contrib.dragAndDrop",Cc.TRIGGER_KEY_VALUE=ll?6:5,Cc._DECORATION_OPTIONS=Bn.register({description:"dnd-target",className:"dnd-target"});let cm=Cc;En(cm.ID,cm,2);En(Ul.ID,Ul,0);S0(L1);Bi(new class extends Zo{constructor(){super({id:s5,precondition:v9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=Ul.get(e))==null?void 0:t.changePasteType()}});Bi(new class extends Zo{constructor(){super({id:"editor.hidePasteWidget",precondition:v9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=Ul.get(e))==null||t.clearWidgets()}});var vu;Te((vu=class extends xt{constructor(){super({id:"editor.action.pasteAs",label:S("pasteAs","Paste As..."),alias:"Paste As...",precondition:G.writable,metadata:{description:"Paste as",args:[{name:"args",schema:vu.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=Ul.get(t))==null?void 0:s.pasteAs(n?new _s(n):void 0)}},vu.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.")}}},vu));Te(class extends xt{constructor(){super({id:"editor.action.pasteAsText",label:S("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:G.writable})}run(o,e){var t;return(t=Ul.get(e))==null?void 0:t.pasteAs({providerId:Xu.id})}});class GR{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 G8{constructor(e){this.identifier=e}}const iB=Yl("treeViewsDndService");Ql(iB,GR,1);var KR=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},Bx=function(o,e){return function(t,i){e(t,i,o)}},vE;const nB="editor.experimental.dropIntoEditor.defaultProvider",sB="editor.changeDropType",I9=new Tn("dropWidgetVisible",!1,S("dropWidgetVisible","Whether the drop widget is showing"));var mu;let g0=(mu=class extends Nt{static get(e){return e.getContribution(vE.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=B1.getInstance(),this._dropProgressManager=this._register(t.createInstance(Xv,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(Qv,"dropIntoEditor",e,I9,{id:sB,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=co(async r=>{const a=new Tt,d=a.add(new Gf(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([te.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 Tt,a=await Rp(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=Hl(a??[]).flat();return{edits:i5(d),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(nB,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new _s(s),a=t.findIndex(d=>r.value===d.providerId&&d.handledMimeType&&G6(n,[d.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new q6;const t=X6(e.dataTransfer);if(this.treeItemsTransfer.hasData(G8.prototype)){const i=this.treeItemsTransfer.getData(G8.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}},vE=mu,mu.ID="editor.contrib.dropIntoEditorController",mu);g0=vE=KR([Bx(1,cn),Bx(2,bs),Bx(3,Di),Bx(4,iB)],g0);En(g0.ID,g0,2);S0(F1);Bi(new class extends Zo{constructor(){super({id:sB,precondition:I9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=g0.get(e))==null||i.changeDropType()}});Bi(new class extends Zo{constructor(){super({id:"editor.hideDropWidget",precondition:I9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=g0.get(e))==null||i.clearWidgets()}});Da.as(Hp.Configuration).registerConfiguration({...Q_,properties:{[nB]:{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 Do=class Do{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===Do._FIND_MATCH_DECORATION||n===Do._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,Do._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,Do._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 te(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,Do._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=Do._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=Do._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 te(g,1,p,1),options:Do._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),g=E.startLineNumber,p=E.endLineNumber)}s.push({range:new te(g,1,p,1),options:Do._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,Do._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}};Do._CURRENT_FIND_MATCH_DECORATION=Bn.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Ks(Xb),position:nl.Center},minimap:{color:Ks(NS),position:1}}),Do._FIND_MATCH_DECORATION=Bn.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Ks(Xb),position:nl.Center},minimap:{color:Ks(NS),position:1}}),Do._FIND_MATCH_NO_OVERVIEW_DECORATION=Bn.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),Do._FIND_MATCH_ONLY_OVERVIEW_DECORATION=Bn.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Ks(Xb),position:nl.Center}}),Do._RANGE_HIGHLIGHT_DECORATION=Bn.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),Do._FIND_SCOPE_DECORATION=Bn.register({description:"find-scope",className:"findScope",isWholeLine:!0});let mE=Do;class ZR{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)=>te.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 oB(o,e){if(o&&o[0]!==""){const t=K8(o,e,"-"),i=K8(o,e,"_");return t&&!i?Z8(o,e,"-"):!t&&i?Z8(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():l4(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 K8(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function Z8(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=oB([n[a]],r)+t}),s.slice(0,-1)}class X8{constructor(e){this.staticValue=e,this.kind=0}}class XR{constructor(e){this.pieces=e,this.kind=1}}class p0{static fromStaticValue(e){return new p0([Jd.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new X8(""):e.length===1&&e[0].staticValue!==null?this._state=new X8(e[0].staticValue):this._state=new XR(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?oB(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=p0._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 Jd{static staticValue(e){return new Jd(e,-1,null)}static caseOps(e,t){return new Jd(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 YR{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++]=Jd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Jd.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Jd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new p0(this._result)}}function QR(o){if(!o||o.length===0)return new p0(null);const e=[],t=new YR(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 ic=new Tn("findWidgetVisible",!1);ic.toNegated();const Fb=new Tn("findInputFocussed",!1),P9=new Tn("replaceInputFocussed",!1),Fx={primary:545,mac:{primary:2593}},Lx={primary:565,mac:{primary:2613}},Ix={primary:560,mac:{primary:2608}},Px={primary:554,mac:{primary:2602}},Tx={primary:558,mac:{primary:2606}},ls={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"},Ic=19999,JR=240;class Sg{constructor(e,t){this._toDispose=new Tt,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Np,this._decorations=new mE(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Qs(()=>{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,Io(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)},JR)):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 te(a.startLineNumber,1,d,this._editor.getModel().getLineMaxColumn(d))}return a}));const n=this._findMatches(i,!1,Ic);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=LA(n.map(d=>d.range),d=>te.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 Si(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()<Ic){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=Sg._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 Si(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 Si(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<Ic){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=Sg._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 Si(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?QR(this._state.replaceString):p0.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 Mp(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new Si(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=>Sg._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>=Ic?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new c4(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 IA(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 ZR(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 Zi(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 h_=class h_ extends zp{constructor(e,t,i){super(),this._hideSoon=this._register(new Qs(()=>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:Ud(TA),inputActiveOptionForeground:Ud(PA),inputActiveOptionBackground:Ud(Lw)},s=this._register(t1());this.caseSensitive=this._register(new d4({appendTitle:this._keybindingLabelFor(ls.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 u4({appendTitle:this._keybindingLabelFor(ls.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 h4({appendTitle:this._keybindingLabelFor(ls.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(qn(this._domNode,Ds.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(qn(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 h_.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")}};h_.ID="editor.contrib.findOptionsWidget";let _E=h_;function Mx(o,e){return o===1?!0:o===2?!1:e}class eN extends Nt{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Mx(this._isRegexOverride,this._isRegex)}get wholeWord(){return Mx(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Mx(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Mx(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 xn),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"&&(te.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=>!te.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>=Ic}}const tN=S("defaultLabel","input"),iN=S("label.preserveCaseToggle","Preserve Case");class nN extends MA{constructor(e){super({icon:Ji.preserveCase,title:iN+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??sb("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class sN extends zp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new xn),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new xn),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new xn),this._onInput=this._register(new xn),this._onKeyUp=this._register(new xn),this._onPreserveCaseKeyDown=this._register(new xn),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||tN;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 f4(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 nN({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(),Pv.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 rB=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},aB=function(o,e){return function(t,i){e(t,i,o)}};const T9=new Tn("suggestWidgetVisible",!1,S("suggestWidgetVisible","Whether suggestion are visible")),M9="historyNavigationWidgetFocus",lB="historyNavigationForwardsEnabled",cB="historyNavigationBackwardsEnabled";let Nl;const Rx=[];function dB(o,e){if(Rx.includes(e))throw new Error("Cannot register the same widget multiple times");Rx.push(e);const t=new Tt,i=new Tn(M9,!1).bindTo(o),n=new Tn(lB,!0).bindTo(o),s=new Tn(cB,!0).bindTo(o),r=()=>{i.set(!0),Nl=e},a=()=>{i.set(!1),Nl===e&&(Nl=void 0)};return p4(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(ms(()=>{Rx.splice(Rx.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let bE=class extends g4{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(dB(s,this.inputBox))}};bE=rB([aB(3,Gn)],bE);let CE=class extends sN{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(dB(r,this.inputBox))}};CE=rB([aB(3,Gn)],CE);hl.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Ue.and(Ue.has(M9),Ue.equals(cB,!0),Ue.not("isComposing"),T9.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{Nl==null||Nl.showPreviousValue()}});hl.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Ue.and(Ue.has(M9),Ue.equals(lB,!0),Ue.not("isComposing"),T9.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{Nl==null||Nl.showNextValue()}});function Y8(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 Q8=Rs("find-collapsed",Ji.chevronRight,S("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),J8=Rs("find-expanded",Ji.chevronDown,S("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),oN=Rs("find-selection",Ji.selection,S("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),rN=Rs("find-replace",Ji.replace,S("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),aN=Rs("find-replace-all",Ji.replaceAll,S("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),lN=Rs("find-previous-match",Ji.arrowUp,S("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),cN=Rs("find-next-match",Ji.arrowDown,S("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),dN=S("label.findDialog","Find / Replace"),uN=S("label.find","Find"),hN=S("placeholder.find","Find"),fN=S("label.previousMatchButton","Previous Match"),gN=S("label.nextMatchButton","Next Match"),pN=S("label.toggleSelectionFind","Find in Selection"),xN=S("label.closeButton","Close"),vN=S("label.replace","Replace"),mN=S("placeholder.replace","Replace"),_N=S("label.replaceButton","Replace"),bN=S("label.replaceAllButton","Replace All"),CN=S("label.toggleReplaceButton","Toggle Replace"),EN=S("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",Ic),yN=S("label.matchesLocation","{0} of {1}"),eD=S("label.noResults","No results"),Na=419,wN=275,SN=wN-54;let G0=69;const DN=33,tD="ctrlEnterReplaceAll.windows.donotask",iD=ll?256:2048;class _C{constructor(e){this.afterLineNumber=e,this.heightInPx=DN,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function nD(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function sD(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const f_=class f_ extends zp{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(tD,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new id(500),this._register(ms(()=>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 _C(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=Fb.bindTo(r),this._findFocusTracker=this._register(Kf(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=P9.bindTo(r),this._replaceFocusTracker=this._register(Kf(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 _C(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 f_.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=jr(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,cs)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){var t;this._matchesCount.style.minWidth=G0+"px",this._state.matchesCount>=Ic?this._matchesCount.title=EN: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>=Ic&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=zw(yN,n,i)}else e=eD;this._matchesCount.appendChild(document.createTextNode(e)),na(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),G0=Math.max(G0,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===eD)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=Uo(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=x4(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 _C(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&&jr(this._domNode)>Na){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=jr(this._findInput.domNode);return}if(Na+28+n>=i&&(r=!0),Na+28+n-G0>=i&&(a=!0),Na+28+n-G0>=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=jr(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&&!te.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(iD|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 nD(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return sD(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(iD|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{G_&&w0&&!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(tD,!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 nD(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return sD(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 bE(null,this._contextViewProvider,{width:SN,label:uN,placeholder:hN,appendCaseSensitiveLabel:this._keybindingLabelFor(ls.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(ls.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(ls.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:()=>Y8(this._keybindingService),inputBoxStyles:HS,toggleStyles:OS},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()})),v4&&this._register(this._findInput.onMouseDown(f=>this._onFindInputMouseDown(f))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(t1());this._prevBtn=this._register(new Wh({label:fN+this._keybindingLabelFor(ls.PreviousMatchFindAction),icon:lN,hoverDelegate:i,onTrigger:()=>{rf(this._codeEditor.getAction(ls.PreviousMatchFindAction)).run().then(void 0,cs)}},this._hoverService)),this._nextBtn=this._register(new Wh({label:gN+this._keybindingLabelFor(ls.NextMatchFindAction),icon:cN,hoverDelegate:i,onTrigger:()=>{rf(this._codeEditor.getAction(ls.NextMatchFindAction)).run().then(void 0,cs)}},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 MA({icon:oN,title:pN+this._keybindingLabelFor(ls.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Ud(Lw),inputActiveOptionBorder:Ud(TA),inputActiveOptionForeground:Ud(PA)})),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 Wh({label:xN+this._keybindingLabelFor(ls.CloseFindWidgetCommand),icon:RA,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 CE(null,void 0,{label:vN,placeholder:mN,appendPreserveCaseLabel:this._keybindingLabelFor(ls.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>Y8(this._keybindingService),inputBoxStyles:HS,toggleStyles:OS},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(t1());this._replaceBtn=this._register(new Wh({label:_N+this._keybindingLabelFor(ls.ReplaceOneAction),icon:rN,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:f=>{f.equals(1026)&&(this._closeBtn.focus(),f.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Wh({label:bN+this._keybindingLabelFor(ls.ReplaceAllAction),icon:aN,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 Wh({label:CN,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=jr(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=dN,this._domNode.role="dialog",this._domNode.style.width=`${Na}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 nf(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let u=Na;this._register(this._resizeSash.onDidStart(()=>{u=jr(this._domNode)})),this._register(this._resizeSash.onDidChange(f=>{this._resized=!0;const g=u+f.startX-f.currentX;if(g<Na)return;const p=parseFloat(m4(this._domNode).maxWidth)||0;g>p||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=jr(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const f=jr(this._domNode);if(f<Na)return;let g=Na;if(!this._resized||f===Na){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=jr(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};f_.ID="editor.contrib.findWidget";let EE=f_;class Wh extends zp{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+Qn.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??sb("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(...Qn.asClassNameArray(Q8)),this._domNode.classList.add(...Qn.asClassNameArray(J8))):(this._domNode.classList.remove(...Qn.asClassNameArray(J8)),this._domNode.classList.add(...Qn.asClassNameArray(Q8)))}}Y_((o,e)=>{const t=o.getColor(pA);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${zg(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(_4);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${zg(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(Wl);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(b4);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(C4);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var uB=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},Br=function(o,e){return function(t,i){e(t,i,o)}},yE;const AN=524288;function wE(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)<AN)return o.getModel().getValueInRange(i)}return null}var _u;let Go=(_u=class extends Nt{get editor(){return this._editor}static get(e){return e.getContribution(yE.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=ic.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new id(500),this._state=this._register(new eN),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!!Fb.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=Vg(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=wE(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=Vg(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=wE(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 Sg(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)}},yE=_u,_u.ID="editor.contrib.findController",_u);Go=yE=uB([Br(1,Gn),Br(2,ud),Br(3,y0),Br(4,Oo),Br(5,$p)],Go);let SE=class extends Go{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 EE(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new _E(this._editor,this._state,this._keybindingService))}};SE=uB([Br(1,X_),Br(2,Gn),Br(3,Gs),Br(4,ra),Br(5,Oo),Br(6,ud),Br(7,y0),Br(8,$p)],SE);const kN=NA(new OA({id:ls.StartFindAction,label:S("startFindAction","Find"),alias:"Find",precondition:Ue.or(G.focus,Ue.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:li.MenubarEditMenu,group:"3_find",title:S({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));kN.addImplementation(0,(o,e,t)=>{const i=Go.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 BN={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 xt{constructor(){super({id:ls.StartFindWithArgs,label:S("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:BN})}async run(e,t,i){const n=Go.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 LN extends xt{constructor(){super({id:ls.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=Go.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 hB extends xt{async run(e,t){const i=Go.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 IN extends hB{constructor(){super({id:ls.NextMatchFindAction,label:S("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:G.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Ue.and(G.focus,Fb),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class PN extends hB{constructor(){super({id:ls.PreviousMatchFindAction,label:S("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:G.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Ue.and(G.focus,Fb),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class TN extends xt{constructor(){super({id:ls.GoToMatchFindAction,label:S("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:ic}),this._highlightDecorations=[]}run(e,t,i){const n=Go.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(Oo).notify({severity:Hw.Warning,message:S("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get(Xl),a=new Tt,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:Ks(HA),position:nl.Full}}}])})}}class fB extends xt{async run(e,t){const i=Go.get(t);if(!i)return;const n=wE(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 MN extends fB{constructor(){super({id:ls.NextSelectionMatchFindAction,label:S("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:G.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class RN extends fB{constructor(){super({id:ls.PreviousSelectionMatchFindAction,label:S("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:G.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const NN=NA(new OA({id:ls.StartFindReplaceAction,label:S("startReplace","Replace"),alias:"Replace",precondition:Ue.or(G.focus,Ue.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:li.MenubarEditMenu,group:"3_find",title:S({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));NN.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=Go.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})});En(Go.ID,SE,0);Te(FN);Te(LN);Te(IN);Te(PN);Te(TN);Te(MN);Te(RN);const La=Zo.bindToContribution(Go.get);Bi(new La({id:ls.CloseFindWidgetCommand,precondition:ic,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:Ue.and(G.focus,Ue.not("isComposing")),primary:9,secondary:[1033]}}));Bi(new La({id:ls.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:G.focus,primary:Fx.primary,mac:Fx.mac,win:Fx.win,linux:Fx.linux}}));Bi(new La({id:ls.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:G.focus,primary:Lx.primary,mac:Lx.mac,win:Lx.win,linux:Lx.linux}}));Bi(new La({id:ls.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:G.focus,primary:Ix.primary,mac:Ix.mac,win:Ix.win,linux:Ix.linux}}));Bi(new La({id:ls.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:G.focus,primary:Px.primary,mac:Px.mac,win:Px.win,linux:Px.linux}}));Bi(new La({id:ls.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:G.focus,primary:Tx.primary,mac:Tx.mac,win:Tx.win,linux:Tx.linux}}));Bi(new La({id:ls.ReplaceOneAction,precondition:ic,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:G.focus,primary:3094}}));Bi(new La({id:ls.ReplaceOneAction,precondition:ic,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:Ue.and(G.focus,P9),primary:3}}));Bi(new La({id:ls.ReplaceAllAction,precondition:ic,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:G.focus,primary:2563}}));Bi(new La({id:ls.ReplaceAllAction,precondition:ic,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:Ue.and(G.focus,P9),primary:void 0,mac:{primary:2051}}}));Bi(new La({id:ls.SelectAllMatchesAction,precondition:ic,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:G.focus,primary:515}}));const ON={0:" ",1:"u",2:"r"},oD=65535,pa=16777215,rD=4278190080;class bC{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 pr{constructor(e,t,i){if(e.length!==t.length||e.length>oD)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new bC(e.length),this._userDefinedStates=new bC(e.length),this._recoveredStates=new bC(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>pa||r>pa)throw new Error("startLineNumber or endLineNumber must not exceed "+pa);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]&pa}getEndLineNumber(e){return this._endIndexes[e]&pa}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 HN(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&rD)>>>24)+((this._endIndexes[e]&rD)>>>16);return t===oD?-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]=`[${ON[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&pa,endLineNumber:this._endIndexes[e]&pa,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 pr(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,A)=>Array.isArray(y)?(I=>I<A?y[I]:void 0):(I=>I<A?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 A=u,I=g;for(;;){if(!I||I.startLineNumber>f.endLineNumber){y=f;break}if(I.source===1&&I.endLineNumber>f.endLineNumber)break;I=a(++A)}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 HN{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 WN{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new xn,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new pr(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(pr.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=pr.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(pr.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=pr.sanitizeAndMerge(this._regions,t,i);this.updatePost(pr.fromFoldRanges(n))}_getLinesChecksum(e,t){return WA(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 R9(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 P0(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 gB(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 zN(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 VN(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 pB(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 N9(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 O9(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 jN(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 $N(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 UN(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 qN{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new xn,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||E4(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 te(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 aD(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!GN(r,n))&&(n=aD(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 GN(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function aD(o,e){const t=LA(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const KN=5e3,ZN="indent";class H9{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=ZN}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(QN(this.editorModel,i,n,this.foldingRangesLimit))}}let XN=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>pa||t>pa)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 pr(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=Aw(g,s);(p<n||p===n&&i++<t)&&(r[u]=f,a[u]=this._endIndexes[d],u++)}return new pr(r,a)}}};const YN={limit:KN,update:()=>{}};function QN(o,e,t,i=YN){const n=o.getOptions().tabSize,s=new XN(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=Aw(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 JN=vi("editor.foldBackground",{light:ol(WS,.3),dark:ol(WS,.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);vi("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."));vi("editorGutter.foldingControlForeground",y4,S("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const dm=Rs("folding-expanded",Ji.chevronDown,S("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),um=Rs("folding-collapsed",Ji.chevronRight,S("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),lD=Rs("folding-manual-collapsed",um,S("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),cD=Rs("folding-manual-expanded",dm,S("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),CC={color:Ks(JN),position:1},zh=S("linesCollapsed","Click to expand the range."),Nx=S("linesExpanded","Click to collapse the range."),Hs=class Hs{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?Hs.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?Hs.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Hs.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:Hs.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?Hs.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Hs.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Hs.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Hs.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?Hs.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Hs.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?Hs.MANUALLY_EXPANDED_VISUAL_DECORATION:Hs.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};Hs.COLLAPSED_VISUAL_DECORATION=Bn.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:zh,firstLineDecorationClassName:Qn.asClassName(um)}),Hs.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=Bn.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:CC,isWholeLine:!0,linesDecorationsTooltip:zh,firstLineDecorationClassName:Qn.asClassName(um)}),Hs.MANUALLY_COLLAPSED_VISUAL_DECORATION=Bn.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:zh,firstLineDecorationClassName:Qn.asClassName(lD)}),Hs.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=Bn.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:CC,isWholeLine:!0,linesDecorationsTooltip:zh,firstLineDecorationClassName:Qn.asClassName(lD)}),Hs.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=Bn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:zh}),Hs.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=Bn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:CC,isWholeLine:!0,linesDecorationsTooltip:zh}),Hs.EXPANDED_VISUAL_DECORATION=Bn.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Qn.asClassName(dm),linesDecorationsTooltip:Nx}),Hs.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=Bn.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Qn.asClassName(dm),linesDecorationsTooltip:Nx}),Hs.MANUALLY_EXPANDED_VISUAL_DECORATION=Bn.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Qn.asClassName(cD),linesDecorationsTooltip:Nx}),Hs.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=Bn.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Qn.asClassName(cD),linesDecorationsTooltip:Nx}),Hs.NO_CONTROLS_EXPANDED_RANGE_DECORATION=Bn.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),Hs.HIDDEN_RANGE_DECORATION=Bn.register({description:"folding-hidden-range-decoration",stickiness:1});let DE=Hs;const eO={},tO="syntax";class W9{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=tO,this.disposables=new Tt,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return iO(this.providers,this.editorModel,e).then(t=>{var i;return t?sO(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function iO(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,eO,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})}},Ws));return Promise.all(n).then(s=>i)}class nO{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>pa||t>pa)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 pr(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 pr(n,s,r)}}}function sO(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 nO(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 oO=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},K0=function(o,e){return function(t,i){e(t,i,o)}},Bd;const xo=new Tn("foldingEnabled",!1);var bu;let ad=(bu=class extends Nt{static get(e){return e.getContribution(Bd.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=Bd._foldingRangeSelector)==null?void 0:n.call(Bd,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 Tt),this.editor=e,this._foldingLimitReporter=new xB(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 DE(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=xo.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 WN(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new qN(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new id(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Qs(()=>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 H9(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=Bd.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new W9(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 or,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=co(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const u=s.setCollapsedAllOfType(Kp.Imports.value,!0);u&&(r=Xf.capture(this.editor),this._currentModelHasFoldedImports=u)}const a=this.editor.getSelections();e.update(s,rO(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=>(cs(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,cs)}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)}},Bd=bu,bu.ID="editor.contrib.folding",bu);ad=Bd=oO([K0(1,Gn),K0(2,ao),K0(3,Oo),K0(4,Tr),K0(5,Di)],ad);class xB{constructor(e){this.editor=e,this._onDidChange=new xn,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 Eo extends xt{runEditorCommand(e,t,i){const n=e.get(ao),s=ad.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 rO(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 vB(o){if(!eg(o)){if(!zA(o))return!1;const e=o;if(!eg(e.levels)&&!zS(e.levels)||!eg(e.direction)&&!fA(e.direction)||!eg(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(zS)))return!1}return!0}class aO extends Eo{constructor(){super({id:"editor.unfold",label:S("unfoldAction.label","Unfold"),alias:"Unfold",precondition:xo,kbOpts:{kbExpr:G.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:vB,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"?gB(t,!1,s,r):P0(t,!1,s,r)}}class lO extends Eo{constructor(){super({id:"editor.unfoldRecursively",label:S("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2142),weight:100}})}invoke(e,t,i,n){P0(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class cO extends Eo{constructor(){super({id:"editor.fold",label:S("foldAction.label","Fold"),alias:"Fold",precondition:xo,kbOpts:{kbExpr:G.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:vB,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"?zN(t,!0,s):a==="up"?gB(t,!0,r||1,s):P0(t,!0,r||1,s)}}class dO extends Eo{constructor(){super({id:"editor.toggleFold",label:S("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);R9(t,1,n)}}class uO extends Eo{constructor(){super({id:"editor.foldRecursively",label:S("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);P0(t,!0,Number.MAX_VALUE,n)}}class hO extends Eo{constructor(){super({id:"editor.toggleFoldRecursively",label:S("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);R9(t,Number.MAX_VALUE,n)}}class fO extends Eo{constructor(){super({id:"editor.foldAllBlockComments",label:S("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())O9(t,Kp.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*"+Vg(a.blockCommentStartToken));N9(t,d,!0)}}}}class gO extends Eo{constructor(){super({id:"editor.foldAllMarkerRegions",label:S("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())O9(t,Kp.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);N9(t,d,!0)}}}}class pO extends Eo{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:S("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())O9(t,Kp.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);N9(t,d,!1)}}}}class xO extends Eo{constructor(){super({id:"editor.foldAllExcept",label:S("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);pB(t,!0,n)}}class vO extends Eo{constructor(){super({id:"editor.unfoldAllExcept",label:S("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);pB(t,!1,n)}}class mO extends Eo{constructor(){super({id:"editor.foldAll",label:S("foldAllAction.label","Fold All"),alias:"Fold All",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2069),weight:100}})}invoke(e,t,i){P0(t,!0)}}class _O extends Eo{constructor(){super({id:"editor.unfoldAll",label:S("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2088),weight:100}})}invoke(e,t,i){P0(t,!1)}}const _f=class _f extends Eo{getFoldingLevel(){return parseInt(this.id.substr(_f.ID_PREFIX.length))}invoke(e,t,i){VN(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};_f.ID_PREFIX="editor.foldLevel",_f.ID=e=>_f.ID_PREFIX+e;let hm=_f;class bO extends Eo{constructor(){super({id:"editor.gotoParentFold",label:S("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=jN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class CO extends Eo{constructor(){super({id:"editor.gotoPreviousFold",label:S("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=$N(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class EO extends Eo{constructor(){super({id:"editor.gotoNextFold",label:S("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=UN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class yO extends Eo{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:S("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(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=pr.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(pr.fromFoldRanges(a))}}}}class wO extends Eo{constructor(){super({id:"editor.removeManualFoldingRanges",label:S("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(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()}}}En(ad.ID,ad,0);Te(aO);Te(lO);Te(cO);Te(uO);Te(hO);Te(mO);Te(_O);Te(fO);Te(gO);Te(pO);Te(xO);Te(vO);Te(dO);Te(bO);Te(CO);Te(EO);Te(yO);Te(wO);for(let o=1;o<=7;o++)w4(new hm({id:hm.ID(o),label:S("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:xo,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2048|21+o),weight:100}}));ps.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof rs))throw Tl();const i=o.get(Di),n=o.get(Ho).getModel(t);if(!n)throw Tl();const s=o.get(bs);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(ao),a=s.getValue("editor.foldingStrategy",{resource:t}),d={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(C,b)=>{}},u=new H9(n,r,d);let f=u;if(a!=="indentation"){const C=ad.getFoldingRangeProviders(i,n);C.length&&(f=new W9(n,C,()=>{},d,u))}const g=await f.compute(vn.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?Kp.fromValue(b):void 0})}return p}finally{f.dispose()}});class SO extends xt{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){Kg.setZoomLevel(Kg.getZoomLevel()+1)}}class DO extends xt{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){Kg.setZoomLevel(Kg.getZoomLevel()-1)}}class AO extends xt{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){Kg.setZoomLevel(0)}}Te(SO);Te(DO);Te(AO);var mB=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)}},Of;let fm=(Of=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new Tt,this._sessionDisposables=new Tt,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 Tv;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 uo,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}});S4(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||_r(r)&&(this._accessibilitySignalService.playSignal(jA.format,{userGesture:!1}),D4.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},Of.ID="editor.contrib.autoFormat",Of);fm=mB([Dg(1,Di),Dg(2,Jl),Dg(3,VA)],fm);var Hf;let gm=(Hf=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Tt,this._callOnModel=new Tt,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($A,this.editor,e,2,Bl.None,vn.None,!1).catch(cs))}},Hf.ID="editor.contrib.formatOnPaste",Hf);gm=mB([Dg(1,Di),Dg(2,cn)],gm);class kO extends xt{constructor(){super({id:"editor.action.formatDocument",label:S("formatDocument.label","Format Document"),alias:"Format Document",precondition:Ue.and(G.notInCompositeEditor,G.writable,G.hasDocumentFormattingProvider),kbOpts:{kbExpr:G.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(cn);await e.get(Op).showWhile(i.invokeFunction(A4,t,1,Bl.None,vn.None,!0),250)}}}class BO extends xt{constructor(){super({id:"editor.action.formatSelection",label:S("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:Ue.and(G.writable,G.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2084),weight:100},contextMenuOpts:{when:G.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(cn),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new te(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(Op).showWhile(i.invokeFunction($A,t,s,1,Bl.None,vn.None,!0),250)}}En(fm.ID,fm,2);En(gm.ID,gm,2);Te(kO);Te(BO);ps.registerCommand("editor.action.format",async o=>{const e=o.get(zs).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(ro);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 uf{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 AE extends uf{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class _B extends uf{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class El extends uf{static create(e,t,i){const n=new uo(i),s=new El(t.uri),r=e.ordered(t),a=r.map((u,f)=>{const g=uf.findId(`provider_${f}`,s),p=new _B(g,s,u.displayName??"Unknown Outline Provider",f);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(C=>{for(const b of C||[])El._makeOutlineElement(b,p);return p},C=>(Ws(C),p)).then(C=>{uf.empty(C)?C.remove():s._groups.set(g,C)})}),d=e.onDidChange(()=>{const u=e.ordered(t);al(u,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?El.create(e,t,i):s._compact()).finally(()=>{n.dispose(),d.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=uf.findId(e,t),n=new AE(i,t,e);if(e.children)for(const s of e.children)El._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=Pl.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 AE?e.push(t.symbol):e.push(...Pl.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>te.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return El._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>Si.compare(te.getStartPosition(i.range),te.getStartPosition(n.range))||Si.compare(te.getEndPosition(n.range),te.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&&El._flattenDocumentSymbols(e,n.children,n.name)}}const lx=Yl("IOutlineModelService");let kE=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Tt,this._cache=new Wp(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()||!al(s.provider,n)){const a=new uo;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:El.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()}}};kE=FO([EC(0,Di),EC(1,Tr),EC(2,Ho)],kE);Ql(lx,kE,1);ps.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;Zn(rs.isUri(t));const i=o.get(lx),s=await o.get(Fa).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,vn.None)).getTopLevelSymbols()}finally{s.dispose()}});const ja=class ja extends Nt{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=ja.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=ja.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=ja.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=ja.suppressSuggestions.bindTo(this.contextKeyService),this._register(Ss(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(Ss(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=JC(f);C===-1&&(C=f.length-1),s=C>0;const b=n.textModel.getOptions().tabSize;r=k4.visibleColumnFromColumn(f,C+1,b)<b}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};ja.inlineSuggestionVisible=new Tn("inlineSuggestionVisible",!1,S("inlineSuggestionVisible","Whether an inline suggestion is visible")),ja.inlineSuggestionHasIndentation=new Tn("inlineSuggestionHasIndentation",!1,S("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),ja.inlineSuggestionHasIndentationLessThanTabSize=new Tn("inlineSuggestionHasIndentationLessThanTabSize",!0,S("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),ja.suppressSuggestions=new Tn("inlineSuggestionSuppressSuggestions",void 0,S("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let sr=ja;function LO(o){const e=new Tt,t=e.add(UA());return e.add(Ss(i=>{t.setStyle(o.read(i))})),e}class cp{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 qA([...this.parts.map(s=>new Vl(te.fromPositions(new Si(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 pm{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=ob(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 BE{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new pm(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=ob(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 dD(o,e){return al(o,e,bB)}function bB(o,e){return o===e?!0:!o||!e?!1:o instanceof cp&&e instanceof cp||o instanceof BE&&e instanceof BE?o.equals(e):!1}const IO=[];function PO(){return IO}class CB{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new e0(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new te(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function EB(o,e){const t=new Tt,i=o.createDecorationsCollection();return t.add(B4({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function TO(o,e){return new Si(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function uD(o,e){return new Si(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var MO=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},RO=function(o,e){return function(t,i){e(t,i,o)}};const hD="ghost-text";let FE=class extends Nt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=br(this,!1),this.currentTextModel=Jo(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=ns(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 BE?r.columnRange:void 0,d=[],u=[];function f(E,y){if(u.length>0){const A=u[u.length-1];y&&A.decorations.push(new Zg(A.content.length+1,A.content.length+1+E[0].length,y,0)),A.content+=E[0],E=E.slice(1)}for(const A of E)u.push({content:A,decorations:y?[new Zg(1,A.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,hD),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 CB(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=ns(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:te.fromPositions(new Si(s.lineNumber,a.column)),options:{description:hD,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:of.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new NO(this.editor,this.languageService.languageIdCodec,ns(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(ms(()=>{this.isDisposed.set(!0,void 0)})),this._register(EB(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};FE=MO([RO(2,Ba)],FE);class NO extends Nt{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=Gd("editorOptionChanged",Ys.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(Ss(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");OO(d,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:d,afterColumnAffinity:1})}})}}function OO(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 KA(1e4);p.appendString('<div class="suggest-preview-text">');for(let E=0,y=t.length;E<y;E++){const A=t[E],I=A.content;p.appendString('<div class="view-line'),p.appendString('" style="top:'),p.appendString(String(E*g)),p.appendString('px;width:1000000px;">');const M=QA(I),R=F4(I),P=L4.createEmpty(I,n);ZA(new XA(f.isMonospace&&!s,f.canUseHalfwidthRightwardsArrow,I,!1,M,R,0,P,A.decorations,e,0,f.spaceWidth,f.middotWidth,f.wsmiddotWidth,r,a,d,u!==I4.OFF,null),p),p.appendString("</div>")}p.appendString("</div>"),YA(o,f);const C=p.build(),b=fD?fD.createHTML(C):C;o.innerHTML=b}const fD=GA("editorGhostText",{createHTML:o=>o});function HO(o,e){const t=new R4,i=new T4(t,u=>e.getLanguageConfiguration(u)),n=new P4(new WO([o]),i),s=M4(n,[],void 0,!0);let r="";const a=o.getLineContent();function d(u,f){if(u.kind===2)if(d(u.openingBracket,f),f=j0(f,u.openingBracket.length),u.child&&(d(u.child,f),f=j0(f,u.child.length)),u.closingBracket)d(u.closingBracket,f),f=j0(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(VS(f),VS(j0(f,u.length)));else if(u.kind===4)for(const g of u.children)d(g,f),f=j0(f,g.length)}}return d(s,N4),r}class WO{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 yB(o,e,t,i,n=vn.None,s){const r=e instanceof Si?jO(e,t):e,a=o.all(t),d=new O4;for(const A of a)A.groupId&&d.add(A.groupId,A);function u(A){if(!A.yieldsToGroupIds)return[];const I=[];for(const M of A.yieldsToGroupIds||[]){const R=d.get(M);for(const P of R)I.push(P)}return I}const f=new Map,g=new Set;function p(A,I){if(I=[...I,A],g.has(A))return I;g.add(A);try{const M=u(A);for(const R of M){const P=p(R,I);if(P)return P}}finally{g.delete(A)}}function C(A){const I=f.get(A);if(I)return I;const M=p(A,[]);M&&Ws(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${M.map(P=>P.toString?P.toString():""+P).join(" -> ")}`));const R=new K_;return f.set(A,R.p),(async()=>{var P;if(!M){const V=u(A);for(const U of V){const J=await C(U);if(J&&J.items.length>0)return}}try{return e instanceof Si?await A.provideInlineCompletions(t,e,i,n):await((P=A.provideInlineEdits)==null?void 0:P.call(A,t,e,i,n))}catch(V){Ws(V);return}})().then(P=>R.complete(P),P=>R.error(P)),R.p}const b=await Promise.all(a.map(async A=>({provider:A,completions:await C(A)}))),E=new Map,y=[];for(const A of b){const I=A.completions;if(!I)continue;const M=new VO(I,A.provider);y.push(M);for(const R of I.items){const P=xm.from(R,M,r,t,s);E.set(P.hash(),P)}}return new zO(Array.from(E.values()),new Set(E.keys()),y)}class zO{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 VO{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 xm{static from(e,t,i,n,s){let r,a,d=e.range?te.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=gD(r,d.getStartPosition(),n,s);const u=r.length-e.insertText.length;u!==0&&(d=new te(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=gD(e.insertText.snippet,d.getStartPosition(),n,s);const g=e.insertText.snippet.length-u;g!==0&&(d=new te(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+g))}const f=new Yu().parse(e.insertText.snippet);f.children.length===1&&f.children[0]instanceof er?(r=f.children[0].value,a=void 0):(r=f.toString(),a={snippet:e.insertText.snippet,range:d})}else H4(e.insertText);return new xm(r,e.command,d,r,a,e.additionalTextEdits||PO(),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 xm(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 Vl(this.range,this.insertText)}}function jO(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new te(o.lineNumber,t.startColumn,o.lineNumber,i):te.fromPositions(o,o.with(void 0,i))}function gD(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?HO(a,i):o}function eu(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=Gp(n,o.text),r=Mv.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),d=te.fromPositions(r,o.range.getEndPosition());return new Vl(d,a)}function wB(o,e){return o.text.startsWith(e.text)&&$O(o.range,e.range)}function pD(o,e,t,i,n=0){let s=eu(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=_o(r).length;if(s.range.startColumn-1<=a){const b=_o(s.text).length,E=r.substring(s.range.startColumn-1,a),[y,A]=[s.range.getStartPosition(),s.range.getEndPosition()],I=y.column+E.length<=A.column?y.delta(0,E.length):A,M=te.fromPositions(I,A),R=s.text.startsWith(E)?s.text.substring(E.length):s.text.substring(b);s=new Vl(M,R)}const u=e.getValueInRange(s.range),f=UO(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,A=Math.max(b.modifiedStart,Math.min(y,C)),I=s.text.substring(b.modifiedStart,A),M=s.text.substring(A,Math.max(b.modifiedStart,y));I.length>0&&p.push(new pm(E,I,!1)),M.length>0&&p.push(new pm(E,M,!0))}return new cp(g,p)}function $O(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let Oa;function UO(o,e){if((Oa==null?void 0:Oa.originalValue)===o&&(Oa==null?void 0:Oa.newValue)===e)return Oa==null?void 0:Oa.changes;{let t=vD(o,e,!0);if(t){const i=xD(t);if(i>0){const n=vD(o,e,!1);n&&xD(n)<i&&(t=n)}}return Oa={originalValue:o,newValue:e,changes:t},t}}function xD(o){let e=0;for(const t of o)e+=t.originalLength;return e}function vD(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 W4({getElements:()=>a},{getElements:()=>d}).ComputeDiff(!1).changes}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},mD=function(o,e){return function(t,i){e(t,i,o)}};let LE=class extends Nt{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 Er),this.inlineCompletions=i1("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=i1("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var f,g;const n=new KO(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 uo,d=(async()=>{if((r||t.triggerKind===Ml.Automatic)&&await GO(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 yB(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 XO(b,n,this.textModel,this.versionId);if(i){const A=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!b.has(A)&&y.prepend(i.inlineCompletion,A.range,!0)}return this._updateOperation.clear(),dh(A=>{s.set(y,A)}),!0})(),u=new ZO(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=qO([mD(3,Di),mD(4,ao)],LE);function GO(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 KO{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&z4(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,j4())&&(e.context.triggerKind===Ml.Automatic||this.context.triggerKind===Ml.Explicit)&&this.versionId===e.versionId}}class ZO{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class XO{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 _D(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 _D(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class _D{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=Al({owner:this,equalsFn:te.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??yC)}toSingleTextEdit(e){return new Vl(this._updatedRange.read(e)??yC,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=eu(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)&&!!V4(p,f)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&Mv.ofRange(i).isGreaterThanOrEqualTo(Mv.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Vl(this._updatedRange.read(e)??yC,this.inlineCompletion.filterText)}}const yC=new te(1,1,1,1),Qi={Visible:T9,HasFocusedSuggestion:new Tn("suggestWidgetHasFocusedSuggestion",!1,S("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new Tn("suggestWidgetDetailsVisible",!1,S("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new Tn("suggestWidgetMultipleSuggestions",!1,S("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new Tn("suggestionMakesTextEdit",!0,S("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Tn("acceptSuggestionOnEnter",!0,S("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Tn("suggestionHasInsertAndReplaceRange",!1,S("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new Tn("suggestionInsertMode",void 0,{type:"string",description:S("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new Tn("suggestionCanResolve",!1,S("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},Oc=new li("suggestWidgetStatusBar");class YO{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=qg.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,te.isIRange(t.range)?(this.editStart=new Si(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new Si(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new Si(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||te.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new Si(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new Si(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new Si(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||te.spansMultipleLines(t.range.insert)||te.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 or(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{dd(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const g_=class g_{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}};g_.default=new g_;let dp=g_;class QO{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function z9(o,e,t,i=dp.default,n={triggerKind:0},s=vn.None){const r=new or;t=t.clone();const a=e.getWordAtPosition(t),d=a?new te(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):te.fromPositions(t),u={replace:d,insert:d.setEndPosition(t.lineNumber,t.column)},f=[],g=new Tt,p=[];let C=!1;const b=(y,A,I)=>{var R;let M=!1;if(!A)return M;for(const P of A.suggestions)if(!i.kindFilter.has(P.kind)){if(!i.showDeprecated&&((R=P==null?void 0:P.tags)!=null&&R.includes(1)))continue;P.range||(P.range=u),P.sortText||(P.sortText=typeof P.label=="string"?P.label:P.label.label),!C&&P.insertTextRules&&P.insertTextRules&4&&(C=Yu.guessNeedsClipboard(P.insertText)),f.push(new YO(t,P,A,y)),M=!0}return JA(A)&&g.add(A),p.push({providerName:y._debugDisplayName??"unknown_provider",elapsedProvider:A.duration??-1,elapsedOverall:I.elapsed()}),M},E=(async()=>{})();for(const y of o.orderedGroups(e)){let A=!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)),A=A||M.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(I)))try{const M=new or,R=await I.provideCompletionItems(e,t,n,s);A=b(I,R,M)||A}catch(M){Ws(M)}})),A||s.isCancellationRequested)break}return await E,s.isCancellationRequested?(g.dispose(),Promise.reject(new Z_)):new QO(f.sort(tH(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 JO(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 eH(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 Lb=new Map;Lb.set(0,JO);Lb.set(2,eH);Lb.set(1,V9);function tH(o){return Lb.get(o)}ps.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;Zn(rs.isUri(t)),Zn(Si.isIPosition(i)),Zn(typeof n=="string"||!n),Zn(typeof s=="number"||!s);const{completionProvider:r}=o.get(Di),a=await o.get(Fa).createModelReference(t);try{const d={incomplete:!1,suggestions:[]},u=[],f=a.object.textEditorModel.validatePosition(i),g=await z9(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(vn.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 iH(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class hf{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 bD(o,e=G_){return $4(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var nH=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)}};class CD{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 ED{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=_o(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(u=>u===e?!1:(u instanceof er&&(a=_o(ob(u.value).pop())),!0));const d=Gp(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 yD{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return vg(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=vg(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return U4(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(Nw(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 wD{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=>!q4(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let vm=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}}};vm=nH([sH(2,ao)],vm);const $a=class $a{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 $a.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return $a.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return $a.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return $a.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}}};$a.dayNames=[S("Sunday","Sunday"),S("Monday","Monday"),S("Tuesday","Tuesday"),S("Wednesday","Wednesday"),S("Thursday","Thursday"),S("Friday","Friday"),S("Saturday","Saturday")],$a.dayNamesShort=[S("SundayShort","Sun"),S("MondayShort","Mon"),S("TuesdayShort","Tue"),S("WednesdayShort","Wed"),S("ThursdayShort","Thu"),S("FridayShort","Fri"),S("SaturdayShort","Sat")],$a.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")],$a.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 mm=$a;class SD{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=G4(this._workspaceService.getWorkspace());if(!K4(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(jS(e))return vg(e.uri.path);let t=vg(e.configPath.path);return t.endsWith($S)&&(t=t.substr(0,t.length-$S.length-1)),t}_resoveWorkspacePath(e){if(jS(e))return bD(e.uri.fsPath);const t=vg(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?bD(i):"/"}}class DD{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 Cb()}}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)}},la;const Vr=class Vr{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=US(t.placeholders,Ir.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=te.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Vr._decor.inactiveFinal:Vr._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(Fs.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 Zi(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(d,a.isFinalTabstop?Vr._decor.activeFinal:Vr._decor.active),s.add(a);for(const f of this._snippet.enclosingPlaceholders(a)){const g=this._placeholderDecorations.get(f);n.changeDecorationOptions(g,f.isFinalTabstop?Vr._decor.activeFinal:Vr._decor.active),s.add(f)}}for(const[a,d]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(d,a.isFinalTabstop?Vr._decor.inactiveFinal:Vr._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof Ir){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 I0,!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=te.fromPositions(t.getPositionAt(s._offset+u),t.getPositionAt(s._offset+u+f)),p=i.addDecoration(g,Vr._decor.inactive);this._placeholderDecorations.set(d,p)}}this._placeholderGroups=US(this._snippet.placeholders,Ir.compareByIndex)})}};Vr._decor={active:Bn.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:Bn.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:Bn.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:Bn.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let _m=Vr;const AD={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let bm=la=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=_o(r,0,t.column-1);let d;return n.walk(u=>{if(!(u instanceof er)||u.parent instanceof I0||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 er(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=Zi.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(qf)),b=e.invokeWithinContext(R=>new yD(R.get(Ug),p)),E=()=>a,y=p.getValueInRange(la.adjustSelection(p,e.getSelection(),i,0)),A=p.getValueInRange(la.adjustSelection(p,e.getSelection(),0,n)),I=p.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),M=e.getSelections().map((R,P)=>({selection:R,idx:P})).sort((R,P)=>te.compareRangesUsingStarts(R.selection,P.selection));for(const{selection:R,idx:P}of M){let V=la.adjustSelection(p,R,i,0),U=la.adjustSelection(p,R,0,n);y!==p.getValueInRange(V)&&(V=R),A!==p.getValueInRange(U)&&(U=R);const J=R.setStartPosition(V.startLineNumber,V.startColumn).setEndPosition(U.endLineNumber,U.endColumn),re=new Yu().parse(t,!0,s),ae=J.getStartPosition(),ie=la.adjustWhitespace(p,ae,r||P>0&&I!==p.getLineFirstNonWhitespaceColumn(R.positionLineNumber),re);re.resolveVariables(new CD([b,new wD(E,P,M.length,e.getOption(79)==="spread"),new ED(p,R,P,d),new vm(p,R,u),new mm,new SD(C),new DD])),f[P]=Fs.replace(J,re.toString()),f[P].identifier={major:P,minor:0},f[P]._isTracked=!0,g[P]=new _m(e,re,ie)}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 Yu,g=new tx,p=new CD([e.invokeWithinContext(b=>new yD(b.get(Ug),u)),new wD(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new ED(u,e.getSelection(),0,r),new vm(u,e.getSelection(),a),new mm,new SD(e.invokeWithinContext(b=>b.get(qf))),new DD]);t=t.sort((b,E)=>te.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 P=t[b-1].range,V=te.fromPositions(P.getEndPosition(),E.getStartPosition()),U=new er(u.getValueInRange(V));g.appendChild(U),C+=U.value.length}const A=f.parseFragment(y,g);la.adjustWhitespace(u,E.getStartPosition(),!0,g,new Set(A)),g.resolveVariables(p);const I=g.toString(),M=I.slice(C);C=I.length;const R=Fs.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 _m(e,g,"")]}}constructor(e,t,i=AD,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){Io(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"?la.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):la.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=>Zi.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=AD){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=la.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=>Zi.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(te.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(te.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(te.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};bm=la=oH([rH(3,ao)],bm);var aH=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},Ox=function(o,e){return function(t,i){e(t,i,o)}},ef;const kD={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var Qa;let No=(Qa=class{static get(e){return e.getContribution(ef.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Tt,this._modelVersionId=-1,this._inSnippet=ef.InSnippetMode.bindTo(n),this._hasNextTabstop=ef.HasNextTabstop.bindTo(n),this._hasPrevTabstop=ef.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"?kD:{...kD,...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?(Zn(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new bm(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()||!Si.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 A=p.choice.options[y];E.push({kind:13,label:A.value,insertText:A.value,sortText:"a".repeat(y+1),range:p.range,filterText:b?`${C}_${A.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(()=>{iH(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()}},ef=Qa,Qa.ID="snippetController2",Qa.InSnippetMode=new Tn("inSnippetMode",!1,S("inSnippetMode","Whether the editor in current in snippet mode")),Qa.HasNextTabstop=new Tn("hasNextTabstop",!1,S("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),Qa.HasPrevTabstop=new Tn("hasPrevTabstop",!1,S("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),Qa);No=ef=aH([Ox(1,uh),Ox(2,Di),Ox(3,Gn),Ox(4,ao)],No);En(No.ID,No,4);const Ib=Zo.bindToContribution(No.get);Bi(new Ib({id:"jumpToNextSnippetPlaceholder",precondition:Ue.and(No.InSnippetMode,No.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:G.textInputFocus,primary:2}}));Bi(new Ib({id:"jumpToPrevSnippetPlaceholder",precondition:Ue.and(No.InSnippetMode,No.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:G.textInputFocus,primary:1026}}));Bi(new Ib({id:"leaveSnippet",precondition:No.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:G.textInputFocus,primary:9,secondary:[1033]}}));Bi(new Ib({id:"acceptSnippet",precondition:No.InSnippetMode,handler:o=>o.finish()}));var lH=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},wC=function(o,e){return function(t,i){e(t,i,o)}};let IE=class extends Nt{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=br(this,!1),this._forceUpdateExplicitlySignal=Vw(this),this._selectedInlineCompletionId=br(this,void 0),this._primaryPosition=ns(this,b=>this._positions.read(b)[0]??new Si(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([Cl.Redo,Cl.Undo,Cl.AcceptWord]),this._fetchInlineCompletionsPromise=ek({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Ml.Automatic}),handleChange:(b,E)=>(b.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(b.change))?E.preserveCurrentCompletion=!0:b.didChange(this._forceUpdateExplicitlySignal)&&(E.inlineCompletionTriggerKind=Ml.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 A=this._source.suggestWidgetInlineCompletions.get(),I=this.selectedSuggestItem.read(b);if(A&&!I){const U=this._source.inlineCompletions.get();dh(J=>{(!U||A.request.versionId>U.request.versionId)&&this._source.inlineCompletions.set(A.clone(),J),this._source.clearSuggestWidgetInlineCompletions(J)})}const M=this._primaryPosition.read(b),R={triggerKind:E.inlineCompletionTriggerKind,selectedSuggestionInfo:I==null?void 0:I.toSelectedSuggestionInfo()},P=this.selectedInlineCompletion.get(),V=E.preserveCurrentCompletion||P!=null&&P.forwardStable?P:void 0;return this._source.fetch(M,R,V)}),this._filteredInlineCompletionItems=Al({owner:this,equalsFn:n1()},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=ns(this,b=>{const E=this._selectedInlineCompletionId.read(b),y=this._filteredInlineCompletionItems.read(b),A=this._selectedInlineCompletionId===void 0?-1:y.findIndex(I=>I.semanticId===E);return A===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):A}),this.selectedInlineCompletion=ns(this,b=>{const E=this._filteredInlineCompletionItems.read(b),y=this.selectedInlineCompletionIndex.read(b);return E[y]}),this.activeCommands=Al({owner:this,equalsFn:n1()},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=ns(this,b=>{if(this.lastTriggerKind.read(b)===Ml.Explicit)return this._filteredInlineCompletionItems.read(b).length}),this.state=Al({owner:this,equalsFn:(b,E)=>!b||!E?b===E:dD(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 A=eu(y.toSingleTextEdit(),E),I=this._computeAugmentation(A,b);if(!this._suggestPreviewEnabled.read(b)&&!I)return;const R=(I==null?void 0:I.edit)??A,P=I?I.edit.text.length-A.text.length:0,V=this._suggestPreviewMode.read(b),U=this._positions.read(b),J=[R,...SC(this.textModel,U,R)],re=J.map((ie,ve)=>pD(ie,E,V,U[ve],P)).filter(nv),ae=re[0]??new cp(R.range.endLineNumber,[]);return{edits:J,primaryGhostText:ae,ghostTexts:re,inlineCompletion:I==null?void 0:I.completion,suggestItem:y}}else{if(!this._isActive.read(b))return;const A=this.selectedInlineCompletion.read(b);if(!A)return;const I=A.toSingleTextEdit(b),M=this._inlineSuggestMode.read(b),R=this._positions.read(b),P=[I,...SC(this.textModel,R,I)],V=P.map((U,J)=>pD(U,E,M,R[J],0)).filter(nv);return V[0]?{edits:P,primaryGhostText:V[0],ghostTexts:V,inlineCompletion:A,suggestItem:void 0}:void 0}}),this.ghostTexts=Al({owner:this,equalsFn:dD},b=>{const E=this.state.read(b);if(E)return E.ghostTexts}),this.primaryGhostText=Al({owner:this,equalsFn:bB},b=>{const E=this.state.read(b);if(E)return E==null?void 0:E.primaryGhostText}),this._register(tk(this._fetchInlineCompletionsPromise));let C;this._register(Ss(b=>{var A,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=(A=R.provider).handleItemDidShow)==null||I.call(A,R.inlineCompletions,M.sourceInlineCompletion,M.insertText)}}))}_getReason(e){return e!=null&&e.isUndoing?Cl.Undo:e!=null&&e.isRedoing?Cl.Redo:this.isAcceptingPartially?Cl.AcceptWord:Cl.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){Rv(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){Rv(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(nv);return Z4(s,a=>{let d=a.toSingleTextEdit(t);return d=eu(d,i,te.fromPositions(d.range.getStartPosition(),e.range.getEndPosition())),wB(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 e0;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",[Fs.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=No.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=BD(s).map(a=>Zi.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>Fs.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,Ws),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 e0;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 Si(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=te.fromPositions(C,d),E=e.getModel().getValueInRange(b)+g,y=new Vl(b,E),A=[y,...SC(this.textModel,p,y)],I=BD(A).map(M=>Zi.fromPositions(M));e.executeEdits("inlineSuggestion.accept",A.map(M=>Fs.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=te.fromPositions(r.range.getStartPosition(),Mv.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=eu(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})}};IE=lH([wC(9,cn),wC(10,ro),wC(11,ao)],IE);var Cl;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(Cl||(Cl={}));function SC(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(te.fromPositions(i,r)),d=uD(i,s);if(d.lineNumber<1)return cs(new e0(`positionWithinTextEdit line number should be bigger than 0.
36
+ Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const u=cH(t.text,d);return n.map(f=>{const g=TO(uD(f,s),r),p=o.getValueInRange(te.fromPositions(f,g)),C=Gp(a,p),b=te.fromPositions(f,f.delta(0,C));return new Vl(b,u)})}function cH(o,e){let t="";const i=Y4(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 BD(o){const e=X4.createSortPermutation(o,Up(s=>s.range,te.compareRangesUsingStarts)),i=new qA(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}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},FD=function(o,e){return function(t,i){e(t,i,o)}},rg;class j9{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 LD extends j9{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class uH extends j9{constructor(){super("recentlyUsed"),this._cache=new Wp(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:jw.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class hH extends j9{constructor(){super("recentlyUsedByPrefix"),this._trie=Q4.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:jw.fromString(i.type),this._trie.set(t,i)}}}var Gc;let PE=(Gc=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Tt,this._persistSoon=new Qs(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===Pw.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=rg._strategyCtors.get(i)||LD;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,d=this._storageService.get(`${rg._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(`${rg._storagePrefix}/${this._strategy.name}`,i,t,1)}}},rg=Gc,Gc._strategyCtors=new Map([["recentlyUsedByPrefix",hH],["recentlyUsed",uH],["first",LD]]),Gc._storagePrefix="suggest/memories",Gc);PE=rg=dH([FD(0,ud),FD(1,bs)],PE);const Pb=Yl("ISuggestMemories");Ql(Pb,PE,1);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},gH=function(o,e){return function(t,i){e(t,i,o)}},TE,Cu;let Cm=(Cu=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=TE.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)}},TE=Cu,Cu.AtEnd=new Tn("atEndOfWord",!1),Cu);Cm=TE=fH([gH(1,Gn)],Cm);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},xH=function(o,e){return function(t,i){e(t,i,o)}},ag,Eu;let x0=(Eu=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=ag.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(ag._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=ag._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},ag=Eu,Eu.OtherSuggestions=new Tn("hasOtherSuggestions",!1),Eu);x0=ag=pH([xH(1,Gn)],x0);class vH{constructor(e,t,i,n){this._disposables=new Tt,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||!_r(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new Tv;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 Dr=class Dr{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>Dr._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>Dr._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>=Dr._maxRounds){e();break}if(!n){e();break}const d=i.bracketPairs.findNextBracket(n);if(!d){e();break}if(Date.now()-a>Dr._maxDuration){setTimeout(()=>Dr._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 ik,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>=Dr._maxRounds&&s.size===0){e();break}if(!n){e();break}const u=i.bracketPairs.findPrevBracket(n);if(!u){e();break}if(Date.now()-d>Dr._maxDuration){setTimeout(()=>Dr._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=te.fromPositions(u.range.getEndPosition(),b.getStartPosition()),y=te.fromPositions(u.range.getStartPosition(),b.getEndPosition());r.push({range:E}),r.push({range:y}),Dr._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:te.fromPositions(new Si(n,s),t.getEndPosition())}),i.push({range:te.fromPositions(new Si(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:te.fromPositions(new Si(r,a),t.getEndPosition())}),i.push({range:te.fromPositions(new Si(r,1),t.getEndPosition())}))}}};Dr._maxDuration=30,Dr._maxRounds=2;let Em=Dr;const Ua=class Ua{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return Ua.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return Ua.None;const[s]=await new Em().provideSelectionRanges(i,[n]);if(s.length===0)return Ua.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return Ua.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends Ua{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(J4(g))return 2<<20;const p=Nv(g,te.fromPositions(d),te.compareRangesUsingStarts),C=p>=0?g[p]:g[Math.max(0,~p-1)];let b=s.length;for(const E of s){if(!te.containsRange(E.range,C))break;b-=1}return b}}}};Ua.None=new class extends Ua{distance(){return 0}};let ym=Ua,ID=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class yc{constructor(e,t,i,n,s,r,a=nk.default,d=void 0){this.clipboardText=d,this._snippetCompareFn=yc._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=yc._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=yc._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?sk:e7;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=qg.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=qg.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;t7(f.completion.filterText,f.textLabel)===0?f.score=E:(f.score=i7(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?n7(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 yc._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 yc._compareCompletionItems(e,t)}}var mH=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},gc=function(o,e){return function(t,i){e(t,i,o)}},ME;class Dd{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 _H(o,e,t){if(!e.getContextKeyValue(sr.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(sr.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function bH(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(sr.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let wm=ME=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 Tt,this._triggerCharacterListener=new Tt,this._triggerQuickSuggest=new Np,this._triggerState=void 0,this._completionDisposables=new Tt,this._onDidCancel=new xn,this._onDidTrigger=new xn,this._onDidSuggest=new xn,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new Zi(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(){Io(this._triggerCharacterListener),Io([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(!bH(this._editor,this._contextKeyService,this._configurationService)||Dd.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="";o7(i.charCodeAt(i.length-1))?r7(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;hf.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=No.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!Dd.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(!hf.isAllOff(n)){if(!hf.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(hf.valueFor(n,r)!=="on")return}_H(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){Zn(this._editor.hasModel()),Zn(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new Dd(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 Dd(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 uo;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}=ME.createSuggestFilter(this._editor),u=new dp(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=ym.create(this._editorWorkerService,this._editor),g=z9(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),u,n,this._requestToken.token);Promise.all([g,f]).then(async([E,y])=>{var P;if((P=this._requestToken)==null||P.dispose(),!this._editor.hasModel())return;let A=e==null?void 0:e.clipboardText;if(!A&&E.needsClipboard&&(A=await this._clipboardService.readText()),this._triggerState===void 0)return;const I=this._editor.getModel(),M=new Dd(I,this._editor.getPosition(),e),R={...nk.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new yc(E.items,this._context.column,{leadingLineContent:M.leadingLineContent,characterCountDelta:M.column-this._context.column},y,this._editor.getOption(119),this._editor.getOption(113),R,A),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(cs)}_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(_o(e.leadingLineContent)!==_o(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(Dd.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=Dd.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})}}}}};wm=ME=mH([gc(1,Jl),gc(2,y0),gc(3,ka),gc(4,uh),gc(5,Gn),gc(6,bs),gc(7,Di),gc(8,s7)],wm);const p_=class p_{constructor(e,t){this._disposables=new Tt,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)>p_._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()}};p_._maxSelectionLength=51200;let RE=p_;var CH=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},DC=function(o,e){return function(t,i){e(t,i,o)}};let NE=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Tt,this.element=di(e,xi(".suggest-status-bar"));const r=(a=>a instanceof Jf?i.createInstance(a7,a,{useComma:!0}):void 0);this._leftActions=new Wg(this.element,{actionViewItemProvider:r}),this._rightActions=new Wg(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()}};NE=CH([DC(2,cn),DC(3,ch),DC(4,Gn)],NE);var EH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yH=function(o,e){return function(t,i){e(t,i,o)}};function $9(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let OE=class{constructor(e,t){this._editor=e,this._onDidClose=new xn,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new xn,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Tt,this._renderDisposeable=new Tt,this._borderWidth=1,this._size=new hs(330,0),this.domNode=xi(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(D0,{editor:e}),this._body=xi(".body"),this._scrollbar=new ok(this._body,{alwaysConsumeMouseWheel:!0}),di(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=di(this._body,xi(".header")),this._close=di(this._header,xi("span"+Qn.asCSSSelector(Ji.close))),this._close.title=S("details.close","Close"),this._type=di(this._header,xi("p.type")),this._docs=di(this._body,xi("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 Fo().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!$9(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,Yr(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else sl(this._type),this._type.title="",gr(this._type),this.domNode.classList.add("no-type");if(sl(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),sl(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 hs(e,t);hs.equals(i,this._size)||(this._size=i,l7(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}};OE=EH([yH(1,cn)],OE);class wH{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Tt,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new y9,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=jp(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new hs(220,2*s.lineHeight),a=e.top,d=(function(){const P=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),V=-s.borderWidth+e.left+e.width,U=new hs(P,n.height-e.top-s.borderHeight-s.verticalPadding),J=U.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:P-t.width,maxSizeTop:U,maxSizeBottom:J,minSize:r.with(Math.min(P,r.width))}})(),u=(function(){const P=e.left-s.borderWidth-s.horizontalPadding,V=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),U=new hs(P,n.height-e.top-s.borderHeight-s.verticalPadding),J=U.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:P-t.width,maxSizeTop:U,maxSizeBottom:J,minSize:r.with(Math.min(P,r.width))}})(),f=(function(){const P=e.left,V=-s.borderWidth+e.top+e.height,U=new hs(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:V,left:P,fit:U.height-t.height,maxSizeBottom:U,maxSizeTop:U,minSize:r.with(U.width)}})(),g=[d,u,f],p=g.find(P=>P.fit>=0)??g.sort((P,V)=>V.fit-P.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 A;i?E<=p.maxSizeTop.height?(b=!0,A=p.maxSizeTop):(b=!1,A=p.maxSizeBottom):E<=p.maxSizeBottom.height?(b=!1,A=p.maxSizeBottom):(b=!0,A=p.maxSizeTop);let{top:I,left:M}=p;!b&&E>e.height&&(I=C-E);const R=this._editor.getDomNode();if(R){const P=R.getBoundingClientRect();I-=P.top,M-=P.left}this._applyTopLeft({left:M,top:I}),this._resizable.enableSashes(!b,p===d,b,p!==d),this._resizable.minSize=p.minSize,this._resizable.maxSize=A,this._resizable.layout(E,Math.min(A.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var il;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(il||(il={}));const SH=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Hx(o,e,t,i,n){if(Qn.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(rs.isUri(n))return[];const s=i===il.ROOT_FOLDER?["rootfolder-icon"]:i===il.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===jo.data)r=Ov.parseMetaData(t).get(Ov.META_DATA_LABEL);else{const a=t.path.match(SH);a?(r=Wx(a[2].toLowerCase()),a[1]&&s.push(`${Wx(a[1].toLowerCase())}-name-dir-icon`)):r=Wx(t.authority.toLowerCase())}if(i===il.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===il.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=DH(o,e,t);a&&s.push(`${Wx(a)}-lang-file-icon`)}}return s}function DH(o,e,t){if(!t)return null;let i=null;if(t.scheme===jo.data){const s=Ov.parseMetaData(t).get(Ov.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==Gg?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function Wx(o){return o.replace(/[\s]/g,"/")}var AH=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)}};function SB(o){return`suggest-aria-id:${o}`}const kH=Rs("suggest-more-info",Ji.chevronRight,S("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var ma;const BH=new(ma=class{extract(e,t){if(e.textLabel.match(ma._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(ma._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=ma._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},ma._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*\))/,ma._regexStrict=new RegExp(`^${ma._regexRelaxed.source}$`,"i"),ma);let HE=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new xn,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Tt,i=e;i.classList.add("show-file-icons");const n=di(e,xi(".icon")),s=di(n,xi("span.colorspan")),r=di(e,xi(".contents")),a=di(r,xi(".main")),d=di(a,xi(".icon-label.codicon")),u=di(a,xi("span.left")),f=di(a,xi("span.right")),g=new wA(u,{supportHighlights:!0,supportIcons:!0});t.add(g);const p=di(u,xi("span.signature-label")),C=di(u,xi("span.qualifier-label")),b=di(f,xi("span.details-label")),E=di(f,xi("span.readMore"+Qn.asCSSSelector(kH)));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 A=this._editor.getOptions(),I=A.get(50),M=I.getMassagedFontFamily(),R=I.fontFeatureSettings,P=A.get(120)||I.fontSize,V=A.get(121)||I.lineHeight,U=I.fontWeight,J=I.letterSpacing,re=`${P}px`,ae=`${V}px`,ie=`${J}px`;i.style.fontSize=re,i.style.fontWeight=U,i.style.letterSpacing=ie,a.style.fontFamily=M,a.style.fontFeatureSettings=R,a.style.lineHeight=ae,n.style.height=ae,n.style.width=ae,E.style.height=ae,E.style.width=ae}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=SB(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:ib(e.score)},r=[];if(n.kind===19&&BH.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=Hx(this._modelService,this._languageService,rs.from({scheme:"fake",path:e.textLabel}),il.FILE),d=Hx(this._modelService,this._languageService,rs.from({scheme:"fake",path:n.detail}),il.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=[Hx(this._modelService,this._languageService,rs.from({scheme:"fake",path:e.textLabel}),il.FOLDER),Hx(this._modelService,this._languageService,rs.from({scheme:"fake",path:n.detail}),il.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Qn.asClassNameArray(jw.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=kC(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=kC(n.label.detail||""),i.detailsLabel.textContent=kC(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Yr(i.detailsLabel):gr(i.detailsLabel),$9(e)?(i.right.classList.add("can-expand-details"),Yr(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"),gr(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};HE=AH([AC(1,Ho),AC(2,Ba),AC(3,ra)],HE);function kC(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},zx=function(o,e){return function(t,i){e(t,i,o)}},tf;vi("editorSuggestWidget.background",rk,S("editorSuggestWidgetBackground","Background color of the suggest widget."));vi("editorSuggestWidget.border",c7,S("editorSuggestWidgetBorder","Border color of the suggest widget."));const LH=vi("editorSuggestWidget.foreground",qp,S("editorSuggestWidgetForeground","Foreground color of the suggest widget."));vi("editorSuggestWidget.selectedForeground",ak,S("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));vi("editorSuggestWidget.selectedIconForeground",d7,S("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const IH=vi("editorSuggestWidget.selectedBackground",lk,S("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));vi("editorSuggestWidget.highlightForeground",ck,S("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));vi("editorSuggestWidget.focusHighlightForeground",u7,S("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));vi("editorSuggestWidgetStatus.foreground",ol(LH,.5),S("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class PH{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof oa}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(hs.is(t))return hs.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 WE=(Kc=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new Er,this._pendingShowDetails=new Er,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new Np,this._disposables=new Tt,this._onDidSelect=new qS,this._onDidFocus=new qS,this._onDidHide=new xn,this._onDidShow=new xn,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new xn,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new y9,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new TH(this,e),this._persistedSize=new PH(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(),A=Math.round(E/2);let{width:I,height:M}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-M)<=A)&&(M=((C=a.persistedSize)==null?void 0:C.height)??y.height),(!a.persistWidth||Math.abs(a.currentSize.width-I)<=A)&&(I=((b=a.persistedSize)==null?void 0:b.width)??y.width),this._persistedSize.store(new hs(I,M))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=di(this.element.domNode,xi(".message")),this._listElement=di(this.element.domNode,xi(".tree"));const d=this._disposables.add(s.createInstance(OE,this.editor));d.onDidClose(this.toggleDetails,this,this._disposables),this._details=new wH(d,this.editor);const u=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);u();const f=s.createInstance(HE,this.editor);this._disposables.add(f),this._disposables.add(f.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Fw("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:A,description:I}=p.completion.label;A&&I?C=S("label.full","{0} {1}, {2}",C,A,I):A?C=S("label.detail","{0} {1}",C,A):I&&(C=S("label.desc","{0}, {1}",C,I))}if(!p.isResolved||!this._isDetailsVisible())return C;const{documentation:b,detail:E}=p.completion,y=zw("{0}{1}",E||"",b?typeof b=="string"?b:b.value:"");return S("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",C,y)}}}),this._list.style(dk({listInactiveFocusBackground:IH,listInactiveFocusOutline:ju})),this._status=s.createInstance(NE,this.element.domNode,Oc);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=Qi.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Qi.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Qi.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Qi.HasFocusedSuggestion.bindTo(i),this._disposables.add(zl(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=zg(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=co(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:SB(i)}))}).catch(cs)),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:gr(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=tf.LOADING_MESSAGE,gr(this._listElement,this._status.element),Yr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Zf(tf.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=tf.NO_SUGGESTIONS_MESSAGE,gr(this._listElement,this._status.element),Yr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Zf(tf.NO_SUGGESTIONS_MESSAGE);break;case 3:gr(this._messageElement),Yr(this._listElement,this._status.element),this._show();break;case 4:gr(this._messageElement),Yr(this._listElement,this._status.element),this._show();break;case 5:gr(this._messageElement),Yr(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=GS(qd(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")):($9(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=GS(qd(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=jp(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 hs(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=Uo(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,A=Math.min(y,f);let I=Math.min(Math.max(A,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=A):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),I=E),this.element.preferredSize=new hs(u,i.defaultSize.height),this.element.maxSize=new hs(d,I),this.element.minSize=new hs(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=h7(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 hs(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}},tf=Kc,Kc.LOADING_MESSAGE=S("suggestWidget.loading","Loading..."),Kc.NO_SUGGESTIONS_MESSAGE=S("suggestWidget.noSuggestions","No suggestions."),Kc);WE=tf=FH([zx(1,ud),zx(2,Gn),zx(3,ra),zx(4,cn)],WE);class TH{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 hs(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 MH=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},Vh=function(o,e){return function(t,i){e(t,i,o)}},zE;class RH{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=Bn.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(te.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 yu;let Jr=(yu=class{static get(e){return e.getContribution(zE.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 Er,this._toDispose=new Tt,this._selectors=new NH(g=>g.priority),this._onWillInsertSuggestItem=new xn,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(wm,this.editor),this._selectors.register({priority:0,select:(g,p,C)=>this._memoryService.select(g,p,C)});const d=Qi.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 Yb(qd(e.getDomNode()),()=>{const g=this._instantiationService.createInstance(WE,this.editor);this._toDispose.add(g),this._toDispose.add(g.onDidSelect(y=>this._insertSuggestion(y,0),this));const p=new vH(this.editor,g,this.model,y=>this._insertSuggestion(y,2));this._toDispose.add(p);const C=Qi.MakesTextEdit.bindTo(this._contextKeyService),b=Qi.HasInsertAndReplaceRange.bindTo(this._contextKeyService),E=Qi.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(ms(()=>{C.reset(),b.reset(),E.reset()})),this._toDispose.add(g.onDidFocus(({item:y})=>{const A=this.editor.getPosition(),I=y.editStart.column,M=A.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:A.lineNumber,startColumn:I,endLineNumber:A.lineNumber,endColumn:M})!==y.completion.insertText),C.set(R),b.set(!Si.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 KS(!0,!1,!1,!1,33))||ll&&y.toKeyCodeChord().equals(new KS(!1,!1,!1,!0,33))){y.stopPropagation();return}y.toKeyCodeChord().isModifierKey()||this.editor.focus()})),g})),this._overtypingCapturer=this._toDispose.add(new Yb(qd(e.getDomNode()),()=>this._toDispose.add(new RE(this.editor,this.model)))),this._alternatives=this._toDispose.add(new Yb(qd(e.getDomNode()),()=>this._toDispose.add(new x0(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(Cm,e)),this._toDispose.add(this.model.onDidTrigger(g=>{this.widget.value.showTriggered(g.auto,g.shy?250:50),this._lineSuffix.value=new RH(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=Qi.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=No.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 uo;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=Xf.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(E=>{let y=te.lift(E.range);if(y.startLineNumber===r.position.lineNumber&&y.startColumn>r.position.column){const A=this.editor.getPosition().column-r.position.column,I=A,M=te.spansMultipleLines(y)?0:A;y=new te(y.startLineNumber,y.startColumn+I,y.endLineNumber,y.endColumn+M)}return Fs.replaceMove(y,E.text)})),b.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!f){const b=new or;let E;const y=n.onDidChangeContent(R=>{if(R.isFlush){d.cancel(),y.dispose();return}for(const P of R.changes){const V=te.getEndPosition(P.range);(!E||Si.isBefore(V,E))&&(E=V)}}),A=t;t|=2;let I=!1;const M=this.editor.onWillType(()=>{M.dispose(),I=!0,A&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(P=>Si.isBefore(E,te.getStartPosition(P.range))))return!1;I&&this.editor.pushUndoStop();const R=Xf.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(P=>Fs.replaceMove(te.lift(P.range),P.text))),R.restoreRelativeVerticalPositionOfCursor(this.editor),(I||!(A&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=Yu.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===Sm.id)this.model.trigger({auto:!0,retrigger:!0});else{const b=new or;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(E=>{r.completion.extensionId?Ws(E):cs(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:WA(cl(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:f7(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:g})}getOverwriteInfo(e,t){Zn(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(_r(e.completion.additionalTextEdits)){const t=S("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);na(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};Ys.once(this.model.onDidTrigger)(s=>{const r=[];Ys.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Io(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Io(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)}},zE=yu,yu.ID="editor.contrib.suggestController",yu);Jr=zE=MH([Vh(1,Pb),Vh(2,ro),Vh(3,Gn),Vh(4,cn),Vh(5,uh),Vh(6,ka)],Jr);class NH{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 x_=class x_ extends xt{constructor(){super({id:x_.id,label:S("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:Ue.and(G.writable,G.hasCompletionItemProvider,Qi.Visible.toNegated()),kbOpts:{kbExpr:G.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Jr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};x_.id="editor.action.triggerSuggest";let Sm=x_;En(Jr.ID,Jr,2);Te(Sm);const yr=190,Wo=Zo.bindToContribution(Jr.get);Bi(new Wo({id:"acceptSelectedSuggestion",precondition:Ue.and(Qi.Visible,Qi.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Ue.and(Qi.Visible,G.textInputFocus),weight:yr},{primary:3,kbExpr:Ue.and(Qi.Visible,G.textInputFocus,Qi.AcceptSuggestionsOnEnter,Qi.MakesTextEdit),weight:yr}],menuOpts:[{menuId:Oc,title:S("accept.insert","Insert"),group:"left",order:1,when:Qi.HasInsertAndReplaceRange.toNegated()},{menuId:Oc,title:S("accept.insert","Insert"),group:"left",order:1,when:Ue.and(Qi.HasInsertAndReplaceRange,Qi.InsertMode.isEqualTo("insert"))},{menuId:Oc,title:S("accept.replace","Replace"),group:"left",order:1,when:Ue.and(Qi.HasInsertAndReplaceRange,Qi.InsertMode.isEqualTo("replace"))}]}));Bi(new Wo({id:"acceptAlternativeSelectedSuggestion",precondition:Ue.and(Qi.Visible,G.textInputFocus,Qi.HasFocusedSuggestion),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:Oc,group:"left",order:2,when:Ue.and(Qi.HasInsertAndReplaceRange,Qi.InsertMode.isEqualTo("insert")),title:S("accept.replace","Replace")},{menuId:Oc,group:"left",order:2,when:Ue.and(Qi.HasInsertAndReplaceRange,Qi.InsertMode.isEqualTo("replace")),title:S("accept.insert","Insert")}]}));ps.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Bi(new Wo({id:"hideSuggestWidget",precondition:Qi.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:9,secondary:[1033]}}));Bi(new Wo({id:"selectNextSuggestion",precondition:Ue.and(Qi.Visible,Ue.or(Qi.MultipleSuggestions,Qi.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));Bi(new Wo({id:"selectNextPageSuggestion",precondition:Ue.and(Qi.Visible,Ue.or(Qi.MultipleSuggestions,Qi.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:12,secondary:[2060]}}));Bi(new Wo({id:"selectLastSuggestion",precondition:Ue.and(Qi.Visible,Ue.or(Qi.MultipleSuggestions,Qi.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));Bi(new Wo({id:"selectPrevSuggestion",precondition:Ue.and(Qi.Visible,Ue.or(Qi.MultipleSuggestions,Qi.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Bi(new Wo({id:"selectPrevPageSuggestion",precondition:Ue.and(Qi.Visible,Ue.or(Qi.MultipleSuggestions,Qi.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:11,secondary:[2059]}}));Bi(new Wo({id:"selectFirstSuggestion",precondition:Ue.and(Qi.Visible,Ue.or(Qi.MultipleSuggestions,Qi.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));Bi(new Wo({id:"focusSuggestion",precondition:Ue.and(Qi.Visible,Qi.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Bi(new Wo({id:"focusAndAcceptSuggestion",precondition:Ue.and(Qi.Visible,Qi.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));Bi(new Wo({id:"toggleSuggestionDetails",precondition:Ue.and(Qi.Visible,Qi.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:Oc,group:"right",order:1,when:Ue.and(Qi.DetailsVisible,Qi.CanResolve),title:S("detail.more","Show Less")},{menuId:Oc,group:"right",order:1,when:Ue.and(Qi.DetailsVisible.toNegated(),Qi.CanResolve),title:S("detail.less","Show More")}]}));Bi(new Wo({id:"toggleExplainMode",precondition:Qi.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Bi(new Wo({id:"toggleSuggestionFocus",precondition:Qi.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:2570,mac:{primary:778}}}));Bi(new Wo({id:"insertBestCompletion",precondition:Ue.and(G.textInputFocus,Ue.equals("config.editor.tabCompletion","on"),Cm.AtEnd,Qi.Visible.toNegated(),x0.OtherSuggestions.toNegated(),No.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(zA(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:yr,primary:2}}));Bi(new Wo({id:"insertNextSuggestion",precondition:Ue.and(G.textInputFocus,Ue.equals("config.editor.tabCompletion","on"),x0.OtherSuggestions,Qi.Visible.toNegated(),No.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:2}}));Bi(new Wo({id:"insertPrevSuggestion",precondition:Ue.and(G.textInputFocus,Ue.equals("config.editor.tabCompletion","on"),x0.OtherSuggestions,Qi.Visible.toNegated(),No.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:yr,kbExpr:G.textInputFocus,primary:1026}}));Te(class extends xt{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=Jr.get(e))==null||t.resetWidgetSize()}});class OH extends Nt{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 xn),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=Jr.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?eu(g,f):void 0;if(!p)return-1;const C=Si.lift(d),b=u.map((y,A)=>{const I=Ag.fromSuggestion(n,f,C,y,this.isShiftKeyPressed),M=eu(I.toSingleTextEdit(),f),R=wB(p,M);return{index:A,valid:R,prefixLength:M.text.length,suggestItem:y}}).filter(y=>y&&y.valid&&y.prefixLength>0),E=g7(b,Up(y=>y.prefixLength,tb));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(Ys.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=Ag.fromSuggestion(n,u,d,a.item,this.isShiftKeyPressed);this.onWillAccept(f)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!HH(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Jr.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 Ag.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Jr.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Jr.get(this.editor);e==null||e.forceRenderingAbove()}}class Ag{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const u=new Yu().parse(r);u.children.length<100&&bm.adjustWhitespace(t,i,!0,u),r=u.toString(),a=!0}const d=e.getOverwriteInfo(n,s);return new Ag(te.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 p7(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Vl(this.range,this.insertText)}}function HH(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var WH=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},ml=function(o,e){return function(t,i){e(t,i,o)}},VE,wu;let Pr=(wu=class extends Nt{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=Xa(this.editor),this._positions=ns(this,p=>{var C;return((C=this._editorObs.selections.read(p))==null?void 0:C.map(b=>b.getEndPosition()))??[new Si(1,1)]}),this._suggestWidgetAdaptor=this._register(new OH(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=Jo(this,p=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(C=>p(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Jo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Jo(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Jo(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=ns(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=nd(this,p=>{if(this._editorObs.isReadonly.read(p))return;const C=this._editorObs.model.read(p);return C?this._instantiationService.createInstance(IE,C,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Jo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Jo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Jo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=ns(this,p=>{const C=this.model.read(p);return(C==null?void 0:C.ghostTexts.read(p))??[]}),this._stablizedGhostTexts=zH(this._ghostTexts,this._store),this._ghostTextWidgets=x7(this,this._stablizedGhostTexts,(p,C)=>C.add(this._instantiationService.createInstance(FE,this.editor,{ghostText:p,minReservedLineCount:Fl(0),targetTextModel:this.model.map(b=>b==null?void 0:b.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=Vw(this),this._fontFamily=Jo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new sr(this._contextKeyService,this.model)),this._register(ZS(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([sv.Tab.id,sv.DeleteLeft.id,sv.DeleteRight.id,P5,"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(ZS(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||d0.dropDownVisible||dh(p=>{var C;(C=this.model.get())==null||C.stop(p)})})),this._register(Ss(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(ms(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const g=J_(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(v7(ns(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 A=E.textModel.getLineContent(y.primaryGhostText.lineNumber);await rb(50,s1(b)),await m7(this._suggestWidgetSelectedItem,eg,()=>!1,s1(b)),await this._accessibilitySignalService.playSignal(jA.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(y.primaryGhostText.renderForScreenReader(A))})),this._register(new Z1(this.editor,this.model,this._instantiationService)),this._register(LO(ns(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())),na(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 Si(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},VE=wu,wu.ID="editor.contrib.inlineCompletionsController",wu);Pr=VE=WH([ml(1,cn),ml(2,Gn),ml(3,bs),ml(4,ro),ml(5,Tr),ml(6,Di),ml(7,VA),ml(8,Gs),ml(9,eb)],Pr);function zH(o,e){const t=br("result",[]),i=[];return e.add(Ss(n=>{const s=o.read(n);dh(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=br("item",s[a]));t.set([...i],r)}i.forEach((a,d)=>a.set(s[d],r))})})),t}const v_=class v_ extends xt{constructor(){super({id:v_.ID,label:S("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Ue.and(G.writable,sr.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Pr.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};v_.ID=M5;let jE=v_;const m_=class m_ extends xt{constructor(){super({id:m_.ID,label:S("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Ue.and(G.writable,sr.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Pr.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};m_.ID=T5;let $E=m_;class VH extends xt{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:S("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:G.writable})}async run(e,t){const i=Pr.get(t);await uk(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 jH extends xt{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:Ue.and(G.writable,sr.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Ue.and(G.writable,sr.inlineSuggestionVisible)},menuOpts:[{menuId:li.InlineSuggestionToolbar,title:S("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=Pr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class $H extends xt{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:Ue.and(G.writable,sr.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:li.InlineSuggestionToolbar,title:S("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=Pr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class UH extends xt{constructor(){super({id:P5,label:S("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:sr.inlineSuggestionVisible,menuOpts:[{menuId:li.InlineSuggestionToolbar,title:S("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Ue.and(sr.inlineSuggestionVisible,G.tabMovesFocus.toNegated(),sr.inlineSuggestionHasIndentationLessThanTabSize,Qi.Visible.toNegated(),G.hoverFocused.toNegated())}})}async run(e,t){var n;const i=Pr.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const __=class __ extends xt{constructor(){super({id:__.ID,label:S("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:sr.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Pr.get(t);dh(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};__.ID="editor.action.inlineSuggest.hide";let UE=__;const b_=class b_ extends Ko{constructor(){super({id:b_.ID,title:S("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:li.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Ue.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(bs),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};b_.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let qE=b_;var qH=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},Z0=function(o,e){return function(t,i){e(t,i,o)}};class GH{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 GE=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=Pr.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 fv(1e3,this,te.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 fv(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new fv(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=Pr.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new GH(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Tt,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(d0,this._editor,!1,Fl(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 th([d])}renderScreenReaderText(e,t){const i=new Tt,n=xi,s=n("div.hover-row.markdown-hover"),r=di(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new D0({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 Fo().appendText(f).appendCodeblock("text",u)));r.replaceChildren(g.element)};return i.add(Ss(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 Iv(r)})),e.fragment.appendChild(s),i}};GE=qH([Z0(1,Ba),Z0(2,Aa),Z0(3,eb),Z0(4,cn),Z0(5,ka)],GE);class KH{}const Tb=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}};En(Pr.ID,Pr,3);Te(VH);Te(jE);Te($E);Te(jH);Te($H);Te(UH);Te(UE);os(qE);ph.register(GE);Tb.register(new KH);var ZH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BC=function(o,e){return function(t,i){e(t,i,o)}},lg,Zc;let up=(Zc=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Tt,this.toUnhookForKeyboard=new Tt,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Db(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=>{cs(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(lg.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 hk(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=co(a=>this.findDefinition(e,a));let n;try{n=await this.previousPromise}catch(a){cs(a);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?te.lift(n[0].originSelectionRange):new te(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:d}of n)d&&(a=te.plusRange(a,d));this.addDecoration(a,new Fo().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 Fo().appendCodeblock(p||"",g):void 0),d.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=lg.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+lg.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new te(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 Ww)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?ox(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 ax({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(Gn);return qo.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},lg=Zc,Zc.ID="editor.contrib.gotodefinitionatposition",Zc.MAX_SOURCE_PREVIEW_LINES=8,Zc);up=lg=ZH([BC(1,Fa),BC(2,Ba),BC(3,Di)],up);En(up.ID,up,2);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},Dm=function(o,e){return function(t,i){e(t,i,o)}};class PD{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let KE=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new xn,this.onDidChange=this._onDidChange.event,this._dispoables=new Tt,this._markers=[],this._nextIdx=-1,rs.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=XS(a.resource.toString(),d.resource.toString());return u===0&&(n==="position"?u=te.compareRangesUsingStarts(a,d)||Po.compare(a.severity,d.severity):u=Po.compare(a.severity,d.severity)||te.compareRangesUsingStarts(a,d)),u},r=()=>{this._markers=this._markerService.read({resource:rs.isUri(e)?e:void 0,severities:Po.Error|Po.Warning|Po.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 PD(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=Nv(this._markers,{resource:e.uri},(r,a)=>XS(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=te.lift(this._markers[r]);if(a.isEmpty()){const d=e.getWordAtPosition(a.getStartPosition());d&&(a=new te(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(te.containsPosition(this._markers[i],t))return new PD(this._markers[i],i+1,this._markers.length)}}};KE=DB([Dm(1,Iw),Dm(2,bs)],KE);const AB=Yl("IMarkerNavigationService");let ZE=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new ik}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new KE(e,this._markerService,this._configService)}};ZE=DB([Dm(0,Iw),Dm(1,bs)],ZE);Ql(AB,ZE,1);var XE;(function(o){function e(t){switch(t){case Cx.Ignore:return"severity-ignore "+Qn.asClassName(Ji.info);case Cx.Info:return Qn.asClassName(Ji.info);case Cx.Warning:return Qn.asClassName(Ji.warning);case Cx.Error:return Qn.asClassName(Ji.error);default:return""}}o.className=e})(XE||(XE={}));var XH=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},jh=function(o,e){return function(t,i){e(t,i,o)}},YE;class YH{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 Tt,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(zl(this._relatedBlock,"click",a=>{a.preventDefault();const d=this._relatedDiagnostics.get(a.target);d&&i(d)})),this._scrollable=new S7(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(){Io(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=ob(i);this._lines=a.length,this._longestLineLength=0;for(const p of a)this._longestLineLength=Math.max(p.length+r,this._longestLineLength);sl(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=xi("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=di(this._codeLink,xi("span"));C.innerText=s.value,p.appendChild(this._codeLink)}}if(sl(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),_r(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 Po.Error:t=S("Error","Error");break;case Po.Warning:t=S("Warning","Warning");break;case Po.Info:t=S("Info","Info");break;case Po.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 Su;let hp=(Su=class extends nm{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 Tt,this._onDidSelectRelatedInformation=new xn,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=Po.Warning,this._backgroundColor=kn.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(tW);let t=QE,i=QH;this._severity===Po.Warning?(t=vv,i=JH):this._severity===Po.Info&&(t=JE,i=eW);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(U5),secondaryHeadingColor:e.getColor(q5)})}_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(YE.TitleMenu,this._contextKeyService);Mw(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=di(e,xi(""))}_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 YH(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=te.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(cl(a.uri),d)}this._icon.className=`codicon ${XE.className(Po.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()}},YE=Su,Su.TitleMenu=new li("gotoErrorTitleMenu"),Su);hp=YE=XH([jh(1,ra),jh(2,Aa),jh(3,ch),jh(4,cn),jh(5,Gn),jh(6,Ug)],hp);const TD=$w(b7,_7),MD=$w(E7,C7),RD=$w(QC,y7),QE=vi("editorMarkerNavigationError.background",{dark:TD,light:TD,hcDark:Wl,hcLight:Wl},S("editorMarkerNavigationError","Editor marker navigation widget error color.")),QH=vi("editorMarkerNavigationError.headerBackground",{dark:ol(QE,.1),light:ol(QE,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),vv=vi("editorMarkerNavigationWarning.background",{dark:MD,light:MD,hcDark:Wl,hcLight:Wl},S("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),JH=vi("editorMarkerNavigationWarning.headerBackground",{dark:ol(vv,.1),light:ol(vv,.1),hcDark:"#0C141F",hcLight:ol(vv,.2)},S("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),JE=vi("editorMarkerNavigationInfo.background",{dark:RD,light:RD,hcDark:Wl,hcLight:Wl},S("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),eW=vi("editorMarkerNavigationInfo.headerBackground",{dark:ol(JE,.1),light:ol(JE,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),tW=vi("editorMarkerNavigation.background",w7,S("editorMarkerNavigationBackground","Editor marker navigation widget background."));var iW=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)}},cg,Du;let sh=(Du=class{static get(e){return e.getContribution(cg.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Tt,this._editor=e,this._widgetVisible=kB.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(hp,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)||!te.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:te.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 Si(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=cg.get(r))==null||i.close(),(n=cg.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},cg=Du,Du.ID="editor.contrib.markerController",Du);sh=cg=iW([Vx(1,AB),Vx(2,Gn),Vx(3,zs),Vx(4,cn)],sh);class Mb extends xt{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=sh.get(t))==null||i.nagivate(this._next,this._multiFile))}}const Td=class Td extends Mb{constructor(){super(!0,!1,{id:Td.ID,label:Td.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:G.focus,primary:578,weight:100},menuOpts:{menuId:hp.TitleMenu,title:Td.LABEL,icon:Rs("marker-navigation-next",Ji.arrowDown,S("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};Td.ID="editor.action.marker.next",Td.LABEL=S("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let Am=Td;const Md=class Md extends Mb{constructor(){super(!1,!1,{id:Md.ID,label:Md.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:G.focus,primary:1602,weight:100},menuOpts:{menuId:hp.TitleMenu,title:Md.LABEL,icon:Rs("marker-navigation-previous",Ji.arrowUp,S("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};Md.ID="editor.action.marker.prev",Md.LABEL=S("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let ey=Md;class nW extends Mb{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:G.focus,primary:66,weight:100},menuOpts:{menuId:li.MenubarGoMenu,title:S({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class sW extends Mb{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:G.focus,primary:1090,weight:100},menuOpts:{menuId:li.MenubarGoMenu,title:S({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}En(sh.ID,sh,4);Te(Am);Te(ey);Te(nW);Te(sW);const kB=new Tn("markersNavigationVisible",!1),oW=Zo.bindToContribution(sh.get);Bi(new oW({id:"closeMarkersNavigation",precondition:kB,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:G.focus,primary:9,secondary:[1033]}}));var ua;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(ua||(ua={}));class rW extends xt{constructor(){super({id:I5,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:Ei("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:[ua.NoAutoFocus,ua.FocusIfVisible,ua.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:ua.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=ko.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=ua.FocusIfVisible;Object.values(ua).includes(s)?r=s:typeof s=="boolean"&&s&&(r=ua.AutoFocusImmediately);const a=u=>{const f=t.getPosition(),g=new te(f.lineNumber,f.column,f.lineNumber,f.column);n.showContentHover(g,1,1,u)},d=t.getOption(2)===2;n.isHoverVisible?r!==ua.NoAutoFocus?n.focus():a(d):a(d||r===ua.AutoFocusImmediately)}}class aW extends xt{constructor(){super({id:wM,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:Ei("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=ko.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new te(n.lineNumber,n.column,n.lineNumber,n.column),r=up.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class lW extends xt{constructor(){super({id:SM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:16,weight:100},metadata:{description:Ei("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.scrollUp()}}class cW extends xt{constructor(){super({id:DM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:18,weight:100},metadata:{description:Ei("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.scrollDown()}}class dW extends xt{constructor(){super({id:AM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:15,weight:100},metadata:{description:Ei("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.scrollLeft()}}class uW extends xt{constructor(){super({id:kM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:17,weight:100},metadata:{description:Ei("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.scrollRight()}}class hW extends xt{constructor(){super({id:BM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:Ei("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.pageUp()}}class fW extends xt{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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:Ei("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.pageDown()}}class gW extends xt{constructor(){super({id:LM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:Ei("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.goToTop()}}class pW extends xt{constructor(){super({id:IM,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:G.hoverFocused,kbOpts:{kbExpr:G.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:Ei("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=ko.get(t);i&&i.goToBottom()}}class xW extends xt{constructor(){super({id:yb,label:PM,alias:"Increase Hover Verbosity Level",precondition:G.hoverVisible})}run(e,t,i){const n=ko.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(Lr.Increase,s,i==null?void 0:i.focus)}}class vW extends xt{constructor(){super({id:wb,label:TM,alias:"Decrease Hover Verbosity Level",precondition:G.hoverVisible})}run(e,t,i){var r;const n=ko.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=ko.get(t))==null||r.updateHoverVerbosityLevel(Lr.Decrease,s,i==null?void 0:i.focus)}}var mW=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},FC=function(o,e){return function(t,i){e(t,i,o)}};const Hr=xi;class _W{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 ND={type:1,filter:{include:fs.QuickFix},triggerAction:rr.QuickFixHover};let ty=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 te(e.range.startLineNumber,d,e.range.startLineNumber,u);r.push(new _W(this,g,f))}return r}renderHoverParts(e,t){if(!t.length)return new th([]);const i=new Tt,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)=>Po.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new th(n)}_renderMarkerHover(e){const t=new Tt,i=Hr("div.hover-row"),n=di(i,Hr("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:d}=e.marker;this._editor.applyFontInfo(n);const u=di(n,Hr("span"));if(u.style.whiteSpace="pre-wrap",u.innerText=r,s||a)if(a&&typeof a!="string"){const g=Hr("span");if(s){const E=di(g,Hr("span"));E.innerText=s}const p=di(g,Hr("a.code-link"));p.setAttribute("href",a.target.toString()),t.add(qn(p,"click",E=>{this._openerService.open(a.target,{allowCommands:!0}),E.preventDefault(),E.stopPropagation()}));const C=di(p,Hr("span"));C.innerText=a.value;const b=di(n,g);b.style.opacity="0.6",b.style.paddingLeft="6px"}else{const g=di(n,Hr("span"));g.style.opacity="0.6",g.style.paddingLeft="6px",g.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(_r(d))for(const{message:g,resource:p,startLineNumber:C,startColumn:b}of d){const E=di(n,Hr("div"));E.style.marginTop="8px";const y=di(E,Hr("a"));y.innerText=`${cl(p)}(${C}, ${b}): `,y.style.cursor="pointer",t.add(qn(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(cs)}}));const A=di(E,Hr("span"));A.innerText=g,this._editor.applyFontInfo(A)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===Po.Error||t.marker.severity===Po.Warning||t.marker.severity===Po.Info){const n=sh.get(this._editor);n&&e.statusBar.addAction({label:S("view problem","View Problem"),commandId:Am.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(Hr("div"));this.recentMarkerCodeActionsInfo&&(YS.makeKey(this.recentMarkerCodeActionsInfo.marker)===YS.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?Nt.None:Hg(()=>n.textContent=S("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(ms(()=>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(ms(()=>{d||a.dispose()})),e.statusBar.addAction({label:S("quick fixes","Quick Fix..."),commandId:_9,run:u=>{d=!0;const f=l0.get(this._editor),g=Uo(u);e.hide(),f==null||f.showCodeActions(ND,a,{x:g.left,y:g.top,width:g.width,height:g.height})}})},cs)}}getCodeActions(e){return co(t=>lf(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new te(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),ND,Bl.None,t))}};ty=mW([FC(1,D7),FC(2,Aa),FC(3,Di)],ty);class bW{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=Fv.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)??Fv.Center;if(!n&&a!==this._laneOrLine)continue;const d=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!d||$g(d)||i.push(...yA(d).map(e))}return i}}var CW=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)}},iy;const HD=xi;var Au;let ny=(Au=class extends Nt{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Tt),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new EA),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new D0({editor:this._editor},t,i)),this._computer=new bW(this._editor),this._hoverOperation=this._register(new R5(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(zl(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return iy.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=HD("div.hover-row.markdown-hover"),r=di(s,HD("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||!Sb(t,e.x,e.y))&&this.hide()}},iy=Au,Au.ID="editor.contrib.modesGlyphHoverWidget",Au);ny=iy=CW([OD(1,Ba),OD(2,Aa)],ny);var EW=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},yW=function(o,e){return function(t,i){e(t,i,o)}},Wf;let km=(Wf=class extends Nt{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Tt,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Qs(()=>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?Sb(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(ny,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},Wf.ID="editor.contrib.marginHover",Wf);km=EW([yW(1,cn)],km);class wW{}class SW{}class DW{}En(ko.ID,ko,2);En(km.ID,km,2);Te(rW);Te(aW);Te(lW);Te(cW);Te(dW);Te(uW);Te(hW);Te(fW);Te(gW);Te(pW);Te(xW);Te(vW);ph.register(rp);ph.register(ty);Y_((o,e)=>{const t=o.getColor(A7);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)}; }`))});Tb.register(new wW);Tb.register(new SW);Tb.register(new DW);function Qo(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function kg(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 BB(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 k7(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,t0.shiftIndent(E,E.length+y,r,a,d)),f=(E,y)=>(y=y||1,t0.unshiftIndent(E,E.length+y,r,a,d)),g=[],p=o.getLineContent(t);let C=_o(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(AW(o,E))continue;const y=o.getLineContent(E),A=_o(y),I=b;s.shouldDecrease(E,I)&&(b=f(b),C=f(C)),A!==b&&g.push(Fs.replaceMove(new Zi(E,1,E,A.length+1),B7(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 AW(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var kW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BW=function(o,e){return function(t,i){e(t,i,o)}};const C_=class C_ extends xt{constructor(){super({id:C_.ID,label:S("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:G.writable,metadata:{description:Ei("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 TW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};C_.ID="editor.action.indentationToSpaces";let sy=C_;const E_=class E_ extends xt{constructor(){super({id:E_.ID,label:S("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:G.writable,metadata:{description:Ei("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 MW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};E_.ID="editor.action.indentationToTabs";let oy=E_;class U9 extends xt{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(Xl),n=e.get(Ho),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 y_=class y_ extends U9{constructor(){super(!1,!1,{id:y_.ID,label:S("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:Ei("indentUsingTabsDescription","Use indentation with tabs.")}})}};y_.ID="editor.action.indentUsingTabs";let ry=y_;const w_=class w_ extends U9{constructor(){super(!0,!1,{id:w_.ID,label:S("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:Ei("indentUsingSpacesDescription","Use indentation with spaces.")}})}};w_.ID="editor.action.indentUsingSpaces";let ay=w_;const S_=class S_ extends U9{constructor(){super(!0,!0,{id:S_.ID,label:S("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:Ei("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};S_.ID="editor.action.changeTabDisplaySize";let ly=S_;const D_=class D_ extends xt{constructor(){super({id:D_.ID,label:S("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:Ei("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(Ho),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};D_.ID="editor.action.detectIndentation";let cy=D_;class FW extends xt{constructor(){super({id:"editor.action.reindentlines",label:S("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:G.writable,metadata:{description:Ei("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(ao),n=t.getModel();if(!n)return;const s=BB(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class LW extends xt{constructor(){super({id:"editor.action.reindentselectedlines",label:S("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:G.writable,metadata:{description:Ei("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(ao),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=BB(n,i,d,u);r.push(...f)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class IW{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(te.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 zf;let Bm=(zf=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Tt,this.callOnModel=new Tt,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)||PW(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=>t0.shiftIndent(b,b.length+1,r,a,d),unshiftIndent:b=>t0.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=mg(s,i,i.getLanguageId(),g,f,this._languageConfigurationService);if(b!==null){const E=_o(p),y=Qo(b,r),A=Qo(E,r);if(y!==A){const I=kg(y,r,d);u.push({range:new te(g,1,g,E.length+1),text:I}),p=I+p.substring(E.length)}else{const I=fk(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=mg(s,{tokenization:{getLineTokens:y=>i.tokenization.getLineTokens(y),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(y,A)=>i.getLanguageIdAtPosition(y,A)},getLineContent:y=>y===C?p:i.getLineContent(y)},i.getLanguageId(),g+1,f,this._languageConfigurationService);if(E!==null){const y=Qo(E,r),A=Qo(_o(i.getLineContent(g+1)),r);if(y!==A){const I=y-A;for(let M=g+1;M<=e.endLineNumber;M++){const R=i.getLineContent(M),P=_o(R),U=Qo(P,r)+I,J=kg(U,r,d);J!==P&&u.push({range:new te(M,1,M,P.length+1),text:J})}}}}if(u.length>0){this.editor.pushUndoStop();const b=new IW(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()}},zf.ID="editor.contrib.autoIndentOnPaste",zf);Bm=kW([BW(1,ao)],Bm);function PW(o,e){const t=i=>F7(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function FB(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 te(r,1,r,d),f=o.getValueInRange(u),g=i?f.replace(/\t/ig,n):f.replace(s," ");e.addEditOperation(u,g)}}class TW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),FB(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class MW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),FB(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}En(Bm.ID,Bm,2);Te(sy);Te(oy);Te(ry);Te(ay);Te(ly);Te(cy);Te(FW);Te(LW);En(lp.ID,lp,1);ph.register(am);class RW{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 Zi(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new Zi(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var NW=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},OW=function(o,e){return function(t,i){e(t,i,o)}},mv,Xc;let v0=(Xc=class{static get(e){return e.getContribution(mv.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 hk(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=co(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=te.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 Zi(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+p-1));const C=new RW(f,s,u.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,C),this.editor.pushUndoStop(),this.decorations.set([{range:g,options:mv.DECORATION}]),(b=this.decorationRemover)==null||b.cancel(),this.decorationRemover=rb(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(cs)}).catch(cs)):Promise.resolve(void 0)}},mv=Xc,Xc.ID="editor.contrib.inPlaceReplaceController",Xc.DECORATION=Bn.register({description:"in-place-replace",className:"valueSetReplacement"}),Xc);v0=mv=NW([OW(1,Jl)],v0);class HW extends xt{constructor(){super({id:"editor.action.inPlaceReplace.up",label:S("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=v0.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class WW extends xt{constructor(){super({id:"editor.action.inPlaceReplace.down",label:S("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=v0.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}En(v0.ID,v0,4);Te(HW);Te(WW);class zW extends xt{constructor(){super({id:"expandLineSelection",label:S("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:G.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,Uw.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}Te(zW);class VW{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=jW(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 jW(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=ov(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++]=Fs.delete(new te(a,C,a,f))}return i}class LB{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 te(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
49
+ `):this._isCopyingDown?t.addEditOperation(new te(i.startLineNumber,1,i.startLineNumber,1),s+`
50
+ `):t.addEditOperation(new te(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=Zi.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var $W=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},UW=function(o,e){return function(t,i){e(t,i,o)}};let dy=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 te(1,1,1,1),null):(t.addEditOperation(new te(g,1,g,1),e.getLineContent(p)),t.addEditOperation(new te(p,1,p,e.getLineMaxColumn(p)),null)),r=new Zi(p,1,p,1)}else{let g,p;if(this._isMovingDown){g=r.endLineNumber+1,p=e.getLineContent(g),t.addEditOperation(new te(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=_o(e.getLineContent(g)),A=b+Qo(y,a);C=kg(A,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)},A=mg(this._autoIndent,y,e.getLanguageIdAtPosition(g,1),r.startLineNumber,f,this._languageConfigurationService);if(A!==null){const I=_o(e.getLineContent(g)),M=Qo(A,a),R=Qo(I,a);M!==R&&(C=kg(M,a,u)+this.trimStart(p))}}t.addEditOperation(new te(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)},A=mg(this._autoIndent,y,e.getLanguageIdAtPosition(g,1),r.startLineNumber+1,f,this._languageConfigurationService);if(A!==null){const I=_o(e.getLineContent(r.startLineNumber)),M=Qo(A,a),R=Qo(I,a);if(M!==R){const P=M-R;this.getIndentEditsOfMovingBlock(e,t,r,a,u,P)}}}}else t.addEditOperation(new te(r.startLineNumber,1,r.startLineNumber,1),C+`
53
+ `)}else if(g=r.startLineNumber-1,p=e.getLineContent(g),t.addEditOperation(new te(g,1,g+1,1),null),t.addEditOperation(new te(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=mg(this._autoIndent,C,e.getLanguageIdAtPosition(r.startLineNumber,1),g,f,this._languageConfigurationService);if(E!==null){const y=_o(e.getLineContent(r.startLineNumber)),A=Qo(E,a),I=Qo(y,a);if(A!==I){const M=A-I;this.getIndentEditsOfMovingBlock(e,t,r,a,u,M)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>t0.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>t0.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===Ex.None||s.indentAction===Ex.Indent?r=s.indentation+s.appendText:s.indentAction===Ex.IndentOutdent?r=s.indentation:s.indentAction===Ex.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const d=_o(e.getLineContent(n));let u=_o(r);const f=fk(e,n,this._languageConfigurationService);f!==null&&f&2&&(u=t.unshiftIndent(u));const g=Qo(u,i),p=Qo(d,i);return g-p}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(ov(r)>=0){const a=e.getLineMaxColumn(s),d=Qb(this._autoIndent,e,new te(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(ov(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=Qb(this._autoIndent,e,new te(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),ov(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=Qb(this._autoIndent,e,new te(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=_o(d),g=Qo(u,n)+r,p=kg(g,n,s);p!==u&&(t.addEditOperation(new te(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}};dy=$W([UW(3,ao)],dy);const bf=class bf{static getCollator(){return bf._COLLATOR||(bf._COLLATOR=new Intl.Collator),bf._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=qW(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=IB(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}};bf._COLLATOR=null;let fp=bf;function IB(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(fp.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function qW(o,e,t){const i=IB(o,e,t);return i?Fs.replace(new te(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
55
+ `)):null}class PB extends xt{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)=>te.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 LB(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class GW extends PB{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:S("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class KW extends PB{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:S("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class ZW extends xt{constructor(){super({id:"editor.action.duplicateSelection",label:S("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:G.writable,menuOpts:{menuId:li.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 LB(a,!0));else{const d=new Zi(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new L7(d,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class TB extends xt{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(ao),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new dy(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class XW extends TB{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:S("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class YW extends TB{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:S("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class MB extends xt{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 Zi(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!fp.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new fp(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class QW extends MB{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:S("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:G.writable})}}class JW extends MB{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:S("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:G.writable})}}class ez extends xt{constructor(){super({id:"editor.action.removeDuplicateLines",label:S("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:G.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 Zi(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 Zi(u.startLineNumber,1,u.endLineNumber,i.getLineMaxColumn(u.endLineNumber)),C=u.startLineNumber-r,b=new Zi(C,1,C+g.length-1,g[g.length-1].length);n.push(Fs.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 A_=class A_ extends xt{constructor(){super({id:A_.ID,label:S("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:qs(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(f=>new Si(f.positionLineNumber,f.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(bs),a=t.getModel(),d=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),u=new VW(s,n,d);t.pushUndoStop(),t.executeCommands(this.id,[u]),t.pushUndoStop()}};A_.ID="editor.action.trimTrailingWhitespace";let uy=A_;class tz extends xt{constructor(){super({id:"editor.action.deleteLines",label:S("lines.delete","Delete Line"),alias:"Delete Line",precondition:G.writable,kbOpts:{kbExpr:G.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(Fs.replace(new Zi(g,C,p,b),"")),a.push(new Zi(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 iz extends xt{constructor(){super({id:"editor.action.indentLines",label:S("lines.indent","Indent Line"),alias:"Indent Line",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,I7.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class nz extends xt{constructor(){super({id:"editor.action.outdentLines",label:S("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:2140,weight:100}})}run(e,t){sv.Outdent.runEditorCommand(e,t,null)}}class sz extends xt{constructor(){super({id:"editor.action.insertLineBefore",label:S("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,gk.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class oz extends xt{constructor(){super({id:"editor.action.insertLineAfter",label:S("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:G.writable,kbOpts:{kbExpr:G.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,gk.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class RB extends xt{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];te.intersectRanges(f,g)===null?s.push(f):n[d+1]=te.plusRange(f,g)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(d=>Fs.replace(d,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class rz extends RB{constructor(){super({id:"deleteAllLeft",label:S("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:G.writable,kbOpts:{kbExpr:G.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 Zi(d,r.startColumn,d,r.startColumn)}else a=new Zi(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(te.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 te(r,a,s.startLineNumber,1)}else return new te(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new te(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class az extends RB{constructor(){super({id:"deleteAllRight",label:S("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:G.writable,kbOpts:{kbExpr:G.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 Zi(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 te(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new te(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(te.compareRangesUsingStarts),n}}class lz extends xt{constructor(){super({id:"editor.action.joinLines",label:S("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:G.writable,kbOpts:{kbExpr:G.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(te.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 Zi(p.startLineNumber,p.startColumn,C.endLineNumber,C.endColumn):C.startLineNumber>p.endLineNumber?(s.push(p),C):new Zi(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 A=0,I,M;const R=a.getLineLength(b.endLineNumber)-b.endColumn;if(b.isEmpty()||b.startLineNumber===b.endLineNumber){const U=b.getStartPosition();U.lineNumber<a.getLineCount()?(I=E+1,M=a.getLineMaxColumn(I)):(I=U.lineNumber,M=a.getLineMaxColumn(U.lineNumber))}else I=b.endLineNumber,M=a.getLineMaxColumn(I);let P=a.getLineContent(E);for(let U=E+1;U<=I;U++){const J=a.getLineContent(U),re=a.getLineFirstNonWhitespaceColumn(U);if(re>=1){let ae=!0;P===""&&(ae=!1),ae&&(P.charAt(P.length-1)===" "||P.charAt(P.length-1)===" ")&&(ae=!1,P=P.replace(/[\s\uFEFF\xA0]+$/g," "));const ie=J.substr(re-1);P+=(ae?" ":"")+ie,ae?A=ie.length+1:A=ie.length}else A=0}const V=new te(E,y,I,M);if(!V.isEmpty()){let U;b.isEmpty()?(d.push(Fs.replace(V,P)),U=new Zi(V.startLineNumber-g,P.length-A+1,E-g,P.length-A+1)):b.startLineNumber===b.endLineNumber?(d.push(Fs.replace(V,P)),U=new Zi(b.startLineNumber-g,b.startColumn,b.endLineNumber-g,b.endColumn)):(d.push(Fs.replace(V,P)),U=new Zi(b.startLineNumber-g,b.startColumn,b.startLineNumber-g,P.length-R)),te.intersectRanges(V,n)!==null?f=U:u.push(U)}g+=V.endLineNumber-V.startLineNumber}u.unshift(f),t.pushUndoStop(),t.executeEdits(this.id,d,u),t.pushUndoStop()}}class cz extends xt{constructor(){super({id:"editor.action.transpose",label:S("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:G.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 te(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new Mp(new Zi(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p))}else{const g=new te(u.lineNumber,Math.max(1,u.column-1),u.lineNumber,u.column+1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new IA(g,p,new Zi(u.lineNumber,u.column+1,u.lineNumber,u.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class mh extends xt{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 te(d.lineNumber,u.startColumn,d.lineNumber,u.endColumn),g=n.getValueInRange(f);r.push(Fs.replace(f,this._modifyText(g,s)))}else{const d=n.getValueInRange(a);r.push(Fs.replace(a,this._modifyText(d,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class dz extends mh{constructor(){super({id:"editor.action.transformToUppercase",label:S("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:G.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class uz extends mh{constructor(){super({id:"editor.action.transformToLowercase",label:S("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:G.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class Ol{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 k_=class k_ extends mh{constructor(){super({id:"editor.action.transformToTitlecase",label:S("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:G.writable})}_modifyText(e,t){const i=k_.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};k_.titleBoundary=new Ol("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let Fm=k_;const Cf=class Cf extends mh{constructor(){super({id:"editor.action.transformToSnakecase",label:S("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:G.writable})}_modifyText(e,t){const i=Cf.caseBoundary.get(),n=Cf.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};Cf.caseBoundary=new Ol("(\\p{Ll})(\\p{Lu})","gmu"),Cf.singleLetters=new Ol("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let Bg=Cf;const B_=class B_ extends mh{constructor(){super({id:"editor.action.transformToCamelcase",label:S("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:G.writable})}_modifyText(e,t){const i=B_.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("")}};B_.wordBoundary=new Ol("[_\\s-]","gm");let Lm=B_;const Ef=class Ef extends mh{constructor(){super({id:"editor.action.transformToPascalcase",label:S("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:G.writable})}_modifyText(e,t){const i=Ef.wordBoundary.get(),n=Ef.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("")}};Ef.wordBoundary=new Ol("[_\\s-]","gm"),Ef.wordBoundaryToMaintain=new Ol("(?<=\\.)","gm");let Im=Ef;const Ec=class Ec extends mh{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:G.writable})}_modifyText(e,t){const i=Ec.caseBoundary.get(),n=Ec.singleLetters.get(),s=Ec.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};Ec.caseBoundary=new Ol("(\\p{Ll})(\\p{Lu})","gmu"),Ec.singleLetters=new Ol("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),Ec.underscoreBoundary=new Ol("(\\S)(_)(\\S)","gm");let Pm=Ec;Te(GW);Te(KW);Te(ZW);Te(XW);Te(YW);Te(QW);Te(JW);Te(ez);Te(uy);Te(tz);Te(iz);Te(nz);Te(sz);Te(oz);Te(rz);Te(az);Te(lz);Te(cz);Te(dz);Te(uz);Bg.caseBoundary.isSupported()&&Bg.singleLetters.isSupported()&&Te(Bg);Lm.wordBoundary.isSupported()&&Te(Lm);Im.wordBoundary.isSupported()&&Te(Im);Fm.titleBoundary.isSupported()&&Te(Fm);Pm.isSupported()&&Te(Pm);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},jx=function(o,e){return function(t,i){e(t,i,o)}},_v;const NB=new Tn("LinkedEditingInputVisible",!1),fz="linked-editing-decoration";var Yc;let m0=(Yc=class extends Nt{static get(e){return e.getContribution(_v.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Tt),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=NB.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 Tt),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(Ys.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new id(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new id(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=Gp(u,f);g+=C,u=u.substr(C),f=f.substr(C);const b=P7(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 te(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 uo;try{const r=new or(!1),a=await OB(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(te.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:_v.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(f),this._syncRangesToken++}catch(r){dd(r)||cs(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},_v=Yc,Yc.ID="editor.contrib.linkedEditing",Yc.DECORATION=Bn.register({description:"linked-editing",stickiness:0,className:fz}),Yc);m0=_v=hz([jx(1,Gn),jx(2,Di),jx(3,ao),jx(4,Tr)],m0);class gz extends xt{constructor(){super({id:"editor.action.linkedEditing",label:S("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:Ue.and(G.writable,G.hasRenameProvider),kbOpts:{kbExpr:G.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(zs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return rs.isUri(n)&&Si.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))))},cs):super.runCommand(e,t)}run(e,t){const i=m0.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const pz=Zo.bindToContribution(m0.get);Bi(new pz({id:"cancelLinkedEditingInput",precondition:NB,handler:o=>o.clearRanges(),kbOpts:{kbExpr:G.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function OB(o,e,t,i){const n=o.ordered(e);return qw(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){Ws(r);return}}),s=>!!s&&_r(s==null?void 0:s.ranges))}vi("editor.linkedEditingBackground",{dark:kn.fromHex("#f00").transparent(.3),light:kn.fromHex("#f00").transparent(.3),hcDark:kn.fromHex("#f00").transparent(.3),hcLight:kn.white},S("editorLinkedEditingBackground","Background color when the editor auto renames on type."));Xo("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(Di);return OB(i,e,t,vn.None)});En(m0.ID,m0,1);Te(gz);let xz=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 Tm{constructor(e){this._disposables=new Tt;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new xz(r,n));t=Tm._union(t,s),JA(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(te.areIntersectingOrTouching(d.range,u.range)){n++;continue}te.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 HB(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])},Ws));return Promise.all(n).then(()=>{const s=new Tm(Hl(i));return t.isCancellationRequested?(s.dispose(),new Tm([])):s})}ps.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;Zn(t instanceof rs),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(Di),s=o.get(Ho).getModel(t);if(!s)return[];const r=await HB(n,s,vn.None);if(!r)return[];for(let d=0;d<Math.min(i,r.links.length);d++)await r.links[d].resolve(vn.None);const a=r.links.slice(0);return r.dispose(),a});var vz=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)}},hy,ku;let gp=(ku=class extends Nt{static get(e){return e.getContribution(hy.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 Qs(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new Db(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=co(t=>HB(this.providers,e,t));try{const t=new or(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){cs(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(Df.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 Df(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(vn.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===jo.file&&s.startsWith(`${jo.file}:`)){const a=rs.parse(s);if(a.scheme===jo.file){const d=T7(a);let u=null;d.startsWith("/./")||d.startsWith("\\.\\")?u=`.${d.substr(1)}`:(d.startsWith("//./")||d.startsWith("\\\\.\\"))&&(u=`.${d.substr(2)}`),u&&(s=M7(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.")):cs(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()}},hy=ku,ku.ID="editor.linkDetector",ku);gp=hy=vz([$x(1,Aa),$x(2,Oo),$x(3,Di),$x(4,Tr)],gp);const WD={general:Bn.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:Bn.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Df{static decoration(e,t){return{range:e.range,options:Df._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?WD.active:WD.general};return n.hoverMessage=mz(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Df._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Df._getOptions(this.link,t,!1))}}function mz(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?ll?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):ll?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 Fo("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new Fo().appendText(`${i} (${n})`)}class _z extends xt{constructor(){super({id:"editor.action.openLink",label:S("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=gp.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)}}}En(gp.ID,gp,1);Te(_z);const CS=class CS extends Nt{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})}))}};CS.ID="editor.contrib.longLinesHelper";let Mm=CS;En(Mm.ID,Mm,2);const bz=vi("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);vi("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);vi("editor.wordHighlightTextBackground",bz,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 Cz=vi("editor.wordHighlightBorder",{light:null,dark:null,hcDark:ju,hcLight:ju},S("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));vi("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:ju,hcLight:ju},S("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));vi("editor.wordHighlightTextBorder",Cz,S("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const Ez=vi("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),yz=vi("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),wz=vi("editorOverviewRuler.wordHighlightTextForeground",pk,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),Sz=Bn.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Ks(yz),position:nl.Center},minimap:{color:Ks(ab),position:1}}),Dz=Bn.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Ks(wz),position:nl.Center},minimap:{color:Ks(ab),position:1}}),Az=Bn.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Ks(pk),position:nl.Center},minimap:{color:Ks(ab),position:1}}),kz=Bn.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),Bz=Bn.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Ks(Ez),position:nl.Center},minimap:{color:Ks(ab),position:1}});function Fz(o){return o===Hv.Write?Sz:o===Hv.Text?Dz:Bz}function Lz(o){return o?kz:Az}Y_((o,e)=>{const t=o.getColor(R7);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var Iz=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},Pz=function(o,e){return function(t,i){e(t,i,o)}},fy;function hd(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);Zf(n)}}class Tz extends xt{constructor(){super({id:"editor.action.insertCursorAbove",label:S("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:li.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,Uw.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),hd(r,s.getCursorStates())}}class Mz extends xt{constructor(){super({id:"editor.action.insertCursorBelow",label:S("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:li.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,Uw.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),hd(r,s.getCursorStates())}}class Rz extends xt{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:G.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:li.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 Zi(n,s,n,s))}e.endColumn>1&&i.push(new Zi(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),hd(r,s.getCursorStates())}}class Nz extends xt{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 Zi(d,i[0].startColumn,d,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),hd(a,r.getCursorStates())}}class Oz extends xt{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 Zi(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),hd(r,s.getCursorStates())}}class Ux{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class pp{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new pp(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 Zi(d.startLineNumber,g.startColumn,d.startLineNumber,g.endColumn)}else u=e.getModel().getValueInRange(d).replace(/\r\n/g,`
57
+ `);return new pp(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 Ux(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 Ux(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 Zi(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 Ux(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 Ux(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 Zi(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 F_=class F_ extends Nt{static get(e){return e.getContribution(F_.ID)}constructor(e){super(),this._sessionDispose=this._register(new Tt),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=pp.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 Zi(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(!WB(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 Zi(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};F_.ID="editor.contrib.multiCursorController";let _0=F_;class T0 extends xt{run(e,t){const i=_0.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=Go.get(t);if(r)this._run(i,r);else{const a=e.get(cn).createInstance(Go,t);this._run(i,a),a.dispose()}hd(s,n.getCursorStates())}}}class Hz extends T0{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:G.focus,primary:2082,weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class Wz extends T0{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:li.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 zz extends T0{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:G.focus,primary:qs(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class Vz extends T0{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 jz extends T0{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:G.focus,primary:3114,weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"3_multi",title:S({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class $z extends T0{constructor(){super({id:"editor.action.changeAll",label:S("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:Ue.and(G.writable,G.editorTextFocus),kbOpts:{kbExpr:G.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class Uz{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(te.compareRangesUsingStarts)),this._cachedFindMatches}}var Bu;let Rm=(Bu=class extends Nt{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Qs(()=>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=Go.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(fy._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=_0.get(i);if(!s)return null;const r=Go.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(!WB(i.getModel(),f,p))return null}a=pp.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 Uz(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(te.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=te.compareRangesUsingStarts(C,n[f]);b<0?((n[f].isEmpty()||!te.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:Lz(a)}));this._decorations.set(d)}dispose(){this._setState(null),super.dispose()}},fy=Bu,Bu.ID="editor.contrib.selectionHighlighter",Bu);Rm=fy=Iz([Pz(1,Di)],Rm);function WB(o,e,t){const i=zD(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=zD(o,r,!t);if(i!==a)return!1}return!0}function zD(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class qz extends xt{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),hd(s,n.getCursorStates()))}}class Gz extends xt{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),hd(s,n.getCursorStates()))}}En(_0.ID,_0,4);En(Rm.ID,Rm,1);Te(Tz);Te(Mz);Te(Rz);Te(Hz);Te(Wz);Te(zz);Te(Vz);Te(jz);Te($z);Te(Nz);Te(Oz);Te(qz);Te(Gz);const Kz="editor.action.inlineEdit.accept",Zz="editor.action.inlineEdit.reject",Xz="editor.action.inlineEdit.jumpTo",Yz="editor.action.inlineEdit.jumpBack";var Qz=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},Jz=function(o,e){return function(t,i){e(t,i,o)}};const LC="inline-edit";let gy=class extends Nt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=br(this,!1),this.currentTextModel=Jo(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=ns(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 P=g[g.length-1];R&&P.decorations.push(new Zg(P.content.length+1,P.content.length+1+M[0].length,R,0)),P.content+=M[0],M=M.slice(1)}for(const P of M)g.push({content:P,decorations:R?[new Zg(1,P.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,LC),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,LC),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 CB(b,C.length+1):void 0,A=d||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:f,additionalLines:g,hiddenRange:y,lineNumber:A,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:d,isPureRemove:u}}),this.decorations=ns(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 te(f,g,f,p);a.push(C)}}for(const d of a)r.push({range:d,options:Gw})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new te(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:Kw})}for(const a of s.inlineTexts)r.push({range:te.fromPositions(new Si(s.lineNumber,a.column)),options:{description:LC,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:of.Left},showIfCollapsed:!0}});return r}),this._register(ms(()=>{this.isDisposed.set(!0,void 0)})),this._register(EB(this.editor,this.decorations))}};gy=Qz([Jz(2,Ba)],gy);var q9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ka=function(o,e){return function(t,i){e(t,i,o)}},bv;let py=class extends Nt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Jo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=ns(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 Si(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Vp((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(xy,this.editor,!0,this.position));e.addContentWidget(a),s.add(ms(()=>e.removeContentWidget(a)))}))}};py=q9([Ka(2,cn)],py);var Qc;let xy=(Qc=class extends Nt{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${bv.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Xr("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Xr("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(li.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(vy,this.nodes.toolBar,this.editor,li.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,d)=>{if(a instanceof Jf)return n.createInstance(eV,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{bv._dropDownVisible=a})),this._register(Ss(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(Ss(a=>{const d=[];for(const[u,f]of this.inlineCompletionsActionsMenus.getActions())for(const g of f)g instanceof Jf&&d.push(g);d.length>0&&d.unshift(new jg),this.toolBar.setAdditionalSecondaryActions(d)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},bv=Qc,Qc._dropDownVisible=!1,Qc.id=0,Qc);xy=bv=q9([Ka(3,cn),Ka(4,Gn),Ka(5,ch)],xy);class eV extends mA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Xr("div.keybinding").root;this._register(new kw(t,Bw,{disableTitle:!0,..._A})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let vy=class extends bA{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=[];Mw(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){al(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};vy=q9([Ka(4,ch),Ka(5,Gn),Ka(6,E0),Ka(7,Gs),Ka(8,ro),Ka(9,ka)],vy);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},Cv=function(o,e){return function(t,i){e(t,i,o)}},dg,my;function*tV(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function IC(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 Fu;let _y=(Fu=class extends Nt{static _createUniqueUri(){return rs.from({scheme:"inline-edit-widget",path:new Date().toString()+String(dg._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=ns(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(tV(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 Si(p,g);return{top:a.range.startLineNumber,left:C}}),this._text=ns(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const d=IC(a.text.split(`
58
+ `));return{text:d.text.join(`
59
+ `),shift:d.shift}}),this._originalModel=nd(()=>this._modelService.createModel("",null,dg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=nd(()=>this._modelService.createModel("",null,dg._createUniqueUri())).keepObserved(this._store),this._diff=ns(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=ns(this,r=>{const a=this._model.read(r);if(!a)return;const d=this._editor.getModel();if(!d)return;const u=IC(d.getValueInRange(a.range).split(`
60
+ `)).text.join(`
61
+ `),f=IC(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 xk.fromFn(async()=>{const p=await g.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},vn.None);if(!p.identical)return p.changes})}),this._register(Vp((r,a)=>{if(!this._model.read(r)||this._position.get()===null)return;const u=a.add(this._instantiationService.createInstance(by,this._editor,this._position,this._text.map(f=>f.text),this._text.map(f=>f.shift),this._diff));e.addOverlayWidget(u),a.add(ms(()=>e.removeOverlayWidget(u)))}))}},dg=Fu,Fu._modelId=0,Fu);_y=dg=zB([Cv(2,cn),Cv(3,Zw),Cv(4,Ho)],_y);var Lu;let by=(Lu=class extends Nt{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${my.id++}`,this.allowEditorOverflow=!1,this._nodes=xi("div.inlineEditSideBySide",void 0),this._scrollChanged=Gd("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(oa,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=Xa(this._previewEditor),this._editorObs=Xa(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(kc,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??Gg,kc.DEFAULT_CREATION_OPTIONS,null)),this._setText=ns(d=>{const u=this._text.read(d);u&&this._previewTextModel.setValue(u)}).recomputeInitiallyAndOnChange(this._store),this._decorations=ns(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 te(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:Kw}),E.modified.isEmpty||p.push({range:E.modified.toInclusiveRange(),options:vk}),E.modified.isEmpty||E.original.isEmpty)E.original.isEmpty||g.push({range:b(E.original.toInclusiveRange()),options:mk}),E.modified.isEmpty||p.push({range:E.modified.toInclusiveRange(),options:_k});else for(const y of E.innerChanges||[])E.original.contains(y.originalRange.startLineNumber)&&g.push({range:b(y.originalRange),options:y.originalRange.isEmpty()?bk:Gw}),E.modified.contains(y.modifiedRange.startLineNumber)&&p.push({range:y.modifiedRange,options:y.modifiedRange.isEmpty()?Ck:Ek});return{org:g,mod:p}}),this._originalDecorations=ns(this,d=>this._decorations.read(d).org),this._modifiedDecorations=ns(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(Ss(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(Ss(d=>{this._position.read(d),this._editor.layoutOverlayWidget(this)})),this._register(Ss(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 Si(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}}}},my=Lu,Lu.id=0,Lu);by=my=zB([Cv(5,cn)],by);var iV=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)}},ug,Fr;let To=(Fr=class extends Nt{static get(e){return e.getContribution(ug.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=ug.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=ug.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=br(this,void 0),this._currentWidget=nd(this._currentEdit,b=>{const E=this._currentEdit.read(b);if(!E)return;const y=E.range.endLineNumber,A=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 cp(y,[new pm(A,I,!1)]),R=E.range.startLineNumber===E.range.endLineNumber&&M.parts.length===1&&M.parts[0].lines.length===1,P=E.text==="";return!R&&!P?void 0:this.instantiationService.createInstance(gy,this.editor,{ghostText:Fl(M),minReservedLineCount:Fl(0),targetTextModel:Fl(this.editor.getModel()??void 0),range:Fl(E.range)})}),this._isAccepting=br(this,!1),this._enabled=Jo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Jo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const u=Gd("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(Ss(b=>{this._enabled.read(b)&&(u.read(b),!this._isAccepting.read(b)&&this.getInlineEdit(e,!0))}));const f=Jo(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(Ss(b=>{if(!this._enabled.read(b))return;const E=f.read(b);E&&this.checkCursorPosition(E)})),this._register(Ss(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=Gd("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(Ss(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=Gd("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(Ss(b=>{this._enabled.read(b)&&(p.read(b),this.getInlineEdit(e,!0))}));const C=this._register(UA());this._register(Ss(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 py(this.editor,this._currentWidget,this.instantiationService)),this._register(new _y(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(te.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 uo;const a=this._currentRequestCts.token,d=t?QS.Automatic:QS.Invoke;if(t&&await nV(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",[Fs.replace(te.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,Ws),this.freeEdit(e),dh(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=Si.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,Ws),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)}},ug=Fr,Fr.ID="editor.contrib.inlineEditController",Fr.inlineEditVisibleKey="inlineEditVisible",Fr.inlineEditVisibleContext=new Tn(Fr.inlineEditVisibleKey,!1),Fr.cursorAtInlineEditKey="cursorAtInlineEdit",Fr.cursorAtInlineEditContext=new Tn(Fr.cursorAtInlineEditKey,!1),Fr);To=ug=iV([Ad(1,cn),Ad(2,Gn),Ad(3,Di),Ad(4,ro),Ad(5,bs),Ad(6,Zw),Ad(7,Ho)],To);function nV(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 sV=class extends xt{constructor(){super({id:Kz,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:Ue.and(G.writable,To.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:Ue.and(G.writable,To.inlineEditVisibleContext,To.cursorAtInlineEditContext)}],menuOpts:[{menuId:li.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=To.get(t);await(i==null?void 0:i.accept())}};class oV extends xt{constructor(){const e=Ue.and(G.writable,Ue.not(To.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=To.get(t);i==null||i.trigger()}}class rV extends xt{constructor(){const e=Ue.and(G.writable,To.inlineEditVisibleContext,Ue.not(To.cursorAtInlineEditKey));super({id:Xz,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:li.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=To.get(t);i==null||i.jumpToCurrent()}}class aV extends xt{constructor(){const e=Ue.and(G.writable,To.cursorAtInlineEditContext);super({id:Yz,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:li.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=To.get(t);i==null||i.jumpBack()}}class lV extends xt{constructor(){const e=Ue.and(G.writable,To.inlineEditVisibleContext);super({id:Zz,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:li.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=To.get(t);await(i==null?void 0:i.clear())}}Te(sV);Te(lV);Te(rV);Te(aV);Te(oV);En(To.ID,To,3);const cV="editor.action.inlineEdits.accept",dV="editor.action.inlineEdits.showPrevious",uV="editor.action.inlineEdits.showNext",b0=new Tn("inlineEditsVisible",!1,S("inlineEditsVisible","Whether an inline edit is visible")),hV=new Tn("inlineEditsIsPinned",!1,S("isPinned","Whether an inline edit is visible")),ES=class ES extends Nt{constructor(e){super(),this._editor=e,this._editorObs=Xa(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=Al({owner:this,equalsFn:yk},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=fV(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=CA((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=Xr("div.editorPlaceholder");i.add(Ss(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(Ss(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(Ss(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:Fl(0),position:Fl(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};ES.ID="editor.contrib.placeholderText";let xp=ES;function fV(o,e){return J_(o,(t,i)=>i===!0?!0:e(t))}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},pV=function(o,e){return function(t,i){e(t,i,o)}};class xV{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let Cy=class extends Nt{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=Xa(this._editor),this._elements=Xr("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[Xr("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[Xr("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),Xr("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),Xr("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),Ph("svg",{style:{overflow:"visible",pointerEvents:"none"}},[Ph("defs",[Ph("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[Ph("stop",{offset:"0%",class:"gradient-stop"}),Ph("stop",{offset:"100%",class:"gradient-stop"})])]),Ph("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(kc,"",Gg,kc.DEFAULT_CREATION_OPTIONS,null)),this._setText=ns(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(kc,"",Gg,kc.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(oa,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:N7},{contributions:O7.getSomeEditorContributions([Jr.ID,xp.ID,h0.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(oa,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=Xa(this._previewEditor),this._decorations=ns(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:Kw}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:vk}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||d.push({range:g.original.toInclusiveRange(),options:mk}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:_k});else for(const p of g.innerChanges||[])g.original.contains(p.originalRange.startLineNumber)&&d.push({range:p.originalRange,options:p.originalRange.isEmpty()?bk:Gw}),g.modified.contains(p.modifiedRange.startLineNumber)&&u.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?Ck:Ek});return u}),this._layout1=ns(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=ns(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 ff(f,g),b=new ff(f,p),E=p-g,y=50,A=this._editor.getOption(67)*a.newLines.length,I=E-A,M=new ff(f+y,g+I/2),R=new ff(f+y,p-I/2);return{topCode:C,bottomCode:b,codeHeight:E,topEdit:M,bottomEdit:R,editHeight:A}});const s=ns(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(H7(this._elements.root,{display:ns(this,r=>s.read(r)?"block":"none")})),this._register(W7(this._editor.getDomNode(),this._elements.root)),this._register(Xa(e).createOverlayWidget({domNode:this._elements.root,position:Fl(null),allowEditorOverflow:!1,minContentWidthInPx:ns(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(Ss(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 mV().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 A=this._previewEditorObs.contentWidth.read(r);this._previewEditor.layout({height:p,width:A})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(_V(vV(this._userPrompt,r=>r??"",r=>r),Xa(this._promptEditor).value)),this._register(Ss(r=>{const a=Xa(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};Cy=gV([pV(3,cn)],Cy);function vV(o,e,t){return wk(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class ff{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new ff(this.x+e,this.y)}}class mV{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 _V(o,e){const t=new Tt;return t.add(Ss(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(Ss(i=>{const n=e.read(i);o.set(n,void 0)})),t}var bV=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},PC=function(o,e){return function(t,i){e(t,i,o)}},hg,Iu;let Ey=(Iu=class extends Nt{static _createUniqueUri(){return rs.from({scheme:"inline-edits",path:new Date().toString()+String(hg._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=br(this,void 0),this._isActive=br(this,!1),this._originalModel=nd(()=>this._modelService.createModel("",null,hg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=nd(()=>this._modelService.createModel("",null,hg._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new EV(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(d=>!!d),this.userPrompt=br(this,void 0),this.inlineEdit=ns(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=ns(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 A=((I=y[0].match(/^\s*/))==null?void 0:I[0])??"";return y.map(M=>M.replace(new RegExp("^"+A),""))}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 xk.fromFn(async()=>{const y=await E.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},vn.None);if(!y.identical)return new xV(z7.fromRangeInclusive(f),p(g),y.changes)})}),this._fetchStore=this._register(new Tt),this._inlineEditsFetchResult=i1(this,void 0),this._inlineEdits=Al({owner:this,equalsFn:yk},d=>{var u;return((u=this._inlineEditsFetchResult.read(d))==null?void 0:u.completions.map(f=>new CV(f)))??[]}),this._fetchInlineEditsPromise=ek({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:Ml.Automatic}),handleChange:(d,u)=>(d.didChange(this._forceUpdateExplicitlySignal)&&(u.inlineCompletionTriggerKind=Ml.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=s1(this._fetchStore);await rb(200,C);const b=await yB(this.languageFeaturesService.inlineCompletionsProvider,g,this.textModel,p,C);C.isCancellationRequested||this._inlineEditsFetchResult.set(b,void 0)}),this._filteredInlineEditItems=Al({owner:this,equalsFn:n1()},d=>this._inlineEdits.read(d)),this.selectedInlineCompletionIndex=ns(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=ns(this,d=>{const u=this._filteredInlineEditItems.read(d),f=this.selectedInlineCompletionIndex.read(d);return u[f]}),this._register(tk(this._fetchInlineEditsPromise))}async triggerExplicitly(e){Rv(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){Rv(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 e0;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},hg=Iu,Iu._modelId=0,Iu);Ey=hg=bV([PC(4,Di),PC(5,Zw),PC(6,Ho)],Ey);class CV{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class EV extends Nt{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=br(this,[]),this.range=ns(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(ms(()=>{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 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},X0=function(o,e){return function(t,i){e(t,i,o)}},yy,Pu;let Gl=(Pu=class extends Nt{static get(e){return e.getContribution(yy.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=V7("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Xa(this.editor),this._selection=ns(this,a=>this._editorObs.cursorSelection.read(a)??new Zi(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=nd(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(o1(Ey,a),d,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=J_(this,(a,d)=>{var u;return d||((u=this.model.read(a))==null?void 0:u.inlineEdit.read(a))!==void 0}),this._widget=nd(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(o1(Cy,a),this.editor,this.model.map((d,u)=>d==null?void 0:d.inlineEdit.read(u)),wV(d=>{var u;return((u=this.model.read(d))==null?void 0:u.userPrompt)??br("empty","")}))}),this._register(JS(b0,this._contextKeyService,a=>{var d;return!!((d=this.model.read(a))!=null&&d.inlineEdit.read(a))})),this._register(JS(hV,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)}},yy=Pu,Pu.ID="editor.contrib.inlineEditsController",Pu);Gl=yy=yV([X0(1,cn),X0(2,Gn),X0(3,Tr),X0(4,Di),X0(5,bs)],Gl);function wV(o){return wk(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function cx(o){return{label:o.value,alias:o.original}}const L_=class L_ extends xt{constructor(){super({id:L_.ID,...cx(Ei("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:Ue.and(G.writable,b0),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Gl.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};L_.ID=uV;let wy=L_;const I_=class I_ extends xt{constructor(){super({id:I_.ID,...cx(Ei("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:Ue.and(G.writable,b0),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Gl.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};I_.ID=dV;let Sy=I_;class SV extends xt{constructor(){super({id:"editor.action.inlineEdits.trigger",...cx(Ei("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:G.writable})}async run(e,t){const i=Gl.get(t);await uk(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class DV extends xt{constructor(){super({id:cV,...cx(Ei("action.inlineEdits.accept","Accept Inline Edit")),precondition:b0,menuOpts:{menuId:li.InlineEditsActions,title:S("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:Ji.check},kbOpts:{primary:2058,weight:2e4,kbExpr:b0}})}async run(e,t){var n;t instanceof oa&&(t=t.getParentEditor());const i=Gl.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const P_=class P_ extends xt{constructor(){super({id:P_.ID,...cx(Ei("action.inlineEdits.hide","Hide Inline Edit")),precondition:b0,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Gl.get(t);dh(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};P_.ID="editor.action.inlineEdits.hide";let Dy=P_;En(Gl.ID,Gl,3);Te(SV);Te(wy);Te(Sy);Te(DV);Te(Dy);const oh={Visible:new Tn("parameterHintsVisible",!1),MultipleSignatures:new Tn("parameterHintsMultipleSignatures",!1)};async function VB(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){Ws(a)}}ps.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Zn(rs.isUri(t)),Zn(Si.isIPosition(i)),Zn(typeof n=="string"||!n);const s=o.get(Di),r=await o.get(Fa).createModelReference(t);try{const a=await VB(s.signatureHelpProvider,r.object.textEditorModel,Si.lift(i),{triggerKind:Mc.Invoke,isRetrigger:!1,triggerCharacter:n},vn.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var _c;(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})(_c||(_c={}));const T_=class T_ extends Nt{constructor(e,t,i=T_.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new xn),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=_c.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new Er),this.triggerChars=new Tv,this.retriggerChars=new Tv,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new id(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=_c.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(cs)}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 _c.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(AV);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 _c.Pending(co(d=>VB(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 _c.Active(d.value),this._lastSignatureHelpResult.value=d,this._onChangedHints.fire(this.state.hints),!0)}catch(d){return e===this.triggerId&&(this.state=_c.Default),cs(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:Mc.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:Mc.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Mc.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};T_.DEFAULT_DELAY=120;let Ay=T_;function AV(o,e){switch(e.triggerKind){case Mc.Invoke:return e;case Mc.ContentChange:return o;case Mc.TriggerCharacter:default:return e}}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},qx=function(o,e){return function(t,i){e(t,i,o)}},ky;const cr=xi,BV=Rs("parameter-hints-next",Ji.chevronDown,S("parameterHintsNextIcon","Icon for show next parameter hint.")),FV=Rs("parameter-hints-previous",Ji.chevronUp,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Tu;let By=(Tu=class extends Nt{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Tt),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new D0({editor:e},s,n)),this.keyVisible=oh.Visible.bindTo(i),this.keyMultipleSignatures=oh.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=cr(".editor-widget.parameter-hints-widget"),t=di(e,cr(".phwrapper"));t.tabIndex=-1;const i=di(t,cr(".controls")),n=di(i,cr(".button"+Qn.asCSSSelector(FV))),s=di(i,cr(".overloads")),r=di(i,cr(".button"+Qn.asCSSSelector(BV)));this._register(qn(n,"click",p=>{Pv.stop(p),this.previous()})),this._register(qn(r,"click",p=>{Pv.stop(p),this.next()}));const a=cr(".body"),d=new ok(a,{alwaysConsumeMouseWheel:!0});this._register(d),t.appendChild(d.getDomNode());const u=di(a,cr(".signature")),f=di(a,cr(".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",Tw.fontFamily)};g(),this._register(Ys.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=di(this.domNodes.signature,cr(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const u=di(n,cr("span"));u.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const u=cr("span.documentation");if(typeof a.documentation=="string")u.textContent=a.documentation;else{const f=this.renderMarkdownDocs(a.documentation);u.appendChild(f.element)}di(this.domNodes.docs,cr("p",{},u))}if(i.documentation!==void 0)if(typeof i.documentation=="string")di(this.domNodes.docs,cr("p",{},i.documentation));else{const u=this.renderMarkdownDocs(i.documentation);di(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&&(na(S("hint","{0}, hint",u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new or,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"&&rf(t.documentation).length>0||t&&typeof t.documentation=="object"&&rf(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&rf(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&rf(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),di(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|^)${Vg(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 ky.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)}},ky=Tu,Tu.ID="editor.widget.parameterHintsWidget",Tu);By=ky=kV([qx(2,Gn),qx(3,Aa),qx(4,Ba),qx(5,ka)],By);vi("editorHoverWidget.highlightForeground",ck,S("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var LV=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)}},Fy,Mu;let C0=(Mu=class extends Nt{static get(e){return e.getContribution(Fy.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Ay(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 Dw(()=>this._register(t.createInstance(By,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)}},Fy=Mu,Mu.ID="editor.controller.parameterHints",Mu);C0=Fy=LV([VD(1,cn),VD(2,Di)],C0);class IV extends xt{constructor(){super({id:"editor.action.triggerParameterHints",label:S("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:G.hasSignatureHelpProvider,kbOpts:{kbExpr:G.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=C0.get(t);i==null||i.trigger({triggerKind:Mc.Invoke})}}En(C0.ID,C0,2);Te(IV);const G9=175,K9=Zo.bindToContribution(C0.get);Bi(new K9({id:"closeParameterHints",precondition:oh.Visible,handler:o=>o.cancel(),kbOpts:{weight:G9,kbExpr:G.focus,primary:9,secondary:[1033]}}));Bi(new K9({id:"showPrevParameterHint",precondition:Ue.and(oh.Visible,oh.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:G9,kbExpr:G.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Bi(new K9({id:"showNextParameterHint",precondition:Ue.and(oh.Visible,oh.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:G9,kbExpr:G.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var PV=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},TV=function(o,e){return function(t,i){e(t,i,o)}};class MV{constructor(e){this.instantiationService=e}init(...e){}}function RV(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=Vp((n,s)=>{const r=o1(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function NV(o){return j7()?RV(o,Ly):o()}let Ly=class extends MV{constructor(e,t){super(t),this.init(e)}};Ly=PV([TV(1,cn)],Ly);En(xp.ID,NV(()=>xp),0);vi("editor.placeholder.foreground",$7,S("placeholderForeground","Foreground color of the placeholder text in the editor."));var OV=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)}};const M0=new Tn("renameInputVisible",!1,S("renameInputVisible","Whether the rename input widget is visible"));new Tn("renameInputFocused",!1,S("renameInputFocused","Whether the rename input widget is focused"));let Iy=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 Tt,this._visibleContextKey=M0.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new or,this._inputWithButton=new HV,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 Z9(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(U7),i=e.getColor(q7);this._domNode.style.backgroundColor=String(e.getColor(rk)??""),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(G7)??"");const n=e.getColor(K7);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(e8)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(e8)??""),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;Zn(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=jp(this.getDomNode().ownerDocument.body),t=Uo(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}=vp.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;Zn(this._renameCandidateListView),Zn(this._nPxAvailableAbove!==void 0),Zn(this._nPxAvailableBelow!==void 0);const t=sf(this._inputWithButton.domNode),i=sf(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:jr(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 Tt;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(qn(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),d.add(qn(this._inputWithButton.button,Ds.KEY_DOWN,f=>{const g=new Xw(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 Si(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(ms(()=>{this._renameCts=void 0,s.dispose(!0)})),d.add(ms(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),d.add(ms(()=>this._candidates.clear()));const u=new K_;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"),Zn(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),Zn(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new uo;const i=t?r1.Invoke:r1.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){Zn(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!te.isEmpty(i)&&!te.spansMultipleLines(i)&&te.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 Rp(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"&&nv(u.value)?u.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=uA(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)}};Iy=OV([Gx(2,ra),Gx(3,Gs),Gx(4,Gn),Gx(5,uh)],Iy);class Z9{constructor(e,t){this._disposables=new Tt,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=Z9._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(dk({listInactiveFocusForeground:ak,listInactiveFocusBackground:lk}))}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`,Zf(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}=vp.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 vp(r,i)}renderElement(r,a,d){d.populate(r)}disposeTemplate(r){r.dispose()}};return new Fw("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class HV{constructor(){this._onDidInputChange=new xn,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Tt}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=Z7().setupManagedHover(sb("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(qn(this.input,Ds.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(qn(this.input,Ds.KEY_DOWN,e=>{const t=new Xw(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(qn(this.input,Ds.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(qn(this.input,Ds.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(qn(this.input,Ds.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Zn(this._inputNode),this._inputNode}get button(){return Zn(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=a1(Ji.sparkle)),sl(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=a1(Ji.primitiveSquare)),sl(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 Og=class Og{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=`${Og._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=a1(Ji.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),YA(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(X7.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+Og._PADDING*2}}dispose(){}};Og._PADDING=2;let vp=Og;var WV=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},pc=function(o,e){return function(t,i){e(t,i,o)}},Py;class X9{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 te(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
76
+ `):void 0}:{range:te.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 zV(o,e,t,i){const n=new X9(e,t,o),s=await n.resolveRenameLocation(vn.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,vn.None)}var Ru;let ld=(Ru=class{static get(e){return e.getContribution(Py.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 Tt,this._cts=new uo,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(Iy,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 uo,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new X9(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new Gf(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 Z_?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"||tv(y))&&((b=ir.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=ir.get(this.editor))==null||E.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new Gf(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,A)=>{let I=u.slice();return y===r1.Automatic&&(I=I.filter(([M,R])=>R)),I.map(([M])=>M.provideNewSymbolNames(a,s.range,y,A))};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=Rp(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(te.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(A=>{e("edits applied"),A.ariaSummary&&na(S("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,p.newName,A.ariaSummary))}).catch(A=>{e(`error when applying edits ${JSON.stringify(A,null," ")}`),this._notificationService.error(S("rename.failedApply","Rename failed to apply edits")),this._logService.error(A)})},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)}},Py=Ru,Ru.ID="editor.contrib.renameController",Ru);ld=Py=WV([pc(1,cn),pc(2,Oo),pc(3,q_),pc(4,Op),pc(5,uh),pc(6,Y7),pc(7,Di),pc(8,ka)],ld);class VV extends xt{constructor(){super({id:"editor.action.rename",label:S("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:Ue.and(G.writable,G.hasRenameProvider),kbOpts:{kbExpr:G.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(zs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return rs.isUri(n)&&Si.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))))},cs):super.runCommand(e,t)}run(e,t){const i=e.get(uh),n=ld.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}En(ld.ID,ld,4);Te(VV);const Y9=Zo.bindToContribution(ld.get);Bi(new Y9({id:"acceptRenameInput",precondition:M0,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Ue.and(G.focus,Ue.not("isComposing")),primary:3}}));Bi(new Y9({id:"acceptRenameInputWithPreview",precondition:Ue.and(M0,Ue.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Ue.and(G.focus,Ue.not("isComposing")),primary:2051}}));Bi(new Y9({id:"cancelRenameInput",precondition:M0,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:G.focus,primary:9,secondary:[1033]}}));os(class extends Ko{constructor(){super({id:"focusNextRenameSuggestion",title:{...Ei("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:M0,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(zs).getFocusedCodeEditor();if(!t)return;const i=ld.get(t);i&&i.focusNextRenameSuggestion()}});os(class extends Ko{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Ei("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:M0,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(zs).getFocusedCodeEditor();if(!t)return;const i=ld.get(t);i&&i.focusPreviousRenameSuggestion()}});Xo("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Zn(typeof n=="string");const{renameProvider:s}=o.get(Di);return zV(s,e,t,n)});Xo("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Di),s=await new X9(e,t,i).resolveRenameLocation(vn.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});Da.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 jV=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},jD=function(o,e){return function(t,i){e(t,i,o)}},Vf;let Nm=(Vf=class extends Nt{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 Qs(()=>{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=>$V(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()}},Vf.ID="editor.sectionHeaderDetector",Vf);Nm=jV([jD(1,ao),jD(2,Jl)],Nm);function $V(o){return{range:o.range,options:Bn.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}En(Nm.ID,Nm,1);function UV(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 qV(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return Q7()||UV(e),J7.wrap(e)}function jB(o){const e=new Uint32Array(GV(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 qV(e)}function GV(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 Rb(o){return o&&!!o.data}function $B(o){return o&&Array.isArray(o.edits)}class KV{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function UB(o,e){return o.has(e)}function ZV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function qB(o,e,t,i,n){const s=ZV(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||!Rb(d)&&!$B(d))&&(d=null),new KV(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 XV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class YV{constructor(e,t){this.provider=e,this.tokens=t}}function QV(o,e){return o.has(e)}function GB(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function Q9(o,e,t,i){const n=GB(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(d){Ws(d),a=null}return(!a||!Rb(a))&&(a=null),new YV(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}ps.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Zn(t instanceof rs);const i=o.get(Ho).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Di),s=XV(n,i);return s?s[0].getLegend():o.get(ro).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});ps.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Zn(t instanceof rs);const i=o.get(Ho).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Di);if(!UB(n,i))return o.get(ro).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await qB(n,i,null,null,vn.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!Rb(a))return;const d=jB({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),d});ps.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Zn(t instanceof rs);const n=o.get(Ho).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Di),r=GB(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!te.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 Q9(s,n,te.lift(i),vn.None);if(a)return a.provider.getLegend()});ps.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Zn(t instanceof rs),Zn(te.isIRange(i));const n=o.get(Ho).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Di),r=await Q9(s,n,te.lift(i),vn.None);if(!(!r||!r.tokens))return jB({id:0,type:"full",data:r.tokens.data})});const J9="editor.semanticHighlighting";function Ev(o,e,t){var n;const i=(n=t.getValue(J9,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var KB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Za=function(o,e){return function(t,i){e(t,i,o)}},mc;let Ty=class extends Nt{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=f=>{this._watchers[f.uri.toString()]=new My(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()];Ev(f,i,n)?g||a(f):g&&d(f,g)}};t.getModels().forEach(f=>{Ev(f,i,n)&&a(f)}),this._register(t.onModelAdded(f=>{Ev(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(J9)&&u()})),this._register(i.onDidColorThemeChange(u))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};Ty=KB([Za(0,Yw),Za(1,Ho),Za(2,ra),Za(3,bs),Za(4,Tr),Za(5,Di)],Ty);var Jc;let My=(Jc=class extends Nt{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:mc.REQUEST_MIN_DELAY,max:mc.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Qs(()=>this._fetchDocumentSemanticTokensNow(),mc.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=()=>{Io(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),Io(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!UB(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new uo,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=qB(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 or(!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&&(dd(d)||typeof d.message=="string"&&d.message.indexOf("busy")!==-1)||cs(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($B(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&&(mc._copy(d,f-b,u,g-b,b),g-=b),C.data&&(mc._copy(C.data,0,u,g-C.data.length,C.data.length),g-=C.data.length),f=C.start}f>0&&mc._copy(d,0,u,0,f),t={resultId:t.resultId,data:u}}}if(Rb(t)){this._currentDocumentResponse=new JV(e,t.resultId,t.data);const a=Sk(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()}},mc=Jc,Jc.REQUEST_MIN_DELAY=300,Jc.REQUEST_MAX_DELAY=2e3,Jc);My=mc=KB([Za(1,Yw),Za(2,ra),Za(3,Tr),Za(4,Di)],My);class JV{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}S0(Ty);var ej=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},Y0=function(o,e){return function(t,i){e(t,i,o)}},jf;let Om=(jf=class extends Nt{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 Qs(()=>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(J9)&&(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(!Ev(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!QV(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=co(r=>Promise.resolve(Q9(this._provider,e,t,r))),s=new or(!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,Sk(d,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},jf.ID="editor.contrib.viewportSemanticTokens",jf);Om=ej([Y0(1,Yw),Y0(2,ra),Y0(3,bs),Y0(4,Tr),Y0(5,Di)],Om);En(Om.ID,Om,1);class tj{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(t8(g)&&i8(f))break;f=g}for(d+=1;u<s.length;u++){const g=s.charCodeAt(u);if(i8(g)&&t8(f))break;if(g===95||g===45)break;f=g}d<u&&e.push({range:new te(i.lineNumber,r+d,i.lineNumber,r+u)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new te(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 te(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var ij=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nj=function(o,e){return function(t,i){e(t,i,o)}},Ry;class eS{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 eS(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var Nu;let mp=(Nu=class{static get(e){return e.getContribution(Ry.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 XB(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),vn.None).then(s=>{var r;if(!(!_r(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!al(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 eS(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=>Zi.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},Ry=Nu,Nu.ID="editor.contrib.smartSelectController",Nu);mp=Ry=ij([nj(1,Di)],mp);class ZB extends xt{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=mp.get(t);i&&await i.run(this._forward)}}class sj extends ZB{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:S("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}ps.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class oj extends ZB{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:S("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:li.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}En(mp.ID,mp,4);Te(sj);Te(oj);async function XB(o,e,t,i,n){const s=o.all(e).concat(new tj(i.selectSubwords));s.length===1&&s.unshift(new Em);const r=[],a=[];for(const d of s)r.push(Promise.resolve(d.provideSelectionRanges(e,t,n)).then(u=>{if(_r(u)&&u.length===t.length)for(let f=0;f<t.length;f++){a[f]||(a[f]=[]);for(const g of u[f])te.isIRange(g.range)&&te.containsPosition(g.range,t[f])&&a[f].push(te.lift(g.range))}},Ws));return await Promise.all(r),a.map(d=>{if(d.length===0)return[];d.sort((p,C)=>Si.isBefore(p.getStartPosition(),C.getStartPosition())?1:Si.isBefore(C.getStartPosition(),p.getStartPosition())||Si.isBefore(p.getEndPosition(),C.getEndPosition())?-1:Si.isBefore(C.getEndPosition(),p.getEndPosition())?1:0);const u=[];let f;for(const p of d)(!f||te.containsRange(p,f)&&!te.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 te(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 te(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})}ps.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Zn(rs.isUri(t));const n=o.get(Di).selectionRangeProvider,s=await o.get(Fa).createModelReference(t);try{return XB(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},vn.None)}finally{s.dispose()}});const rj=Object.freeze({View:Ei("view","View"),Help:Ei("help","Help"),Test:Ei("test","Test"),File:Ei("file","File"),Preferences:Ei("preferences","Preferences"),Developer:Ei({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class Fg{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&&al(this.startLineNumbers,e.startLineNumbers)&&al(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new Fg([],[],0)}}const $D=GA("stickyScrollViewLayer",{createHTML:o=>o}),TC="data-sticky-line-index",UD="data-sticky-is-line",aj="data-sticky-is-line-number",qD="data-sticky-is-folding-icon";class lj extends Nt{constructor(e){super(),this._editor=e,this._foldingIconStore=new Tt,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 oa),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(qn(this._lineNumbersDomNode,Ds.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(qn(this._lineNumbersDomNode,Ds.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 Si(t,1)).lineNumber,a=s.getViewLineRenderingData(r),d=this._editor.getOption(68);let u;try{u=Zg.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{u=[]}const f=new XA(!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 KA(2e3),p=ZA(f,g);let C;$D?C=$D.createHTML(g.build()):C=g.build();const b=document.createElement("span");b.setAttribute(TC,String(e)),b.setAttribute(UD,""),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(TC,String(e)),E.setAttribute(aj,""),E.className="sticky-line-number",E.style.lineHeight=`${this._lineHeight}px`;const y=n.contentLeft;E.style.width=`${y}px`;const A=document.createElement("span");d.renderType===1||d.renderType===3&&t%10===0?A.innerText=t.toString():d.renderType===2&&(A.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),A.className="sticky-line-number-inner",A.style.lineHeight=`${this._lineHeight}px`,A.style.width=`${n.lineNumbersWidth}px`,A.style.paddingLeft=`${n.lineNumbersLeft}px`,E.appendChild(A);const I=this._renderFoldingIconForLine(i,t);I&&E.appendChild(I.domNode),this._editor.applyFontInfo(b),this._editor.applyFontInfo(A),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 cj(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 dj(d,r,n.getEndLineNumber(s),this._lineHeight);return u.setVisible(this._isOnGlyphMargin?!0:d||i==="always"),u.domNode.setAttribute(qD,""),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=eL(t.characterMapping,e,0);return new Si(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,TC);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,UD)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,qD)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class cj{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 dj{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=Qn.asClassName(e?um:dm)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class Lg{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class Hm{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class YB{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var Nb=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_p=function(o,e){return function(t,i){e(t,i,o)}},Ig;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(Ig||(Ig={}));var Pc;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(Pc||(Pc={}));let Ny=class extends Nt{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new id(300)),this._updateOperation=this._register(new Tt),this._editor.getOption(116).defaultModel){case Ig.OUTLINE_MODEL:this._modelProviders.push(new Oy(this._editor,n));case Ig.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new Wy(this._editor,t,n));case Ig.INDENTATION_MODEL:this._modelProviders.push(new Hy(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 Pc.CANCELED:return this._updateOperation.clear(),null;case Pc.VALID:return t.stickyModel}}return null}).catch(t=>(cs(t),null))}};Ny=Nb([_p(2,cn),_p(3,Di)],Ny);class QB extends Nt{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,Pc.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=co(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?Pc.CANCELED:(this._stickyModel=this.createStickyModel(e,i),Pc.VALID):this._invalid()).then(void 0,i=>(cs(i),Pc.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let Oy=class extends QB{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return El.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 YB(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(Pl.first(e.children.values())instanceof _B){const a=Pl.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 Lg(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),f=new Lg(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 Hm(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 Lg(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Hm(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 AE?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};Oy=Nb([_p(1,Di)],Oy);class JB extends QB{constructor(e){super(e),this._foldingLimitReporter=new xB(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new YB(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new Hm(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 Hm(new Lg(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(d),i.push(d)}return n}}let Hy=class extends JB{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new H9(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};Hy=Nb([_p(1,ao)],Hy);let Wy=class extends JB{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=ad.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new W9(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}};Wy=Nb([_p(2,Di)],Wy);var uj=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},GD=function(o,e){return function(t,i){e(t,i,o)}};class hj{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let zy=class extends Nt{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new xn),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Tt),this._updateSoon=this._register(new Qs(()=>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(ms(()=>{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 Ny(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new uo,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(Nv(a,e.startLineNumber,(f,g)=>f-g)),u=this.updateIndex(Nv(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 hj(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}};zy=uj([GD(1,Di),GD(2,ao)],zy);var fj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$h=function(o,e){return function(t,i){e(t,i,o)}},Vy,Ou;let Kl=(Ou=class extends Nt{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 Tt,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 lj(this._editor),this._stickyLineCandidateProvider=new zy(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=Fg.Empty,this._onDidResize(),this._readConfiguration();const d=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(f=>{this._readConfigurationChange(f)})),this._register(qn(d,Ds.CONTEXT_MENU,async f=>{this._onContextMenu(qd(d),f)})),this._stickyScrollFocusedContextKey=G.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=G.stickyScrollVisible.bindTo(this._contextKeyService);const u=this._register(Kf(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(qn(d,Ds.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 Tt,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(te.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Tt),t=this._register(new Db(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 te(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(zl(n,Ds.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 Si(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 Si(u,1)}this._revealPosition(d)})),this._register(zl(n,Ds.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(qn(n,Ds.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 uo;e.add(ms(()=>f.dispose(!0)));let g;ox(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Si(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(ms(()=>{g.style.textDecoration="none"}))):g||(g=C,g.style.textDecoration="underline",e.add(ms(()=>{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(J5,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new tL(e,t);this._contextMenuService.showContextMenu({menuId:li.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;R9(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=ad.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=Fg.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 Lg(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,A=this._editor.getTopForLineNumber(p)-i,I=this._editor.getBottomForLineNumber(p)-i;if(b>A&&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 Fg(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},Vy=Ou,Ou.ID="store.contrib.stickyScrollController",Ou);Kl=Vy=fj([$h(1,E0),$h(2,Di),$h(3,cn),$h(4,ao),$h(5,Tr),$h(6,Gn)],Kl);class gj extends Ko{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Ei("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:S({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Ei("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:rj.View,toggled:{condition:Ue.equals("config.editor.stickyScroll.enabled",!0),title:S("stickyScroll","Sticky Scroll"),mnemonicTitle:S({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:li.CommandPalette},{id:li.MenubarAppearanceMenu,group:"4_editor",order:3},{id:li.StickyScrollContext}]})}async run(e){const t=e.get(bs),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const Ob=100;class pj extends Sa{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Ei("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:S({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:Ue.and(Ue.has("config.editor.stickyScroll.enabled"),G.stickyScrollVisible),menu:[{id:li.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Kl.get(t))==null||i.focus()}}class xj extends Sa{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Ei("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:G.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Ob,primary:18}})}runEditorCommand(e,t){var i;(i=Kl.get(t))==null||i.focusNext()}}class vj extends Sa{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Ei("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:G.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Ob,primary:16}})}runEditorCommand(e,t){var i;(i=Kl.get(t))==null||i.focusPrevious()}}class mj extends Sa{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Ei("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:G.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Ob,primary:3}})}runEditorCommand(e,t){var i;(i=Kl.get(t))==null||i.goToFocused()}}class _j extends Sa{constructor(){super({id:"editor.action.selectEditor",title:Ei("selectEditor.title","Select Editor"),precondition:G.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Ob,primary:9}})}runEditorCommand(e,t){var i;(i=Kl.get(t))==null||i.selectEditor()}}En(Kl.ID,Kl,1);os(gj);os(pj);os(vj);os(xj);os(mj);os(_j);var eF=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},fg=function(o,e){return function(t,i){e(t,i,o)}};class bj{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 jy=class extends iL{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=Pl.slice(t,i),s=Pl.slice(t,0,i);let r=5;for(const a of Pl.concat(n,s)){if(a.score===qg.Default)continue;const d=new te(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 bj(d,u,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve(vn.None)}return e}};jy=eF([fg(5,Pb)],jy);let $y=class extends Nt{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(hf.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(hf.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 te(t.lineNumber,1,t.lineNumber,t.column));if(!f&&((C=this._lastResult)!=null&&C.canBeReused(e,t.lineNumber,u))){const b=new ID(p,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=b,this._lastResult.acquire(),g=this._lastResult}else{const b=await z9(this._languageFeatureService.completionProvider,e,t,new dp(void 0,wm.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 yc(b.items,t.column,new ID(p,0),ym.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},E);g=new jy(e,t.lineNumber,u,y,b,this._suggestMemoryService)}return this._lastResult=g,g}handleItemDidShow(e,t){t.completion.resolve(vn.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(te.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}}};$y=eF([fg(0,Di),fg(1,y0),fg(2,Pb),fg(3,zs)],$y);S0($y);class Cj extends xt{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 or;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}Te(Cj);const M_=class M_ extends Ko{constructor(){super({id:M_.ID,title:Ei({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:Ei("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=!n8.getTabFocusMode();n8.setTabFocusMode(t),t?na(S("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):na(S("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};M_.ID="editor.action.toggleTabFocusMode";let Uy=M_;os(Uy);var Ej=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)}};let qy=class extends Nt{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=di(e,xi("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??sb("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new Jb(this.el,"click")),a=this._register(new Jb(this.el,"keypress")),d=Ys.chain(a.event,g=>g.map(p=>new Xw(p)).filter(p=>p.keyCode===3)),u=this._register(new Jb(this.el,nL.Tap)).event;this._register(gA.addTarget(this.el));const f=Ys.any(r.event,d,u);this._register(f(g=>{this.enabled&&(Pv.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)}};qy=Ej([KD(3,$p),KD(4,Aa)],qy);var tF=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 yj=26;let Gy=class extends Nt{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(Ky))}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,yj)}};Gy=tF([iF(1,cn)],Gy);let Ky=class extends Nt{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(D0,{}),this.element=xi("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=xi("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){sl(this.element)}show(e){sl(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=di(this.element,xi("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(xi(`div${Qn.asCSSSelector(e.icon)}`));const n=di(this.element,xi("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=di(this.element,xi("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(qy,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=di(this.element,xi("div.action-container"));this.actionBar=this._register(new Wg(s)),this.actionBar.push(this._register(new Qf("banner.close","Close Banner",Qn.asClassName(RA),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};Ky=tF([iF(0,cn)],Ky);var tS=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},Af=function(o,e){return function(t,i){e(t,i,o)}};const wj=Rs("extensions-warning-message",Ji.warning,S("warningIcon","Icon shown with a warning message in the extensions editor."));var $f;let bp=($f=class extends Nt{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 Ep};else if(s.ambiguousCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new rh};else if(s.invisibleCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Cp};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:wj,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(Gy,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=Sj(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"?sL:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Zy(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Dj(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},$f.ID="editor.contrib.unicodeHighlighter",$f);bp=tS([Af(1,Jl),Af(2,oL),Af(3,cn)],bp);function Sj(o,e){return{nonBasicASCII:e.nonBasicASCII===eC?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===eC?!o:e.includeComments,includeStrings:e.includeStrings===eC?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let Zy=class extends Nt{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 Qs(()=>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:Wm.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!Dk(t,e))return null;const i=t.getValueInRange(e.range);return{reason:sF(i,this._options),inComment:kk(t,e),inString:Ak(t,e)}}};Zy=tS([Af(3,Jl)],Zy);class Dj extends Nt{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 Qs(()=>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=Bk.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:Wm.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 Dk(t,e)?{reason:sF(i,this._options),inComment:kk(t,e),inString:Ak(t,e)}:null}}const nF=S("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let Xy=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(bp.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=MC(g);let C;switch(u.reason.kind){case 0:{QA(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,MC(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,MC(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:${zm.ID}?${encodeURIComponent(JSON.stringify(b))}`,A=new Fo("",!0).appendMarkdown(C).appendText(" ").appendLink(y,E,nF);s.push(new Qr(this,d.range,[A],!1,a++))}return s}renderHoverParts(e,t){return tR(e,t,this._editor,this._languageService,this._openerService)}};Xy=tS([Af(1,Ba),Af(2,Aa)],Xy);function Yy(o){return`U+${o.toString(16).padStart(4,"0")}`}function MC(o){let e=`\`${Yy(o)}\``;return Fk.isInvisibleCharacter(o)||(e+=` "${`${Aj(o)}`}"`),e}function Aj(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function sF(o,e){return Bk.computeUnicodeHighlightReason(o,e)}const R_=class R_{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=Bn.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}};R_.instance=new R_;let Wm=R_;class kj extends xt{constructor(){super({id:rh.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(bs);n&&this.runAction(n)}async runAction(e){await e.updateValue(jl.includeComments,!1,2)}}class Bj extends xt{constructor(){super({id:rh.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(bs);n&&this.runAction(n)}async runAction(e){await e.updateValue(jl.includeStrings,!1,2)}}const N_=class N_ extends xt{constructor(){super({id:N_.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(bs);n&&this.runAction(n)}async runAction(e){await e.updateValue(jl.ambiguousCharacters,!1,2)}};N_.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let rh=N_;const O_=class O_ extends xt{constructor(){super({id:O_.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(bs);n&&this.runAction(n)}async runAction(e){await e.updateValue(jl.invisibleCharacters,!1,2)}};O_.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let Cp=O_;const H_=class H_ extends xt{constructor(){super({id:H_.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(bs);n&&this.runAction(n)}async runAction(e){await e.updateValue(jl.nonBasicASCII,!1,2)}};H_.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let Ep=H_;const W_=class W_ extends xt{constructor(){super({id:W_.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(Xl),f=e.get(bs);function g(b){return Fk.isInvisibleCharacter(b)?S("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",Yy(b)):S("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${Yy(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()=>{Lj(f,[b])}});if(p.push({label:g(n),run:()=>Fj(f,[n])}),a){const b=new kj;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(r){const b=new Bj;p.push({label:b.label,run:async()=>b.runAction(f)})}if(s.kind===0){const b=new rh;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===1){const b=new Cp;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===2){const b=new Ep;p.push({label:b.label,run:async()=>b.runAction(f)})}else Ij(s);const C=await u.pick(p,{title:nF});C&&await C.run()}};W_.ID="editor.action.unicodeHighlight.showExcludeOptions";let zm=W_;async function Fj(o,e){const t=o.getValue(jl.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(jl.allowedCharacters,i,2)}async function Lj(o,e){var n;const t=(n=o.inspect(jl.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(jl.allowedLocales,i,2)}function Ij(o){throw new Error(`Unexpected value: ${o}`)}Te(rh);Te(Cp);Te(Ep);Te(zm);En(bp.ID,bp,1);ph.register(Xy);var Pj=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},ZD=function(o,e){return function(t,i){e(t,i,o)}};const oF="ignoreUnusualLineTerminators";function Tj(o,e,t){o.setModelProperty(e.uri,oF,t)}function Mj(o,e){return o.getModelProperty(e.uri,oF)}var Uf;let Vm=(Uf=class extends Nt{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()||Mj(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`.",cl(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){Tj(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},Uf.ID="editor.contrib.unusualLineTerminatorsDetector",Uf);Vm=Pj([ZD(1,Qw),ZD(2,zs)],Vm);En(Vm.ID,Vm,1);var Rj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nj=function(o,e){return function(t,i){e(t,i,o)}};class XD{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,s8,!1).map(a=>({range:a.range,kind:Hv.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new td,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,s8,!1).map(f=>({range:f.range,kind:Hv.Text}));u&&s.set(a.uri,u)}return s}}let Qy=class extends Nt{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new XD)),this._register(e.multiDocumentHighlightProvider.register("*",new XD))}};Qy=Rj([Nj(0,Di)],Qy);var rF=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},yv=function(o,e){return function(t,i){e(t,i,o)}},Ps,Jy;const iS=new Tn("hasWordHighlights",!1);function aF(o,e,t,i){const n=o.ordered(e);return qw(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,Ws)),s=>s!=null).then(s=>{if(s){const r=new td;return r.set(e.uri,s),r}return new td})}function Oj(o,e,t,i,n,s){const r=o.ordered(e);return qw(r.map(a=>()=>{const d=s.filter(u=>aL(u)).filter(u=>lL(a.selector,u.uri,u.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,d,n)).then(void 0,Ws)}),a=>a!=null)}class lF{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=co(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new te(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 Hj extends lF{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return aF(this._providers,e,t.getPosition(),n).then(s=>s||new td)}}class Wj extends lF{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return Oj(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new td)}}function zj(o,e,t,i,n){return new Hj(e,t,n,o)}function Vj(o,e,t,i,n,s){return new Wj(e,t,n,o,s)}Xo("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Di),n=await aF(i.documentHighlightProvider,e,t,vn.None);return n==null?void 0:n.get(e.uri)});var ed;let ew=(ed=class{constructor(e,t,i,n,s){this.toUnhook=new Tt,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new td,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new id(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=iS.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=>{rL(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():Ps.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=Ps.query)==null?void 0:d.modelInfo)==null?void 0:u.model);break;case"multiFile":Ps.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,Ps.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(te.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);na(`${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);na(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=Ps.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),Ps.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()||Lv(n.getModel().uri,e==null?void 0:e.uri))continue;const s=Ps.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=cd.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)Ps.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==jo.vscodeNotebookCell&&((i=(t=Ps.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==jo.vscodeNotebookCell?(Ps.query=null,this._run()):(n=Ps.query)!=null&&n.modelInfo&&(Ps.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)!==jo.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===jo.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const d=a.getModel();d&&d!==e&&d.uri.scheme===jo.vscodeNotebookCell&&s.push(d)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!Lk(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){Ps.query=null,this._stopAll();return}const a=r.startColumn,d=r.endColumn,u=this._getWord();if(!u||u.startColumn>a||u.endColumn<d){Ps.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),Ps.query={modelInfo:{model:this.model,selection:r},word:u}}else if(!Ps.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(Lv(this.editor.getModel().uri,(n=Ps.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(!Ps.query||!Ps.query.modelInfo||Ps.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(Ps.query.modelInfo.model,Ps.query.modelInfo.selection,Ps.query.word,a),(s=this.workerRequest)==null||s.result.then(d=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=d||[],this._beginRenderDecorations())},cs)}}computeWithModel(e,t,i,n){return n.length?Vj(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):zj(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=cd.get(s);if(!r)continue;const a=[],d=(t=s.getModel())==null?void 0:t.uri;if(d&&this.workerRequestValue.has(d)){const u=Ps.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)}),Ps.storedDecorationIDs=Ps.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()}},Ps=ed,ed.storedDecorationIDs=new td,ed.query=null,ed);ew=Ps=rF([yv(4,zs)],ew);var Hu;let cd=(Hu=class extends Nt{static get(e){return e.getContribution(Jy.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new ew(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()}},Jy=Hu,Hu.ID="editor.contrib.wordHighlighter",Hu);cd=Jy=rF([yv(1,Gn),yv(2,Di),yv(3,zs)],cd);class cF extends xt{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=cd.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class jj extends cF{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:iS,kbOpts:{kbExpr:G.editorTextFocus,primary:65,weight:100}})}}class $j extends cF{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:iS,kbOpts:{kbExpr:G.editorTextFocus,primary:1089,weight:100}})}}class Uj extends xt{constructor(){super({id:"editor.action.wordHighlight.trigger",label:S("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:G.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=cd.get(t);n&&n.restoreViewState(!0)}}En(cd.ID,cd,0);Te(jj);Te($j);Te(Uj);S0(Qy);class Hb extends Zo{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=hh(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,d=r.map(u=>{const f=new Si(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=>cL.fromModelSelection(u))),d.length===1){const u=new Si(d[0].positionLineNumber,d[0].positionColumn);t.revealPosition(u,0)}}_moveTo(e,t,i){return i?new Zi(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new Zi(t.lineNumber,t.column,t.lineNumber,t.column)}}class fd extends Hb{_move(e,t,i,n,s){return Zp.moveWordLeft(e,t,i,n,s)}}class gd extends Hb{_move(e,t,i,n,s){return Zp.moveWordRight(e,t,i,n)}}class qj extends fd{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class Gj extends fd{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class Kj extends fd{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Ue.and(G.textInputFocus,(e=Ue.and(lb,cb))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class Zj extends fd{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class Xj extends fd{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class Yj extends fd{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Ue.and(G.textInputFocus,(e=Ue.and(lb,cb))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class Qj extends fd{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(hh(db.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Jj extends fd{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(hh(db.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class e$ extends gd{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class t$ extends gd{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Ue.and(G.textInputFocus,(e=Ue.and(lb,cb))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class i$ extends gd{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class n$ extends gd{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class s$ extends gd{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Ue.and(G.textInputFocus,(e=Ue.and(lb,cb))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class o$ extends gd{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class r$ extends gd{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(hh(db.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class a$ extends gd{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(hh(db.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Wb extends Zo{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(ao);if(!t.hasModel())return;const s=hh(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 Mp(b,"")});t.pushUndoStop(),t.executeCommands(this.id,p),t.pushUndoStop()}}class nS extends Wb{_delete(e,t){const i=Zp.deleteWordLeft(e,t);return i||new te(1,1,1,1)}}class sS extends Wb{_delete(e,t){const i=Zp.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new te(n,s,n,s)}}class l$ extends nS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:G.writable})}}class c$ extends nS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:G.writable})}}class d$ extends nS{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:G.writable,kbOpts:{kbExpr:G.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class u$ extends sS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:G.writable})}}class h$ extends sS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:G.writable})}}class f$ extends sS{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:G.writable,kbOpts:{kbExpr:G.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class g$ extends xt{constructor(){super({id:"deleteInsideWord",precondition:G.writable,label:S("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=hh(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(d=>{const u=Zp.deleteInsideWord(n,s,d);return new Mp(u,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}Bi(new qj);Bi(new Gj);Bi(new Kj);Bi(new Zj);Bi(new Xj);Bi(new Yj);Bi(new e$);Bi(new t$);Bi(new i$);Bi(new n$);Bi(new s$);Bi(new o$);Bi(new Qj);Bi(new Jj);Bi(new r$);Bi(new a$);Bi(new l$);Bi(new c$);Bi(new d$);Bi(new u$);Bi(new h$);Bi(new f$);Te(g$);class p$ extends Wb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:G.writable,kbOpts:{kbExpr:G.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=ub.deleteWordPartLeft(e);return i||new te(1,1,1,1)}}class x$ extends Wb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:G.writable,kbOpts:{kbExpr:G.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=ub.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new te(n,s,n,s)}}class dF extends Hb{_move(e,t,i,n,s){return ub.moveWordPartLeft(e,t,i,s)}}class v$ extends dF{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:G.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}ps.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class m$ extends dF{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:G.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}ps.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class uF extends Hb{_move(e,t,i,n,s){return ub.moveWordPartRight(e,t,i)}}class _$ extends uF{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:G.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class b$ extends uF{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:G.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}Bi(new p$);Bi(new x$);Bi(new v$);Bi(new m$);Bi(new _$);Bi(new b$);const yS=class yS extends Nt{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=ir.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new Fo(S("editor.simple.readonly","Cannot edit in read-only input")):t=new Fo(S("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};yS.ID="editor.contrib.readOnlyMessageController";let jm=yS;En(jm.ID,jm,2);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},YD=function(o,e){return function(t,i){e(t,i,o)}};let tw=class extends Nt{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=br(this,void 0);const n=Gd("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=Gd("_textModel.onDidChangeContent",Ys.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(Vp(async(r,a)=>{n.read(r),s.read(r);const d=a.add(new hL),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(uL(Up(s=>s.range.endLineNumber-s.range.startLineNumber,tb))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};tw=C$([YD(1,Di),YD(2,lx)],tw);dL.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(tw,o));const wS=class wS extends Nt{constructor(e){super(),this.editor=e,this.widget=null,e1&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new iw(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};wS.ID="editor.contrib.iPadShowKeyboard";let $m=wS;const z_=class z_ extends Nt{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(qn(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(qn(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return z_.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};z_.ID="editor.contrib.ShowKeyboardWidget";let iw=z_;En($m.ID,$m,3);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},QD=function(o,e){return function(t,i){e(t,i,o)}},nw,Wu;let yp=(Wu=class extends Nt{static get(e){return e.getContribution(nw.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(nb.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 sw(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},nw=Wu,Wu.ID="editor.contrib.inspectTokens",Wu);yp=nw=E$([QD(1,Ik),QD(2,Ba)],yp);class y$ extends xt{constructor(){super({id:"editor.action.inspectTokens",label:xL.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=yp.get(t);i==null||i.launch()}}function w$(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 S$(o,e){const t=nb.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>fL,tokenize:(n,s,r)=>pL(e,r),tokenizeEncoded:(n,s,r)=>gL(i,r)}}const V_=class V_ extends Nt{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=S$(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 V_._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)}Iv(this._domNode,xi("h2.tm-token",void 0,w$(r),xi("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),di(this._domNode,xi("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;di(this._domNode,xi("table.tm-metadata-table",void 0,xi("tbody",void 0,xi("tr",void 0,xi("td.tm-metadata-key",void 0,"language"),xi("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),xi("tr",void 0,xi("td.tm-metadata-key",void 0,"token type"),xi("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),xi("tr",void 0,xi("td.tm-metadata-key",void 0,"font style"),xi("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),xi("tr",void 0,xi("td.tm-metadata-key",void 0,"foreground"),xi("td.tm-metadata-value",void 0,`${a?kn.Format.CSS.formatHex(a.foreground):"-?-"}`)),xi("tr",void 0,xi("td.tm-metadata-key",void 0,"background"),xi("td.tm-metadata-value",void 0,`${a?kn.Format.CSS.formatHex(a.background):"-?-"}`))))),di(this._domNode,xi("hr.tokens-inspect-separator")),i<t.tokens1.length&&di(this._domNode,xi("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=nb.getColorMap(),i=$0.getLanguageId(e),n=$0.getTokenType(e),s=$0.getFontStyle(e),r=$0.getForeground(e),a=$0.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]}}};V_._ID="editor.contrib.inspectTokensWidget";let sw=V_;En(yp.ID,yp,4);Te(y$);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},JD=function(o,e){return function(t,i){e(t,i,o)}},gg,zu;let ow=(zu=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=Da.as(Xp.Quickaccess)}provide(e){const t=new Tt;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(gg.PREFIX.length));n&&n.prefix&&n.prefix!==gg.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==gg.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}})}},gg=zu,zu.PREFIX="?",zu);ow=gg=D$([JD(0,Xl),JD(1,Gs)],ow);Da.as(Xp.Quickaccess).registerQuickAccessProvider({ctor:ow,prefix:"",helpEntries:[{description:vL.helpQuickAccessActionLabel}]});class hF{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new Tt;e.canAcceptInBackground=!!((r=this.options)!=null&&r.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new Er);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 Tt,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=Pk(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(Tk(t.onCancellationRequested)(()=>{var u;return(u=r.restoreViewState)==null?void 0:u.call(r)}))}n.add(ms(()=>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&&Zf(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return Lk(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:Ks(HA),position:nl.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 j_=class j_ extends hF{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,Nt.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Tt;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(j_.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=Pk(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(ms(()=>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}};j_.PREFIX=":";let rw=j_;var A$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},k$=function(o,e){return function(t,i){e(t,i,o)}};let wp=class extends rw{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Ys.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};wp=A$([k$(0,zs)],wp);var Vu;let fF=(Vu=class extends xt{constructor(){super({id:Vu.ID,label:Mk.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:G.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Xl).quickAccess.show(wp.PREFIX)}},Vu.ID="editor.action.gotoLine",Vu);Te(fF);Da.as(Xp.Quickaccess).registerQuickAccessProvider({ctor:wp,prefix:wp.PREFIX,helpEntries:[{description:Mk.gotoLineActionLabel,commandId:fF.ID}]});const gF=[void 0,[]];function RC(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?B$(o,n.values,t,i):pF(o,e,t,i)}function B$(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,d]=pF(o,r,t,i);if(typeof a!="number")return gF;n+=a,s.push(...d)}return[n,F$(s)]}function pF(o,e,t,i){const n=sk(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],ib(n)]:gF}function F$(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!L$(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 L$(o,e){return!(o.end<e.start||e.end<o.start)}function e2(o){return o.startsWith('"')&&o.endsWith('"')}const xF=" ";function aw(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=t2(o),s=t.indexOf(l1)>=0,r=e2(o);let a;const d=o.split(xF);if(d.length>1)for(const u of d){const f=e2(u),{pathNormalized:g,normalized:p,normalizedLowercase:C}=t2(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 t2(o){let e;G_?e=o.replace(/\//g,l1):e=o.replace(/\\/g,l1);const t=mL(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function i2(o){return Array.isArray(o)?aw(o.map(e=>e.original).join(xF)):aw(o.original)}var I$=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},n2=function(o,e){return function(t,i){e(t,i,o)}},wv,_a;let tu=(_a=class extends hF{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.")),Nt.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):Nt.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Tt;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 K_,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(ms(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var g;const r=e.editor,a=new Tt;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 uo(n),i.busy=!0;try{const C=aw(i.value.substr(wv.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=EL(b,y=>!!(y.type!=="separator"&&y.range&&te.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,A;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(wv.SCOPE_PREFIX)===0,d=a?1:0;let u,f;t.values&&t.values.length>1?(u=i2(t.values[0]),f=i2(t.values.slice(1))):u=t;let g;const p=(A=(y=this.options)==null?void 0:y.openSideBySideDirection)==null?void 0:A.call(y);p&&(g=[{iconClass:p==="right"?Qn.asClassName(Ji.splitHorizontal):Qn.asClassName(Ji.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=_L(M.name),P=`$(${bL.toIcon(M.kind).id}) ${R}`,V=P.length-R.length;let U=M.containerName;i!=null&&i.extraContainerLabel&&(U?U=`${i.extraContainerLabel} • ${U}`:U=i.extraContainerLabel);let J,re,ae,ie;if(t.original.length>d){let Se=!1;if(u!==t&&([J,re]=RC(P,{...t,values:void 0},d,V),typeof J=="number"&&(Se=!0)),typeof J!="number"&&([J,re]=RC(P,u,d,V),typeof J!="number"))continue;if(!Se&&f){if(U&&f.original.length>0&&([ae,ie]=RC(U,f)),typeof ae!="number")continue;typeof J=="number"&&(J+=ae)}}const ve=M.tags&&M.tags.indexOf(1)>=0;C.push({index:I,kind:M.kind,score:J,label:P,ariaLabel:CL(M.name,M.kind),description:U,highlights:ve?void 0:{label:re,description:ie},range:{selection:te.collapseToStart(M.selectionRange),decoration:M.range},uri:s.uri,symbolName:R,strikethrough:ve,buttons:g})}const b=C.sort((I,M)=>a?this.compareByKindAndScore(I,M):this.compareByScore(I,M));let E=[];if(a){let P=function(){M&&typeof I=="number"&&R>0&&(M.label=zw(OC[I]||NC,R))},I,M,R=0;for(const V of b)I!==V.kind?(P(),I=V.kind,R=1,M={type:"separator"},E.push(M)):R++,E.push(V);P()}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=OC[e.kind]||NC,n=OC[t.kind]||NC,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()}},wv=_a,_a.PREFIX="@",_a.SCOPE_PREFIX=":",_a.PREFIX_BY_CATEGORY=`${_a.PREFIX}${_a.SCOPE_PREFIX}`,_a);tu=wv=I$([n2(0,Di),n2(1,lx)],tu);const NC=S("property","properties ({0})"),OC={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 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},HC=function(o,e){return function(t,i){e(t,i,o)}};let lw=class extends tu{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Ys.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};lw=P$([HC(0,zs),HC(1,Di),HC(2,lx)],lw);const $_=class $_ extends xt{constructor(){super({id:$_.ID,label:c1.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:G.hasDocumentSymbolProvider,kbOpts:{kbExpr:G.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Xl).quickAccess.show(tu.PREFIX,{itemActivation:yL.NONE})}};$_.ID="editor.action.quickOutline";let Um=$_;Te(Um);Da.as(Xp.Quickaccess).registerQuickAccessProvider({ctor:lw,prefix:tu.PREFIX,helpEntries:[{description:c1.quickOutlineActionLabel,prefix:tu.PREFIX,commandId:Um.ID},{description:c1.quickOutlineByCategoryActionLabel,prefix:tu.PREFIX_BY_CATEGORY}]});function T$(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class Pg{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 T$(Pg.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=Pg.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=Pg.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 M$(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 gf;(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"})(gf||(gf={}));function WC(o){return Array.isArray(o.items)}function s2(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class R$ extends Nt{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var u;const n=new Tt;e.canAcceptInBackground=!!((u=this.options)!=null&&u.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new Er),a=async()=>{var y;const f=r.value=new Tt;s==null||s.dispose(!0),e.busy=!1,s=new uo(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=(A,I)=>{var P;let M,R;if(WC(A)?(M=A.items,R=A.active):M=A,M.length===0){if(I)return!1;(p.length>0||e.hideInput)&&((P=this.options)!=null&&P.noResultsPick)&&(wL(this.options.noResultsPick)?M=[this.options.noResultsPick(p)]:M=[this.options.noResultsPick])}return e.items=M,R&&(e.activeItems=[R]),!0},E=async A=>{let I=!1,M=!1;await Promise.all([(async()=>{typeof A.mergeDelay=="number"&&(await rb(A.mergeDelay),g.isCancellationRequested)||M||(I=b(A.picks,!0))})(),(async()=>{e.busy=!0;try{const R=await A.additionalPicks;if(g.isCancellationRequested)return;let P,V;WC(A.picks)?(P=A.picks.items,V=A.picks.active):P=A.picks;let U,J;if(WC(R)?(U=R.items,J=R.active):U=R,U.length>0||!I){let re;if(!V&&!J){const ae=e.activeItems[0];ae&&P.indexOf(ae)!==-1&&(re=ae)}b({items:[...P,...U],active:V||J||re})}}finally{g.isCancellationRequested||(e.busy=!1),M=!0}})()])};if(C!==null)if(s2(C))await E(C);else if(!(C instanceof Promise))b(C);else{e.busy=!0;try{const A=await C;if(g.isCancellationRequested)return;s2(A)?await E(A):b(A)}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 gf.NO_ACTION:break;case gf.CLOSE_PICKER:e.hide();break;case gf.REFRESH_PICKER:a();break;case gf.REMOVE_ITEM:{const y=e.items.indexOf(g);if(y!==-1){const A=e.items.slice(),I=A.splice(y,1),M=e.activeItems.filter(P=>P!==I[0]),R=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=A,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 vF=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},wc=function(o,e){return function(t,i){e(t,i,o)}},Fd,js,Ja;let cw=(Ja=class extends R${constructor(e,t,i,n,s,r){super(Fd.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(dw)),this.options=e}async _getPicks(e,t,i,n){var C,b;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=Tk(()=>{const E=new Pg;E.updateDocuments(s.map(A=>({key:A.commandId,textChunks:[this.getTfIdfChunk(A)]})));const y=E.calculateScores(e,i);return M$(y).filter(A=>A.score>Fd.TFIDF_THRESHOLD).slice(0,Fd.TFIDF_MAX_RESULTS)}),a=[];for(const E of s){const y=Fd.WORD_FILTER(e,E.label)??void 0,A=E.commandAlias?Fd.WORD_FILTER(e,E.commandAlias)??void 0:void 0;if(y||A)E.highlights={label:y,detail:this.options.showAlias?A: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 A=this.commandsHistory.peek(E.commandId),I=this.commandsHistory.peek(y.commandId);if(A&&I)return A>I?-1:1;if(A)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 A;const E=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const y=E.map(I=>this.toCommandPick(I,n));return g&&((A=y[0])==null?void 0:A.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){dd(r)||this.dialogService.error(S("canNotRun","Command '{0}' resulted in an error",e.label),Yv(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}},Fd=Ja,Ja.PREFIX=">",Ja.TFIDF_THRESHOLD=.5,Ja.TFIDF_MAX_RESULTS=5,Ja.WORD_FILTER=SL(kL,AL,DL),Ja);cw=Fd=vF([wc(1,cn),wc(2,Gs),wc(3,ro),wc(4,ka),wc(5,Qw)],cw);var ba;let dw=(ba=class extends Nt{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===Pw.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=js.getConfiguredCommandHistoryLength(this.configurationService),js.cache&&js.cache.limit!==this.configuredCommandsHistoryLength&&(js.cache.limit=this.configuredCommandsHistoryLength,js.hasChanges=!0))}load(){const e=this.storageService.get(js.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=js.cache=new Wp(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))}js.counter=this.storageService.getNumber(js.PREF_KEY_COUNTER,0,js.counter)}push(e){js.cache&&(js.cache.set(e,js.counter++),js.hasChanges=!0)}peek(e){var t;return(t=js.cache)==null?void 0:t.peek(e)}saveState(){if(!js.cache||!js.hasChanges)return;const e={usesLRU:!0,entries:[]};js.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(js.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(js.PREF_KEY_COUNTER,js.counter,0,0),js.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:js.DEFAULT_COMMANDS_HISTORY_LENGTH}},js=ba,ba.DEFAULT_COMMANDS_HISTORY_LENGTH=50,ba.PREF_KEY_CACHE="commandPalette.mru.cache",ba.PREF_KEY_COUNTER="commandPalette.mru.counter",ba.counter=1,ba.hasChanges=!1,ba);dw=js=vF([wc(0,ud),wc(1,bs),wc(2,uh)],dw);class N$ extends cw{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&&(BL(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:FL(n.label)||n.id})}return t}}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},Uh=function(o,e){return function(t,i){e(t,i,o)}};let Sp=class extends N${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[]}};Sp=O$([Uh(0,cn),Uh(1,zs),Uh(2,Gs),Uh(3,ro),Uh(4,ka),Uh(5,Qw)],Sp);const U_=class U_ extends xt{constructor(){super({id:U_.ID,label:Rk.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:G.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Xl).quickAccess.show(Sp.PREFIX)}};U_.ID="editor.action.quickCommand";let qm=U_;Te(qm);Da.as(Xp.Quickaccess).registerQuickAccessProvider({ctor:Sp,prefix:Sp.PREFIX,helpEntries:[{description:Rk.quickCommandHelp,commandId:qm.ID}]});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},qh=function(o,e){return function(t,i){e(t,i,o)}};let uw=class extends ih{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};uw=H$([qh(1,Gn),qh(2,zs),qh(3,Oo),qh(4,cn),qh(5,ud),qh(6,bs)],uw);En(ih.ID,uw,4);class W$ extends xt{constructor(){super({id:"editor.action.toggleHighContrast",label:LL.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(Ik),n=i.getColorTheme();zg(n.type)?(i.setTheme(this._originalThemeName||(o8(n.type)?IL:PL)),this._originalThemeName=null):(i.setTheme(o8(n.type)?TL:ML),this._originalThemeName=n.themeName)}}Te(W$);const mF="she-theme";function z$(){return localStorage.getItem(mF)??"system"}function V$(o){localStorage.setItem(mF,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o),window.dispatchEvent(new CustomEvent("she:theme-changed"))}function pf(){const o=document.documentElement.getAttribute("data-theme");return o==="light"?"vs":o==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}let hw=null;function j$(o){hw=o}function $$(o={}){return{"Content-Type":"application/json",...o}}async function Ht(o,e,t){const i=await fetch(e,{method:o,headers:$$(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw hw&&hw(),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 U$(){return await(await fetch("/she/auth/mode")).json()}async function q$(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 G$(){await fetch("/she/auth/logout",{method:"POST"})}async function K$(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 Z$(){return Ht("GET","/she/scripts/tree")}function Kx(o){return Ht("GET",`/she/scripts/${o}`)}function xc(o,e){return Ht("PUT",`/she/scripts/${o}`,{content:e})}function o2(o,e={}){const t=new URLSearchParams({q:o});return e.regex&&t.set("regex","true"),e.caseSensitive&&t.set("caseSensitive","true"),e.mode&&t.set("mode",e.mode),Ht("GET",`/she/scripts/search?${t}`)}function Zx(o){return Ht("DELETE",`/she/scripts/${o}`)}function r2(o,e){return Ht("POST",`/she/scripts/${o}/rename`,{newPath:e})}function X$(o){return Ht("POST","/she/scripts/mkdir",{path:o})}function Y$(){return Ht("GET","/she/git/status")}function xf(){return Ht("GET","/she/status")}function _F(){return Ht("POST","/she/restart")}function Q$(){return Ht("POST","/she/update")}function J$(){return Ht("POST","/she/check-update")}function eU(o,e){return Ht("POST","/she/git/commit",{path:o,message:e})}function a2(o,e){return Ht("POST","/she/git/commit",{files:o,message:e})}function l2(o){return Ht("POST","/she/git/commit",{message:o})}function Xx(o){return Ht("POST","/she/git/push",{remote:o})}function tU(o,e){return Ht("GET",`/she/git/log?path=${encodeURIComponent(o)}&limit=${e}`)}function iU(o,e){return Ht("GET",`/she/git/show?hash=${encodeURIComponent(o)}&path=${encodeURIComponent(e)}`)}function Zl(){return Ht("GET","/she/config")}function Dp(o){return Ht("PUT","/she/config",o)}function _h(o){return o.split("/").map(encodeURIComponent).join("/")}function bF(){return Ht("GET","/she/db/docs")}function nU(o){return Ht("GET",`/she/db/docs/${_h(o)}`)}function c2(o,e){return Ht("PUT",`/she/db/docs/${_h(o)}`,e)}function sU(o){return Ht("DELETE",`/she/db/docs/${_h(o)}`)}function CF(){return Ht("GET","/she/db/views")}function oU(o){return Ht("GET",`/she/db/views/${_h(o)}`)}function d2(o,e){return Ht("PUT",`/she/db/views/${_h(o)}`,e)}function rU(o){return Ht("DELETE",`/she/db/views/${_h(o)}`)}function aU(){return Ht("GET","/she/deps")}function lU(o){return Ht("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function cU(o,e){return Ht("POST","/she/deps/install",{name:o,version:null})}function dU(o){return Ht("POST","/she/deps/remove",{name:o})}function uU(o){return Ht("POST","/she/deps/update",{name:o})}function EF(){return Ht("GET","/she/deps/outdated")}function hU(){return Ht("POST","/she/deps/check-outdated")}function fU(){return Ht("GET","/she/ai/conversations")}function u2(o){return Ht("GET",`/she/ai/conversations/${encodeURIComponent(o)}`)}function gU(o,e,t){return Ht("PUT",`/she/ai/conversations/${encodeURIComponent(o)}`,{title:e,messages:t})}function pU(o){return Ht("DELETE",`/she/ai/conversations/${encodeURIComponent(o)}`)}function zC(o){return Ht("GET",`/she/db/views/${_h(o)}/result`)}function oS(){return Ht("GET","/she/matter/devices")}function Sv(o){return Ht("GET",`/she/matter/devices/${o}`)}function xU(o){return Ht("POST","/she/matter/commission",o)}function vU(o){return Ht("DELETE",`/she/matter/devices/${o}`)}function mU(o,e,t,i,n){return Ht("POST",`/she/matter/devices/${o}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function yF(){return Ht("GET","/she/mqtt/state")}function h2(o,e,t=!1,i=0){return Ht("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function wF(){return Ht("GET","/she/ai/config")}function SF(){return Ht("GET","/she/ai/models")}function fw(o){return Ht("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}function DF(o){return Ht("POST","/she/ai/prompt",o)}async function AF(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 zb(){return Ht("GET","/she/broker/status")}function _U(){return Ht("GET","/she/broker/local/check")}function bU(){return Ht("GET","/she/broker/ip-addresses")}function dx(){return Ht("GET","/she/broker/config")}function CU(o=500){return Ht("GET",`/she/broker/logs?limit=${o}`)}function kF(o){return Ht("PUT","/she/broker/config",o)}function EU(o,e){return Ht("PUT","/she/broker/config/raw",{content:o,checksum:e})}function yU(){return Ht("GET","/she/broker/config/backups")}function wU(o){return Ht("POST","/she/broker/config/restore",{backup:o})}function Vb(){return Ht("POST","/she/broker/reload")}function SU(){return Ht("POST","/she/broker/restart")}function DU(){return Ht("POST","/she/broker/wizard/deactivate")}function AU(){return Ht("POST","/she/broker/wizard/reinit")}function kU(){return Ht("GET","/she/broker/wizard/diagnose")}function BU(o){return Ht("GET",`/she/broker/passwd?file=${encodeURIComponent(o)}`)}function f2(o,e,t){return Ht("POST","/she/broker/passwd",{file:o,username:e,password:t})}function FU(o,e){return Ht("DELETE",`/she/broker/passwd/${encodeURIComponent(e)}`,{file:o})}function LU(o){return Ht("GET",`/she/broker/acl?file=${encodeURIComponent(o)}`)}function IU(o,e){return Ht("PUT","/she/broker/acl",{file:o,content:e})}function PU(){return Ht("GET","/she/broker/users")}function TU(o,e){return Ht("POST","/she/broker/users",{username:o,password:e})}function MU(o){return Ht("DELETE",`/she/broker/users/${encodeURIComponent(o)}`)}function RU(o,e){return Ht("PUT",`/she/broker/users/${encodeURIComponent(o)}/password`,{password:e})}function NU(o,e){return Ht("POST",`/she/broker/users/${encodeURIComponent(o)}/roles`,{rolename:e})}function OU(o,e){return Ht("DELETE",`/she/broker/users/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function BF(){return Ht("GET","/she/broker/roles")}function HU(o){return Ht("POST","/she/broker/roles",{rolename:o})}function WU(o){return Ht("DELETE",`/she/broker/roles/${encodeURIComponent(o)}`)}function zU(o,e){return Ht("POST",`/she/broker/roles/${encodeURIComponent(o)}/acls`,e)}function VU(o,e,t){return Ht("DELETE",`/she/broker/roles/${encodeURIComponent(o)}/acls`,{acltype:e,topic:t})}function jU(){return Ht("GET","/she/broker/groups")}function $U(o){return Ht("POST","/she/broker/groups",{groupname:o})}function UU(o){return Ht("DELETE",`/she/broker/groups/${encodeURIComponent(o)}`)}function g2(o,e){return Ht("POST",`/she/broker/groups/${encodeURIComponent(o)}/clients`,{username:e})}function p2(o,e){return Ht("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/clients/${encodeURIComponent(e)}`)}function qU(o,e){return Ht("POST",`/she/broker/groups/${encodeURIComponent(o)}/roles`,{rolename:e})}function GU(o,e){return Ht("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function KU(){return Ht("GET","/she/broker/acl-defaults")}function ZU(o){return Ht("PUT","/she/broker/acl-defaults",{acls:o})}function XU(o){return Ht("GET",`/she/broker/acl-check?${new URLSearchParams({topic:o})}`)}function YU(){return Ht("GET","/she/broker/anonymous-group")}function QU(o){return Ht("PUT","/she/broker/anonymous-group",{groupname:o})}function JU(){return Ht("GET","/she/broker/ca/server")}function eq(o){return Ht("POST","/she/broker/ca/server/generate",o)}function tq(o){return Ht("POST","/she/broker/ca/server/csr",o)}function VC(o){return Ht("POST","/she/broker/ca/server/import",o)}function iq(){return Ht("GET","/she/broker/ca/trusted")}function nq(o){return Ht("POST","/she/broker/ca/trusted",{pem:o})}function sq(o){return Ht("DELETE",`/she/broker/ca/trusted/${encodeURIComponent(o)}`)}function oq(o){return Ht("GET",`/she/broker/fs/complete?path=${encodeURIComponent(o)}`)}function rq(o){return Ht("POST","/she/broker/ca/server/pathlink",o)}function aq(o){return Ht("POST","/she/broker/ca/trusted/addpath",{path:o})}const lq=2e3,Dv=[],cq=500,Av=[];function FF(){return Dv.slice()}function dq(){return Av.slice()}let Tc=null;const Gm=new Set,vf=new Map;let gw=null,kv=null;function rS(){return kv||(kv=fetch("/she/logs/history").then(o=>o.ok?o.json():[]).catch(()=>[])),kv}function Ap(){let o=Gm.size;for(const e of vf.values())o+=e.size;return o}function uq(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function aS(){if(Tc)return;rS();const o=uq(),e=new WebSocket(o);Tc=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};Dv.length>=lq&&Dv.shift(),Dv.push(s),Gm.forEach(r=>r(s))}if(i.type==="brokerLog"){const s={level:i.level,msg:i.msg,ts:i.ts};Av.length>=cq&&Av.shift(),Av.push(s)}const n=vf.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{Tc===e&&(Tc=null,kv=null),Ap()>0&&(gw=setTimeout(aS,3e3))},e.onerror=()=>{e.close()}}function LF(){gw&&clearTimeout(gw),Tc==null||Tc.close(),Tc=null}function lS(o){return Gm.add(o),Ap()===1&&aS(),()=>{Gm.delete(o),Ap()===0&&LF()}}function mr(o,e){return vf.has(o)||vf.set(o,new Set),vf.get(o).add(e),Ap()===1&&aS(),()=>{var t;(t=vf.get(o))==null||t.delete(e),Ap()===0&&LF()}}function cS(o){const e=new Date(o);return e.toTimeString().slice(0,8)+"."+String(e.getMilliseconds()).padStart(3,"0")}var hq=F('<button class="cancel svelte-1eh8v5n">Cancel</button>'),fq=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 gl(o,e){Zs(e,!0);let t=B(!1),i=B(""),n=B("Confirm"),s=B(!1),r=B(!1),a=null;function d(E,y){return x(i,E,!0),x(n,(y==null?void 0:y.confirm)??(y!=null&&y.alert?"OK":"Confirm"),!0),x(s,(y==null?void 0:y.danger)??!1,!0),x(r,(y==null?void 0:y.alert)??!1,!0),x(t,!0),new Promise(A=>a=A)}function u(E){x(t,!1),a==null||a(E),a=null}function f(E){l(t)&&(E.key==="Escape"&&u(!1),E.key==="Enter"&&u(!0))}var g={show:d},p=Us();Ts("keydown",Xd,f);var C=dt(p);{var b=E=>{var y=fq(),A=dt(y),I=v(A,2),M=m(I),R=m(M),P=v(M,2),V=m(P);{var U=ie=>{var ve=hq();j("click",ve,()=>u(!1)),D(ie,ve)};O(V,ie=>{l(r)||ie(U)})}var J=v(V,2);let re;var ae=m(J);z(()=>{N(R,l(i)),re=Dt(J,1,"svelte-1eh8v5n",null,re,{danger:l(s)}),N(ae,l(n))}),j("click",A,()=>u(!1)),j("click",J,()=>u(!0)),D(E,y)};O(C,E=>{l(t)&&E(b)})}return D(o,p),Xs(g)}lo(["click"]);var gq=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 pq(o,e){Zs(e,!0);let t=B(!1),i=B(""),n=B(""),s=B("OK"),r=B(""),a=null,d=B(void 0);function u(A,I){return x(i,A,!0),x(n,(I==null?void 0:I.placeholder)??"",!0),x(s,(I==null?void 0:I.confirm)??"OK",!0),x(r,(I==null?void 0:I.initial)??"",!0),x(t,!0),setTimeout(()=>{if(l(d)){l(d).focus();const M=l(d).value.length;l(d).setSelectionRange(M,M)}},0),new Promise(M=>a=M)}function f(){const A=l(r).trim();A&&(x(t,!1),a==null||a(A),a=null,x(r,""))}function g(){x(t,!1),a==null||a(null),a=null,x(r,"")}function p(A){l(t)&&A.key==="Escape"&&(A.stopPropagation(),g())}var C={show:u},b=Us();Ts("keydown",Xd,p);var E=dt(b);{var y=A=>{var I=gq(),M=dt(I),R=v(M,2),P=m(R),V=m(P),U=v(P,2);ks(U,ve=>x(d,ve),()=>l(d));var J=v(U,2),re=m(J),ae=v(re,2),ie=m(ae);z(ve=>{N(V,l(i)),gn(U,"placeholder",l(n)),ae.disabled=ve,N(ie,l(s))},[()=>!l(r).trim()]),j("click",M,g),j("keydown",U,ve=>{ve.key==="Enter"&&(ve.preventDefault(),f())}),yt(U,()=>l(r),ve=>x(r,ve)),j("click",re,g),j("click",ae,f),D(A,I)};O(E,A=>{l(t)&&A(y)})}return D(o,b),Xs(C)}lo(["click","keydown"]);function dS(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var jC,x2;function xq(){if(x2)return jC;x2=1;function o(K){return K instanceof Map?K.clear=K.delete=K.set=function(){throw new Error("map is read-only")}:K instanceof Set&&(K.add=K.clear=K.delete=function(){throw new Error("set is read-only")}),Object.freeze(K),Object.getOwnPropertyNames(K).forEach(Ae=>{const ot=K[Ae],Ge=typeof ot;(Ge==="object"||Ge==="function")&&!Object.isFrozen(ot)&&o(ot)}),K}class e{constructor(Ae){Ae.data===void 0&&(Ae.data={}),this.data=Ae.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(K){return K.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(K,...Ae){const ot=Object.create(null);for(const Ge in K)ot[Ge]=K[Ge];return Ae.forEach(function(Ge){for(const Pt in Ge)ot[Pt]=Ge[Pt]}),ot}const n="</span>",s=K=>!!K.scope,r=(K,{prefix:Ae})=>{if(K.startsWith("language:"))return K.replace("language:","language-");if(K.includes(".")){const ot=K.split(".");return[`${Ae}${ot.shift()}`,...ot.map((Ge,Pt)=>`${Ge}${"_".repeat(Pt+1)}`)].join(" ")}return`${Ae}${K}`};class a{constructor(Ae,ot){this.buffer="",this.classPrefix=ot.classPrefix,Ae.walk(this)}addText(Ae){this.buffer+=t(Ae)}openNode(Ae){if(!s(Ae))return;const ot=r(Ae.scope,{prefix:this.classPrefix});this.span(ot)}closeNode(Ae){s(Ae)&&(this.buffer+=n)}value(){return this.buffer}span(Ae){this.buffer+=`<span class="${Ae}">`}}const d=(K={})=>{const Ae={children:[]};return Object.assign(Ae,K),Ae};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(Ae){this.top.children.push(Ae)}openNode(Ae){const ot=d({scope:Ae});this.add(ot),this.stack.push(ot)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Ae){return this.constructor._walk(Ae,this.rootNode)}static _walk(Ae,ot){return typeof ot=="string"?Ae.addText(ot):ot.children&&(Ae.openNode(ot),ot.children.forEach(Ge=>this._walk(Ae,Ge)),Ae.closeNode(ot)),Ae}static _collapse(Ae){typeof Ae!="string"&&Ae.children&&(Ae.children.every(ot=>typeof ot=="string")?Ae.children=[Ae.children.join("")]:Ae.children.forEach(ot=>{u._collapse(ot)}))}}class f extends u{constructor(Ae){super(),this.options=Ae}addText(Ae){Ae!==""&&this.add(Ae)}startScope(Ae){this.openNode(Ae)}endScope(){this.closeNode()}__addSublanguage(Ae,ot){const Ge=Ae.root;ot&&(Ge.scope=`language:${ot}`),this.add(Ge)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(K){return K?typeof K=="string"?K:K.source:null}function p(K){return E("(?=",K,")")}function C(K){return E("(?:",K,")*")}function b(K){return E("(?:",K,")?")}function E(...K){return K.map(ot=>g(ot)).join("")}function y(K){const Ae=K[K.length-1];return typeof Ae=="object"&&Ae.constructor===Object?(K.splice(K.length-1,1),Ae):{}}function A(...K){return"("+(y(K).capture?"":"?:")+K.map(Ge=>g(Ge)).join("|")+")"}function I(K){return new RegExp(K.toString()+"|").exec("").length-1}function M(K,Ae){const ot=K&&K.exec(Ae);return ot&&ot.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function P(K,{joinWith:Ae}){let ot=0;return K.map(Ge=>{ot+=1;const Pt=ot;let Yt=g(Ge),gt="";for(;Yt.length>0;){const et=R.exec(Yt);if(!et){gt+=Yt;break}gt+=Yt.substring(0,et.index),Yt=Yt.substring(et.index+et[0].length),et[0][0]==="\\"&&et[1]?gt+="\\"+String(Number(et[1])+Pt):(gt+=et[0],et[0]==="("&&ot++)}return gt}).map(Ge=>`(${Ge})`).join(Ae)}const V=/\b\B/,U="[a-zA-Z]\\w*",J="[a-zA-Z_]\\w*",re="\\b\\d+(\\.\\d+)?",ae="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ie="\\b(0b[01]+)",ve="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Se=(K={})=>{const Ae=/^#![ ]*\//;return K.binary&&(K.begin=E(Ae,/.*\b/,K.binary,/\b.*/)),i({scope:"meta",begin:Ae,end:/$/,relevance:0,"on:begin":(ot,Ge)=>{ot.index!==0&&Ge.ignoreMatch()}},K)},Q={begin:"\\\\[\\s\\S]",relevance:0},he={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Q]},De={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Q]},Fe={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/},ge=function(K,Ae,ot={}){const Ge=i({scope:"comment",begin:K,end:Ae,contains:[]},ot);Ge.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 Pt=A("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 Ge.contains.push({begin:E(/[ ]+/,"(",Pt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ge},Ne=ge("//","$"),Oe=ge("/\\*","\\*/"),pe=ge("#","$"),lt={scope:"number",begin:re,relevance:0},Ot={scope:"number",begin:ae,relevance:0},Xe={scope:"number",begin:ie,relevance:0},ht={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Q,{begin:/\[/,end:/\]/,relevance:0,contains:[Q]}]},me={scope:"title",begin:U,relevance:0},Be={scope:"title",begin:J,relevance:0},st={begin:"\\.\\s*"+J,relevance:0};var rt=Object.freeze({__proto__:null,APOS_STRING_MODE:he,BACKSLASH_ESCAPE:Q,BINARY_NUMBER_MODE:Xe,BINARY_NUMBER_RE:ie,COMMENT:ge,C_BLOCK_COMMENT_MODE:Oe,C_LINE_COMMENT_MODE:Ne,C_NUMBER_MODE:Ot,C_NUMBER_RE:ae,END_SAME_AS_BEGIN:function(K){return Object.assign(K,{"on:begin":(Ae,ot)=>{ot.data._beginMatch=Ae[1]},"on:end":(Ae,ot)=>{ot.data._beginMatch!==Ae[1]&&ot.ignoreMatch()}})},HASH_COMMENT_MODE:pe,IDENT_RE:U,MATCH_NOTHING_RE:V,METHOD_GUARD:st,NUMBER_MODE:lt,NUMBER_RE:re,PHRASAL_WORDS_MODE:Fe,QUOTE_STRING_MODE:De,REGEXP_MODE:ht,RE_STARTERS_RE:ve,SHEBANG:Se,TITLE_MODE:me,UNDERSCORE_IDENT_RE:J,UNDERSCORE_TITLE_MODE:Be});function wt(K,Ae){K.input[K.index-1]==="."&&Ae.ignoreMatch()}function ui(K,Ae){K.className!==void 0&&(K.scope=K.className,delete K.className)}function ci(K,Ae){Ae&&K.beginKeywords&&(K.begin="\\b("+K.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",K.__beforeBegin=wt,K.keywords=K.keywords||K.beginKeywords,delete K.beginKeywords,K.relevance===void 0&&(K.relevance=0))}function hi(K,Ae){Array.isArray(K.illegal)&&(K.illegal=A(...K.illegal))}function Ct(K,Ae){if(K.match){if(K.begin||K.end)throw new Error("begin & end are not supported with match");K.begin=K.match,delete K.match}}function ai(K,Ae){K.relevance===void 0&&(K.relevance=1)}const Re=(K,Ae)=>{if(!K.beforeMatch)return;if(K.starts)throw new Error("beforeMatch cannot be used with starts");const ot=Object.assign({},K);Object.keys(K).forEach(Ge=>{delete K[Ge]}),K.keywords=ot.keywords,K.begin=E(ot.beforeMatch,p(ot.begin)),K.starts={relevance:0,contains:[Object.assign(ot,{endsParent:!0})]},K.relevance=0,delete ot.beforeMatch},Ee=["of","and","for","in","not","or","if","then","parent","list","value"],zt="keyword";function ii(K,Ae,ot=zt){const Ge=Object.create(null);return typeof K=="string"?Pt(ot,K.split(" ")):Array.isArray(K)?Pt(ot,K):Object.keys(K).forEach(function(Yt){Object.assign(Ge,ii(K[Yt],Ae,Yt))}),Ge;function Pt(Yt,gt){Ae&&(gt=gt.map(et=>et.toLowerCase())),gt.forEach(function(et){const X=et.split("|");Ge[X[0]]=[Yt,Vt(X[0],X[1])]})}}function Vt(K,Ae){return Ae?Number(Ae):Ai(K)?0:1}function Ai(K){return Ee.includes(K.toLowerCase())}const Fi={},mi=K=>{console.error(K)},ln=(K,...Ae)=>{console.log(`WARN: ${K}`,...Ae)},sn=(K,Ae)=>{Fi[`${K}/${Ae}`]||(console.log(`Deprecated as of ${K}. ${Ae}`),Fi[`${K}/${Ae}`]=!0)},dn=new Error;function bn(K,Ae,{key:ot}){let Ge=0;const Pt=K[ot],Yt={},gt={};for(let et=1;et<=Ae.length;et++)gt[et+Ge]=Pt[et],Yt[et+Ge]=!0,Ge+=I(Ae[et-1]);K[ot]=gt,K[ot]._emit=Yt,K[ot]._multi=!0}function ft(K){if(Array.isArray(K.begin)){if(K.skip||K.excludeBegin||K.returnBegin)throw mi("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),dn;if(typeof K.beginScope!="object"||K.beginScope===null)throw mi("beginScope must be object"),dn;bn(K,K.begin,{key:"beginScope"}),K.begin=P(K.begin,{joinWith:""})}}function qt(K){if(Array.isArray(K.end)){if(K.skip||K.excludeEnd||K.returnEnd)throw mi("skip, excludeEnd, returnEnd not compatible with endScope: {}"),dn;if(typeof K.endScope!="object"||K.endScope===null)throw mi("endScope must be object"),dn;bn(K,K.end,{key:"endScope"}),K.end=P(K.end,{joinWith:""})}}function Ti(K){K.scope&&typeof K.scope=="object"&&K.scope!==null&&(K.beginScope=K.scope,delete K.scope)}function ki(K){Ti(K),typeof K.beginScope=="string"&&(K.beginScope={_wrap:K.beginScope}),typeof K.endScope=="string"&&(K.endScope={_wrap:K.endScope}),ft(K),qt(K)}function bi(K){function Ae(gt,et){return new RegExp(g(gt),"m"+(K.case_insensitive?"i":"")+(K.unicodeRegex?"u":"")+(et?"g":""))}class ot{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(et,X){X.position=this.position++,this.matchIndexes[this.matchAt]=X,this.regexes.push([X,et]),this.matchAt+=I(et)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const et=this.regexes.map(X=>X[1]);this.matcherRe=Ae(P(et,{joinWith:"|"}),!0),this.lastIndex=0}exec(et){this.matcherRe.lastIndex=this.lastIndex;const X=this.matcherRe.exec(et);if(!X)return null;const Pe=X.findIndex((fe,Gt)=>Gt>0&&fe!==void 0),ce=this.matchIndexes[Pe];return X.splice(0,Pe),Object.assign(X,ce)}}class Ge{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(et){if(this.multiRegexes[et])return this.multiRegexes[et];const X=new ot;return this.rules.slice(et).forEach(([Pe,ce])=>X.addRule(Pe,ce)),X.compile(),this.multiRegexes[et]=X,X}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(et,X){this.rules.push([et,X]),X.type==="begin"&&this.count++}exec(et){const X=this.getMatcher(this.regexIndex);X.lastIndex=this.lastIndex;let Pe=X.exec(et);if(this.resumingScanAtSamePosition()&&!(Pe&&Pe.index===this.lastIndex)){const ce=this.getMatcher(0);ce.lastIndex=this.lastIndex+1,Pe=ce.exec(et)}return Pe&&(this.regexIndex+=Pe.position+1,this.regexIndex===this.count&&this.considerAll()),Pe}}function Pt(gt){const et=new Ge;return gt.contains.forEach(X=>et.addRule(X.begin,{rule:X,type:"begin"})),gt.terminatorEnd&&et.addRule(gt.terminatorEnd,{type:"end"}),gt.illegal&&et.addRule(gt.illegal,{type:"illegal"}),et}function Yt(gt,et){const X=gt;if(gt.isCompiled)return X;[ui,Ct,ki,Re].forEach(ce=>ce(gt,et)),K.compilerExtensions.forEach(ce=>ce(gt,et)),gt.__beforeBegin=null,[ci,hi,ai].forEach(ce=>ce(gt,et)),gt.isCompiled=!0;let Pe=null;return typeof gt.keywords=="object"&&gt.keywords.$pattern&&(gt.keywords=Object.assign({},gt.keywords),Pe=gt.keywords.$pattern,delete gt.keywords.$pattern),Pe=Pe||/\w+/,gt.keywords&&(gt.keywords=ii(gt.keywords,K.case_insensitive)),X.keywordPatternRe=Ae(Pe,!0),et&&(gt.begin||(gt.begin=/\B|\b/),X.beginRe=Ae(X.begin),!gt.end&&!gt.endsWithParent&&(gt.end=/\B|\b/),gt.end&&(X.endRe=Ae(X.end)),X.terminatorEnd=g(X.end)||"",gt.endsWithParent&&et.terminatorEnd&&(X.terminatorEnd+=(gt.end?"|":"")+et.terminatorEnd)),gt.illegal&&(X.illegalRe=Ae(gt.illegal)),gt.contains||(gt.contains=[]),gt.contains=[].concat(...gt.contains.map(function(ce){return mn(ce==="self"?gt:ce)})),gt.contains.forEach(function(ce){Yt(ce,X)}),gt.starts&&Yt(gt.starts,et),X.matcher=Pt(X),X}if(K.compilerExtensions||(K.compilerExtensions=[]),K.contains&&K.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return K.classNameAliases=i(K.classNameAliases||{}),Yt(K)}function yn(K){return K?K.endsWithParent||yn(K.starts):!1}function mn(K){return K.variants&&!K.cachedVariants&&(K.cachedVariants=K.variants.map(function(Ae){return i(K,{variants:null},Ae)})),K.cachedVariants?K.cachedVariants:yn(K)?i(K,{starts:K.starts?i(K.starts):null}):Object.isFrozen(K)?i(K):K}var _n="11.11.1";class qe extends Error{constructor(Ae,ot){super(Ae),this.name="HTMLInjectionError",this.html=ot}}const Xt=t,yi=i,Ut=Symbol("nomatch"),Li=7,qi=function(K){const Ae=Object.create(null),ot=Object.create(null),Ge=[];let Pt=!0;const Yt="Could not find the language '{}', did you forget to load/include a language module?",gt={disableAutodetect:!0,name:"Plain text",contains:[]};let et={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:f};function X(q){return et.noHighlightRe.test(q)}function Pe(q){let T=q.className+" ";T+=q.parentNode?q.parentNode.className:"";const H=et.languageDetectRe.exec(T);if(H){const Y=oi(H[1]);return Y||(ln(Yt.replace("{}",H[1])),ln("Falling back to no-highlight mode for this block.",q)),Y?H[1]:"no-highlight"}return T.split(/\s+/).find(Y=>X(Y)||oi(Y))}function ce(q,T,H){let Y="",ne="";typeof T=="object"?(Y=q,H=T.ignoreIllegals,ne=T.language):(sn("10.7.0","highlight(lang, code, ...args) has been deprecated."),sn("10.7.0",`Please use highlight(code, options) instead.
80
+ https://github.com/highlightjs/highlight.js/issues/2277`),ne=q,Y=T),H===void 0&&(H=!0);const le={code:Y,language:ne};Ve("before:highlight",le);const oe=le.result?le.result:fe(le.language,le.code,H);return oe.code=le.code,Ve("after:highlight",oe),oe}function fe(q,T,H,Y){const ne=Object.create(null);function le(Ze,Et){return Ze.keywords[Et]}function oe(){if(!Qe.keywords){_t.addText(tt);return}let Ze=0;Qe.keywordPatternRe.lastIndex=0;let Et=Qe.keywordPatternRe.exec(tt),Zt="";for(;Et;){Zt+=tt.substring(Ze,Et.index);const ji=ze.case_insensitive?Et[0].toLowerCase():Et[0],Wt=le(Qe,ji);if(Wt){const[$t,wi]=Wt;if(_t.addText(Zt),Zt="",ne[ji]=(ne[ji]||0)+1,ne[ji]<=Li&&(Bt+=wi),$t.startsWith("_"))Zt+=Et[0];else{const Xi=ze.classNameAliases[$t]||$t;be(Et[0],Xi)}}else Zt+=Et[0];Ze=Qe.keywordPatternRe.lastIndex,Et=Qe.keywordPatternRe.exec(tt)}Zt+=tt.substring(Ze),_t.addText(Zt)}function ye(){if(tt==="")return;let Ze=null;if(typeof Qe.subLanguage=="string"){if(!Ae[Qe.subLanguage]){_t.addText(tt);return}Ze=fe(Qe.subLanguage,tt,!0,mt[Qe.subLanguage]),mt[Qe.subLanguage]=Ze._top}else Ze=ni(tt,Qe.subLanguage.length?Qe.subLanguage:null);Qe.relevance>0&&(Bt+=Ze.relevance),_t.__addSublanguage(Ze._emitter,Ze.language)}function We(){Qe.subLanguage!=null?ye():oe(),tt=""}function be(Ze,Et){Ze!==""&&(_t.startScope(Et),_t.addText(Ze),_t.endScope())}function Le(Ze,Et){let Zt=1;const ji=Et.length-1;for(;Zt<=ji;){if(!Ze._emit[Zt]){Zt++;continue}const Wt=ze.classNameAliases[Ze[Zt]]||Ze[Zt],$t=Et[Zt];Wt?be($t,Wt):(tt=$t,oe(),tt=""),Zt++}}function Me(Ze,Et){return Ze.scope&&typeof Ze.scope=="string"&&_t.openNode(ze.classNameAliases[Ze.scope]||Ze.scope),Ze.beginScope&&(Ze.beginScope._wrap?(be(tt,ze.classNameAliases[Ze.beginScope._wrap]||Ze.beginScope._wrap),tt=""):Ze.beginScope._multi&&(Le(Ze.beginScope,Et),tt="")),Qe=Object.create(Ze,{parent:{value:Qe}}),Qe}function nt(Ze,Et,Zt){let ji=M(Ze.endRe,Zt);if(ji){if(Ze["on:end"]){const Wt=new e(Ze);Ze["on:end"](Et,Wt),Wt.isMatchIgnored&&(ji=!1)}if(ji){for(;Ze.endsParent&&Ze.parent;)Ze=Ze.parent;return Ze}}if(Ze.endsWithParent)return nt(Ze.parent,Et,Zt)}function Jt(Ze){return Qe.matcher.regexIndex===0?(tt+=Ze[0],1):(Kt=!0,0)}function ee(Ze){const Et=Ze[0],Zt=Ze.rule,ji=new e(Zt),Wt=[Zt.__beforeBegin,Zt["on:begin"]];for(const $t of Wt)if($t&&($t(Ze,ji),ji.isMatchIgnored))return Jt(Et);return Zt.skip?tt+=Et:(Zt.excludeBegin&&(tt+=Et),We(),!Zt.returnBegin&&!Zt.excludeBegin&&(tt=Et)),Me(Zt,Ze),Zt.returnBegin?0:Et.length}function de(Ze){const Et=Ze[0],Zt=T.substring(Ze.index),ji=nt(Qe,Ze,Zt);if(!ji)return Ut;const Wt=Qe;Qe.endScope&&Qe.endScope._wrap?(We(),be(Et,Qe.endScope._wrap)):Qe.endScope&&Qe.endScope._multi?(We(),Le(Qe.endScope,Ze)):Wt.skip?tt+=Et:(Wt.returnEnd||Wt.excludeEnd||(tt+=Et),We(),Wt.excludeEnd&&(tt=Et));do Qe.scope&&_t.closeNode(),!Qe.skip&&!Qe.subLanguage&&(Bt+=Qe.relevance),Qe=Qe.parent;while(Qe!==ji.parent);return ji.starts&&Me(ji.starts,Ze),Wt.returnEnd?0:Et.length}function $e(){const Ze=[];for(let Et=Qe;Et!==ze;Et=Et.parent)Et.scope&&Ze.unshift(Et.scope);Ze.forEach(Et=>_t.openNode(Et))}let Ft={};function je(Ze,Et){const Zt=Et&&Et[0];if(tt+=Ze,Zt==null)return We(),0;if(Ft.type==="begin"&&Et.type==="end"&&Ft.index===Et.index&&Zt===""){if(tt+=T.slice(Et.index,Et.index+1),!Pt){const ji=new Error(`0 width match regex (${q})`);throw ji.languageName=q,ji.badRule=Ft.rule,ji}return 1}if(Ft=Et,Et.type==="begin")return ee(Et);if(Et.type==="illegal"&&!H){const ji=new Error('Illegal lexeme "'+Zt+'" for mode "'+(Qe.scope||"<unnamed>")+'"');throw ji.mode=Qe,ji}else if(Et.type==="end"){const ji=de(Et);if(ji!==Ut)return ji}if(Et.type==="illegal"&&Zt==="")return tt+=`
81
+ `,1;if(Mt>1e5&&Mt>Et.index*3)throw new Error("potential infinite loop, way more iterations than matches");return tt+=Zt,Zt.length}const ze=oi(q);if(!ze)throw mi(Yt.replace("{}",q)),new Error('Unknown language: "'+q+'"');const kt=bi(ze);let ct="",Qe=Y||kt;const mt={},_t=new et.__emitter(et);$e();let tt="",Bt=0,ei=0,Mt=0,Kt=!1;try{if(ze.__emitTokens)ze.__emitTokens(T,_t);else{for(Qe.matcher.considerAll();;){Mt++,Kt?Kt=!1:Qe.matcher.considerAll(),Qe.matcher.lastIndex=ei;const Ze=Qe.matcher.exec(T);if(!Ze)break;const Et=T.substring(ei,Ze.index),Zt=je(Et,Ze);ei=Ze.index+Zt}je(T.substring(ei))}return _t.finalize(),ct=_t.toHTML(),{language:q,value:ct,relevance:Bt,illegal:!1,_emitter:_t,_top:Qe}}catch(Ze){if(Ze.message&&Ze.message.includes("Illegal"))return{language:q,value:Xt(T),illegal:!0,relevance:0,_illegalBy:{message:Ze.message,index:ei,context:T.slice(ei-100,ei+100),mode:Ze.mode,resultSoFar:ct},_emitter:_t};if(Pt)return{language:q,value:Xt(T),illegal:!1,relevance:0,errorRaised:Ze,_emitter:_t,_top:Qe};throw Ze}}function Gt(q){const T={value:Xt(q),illegal:!1,relevance:0,_top:gt,_emitter:new et.__emitter(et)};return T._emitter.addText(q),T}function ni(q,T){T=T||et.languages||Object.keys(Ae);const H=Gt(q),Y=T.filter(oi).filter(ue).map(We=>fe(We,q,!1));Y.unshift(H);const ne=Y.sort((We,be)=>{if(We.relevance!==be.relevance)return be.relevance-We.relevance;if(We.language&&be.language){if(oi(We.language).supersetOf===be.language)return 1;if(oi(be.language).supersetOf===We.language)return-1}return 0}),[le,oe]=ne,ye=le;return ye.secondBest=oe,ye}function gi(q,T,H){const Y=T&&ot[T]||H;q.classList.add("hljs"),q.classList.add(`language-${Y}`)}function fi(q){let T=null;const H=Pe(q);if(X(H))return;if(Ve("before:highlightElement",{el:q,language:H}),q.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",q);return}if(q.children.length>0&&(et.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(q)),et.throwUnescapedHTML))throw new qe("One of your code blocks includes unescaped HTML.",q.innerHTML);T=q;const Y=T.textContent,ne=H?ce(Y,{language:H,ignoreIllegals:!0}):ni(Y);q.innerHTML=ne.value,q.dataset.highlighted="yes",gi(q,H,ne.language),q.result={language:ne.language,re:ne.relevance,relevance:ne.relevance},ne.secondBest&&(q.secondBest={language:ne.secondBest.language,relevance:ne.secondBest.relevance}),Ve("after:highlightElement",{el:q,result:ne,text:Y})}function Ii(q){et=yi(et,q)}const pi=()=>{Ye(),sn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Ci(){Ye(),sn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let He=!1;function Ye(){function q(){Ye()}if(document.readyState==="loading"){He||window.addEventListener("DOMContentLoaded",q,!1),He=!0;return}document.querySelectorAll(et.cssSelector).forEach(fi)}function jt(q,T){let H=null;try{H=T(K)}catch(Y){if(mi("Language definition for '{}' could not be registered.".replace("{}",q)),Pt)mi(Y);else throw Y;H=gt}H.name||(H.name=q),Ae[q]=H,H.rawDefinition=T.bind(null,K),H.aliases&&$(H.aliases,{languageName:q})}function Qt(q){delete Ae[q];for(const T of Object.keys(ot))ot[T]===q&&delete ot[T]}function Mi(){return Object.keys(Ae)}function oi(q){return q=(q||"").toLowerCase(),Ae[q]||Ae[ot[q]]}function $(q,{languageName:T}){typeof q=="string"&&(q=[q]),q.forEach(H=>{ot[H.toLowerCase()]=T})}function ue(q){const T=oi(q);return T&&!T.disableAutodetect}function Ce(q){q["before:highlightBlock"]&&!q["before:highlightElement"]&&(q["before:highlightElement"]=T=>{q["before:highlightBlock"](Object.assign({block:T.el},T))}),q["after:highlightBlock"]&&!q["after:highlightElement"]&&(q["after:highlightElement"]=T=>{q["after:highlightBlock"](Object.assign({block:T.el},T))})}function _e(q){Ce(q),Ge.push(q)}function Je(q){const T=Ge.indexOf(q);T!==-1&&Ge.splice(T,1)}function Ve(q,T){const H=q;Ge.forEach(function(Y){Y[H]&&Y[H](T)})}function St(q){return sn("10.7.0","highlightBlock will be removed entirely in v12.0"),sn("10.7.0","Please use highlightElement now."),fi(q)}Object.assign(K,{highlight:ce,highlightAuto:ni,highlightAll:Ye,highlightElement:fi,highlightBlock:St,configure:Ii,initHighlighting:pi,initHighlightingOnLoad:Ci,registerLanguage:jt,unregisterLanguage:Qt,listLanguages:Mi,getLanguage:oi,registerAliases:$,autoDetection:ue,inherit:yi,addPlugin:_e,removePlugin:Je}),K.debugMode=function(){Pt=!1},K.safeMode=function(){Pt=!0},K.versionString=_n,K.regex={concat:E,lookahead:p,either:A,optional:b,anyNumberOfTimes:C};for(const q in rt)typeof rt[q]=="object"&&o(rt[q]);return Object.assign(K,rt),K},Gi=qi({});return Gi.newInstance=()=>qi({}),jC=Gi,Gi.HighlightJS=Gi,Gi.default=Gi,jC}var vq=xq();const Km=dS(vq),v2="[A-Za-z$_][0-9A-Za-z$_]*",mq=["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"],_q=["true","false","null","undefined","NaN","Infinity"],IF=["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"],PF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],TF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],bq=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Cq=[].concat(TF,IF,PF);function MF(o){const e=o.regex,t=(ge,{after:Ne})=>{const Oe="</"+ge[0].slice(1);return ge.input.indexOf(Oe,Ne)!==-1},i=v2,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(ge,Ne)=>{const Oe=ge[0].length+ge.index,pe=ge.input[Oe];if(pe==="<"||pe===","){Ne.ignoreMatch();return}pe===">"&&(t(ge,{after:Oe})||Ne.ignoreMatch());let lt;const Ot=ge.input.substring(Oe);if(lt=Ot.match(/^\s*=/)){Ne.ignoreMatch();return}if((lt=Ot.match(/^\s+extends\s+/))&&lt.index===0){Ne.ignoreMatch();return}}},a={$pattern:v2,keyword:mq,literal:_q,built_in:Cq,"variable.language":bq},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),P=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),V={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:P},U={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"}}]},J={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:{_:[...IF,...PF]}},re={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ae={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},ie={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ve(ge){return e.concat("(?!",ge.join("|"),")")}const Se={match:e.concat(/\b/,ve([...TF,"super","import"].map(ge=>`${ge}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Q={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},he={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},De="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",Fe={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(De)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[V]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),re,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,C,b,E,y,I,{match:/\$\d+/},g,J,{scope:"attr",match:i+e.lookahead(":"),relevance:0},Fe,{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:De,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:P}]}]},{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"]}]}]},ae,{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},Q,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},Se,ie,U,he,{match:/\$[(.]/}]}}function uS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bh=uS();function RF(o){bh=o}var Pd={exec:()=>null};function Gh(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 gs(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($o.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var Eq=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),$o={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:Gh(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Gh(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Gh(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:Gh(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:Gh(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Gh(o=>new RegExp(`^ {0,${o}}>`))},yq=/^(?:[ \t]*(?:\n|$))+/,wq=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Sq=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ux=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Dq=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hS=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,NF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,OF=gs(NF).replace(/bull/g,hS).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(),Aq=gs(NF).replace(/bull/g,hS).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(),fS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,kq=/^[^\n]+/,gS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Bq=gs(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fq=gs(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hS).getRegex(),jb="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",pS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lq=gs("^ {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",pS).replace("tag",jb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),HF=gs(fS).replace("hr",ux).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",jb).getRegex(),Iq=gs(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",HF).getRegex(),xS={blockquote:Iq,code:wq,def:Bq,fences:Sq,heading:Dq,hr:ux,html:Lq,lheading:OF,list:Fq,newline:yq,paragraph:HF,table:Pd,text:kq},m2=gs("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ux).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",jb).getRegex(),Pq={...xS,lheading:Aq,table:m2,paragraph:gs(fS).replace("hr",ux).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",m2).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",jb).getRegex()},Tq={...xS,html:gs(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pS).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:Pd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:gs(fS).replace("hr",ux).replace("heading",` *#{1,6} *[^
82
+ ]`).replace("lheading",OF).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Mq=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rq=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,WF=/^( {2,}|\\)\n(?!\s*$)/,Nq=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,R0=/[\p{P}\p{S}]/u,$b=/[\s\p{P}\p{S}]/u,vS=/[^\s\p{P}\p{S}]/u,Oq=gs(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$b).getRegex(),zF=/(?!~)[\p{P}\p{S}]/u,Hq=/(?!~)[\s\p{P}\p{S}]/u,Wq=/(?:[^\s\p{P}\p{S}]|~)/u,zq=gs(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Eq?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),VF=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Vq=gs(VF,"u").replace(/punct/g,R0).getRegex(),jq=gs(VF,"u").replace(/punct/g,zF).getRegex(),jF="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",$q=gs(jF,"gu").replace(/notPunctSpace/g,vS).replace(/punctSpace/g,$b).replace(/punct/g,R0).getRegex(),Uq=gs(jF,"gu").replace(/notPunctSpace/g,Wq).replace(/punctSpace/g,Hq).replace(/punct/g,zF).getRegex(),qq=gs("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vS).replace(/punctSpace/g,$b).replace(/punct/g,R0).getRegex(),Gq=gs(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,R0).getRegex(),Kq="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Zq=gs(Kq,"gu").replace(/notPunctSpace/g,vS).replace(/punctSpace/g,$b).replace(/punct/g,R0).getRegex(),Xq=gs(/\\(punct)/,"gu").replace(/punct/g,R0).getRegex(),Yq=gs(/^<(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(),Qq=gs(pS).replace("(?:-->|$)","-->").getRegex(),Jq=gs("^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",Qq).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,eG=gs(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Zm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$F=gs(/^!?\[(label)\]\[(ref)\]/).replace("label",Zm).replace("ref",gS).getRegex(),UF=gs(/^!?\[(ref)\](?:\[\])?/).replace("ref",gS).getRegex(),tG=gs("reflink|nolink(?!\\()","g").replace("reflink",$F).replace("nolink",UF).getRegex(),_2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mS={_backpedal:Pd,anyPunctuation:Xq,autolink:Yq,blockSkip:zq,br:WF,code:Rq,del:Pd,delLDelim:Pd,delRDelim:Pd,emStrongLDelim:Vq,emStrongRDelimAst:$q,emStrongRDelimUnd:qq,escape:Mq,link:eG,nolink:UF,punctuation:Oq,reflink:$F,reflinkSearch:tG,tag:Jq,text:Nq,url:Pd},iG={...mS,link:gs(/^!?\[(label)\]\((.*?)\)/).replace("label",Zm).getRegex(),reflink:gs(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zm).getRegex()},pw={...mS,emStrongRDelimAst:Uq,emStrongLDelim:jq,delLDelim:Gq,delRDelim:Zq,url:gs(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_2).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:gs(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_2).getRegex()},nG={...pw,br:gs(WF).replace("{2,}","*").getRegex(),text:gs(pw.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yx={normal:xS,gfm:Pq,pedantic:Tq},Q0={normal:mS,gfm:pw,breaks:nG,pedantic:iG},sG={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},b2=o=>sG[o];function za(o,e){if(e){if($o.escapeTest.test(o))return o.replace($o.escapeReplace,b2)}else if($o.escapeTestNoEncode.test(o))return o.replace($o.escapeReplaceNoEncode,b2);return o}function C2(o){try{o=encodeURI(o).replace($o.percentDecode,"%")}catch{return null}return o}function E2(o,e){var s;let t=o.replace($o.findPipe,(r,a,d)=>{let u=!1,f=a;for(;--f>=0&&d[f]==="\\";)u=!u;return u?"|":" |"}),i=t.split($o.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($o.slashPipe,"|");return i}function vc(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 y2(o){let e=o.split(`
83
+ `),t=e.length-1;for(;t>=0&&$o.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
84
+ `)}function oG(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 rG(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 w2(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 aG(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 Xm=class{constructor(o){Un(this,"options");Un(this,"rules");Un(this,"lexer");this.options=o||bh}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]:y2(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=aG(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=vc(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:vc(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:vc(e[0],`
88
+ `)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=vc(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=rG(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),A=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 P=o.split(`
103
+ `,1)[0],V;if(p=P,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),V=p):V=p.replace(this.rules.other.tabCharGlobal," "),A.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||A.test(g)||I.test(g)||y.test(g))break;f+=`
105
+ `+p}C=!p.trim(),u+=P+`
106
+ `,o=o.substring(P.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=y2(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:vc(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=E2(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:vc(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(E2(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:vc(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=vc(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=oG(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)),w2(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 w2(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}}}},xa=class xw{constructor(e){Un(this,"tokens");Un(this,"options");Un(this,"state");Un(this,"inlineQueue");Un(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||bh,this.options.tokenizer=this.options.tokenizer||new Xm,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:$o,block:Yx.normal,inline:Q0.normal};this.options.pedantic?(t.block=Yx.pedantic,t.inline=Q0.pedantic):this.options.gfm&&(t.block=Yx.gfm,this.options.breaks?t.inline=Q0.breaks:t.inline=Q0.gfm),this.tokenizer.rules=t}static get rules(){return{block:Yx,inline:Q0}}static lex(e,t){return new xw(t).lex(e)}static lexInline(e,t){return new xw(t).inlineTokens(e)}lex(e){e=e.replace($o.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($o.tabCharGlobal," ").replace($o.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,A=e.slice(1),I;this.options.extensions.startInline.forEach(M=>{I=M.call({lexer:this},A),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)}},Ym=class{constructor(o){Un(this,"options");Un(this,"parser");this.options=o||bh}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match($o.notSpaceStart))==null?void 0:s[0],n=o.replace($o.endingNewline,"")+`
126
+ `;return i?'<pre><code class="language-'+za(i)+'">'+(t?n:za(n,!0))+`</code></pre>
127
+ `:"<pre><code>"+(t?n:za(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>${za(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=C2(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+za(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=C2(o);if(n===null)return za(t);o=n;let s=`<img src="${o}" alt="${za(t)}"`;return e&&(s+=` title="${za(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:za(o.text)}},_S=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}},va=class vw{constructor(e){Un(this,"options");Un(this,"renderer");Un(this,"textRenderer");this.options=e||bh,this.options.renderer=this.options.renderer||new Ym,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _S}static parse(e,t){return new vw(t).parse(e)}static parseInline(e,t){return new vw(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}},ev,pg=(ev=class{constructor(o){Un(this,"options");Un(this,"block");this.options=o||bh}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?xa.lex:xa.lexInline}provideParser(o=this.block){return o?va.parse:va.parseInline}},Un(ev,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Un(ev,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ev),lG=class{constructor(...o){Un(this,"defaults",uS());Un(this,"options",this.setOptions);Un(this,"parse",this.parseMarkdown(!0));Un(this,"parseInline",this.parseMarkdown(!1));Un(this,"Parser",va);Un(this,"Renderer",Ym);Un(this,"TextRenderer",_S);Un(this,"Lexer",xa);Un(this,"Tokenizer",Xm);Un(this,"Hooks",pg);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 Ym(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 Xm(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 pg;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];pg.passThroughHooks.has(s)?n[r]=u=>{if(this.defaults.async&&pg.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 xa.lex(o,e??this.defaults)}parser(o,e){return va.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?xa.lex:xa.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?va.parse:va.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?xa.lex:xa.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?va.parse:va.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>"+za(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},ah=new lG;function ys(o,e){return ah.parse(o,e)}ys.options=ys.setOptions=function(o){return ah.setOptions(o),ys.defaults=ah.defaults,RF(ys.defaults),ys};ys.getDefaults=uS;ys.defaults=bh;ys.use=function(...o){return ah.use(...o),ys.defaults=ah.defaults,RF(ys.defaults),ys};ys.walkTokens=function(o,e){return ah.walkTokens(o,e)};ys.parseInline=ah.parseInline;ys.Parser=va;ys.parser=va.parse;ys.Renderer=Ym;ys.TextRenderer=_S;ys.Lexer=xa;ys.lexer=xa.lex;ys.Tokenizer=Xm;ys.Hooks=pg;ys.parse=ys;ys.options;ys.setOptions;ys.use;ys.walkTokens;ys.parseInline;va.parse;xa.lex;var cG=F('<span class="chat-model svelte-10ayso4"><!></span>'),dG=F('<button class="clear-btn svelte-10ayso4" title="New conversation">+</button>'),uG=F('<p class="history-empty svelte-10ayso4">No saved conversations.</p>'),hG=F('<li><button class="history-load svelte-10ayso4"> </button> <button class="history-del svelte-10ayso4" title="Delete">✕</button></li>'),fG=F('<ul class="history-list svelte-10ayso4"></ul>'),gG=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>'),pG=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>'),xG=F('Chatting in context of <code class="svelte-10ayso4"> </code>',1),vG=F('<button class="chip svelte-10ayso4"> </button>'),mG=F('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),_G=F('<div class="msg-content user-text svelte-10ayso4"> </div>'),S2=F('<span class="tool-args svelte-10ayso4"> </span>'),D2=F('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),A2=F('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),k2=F('<div class="tool-events svelte-10ayso4"></div>'),B2=F('<div class="text-block svelte-10ayso4"></div>'),bG=F('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),CG=F('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),EG=F('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),yG=F('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),wG=F('<button class="expand-btn svelte-10ayso4"> </button>'),SG=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>'),DG=F('<!> <div class="msg-content svelte-10ayso4"></div>',1),AG=F("<div><!></div>"),kG=F('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),BG=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>'),FG=F('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),LG=F('<div class="chat-error svelte-10ayso4"> </div>'),IG=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>'),PG=F('<span><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4"> </button></span>'),TG=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>'),MG=F('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),RG=F('<button class="send-btn svelte-10ayso4">↑</button>'),NG=F('<option class="svelte-10ayso4"> </option>'),OG=F('<select class="model-select svelte-10ayso4"></select>'),HG=F('<span class="model-name svelte-10ayso4"> </span>'),WG=F('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),zG=F('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),VG=F('<p class="info-status svelte-10ayso4">Loading…</p>'),jG=F('<p class="info-status info-err svelte-10ayso4"> </p>'),$G=F('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),UG=F('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),qG=F('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),GG=F('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),KG=F('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),ZG=F('<div class="running-model svelte-10ayso4"> </div>'),XG=F('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),YG=F('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),QG=F('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),JG=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>'),eK=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 tK(o,e){Zs(e,!0),Km.registerLanguage("javascript",MF),ys.use({breaks:!0,gfm:!0});let t=Ku(e,"currentScript",3,null),i=Ku(e,"extraFiles",31,()=>_i([])),n=B(_i([])),s=B(null),r=B(""),a=B(!1),d=B(""),u=B(null);const f="she:conversationId";function g(){return crypto.randomUUID().replace(/-/g,"").slice(0,16)}let p=B(_i(localStorage.getItem(f)??g())),C=B(_i([])),b=B(!1);us(()=>{localStorage.setItem(f,l(p))});let E=B(_i([])),y=B(_i(localStorage.getItem("she:selectedModel")??"")),A=B(null);const I=At(()=>{var ee;return l(A)!==null&&((ee=t())==null?void 0:ee.path)===l(A)});let M=B(_i(new Set)),R=B(!1),P=B(null),V=B(!1),U=B(""),J=B(0),re=null,ae=B(0);const ie=["[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 ve=B(!0),Se=B(!0),Q=B(!0),he=B(!1),De,Fe=B(_i([])),ge,Ne;const Oe=At(()=>({apiref:l(ve),tools:l(Se)})),pe=At(()=>{var ee;return((ee=l(u))==null?void 0:ee.configured)??!1}),lt=At(()=>{var ee;return l(pe)||!!((ee=l(u))!=null&&ee.provider)&&!!l(y)}),Ot=At(()=>l(J)+new TextEncoder().encode(l(r)).length),Xe=At(()=>l(Q)?t():null);us(()=>{var de;const ee=(de=t())==null?void 0:de.path;x(Q,!0),l(A)!==null&&ee!==l(A)&&x(A,null)}),us(()=>{var Ft;if(!l(I))return;const ee=l(n).at(-1);if(!ee||ee.role!=="assistant")return;const $e=me(ee.content).find(je=>je.type==="code"&&Ct(je.lang));if($e){const je=ai($e.text);(Ft=e.onApply)==null||Ft.call(e,je?je.code:$e.text)}});async function ht(){try{const ee=await wF();x(u,ee,!0),ee.configured&&!l(y)&&x(y,ee.model,!0)}catch{}}us(()=>(window.addEventListener("she:config-changed",ht),()=>window.removeEventListener("she:config-changed",ht))),us(()=>{l(y)&&localStorage.setItem("she:selectedModel",l(y))}),us(()=>{var ee;(ee=l(u))!=null&&ee.provider&&SF().then(de=>{x(E,de.models,!0),!l(y)&&de.models.length>0&&x(y,de.models[0],!0)}).catch(()=>{})}),us(()=>{l(y),x(P,null),x(U,"")}),us(()=>{var de,$e;if(((de=l(u))==null?void 0:de.provider)!=="ollama")return;const ee=l(y)||(($e=l(u))==null?void 0:$e.model);!ee||l(P)||fw(ee).then(Ft=>{x(P,Ft,!0)}).catch(()=>{})}),us(()=>{if(!l(a))return;x(ae,Math.floor(Math.random()*ie.length),!0);const ee=setInterval(()=>{x(ae,(l(ae)+1)%ie.length)},1e4);return()=>clearInterval(ee)}),us(()=>{var ee;Ne&&(l(n).length+(((ee=l(s))==null?void 0:ee.length)??0),requestAnimationFrame(()=>{Ne&&(Ne.scrollTop=Ne.scrollHeight)}))}),us(()=>{const ee=l(Oe),de=l(Xe),$e=i();l(lt)&&DF({context:ee,currentScript:de??null,extraFiles:$e.length>0?$e:void 0}).then(Ft=>{x(J,new TextEncoder().encode(Ft.prompt).length,!0)}).catch(()=>{})});function me(ee){const de=ee.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
145
+ $2
146
+ `),$e=[],Ft=/```(\w*)\n([\s\S]*?)```/g;let je=0,ze;for(;(ze=Ft.exec(de))!==null;)ze.index>je&&$e.push({type:"text",text:de.slice(je,ze.index)}),$e.push({type:"code",lang:ze[1]||"text",text:ze[2].trimEnd()}),je=ze.index+ze[0].length;return je<de.length&&$e.push({type:"text",text:de.slice(je)}),$e}const Be=15;function st(ee){return ee.split(`
147
+ `).length>Be}function vt(ee){const de=new Set(l(M));de.has(ee)?de.delete(ee):de.add(ee),x(M,de,!0)}function rt(ee,de){if(Ct(de))try{return Km.highlight(ee,{language:"javascript"}).value}catch{}return ee.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wt(ee){return ys.parse(ee)}function ui(ee){const de=ee.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
148
+ $2
149
+ `),$e=[],Ft=/```(\w*)\n([\s\S]*?)```/g;let je=0,ze;for(;(ze=Ft.exec(de))!==null;)ze.index>je&&$e.push({type:"text",text:de.slice(je,ze.index)}),$e.push({type:"code",lang:ze[1]||"text",text:ze[2].trimEnd()}),je=ze.index+ze[0].length;const kt=de.slice(je),ct=kt.match(/```(\w*)\n([\s\S]*)$/);return ct?(ct.index>0&&$e.push({type:"text",text:kt.slice(0,ct.index)}),$e.push({type:"code",lang:ct[1]||"text",text:ct[2]})):kt&&$e.push({type:"text",text:kt}),$e}function ci(ee){navigator.clipboard.writeText(ee).catch(()=>{})}function hi(ee,de=!1){var $e;de&&t()&&x(A,t().path,!0),($e=e.onApply)==null||$e.call(e,ee)}function Ct(ee){return!ee||ee==="js"||ee==="javascript"}function ai(ee){const de=ee.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return de?{filename:de[1],code:ee.slice(de[0].length)}:null}function Re(ee){return ee>=1e9?`${(ee/1e9).toFixed(1)} GB`:ee>=1e6?`${(ee/1e6).toFixed(0)} MB`:ee>=1024?`${(ee/1024).toFixed(1)} kB`:`${ee} B`}async function Ee(){if(x(R,!0),!(l(P)||l(V))){x(V,!0),x(U,"");try{x(P,await fw(l(y)||l(u).model),!0)}catch(ee){x(U,ee.message,!0)}x(V,!1)}}function zt(ee){const de=ee.match(/\.([^.]+)$/);return de?de[1].toUpperCase():"?"}function ii(ee){switch(ee){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return ee}}function Vt(ee){i(i().filter((de,$e)=>$e!==ee))}function Ai(){De.click()}async function Fi(ee){if(!(!ee||ee.length===0))for(const de of Array.from(ee)){const $e=await de.text();i([...i(),{name:de.name,content:$e}])}}function mi(ee){const de=ee.target;Fi(de.files),de.value=""}function ln(ee){var de;ee.preventDefault(),x(he,!1),Fi(((de=ee.dataTransfer)==null?void 0:de.files)??null)}function sn(ee){var de;(de=ee.dataTransfer)!=null&&de.types.includes("Files")&&(ee.preventDefault(),x(he,!0))}function dn(){x(he,!1)}async function bn(){try{x(C,await fU(),!0)}catch{}}async function ft(){var de;if(l(n).length===0)return;const ee=((de=l(n).find($e=>$e.role==="user"))==null?void 0:de.content.slice(0,80))??l(p);try{await gU(l(p),ee,l(n)),await bn()}catch{}}async function qt(ee){try{const de=await u2(ee);x(n,de.messages,!0),x(p,ee,!0),x(b,!1),x(d,"")}catch{}}async function Ti(ee){try{await pU(ee),await bn(),ee===l(p)&&ki()}catch{}}function ki(){x(n,[],!0),x(d,""),x(p,g(),!0),x(b,!1)}oo(async()=>{ht();try{const ee=await u2(l(p));x(n,ee.messages,!0)}catch{}await bn()});async function bi(){const ee=l(r).trim();if(!ee||l(a))return;x(r,""),x(d,""),x(a,!0);const de={role:"user",content:ee};x(n,[...l(n),de],!0),re=new AbortController,x(Fe,[],!0);try{await AF({messages:l(n),currentScript:l(Xe),context:l(Oe),modelOverride:l(y)||void 0,extraFiles:i().length>0?i():void 0},$e=>{x(s,(l(s)??"")+$e)},re.signal,$e=>{x(Fe,[...l(Fe),$e],!0)}),x(n,[...l(n),{role:"assistant",content:l(s)??"",toolEvents:l(Fe).length>0?[...l(Fe)]:void 0}],!0),x(Fe,[],!0)}catch($e){if($e.name==="AbortError"){const Ft=l(s);Ft&&Ft.trim()&&x(n,[...l(n),{role:"assistant",content:Ft+`
150
+
151
+ *[stopped]*`,toolEvents:l(Fe).length>0?[...l(Fe)]:void 0}],!0)}else x(d,$e.message,!0)}finally{re=null,x(s,null),x(Fe,[],!0),x(a,!1),ft()}}function yn(){re==null||re.abort()}function mn(ee){ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),bi())}function _n(){ki()}const qe=["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 Xt(ee){x(r,ee,!0),ge==null||ge.focus()}var yi=eK(),Ut=dt(yi),Li=m(Ut),qi=v(m(Li),2);{var Gi=ee=>{var de=cG(),$e=m(de);{var Ft=kt=>{var ct=Co();z(()=>N(ct,`${l(u).provider??""} · ${(l(y)||l(u).model)??""}`)),D(kt,ct)},je=kt=>{var ct=Co();z(()=>N(ct,`${l(u).provider??""} · pick a model below`)),D(kt,ct)},ze=kt=>{var ct=Co("Not configured");D(kt,ct)};O($e,kt=>{l(lt)?kt(Ft):l(u).provider?kt(je,1):kt(ze,-1)})}z(()=>gn(de,"title",`Provider: ${l(u).provider??""}`)),D(ee,de)};O(qi,ee=>{l(u)&&ee(Gi)})}var K=v(qi,2);let Ae;var ot=v(K,2);{var Ge=ee=>{var de=dG();j("click",de,_n),D(ee,de)};O(ot,ee=>{l(n).length>0&&ee(Ge)})}var Pt=v(Li,2);{var Yt=ee=>{var de=gG(),$e=m(de),Ft=v(m($e),2),je=v($e,2);{var ze=ct=>{var Qe=uG();D(ct,Qe)},kt=ct=>{var Qe=fG();ti(Qe,21,()=>l(C),mt=>mt.id,(mt,_t)=>{var tt=hG();let Bt;var ei=m(tt),Mt=m(ei),Kt=v(ei,2);z(()=>{Bt=Dt(tt,1,"history-item svelte-10ayso4",null,Bt,{"history-active":l(_t).id===l(p)}),gn(ei,"title",l(_t).id),N(Mt,l(_t).title||l(_t).id)}),j("click",ei,()=>qt(l(_t).id)),j("click",Kt,()=>Ti(l(_t).id)),D(mt,tt)}),D(ct,Qe)};O(je,ct=>{l(C).length===0?ct(ze):ct(kt,-1)})}j("click",Ft,ki),D(ee,de)};O(Pt,ee=>{l(b)&&ee(Yt)})}var gt=v(Pt,2),et=m(gt);{var X=ee=>{var de=pG();D(ee,de)},Pe=ee=>{var de=mG(),$e=m(de),Ft=m($e);{var je=ct=>{var Qe=xG(),mt=v(dt(Qe)),_t=m(mt);z(tt=>N(_t,tt),[()=>t().path.split("/").pop()]),D(ct,Qe)},ze=ct=>{var Qe=Co("No script open. Ask a general she scripting question.");D(ct,Qe)};O(Ft,ct=>{t()?ct(je):ct(ze,-1)})}var kt=v($e,2);ti(kt,17,()=>qe,zi,(ct,Qe)=>{var mt=vG(),_t=m(mt);z(()=>N(_t,l(Qe))),j("click",mt,()=>Xt(l(Qe))),D(ct,mt)}),D(ee,de)};O(et,ee=>{l(pe)?l(n).length===0&&l(s)===null&&ee(Pe,1):ee(X)})}var ce=v(et,2);ti(ce,17,()=>l(n),zi,(ee,de,$e)=>{var Ft=AG(),je=m(Ft);{var ze=ct=>{var Qe=_G(),mt=m(Qe);z(()=>N(mt,l(de).content)),D(ct,Qe)},kt=ct=>{const Qe=At(()=>me(l(de).content));var mt=DG(),_t=dt(mt);{var tt=ei=>{var Mt=k2();ti(Mt,21,()=>l(de).toolEvents,zi,(Kt,Ze)=>{var Et=Us(),Zt=dt(Et);{var ji=$t=>{var wi=D2(),Xi=v(m(wi),2),$i=m(Xi),Hi=v(Xi,2);{var we=ut=>{var Lt=S2(),Rt=m(Lt);z(si=>N(Rt,si),[()=>Object.entries(l(Ze).args).map(([si,ri])=>`${si}=${JSON.stringify(ri)}`).join(", ")]),D(ut,Lt)},it=At(()=>l(Ze).args&&Object.keys(l(Ze).args).length>0);O(Hi,ut=>{l(it)&&ut(we)})}z(ut=>N($i,ut),[()=>l(Ze).name.replace(/_/g," ")]),D($t,wi)},Wt=$t=>{var wi=A2(),Xi=v(m(wi),2),$i=m(Xi);z(Hi=>N($i,Hi),[()=>l(Ze).name.replace(/_/g," ")]),D($t,wi)};O(Zt,$t=>{l(Ze).type==="tool_call"?$t(ji):$t(Wt,-1)})}D(Kt,Et)}),D(ei,Mt)};O(_t,ei=>{var Mt;(Mt=l(de).toolEvents)!=null&&Mt.length&&ei(tt)})}var Bt=v(_t,2);ti(Bt,21,()=>l(Qe),zi,(ei,Mt,Kt)=>{var Ze=Us(),Et=dt(Ze);{var Zt=Wt=>{var $t=B2();Fc($t,()=>wt(l(Mt).text),!0),D(Wt,$t)},ji=Wt=>{const $t=At(()=>Ct(l(Mt).lang)?ai(l(Mt).text):null),wi=At(()=>l($t)?l($t).code:l(Mt).text),Xi=At(()=>`${$e}:${Kt}`),$i=At(()=>st(l(wi))),Hi=At(()=>l(M).has(l(Xi)));var we=SG(),it=m(we),ut=m(it),Lt=m(ut),Rt=v(ut,2),si=m(Rt),ri=v(si,2);{var Ri=Vi=>{var nn=bG();j("click",nn,()=>e.onCreateFile(l($t).filename,l($t).code)),D(Vi,nn)},tn=Vi=>{var nn=yG(),Mn=dt(nn),Cs=v(Mn,2);{var Fn=as=>{var Es=CG();D(as,Es)},zn=as=>{var Es=EG();j("click",Es,()=>hi(l(Mt).text,!0)),D(as,Es)};O(Cs,as=>{l(I)?as(Fn):as(zn,-1)})}j("click",Mn,()=>hi(l(Mt).text)),D(Vi,nn)},on=At(()=>Ct(l(Mt).lang)&&t());O(ri,Vi=>{l($t)&&e.onCreateFile?Vi(Ri):l(on)&&Vi(tn,1)})}var en=v(it,2);let pn;var wn=m(en),Ni=m(wn);Fc(Ni,()=>rt(l(wi),l(Mt).lang??""),!0);var Rn=v(wn,2);{var Ki=Vi=>{var nn=wG(),Mn=m(nn);z(()=>N(Mn,l(Hi)?"▲ collapse":"▼ expand")),j("click",nn,()=>vt(l(Xi))),D(Vi,nn)};O(Rn,Vi=>{l($i)&&Vi(Ki)})}z(()=>{N(Lt,l($t)?`new: ${l($t).filename}`:l(Mt).lang),pn=Dt(en,1,"code-body svelte-10ayso4",null,pn,{collapsed:l($i)&&!l(Hi)})}),j("click",si,()=>ci(l(wi))),D(Wt,we)};O(Et,Wt=>{l(Mt).type==="text"?Wt(Zt):Wt(ji,-1)})}D(ei,Ze)}),D(ct,mt)};O(je,ct=>{l(de).role==="user"?ct(ze):ct(kt,-1)})}z(()=>Dt(Ft,1,`message ${l(de).role??""}`,"svelte-10ayso4")),D(ee,Ft)});var fe=v(ce,2);{var Gt=ee=>{var de=k2();ti(de,21,()=>l(Fe),zi,($e,Ft)=>{var je=Us(),ze=dt(je);{var kt=Qe=>{var mt=D2(),_t=v(m(mt),2),tt=m(_t),Bt=v(_t,2);{var ei=Kt=>{var Ze=S2(),Et=m(Ze);z(Zt=>N(Et,Zt),[()=>Object.entries(l(Ft).args).map(([Zt,ji])=>`${Zt}=${JSON.stringify(ji)}`).join(", ")]),D(Kt,Ze)},Mt=At(()=>l(Ft).args&&Object.keys(l(Ft).args).length>0);O(Bt,Kt=>{l(Mt)&&Kt(ei)})}z(Kt=>N(tt,Kt),[()=>l(Ft).name.replace(/_/g," ")]),D(Qe,mt)},ct=Qe=>{var mt=A2(),_t=v(m(mt),2),tt=m(_t);z(Bt=>N(tt,Bt),[()=>l(Ft).name.replace(/_/g," ")]),D(Qe,mt)};O(ze,Qe=>{l(Ft).type==="tool_call"?Qe(kt):Qe(ct,-1)})}D($e,je)}),D(ee,de)};O(fe,ee=>{l(Fe).length>0&&ee(Gt)})}var ni=v(fe,2);{var gi=ee=>{var de=kG(),$e=m(de),Ft=m($e),je=m(Ft);z(()=>N(je,ie[l(ae)])),D(ee,de)};O(ni,ee=>{l(a)&&l(s)===null&&l(Fe).length===0&&ee(gi)})}var fi=v(ni,2);{var Ii=ee=>{var de=FG(),$e=m(de);ti($e,21,()=>ui(l(s)),zi,(Ft,je)=>{var ze=Us(),kt=dt(ze);{var ct=mt=>{var _t=B2();Fc(_t,()=>wt(l(je).text),!0),D(mt,_t)},Qe=mt=>{var _t=BG(),tt=m(_t),Bt=m(tt),ei=m(Bt),Mt=v(tt,2),Kt=m(Mt);Fc(Kt,()=>rt(l(je).text,l(je).lang??""),!0),z(()=>N(ei,l(je).lang)),D(mt,_t)};O(kt,mt=>{l(je).type==="text"?mt(ct):mt(Qe,-1)})}D(Ft,ze)}),D(ee,de)};O(fi,ee=>{l(s)!==null&&ee(Ii)})}ks(gt,ee=>Ne=ee,()=>Ne);var pi=v(gt,2);{var Ci=ee=>{var de=LG(),$e=m(de);z(()=>N($e,l(d))),D(ee,de)};O(pi,ee=>{l(d)&&ee(Ci)})}var He=v(pi,2),Ye=m(He),jt=m(Ye),Qt=v(Ye,2),Mi=m(Qt),oi=v(Qt,2),$=m(oi),ue=v($);{var Ce=ee=>{const de=At(()=>Math.min(100,Math.round(l(Ot)/4/l(P).contextLength*100)));var $e=IG(),Ft=m($e),je=v(m(Ft));z((ze,kt)=>{gn($e,"title",`~${l(de)??""}% of ${ze??""} token context window used`),gn(je,"stroke",l(de)>80?"var(--fg-err)":l(de)>50?"var(--fg-warn)":"var(--fg-ok)"),gn(je,"stroke-dasharray",`${kt??""} 31.4`)},[()=>l(P).contextLength.toLocaleString(),()=>(l(de)/100*31.4).toFixed(1)]),D(ee,$e)};O(ue,ee=>{var de;(de=l(P))!=null&&de.contextLength&&ee(Ce)})}var _e=v(He,2),Je=m(_e);{var Ve=ee=>{const de=At(()=>zt(t().path.split("/").pop()??t().path));var $e=PG();let Ft;var je=m($e),ze=m(je),kt=v(je,2),ct=m(kt),Qe=v(kt,2),mt=m(Qe);z((_t,tt)=>{Ft=Dt($e,1,"file-chip svelte-10ayso4",null,Ft,{inactive:!l(Q)}),Dt(je,1,`badge badge-${_t??""}`,"svelte-10ayso4"),N(ze,tt),N(ct,t().path),gn(Qe,"title",l(Q)?"Remove from context":"Re-add to context"),N(mt,l(Q)?"×":"+")},[()=>l(de).toLowerCase(),()=>ii(l(de))]),j("click",Qe,()=>x(Q,!l(Q))),D(ee,$e)};O(Je,ee=>{t()&&ee(Ve)})}var St=v(Je,2);ti(St,17,i,zi,(ee,de,$e)=>{const Ft=At(()=>zt(l(de).name));var je=TG(),ze=m(je),kt=m(ze),ct=v(ze,2),Qe=m(ct),mt=v(ct,2);z((_t,tt)=>{Dt(ze,1,`badge badge-${_t??""}`,"svelte-10ayso4"),N(kt,tt),N(Qe,l(de).name)},[()=>l(Ft).toLowerCase(),()=>ii(l(Ft))]),j("click",mt,()=>Vt($e)),D(ee,je)});var q=v(St,2),T=v(q,2);ks(T,ee=>De=ee,()=>De);var H=v(_e,2);let Y;var ne=m(H);let le;var oe=m(ne);ks(oe,ee=>ge=ee,()=>ge);var ye=v(ne,2);{var We=ee=>{var de=MG();j("click",de,yn),D(ee,de)},be=ee=>{var de=RG();z($e=>de.disabled=$e,[()=>!l(r).trim()||!l(lt)]),j("click",de,bi),D(ee,de)};O(ye,ee=>{l(a)?ee(We):ee(be,-1)})}var Le=v(H,2);{var Me=ee=>{var de=zG(),$e=m(de),Ft=m($e),je=v($e,2);{var ze=mt=>{var _t=OG();ti(_t,21,()=>l(E),zi,(tt,Bt)=>{var ei=NG(),Mt=m(ei),Kt={};z(()=>{N(Mt,l(Bt)),Kt!==(Kt=l(Bt))&&(ei.value=(ei.__value=l(Bt))??"")}),D(tt,ei)}),z(()=>_t.disabled=l(a)),$s(_t,()=>l(y),tt=>x(y,tt)),D(mt,_t)},kt=mt=>{var _t=HG(),tt=m(_t);z(()=>N(tt,l(y)||l(u).model)),D(mt,_t)};O(je,mt=>{l(E).length>0?mt(ze):mt(kt,-1)})}var ct=v(je,2);{var Qe=mt=>{var _t=WG();j("click",_t,Ee),D(mt,_t)};O(ct,mt=>{l(u).provider==="ollama"&&mt(Qe)})}z(()=>N(Ft,l(u).provider)),D(ee,de)};O(Le,ee=>{var de;(de=l(u))!=null&&de.provider&&(l(pe)||l(E).length>0)&&ee(Me)})}var nt=v(Ut,2);{var Jt=ee=>{var de=JG(),$e=m(de),Ft=m($e),je=m(Ft),ze=m(je),kt=v(je,2),ct=v(Ft,2),Qe=m(ct);{var mt=Bt=>{var ei=VG();D(Bt,ei)},_t=Bt=>{var ei=jG(),Mt=m(ei);z(()=>N(Mt,l(U))),D(Bt,ei)},tt=Bt=>{var ei=QG(),Mt=m(ei);{var Kt=it=>{var ut=$G(),Lt=v(dt(ut)),Rt=m(Lt);z(()=>N(Rt,l(P).version)),D(it,ut)};O(Mt,it=>{l(P).version&&it(Kt)})}var Ze=v(Mt,2);{var Et=it=>{var ut=UG(),Lt=v(dt(ut)),Rt=m(Lt);z(()=>N(Rt,l(P).details.family)),D(it,ut)};O(Ze,it=>{var ut;(ut=l(P).details)!=null&&ut.family&&it(Et)})}var Zt=v(Ze,2);{var ji=it=>{var ut=qG(),Lt=v(dt(ut)),Rt=m(Lt);z(()=>N(Rt,l(P).details.parameter_size)),D(it,ut)};O(Zt,it=>{var ut;(ut=l(P).details)!=null&&ut.parameter_size&&it(ji)})}var Wt=v(Zt,2);{var $t=it=>{var ut=GG(),Lt=v(dt(ut)),Rt=m(Lt);z(()=>N(Rt,l(P).details.quantization_level)),D(it,ut)};O(Wt,it=>{var ut;(ut=l(P).details)!=null&&ut.quantization_level&&it($t)})}var wi=v(Wt,2);{var Xi=it=>{var ut=KG(),Lt=v(dt(ut)),Rt=m(Lt);z(()=>N(Rt,l(P).details.format)),D(it,ut)};O(wi,it=>{var ut;(ut=l(P).details)!=null&&ut.format&&it(Xi)})}var $i=v(wi,2);{var Hi=it=>{var ut=XG(),Lt=v(dt(ut),2);ti(Lt,21,()=>l(P).running,zi,(Rt,si)=>{var ri=ZG(),Ri=m(ri);z(tn=>N(Ri,`${l(si).name??""} · ${tn??""} VRAM`),[()=>Re(l(si).size_vram)]),D(Rt,ri)}),D(it,ut)},we=it=>{var ut=YG();D(it,ut)};O($i,it=>{l(P).running&&l(P).running.length>0?it(Hi):l(P).running!==null&&it(we,1)})}D(Bt,ei)};O(Qe,Bt=>{l(V)?Bt(mt):l(U)?Bt(_t,1):l(P)&&Bt(tt,2)})}z(()=>{var Bt;return N(ze,`Ollama · ${(l(y)||((Bt=l(u))==null?void 0:Bt.model))??""}`)}),j("click",de,()=>x(R,!1)),j("click",$e,Bt=>Bt.stopPropagation()),j("click",kt,()=>x(R,!1)),D(ee,de)};O(nt,ee=>{l(R)&&ee(Jt)})}z(ee=>{Ae=Dt(K,1,"icon-hdr-btn svelte-10ayso4",null,Ae,{active:l(b)}),N($,ee),Y=Dt(H,1,"input-row svelte-10ayso4",null,Y,{"drag-over":l(he)}),le=Dt(ne,1,"textarea-wrap svelte-10ayso4",null,le,{loading:l(a)}),gn(oe,"placeholder",l(lt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":l(pe)?"Select a model above to start chatting":"AI not configured"),oe.disabled=l(a)||!l(lt)},[()=>Re(l(Ot))]),j("click",K,()=>x(b,!l(b))),Ms(jt,()=>l(ve),ee=>x(ve,ee)),Ms(Mi,()=>l(Se),ee=>x(Se,ee)),j("click",q,Ai),j("change",T,mi),Ts("dragover",H,sn),Ts("dragleave",H,dn),Ts("drop",H,ln),j("keydown",oe,mn),yt(oe,()=>l(r),ee=>x(r,ee)),D(o,yi),Xs()}lo(["click","change","keydown"]);const iK={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"]},nK={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 mw=[],_w=[],bw=[];const Qm=new Map;let qF=[];const Cw=new Map,Ew=new Map;async function F2(){try{mw=(await yF()).map(e=>e.topic)}catch{}}async function L2(){try{const[o,e]=await Promise.all([bF(),CF()]);_w=o,bw=e}catch{}}async function I2(){try{const o=await oS();qF=o.map(e=>e.nodeId),Cw.clear(),Ew.clear();for(const e of o)e.name&&(Cw.set(e.nodeId,e.name),Ew.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!Qm.has(e.nodeId))try{Qm.set(e.nodeId,await Sv(e.nodeId))}catch{}}))}catch{}}function sK(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=oK(u),g=rK(u);if(f===0)return{type:"matter-nodeId",prefix:g};if(f===1){const p=Kh(u,0);if(p)return{type:"matter-endpointId",nodeId:p}}if(f===2){const p=Kh(u,0),C=P2(u,1)??Kh(u,1);if(p&&C!==null)return{type:"matter-cluster",nodeId:p,endpointId:C}}if(f>=3){const p=Kh(u,0),C=P2(u,1)??Kh(u,1),b=Kh(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 oK(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 rK(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function Kh(o,e){var s;const i=(s=GF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function P2(o,e){var s;const i=(s=GF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function GF(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 lh=Ld.CompletionItemKind;function aK(o,e){return(e?mw.filter(i=>i.startsWith(e)):mw).map(i=>({label:i,kind:lh.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function lK(o,e,t){const i=t?[..._w,...bw]:_w;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:lh.Value,insertText:s,range:o,detail:bw.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function cK(o,e){return qF.map(t=>{const i=Cw.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:lh.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function KF(o){return Ew.get(o)??o}function dK(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 uK(o,e){const t=Qm.get(KF(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:lh.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function hK(o,e,t){const i=Qm.get(KF(e));if(!i)return[];const n=dK(i,t);return n?n.clusters.map(s=>({label:s.name,kind:lh.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function fK(o,e,t){return(t?nK[e]??[]:iK[e]??[]).map(n=>({label:n,kind:t?lh.Function:lh.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let T2=!1;function gK(){T2||(T2=!0,F2(),L2(),I2(),setInterval(F2,15e3),setInterval(L2,1e4),setInterval(I2,6e4),Ld.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=sK(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:aK(a,i.prefix)};case"db":return{suggestions:lK(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:cK(a,i.prefix)};case"matter-endpointId":return{suggestions:uK(a,i.nodeId)};case"matter-cluster":return{suggestions:hK(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:fK(a,i.cluster,i.isSend)};default:return null}}}))}var pK=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),xK=F('<button class="svelte-1pyfjii">Show git history</button>'),vK=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),mK=F('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),_K=F('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),M2=F('<span class="git-mod svelte-1pyfjii" title="Uncommitted changes">M</span>'),bK=F('<ul class="tree-children svelte-1pyfjii"></ul>'),CK=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>'),EK=F('<span class="dirty-dot svelte-1pyfjii">●</span>'),yK=F('<span class="run-dot svelte-1pyfjii" title="Running">●</span>'),wK=F('<span class="err-dot svelte-1pyfjii">●</span>'),SK=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>'),DK=F('<span class="dis-spacer svelte-1pyfjii"></span>'),AK=F('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!><!> <!> <!></button> <!></div></li>'),kK=F('<div class="err svelte-1pyfjii"> </div>'),BK=F('<button title="Case sensitive">Aa</button> <button title="Use regex">.*</button> <button title="Replace">⇄</button>',1),FK=F('<div class="search-input-row svelte-1pyfjii"><input placeholder="Replace with…" class="svelte-1pyfjii"/> <button class="svelte-1pyfjii"> </button></div>'),LK=F('<div class="search-status svelte-1pyfjii">Searching…</div>'),IK=F('<div class="search-status search-err svelte-1pyfjii"> </div>'),PK=F('<div class="search-status svelte-1pyfjii">No results.</div>'),TK=F('<div class="search-status search-trunc svelte-1pyfjii">Showing first 500 matches.</div>'),MK=F('<button class="search-match-row svelte-1pyfjii"><span class="search-lnum svelte-1pyfjii"> </span> <span class="search-preview svelte-1pyfjii"> </span></button>'),RK=F('<div class="search-file-group svelte-1pyfjii"><button class="search-file-btn svelte-1pyfjii"><span class="search-fname svelte-1pyfjii"> </span> <span class="search-fcount svelte-1pyfjii"> </span></button> <!></div>'),$C=F("<!> <!>",1),NK=F('<div class="search-status svelte-1pyfjii">No files found.</div>'),OK=F('<div class="search-status search-trunc svelte-1pyfjii">Showing first 200 results.</div>'),HK=F('<button class="search-match-row search-file-result svelte-1pyfjii"><span class="search-preview svelte-1pyfjii"> </span></button>'),WK=F('<label class="replace-item svelte-1pyfjii"><input type="checkbox" class="svelte-1pyfjii"/> <span class="replace-checkmark svelte-1pyfjii"></span> <span class="replace-item-path svelte-1pyfjii"> </span> <span class="replace-item-n svelte-1pyfjii"> </span></label>'),zK=F('<div class="replace-confirm svelte-1pyfjii"><div class="replace-confirm-hdr svelte-1pyfjii"><span> </span> <div class="replace-confirm-btns svelte-1pyfjii"><button class="svelte-1pyfjii">Apply</button> <button class="svelte-1pyfjii">Cancel</button></div></div> <div class="replace-confirm-list svelte-1pyfjii"></div></div>'),VK=F('<div class="search-panel svelte-1pyfjii"><div class="search-mode-bar svelte-1pyfjii"><button>Text</button> <button>Files</button> <button class="search-close-btn svelte-1pyfjii" title="Close">×</button></div> <div class="search-input-row svelte-1pyfjii"><input class="svelte-1pyfjii"/> <!></div> <!> <div class="search-results svelte-1pyfjii"><!></div> <!></div>'),jK=F('<div class="history-empty svelte-1pyfjii">Loading…</div>'),$K=F('<div class="history-empty svelte-1pyfjii">No commits found.</div>'),UK=F('<button class="history-row svelte-1pyfjii"><span class="history-subject svelte-1pyfjii"> </span> <span class="history-meta svelte-1pyfjii"> </span></button>'),qK=F('<button class="history-load-more svelte-1pyfjii"> </button>'),GK=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>'),KK=F('<span class="tab-dirty svelte-1pyfjii">●</span>'),ZK=F('<div role="tab" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),XK=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>'),YK=F('<li class="changes-item svelte-1pyfjii"><label class="changes-cb-wrap svelte-1pyfjii"><input type="checkbox" class="changes-check svelte-1pyfjii"/> <span class="changes-checkmark svelte-1pyfjii"></span></label> <span class="changes-status svelte-1pyfjii"> </span> <span class="changes-file svelte-1pyfjii"> </span></li>'),QK=F('<div class="changes-err svelte-1pyfjii"> </div>'),JK=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),eZ=F('<div class="changes-wrap svelte-1pyfjii"><button class="git-changes svelte-1pyfjii"> </button> <!></div>'),tZ=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),iZ=F('<div class="changes-wrap svelte-1pyfjii"><button class="git-ahead svelte-1pyfjii"> </button> <!></div>'),nZ=F('<span class="git-behind svelte-1pyfjii"> </span>'),sZ=F('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),oZ=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),rZ=F('<button class="danger svelte-1pyfjii">Delete</button>'),aZ=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#Documentation" target="_blank" rel="noopener" class="svelte-1pyfjii">Documentation</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>`),lZ=F('<button class="svelte-1pyfjii">Always accept in this session</button>'),cZ=F('<button class="svelte-1pyfjii">Disable auto-accept</button>'),dZ=F('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),uZ=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>'),hZ=F('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),fZ=F('<div class="diff-container svelte-1pyfjii"></div>'),gZ=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>'),pZ=F('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),xZ=F('<span class="log-file svelte-1pyfjii"> </span>'),vZ=F("<option> </option>"),mZ=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> <label class="log-filter-autoscroll svelte-1pyfjii"><input type="checkbox" class="svelte-1pyfjii"/> <span class="log-filter-checkmark svelte-1pyfjii"></span> Auto-scroll</label> <button class="log-clear svelte-1pyfjii">Clear</button>',1),_Z=F('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),bZ=F('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),CZ=F('<div class="log-body svelte-1pyfjii"><!> <!></div>'),EZ=F('<div><!> <div class="log-header svelte-1pyfjii"><button class="log-toggle svelte-1pyfjii"> <!></button> <!></div> <!></div>'),yZ=F('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),wZ=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="Find in files / Find files (Ctrl+Shift+F)">&#x2315;</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></div></div>',1);function SZ(o,e){Zs(e,!0);let t=B(_i([])),i=B(_i({})),n=B(null),s=B(null),r=B(null),a=B(null),d=B(_i([])),u=B(null),f=B(!1),g=B(""),p=B(!1),C=B(!0),b=B(null),E=B(!1),y=B(!1),A=B(null),I=B(_i([])),M=B(!1),R=B(30),P=B(void 0),V=null,U=null,J=null,re=B(!1),ae=B(""),ie=B(!1),ve=B(void 0),Se=B(_i(new Set));const Q=new Set;let he=B(_i(new Set)),De=B(_i([])),Fe=B(!1),ge=B("text"),Ne=B(""),Oe=B(!1),pe=B(!1),lt=B(!1),Ot=B(""),Xe=B(_i([])),ht=B(_i([])),me=B(!1),Be=B(!1),st=B(""),vt=B(void 0),rt=B(_i([])),wt=B(!1),ui=B(!1),ci=null,hi=B(void 0),Ct=B(!1),ai=B(!1),Re=null;function Ee(){l(hi)&&(x(Ct,l(hi).scrollLeft>0),x(ai,l(hi).scrollLeft+l(hi).clientWidth<l(hi).scrollWidth-1))}function zt(Z){var xe;(xe=l(hi))==null||xe.scrollBy({left:Z*200,behavior:"smooth"})}function ii(Z="text"){x(Fe,!0),x(ge,Z,!0),kl().then(()=>{var xe;return(xe=l(vt))==null?void 0:xe.focus()})}function Vt(){x(Fe,!1),x(Ne,""),x(Xe,[],!0),x(ht,[],!0),x(me,!1),x(st,""),x(lt,!1),x(wt,!1)}function Ai(){ci&&clearTimeout(ci),ci=setTimeout(Fi,300)}async function Fi(){const Z=l(Ne).trim();if(!Z){x(Xe,[],!0),x(ht,[],!0),x(me,!1),x(st,"");return}x(Be,!0),x(st,"");try{if(l(ge)==="files"){const xe=await o2(Z,{mode:"files"});x(ht,xe.results,!0),x(me,xe.truncated,!0)}else{const xe=await o2(Z,{regex:l(pe),caseSensitive:l(Oe)});x(Xe,xe.results,!0),x(me,xe.truncated,!0)}}catch(xe){x(st,xe.message||"Search failed",!0)}finally{x(Be,!1)}}async function mi(Z,xe){await ct(Z),Ut&&(Ut.revealLineInCenter(xe.line),Ut.setPosition({lineNumber:xe.line,column:xe.col}),Ut.focus())}function ln(Z){return Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function sn(){if(!l(Ne).trim()||!l(Xe).length)return;x(ui,!0);const Z=[],xe="g"+(l(Oe)?"":"i");for(const bt of l(Xe))try{const pt=await Kx(bt.path),at=l(pe)?new RegExp(l(Ne),xe):new RegExp(ln(l(Ne)),xe),Pi=pt.content.replace(at,l(Ot));Pi!==pt.content&&Z.push({path:bt.path,checked:!0,original:pt.content,replaced:Pi,changes:bt.matches.length})}catch{}x(rt,Z,!0),x(ui,!1),x(wt,!0)}async function dn(){for(const Z of l(rt).filter(xe=>xe.checked))try{await xc(Z.path,Z.replaced);const xe=l(d).find(bt=>bt.path===Z.path);xe!=null&&xe.model&&(xe.model.setValue(Z.replaced),xe.savedContent=Z.replaced,xe.dirty=!1)}catch{}x(wt,!1),await Fi()}function bn(Z){Z.ctrlKey&&Z.shiftKey&&Z.key==="F"&&(Z.preventDefault(),l(Fe)&&l(ge)==="text"?Vt():ii("text"))}us(()=>{l(hi)&&(Re==null||Re.disconnect(),Re=new ResizeObserver(Ee),Re.observe(l(hi)),Ee())});let ft=B("all"),qt=B(""),Ti=B(!1),ki=B(!0);const bi=["all","debug","info","warn","error"],yn={debug:0,info:1,warn:2,error:3};function mn(Z){if(l(ft)!=="all"&&yn[Z.level]<yn[l(ft)])return!1;if(!l(qt))return!0;if(l(Ti))try{return new RegExp(l(qt),"i").test(Z.msg)}catch{}return Z.msg.toLowerCase().includes(l(qt).toLowerCase())}let _n=B(null);function qe(Z){const xe=Z.currentTarget.getBoundingClientRect();x(_n,{x:xe.left,y:xe.top},!0)}function Xt(){x(_n,null)}let yi,Ut,Li,qi=!1,Gi=null,K=null,Ae=!1,ot=!1,Ge=B(!1),Pt=B(null),Yt=B(!1),gt=B(!1),et=B(void 0),X=null,Pe=null,ce=null,fe=B(_i(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),Gt=B(_i(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),ni=B(_i(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),gi=B(_i(parseInt(localStorage.getItem("she-scripts-history-height")??"220",10))),fi=!1,Ii=0,pi=0,Ci=!1,He=0,Ye=0,jt=!1,Qt=0,Mi=0,oi=!1,$=0,ue=0;const Ce=At(()=>{var Z;return l(u)&&l(ye)?{path:l(u),content:((Z=l(ye).model)==null?void 0:Z.getValue())??l(ye).savedContent}:null}),_e=At(()=>{var Z;return new Set(((Z=l(b))==null?void 0:Z.changes.map(xe=>xe.file))??[])}),Je=At(()=>{const Z=new Set;for(const xe of l(_e)){const bt=xe.split("/");for(let pt=1;pt<bt.length;pt++)Z.add(bt.slice(0,pt).join("/"))}return Z});let Ve=B(!1),St=B(!1),q=B(""),T=B(!1),H=B(""),Y=B(_i(new Set));async function ne(){var Z;if(!(!l(q).trim()||l(Y).size===0)){x(T,!0),x(H,"");try{const xe=l(b).changes.filter(bt=>l(Y).has(bt.file)).map(bt=>bt.file);if(xe.length===l(b).changes.length?await l2(l(q).trim()):await a2(xe,l(q).trim()),l(y))try{await Xx()}catch{}x(q,""),await _t(),(Z=l(b))!=null&&Z.changes.length?x(Y,new Set(l(b).changes.map(bt=>bt.file)),!0):x(Ve,!1)}catch(xe){x(H,xe.message,!0)}finally{x(T,!1)}}}let le,oe,ye=At(()=>l(d).find(Z=>Z.path===l(u))??null);const We="she-tabs",be="she-active-tab",Le="she-log-open",Me="she-chat-open";let nt=Ku(e,"active",3,!0);us(()=>{ot&&(localStorage.setItem(We,JSON.stringify(l(d).map(Z=>Z.path))),l(u)?localStorage.setItem(be,l(u)):localStorage.removeItem(be))}),us(()=>{ot&&localStorage.setItem(Me,String(l(Ge)))}),us(()=>{nt()&&Ut&&Ut.layout()});const Jt=`
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 ee(Z){l(d).some(xe=>xe.dirty)&&Z.preventDefault()}oo(async()=>{var Ui,un;window.addEventListener("beforeunload",ee),x(C,localStorage.getItem(Le)!=="false"),x(Ge,localStorage.getItem(Me)==="true"),Ld.typescript.javascriptDefaults.addExtraLib(Jt,"she-api.d.ts"),Ld.typescript.javascriptDefaults.setCompilerOptions({target:Ld.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),Ld.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),gK(),Li=dr.createModel("","javascript"),Ut=dr.create(yi,{model:Li,theme:pf(),automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),Ut.addCommand(d1.CtrlCmd|d1.Shift|Nk.KeyF,()=>{l(Fe)&&l(ge)==="text"?Vt():ii("text")}),(Ui=Ut.getDomNode())==null||Ui.addEventListener("keydown",Oi=>{(Oi.ctrlKey||Oi.metaKey)&&Oi.key==="s"&&(Oi.preventDefault(),Bt())}),Ut.onDidChangeModelContent(()=>{if(qi)return;const Oi=l(d).find(rn=>rn.path===l(u));Oi&&(Oi.dirty=Ut.getValue()!==Oi.savedContent),Ki&&clearTimeout(Ki),Ki=setTimeout(Vi,600)}),Gi=lS(Oi=>{const rn=Oi.msg.match(/^([^:\n]+\.js):\s/);if(!rn)return;const an=rn[1];if(Oi.level==="error")Q.add(an),l(Se).has(an)||x(Se,new Set([...l(Se),an]),!0);else if(Q.has(an)){Q.delete(an);const Sn=new Set(l(Se));Sn.delete(an),x(Se,Sn,!0)}const Nn=l(d).find(Sn=>Sn.path===an);Nn&&(Nn.logEntries=[...Nn.logEntries.slice(-199),Oi],Nn.path===l(u)&&l(C)&&l(ve)&&l(ki)&&kl().then(()=>{l(ve)&&(l(ve).scrollTop=l(ve).scrollHeight)}))}),K=mr("script:running",Oi=>{const rn=Oi.path;if(Oi.running)x(he,new Set([...l(he),rn]),!0);else{const an=new Set(l(he));an.delete(rn),x(he,an,!0)}}),await de(),_t();try{const Oi=await Zl();typeof Oi.gitAutoCommit=="boolean"&&x(E,Oi.gitAutoCommit,!0),typeof Oi.gitAutoPush=="boolean"&&x(y,Oi.gitAutoPush,!0)}catch{}try{const Oi=await getDaemonStatus();x(he,new Set(Oi.runningScripts??[]),!0)}catch{}const Z=JSON.parse(localStorage.getItem(We)??"[]"),xe=localStorage.getItem(be);for(const Oi of Z)await kt(Oi,!1);const bt=xe&&l(d).some(Oi=>Oi.path===xe)?xe:((un=l(d)[0])==null?void 0:un.path)??null;bt&&await Qe(bt),ot=!0;const pt=()=>dr.setTheme(pf()),at=window.matchMedia("(prefers-color-scheme: dark)");window.addEventListener("she:theme-changed",pt),at.addEventListener("change",pt);const Pi=Oi=>{var an;const rn=(an=Oi.detail)==null?void 0:an.path;typeof rn=="string"&&rn&&ct(rn)};return window.addEventListener("she:open-script",Pi),()=>{window.removeEventListener("she:theme-changed",pt),at.removeEventListener("change",pt),window.removeEventListener("she:open-script",Pi)}}),B0(()=>{var Z;window.removeEventListener("beforeunload",ee),Re==null||Re.disconnect(),Ki&&clearTimeout(Ki),Gi==null||Gi(),K==null||K();for(const xe of l(d))(Z=xe.model)==null||Z.dispose();Li==null||Li.dispose(),Ut==null||Ut.dispose()});async function de(){try{if(x(t,await Z$(),!0),!Ae){let xe=function(bt){for(const pt of bt)pt.type==="dir"&&(Z[pt.path]=!0,pt.children&&xe(pt.children))};Ae=!0;const Z={};xe(l(t)),x(i,Z,!0)}x(g,"")}catch(Z){x(g,Z.message,!0)}}function $e(Z){l(i)[Z]=!l(i)[Z]}function Ft(Z){switch(Z){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return Z}}async function je(Z,xe){try{xe?await xc(`${Z}/.shelib`,""):await Zx(`${Z}/.shelib`),await de(),await tt("all",xe?`lib ${Z}`:`unlib ${Z}`)}catch(bt){x(g,bt.message,!0)}}async function ze(Z,xe){const bt=Z.split("/").pop(),pt=Z.includes("/")?Z.slice(0,Z.lastIndexOf("/")):"",at=pt?`${pt}/.shedisable-${bt}`:`.shedisable-${bt}`;try{xe?await xc(at,""):await Zx(at),await de(),await tt("all",xe?`disable ${Z}`:`enable ${Z}`)}catch(Pi){x(g,Pi.message,!0)}}async function kt(Z,xe=!0){var bt;if(l(d).some(pt=>pt.path===Z)){xe&&await Qe(Z);return}try{const{content:pt}=await Kx(Z),at=RL.parse(`file:///she-scripts/${encodeURIComponent(Z)}`);(bt=dr.getModel(at))==null||bt.dispose();const Pi=dr.createModel(pt,Rn(Z),at);let Ui=[];try{Ui=(await rS()).filter(Oi=>{const rn=Oi.msg.match(/^([^:\n]+\.js):\s/);return rn&&rn[1]===Z})}catch{}x(d,[...l(d),{path:Z,dirty:!1,savedContent:pt,model:Pi,logEntries:Ui}],!0),xe&&await Qe(Z)}catch(pt){x(g,pt.message,!0)}}async function ct(Z){await kt(Z,!0)}async function Qe(Z){var bt,pt;const xe=l(d).find(at=>at.path===Z);xe!=null&&xe.model&&($t(),x(Pt,null),x(u,Z,!0),qi=!0,Ut.setModel(xe.model),qi=!1,Vi(),await kl(),(pt=(bt=l(hi))==null?void 0:bt.querySelector(`[data-tab-path="${CSS.escape(Z)}"]`))==null||pt.scrollIntoView({inline:"nearest",block:"nearest"}),Ee())}async function mt(Z){var pt;const xe=l(d).find(at=>at.path===Z);if(!xe||xe.dirty&&!await le.show(`Discard unsaved changes to ${Z}?`,{confirm:"Discard"}))return;const bt=l(d).findIndex(at=>at.path===Z);if((pt=xe.model)==null||pt.dispose(),x(d,l(d).filter(at=>at.path!==Z),!0),l(u)===Z){const at=l(d)[bt]??l(d)[bt-1]??null;at?await Qe(at.path):(x(u,null),Ut.setModel(Li))}}async function _t(){try{x(b,await Y$(),!0)}catch{x(b,null)}}async function tt(Z,xe){if(l(b))try{if(Z==="all"?await l2(xe):await a2(Z,xe),l(y))try{await Xx()}catch{}await _t()}catch{}}async function Bt(){if(!l(u))return;const Z=l(d).find(xe=>xe.path===l(u));if(Z){x(f,!0);try{const xe=Ut.getValue();await xc(l(u),xe),Z.savedContent=xe,Z.dirty=!1,x(g,""),l(E)?await tt([l(u)],`update ${l(u)}`):_t()}catch(xe){x(g,xe.message,!0)}finally{x(f,!1)}}}async function ei(){if(!l(u)||(await Bt(),l(g)))return;const Z=await oe.show("Commit message:",{initial:`update ${l(u)}`,placeholder:"Update script",confirm:"Commit"});if(Z)try{if(await eU(l(u),Z),l(y))try{await Xx()}catch{}_t()}catch(xe){x(g,"Git: "+xe.message)}}async function Mt(){x(p,!1);try{await Xx(),await _t(),x(g,"")}catch(Z){x(g,"Git push: "+Z.message)}}function Kt(Z){const xe=Date.now()-new Date(Z).getTime(),bt=Math.floor(xe/1e3);if(bt<60)return"just now";const pt=Math.floor(bt/60);if(pt<60)return`${pt}m ago`;const at=Math.floor(pt/60);if(at<24)return`${at}h ago`;const Pi=Math.floor(at/24);if(Pi<30)return`${Pi}d ago`;const Ui=Math.floor(Pi/30);return Ui<12?`${Ui}mo ago`:`${Math.floor(Ui/12)}y ago`}async function Ze(Z){Hi(),x(A,Z,!0),x(I,[],!0),x(R,30),await Et()}async function Et(){if(l(A)){x(M,!0);try{x(I,await tU(l(A).path,l(R)),!0)}catch{}finally{x(M,!1)}}}async function Zt(){x(R,l(R)+30),await Et()}function ji(){x(A,null),x(I,[],!0),$t()}async function Wt(Z){if(!l(A))return;$t(),await ct(l(A).path);let xe;try{xe=await iU(Z.hash,l(A).path)}catch{return}if(x(ae,Z.hash,!0),x(ie,xe.binary,!0),x(re,!0),xe.binary||xe.content===null)return;let bt="";const pt=l(d).find(Pi=>Pi.path===l(A).path);if(pt!=null&&pt.model)bt=pt.model.getValue();else try{bt=(await Kx(l(A).path)).content}catch{}if(await kl(),!l(P))return;const at=Rn(l(A).path);U=dr.createModel(xe.content,at),J=dr.createModel(bt,at),V=dr.createDiffEditor(l(P),{theme:pf(),readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),V.setModel({original:U,modified:J})}function $t(){x(re,!1),x(ie,!1),V==null||V.dispose(),V=null,U==null||U.dispose(),U=null,J==null||J.dispose(),J=null}async function wi(){const Z=l(n)?`${l(n)}/`:"",xe=await oe.show("New script name:",{placeholder:Z?`${Z}myscript.js`:"myscript.js",initial:Z,confirm:"Create"});if(!xe)return;const bt=xe.endsWith(".js")?`/* global she */
217
+ 'use strict';
218
+
219
+ `:"";await xc(xe,bt),await de(),await kt(xe,!0)}async function Xi(){const Z=l(n)?`${l(n)}/`:"",xe=await oe.show("New folder name:",{placeholder:Z?`${Z}subfolder`:"myfolder",initial:Z,confirm:"Create"});xe&&(await X$(xe),l(i)[xe]=!0,await de())}function $i(Z,xe){Z.preventDefault();const bt=180,pt=200,at=Math.min(Z.clientX,window.innerWidth-bt),Pi=Math.min(Z.clientY,window.innerHeight-pt);x(s,{x:at,y:Pi,entry:xe},!0)}function Hi(){x(s,null)}async function we(Z){Hi(),x(n,Z,!0),l(i)[Z]=!0,await wi()}async function it(Z){Hi(),x(n,Z,!0),await Xi()}async function ut(Z){Hi();const xe=Z.path.includes("/")?Z.path.slice(0,Z.path.lastIndexOf("/")+1):"",bt=await oe.show(Z.type==="dir"?"Rename folder:":"Rename script:",{initial:Z.name,placeholder:Z.name,confirm:"Rename"});if(!bt||bt===Z.name)return;const pt=xe+bt;try{await r2(Z.path,pt);const at=l(d).find(Pi=>Pi.path===Z.path);at&&(at.path=pt,l(u)===Z.path&&x(u,pt)),await de(),await tt("all",`rename ${Z.path} → ${pt}`)}catch(at){x(g,at.message,!0)}}function Lt(Z){if(!Z.children)return 0;let xe=0;for(const bt of Z.children)xe++,bt.type==="dir"&&(xe+=Lt(bt));return xe}async function Rt(Z){Hi();let xe=`Delete ${Z.type==="dir"?"folder":"file"} "${Z.path}"?`;if(Z.type==="dir"){const bt=Lt(Z);bt>0&&(xe+=` This will also delete ${bt} item${bt===1?"":"s"} inside.`)}if(await le.show(xe,{confirm:"Delete",danger:!0})){if(Z.type==="dir")for(const bt of[...l(d)])bt.path.startsWith(Z.path+"/")&&await mt(bt.path);else await mt(Z.path);await Zx(Z.path),await de(),await tt("all",`delete ${Z.path}`)}}async function si(Z){Hi();const{content:xe}=await Kx(Z.path);l(De).some(bt=>bt.name===Z.path)||x(De,[...l(De),{name:Z.path,content:xe}],!0),x(Ge,!0)}function ri(Z,xe){var bt;x(r,xe,!0),(bt=Z.dataTransfer)==null||bt.setData("text/plain",xe)}function Ri(Z,xe){if(Z.preventDefault(),l(r)&&(l(r)===xe||xe.startsWith(l(r)+"/"))){Z.dataTransfer&&(Z.dataTransfer.dropEffect="none"),x(a,null);return}Z.dataTransfer&&(Z.dataTransfer.dropEffect="move"),x(a,xe,!0)}function tn(){x(a,null)}async function on(Z,xe){var Ui,un,Oi;Z.preventDefault(),x(a,null);const bt=Array.from(((Ui=Z.dataTransfer)==null?void 0:Ui.items)??[]).filter(rn=>rn.kind==="file");if(bt.length>0&&!l(r)){for(const rn of bt){const an=(un=rn.webkitGetAsEntry)==null?void 0:un.call(rn);an&&await en(an,xe,!0)}await de();return}const pt=l(r)??((Oi=Z.dataTransfer)==null?void 0:Oi.getData("text/plain"));if(x(r,null),!pt||pt===xe||xe.startsWith(pt+"/"))return;const at=pt.split("/").pop(),Pi=xe?`${xe}/${at}`:at;if(Pi!==pt)try{await r2(pt,Pi);for(const rn of l(d))if(rn.path===pt)l(u)===pt&&x(u,Pi,!0),rn.path=Pi;else if(rn.path.startsWith(pt+"/")){const an=Pi+rn.path.slice(pt.length);l(u)===rn.path&&x(u,an),rn.path=an}await de(),await tt("all",`rename ${pt} → ${Pi}`)}catch(rn){x(g,rn.message,!0)}}async function en(Z,xe,bt){if(Z.isFile){const at=await(await new Promise((Ui,un)=>Z.file(Ui,un))).text(),Pi=xe?`${xe}/${Z.name}`:Z.name;await xc(Pi,at),bt&&Z.name.endsWith(".js")&&await ze(Pi,!0)}else if(Z.isDirectory){const pt=Z.createReader();let at=[],Pi;do Pi=await new Promise((Ui,un)=>pt.readEntries(Ui,un)),at=[...at,...Pi];while(Pi.length>0);for(const Ui of at)await en(Ui,xe?`${xe}/${Z.name}`:Z.name,!1);if(bt){const Ui=xe?`${xe}/${Z.name}`:Z.name;await ze(Ui,!0)}}}async function pn(){if(!l(u)||!await le.show(`Delete ${l(u)}?`,{confirm:"Delete",danger:!0}))return;const Z=l(u);await mt(Z),await Zx(Z),await de(),await tt("all",`delete ${Z}`)}function wn(){l(ye)&&(l(ye).logEntries=[])}function Ni(){x(C,!l(C)),localStorage.setItem(Le,String(l(C)))}function Rn(Z){var pt;const xe=((pt=Z.split(".").pop())==null?void 0:pt.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"}[xe]??"plaintext"}let Ki=null;async function Vi(){const Z=l(d).find(bt=>bt.path===l(u));if(!(Z!=null&&Z.model))return;const xe=Z.model;try{const Pi=(await(await(await Ld.typescript.getJavaScriptWorker())(xe.uri)).getSyntacticDiagnostics(xe.uri.toString())).map(Ui=>{const un=xe.getPositionAt(Ui.start??0),Oi=xe.getPositionAt((Ui.start??0)+(Ui.length??0));return{severity:NL.Error,startLineNumber:un.lineNumber,startColumn:un.column,endLineNumber:Oi.lineNumber,endColumn:Oi.column,message:typeof Ui.messageText=="string"?Ui.messageText:JSON.stringify(Ui.messageText),source:"she-syntax"}});if(dr.setModelMarkers(xe,"she-syntax",Pi),l(u)){if(Pi.length>0)Q.add(l(u)),l(Se).has(l(u))||x(Se,new Set([...l(Se),l(u)]),!0);else if(Q.has(l(u))){Q.delete(l(u));const Ui=new Set(l(Se));Ui.delete(l(u)),x(Se,Ui,!0)}}}catch{}}function nn(Z){fi=!0,Ii=Z.clientX,pi=l(fe),Z.preventDefault()}function Mn(Z){Ci=!0,He=Z.clientY,Ye=l(Gt),Z.preventDefault()}function Cs(Z){jt=!0,Qt=Z.clientX,Mi=l(ni),Z.preventDefault()}function Fn(Z){oi=!0,$=Z.clientY,ue=l(gi),Z.preventDefault()}function zn(Z){fi&&x(fe,Math.max(140,Math.min(500,pi+Z.clientX-Ii)),!0),Ci&&x(Gt,Math.max(60,Math.min(500,Ye-(Z.clientY-He))),!0),jt&&x(ni,Math.max(200,Math.min(700,Mi-(Z.clientX-Qt))),!0),oi&&x(gi,Math.max(80,Math.min(600,ue-(Z.clientY-$))),!0)}function as(){fi&&(fi=!1,localStorage.setItem("she-scripts-sidebar-width",String(l(fe)))),Ci&&(Ci=!1,localStorage.setItem("she-scripts-log-height",String(l(Gt)))),jt&&(jt=!1,localStorage.setItem("she-scripts-chat-width",String(l(ni)))),oi&&(oi=!1,localStorage.setItem("she-scripts-history-height",String(l(gi))))}function Es(Z){(Z.ctrlKey||Z.metaKey)&&Z.key==="s"&&(Z.preventDefault(),Bt()),Z.key==="Escape"&&(x(p,!1),x(s,null),x(St,!1))}async function Ns(Z,xe){const bt=await oe.show("Save new script as:",{placeholder:"myscript.js",initial:Z,confirm:"Create"});if(bt)try{await xc(bt,xe),await de(),await kt(bt,!0)}catch(pt){x(g,pt.message,!0)}}async function Cn(Z){var bt,pt;if(l(Yt)&&l(u)){x(Pt,Z,!0),await Kn();return}if(x(Pt,Z,!0),await kl(),!l(et))return;Pe==null||Pe.dispose(),ce==null||ce.dispose(),X==null||X.dispose();const xe=((pt=(bt=l(ye))==null?void 0:bt.model)==null?void 0:pt.getValue())??"";Pe=dr.createModel(xe,"javascript"),ce=dr.createModel(Z,"javascript"),X=dr.createDiffEditor(l(et),{theme:pf(),readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),X.setModel({original:Pe,modified:ce})}us(()=>{l(u),x(Yt,!1),x(gt,!1)});async function Kn(){if(l(Pt)===null||!l(u))return;const Z=l(Pt);x(Pt,null);const xe=l(d).find(bt=>bt.path===l(u));xe!=null&&xe.model&&(qi=!0,xe.model.setValue(Z),qi=!1,xe.dirty=!1,xe.savedContent=Z);try{await xc(l(u),Z),x(g,""),l(E)?await tt([l(u)],`update ${l(u)}`):_t()}catch(bt){x(g,bt.message,!0)}to()}function eo(){x(Pt,null),to()}function to(){X==null||X.dispose(),X=null,Pe==null||Pe.dispose(),Pe=null,ce==null||ce.dispose(),ce=null}var xs=wZ();Ts("keydown",Xd,Es),Ts("mousemove",Xd,zn),Ts("mouseup",Xd,as);var ar=dt(xs);ks(gl(ar,{}),Z=>le=Z,()=>le);var nc=v(ar,2);ks(pq(nc,{}),Z=>oe=Z,()=>oe);var sc=v(nc,2);{var N0=Z=>{var xe=mK(),bt=dt(xe),pt=v(bt,2);let at;var Pi=m(pt);{var Ui=Oi=>{var rn=pK(),an=dt(rn),Nn=v(an,2),Sn=v(Nn,4),Vn=v(Sn,2);j("click",an,()=>we(l(s).entry.path)),j("click",Nn,()=>it(l(s).entry.path)),j("click",Sn,()=>ut(l(s).entry)),j("click",Vn,()=>Rt(l(s).entry)),D(Oi,rn)},un=Oi=>{var rn=vK(),an=dt(rn),Nn=v(an,2),Sn=v(Nn,2),Vn=v(Sn,2);{var On=Yi=>{var Ln=xK();j("click",Ln,()=>Ze(l(s).entry)),D(Yi,Ln)};O(Vn,Yi=>{l(b)&&Yi(On)})}var jn=v(Vn,4);j("click",an,()=>ct(l(s).entry.path)),j("click",Nn,()=>ut(l(s).entry)),j("click",Sn,()=>si(l(s).entry)),j("click",jn,()=>Rt(l(s).entry)),D(Oi,rn)};O(Pi,Oi=>{l(s).entry.type==="dir"?Oi(Ui):Oi(un,-1)})}z(()=>at=Vo(pt,"",at,{left:`${l(s).x??""}px`,top:`${l(s).y??""}px`})),j("click",bt,Hi),j("contextmenu",bt,Oi=>{Oi.preventDefault(),Hi()}),D(Z,xe)};O(sc,Z=>{l(s)&&Z(N0)})}var oc=v(sc,2);{var pd=Z=>{var xe=_K();let bt;z(()=>bt=Vo(xe,"",bt,{left:`${l(_n).x??""}px`,top:`${l(_n).y-4}px`})),D(Z,xe)};O(oc,Z=>{l(_n)&&Z(pd)})}var Ch=v(oc,2),xd=m(Ch);let rc;{const Z=(pt,at=fb,Pi)=>{let Ui=n9(()=>$L(Pi==null?void 0:Pi(),!1));var un=Us(),Oi=dt(un);{var rn=Nn=>{var Sn=CK(),Vn=m(Sn);let On;var jn=m(Vn);let Yi;var Ln=v(jn,2);let Bs;var ho=m(Ln),Hn=v(Ln,2);{var ts=$n=>{var As=M2();D($n,As)},ds=At(()=>l(_e).has(at().path)||l(Je).has(at().path));O(Hn,$n=>{l(ds)&&$n(ts)})}var Xn=v(Hn,2),ws=m(Xn),An=v(Xn,2),Jn=m(An),Yn=v(Vn,2);{var es=$n=>{var As=bK();ti(As,21,()=>at().children,Vs=>Vs.path,(Vs,yo)=>{Z(Vs,()=>l(yo),()=>at().disabled||l(Ui))}),D($n,As)};O(Yn,$n=>{l(i)[at().path]&&at().children&&$n(es)})}z(()=>{On=Dt(Vn,1,"dir-row svelte-1pyfjii",null,On,{"dir-selected":l(n)===at().path,"drag-target":l(a)===at().path}),gn(Vn,"aria-selected",l(n)===at().path),Yi=Dt(jn,1,"chevron svelte-1pyfjii",null,Yi,{open:l(i)[at().path]}),Bs=Dt(Ln,1,"dir-name svelte-1pyfjii",null,Bs,{lib:at().lib}),N(ho,at().name),vr(ws,at().lib),vr(Jn,at().disabled)}),Ts("dragstart",Vn,$n=>ri($n,at().path)),Ts("dragover",Vn,$n=>Ri($n,at().path)),Ts("dragleave",Vn,tn),Ts("drop",Vn,$n=>on($n,at().path)),j("contextmenu",Vn,$n=>$i($n,at())),j("click",jn,()=>$e(at().path)),j("click",Ln,()=>{x(n,at().path,!0),l(i)[at().path]=!0}),j("keydown",Ln,$n=>$n.key==="Enter"&&x(n,at().path,!0)),Ts("mouseenter",Xn,qe),Ts("mouseleave",Xn,Xt),j("change",ws,()=>je(at().path,!at().lib)),j("change",Jn,()=>ze(at().path,!at().disabled)),D(Nn,Sn)},an=Nn=>{const Sn=At(()=>l(Se).has(at().path)),Vn=At(()=>l(_e).has(at().path)),On=At(()=>l(d).some(c=>c.path===at().path&&c.dirty)),jn=At(()=>(at().name.split(".").pop()??"txt").toUpperCase()),Yi=At(()=>at().name.endsWith(".js"));var Ln=AK();let Bs;var ho=m(Ln),Hn=m(ho);let ts;var ds=m(Hn);let Xn;var ws=m(ds),An=v(ds,2),Jn=m(An),Yn=v(An,2);{var es=c=>{var h=M2();D(c,h)};O(Yn,c=>{l(Vn)&&c(es)})}var $n=v(Yn);{var As=c=>{var h=EK();D(c,h)};O($n,c=>{l(On)&&c(As)})}var Vs=v($n,2);{var yo=c=>{var h=yK();D(c,h)},Or=At(()=>l(Yi)&&l(he).has(at().path)&&!l(Sn));O(Vs,c=>{l(Or)&&c(yo)})}var wo=v(Vs,2);{var Os=c=>{var h=wK();D(c,h)};O(wo,c=>{l(Sn)&&c(Os)})}var io=v(Hn,2);{var wr=c=>{var h=SK();let _;var w=m(h);z(()=>{_=Dt(h,1,"dis-label svelte-1pyfjii",null,_,{"dis-locked":l(Ui)}),gn(h,"title",l(Ui)?"Disabled by parent directory":"Disable — this script will not be executed"),vr(w,at().disabled),w.disabled=l(Ui)}),j("change",w,()=>ze(at().path,!at().disabled)),D(c,h)},Ma=c=>{var h=DK();D(c,h)};O(io,c=>{l(Yi)?c(wr):c(Ma,-1)})}z((c,h,_)=>{Bs=Dt(Ln,1,"tree-file svelte-1pyfjii",null,Bs,c),ts=Dt(Hn,1,"svelte-1pyfjii",null,ts,{lib:at().lib,dis:at().disabled,err:l(Sn)}),Xn=Dt(ds,1,`badge badge-${h??""}`,"svelte-1pyfjii",Xn,{"badge-shelib":at().lib}),N(ws,_),N(Jn,at().name)},[()=>({active:l(d).some(c=>c.path===at().path),"active-tab":at().path===l(u)}),()=>l(jn).toLowerCase(),()=>Ft(l(jn))]),Ts("dragstart",Ln,c=>ri(c,at().path)),j("contextmenu",Ln,c=>$i(c,at())),j("click",Hn,()=>ct(at().path)),D(Nn,Ln)};O(Oi,Nn=>{at().type==="dir"?Nn(rn):Nn(an,-1)})}D(pt,un)};var Eh=m(xd),ac=m(Eh),vd=v(ac,2),Is=v(vd,2);let xe;var Mr=v(Is,2),md=v(Eh,2);{var Ia=pt=>{var at=kK(),Pi=m(at);z(()=>N(Pi,l(g))),D(pt,at)};O(md,pt=>{l(g)&&pt(Ia)})}var Bo=v(md,2);{var yh=pt=>{var at=VK(),Pi=m(at),Ui=m(Pi);let un;var Oi=v(Ui,2);let rn;var an=v(Oi,2),Nn=v(Pi,2),Sn=m(Nn);ks(Sn,An=>x(vt,An),()=>l(vt));var Vn=v(Sn,2);{var On=An=>{var Jn=BK(),Yn=dt(Jn);let es;var $n=v(Yn,2);let As;var Vs=v($n,2);let yo;z(()=>{es=Dt(Yn,1,"svelte-1pyfjii",null,es,{active:l(Oe)}),As=Dt($n,1,"svelte-1pyfjii",null,As,{active:l(pe)}),yo=Dt(Vs,1,"svelte-1pyfjii",null,yo,{active:l(lt)})}),j("click",Yn,()=>{x(Oe,!l(Oe)),Ai()}),j("click",$n,()=>{x(pe,!l(pe)),Ai()}),j("click",Vs,()=>x(lt,!l(lt))),D(An,Jn)};O(Vn,An=>{l(ge)==="text"&&An(On)})}var jn=v(Nn,2);{var Yi=An=>{var Jn=FK(),Yn=m(Jn),es=v(Yn,2),$n=m(es);z(As=>{es.disabled=As,N($n,l(ui)?"…":"Preview")},[()=>!l(Ne).trim()||l(Xe).length===0||l(ui)]),yt(Yn,()=>l(Ot),As=>x(Ot,As)),j("click",es,sn),D(An,Jn)};O(jn,An=>{l(ge)==="text"&&l(lt)&&An(Yi)})}var Ln=v(jn,2),Bs=m(Ln);{var ho=An=>{var Jn=LK();D(An,Jn)},Hn=An=>{var Jn=IK(),Yn=m(Jn);z(()=>N(Yn,l(st))),D(An,Jn)},ts=An=>{var Jn=Us(),Yn=dt(Jn);{var es=As=>{var Vs=Us(),yo=dt(Vs);{var Or=Os=>{var io=PK();D(Os,io)},wo=Os=>{var io=$C(),wr=dt(io);{var Ma=h=>{var _=TK();D(h,_)};O(wr,h=>{l(me)&&h(Ma)})}var c=v(wr,2);ti(c,17,()=>l(Xe),zi,(h,_)=>{var w=RK(),k=m(w),W=m(k),se=m(W),Ie=v(W,2),Ke=m(Ie),It=v(k,2);ti(It,17,()=>l(_).matches,zi,(Wi,hn)=>{var Wn=MK(),So=m(Wn),fo=m(So),lr=v(So,2),zo=m(lr);z(()=>{N(fo,l(hn).line),N(zo,l(hn).preview)}),j("click",Wn,()=>mi(l(_).path,l(hn))),D(Wi,Wn)}),z(()=>{N(se,l(_).path),N(Ke,l(_).matches.length)}),j("click",k,()=>ct(l(_).path)),D(h,w)}),D(Os,io)};O(yo,Os=>{l(Xe).length===0?Os(Or):Os(wo,-1)})}D(As,Vs)},$n=As=>{var Vs=Us(),yo=dt(Vs);{var Or=Os=>{var io=NK();D(Os,io)},wo=Os=>{var io=$C(),wr=dt(io);{var Ma=h=>{var _=OK();D(h,_)};O(wr,h=>{l(me)&&h(Ma)})}var c=v(wr,2);ti(c,17,()=>l(ht),zi,(h,_)=>{var w=HK(),k=m(w),W=m(k);z(()=>N(W,l(_))),j("click",w,()=>ct(l(_))),D(h,w)}),D(Os,io)};O(yo,Os=>{l(ht).length===0?Os(Or):Os(wo,-1)})}D(As,Vs)};O(Yn,As=>{l(ge)==="text"?As(es):As($n,-1)})}D(An,Jn)},ds=At(()=>l(Ne).trim());O(Bs,An=>{l(Be)?An(ho):l(st)?An(Hn,1):l(ds)&&An(ts,2)})}var Xn=v(Ln,2);{var ws=An=>{var Jn=zK(),Yn=m(Jn),es=m(Yn),$n=m(es),As=v(es,2),Vs=m(As),yo=v(Vs,2),Or=v(Yn,2);ti(Or,21,()=>l(rt),zi,(wo,Os,io)=>{var wr=WK(),Ma=m(wr),c=v(Ma,4),h=m(c),_=v(c,2),w=m(_);z(()=>{N(h,l(Os).path),N(w,`${l(Os).changes??""}×`)}),Ms(Ma,()=>l(Os).checked,k=>l(Os).checked=k),D(wo,wr)}),z((wo,Os)=>{N($n,`Replace in ${wo??""} file(s)`),Vs.disabled=Os},[()=>l(rt).filter(wo=>wo.checked).length,()=>l(rt).filter(wo=>wo.checked).length===0]),j("click",Vs,dn),j("click",yo,()=>x(wt,!1)),D(An,Jn)};O(Xn,An=>{l(wt)&&An(ws)})}z(()=>{un=Dt(Ui,1,"svelte-1pyfjii",null,un,{active:l(ge)==="text"}),rn=Dt(Oi,1,"svelte-1pyfjii",null,rn,{active:l(ge)==="files"}),gn(Sn,"placeholder",l(ge)==="text"?"Find in files…":"Find files…")}),j("click",Ui,()=>{x(ge,"text"),Ai()}),j("click",Oi,()=>{x(ge,"files"),Ai()}),j("click",an,Vt),j("input",Sn,Ai),j("keydown",Sn,An=>An.key==="Escape"&&Vt()),yt(Sn,()=>l(Ne),An=>x(Ne,An)),D(pt,at)};O(Bo,pt=>{l(Fe)&&pt(yh)})}var lc=v(Bo,2),Pa=m(lc);let bt;var _d=v(Pa,2);ti(_d,17,()=>l(t),pt=>pt.path,(pt,at)=>{Z(pt,()=>l(at))});var bd=v(lc,2);{var O0=pt=>{var at=GK();let Pi;var Ui=m(at),un=v(Ui,2),Oi=m(un),rn=m(Oi),an=v(Oi,2),Nn=v(un,2),Sn=m(Nn);{var Vn=Yi=>{var Ln=jK();D(Yi,Ln)},On=Yi=>{var Ln=$K();D(Yi,Ln)},jn=Yi=>{var Ln=$C(),Bs=dt(Ln);ti(Bs,17,()=>l(I),ts=>ts.hash,(ts,ds)=>{var Xn=UK(),ws=m(Xn),An=m(ws),Jn=v(ws,2),Yn=m(Jn);z((es,$n)=>{N(An,l(ds).subject),N(Yn,`${es??""} · ${$n??""}`)},[()=>l(ds).hash.slice(0,7),()=>Kt(l(ds).date)]),j("click",Xn,()=>Wt(l(ds))),D(ts,Xn)});var ho=v(Bs,2);{var Hn=ts=>{var ds=qK(),Xn=m(ds);z(()=>{ds.disabled=l(M),N(Xn,l(M)?"Loading…":"Load more")}),j("click",ds,Zt),D(ts,ds)};O(ho,ts=>{l(I).length>=l(R)&&ts(Hn)})}D(Yi,Ln)};O(Sn,Yi=>{l(M)&&l(I).length===0?Yi(Vn):l(I).length===0?Yi(On,1):Yi(jn,-1)})}z(()=>{Pi=Vo(at,"",Pi,{height:`${l(gi)??""}px`}),gn(Oi,"title",l(A).path),N(rn,`History: ${l(A).name??""}`)}),j("mousedown",Ui,Fn),j("click",an,ji),D(pt,at)};O(bd,pt=>{l(A)&&pt(O0)})}z(()=>{xe=Dt(Is,1,"search-toggle svelte-1pyfjii",null,xe,{active:l(Fe)}),bt=Dt(Pa,1,"tree-root-drop svelte-1pyfjii",null,bt,{"drag-target":l(a)===""})}),j("click",ac,wi),j("click",vd,Xi),j("click",Is,()=>l(Fe)?Vt():ii("text")),j("click",Mr,de),Ts("dragover",Pa,pt=>Ri(pt,"")),Ts("dragleave",Pa,tn),Ts("drop",Pa,pt=>on(pt,""))}var Cd=v(xd,2),wh=v(Cd,2),Sh=m(wh);{var vo=Z=>{var xe=XK(),bt=m(xe),pt=v(bt,2);ti(pt,21,()=>l(d),Pi=>Pi.path,(Pi,Ui)=>{var un=ZK();let Oi;var rn=m(un),an=m(rn),Nn=v(rn,2);{var Sn=On=>{var jn=KK();D(On,jn)};O(Nn,On=>{l(Ui).dirty&&On(Sn)})}var Vn=v(Nn,2);z(On=>{Oi=Dt(un,1,"tab svelte-1pyfjii",null,Oi,{active:l(Ui).path===l(u)}),gn(un,"data-tab-path",l(Ui).path),N(an,On)},[()=>l(Ui).path.split("/").pop()]),j("click",un,()=>Qe(l(Ui).path)),j("keydown",un,On=>On.key==="Enter"&&Qe(l(Ui).path)),j("click",Vn,On=>{On.stopPropagation(),mt(l(Ui).path)}),D(Pi,un)}),ks(pt,Pi=>x(hi,Pi),()=>l(hi));var at=v(pt,2);z(()=>{bt.disabled=!l(Ct),at.disabled=!l(ai)}),j("click",bt,()=>zt(-1)),Ts("scroll",pt,Ee),Ts("wheel",pt,Pi=>{Pi.preventDefault(),l(hi).scrollLeft+=Pi.deltaY,Ee()}),j("click",at,()=>zt(1)),D(Z,xe)};O(Sh,Z=>{l(d).length>0&&Z(vo)})}var pl=v(Sh,2),hx=m(pl),aa=m(hx),fx=v(hx,2);{var cc=Z=>{var xe=sZ(),bt=m(xe),pt=m(bt),at=v(bt,2);{var Pi=an=>{var Nn=eZ(),Sn=m(Nn),Vn=m(Sn),On=v(Sn,2);{var jn=Yi=>{var Ln=JK(),Bs=dt(Ln),ho=v(Bs,2),Hn=v(m(ho),2);ti(Hn,21,()=>l(b).changes,zi,(Yn,es)=>{var $n=YK(),As=m($n),Vs=m(As),yo=v(As,2),Or=m(yo),wo=v(yo,2),Os=m(wo);z(io=>{vr(Vs,io),N(Or,l(es).status),N(Os,l(es).file)},[()=>l(Y).has(l(es).file)]),j("change",Vs,()=>{const io=new Set(l(Y));io.has(l(es).file)?io.delete(l(es).file):io.add(l(es).file),x(Y,io,!0)}),D(Yn,$n)});var ts=v(Hn,2),ds=m(ts),Xn=v(ds,2),ws=m(Xn),An=v(ts,2);{var Jn=Yn=>{var es=QK(),$n=m(es);z(()=>N($n,l(H))),D(Yn,es)};O(An,Yn=>{l(H)&&Yn(Jn)})}z(Yn=>{var es;Xn.disabled=Yn,N(ws,l(T)?"…":l(Y).size===((es=l(b))==null?void 0:es.changes.length)?"Commit all":`Commit ${l(Y).size}`)},[()=>!l(q).trim()||l(T)||l(Y).size===0]),j("click",Bs,()=>x(Ve,!1)),j("keydown",ds,Yn=>Yn.key==="Enter"&&ne()),yt(ds,()=>l(q),Yn=>x(q,Yn)),j("click",Xn,ne),D(Yi,Ln)};O(On,Yi=>{l(Ve)&&Yi(jn)})}z(()=>{gn(Sn,"title",`${l(b).changes.length??""} uncommitted change(s) — click to view`),N(Vn,`✎${l(b).changes.length??""}`)}),j("click",Sn,()=>{l(Ve)||x(Y,new Set(l(b).changes.map(Yi=>Yi.file)),!0),x(Ve,!l(Ve)),x(H,"")}),D(an,Nn)};O(at,an=>{l(b).changes.length>0&&an(Pi)})}var Ui=v(at,2);{var un=an=>{var Nn=iZ(),Sn=m(Nn),Vn=m(Sn),On=v(Sn,2);{var jn=Yi=>{var Ln=tZ(),Bs=dt(Ln),ho=v(Bs,2),Hn=m(ho),ts=m(Hn),ds=v(Hn,2),Xn=m(ds);z(()=>N(ts,`${l(b).ahead??""} unpushed commit(s)`)),j("click",Bs,()=>x(St,!1)),j("click",Xn,()=>{x(St,!1),Mt()}),D(Yi,Ln)};O(On,Yi=>{l(St)&&Yi(jn)})}z(()=>{gn(Sn,"title",`${l(b).ahead??""} commit(s) ahead of upstream — click to push`),N(Vn,`↑${l(b).ahead??""}`)}),j("click",Sn,()=>x(St,!l(St))),D(an,Nn)};O(Ui,an=>{l(b).ahead>0&&an(un)})}var Oi=v(Ui,2);{var rn=an=>{var Nn=nZ(),Sn=m(Nn);z(()=>{gn(Nn,"title",`${l(b).behind??""} commit(s) behind upstream`),N(Sn,`↓${l(b).behind??""}`)}),D(an,Nn)};O(Oi,an=>{l(b).behind>0&&an(rn)})}z(()=>{gn(bt,"title",`Branch: ${l(b).branch??""}`),N(pt,`⎇ ${l(b).branch??""}`)}),D(Z,xe)};O(fx,Z=>{l(b)&&Z(cc)})}var gx=v(fx,2),dc=m(gx),Ed=m(dc),Dh=m(Ed),px=v(Ed,2),Ta=v(dc,2);{var Ah=Z=>{var xe=oZ(),bt=dt(xe),pt=v(bt,2),at=m(pt),Pi=v(at,2);j("click",bt,()=>x(p,!1)),j("click",at,()=>{x(p,!1),Bt()}),j("click",Pi,()=>{x(p,!1),ei()}),D(Z,xe)};O(Ta,Z=>{l(p)&&Z(Ah)})}var xx=v(gx,2);{var H0=Z=>{var xe=rZ();j("click",xe,pn),D(Z,xe)};O(xx,Z=>{l(u)&&Z(H0)})}var W0=v(xx,2);let Rr;var Ub=v(pl,2),xl=m(Ub),vx=m(xl),Nr=m(vx);ks(Nr,Z=>yi=Z,()=>yi);var yd=v(Nr,2);{var mx=Z=>{var xe=aZ();D(Z,xe)};O(yd,Z=>{l(u)||Z(mx)})}var kh=v(yd,2);{var Bh=Z=>{var xe=uZ(),bt=m(xe),pt=m(bt),at=v(m(pt)),Pi=m(at),Ui=v(pt,2),un=m(Ui),Oi=m(un),rn=m(Oi),an=m(rn),Nn=v(rn,2),Sn=v(Oi,2);{var Vn=Yi=>{var Ln=dZ(),Bs=dt(Ln),ho=v(Bs,2),Hn=m(ho);{var ts=Xn=>{var ws=lZ();j("click",ws,()=>{x(gt,!1),x(Yt,!0),Kn()}),D(Xn,ws)},ds=Xn=>{var ws=cZ();j("click",ws,()=>{x(gt,!1),x(Yt,!1)}),D(Xn,ws)};O(Hn,Xn=>{l(Yt)?Xn(ds,-1):Xn(ts)})}j("click",Bs,()=>x(gt,!1)),D(Yi,Ln)};O(Sn,Yi=>{l(gt)&&Yi(Vn)})}var On=v(un,2),jn=v(bt,2);ks(jn,Yi=>x(et,Yi),()=>l(et)),z(Yi=>{N(Pi,Yi),N(an,l(Yt)?"Auto-accept ✓":"Accept")},[()=>{var Yi;return(Yi=l(u))==null?void 0:Yi.split("/").pop()}]),j("click",rn,Kn),j("click",Nn,()=>x(gt,!l(gt))),j("click",On,eo),D(Z,xe)};O(kh,Z=>{l(Pt)!==null&&Z(Bh)})}var z0=v(kh,2);{var Fh=Z=>{var xe=gZ(),bt=m(xe),pt=m(bt),at=v(m(pt)),Pi=m(at),Ui=v(at,2),un=m(Ui),Oi=v(pt,2),rn=m(Oi),an=v(bt,2);{var Nn=Vn=>{var On=hZ();D(Vn,On)},Sn=Vn=>{var On=fZ();ks(On,jn=>x(P,jn),()=>l(P)),D(Vn,On)};O(an,Vn=>{l(ie)?Vn(Nn):Vn(Sn,-1)})}z(Vn=>{var On;N(Pi,Vn),N(un,(On=l(A))==null?void 0:On.name)},[()=>l(ae).slice(0,7)]),j("click",rn,$t),D(Z,xe)};O(z0,Z=>{l(re)&&Z(Fh)})}var uc=v(vx,2);{var Lh=Z=>{var xe=EZ();let bt,pt;var at=m(xe);{var Pi=jn=>{var Yi=pZ();j("mousedown",Yi,Mn),D(jn,Yi)};O(at,jn=>{l(C)&&jn(Pi)})}var Ui=v(at,2),un=m(Ui),Oi=m(un),rn=v(Oi);{var an=jn=>{var Yi=xZ(),Ln=m(Yi);z(Bs=>N(Ln,`— ${Bs??""}`),[()=>l(u).split("/").pop()]),D(jn,Yi)};O(rn,jn=>{l(u)&&jn(an)})}var Nn=v(un,2);{var Sn=jn=>{var Yi=mZ(),Ln=dt(Yi);ti(Ln,21,()=>bi,zi,(ws,An)=>{var Jn=vZ(),Yn=m(Jn),es={};z(()=>{N(Yn,l(An)),es!==(es=l(An))&&(Jn.value=(Jn.__value=l(An))??"")}),D(ws,Jn)});var Bs=v(Ln,2),ho=v(Bs,2),Hn=m(ho),ts=v(ho,2),ds=m(ts),Xn=v(ts,2);$s(Ln,()=>l(ft),ws=>x(ft,ws)),yt(Bs,()=>l(qt),ws=>x(qt,ws)),Ms(Hn,()=>l(Ti),ws=>x(Ti,ws)),Ms(ds,()=>l(ki),ws=>x(ki,ws)),j("click",Xn,wn),D(jn,Yi)};O(Nn,jn=>{l(C)&&jn(Sn)})}var Vn=v(Ui,2);{var On=jn=>{var Yi=CZ(),Ln=m(Yi);ti(Ln,17,()=>{var Hn;return(((Hn=l(ye))==null?void 0:Hn.logEntries)??[]).filter(mn)},zi,(Hn,ts)=>{var ds=_Z(),Xn=m(ds),ws=m(Xn),An=v(Xn,2),Jn=m(An),Yn=v(An,2),es=m(Yn);z(($n,As)=>{Dt(ds,1,`log-line ${l(ts).level??""}`,"svelte-1pyfjii"),N(ws,$n),N(Jn,As),N(es,l(ts).msg)},[()=>cS(l(ts).ts),()=>l(ts).level.toUpperCase()]),D(Hn,ds)});var Bs=v(Ln,2);{var ho=Hn=>{var ts=bZ();D(Hn,ts)};O(Bs,Hn=>{var ts;(((ts=l(ye))==null?void 0:ts.logEntries.length)??0)===0&&Hn(ho)})}ks(Yi,Hn=>x(ve,Hn),()=>l(ve)),D(jn,Yi)};O(Vn,jn=>{l(C)&&jn(On)})}z(()=>{bt=Dt(xe,1,"log-panel svelte-1pyfjii",null,bt,{collapsed:!l(C)}),pt=Vo(xe,"",pt,{height:l(C)?`${l(Gt)}px`:"26px"}),N(Oi,`${l(C)?"▾":"▸"} Script Log `)}),j("click",un,Ni),D(Z,xe)};O(uc,Z=>{l(d).length>0&&Z(Lh)})}var V0=v(xl,2);{var _x=Z=>{var xe=yZ(),bt=dt(xe),pt=v(bt,2);let at;var Pi=m(pt);tK(Pi,{get currentScript(){return l(Ce)},onApply:Cn,onCreateFile:Ns,get extraFiles(){return l(De)},set extraFiles(Ui){x(De,Ui,!0)}}),z(()=>at=Vo(pt,"",at,{width:`${l(ni)??""}px`})),j("mousedown",bt,Cs),D(Z,xe)};O(V0,Z=>{l(Ge)&&Z(_x)})}z(()=>{var Z;rc=Vo(xd,"",rc,{width:`${l(fe)??""}px`}),N(aa,l(u)??"No file selected"),Ed.disabled=!((Z=l(ye))!=null&&Z.dirty)||l(f),N(Dh,l(f)?"Saving…":"Save"),px.disabled=!l(u),Rr=Dt(W0,1,"ai-toggle svelte-1pyfjii",null,Rr,{"ai-open":l(Ge)}),gn(W0,"title",l(Ge)?"Close AI assistant":"Open AI assistant")}),j("keydown",Ch,bn),j("mousedown",Cd,nn),j("click",Ed,Bt),j("click",px,()=>x(p,!l(p))),j("click",W0,()=>x(Ge,!l(Ge))),D(o,xs),Xs()}lo(["click","contextmenu","keydown","change","input","mousedown"]);var xg={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 DZ=xg.exports,R2;function AZ(){return R2||(R2=1,(function(o,e){(function(t,i){i(e)})(DZ,(function(t){var i="1.9.4";function n(c){var h,_,w,k;for(_=1,w=arguments.length;_<w;_++){k=arguments[_];for(h in k)c[h]=k[h]}return c}var s=Object.create||(function(){function c(){}return function(h){return c.prototype=h,new c}})();function r(c,h){var _=Array.prototype.slice;if(c.bind)return c.bind.apply(c,_.call(arguments,1));var w=_.call(arguments,2);return function(){return c.apply(h,w.length?w.concat(_.call(arguments)):arguments)}}var a=0;function d(c){return"_leaflet_id"in c||(c._leaflet_id=++a),c._leaflet_id}function u(c,h,_){var w,k,W,se;return se=function(){w=!1,k&&(W.apply(_,k),k=!1)},W=function(){w?k=arguments:(c.apply(_,arguments),setTimeout(se,h),w=!0)},W}function f(c,h,_){var w=h[1],k=h[0],W=w-k;return c===w&&_?c:((c-k)%W+W)%W+k}function g(){return!1}function p(c,h){if(h===!1)return c;var _=Math.pow(10,h===void 0?6:h);return Math.round(c*_)/_}function C(c){return c.trim?c.trim():c.replace(/^\s+|\s+$/g,"")}function b(c){return C(c).split(/\s+/)}function E(c,h){Object.prototype.hasOwnProperty.call(c,"options")||(c.options=c.options?s(c.options):{});for(var _ in h)c.options[_]=h[_];return c.options}function y(c,h,_){var w=[];for(var k in c)w.push(encodeURIComponent(_?k.toUpperCase():k)+"="+encodeURIComponent(c[k]));return(!h||h.indexOf("?")===-1?"?":"&")+w.join("&")}var A=/\{ *([\w_ -]+) *\}/g;function I(c,h){return c.replace(A,function(_,w){var k=h[w];if(k===void 0)throw new Error("No value provided for variable "+_);return typeof k=="function"&&(k=k(h)),k})}var M=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"};function R(c,h){for(var _=0;_<c.length;_++)if(c[_]===h)return _;return-1}var P="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function V(c){return window["webkit"+c]||window["moz"+c]||window["ms"+c]}var U=0;function J(c){var h=+new Date,_=Math.max(0,16-(h-U));return U=h+_,window.setTimeout(c,_)}var re=window.requestAnimationFrame||V("RequestAnimationFrame")||J,ae=window.cancelAnimationFrame||V("CancelAnimationFrame")||V("CancelRequestAnimationFrame")||function(c){window.clearTimeout(c)};function ie(c,h,_){if(_&&re===J)c.call(h);else return re.call(window,r(c,h))}function ve(c){c&&ae.call(window,c)}var Se={__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:P,requestFn:re,cancelFn:ae,requestAnimFrame:ie,cancelAnimFrame:ve};function Q(){}Q.extend=function(c){var h=function(){E(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},_=h.__super__=this.prototype,w=s(_);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 c.statics&&n(h,c.statics),c.includes&&(he(c.includes),n.apply(null,[w].concat(c.includes))),n(w,c),delete w.statics,delete w.includes,w.options&&(w.options=_.options?s(_.options):{},n(w.options,c.options)),w._initHooks=[],w.callInitHooks=function(){if(!this._initHooksCalled){_.callInitHooks&&_.callInitHooks.call(this),this._initHooksCalled=!0;for(var W=0,se=w._initHooks.length;W<se;W++)w._initHooks[W].call(this)}},h},Q.include=function(c){var h=this.prototype.options;return n(this.prototype,c),c.options&&(this.prototype.options=h,this.mergeOptions(c.options)),this},Q.mergeOptions=function(c){return n(this.prototype.options,c),this},Q.addInitHook=function(c){var h=Array.prototype.slice.call(arguments,1),_=typeof c=="function"?c:function(){this[c].apply(this,h)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(_),this};function he(c){if(!(typeof L>"u"||!L||!L.Mixin)){c=M(c)?c:[c];for(var h=0;h<c.length;h++)c[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 De={on:function(c,h,_){if(typeof c=="object")for(var w in c)this._on(w,c[w],h);else{c=b(c);for(var k=0,W=c.length;k<W;k++)this._on(c[k],h,_)}return this},off:function(c,h,_){if(!arguments.length)delete this._events;else if(typeof c=="object")for(var w in c)this._off(w,c[w],h);else{c=b(c);for(var k=arguments.length===1,W=0,se=c.length;W<se;W++)k?this._off(c[W]):this._off(c[W],h,_)}return this},_on:function(c,h,_,w){if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}if(this._listens(c,h,_)===!1){_===this&&(_=void 0);var k={fn:h,ctx:_};w&&(k.once=!0),this._events=this._events||{},this._events[c]=this._events[c]||[],this._events[c].push(k)}},_off:function(c,h,_){var w,k,W;if(this._events&&(w=this._events[c],!!w)){if(arguments.length===1){if(this._firingCount)for(k=0,W=w.length;k<W;k++)w[k].fn=g;delete this._events[c];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var se=this._listens(c,h,_);if(se!==!1){var Ie=w[se];this._firingCount&&(Ie.fn=g,this._events[c]=w=w.slice()),w.splice(se,1)}}},fire:function(c,h,_){if(!this.listens(c,_))return this;var w=n({},h,{type:c,target:this,sourceTarget:h&&h.sourceTarget||this});if(this._events){var k=this._events[c];if(k){this._firingCount=this._firingCount+1||1;for(var W=0,se=k.length;W<se;W++){var Ie=k[W],Ke=Ie.fn;Ie.once&&this.off(c,Ke,Ie.ctx),Ke.call(Ie.ctx||this,w)}this._firingCount--}}return _&&this._propagateEvent(w),this},listens:function(c,h,_,w){typeof c!="string"&&console.warn('"string" type argument expected');var k=h;typeof h!="function"&&(w=!!h,k=void 0,_=void 0);var W=this._events&&this._events[c];if(W&&W.length&&this._listens(c,k,_)!==!1)return!0;if(w){for(var se in this._eventParents)if(this._eventParents[se].listens(c,h,_,w))return!0}return!1},_listens:function(c,h,_){if(!this._events)return!1;var w=this._events[c]||[];if(!h)return!!w.length;_===this&&(_=void 0);for(var k=0,W=w.length;k<W;k++)if(w[k].fn===h&&w[k].ctx===_)return k;return!1},once:function(c,h,_){if(typeof c=="object")for(var w in c)this._on(w,c[w],h,!0);else{c=b(c);for(var k=0,W=c.length;k<W;k++)this._on(c[k],h,_,!0)}return this},addEventParent:function(c){return this._eventParents=this._eventParents||{},this._eventParents[d(c)]=c,this},removeEventParent:function(c){return this._eventParents&&delete this._eventParents[d(c)],this},_propagateEvent:function(c){for(var h in this._eventParents)this._eventParents[h].fire(c.type,n({layer:c.target,propagatedFrom:c.target},c),!0)}};De.addEventListener=De.on,De.removeEventListener=De.clearAllEventListeners=De.off,De.addOneTimeEventListener=De.once,De.fireEvent=De.fire,De.hasEventListeners=De.listens;var Fe=Q.extend(De);function ge(c,h,_){this.x=_?Math.round(c):c,this.y=_?Math.round(h):h}var Ne=Math.trunc||function(c){return c>0?Math.floor(c):Math.ceil(c)};ge.prototype={clone:function(){return new ge(this.x,this.y)},add:function(c){return this.clone()._add(Oe(c))},_add:function(c){return this.x+=c.x,this.y+=c.y,this},subtract:function(c){return this.clone()._subtract(Oe(c))},_subtract:function(c){return this.x-=c.x,this.y-=c.y,this},divideBy:function(c){return this.clone()._divideBy(c)},_divideBy:function(c){return this.x/=c,this.y/=c,this},multiplyBy:function(c){return this.clone()._multiplyBy(c)},_multiplyBy:function(c){return this.x*=c,this.y*=c,this},scaleBy:function(c){return new ge(this.x*c.x,this.y*c.y)},unscaleBy:function(c){return new ge(this.x/c.x,this.y/c.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=Ne(this.x),this.y=Ne(this.y),this},distanceTo:function(c){c=Oe(c);var h=c.x-this.x,_=c.y-this.y;return Math.sqrt(h*h+_*_)},equals:function(c){return c=Oe(c),c.x===this.x&&c.y===this.y},contains:function(c){return c=Oe(c),Math.abs(c.x)<=Math.abs(this.x)&&Math.abs(c.y)<=Math.abs(this.y)},toString:function(){return"Point("+p(this.x)+", "+p(this.y)+")"}};function Oe(c,h,_){return c instanceof ge?c:M(c)?new ge(c[0],c[1]):c==null?c:typeof c=="object"&&"x"in c&&"y"in c?new ge(c.x,c.y):new ge(c,h,_)}function pe(c,h){if(c)for(var _=h?[c,h]:c,w=0,k=_.length;w<k;w++)this.extend(_[w])}pe.prototype={extend:function(c){var h,_;if(!c)return this;if(c instanceof ge||typeof c[0]=="number"||"x"in c)h=_=Oe(c);else if(c=lt(c),h=c.min,_=c.max,!h||!_)return this;return!this.min&&!this.max?(this.min=h.clone(),this.max=_.clone()):(this.min.x=Math.min(h.x,this.min.x),this.max.x=Math.max(_.x,this.max.x),this.min.y=Math.min(h.y,this.min.y),this.max.y=Math.max(_.y,this.max.y)),this},getCenter:function(c){return Oe((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,c)},getBottomLeft:function(){return Oe(this.min.x,this.max.y)},getTopRight:function(){return Oe(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(c){var h,_;return typeof c[0]=="number"||c instanceof ge?c=Oe(c):c=lt(c),c instanceof pe?(h=c.min,_=c.max):h=_=c,h.x>=this.min.x&&_.x<=this.max.x&&h.y>=this.min.y&&_.y<=this.max.y},intersects:function(c){c=lt(c);var h=this.min,_=this.max,w=c.min,k=c.max,W=k.x>=h.x&&w.x<=_.x,se=k.y>=h.y&&w.y<=_.y;return W&&se},overlaps:function(c){c=lt(c);var h=this.min,_=this.max,w=c.min,k=c.max,W=k.x>h.x&&w.x<_.x,se=k.y>h.y&&w.y<_.y;return W&&se},isValid:function(){return!!(this.min&&this.max)},pad:function(c){var h=this.min,_=this.max,w=Math.abs(h.x-_.x)*c,k=Math.abs(h.y-_.y)*c;return lt(Oe(h.x-w,h.y-k),Oe(_.x+w,_.y+k))},equals:function(c){return c?(c=lt(c),this.min.equals(c.getTopLeft())&&this.max.equals(c.getBottomRight())):!1}};function lt(c,h){return!c||c instanceof pe?c:new pe(c,h)}function Ot(c,h){if(c)for(var _=h?[c,h]:c,w=0,k=_.length;w<k;w++)this.extend(_[w])}Ot.prototype={extend:function(c){var h=this._southWest,_=this._northEast,w,k;if(c instanceof ht)w=c,k=c;else if(c instanceof Ot){if(w=c._southWest,k=c._northEast,!w||!k)return this}else return c?this.extend(me(c)||Xe(c)):this;return!h&&!_?(this._southWest=new ht(w.lat,w.lng),this._northEast=new ht(k.lat,k.lng)):(h.lat=Math.min(w.lat,h.lat),h.lng=Math.min(w.lng,h.lng),_.lat=Math.max(k.lat,_.lat),_.lng=Math.max(k.lng,_.lng)),this},pad:function(c){var h=this._southWest,_=this._northEast,w=Math.abs(h.lat-_.lat)*c,k=Math.abs(h.lng-_.lng)*c;return new Ot(new ht(h.lat-w,h.lng-k),new ht(_.lat+w,_.lng+k))},getCenter:function(){return new ht((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 ht(this.getNorth(),this.getWest())},getSouthEast:function(){return new ht(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(c){typeof c[0]=="number"||c instanceof ht||"lat"in c?c=me(c):c=Xe(c);var h=this._southWest,_=this._northEast,w,k;return c instanceof Ot?(w=c.getSouthWest(),k=c.getNorthEast()):w=k=c,w.lat>=h.lat&&k.lat<=_.lat&&w.lng>=h.lng&&k.lng<=_.lng},intersects:function(c){c=Xe(c);var h=this._southWest,_=this._northEast,w=c.getSouthWest(),k=c.getNorthEast(),W=k.lat>=h.lat&&w.lat<=_.lat,se=k.lng>=h.lng&&w.lng<=_.lng;return W&&se},overlaps:function(c){c=Xe(c);var h=this._southWest,_=this._northEast,w=c.getSouthWest(),k=c.getNorthEast(),W=k.lat>h.lat&&w.lat<_.lat,se=k.lng>h.lng&&w.lng<_.lng;return W&&se},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(c,h){return c?(c=Xe(c),this._southWest.equals(c.getSouthWest(),h)&&this._northEast.equals(c.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function Xe(c,h){return c instanceof Ot?c:new Ot(c,h)}function ht(c,h,_){if(isNaN(c)||isNaN(h))throw new Error("Invalid LatLng object: ("+c+", "+h+")");this.lat=+c,this.lng=+h,_!==void 0&&(this.alt=+_)}ht.prototype={equals:function(c,h){if(!c)return!1;c=me(c);var _=Math.max(Math.abs(this.lat-c.lat),Math.abs(this.lng-c.lng));return _<=(h===void 0?1e-9:h)},toString:function(c){return"LatLng("+p(this.lat,c)+", "+p(this.lng,c)+")"},distanceTo:function(c){return st.distance(this,me(c))},wrap:function(){return st.wrapLatLng(this)},toBounds:function(c){var h=180*c/40075017,_=h/Math.cos(Math.PI/180*this.lat);return Xe([this.lat-h,this.lng-_],[this.lat+h,this.lng+_])},clone:function(){return new ht(this.lat,this.lng,this.alt)}};function me(c,h,_){return c instanceof ht?c:M(c)&&typeof c[0]!="object"?c.length===3?new ht(c[0],c[1],c[2]):c.length===2?new ht(c[0],c[1]):null:c==null?c:typeof c=="object"&&"lat"in c?new ht(c.lat,"lng"in c?c.lng:c.lon,c.alt):h===void 0?null:new ht(c,h,_)}var Be={latLngToPoint:function(c,h){var _=this.projection.project(c),w=this.scale(h);return this.transformation._transform(_,w)},pointToLatLng:function(c,h){var _=this.scale(h),w=this.transformation.untransform(c,_);return this.projection.unproject(w)},project:function(c){return this.projection.project(c)},unproject:function(c){return this.projection.unproject(c)},scale:function(c){return 256*Math.pow(2,c)},zoom:function(c){return Math.log(c/256)/Math.LN2},getProjectedBounds:function(c){if(this.infinite)return null;var h=this.projection.bounds,_=this.scale(c),w=this.transformation.transform(h.min,_),k=this.transformation.transform(h.max,_);return new pe(w,k)},infinite:!1,wrapLatLng:function(c){var h=this.wrapLng?f(c.lng,this.wrapLng,!0):c.lng,_=this.wrapLat?f(c.lat,this.wrapLat,!0):c.lat,w=c.alt;return new ht(_,h,w)},wrapLatLngBounds:function(c){var h=c.getCenter(),_=this.wrapLatLng(h),w=h.lat-_.lat,k=h.lng-_.lng;if(w===0&&k===0)return c;var W=c.getSouthWest(),se=c.getNorthEast(),Ie=new ht(W.lat-w,W.lng-k),Ke=new ht(se.lat-w,se.lng-k);return new Ot(Ie,Ke)}},st=n({},Be,{wrapLng:[-180,180],R:6371e3,distance:function(c,h){var _=Math.PI/180,w=c.lat*_,k=h.lat*_,W=Math.sin((h.lat-c.lat)*_/2),se=Math.sin((h.lng-c.lng)*_/2),Ie=W*W+Math.cos(w)*Math.cos(k)*se*se,Ke=2*Math.atan2(Math.sqrt(Ie),Math.sqrt(1-Ie));return this.R*Ke}}),vt=6378137,rt={R:vt,MAX_LATITUDE:85.0511287798,project:function(c){var h=Math.PI/180,_=this.MAX_LATITUDE,w=Math.max(Math.min(_,c.lat),-_),k=Math.sin(w*h);return new ge(this.R*c.lng*h,this.R*Math.log((1+k)/(1-k))/2)},unproject:function(c){var h=180/Math.PI;return new ht((2*Math.atan(Math.exp(c.y/this.R))-Math.PI/2)*h,c.x*h/this.R)},bounds:(function(){var c=vt*Math.PI;return new pe([-c,-c],[c,c])})()};function wt(c,h,_,w){if(M(c)){this._a=c[0],this._b=c[1],this._c=c[2],this._d=c[3];return}this._a=c,this._b=h,this._c=_,this._d=w}wt.prototype={transform:function(c,h){return this._transform(c.clone(),h)},_transform:function(c,h){return h=h||1,c.x=h*(this._a*c.x+this._b),c.y=h*(this._c*c.y+this._d),c},untransform:function(c,h){return h=h||1,new ge((c.x/h-this._b)/this._a,(c.y/h-this._d)/this._c)}};function ui(c,h,_,w){return new wt(c,h,_,w)}var ci=n({},st,{code:"EPSG:3857",projection:rt,transformation:(function(){var c=.5/(Math.PI*rt.R);return ui(c,.5,-c,.5)})()}),hi=n({},ci,{code:"EPSG:900913"});function Ct(c){return document.createElementNS("http://www.w3.org/2000/svg",c)}function ai(c,h){var _="",w,k,W,se,Ie,Ke;for(w=0,W=c.length;w<W;w++){for(Ie=c[w],k=0,se=Ie.length;k<se;k++)Ke=Ie[k],_+=(k?"L":"M")+Ke.x+" "+Ke.y;_+=h?fe.svg?"z":"x":""}return _||"M0 0"}var Re=document.documentElement.style,Ee="ActiveXObject"in window,zt=Ee&&!document.addEventListener,ii="msLaunchUri"in navigator&&!("documentMode"in document),Vt=ce("webkit"),Ai=ce("android"),Fi=ce("android 2")||ce("android 3"),mi=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ln=Ai&&ce("Google")&&mi<537&&!("AudioNode"in window),sn=!!window.opera,dn=!ii&&ce("chrome"),bn=ce("gecko")&&!Vt&&!sn&&!Ee,ft=!dn&&ce("safari"),qt=ce("phantom"),Ti="OTransition"in Re,ki=navigator.platform.indexOf("Win")===0,bi=Ee&&"transition"in Re,yn="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Fi,mn="MozPerspective"in Re,_n=!window.L_DISABLE_3D&&(bi||yn||mn)&&!Ti&&!qt,qe=typeof orientation<"u"||ce("mobile"),Xt=qe&&Vt,yi=qe&&yn,Ut=!window.PointerEvent&&window.MSPointerEvent,Li=!!(window.PointerEvent||Ut),qi="ontouchstart"in window||!!window.TouchEvent,Gi=!window.L_NO_TOUCH&&(qi||Li),K=qe&&sn,Ae=qe&&bn,ot=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Ge=(function(){var c=!1;try{var h=Object.defineProperty({},"passive",{get:function(){c=!0}});window.addEventListener("testPassiveEventSupport",g,h),window.removeEventListener("testPassiveEventSupport",g,h)}catch{}return c})(),Pt=(function(){return!!document.createElement("canvas").getContext})(),Yt=!!(document.createElementNS&&Ct("svg").createSVGRect),gt=!!Yt&&(function(){var c=document.createElement("div");return c.innerHTML="<svg/>",(c.firstChild&&c.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),et=!Yt&&(function(){try{var c=document.createElement("div");c.innerHTML='<v:shape adj="1"/>';var h=c.firstChild;return h.style.behavior="url(#default#VML)",h&&typeof h.adj=="object"}catch{return!1}})(),X=navigator.platform.indexOf("Mac")===0,Pe=navigator.platform.indexOf("Linux")===0;function ce(c){return navigator.userAgent.toLowerCase().indexOf(c)>=0}var fe={ie:Ee,ielt9:zt,edge:ii,webkit:Vt,android:Ai,android23:Fi,androidStock:ln,opera:sn,chrome:dn,gecko:bn,safari:ft,phantom:qt,opera12:Ti,win:ki,ie3d:bi,webkit3d:yn,gecko3d:mn,any3d:_n,mobile:qe,mobileWebkit:Xt,mobileWebkit3d:yi,msPointer:Ut,pointer:Li,touch:Gi,touchNative:qi,mobileOpera:K,mobileGecko:Ae,retina:ot,passiveEvents:Ge,canvas:Pt,svg:Yt,vml:et,inlineSvg:gt,mac:X,linux:Pe},Gt=fe.msPointer?"MSPointerDown":"pointerdown",ni=fe.msPointer?"MSPointerMove":"pointermove",gi=fe.msPointer?"MSPointerUp":"pointerup",fi=fe.msPointer?"MSPointerCancel":"pointercancel",Ii={touchstart:Gt,touchmove:ni,touchend:gi,touchcancel:fi},pi={touchstart:Ce,touchmove:ue,touchend:ue,touchcancel:ue},Ci={},He=!1;function Ye(c,h,_){return h==="touchstart"&&$(),pi[h]?(_=pi[h].bind(this,_),c.addEventListener(Ii[h],_,!1),_):(console.warn("wrong event specified:",h),g)}function jt(c,h,_){if(!Ii[h]){console.warn("wrong event specified:",h);return}c.removeEventListener(Ii[h],_,!1)}function Qt(c){Ci[c.pointerId]=c}function Mi(c){Ci[c.pointerId]&&(Ci[c.pointerId]=c)}function oi(c){delete Ci[c.pointerId]}function $(){He||(document.addEventListener(Gt,Qt,!0),document.addEventListener(ni,Mi,!0),document.addEventListener(gi,oi,!0),document.addEventListener(fi,oi,!0),He=!0)}function ue(c,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var _ in Ci)h.touches.push(Ci[_]);h.changedTouches=[h],c(h)}}function Ce(c,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Rt(h),ue(c,h)}function _e(c){var h={},_,w;for(w in c)_=c[w],h[w]=_&&_.bind?_.bind(c):_;return c=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var Je=200;function Ve(c,h){c.addEventListener("dblclick",h);var _=0,w;function k(W){if(W.detail!==1){w=W.detail;return}if(!(W.pointerType==="mouse"||W.sourceCapabilities&&!W.sourceCapabilities.firesTouchEvents)){var se=ri(W);if(!(se.some(function(Ke){return Ke instanceof HTMLLabelElement&&Ke.attributes.for})&&!se.some(function(Ke){return Ke instanceof HTMLInputElement||Ke instanceof HTMLSelectElement}))){var Ie=Date.now();Ie-_<=Je?(w++,w===2&&h(_e(W))):w=1,_=Ie}}}return c.addEventListener("click",k),{dblclick:h,simDblclick:k}}function St(c,h){c.removeEventListener("dblclick",h.dblclick),c.removeEventListener("click",h.simDblclick)}var q=Ft(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),T=Ft(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),H=T==="webkitTransition"||T==="OTransition"?T+"End":"transitionend";function Y(c){return typeof c=="string"?document.getElementById(c):c}function ne(c,h){var _=c.style[h]||c.currentStyle&&c.currentStyle[h];if((!_||_==="auto")&&document.defaultView){var w=document.defaultView.getComputedStyle(c,null);_=w?w[h]:null}return _==="auto"?null:_}function le(c,h,_){var w=document.createElement(c);return w.className=h||"",_&&_.appendChild(w),w}function oe(c){var h=c.parentNode;h&&h.removeChild(c)}function ye(c){for(;c.firstChild;)c.removeChild(c.firstChild)}function We(c){var h=c.parentNode;h&&h.lastChild!==c&&h.appendChild(c)}function be(c){var h=c.parentNode;h&&h.firstChild!==c&&h.insertBefore(c,h.firstChild)}function Le(c,h){if(c.classList!==void 0)return c.classList.contains(h);var _=ee(c);return _.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(_)}function Me(c,h){if(c.classList!==void 0)for(var _=b(h),w=0,k=_.length;w<k;w++)c.classList.add(_[w]);else if(!Le(c,h)){var W=ee(c);Jt(c,(W?W+" ":"")+h)}}function nt(c,h){c.classList!==void 0?c.classList.remove(h):Jt(c,C((" "+ee(c)+" ").replace(" "+h+" "," ")))}function Jt(c,h){c.className.baseVal===void 0?c.className=h:c.className.baseVal=h}function ee(c){return c.correspondingElement&&(c=c.correspondingElement),c.className.baseVal===void 0?c.className:c.className.baseVal}function de(c,h){"opacity"in c.style?c.style.opacity=h:"filter"in c.style&&$e(c,h)}function $e(c,h){var _=!1,w="DXImageTransform.Microsoft.Alpha";try{_=c.filters.item(w)}catch{if(h===1)return}h=Math.round(h*100),_?(_.Enabled=h!==100,_.Opacity=h):c.style.filter+=" progid:"+w+"(opacity="+h+")"}function Ft(c){for(var h=document.documentElement.style,_=0;_<c.length;_++)if(c[_]in h)return c[_];return!1}function je(c,h,_){var w=h||new ge(0,0);c.style[q]=(fe.ie3d?"translate("+w.x+"px,"+w.y+"px)":"translate3d("+w.x+"px,"+w.y+"px,0)")+(_?" scale("+_+")":"")}function ze(c,h){c._leaflet_pos=h,fe.any3d?je(c,h):(c.style.left=h.x+"px",c.style.top=h.y+"px")}function kt(c){return c._leaflet_pos||new ge(0,0)}var ct,Qe,mt;if("onselectstart"in document)ct=function(){Wt(window,"selectstart",Rt)},Qe=function(){wi(window,"selectstart",Rt)};else{var _t=Ft(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ct=function(){if(_t){var c=document.documentElement.style;mt=c[_t],c[_t]="none"}},Qe=function(){_t&&(document.documentElement.style[_t]=mt,mt=void 0)}}function tt(){Wt(window,"dragstart",Rt)}function Bt(){wi(window,"dragstart",Rt)}var ei,Mt;function Kt(c){for(;c.tabIndex===-1;)c=c.parentNode;c.style&&(Ze(),ei=c,Mt=c.style.outlineStyle,c.style.outlineStyle="none",Wt(window,"keydown",Ze))}function Ze(){ei&&(ei.style.outlineStyle=Mt,ei=void 0,Mt=void 0,wi(window,"keydown",Ze))}function Et(c){do c=c.parentNode;while((!c.offsetWidth||!c.offsetHeight)&&c!==document.body);return c}function Zt(c){var h=c.getBoundingClientRect();return{x:h.width/c.offsetWidth||1,y:h.height/c.offsetHeight||1,boundingClientRect:h}}var ji={__proto__:null,TRANSFORM:q,TRANSITION:T,TRANSITION_END:H,get:Y,getStyle:ne,create:le,remove:oe,empty:ye,toFront:We,toBack:be,hasClass:Le,addClass:Me,removeClass:nt,setClass:Jt,getClass:ee,setOpacity:de,testProp:Ft,setTransform:je,setPosition:ze,getPosition:kt,get disableTextSelection(){return ct},get enableTextSelection(){return Qe},disableImageDrag:tt,enableImageDrag:Bt,preventOutline:Kt,restoreOutline:Ze,getSizedParentNode:Et,getScale:Zt};function Wt(c,h,_,w){if(h&&typeof h=="object")for(var k in h)Hi(c,k,h[k],_);else{h=b(h);for(var W=0,se=h.length;W<se;W++)Hi(c,h[W],_,w)}return this}var $t="_leaflet_events";function wi(c,h,_,w){if(arguments.length===1)Xi(c),delete c[$t];else if(h&&typeof h=="object")for(var k in h)we(c,k,h[k],_);else if(h=b(h),arguments.length===2)Xi(c,function(Ie){return R(h,Ie)!==-1});else for(var W=0,se=h.length;W<se;W++)we(c,h[W],_,w);return this}function Xi(c,h){for(var _ in c[$t]){var w=_.split(/\d/)[0];(!h||h(w))&&we(c,w,null,null,_)}}var $i={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Hi(c,h,_,w){var k=h+d(_)+(w?"_"+d(w):"");if(c[$t]&&c[$t][k])return this;var W=function(Ie){return _.call(w||c,Ie||window.event)},se=W;!fe.touchNative&&fe.pointer&&h.indexOf("touch")===0?W=Ye(c,h,W):fe.touch&&h==="dblclick"?W=Ve(c,W):"addEventListener"in c?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?c.addEventListener($i[h]||h,W,fe.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(W=function(Ie){Ie=Ie||window.event,en(c,Ie)&&se(Ie)},c.addEventListener($i[h],W,!1)):c.addEventListener(h,se,!1):c.attachEvent("on"+h,W),c[$t]=c[$t]||{},c[$t][k]=W}function we(c,h,_,w,k){k=k||h+d(_)+(w?"_"+d(w):"");var W=c[$t]&&c[$t][k];if(!W)return this;!fe.touchNative&&fe.pointer&&h.indexOf("touch")===0?jt(c,h,W):fe.touch&&h==="dblclick"?St(c,W):"removeEventListener"in c?c.removeEventListener($i[h]||h,W,!1):c.detachEvent("on"+h,W),c[$t][k]=null}function it(c){return c.stopPropagation?c.stopPropagation():c.originalEvent?c.originalEvent._stopped=!0:c.cancelBubble=!0,this}function ut(c){return Hi(c,"wheel",it),this}function Lt(c){return Wt(c,"mousedown touchstart dblclick contextmenu",it),c._leaflet_disable_click=!0,this}function Rt(c){return c.preventDefault?c.preventDefault():c.returnValue=!1,this}function si(c){return Rt(c),it(c),this}function ri(c){if(c.composedPath)return c.composedPath();for(var h=[],_=c.target;_;)h.push(_),_=_.parentNode;return h}function Ri(c,h){if(!h)return new ge(c.clientX,c.clientY);var _=Zt(h),w=_.boundingClientRect;return new ge((c.clientX-w.left)/_.x-h.clientLeft,(c.clientY-w.top)/_.y-h.clientTop)}var tn=fe.linux&&fe.chrome?window.devicePixelRatio:fe.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function on(c){return fe.edge?c.wheelDeltaY/2:c.deltaY&&c.deltaMode===0?-c.deltaY/tn:c.deltaY&&c.deltaMode===1?-c.deltaY*20:c.deltaY&&c.deltaMode===2?-c.deltaY*60:c.deltaX||c.deltaZ?0:c.wheelDelta?(c.wheelDeltaY||c.wheelDelta)/2:c.detail&&Math.abs(c.detail)<32765?-c.detail*20:c.detail?c.detail/-32765*60:0}function en(c,h){var _=h.relatedTarget;if(!_)return!0;try{for(;_&&_!==c;)_=_.parentNode}catch{return!1}return _!==c}var pn={__proto__:null,on:Wt,off:wi,stopPropagation:it,disableScrollPropagation:ut,disableClickPropagation:Lt,preventDefault:Rt,stop:si,getPropagationPath:ri,getMousePosition:Ri,getWheelDelta:on,isExternalTarget:en,addListener:Wt,removeListener:wi},wn=Fe.extend({run:function(c,h,_,w){this.stop(),this._el=c,this._inProgress=!0,this._duration=_||.25,this._easeOutPower=1/Math.max(w||.5,.2),this._startPos=kt(c),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=ie(this._animate,this),this._step()},_step:function(c){var h=+new Date-this._startTime,_=this._duration*1e3;h<_?this._runFrame(this._easeOut(h/_),c):(this._runFrame(1),this._complete())},_runFrame:function(c,h){var _=this._startPos.add(this._offset.multiplyBy(c));h&&_._round(),ze(this._el,_),this.fire("step")},_complete:function(){ve(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(c){return 1-Math.pow(1-c,this._easeOutPower)}}),Ni=Fe.extend({options:{crs:ci,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(c,h){h=E(this,h),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(c),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(me(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=T&&fe.any3d&&!fe.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Wt(this._proxy,H,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(c,h,_){if(h=h===void 0?this._zoom:this._limitZoom(h),c=this._limitCenter(me(c),h,this.options.maxBounds),_=_||{},this._stop(),this._loaded&&!_.reset&&_!==!0){_.animate!==void 0&&(_.zoom=n({animate:_.animate},_.zoom),_.pan=n({animate:_.animate,duration:_.duration},_.pan));var w=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(c,h,_.zoom):this._tryAnimatedPan(c,_.pan);if(w)return clearTimeout(this._sizeTimer),this}return this._resetView(c,h,_.pan&&_.pan.noMoveStart),this},setZoom:function(c,h){return this._loaded?this.setView(this.getCenter(),c,{zoom:h}):(this._zoom=c,this)},zoomIn:function(c,h){return c=c||(fe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+c,h)},zoomOut:function(c,h){return c=c||(fe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-c,h)},setZoomAround:function(c,h,_){var w=this.getZoomScale(h),k=this.getSize().divideBy(2),W=c instanceof ge?c:this.latLngToContainerPoint(c),se=W.subtract(k).multiplyBy(1-1/w),Ie=this.containerPointToLatLng(k.add(se));return this.setView(Ie,h,{zoom:_})},_getBoundsCenterZoom:function(c,h){h=h||{},c=c.getBounds?c.getBounds():Xe(c);var _=Oe(h.paddingTopLeft||h.padding||[0,0]),w=Oe(h.paddingBottomRight||h.padding||[0,0]),k=this.getBoundsZoom(c,!1,_.add(w));if(k=typeof h.maxZoom=="number"?Math.min(h.maxZoom,k):k,k===1/0)return{center:c.getCenter(),zoom:k};var W=w.subtract(_).divideBy(2),se=this.project(c.getSouthWest(),k),Ie=this.project(c.getNorthEast(),k),Ke=this.unproject(se.add(Ie).divideBy(2).add(W),k);return{center:Ke,zoom:k}},fitBounds:function(c,h){if(c=Xe(c),!c.isValid())throw new Error("Bounds are not valid.");var _=this._getBoundsCenterZoom(c,h);return this.setView(_.center,_.zoom,h)},fitWorld:function(c){return this.fitBounds([[-90,-180],[90,180]],c)},panTo:function(c,h){return this.setView(c,this._zoom,{pan:h})},panBy:function(c,h){if(c=Oe(c).round(),h=h||{},!c.x&&!c.y)return this.fire("moveend");if(h.animate!==!0&&!this.getSize().contains(c))return this._resetView(this.unproject(this.project(this.getCenter()).add(c)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new wn,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){Me(this._mapPane,"leaflet-pan-anim");var _=this._getMapPanePos().subtract(c).round();this._panAnim.run(this._mapPane,_,h.duration||.25,h.easeLinearity)}else this._rawPanBy(c),this.fire("move").fire("moveend");return this},flyTo:function(c,h,_){if(_=_||{},_.animate===!1||!fe.any3d)return this.setView(c,h,_);this._stop();var w=this.project(this.getCenter()),k=this.project(c),W=this.getSize(),se=this._zoom;c=me(c),h=h===void 0?se:h;var Ie=Math.max(W.x,W.y),Ke=Ie*this.getZoomScale(se,h),It=k.distanceTo(w)||1,Wi=1.42,hn=Wi*Wi;function Wn(go){var bx=go?-1:1,JF=go?Ke:Ie,e3=Ke*Ke-Ie*Ie+bx*hn*hn*It*It,t3=2*JF*hn*It,qb=e3/t3,AS=Math.sqrt(qb*qb+1)-qb,i3=AS<1e-9?-18:Math.log(AS);return i3}function So(go){return(Math.exp(go)-Math.exp(-go))/2}function fo(go){return(Math.exp(go)+Math.exp(-go))/2}function lr(go){return So(go)/fo(go)}var zo=Wn(0);function Ih(go){return Ie*(fo(zo)/fo(zo+Wi*go))}function ZF(go){return Ie*(fo(zo)*lr(zo+Wi*go)-So(zo))/hn}function XF(go){return 1-Math.pow(1-go,1.5)}var YF=Date.now(),SS=(Wn(1)-zo)/Wi,QF=_.duration?1e3*_.duration:1e3*SS*.8;function DS(){var go=(Date.now()-YF)/QF,bx=XF(go)*SS;go<=1?(this._flyToFrame=ie(DS,this),this._move(this.unproject(w.add(k.subtract(w).multiplyBy(ZF(bx)/It)),se),this.getScaleZoom(Ie/Ih(bx),se),{flyTo:!0})):this._move(c,h)._moveEnd(!0)}return this._moveStart(!0,_.noMoveStart),DS.call(this),this},flyToBounds:function(c,h){var _=this._getBoundsCenterZoom(c,h);return this.flyTo(_.center,_.zoom,h)},setMaxBounds:function(c){return c=Xe(c),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),c.isValid()?(this.options.maxBounds=c,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(c){var h=this.options.minZoom;return this.options.minZoom=c,this._loaded&&h!==c&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(c):this},setMaxZoom:function(c){var h=this.options.maxZoom;return this.options.maxZoom=c,this._loaded&&h!==c&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(c):this},panInsideBounds:function(c,h){this._enforcingBounds=!0;var _=this.getCenter(),w=this._limitCenter(_,this._zoom,Xe(c));return _.equals(w)||this.panTo(w,h),this._enforcingBounds=!1,this},panInside:function(c,h){h=h||{};var _=Oe(h.paddingTopLeft||h.padding||[0,0]),w=Oe(h.paddingBottomRight||h.padding||[0,0]),k=this.project(this.getCenter()),W=this.project(c),se=this.getPixelBounds(),Ie=lt([se.min.add(_),se.max.subtract(w)]),Ke=Ie.getSize();if(!Ie.contains(W)){this._enforcingBounds=!0;var It=W.subtract(Ie.getCenter()),Wi=Ie.extend(W).getSize().subtract(Ke);k.x+=It.x<0?-Wi.x:Wi.x,k.y+=It.y<0?-Wi.y:Wi.y,this.panTo(this.unproject(k),h),this._enforcingBounds=!1}return this},invalidateSize:function(c){if(!this._loaded)return this;c=n({animate:!1,pan:!0},c===!0?{animate:!0}:c);var h=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var _=this.getSize(),w=h.divideBy(2).round(),k=_.divideBy(2).round(),W=w.subtract(k);return!W.x&&!W.y?this:(c.animate&&c.pan?this.panBy(W):(c.pan&&this._rawPanBy(W),this.fire("move"),c.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:h,newSize:_}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(c){if(c=this._locateOptions=n({timeout:1e4,watch:!1},c),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var h=r(this._handleGeolocationResponse,this),_=r(this._handleGeolocationError,this);return c.watch?this._locationWatchId=navigator.geolocation.watchPosition(h,_,c):navigator.geolocation.getCurrentPosition(h,_,c),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(c){if(this._container._leaflet_id){var h=c.code,_=c.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: "+_+"."})}},_handleGeolocationResponse:function(c){if(this._container._leaflet_id){var h=c.coords.latitude,_=c.coords.longitude,w=new ht(h,_),k=w.toBounds(c.coords.accuracy*2),W=this._locateOptions;if(W.setView){var se=this.getBoundsZoom(k);this.setView(w,W.maxZoom?Math.min(se,W.maxZoom):se)}var Ie={latlng:w,bounds:k,timestamp:c.timestamp};for(var Ke in c.coords)typeof c.coords[Ke]=="number"&&(Ie[Ke]=c.coords[Ke]);this.fire("locationfound",Ie)}},addHandler:function(c,h){if(!h)return this;var _=this[c]=new h(this);return this._handlers.push(_),this.options[c]&&_.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(),oe(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ve(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var c;for(c in this._layers)this._layers[c].remove();for(c in this._panes)oe(this._panes[c]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(c,h){var _="leaflet-pane"+(c?" leaflet-"+c.replace("Pane","")+"-pane":""),w=le("div",_,h||this._mapPane);return c&&(this._panes[c]=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 c=this.getPixelBounds(),h=this.unproject(c.getBottomLeft()),_=this.unproject(c.getTopRight());return new Ot(h,_)},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(c,h,_){c=Xe(c),_=Oe(_||[0,0]);var w=this.getZoom()||0,k=this.getMinZoom(),W=this.getMaxZoom(),se=c.getNorthWest(),Ie=c.getSouthEast(),Ke=this.getSize().subtract(_),It=lt(this.project(Ie,w),this.project(se,w)).getSize(),Wi=fe.any3d?this.options.zoomSnap:1,hn=Ke.x/It.x,Wn=Ke.y/It.y,So=h?Math.max(hn,Wn):Math.min(hn,Wn);return w=this.getScaleZoom(So,w),Wi&&(w=Math.round(w/(Wi/100))*(Wi/100),w=h?Math.ceil(w/Wi)*Wi:Math.floor(w/Wi)*Wi),Math.max(k,Math.min(W,w))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ge(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(c,h){var _=this._getTopLeftPoint(c,h);return new pe(_,_.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(c){return this.options.crs.getProjectedBounds(c===void 0?this.getZoom():c)},getPane:function(c){return typeof c=="string"?this._panes[c]:c},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(c,h){var _=this.options.crs;return h=h===void 0?this._zoom:h,_.scale(c)/_.scale(h)},getScaleZoom:function(c,h){var _=this.options.crs;h=h===void 0?this._zoom:h;var w=_.zoom(c*_.scale(h));return isNaN(w)?1/0:w},project:function(c,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(me(c),h)},unproject:function(c,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(Oe(c),h)},layerPointToLatLng:function(c){var h=Oe(c).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(c){var h=this.project(me(c))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(c){return this.options.crs.wrapLatLng(me(c))},wrapLatLngBounds:function(c){return this.options.crs.wrapLatLngBounds(Xe(c))},distance:function(c,h){return this.options.crs.distance(me(c),me(h))},containerPointToLayerPoint:function(c){return Oe(c).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(c){return Oe(c).add(this._getMapPanePos())},containerPointToLatLng:function(c){var h=this.containerPointToLayerPoint(Oe(c));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(c){return this.layerPointToContainerPoint(this.latLngToLayerPoint(me(c)))},mouseEventToContainerPoint:function(c){return Ri(c,this._container)},mouseEventToLayerPoint:function(c){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(c))},mouseEventToLatLng:function(c){return this.layerPointToLatLng(this.mouseEventToLayerPoint(c))},_initContainer:function(c){var h=this._container=Y(c);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Wt(h,"scroll",this._onScroll,this),this._containerId=d(h)},_initLayout:function(){var c=this._container;this._fadeAnimated=this.options.fadeAnimation&&fe.any3d,Me(c,"leaflet-container"+(fe.touch?" leaflet-touch":"")+(fe.retina?" leaflet-retina":"")+(fe.ielt9?" leaflet-oldie":"")+(fe.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=ne(c,"position");h!=="absolute"&&h!=="relative"&&h!=="fixed"&&h!=="sticky"&&(c.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var c=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ze(this._mapPane,new ge(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Me(c.markerPane,"leaflet-zoom-hide"),Me(c.shadowPane,"leaflet-zoom-hide"))},_resetView:function(c,h,_){ze(this._mapPane,new ge(0,0));var w=!this._loaded;this._loaded=!0,h=this._limitZoom(h),this.fire("viewprereset");var k=this._zoom!==h;this._moveStart(k,_)._move(c,h)._moveEnd(k),this.fire("viewreset"),w&&this.fire("load")},_moveStart:function(c,h){return c&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(c,h,_,w){h===void 0&&(h=this._zoom);var k=this._zoom!==h;return this._zoom=h,this._lastCenter=c,this._pixelOrigin=this._getNewPixelOrigin(c),w?_&&_.pinch&&this.fire("zoom",_):((k||_&&_.pinch)&&this.fire("zoom",_),this.fire("move",_)),this},_moveEnd:function(c){return c&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return ve(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(c){ze(this._mapPane,this._getMapPanePos().subtract(c))},_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(c){this._targets={},this._targets[d(this._container)]=this;var h=c?wi:Wt;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),fe.any3d&&this.options.transform3DLimit&&(c?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ve(this._resizeRequest),this._resizeRequest=ie(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var c=this._getMapPanePos();Math.max(Math.abs(c.x),Math.abs(c.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(c,h){for(var _=[],w,k=h==="mouseout"||h==="mouseover",W=c.target||c.srcElement,se=!1;W;){if(w=this._targets[d(W)],w&&(h==="click"||h==="preclick")&&this._draggableMoved(w)){se=!0;break}if(w&&w.listens(h,!0)&&(k&&!en(W,c)||(_.push(w),k))||W===this._container)break;W=W.parentNode}return!_.length&&!se&&!k&&this.listens(h,!0)&&(_=[this]),_},_isClickDisabled:function(c){for(;c&&c!==this._container;){if(c._leaflet_disable_click)return!0;c=c.parentNode}},_handleDOMEvent:function(c){var h=c.target||c.srcElement;if(!(!this._loaded||h._leaflet_disable_events||c.type==="click"&&this._isClickDisabled(h))){var _=c.type;_==="mousedown"&&Kt(h),this._fireDOMEvent(c,_)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(c,h,_){if(c.type==="click"){var w=n({},c);w.type="preclick",this._fireDOMEvent(w,w.type,_)}var k=this._findEventTargets(c,h);if(_){for(var W=[],se=0;se<_.length;se++)_[se].listens(h,!0)&&W.push(_[se]);k=W.concat(k)}if(k.length){h==="contextmenu"&&Rt(c);var Ie=k[0],Ke={originalEvent:c};if(c.type!=="keypress"&&c.type!=="keydown"&&c.type!=="keyup"){var It=Ie.getLatLng&&(!Ie._radius||Ie._radius<=10);Ke.containerPoint=It?this.latLngToContainerPoint(Ie.getLatLng()):this.mouseEventToContainerPoint(c),Ke.layerPoint=this.containerPointToLayerPoint(Ke.containerPoint),Ke.latlng=It?Ie.getLatLng():this.layerPointToLatLng(Ke.layerPoint)}for(se=0;se<k.length;se++)if(k[se].fire(h,Ke,!0),Ke.originalEvent._stopped||k[se].options.bubblingMouseEvents===!1&&R(this._mouseEvents,h)!==-1)return}},_draggableMoved:function(c){return c=c.dragging&&c.dragging.enabled()?c:this,c.dragging&&c.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var c=0,h=this._handlers.length;c<h;c++)this._handlers[c].disable()},whenReady:function(c,h){return this._loaded?c.call(h||this,{target:this}):this.on("load",c,h),this},_getMapPanePos:function(){return kt(this._mapPane)||new ge(0,0)},_moved:function(){var c=this._getMapPanePos();return c&&!c.equals([0,0])},_getTopLeftPoint:function(c,h){var _=c&&h!==void 0?this._getNewPixelOrigin(c,h):this.getPixelOrigin();return _.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(c,h){var _=this.getSize()._divideBy(2);return this.project(c,h)._subtract(_)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(c,h,_){var w=this._getNewPixelOrigin(_,h);return this.project(c,h)._subtract(w)},_latLngBoundsToNewLayerBounds:function(c,h,_){var w=this._getNewPixelOrigin(_,h);return lt([this.project(c.getSouthWest(),h)._subtract(w),this.project(c.getNorthWest(),h)._subtract(w),this.project(c.getSouthEast(),h)._subtract(w),this.project(c.getNorthEast(),h)._subtract(w)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(c){return this.latLngToLayerPoint(c).subtract(this._getCenterLayerPoint())},_limitCenter:function(c,h,_){if(!_)return c;var w=this.project(c,h),k=this.getSize().divideBy(2),W=new pe(w.subtract(k),w.add(k)),se=this._getBoundsOffset(W,_,h);return Math.abs(se.x)<=1&&Math.abs(se.y)<=1?c:this.unproject(w.add(se),h)},_limitOffset:function(c,h){if(!h)return c;var _=this.getPixelBounds(),w=new pe(_.min.add(c),_.max.add(c));return c.add(this._getBoundsOffset(w,h))},_getBoundsOffset:function(c,h,_){var w=lt(this.project(h.getNorthEast(),_),this.project(h.getSouthWest(),_)),k=w.min.subtract(c.min),W=w.max.subtract(c.max),se=this._rebound(k.x,-W.x),Ie=this._rebound(k.y,-W.y);return new ge(se,Ie)},_rebound:function(c,h){return c+h>0?Math.round(c-h)/2:Math.max(0,Math.ceil(c))-Math.max(0,Math.floor(h))},_limitZoom:function(c){var h=this.getMinZoom(),_=this.getMaxZoom(),w=fe.any3d?this.options.zoomSnap:1;return w&&(c=Math.round(c/w)*w),Math.max(h,Math.min(_,c))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){nt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(c,h){var _=this._getCenterOffset(c)._trunc();return(h&&h.animate)!==!0&&!this.getSize().contains(_)?!1:(this.panBy(_,h),!0)},_createAnimProxy:function(){var c=this._proxy=le("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(c),this.on("zoomanim",function(h){var _=q,w=this._proxy.style[_];je(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),w===this._proxy.style[_]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){oe(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var c=this.getCenter(),h=this.getZoom();je(this._proxy,this.project(c,h),this.getZoomScale(h,1))},_catchTransitionEnd:function(c){this._animatingZoom&&c.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(c,h,_){if(this._animatingZoom)return!0;if(_=_||{},!this._zoomAnimated||_.animate===!1||this._nothingToAnimate()||Math.abs(h-this._zoom)>this.options.zoomAnimationThreshold)return!1;var w=this.getZoomScale(h),k=this._getCenterOffset(c)._divideBy(1-1/w);return _.animate!==!0&&!this.getSize().contains(k)?!1:(ie(function(){this._moveStart(!0,_.noMoveStart||!1)._animateZoom(c,h,!0)},this),!0)},_animateZoom:function(c,h,_,w){this._mapPane&&(_&&(this._animatingZoom=!0,this._animateToCenter=c,this._animateToZoom=h,Me(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:c,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&&nt(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 Rn(c,h){return new Ni(c,h)}var Ki=Q.extend({options:{position:"topright"},initialize:function(c){E(this,c)},getPosition:function(){return this.options.position},setPosition:function(c){var h=this._map;return h&&h.removeControl(this),this.options.position=c,h&&h.addControl(this),this},getContainer:function(){return this._container},addTo:function(c){this.remove(),this._map=c;var h=this._container=this.onAdd(c),_=this.getPosition(),w=c._controlCorners[_];return Me(h,"leaflet-control"),_.indexOf("bottom")!==-1?w.insertBefore(h,w.firstChild):w.appendChild(h),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(oe(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(c){this._map&&c&&c.screenX>0&&c.screenY>0&&this._map.getContainer().focus()}}),Vi=function(c){return new Ki(c)};Ni.include({addControl:function(c){return c.addTo(this),this},removeControl:function(c){return c.remove(),this},_initControlPos:function(){var c=this._controlCorners={},h="leaflet-",_=this._controlContainer=le("div",h+"control-container",this._container);function w(k,W){var se=h+k+" "+h+W;c[k+W]=le("div",se,_)}w("top","left"),w("top","right"),w("bottom","left"),w("bottom","right")},_clearControlPos:function(){for(var c in this._controlCorners)oe(this._controlCorners[c]);oe(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var nn=Ki.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(c,h,_,w){return _<w?-1:w<_?1:0}},initialize:function(c,h,_){E(this,_),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var w in c)this._addLayer(c[w],w);for(w in h)this._addLayer(h[w],w,!0)},onAdd:function(c){this._initLayout(),this._update(),this._map=c,c.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(c){return Ki.prototype.addTo.call(this,c),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var c=0;c<this._layers.length;c++)this._layers[c].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(c,h){return this._addLayer(c,h),this._map?this._update():this},addOverlay:function(c,h){return this._addLayer(c,h,!0),this._map?this._update():this},removeLayer:function(c){c.off("add remove",this._onLayerChange,this);var h=this._getLayer(d(c));return h&&this._layers.splice(this._layers.indexOf(h),1),this._map?this._update():this},expand:function(){Me(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var c=this._map.getSize().y-(this._container.offsetTop+50);return c<this._section.clientHeight?(Me(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=c+"px"):nt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return nt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var c="leaflet-control-layers",h=this._container=le("div",c),_=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Lt(h),ut(h);var w=this._section=le("section",c+"-list");_&&(this._map.on("click",this.collapse,this),Wt(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var k=this._layersLink=le("a",c+"-toggle",h);k.href="#",k.title="Layers",k.setAttribute("role","button"),Wt(k,{keydown:function(W){W.keyCode===13&&this._expandSafely()},click:function(W){Rt(W),this._expandSafely()}},this),_||this.expand(),this._baseLayersList=le("div",c+"-base",w),this._separator=le("div",c+"-separator",w),this._overlaysList=le("div",c+"-overlays",w),h.appendChild(w)},_getLayer:function(c){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&d(this._layers[h].layer)===c)return this._layers[h]},_addLayer:function(c,h,_){this._map&&c.on("add remove",this._onLayerChange,this),this._layers.push({layer:c,name:h,overlay:_}),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&&c.setZIndex&&(this._lastZIndex++,c.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;ye(this._baseLayersList),ye(this._overlaysList),this._layerControlInputs=[];var c,h,_,w,k=0;for(_=0;_<this._layers.length;_++)w=this._layers[_],this._addItem(w),h=h||w.overlay,c=c||!w.overlay,k+=w.overlay?0:1;return this.options.hideSingleBase&&(c=c&&k>1,this._baseLayersList.style.display=c?"":"none"),this._separator.style.display=h&&c?"":"none",this},_onLayerChange:function(c){this._handlingClick||this._update();var h=this._getLayer(d(c.target)),_=h.overlay?c.type==="add"?"overlayadd":"overlayremove":c.type==="add"?"baselayerchange":null;_&&this._map.fire(_,h)},_createRadioElement:function(c,h){var _='<input type="radio" class="leaflet-control-layers-selector" name="'+c+'"'+(h?' checked="checked"':"")+"/>",w=document.createElement("div");return w.innerHTML=_,w.firstChild},_addItem:function(c){var h=document.createElement("label"),_=this._map.hasLayer(c.layer),w;c.overlay?(w=document.createElement("input"),w.type="checkbox",w.className="leaflet-control-layers-selector",w.defaultChecked=_):w=this._createRadioElement("leaflet-base-layers_"+d(this),_),this._layerControlInputs.push(w),w.layerId=d(c.layer),Wt(w,"click",this._onInputClick,this);var k=document.createElement("span");k.innerHTML=" "+c.name;var W=document.createElement("span");h.appendChild(W),W.appendChild(w),W.appendChild(k);var se=c.overlay?this._overlaysList:this._baseLayersList;return se.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var c=this._layerControlInputs,h,_,w=[],k=[];this._handlingClick=!0;for(var W=c.length-1;W>=0;W--)h=c[W],_=this._getLayer(h.layerId).layer,h.checked?w.push(_):h.checked||k.push(_);for(W=0;W<k.length;W++)this._map.hasLayer(k[W])&&this._map.removeLayer(k[W]);for(W=0;W<w.length;W++)this._map.hasLayer(w[W])||this._map.addLayer(w[W]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var c=this._layerControlInputs,h,_,w=this._map.getZoom(),k=c.length-1;k>=0;k--)h=c[k],_=this._getLayer(h.layerId).layer,h.disabled=_.options.minZoom!==void 0&&w<_.options.minZoom||_.options.maxZoom!==void 0&&w>_.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var c=this._section;this._preventClick=!0,Wt(c,"click",Rt),this.expand();var h=this;setTimeout(function(){wi(c,"click",Rt),h._preventClick=!1})}}),Mn=function(c,h,_){return new nn(c,h,_)},Cs=Ki.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(c){var h="leaflet-control-zoom",_=le("div",h+" leaflet-bar"),w=this.options;return this._zoomInButton=this._createButton(w.zoomInText,w.zoomInTitle,h+"-in",_,this._zoomIn),this._zoomOutButton=this._createButton(w.zoomOutText,w.zoomOutTitle,h+"-out",_,this._zoomOut),this._updateDisabled(),c.on("zoomend zoomlevelschange",this._updateDisabled,this),_},onRemove:function(c){c.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(c){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(c.shiftKey?3:1))},_zoomOut:function(c){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(c.shiftKey?3:1))},_createButton:function(c,h,_,w,k){var W=le("a",_,w);return W.innerHTML=c,W.href="#",W.title=h,W.setAttribute("role","button"),W.setAttribute("aria-label",h),Lt(W),Wt(W,"click",si),Wt(W,"click",k,this),Wt(W,"click",this._refocusOnMap,this),W},_updateDisabled:function(){var c=this._map,h="leaflet-disabled";nt(this._zoomInButton,h),nt(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||c._zoom===c.getMinZoom())&&(Me(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||c._zoom===c.getMaxZoom())&&(Me(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ni.mergeOptions({zoomControl:!0}),Ni.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Cs,this.addControl(this.zoomControl))});var Fn=function(c){return new Cs(c)},zn=Ki.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(c){var h="leaflet-control-scale",_=le("div",h),w=this.options;return this._addScales(w,h+"-line",_),c.on(w.updateWhenIdle?"moveend":"move",this._update,this),c.whenReady(this._update,this),_},onRemove:function(c){c.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(c,h,_){c.metric&&(this._mScale=le("div",h,_)),c.imperial&&(this._iScale=le("div",h,_))},_update:function(){var c=this._map,h=c.getSize().y/2,_=c.distance(c.containerPointToLatLng([0,h]),c.containerPointToLatLng([this.options.maxWidth,h]));this._updateScales(_)},_updateScales:function(c){this.options.metric&&c&&this._updateMetric(c),this.options.imperial&&c&&this._updateImperial(c)},_updateMetric:function(c){var h=this._getRoundNum(c),_=h<1e3?h+" m":h/1e3+" km";this._updateScale(this._mScale,_,h/c)},_updateImperial:function(c){var h=c*3.2808399,_,w,k;h>5280?(_=h/5280,w=this._getRoundNum(_),this._updateScale(this._iScale,w+" mi",w/_)):(k=this._getRoundNum(h),this._updateScale(this._iScale,k+" ft",k/h))},_updateScale:function(c,h,_){c.style.width=Math.round(this.options.maxWidth*_)+"px",c.innerHTML=h},_getRoundNum:function(c){var h=Math.pow(10,(Math.floor(c)+"").length-1),_=c/h;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:1,h*_}}),as=function(c){return new zn(c)},Es='<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>',Ns=Ki.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(fe.inlineSvg?Es+" ":"")+"Leaflet</a>"},initialize:function(c){E(this,c),this._attributions={}},onAdd:function(c){c.attributionControl=this,this._container=le("div","leaflet-control-attribution"),Lt(this._container);for(var h in c._layers)c._layers[h].getAttribution&&this.addAttribution(c._layers[h].getAttribution());return this._update(),c.on("layeradd",this._addAttribution,this),this._container},onRemove:function(c){c.off("layeradd",this._addAttribution,this)},_addAttribution:function(c){c.layer.getAttribution&&(this.addAttribution(c.layer.getAttribution()),c.layer.once("remove",function(){this.removeAttribution(c.layer.getAttribution())},this))},setPrefix:function(c){return this.options.prefix=c,this._update(),this},addAttribution:function(c){return c?(this._attributions[c]||(this._attributions[c]=0),this._attributions[c]++,this._update(),this):this},removeAttribution:function(c){return c?(this._attributions[c]&&(this._attributions[c]--,this._update()),this):this},_update:function(){if(this._map){var c=[];for(var h in this._attributions)this._attributions[h]&&c.push(h);var _=[];this.options.prefix&&_.push(this.options.prefix),c.length&&_.push(c.join(", ")),this._container.innerHTML=_.join(' <span aria-hidden="true">|</span> ')}}});Ni.mergeOptions({attributionControl:!0}),Ni.addInitHook(function(){this.options.attributionControl&&new Ns().addTo(this)});var Cn=function(c){return new Ns(c)};Ki.Layers=nn,Ki.Zoom=Cs,Ki.Scale=zn,Ki.Attribution=Ns,Vi.layers=Mn,Vi.zoom=Fn,Vi.scale=as,Vi.attribution=Cn;var Kn=Q.extend({initialize:function(c){this._map=c},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}});Kn.addTo=function(c,h){return c.addHandler(h,this),this};var eo={Events:De},to=fe.touch?"touchstart mousedown":"mousedown",xs=Fe.extend({options:{clickTolerance:3},initialize:function(c,h,_,w){E(this,w),this._element=c,this._dragStartTarget=h||c,this._preventOutline=_},enable:function(){this._enabled||(Wt(this._dragStartTarget,to,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xs._dragging===this&&this.finishDrag(!0),wi(this._dragStartTarget,to,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(c){if(this._enabled&&(this._moved=!1,!Le(this._element,"leaflet-zoom-anim"))){if(c.touches&&c.touches.length!==1){xs._dragging===this&&this.finishDrag();return}if(!(xs._dragging||c.shiftKey||c.which!==1&&c.button!==1&&!c.touches)&&(xs._dragging=this,this._preventOutline&&Kt(this._element),tt(),ct(),!this._moving)){this.fire("down");var h=c.touches?c.touches[0]:c,_=Et(this._element);this._startPoint=new ge(h.clientX,h.clientY),this._startPos=kt(this._element),this._parentScale=Zt(_);var w=c.type==="mousedown";Wt(document,w?"mousemove":"touchmove",this._onMove,this),Wt(document,w?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(c){if(this._enabled){if(c.touches&&c.touches.length>1){this._moved=!0;return}var h=c.touches&&c.touches.length===1?c.touches[0]:c,_=new ge(h.clientX,h.clientY)._subtract(this._startPoint);!_.x&&!_.y||Math.abs(_.x)+Math.abs(_.y)<this.options.clickTolerance||(_.x/=this._parentScale.x,_.y/=this._parentScale.y,Rt(c),this._moved||(this.fire("dragstart"),this._moved=!0,Me(document.body,"leaflet-dragging"),this._lastTarget=c.target||c.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Me(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(_),this._moving=!0,this._lastEvent=c,this._updatePosition())}},_updatePosition:function(){var c={originalEvent:this._lastEvent};this.fire("predrag",c),ze(this._element,this._newPos),this.fire("drag",c)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(c){nt(document.body,"leaflet-dragging"),this._lastTarget&&(nt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),wi(document,"mousemove touchmove",this._onMove,this),wi(document,"mouseup touchend touchcancel",this._onUp,this),Bt(),Qe();var h=this._moved&&this._moving;this._moving=!1,xs._dragging=!1,h&&this.fire("dragend",{noInertia:c,distance:this._newPos.distanceTo(this._startPos)})}});function ar(c,h,_){var w,k=[1,4,2,8],W,se,Ie,Ke,It,Wi,hn,Wn;for(W=0,Wi=c.length;W<Wi;W++)c[W]._code=Mr(c[W],h);for(Ie=0;Ie<4;Ie++){for(hn=k[Ie],w=[],W=0,Wi=c.length,se=Wi-1;W<Wi;se=W++)Ke=c[W],It=c[se],Ke._code&hn?It._code&hn||(Wn=Is(It,Ke,hn,h,_),Wn._code=Mr(Wn,h),w.push(Wn)):(It._code&hn&&(Wn=Is(It,Ke,hn,h,_),Wn._code=Mr(Wn,h),w.push(Wn)),w.push(Ke));c=w}return c}function nc(c,h){var _,w,k,W,se,Ie,Ke,It,Wi;if(!c||c.length===0)throw new Error("latlngs not passed");Bo(c)||(console.warn("latlngs are not flat! Only the first ring will be used"),c=c[0]);var hn=me([0,0]),Wn=Xe(c),So=Wn.getNorthWest().distanceTo(Wn.getSouthWest())*Wn.getNorthEast().distanceTo(Wn.getNorthWest());So<1700&&(hn=sc(c));var fo=c.length,lr=[];for(_=0;_<fo;_++){var zo=me(c[_]);lr.push(h.project(me([zo.lat-hn.lat,zo.lng-hn.lng])))}for(Ie=Ke=It=0,_=0,w=fo-1;_<fo;w=_++)k=lr[_],W=lr[w],se=k.y*W.x-W.y*k.x,Ke+=(k.x+W.x)*se,It+=(k.y+W.y)*se,Ie+=se*3;Ie===0?Wi=lr[0]:Wi=[Ke/Ie,It/Ie];var Ih=h.unproject(Oe(Wi));return me([Ih.lat+hn.lat,Ih.lng+hn.lng])}function sc(c){for(var h=0,_=0,w=0,k=0;k<c.length;k++){var W=me(c[k]);h+=W.lat,_+=W.lng,w++}return me([h/w,_/w])}var N0={__proto__:null,clipPolygon:ar,polygonCenter:nc,centroid:sc};function oc(c,h){if(!h||!c.length)return c.slice();var _=h*h;return c=Eh(c,_),c=xd(c,_),c}function pd(c,h,_){return Math.sqrt(Ia(c,h,_,!0))}function Ch(c,h,_){return Ia(c,h,_)}function xd(c,h){var _=c.length,w=typeof Uint8Array<"u"?Uint8Array:Array,k=new w(_);k[0]=k[_-1]=1,rc(c,k,h,0,_-1);var W,se=[];for(W=0;W<_;W++)k[W]&&se.push(c[W]);return se}function rc(c,h,_,w,k){var W=0,se,Ie,Ke;for(Ie=w+1;Ie<=k-1;Ie++)Ke=Ia(c[Ie],c[w],c[k],!0),Ke>W&&(se=Ie,W=Ke);W>_&&(h[se]=1,rc(c,h,_,w,se),rc(c,h,_,se,k))}function Eh(c,h){for(var _=[c[0]],w=1,k=0,W=c.length;w<W;w++)md(c[w],c[k])>h&&(_.push(c[w]),k=w);return k<W-1&&_.push(c[W-1]),_}var ac;function vd(c,h,_,w,k){var W=w?ac:Mr(c,_),se=Mr(h,_),Ie,Ke,It;for(ac=se;;){if(!(W|se))return[c,h];if(W&se)return!1;Ie=W||se,Ke=Is(c,h,Ie,_,k),It=Mr(Ke,_),Ie===W?(c=Ke,W=It):(h=Ke,se=It)}}function Is(c,h,_,w,k){var W=h.x-c.x,se=h.y-c.y,Ie=w.min,Ke=w.max,It,Wi;return _&8?(It=c.x+W*(Ke.y-c.y)/se,Wi=Ke.y):_&4?(It=c.x+W*(Ie.y-c.y)/se,Wi=Ie.y):_&2?(It=Ke.x,Wi=c.y+se*(Ke.x-c.x)/W):_&1&&(It=Ie.x,Wi=c.y+se*(Ie.x-c.x)/W),new ge(It,Wi,k)}function Mr(c,h){var _=0;return c.x<h.min.x?_|=1:c.x>h.max.x&&(_|=2),c.y<h.min.y?_|=4:c.y>h.max.y&&(_|=8),_}function md(c,h){var _=h.x-c.x,w=h.y-c.y;return _*_+w*w}function Ia(c,h,_,w){var k=h.x,W=h.y,se=_.x-k,Ie=_.y-W,Ke=se*se+Ie*Ie,It;return Ke>0&&(It=((c.x-k)*se+(c.y-W)*Ie)/Ke,It>1?(k=_.x,W=_.y):It>0&&(k+=se*It,W+=Ie*It)),se=c.x-k,Ie=c.y-W,w?se*se+Ie*Ie:new ge(k,W)}function Bo(c){return!M(c[0])||typeof c[0][0]!="object"&&typeof c[0][0]<"u"}function yh(c){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Bo(c)}function lc(c,h){var _,w,k,W,se,Ie,Ke,It;if(!c||c.length===0)throw new Error("latlngs not passed");Bo(c)||(console.warn("latlngs are not flat! Only the first ring will be used"),c=c[0]);var Wi=me([0,0]),hn=Xe(c),Wn=hn.getNorthWest().distanceTo(hn.getSouthWest())*hn.getNorthEast().distanceTo(hn.getNorthWest());Wn<1700&&(Wi=sc(c));var So=c.length,fo=[];for(_=0;_<So;_++){var lr=me(c[_]);fo.push(h.project(me([lr.lat-Wi.lat,lr.lng-Wi.lng])))}for(_=0,w=0;_<So-1;_++)w+=fo[_].distanceTo(fo[_+1])/2;if(w===0)It=fo[0];else for(_=0,W=0;_<So-1;_++)if(se=fo[_],Ie=fo[_+1],k=se.distanceTo(Ie),W+=k,W>w){Ke=(W-w)/k,It=[Ie.x-Ke*(Ie.x-se.x),Ie.y-Ke*(Ie.y-se.y)];break}var zo=h.unproject(Oe(It));return me([zo.lat+Wi.lat,zo.lng+Wi.lng])}var Pa={__proto__:null,simplify:oc,pointToSegmentDistance:pd,closestPointOnSegment:Ch,clipSegment:vd,_getEdgeIntersection:Is,_getBitCode:Mr,_sqClosestPointOnSegment:Ia,isFlat:Bo,_flat:yh,polylineCenter:lc},_d={project:function(c){return new ge(c.lng,c.lat)},unproject:function(c){return new ht(c.y,c.x)},bounds:new pe([-180,-90],[180,90])},bd={R:6378137,R_MINOR:6356752314245179e-9,bounds:new pe([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(c){var h=Math.PI/180,_=this.R,w=c.lat*h,k=this.R_MINOR/_,W=Math.sqrt(1-k*k),se=W*Math.sin(w),Ie=Math.tan(Math.PI/4-w/2)/Math.pow((1-se)/(1+se),W/2);return w=-_*Math.log(Math.max(Ie,1e-10)),new ge(c.lng*h*_,w)},unproject:function(c){for(var h=180/Math.PI,_=this.R,w=this.R_MINOR/_,k=Math.sqrt(1-w*w),W=Math.exp(-c.y/_),se=Math.PI/2-2*Math.atan(W),Ie=0,Ke=.1,It;Ie<15&&Math.abs(Ke)>1e-7;Ie++)It=k*Math.sin(se),It=Math.pow((1-It)/(1+It),k/2),Ke=Math.PI/2-2*Math.atan(W*It)-se,se+=Ke;return new ht(se*h,c.x*h/_)}},O0={__proto__:null,LonLat:_d,Mercator:bd,SphericalMercator:rt},Cd=n({},st,{code:"EPSG:3395",projection:bd,transformation:(function(){var c=.5/(Math.PI*bd.R);return ui(c,.5,-c,.5)})()}),wh=n({},st,{code:"EPSG:4326",projection:_d,transformation:ui(1/180,1,-1/180,.5)}),Sh=n({},Be,{projection:_d,transformation:ui(1,0,-1,0),scale:function(c){return Math.pow(2,c)},zoom:function(c){return Math.log(c)/Math.LN2},distance:function(c,h){var _=h.lng-c.lng,w=h.lat-c.lat;return Math.sqrt(_*_+w*w)},infinite:!0});Be.Earth=st,Be.EPSG3395=Cd,Be.EPSG3857=ci,Be.EPSG900913=hi,Be.EPSG4326=wh,Be.Simple=Sh;var vo=Fe.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(c){return c.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(c){return c&&c.removeLayer(this),this},getPane:function(c){return this._map.getPane(c?this.options[c]||c:this.options.pane)},addInteractiveTarget:function(c){return this._map._targets[d(c)]=this,this},removeInteractiveTarget:function(c){return delete this._map._targets[d(c)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(c){var h=c.target;if(h.hasLayer(this)){if(this._map=h,this._zoomAnimated=h._zoomAnimated,this.getEvents){var _=this.getEvents();h.on(_,this),this.once("remove",function(){h.off(_,this)},this)}this.onAdd(h),this.fire("add"),h.fire("layeradd",{layer:this})}}});Ni.include({addLayer:function(c){if(!c._layerAdd)throw new Error("The provided object is not a Layer.");var h=d(c);return this._layers[h]?this:(this._layers[h]=c,c._mapToAdd=this,c.beforeAdd&&c.beforeAdd(this),this.whenReady(c._layerAdd,c),this)},removeLayer:function(c){var h=d(c);return this._layers[h]?(this._loaded&&c.onRemove(this),delete this._layers[h],this._loaded&&(this.fire("layerremove",{layer:c}),c.fire("remove")),c._map=c._mapToAdd=null,this):this},hasLayer:function(c){return d(c)in this._layers},eachLayer:function(c,h){for(var _ in this._layers)c.call(h,this._layers[_]);return this},_addLayers:function(c){c=c?M(c)?c:[c]:[];for(var h=0,_=c.length;h<_;h++)this.addLayer(c[h])},_addZoomLimit:function(c){(!isNaN(c.options.maxZoom)||!isNaN(c.options.minZoom))&&(this._zoomBoundLayers[d(c)]=c,this._updateZoomLevels())},_removeZoomLimit:function(c){var h=d(c);this._zoomBoundLayers[h]&&(delete this._zoomBoundLayers[h],this._updateZoomLevels())},_updateZoomLevels:function(){var c=1/0,h=-1/0,_=this._getZoomSpan();for(var w in this._zoomBoundLayers){var k=this._zoomBoundLayers[w].options;c=k.minZoom===void 0?c:Math.min(c,k.minZoom),h=k.maxZoom===void 0?h:Math.max(h,k.maxZoom)}this._layersMaxZoom=h===-1/0?void 0:h,this._layersMinZoom=c===1/0?void 0:c,_!==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 pl=vo.extend({initialize:function(c,h){E(this,h),this._layers={};var _,w;if(c)for(_=0,w=c.length;_<w;_++)this.addLayer(c[_])},addLayer:function(c){var h=this.getLayerId(c);return this._layers[h]=c,this._map&&this._map.addLayer(c),this},removeLayer:function(c){var h=c in this._layers?c:this.getLayerId(c);return this._map&&this._layers[h]&&this._map.removeLayer(this._layers[h]),delete this._layers[h],this},hasLayer:function(c){var h=typeof c=="number"?c:this.getLayerId(c);return h in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(c){var h=Array.prototype.slice.call(arguments,1),_,w;for(_ in this._layers)w=this._layers[_],w[c]&&w[c].apply(w,h);return this},onAdd:function(c){this.eachLayer(c.addLayer,c)},onRemove:function(c){this.eachLayer(c.removeLayer,c)},eachLayer:function(c,h){for(var _ in this._layers)c.call(h,this._layers[_]);return this},getLayer:function(c){return this._layers[c]},getLayers:function(){var c=[];return this.eachLayer(c.push,c),c},setZIndex:function(c){return this.invoke("setZIndex",c)},getLayerId:function(c){return d(c)}}),hx=function(c,h){return new pl(c,h)},aa=pl.extend({addLayer:function(c){return this.hasLayer(c)?this:(c.addEventParent(this),pl.prototype.addLayer.call(this,c),this.fire("layeradd",{layer:c}))},removeLayer:function(c){return this.hasLayer(c)?(c in this._layers&&(c=this._layers[c]),c.removeEventParent(this),pl.prototype.removeLayer.call(this,c),this.fire("layerremove",{layer:c})):this},setStyle:function(c){return this.invoke("setStyle",c)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var c=new Ot;for(var h in this._layers){var _=this._layers[h];c.extend(_.getBounds?_.getBounds():_.getLatLng())}return c}}),fx=function(c,h){return new aa(c,h)},cc=Q.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(c){E(this,c)},createIcon:function(c){return this._createIcon("icon",c)},createShadow:function(c){return this._createIcon("shadow",c)},_createIcon:function(c,h){var _=this._getIconUrl(c);if(!_){if(c==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var w=this._createImg(_,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(w,c),(this.options.crossOrigin||this.options.crossOrigin==="")&&(w.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),w},_setIconStyles:function(c,h){var _=this.options,w=_[h+"Size"];typeof w=="number"&&(w=[w,w]);var k=Oe(w),W=Oe(h==="shadow"&&_.shadowAnchor||_.iconAnchor||k&&k.divideBy(2,!0));c.className="leaflet-marker-"+h+" "+(_.className||""),W&&(c.style.marginLeft=-W.x+"px",c.style.marginTop=-W.y+"px"),k&&(c.style.width=k.x+"px",c.style.height=k.y+"px")},_createImg:function(c,h){return h=h||document.createElement("img"),h.src=c,h},_getIconUrl:function(c){return fe.retina&&this.options[c+"RetinaUrl"]||this.options[c+"Url"]}});function gx(c){return new cc(c)}var dc=cc.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(c){return typeof dc.imagePath!="string"&&(dc.imagePath=this._detectIconPath()),(this.options.imagePath||dc.imagePath)+cc.prototype._getIconUrl.call(this,c)},_stripUrl:function(c){var h=function(_,w,k){var W=w.exec(_);return W&&W[k]};return c=h(c,/^url\((['"])?(.+)\1\)$/,2),c&&h(c,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var c=le("div","leaflet-default-icon-path",document.body),h=ne(c,"background-image")||ne(c,"backgroundImage");if(document.body.removeChild(c),h=this._stripUrl(h),h)return h;var _=document.querySelector('link[href$="leaflet.css"]');return _?_.href.substring(0,_.href.length-11-1):""}}),Ed=Kn.extend({initialize:function(c){this._marker=c},addHooks:function(){var c=this._marker._icon;this._draggable||(this._draggable=new xs(c,c,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Me(c,"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&&nt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(c){var h=this._marker,_=h._map,w=this._marker.options.autoPanSpeed,k=this._marker.options.autoPanPadding,W=kt(h._icon),se=_.getPixelBounds(),Ie=_.getPixelOrigin(),Ke=lt(se.min._subtract(Ie).add(k),se.max._subtract(Ie).subtract(k));if(!Ke.contains(W)){var It=Oe((Math.max(Ke.max.x,W.x)-Ke.max.x)/(se.max.x-Ke.max.x)-(Math.min(Ke.min.x,W.x)-Ke.min.x)/(se.min.x-Ke.min.x),(Math.max(Ke.max.y,W.y)-Ke.max.y)/(se.max.y-Ke.max.y)-(Math.min(Ke.min.y,W.y)-Ke.min.y)/(se.min.y-Ke.min.y)).multiplyBy(w);_.panBy(It,{animate:!1}),this._draggable._newPos._add(It),this._draggable._startPos._add(It),ze(h._icon,this._draggable._newPos),this._onDrag(c),this._panRequest=ie(this._adjustPan.bind(this,c))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(c){this._marker.options.autoPan&&(ve(this._panRequest),this._panRequest=ie(this._adjustPan.bind(this,c)))},_onDrag:function(c){var h=this._marker,_=h._shadow,w=kt(h._icon),k=h._map.layerPointToLatLng(w);_&&ze(_,w),h._latlng=k,c.latlng=k,c.oldLatLng=this._oldLatLng,h.fire("move",c).fire("drag",c)},_onDragEnd:function(c){ve(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",c)}}),Dh=vo.extend({options:{icon:new dc,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(c,h){E(this,h),this._latlng=me(c)},onAdd:function(c){this._zoomAnimated=this._zoomAnimated&&c.options.markerZoomAnimation,this._zoomAnimated&&c.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(c){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&c.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(c){var h=this._latlng;return this._latlng=me(c),this.update(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},setZIndexOffset:function(c){return this.options.zIndexOffset=c,this.update()},getIcon:function(){return this.options.icon},setIcon:function(c){return this.options.icon=c,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 c=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(c)}return this},_initIcon:function(){var c=this.options,h="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),_=c.icon.createIcon(this._icon),w=!1;_!==this._icon&&(this._icon&&this._removeIcon(),w=!0,c.title&&(_.title=c.title),_.tagName==="IMG"&&(_.alt=c.alt||"")),Me(_,h),c.keyboard&&(_.tabIndex="0",_.setAttribute("role","button")),this._icon=_,c.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Wt(_,"focus",this._panOnFocus,this);var k=c.icon.createShadow(this._shadow),W=!1;k!==this._shadow&&(this._removeShadow(),W=!0),k&&(Me(k,h),k.alt=""),this._shadow=k,c.opacity<1&&this._updateOpacity(),w&&this.getPane().appendChild(this._icon),this._initInteraction(),k&&W&&this.getPane(c.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),oe(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&oe(this._shadow),this._shadow=null},_setPos:function(c){this._icon&&ze(this._icon,c),this._shadow&&ze(this._shadow,c),this._zIndex=c.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(c){this._icon&&(this._icon.style.zIndex=this._zIndex+c)},_animateZoom:function(c){var h=this._map._latLngToNewLayerPoint(this._latlng,c.zoom,c.center).round();this._setPos(h)},_initInteraction:function(){if(this.options.interactive&&(Me(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ed)){var c=this.options.draggable;this.dragging&&(c=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ed(this),c&&this.dragging.enable()}},setOpacity:function(c){return this.options.opacity=c,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var c=this.options.opacity;this._icon&&de(this._icon,c),this._shadow&&de(this._shadow,c)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var c=this._map;if(c){var h=this.options.icon.options,_=h.iconSize?Oe(h.iconSize):Oe(0,0),w=h.iconAnchor?Oe(h.iconAnchor):Oe(0,0);c.panInside(this._latlng,{paddingTopLeft:w,paddingBottomRight:_.subtract(w)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function px(c,h){return new Dh(c,h)}var Ta=vo.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(c){this._renderer=c.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(c){return E(this,c),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&c&&Object.prototype.hasOwnProperty.call(c,"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)}}),Ah=Ta.extend({options:{fill:!0,radius:10},initialize:function(c,h){E(this,h),this._latlng=me(c),this._radius=this.options.radius},setLatLng:function(c){var h=this._latlng;return this._latlng=me(c),this.redraw(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(c){return this.options.radius=this._radius=c,this.redraw()},getRadius:function(){return this._radius},setStyle:function(c){var h=c&&c.radius||this._radius;return Ta.prototype.setStyle.call(this,c),this.setRadius(h),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var c=this._radius,h=this._radiusY||c,_=this._clickTolerance(),w=[c+_,h+_];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(c){return c.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function xx(c,h){return new Ah(c,h)}var H0=Ah.extend({initialize:function(c,h,_){if(typeof h=="number"&&(h=n({},_,{radius:h})),E(this,h),this._latlng=me(c),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(c){return this._mRadius=c,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var c=[this._radius,this._radiusY||this._radius];return new Ot(this._map.layerPointToLatLng(this._point.subtract(c)),this._map.layerPointToLatLng(this._point.add(c)))},setStyle:Ta.prototype.setStyle,_project:function(){var c=this._latlng.lng,h=this._latlng.lat,_=this._map,w=_.options.crs;if(w.distance===st.distance){var k=Math.PI/180,W=this._mRadius/st.R/k,se=_.project([h+W,c]),Ie=_.project([h-W,c]),Ke=se.add(Ie).divideBy(2),It=_.unproject(Ke).lat,Wi=Math.acos((Math.cos(W*k)-Math.sin(h*k)*Math.sin(It*k))/(Math.cos(h*k)*Math.cos(It*k)))/k;(isNaN(Wi)||Wi===0)&&(Wi=W/Math.cos(Math.PI/180*h)),this._point=Ke.subtract(_.getPixelOrigin()),this._radius=isNaN(Wi)?0:Ke.x-_.project([It,c-Wi]).x,this._radiusY=Ke.y-se.y}else{var hn=w.unproject(w.project(this._latlng).subtract([this._mRadius,0]));this._point=_.latLngToLayerPoint(this._latlng),this._radius=this._point.x-_.latLngToLayerPoint(hn).x}this._updateBounds()}});function W0(c,h,_){return new H0(c,h,_)}var Rr=Ta.extend({options:{smoothFactor:1,noClip:!1},initialize:function(c,h){E(this,h),this._setLatLngs(c)},getLatLngs:function(){return this._latlngs},setLatLngs:function(c){return this._setLatLngs(c),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(c){for(var h=1/0,_=null,w=Ia,k,W,se=0,Ie=this._parts.length;se<Ie;se++)for(var Ke=this._parts[se],It=1,Wi=Ke.length;It<Wi;It++){k=Ke[It-1],W=Ke[It];var hn=w(c,k,W,!0);hn<h&&(h=hn,_=w(c,k,W))}return _&&(_.distance=Math.sqrt(h)),_},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return lc(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(c,h){return h=h||this._defaultShape(),c=me(c),h.push(c),this._bounds.extend(c),this.redraw()},_setLatLngs:function(c){this._bounds=new Ot,this._latlngs=this._convertLatLngs(c)},_defaultShape:function(){return Bo(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(c){for(var h=[],_=Bo(c),w=0,k=c.length;w<k;w++)_?(h[w]=me(c[w]),this._bounds.extend(h[w])):h[w]=this._convertLatLngs(c[w]);return h},_project:function(){var c=new pe;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,c),this._bounds.isValid()&&c.isValid()&&(this._rawPxBounds=c,this._updateBounds())},_updateBounds:function(){var c=this._clickTolerance(),h=new ge(c,c);this._rawPxBounds&&(this._pxBounds=new pe([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(c,h,_){var w=c[0]instanceof ht,k=c.length,W,se;if(w){for(se=[],W=0;W<k;W++)se[W]=this._map.latLngToLayerPoint(c[W]),_.extend(se[W]);h.push(se)}else for(W=0;W<k;W++)this._projectLatlngs(c[W],h,_)},_clipPoints:function(){var c=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(c))){if(this.options.noClip){this._parts=this._rings;return}var h=this._parts,_,w,k,W,se,Ie,Ke;for(_=0,k=0,W=this._rings.length;_<W;_++)for(Ke=this._rings[_],w=0,se=Ke.length;w<se-1;w++)Ie=vd(Ke[w],Ke[w+1],c,w,!0),Ie&&(h[k]=h[k]||[],h[k].push(Ie[0]),(Ie[1]!==Ke[w+1]||w===se-2)&&(h[k].push(Ie[1]),k++))}},_simplifyPoints:function(){for(var c=this._parts,h=this.options.smoothFactor,_=0,w=c.length;_<w;_++)c[_]=oc(c[_],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(c,h){var _,w,k,W,se,Ie,Ke=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(c))return!1;for(_=0,W=this._parts.length;_<W;_++)for(Ie=this._parts[_],w=0,se=Ie.length,k=se-1;w<se;k=w++)if(!(!h&&w===0)&&pd(c,Ie[k],Ie[w])<=Ke)return!0;return!1}});function Ub(c,h){return new Rr(c,h)}Rr._flat=yh;var xl=Rr.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 nc(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(c){var h=Rr.prototype._convertLatLngs.call(this,c),_=h.length;return _>=2&&h[0]instanceof ht&&h[0].equals(h[_-1])&&h.pop(),h},_setLatLngs:function(c){Rr.prototype._setLatLngs.call(this,c),Bo(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Bo(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var c=this._renderer._bounds,h=this.options.weight,_=new ge(h,h);if(c=new pe(c.min.subtract(_),c.max.add(_)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(c))){if(this.options.noClip){this._parts=this._rings;return}for(var w=0,k=this._rings.length,W;w<k;w++)W=ar(this._rings[w],c,!0),W.length&&this._parts.push(W)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(c){var h=!1,_,w,k,W,se,Ie,Ke,It;if(!this._pxBounds||!this._pxBounds.contains(c))return!1;for(W=0,Ke=this._parts.length;W<Ke;W++)for(_=this._parts[W],se=0,It=_.length,Ie=It-1;se<It;Ie=se++)w=_[se],k=_[Ie],w.y>c.y!=k.y>c.y&&c.x<(k.x-w.x)*(c.y-w.y)/(k.y-w.y)+w.x&&(h=!h);return h||Rr.prototype._containsPoint.call(this,c,!0)}});function vx(c,h){return new xl(c,h)}var Nr=aa.extend({initialize:function(c,h){E(this,h),this._layers={},c&&this.addData(c)},addData:function(c){var h=M(c)?c:c.features,_,w,k;if(h){for(_=0,w=h.length;_<w;_++)k=h[_],(k.geometries||k.geometry||k.features||k.coordinates)&&this.addData(k);return this}var W=this.options;if(W.filter&&!W.filter(c))return this;var se=yd(c,W);return se?(se.feature=Lh(c),se.defaultOptions=se.options,this.resetStyle(se),W.onEachFeature&&W.onEachFeature(c,se),this.addLayer(se)):this},resetStyle:function(c){return c===void 0?this.eachLayer(this.resetStyle,this):(c.options=n({},c.defaultOptions),this._setLayerStyle(c,this.options.style),this)},setStyle:function(c){return this.eachLayer(function(h){this._setLayerStyle(h,c)},this)},_setLayerStyle:function(c,h){c.setStyle&&(typeof h=="function"&&(h=h(c.feature)),c.setStyle(h))}});function yd(c,h){var _=c.type==="Feature"?c.geometry:c,w=_?_.coordinates:null,k=[],W=h&&h.pointToLayer,se=h&&h.coordsToLatLng||kh,Ie,Ke,It,Wi;if(!w&&!_)return null;switch(_.type){case"Point":return Ie=se(w),mx(W,c,Ie,h);case"MultiPoint":for(It=0,Wi=w.length;It<Wi;It++)Ie=se(w[It]),k.push(mx(W,c,Ie,h));return new aa(k);case"LineString":case"MultiLineString":return Ke=Bh(w,_.type==="LineString"?0:1,se),new Rr(Ke,h);case"Polygon":case"MultiPolygon":return Ke=Bh(w,_.type==="Polygon"?1:2,se),new xl(Ke,h);case"GeometryCollection":for(It=0,Wi=_.geometries.length;It<Wi;It++){var hn=yd({geometry:_.geometries[It],type:"Feature",properties:c.properties},h);hn&&k.push(hn)}return new aa(k);case"FeatureCollection":for(It=0,Wi=_.features.length;It<Wi;It++){var Wn=yd(_.features[It],h);Wn&&k.push(Wn)}return new aa(k);default:throw new Error("Invalid GeoJSON object.")}}function mx(c,h,_,w){return c?c(h,_):new Dh(_,w&&w.markersInheritOptions&&w)}function kh(c){return new ht(c[1],c[0],c[2])}function Bh(c,h,_){for(var w=[],k=0,W=c.length,se;k<W;k++)se=h?Bh(c[k],h-1,_):(_||kh)(c[k]),w.push(se);return w}function z0(c,h){return c=me(c),c.alt!==void 0?[p(c.lng,h),p(c.lat,h),p(c.alt,h)]:[p(c.lng,h),p(c.lat,h)]}function Fh(c,h,_,w){for(var k=[],W=0,se=c.length;W<se;W++)k.push(h?Fh(c[W],Bo(c[W])?0:h-1,_,w):z0(c[W],w));return!h&&_&&k.length>0&&k.push(k[0].slice()),k}function uc(c,h){return c.feature?n({},c.feature,{geometry:h}):Lh(h)}function Lh(c){return c.type==="Feature"||c.type==="FeatureCollection"?c:{type:"Feature",properties:{},geometry:c}}var V0={toGeoJSON:function(c){return uc(this,{type:"Point",coordinates:z0(this.getLatLng(),c)})}};Dh.include(V0),H0.include(V0),Ah.include(V0),Rr.include({toGeoJSON:function(c){var h=!Bo(this._latlngs),_=Fh(this._latlngs,h?1:0,!1,c);return uc(this,{type:(h?"Multi":"")+"LineString",coordinates:_})}}),xl.include({toGeoJSON:function(c){var h=!Bo(this._latlngs),_=h&&!Bo(this._latlngs[0]),w=Fh(this._latlngs,_?2:h?1:0,!0,c);return h||(w=[w]),uc(this,{type:(_?"Multi":"")+"Polygon",coordinates:w})}}),pl.include({toMultiPoint:function(c){var h=[];return this.eachLayer(function(_){h.push(_.toGeoJSON(c).geometry.coordinates)}),uc(this,{type:"MultiPoint",coordinates:h})},toGeoJSON:function(c){var h=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(h==="MultiPoint")return this.toMultiPoint(c);var _=h==="GeometryCollection",w=[];return this.eachLayer(function(k){if(k.toGeoJSON){var W=k.toGeoJSON(c);if(_)w.push(W.geometry);else{var se=Lh(W);se.type==="FeatureCollection"?w.push.apply(w,se.features):w.push(se)}}}),_?uc(this,{geometries:w,type:"GeometryCollection"}):{type:"FeatureCollection",features:w}}});function _x(c,h){return new Nr(c,h)}var Z=_x,xe=vo.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(c,h,_){this._url=c,this._bounds=Xe(h),E(this,_)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Me(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){oe(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(c){return this.options.opacity=c,this._image&&this._updateOpacity(),this},setStyle:function(c){return c.opacity&&this.setOpacity(c.opacity),this},bringToFront:function(){return this._map&&We(this._image),this},bringToBack:function(){return this._map&&be(this._image),this},setUrl:function(c){return this._url=c,this._image&&(this._image.src=c),this},setBounds:function(c){return this._bounds=Xe(c),this._map&&this._reset(),this},getEvents:function(){var c={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(c.zoomanim=this._animateZoom),c},setZIndex:function(c){return this.options.zIndex=c,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var c=this._url.tagName==="IMG",h=this._image=c?this._url:le("img");if(Me(h,"leaflet-image-layer"),this._zoomAnimated&&Me(h,"leaflet-zoom-animated"),this.options.className&&Me(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(),c){this._url=h.src;return}h.src=this._url,h.alt=this.options.alt},_animateZoom:function(c){var h=this._map.getZoomScale(c.zoom),_=this._map._latLngBoundsToNewLayerBounds(this._bounds,c.zoom,c.center).min;je(this._image,_,h)},_reset:function(){var c=this._image,h=new pe(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),_=h.getSize();ze(c,h.min),c.style.width=_.x+"px",c.style.height=_.y+"px"},_updateOpacity:function(){de(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 c=this.options.errorOverlayUrl;c&&this._url!==c&&(this._url=c,this._image.src=c)},getCenter:function(){return this._bounds.getCenter()}}),bt=function(c,h,_){return new xe(c,h,_)},pt=xe.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var c=this._url.tagName==="VIDEO",h=this._image=c?this._url:le("video");if(Me(h,"leaflet-image-layer"),this._zoomAnimated&&Me(h,"leaflet-zoom-animated"),this.options.className&&Me(h,this.options.className),h.onselectstart=g,h.onmousemove=g,h.onloadeddata=r(this.fire,this,"load"),c){for(var _=h.getElementsByTagName("source"),w=[],k=0;k<_.length;k++)w.push(_[k].src);this._url=_.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 W=0;W<this._url.length;W++){var se=le("source");se.src=this._url[W],h.appendChild(se)}}});function at(c,h,_){return new pt(c,h,_)}var Pi=xe.extend({_initImage:function(){var c=this._image=this._url;Me(c,"leaflet-image-layer"),this._zoomAnimated&&Me(c,"leaflet-zoom-animated"),this.options.className&&Me(c,this.options.className),c.onselectstart=g,c.onmousemove=g}});function Ui(c,h,_){return new Pi(c,h,_)}var un=vo.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(c,h){c&&(c instanceof ht||M(c))?(this._latlng=me(c),E(this,h)):(E(this,c),this._source=h),this.options.content&&(this._content=this.options.content)},openOn:function(c){return c=arguments.length?c:this._source._map,c.hasLayer(this)||c.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(c){return this._map?this.close():(arguments.length?this._source=c:c=this._source,this._prepareOpen(),this.openOn(c._map)),this},onAdd:function(c){this._zoomAnimated=c._zoomAnimated,this._container||this._initLayout(),c._fadeAnimated&&de(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),c._fadeAnimated&&de(this._container,1),this.bringToFront(),this.options.interactive&&(Me(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(c){c._fadeAnimated?(de(this._container,0),this._removeTimeout=setTimeout(r(oe,void 0,this._container),200)):oe(this._container),this.options.interactive&&(nt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(c){return this._latlng=me(c),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(c){return this._content=c,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 c={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(c.zoomanim=this._animateZoom),c},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&We(this._container),this},bringToBack:function(){return this._map&&be(this._container),this},_prepareOpen:function(c){var h=this._source;if(!h._map)return!1;if(h instanceof aa){h=null;var _=this._source._layers;for(var w in _)if(_[w]._map){h=_[w];break}if(!h)return!1;this._source=h}if(!c)if(h.getCenter)c=h.getCenter();else if(h.getLatLng)c=h.getLatLng();else if(h.getBounds)c=h.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(c),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var c=this._contentNode,h=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof h=="string")c.innerHTML=h;else{for(;c.hasChildNodes();)c.removeChild(c.firstChild);c.appendChild(h)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var c=this._map.latLngToLayerPoint(this._latlng),h=Oe(this.options.offset),_=this._getAnchor();this._zoomAnimated?ze(this._container,c.add(_)):h=h.add(c).add(_);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]}});Ni.include({_initOverlay:function(c,h,_,w){var k=h;return k instanceof c||(k=new c(w).setContent(h)),_&&k.setLatLng(_),k}}),vo.include({_initOverlay:function(c,h,_,w){var k=_;return k instanceof c?(E(k,w),k._source=this):(k=h&&!w?h:new c(w,this),k.setContent(_)),k}});var Oi=un.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(c){return c=arguments.length?c:this._source._map,!c.hasLayer(this)&&c._popup&&c._popup.options.autoClose&&c.removeLayer(c._popup),c._popup=this,un.prototype.openOn.call(this,c)},onAdd:function(c){un.prototype.onAdd.call(this,c),c.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Ta||this._source.on("preclick",it))},onRemove:function(c){un.prototype.onRemove.call(this,c),c.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Ta||this._source.off("preclick",it))},getEvents:function(){var c=un.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(c.preclick=this.close),this.options.keepInView&&(c.moveend=this._adjustPan),c},_initLayout:function(){var c="leaflet-popup",h=this._container=le("div",c+" "+(this.options.className||"")+" leaflet-zoom-animated"),_=this._wrapper=le("div",c+"-content-wrapper",h);if(this._contentNode=le("div",c+"-content",_),Lt(h),ut(this._contentNode),Wt(h,"contextmenu",it),this._tipContainer=le("div",c+"-tip-container",h),this._tip=le("div",c+"-tip",this._tipContainer),this.options.closeButton){var w=this._closeButton=le("a",c+"-close-button",h);w.setAttribute("role","button"),w.setAttribute("aria-label","Close popup"),w.href="#close",w.innerHTML='<span aria-hidden="true">&#215;</span>',Wt(w,"click",function(k){Rt(k),this.close()},this)}},_updateLayout:function(){var c=this._contentNode,h=c.style;h.width="",h.whiteSpace="nowrap";var _=c.offsetWidth;_=Math.min(_,this.options.maxWidth),_=Math.max(_,this.options.minWidth),h.width=_+1+"px",h.whiteSpace="",h.height="";var w=c.offsetHeight,k=this.options.maxHeight,W="leaflet-popup-scrolled";k&&w>k?(h.height=k+"px",Me(c,W)):nt(c,W),this._containerWidth=this._container.offsetWidth},_animateZoom:function(c){var h=this._map._latLngToNewLayerPoint(this._latlng,c.zoom,c.center),_=this._getAnchor();ze(this._container,h.add(_))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var c=this._map,h=parseInt(ne(this._container,"marginBottom"),10)||0,_=this._container.offsetHeight+h,w=this._containerWidth,k=new ge(this._containerLeft,-_-this._containerBottom);k._add(kt(this._container));var W=c.layerPointToContainerPoint(k),se=Oe(this.options.autoPanPadding),Ie=Oe(this.options.autoPanPaddingTopLeft||se),Ke=Oe(this.options.autoPanPaddingBottomRight||se),It=c.getSize(),Wi=0,hn=0;W.x+w+Ke.x>It.x&&(Wi=W.x+w-It.x+Ke.x),W.x-Wi-Ie.x<0&&(Wi=W.x-Ie.x),W.y+_+Ke.y>It.y&&(hn=W.y+_-It.y+Ke.y),W.y-hn-Ie.y<0&&(hn=W.y-Ie.y),(Wi||hn)&&(this.options.keepInView&&(this._autopanning=!0),c.fire("autopanstart").panBy([Wi,hn]))}},_getAnchor:function(){return Oe(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),rn=function(c,h){return new Oi(c,h)};Ni.mergeOptions({closePopupOnClick:!0}),Ni.include({openPopup:function(c,h,_){return this._initOverlay(Oi,c,h,_).openOn(this),this},closePopup:function(c){return c=arguments.length?c:this._popup,c&&c.close(),this}}),vo.include({bindPopup:function(c,h){return this._popup=this._initOverlay(Oi,this._popup,c,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(c){return this._popup&&(this instanceof aa||(this._popup._source=this),this._popup._prepareOpen(c||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(c){return this._popup&&this._popup.setContent(c),this},getPopup:function(){return this._popup},_openPopup:function(c){if(!(!this._popup||!this._map)){si(c);var h=c.layer||c.target;if(this._popup._source===h&&!(h instanceof Ta)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(c.latlng);return}this._popup._source=h,this.openPopup(c.latlng)}},_movePopup:function(c){this._popup.setLatLng(c.latlng)},_onKeyPress:function(c){c.originalEvent.keyCode===13&&this._openPopup(c)}});var an=un.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(c){un.prototype.onAdd.call(this,c),this.setOpacity(this.options.opacity),c.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(c){un.prototype.onRemove.call(this,c),c.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var c=un.prototype.getEvents.call(this);return this.options.permanent||(c.preclick=this.close),c},_initLayout:function(){var c="leaflet-tooltip",h=c+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=le("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+d(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(c){var h,_,w=this._map,k=this._container,W=w.latLngToContainerPoint(w.getCenter()),se=w.layerPointToContainerPoint(c),Ie=this.options.direction,Ke=k.offsetWidth,It=k.offsetHeight,Wi=Oe(this.options.offset),hn=this._getAnchor();Ie==="top"?(h=Ke/2,_=It):Ie==="bottom"?(h=Ke/2,_=0):Ie==="center"?(h=Ke/2,_=It/2):Ie==="right"?(h=0,_=It/2):Ie==="left"?(h=Ke,_=It/2):se.x<W.x?(Ie="right",h=0,_=It/2):(Ie="left",h=Ke+(Wi.x+hn.x)*2,_=It/2),c=c.subtract(Oe(h,_,!0)).add(Wi).add(hn),nt(k,"leaflet-tooltip-right"),nt(k,"leaflet-tooltip-left"),nt(k,"leaflet-tooltip-top"),nt(k,"leaflet-tooltip-bottom"),Me(k,"leaflet-tooltip-"+Ie),ze(k,c)},_updatePosition:function(){var c=this._map.latLngToLayerPoint(this._latlng);this._setPosition(c)},setOpacity:function(c){this.options.opacity=c,this._container&&de(this._container,c)},_animateZoom:function(c){var h=this._map._latLngToNewLayerPoint(this._latlng,c.zoom,c.center);this._setPosition(h)},_getAnchor:function(){return Oe(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Nn=function(c,h){return new an(c,h)};Ni.include({openTooltip:function(c,h,_){return this._initOverlay(an,c,h,_).openOn(this),this},closeTooltip:function(c){return c.close(),this}}),vo.include({bindTooltip:function(c,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(an,this._tooltip,c,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(c){if(!(!c&&this._tooltipHandlersAdded)){var h=c?"off":"on",_={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?_.add=this._openTooltip:(_.mouseover=this._openTooltip,_.mouseout=this.closeTooltip,_.click=this._openTooltip,this._map?this._addFocusListeners():_.add=this._addFocusListeners),this._tooltip.options.sticky&&(_.mousemove=this._moveTooltip),this[h](_),this._tooltipHandlersAdded=!c}},openTooltip:function(c){return this._tooltip&&(this instanceof aa||(this._tooltip._source=this),this._tooltip._prepareOpen(c)&&(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(c){return this._tooltip&&this._tooltip.setContent(c),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(c){var h=typeof c.getElement=="function"&&c.getElement();h&&(Wt(h,"focus",function(){this._tooltip._source=c,this.openTooltip()},this),Wt(h,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(c){var h=typeof c.getElement=="function"&&c.getElement();h&&h.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(c){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(c)});return}this._tooltip._source=c.layer||c.target,this.openTooltip(this._tooltip.options.sticky?c.latlng:void 0)}},_moveTooltip:function(c){var h=c.latlng,_,w;this._tooltip.options.sticky&&c.originalEvent&&(_=this._map.mouseEventToContainerPoint(c.originalEvent),w=this._map.containerPointToLayerPoint(_),h=this._map.layerPointToLatLng(w)),this._tooltip.setLatLng(h)}});var Sn=cc.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(c){var h=c&&c.tagName==="DIV"?c:document.createElement("div"),_=this.options;if(_.html instanceof Element?(ye(h),h.appendChild(_.html)):h.innerHTML=_.html!==!1?_.html:"",_.bgPos){var w=Oe(_.bgPos);h.style.backgroundPosition=-w.x+"px "+-w.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function Vn(c){return new Sn(c)}cc.Default=dc;var On=vo.extend({options:{tileSize:256,opacity:1,updateWhenIdle:fe.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(c){E(this,c)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(c){c._addZoomLimit(this)},onRemove:function(c){this._removeAllTiles(),oe(this._container),c._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(We(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(be(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(c){return this.options.opacity=c,this._updateOpacity(),this},setZIndex:function(c){return this.options.zIndex=c,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var c=this._clampZoom(this._map.getZoom());c!==this._tileZoom&&(this._tileZoom=c,this._updateLevels()),this._update()}return this},getEvents:function(){var c={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)),c.move=this._onMove),this._zoomAnimated&&(c.zoomanim=this._animateZoom),c},createTile:function(){return document.createElement("div")},getTileSize:function(){var c=this.options.tileSize;return c instanceof ge?c:new ge(c,c)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(c){for(var h=this.getPane().children,_=-c(-1/0,1/0),w=0,k=h.length,W;w<k;w++)W=h[w].style.zIndex,h[w]!==this._container&&W&&(_=c(_,+W));isFinite(_)&&(this.options.zIndex=_+c(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!fe.ielt9){de(this._container,this.options.opacity);var c=+new Date,h=!1,_=!1;for(var w in this._tiles){var k=this._tiles[w];if(!(!k.current||!k.loaded)){var W=Math.min(1,(c-k.loaded)/200);de(k.el,W),W<1?h=!0:(k.active?_=!0:this._onOpaqueTile(k),k.active=!0)}}_&&!this._noPrune&&this._pruneTiles(),h&&(ve(this._fadeFrame),this._fadeFrame=ie(this._updateOpacity,this))}},_onOpaqueTile:g,_initContainer:function(){this._container||(this._container=le("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var c=this._tileZoom,h=this.options.maxZoom;if(c!==void 0){for(var _ in this._levels)_=Number(_),this._levels[_].el.children.length||_===c?(this._levels[_].el.style.zIndex=h-Math.abs(c-_),this._onUpdateLevel(_)):(oe(this._levels[_].el),this._removeTilesAtZoom(_),this._onRemoveLevel(_),delete this._levels[_]);var w=this._levels[c],k=this._map;return w||(w=this._levels[c]={},w.el=le("div","leaflet-tile-container leaflet-zoom-animated",this._container),w.el.style.zIndex=h,w.origin=k.project(k.unproject(k.getPixelOrigin()),c).round(),w.zoom=c,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 c,h,_=this._map.getZoom();if(_>this.options.maxZoom||_<this.options.minZoom){this._removeAllTiles();return}for(c in this._tiles)h=this._tiles[c],h.retain=h.current;for(c in this._tiles)if(h=this._tiles[c],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(c in this._tiles)this._tiles[c].retain||this._removeTile(c)}},_removeTilesAtZoom:function(c){for(var h in this._tiles)this._tiles[h].coords.z===c&&this._removeTile(h)},_removeAllTiles:function(){for(var c in this._tiles)this._removeTile(c)},_invalidateAll:function(){for(var c in this._levels)oe(this._levels[c].el),this._onRemoveLevel(Number(c)),delete this._levels[c];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(c,h,_,w){var k=Math.floor(c/2),W=Math.floor(h/2),se=_-1,Ie=new ge(+k,+W);Ie.z=+se;var Ke=this._tileCoordsToKey(Ie),It=this._tiles[Ke];return It&&It.active?(It.retain=!0,!0):(It&&It.loaded&&(It.retain=!0),se>w?this._retainParent(k,W,se,w):!1)},_retainChildren:function(c,h,_,w){for(var k=2*c;k<2*c+2;k++)for(var W=2*h;W<2*h+2;W++){var se=new ge(k,W);se.z=_+1;var Ie=this._tileCoordsToKey(se),Ke=this._tiles[Ie];if(Ke&&Ke.active){Ke.retain=!0;continue}else Ke&&Ke.loaded&&(Ke.retain=!0);_+1<w&&this._retainChildren(k,W,_+1,w)}},_resetView:function(c){var h=c&&(c.pinch||c.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),h,h)},_animateZoom:function(c){this._setView(c.center,c.zoom,!0,c.noUpdate)},_clampZoom:function(c){var h=this.options;return h.minNativeZoom!==void 0&&c<h.minNativeZoom?h.minNativeZoom:h.maxNativeZoom!==void 0&&h.maxNativeZoom<c?h.maxNativeZoom:c},_setView:function(c,h,_,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 W=this.options.updateWhenZooming&&k!==this._tileZoom;(!w||W)&&(this._tileZoom=k,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),k!==void 0&&this._update(c),_||this._pruneTiles(),this._noPrune=!!_),this._setZoomTransforms(c,h)},_setZoomTransforms:function(c,h){for(var _ in this._levels)this._setZoomTransform(this._levels[_],c,h)},_setZoomTransform:function(c,h,_){var w=this._map.getZoomScale(_,c.zoom),k=c.origin.multiplyBy(w).subtract(this._map._getNewPixelOrigin(h,_)).round();fe.any3d?je(c.el,k,w):ze(c.el,k)},_resetGrid:function(){var c=this._map,h=c.options.crs,_=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(c.project([0,h.wrapLng[0]],w).x/_.x),Math.ceil(c.project([0,h.wrapLng[1]],w).x/_.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(c.project([h.wrapLat[0],0],w).y/_.x),Math.ceil(c.project([h.wrapLat[1],0],w).y/_.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(c){var h=this._map,_=h._animatingZoom?Math.max(h._animateToZoom,h.getZoom()):h.getZoom(),w=h.getZoomScale(_,this._tileZoom),k=h.project(c,this._tileZoom).floor(),W=h.getSize().divideBy(w*2);return new pe(k.subtract(W),k.add(W))},_update:function(c){var h=this._map;if(h){var _=this._clampZoom(h.getZoom());if(c===void 0&&(c=h.getCenter()),this._tileZoom!==void 0){var w=this._getTiledPixelBounds(c),k=this._pxBoundsToTileRange(w),W=k.getCenter(),se=[],Ie=this.options.keepBuffer,Ke=new pe(k.getBottomLeft().subtract([Ie,-Ie]),k.getTopRight().add([Ie,-Ie]));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 It in this._tiles){var Wi=this._tiles[It].coords;(Wi.z!==this._tileZoom||!Ke.contains(new ge(Wi.x,Wi.y)))&&(this._tiles[It].current=!1)}if(Math.abs(_-this._tileZoom)>1){this._setView(c,_);return}for(var hn=k.min.y;hn<=k.max.y;hn++)for(var Wn=k.min.x;Wn<=k.max.x;Wn++){var So=new ge(Wn,hn);if(So.z=this._tileZoom,!!this._isValidTile(So)){var fo=this._tiles[this._tileCoordsToKey(So)];fo?fo.current=!0:se.push(So)}}if(se.sort(function(zo,Ih){return zo.distanceTo(W)-Ih.distanceTo(W)}),se.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var lr=document.createDocumentFragment();for(Wn=0;Wn<se.length;Wn++)this._addTile(se[Wn],lr);this._level.el.appendChild(lr)}}}},_isValidTile:function(c){var h=this._map.options.crs;if(!h.infinite){var _=this._globalTileRange;if(!h.wrapLng&&(c.x<_.min.x||c.x>_.max.x)||!h.wrapLat&&(c.y<_.min.y||c.y>_.max.y))return!1}if(!this.options.bounds)return!0;var w=this._tileCoordsToBounds(c);return Xe(this.options.bounds).overlaps(w)},_keyToBounds:function(c){return this._tileCoordsToBounds(this._keyToTileCoords(c))},_tileCoordsToNwSe:function(c){var h=this._map,_=this.getTileSize(),w=c.scaleBy(_),k=w.add(_),W=h.unproject(w,c.z),se=h.unproject(k,c.z);return[W,se]},_tileCoordsToBounds:function(c){var h=this._tileCoordsToNwSe(c),_=new Ot(h[0],h[1]);return this.options.noWrap||(_=this._map.wrapLatLngBounds(_)),_},_tileCoordsToKey:function(c){return c.x+":"+c.y+":"+c.z},_keyToTileCoords:function(c){var h=c.split(":"),_=new ge(+h[0],+h[1]);return _.z=+h[2],_},_removeTile:function(c){var h=this._tiles[c];h&&(oe(h.el),delete this._tiles[c],this.fire("tileunload",{tile:h.el,coords:this._keyToTileCoords(c)}))},_initTile:function(c){Me(c,"leaflet-tile");var h=this.getTileSize();c.style.width=h.x+"px",c.style.height=h.y+"px",c.onselectstart=g,c.onmousemove=g,fe.ielt9&&this.options.opacity<1&&de(c,this.options.opacity)},_addTile:function(c,h){var _=this._getTilePos(c),w=this._tileCoordsToKey(c),k=this.createTile(this._wrapCoords(c),r(this._tileReady,this,c));this._initTile(k),this.createTile.length<2&&ie(r(this._tileReady,this,c,null,k)),ze(k,_),this._tiles[w]={el:k,coords:c,current:!0},h.appendChild(k),this.fire("tileloadstart",{tile:k,coords:c})},_tileReady:function(c,h,_){h&&this.fire("tileerror",{error:h,tile:_,coords:c});var w=this._tileCoordsToKey(c);_=this._tiles[w],_&&(_.loaded=+new Date,this._map._fadeAnimated?(de(_.el,0),ve(this._fadeFrame),this._fadeFrame=ie(this._updateOpacity,this)):(_.active=!0,this._pruneTiles()),h||(Me(_.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:_.el,coords:c})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),fe.ielt9||!this._map._fadeAnimated?ie(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(c){return c.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(c){var h=new ge(this._wrapX?f(c.x,this._wrapX):c.x,this._wrapY?f(c.y,this._wrapY):c.y);return h.z=c.z,h},_pxBoundsToTileRange:function(c){var h=this.getTileSize();return new pe(c.min.unscaleBy(h).floor(),c.max.unscaleBy(h).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var c in this._tiles)if(!this._tiles[c].loaded)return!1;return!0}});function jn(c){return new On(c)}var Yi=On.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(c,h){this._url=c,h=E(this,h),h.detectRetina&&fe.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(c,h){return this._url===c&&h===void 0&&(h=!0),this._url=c,h||this.redraw(),this},createTile:function(c,h){var _=document.createElement("img");return Wt(_,"load",r(this._tileOnLoad,this,h,_)),Wt(_,"error",r(this._tileOnError,this,h,_)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(_.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(_.referrerPolicy=this.options.referrerPolicy),_.alt="",_.src=this.getTileUrl(c),_},getTileUrl:function(c){var h={r:fe.retina?"@2x":"",s:this._getSubdomain(c),x:c.x,y:c.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var _=this._globalTileRange.max.y-c.y;this.options.tms&&(h.y=_),h["-y"]=_}return I(this._url,n(h,this.options))},_tileOnLoad:function(c,h){fe.ielt9?setTimeout(r(c,this,null,h),0):c(null,h)},_tileOnError:function(c,h,_){var w=this.options.errorTileUrl;w&&h.getAttribute("src")!==w&&(h.src=w),c(_,h)},_onTileRemove:function(c){c.tile.onload=null},_getZoomForUrl:function(){var c=this._tileZoom,h=this.options.maxZoom,_=this.options.zoomReverse,w=this.options.zoomOffset;return _&&(c=h-c),c+w},_getSubdomain:function(c){var h=Math.abs(c.x+c.y)%this.options.subdomains.length;return this.options.subdomains[h]},_abortLoading:function(){var c,h;for(c in this._tiles)if(this._tiles[c].coords.z!==this._tileZoom&&(h=this._tiles[c].el,h.onload=g,h.onerror=g,!h.complete)){h.src=P;var _=this._tiles[c].coords;oe(h),delete this._tiles[c],this.fire("tileabort",{tile:h,coords:_})}},_removeTile:function(c){var h=this._tiles[c];if(h)return h.el.setAttribute("src",P),On.prototype._removeTile.call(this,c)},_tileReady:function(c,h,_){if(!(!this._map||_&&_.getAttribute("src")===P))return On.prototype._tileReady.call(this,c,h,_)}});function Ln(c,h){return new Yi(c,h)}var Bs=Yi.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(c,h){this._url=c;var _=n({},this.defaultWmsParams);for(var w in h)w in this.options||(_[w]=h[w]);h=E(this,h);var k=h.detectRetina&&fe.retina?2:1,W=this.getTileSize();_.width=W.x*k,_.height=W.y*k,this.wmsParams=_},onAdd:function(c){this._crs=this.options.crs||c.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var h=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[h]=this._crs.code,Yi.prototype.onAdd.call(this,c)},getTileUrl:function(c){var h=this._tileCoordsToNwSe(c),_=this._crs,w=lt(_.project(h[0]),_.project(h[1])),k=w.min,W=w.max,se=(this._wmsVersion>=1.3&&this._crs===wh?[k.y,k.x,W.y,W.x]:[k.x,k.y,W.x,W.y]).join(","),Ie=Yi.prototype.getTileUrl.call(this,c);return Ie+y(this.wmsParams,Ie,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+se},setParams:function(c,h){return n(this.wmsParams,c),h||this.redraw(),this}});function ho(c,h){return new Bs(c,h)}Yi.WMS=Bs,Ln.wms=ho;var Hn=vo.extend({options:{padding:.1},initialize:function(c){E(this,c),d(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Me(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 c={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(c.zoomanim=this._onAnimZoom),c},_onAnimZoom:function(c){this._updateTransform(c.center,c.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(c,h){var _=this._map.getZoomScale(h,this._zoom),w=this._map.getSize().multiplyBy(.5+this.options.padding),k=this._map.project(this._center,h),W=w.multiplyBy(-_).add(k).subtract(this._map._getNewPixelOrigin(c,h));fe.any3d?je(this._container,W,_):ze(this._container,W)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var c in this._layers)this._layers[c]._reset()},_onZoomEnd:function(){for(var c in this._layers)this._layers[c]._project()},_updatePaths:function(){for(var c in this._layers)this._layers[c]._update()},_update:function(){var c=this.options.padding,h=this._map.getSize(),_=this._map.containerPointToLayerPoint(h.multiplyBy(-c)).round();this._bounds=new pe(_,_.add(h.multiplyBy(1+c*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),ts=Hn.extend({options:{tolerance:0},getEvents:function(){var c=Hn.prototype.getEvents.call(this);return c.viewprereset=this._onViewPreReset,c},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Hn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var c=this._container=document.createElement("canvas");Wt(c,"mousemove",this._onMouseMove,this),Wt(c,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Wt(c,"mouseout",this._handleMouseOut,this),c._leaflet_disable_events=!0,this._ctx=c.getContext("2d")},_destroyContainer:function(){ve(this._redrawRequest),delete this._ctx,oe(this._container),wi(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var c;this._redrawBounds=null;for(var h in this._layers)c=this._layers[h],c._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Hn.prototype._update.call(this);var c=this._bounds,h=this._container,_=c.getSize(),w=fe.retina?2:1;ze(h,c.min),h.width=w*_.x,h.height=w*_.y,h.style.width=_.x+"px",h.style.height=_.y+"px",fe.retina&&this._ctx.scale(2,2),this._ctx.translate(-c.min.x,-c.min.y),this.fire("update")}},_reset:function(){Hn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(c){this._updateDashArray(c),this._layers[d(c)]=c;var h=c._order={layer:c,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=h),this._drawLast=h,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(c){this._requestRedraw(c)},_removePath:function(c){var h=c._order,_=h.next,w=h.prev;_?_.prev=w:this._drawLast=w,w?w.next=_:this._drawFirst=_,delete c._order,delete this._layers[d(c)],this._requestRedraw(c)},_updatePath:function(c){this._extendRedrawBounds(c),c._project(),c._update(),this._requestRedraw(c)},_updateStyle:function(c){this._updateDashArray(c),this._requestRedraw(c)},_updateDashArray:function(c){if(typeof c.options.dashArray=="string"){var h=c.options.dashArray.split(/[, ]+/),_=[],w,k;for(k=0;k<h.length;k++){if(w=Number(h[k]),isNaN(w))return;_.push(w)}c.options._dashArray=_}else c.options._dashArray=c.options.dashArray},_requestRedraw:function(c){this._map&&(this._extendRedrawBounds(c),this._redrawRequest=this._redrawRequest||ie(this._redraw,this))},_extendRedrawBounds:function(c){if(c._pxBounds){var h=(c.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new pe,this._redrawBounds.extend(c._pxBounds.min.subtract([h,h])),this._redrawBounds.extend(c._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 c=this._redrawBounds;if(c){var h=c.getSize();this._ctx.clearRect(c.min.x,c.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 c,h=this._redrawBounds;if(this._ctx.save(),h){var _=h.getSize();this._ctx.beginPath(),this._ctx.rect(h.min.x,h.min.y,_.x,_.y),this._ctx.clip()}this._drawing=!0;for(var w=this._drawFirst;w;w=w.next)c=w.layer,(!h||c._pxBounds&&c._pxBounds.intersects(h))&&c._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(c,h){if(this._drawing){var _,w,k,W,se=c._parts,Ie=se.length,Ke=this._ctx;if(Ie){for(Ke.beginPath(),_=0;_<Ie;_++){for(w=0,k=se[_].length;w<k;w++)W=se[_][w],Ke[w?"lineTo":"moveTo"](W.x,W.y);h&&Ke.closePath()}this._fillStroke(Ke,c)}}},_updateCircle:function(c){if(!(!this._drawing||c._empty())){var h=c._point,_=this._ctx,w=Math.max(Math.round(c._radius),1),k=(Math.max(Math.round(c._radiusY),1)||w)/w;k!==1&&(_.save(),_.scale(1,k)),_.beginPath(),_.arc(h.x,h.y/k,w,0,Math.PI*2,!1),k!==1&&_.restore(),this._fillStroke(_,c)}},_fillStroke:function(c,h){var _=h.options;_.fill&&(c.globalAlpha=_.fillOpacity,c.fillStyle=_.fillColor||_.color,c.fill(_.fillRule||"evenodd")),_.stroke&&_.weight!==0&&(c.setLineDash&&c.setLineDash(h.options&&h.options._dashArray||[]),c.globalAlpha=_.opacity,c.lineWidth=_.weight,c.strokeStyle=_.color,c.lineCap=_.lineCap,c.lineJoin=_.lineJoin,c.stroke())},_onClick:function(c){for(var h=this._map.mouseEventToLayerPoint(c),_,w,k=this._drawFirst;k;k=k.next)_=k.layer,_.options.interactive&&_._containsPoint(h)&&(!(c.type==="click"||c.type==="preclick")||!this._map._draggableMoved(_))&&(w=_);this._fireEvent(w?[w]:!1,c)},_onMouseMove:function(c){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var h=this._map.mouseEventToLayerPoint(c);this._handleMouseHover(c,h)}},_handleMouseOut:function(c){var h=this._hoveredLayer;h&&(nt(this._container,"leaflet-interactive"),this._fireEvent([h],c,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(c,h){if(!this._mouseHoverThrottled){for(var _,w,k=this._drawFirst;k;k=k.next)_=k.layer,_.options.interactive&&_._containsPoint(h)&&(w=_);w!==this._hoveredLayer&&(this._handleMouseOut(c),w&&(Me(this._container,"leaflet-interactive"),this._fireEvent([w],c,"mouseover"),this._hoveredLayer=w)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,c),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(c,h,_){this._map._fireDOMEvent(h,_||h.type,c)},_bringToFront:function(c){var h=c._order;if(h){var _=h.next,w=h.prev;if(_)_.prev=w;else return;w?w.next=_:_&&(this._drawFirst=_),h.prev=this._drawLast,this._drawLast.next=h,h.next=null,this._drawLast=h,this._requestRedraw(c)}},_bringToBack:function(c){var h=c._order;if(h){var _=h.next,w=h.prev;if(w)w.next=_;else return;_?_.prev=w:w&&(this._drawLast=w),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(c)}}});function ds(c){return fe.canvas?new ts(c):null}var Xn=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(c){return document.createElement("<lvml:"+c+' class="lvml">')}}catch{}return function(c){return document.createElement("<"+c+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),ws={_initContainer:function(){this._container=le("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Hn.prototype._update.call(this),this.fire("update"))},_initPath:function(c){var h=c._container=Xn("shape");Me(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",c._path=Xn("path"),h.appendChild(c._path),this._updateStyle(c),this._layers[d(c)]=c},_addPath:function(c){var h=c._container;this._container.appendChild(h),c.options.interactive&&c.addInteractiveTarget(h)},_removePath:function(c){var h=c._container;oe(h),c.removeInteractiveTarget(h),delete this._layers[d(c)]},_updateStyle:function(c){var h=c._stroke,_=c._fill,w=c.options,k=c._container;k.stroked=!!w.stroke,k.filled=!!w.fill,w.stroke?(h||(h=c._stroke=Xn("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),c._stroke=null),w.fill?(_||(_=c._fill=Xn("fill")),k.appendChild(_),_.color=w.fillColor||w.color,_.opacity=w.fillOpacity):_&&(k.removeChild(_),c._fill=null)},_updateCircle:function(c){var h=c._point.round(),_=Math.round(c._radius),w=Math.round(c._radiusY||_);this._setPath(c,c._empty()?"M0 0":"AL "+h.x+","+h.y+" "+_+","+w+" 0,"+65535*360)},_setPath:function(c,h){c._path.v=h},_bringToFront:function(c){We(c._container)},_bringToBack:function(c){be(c._container)}},An=fe.vml?Xn:Ct,Jn=Hn.extend({_initContainer:function(){this._container=An("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=An("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){oe(this._container),wi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Hn.prototype._update.call(this);var c=this._bounds,h=c.getSize(),_=this._container;(!this._svgSize||!this._svgSize.equals(h))&&(this._svgSize=h,_.setAttribute("width",h.x),_.setAttribute("height",h.y)),ze(_,c.min),_.setAttribute("viewBox",[c.min.x,c.min.y,h.x,h.y].join(" ")),this.fire("update")}},_initPath:function(c){var h=c._path=An("path");c.options.className&&Me(h,c.options.className),c.options.interactive&&Me(h,"leaflet-interactive"),this._updateStyle(c),this._layers[d(c)]=c},_addPath:function(c){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(c._path),c.addInteractiveTarget(c._path)},_removePath:function(c){oe(c._path),c.removeInteractiveTarget(c._path),delete this._layers[d(c)]},_updatePath:function(c){c._project(),c._update()},_updateStyle:function(c){var h=c._path,_=c.options;h&&(_.stroke?(h.setAttribute("stroke",_.color),h.setAttribute("stroke-opacity",_.opacity),h.setAttribute("stroke-width",_.weight),h.setAttribute("stroke-linecap",_.lineCap),h.setAttribute("stroke-linejoin",_.lineJoin),_.dashArray?h.setAttribute("stroke-dasharray",_.dashArray):h.removeAttribute("stroke-dasharray"),_.dashOffset?h.setAttribute("stroke-dashoffset",_.dashOffset):h.removeAttribute("stroke-dashoffset")):h.setAttribute("stroke","none"),_.fill?(h.setAttribute("fill",_.fillColor||_.color),h.setAttribute("fill-opacity",_.fillOpacity),h.setAttribute("fill-rule",_.fillRule||"evenodd")):h.setAttribute("fill","none"))},_updatePoly:function(c,h){this._setPath(c,ai(c._parts,h))},_updateCircle:function(c){var h=c._point,_=Math.max(Math.round(c._radius),1),w=Math.max(Math.round(c._radiusY),1)||_,k="a"+_+","+w+" 0 1,0 ",W=c._empty()?"M0 0":"M"+(h.x-_)+","+h.y+k+_*2+",0 "+k+-_*2+",0 ";this._setPath(c,W)},_setPath:function(c,h){c._path.setAttribute("d",h)},_bringToFront:function(c){We(c._path)},_bringToBack:function(c){be(c._path)}});fe.vml&&Jn.include(ws);function Yn(c){return fe.svg||fe.vml?new Jn(c):null}Ni.include({getRenderer:function(c){var h=c.options.renderer||this._getPaneRenderer(c.options.pane)||this.options.renderer||this._renderer;return h||(h=this._renderer=this._createRenderer()),this.hasLayer(h)||this.addLayer(h),h},_getPaneRenderer:function(c){if(c==="overlayPane"||c===void 0)return!1;var h=this._paneRenderers[c];return h===void 0&&(h=this._createRenderer({pane:c}),this._paneRenderers[c]=h),h},_createRenderer:function(c){return this.options.preferCanvas&&ds(c)||Yn(c)}});var es=xl.extend({initialize:function(c,h){xl.prototype.initialize.call(this,this._boundsToLatLngs(c),h)},setBounds:function(c){return this.setLatLngs(this._boundsToLatLngs(c))},_boundsToLatLngs:function(c){return c=Xe(c),[c.getSouthWest(),c.getNorthWest(),c.getNorthEast(),c.getSouthEast()]}});function $n(c,h){return new es(c,h)}Jn.create=An,Jn.pointsToPath=ai,Nr.geometryToLayer=yd,Nr.coordsToLatLng=kh,Nr.coordsToLatLngs=Bh,Nr.latLngToCoords=z0,Nr.latLngsToCoords=Fh,Nr.getFeature=uc,Nr.asFeature=Lh,Ni.mergeOptions({boxZoom:!0});var As=Kn.extend({initialize:function(c){this._map=c,this._container=c._container,this._pane=c._panes.overlayPane,this._resetStateTimeout=0,c.on("unload",this._destroy,this)},addHooks:function(){Wt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){wi(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){oe(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(c){if(!c.shiftKey||c.which!==1&&c.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),ct(),tt(),this._startPoint=this._map.mouseEventToContainerPoint(c),Wt(document,{contextmenu:si,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(c){this._moved||(this._moved=!0,this._box=le("div","leaflet-zoom-box",this._container),Me(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(c);var h=new pe(this._point,this._startPoint),_=h.getSize();ze(this._box,h.min),this._box.style.width=_.x+"px",this._box.style.height=_.y+"px"},_finish:function(){this._moved&&(oe(this._box),nt(this._container,"leaflet-crosshair")),Qe(),Bt(),wi(document,{contextmenu:si,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(c){if(!(c.which!==1&&c.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var h=new Ot(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(h).fire("boxzoomend",{boxZoomBounds:h})}},_onKeyDown:function(c){c.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Ni.addInitHook("addHandler","boxZoom",As),Ni.mergeOptions({doubleClickZoom:!0});var Vs=Kn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(c){var h=this._map,_=h.getZoom(),w=h.options.zoomDelta,k=c.originalEvent.shiftKey?_-w:_+w;h.options.doubleClickZoom==="center"?h.setZoom(k):h.setZoomAround(c.containerPoint,k)}});Ni.addInitHook("addHandler","doubleClickZoom",Vs),Ni.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var yo=Kn.extend({addHooks:function(){if(!this._draggable){var c=this._map;this._draggable=new xs(c._mapPane,c._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),c.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),c.on("zoomend",this._onZoomEnd,this),c.whenReady(this._onZoomEnd,this))}Me(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){nt(this._map._container,"leaflet-grab"),nt(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 c=this._map;if(c._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var h=Xe(this._map.options.maxBounds);this._offsetLimit=lt(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;c.fire("movestart").fire("dragstart"),c.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(c){if(this._map.options.inertia){var h=this._lastTime=+new Date,_=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(_),this._times.push(h),this._prunePositions(h)}this._map.fire("move",c).fire("drag",c)},_prunePositions:function(c){for(;this._positions.length>1&&c-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var c=this._map.getSize().divideBy(2),h=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=h.subtract(c).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(c,h){return c-(c-h)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var c=this._draggable._newPos.subtract(this._draggable._startPos),h=this._offsetLimit;c.x<h.min.x&&(c.x=this._viscousLimit(c.x,h.min.x)),c.y<h.min.y&&(c.y=this._viscousLimit(c.y,h.min.y)),c.x>h.max.x&&(c.x=this._viscousLimit(c.x,h.max.x)),c.y>h.max.y&&(c.y=this._viscousLimit(c.y,h.max.y)),this._draggable._newPos=this._draggable._startPos.add(c)}},_onPreDragWrap:function(){var c=this._worldWidth,h=Math.round(c/2),_=this._initialWorldOffset,w=this._draggable._newPos.x,k=(w-h+_)%c+h-_,W=(w+h+_)%c-h-_,se=Math.abs(k+_)<Math.abs(W+_)?k:W;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=se},_onDragEnd:function(c){var h=this._map,_=h.options,w=!_.inertia||c.noInertia||this._times.length<2;if(h.fire("dragend",c),w)h.fire("moveend");else{this._prunePositions(+new Date);var k=this._lastPos.subtract(this._positions[0]),W=(this._lastTime-this._times[0])/1e3,se=_.easeLinearity,Ie=k.multiplyBy(se/W),Ke=Ie.distanceTo([0,0]),It=Math.min(_.inertiaMaxSpeed,Ke),Wi=Ie.multiplyBy(It/Ke),hn=It/(_.inertiaDeceleration*se),Wn=Wi.multiplyBy(-hn/2).round();!Wn.x&&!Wn.y?h.fire("moveend"):(Wn=h._limitOffset(Wn,h.options.maxBounds),ie(function(){h.panBy(Wn,{duration:hn,easeLinearity:se,noMoveStart:!0,animate:!0})}))}}});Ni.addInitHook("addHandler","dragging",yo),Ni.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Or=Kn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(c){this._map=c,this._setPanDelta(c.options.keyboardPanDelta),this._setZoomDelta(c.options.zoomDelta)},addHooks:function(){var c=this._map._container;c.tabIndex<=0&&(c.tabIndex="0"),Wt(c,{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 c=document.body,h=document.documentElement,_=c.scrollTop||h.scrollTop,w=c.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(w,_)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(c){var h=this._panKeys={},_=this.keyCodes,w,k;for(w=0,k=_.left.length;w<k;w++)h[_.left[w]]=[-1*c,0];for(w=0,k=_.right.length;w<k;w++)h[_.right[w]]=[c,0];for(w=0,k=_.down.length;w<k;w++)h[_.down[w]]=[0,c];for(w=0,k=_.up.length;w<k;w++)h[_.up[w]]=[0,-1*c]},_setZoomDelta:function(c){var h=this._zoomKeys={},_=this.keyCodes,w,k;for(w=0,k=_.zoomIn.length;w<k;w++)h[_.zoomIn[w]]=c;for(w=0,k=_.zoomOut.length;w<k;w++)h[_.zoomOut[w]]=-c},_addHooks:function(){Wt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){wi(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(c){if(!(c.altKey||c.ctrlKey||c.metaKey)){var h=c.keyCode,_=this._map,w;if(h in this._panKeys){if(!_._panAnim||!_._panAnim._inProgress)if(w=this._panKeys[h],c.shiftKey&&(w=Oe(w).multiplyBy(3)),_.options.maxBounds&&(w=_._limitOffset(Oe(w),_.options.maxBounds)),_.options.worldCopyJump){var k=_.wrapLatLng(_.unproject(_.project(_.getCenter()).add(w)));_.panTo(k)}else _.panBy(w)}else if(h in this._zoomKeys)_.setZoom(_.getZoom()+(c.shiftKey?3:1)*this._zoomKeys[h]);else if(h===27&&_._popup&&_._popup.options.closeOnEscapeKey)_.closePopup();else return;si(c)}}});Ni.addInitHook("addHandler","keyboard",Or),Ni.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var wo=Kn.extend({addHooks:function(){Wt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){wi(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(c){var h=on(c),_=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(c),this._startTime||(this._startTime=+new Date);var w=Math.max(_-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),w),si(c)},_performZoom:function(){var c=this._map,h=c.getZoom(),_=this._map.options.zoomSnap||0;c._stop();var w=this._delta/(this._map.options.wheelPxPerZoomLevel*4),k=4*Math.log(2/(1+Math.exp(-Math.abs(w))))/Math.LN2,W=_?Math.ceil(k/_)*_:k,se=c._limitZoom(h+(this._delta>0?W:-W))-h;this._delta=0,this._startTime=null,se&&(c.options.scrollWheelZoom==="center"?c.setZoom(h+se):c.setZoomAround(this._lastMousePos,h+se))}});Ni.addInitHook("addHandler","scrollWheelZoom",wo);var Os=600;Ni.mergeOptions({tapHold:fe.touchNative&&fe.safari&&fe.mobile,tapTolerance:15});var io=Kn.extend({addHooks:function(){Wt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){wi(this._map._container,"touchstart",this._onDown,this)},_onDown:function(c){if(clearTimeout(this._holdTimeout),c.touches.length===1){var h=c.touches[0];this._startPos=this._newPos=new ge(h.clientX,h.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(Wt(document,"touchend",Rt),Wt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),Os),Wt(document,"touchend touchcancel contextmenu",this._cancel,this),Wt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function c(){wi(document,"touchend",Rt),wi(document,"touchend touchcancel",c)},_cancel:function(){clearTimeout(this._holdTimeout),wi(document,"touchend touchcancel contextmenu",this._cancel,this),wi(document,"touchmove",this._onMove,this)},_onMove:function(c){var h=c.touches[0];this._newPos=new ge(h.clientX,h.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(c,h){var _=new MouseEvent(c,{bubbles:!0,cancelable:!0,view:window,screenX:h.screenX,screenY:h.screenY,clientX:h.clientX,clientY:h.clientY});_._simulated=!0,h.target.dispatchEvent(_)}});Ni.addInitHook("addHandler","tapHold",io),Ni.mergeOptions({touchZoom:fe.touch,bounceAtZoomLimits:!0});var wr=Kn.extend({addHooks:function(){Me(this._map._container,"leaflet-touch-zoom"),Wt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){nt(this._map._container,"leaflet-touch-zoom"),wi(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(c){var h=this._map;if(!(!c.touches||c.touches.length!==2||h._animatingZoom||this._zooming)){var _=h.mouseEventToContainerPoint(c.touches[0]),w=h.mouseEventToContainerPoint(c.touches[1]);this._centerPoint=h.getSize()._divideBy(2),this._startLatLng=h.containerPointToLatLng(this._centerPoint),h.options.touchZoom!=="center"&&(this._pinchStartLatLng=h.containerPointToLatLng(_.add(w)._divideBy(2))),this._startDist=_.distanceTo(w),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),Wt(document,"touchmove",this._onTouchMove,this),Wt(document,"touchend touchcancel",this._onTouchEnd,this),Rt(c)}},_onTouchMove:function(c){if(!(!c.touches||c.touches.length!==2||!this._zooming)){var h=this._map,_=h.mouseEventToContainerPoint(c.touches[0]),w=h.mouseEventToContainerPoint(c.touches[1]),k=_.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 W=_._add(w)._divideBy(2)._subtract(this._centerPoint);if(k===1&&W.x===0&&W.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(W),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),ve(this._animRequest);var se=r(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=ie(se,this,!0),Rt(c)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ve(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))}});Ni.addInitHook("addHandler","touchZoom",wr),Ni.BoxZoom=As,Ni.DoubleClickZoom=Vs,Ni.Drag=yo,Ni.Keyboard=Or,Ni.ScrollWheelZoom=wo,Ni.TapHold=io,Ni.TouchZoom=wr,t.Bounds=pe,t.Browser=fe,t.CRS=Be,t.Canvas=ts,t.Circle=H0,t.CircleMarker=Ah,t.Class=Q,t.Control=Ki,t.DivIcon=Sn,t.DivOverlay=un,t.DomEvent=pn,t.DomUtil=ji,t.Draggable=xs,t.Evented=Fe,t.FeatureGroup=aa,t.GeoJSON=Nr,t.GridLayer=On,t.Handler=Kn,t.Icon=cc,t.ImageOverlay=xe,t.LatLng=ht,t.LatLngBounds=Ot,t.Layer=vo,t.LayerGroup=pl,t.LineUtil=Pa,t.Map=Ni,t.Marker=Dh,t.Mixin=eo,t.Path=Ta,t.Point=ge,t.PolyUtil=N0,t.Polygon=xl,t.Polyline=Rr,t.Popup=Oi,t.PosAnimation=wn,t.Projection=O0,t.Rectangle=es,t.Renderer=Hn,t.SVG=Jn,t.SVGOverlay=Pi,t.TileLayer=Yi,t.Tooltip=an,t.Transformation=wt,t.Util=Se,t.VideoOverlay=pt,t.bind=r,t.bounds=lt,t.canvas=ds,t.circle=W0,t.circleMarker=xx,t.control=Vi,t.divIcon=Vn,t.extend=n,t.featureGroup=fx,t.geoJSON=_x,t.geoJson=Z,t.gridLayer=jn,t.icon=gx,t.imageOverlay=bt,t.latLng=me,t.latLngBounds=Xe,t.layerGroup=hx,t.map=Rn,t.marker=px,t.point=Oe,t.polygon=vx,t.polyline=Ub,t.popup=rn,t.rectangle=$n,t.setOptions=E,t.stamp=d,t.svg=Yn,t.svgOverlay=Ui,t.tileLayer=Ln,t.tooltip=Nn,t.transformation=ui,t.version=i,t.videoOverlay=at;var Ma=window.L;t.noConflict=function(){return window.L=Ma,this},window.L=t}))})(xg,xg.exports)),xg.exports}var kZ=AZ();const J0=dS(kZ),BZ="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=",FZ="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==",LZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",Dn=(o,e=fb)=>{var t=IZ(),i=v(m(t),2),n=m(i);z(()=>N(n,e())),D(o,t)};var IZ=F('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),PZ=F("<button> </button>"),TZ=F('<span class="err svelte-767znw"> </span>'),MZ=F('<span class="ok svelte-767znw"> </span>'),RZ=F('<div class="loading svelte-767znw">Loading…</div>'),NZ=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>'),OZ=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>'),HZ=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),WZ=F('<div class="field-error svelte-767znw"> </div>'),zZ=F('<div class="field-ok svelte-767znw"> </div>'),VZ=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>'),jZ=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),$Z=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>'),UZ=F('<section id="sec-broker" class="svelte-767znw"><h3 class="svelte-767znw">Mosquitto management</h3> <div class="field field--check svelte-767znw"><label class="svelte-767znw">Enable <!></label> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Mosquitto management<!></label></div></section>'),qZ=F('<div class="field svelte-767znw"><label class="svelte-767znw">Storage path <!></label> <input id="matter-storage-input" type="text" class="svelte-767znw"/></div>'),GZ=F('<section id="sec-matter" class="svelte-767znw"><h3 class="svelte-767znw">Matter controller</h3> <div class="field field--check svelte-767znw"><label class="svelte-767znw">Enable <!></label> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Matter controller<!></label></div> <!></section>'),KZ=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>'),ZZ=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>'),XZ=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>'),N2=F("<option> </option>"),YZ=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>'),QZ=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>'),JZ=F('<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> Retain document messages <!></label></div>'),eX=F('<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 class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Publish documents to MQTT <!></label></div> <!>',1),tX=F('<section id="sec-shedb" class="svelte-767znw"><h3 class="svelte-767znw">sheDB</h3> <div class="field field--check svelte-767znw"><label class="svelte-767znw">Enable <!></label> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> sheDB</label></div> <!></section>'),iX=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>'),nX=F('<div class="field svelte-767znw"><label class="svelte-767znw">Token <!></label> <input type="password" placeholder="API token" autocomplete="off" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Organization <!></label> <input type="text" placeholder="my-org" spellcheck="false" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Bucket <!></label> <input type="text" placeholder="mqtt" spellcheck="false" class="svelte-767znw"/></div>',1),sX=F('<div class="field svelte-767znw"><label class="svelte-767znw">Database <!></label> <input type="text" placeholder="she" spellcheck="false" 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>',1),oX=F('<section id="sec-influx" class="svelte-767znw"><h3 class="svelte-767znw">InfluxDB</h3> <div class="field svelte-767znw"><label class="svelte-767znw">URL <!></label> <input type="text" placeholder="leave empty to disable" spellcheck="false" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">API version <!></label> <select class="svelte-767znw"><option>2.x (token / org / bucket)</option><option>1.x (database / username / password)</option></select></div> <!></section>'),rX=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>'),aX=F('<section id="sec-engine" class="svelte-767znw"><h3 class="svelte-767znw">Script engine</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> Enable event-loop heartbeat <!></label></div> <div class="field svelte-767znw"><label class="svelte-767znw">Heartbeat interval (ms) <!></label> <input type="number" min="10" max="5000" step="10" placeholder="50" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Lag threshold (ms) <!></label> <input type="number" min="50" max="60000" step="50" placeholder="300" class="svelte-767znw"/></div></section>'),lX=F('<span class="free-badge svelte-767znw">FREE</span> ',1),cX=F('&nbsp;— <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),dX=F("<div><!> <!></div>"),uX=F('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),hX=F('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),fX=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>'),gX=F('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),pX=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 xX(o,e){Zs(e,!0),delete J0.Icon.Default.prototype._getIconUrl,J0.Icon.Default.mergeOptions({iconUrl:BZ,iconRetinaUrl:FZ,shadowUrl:LZ});let t=B(_i(z$())),i=B("~/.she"),n=B("mqtt"),s=B(""),r=B(""),a=B(""),d=B(""),u=B(""),f=B(""),g=B("logic"),p=B("var"),C=B(""),b=B(!1),E=B(!1),y=B(!1),A=B(!1),I=B(""),M=B(!1),R=B(8080),P=B(""),V=B("none"),U=B(""),J=B("X-Remote-User"),re=B(""),ae=B(!1),ie=B(""),ve=B(""),Se=B(""),Q=B(!1),he=B(!1),De=B(!1),Fe=B(""),ge=B(48.7408),Ne=B(9.1778),Oe=B(!1),pe=B(void 0),lt=B(!1),Ot=B(null),Xe=B("info"),ht=B(!1),me=B(50),Be=B(300),st=B(!0),vt=B(""),rt=B(""),wt=B(!1),ui=B(!1),ci=B(""),hi=B("2"),Ct=B(""),ai=B(""),Re=B(""),Ee=B(""),zt=B(""),ii=B(""),Vt=B("");const Ai=[{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 Fi=B("ollama"),mi=B("ollama"),ln=B(""),sn=B(""),dn=B("");const bn={};let ft="ollama";function qt($,ue){return $==="anthropic"?"anthropic":$==="ollama"?"ollama":ue?ue.includes("localhost:1234")?"lmstudio":ue.includes("groq.com")?"groq":ue.includes("googleapis.com")?"gemini":"openai":"openai"}function Ti(){bn[ft]={baseUrl:l(ln),model:l(sn),apiKey:l(dn)};const $=Ai.find(Ce=>Ce.id===l(Fi));if(!$)return;x(mi,$.provider,!0);const ue=bn[l(Fi)];x(ln,(ue==null?void 0:ue.baseUrl)??$.baseUrl,!0),x(sn,(ue==null?void 0:ue.model)??$.defaultModel,!0),x(dn,(ue==null?void 0:ue.apiKey)??"",!0),ft=l(Fi)}const ki=At(()=>Ai.find($=>$.id===l(Fi)));let bi=B(_i({}));const yn=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","influx","ai","broker","matter-storage"]);us(()=>{if(!l(pe))return;const $=typeof l(ge)=="number"?l(ge):48.7408,ue=typeof l(Ne)=="number"?l(Ne):9.1778,Ce=J0.map(l(pe)).setView([$,ue],10);J0.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(Ce);const _e=J0.marker([$,ue],{draggable:!0}).addTo(Ce);x(Ot,_e,!0);const Je=Ve=>{x(ge,+Ve.lat.toFixed(6)),x(Ne,+Ve.lng.toFixed(6))};return _e.on("dragend",()=>Je(_e.getLatLng())),Ce.on("click",Ve=>{_e.setLatLng(Ve.latlng),Je(Ve.latlng)}),()=>{x(Ot,null),Ce.remove()}}),us(()=>{!l(Ot)||l(ge)===""||l(Ne)===""||l(Ot).setLatLng([Number(l(ge)),Number(l(Ne))])});let mn;function _n(){if(!navigator.geolocation){mn.show("Geolocation is not supported by this browser.",{alert:!0});return}x(lt,!0),navigator.geolocation.getCurrentPosition($=>{x(ge,+$.coords.latitude.toFixed(6)),x(Ne,+$.coords.longitude.toFixed(6)),x(lt,!1)},()=>{x(lt,!1)})}let qe=B(!0),Xt=B(!1),yi=B(""),Ut=B(""),Li=B(""),qi=B("appearance");const Gi=[{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:"broker",label:"Mosquitto",terms:["mosquitto","broker","mqtt broker","management","dynsec"]},{id:"matter",label:"Matter controller",terms:["matter","thread","zigbee","iot","devices","smart home controller"]},{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:"shedb",label:"sheDB",terms:["database","db","shedb","path","retain","enable"]},{id:"redis",label:"Redis",terms:["redis","cache"]},{id:"influx",label:"InfluxDB",terms:["influx","influxdb","time series","history","token","org","bucket","database","flux","influxql"]},{id:"logging",label:"Logging",terms:["verbosity","debug","info","warn","error"]},{id:"engine",label:"Script engine",terms:["heartbeat","event loop","lag","blocking","performance"]},{id:"ai",label:"AI Assistant",terms:["llm","ollama","openai","anthropic","model","provider","base url"]}];let K=At(()=>Gi.filter($=>{const ue=l(Li).trim().toLowerCase();return!ue||$.label.toLowerCase().includes(ue)||$.terms.some(Ce=>Ce.includes(ue))}));function Ae($){var ue;x(qi,$,!0),(ue=document.getElementById("sec-"+$))==null||ue.scrollIntoView({behavior:"smooth",block:"start"})}oo(async()=>{try{const $=await xf();$.dataDir&&x(i,$.dataDir,!0)}catch{}try{const $=await Zl();if(typeof $.url=="string"&&$.url)try{const St=new URL($.url);x(n,St.protocol.replace(":",""),!0),x(s,St.host,!0)}catch{x(s,$.url,!0)}if(typeof $.mqttUsername=="string"&&x(r,$.mqttUsername,!0),typeof $.mqttPassword=="string"&&x(a,$.mqttPassword,!0),typeof $.mqttCa=="string"&&x(d,$.mqttCa,!0),typeof $.mqttCert=="string"&&x(u,$.mqttCert,!0),typeof $.mqttKey=="string"&&x(f,$.mqttKey,!0),typeof $.mqttVersion=="string"&&x(C,$.mqttVersion,!0),typeof $.name=="string"&&x(g,$.name,!0),typeof $.variablePrefix=="string"&&x(p,$.variablePrefix,!0),typeof $.disableVariables=="boolean"&&x(b,$.disableVariables,!0),typeof $.port=="number"&&x(R,$.port,!0),typeof $.bindAddress=="string"&&x(P,$.bindAddress,!0),typeof $.auth=="string"&&x(V,$.auth,!0),typeof $.proxyHeader=="string"&&x(J,$.proxyHeader,!0),typeof $.proxyLogoutUrl=="string"&&x(re,$.proxyLogoutUrl,!0),typeof $.dir=="string"&&x(Se,$.dir,!0),typeof $.disableWatch=="boolean"&&x(Q,$.disableWatch,!0),typeof $.gitAutoCommit=="boolean"&&x(he,$.gitAutoCommit,!0),typeof $.gitAutoPush=="boolean"&&x(De,$.gitAutoPush,!0),typeof $.latitude=="number"&&x(ge,$.latitude,!0),typeof $.longitude=="number"&&x(Ne,$.longitude,!0),typeof $.timezone=="string"&&x(Fe,$.timezone,!0),typeof $.verbosity=="string"&&x(Xe,$.verbosity,!0),typeof $.heartbeat=="object"&&$.heartbeat!==null){const St=$.heartbeat;typeof St.enabled=="boolean"&&x(ht,St.enabled,!0),typeof St.interval=="number"&&x(me,St.interval,!0),typeof St.threshold=="number"&&x(Be,St.threshold,!0)}typeof $.dbPath=="string"?(x(st,$.dbPath!==""),x(vt,$.dbPath,!0)):(x(st,!0),x(vt,"")),typeof $.dbPrefix=="string"&&x(rt,$.dbPrefix,!0),typeof $.dbPublish=="boolean"&&x(wt,$.dbPublish,!0),typeof $.dbRetain=="boolean"&&x(ui,$.dbRetain,!0);const ue=$.redis;ue!=null&&ue.url&&x(ci,ue.url,!0);const Ce=$.influx;Ce&&(x(hi,Number(Ce.version)===1||Ce.database&&!Ce.token?"1":"2",!0),typeof Ce.url=="string"&&x(Ct,Ce.url,!0),typeof Ce.token=="string"&&x(ai,Ce.token,!0),typeof Ce.org=="string"&&x(Re,Ce.org,!0),typeof Ce.bucket=="string"&&x(Ee,Ce.bucket,!0),typeof Ce.database=="string"&&x(zt,Ce.database,!0),typeof Ce.username=="string"&&x(ii,Ce.username,!0),typeof Ce.password=="string"&&x(Vt,Ce.password,!0));const _e=$.broker;x(E,(_e==null?void 0:_e.enabled)===!0);const Je=$["matter-storage"];x(A,!!Je),x(I,Je&&typeof Je=="string"&&Je!=="true"?Je:"",!0);const Ve=$.ai;Ve!=null&&Ve.provider&&x(mi,Ve.provider,!0),Ve!=null&&Ve.baseUrl&&x(ln,Ve.baseUrl,!0),Ve!=null&&Ve.model&&x(sn,Ve.model,!0),Ve!=null&&Ve.apiKey&&x(dn,Ve.apiKey,!0),x(Fi,qt(l(mi),l(ln)),!0),ft=l(Fi),x(bi,Object.fromEntries(Object.entries($).filter(([St])=>!yn.has(St))),!0),_e&&x(bi,{...l(bi),broker:_e},!0)}catch($){x(Ut,$.message,!0)}finally{x(qe,!1)}});async function ot(){if(x(ve,""),x(ie,""),l(V)==="password"&&!l(U)){x(ve,"A password is required to enable password authentication.");return}x(ae,!0);try{await K$(l(V),l(V)==="password"?l(U):void 0,l(V)==="proxy"?l(J):void 0,l(V)==="proxy"?l(re):void 0),x(U,""),x(ie,"Authentication settings saved.")}catch($){x(ve,$.message,!0)}finally{x(ae,!1)}}async function Ge($){if($){x(st,!0);return}let ue=0;try{ue=(await xf()).dbDocs??0}catch{}ue>0&&!await mn.show(`sheDB contains ${ue} document${ue===1?"":"s"}. Disabling it will hide the DB page but data on disk is preserved and can be re-enabled later. Continue?`,{confirm:"Disable anyway",danger:!0})||x(st,!1)}async function Pt($){if($){x(A,!0);return}x(M,!0);try{const ue=await oS();if(ue.length>0){await mn.show(`Cannot disable the Matter controller: ${ue.length} device${ue.length===1?" is":"s are"} still paired. Unpair all devices first via the Matter page.`,{alert:!0});return}}catch{}finally{x(M,!1)}x(A,!1)}async function Yt($){var ue;if($){x(E,!0);return}x(y,!0);try{const Ce=await zb();if((ue=Ce.dynsec)!=null&&ue.configured){await mn.show("Cannot disable mosquitto management: the dynamic security plugin is still configured. Remove it first via Broker → Status.",{alert:!0});return}if(Ce.sshConfigured&&!await mn.show("An SSH broker connection is configured. Disabling mosquitto management will hide the Broker page but your configuration will be preserved.",{confirm:"Disable anyway",danger:!0}))return}catch{}finally{x(y,!1)}x(E,!1)}async function gt(){x(Ut,""),x(yi,"");const $={...l(bi)};l(s)&&($.url=`${l(n)}://${l(s)}`),$.name=l(g),$.variablePrefix=l(p),l(C)&&($.mqttVersion=l(C)),l(b)&&($.disableVariables=!0),l(r)&&($.mqttUsername=l(r)),l(a)&&($.mqttPassword=l(a)),l(d)&&($.mqttCa=l(d)),l(u)&&($.mqttCert=l(u)),l(f)&&($.mqttKey=l(f)),l(R)!==""&&($.port=Number(l(R))),l(P)&&($.bindAddress=l(P)),l(Se)&&($.dir=l(Se)),l(Q)&&($.disableWatch=!0),l(he)&&($.gitAutoCommit=!0),l(De)&&($.gitAutoPush=!0),l(ge)!==""&&($.latitude=Number(l(ge))),l(Ne)!==""&&($.longitude=Number(l(Ne))),l(Fe)&&($.timezone=l(Fe)),$.verbosity=l(Xe),$.heartbeat={enabled:l(ht),...l(me)!==""?{interval:Number(l(me))}:{},...l(Be)!==""?{threshold:Number(l(Be))}:{}},l(st)?l(vt)&&($.dbPath=l(vt),l(rt)&&($.dbPrefix=l(rt)),l(wt)&&($.dbPublish=!0,l(ui)&&($.dbRetain=!0))):$.dbPath="",l(ci)&&($.redis={url:l(ci)}),l(Ct)&&($.influx=l(hi)==="1"?{version:1,url:l(Ct),...l(zt)?{database:l(zt)}:{},...l(ii)?{username:l(ii)}:{},...l(Vt)?{password:l(Vt)}:{}}:{url:l(Ct),...l(ai)?{token:l(ai)}:{},...l(Re)?{org:l(Re)}:{},...l(Ee)?{bucket:l(Ee)}:{}});const ue=l(bi).broker??{},{enabled:Ce,..._e}=ue;l(E)?$.broker={..._e,enabled:!0}:Object.keys(_e).length>0&&($.broker=_e),l(A)&&($["matter-storage"]=l(I)||!0),l(mi)&&($.ai={provider:l(mi),...l(ln)?{baseUrl:l(ln)}:{},...l(sn)?{model:l(sn)}:{},...l(dn)?{apiKey:l(dn)}:{}}),x(Xt,!0);try{const Je=await Dp($);window.dispatchEvent(new CustomEvent("she:config-changed")),x(yi,Je.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(Je){x(Ut,Je.message,!0)}finally{x(Xt,!1)}}var et=pX(),X=dt(et);ks(gl(X,{}),$=>mn=$,()=>mn);var Pe=v(X,2),ce=m(Pe),fe=m(ce),Gt=v(m(fe),2),ni=v(fe,2);ti(ni,21,()=>Gi,$=>$.id,($,ue)=>{var Ce=Us(),_e=dt(Ce);{var Je=St=>{var q=PZ();let T;var H=m(q);z(()=>{T=Dt(q,1,"section-link svelte-767znw",null,T,{active:l(qi)===l(ue).id}),N(H,l(ue).label)}),j("click",q,()=>Ae(l(ue).id)),D(St,q)},Ve=At(()=>l(K).some(St=>St.id===l(ue).id));O(_e,St=>{l(Ve)&&St(Je)})}D($,Ce)});var gi=v(ce,2),fi=m(gi),Ii=v(m(fi),2);{var pi=$=>{var ue=TZ(),Ce=m(ue);z(()=>N(Ce,l(Ut))),D($,ue)};O(Ii,$=>{l(Ut)&&$(pi)})}var Ci=v(Ii,2);{var He=$=>{var ue=MZ(),Ce=m(ue);z(()=>N(Ce,l(yi))),D($,ue)};O(Ci,$=>{l(yi)&&$(He)})}var Ye=v(Ci,2),jt=m(Ye),Qt=v(fi,2);{var Mi=$=>{var ue=RZ();D($,ue)},oi=$=>{var ue=gX(),Ce=m(ue);{var _e=we=>{var it=NZ(),ut=v(m(it),2),Lt=v(m(ut),2),Rt=m(Lt);Rt.value=Rt.__value="dark";var si=v(Rt);si.value=si.__value="light";var ri=v(si);ri.value=ri.__value="system",j("change",Lt,()=>V$(l(t))),$s(Lt,()=>l(t),Ri=>x(t,Ri)),D(we,it)},Je=At(()=>l(K).some(we=>we.id==="appearance"));O(Ce,we=>{l(Je)&&we(_e)})}var Ve=v(Ce,2);{var St=we=>{var it=VZ(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var si=v(Lt,2),ri=m(si);ri.value=ri.__value="none";var Ri=v(ri);Ri.value=Ri.__value="password";var tn=v(Ri);tn.value=tn.__value="proxy";var on=v(ut,2);{var en=Fn=>{var zn=OZ(),as=m(zn),Es=m(as),Ns=v(Es);Dn(Ns,()=>"Set a new password. Leave empty to keep the current password (if already set).");var Cn=v(as,2);z(()=>N(Es,`${l(U)?"New password":"Password"} `)),yt(Cn,()=>l(U),Kn=>x(U,Kn)),D(Fn,zn)};O(on,Fn=>{l(V)==="password"&&Fn(en)})}var pn=v(on,2);{var wn=Fn=>{var zn=HZ(),as=dt(zn),Es=m(as),Ns=v(m(Es));Dn(Ns,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var Cn=v(Es,2),Kn=v(as,2),eo=m(Kn),to=v(m(eo));Dn(to,()=>"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 xs=v(eo,2);yt(Cn,()=>l(J),ar=>x(J,ar)),yt(xs,()=>l(re),ar=>x(re,ar)),D(Fn,zn)};O(pn,Fn=>{l(V)==="proxy"&&Fn(wn)})}var Ni=v(pn,2);{var Rn=Fn=>{var zn=WZ(),as=m(zn);z(()=>N(as,l(ve))),D(Fn,zn)};O(Ni,Fn=>{l(ve)&&Fn(Rn)})}var Ki=v(Ni,2);{var Vi=Fn=>{var zn=zZ(),as=m(zn);z(()=>N(as,l(ie))),D(Fn,zn)};O(Ki,Fn=>{l(ie)&&Fn(Vi)})}var nn=v(Ki,2),Mn=v(m(nn),2),Cs=m(Mn);z(()=>{Mn.disabled=l(ae)||l(V)==="password"&&!l(U),N(Cs,l(ae)?"Saving…":"Apply authentication settings")}),$s(si,()=>l(V),Fn=>x(V,Fn)),j("click",Mn,ot),D(we,it)},q=At(()=>l(K).some(we=>we.id==="auth"));O(Ve,we=>{l(q)&&we(St)})}var T=v(Ve,2);{var H=we=>{var it=$Z(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var si=v(Lt,2),ri=m(si);ri.value=ri.__value="mqtt";var Ri=v(ri);Ri.value=Ri.__value="mqtts";var tn=v(Ri);tn.value=tn.__value="ws";var on=v(tn);on.value=on.__value="wss";var en=v(ut,2),pn=m(en),wn=v(m(pn));Dn(wn,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var Ni=v(pn,2),Rn=v(en,2),Ki=m(Rn),Vi=v(m(Ki));Dn(Vi,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var nn=v(Ki,2),Mn=v(Rn,2),Cs=m(Mn),Fn=v(m(Cs));Dn(Fn,()=>"MQTT broker password. Stored in plain text in config.json.");var zn=v(Cs,2),as=v(Mn,2);{var Es=Is=>{var Mr=jZ(),md=dt(Mr),Ia=m(md),Bo=v(m(Ia));Dn(Bo,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var yh=v(Ia,2),lc=v(md,2),Pa=m(lc),_d=v(m(Pa));Dn(_d,()=>"PEM-encoded client certificate for mutual TLS authentication.");var bd=v(Pa,2),O0=v(lc,2),Cd=m(O0),wh=v(m(Cd));Dn(wh,()=>"PEM-encoded private key matching the client certificate.");var Sh=v(Cd,2);yt(yh,()=>l(d),vo=>x(d,vo)),yt(bd,()=>l(u),vo=>x(u,vo)),yt(Sh,()=>l(f),vo=>x(f,vo)),D(Is,Mr)};O(as,Is=>{(l(n)==="mqtts"||l(n)==="wss")&&Is(Es)})}var Ns=v(as,2),Cn=m(Ns),Kn=v(m(Cn));Dn(Kn,()=>"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 eo=v(Cn,2),to=m(eo);to.value=to.__value="";var xs=v(to);xs.value=xs.__value="5";var ar=v(Ns,2),nc=m(ar),sc=v(m(nc));Dn(sc,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var N0=v(nc,2),oc=v(ar,2),pd=m(oc),Ch=v(m(pd));Dn(Ch,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var xd=v(pd,2),rc=v(oc,2),Eh=v(m(rc),2),ac=m(Eh),vd=v(ac,4);Dn(vd,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),$s(si,()=>l(n),Is=>x(n,Is)),yt(Ni,()=>l(s),Is=>x(s,Is)),yt(nn,()=>l(r),Is=>x(r,Is)),yt(zn,()=>l(a),Is=>x(a,Is)),$s(eo,()=>l(C),Is=>x(C,Is)),yt(N0,()=>l(g),Is=>x(g,Is)),yt(xd,()=>l(p),Is=>x(p,Is)),Ms(ac,()=>l(b),Is=>x(b,Is)),D(we,it)},Y=At(()=>l(K).some(we=>we.id==="mqtt"));O(T,we=>{l(Y)&&we(H)})}var ne=v(T,2);{var le=we=>{var it=UZ(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Shows the Broker page in the navigation, giving access to listener config, dynamic security, TLS certificates and more. Disable if you are not using Mosquitto or prefer to manage it externally.");var si=v(Lt,2);let ri;var Ri=m(si),tn=v(Ri,4);{var on=en=>{var pn=Co("— checking…");D(en,pn)};O(tn,en=>{l(y)&&en(on)})}z(()=>{ri=Dt(si,1,"check-label svelte-767znw",null,ri,{muted:l(y)}),vr(Ri,l(E)),Ri.disabled=l(y)}),j("change",Ri,en=>Yt(en.target.checked)),D(we,it)},oe=At(()=>l(K).some(we=>we.id==="broker"));O(ne,we=>{l(oe)&&we(le)})}var ye=v(ne,2);{var We=we=>{var it=GZ(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Shows the Matter page and starts the built-in Matter controller on next restart. Requires a restart to take effect. Disable only after unpairing all devices.");var si=v(Lt,2);let ri;var Ri=m(si),tn=v(Ri,4);{var on=wn=>{var Ni=Co("— checking…");D(wn,Ni)};O(tn,wn=>{l(M)&&wn(on)})}var en=v(ut,2);{var pn=wn=>{var Ni=qZ(),Rn=m(Ni),Ki=v(m(Rn));Dn(Ki,()=>"Path to the Matter controller storage directory. Leave empty to use the default ({dataDir}/matter).");var Vi=v(Rn,2);z(()=>gn(Vi,"placeholder",`${l(i)??""}/matter (default)`)),yt(Vi,()=>l(I),nn=>x(I,nn)),D(wn,Ni)};O(en,wn=>{l(A)&&wn(pn)})}z(()=>{ri=Dt(si,1,"check-label svelte-767znw",null,ri,{muted:l(M)}),vr(Ri,l(A)),Ri.disabled=l(M)}),j("change",Ri,wn=>Pt(wn.target.checked)),D(we,it)},be=At(()=>l(K).some(we=>we.id==="matter"));O(ye,we=>{l(be)&&we(We)})}var Le=v(ye,2);{var Me=we=>{var it=KZ(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var si=v(Lt,2),ri=v(ut,2),Ri=m(ri),tn=v(m(Ri));Dn(tn,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var on=v(Ri,2);yt(si,()=>l(R),en=>x(R,en)),yt(on,()=>l(P),en=>x(P,en)),D(we,it)},nt=At(()=>l(K).some(we=>we.id==="webserver"));O(Le,we=>{l(nt)&&we(Me)})}var Jt=v(Le,2);{var ee=we=>{var it=ZZ(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var si=v(Lt,2),ri=v(ut,2),Ri=v(m(ri),2),tn=m(Ri),on=v(tn,4);Dn(on,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),z(()=>gn(si,"placeholder",`${l(i)??""}/scripts (default)`)),yt(si,()=>l(Se),en=>x(Se,en)),Ms(tn,()=>l(Q),en=>x(Q,en)),D(we,it)},de=At(()=>l(K).some(we=>we.id==="scripts"));O(Jt,we=>{l(de)&&we(ee)})}var $e=v(Jt,2);{var Ft=we=>{var it=XZ(),ut=v(m(it),2),Lt=v(m(ut),2),Rt=m(Lt),si=v(Rt,4);Dn(si,()=>"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 ri=v(ut,2),Ri=v(m(ri),2),tn=m(Ri),on=v(tn,4);Dn(on,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),Ms(Rt,()=>l(he),en=>x(he,en)),Ms(tn,()=>l(De),en=>x(De,en)),D(we,it)},je=At(()=>l(K).some(we=>we.id==="git"));O($e,we=>{l(je)&&we(Ft)})}var ze=v($e,2);{var kt=we=>{var it=QZ(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"IANA timezone for cron scheduling (e.g. Europe/Berlin). Leave empty to use the system timezone. Requires daemon restart.");var si=v(Lt,2),ri=v(si,2);ti(ri,20,()=>{var Cn;return((Cn=Intl.supportedValuesOf)==null?void 0:Cn.call(Intl,"timeZone"))??[]},zi,(Cn,Kn)=>{var eo=N2(),to=m(eo),xs={};z(()=>{N(to,Kn),xs!==(xs=Kn)&&(eo.value=(eo.__value=Kn)??"")}),D(Cn,eo)});var Ri=v(ut,2),tn=m(Ri),on=v(m(tn));Dn(on,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var en=v(tn,2),pn=v(Ri,2),wn=m(pn),Ni=v(m(wn));Dn(Ni,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var Rn=v(wn,2),Ki=v(pn,2),Vi=v(m(Ki),2),nn=m(Vi),Mn=m(nn);{var Cs=Cn=>{var Kn=Co("…");D(Cn,Kn)},Fn=Cn=>{var Kn=Co("📍 Use my location");D(Cn,Kn)};O(Mn,Cn=>{l(lt)?Cn(Cs):Cn(Fn,-1)})}var zn=v(nn,2),as=m(zn),Es=v(Ki,2);{var Ns=Cn=>{var Kn=YZ(),eo=v(m(Kn),2);ks(eo,to=>x(pe,to),()=>l(pe)),D(Cn,Kn)};O(Es,Cn=>{l(Oe)&&Cn(Ns)})}z(()=>{nn.disabled=l(lt),N(as,l(Oe)?"Hide map":"Pick on map")}),yt(si,()=>l(Fe),Cn=>x(Fe,Cn)),yt(en,()=>l(ge),Cn=>x(ge,Cn)),yt(Rn,()=>l(Ne),Cn=>x(Ne,Cn)),j("click",nn,_n),j("click",zn,()=>x(Oe,!l(Oe))),D(we,it)},ct=At(()=>l(K).some(we=>we.id==="solar"));O(ze,we=>{l(ct)&&we(kt)})}var Qe=v(ze,2);{var mt=we=>{var it=tX(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Built-in JSON document store used by scripts and the DB page. Disable only if you don't use it — data on disk is preserved.");var si=v(Lt,2),ri=m(si),Ri=v(ut,2);{var tn=on=>{var en=eX(),pn=dt(en),wn=m(pn),Ni=v(m(wn));Dn(Ni,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to use the default.");var Rn=v(wn,2),Ki=v(pn,2),Vi=m(Ki),nn=v(m(Vi));Dn(nn,()=>"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 Mn=v(Vi,2),Cs=v(Ki,2),Fn=v(m(Cs),2),zn=m(Fn),as=v(zn,4);Dn(as,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var Es=v(Cs,2);{var Ns=Cn=>{var Kn=JZ(),eo=v(m(Kn),2),to=m(eo),xs=v(to,4);Dn(xs,()=>"When enabled, MQTT messages for document changes are published as retained messages."),Ms(to,()=>l(ui),ar=>x(ui,ar)),D(Cn,Kn)};O(Es,Cn=>{l(wt)&&Cn(Ns)})}z(()=>gn(Rn,"placeholder",`defaults to ${l(i)??""}/db`)),yt(Rn,()=>l(vt),Cn=>x(vt,Cn)),yt(Mn,()=>l(rt),Cn=>x(rt,Cn)),Ms(zn,()=>l(wt),Cn=>x(wt,Cn)),D(on,en)};O(Ri,on=>{l(st)&&on(tn)})}z(()=>vr(ri,l(st))),j("change",ri,on=>Ge(on.target.checked)),D(we,it)},_t=At(()=>l(K).some(we=>we.id==="shedb"));O(Qe,we=>{l(_t)&&we(mt)})}var tt=v(Qe,2);{var Bt=we=>{var it=iX(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"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 si=v(Lt,2);yt(si,()=>l(ci),ri=>x(ci,ri)),D(we,it)},ei=At(()=>l(K).some(we=>we.id==="redis"));O(tt,we=>{l(ei)&&we(Bt)})}var Mt=v(tt,2);{var Kt=we=>{var it=oX(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Base URL of the InfluxDB server, e.g. http://localhost:8086. Leave empty to disable the InfluxDB integration. Requires daemon restart.");var si=v(Lt,2),ri=v(ut,2),Ri=m(ri),tn=v(m(Ri));Dn(tn,()=>"InfluxDB 2.x uses token/org/bucket and Flux queries. InfluxDB 1.x uses database/username/password and InfluxQL queries (she.influx.query).");var on=v(Ri,2),en=m(on);en.value=en.__value="2";var pn=v(en);pn.value=pn.__value="1";var wn=v(ri,2);{var Ni=Ki=>{var Vi=nX(),nn=dt(Vi),Mn=m(nn),Cs=v(m(Mn));Dn(Cs,()=>"InfluxDB API token. Stored in plain text in config.json.");var Fn=v(Mn,2),zn=v(nn,2),as=m(zn),Es=v(m(as));Dn(Es,()=>"InfluxDB organization name.");var Ns=v(as,2),Cn=v(zn,2),Kn=m(Cn),eo=v(m(Kn));Dn(eo,()=>"Bucket that she.influx.write() writes to and getLast()/getRange() read from.");var to=v(Kn,2);yt(Fn,()=>l(ai),xs=>x(ai,xs)),yt(Ns,()=>l(Re),xs=>x(Re,xs)),yt(to,()=>l(Ee),xs=>x(Ee,xs)),D(Ki,Vi)},Rn=Ki=>{var Vi=sX(),nn=dt(Vi),Mn=m(nn),Cs=v(m(Mn));Dn(Cs,()=>"InfluxDB 1.x database name that she.influx writes to and reads from.");var Fn=v(Mn,2),zn=v(nn,2),as=m(zn),Es=v(m(as));Dn(Es,()=>"InfluxDB 1.x username. Leave empty if authentication is disabled on the server.");var Ns=v(as,2),Cn=v(zn,2),Kn=m(Cn),eo=v(m(Kn));Dn(eo,()=>"InfluxDB 1.x password. Stored in plain text in config.json.");var to=v(Kn,2);yt(Fn,()=>l(zt),xs=>x(zt,xs)),yt(Ns,()=>l(ii),xs=>x(ii,xs)),yt(to,()=>l(Vt),xs=>x(Vt,xs)),D(Ki,Vi)};O(wn,Ki=>{l(hi)==="2"?Ki(Ni):Ki(Rn,-1)})}yt(si,()=>l(Ct),Ki=>x(Ct,Ki)),$s(on,()=>l(hi),Ki=>x(hi,Ki)),D(we,it)},Ze=At(()=>l(K).some(we=>we.id==="influx"));O(Mt,we=>{l(Ze)&&we(Kt)})}var Et=v(Mt,2);{var Zt=we=>{var it=rX(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var si=v(Lt,2),ri=m(si);ri.value=ri.__value="debug";var Ri=v(ri);Ri.value=Ri.__value="info";var tn=v(Ri);tn.value=tn.__value="warn";var on=v(tn);on.value=on.__value="error",$s(si,()=>l(Xe),en=>x(Xe,en)),D(we,it)},ji=At(()=>l(K).some(we=>we.id==="logging"));O(Et,we=>{l(ji)&&we(Zt)})}var Wt=v(Et,2);{var $t=we=>{var it=aX(),ut=v(m(it),2),Lt=v(m(ut),2),Rt=m(Lt),si=v(Rt,4);Dn(si,()=>"When enabled, periodically measures event-loop lag and logs a warning when a user script callback blocks the loop longer than the threshold. Requires daemon restart.");var ri=v(ut,2),Ri=m(ri),tn=v(m(Ri));Dn(tn,()=>"How often the heartbeat fires, in milliseconds. Lower = finer resolution, slightly more overhead. Default: 50 ms.");var on=v(Ri,2),en=v(ri,2),pn=m(en),wn=v(m(pn));Dn(wn,()=>"Minimum excess delay (beyond the interval) before a warning is logged. Default: 300 ms.");var Ni=v(pn,2);z(()=>{on.disabled=!l(ht),Ni.disabled=!l(ht)}),Ms(Rt,()=>l(ht),Rn=>x(ht,Rn)),yt(on,()=>l(me),Rn=>x(me,Rn)),yt(Ni,()=>l(Be),Rn=>x(Be,Rn)),D(we,it)},wi=At(()=>l(K).some(we=>we.id==="engine"));O(Wt,we=>{l(wi)&&we($t)})}var Xi=v(Wt,2);{var $i=we=>{var it=fX(),ut=v(m(it),2),Lt=m(ut),Rt=v(m(Lt));Dn(Rt,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var si=v(Lt,2);ti(si,21,()=>Ai,zi,(Vi,nn)=>{var Mn=N2(),Cs=m(Mn),Fn={};z(()=>{N(Cs,l(nn).label),Fn!==(Fn=l(nn).id)&&(Mn.value=(Mn.__value=l(nn).id)??"")}),D(Vi,Mn)});var ri=v(ut,2);{var Ri=Vi=>{var nn=dX();let Mn;var Cs=m(nn);{var Fn=Es=>{var Ns=lX(),Cn=v(dt(Ns));z(()=>N(Cn,` ${l(ki).freeNote??""}`)),D(Es,Ns)};O(Cs,Es=>{l(ki).freeNote&&Es(Fn)})}var zn=v(Cs,2);{var as=Es=>{var Ns=cX(),Cn=v(dt(Ns));z(()=>gn(Cn,"href",l(ki).apiKeyUrl)),D(Es,Ns)};O(zn,Es=>{l(ki).apiKeyUrl&&Es(as)})}z(()=>Mn=Dt(nn,1,"preset-note svelte-767znw",null,Mn,{free:!!l(ki).freeNote})),D(Vi,nn)};O(ri,Vi=>{var nn,Mn;((nn=l(ki))!=null&&nn.freeNote||(Mn=l(ki))!=null&&Mn.apiKeyUrl)&&Vi(Ri)})}var tn=v(ri,2);{var on=Vi=>{var nn=uX(),Mn=m(nn),Cs=v(m(Mn));Dn(Cs,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var Fn=v(Mn,2);z(()=>{var zn;return gn(Fn,"placeholder",l(Fi)==="ollama"?"http://localhost:11434":l(Fi)==="lmstudio"?"http://localhost:1234":((zn=l(ki))==null?void 0:zn.baseUrl)??"")}),yt(Fn,()=>l(ln),zn=>x(ln,zn)),D(Vi,nn)};O(tn,Vi=>{l(Fi)!=="anthropic"&&Vi(on)})}var en=v(tn,2),pn=m(en),wn=v(m(pn));Dn(wn,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var Ni=v(pn,2),Rn=v(en,2);{var Ki=Vi=>{var nn=hX(),Mn=m(nn),Cs=v(m(Mn));Dn(Cs,()=>"Stored in config.json. Not needed for local providers.");var Fn=v(Mn,2);yt(Fn,()=>l(dn),zn=>x(dn,zn)),D(Vi,nn)};O(Rn,Vi=>{l(Fi)!=="ollama"&&l(Fi)!=="lmstudio"&&Vi(Ki)})}z(()=>{var Vi;return gn(Ni,"placeholder",((Vi=l(ki))==null?void 0:Vi.defaultModel)||"e.g. llama3.2")}),j("change",si,Ti),$s(si,()=>l(Fi),Vi=>x(Fi,Vi)),yt(Ni,()=>l(sn),Vi=>x(sn,Vi)),D(we,it)},Hi=At(()=>l(K).some(we=>we.id==="ai"));O(Xi,we=>{l(Hi)&&we($i)})}D($,ue)};O(Qt,$=>{l(qe)?$(Mi):$(oi,-1)})}z(()=>{Ye.disabled=l(Xt),N(jt,l(Xt)?"Saving…":"Save")}),yt(Gt,()=>l(Li),$=>x(Li,$)),j("click",Ye,gt),D(o,et),Xs()}lo(["click","change"]);var vX=F('<span class="history-loading svelte-18loop9" title="Loading log history…">↺</span>'),mX=F("<option> </option>"),_X=F('<button class="script-link svelte-18loop9"> </button> ',1),bX=F('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"><!></span></div>'),CX=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 EX(o,e){Zs(e,!0);const t=2e3;let i=B(_i(FF())),n=B(!0),s,r=B(!0),a=B("all"),d=B(""),u=B(!1);const f=["all","debug","info","warn","error"],g={debug:0,info:1,warn:2,error:3},p=lS(Q=>{x(i,[...l(i).slice(-1999),Q],!0)});B0(p),oo(async()=>{try{const Q=await rS(),he=new Set(l(i).map(Fe=>Fe.ts+Fe.msg)),De=Q.filter(Fe=>!he.has(Fe.ts+Fe.msg));x(i,[...De,...l(i)].slice(-t),!0)}catch{}x(n,!1),s&&(s.scrollTop=s.scrollHeight)}),us(()=>{l(i).length,l(r)&&s&&(s.scrollTop=s.scrollHeight)});function C(){x(i,[],!0)}const b=/^([^:\n]+\.js):\s/;function E(Q){const he=Q.match(b);return he?he[1]:null}function y(Q){location.hash="scripts",window.dispatchEvent(new CustomEvent("she:open-script",{detail:{path:Q}}))}function A(Q){if(l(a)!=="all"&&g[Q.level]<g[l(a)])return!1;if(!l(d))return!0;if(l(u))try{return new RegExp(l(d),"i").test(Q.msg)}catch{}return Q.msg.toLowerCase().includes(l(d).toLowerCase())}var I=CX(),M=m(I),R=v(m(M),2);{var P=Q=>{var he=vX();D(Q,he)};O(R,Q=>{l(n)&&Q(P)})}var V=v(R,2);ti(V,21,()=>f,zi,(Q,he)=>{var De=mX(),Fe=m(De),ge={};z(()=>{N(Fe,l(he)),ge!==(ge=l(he))&&(De.value=(De.__value=l(he))??"")}),D(Q,De)});var U=v(V,2),J=v(U,2),re=m(J),ae=v(J,2),ie=m(ae),ve=v(ae,2),Se=v(M,2);ti(Se,21,()=>l(i).filter(A),zi,(Q,he)=>{const De=At(()=>E(l(he).msg));var Fe=bX(),ge=m(Fe),Ne=m(ge),Oe=v(ge,2),pe=m(Oe),lt=v(Oe,2),Ot=m(lt);{var Xe=me=>{var Be=_X(),st=dt(Be),vt=m(st),rt=v(st,1,!0);z(wt=>{gn(st,"title",`Open ${l(De)??""} in the editor`),N(vt,`${l(De)??""}:`),N(rt,wt)},[()=>l(he).msg.slice(l(De).length+1)]),j("click",st,()=>y(l(De))),D(me,Be)},ht=me=>{var Be=Co();z(()=>N(Be,l(he).msg)),D(me,Be)};O(Ot,me=>{l(De)?me(Xe):me(ht,-1)})}z((me,Be)=>{Dt(Fe,1,`line ${l(he).level??""}`,"svelte-18loop9"),N(Ne,me),N(pe,Be)},[()=>cS(l(he).ts),()=>l(he).level.toUpperCase()]),D(Q,Fe)}),ks(Se,Q=>s=Q,()=>s),$s(V,()=>l(a),Q=>x(a,Q)),yt(U,()=>l(d),Q=>x(d,Q)),Ms(re,()=>l(u),Q=>x(u,Q)),Ms(ie,()=>l(r),Q=>x(r,Q)),j("click",ve,C),D(o,I),Xs()}lo(["click"]);function O2(o,e){if(o===e)return[];if(e==="#")return[o];const t=[],i=o.split("/"),n=e.split("/");let s=0;for(const r=i.length;s<r;s++)if(n[s]==="+")t.push(i[s]);else{if(n[s]==="#")return t.push(i.slice(s).join("/")),t;if(n[s]!==i[s])return null}return n[s]==="#"&&(s+=1),s===n.length?t:null}var yX=F('<span class="chat-model svelte-1twuiul"><!></span>'),wX=F('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),SX=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>'),DX=F('Working on view <code class="svelte-1twuiul"> </code>',1),AX=F('<button class="chip svelte-1twuiul"> </button>'),kX=F('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),BX=F('<div class="msg-content user-text svelte-1twuiul"> </div>'),H2=F('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),W2=F('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),z2=F('<div class="tool-events svelte-1twuiul"></div>'),V2=F('<div class="text-block svelte-1twuiul"></div>'),FX=F('<button class="expand-btn svelte-1twuiul"> </button>'),LX=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>'),IX=F('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),PX=F('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),TX=F("<div><!></div>"),MX=F('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),RX=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>'),NX=F('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),OX=F('<div class="chat-error svelte-1twuiul"> </div>'),HX=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>'),WX=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>'),zX=F('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),VX=F('<button class="send-btn svelte-1twuiul">↑</button>'),jX=F('<option class="svelte-1twuiul"> </option>'),$X=F('<select class="model-select svelte-1twuiul"></select>'),UX=F('<span class="model-name svelte-1twuiul"> </span>'),qX=F('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),GX=F('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),KX=F('<p class="info-status svelte-1twuiul">Loading…</p>'),ZX=F('<p class="info-status info-err svelte-1twuiul"> </p>'),XX=F('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),YX=F('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),QX=F('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),JX=F('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),eY=F('<div class="running-model svelte-1twuiul"> </div>'),tY=F('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),iY=F('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),nY=F('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),sY=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>'),oY=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 rY(o,e){Zs(e,!0),Km.registerLanguage("javascript",MF),ys.use({breaks:!0,gfm:!0});let t=Ku(e,"currentView",3,null);const i="she:viewchat:messages";let n=B(_i(JSON.parse(localStorage.getItem(i)??"[]"))),s=B(null),r=B(""),a=B(!1),d=B(""),u=B(null),f=B(_i([])),g=B(_i(localStorage.getItem("she:selectedModel")??""));us(()=>{localStorage.setItem(i,JSON.stringify(l(n)))});let p=B(_i(new Set)),C=B(!1),b=B(null),E=B(!1),y=B(""),A=null,I=B(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=B(!0),P=B(!0),V=B(!0),U=B(_i([])),J=B(!0),re=B(!1),ae,ie=B(_i([])),ve=B(0),Se,Q;const he=At(()=>({apiref:!1,shedb:l(R),sampleDocs:l(P),tools:l(V)})),De=At(()=>{var q;return((q=l(u))==null?void 0:q.configured)??!1}),Fe=At(()=>l(ve)+new TextEncoder().encode(l(r)).length),ge=At(()=>l(J)?t():null);async function Ne(){try{const q=await wF();x(u,q,!0),q.configured&&!l(g)&&x(g,q.model,!0)}catch{}}us(()=>(window.addEventListener("she:config-changed",Ne),()=>window.removeEventListener("she:config-changed",Ne))),oo(()=>{Ne()}),us(()=>{l(g)&&localStorage.setItem("she:selectedModel",l(g))}),us(()=>{var q;(q=l(u))!=null&&q.provider&&SF().then(T=>{x(f,T.models,!0),!l(g)&&T.models.length>0&&x(g,T.models[0],!0)}).catch(()=>{})}),us(()=>{l(g),x(b,null),x(y,"")}),us(()=>{const q=l(he),T=l(ge),H=l(U);l(De)&&DF({context:q,currentView:T??null,extraFiles:H.length>0?H:void 0}).then(Y=>{x(ve,new TextEncoder().encode(Y.prompt).length,!0)}).catch(()=>{})}),us(()=>{if(!l(a))return;x(I,Math.floor(Math.random()*M.length),!0);const q=setInterval(()=>{x(I,(l(I)+1)%M.length)},1e4);return()=>clearInterval(q)}),us(()=>{var q;Q&&(l(n).length+(((q=l(s))==null?void 0:q.length)??0),requestAnimationFrame(()=>{Q&&(Q.scrollTop=Q.scrollHeight)}))});function Oe(q){const T=[],H=/```(\w*)\n([\s\S]*?)```/g;let Y=0,ne;for(;(ne=H.exec(q))!==null;)ne.index>Y&&T.push({type:"text",text:q.slice(Y,ne.index)}),T.push({type:"code",lang:ne[1]||"text",text:ne[2].trimEnd()}),Y=ne.index+ne[0].length;return Y<q.length&&T.push({type:"text",text:q.slice(Y)}),T}function pe(q){const T=[],H=/```(\w*)\n([\s\S]*?)```/g;let Y=0,ne;for(;(ne=H.exec(q))!==null;)ne.index>Y&&T.push({type:"text",text:q.slice(Y,ne.index)}),T.push({type:"code",lang:ne[1]||"text",text:ne[2].trimEnd()}),Y=ne.index+ne[0].length;const le=q.slice(Y),oe=le.match(/```(\w*)\n([\s\S]*)$/);return oe?(oe.index>0&&T.push({type:"text",text:le.slice(0,oe.index)}),T.push({type:"code",lang:oe[1]||"text",text:oe[2]})):le&&T.push({type:"text",text:le}),T}function lt(q){const T={};for(const H of q)if(H.type==="code"){if(H.lang==="filter")T.filter=H.text.trim();else if(rt(H.lang)){const Y=H.text.split(`
223
+ `)[0].trim();Y==="// @view-map"?T.map=H.text.split(`
224
+ `).slice(1).join(`
225
+ `).trim():Y==="// @view-reduce"&&(T.reduce=H.text.split(`
226
+ `).slice(1).join(`
227
+ `).trim())}}return T}function Ot(q){return q.filter!==void 0||q.map!==void 0||q.reduce!==void 0}function Xe(q){const T=[];return q.filter!==void 0&&T.push("filter"),q.map!==void 0&&T.push("map"),q.reduce!==void 0&&T.push("reduce"),`Apply ${T.join(" + ")}`}const ht=15;function me(q){return q.split(`
228
+ `).length>ht}function Be(q){const T=new Set(l(p));T.has(q)?T.delete(q):T.add(q),x(p,T,!0)}function st(q,T){if(rt(T))try{return Km.highlight(q,{language:"javascript"}).value}catch{}return q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vt(q){return ys.parse(q)}function rt(q){return!q||q==="js"||q==="javascript"}function wt(q){navigator.clipboard.writeText(q).catch(()=>{})}async function ui(){if(x(C,!0),!(l(b)||l(E))){x(E,!0),x(y,"");try{x(b,await fw(l(g)||l(u).model),!0)}catch(q){x(y,q.message,!0)}x(E,!1)}}function ci(q){return q>=1e9?`${(q/1e9).toFixed(1)} GB`:q>=1e6?`${(q/1e6).toFixed(0)} MB`:`${q} B`}function hi(q){const T=q.match(/\.([^.]+)$/);return T?T[1].toUpperCase():"?"}function Ct(q){switch(q){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return q}}function ai(q){x(U,l(U).filter((T,H)=>H!==q),!0)}function Re(){ae.click()}async function Ee(q){if(!(!q||q.length===0))for(const T of Array.from(q)){const H=await T.text();x(U,[...l(U),{name:T.name,content:H}],!0)}}function zt(q){const T=q.target;Ee(T.files),T.value=""}function ii(q){var T;q.preventDefault(),x(re,!1),Ee(((T=q.dataTransfer)==null?void 0:T.files)??null)}function Vt(q){var T;(T=q.dataTransfer)!=null&&T.types.includes("Files")&&(q.preventDefault(),x(re,!0))}function Ai(){x(re,!1)}async function Fi(){const q=l(r).trim();if(!(!q||l(a))){x(r,""),x(d,""),x(a,!0),x(n,[...l(n),{role:"user",content:q}],!0),A=new AbortController,x(ie,[],!0);try{await AF({messages:l(n),currentView:l(ge),context:l(he),modelOverride:l(g)||void 0,extraFiles:l(U).length>0?l(U):void 0},T=>{x(s,(l(s)??"")+T)},A.signal,T=>{x(ie,[...l(ie),T],!0)}),x(n,[...l(n),{role:"assistant",content:l(s)??"",toolEvents:l(ie).length>0?[...l(ie)]:void 0}],!0),x(ie,[],!0)}catch(T){if(T.name==="AbortError"){const H=l(s);H!=null&&H.trim()&&x(n,[...l(n),{role:"assistant",content:H+`
229
+
230
+ *[stopped]*`,toolEvents:l(ie).length>0?[...l(ie)]:void 0}],!0)}else x(d,T.message,!0)}finally{A=null,x(s,null),x(ie,[],!0),x(a,!1)}}}function mi(){A==null||A.abort()}function ln(q){q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),Fi())}function sn(){x(n,[],!0),x(d,"")}const dn=["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 bn(q){x(r,q,!0),Se==null||Se.focus()}var ft=oY(),qt=dt(ft),Ti=m(qt),ki=v(m(Ti),2);{var bi=q=>{var T=yX(),H=m(T);{var Y=le=>{var oe=Co();z(()=>N(oe,`${l(u).provider??""} · ${(l(g)||l(u).model)??""}`)),D(le,oe)},ne=le=>{var oe=Co("Not configured");D(le,oe)};O(H,le=>{l(De)?le(Y):le(ne,-1)})}z(()=>gn(T,"title",`Provider: ${l(u).provider??""}`)),D(q,T)};O(ki,q=>{l(u)&&q(bi)})}var yn=v(ki,2);{var mn=q=>{var T=wX();j("click",T,sn),D(q,T)};O(yn,q=>{l(n).length>0&&q(mn)})}var _n=v(Ti,2),qe=m(_n);{var Xt=q=>{var T=SX();D(q,T)},yi=q=>{var T=kX(),H=m(T),Y=m(H);{var ne=ye=>{var We=DX(),be=v(dt(We)),Le=m(be);z(()=>N(Le,t().id)),D(ye,We)},le=ye=>{var We=Co("No view selected. Ask a general sheDB view question.");D(ye,We)};O(Y,ye=>{t()?ye(ne):ye(le,-1)})}var oe=v(H,2);ti(oe,17,()=>dn,zi,(ye,We)=>{var be=AX(),Le=m(be);z(()=>N(Le,l(We))),j("click",be,()=>bn(l(We))),D(ye,be)}),D(q,T)};O(qe,q=>{l(De)?l(n).length===0&&l(s)===null&&q(yi,1):q(Xt)})}var Ut=v(qe,2);ti(Ut,17,()=>l(n),zi,(q,T,H)=>{var Y=TX(),ne=m(Y);{var le=ye=>{var We=BX(),be=m(We);z(()=>N(be,l(T).content)),D(ye,We)},oe=ye=>{const We=At(()=>Oe(l(T).content)),be=At(()=>lt(l(We)));var Le=PX(),Me=dt(Le);{var nt=je=>{var ze=z2();ti(ze,21,()=>l(T).toolEvents,zi,(kt,ct)=>{var Qe=Us(),mt=dt(Qe);{var _t=Bt=>{var ei=H2(),Mt=v(m(ei)),Kt=m(Mt);z(Ze=>N(Kt,Ze),[()=>l(ct).name.replace(/_/g," ")]),D(Bt,ei)},tt=Bt=>{var ei=W2(),Mt=v(m(ei)),Kt=m(Mt);z(Ze=>N(Kt,Ze),[()=>l(ct).name.replace(/_/g," ")]),D(Bt,ei)};O(mt,Bt=>{l(ct).type==="tool_call"?Bt(_t):Bt(tt,-1)})}D(kt,Qe)}),D(je,ze)};O(Me,je=>{var ze;(ze=l(T).toolEvents)!=null&&ze.length&&je(nt)})}var Jt=v(Me,2),ee=m(Jt);ti(ee,17,()=>l(We),zi,(je,ze,kt)=>{var ct=Us(),Qe=dt(ct);{var mt=tt=>{var Bt=V2();Fc(Bt,()=>vt(l(ze).text),!0),D(tt,Bt)},_t=tt=>{const Bt=At(()=>`${H}:${kt}`),ei=At(()=>me(l(ze).text)),Mt=At(()=>l(p).has(l(Bt))),Kt=At(()=>l(ze).lang==="filter");var Ze=LX(),Et=m(Ze),Zt=m(Et),ji=m(Zt),Wt=v(Zt,2),$t=m(Wt),wi=v(Et,2);let Xi;var $i=m(wi),Hi=m($i);Fc(Hi,()=>st(l(ze).text,l(ze).lang??""),!0);var we=v($i,2);{var it=ut=>{var Lt=FX(),Rt=m(Lt);z(()=>N(Rt,l(Mt)?"▲ collapse":"▼ expand")),j("click",Lt,()=>Be(l(Bt))),D(ut,Lt)};O(we,ut=>{l(ei)&&ut(it)})}z(()=>{N(ji,l(Kt)?"filter":l(ze).lang),Xi=Dt(wi,1,"code-body svelte-1twuiul",null,Xi,{collapsed:l(ei)&&!l(Mt)})}),j("click",$t,()=>wt(l(ze).text)),D(tt,Ze)};O(Qe,tt=>{l(ze).type==="text"?tt(mt):tt(_t,-1)})}D(je,ct)});var de=v(ee,2);{var $e=je=>{var ze=IX(),kt=m(ze),ct=m(kt);z(Qe=>N(ct,Qe),[()=>Xe(l(be))]),j("click",kt,()=>e.onApplyView(l(be))),D(je,ze)},Ft=At(()=>Ot(l(be))&&e.onApplyView);O(de,je=>{l(Ft)&&je($e)})}D(ye,Le)};O(ne,ye=>{l(T).role==="user"?ye(le):ye(oe,-1)})}z(()=>Dt(Y,1,`message ${l(T).role??""}`,"svelte-1twuiul")),D(q,Y)});var Li=v(Ut,2);{var qi=q=>{var T=z2();ti(T,21,()=>l(ie),zi,(H,Y)=>{var ne=Us(),le=dt(ne);{var oe=We=>{var be=H2(),Le=v(m(be)),Me=m(Le);z(nt=>N(Me,nt),[()=>l(Y).name.replace(/_/g," ")]),D(We,be)},ye=We=>{var be=W2(),Le=v(m(be)),Me=m(Le);z(nt=>N(Me,nt),[()=>l(Y).name.replace(/_/g," ")]),D(We,be)};O(le,We=>{l(Y).type==="tool_call"?We(oe):We(ye,-1)})}D(H,ne)}),D(q,T)};O(Li,q=>{l(ie).length>0&&q(qi)})}var Gi=v(Li,2);{var K=q=>{var T=MX(),H=m(T),Y=m(H),ne=m(Y);z(()=>N(ne,M[l(I)])),D(q,T)};O(Gi,q=>{l(a)&&l(s)===null&&l(ie).length===0&&q(K)})}var Ae=v(Gi,2);{var ot=q=>{var T=NX(),H=m(T);ti(H,21,()=>pe(l(s)),zi,(Y,ne)=>{var le=Us(),oe=dt(le);{var ye=be=>{var Le=V2();Fc(Le,()=>vt(l(ne).text),!0),D(be,Le)},We=be=>{var Le=RX(),Me=m(Le),nt=m(Me),Jt=m(nt),ee=v(Me,2),de=m(ee);Fc(de,()=>st(l(ne).text,l(ne).lang??""),!0),z(()=>N(Jt,l(ne).lang)),D(be,Le)};O(oe,be=>{l(ne).type==="text"?be(ye):be(We,-1)})}D(Y,le)}),D(q,T)};O(Ae,q=>{l(s)!==null&&q(ot)})}ks(_n,q=>Q=q,()=>Q);var Ge=v(_n,2);{var Pt=q=>{var T=OX(),H=m(T);z(()=>N(H,l(d))),D(q,T)};O(Ge,q=>{l(d)&&q(Pt)})}var Yt=v(Ge,2),gt=m(Yt),et=m(gt),X=v(gt,2),Pe=m(X),ce=v(X,2),fe=m(ce),Gt=v(ce,2),ni=m(Gt),gi=v(Yt,2),fi=m(gi);{var Ii=q=>{var T=HX();let H;var Y=v(m(T),2),ne=m(Y),le=v(Y,2),oe=m(le);z(()=>{H=Dt(T,1,"file-chip svelte-1twuiul",null,H,{inactive:!l(J)}),N(ne,t().id),gn(le,"title",l(J)?"Remove from context":"Re-add to context"),N(oe,l(J)?"×":"+")}),j("click",le,()=>x(J,!l(J))),D(q,T)};O(fi,q=>{t()&&q(Ii)})}var pi=v(fi,2);ti(pi,17,()=>l(U),zi,(q,T,H)=>{const Y=At(()=>hi(l(T).name));var ne=WX(),le=m(ne),oe=m(le),ye=v(le,2),We=m(ye),be=v(ye,2);z((Le,Me)=>{Dt(le,1,`badge badge-${Le??""}`,"svelte-1twuiul"),N(oe,Me),N(We,l(T).name)},[()=>l(Y).toLowerCase(),()=>Ct(l(Y))]),j("click",be,()=>ai(H)),D(q,ne)});var Ci=v(pi,2),He=v(Ci,2);ks(He,q=>ae=q,()=>ae);var Ye=v(gi,2);let jt;var Qt=m(Ye);let Mi;var oi=m(Qt);ks(oi,q=>Se=q,()=>Se);var $=v(Qt,2);{var ue=q=>{var T=zX();j("click",T,mi),D(q,T)},Ce=q=>{var T=VX();z(H=>T.disabled=H,[()=>!l(r).trim()||!l(De)]),j("click",T,Fi),D(q,T)};O($,q=>{l(a)?q(ue):q(Ce,-1)})}var _e=v(Ye,2);{var Je=q=>{var T=GX(),H=m(T),Y=m(H),ne=v(H,2);{var le=be=>{var Le=$X();ti(Le,21,()=>l(f),zi,(Me,nt)=>{var Jt=jX(),ee=m(Jt),de={};z(()=>{N(ee,l(nt)),de!==(de=l(nt))&&(Jt.value=(Jt.__value=l(nt))??"")}),D(Me,Jt)}),z(()=>Le.disabled=l(a)),$s(Le,()=>l(g),Me=>x(g,Me)),D(be,Le)},oe=be=>{var Le=UX(),Me=m(Le);z(()=>N(Me,l(g)||l(u).model)),D(be,Le)};O(ne,be=>{l(f).length>0?be(le):be(oe,-1)})}var ye=v(ne,2);{var We=be=>{var Le=qX();j("click",Le,ui),D(be,Le)};O(ye,be=>{l(u).provider==="ollama"&&be(We)})}z(()=>N(Y,l(u).provider)),D(q,T)};O(_e,q=>{l(De)&&l(u)&&q(Je)})}var Ve=v(qt,2);{var St=q=>{var T=sY(),H=m(T),Y=m(H),ne=m(Y),le=m(ne),oe=v(ne,2),ye=v(Y,2),We=m(ye);{var be=nt=>{var Jt=KX();D(nt,Jt)},Le=nt=>{var Jt=ZX(),ee=m(Jt);z(()=>N(ee,l(y))),D(nt,Jt)},Me=nt=>{var Jt=nY(),ee=m(Jt);{var de=tt=>{var Bt=XX(),ei=v(dt(Bt)),Mt=m(ei);z(()=>N(Mt,l(b).version)),D(tt,Bt)};O(ee,tt=>{l(b).version&&tt(de)})}var $e=v(ee,2);{var Ft=tt=>{var Bt=YX(),ei=v(dt(Bt)),Mt=m(ei);z(()=>N(Mt,l(b).details.family)),D(tt,Bt)};O($e,tt=>{var Bt;(Bt=l(b).details)!=null&&Bt.family&&tt(Ft)})}var je=v($e,2);{var ze=tt=>{var Bt=QX(),ei=v(dt(Bt)),Mt=m(ei);z(()=>N(Mt,l(b).details.parameter_size)),D(tt,Bt)};O(je,tt=>{var Bt;(Bt=l(b).details)!=null&&Bt.parameter_size&&tt(ze)})}var kt=v(je,2);{var ct=tt=>{var Bt=JX(),ei=v(dt(Bt)),Mt=m(ei);z(()=>N(Mt,l(b).details.quantization_level)),D(tt,Bt)};O(kt,tt=>{var Bt;(Bt=l(b).details)!=null&&Bt.quantization_level&&tt(ct)})}var Qe=v(kt,2);{var mt=tt=>{var Bt=tY(),ei=v(dt(Bt),2);ti(ei,21,()=>l(b).running,zi,(Mt,Kt)=>{var Ze=eY(),Et=m(Ze);z(Zt=>N(Et,`${l(Kt).name??""} · ${Zt??""} VRAM`),[()=>ci(l(Kt).size_vram)]),D(Mt,Ze)}),D(tt,Bt)},_t=tt=>{var Bt=iY();D(tt,Bt)};O(Qe,tt=>{l(b).running&&l(b).running.length>0?tt(mt):l(b).running!==null&&tt(_t,1)})}D(nt,Jt)};O(We,nt=>{l(E)?nt(be):l(y)?nt(Le,1):l(b)&&nt(Me,2)})}z(()=>{var nt;return N(le,`Ollama · ${(l(g)||((nt=l(u))==null?void 0:nt.model))??""}`)}),j("click",T,()=>x(C,!1)),j("click",H,nt=>nt.stopPropagation()),j("click",oe,()=>x(C,!1)),D(q,T)};O(Ve,q=>{l(C)&&q(St)})}z(q=>{N(ni,q),jt=Dt(Ye,1,"input-row svelte-1twuiul",null,jt,{"drag-over":l(re)}),Mi=Dt(Qt,1,"textarea-wrap svelte-1twuiul",null,Mi,{loading:l(a)}),gn(oi,"placeholder",l(De)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),oi.disabled=l(a)||!l(De)},[()=>ci(l(Fe))]),Ms(et,()=>l(R),q=>x(R,q)),Ms(Pe,()=>l(P),q=>x(P,q)),Ms(fe,()=>l(V),q=>x(V,q)),j("click",Ci,Re),j("change",He,zt),Ts("dragover",Ye,Vt),Ts("dragleave",Ye,Ai),Ts("drop",Ye,ii),j("keydown",oi,ln),yt(oi,()=>l(r),q=>x(r,q)),D(o,ft),Xs()}lo(["click","change","keydown"]);var aY=F('<div class="me svelte-1pxdb1"></div>');function Tg(o,e){Zs(e,!0);let t=Ku(e,"value",15,""),i=Ku(e,"language",3,"javascript"),n,s,r=!1;function a(){dr.setTheme(pf())}oo(()=>{const u=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=dr.create(n,{value:t(),language:i(),theme:pf(),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},...u}),s.onDidChangeModelContent(()=>{r||t(s.getValue())}),e.onSave&&s.addCommand(d1.CtrlCmd|Nk.KeyS,()=>e.onSave()),window.addEventListener("she:theme-changed",a);const f=window.matchMedia("(prefers-color-scheme: dark)");return f.addEventListener("change",a),()=>{window.removeEventListener("she:theme-changed",a),f.removeEventListener("change",a)}}),B0(()=>s==null?void 0:s.dispose()),us(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var d=aY();ks(d,u=>n=u,()=>n),D(o,d),Xs()}const j2=o=>{var e=lY();D(o,e)};var lY=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>'),cY=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>'),$2=F('<div class="form-error svelte-rrt0o"> </div>'),dY=F('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),U2=F("<li> </li>"),q2=F('<div class="error-bar svelte-rrt0o"> </div>'),G2=F('<div class="loading svelte-rrt0o">Loading…</div>'),uY=F('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),hY=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),fY=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>'),gY=F('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),pY=mb('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="2,8 6,12 14,4"></polyline></svg>'),xY=mb('<svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><rect x="5" y="2" width="9" height="11" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"></rect><rect x="2" y="5" width="9" height="11" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"></rect></svg>'),vY=F('<div class="mqtt-topic-row svelte-rrt0o"><code class="mqtt-topic svelte-rrt0o"> </code> <button class="btn-copy svelte-rrt0o"><!></button> <span class="section-hint svelte-rrt0o">published on every update</span></div> <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>',1),mY=F('<span class="badge-error svelte-rrt0o">error</span>'),_Y=F('<span class="badge-ok svelte-rrt0o"> </span>'),bY=F('<pre class="result-error svelte-rrt0o"> </pre>'),CY=F('<pre class="result-json svelte-rrt0o"> </pre>'),EY=F('<div class="view-result-fill svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),yY=F('<div class="view-sections svelte-rrt0o"><div class="view-top 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 svelte-rrt0o"><!></div> <div class="view-row-handle svelte-rrt0o" role="separator"></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 svelte-rrt0o"><!></div> <div class="view-row-handle svelte-rrt0o" role="separator"></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</label> <!></div></div> <!></div>'),wY=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),SY=F('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),DY=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>'),AY=F('<!> <div role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>',1);function kY(o,e){Zs(e,!0);let t=B(_i([])),i=B(null),n=B("{}"),s=B(!1),r=B(null);const a="she-db-selected-view";let d=B(_i([])),u=B(_i(localStorage.getItem(a))),f=B("#"),g=B("// emit(this.someProperty)"),p=B(""),C=B(""),b=B(!1),E=B(!1),y=B(null),A=B(!1),I=B(null),M=B("she/db/view/");const R="she-db-panel";let P=B(_i(localStorage.getItem(R)??"docs")),V=B(""),U=B(!1),J=B(null),re=B(""),ae=B(!1),ie=B(null);const ve="she-db-sidebar-width";let Se=B(_i(parseInt(localStorage.getItem(ve)??"220",10))),Q=!1,he=0,De=0;const Fe="she-db-chat-width",ge="she-db-chat-open";let Ne=B(localStorage.getItem(ge)==="true"),Oe=B(_i(parseInt(localStorage.getItem(Fe)??"320",10))),pe=!1,lt=0,Ot=0;const Xe="she-db-map-height",ht="she-db-reduce-height";let me=B(_i(parseInt(localStorage.getItem(Xe)??"240",10))),Be=B(_i(parseInt(localStorage.getItem(ht)??"160",10))),st=!1,vt=0,rt=0,wt=!1,ui=0,ci=0;const hi=At(()=>l(u)?{id:l(u),filter:l(f),map:l(g),reduce:l(p)}:null);function Ct(ce){ce.filter!==void 0&&x(f,ce.filter,!0),ce.map!==void 0&&x(g,ce.map,!0),ce.reduce!==void 0&&x(p,ce.reduce,!0)}us(()=>{localStorage.setItem(ge,String(l(Ne)))}),us(()=>{localStorage.setItem(R,l(P))}),us(()=>{l(u)?localStorage.setItem(a,l(u)):localStorage.removeItem(a)});function ai(ce){Q=!0,he=ce.clientX,De=l(Se),ce.preventDefault()}function Re(ce){Q&&x(Se,Math.max(140,Math.min(500,De+ce.clientX-he)),!0),pe&&x(Oe,Math.max(240,Math.min(600,Ot-(ce.clientX-lt))),!0),st&&x(me,Math.max(60,Math.min(600,rt+ce.clientY-vt)),!0),wt&&x(Be,Math.max(40,Math.min(400,ci+ce.clientY-ui)),!0)}function Ee(){Q&&(Q=!1,localStorage.setItem(ve,String(l(Se)))),pe&&(pe=!1,localStorage.setItem(Fe,String(l(Oe)))),st&&(st=!1,localStorage.setItem(Xe,String(l(me)))),wt&&(wt=!1,localStorage.setItem(ht,String(l(Be))))}function zt(ce){pe=!0,lt=ce.clientX,Ot=l(Oe),ce.preventDefault()}async function ii(){try{x(t,await bF(),!0)}catch{}}async function Vt(){try{x(d,await CF(),!0)}catch{}}async function Ai(ce){x(i,ce,!0),x(r,null),x(s,!0);try{const fe=await nU(ce);x(n,JSON.stringify(fe,null,2),!0)}catch(fe){x(r,fe instanceof Error?fe.message:String(fe),!0)}finally{x(s,!1)}}async function Fi(){if(l(i)){x(r,null);try{const ce=JSON.parse(l(n));await c2(l(i),ce)}catch(ce){x(r,ce instanceof Error?ce.message:String(ce),!0)}}}let mi;async function ln(){if(l(i)&&await mi.show(`Delete document "${l(i)}"?`,{confirm:"Delete",danger:!0}))try{await sU(l(i)),x(i,null),x(n,"{}")}catch(ce){x(r,ce instanceof Error?ce.message:String(ce),!0)}}async function sn(){const ce=l(V).trim();if(ce){x(J,null);try{await c2(ce,{}),x(U,!1),x(V,""),await Ai(ce)}catch(fe){x(J,fe instanceof Error?fe.message:String(fe),!0)}}}async function dn(ce){x(u,ce,!0),x(I,null),x(A,!0),x(y,null);try{const fe=await oU(ce);x(f,fe.filter??"",!0),x(g,fe.map,!0),x(p,fe.reduce??"",!0),x(C,fe.description??"",!0),x(b,fe.mqttpub??!1,!0),x(E,fe.retain??!1,!0),x(y,await zC(ce).catch(()=>null),!0)}catch(fe){x(I,fe instanceof Error?fe.message:String(fe),!0)}finally{x(A,!1)}}async function bn(){if(l(u)){x(I,null);try{const ce={map:l(g)};l(f).trim()&&(ce.filter=l(f).trim()),l(p).trim()&&(ce.reduce=l(p).trim()),l(C).trim()&&(ce.description=l(C).trim()),l(b)&&(ce.mqttpub=!0),l(E)&&(ce.retain=!0),await d2(l(u),ce)}catch(ce){x(I,ce instanceof Error?ce.message:String(ce),!0)}}}async function ft(){if(l(u))try{x(y,await zC(l(u)),!0)}catch(ce){x(I,ce instanceof Error?ce.message:String(ce),!0)}}async function qt(){if(l(u)&&await mi.show(`Delete view "${l(u)}"?`,{confirm:"Delete",danger:!0}))try{await rU(l(u)),x(u,null),x(f,""),x(g,"// emit(this.someProperty)"),x(p,""),x(C,""),x(b,!1),x(E,!1),x(y,null)}catch(ce){x(I,ce instanceof Error?ce.message:String(ce),!0)}}async function Ti(){if(!l(re).trim())return;const ce=l(re).trim();x(ie,null);try{await d2(ce,{map:"// emit(this.someProperty)"}),x(ae,!1),x(re,""),await Vt(),await dn(ce)}catch(fe){x(ie,fe instanceof Error?fe.message:String(fe),!0)}}let ki=B(""),bi=B("");function yn(ce){return ce.includes("#")||ce.includes("+")}let mn=At(()=>[...l(t)].filter(ce=>l(ki)?yn(l(ki))?O2(ce,l(ki))!==null:ce.toLowerCase().includes(l(ki).toLowerCase()):!0).sort()),_n=At(()=>[...l(d)].filter(ce=>l(bi)?yn(l(bi))?O2(ce,l(bi))!==null:ce.toLowerCase().includes(l(bi).toLowerCase()):!0).sort()),qe=B(!1),Xt=null;function yi(){try{navigator.clipboard.writeText(`${l(M)}${l(u)}`)}catch{}x(qe,!0),Xt&&clearTimeout(Xt),Xt=setTimeout(()=>x(qe,!1),1500)}oo(()=>{ii(),Vt().then(()=>{l(u)&&l(d).includes(l(u))?dn(l(u)):x(u,null)}),Zl().then(gi=>{const fi=gi.dbPrefix||"she/db/",Ii=fi.endsWith("/")?fi:fi+"/";x(M,Ii+"view/")}).catch(()=>{});const ce=mr("db:ids",gi=>{x(t,gi.ids??[],!0)}),fe=mr("db:viewIds",gi=>{x(d,gi.ids??[],!0)}),Gt=mr("db:change",async gi=>{const fi=gi.id;l(i)===fi&&(gi.doc===null?(x(i,null),x(n,"{}")):x(n,JSON.stringify(gi.doc,null,2),!0))}),ni=mr("db:viewUpdate",async gi=>{const fi=gi.id;l(u)===fi&&x(y,await zC(fi).catch(()=>null),!0)});return()=>{ce(),fe(),Gt(),ni()}});var Ut=AY(),Li=dt(Ut);ks(gl(Li,{}),ce=>mi=ce,()=>mi);var qi=v(Li,2);let Gi;var K=m(qi),Ae=m(K);let ot;var Ge=v(Ae,2);let Pt;var Yt=v(Ge,2);{var gt=ce=>{var fe=cY();let Gt;z(()=>{Gt=Dt(fe,1,"ai-toggle svelte-rrt0o",null,Gt,{"ai-open":l(Ne)}),gn(fe,"title",l(Ne)?"Close AI assistant":"Open AI assistant")}),j("click",fe,()=>x(Ne,!l(Ne))),D(ce,fe)};O(Yt,ce=>{l(P)==="views"&&ce(gt)})}var et=v(K,2);{var X=ce=>{var fe=fY(),Gt=m(fe);let ni;var gi=m(Gt),fi=m(gi),Ii=v(gi,2);{var pi=ue=>{var Ce=dY(),_e=dt(Ce),Je=m(_e),Ve=v(Je,2),St=v(_e,2);{var q=T=>{var H=$2(),Y=m(H);z(()=>N(Y,l(J))),D(T,H)};O(St,T=>{l(J)&&T(q)})}j("keydown",Je,T=>T.key==="Enter"&&sn()),yt(Je,()=>l(V),T=>x(V,T)),j("click",Ve,sn),D(ue,Ce)};O(Ii,ue=>{l(U)&&ue(pi)})}var Ci=v(Ii,2),He=m(Ci),Ye=v(Ci,2);ti(Ye,20,()=>l(mn),ue=>ue,(ue,Ce)=>{var _e=U2();let Je;var Ve=m(_e);z(()=>{Je=Dt(_e,1,"flat-item svelte-rrt0o",null,Je,{"active-item":l(i)===Ce}),N(Ve,Ce)}),j("click",_e,()=>Ai(Ce)),D(ue,_e)});var jt=v(Gt,2),Qt=v(jt,2),Mi=m(Qt);{var oi=ue=>{var Ce=hY(),_e=dt(Ce),Je=m(_e),Ve=m(Je),St=v(Je,2),q=v(St,2),T=v(_e,2);{var H=oe=>{var ye=q2(),We=m(ye);z(()=>N(We,l(r))),D(oe,ye)};O(T,oe=>{l(r)&&oe(H)})}var Y=v(T,2);{var ne=oe=>{var ye=G2();D(oe,ye)},le=oe=>{var ye=uY(),We=m(ye);Tg(We,{language:"json",get value(){return l(n)},set value(be){x(n,be,!0)}}),D(oe,ye)};O(Y,oe=>{l(s)?oe(ne):oe(le,-1)})}z(()=>N(Ve,l(i))),j("click",St,Fi),j("click",q,ln),D(ue,Ce)},$=ue=>{j2(ue)};O(Mi,ue=>{l(i)?ue(oi):ue($,-1)})}z(()=>ni=Vo(Gt,"",ni,{width:`${l(Se)??""}px`})),j("click",fi,()=>{x(U,!l(U)),x(J,null)}),yt(He,()=>l(ki),ue=>x(ki,ue)),j("mousedown",jt,ai),D(ce,fe)},Pe=ce=>{var fe=DY(),Gt=m(fe);let ni;var gi=m(Gt),fi=m(gi),Ii=v(gi,2);{var pi=_e=>{var Je=gY(),Ve=dt(Je),St=m(Ve),q=v(St,2),T=v(Ve,2);{var H=Y=>{var ne=$2(),le=m(ne);z(()=>N(le,l(ie))),D(Y,ne)};O(T,Y=>{l(ie)&&Y(H)})}j("keydown",St,Y=>Y.key==="Enter"&&Ti()),yt(St,()=>l(re),Y=>x(re,Y)),j("click",q,Ti),D(_e,Je)};O(Ii,_e=>{l(ae)&&_e(pi)})}var Ci=v(Ii,2),He=m(Ci),Ye=v(Ci,2);ti(Ye,20,()=>l(_n),_e=>_e,(_e,Je)=>{var Ve=U2();let St;var q=m(Ve);z(()=>{St=Dt(Ve,1,"flat-item svelte-rrt0o",null,St,{"active-item":l(u)===Je}),N(q,Je)}),j("click",Ve,()=>dn(Je)),D(_e,Ve)});var jt=v(Gt,2),Qt=v(jt,2),Mi=m(Qt);{var oi=_e=>{var Je=wY(),Ve=dt(Je),St=m(Ve),q=m(St),T=v(St,2),H=v(T,2),Y=v(H,2),ne=v(Ve,2);{var le=be=>{var Le=q2(),Me=m(Le);z(()=>N(Me,l(I))),D(be,Le)};O(ne,be=>{l(I)&&be(le)})}var oe=v(ne,2);{var ye=be=>{var Le=G2();D(be,Le)},We=be=>{var Le=yY(),Me=m(Le),nt=m(Me),Jt=v(m(nt),2),ee=m(Jt),de=v(nt,2),$e=v(m(de),2),Ft=m($e),je=v(de,2),ze=v(m(je),2);let kt;var ct=m(ze);Tg(ct,{language:"javascript",onSave:bn,get value(){return l(g)},set value($t){x(g,$t,!0)}});var Qe=v(ze,2),mt=v(je,2),_t=v(m(mt),2);let tt;var Bt=m(_t);Tg(Bt,{language:"javascript",onSave:bn,get value(){return l(p)},set value($t){x(p,$t,!0)}});var ei=v(_t,2),Mt=v(mt,2),Kt=m(Mt),Ze=m(Kt),Et=v(Kt,2);{var Zt=$t=>{var wi=vY(),Xi=dt(wi),$i=m(Xi),Hi=m($i),we=v($i,2),it=m(we);{var ut=ri=>{var Ri=pY();D(ri,Ri)},Lt=ri=>{var Ri=xY();D(ri,Ri)};O(it,ri=>{l(qe)?ri(ut):ri(Lt,-1)})}var Rt=v(Xi,2),si=m(Rt);z(()=>{N(Hi,`${l(M)??""}${l(u)??""}`),gn(we,"title",l(qe)?"Copied!":"Copy topic")}),j("click",we,yi),Ms(si,()=>l(E),ri=>x(E,ri)),D($t,wi)};O(Et,$t=>{l(b)&&$t(Zt)})}var ji=v(Me,2);{var Wt=$t=>{var wi=EY(),Xi=m(wi),$i=v(m(Xi));{var Hi=Rt=>{var si=mY();D(Rt,si)},we=Rt=>{var si=_Y(),ri=m(si);z(()=>N(ri,`${l(y).length??0??""} items · rev ${l(y)._rev??""}`)),D(Rt,si)};O($i,Rt=>{l(y).error?Rt(Hi):Rt(we,-1)})}var it=v(Xi,2);{var ut=Rt=>{var si=bY(),ri=m(si);z(()=>N(ri,l(y).error)),D(Rt,si)},Lt=Rt=>{var si=CY(),ri=m(si);z(Ri=>N(ri,Ri),[()=>JSON.stringify(l(y).result,null,2)]),D(Rt,si)};O(it,Rt=>{l(y).error?Rt(ut):Rt(Lt,-1)})}D($t,wi)};O(ji,$t=>{l(y)&&$t(Wt)})}z(()=>{kt=Vo(ze,"",kt,{height:`${l(me)??""}px`}),tt=Vo(_t,"",tt,{height:`${l(Be)??""}px`})}),yt(ee,()=>l(C),$t=>x(C,$t)),yt(Ft,()=>l(f),$t=>x(f,$t)),j("mousedown",Qe,$t=>{st=!0,vt=$t.clientY,rt=l(me),$t.preventDefault()}),j("mousedown",ei,$t=>{wt=!0,ui=$t.clientY,ci=l(Be),$t.preventDefault()}),Ms(Ze,()=>l(b),$t=>x(b,$t)),D(be,Le)};O(oe,be=>{l(A)?be(ye):be(We,-1)})}z(()=>N(q,l(u))),j("click",T,bn),j("click",H,ft),j("click",Y,qt),D(_e,Je)},$=_e=>{j2(_e)};O(Mi,_e=>{l(u)?_e(oi):_e($,-1)})}var ue=v(Qt,2);{var Ce=_e=>{var Je=SY(),Ve=dt(Je),St=v(Ve,2);let q;var T=m(St);rY(T,{get currentView(){return l(hi)},onApplyView:Ct}),z(()=>q=Vo(St,"",q,{width:`${l(Oe)??""}px`})),j("mousedown",Ve,zt),D(_e,Je)};O(ue,_e=>{l(Ne)&&_e(Ce)})}z(()=>ni=Vo(Gt,"",ni,{width:`${l(Se)??""}px`})),j("click",fi,()=>{x(ae,!l(ae)),x(ie,null)}),yt(He,()=>l(bi),_e=>x(bi,_e)),j("mousedown",jt,ai),D(ce,fe)};O(et,ce=>{l(P)==="docs"?ce(X):ce(Pe,-1)})}z(()=>{Gi=Dt(qi,1,"db-root svelte-rrt0o",null,Gi,{"row-dragging":st||wt}),ot=Dt(Ae,1,"svelte-rrt0o",null,ot,{active:l(P)==="docs"}),Pt=Dt(Ge,1,"svelte-rrt0o",null,Pt,{active:l(P)==="views"})}),j("mousemove",qi,Re),j("mouseup",qi,Ee),Ts("mouseleave",qi,Ee),j("click",Ae,()=>x(P,"docs")),j("click",Ge,()=>x(P,"views")),D(o,Ut),Xs()}lo(["mousemove","mouseup","click","keydown","mousedown"]);var Bv={exports:{}},BY=Bv.exports,K2;function FY(){return K2||(K2=1,(function(o,e){(function(i,n){o.exports=n()})(typeof self<"u"?self:BY,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],A=a.extract(p,y),I=r.decode(A.matrix);if(I)return{binaryData:I.bytes,data:I.text,chunks:I.chunks,version:I.version,location:{topRightCorner:A.mappingFunction(y.dimension,0),topLeftCorner:A.mappingFunction(0,0),bottomRightCorner:A.mappingFunction(y.dimension,y.dimension),bottomLeftCorner:A.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(U){y[U]=E[U]||y[U]});var A=y.inversionAttempts==="attemptBoth"||y.inversionAttempts==="invertFirst",I=y.inversionAttempts==="onlyInvert"||y.inversionAttempts==="invertFirst",M=s.binarize(p,C,b,A),R=M.binarized,P=M.inverted,V=u(I?P:R);return!V&&(y.inversionAttempts==="attemptBoth"||y.inversionAttempts==="invertFirst")&&(V=u(I?R:P)),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 A=0;A<C;A++){var I=g[(A*p+y)*4+0],M=g[(A*p+y)*4+1],R=g[(A*p+y)*4+2];E.set(y,A,.2126*I+.7152*M+.0722*R)}for(var P=Math.ceil(p/r),V=Math.ceil(C/r),U=new u(P,V),J=0;J<V;J++)for(var re=0;re<P;re++){for(var ae=0,ie=1/0,ve=0,A=0;A<r;A++)for(var y=0;y<r;y++){var Se=E.get(re*r+y,J*r+A);ae+=Se,ie=Math.min(ie,Se),ve=Math.max(ve,Se)}var Q=ae/Math.pow(r,2);if(ve-ie<=a&&(Q=ie/2,J>0&&re>0)){var he=(U.get(re,J-1)+2*U.get(re-1,J)+U.get(re-1,J-1))/4;ie<he&&(Q=he)}U.set(re,J,Q)}var De=s.BitMatrix.createEmpty(p,C),Fe=null;b&&(Fe=s.BitMatrix.createEmpty(p,C));for(var J=0;J<V;J++)for(var re=0;re<P;re++){for(var ge=d(re,2,P-3),Ne=d(J,2,V-3),ae=0,Oe=-2;Oe<=2;Oe++)for(var pe=-2;pe<=2;pe++)ae+=U.get(ge+Oe,Ne+pe);for(var lt=ae/25,Oe=0;Oe<r;Oe++)for(var pe=0;pe<r;pe++){var y=re*r+Oe,A=J*r+pe,Ot=E.get(y,A);De.set(y,A,Ot<=lt),b&&Fe.set(y,A,!(Ot<=lt))}}return b?{binarized:De,inverted:Fe}:{binarized:De}}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,P){for(var V=R^P,U=0;V;)U++,V&=V-1;return U}function f(R,P){return P<<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 P=17+4*R.versionNumber,V=s.BitMatrix.createEmpty(P,P);V.setRegion(0,0,9,9,!0),V.setRegion(P-8,0,8,9,!0),V.setRegion(0,P-8,9,8,!0);for(var U=0,J=R.alignmentPatternCenters;U<J.length;U++)for(var re=J[U],ae=0,ie=R.alignmentPatternCenters;ae<ie.length;ae++){var ve=ie[ae];re===6&&ve===6||re===6&&ve===P-7||re===P-7&&ve===6||V.setRegion(re-2,ve-2,5,5,!0)}return V.setRegion(6,9,1,P-17,!0),V.setRegion(9,6,P-17,1,!0),R.versionNumber>6&&(V.setRegion(P-11,0,3,6,!0),V.setRegion(0,P-11,6,3,!0)),V}function b(R,P,V){for(var U=p[V.dataMask],J=R.height,re=C(P),ae=[],ie=0,ve=0,Se=!0,Q=J-1;Q>0;Q-=2){Q===6&&Q--;for(var he=0;he<J;he++)for(var De=Se?J-1-he:he,Fe=0;Fe<2;Fe++){var ge=Q-Fe;if(!re.get(ge,De)){ve++;var Ne=R.get(ge,De);U({y:De,x:ge})&&(Ne=!Ne),ie=f(Ne,ie),ve===8&&(ae.push(ie),ve=0,ie=0)}}Se=!Se}return ae}function E(R){var P=R.height,V=Math.floor((P-17)/4);if(V<=6)return d.VERSIONS[V-1];for(var U=0,J=5;J>=0;J--)for(var re=P-9;re>=P-11;re--)U=f(R.get(re,J),U);for(var ae=0,re=5;re>=0;re--)for(var J=P-9;J>=P-11;J--)ae=f(R.get(re,J),ae);for(var ie=1/0,ve,Se=0,Q=d.VERSIONS;Se<Q.length;Se++){var he=Q[Se];if(he.infoBits===U||he.infoBits===ae)return he;var De=u(U,he.infoBits);De<ie&&(ve=he,ie=De),De=u(ae,he.infoBits),De<ie&&(ve=he,ie=De)}if(ie<=3)return ve}function y(R){for(var P=0,V=0;V<=8;V++)V!==6&&(P=f(R.get(V,8),P));for(var U=7;U>=0;U--)U!==6&&(P=f(R.get(8,U),P));for(var J=R.height,re=0,U=J-1;U>=J-7;U--)re=f(R.get(8,U),re);for(var V=J-8;V<J;V++)re=f(R.get(V,8),re);for(var ae=1/0,ie=null,ve=0,Se=g;ve<Se.length;ve++){var Q=Se[ve],he=Q.bits,De=Q.formatInfo;if(he===P||he===re)return De;var Fe=u(P,he);Fe<ae&&(ie=De,ae=Fe),P!==re&&(Fe=u(re,he),Fe<ae&&(ie=De,ae=Fe))}return ae<=3?ie:null}function A(R,P,V){var U=P.errorCorrectionLevels[V],J=[],re=0;if(U.ecBlocks.forEach(function(Ne){for(var Oe=0;Oe<Ne.numBlocks;Oe++)J.push({numDataCodewords:Ne.dataCodewordsPerBlock,codewords:[]}),re+=Ne.dataCodewordsPerBlock+U.ecCodewordsPerBlock}),R.length<re)return null;R=R.slice(0,re);for(var ae=U.ecBlocks[0].dataCodewordsPerBlock,ie=0;ie<ae;ie++)for(var ve=0,Se=J;ve<Se.length;ve++){var Q=Se[ve];Q.codewords.push(R.shift())}if(U.ecBlocks.length>1)for(var he=U.ecBlocks[0].numBlocks,De=U.ecBlocks[1].numBlocks,ie=0;ie<De;ie++)J[he+ie].codewords.push(R.shift());for(;R.length>0;)for(var Fe=0,ge=J;Fe<ge.length;Fe++){var Q=ge[Fe];Q.codewords.push(R.shift())}return J}function I(R){var P=E(R);if(!P)return null;var V=y(R);if(!V)return null;var U=b(R,P,V),J=A(U,P,V.errorCorrectionLevel);if(!J)return null;for(var re=J.reduce(function(Fe,ge){return Fe+ge.numDataCodewords},0),ae=new Uint8ClampedArray(re),ie=0,ve=0,Se=J;ve<Se.length;ve++){var Q=Se[ve],he=a.decode(Q.codewords,Q.codewords.length-Q.numDataCodewords);if(!he)return null;for(var De=0;De<Q.numDataCodewords;De++)ae[ie++]=he[De]}try{return r.decode(ae,P.versionNumber)}catch{return null}}function M(R){if(R==null)return null;var P=I(R);if(P)return P;for(var V=0;V<R.width;V++)for(var U=V+1;U<R.height;U++)R.get(V,U)!==R.get(U,V)&&(R.set(V,U,!R.get(V,U)),R.set(U,V,!R.get(U,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 A=[],I="",M=[10,12,14][y],R=E.readBits(M);R>=3;){var P=E.readBits(10);if(P>=1e3)throw new Error("Invalid numeric value above 999");var V=Math.floor(P/100),U=Math.floor(P/10)%10,J=P%10;A.push(48+V,48+U,48+J),I+=V.toString()+U.toString()+J.toString(),R-=3}if(R===2){var P=E.readBits(7);if(P>=100)throw new Error("Invalid numeric value above 99");var V=Math.floor(P/10),U=P%10;A.push(48+V,48+U),I+=V.toString()+U.toString()}else if(R===1){var P=E.readBits(4);if(P>=10)throw new Error("Invalid numeric value above 9");A.push(48+P),I+=P.toString()}return{bytes:A,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 A=[],I="",M=[9,11,13][y],R=E.readBits(M);R>=2;){var P=E.readBits(11),V=Math.floor(P/45),U=P%45;A.push(f[V].charCodeAt(0),f[U].charCodeAt(0)),I+=f[V]+f[U],R-=2}if(R===1){var V=E.readBits(6);A.push(f[V].charCodeAt(0)),I+=f[V]}return{bytes:A,text:I}}function p(E,y){for(var A=[],I="",M=[8,16,16][y],R=E.readBits(M),P=0;P<R;P++){var V=E.readBits(8);A.push(V)}try{I+=decodeURIComponent(A.map(function(U){return"%"+("0"+U.toString(16)).substr(-2)}).join(""))}catch{}return{bytes:A,text:I}}function C(E,y){for(var A=[],I="",M=[8,10,12][y],R=E.readBits(M),P=0;P<R;P++){var V=E.readBits(13),U=Math.floor(V/192)<<8|V%192;U<7936?U+=33088:U+=49472,A.push(U>>8,U&255),I+=String.fromCharCode(r.shiftJISTable[U])}return{bytes:A,text:I}}function b(E,y){for(var A,I,M,R,P=new s.BitStream(E),V=y<=9?0:y<=26?1:2,U={text:"",bytes:[],chunks:[],version:y};P.available()>=4;){var J=P.readBits(4);if(J===d.Terminator)return U;if(J===d.ECI)P.readBits(1)===0?U.chunks.push({type:a.ECI,assignmentNumber:P.readBits(7)}):P.readBits(1)===0?U.chunks.push({type:a.ECI,assignmentNumber:P.readBits(14)}):P.readBits(1)===0?U.chunks.push({type:a.ECI,assignmentNumber:P.readBits(21)}):U.chunks.push({type:a.ECI,assignmentNumber:-1});else if(J===d.Numeric){var re=u(P,V);U.text+=re.text,(A=U.bytes).push.apply(A,re.bytes),U.chunks.push({type:a.Numeric,text:re.text})}else if(J===d.Alphanumeric){var ae=g(P,V);U.text+=ae.text,(I=U.bytes).push.apply(I,ae.bytes),U.chunks.push({type:a.Alphanumeric,text:ae.text})}else if(J===d.Byte){var ie=p(P,V);U.text+=ie.text,(M=U.bytes).push.apply(M,ie.bytes),U.chunks.push({type:a.Byte,bytes:ie.bytes,text:ie.text})}else if(J===d.Kanji){var ve=C(P,V);U.text+=ve.text,(R=U.bytes).push.apply(R,ve.bytes),U.chunks.push({type:a.Kanji,bytes:ve.bytes,text:ve.text})}}if(P.available()===0||P.readBits(P.available())===0)return U}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,A=C,I=g.zero,M=g.one;A.degree()>=b/2;){var R=y,P=I;if(y=A,I=M,y.isZero())return null;A=R;for(var V=g.zero,U=y.getCoefficient(y.degree()),J=g.inverse(U);A.degree()>=y.degree()&&!A.isZero();){var re=A.degree()-y.degree(),ae=g.multiply(A.getCoefficient(A.degree()),J);V=V.addOrSubtract(g.buildMonomial(re,ae)),A=A.addOrSubtract(y.multiplyByMonomial(re,ae))}if(M=V.multiplyPoly(I).addOrSubtract(P),A.degree()>=y.degree())return null}var ie=M.getCoefficient(0);if(ie===0)return null;var ve=g.inverse(ie);return[M.multiply(ve),A.multiply(ve)]}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 A=g.inverse(C[y]),I=1,M=0;M<b;M++)y!==M&&(I=g.multiply(I,s.addOrSubtractGF(1,g.multiply(C[M],A))));E[y]=g.multiply(p.evaluateAt(A),g.inverse(I)),g.generatorBase!==0&&(E[y]=g.multiply(E[y],A))}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),A=!1,I=0;I<p;I++){var M=E.evaluateAt(b.exp(I+b.generatorBase));y[y.length-1-I]=M,M!==0&&(A=!0)}if(!A)return C;var R=new r.default(b,y),P=a(b,b.buildMonomial(p,1),R,p);if(P===null)return null;var V=d(b,P[0]);if(V==null)return null;for(var U=u(b,P[1],V),J=0;J<V.length;J++){var re=C.length-1-b.log(V[J]);if(re<0)return null;C[re]=s.addOrSubtractGF(C[re],U[J])}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,A=C.x-p.x,I=g.y-p.y,M=C.y-p.y,R=y*M-A*I,P=(b*M-A*E)/R,V=(y*E-b*I)/R;return{a11:g.x-f.x+P*g.x,a12:g.y-f.y+P*g.y,a13:P,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,U){var J=b.a13*V+b.a23*U+b.a33;return{x:(b.a11*V+b.a21*U+b.a31)/J,y:(b.a12*V+b.a22*U+b.a32)/J}},A=0;A<g.dimension;A++)for(var I=0;I<g.dimension;I++){var M=I+.5,R=A+.5,P=y(M,R);E.set(I,A,f.get(Math.floor(P.x),Math.floor(P.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,P){return R+P})}function f(M,R,P){var V,U,J,re,ae=d(M,R),ie=d(R,P),ve=d(M,P),Se,Q,he;return ie>=ae&&ie>=ve?(V=[R,M,P],Se=V[0],Q=V[1],he=V[2]):ve>=ie&&ve>=ae?(U=[M,R,P],Se=U[0],Q=U[1],he=U[2]):(J=[M,P,R],Se=J[0],Q=J[1],he=J[2]),(he.x-Q.x)*(Se.y-Q.y)-(he.y-Q.y)*(Se.x-Q.x)<0&&(re=[he,Se],Se=re[0],he=re[1]),{bottomLeft:Se,topLeft:Q,topRight:he}}function g(M,R,P,V){var U=(u(C(M,P,V,5))/7+u(C(M,R,V,5))/7+u(C(P,M,V,5))/7+u(C(R,M,V,5))/7)/4;if(U<1)throw new Error("Invalid module size");var J=Math.round(d(M,R)/U),re=Math.round(d(M,P)/U),ae=Math.floor((J+re)/2)+7;switch(ae%4){case 0:ae++;break;case 2:ae--;break}return{dimension:ae,moduleSize:U}}function p(M,R,P,V){var U=[{x:Math.floor(M.x),y:Math.floor(M.y)}],J=Math.abs(R.y-M.y)>Math.abs(R.x-M.x),re,ae,ie,ve;J?(re=Math.floor(M.y),ae=Math.floor(M.x),ie=Math.floor(R.y),ve=Math.floor(R.x)):(re=Math.floor(M.x),ae=Math.floor(M.y),ie=Math.floor(R.x),ve=Math.floor(R.y));for(var Se=Math.abs(ie-re),Q=Math.abs(ve-ae),he=Math.floor(-Se/2),De=re<ie?1:-1,Fe=ae<ve?1:-1,ge=!0,Ne=re,Oe=ae;Ne!==ie+De;Ne+=De){var pe=J?Oe:Ne,lt=J?Ne:Oe;if(P.get(pe,lt)!==ge&&(ge=!ge,U.push({x:pe,y:lt}),U.length===V+1))break;if(he+=Q,he>0){if(Oe===ve)break;Oe+=Fe,he-=Se}}for(var Ot=[],Xe=0;Xe<V;Xe++)U[Xe]&&U[Xe+1]?Ot.push(d(U[Xe],U[Xe+1])):Ot.push(0);return Ot}function C(M,R,P,V){var U,J=R.y-M.y,re=R.x-M.x,ae=p(M,R,P,Math.ceil(V/2)),ie=p(M,{x:M.x-re,y:M.y-J},P,Math.ceil(V/2)),ve=ae.shift()+ie.shift()-1;return(U=ie.concat(ve)).concat.apply(U,ae)}function b(M,R){var P=u(M)/u(R),V=0;return R.forEach(function(U,J){V+=Math.pow(M[J]-U*P,2)}),{averageSize:P,error:V}}function E(M,R,P){try{var V=C(M,{x:-1,y:M.y},P,R.length),U=C(M,{x:M.x,y:-1},P,R.length),J={x:Math.max(0,M.x-M.y)-1,y:Math.max(0,M.y-M.x)-1},re=C(M,J,P,R.length),ae={x:Math.min(P.width,M.x+M.y)+1,y:Math.min(P.height,M.y+M.x)+1},ie=C(M,ae,P,R.length),ve=b(V,R),Se=b(U,R),Q=b(re,R),he=b(ie,R),De=Math.sqrt(ve.error*ve.error+Se.error*Se.error+Q.error*Q.error+he.error*he.error),Fe=(ve.averageSize+Se.averageSize+Q.averageSize+he.averageSize)/4,ge=(Math.pow(ve.averageSize-Fe,2)+Math.pow(Se.averageSize-Fe,2)+Math.pow(Q.averageSize-Fe,2)+Math.pow(he.averageSize-Fe,2))/Fe;return De+ge}catch{return 1/0}}function y(M,R){for(var P=Math.round(R.x);M.get(P,Math.round(R.y));)P--;for(var V=Math.round(R.x);M.get(V,Math.round(R.y));)V++;for(var U=(P+V)/2,J=Math.round(R.y);M.get(Math.round(U),J);)J--;for(var re=Math.round(R.y);M.get(Math.round(U),re);)re++;var ae=(J+re)/2;return{x:U,y:ae}}function A(M){for(var R=[],P=[],V=[],U=[],J=function(pe){for(var lt=0,Ot=!1,Xe=[0,0,0,0,0],ht=function(Be){var st=M.get(Be,pe);if(st===Ot)lt++;else{Xe=[Xe[1],Xe[2],Xe[3],Xe[4],lt],lt=1,Ot=st;var vt=u(Xe)/7,rt=Math.abs(Xe[0]-vt)<vt&&Math.abs(Xe[1]-vt)<vt&&Math.abs(Xe[2]-3*vt)<3*vt&&Math.abs(Xe[3]-vt)<vt&&Math.abs(Xe[4]-vt)<vt&&!st,wt=u(Xe.slice(-3))/3,ui=Math.abs(Xe[2]-wt)<wt&&Math.abs(Xe[3]-wt)<wt&&Math.abs(Xe[4]-wt)<wt&&st;if(rt){var ci=Be-Xe[3]-Xe[4],hi=ci-Xe[2],Ct={startX:hi,endX:ci,y:pe},ai=P.filter(function(zt){return hi>=zt.bottom.startX&&hi<=zt.bottom.endX||ci>=zt.bottom.startX&&hi<=zt.bottom.endX||hi<=zt.bottom.startX&&ci>=zt.bottom.endX&&Xe[2]/(zt.bottom.endX-zt.bottom.startX)<a&&Xe[2]/(zt.bottom.endX-zt.bottom.startX)>r});ai.length>0?ai[0].bottom=Ct:P.push({top:Ct,bottom:Ct})}if(ui){var Re=Be-Xe[4],Ee=Re-Xe[3],Ct={startX:Ee,y:pe,endX:Re},ai=U.filter(function(Vt){return Ee>=Vt.bottom.startX&&Ee<=Vt.bottom.endX||Re>=Vt.bottom.startX&&Ee<=Vt.bottom.endX||Ee<=Vt.bottom.startX&&Re>=Vt.bottom.endX&&Xe[2]/(Vt.bottom.endX-Vt.bottom.startX)<a&&Xe[2]/(Vt.bottom.endX-Vt.bottom.startX)>r});ai.length>0?ai[0].bottom=Ct:U.push({top:Ct,bottom:Ct})}}},me=-1;me<=M.width;me++)ht(me);R.push.apply(R,P.filter(function(Be){return Be.bottom.y!==pe&&Be.bottom.y-Be.top.y>=2})),P=P.filter(function(Be){return Be.bottom.y===pe}),V.push.apply(V,U.filter(function(Be){return Be.bottom.y!==pe})),U=U.filter(function(Be){return Be.bottom.y===pe})},re=0;re<=M.height;re++)J(re);R.push.apply(R,P.filter(function(pe){return pe.bottom.y-pe.top.y>=2})),V.push.apply(V,U);var ae=R.filter(function(pe){return pe.bottom.y-pe.top.y>=2}).map(function(pe){var lt=(pe.top.startX+pe.top.endX+pe.bottom.startX+pe.bottom.endX)/4,Ot=(pe.top.y+pe.bottom.y+1)/2;if(M.get(Math.round(lt),Math.round(Ot))){var Xe=[pe.top.endX-pe.top.startX,pe.bottom.endX-pe.bottom.startX,pe.bottom.y-pe.top.y+1],ht=u(Xe)/Xe.length,me=E({x:Math.round(lt),y:Math.round(Ot)},[1,1,3,1,1],M);return{score:me,x:lt,y:Ot,size:ht}}}).filter(function(pe){return!!pe}).sort(function(pe,lt){return pe.score-lt.score}).map(function(pe,lt,Ot){if(lt>s)return null;var Xe=Ot.filter(function(me,Be){return lt!==Be}).map(function(me){return{x:me.x,y:me.y,score:me.score+Math.pow(me.size-pe.size,2)/pe.size,size:me.size}}).sort(function(me,Be){return me.score-Be.score});if(Xe.length<2)return null;var ht=pe.score+Xe[0].score+Xe[1].score;return{points:[pe].concat(Xe.slice(0,2)),score:ht}}).filter(function(pe){return!!pe}).sort(function(pe,lt){return pe.score-lt.score});if(ae.length===0)return null;var ie=f(ae[0].points[0],ae[0].points[1],ae[0].points[2]),ve=ie.topRight,Se=ie.topLeft,Q=ie.bottomLeft,he=I(M,V,ve,Se,Q),De=[];he&&De.push({alignmentPattern:{x:he.alignmentPattern.x,y:he.alignmentPattern.y},bottomLeft:{x:Q.x,y:Q.y},dimension:he.dimension,topLeft:{x:Se.x,y:Se.y},topRight:{x:ve.x,y:ve.y}});var Fe=y(M,ve),ge=y(M,Se),Ne=y(M,Q),Oe=I(M,V,Fe,ge,Ne);return Oe&&De.push({alignmentPattern:{x:Oe.alignmentPattern.x,y:Oe.alignmentPattern.y},bottomLeft:{x:Ne.x,y:Ne.y},topLeft:{x:ge.x,y:ge.y},topRight:{x:Fe.x,y:Fe.y},dimension:Oe.dimension}),De.length===0?null:De}i.locate=A;function I(M,R,P,V,U){var J,re,ae;try{J=g(V,P,U,M),re=J.dimension,ae=J.moduleSize}catch{return null}var ie={x:P.x-V.x+U.x,y:P.y-V.y+U.y},ve=(d(V,U)+d(V,P))/2/ae,Se=1-3/ve,Q={x:V.x+Se*(ie.x-V.x),y:V.y+Se*(ie.y-V.y)},he=R.map(function(Fe){var ge=(Fe.top.startX+Fe.top.endX+Fe.bottom.startX+Fe.bottom.endX)/4,Ne=(Fe.top.y+Fe.bottom.y+1)/2;if(M.get(Math.floor(ge),Math.floor(Ne))){var Oe=[Fe.top.endX-Fe.top.startX,Fe.bottom.endX-Fe.bottom.startX,Fe.bottom.y-Fe.top.y+1];u(Oe)/Oe.length;var pe=E({x:Math.floor(ge),y:Math.floor(Ne)},[1,1,1],M),lt=pe+d({x:ge,y:Ne},Q);return{x:ge,y:Ne,score:lt}}}).filter(function(Fe){return!!Fe}).sort(function(Fe,ge){return Fe.score-ge.score}),De=ve>=15&&he.length?he[0]:Q;return{alignmentPattern:De,dimension:re}}})]).default})})(Bv)),Bv.exports}var LY=FY();const IY=dS(LY);var PY=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),TY=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),Z2=F('<p class="err svelte-1ua3isv"> </p>'),MY=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>'),RY=F('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),NY=F('<span class="device-name svelte-1ua3isv"> </span>'),OY=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>'),HY=F('<li class="empty svelte-1ua3isv">No paired devices</li>'),WY=F('<p class="info svelte-1ua3isv">Loading…</p>'),zY=F('<p class="device-subtitle svelte-1ua3isv"> </p>'),VY=F('<span class="ep-chip svelte-1ua3isv"> </span>'),jY=F('<span class="attr-id svelte-1ua3isv"> </span>'),$Y=F('<button class="attr-action-btn svelte-1ua3isv"> </button>'),UY=F('<div class="attr-actions svelte-1ua3isv"></div>'),qY=F('<span class="cmd-sep svelte-1ua3isv">,</span>'),GY=F('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),KY=F('<span class="cmd-id svelte-1ua3isv"> </span>'),ZY=F("<!> <!>",1),XY=F('<span class="cmd-list svelte-1ua3isv"></span>'),YY=F(' <span class="cmd-id svelte-1ua3isv"> </span>',1),QY=F('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),JY=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>'),eQ=F('<th class="svelte-1ua3isv"> </th>'),tQ=F('<td class="svelte-1ua3isv"> </td>'),iQ=F('<tr class="svelte-1ua3isv"></tr>'),nQ=F('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),sQ=F('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),oQ=F('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),rQ=F('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),aQ=F('<span class="attr-val svelte-1ua3isv"> </span>'),lQ=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>'),cQ=F('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),dQ=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>'),uQ=F('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),hQ=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>'),fQ=F('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),gQ=F('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),pQ=F('<span class="stream-badge svelte-1ua3isv"> </span>'),xQ=F('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),UC=F('&nbsp;<span class="e-sub svelte-1ua3isv"> </span>',1),vQ=F('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),mQ=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),_Q=F('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),bQ=F('<div class="stream-body svelte-1ua3isv"><!></div>'),CQ=F('<p class="scan-err svelte-1ua3isv"> </p>'),EQ=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),yQ=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),wQ=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 SQ(o,e){Zs(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(X,Pe,ce,fe,Gt){try{await mU(X,Pe,ce,fe,Gt)}catch(ni){console.error("matter command failed",ni)}}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(X,Pe){const ce=n[X];return Pe.map(fe=>{const Gt=typeof fe=="number"?fe:Number(fe);return{id:Gt,name:(ce==null?void 0:ce[Gt])??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(X){return"0x"+X.toString(16).toUpperCase().padStart(4,"0")}let f=B(_i([])),g=_i(new Map);function p(X){if(X==null)return"—";if(typeof X=="boolean"||typeof X=="number")return String(X);if(typeof X=="string")return X.length>50?X.slice(0,47)+"…":X;const Pe=JSON.stringify(X);return Pe.length>60?Pe.slice(0,57)+"…":Pe}function C(X){return X==null?"—":typeof X=="boolean"||typeof X=="number"?String(X):typeof X=="string"?X:JSON.stringify(X)}function b(X){return X!==null&&typeof X=="object"&&!Array.isArray(X)}function E(X){return Array.isArray(X)&&X.length>0&&X.every(b)}function y(X,Pe){return!!(Pe==="attributeList"||Array.isArray(X)&&X.length===0||b(X)&&Object.keys(X).length===0)}function A(X){return new Date(X).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const I=500,M=20,R=32;let P=0,V=B(_i([])),U=B(!0),J=B(180),re=At(()=>{const X=Math.max(1,Math.floor((l(J)-R)/M)+1);return l(V).slice(0,X)});function ae(X){X.preventDefault();const Pe=X.clientY,ce=l(J);function fe(ni){x(J,Math.max(60,Math.min(600,ce+Pe-ni.clientY)),!0)}function Gt(){document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Gt)}document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Gt)}let ie=B(null),ve=B(!1),Se=B(null),Q=B(!1),he=B("passcode"),De=B(""),Fe=B(""),ge=B(""),Ne=B(!1),Oe=B(null),pe=B(""),lt=B(!1),Ot=B(""),Xe=B(void 0),ht=B(void 0),me=null,Be=null;function st(){Be!==null&&(cancelAnimationFrame(Be),Be=null),me&&(me.getTracks().forEach(X=>X.stop()),me=null),x(lt,!1),x(Ot,"")}function vt(X){st(),x(he,"pairingCode"),x(ge,X,!0)}function rt(){if(!l(ht))return null;const X=l(ht).getContext("2d",{willReadFrequently:!0}),{width:Pe,height:ce}=l(ht);if(!Pe||!ce)return null;const fe=X.getImageData(0,0,Pe,ce);return IY(fe.data,fe.width,fe.height,{inversionAttempts:"dontInvert"})}async function wt(){if(x(lt,!0),x(Ot,""),await kl(),!l(Xe)||!l(ht))return;try{me=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}),l(Xe).srcObject=me,await l(Xe).play()}catch(Pe){x(Ot,"Camera unavailable: "+(Pe instanceof Error?Pe.message:String(Pe)));return}const X=()=>{var Pe;if(!(!l(Xe)||!l(ht)||!me)){if(l(Xe).readyState===l(Xe).HAVE_ENOUGH_DATA){l(ht).width=l(Xe).videoWidth,l(ht).height=l(Xe).videoHeight,l(ht).getContext("2d",{willReadFrequently:!0}).drawImage(l(Xe),0,0);const fe=rt();if((Pe=fe==null?void 0:fe.data)!=null&&Pe.startsWith("MT:")){vt(fe.data);return}}Be=requestAnimationFrame(X)}};Be=requestAnimationFrame(X)}function ui(X){var fe;const Pe=(fe=X.target.files)==null?void 0:fe[0];if(!Pe)return;const ce=new FileReader;ce.onload=Gt=>{const ni=new Image;ni.onload=()=>{var Ii;if(!l(ht))return;l(ht).width=ni.width,l(ht).height=ni.height,l(ht).getContext("2d",{willReadFrequently:!0}).drawImage(ni,0,0);const fi=rt();(Ii=fi==null?void 0:fi.data)!=null&&Ii.startsWith("MT:")?vt(fi.data):x(Ot,"No Matter QR code found in image.")},ni.src=Gt.target.result},ce.readAsDataURL(Pe)}const ci="she:matter:selectedNodeId";async function hi(){try{x(f,await oS(),!0);for(const X of l(f))Sv(X.nodeId).then(Pe=>{g.set(X.nodeId,Pe)}).catch(()=>{});if(l(f).length>0&&!l(ie)){const X=localStorage.getItem(ci),Pe=X&&l(f).find(ce=>ce.nodeId===X)?X:l(f)[0].nodeId;Ct(Pe)}}catch{x(f,[],!0)}}async function Ct(X){x(ve,!0),x(Se,null);try{x(ie,await Sv(X),!0),g.set(X,l(ie)),localStorage.setItem(ci,X)}catch(Pe){x(Se,Pe instanceof Error?Pe.message:String(Pe),!0)}finally{x(ve,!1)}}let ai;async function Re(X){var Pe;if(await ai.show(`Unpair device ${X}?`,{confirm:"Unpair",danger:!0}))try{await vU(X),((Pe=l(ie))==null?void 0:Pe.nodeId)===X&&x(ie,null),await hi()}catch(ce){x(Se,ce instanceof Error?ce.message:String(ce),!0)}}async function Ee(){x(Ne,!0),x(Oe,null);try{let X;l(he)==="passcode"?(X={passcode:Number(l(De))},l(Fe)&&(X={...X,discriminator:Number(l(Fe))})):X={pairingCode:l(ge).trim()},l(pe).trim()&&(X={...X,discoveryAddress:l(pe).trim()}),await xU(X),x(Q,!1),x(De,""),x(Fe,""),x(ge,""),x(pe,""),await hi()}catch(X){x(Oe,X instanceof Error?X.message:String(X),!0)}finally{x(Ne,!1)}}oo(()=>{hi()});const zt=mr("matter:deviceList",X=>{if(!Array.isArray(X.devices))return;const Pe=X.devices;for(const ce of Pe)g.has(ce.nodeId)||Sv(ce.nodeId).then(fe=>{g.set(ce.nodeId,fe)}).catch(()=>{});x(f,Pe,!0)}),ii=mr("matter:deviceStatus",X=>{if(X.nodeId===void 0)return;const Pe=String(X.nodeId),ce=!!X.online;x(f,l(f).map(fe=>fe.nodeId===Pe?{...fe,online:ce}:fe),!0),x(V,[{id:P++,kind:"status",nodeId:Pe,online:ce,ts:Date.now()},...l(V).slice(0,I-1)],!0)}),Vt=mr("matter:attr",X=>{const Pe=String(X.nodeId),ce=X.endpointId,fe=String(X.clusterName),Gt=String(X.attrName),ni=X.value;if(l(ie)&&l(ie).nodeId===Pe){const fi=l(ie).endpoints.find(pi=>pi.endpointId===ce),Ii=fi==null?void 0:fi.clusters.find(pi=>pi.name===fe);Ii&&(Ii.attrs[Gt]=ni)}const gi=g.get(Pe);if(gi){const fi=gi.endpoints.find(pi=>pi.endpointId===ce),Ii=fi==null?void 0:fi.clusters.find(pi=>pi.name===fe);Ii&&(Ii.attrs[Gt]=ni)}x(V,[{id:P++,kind:"attr",nodeId:Pe,endpointId:ce,clusterName:fe,attrName:Gt,value:ni,ts:X.ts??Date.now()},...l(V).slice(0,I-1)],!0)});B0(()=>{zt(),ii(),Vt(),st()});var Ai=wQ(),Fi=dt(Ai);ks(gl(Fi,{}),X=>ai=X,()=>ai);var mi=v(Fi,2),ln=m(mi),sn=m(ln),dn=m(sn),bn=v(m(dn),2),ft=v(dn,2);{var qt=X=>{var Pe=MY(),ce=m(Pe),fe=m(ce);let Gt;var ni=v(fe,2);let gi;var fi=v(ce,2);{var Ii=oi=>{var $=PY(),ue=dt($),Ce=v(m(ue)),_e=v(ue,2),Je=v(m(_e));yt(Ce,()=>l(De),Ve=>x(De,Ve)),yt(Je,()=>l(Fe),Ve=>x(Fe,Ve)),D(oi,$)},pi=oi=>{var $=TY(),ue=dt($),Ce=v(m(ue)),_e=v(ue,2),Je=m(_e),Ve=v(Je,2),St=v(m(Ve),2);yt(Ce,()=>l(ge),q=>x(ge,q)),j("click",Je,wt),j("change",St,ui),D(oi,$)};O(fi,oi=>{l(he)==="passcode"?oi(Ii):oi(pi,-1)})}var Ci=v(fi,2),He=v(m(Ci)),Ye=v(Ci,2);{var jt=oi=>{var $=Z2(),ue=m($);z(()=>N(ue,l(Oe))),D(oi,$)};O(Ye,oi=>{l(Oe)&&oi(jt)})}var Qt=v(Ye,2),Mi=m(Qt);z(()=>{Gt=Dt(fe,1,"svelte-1ua3isv",null,Gt,{active:l(he)==="passcode"}),gi=Dt(ni,1,"svelte-1ua3isv",null,gi,{active:l(he)==="pairingCode"}),Qt.disabled=l(Ne),N(Mi,l(Ne)?"Commissioning…":"Commission")}),j("click",fe,()=>x(he,"passcode")),j("click",ni,()=>x(he,"pairingCode")),yt(He,()=>l(pe),oi=>x(pe,oi)),j("click",Qt,Ee),D(X,Pe)};O(ft,X=>{l(Q)&&X(qt)})}var Ti=v(ft,2),ki=m(Ti);ti(ki,17,()=>l(f),X=>X.nodeId,(X,Pe)=>{var ce=OY();let fe;var Gt=m(ce),ni=m(Gt);let gi;var fi=v(ni,2),Ii=m(fi);{var pi=Ye=>{var jt=RY(),Qt=dt(jt),Mi=m(Qt),oi=v(Qt,2),$=m(oi);z(()=>{N(Mi,l(Pe).name),N($,`#${l(Pe).nodeId??""}`)}),D(Ye,jt)},Ci=Ye=>{var jt=NY(),Qt=m(jt);z(()=>N(Qt,`Node ${l(Pe).nodeId??""}`)),D(Ye,jt)};O(Ii,Ye=>{l(Pe).name?Ye(pi):Ye(Ci,-1)})}var He=v(Gt,2);z(()=>{var Ye;fe=Dt(ce,1,"svelte-1ua3isv",null,fe,{selected:((Ye=l(ie))==null?void 0:Ye.nodeId)===l(Pe).nodeId}),gi=Dt(ni,1,"status-dot svelte-1ua3isv",null,gi,{online:l(Pe).online})}),j("click",Gt,()=>Ct(l(Pe).nodeId)),j("click",He,()=>Re(l(Pe).nodeId)),D(X,ce)});var bi=v(ki,2);{var yn=X=>{var Pe=HY();D(X,Pe)};O(bi,X=>{l(f).length===0&&X(yn)})}var mn=v(sn,2),_n=m(mn);{var qe=X=>{var Pe=WY();D(X,Pe)},Xt=X=>{var Pe=Z2(),ce=m(Pe);z(()=>N(ce,l(Se))),D(X,Pe)},yi=X=>{var Pe=fQ(),ce=dt(Pe),fe=m(ce),Gt=m(fe),ni=v(fe,2);{var gi=Ci=>{var He=zY(),Ye=m(He);z(()=>N(Ye,l(ie).subtitle)),D(Ci,He)};O(ni,Ci=>{l(ie).subtitle&&Ci(gi)})}var fi=v(ni,2),Ii=m(fi),pi=v(ce,2);ti(pi,17,()=>l(ie).endpoints,Ci=>Ci.endpointId,(Ci,He)=>{var Ye=hQ(),jt=m(Ye),Qt=m(jt),Mi=v(Qt),oi=m(Mi),$=v(Mi,2);ti($,21,()=>l(He).clusters,zi,(Je,Ve)=>{var St=VY(),q=m(St);z(()=>N(q,l(Ve).name)),D(Je,St)});var ue=v(jt,2);{var Ce=Je=>{var Ve=dQ(),St=v(m(Ve));ti(St,21,()=>l(He).clusters,zi,(q,T)=>{var H=cQ(),Y=dt(H),ne=m(Y),le=m(ne),oe=v(Y,2);ti(oe,17,()=>Object.entries(l(T).attrs),zi,(ye,We)=>{var be=At(()=>a8(l(We),2));let Le=()=>l(be)[0],Me=()=>l(be)[1];var nt=Us(),Jt=dt(nt);{var ee=$e=>{const Ft=At(()=>{var we;return(we=t[l(T).name])==null?void 0:we[Le()]}),je=At(()=>(Le()==="acceptedCommandList"||Le()==="generatedCommandList")&&Array.isArray(Me())),ze=At(()=>{var we;return((we=d[l(T).name])==null?void 0:we[Le()])??a[Le()]});var kt=lQ(),ct=m(kt),Qe=m(ct),mt=m(Qe),_t=v(Qe);{var tt=we=>{var it=jY(),ut=m(it);z(Lt=>N(ut,`(${Lt??""})`),[()=>u(l(ze))]),D(we,it)};O(_t,we=>{l(ze)!==void 0&&we(tt)})}var Bt=v(ct),ei=m(Bt);{var Mt=we=>{var it=UY();ti(it,21,()=>l(Ft),zi,(ut,Lt)=>{var Rt=$Y(),si=m(Rt);z(()=>N(si,l(Lt).label)),j("click",Rt,()=>i(l(ie).nodeId,l(He).endpointId,l(T).name,l(Lt).command,l(Lt).args)),D(ut,Rt)}),D(we,it)};O(ei,we=>{l(Ft)&&we(Mt)})}var Kt=v(Bt),Ze=m(Kt);{var Et=we=>{var it=XY();ti(it,21,()=>s(l(T).name,Me()),zi,(ut,Lt,Rt)=>{var si=ZY(),ri=dt(si);{var Ri=pn=>{var wn=qY();D(pn,wn)};O(ri,pn=>{Rt>0&&pn(Ri)})}var tn=v(ri,2);{var on=pn=>{var wn=GY(),Ni=dt(wn),Rn=m(Ni),Ki=v(Ni),Vi=m(Ki);z(()=>{N(Rn,l(Lt).name),N(Vi,`(${l(Lt).id??""})`)}),D(pn,wn)},en=pn=>{var wn=KY(),Ni=m(wn);z(()=>N(Ni,l(Lt).id)),D(pn,wn)};O(tn,pn=>{l(Lt).name?pn(on):pn(en,-1)})}D(ut,si)}),D(we,it)},Zt=we=>{var it=JY(),ut=v(m(it));ti(ut,21,Me,zi,(Lt,Rt)=>{const si=At(()=>l(Rt)),ri=At(()=>l(si).deviceType),Ri=At(()=>r[l(ri)]);var tn=QY(),on=m(tn),en=m(on);{var pn=Ki=>{var Vi=YY(),nn=dt(Vi),Mn=v(nn),Cs=m(Mn);z(Fn=>{N(nn,`${l(Ri)??""} `),N(Cs,`(${Fn??""})`)},[()=>u(l(ri))]),D(Ki,Vi)},wn=Ki=>{var Vi=Co();z(nn=>N(Vi,nn),[()=>u(l(ri))]),D(Ki,Vi)};O(en,Ki=>{l(Ri)?Ki(pn):Ki(wn,-1)})}var Ni=v(on),Rn=m(Ni);z(Ki=>N(Rn,Ki),[()=>C(l(si).revision)]),D(Lt,tn)}),D(we,it)},ji=At(()=>Le()==="deviceTypeList"&&Array.isArray(Me())),Wt=we=>{const it=At(()=>[...new Set(Me().flatMap(ri=>Object.keys(ri)))]);var ut=nQ(),Lt=m(ut),Rt=m(Lt);ti(Rt,21,()=>l(it),zi,(ri,Ri)=>{var tn=eQ(),on=m(tn);z(()=>N(on,l(Ri))),D(ri,tn)});var si=v(Lt);ti(si,21,Me,zi,(ri,Ri)=>{var tn=iQ();ti(tn,21,()=>l(it),zi,(on,en)=>{var pn=tQ(),wn=m(pn);z(Ni=>N(wn,Ni),[()=>C(l(Ri)[l(en)])]),D(on,pn)}),D(ri,tn)}),D(we,ut)},$t=At(()=>E(Me())),wi=we=>{var it=oQ(),ut=m(it);ti(ut,21,()=>Object.entries(Me()),zi,(Lt,Rt)=>{var si=At(()=>a8(l(Rt),2));let ri=()=>l(si)[0],Ri=()=>l(si)[1];var tn=sQ(),on=m(tn),en=m(on),pn=v(on),wn=m(pn);z(Ni=>{N(en,ri()),N(wn,Ni)},[()=>C(Ri())]),D(Lt,tn)}),D(we,it)},Xi=At(()=>b(Me())),$i=we=>{var it=rQ(),ut=m(it);z(()=>{gn(it,"href",Me()),N(ut,Me())}),D(we,it)},Hi=we=>{var it=aQ(),ut=m(it);z(Lt=>N(ut,Lt),[()=>C(Me())]),D(we,it)};O(Ze,we=>{l(je)?we(Et):l(ji)?we(Zt,1):l($t)?we(Wt,2):l(Xi)?we(wi,3):(Le()==="productUrl"||Le()==="productURL")&&typeof Me()=="string"?we($i,4):we(Hi,-1)})}z(()=>{gn(ct,"title",Le()),N(mt,Le())}),D($e,kt)},de=At(()=>!y(Me(),Le()));O(Jt,$e=>{l(de)&&$e(ee)})}D(ye,nt)}),z(()=>N(le,l(T).name)),D(q,H)}),D(Je,Ve)},_e=Je=>{var Ve=uQ();D(Je,Ve)};O(ue,Je=>{l(He).clusters.length>0?Je(Ce):Je(_e,-1)})}z(()=>{N(Qt,`${l(He).name??`Endpoint ${l(He).endpointId}`??""} `),N(oi,`ep${l(He).endpointId??""}`)}),D(Ci,Ye)}),z(()=>{N(Gt,l(ie).name??`Node ${l(ie).nodeId}`),N(Ii,`Node ID: ${l(ie).nodeId??""}`)}),D(X,Pe)},Ut=X=>{var Pe=gQ();D(X,Pe)};O(_n,X=>{l(ve)?X(qe):l(Se)?X(Xt,1):l(ie)?X(yi,2):X(Ut,-1)})}var Li=v(ln,2),qi=m(Li),Gi=v(qi,2),K=v(m(Gi),2);{var Ae=X=>{var Pe=pQ(),ce=m(Pe);z(()=>N(ce,l(V).length)),D(X,Pe)};O(K,X=>{!l(U)&&l(V).length>0&&X(Ae)})}var ot=v(K,2),Ge=m(ot),Pt=v(Gi,2);{var Yt=X=>{var Pe=bQ(),ce=m(Pe);{var fe=ni=>{var gi=xQ();D(ni,gi)},Gt=ni=>{var gi=Us(),fi=dt(gi);ti(fi,17,()=>l(re),Ii=>Ii.id,(Ii,pi)=>{const Ci=At(()=>{var Ce,_e;return((Ce=g.get(l(pi).nodeId))==null?void 0:Ce.name)??((_e=l(f).find(Je=>Je.nodeId===l(pi).nodeId))==null?void 0:_e.name)??null}),He=At(()=>{var Ce,_e;return l(pi).endpointId!==void 0?((_e=(Ce=g.get(l(pi).nodeId))==null?void 0:Ce.endpoints.find(Je=>Je.endpointId===l(pi).endpointId))==null?void 0:_e.name)??null:null}),Ye=At(()=>l(pi).attrName??l(pi).clusterName);var jt=_Q(),Qt=m(jt),Mi=m(Qt),oi=v(Qt,2);{var $=Ce=>{var _e=vQ(),Je=v(dt(_e),2),Ve=m(Je),St=v(Ve);{var q=ne=>{var le=UC(),oe=v(dt(le)),ye=m(oe);z(()=>N(ye,`(#${l(pi).nodeId??""})`)),D(ne,le)};O(St,ne=>{l(Ci)&&ne(q)})}var T=v(Je,2);let H;var Y=m(T);z(()=>{N(Ve,l(Ci)??`#${l(pi).nodeId}`),H=Dt(T,1,"e-val svelte-1ua3isv",null,H,{"e-online":l(pi).online,"e-offline":!l(pi).online}),N(Y,l(pi).online?"online":"offline")}),D(Ce,_e)},ue=Ce=>{var _e=mQ(),Je=v(dt(_e),2),Ve=m(Je),St=v(Ve);{var q=Me=>{var nt=UC(),Jt=v(dt(nt)),ee=m(Jt);z(()=>N(ee,`(#${l(pi).nodeId??""})`)),D(Me,nt)};O(St,Me=>{l(Ci)&&Me(q)})}var T=v(Je,2),H=m(T),Y=v(H);{var ne=Me=>{var nt=UC(),Jt=v(dt(nt)),ee=m(Jt);z(()=>N(ee,`(ep ${l(pi).endpointId??""})`)),D(Me,nt)};O(Y,Me=>{l(He)&&Me(ne)})}var le=v(T,2),oe=m(le),ye=v(le,2),We=m(ye),be=v(ye,2),Le=m(be);z(Me=>{N(Ve,l(Ci)??`#${l(pi).nodeId}`),N(H,l(He)??`ep${l(pi).endpointId}`),N(oe,l(pi).clusterName),N(We,l(Ye)),N(Le,Me)},[()=>p(l(pi).value)]),D(Ce,_e)};O(oi,Ce=>{l(pi).kind==="status"?Ce($):Ce(ue,-1)})}z(Ce=>N(Mi,Ce),[()=>A(l(pi).ts)]),D(Ii,jt)}),D(ni,gi)};O(ce,ni=>{l(re).length===0?ni(fe):ni(Gt,-1)})}D(X,Pe)};O(Pt,X=>{l(U)&&X(Yt)})}var gt=v(mi,2);{var et=X=>{var Pe=yQ(),ce=dt(Pe),fe=v(ce,2),Gt=m(fe),ni=v(m(Gt),2),gi=v(Gt,2);{var fi=Ci=>{var He=CQ(),Ye=m(He);z(()=>N(Ye,l(Ot))),D(Ci,He)},Ii=Ci=>{var He=EQ(),Ye=dt(He),jt=m(Ye);ks(jt,Qt=>x(Xe,Qt),()=>l(Xe)),D(Ci,He)};O(gi,Ci=>{l(Ot)?Ci(fi):Ci(Ii,-1)})}var pi=v(gi,2);ks(pi,Ci=>x(ht,Ci),()=>l(ht)),j("click",ce,st),j("click",ni,st),D(X,Pe)};O(gt,X=>{l(lt)&&X(et)})}z(()=>{Vo(Li,l(U)?`height: ${l(J)}px;`:""),N(Ge,l(U)?"▾":"▸")}),j("click",bn,()=>x(Q,!l(Q))),j("mousedown",qi,ae),j("click",ot,()=>{x(U,!l(U))}),D(o,Ai),Xs()}lo(["click","change","mousedown"]);var DQ=F("<button>›</button>"),AQ=F('<span class="chev-ph svelte-1vejtrc"></span>'),kQ=F('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),BQ=F("<button>🔒</button>"),FQ=F('<span class="acl-loading">Loading…</span>'),LQ=F("<span> </span>"),IQ=F('<span class="acl-dyn svelte-1vejtrc" title="per-user/client pattern — cannot evaluate statically">⚠%u/%c</span>'),PQ=F('<span class="acl-members svelte-1vejtrc"> </span>'),TQ=F('<span class="acl-group svelte-1vejtrc"> </span>'),MQ=F('<span> <strong class="svelte-1vejtrc"> </strong> <!> <!> <!></span>'),RQ=F('<div class="acl-sec svelte-1vejtrc"><span class="acl-sec-hdr svelte-1vejtrc"> </span> <!></div>'),NQ=F('<div class="acl-panel svelte-1vejtrc"><!></div>'),OQ=F('<div class="tc svelte-1vejtrc"></div>'),HQ=F('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!> <!></div> <!> <!></div>'),WQ=F('<button class="acl-refresh svelte-1vejtrc" title="Refresh ACL data">↺</button>'),zQ=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),VQ=F("<option></option>"),jQ=F('<span class="pub-ok svelte-1vejtrc">✓</span>'),$Q=F('<span class="pub-err svelte-1vejtrc"> </span>'),UQ=F('<div class="info svelte-1vejtrc">Loading…</div>'),qQ=F('<div class="info err svelte-1vejtrc"> </div>'),GQ=F('<div class="info svelte-1vejtrc">No topics match.</div>'),KQ=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>'),ZQ=F('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),XQ=F('<div class="info svelte-1vejtrc">No topics yet.</div>'),YQ=F('<div class="tree-wrap svelte-1vejtrc"><!></div>'),QQ=F('<span class="stream-badge"> </span>'),JQ=F('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),eJ=F('<span class="s-ret svelte-1vejtrc" title="retained snapshot">&#x229B;</span>'),tJ=F('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),iJ=F('<div class="stream-body svelte-1vejtrc"><!></div>'),nJ=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),sJ=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>'),oJ=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),rJ=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 aJ(o,e){Zs(e,!0);const t=(T,H=fb)=>{const Y=At(()=>l(g).has(H().path)),ne=At(()=>l(a)>=0&&H().children.size>0),le=At(()=>l(a)>=0&&H().isLeaf&&!n.has(H().path));var oe=HQ(),ye=m(oe);let We;var be=m(ye);{var Le=mt=>{var _t=DQ();let tt;z(()=>{tt=Dt(_t,1,"chev svelte-1vejtrc",null,tt,{open:l(Y)}),gn(_t,"aria-label",l(Y)?"Collapse":"Expand")}),j("click",_t,()=>p(H().path)),D(mt,_t)},Me=mt=>{var _t=AQ();D(mt,_t)};O(be,mt=>{l(ne)?mt(Le):mt(Me,-1)})}var nt=v(be,2),Jt=m(nt),ee=v(nt,2);{var de=mt=>{var _t=kQ(),tt=dt(_t),Bt=m(tt),ei=v(tt,2),Mt=m(ei);z((Kt,Ze,Et)=>{gn(tt,"title",Kt),N(Bt,Ze),N(Mt,Et)},[()=>{var Kt;return ci((Kt=ai(H().path))==null?void 0:Kt.val)},()=>{var Kt;return ci((Kt=ai(H().path))==null?void 0:Kt.val)},()=>{var Kt;return((Kt=ai(H().path))==null?void 0:Kt.ts)!=null?hi(ai(H().path).ts):""}]),D(mt,_t)},$e=At(()=>H().isLeaf&&i.has(H().path));O(ee,mt=>{l($e)&&mt(de)})}var Ft=v(ee,2);{var je=mt=>{const _t=At(()=>!!l(Ai)&&dn(H().path));var tt=BQ();let Bt;z(()=>{Bt=Dt(tt,1,"acl-badge svelte-1vejtrc",null,Bt,{matched:l(_t)}),gn(tt,"title",l(_t)?"Has explicit ACL — click to inspect":"No explicit ACL — click to inspect defaults")}),j("click",tt,ei=>{ei.stopPropagation(),ft(H().path)}),D(mt,tt)};O(Ft,mt=>{l(ii)&&H().isLeaf&&mt(je)})}var ze=v(ye,2);{var kt=mt=>{var _t=NQ(),tt=m(_t);{var Bt=Mt=>{var Kt=FQ();D(Mt,Kt)},ei=Mt=>{var Kt=Us(),Ze=dt(Kt);ti(Ze,17,()=>[{label:"Send",section:l(mi).send},{label:"Subscribe",section:l(mi).subscribe},{label:"Receive",section:l(mi).receive}],zi,(Et,Zt)=>{var ji=RQ(),Wt=m(ji),$t=m(Wt),wi=v(Wt,2);{var Xi=Hi=>{var we=LQ();let it;var ut=m(we);z(()=>{it=Dt(we,1,"acl-def svelte-1vejtrc",null,it,{allow:l(Zt).section.default,deny:!l(Zt).section.default}),N(ut,`${l(Zt).section.default?"allow":"deny"} (default)`)}),D(Hi,we)},$i=Hi=>{var we=Us(),it=dt(we);ti(it,17,()=>l(Zt).section.roles,zi,(ut,Lt)=>{var Rt=MQ();let si;var ri=m(Rt),Ri=v(ri),tn=m(Ri),on=v(Ri,2);{var en=Rn=>{var Ki=IQ();D(Rn,Ki)};O(on,Rn=>{l(Lt).dynamic&&Rn(en)})}var pn=v(on,2);{var wn=Rn=>{var Ki=PQ(),Vi=m(Ki);z(nn=>N(Vi,nn),[()=>l(Lt).users.join(", ")]),D(Rn,Ki)};O(pn,Rn=>{l(Lt).users.length>0&&Rn(wn)})}var Ni=v(pn,2);ti(Ni,17,()=>l(Lt).groups,zi,(Rn,Ki)=>{var Vi=TQ(),nn=m(Vi);z(()=>N(nn,l(Ki).groupname)),D(Rn,Vi)}),z(()=>{si=Dt(Rt,1,"acl-role svelte-1vejtrc",null,si,{allow:l(Lt).allow,deny:!l(Lt).allow}),N(ri,`${l(Lt).allow?"✓":"✗"} `),N(tn,l(Lt).rolename)}),D(ut,Rt)}),D(Hi,we)};O(wi,Hi=>{l(Zt).section.roles.length===0?Hi(Xi):Hi($i,-1)})}z(()=>N($t,l(Zt).label)),D(Et,ji)}),D(Mt,Kt)};O(tt,Mt=>{l(ln)?Mt(Bt):l(mi)&&Mt(ei,1)})}D(mt,_t)};O(ze,mt=>{l(ii)&&H().isLeaf&&l(Fi)===H().path&&mt(kt)})}var ct=v(ze,2);{var Qe=mt=>{var _t=OQ();ti(_t,21,()=>[...H().children.values()].sort((tt,Bt)=>tt.seg.localeCompare(Bt.seg)),tt=>tt.path,(tt,Bt)=>{t(tt,()=>l(Bt))}),D(mt,_t)};O(ct,mt=>{l(ne)&&l(Y)&&mt(Qe)})}z(()=>{We=Dt(ye,1,"tr svelte-1vejtrc",null,We,{stale:l(le)}),N(Jt,H().seg)}),j("click",ye,()=>{x(ve,H().path+"/#")}),j("contextmenu",ye,mt=>{mt.preventDefault(),x(pe,{x:mt.clientX,y:mt.clientY,topic:H().path},!0)}),D(T,oe)},i=new Map,n=new Set,s=new Set;let r=null,a=B(0);function d(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const T of s)f(T);s.clear(),d8(a)}))}const u=new Map;function f(T){const H=T.split("/");let Y=u,ne="";for(let le=0;le<H.length;le++){const oe=H[le];ne=le===0?oe:`${ne}/${oe}`,Y.has(oe)||Y.set(oe,{seg:oe,path:ne,children:new Map,isLeaf:!1});const ye=Y.get(oe);le===H.length-1&&(ye.isLeaf=!0),Y=ye.children}}let g=B(_i(new Set));function p(T){const H=new Set(l(g));H.has(T)?H.delete(T):H.add(T),x(g,H,!0)}let C=B("");const b=24,E=5;let y=B(0),A=B(300),I=At(()=>{if(l(a),!l(C))return[];const T=l(C).toLowerCase().split(/\s+/).filter(Boolean),H=[];for(const[Y,ne]of i){const le=Y.toLowerCase();T.every(oe=>le.includes(oe))&&H.push({topic:Y,...ne})}return H.sort((Y,ne)=>Y.topic.localeCompare(ne.topic))}),M=At(()=>{const T=l(I).length,H=Math.max(0,Math.floor(l(y)/b)-E),Y=Math.min(T,Math.ceil((l(y)+l(A))/b)+E);return{start:H,end:Y,totalH:T*b,top:H*b}});const R=1e3,P=200,V=20,U=36;let J=0,re=B(_i([])),ae=B(_i([])),ie=B(!0),ve=B("#"),Se=B(200);us(()=>{const T=l(ve).trim(),H=tc(()=>l(re)),Y=!T||T==="#"?H.slice(0,P):H.filter(ne=>Q(T,ne.topic)).slice(0,P);if(T&&T!=="#"){const ne=new Set(Y.map(oe=>oe.topic)),le=[];for(const[oe,ye]of i)ne.has(oe)||Q(T,oe)&&le.push({id:-(le.length+1),topic:oe,val:ye.val,ts:ye.ts,retained:!0});le.sort((oe,ye)=>oe.topic.localeCompare(ye.topic)),x(ae,[...Y,...le],!0)}else x(ae,Y,!0)});function Q(T,H){if(T==="#")return!0;const Y=T.split("/"),ne=H.split("/");for(let le=0;le<Y.length;le++){if(Y[le]==="#")return!0;if(le>=ne.length||Y[le]!=="+"&&Y[le]!==ne[le])return!1}return Y.length===ne.length}function he(T){T.preventDefault();const H=T.clientY,Y=l(Se);function ne(oe){x(Se,Math.max(60,Math.min(800,Y+H-oe.clientY)),!0)}function le(){document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",le)}document.addEventListener("mousemove",ne),document.addEventListener("mouseup",le)}let De=At(()=>{const T=Math.max(1,Math.floor((l(Se)-U)/V)+1);return l(ae).slice(0,T)}),Fe=B(!0),ge=B(null);async function Ne(){x(Fe,!0),x(ge,null);try{const T=await yF();for(const H of T)i.set(H.topic,{val:H.val,ts:H.ts}),f(H.topic)}catch(T){x(ge,T instanceof Error?T.message:String(T),!0)}finally{x(Fe,!1),d8(a)}}const Oe=mr("mqtt",T=>{const{topic:H,val:Y,ts:ne}=T;i.set(H,{val:Y,ts:ne}),n.add(H),s.add(H),d();const le={id:J++,topic:H,val:Y,ts:ne};x(re,[le,...l(re).slice(0,R-1)],!0);const oe=l(ve).trim();(!oe||oe==="#"||Q(oe,H))&&x(ae,[le,...l(ae).filter(ye=>!(ye.retained&&ye.topic===H)).slice(0,P-1)],!0)});let pe=B(null),lt=B(null);async function Ot(T,H){const Y=[T];if(H){const ne=T+"/";for(const le of i.keys())le.startsWith(ne)&&Y.push(le)}for(const ne of Y)await h2(ne,"",!0,0)}let Xe=At(()=>(l(a),[...i.keys()].sort())),ht=B(""),me=B(""),Be=B(!1),st=B(0),vt=B(!1),rt=B(null),wt=B(!1);async function ui(){if(l(ht)){x(vt,!0),x(rt,null),x(wt,!1);try{await h2(l(ht),l(me),l(Be),l(st)),x(wt,!0),setTimeout(()=>{x(wt,!1)},2e3)}catch(T){x(rt,T instanceof Error?T.message:String(T),!0)}finally{x(vt,!1)}}}function ci(T){return T==null?"":typeof T=="object"?JSON.stringify(T):String(T)}function hi(T){return new Date(T).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ct(T){return new Date(T).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function ai(T){return l(a),i.get(T)}let Re=At(()=>(l(a),[...u.values()].sort((T,H)=>T.seg.localeCompare(H.seg)))),Ee=At(()=>(l(a),i.size)),zt=B(!1),ii=B(!1),Vt=B(!1),Ai=B(null),Fi=B(null),mi=B(null),ln=B(!1);function sn(T,H,Y){return H.includes("%u")||H.includes("%c")?"dynamic":T==="subscribeLiteral"||T==="unsubscribeLiteral"?H===Y?"match":"no-match":Q(H,Y)?"match":"no-match"}function dn(T){if(!l(Ai))return!1;for(const H of l(Ai).roles)if(H.acls){for(const Y of H.acls)if(sn(Y.acltype,Y.topic,T)!=="no-match")return!0}return!1}async function bn(){x(Vt,!0);try{const T=await BF();x(Ai,{roles:T.roles},!0)}catch{x(Ai,null),x(ii,!1)}finally{x(Vt,!1)}}async function ft(T){if(l(Fi)===T){x(Fi,null),x(mi,null);return}x(Fi,T,!0),x(mi,null),x(ln,!0);try{x(mi,await XU(T),!0)}catch{x(mi,null)}finally{x(ln,!1)}}async function qt(){l(ii)?(x(ii,!1),x(Fi,null),x(mi,null)):(x(ii,!0),x(Fi,null),x(mi,null),l(Ai)||await bn())}const Ti=mr("mqtt:status",()=>{Ne()});oo(Ne),oo(async()=>{var T;try{const H=await zb();x(zt,!!((T=H.dynsec)!=null&&T.dynsecReady),!0)}catch{x(zt,!1)}}),B0(()=>{Oe(),Ti(),r!==null&&cancelAnimationFrame(r)});var ki=rJ(),bi=m(ki),yn=v(m(bi),2);{var mn=T=>{var H=zQ(),Y=dt(H);let ne;var le=v(m(Y),2);{var oe=be=>{var Le=Co("…");D(be,Le)};O(le,be=>{l(Vt)&&be(oe)})}var ye=v(Y,2);{var We=be=>{var Le=WQ();z(()=>Le.disabled=l(Vt)),j("click",Le,bn),D(be,Le)};O(ye,be=>{l(ii)&&be(We)})}z(()=>{ne=Dt(Y,1,"acl-btn svelte-1vejtrc",null,ne,{active:l(ii)}),Y.disabled=l(Vt)}),j("click",Y,qt),D(T,H)};O(yn,T=>{l(zt)&&T(mn)})}var _n=v(bi,2),qe=m(_n),Xt=m(qe),yi=v(Xt,2);ti(yi,20,()=>l(Xe),T=>T,(T,H)=>{var Y=VQ(),ne={};z(()=>{ne!==(ne=H)&&(Y.value=(Y.__value=H)??"")}),D(T,Y)});var Ut=v(yi,2),Li=v(Ut,2),qi=m(Li),Gi=v(Li,2),K=m(Gi);K.value=K.__value=0;var Ae=v(K);Ae.value=Ae.__value=1;var ot=v(Ae);ot.value=ot.__value=2;var Ge=v(Gi,2),Pt=v(Ge,2);{var Yt=T=>{var H=jQ();D(T,H)};O(Pt,T=>{l(wt)&&T(Yt)})}var gt=v(Pt,2);{var et=T=>{var H=$Q(),Y=m(H);z(()=>N(Y,l(rt))),D(T,H)};O(gt,T=>{l(rt)&&T(et)})}var X=v(qe,2),Pe=m(X),ce=v(Pe,2),fe=m(ce);{var Gt=T=>{var H=Co();z(()=>N(H,`${l(I).length??""} /`)),D(T,H)};O(fe,T=>{l(C)&&T(Gt)})}var ni=v(fe),gi=v(X,2);{var fi=T=>{var H=UQ();D(T,H)},Ii=T=>{var H=qQ(),Y=m(H);z(()=>N(Y,l(ge))),D(T,H)},pi=T=>{var H=Us(),Y=dt(H);{var ne=oe=>{var ye=GQ();D(oe,ye)},le=oe=>{var ye=ZQ(),We=m(ye),be=m(We);ti(be,21,()=>l(I).slice(l(M).start,l(M).end),Le=>Le.topic,(Le,Me)=>{var nt=KQ(),Jt=m(nt),ee=m(Jt),de=v(Jt,2),$e=m(de),Ft=v(de,2),je=m(Ft);z((ze,kt,ct)=>{N(ee,l(Me).topic),gn(de,"title",ze),N($e,kt),N(je,ct)},[()=>ci(l(Me).val),()=>ci(l(Me).val),()=>hi(l(Me).ts)]),D(Le,nt)}),z(()=>{Vo(We,`height: ${l(M).totalH??""}px; position: relative;`),Vo(be,`top: ${l(M).top??""}px;`)}),Ts("scroll",ye,Le=>{x(y,Le.currentTarget.scrollTop,!0)}),EP(ye,"clientHeight",Le=>x(A,Le)),D(oe,ye)};O(Y,oe=>{l(I).length===0?oe(ne):oe(le,-1)})}D(T,H)},Ci=T=>{var H=YQ(),Y=m(H);{var ne=oe=>{var ye=XQ();D(oe,ye)},le=oe=>{var ye=Us(),We=dt(ye);ti(We,17,()=>l(Re),be=>be.path,(be,Le)=>{t(be,()=>l(Le))}),D(oe,ye)};O(Y,oe=>{l(Re).length===0?oe(ne):oe(le,-1)})}D(T,H)};O(gi,T=>{l(Fe)?T(fi):l(ge)?T(Ii,1):l(C)?T(pi,2):T(Ci,-1)})}var He=v(_n,2),Ye=m(He),jt=v(Ye,2),Qt=m(jt),Mi=v(Qt,2);{var oi=T=>{var H=QQ(),Y=m(H);z(()=>N(Y,l(ae).length)),D(T,H)};O(Mi,T=>{!l(ie)&&l(ae).length>0&&T(oi)})}var $=v(Mi,2),ue=m($),Ce=v(jt,2);{var _e=T=>{var H=iJ(),Y=m(H);{var ne=oe=>{var ye=JQ();D(oe,ye)},le=oe=>{var ye=Us(),We=dt(ye);ti(We,17,()=>l(De),be=>be.id,(be,Le)=>{var Me=tJ();let nt;var Jt=m(Me),ee=m(Jt),de=v(Jt,2);{var $e=ct=>{var Qe=eJ();D(ct,Qe)};O(de,ct=>{l(Le).retained&&ct($e)})}var Ft=v(de,2),je=m(Ft),ze=v(Ft,2),kt=m(ze);z((ct,Qe,mt)=>{nt=Dt(Me,1,"sr svelte-1vejtrc",null,nt,{retained:l(Le).retained}),N(ee,ct),N(je,l(Le).topic),gn(ze,"title",Qe),N(kt,mt)},[()=>Ct(l(Le).ts),()=>ci(l(Le).val),()=>ci(l(Le).val)]),D(be,Me)}),D(oe,ye)};O(Y,oe=>{l(De).length===0?oe(ne):oe(le,-1)})}D(T,H)};O(Ce,T=>{l(ie)&&T(_e)})}var Je=v(He,2);{var Ve=T=>{var H=nJ(),Y=dt(H),ne=v(Y,2);let le;var oe=m(ne),ye=v(oe,2);z(()=>le=Vo(ne,"",le,{left:`${l(pe).x??""}px`,top:`${l(pe).y??""}px`})),j("click",Y,()=>x(pe,null)),j("contextmenu",Y,We=>{We.preventDefault(),x(pe,null)}),j("click",oe,()=>{navigator.clipboard.writeText(l(pe).topic),x(pe,null)}),j("click",ye,()=>{const We=l(pe).topic,be=We+"/",Le=[...i.keys()].some(Me=>Me.startsWith(be));x(lt,{topic:We,hasChildren:Le,recursive:!1},!0),x(pe,null)}),D(T,H)};O(Je,T=>{l(pe)&&T(Ve)})}var St=v(Je,2);{var q=T=>{var H=oJ(),Y=dt(H),ne=v(Y,2),le=v(m(ne),2),oe=m(le),ye=v(m(oe)),We=m(ye),be=v(oe,2);{var Le=ee=>{var de=sJ(),$e=m(de);Ms($e,()=>l(lt).recursive,Ft=>l(lt).recursive=Ft),D(ee,de)};O(be,ee=>{l(lt).hasChildren&&ee(Le)})}var Me=v(le,2),nt=m(Me),Jt=v(nt,2);z(()=>N(We,l(lt).topic)),j("click",Y,()=>x(lt,null)),j("click",nt,()=>x(lt,null)),j("click",Jt,()=>{const{topic:ee,recursive:de}=l(lt);x(lt,null),Ot(ee,de)}),D(T,H)};O(St,T=>{l(lt)&&T(q)})}z(()=>{Ge.disabled=l(vt)||!l(ht),N(ni,` ${l(Ee)??""}`),Vo(He,l(ie)?`height: ${l(Se)}px;`:""),N(ue,l(ie)?"▾":"▸")}),yt(Xt,()=>l(ht),T=>x(ht,T)),yt(Ut,()=>l(me),T=>x(me,T)),Ms(qi,()=>l(Be),T=>x(Be,T)),$s(Gi,()=>l(st),T=>x(st,T)),j("click",Ge,ui),yt(Pe,()=>l(C),T=>x(C,T)),j("mousedown",Ye,he),yt(Qt,()=>l(ve),T=>x(ve,T)),j("click",$,()=>{x(ie,!l(ie))}),D(o,ki),Xs()}lo(["click","contextmenu","mousedown"]);var lJ=F('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),cJ=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>'),dJ=F('<div class="err svelte-twakcj"> </div>'),uJ=F('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),hJ=F('<p class="empty svelte-twakcj">No packages installed.</p>'),fJ=F('<p class="empty svelte-twakcj">No match.</p>'),gJ=F("<span> </span>"),pJ=mb('<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>'),xJ=mb('<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>'),vJ=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>'),mJ=F('<span class="result-author svelte-twakcj"> </span>'),_J=F('<span class="result-date svelte-twakcj"> </span>'),bJ=F('<span class="result-desc svelte-twakcj"> </span>'),CJ=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>'),EJ=F('<div class="results-list svelte-twakcj"></div>'),yJ=F('<pre class="npm-output svelte-twakcj"> </pre>'),wJ=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>`),SJ=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 DJ(o,e){Zs(e,!0);let t=B(_i([])),i=B(""),n=B(_i({})),s=B(_i([])),r=B(!1),a=B(""),d=B(_i([])),u=B(!1),f=B(!1),g=B(!1),p=B(""),C=B(""),b=_i({});const E=At(()=>l(i).trim()?l(t).filter(ft=>ft.name.toLowerCase().includes(l(i).toLowerCase())):l(t)),y=At(()=>Object.keys(l(n)).filter(ft=>!l(s).includes(ft)).length);oo(async()=>{await Promise.all([A(),I(),M()])});async function A(){try{x(t,await aU(),!0),x(p,"")}catch(ft){x(p,ft.message,!0)}}async function I(){try{x(n,await EF(),!0)}catch{}}async function M(){try{const ft=await Zl();x(s,Array.isArray(ft.pinnedPackages)?ft.pinnedPackages:[],!0)}catch{}}async function R(ft){const qt=l(s).includes(ft)?l(s).filter(Ti=>Ti!==ft):[...l(s),ft];x(s,qt,!0);try{const Ti=await Zl();await Dp({...Ti,pinnedPackages:qt})}catch{}}async function P(){x(r,!0);try{x(n,await hU(),!0)}catch{}finally{x(r,!1)}}async function V(){const ft=l(a).trim();if(!ft){x(d,[],!0);return}x(g,!0),x(p,"");try{x(d,await lU(ft),!0)}catch(qt){x(p,qt.message,!0)}finally{x(g,!1)}}function U(ft){if(!ft)return"";try{return new Date(ft).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function J(ft,qt){b[ft]=!0,x(p,""),x(C,"");try{const Ti=await cU(ft,qt);x(C,Ti.stdout||Ti.stderr||"Done.",!0),x(u,!0),await A()}catch(Ti){x(p,Ti.message,!0)}finally{b[ft]=!1}}async function re(ft){b[ft]=!0,x(p,""),x(C,"");try{const qt=await dU(ft);x(C,qt.stdout||qt.stderr||"Done.",!0),x(u,!0);const Ti={...l(n)};delete Ti[ft],x(n,Ti,!0),await A()}catch(qt){x(p,qt.message,!0)}finally{b[ft]=!1}}async function ae(ft){b[ft]=!0,x(p,""),x(C,"");try{const qt=await uU(ft);x(C,qt.stdout||qt.stderr||"Done.",!0),x(u,!0);const Ti={...l(n)};delete Ti[ft],x(n,Ti,!0),await A()}catch(qt){x(p,qt.message,!0)}finally{b[ft]=!1}}let ie;async function ve(){if(await ie.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){x(f,!0);try{await _F()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var Se=SJ(),Q=dt(Se);ks(gl(Q,{}),ft=>ie=ft,()=>ie);var he=v(Q,2),De=m(he);{var Fe=ft=>{var qt=lJ();D(ft,qt)},ge=ft=>{var qt=cJ(),Ti=v(m(qt));j("click",Ti,ve),D(ft,qt)};O(De,ft=>{l(f)?ft(Fe):l(u)&&ft(ge,1)})}var Ne=v(De,2);{var Oe=ft=>{var qt=dJ(),Ti=m(qt);z(()=>N(Ti,l(p))),D(ft,qt)};O(Ne,ft=>{l(p)&&ft(Oe)})}var pe=v(Ne,2),lt=m(pe),Ot=m(lt),Xe=v(m(Ot),2),ht=m(Xe),me=v(Xe,2);{var Be=ft=>{var qt=uJ(),Ti=m(qt);z(()=>N(Ti,`${l(y)??""} outdated`)),D(ft,qt)};O(me,ft=>{l(y)>0&&ft(Be)})}var st=v(me,2),vt=m(st);let rt;var wt=v(Ot,2),ui=m(wt),ci=v(wt,2),hi=m(ci);{var Ct=ft=>{var qt=hJ();D(ft,qt)},ai=ft=>{var qt=fJ();D(ft,qt)},Re=ft=>{var qt=Us(),Ti=dt(qt);ti(Ti,17,()=>l(E),ki=>ki.name,(ki,bi)=>{var yn=vJ();let mn;var _n=m(yn),qe=m(_n),Xt=m(qe),yi=v(qe,2),Ut=m(yi),Li=v(yi,2);{var qi=X=>{var Pe=gJ();let ce;var fe=m(Pe);z(Gt=>{ce=Dt(Pe,1,"dep-latest svelte-twakcj",null,ce,Gt),N(fe,`→ v${l(n)[l(bi).name].latest??""}`)},[()=>({"dep-latest--pinned":l(s).includes(l(bi).name)})]),D(X,Pe)};O(Li,X=>{l(n)[l(bi).name]&&X(qi)})}var Gi=v(_n,2),K=m(Gi);let Ae;var ot=v(K,2);let Ge;var Pt=m(ot);{var Yt=X=>{var Pe=pJ();D(X,Pe)},gt=X=>{var Pe=xJ();D(X,Pe)};O(Pt,X=>{b[l(bi).name]?X(Yt):X(gt,-1)})}var et=v(ot,2);z((X,Pe,ce)=>{mn=Dt(yn,1,"dep-row svelte-twakcj",null,mn,{"dep-busy":!!b[l(bi).name]}),gn(qe,"href",l(bi).url??`https://www.npmjs.com/package/${l(bi).name}`),N(Xt,l(bi).name),N(Ut,l(bi).installedVersion??l(bi).version),Ae=Dt(K,1,"icon-btn svelte-twakcj",null,Ae,X),gn(K,"title",Pe),Ge=Dt(ot,1,"icon-btn svelte-twakcj",null,Ge,ce),ot.disabled=!!b[l(bi).name],gn(ot,"title",l(n)[l(bi).name]?`Update to v${l(n)[l(bi).name].latest}`:"Update to latest"),et.disabled=!!b[l(bi).name]},[()=>({"icon-btn--pinned":l(s).includes(l(bi).name)}),()=>l(s).includes(l(bi).name)?"Unpin package":"Pin package (suppress update dot)",()=>({"icon-btn--update":!!l(n)[l(bi).name]&&!l(s).includes(l(bi).name)})]),j("click",K,()=>R(l(bi).name)),j("click",ot,()=>ae(l(bi).name)),j("click",et,()=>re(l(bi).name)),D(ki,yn)}),D(ft,qt)};O(hi,ft=>{l(t).length===0?ft(Ct):l(E).length===0?ft(ai,1):ft(Re,-1)})}var Ee=v(lt,2),zt=v(m(Ee),2),ii=m(zt),Vt=v(ii,2),Ai=m(Vt),Fi=v(zt,2);{var mi=ft=>{var qt=EJ();ti(qt,21,()=>l(d),Ti=>Ti.name,(Ti,ki)=>{var bi=CJ(),yn=m(bi),mn=m(yn),_n=m(mn),qe=v(mn,2),Xt=m(qe),yi=v(qe,2);{var Ut=Ge=>{var Pt=mJ(),Yt=m(Pt);z(()=>N(Yt,l(ki).author)),D(Ge,Pt)};O(yi,Ge=>{l(ki).author&&Ge(Ut)})}var Li=v(yi,2);{var qi=Ge=>{var Pt=_J(),Yt=m(Pt);z(gt=>{gn(Pt,"title",l(ki).date),N(Yt,gt)},[()=>U(l(ki).date)]),D(Ge,Pt)};O(Li,Ge=>{l(ki).date&&Ge(qi)})}var Gi=v(Li,2);{var K=Ge=>{var Pt=bJ(),Yt=m(Pt);z(()=>N(Yt,l(ki).description)),D(Ge,Pt)};O(Gi,Ge=>{l(ki).description&&Ge(K)})}var Ae=v(yn,2),ot=m(Ae);z(()=>{gn(mn,"href",l(ki).url??`https://www.npmjs.com/package/${l(ki).name}`),N(_n,l(ki).name),N(Xt,l(ki).version),Ae.disabled=!!b[l(ki).name],N(ot,b[l(ki).name]?"Installing…":"Install")}),j("click",Ae,()=>J(l(ki).name)),D(Ti,bi)}),D(ft,qt)};O(Fi,ft=>{l(d).length>0&&ft(mi)})}var ln=v(Fi,2);{var sn=ft=>{var qt=yJ(),Ti=m(qt);z(()=>N(Ti,l(C))),D(ft,qt)};O(ln,ft=>{l(C)&&ft(sn)})}var dn=v(ln,2);{var bn=ft=>{var qt=wJ();D(ft,qt)};O(dn,ft=>{!l(d).length&&!l(C)&&ft(bn)})}z(()=>{N(ht,l(t).length),st.disabled=l(r),rt=Dt(vt,0,"svelte-twakcj",null,rt,{spinning:l(r)}),Vt.disabled=l(g),N(Ai,l(g)?"Searching…":"Search")}),j("click",st,P),yt(ui,()=>l(i),ft=>x(i,ft)),j("keydown",ii,ft=>ft.key==="Enter"&&V()),yt(ii,()=>l(a),ft=>x(a,ft)),j("click",Vt,V),D(o,Se),Xs()}lo(["click","keydown"]);var AJ=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>'),Ha=F('<div class="err svelte-3itf14"> </div>'),kJ=F('<div class="empty svelte-3itf14">No users found.</div>'),BJ=F('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),Zh=F("<option> </option>"),Qx=F('<div class="inline-err svelte-3itf14"> </div>'),X2=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),FJ=F('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove from group">×</button></span>'),LJ=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),IJ=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>'),PJ=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>'),TJ=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>'),MJ=F('<div class="empty svelte-3itf14">No roles found.</div>'),RJ=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>'),NJ=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>'),OJ=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>'),HJ=F('<div class="empty svelte-3itf14">No groups found.</div>'),WJ=F('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove member">×</button></span>'),zJ=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),VJ=F('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),jJ=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>'),$J=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>'),UJ=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>'),Y2=F('<div class="empty svelte-3itf14">Loading…</div>'),qJ=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>'),GJ=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>'),KJ=F('<div class="anon-current svelte-3itf14">Current: <span class="mono svelte-3itf14"> </span></div>'),ZJ=F('<div class="anon-current muted svelte-3itf14">No anonymous group configured.</div>'),XJ=F('<div class="anon-row svelte-3itf14"><select class="svelte-3itf14"><option>— none —</option><!></select> <button class="svelte-3itf14"> </button></div> <!>',1),YJ=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>'),QJ=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>'),JJ=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>'),eee=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>'),tee=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="btn-rm svelte-3itf14">✕</button></td></tr>'),iee=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>'),nee=F('<div class="empty svelte-3itf14">No ACL rules yet.</div>'),see=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"/> <span class="acl-checkmark svelte-3itf14"></span> Allow</label> <button class="svelte-3itf14">Add</button></div> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Close</button></div></div></div>'),oee=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>'),ree=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 aee(o,e){Zs(e,!0);let t=Ku(e,"dynsecReady",3,!1),i,n=B(_i([])),s=B(_i([])),r=B(_i([])),a=B(""),d=B(""),u=B(""),f=B("users"),g=B(null),p=B(""),C=B(""),b=B(!1);const E=At(()=>l(g)?l(g).kind==="user-roles"?l(s).map($=>$.rolename).filter($=>{var ue,Ce;return!((Ce=(ue=l(n).find(_e=>_e.username===l(g).target))==null?void 0:ue.roles)!=null&&Ce.some(_e=>_e.rolename===$))}):l(g).kind==="user-groups"?l(r).map($=>$.groupname).filter($=>{var ue,Ce;return!((Ce=(ue=l(n).find(_e=>_e.username===l(g).target))==null?void 0:ue.groups)!=null&&Ce.some(_e=>_e.groupname===$))}):l(g).kind==="group-members"?l(n).map($=>$.username).filter($=>{var ue,Ce;return!((Ce=(ue=l(r).find(_e=>_e.groupname===l(g).target))==null?void 0:ue.clients)!=null&&Ce.some(_e=>_e.username===$))}):l(s).map($=>$.rolename).filter($=>{var ue,Ce;return!((Ce=(ue=l(r).find(_e=>_e.groupname===l(g).target))==null?void 0:ue.roles)!=null&&Ce.some(_e=>_e.rolename===$))}):[]);function y($,ue){x(g,{kind:$,target:ue},!0),x(p,""),x(C,"")}async function A(){if(!(!l(g)||!l(p))){x(b,!0),x(C,"");try{const{kind:$,target:ue}=l(g);$==="user-roles"?await NU(ue,l(p)):$==="user-groups"?await g2(l(p),ue):$==="group-members"?await g2(ue,l(p)):await qU(ue,l(p)),x(g,null),x(p,""),await mi()}catch($){x(C,$.message,!0)}finally{x(b,!1)}}}async function I($,ue){try{await OU($,ue),await mi()}catch(Ce){x(a,Ce.message,!0)}}async function M($,ue){try{await p2(ue,$),await mi()}catch(Ce){x(a,Ce.message,!0)}}async function R($,ue){try{await p2($,ue),await mi()}catch(Ce){x(u,Ce.message,!0)}}async function P($,ue){try{await GU($,ue),await mi()}catch(Ce){x(u,Ce.message,!0)}}let V=B(!1),U=B(""),J=B(""),re=B(!1),ae=B(""),ie=B(!1),ve=B(!1),Se=B(""),Q=B(""),he=B(""),De=B(!1),Fe=B(!1),ge=B(""),Ne=B(""),Oe=B(!1),pe=B(null),lt=B(!1),Ot=B("publishClientSend"),Xe=B(""),ht=B(!0),me=B(""),Be=B(!1),st=B(""),vt=B(""),rt=B(!1),wt=B(_i([])),ui=B(""),ci=B(!1),hi=B(null),Ct=B(""),ai=B(""),Re=B(!1),Ee=B(!1);const zt=[{acltype:"publishClientSend",label:"Publish (send)"},{acltype:"publishClientReceive",label:"Publish (receive)"},{acltype:"subscribe",label:"Subscribe"},{acltype:"unsubscribe",label:"Unsubscribe"}];async function ii(){var $,ue;x(Ee,!1),x(ui,""),x(ai,"");try{const[Ce,_e]=await Promise.allSettled([KU(),YU()]);if(Ce.status==="fulfilled"){const Je=Object.fromEntries(Ce.value.acls.map(Ve=>[Ve.acltype,Ve.allow]));x(wt,zt.map(({acltype:Ve})=>({acltype:Ve,allow:Je[Ve]??(Ve==="publishClientReceive"||Ve==="unsubscribe")})),!0)}else x(ui,(($=Ce.reason)==null?void 0:$.message)??"Failed to load default ACLs",!0);_e.status==="fulfilled"?(x(hi,_e.value.group,!0),x(Ct,_e.value.group??"",!0)):x(ai,((ue=_e.reason)==null?void 0:ue.message)??"Failed to load anonymous group",!0)}finally{x(Ee,!0)}}async function Vt($,ue){x(wt,l(wt).map(Ce=>Ce.acltype===$?{...Ce,allow:ue}:Ce),!0),x(ci,!0),x(ui,"");try{await ZU(l(wt))}catch(Ce){x(ui,Ce.message,!0)}finally{x(ci,!1)}}async function Ai(){x(Re,!0),x(ai,"");try{await QU(l(Ct)||null),x(hi,l(Ct)||null,!0)}catch($){x(ai,$.message,!0)}finally{x(Re,!1)}}const Fi=["publishClientSend","publishClientReceive","subscribeLiteral","subscribePattern","unsubscribeLiteral","unsubscribePattern"];async function mi(){var $,ue,Ce;try{const[_e,Je,Ve]=await Promise.allSettled([PU(),BF(),jU()]);_e.status==="fulfilled"?(x(n,_e.value.users,!0),x(a,"")):x(a,(($=_e.reason)==null?void 0:$.message)??"Failed to load users",!0),Je.status==="fulfilled"?(x(s,Je.value.roles,!0),x(d,"")):x(d,((ue=Je.reason)==null?void 0:ue.message)??"Failed to load roles",!0),Ve.status==="fulfilled"?(x(r,Ve.value.groups,!0),x(u,"")):x(u,((Ce=Ve.reason)==null?void 0:Ce.message)??"Failed to load groups",!0)}catch{}}oo(()=>{mi()});async function ln(){x(ae,""),x(ie,!0);try{await TU(l(U),l(J)),x(U,""),x(J,""),x(V,!1),await mi()}catch($){x(ae,$.message??"Failed to create user",!0)}finally{x(ie,!1)}}async function sn($){if(await i.show(`Delete user “${$}”?`,{confirm:"Delete",danger:!0}))try{await MU($),await mi()}catch(ue){x(a,ue.message,!0)}}async function dn($){x(Se,$,!0),x(Q,""),x(he,""),x(ve,!0)}async function bn(){x(he,""),x(De,!0);try{await RU(l(Se),l(Q)),x(ve,!1)}catch($){x(he,$.message,!0)}finally{x(De,!1)}}async function ft(){x(Ne,""),x(Oe,!0);try{await HU(l(ge)),x(ge,""),x(Fe,!1),await mi()}catch($){x(Ne,$.message??"Failed to create role",!0)}finally{x(Oe,!1)}}async function qt($){var ue;if(await i.show(`Delete role “${$}”?`,{confirm:"Delete",danger:!0}))try{await WU($),((ue=l(pe))==null?void 0:ue.rolename)===$&&(x(pe,null),x(lt,!1)),await mi()}catch(Ce){x(d,Ce.message,!0)}}function Ti($){x(pe,$,!0),x(lt,!0),x(Ot,"publishClientSend"),x(Xe,""),x(ht,!0),x(me,"")}async function ki(){if(l(pe)){x(me,"");try{await zU(l(pe).rolename,{acltype:l(Ot),topic:l(Xe),allow:l(ht)}),x(Xe,""),await mi(),x(pe,l(s).find($=>$.rolename===l(pe).rolename)??l(pe),!0)}catch($){x(me,$.message,!0)}}}async function bi($,ue,Ce){try{await VU($,ue,Ce),await mi(),x(pe,l(s).find(_e=>_e.rolename===$)??l(pe),!0)}catch(_e){x(me,_e.message,!0)}}async function yn(){x(vt,""),x(rt,!0);try{await $U(l(st)),x(st,""),x(Be,!1),await mi()}catch($){x(vt,$.message??"Failed to create group",!0)}finally{x(rt,!1)}}async function mn($){if(await i.show(`Delete group “${$}”?`,{confirm:"Delete",danger:!0}))try{await UU($),await mi()}catch(ue){x(u,ue.message,!0)}}var _n=ree(),qe=dt(_n),Xt=m(qe);{var yi=$=>{var ue=AJ();D($,ue)};O(Xt,$=>{t()||$(yi)})}var Ut=v(Xt,2),Li=m(Ut);let qi;var Gi=v(Li,2);let K;var Ae=v(Gi,2);let ot;var Ge=v(Ae,2);let Pt;var Yt=v(Ge,2),gt=v(Ut,2);{var et=$=>{var ue=TJ(),Ce=m(ue),_e=v(m(Ce),2),Je=v(Ce,2);{var Ve=H=>{var Y=Ha(),ne=m(Y);z(()=>N(ne,l(a))),D(H,Y)};O(Je,H=>{l(a)&&H(Ve)})}var St=v(Je,2);{var q=H=>{var Y=kJ();D(H,Y)},T=H=>{var Y=PJ(),ne=v(m(Y));ti(ne,21,()=>l(n),zi,(le,oe)=>{var ye=IJ(),We=m(ye),be=m(We),Le=v(We),Me=m(Le),nt=m(Me),Jt=m(nt);ti(Jt,17,()=>l(oe).roles??[],zi,(Mt,Kt)=>{var Ze=BJ(),Et=m(Ze),Zt=v(Et);z(()=>N(Et,l(Kt).rolename)),j("click",Zt,()=>I(l(oe).username,l(Kt).rolename)),D(Mt,Ze)});var ee=v(Jt,2),de=v(nt,2);{var $e=Mt=>{var Kt=X2(),Ze=dt(Kt),Et=m(Ze),Zt=m(Et);Zt.value=Zt.__value="";var ji=v(Zt);ti(ji,17,()=>l(E),zi,($i,Hi)=>{var we=Zh(),it=m(we),ut={};z(()=>{N(it,l(Hi)),ut!==(ut=l(Hi))&&(we.value=(we.__value=l(Hi))??"")}),D($i,we)});var Wt=v(Et,2),$t=v(Wt,2),wi=v(Ze,2);{var Xi=$i=>{var Hi=Qx(),we=m(Hi);z(()=>N(we,l(C))),D($i,Hi)};O(wi,$i=>{l(C)&&$i(Xi)})}z(()=>Wt.disabled=!l(p)||l(b)),$s(Et,()=>l(p),$i=>x(p,$i)),j("click",Wt,A),j("click",$t,()=>x(g,null)),D(Mt,Kt)};O(de,Mt=>{var Kt;((Kt=l(g))==null?void 0:Kt.kind)==="user-roles"&&l(g).target===l(oe).username&&Mt($e)})}var Ft=v(Le),je=m(Ft),ze=m(je),kt=m(ze);ti(kt,17,()=>l(oe).groups??[],zi,(Mt,Kt)=>{var Ze=FJ(),Et=m(Ze),Zt=v(Et);z(()=>N(Et,l(Kt).groupname)),j("click",Zt,()=>M(l(oe).username,l(Kt).groupname)),D(Mt,Ze)});var ct=v(kt,2),Qe=v(ze,2);{var mt=Mt=>{var Kt=LJ(),Ze=dt(Kt),Et=m(Ze),Zt=m(Et);Zt.value=Zt.__value="";var ji=v(Zt);ti(ji,17,()=>l(E),zi,($i,Hi)=>{var we=Zh(),it=m(we),ut={};z(()=>{N(it,l(Hi)),ut!==(ut=l(Hi))&&(we.value=(we.__value=l(Hi))??"")}),D($i,we)});var Wt=v(Et,2),$t=v(Wt,2),wi=v(Ze,2);{var Xi=$i=>{var Hi=Qx(),we=m(Hi);z(()=>N(we,l(C))),D($i,Hi)};O(wi,$i=>{l(C)&&$i(Xi)})}z(()=>Wt.disabled=!l(p)||l(b)),$s(Et,()=>l(p),$i=>x(p,$i)),j("click",Wt,A),j("click",$t,()=>x(g,null)),D(Mt,Kt)};O(Qe,Mt=>{var Kt;((Kt=l(g))==null?void 0:Kt.kind)==="user-groups"&&l(g).target===l(oe).username&&Mt(mt)})}var _t=v(Ft),tt=m(_t),Bt=m(tt),ei=v(Bt,2);z(()=>N(be,l(oe).username)),j("click",ee,()=>y("user-roles",l(oe).username)),j("click",ct,()=>y("user-groups",l(oe).username)),j("click",Bt,()=>dn(l(oe).username)),j("click",ei,()=>sn(l(oe).username)),D(le,ye)}),D(H,Y)};O(St,H=>{l(n).length===0?H(q):H(T,-1)})}j("click",_e,()=>{x(V,!0),x(ae,"")}),D($,ue)};O(gt,$=>{l(f)==="users"&&$(et)})}var X=v(gt,2);{var Pe=$=>{var ue=OJ(),Ce=m(ue),_e=v(m(Ce),2),Je=v(Ce,2);{var Ve=H=>{var Y=Ha(),ne=m(Y);z(()=>N(ne,l(d))),D(H,Y)};O(Je,H=>{l(d)&&H(Ve)})}var St=v(Je,2);{var q=H=>{var Y=MJ();D(H,Y)},T=H=>{var Y=NJ(),ne=v(m(Y));ti(ne,21,()=>l(s),zi,(le,oe)=>{var ye=RJ(),We=m(ye),be=m(We),Le=v(We),Me=m(Le),nt=v(Le),Jt=m(nt),ee=m(Jt),de=v(ee,2);z(()=>{var $e;N(be,l(oe).rolename),N(Me,(($e=l(oe).acls)==null?void 0:$e.length)??0)}),j("click",ee,()=>Ti(l(oe))),j("click",de,()=>qt(l(oe).rolename)),D(le,ye)}),D(H,Y)};O(St,H=>{l(s).length===0?H(q):H(T,-1)})}j("click",_e,()=>{x(Fe,!0),x(Ne,""),x(ge,"")}),D($,ue)};O(X,$=>{l(f)==="roles"&&$(Pe)})}var ce=v(X,2);{var fe=$=>{var ue=UJ(),Ce=m(ue),_e=v(m(Ce),2),Je=v(Ce,2);{var Ve=H=>{var Y=Ha(),ne=m(Y);z(()=>N(ne,l(u))),D(H,Y)};O(Je,H=>{l(u)&&H(Ve)})}var St=v(Je,2);{var q=H=>{var Y=HJ();D(H,Y)},T=H=>{var Y=$J(),ne=v(m(Y));ti(ne,21,()=>l(r),zi,(le,oe)=>{var ye=jJ(),We=m(ye),be=m(We),Le=v(We),Me=m(Le),nt=m(Me),Jt=m(nt);ti(Jt,17,()=>l(oe).clients??[],zi,(ei,Mt)=>{var Kt=WJ(),Ze=m(Kt),Et=v(Ze);z(()=>N(Ze,l(Mt).username)),j("click",Et,()=>R(l(oe).groupname,l(Mt).username)),D(ei,Kt)});var ee=v(Jt,2),de=v(nt,2);{var $e=ei=>{var Mt=zJ(),Kt=dt(Mt),Ze=m(Kt),Et=m(Ze);Et.value=Et.__value="";var Zt=v(Et);ti(Zt,17,()=>l(E),zi,(Xi,$i)=>{var Hi=Zh(),we=m(Hi),it={};z(()=>{N(we,l($i)),it!==(it=l($i))&&(Hi.value=(Hi.__value=l($i))??"")}),D(Xi,Hi)});var ji=v(Ze,2),Wt=v(ji,2),$t=v(Kt,2);{var wi=Xi=>{var $i=Qx(),Hi=m($i);z(()=>N(Hi,l(C))),D(Xi,$i)};O($t,Xi=>{l(C)&&Xi(wi)})}z(()=>ji.disabled=!l(p)||l(b)),$s(Ze,()=>l(p),Xi=>x(p,Xi)),j("click",ji,A),j("click",Wt,()=>x(g,null)),D(ei,Mt)};O(de,ei=>{var Mt;((Mt=l(g))==null?void 0:Mt.kind)==="group-members"&&l(g).target===l(oe).groupname&&ei($e)})}var Ft=v(Le),je=m(Ft),ze=m(je),kt=m(ze);ti(kt,17,()=>l(oe).roles??[],zi,(ei,Mt)=>{var Kt=VJ(),Ze=m(Kt),Et=v(Ze);z(()=>N(Ze,l(Mt).rolename)),j("click",Et,()=>P(l(oe).groupname,l(Mt).rolename)),D(ei,Kt)});var ct=v(kt,2),Qe=v(ze,2);{var mt=ei=>{var Mt=X2(),Kt=dt(Mt),Ze=m(Kt),Et=m(Ze);Et.value=Et.__value="";var Zt=v(Et);ti(Zt,17,()=>l(E),zi,(Xi,$i)=>{var Hi=Zh(),we=m(Hi),it={};z(()=>{N(we,l($i)),it!==(it=l($i))&&(Hi.value=(Hi.__value=l($i))??"")}),D(Xi,Hi)});var ji=v(Ze,2),Wt=v(ji,2),$t=v(Kt,2);{var wi=Xi=>{var $i=Qx(),Hi=m($i);z(()=>N(Hi,l(C))),D(Xi,$i)};O($t,Xi=>{l(C)&&Xi(wi)})}z(()=>ji.disabled=!l(p)||l(b)),$s(Ze,()=>l(p),Xi=>x(p,Xi)),j("click",ji,A),j("click",Wt,()=>x(g,null)),D(ei,Mt)};O(Qe,ei=>{var Mt;((Mt=l(g))==null?void 0:Mt.kind)==="group-roles"&&l(g).target===l(oe).groupname&&ei(mt)})}var _t=v(Ft),tt=m(_t),Bt=m(tt);z(()=>N(be,l(oe).groupname)),j("click",ee,()=>y("group-members",l(oe).groupname)),j("click",ct,()=>y("group-roles",l(oe).groupname)),j("click",Bt,()=>mn(l(oe).groupname)),D(le,ye)}),D(H,Y)};O(St,H=>{l(r).length===0?H(q):H(T,-1)})}j("click",_e,()=>{x(Be,!0),x(vt,""),x(st,"")}),D($,ue)};O(ce,$=>{l(f)==="groups"&&$(fe)})}var Gt=v(ce,2);{var ni=$=>{var ue=YJ(),Ce=m(ue),_e=v(m(Ce),4);{var Je=ye=>{var We=Ha(),be=m(We);z(()=>N(be,l(ui))),D(ye,We)};O(_e,ye=>{l(ui)&&ye(Je)})}var Ve=v(_e,2);{var St=ye=>{var We=Y2();D(ye,We)},q=ye=>{var We=GJ(),be=v(m(We));ti(be,21,()=>zt,zi,(Le,Me)=>{let nt=()=>l(Me).acltype,Jt=()=>l(Me).label;const ee=At(()=>l(wt).find(mt=>mt.acltype===nt()));var de=qJ();let $e;var Ft=m(de),je=m(Ft),ze=v(Ft),kt=m(ze),ct=v(ze),Qe=m(ct);z(()=>{var mt,_t;$e=Dt(de,1,"svelte-3itf14",null,$e,{saving:l(ci)}),N(je,Jt()),gn(kt,"name",nt()),vr(kt,((mt=l(ee))==null?void 0:mt.allow)===!0),gn(Qe,"name",nt()),vr(Qe,((_t=l(ee))==null?void 0:_t.allow)===!1)}),j("change",kt,()=>Vt(nt(),!0)),j("change",Qe,()=>Vt(nt(),!1)),D(Le,de)}),D(ye,We)};O(Ve,ye=>{l(Ee)?ye(q,-1):ye(St)})}var T=v(Ce,2),H=v(m(T),4);{var Y=ye=>{var We=Ha(),be=m(We);z(()=>N(be,l(ai))),D(ye,We)};O(H,ye=>{l(ai)&&ye(Y)})}var ne=v(H,2);{var le=ye=>{var We=Y2();D(ye,We)},oe=ye=>{var We=XJ(),be=dt(We),Le=m(be),Me=m(Le);Me.value=Me.__value="";var nt=v(Me);ti(nt,17,()=>l(r),zi,(je,ze)=>{var kt=Zh(),ct=m(kt),Qe={};z(()=>{N(ct,l(ze).groupname),Qe!==(Qe=l(ze).groupname)&&(kt.value=(kt.__value=l(ze).groupname)??"")}),D(je,kt)});var Jt=v(Le,2),ee=m(Jt),de=v(be,2);{var $e=je=>{var ze=KJ(),kt=v(m(ze)),ct=m(kt);z(()=>N(ct,l(hi))),D(je,ze)},Ft=je=>{var ze=ZJ();D(je,ze)};O(de,je=>{l(hi)?je($e):je(Ft,-1)})}z(()=>{Jt.disabled=l(Re)||l(Ct)===(l(hi)??""),N(ee,l(Re)?"Saving…":"Save")}),$s(Le,()=>l(Ct),je=>x(Ct,je)),j("click",Jt,Ai),D(ye,We)};O(ne,ye=>{l(Ee)?ye(oe,-1):ye(le)})}D($,ue)};O(Gt,$=>{l(f)==="settings"&&$(ni)})}var gi=v(qe,2);{var fi=$=>{var ue=QJ(),Ce=m(ue),_e=v(m(Ce),2),Je=v(m(_e)),Ve=v(_e,2),St=v(m(Ve)),q=m(St),T=v(q,2),H=m(T),Y=v(Ve,2);{var ne=be=>{var Le=Ha(),Me=m(Le);z(()=>N(Me,l(ae))),D(be,Le)};O(Y,be=>{l(ae)&&be(ne)})}var le=v(Y,2),oe=m(le),ye=v(oe,2),We=m(ye);z(()=>{gn(q,"type",l(re)?"text":"password"),N(H,l(re)?"Hide":"Show"),ye.disabled=l(ie)||!l(U)||!l(J),N(We,l(ie)?"Creating…":"Create")}),yt(Je,()=>l(U),be=>x(U,be)),yt(q,()=>l(J),be=>x(J,be)),j("click",T,()=>x(re,!l(re))),j("click",oe,()=>x(V,!1)),j("click",ye,ln),D($,ue)};O(gi,$=>{l(V)&&$(fi)})}var Ii=v(gi,2);{var pi=$=>{var ue=JJ(),Ce=m(ue),_e=m(Ce),Je=v(m(_e)),Ve=m(Je),St=v(_e,2),q=v(m(St)),T=v(St,2);{var H=ye=>{var We=Ha(),be=m(We);z(()=>N(be,l(he))),D(ye,We)};O(T,ye=>{l(he)&&ye(H)})}var Y=v(T,2),ne=m(Y),le=v(ne,2),oe=m(le);z(()=>{N(Ve,l(Se)),le.disabled=l(De)||!l(Q),N(oe,l(De)?"Saving…":"Set password")}),yt(q,()=>l(Q),ye=>x(Q,ye)),j("click",ne,()=>x(ve,!1)),j("click",le,bn),D($,ue)};O(Ii,$=>{l(ve)&&$(pi)})}var Ci=v(Ii,2);{var He=$=>{var ue=eee(),Ce=m(ue),_e=v(m(Ce),2),Je=v(m(_e)),Ve=v(_e,2);{var St=ne=>{var le=Ha(),oe=m(le);z(()=>N(oe,l(Ne))),D(ne,le)};O(Ve,ne=>{l(Ne)&&ne(St)})}var q=v(Ve,2),T=m(q),H=v(T,2),Y=m(H);z(()=>{H.disabled=l(Oe)||!l(ge),N(Y,l(Oe)?"Creating…":"Create")}),yt(Je,()=>l(ge),ne=>x(ge,ne)),j("click",T,()=>x(Fe,!1)),j("click",H,ft),D($,ue)};O(Ci,$=>{l(Fe)&&$(He)})}var Ye=v(Ci,2);{var jt=$=>{var ue=see(),Ce=m(ue),_e=m(Ce),Je=v(m(_e)),Ve=m(Je),St=v(_e,2);{var q=nt=>{var Jt=iee(),ee=v(m(Jt));ti(ee,21,()=>l(pe).acls??[],zi,(de,$e)=>{var Ft=tee(),je=m(Ft),ze=m(je),kt=v(je),ct=m(kt),Qe=v(kt),mt=m(Qe),_t=v(Qe),tt=m(_t);z(()=>{N(ze,l($e).acltype),N(ct,l($e).topic),N(mt,l($e).allow?"✓":"✗")}),j("click",tt,()=>bi(l(pe).rolename,l($e).acltype,l($e).topic)),D(de,Ft)}),D(nt,Jt)},T=nt=>{var Jt=nee();D(nt,Jt)};O(St,nt=>{var Jt;(((Jt=l(pe).acls)==null?void 0:Jt.length)??0)>0?nt(q):nt(T,-1)})}var H=v(St,2),Y=m(H);ti(Y,21,()=>Fi,zi,(nt,Jt)=>{var ee=Zh(),de=m(ee),$e={};z(()=>{N(de,l(Jt)),$e!==($e=l(Jt))&&(ee.value=(ee.__value=l(Jt))??"")}),D(nt,ee)});var ne=v(Y,2),le=v(ne,2),oe=m(le),ye=v(le,2),We=v(H,2);{var be=nt=>{var Jt=Ha(),ee=m(Jt);z(()=>N(ee,l(me))),D(nt,Jt)};O(We,nt=>{l(me)&&nt(be)})}var Le=v(We,2),Me=m(Le);z(()=>{N(Ve,l(pe).rolename),ye.disabled=!l(Xe)}),$s(Y,()=>l(Ot),nt=>x(Ot,nt)),yt(ne,()=>l(Xe),nt=>x(Xe,nt)),Ms(oe,()=>l(ht),nt=>x(ht,nt)),j("click",ye,ki),j("click",Me,()=>x(lt,!1)),D($,ue)};O(Ye,$=>{l(lt)&&l(pe)&&$(jt)})}var Qt=v(Ye,2);{var Mi=$=>{var ue=oee(),Ce=m(ue),_e=v(m(Ce),2),Je=v(m(_e)),Ve=v(_e,2);{var St=ne=>{var le=Ha(),oe=m(le);z(()=>N(oe,l(vt))),D(ne,le)};O(Ve,ne=>{l(vt)&&ne(St)})}var q=v(Ve,2),T=m(q),H=v(T,2),Y=m(H);z(()=>{H.disabled=l(rt)||!l(st),N(Y,l(rt)?"Creating…":"Create")}),yt(Je,()=>l(st),ne=>x(st,ne)),j("click",T,()=>x(Be,!1)),j("click",H,yn),D($,ue)};O(Qt,$=>{l(Be)&&$(Mi)})}var oi=v(Qt,2);ks(gl(oi,{}),$=>i=$,()=>i),z(()=>{qi=Dt(Li,1,"svelte-3itf14",null,qi,{active:l(f)==="users"}),K=Dt(Gi,1,"svelte-3itf14",null,K,{active:l(f)==="roles"}),ot=Dt(Ae,1,"svelte-3itf14",null,ot,{active:l(f)==="groups"}),Pt=Dt(Ge,1,"svelte-3itf14",null,Pt,{active:l(f)==="settings"})}),j("click",Li,()=>x(f,"users")),j("click",Gi,()=>x(f,"roles")),j("click",Ae,()=>x(f,"groups")),j("click",Ge,()=>{x(f,"settings"),l(Ee)||ii()}),j("click",Yt,mi),D(o,_n),Xs()}lo(["click","change"]);var Q2=F('<div class="err svelte-9i68x"> </div>'),lee=F('<div class="ok svelte-9i68x">Saved.</div>'),cee=F('<div class="reload-msg svelte-9i68x"> </div>'),dee=F('<div class="loading svelte-9i68x">Loading…</div>'),uee=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>'),hee=F("<option></option>"),fee=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"/> <span class="checkmark svelte-9i68x"></span> Require client certificate (require_certificate)</label> <label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> Use cert CN as username (use_identity_as_username)</label></div></div>'),gee=F('<div class="field-row svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> Use cert Subject as username (use_subject_as_username)</label></div>'),pee=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>'),xee=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>'),vee=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"/> <span class="checkmark svelte-9i68x"></span> TLS</label></div> <datalist></datalist> <!> <button class="advanced-btn svelte-9i68x"> </button> <!> <!></div>'),mee=F('<div class="empty svelte-9i68x">No listeners configured. Click "+ Add listener" to create one.</div>'),_ee=F('<div class="global-settings svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> <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),bee=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 Cee(o,e){Zs(e,!0);let t=B(null),i=B(""),n=B(!1),s=B(""),r=B(!1),a=B(!1),d=B(""),u=B(_i([])),f=B(null),g=B(!1),p=B(""),C=B(_i([])),b=B(_i(new Set));oo(()=>{E(),bU().then(me=>{x(C,me.addresses,!0)}).catch(()=>{})});async function E(){try{x(t,await dx(),!0),x(u,JSON.parse(JSON.stringify(l(t).listeners)),!0),x(f,l(t).checksum,!0);const me=l(t).managed.allow_anonymous;x(p,me==="true"||me==="false"?me:"",!0),x(g,l(t).managed.per_listener_settings==="true"),x(i,"")}catch(me){x(i,me.message??"Failed to load broker config",!0)}}function y(){x(u,[...l(u),{port:1883,bindAddress:"",protocol:"mqtt",tls:{}}],!0),x(b,new Set(l(b)),!0)}function A(me){const Be=new Set(l(b));Be.has(me)?Be.delete(me):Be.add(me),x(b,Be,!0)}function I(me){x(u,l(u).filter((Be,st)=>st!==me),!0)}async function M(){if(l(t)){x(n,!0),x(s,""),x(r,!1);try{const me={...l(t).managed};l(g)?(me.per_listener_settings="true",delete me.allow_anonymous):(delete me.per_listener_settings,l(p)?me.allow_anonymous=l(p):delete me.allow_anonymous),await kF({listeners:l(u),managed:me,passthrough:l(t).passthrough,checksum:l(f)}),x(r,!0),setTimeout(()=>x(r,!1),3e3),await E()}catch(me){x(s,me.message??"Save failed",!0)}finally{x(n,!1)}}}async function R(){x(a,!0),x(d,"");try{const me=await Vb();x(d,me.stderr||me.stdout||"Reloaded",!0)}catch(me){x(d,"Error: "+(me.message??"reload failed"))}finally{x(a,!1)}}function P(me){var Be,st,vt,rt,wt;return!!((Be=me.tls)!=null&&Be.enabled||(st=me.tls)!=null&&st.certfile||(vt=me.tls)!=null&&vt.keyfile||(rt=me.tls)!=null&&rt.capath||(wt=me.tls)!=null&&wt.cafile)}function V(me,Be){Be?me.tls={...me.tls,enabled:!0}:me.tls={},x(u,[...l(u)],!0)}var U=bee(),J=m(U),re=v(m(J),2),ae=m(re),ie=v(ae,2),ve=m(ie),Se=v(ie,2),Q=m(Se),he=v(J,2);{var De=me=>{var Be=Q2(),st=m(Be);z(()=>N(st,l(i))),D(me,Be)};O(he,me=>{l(i)&&me(De)})}var Fe=v(he,2);{var ge=me=>{var Be=Q2(),st=m(Be);z(()=>N(st,l(s))),D(me,Be)};O(Fe,me=>{l(s)&&me(ge)})}var Ne=v(Fe,2);{var Oe=me=>{var Be=lee();D(me,Be)};O(Ne,me=>{l(r)&&me(Oe)})}var pe=v(Ne,2);{var lt=me=>{var Be=cee(),st=m(Be);z(()=>N(st,l(d))),D(me,Be)};O(pe,me=>{l(d)&&me(lt)})}var Ot=v(pe,2);{var Xe=me=>{var Be=dee();D(me,Be)},ht=me=>{var Be=_ee(),st=dt(Be),vt=m(st),rt=m(vt),wt=v(vt,2);{var ui=Re=>{var Ee=uee(),zt=v(m(Ee),2),ii=m(zt);ii.value=ii.__value="";var Vt=v(ii);Vt.value=Vt.__value="true";var Ai=v(Vt);Ai.value=Ai.__value="false",$s(zt,()=>l(p),Fi=>x(p,Fi)),D(Re,Ee)};O(wt,Re=>{l(g)||Re(ui)})}var ci=v(st,2),hi=m(ci);ti(hi,17,()=>l(u),zi,(Re,Ee,zt)=>{var ii=vee(),Vt=m(ii),Ai=m(Vt),Fi=m(Ai),mi=v(Ai,2),ln=v(Vt,2),sn=m(ln),dn=v(m(sn)),bn=v(sn,2),ft=v(m(bn)),qt=m(ft);qt.value=qt.__value="mqtt";var Ti=v(qt);Ti.value=Ti.__value="websockets";var ki=v(bn,2),bi=v(m(ki));gn(bi,"list",`bind-addr-list-${zt}`);var yn=v(ki,2),mn=m(yn),_n=v(ln,2);gn(_n,"id",`bind-addr-list-${zt}`),ti(_n,21,()=>l(C),zi,(Ge,Pt)=>{var Yt=hee(),gt={};z(()=>{gt!==(gt=l(Pt))&&(Yt.value=(Yt.__value=l(Pt))??"")}),D(Ge,Yt)});var qe=v(_n,2);{var Xt=Ge=>{var Pt=fee(),Yt=m(Pt),gt=m(Yt),et=v(m(gt)),X=v(gt,2),Pe=v(m(X)),ce=v(Yt,2),fe=m(ce),Gt=v(m(fe)),ni=v(fe,2),gi=v(m(ni)),fi=v(ce,2),Ii=m(fi),pi=v(m(Ii)),Ci=v(Ii,2),He=v(m(Ci)),Ye=m(He);Ye.value=Ye.__value="";var jt=v(Ye);jt.value=jt.__value="tlsv1.3";var Qt=v(jt);Qt.value=Qt.__value="tlsv1.2";var Mi=v(fi,2),oi=m(Mi),$=m(oi),ue=v(oi,2),Ce=m(ue);yt(et,()=>l(Ee).tls.certfile,_e=>l(Ee).tls.certfile=_e),yt(Pe,()=>l(Ee).tls.keyfile,_e=>l(Ee).tls.keyfile=_e),yt(Gt,()=>l(Ee).tls.cafile,_e=>l(Ee).tls.cafile=_e),yt(gi,()=>l(Ee).tls.capath,_e=>l(Ee).tls.capath=_e),yt(pi,()=>l(Ee).tls.crlfile,_e=>l(Ee).tls.crlfile=_e),$s(He,()=>l(Ee).tls.tls_version,_e=>l(Ee).tls.tls_version=_e),Ms($,()=>l(Ee).tls.require_certificate,_e=>l(Ee).tls.require_certificate=_e),Ms(Ce,()=>l(Ee).tls.use_identity_as_username,_e=>l(Ee).tls.use_identity_as_username=_e),D(Ge,Pt)},yi=At(()=>P(l(Ee)));O(qe,Ge=>{l(yi)&&Ge(Xt)})}var Ut=v(qe,2),Li=m(Ut),qi=v(Ut,2);{var Gi=Ge=>{var Pt=pee(),Yt=m(Pt),gt=m(Yt),et=v(m(gt)),X=v(gt,2),Pe=v(m(X)),ce=v(X,2),fe=v(m(ce)),Gt=m(fe);Gt.value=Gt.__value="";var ni=v(Gt);ni.value=ni.__value="0";var gi=v(ni);gi.value=gi.__value="1";var fi=v(gi);fi.value=fi.__value="2";var Ii;w1(fe);var pi=v(Yt,2);{var Ci=Ye=>{var jt=gee(),Qt=m(jt),Mi=m(Qt);Ms(Mi,()=>l(Ee).tls.use_subject_as_username,oi=>l(Ee).tls.use_subject_as_username=oi),D(Ye,jt)},He=At(()=>P(l(Ee)));O(pi,Ye=>{l(He)&&Ye(Ci)})}z(Ye=>{Ii!==(Ii=Ye)&&(fe.value=(fe.__value=Ye)??"",qv(fe,Ye))},[()=>l(Ee).max_qos!==void 0?String(l(Ee).max_qos):""]),yt(et,()=>l(Ee).mount_point,Ye=>l(Ee).mount_point=Ye),yt(Pe,()=>l(Ee).max_connections,Ye=>l(Ee).max_connections=Ye),j("change",fe,Ye=>{const jt=Ye.target.value;l(Ee).max_qos=jt===""?void 0:Number(jt),x(u,[...l(u)],!0)}),D(Ge,Pt)},K=At(()=>l(b).has(zt));O(qi,Ge=>{l(K)&&Ge(Gi)})}var Ae=v(qi,2);{var ot=Ge=>{var Pt=xee(),Yt=v(m(Pt),2),gt=m(Yt),et=v(m(gt)),X=m(et);X.value=X.__value="";var Pe=v(X);Pe.value=Pe.__value="true";var ce=v(Pe);ce.value=ce.__value="false";var fe;w1(et);var Gt=v(gt,2),ni=v(m(Gt)),gi=v(Gt,2),fi=v(m(gi));z(()=>{fe!==(fe=l(Ee).allow_anonymous===void 0?"":l(Ee).allow_anonymous?"true":"false")&&(et.value=et.__value=l(Ee).allow_anonymous===void 0?"":l(Ee).allow_anonymous?"true":"false",qv(et,l(Ee).allow_anonymous===void 0?"":l(Ee).allow_anonymous?"true":"false"))}),j("change",et,Ii=>{const pi=Ii.target.value;l(Ee).allow_anonymous=pi===""?void 0:pi==="true",x(u,[...l(u)],!0)}),yt(ni,()=>l(Ee).password_file,Ii=>l(Ee).password_file=Ii),yt(fi,()=>l(Ee).acl_file,Ii=>l(Ee).acl_file=Ii),D(Ge,Pt)};O(Ae,Ge=>{l(g)&&Ge(ot)})}z((Ge,Pt)=>{N(Fi,`Port ${l(Ee).port??""}`),vr(mn,Ge),N(Li,`${Pt??""} Advanced`)},[()=>P(l(Ee)),()=>l(b).has(zt)?"▾":"▸"]),j("click",mi,()=>I(zt)),yt(dn,()=>l(Ee).port,Ge=>l(Ee).port=Ge),$s(ft,()=>l(Ee).protocol,Ge=>l(Ee).protocol=Ge),yt(bi,()=>l(Ee).bindAddress,Ge=>l(Ee).bindAddress=Ge),j("change",mn,Ge=>V(l(Ee),Ge.target.checked)),j("click",Ut,()=>A(zt)),D(Re,ii)});var Ct=v(hi,2);{var ai=Re=>{var Ee=mee();D(Re,Ee)};O(Ct,Re=>{l(u).length===0&&Re(ai)})}Ms(rt,()=>l(g),Re=>x(g,Re)),D(me,Be)};O(Ot,me=>{l(t)===null&&!l(i)?me(Xe):me(ht,-1)})}z(()=>{ie.disabled=l(n),N(ve,l(n)?"Saving…":"Save"),Se.disabled=l(a),N(Q,l(a)?"Reloading…":"Apply & Reload")}),j("click",ae,y),j("click",ie,M),j("click",Se,R),D(o,U),Xs()}lo(["click","change"]);var J2=F('<div class="err svelte-1by6o5t"> </div>'),Eee=F('<div class="ok svelte-1by6o5t">Saved.</div>'),yee=F('<div class="reload-msg svelte-1by6o5t"> </div>'),qC=F('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <span class="checkmark svelte-1by6o5t"></span> </label>'),wee=F('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <span class="checkmark svelte-1by6o5t"></span> <strong> </strong></label>'),See=F(`<div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">General</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">persistence</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — persist sessions &amp; retained msgs</option><option>false — no disk persistence</option></select></label> <p class="hint svelte-1by6o5t">Enable on-disk persistence of subscriptions, retained messages, and QoS 1/2 queues.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">persistence_location</span> <input placeholder="/var/lib/mosquitto/" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Directory where mosquitto stores its persistence data. Must be writable by the mosquitto process.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">sys_interval</span> <input type="number" placeholder="10" min="0" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Interval in seconds between <code class="svelte-1by6o5t">$SYS</code> status updates. <code class="svelte-1by6o5t">0</code> disables <code class="svelte-1by6o5t">$SYS</code> messages.</p></div></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">include_dir</span> <textarea placeholder="/etc/mosquitto/conf.d" class="svelte-1by6o5t"></textarea></label> <p class="hint svelte-1by6o5t">One path per line. Each directory will be scanned for <code class="svelte-1by6o5t">*.conf</code> files and included in order.</p></div></div> <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),Dee=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 Aee(o,e){Zs(e,!0);let t=B(null),i=B(""),n=B(!1),s=B(""),r=B(!1),a=B(!1),d=B(""),u=B(null),f=B(""),g=B(""),p=B(""),C=B(""),b=B(""),E=B(""),y=B(""),A=B(""),I=B(""),M=B(""),R=B(""),P=B(""),V=B(""),U=B("");const J=["file","stdout","stderr","syslog","topic","none"],re=["error","warning","notice","information","debug"],ae=["connect","disconnect","subscribe","unsubscribe","publish","receive","websockets"],ie=["all"];[...re,...ae,...ie];let ve=B(_i(new Set)),Se=B(_i(new Set));function Q(Re,Ee){const zt=new Set(Re);return zt.has(Ee)?zt.delete(Ee):zt.add(Ee),zt}function he(Re){if(!l(t))return"";const Ee=l(t).managed[Re];return Array.isArray(Ee)?Ee[0]:Ee??""}function De(Re){if(!l(t))return new Set;const Ee=l(t).managed[Re];return Ee?new Set(Array.isArray(Ee)?Ee:[Ee]):new Set}oo(()=>Fe());async function Fe(){try{x(t,await dx(),!0),x(u,l(t).checksum,!0),x(f,he("persistence"),!0),x(g,he("persistence_location"),!0),x(p,he("sys_interval"),!0);const Re=l(t).managed.include_dir;x(C,Re?Array.isArray(Re)?Re.join(`
231
+ `):Re:"",!0),x(b,he("max_connections"),!0),x(E,he("max_inflight_messages"),!0),x(y,he("max_queued_messages"),!0),x(A,he("max_packet_size"),!0),x(I,he("message_size_limit"),!0),x(M,he("max_keepalive"),!0),x(R,he("persistent_client_expiration"),!0),x(P,he("retain_available"),!0),x(V,he("set_tcp_nodelay"),!0),x(U,he("connection_messages"),!0),x(ve,De("log_dest"),!0),x(Se,De("log_type"),!0),x(i,"")}catch(Re){x(i,Re.message??"Failed to load config",!0)}}async function ge(){if(l(t)){x(n,!0),x(s,""),x(r,!1);try{let Ee=function(ii,Vt){Vt!==""?Re[ii]=Vt:delete Re[ii]};const Re={...l(t).managed};Ee("persistence",l(f)),Ee("persistence_location",l(g)),Ee("sys_interval",l(p));const zt=l(C).split(`
232
+ `).map(ii=>ii.trim()).filter(Boolean);zt.length>0?Re.include_dir=zt.length===1?zt[0]:zt:delete Re.include_dir,Ee("max_connections",l(b)),Ee("max_inflight_messages",l(E)),Ee("max_queued_messages",l(y)),Ee("max_packet_size",l(A)),Ee("message_size_limit",l(I)),Ee("max_keepalive",l(M)),Ee("persistent_client_expiration",l(R)),Ee("retain_available",l(P)),Ee("set_tcp_nodelay",l(V)),Ee("connection_messages",l(U)),l(ve).size>0?Re.log_dest=l(ve).size===1?[...l(ve)][0]:[...l(ve)]:delete Re.log_dest,l(Se).size>0?Re.log_type=l(Se).size===1?[...l(Se)][0]:[...l(Se)]:delete Re.log_type,await kF({listeners:l(t).listeners,managed:Re,passthrough:l(t).passthrough,checksum:l(u)}),x(r,!0),setTimeout(()=>x(r,!1),3e3),await Fe()}catch(Re){x(s,Re.message??"Save failed",!0)}finally{x(n,!1)}}}async function Ne(){x(a,!0),x(d,"");try{const Re=await Vb();x(d,Re.stderr||Re.stdout||"Reloaded",!0)}catch(Re){x(d,"Error: "+(Re.message??"reload failed"))}finally{x(a,!1)}}var Oe=Dee(),pe=m(Oe),lt=v(m(pe),2),Ot=m(lt),Xe=m(Ot),ht=v(Ot,2),me=m(ht),Be=v(pe,2);{var st=Re=>{var Ee=J2(),zt=m(Ee);z(()=>N(zt,l(i))),D(Re,Ee)};O(Be,Re=>{l(i)&&Re(st)})}var vt=v(Be,2);{var rt=Re=>{var Ee=J2(),zt=m(Ee);z(()=>N(zt,l(s))),D(Re,Ee)};O(vt,Re=>{l(s)&&Re(rt)})}var wt=v(vt,2);{var ui=Re=>{var Ee=Eee();D(Re,Ee)};O(wt,Re=>{l(r)&&Re(ui)})}var ci=v(wt,2);{var hi=Re=>{var Ee=yee(),zt=m(Ee);z(()=>N(zt,l(d))),D(Re,Ee)};O(ci,Re=>{l(d)&&Re(hi)})}var Ct=v(ci,2);{var ai=Re=>{var Ee=See(),zt=dt(Ee),ii=v(m(zt),2),Vt=m(ii),Ai=m(Vt),Fi=v(m(Ai),2),mi=m(Fi);mi.value=mi.__value="";var ln=v(mi);ln.value=ln.__value="true";var sn=v(ln);sn.value=sn.__value="false";var dn=v(Vt,2),bn=m(dn),ft=v(m(bn),2),qt=v(dn,2),Ti=m(qt),ki=v(m(Ti),2),bi=v(ii,2),yn=m(bi),mn=v(m(yn),2);gn(mn,"rows",3);var _n=v(zt,2),qe=v(m(_n),2),Xt=v(m(qe),2);ti(Xt,21,()=>J,zi,(je,ze)=>{var kt=qC(),ct=m(kt),Qe=v(ct,3);z(mt=>{vr(ct,mt),N(Qe,` ${l(ze)??""}`)},[()=>l(ve).has(l(ze))]),j("change",ct,()=>{x(ve,Q(l(ve),l(ze)),!0)}),D(je,kt)});var yi=v(qe,2),Ut=v(m(yi),2),Li=m(Ut),qi=v(m(Li),2);ti(qi,17,()=>re,zi,(je,ze)=>{var kt=qC(),ct=m(kt),Qe=v(ct,3);z(mt=>{vr(ct,mt),N(Qe,` ${l(ze)??""}`)},[()=>l(Se).has(l(ze))]),j("change",ct,()=>{x(Se,Q(l(Se),l(ze)),!0)}),D(je,kt)});var Gi=v(Li,2),K=v(m(Gi),2);ti(K,17,()=>ae,zi,(je,ze)=>{var kt=qC(),ct=m(kt),Qe=v(ct,3);z(mt=>{vr(ct,mt),N(Qe,` ${l(ze)??""}`)},[()=>l(Se).has(l(ze))]),j("change",ct,()=>{x(Se,Q(l(Se),l(ze)),!0)}),D(je,kt)});var Ae=v(Gi,2),ot=m(Ae);ti(ot,17,()=>ie,zi,(je,ze)=>{var kt=wee(),ct=m(kt),Qe=v(ct,4),mt=m(Qe);z(_t=>{vr(ct,_t),N(mt,l(ze))},[()=>l(Se).has(l(ze))]),j("change",ct,()=>{x(Se,Q(l(Se),l(ze)),!0)}),D(je,kt)});var Ge=v(_n,2),Pt=v(m(Ge),2),Yt=m(Pt),gt=m(Yt),et=v(m(gt),2),X=v(Yt,2),Pe=m(X),ce=v(m(Pe),2),fe=v(X,2),Gt=m(fe),ni=v(m(Gt),2),gi=v(fe,2),fi=m(gi),Ii=v(m(fi),2),pi=v(Ge,2),Ci=v(m(pi),2),He=m(Ci),Ye=m(He),jt=v(m(Ye),2),Qt=v(He,2),Mi=m(Qt),oi=v(m(Mi),2),$=v(pi,2),ue=v(m($),2),Ce=m(ue),_e=m(Ce),Je=v(m(_e),2),Ve=v(Ce,2),St=m(Ve),q=v(m(St),2),T=m(q);T.value=T.__value="";var H=v(T);H.value=H.__value="true";var Y=v(H);Y.value=Y.__value="false";var ne=v($,2),le=v(m(ne),2),oe=m(le),ye=m(oe),We=v(m(ye),2),be=m(We);be.value=be.__value="";var Le=v(be);Le.value=Le.__value="true";var Me=v(Le);Me.value=Me.__value="false";var nt=v(oe,2),Jt=m(nt),ee=v(m(Jt),2),de=m(ee);de.value=de.__value="";var $e=v(de);$e.value=$e.__value="true";var Ft=v($e);Ft.value=Ft.__value="false",$s(Fi,()=>l(f),je=>x(f,je)),yt(ft,()=>l(g),je=>x(g,je)),yt(ki,()=>l(p),je=>x(p,je)),yt(mn,()=>l(C),je=>x(C,je)),yt(et,()=>l(b),je=>x(b,je)),yt(ce,()=>l(M),je=>x(M,je)),yt(ni,()=>l(E),je=>x(E,je)),yt(Ii,()=>l(y),je=>x(y,je)),yt(jt,()=>l(A),je=>x(A,je)),yt(oi,()=>l(I),je=>x(I,je)),yt(Je,()=>l(R),je=>x(R,je)),$s(q,()=>l(P),je=>x(P,je)),$s(We,()=>l(V),je=>x(V,je)),$s(ee,()=>l(U),je=>x(U,je)),D(Re,Ee)};O(Ct,Re=>{l(t)&&Re(ai)})}z(()=>{Ot.disabled=l(n),N(Xe,l(n)?"Saving…":"Save"),ht.disabled=l(a),N(me,l(a)?"Reloading…":"Apply & Reload")}),j("click",Ot,ge),j("click",ht,Ne),D(o,Oe),Xs()}lo(["click","change"]);var _l=F('<div class="err svelte-9auejo"> </div>'),kee=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>'),Bee=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>'),Fee=F('<div class="empty svelte-9auejo">No trusted CA certs. Add one to enable client certificate authentication.</div>'),Lee=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>'),Iee=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>'),Pee=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>'),eA=F('<button class="btn-primary svelte-9auejo"> </button>'),Tee=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>'),Mee=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),Ree=F('<div class="ok svelte-9auejo">✓ Certificate installed.</div>'),Nee=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),Oee=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>'),Hee=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),Wee=F('<span class="file-name mono small svelte-9auejo"> </span>'),zee=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),Vee=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>'),GC=F("<option></option>"),jee=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>'),$ee=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),Uee=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),qee=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>'),Gee=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 Kee(o,e){Zs(e,!0);let t=B(null),i=B(_i([])),n=B(""),s=B(""),r=B(!1),a=B(""),d=B(""),u=B(365),f=B(!1),g=B(""),p=B(null),C=B(!1),b=B(""),E=B(""),y=B(!1),A=B(""),I=B(""),M=B(""),R=B(!1),P=B(""),V=B(!1),U=B(!1),J=B("pem"),re=B(""),ae=B(""),ie=B(""),ve=B(""),Se=B(""),Q=B(!1),he=B(!1),De=B(""),Fe=B(!1),ge=B(""),Ne=B(""),Oe=B(!1),pe=B(""),lt=B(_i([])),Ot=B(_i([])),Xe=B(!1),ht=B("pem"),me=B(""),Be=B(!1),st=B(""),vt=B(""),rt=B(_i([])),wt=B(!1),ui=B("");async function ci(){try{const[He,Ye]=await Promise.allSettled([JU(),iq()]);He.status==="fulfilled"&&x(t,He.value.server,!0),Ye.status==="fulfilled"&&x(i,Ye.value.certs,!0),x(n,"")}catch(He){x(n,He.message,!0)}}oo(()=>{ci()});async function hi(){x(g,""),x(f,!0),x(p,null);try{const He=l(d).split(",").map(jt=>jt.trim()).filter(Boolean),Ye=await eq({cn:l(a),san:He,days:l(u)});x(p,{fingerprint:Ye.fingerprint,expires:Ye.expires},!0),await ci()}catch(He){x(g,He.message,!0)}finally{x(f,!1)}}async function Ct(){x(A,""),x(y,!0),x(I,"");try{const He=l(E).split(",").map(jt=>jt.trim()).filter(Boolean),Ye=await tq({cn:l(b),san:He});x(I,Ye.csrPem,!0)}catch(He){x(A,He.message,!0)}finally{x(y,!1)}}async function ai(){x(P,""),x(R,!0),x(V,!1);try{if(!l(M).trim())throw new Error("Paste the signed certificate PEM");await VC({cert:l(M)}),x(V,!0),await ci()}catch(He){x(P,He.message,!0)}finally{x(R,!1)}}function Re(){navigator.clipboard.writeText(l(I)).catch(()=>{})}function Ee(He){var Qt;const Ye=(Qt=He.target.files)==null?void 0:Qt[0];if(!Ye)return;x(ve,Ye.name,!0);const jt=new FileReader;jt.onload=()=>{const Mi=jt.result;x(ie,btoa(String.fromCharCode(...new Uint8Array(Mi))),!0)},jt.readAsArrayBuffer(Ye)}async function zt(){x(De,""),x(he,!0);try{if(l(J)==="p12"){if(!l(ie))throw new Error("Select a .p12 / .pfx file");await VC({p12base64:l(ie),passphrase:l(Se)})}else{if(!l(re).trim())throw new Error("Certificate PEM is required");await VC({cert:l(re),key:l(ae)||void 0})}x(U,!1),await ci()}catch(He){x(De,He.message,!0)}finally{x(he,!1)}}function ii(He){let Ye;return jt=>{const Qt=jt.target.value;clearTimeout(Ye),Ye=setTimeout(async()=>{if(!Qt.startsWith("/")||Qt.length<2){He([]);return}try{He((await oq(Qt)).suggestions)}catch{He([])}},280)}}const Vt=ii(He=>{x(lt,He,!0)}),Ai=ii(He=>{x(Ot,He,!0)}),Fi=ii(He=>{x(rt,He,!0)});async function mi(){x(pe,""),x(Oe,!0);try{await rq({certPath:l(ge),keyPath:l(Ne)}),x(Fe,!1),await ci()}catch(He){x(pe,He.message,!0)}finally{x(Oe,!1)}}async function ln(){x(st,""),x(Be,!0);try{await nq(l(me)),x(me,""),x(Xe,!1),await ci()}catch(He){x(st,He.message,!0)}finally{x(Be,!1)}}async function sn(){x(ui,""),x(wt,!0);try{await aq(l(vt)),x(vt,""),x(Xe,!1),await ci()}catch(He){x(ui,He.message,!0)}finally{x(wt,!1)}}async function dn(He){if(confirm("Remove this trusted CA cert?"))try{await sq(He),await ci()}catch(Ye){x(s,Ye.message,!0)}}function bn(He){const Ye=new Date(He).getTime()-Date.now();return Ye<0?"expired":Ye<30*864e5?"expiring":""}function ft(He){return new Date(He).toLocaleDateString()}var qt=Gee(),Ti=dt(qt),ki=m(Ti),bi=m(ki),yn=v(ki,2);{var mn=He=>{var Ye=_l(),jt=m(Ye);z(()=>N(jt,l(n))),D(He,Ye)};O(yn,He=>{l(n)&&He(mn)})}var _n=v(yn,2);{var qe=He=>{var Ye=_l(),jt=m(Ye);z(()=>N(jt,l(s))),D(He,Ye)};O(_n,He=>{l(s)&&He(qe)})}var Xt=v(_n,2),yi=m(Xt),Ut=v(m(yi),2),Li=v(Ut,2),qi=v(Li,2),Gi=v(qi,2),K=v(yi,2);{var Ae=He=>{var Ye=kee(),jt=m(Ye),Qt=v(m(jt)),Mi=m(Qt),oi=v(Qt,3),$=m(oi),ue=v(oi,3),Ce=m(ue);z((_e,Je)=>{N(Mi,l(t).cn),N($,l(t).fingerprint),Dt(ue,1,_e,"svelte-9auejo"),N(Ce,Je)},[()=>Eg(bn(l(t).expires)),()=>ft(l(t).expires)]),D(He,Ye)},ot=He=>{var Ye=Bee();D(He,Ye)};O(K,He=>{l(t)?He(Ae):He(ot,-1)})}var Ge=v(Xt,2),Pt=m(Ge),Yt=v(m(Pt),2),gt=v(Pt,2);{var et=He=>{var Ye=Fee();D(He,Ye)},X=He=>{var Ye=Iee(),jt=v(m(Ye));ti(jt,21,()=>l(i),zi,(Qt,Mi)=>{var oi=Lee(),$=m(oi),ue=m($),Ce=v($),_e=m(Ce),Je=v(Ce),Ve=m(Je),St=v(Je),q=m(St);z((T,H,Y)=>{N(ue,l(Mi).cn),N(_e,`${T??""}…`),Dt(Je,1,H,"svelte-9auejo"),N(Ve,Y)},[()=>l(Mi).fingerprint.slice(0,29),()=>Eg(bn(l(Mi).expires)),()=>ft(l(Mi).expires)]),j("click",q,()=>dn(l(Mi).fingerprint)),D(Qt,oi)}),D(He,Ye)};O(gt,He=>{l(i).length===0?He(et):He(X,-1)})}var Pe=v(Ti,2);{var ce=He=>{var Ye=Tee(),jt=m(Ye),Qt=v(m(jt),2),Mi=v(m(Qt)),oi=v(Qt,2),$=v(m(oi)),ue=v(oi,2),Ce=v(m(ue)),_e=v(ue,2);{var Je=ne=>{var le=_l(),oe=m(le);z(()=>N(oe,l(g))),D(ne,le)};O(_e,ne=>{l(g)&&ne(Je)})}var Ve=v(_e,2);{var St=ne=>{var le=Pee(),oe=v(m(le),2),ye=v(m(oe)),We=m(ye),be=v(ye,2),Le=m(be);z(Me=>{N(We,l(p).fingerprint),N(Le,Me)},[()=>ft(l(p).expires)]),D(ne,le)};O(Ve,ne=>{l(p)&&ne(St)})}var q=v(Ve,2),T=m(q),H=v(T,2);{var Y=ne=>{var le=eA(),oe=m(le);z(()=>{le.disabled=l(f),N(oe,l(f)?"Generating…":"Generate")}),j("click",le,hi),D(ne,le)};O(H,ne=>{l(p)||ne(Y)})}yt(Mi,()=>l(a),ne=>x(a,ne)),yt($,()=>l(d),ne=>x(d,ne)),yt(Ce,()=>l(u),ne=>x(u,ne)),j("click",T,()=>x(r,!1)),D(He,Ye)};O(Pe,He=>{l(r)&&He(ce)})}var fe=v(Pe,2);{var Gt=He=>{var Ye=Oee(),jt=m(Ye),Qt=v(m(jt),2);{var Mi=$=>{var ue=Mee(),Ce=dt(ue),_e=v(m(Ce)),Je=v(Ce,2),Ve=v(m(Je)),St=v(Je,4);{var q=le=>{var oe=_l(),ye=m(oe);z(()=>N(ye,l(A))),D(le,oe)};O(St,le=>{l(A)&&le(q)})}var T=v(St,2),H=m(T),Y=v(H,2),ne=m(Y);z(()=>{Y.disabled=l(y),N(ne,l(y)?"Generating…":"Generate key + CSR")}),yt(_e,()=>l(b),le=>x(b,le)),yt(Ve,()=>l(E),le=>x(E,le)),j("click",H,()=>x(C,!1)),j("click",Y,Ct),D($,ue)},oi=$=>{var ue=Nee(),Ce=v(dt(ue),2),_e=v(m(Ce)),Je=v(Ce,2),Ve=m(Je),St=v(Ve,2),q=v(Je,4),T=v(m(q)),H=v(q,2);{var Y=Le=>{var Me=_l(),nt=m(Me);z(()=>N(nt,l(P))),D(Le,Me)};O(H,Le=>{l(P)&&Le(Y)})}var ne=v(H,2);{var le=Le=>{var Me=Ree();D(Le,Me)};O(ne,Le=>{l(V)&&Le(le)})}var oe=v(ne,2),ye=m(oe),We=v(ye,2);{var be=Le=>{var Me=eA(),nt=m(Me);z(Jt=>{Me.disabled=Jt,N(nt,l(R)?"Uploading…":"Upload signed cert")},[()=>l(R)||!l(M).trim()]),j("click",Me,ai),D(Le,Me)};O(We,Le=>{l(V)||Le(be)})}z(Le=>{S1(_e,l(I)),gn(St,"href",`data:application/pkcs10;charset=utf-8,${Le??""}`)},[()=>encodeURIComponent(l(I))]),j("click",Ve,Re),yt(T,()=>l(M),Le=>x(M,Le)),j("click",ye,()=>x(C,!1)),D($,ue)};O(Qt,$=>{l(I)?$(oi,-1):$(Mi)})}D(He,Ye)};O(fe,He=>{l(C)&&He(Gt)})}var ni=v(fe,2);{var gi=He=>{var Ye=Vee(),jt=m(Ye),Qt=v(m(jt),2),Mi=m(Qt);let oi;var $=v(Mi,2);let ue;var Ce=v(Qt,2);{var _e=ne=>{var le=Hee(),oe=dt(le),ye=v(m(oe)),We=v(oe,2),be=v(m(We));yt(ye,()=>l(re),Le=>x(re,Le)),yt(be,()=>l(ae),Le=>x(ae,Le)),D(ne,le)},Je=ne=>{var le=zee(),oe=dt(le),ye=v(m(oe)),We=m(ye),be=v(We,2);{var Le=$e=>{var Ft=Wee(),je=m(Ft);z(()=>N(je,l(ve))),D($e,Ft)};O(be,$e=>{l(ve)&&$e(Le)})}var Me=v(oe,2),nt=v(m(Me)),Jt=m(nt),ee=v(Jt,2),de=m(ee);z(()=>{gn(Jt,"type",l(Q)?"text":"password"),N(de,l(Q)?"Hide":"Show")}),j("change",We,Ee),yt(Jt,()=>l(Se),$e=>x(Se,$e)),j("click",ee,()=>x(Q,!l(Q))),D(ne,le)};O(Ce,ne=>{l(J)==="pem"?ne(_e):ne(Je,-1)})}var Ve=v(Ce,2);{var St=ne=>{var le=_l(),oe=m(le);z(()=>N(oe,l(De))),D(ne,le)};O(Ve,ne=>{l(De)&&ne(St)})}var q=v(Ve,2),T=m(q),H=v(T,2),Y=m(H);z(()=>{oi=Dt(Mi,1,"svelte-9auejo",null,oi,{active:l(J)==="pem"}),ue=Dt($,1,"svelte-9auejo",null,ue,{active:l(J)==="p12"}),H.disabled=l(he),N(Y,l(he)?"Importing…":"Import")}),j("click",Mi,()=>x(J,"pem")),j("click",$,()=>x(J,"p12")),j("click",T,()=>x(U,!1)),j("click",H,zt),D(He,Ye)};O(ni,He=>{l(U)&&He(gi)})}var fi=v(ni,2);{var Ii=He=>{var Ye=jee(),jt=m(Ye),Qt=v(m(jt),4),Mi=v(m(Qt)),oi=v(Mi,2);ti(oi,21,()=>l(lt),zi,(H,Y)=>{var ne=GC(),le={};z(()=>{le!==(le=l(Y))&&(ne.value=(ne.__value=l(Y))??"")}),D(H,ne)});var $=v(Qt,2),ue=v(m($)),Ce=v(ue,2);ti(Ce,21,()=>l(Ot),zi,(H,Y)=>{var ne=GC(),le={};z(()=>{le!==(le=l(Y))&&(ne.value=(ne.__value=l(Y))??"")}),D(H,ne)});var _e=v($,2);{var Je=H=>{var Y=_l(),ne=m(Y);z(()=>N(ne,l(pe))),D(H,Y)};O(_e,H=>{l(pe)&&H(Je)})}var Ve=v(_e,2),St=m(Ve),q=v(St,2),T=m(q);z(H=>{q.disabled=H,N(T,l(Oe)?"Installing…":"Install")},[()=>l(Oe)||!l(ge).trim()||!l(Ne).trim()]),j("input",Mi,Vt),yt(Mi,()=>l(ge),H=>x(ge,H)),j("input",ue,Ai),yt(ue,()=>l(Ne),H=>x(Ne,H)),j("click",St,()=>x(Fe,!1)),j("click",q,mi),D(He,Ye)};O(fi,He=>{l(Fe)&&He(Ii)})}var pi=v(fi,2);{var Ci=He=>{var Ye=qee(),jt=m(Ye),Qt=v(m(jt),2),Mi=m(Qt);let oi;var $=v(Mi,2);let ue;var Ce=v(Qt,2);{var _e=Ve=>{var St=$ee(),q=dt(St),T=v(m(q)),H=v(q,2);{var Y=We=>{var be=_l(),Le=m(be);z(()=>N(Le,l(st))),D(We,be)};O(H,We=>{l(st)&&We(Y)})}var ne=v(H,2),le=m(ne),oe=v(le,2),ye=m(oe);z(We=>{oe.disabled=We,N(ye,l(Be)?"Adding…":"Add CA cert")},[()=>l(Be)||!l(me).trim()]),yt(T,()=>l(me),We=>x(me,We)),j("click",le,()=>x(Xe,!1)),j("click",oe,ln),D(Ve,St)},Je=Ve=>{var St=Uee(),q=v(dt(St),2),T=v(m(q)),H=v(T,2);ti(H,21,()=>l(rt),zi,(be,Le)=>{var Me=GC(),nt={};z(()=>{nt!==(nt=l(Le))&&(Me.value=(Me.__value=l(Le))??"")}),D(be,Me)});var Y=v(q,2);{var ne=be=>{var Le=_l(),Me=m(Le);z(()=>N(Me,l(ui))),D(be,Le)};O(Y,be=>{l(ui)&&be(ne)})}var le=v(Y,2),oe=m(le),ye=v(oe,2),We=m(ye);z(be=>{ye.disabled=be,N(We,l(wt)?"Adding…":"Add CA cert")},[()=>l(wt)||!l(vt).trim()]),j("input",T,Fi),yt(T,()=>l(vt),be=>x(vt,be)),j("click",oe,()=>x(Xe,!1)),j("click",ye,sn),D(Ve,St)};O(Ce,Ve=>{l(ht)==="pem"?Ve(_e):Ve(Je,-1)})}z(()=>{oi=Dt(Mi,1,"svelte-9auejo",null,oi,{active:l(ht)==="pem"}),ue=Dt($,1,"svelte-9auejo",null,ue,{active:l(ht)==="path"})}),j("click",Mi,()=>x(ht,"pem")),j("click",$,()=>x(ht,"path")),D(He,Ye)};O(pi,He=>{l(Xe)&&He(Ci)})}j("click",bi,ci),j("click",Ut,()=>{x(r,!0),x(g,""),x(p,null)}),j("click",Li,()=>{x(C,!0),x(A,""),x(I,""),x(M,""),x(V,!1),x(P,"")}),j("click",qi,()=>{x(U,!0),x(De,""),x(J,"pem"),x(re,""),x(ae,""),x(ie,""),x(ve,""),x(Se,""),x(Q,!1)}),j("click",Gi,()=>{x(Fe,!0),x(pe,""),x(ge,""),x(Ne,""),x(lt,[],!0),x(Ot,[],!0)}),j("click",Yt,()=>{x(Xe,!0),x(st,""),x(me,""),x(ht,"pem"),x(ui,""),x(vt,""),x(rt,[],!0)}),D(o,qt),Xs()}lo(["click","change","input"]);var Jx=F('<div class="err svelte-17yczfe"> </div>'),Zee=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>'),Xee=F('<div class="checking svelte-17yczfe">Checking…</div>'),Yee=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>'),Qee=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>'),Jee=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),ete=F('<div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div>'),tte=F("<span> </span>"),ite=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),nte=F('<div class="ok svelte-17yczfe">Saved.</div>'),ste=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 ote(o,e){Zs(e,!0);let t=B(_i({})),i=B(""),n=B(!1),s=B(!1),r=B(""),a=B("~/.she/ssh/broker_id_ed25519"),d=B("local"),u=B(null),f=B(!1),g=B(""),p=B(""),C=B(!1),b=B(""),E=B(!1),y=B(""),A=B(_i({}));oo(async()=>{try{const[rt,wt,ui]=await Promise.all([Zl(),zb(),fetch("/she/broker/ssh/pubkey").then(hi=>hi.json()).catch(()=>({publicKey:null}))]);x(A,rt,!0),wt.sshKeyDefault&&x(a,wt.sshKeyDefault,!0);const ci=l(A).broker??{};x(t,ci.ssh??{},!0),l(t).port||(l(t).port=22),l(t).identityFile||(l(t).identityFile=l(a)),ui.publicKey&&x(p,ui.publicKey,!0),x(d,l(t).host?"ssh":"local",!0),l(d)==="local"&&I()}catch(rt){x(i,rt.message,!0)}});async function I(){x(f,!0),x(g,"");try{x(u,await _U(),!0)}catch(rt){x(g,rt.message??"Check failed",!0)}finally{x(f,!1)}}async function M(){x(n,!0),x(r,""),x(s,!1);try{const rt=l(A).broker??{},wt=l(d)==="local"?{...l(t),host:""}:l(t),ui={...l(A),broker:{...rt,ssh:wt}};await Dp(ui),x(s,!0),setTimeout(()=>x(s,!1),3e3)}catch(rt){x(r,rt.message,!0)}finally{x(n,!1)}}async function R(){x(C,!0),x(b,"");try{const rt=await fetch("/she/broker/ssh/keygen",{method:"POST",headers:{"Content-Type":"application/json"}}),wt=await rt.json();if(!rt.ok)throw new Error(wt.error??rt.statusText);x(p,wt.publicKey,!0)}catch(rt){x(b,rt.message,!0)}finally{x(C,!1)}}async function P(){x(E,!0),x(y,"");try{const rt=await fetch("/she/broker/ssh/test",{method:"POST",headers:{"Content-Type":"application/json"}}),wt=await rt.json();if(!rt.ok)throw new Error(wt.error??rt.statusText);x(y,wt.ok?"✓ Connection successful":"✗ "+(wt.error??"Failed"),!0)}catch(rt){x(y,"✗ "+rt.message)}finally{x(E,!1)}}function V(rt){navigator.clipboard.writeText(rt).catch(()=>{})}const U=At(()=>l(t).identityFile&&l(t).user&&l(t).host?`ssh-copy-id -i ${l(t).identityFile}.pub ${l(t).user}@${l(t).host}`:"");var J=ste(),re=m(J);{var ae=rt=>{var wt=Jx(),ui=m(wt);z(()=>N(ui,l(i))),D(rt,wt)};O(re,rt=>{l(i)&&rt(ae)})}var ie=v(re,2),ve=v(m(ie),2),Se=m(ve);let Q;var he=v(Se,2);let De;var Fe=v(ve,2),ge=m(Fe),Ne=v(ie,2);{var Oe=rt=>{var wt=Yee(),ui=v(m(wt),4);{var ci=ii=>{var Vt=Jx(),Ai=m(Vt);z(()=>N(Ai,l(g))),D(ii,Vt)};O(ui,ii=>{l(g)&&ii(ci)})}var hi=v(ui,2);{var Ct=ii=>{var Vt=Zee(),Ai=m(Vt),Fi=m(Ai);let mi;var ln=m(Fi),sn=v(Fi,4);let dn;var bn=m(sn),ft=v(Ai,2),qt=m(ft);let Ti;var ki=m(qt),bi=v(qt,4);let yn;var mn=m(bi);z(()=>{mi=Dt(Fi,1,"check-icon svelte-17yczfe",null,mi,{ok:l(u).mosquittoCtrl,fail:!l(u).mosquittoCtrl}),N(ln,l(u).mosquittoCtrl?"✓":"✗"),dn=Dt(sn,1,"check-note svelte-17yczfe",null,dn,{ok:l(u).mosquittoCtrl,fail:!l(u).mosquittoCtrl}),N(bn,l(u).mosquittoCtrl?"found in PATH":"not found — install the mosquitto or mosquitto-clients package"),Ti=Dt(qt,1,"check-icon svelte-17yczfe",null,Ti,{ok:l(u).mosquitto,fail:!l(u).mosquitto}),N(ki,l(u).mosquitto?"✓":"✗"),yn=Dt(bi,1,"check-note svelte-17yczfe",null,yn,{ok:l(u).mosquitto,fail:!l(u).mosquitto}),N(mn,l(u).mosquitto?"found in PATH":"not found — install the mosquitto package")}),D(ii,Vt)},ai=ii=>{var Vt=Xee();D(ii,Vt)};O(hi,ii=>{l(u)?ii(Ct):l(f)&&ii(ai,1)})}var Re=v(hi,2),Ee=m(Re),zt=m(Ee);z(()=>{Ee.disabled=l(f),N(zt,l(f)?"Checking…":l(u)?"Re-check":"Check tools")}),j("click",Ee,I),D(rt,wt)};O(Ne,rt=>{l(d)==="local"&&rt(Oe)})}var pe=v(Ne,2);{var lt=rt=>{var wt=ite(),ui=dt(wt),ci=v(m(ui),4),hi=m(ci),Ct=v(m(hi)),ai=v(hi,2),Re=v(m(ai)),Ee=v(ai,2),zt=v(m(Ee)),ii=v(Ee,2),Vt=v(m(ii)),Ai=v(ui,2),Fi=v(m(Ai),2),mi=v(m(Fi)),ln=m(mi),sn=v(Fi,2);{var dn=qe=>{var Xt=Jee(),yi=dt(Xt),Ut=v(m(yi)),Li=m(Ut),qi=v(Li,2),Gi=v(yi,2);{var K=Pt=>{var Yt=Qee(),gt=v(m(Yt)),et=m(gt),X=v(et,2);z(()=>S1(et,l(U))),j("click",X,()=>V(l(U))),D(Pt,Yt)};O(Gi,Pt=>{l(U)&&Pt(K)})}var Ae=v(Gi,2),ot=m(Ae),Ge=m(ot);z(()=>{S1(Li,l(p)),ot.disabled=l(C),N(Ge,l(C)?"Generating…":"Regenerate keypair")}),j("click",qi,()=>V(l(p))),j("click",ot,R),D(qe,Xt)},bn=qe=>{var Xt=ete(),yi=m(Xt),Ut=m(yi);z(()=>{yi.disabled=l(C),N(Ut,l(C)?"Generating…":"Generate keypair")}),j("click",yi,R),D(qe,Xt)};O(sn,qe=>{l(p)?qe(dn):qe(bn,-1)})}var ft=v(sn,2);{var qt=qe=>{var Xt=Jx(),yi=m(Xt);z(()=>N(yi,l(b))),D(qe,Xt)};O(ft,qe=>{l(b)&&qe(qt)})}var Ti=v(Ai,2),ki=v(m(Ti),2),bi=m(ki),yn=m(bi),mn=v(bi,2);{var _n=qe=>{var Xt=tte();let yi;var Ut=m(Xt);z(Li=>{yi=Dt(Xt,1,"test-result svelte-17yczfe",null,yi,Li),N(Ut,l(y))},[()=>({ok:l(y).startsWith("✓"),fail:l(y).startsWith("✗")})]),D(qe,Xt)};O(mn,qe=>{l(y)&&qe(_n)})}z(()=>{gn(Vt,"placeholder",l(a)),N(ln,l(t).identityFile||l(a)),bi.disabled=l(E)||!l(t).host,N(yn,l(E)?"Testing…":"Test SSH connection")}),yt(Ct,()=>l(t).host,qe=>l(t).host=qe),yt(Re,()=>l(t).port,qe=>l(t).port=qe),yt(zt,()=>l(t).user,qe=>l(t).user=qe),yt(Vt,()=>l(t).identityFile,qe=>l(t).identityFile=qe),j("click",bi,P),D(rt,wt)};O(pe,rt=>{l(d)==="ssh"&&rt(lt)})}var Ot=v(pe,2);{var Xe=rt=>{var wt=Jx(),ui=m(wt);z(()=>N(ui,l(r))),D(rt,wt)};O(Ot,rt=>{l(r)&&rt(Xe)})}var ht=v(Ot,2);{var me=rt=>{var wt=nte();D(rt,wt)};O(ht,rt=>{l(s)&&rt(me)})}var Be=v(ht,2),st=m(Be),vt=m(st);z(()=>{Q=Dt(Se,1,"svelte-17yczfe",null,Q,{active:l(d)==="local"}),De=Dt(he,1,"svelte-17yczfe",null,De,{active:l(d)==="ssh"}),N(ge,l(d)==="local"?"she and mosquitto run on the same machine — local filesystem access":"mosquitto runs on a remote host — file operations go through SSH"),st.disabled=l(n),N(vt,l(n)?"Saving…":"Save")}),j("click",Se,()=>{x(d,"local"),l(u)||I()}),j("click",he,()=>x(d,"ssh")),j("click",st,M),D(o,J),Xs()}lo(["click"]);var rte=F("<button> </button>"),ate=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),lte=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),cte=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),dte=F('<div class="empty svelte-1yc29ow"><!></div>'),ute=F('<div class="entry svelte-1yc29ow"><span class="ts svelte-1yc29ow"> </span> <span> </span> <span class="msg svelte-1yc29ow"> </span></div>'),hte=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"/> <span class="checkmark svelte-1yc29ow"></span> Auto-scroll</label> <button class="btn-clear svelte-1yc29ow">Clear</button></div> <div class="log-container svelte-1yc29ow"><!></div></div>');function fte(o,e){Zs(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"},n=new Set(["D","I","N","W","E"]);let s=B(_i([])),r=B(!0),a=B(_i(new Set(["D","I","N","W","E"]))),d=B(void 0),u=B(!1),f=B(null),g=null;oo(async()=>{const ae=await CU().catch(()=>[]),ie=dq(),ve=new Set,Se=[...ae,...ie].filter(Q=>n.has(Q.level)).map(Q=>({ts:Q.ts,level:Q.level,msg:Q.msg}));Se.sort((Q,he)=>Q.ts-he.ts),x(s,Se.filter(Q=>{const he=`${Q.ts}\0${Q.msg}`;return ve.has(he)?!1:(ve.add(he),!0)}).slice(-500),!0),l(s).length>0&&(x(u,!0),kl().then(p)),g=mr("brokerLog",Q=>{n.has(Q.level)&&(x(u,!0),x(s,[...l(s).slice(-499),{ts:Q.ts,level:Q.level,msg:Q.msg}],!0),l(r)&&kl().then(p))}),dx().then(Q=>{const he=Q.managed.log_dest,De=Array.isArray(he)?he:he?[he]:[];x(f,De.includes("topic"),!0)}).catch(()=>{x(f,null)})}),B0(()=>{g==null||g()});function p(){l(d)&&(l(d).scrollTop=l(d).scrollHeight)}function C(ae){const ie=new Set(l(a));ie.has(ae)?ie.delete(ae):ie.add(ae),x(a,ie,!0)}function b(){x(s,[],!0),x(u,!1)}let E=At(()=>l(s).filter(ae=>l(a).has(ae.level)));var y=hte(),A=m(y),I=m(A);ti(I,20,()=>["D","I","N","W","E"],zi,(ae,ie)=>{var ve=rte();let Se;var Q=m(ve);z(he=>{Se=Dt(ve,1,`lvl-btn ${i[ie]??""}`,"svelte-1yc29ow",Se,he),gn(ve,"title",`Toggle ${ie??""} messages`),N(Q,t[ie])},[()=>({active:l(a).has(ie)})]),j("click",ve,()=>C(ie)),D(ae,ve)});var M=v(I,4),R=m(M),P=v(M,2),V=v(A,2),U=m(V);{var J=ae=>{var ie=dte(),ve=m(ie);{var Se=he=>{var De=Us(),Fe=dt(De);{var ge=pe=>{var lt=ate();D(pe,lt)},Ne=pe=>{var lt=lte();D(pe,lt)},Oe=pe=>{var lt=cte();D(pe,lt)};O(Fe,pe=>{l(f)===!1?pe(ge):l(f)===!0?pe(Ne,1):pe(Oe,-1)})}D(he,De)},Q=he=>{var De=Co("No messages match the current filter.");D(he,De)};O(ve,he=>{l(u)?he(Q,-1):he(Se)})}D(ae,ie)},re=ae=>{var ie=Us(),ve=dt(ie);ti(ve,17,()=>l(E),zi,(Se,Q)=>{var he=ute(),De=m(he),Fe=m(De),ge=v(De,2),Ne=m(ge),Oe=v(ge,2),pe=m(Oe);z(lt=>{N(Fe,lt),Dt(ge,1,`badge ${i[l(Q).level]??""}`,"svelte-1yc29ow"),N(Ne,t[l(Q).level]),N(pe,l(Q).msg)},[()=>cS(l(Q).ts)]),D(Se,he)}),D(ae,ie)};O(U,ae=>{l(E).length===0?ae(J):ae(re,-1)})}ks(V,ae=>x(d,ae),()=>l(d)),Ms(R,()=>l(r),ae=>x(r,ae)),j("click",P,b),D(o,y),Xs()}lo(["click"]);var gte=F('<div class="err svelte-d31be1"> </div>'),pte=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>'),xte=F('<div class="step svelte-d31be1"><p class="svelte-d31be1"> </p></div>'),vte=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>'),mte=F('<p class="hint svelte-d31be1">Restarting mosquitto… this may take a few seconds.</p>'),_te=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>`),bte=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>'),Cte=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>'),Ete=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 yte(o,e){Zs(e,!0);let t=B("intro"),i=B(""),n=B(!1),s=B("she-admin"),r=B(""),a=B("/etc/mosquitto"),d=B(null),u=B(!1),f=B(!1),g=B("she-admin"),p=B(""),C=B(!1);async function b(){x(n,!0),x(i,"");try{(await(await fetch("/she/broker/wizard/probe",{method:"POST",headers:{"Content-Type":"application/json"}})).json()).active?x(t,"done"):x(t,"config")}catch(Q){x(i,Q.message,!0)}finally{x(n,!1)}}async function E(){x(n,!0),x(i,"");try{const Q=await fetch("/she/broker/wizard/bootstrap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adminUsername:l(s),adminPassword:l(r)||void 0,configDir:l(a)})}),he=await Q.json();if(!Q.ok||!he.ok)throw new Error(he.error??"Bootstrap failed");x(d,he,!0);const De=await Zl(),Fe=De.broker??{};await Dp({...De,broker:{...Fe,dynsec:{adminUsername:he.adminUsername,adminPassword:he.adminPassword}}}),await AU().catch(()=>{}),x(t,"restart")}catch(Q){x(i,Q.message,!0)}finally{x(n,!1)}}async function y(){x(f,!0),x(i,"");try{await SU(),await new Promise(Q=>setTimeout(Q,2e3)),x(u,!0),x(t,"done")}catch(Q){x(i,Q.message,!0)}finally{x(f,!1)}}async function A(){x(C,!0),x(i,"");try{const Q=await Zl(),he=Q.broker??{};await Dp({...Q,broker:{...he,dynsec:{adminUsername:l(g),adminPassword:l(p)}}}),x(t,"done")}catch(Q){x(i,Q.message,!0)}finally{x(C,!1)}}var I=Ete(),M=m(I),R=v(m(M),2),P=v(M,2);{var V=Q=>{var he=gte(),De=m(he);z(()=>N(De,l(i))),D(Q,he)};O(P,Q=>{l(i)&&Q(V)})}var U=v(P,2);{var J=Q=>{var he=pte(),De=v(m(he),6),Fe=m(De);z(()=>Fe.disabled=l(n)),j("click",Fe,()=>{x(t,"probe"),b()}),D(Q,he)},re=Q=>{var he=xte(),De=m(he),Fe=m(De);z(()=>N(Fe,l(n)?"Probing dynsec…":"Checking dynsec status…")),D(Q,he)},ae=Q=>{var he=vte(),De=v(m(he),2),Fe=v(m(De)),ge=v(De,2),Ne=v(m(ge)),Oe=v(ge,2),pe=v(m(Oe)),lt=v(Oe,2),Ot=m(lt),Xe=m(Ot);z(()=>{Ot.disabled=l(n)||!l(s),N(Xe,l(n)?"Bootstrapping…":"Bootstrap dynsec")}),yt(Fe,()=>l(s),ht=>x(s,ht)),yt(Ne,()=>l(r),ht=>x(r,ht)),yt(pe,()=>l(a),ht=>x(a,ht)),j("click",Ot,E),D(Q,he)},ie=Q=>{var he=_te(),De=v(m(he),2),Fe=v(m(De),3),ge=m(Fe),Ne=v(De,4),Oe=m(Ne),pe=m(Oe),lt=v(Oe,2),Ot=v(Ne,2);{var Xe=ht=>{var me=mte();D(ht,me)};O(Ot,ht=>{l(f)&&ht(Xe)})}z(()=>{N(ge,l(d).confFilePath),Oe.disabled=l(f),N(pe,l(f)?"Restarting…":"Restart mosquitto now")}),j("click",Oe,y),j("click",lt,()=>{x(t,"done")}),D(Q,he)},ve=Q=>{var he=bte(),De=v(m(he),4),Fe=m(De);j("click",Fe,function(...ge){var Ne;(Ne=e.onDone)==null||Ne.apply(this,ge)}),D(Q,he)},Se=Q=>{var he=Cte(),De=v(m(he),2),Fe=v(m(De)),ge=v(De,2),Ne=v(m(ge)),Oe=v(ge,2),pe=m(Oe),lt=v(pe,2),Ot=m(lt);z(()=>{lt.disabled=l(C)||!l(g)||!l(p),N(Ot,l(C)?"Saving…":"Save credentials")}),yt(Fe,()=>l(g),Xe=>x(g,Xe)),yt(Ne,()=>l(p),Xe=>x(p,Xe)),j("click",pe,()=>x(t,"intro")),j("click",lt,A),D(Q,he)};O(U,Q=>{l(t)==="intro"?Q(J):l(t)==="probe"?Q(re,1):l(t)==="config"?Q(ae,2):l(t)==="restart"&&l(d)?Q(ie,3):l(t)==="done"?Q(ve,4):l(t)==="manual"&&Q(Se,5)})}j("click",R,()=>x(t,"manual")),D(o,I),Xs()}lo(["click"]);var tA=F('<div class="err svelte-bwar3a"> </div>'),wte=F('<div class="ok svelte-bwar3a">Saved.</div>'),Ste=F('<div class="reload-msg svelte-bwar3a"> </div>'),Dte=F('<div class="loading svelte-bwar3a">Loading…</div>'),Ate=F('<li class="svelte-bwar3a"><span class="backup-name svelte-bwar3a"> </span> <button class="btn-restore svelte-bwar3a"> </button></li>'),kte=F('<div class="backups-section svelte-bwar3a"><div class="backups-header svelte-bwar3a"><span class="backups-title svelte-bwar3a">Backups</span> <button class="btn-refresh svelte-bwar3a" title="Refresh backup list">↻</button></div> <ul class="backup-list svelte-bwar3a"></ul></div>'),Bte=F('<div class="advanced-page svelte-bwar3a"><div class="page-header svelte-bwar3a"><h3 class="svelte-bwar3a">Advanced — mosquitto.conf</h3> <div class="header-actions svelte-bwar3a"><button class="btn-save svelte-bwar3a"> </button> <button class="svelte-bwar3a"> </button></div></div> <!> <!> <!> <!> <div class="editor-wrap svelte-bwar3a"><!></div> <!></div> <!>',1);function Fte(o,e){Zs(e,!0);let t=B(""),i=B(null),n=B(_i([])),s=B(!0),r=B(""),a=B(!1),d=B(""),u=B(!1),f=B(!1),g=B(""),p=B(""),C;oo(()=>{b()});async function b(){x(s,!0),x(r,"");try{const Be=await dx();x(t,Be.raw??"",!0),x(i,Be.checksum,!0),x(n,Be.backups??[],!0)}catch(Be){x(r,Be.message??"Failed to load config",!0)}finally{x(s,!1)}}async function E(){var Be;x(a,!0),x(d,""),x(u,!1);try{await EU(l(t),l(i)),x(u,!0),await b(),x(u,!0)}catch(st){(Be=st.message)!=null&&Be.includes("external_modify")||st.status===409?x(d,"mosquitto.conf was modified externally since last read. Reload first."):x(d,st.message??"Save failed",!0)}finally{x(a,!1)}}async function y(){x(f,!0),x(g,"");try{const Be=await Vb();x(g,Be.stderr||Be.stdout||"Reloaded",!0)}catch(Be){x(g,"Error: "+(Be.message??"reload failed"))}finally{x(f,!1)}}async function A(Be){if(await C.show(`Restore backup "${Be}"? Current mosquitto.conf will be overwritten.`,{confirm:"Restore",danger:!0})){x(p,Be,!0),x(d,"");try{await wU(Be),await b()}catch(st){x(d,st.message??"Restore failed",!0)}finally{x(p,"")}}}async function I(){try{const Be=await yU();x(n,Be.backups,!0)}catch{}}function M(Be){const st=Be.match(/\.bak-(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})/);return st?`${st[1]}-${st[2]}-${st[3]} ${st[4]}:${st[5]}:${st[6]}`:Be}var R=Bte(),P=dt(R),V=m(P),U=v(m(V),2),J=m(U),re=m(J),ae=v(J,2),ie=m(ae),ve=v(V,2);{var Se=Be=>{var st=tA(),vt=m(st);z(()=>N(vt,l(r))),D(Be,st)};O(ve,Be=>{l(r)&&Be(Se)})}var Q=v(ve,2);{var he=Be=>{var st=tA(),vt=m(st);z(()=>N(vt,l(d))),D(Be,st)};O(Q,Be=>{l(d)&&Be(he)})}var De=v(Q,2);{var Fe=Be=>{var st=wte();D(Be,st)};O(De,Be=>{l(u)&&Be(Fe)})}var ge=v(De,2);{var Ne=Be=>{var st=Ste(),vt=m(st);z(()=>N(vt,l(g))),D(Be,st)};O(ge,Be=>{l(g)&&Be(Ne)})}var Oe=v(ge,2),pe=m(Oe);{var lt=Be=>{var st=Dte();D(Be,st)},Ot=Be=>{Tg(Be,{language:"ini",onSave:E,get value(){return l(t)},set value(st){x(t,st,!0)}})};O(pe,Be=>{l(s)?Be(lt):Be(Ot,-1)})}var Xe=v(Oe,2);{var ht=Be=>{var st=kte(),vt=m(st),rt=v(m(vt),2),wt=v(vt,2);ti(wt,21,()=>l(n),zi,(ui,ci)=>{var hi=Ate(),Ct=m(hi),ai=m(Ct),Re=v(Ct,2),Ee=m(Re);z(zt=>{N(ai,zt),Re.disabled=l(p)===l(ci),N(Ee,l(p)===l(ci)?"Restoring…":"Restore")},[()=>M(l(ci))]),j("click",Re,()=>A(l(ci))),D(ui,hi)}),j("click",rt,I),D(Be,st)};O(Xe,Be=>{l(n).length>0&&Be(ht)})}var me=v(P,2);ks(gl(me,{}),Be=>C=Be,()=>C),z(()=>{J.disabled=l(a)||l(s),N(re,l(a)?"Saving…":"Save"),ae.disabled=l(f),N(ie,l(f)?"Reloading…":"Apply & Reload")}),j("click",J,E),j("click",ae,y),D(o,R),Xs()}lo(["click"]);var Lte=F('<div class="reload-msg svelte-1q1ovna"> </div>'),KC=F('<div class="err svelte-1q1ovna"> </div>'),iA=F('<div class="ok svelte-1q1ovna"> </div>'),nA=F('<div class="loading svelte-1q1ovna">Loading…</div>'),Ite=F('<span class="inline-err svelte-1q1ovna"> </span>'),Pte=F('<div class="change-form svelte-1q1ovna"><input type="password" placeholder="New password" autocomplete="new-password" class="svelte-1q1ovna"/> <input type="password" placeholder="Confirm password" autocomplete="new-password" class="svelte-1q1ovna"/> <!> <button class="svelte-1q1ovna"> </button> <button class="svelte-1q1ovna">Cancel</button></div>'),Tte=F('<button class="svelte-1q1ovna">Change password</button> <button class="btn-danger svelte-1q1ovna"> </button>',1),Mte=F('<tr><td class="user-name svelte-1q1ovna"> </td><td class="user-actions svelte-1q1ovna"><!></td></tr>'),Rte=F('<table class="user-table svelte-1q1ovna"><thead><tr><th class="svelte-1q1ovna">Username</th><th class="svelte-1q1ovna"></th></tr></thead><tbody></tbody></table>'),Nte=F('<p class="empty svelte-1q1ovna">No users found — file may not exist yet.</p>'),Ote=F('<!> <div class="add-form svelte-1q1ovna"><span class="add-title svelte-1q1ovna">Add user</span> <div class="add-fields svelte-1q1ovna"><input placeholder="Username" autocomplete="off" class="svelte-1q1ovna"/> <input type="password" placeholder="Password" autocomplete="new-password" class="svelte-1q1ovna"/> <input type="password" placeholder="Confirm password" autocomplete="new-password" class="svelte-1q1ovna"/> <button class="btn-add svelte-1q1ovna"> </button></div> <!></div>',1),Hte=F(`<div class="passwd-page svelte-1q1ovna"><section class="card svelte-1q1ovna"><div class="card-header svelte-1q1ovna"><h4 class="svelte-1q1ovna">Password File</h4> <div class="header-actions svelte-1q1ovna"><button class="svelte-1q1ovna"> </button></div></div> <div class="file-row svelte-1q1ovna"><label class="file-label svelte-1q1ovna"><span class="svelte-1q1ovna">File path</span> <input placeholder="/etc/mosquitto/passwd" class="svelte-1q1ovna"/></label> <button class="svelte-1q1ovna">↻</button></div> <!> <!> <!> <!></section> <section class="card acl-card svelte-1q1ovna"><div class="card-header svelte-1q1ovna"><h4 class="svelte-1q1ovna">ACL File</h4> <div class="header-actions svelte-1q1ovna"><button class="btn-save svelte-1q1ovna"> </button></div></div> <div class="file-row svelte-1q1ovna"><label class="file-label svelte-1q1ovna"><span class="svelte-1q1ovna">File path</span> <input placeholder="/etc/mosquitto/acl" class="svelte-1q1ovna"/></label> <button class="svelte-1q1ovna">↻</button></div> <!> <!> <div class="acl-editor-wrap svelte-1q1ovna"><!></div> <p class="hint svelte-1q1ovna">Static ACL file format: <code class="svelte-1q1ovna">user &lt;username&gt;</code> followed by <code class="svelte-1q1ovna">topic [read|write|readwrite] &lt;pattern&gt;</code>.
233
+ Requires <code class="svelte-1q1ovna">acl_file</code> set in mosquitto.conf and no dynsec plugin.
234
+ After saving, click <strong>Apply &amp; Reload</strong> above to activate changes.</p></section></div> <!>`,1);function Wte(o,e){Zs(e,!0);let t=B("/etc/mosquitto/passwd"),i=B(_i([])),n=B(!1),s=B(""),r=B(""),a=B(""),d=B(""),u=B(""),f=B(!1),g=B(""),p=B(null),C=B(""),b=B(""),E=B(!1),y=B(""),A=B(null),I=B("/etc/mosquitto/acl"),M=B(""),R=B(!1),P=B(""),V=B(""),U=B(!1),J=B(!1),re=B(""),ae;oo(async()=>{try{const qe=await dx(),Xt=qe.listeners.find(Ut=>Ut.password_file);Xt!=null&&Xt.password_file&&x(t,Xt.password_file,!0);const yi=qe.listeners.find(Ut=>Ut.acl_file);yi!=null&&yi.acl_file&&x(I,yi.acl_file,!0),!(Xt!=null&&Xt.password_file)&&qe.managed.password_file&&x(t,String(qe.managed.password_file),!0),!(yi!=null&&yi.acl_file)&&qe.managed.acl_file&&x(I,String(qe.managed.acl_file),!0)}catch{}await ie(),await De()});async function ie(){if(l(t)){x(n,!0),x(s,""),x(r,"");try{const qe=await BU(l(t));x(i,qe.users,!0)}catch(qe){x(s,qe.message??"Failed to load password file",!0)}finally{x(n,!1)}}}async function ve(){if(!l(a).trim()){x(g,"Username required");return}if(!l(d)){x(g,"Password required");return}if(l(d)!==l(u)){x(g,"Passwords do not match");return}x(f,!0),x(g,""),x(r,"");try{await f2(l(t),l(a).trim(),l(d)),x(a,""),x(d,""),x(u,""),x(r,"User added."),await ie()}catch(qe){x(g,qe.message??"Failed to add user",!0)}finally{x(f,!1)}}async function Se(qe){x(p,qe,!0),x(C,""),x(b,""),x(y,"")}async function Q(){if(!l(C)){x(y,"Password required");return}if(l(C)!==l(b)){x(y,"Passwords do not match");return}x(E,!0),x(y,""),x(r,"");try{await f2(l(t),l(p),l(C)),x(p,null),x(r,"Password updated.")}catch(qe){x(y,qe.message??"Failed to change password",!0)}finally{x(E,!1)}}async function he(qe){if(await ae.show(`Delete user "${qe}" from ${l(t)}?`,{confirm:"Delete",danger:!0})){x(A,qe,!0),x(s,""),x(r,"");try{await FU(l(t),qe),x(r,`User "${qe}" deleted.`),await ie()}catch(Xt){x(s,Xt.message??"Delete failed",!0)}finally{x(A,null)}}}async function De(){if(l(I)){x(R,!0),x(P,""),x(V,"");try{const qe=await LU(l(I));x(M,qe.content,!0)}catch(qe){x(P,qe.message??"Failed to load ACL file",!0)}finally{x(R,!1)}}}async function Fe(){x(U,!0),x(P,""),x(V,"");try{await IU(l(I),l(M)),x(V,"ACL file saved.")}catch(qe){x(P,qe.message??"Save failed",!0)}finally{x(U,!1)}}async function ge(){x(J,!0),x(re,"");try{const qe=await Vb();x(re,qe.stderr||qe.stdout||"Reloaded",!0)}catch(qe){x(re,"Error: "+(qe.message??"reload failed"))}finally{x(J,!1)}}var Ne=Hte(),Oe=dt(Ne),pe=m(Oe),lt=m(pe),Ot=v(m(lt),2),Xe=m(Ot),ht=m(Xe),me=v(lt,2),Be=m(me),st=v(m(Be),2),vt=v(Be,2),rt=v(me,2);{var wt=qe=>{var Xt=Lte(),yi=m(Xt);z(()=>N(yi,l(re))),D(qe,Xt)};O(rt,qe=>{l(re)&&qe(wt)})}var ui=v(rt,2);{var ci=qe=>{var Xt=KC(),yi=m(Xt);z(()=>N(yi,l(s))),D(qe,Xt)};O(ui,qe=>{l(s)&&qe(ci)})}var hi=v(ui,2);{var Ct=qe=>{var Xt=iA(),yi=m(Xt);z(()=>N(yi,l(r))),D(qe,Xt)};O(hi,qe=>{l(r)&&qe(Ct)})}var ai=v(hi,2);{var Re=qe=>{var Xt=nA();D(qe,Xt)},Ee=qe=>{var Xt=Ote(),yi=dt(Xt);{var Ut=et=>{var X=Rte(),Pe=v(m(X));ti(Pe,21,()=>l(i),zi,(ce,fe)=>{var Gt=Mte(),ni=m(Gt),gi=m(ni),fi=v(ni),Ii=m(fi);{var pi=He=>{var Ye=Pte(),jt=m(Ye),Qt=v(jt,2),Mi=v(Qt,2);{var oi=_e=>{var Je=Ite(),Ve=m(Je);z(()=>N(Ve,l(y))),D(_e,Je)};O(Mi,_e=>{l(y)&&_e(oi)})}var $=v(Mi,2),ue=m($),Ce=v($,2);z(()=>{$.disabled=l(E),N(ue,l(E)?"…":"Save")}),yt(jt,()=>l(C),_e=>x(C,_e)),yt(Qt,()=>l(b),_e=>x(b,_e)),j("click",$,Q),j("click",Ce,()=>x(p,null)),D(He,Ye)},Ci=He=>{var Ye=Tte(),jt=dt(Ye),Qt=v(jt,2),Mi=m(Qt);z(()=>{Qt.disabled=l(A)===l(fe),N(Mi,l(A)===l(fe)?"…":"Delete")}),j("click",jt,()=>Se(l(fe))),j("click",Qt,()=>he(l(fe))),D(He,Ye)};O(Ii,He=>{l(p)===l(fe)?He(pi):He(Ci,-1)})}z(()=>N(gi,l(fe))),D(ce,Gt)}),D(et,X)},Li=et=>{var X=Nte();D(et,X)};O(yi,et=>{l(i).length>0?et(Ut):l(s)||et(Li,1)})}var qi=v(yi,2),Gi=v(m(qi),2),K=m(Gi),Ae=v(K,2),ot=v(Ae,2),Ge=v(ot,2),Pt=m(Ge),Yt=v(Gi,2);{var gt=et=>{var X=KC(),Pe=m(X);z(()=>N(Pe,l(g))),D(et,X)};O(Yt,et=>{l(g)&&et(gt)})}z(()=>{Ge.disabled=l(f),N(Pt,l(f)?"Adding…":"Add")}),yt(K,()=>l(a),et=>x(a,et)),yt(Ae,()=>l(d),et=>x(d,et)),yt(ot,()=>l(u),et=>x(u,et)),j("click",Ge,ve),D(qe,Xt)};O(ai,qe=>{l(n)?qe(Re):qe(Ee,-1)})}var zt=v(pe,2),ii=m(zt),Vt=v(m(ii),2),Ai=m(Vt),Fi=m(Ai),mi=v(ii,2),ln=m(mi),sn=v(m(ln),2),dn=v(ln,2),bn=v(mi,2);{var ft=qe=>{var Xt=KC(),yi=m(Xt);z(()=>N(yi,l(P))),D(qe,Xt)};O(bn,qe=>{l(P)&&qe(ft)})}var qt=v(bn,2);{var Ti=qe=>{var Xt=iA(),yi=m(Xt);z(()=>N(yi,l(V))),D(qe,Xt)};O(qt,qe=>{l(V)&&qe(Ti)})}var ki=v(qt,2),bi=m(ki);{var yn=qe=>{var Xt=nA();D(qe,Xt)},mn=qe=>{Tg(qe,{language:"plaintext",onSave:Fe,get value(){return l(M)},set value(Xt){x(M,Xt,!0)}})};O(bi,qe=>{l(R)?qe(yn):qe(mn,-1)})}var _n=v(Oe,2);ks(gl(_n,{}),qe=>ae=qe,()=>ae),z(()=>{Xe.disabled=l(J),N(ht,l(J)?"Reloading…":"Apply & Reload"),vt.disabled=l(n),Ai.disabled=l(U),N(Fi,l(U)?"Saving…":"Save"),dn.disabled=l(R)}),j("click",Xe,ge),j("change",st,ie),yt(st,()=>l(t),qe=>x(t,qe)),j("click",vt,ie),j("click",Ai,Fe),j("change",sn,De),yt(sn,()=>l(I),qe=>x(I,qe)),j("click",dn,De),D(o,Ne),Xs()}lo(["click","change"]);var zte=F('<div class="loading svelte-zuhcpo">Loading…</div>'),Vte=F('<div class="error-banner svelte-zuhcpo"> </div>'),jte=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>'),$te=F('<button class="btn-wizard-inline svelte-zuhcpo">Setup Wizard ↗</button>'),Ute=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>'),qte=F('<div class="error-inline svelte-zuhcpo"> </div>'),Gte=F('<button class="diag-btn svelte-zuhcpo"> </button>'),sA=F('<p class="diag-issue svelte-zuhcpo"> </p>'),Kte=F('<p class="diag-ok-msg svelte-zuhcpo">✓ dynamic-security.json looks correct. Verify mosquitto restarted with the plugin loaded.</p>'),Zte=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),Xte=F('<div><!></div> <button class="diag-btn svelte-zuhcpo" style="margin-top:6px"> </button>',1),Yte=F('<button class="wizard-btn svelte-zuhcpo">Run Setup Wizard</button>'),Qte=F('<div class="diag-area svelte-zuhcpo"><!> <!></div>'),Jte=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>'),eie=F('<div style="margin-top: 20px;"><!></div>'),tie=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),iie=F('<div class="tab-content svelte-zuhcpo"><!></div>'),nie=F('<div class="broker-page svelte-zuhcpo"><div class="sub-nav svelte-zuhcpo"><button>Status</button> <button>Directory</button> <button>Config</button> <button>Advanced</button> <button>Auth Files</button> <button>Listeners</button> <button>Certificates</button> <button>Connection</button> <button>Logs</button></div> <!></div> <!>',1);function sie(o,e){Zs(e,!0);let t=B(!1),i,n=B(!1),s=B(""),r=B(!1),a=B(null);const d="she-broker-tab";let u=B(_i(localStorage.getItem(d)??"status"));us(()=>{localStorage.setItem(d,l(u))});let f=B(null),g=B(""),p=B(!0);async function C(){try{x(f,await zb(),!0),x(g,"")}catch(Ct){x(g,Ct.message??"Failed to load broker status",!0)}finally{x(p,!1)}}oo(()=>{C();const Ct=setInterval(C,1e4);return()=>clearInterval(Ct)});async function b(){x(r,!0),x(a,null);try{x(a,await kU(),!0)}catch(Ct){x(a,{ok:!1,dynSecPath:"",issues:[Ct.message??"Diagnose request failed"]},!0)}finally{x(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})){x(n,!0),x(s,"");try{await DU(),await C()}catch(Ct){x(s,Ct.message??"Deactivate failed",!0)}finally{x(n,!1)}}}function y(Ct){var Re;if(!((Re=l(f))!=null&&Re.sys))return"—";const ai=l(f).sys[Ct];return ai?String(ai.val??"—"):"—"}function A(Ct){if(Ct==="—")return Ct;const ai=Ct.match(/^(\d+)/),Re=ai?parseInt(ai[1]):NaN;if(isNaN(Re))return Ct;const Ee=Math.floor(Re/86400),zt=Math.floor(Re%86400/3600),ii=Math.floor(Re%3600/60),Vt=Re%60,Ai=Fi=>String(Fi).padStart(2,"0");return Ee>0?`${Ee}d ${Ai(zt)}:${Ai(ii)}:${Ai(Vt)}`:`${Ai(zt)}:${Ai(ii)}:${Ai(Vt)}`}function I(Ct){if(Ct==="—")return Ct;const ai=parseInt(Ct);return isNaN(ai)?Ct:ai<1024?`${ai} B`:ai<1048576?`${(ai/1024).toFixed(1)} KB`:ai<1073741824?`${(ai/1048576).toFixed(1)} MB`:`${(ai/1073741824).toFixed(1)} GB`}var M=nie(),R=dt(M),P=m(R),V=m(P);let U;var J=v(V,2);let re;var ae=v(J,2);let ie;var ve=v(ae,2);let Se;var Q=v(ve,2);let he;var De=v(Q,2);let Fe;var ge=v(De,2);let Ne;var Oe=v(ge,2);let pe;var lt=v(Oe,2);let Ot;var Xe=v(P,2);{var ht=Ct=>{var ai=iie(),Re=m(ai);{var Ee=Vt=>{var Ai=zte();D(Vt,Ai)},zt=Vt=>{var Ai=Vte(),Fi=m(Ai);z(()=>N(Fi,l(g))),D(Vt,Ai)},ii=Vt=>{var Ai=tie(),Fi=dt(Ai),mi=m(Fi),ln=m(mi),sn=v(m(ln),4),dn=m(sn),bn=v(ln,2);{var ft=Ut=>{var Li=jte(),qi=m(Li);let Gi;var K=v(qi,4);let Ae;var ot=m(K);{var Ge=X=>{var Pe=Co("plugin active");D(X,Pe)},Pt=X=>{var Pe=Co("connected — plugin not responding");D(X,Pe)},Yt=X=>{var Pe=Co("disconnected");D(X,Pe)};O(ot,X=>{l(f).dynsec.dynsecReady?X(Ge):l(f).dynsec.connected?X(Pt,1):X(Yt,-1)})}var gt=v(K,2),et=m(gt);z(()=>{Gi=Dt(qi,1,"dot svelte-zuhcpo",null,Gi,{ok:l(f).dynsec.dynsecReady,warn:l(f).dynsec.connected&&!l(f).dynsec.dynsecReady,"dot-err":!l(f).dynsec.connected}),Ae=Dt(K,1,"conn-detail svelte-zuhcpo",null,Ae,{ok:l(f).dynsec.dynsecReady,warn:l(f).dynsec.connected&&!l(f).dynsec.dynsecReady,err:!l(f).dynsec.connected}),gt.disabled=l(n),N(et,l(n)?"…":"deactivate")}),j("click",gt,E),D(Ut,Li)},qt=Ut=>{var Li=Ute(),qi=v(m(Li),6);{var Gi=K=>{var Ae=$te();j("click",Ae,()=>x(t,!0)),D(K,Ae)};O(qi,K=>{l(t)||K(Gi)})}D(Ut,Li)};O(bn,Ut=>{l(f).dynsec.configured?Ut(ft):Ut(qt,-1)})}var Ti=v(bn,2);{var ki=Ut=>{var Li=qte(),qi=m(Li);z(()=>N(qi,l(s))),D(Ut,Li)};O(Ti,Ut=>{l(s)&&Ut(ki)})}var bi=v(mi,2);{var yn=Ut=>{var Li=Qte(),qi=m(Li);{var Gi=Ge=>{var Pt=Gte(),Yt=m(Pt);z(()=>{Pt.disabled=l(r),N(Yt,l(r)?"Running diagnostics…":"Run diagnostics")}),j("click",Pt,b),D(Ge,Pt)},K=Ge=>{var Pt=Xte(),Yt=dt(Pt);let gt;var et=m(Yt);{var X=Gt=>{var ni=sA(),gi=m(ni);z(()=>N(gi,`⚠ ${l(a).error??""}`)),D(Gt,ni)},Pe=Gt=>{var ni=Zte(),gi=dt(ni),fi=v(m(gi)),Ii=m(fi),pi=v(gi,2),Ci=v(m(pi)),He=m(Ci),Ye=v(pi,2),jt=v(m(Ye)),Qt=m(jt),Mi=v(Ye,2),oi=v(m(Mi)),$=m(oi),ue=v(Mi,2);ti(ue,17,()=>l(a).issues,zi,(Je,Ve)=>{var St=sA(),q=m(St);z(()=>N(q,`⚠ ${l(Ve)??""}`)),D(Je,St)});var Ce=v(ue,2);{var _e=Je=>{var Ve=Kte();D(Je,Ve)};O(Ce,Je=>{l(a).ok&&Je(_e)})}z(()=>{N(Ii,l(a).dynSecPath),Dt(Ci,1,Eg(l(a).adminClientExists?"ok":"fail"),"svelte-zuhcpo"),N(He,l(a).adminClientExists?"✓ yes":"✗ no"),Dt(jt,1,Eg(l(a).hasAdminRole?"ok":"fail"),"svelte-zuhcpo"),N(Qt,l(a).hasAdminRole?"✓ yes":"✗ no"),Dt(oi,1,Eg(l(a).hasControlSendAcl?"ok":"fail"),"svelte-zuhcpo"),N($,l(a).hasControlSendAcl?"✓ present":"✗ missing")}),D(Gt,ni)};O(et,Gt=>{l(a).error?Gt(X):Gt(Pe,-1)})}var ce=v(Yt,2),fe=m(ce);z(()=>{gt=Dt(Yt,1,"diag-card svelte-zuhcpo",null,gt,{"diag-ok":l(a).ok,"diag-fail":!l(a).ok}),ce.disabled=l(r),N(fe,l(r)?"Running…":"Re-run")}),j("click",ce,b),D(Ge,Pt)};O(qi,Ge=>{l(a)?Ge(K,-1):Ge(Gi)})}var Ae=v(qi,2);{var ot=Ge=>{var Pt=Yte();j("click",Pt,()=>x(t,!0)),D(Ge,Pt)};O(Ae,Ge=>{l(t)||Ge(ot)})}D(Ut,Li)};O(bi,Ut=>{l(f).dynsec.configured&&l(f).dynsec.connected&&!l(f).dynsec.dynsecReady&&Ut(yn)})}var mn=v(bi,2);{var _n=Ut=>{var Li=Jte(),qi=m(Li),Gi=v(m(qi)),K=m(Gi),Ae=v(Gi,3),ot=m(Ae),Ge=v(Ae,3),Pt=m(Ge),Yt=v(Ge,3),gt=m(Yt),et=v(Yt,3),X=m(et),Pe=v(et,3),ce=m(Pe);z((fe,Gt,ni,gi,fi,Ii,pi,Ci,He,Ye,jt,Qt)=>{N(K,fe),N(ot,Gt),N(Pt,`${ni??""} connected · ${gi??""} max · ${fi??""} total`),N(gt,`${Ii??""} rcv · ${pi??""} sent · ${Ci??""} stored`),N(X,`${He??""} retained · ${Ye??""} subscriptions`),N(ce,`${jt??""} in · ${Qt??""} out`)},[()=>y("$SYS/broker/version"),()=>A(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"))]),D(Ut,Li)},qe=At(()=>Object.keys(l(f).sys).length>0);O(mn,Ut=>{l(qe)&&Ut(_n)})}var Xt=v(Fi,2);{var yi=Ut=>{var Li=eie(),qi=m(Li);yte(qi,{onDone:()=>{x(t,!1),C()}}),D(Ut,Li)};O(Xt,Ut=>{l(t)&&(!l(f).dynsec.configured||!l(f).dynsec.dynsecReady)&&Ut(yi)})}z(()=>N(dn,l(f).sshConfigured?`ssh — ${l(f).sshHost}`:"local")),D(Vt,Ai)};O(Re,Vt=>{l(p)?Vt(Ee):l(g)?Vt(zt,1):l(f)&&Vt(ii,2)})}D(Ct,ai)},me=Ct=>{{let ai=At(()=>{var Re;return((Re=l(f))==null?void 0:Re.dynsec.dynsecReady)??!1});aee(Ct,{get dynsecReady(){return l(ai)}})}},Be=Ct=>{Aee(Ct,{})},st=Ct=>{Fte(Ct,{})},vt=Ct=>{Wte(Ct,{})},rt=Ct=>{Cee(Ct,{})},wt=Ct=>{Kee(Ct,{})},ui=Ct=>{ote(Ct,{})},ci=Ct=>{fte(Ct,{})};O(Xe,Ct=>{l(u)==="status"?Ct(ht):l(u)==="users"?Ct(me,1):l(u)==="brokerconfig"?Ct(Be,2):l(u)==="advanced"?Ct(st,3):l(u)==="passwd"?Ct(vt,4):l(u)==="listeners"?Ct(rt,5):l(u)==="certs"?Ct(wt,6):l(u)==="ssh"?Ct(ui,7):l(u)==="logs"&&Ct(ci,8)})}var hi=v(R,2);ks(gl(hi,{}),Ct=>i=Ct,()=>i),z(()=>{U=Dt(V,1,"svelte-zuhcpo",null,U,{active:l(u)==="status"}),re=Dt(J,1,"svelte-zuhcpo",null,re,{active:l(u)==="users"}),ie=Dt(ae,1,"svelte-zuhcpo",null,ie,{active:l(u)==="brokerconfig"}),Se=Dt(ve,1,"svelte-zuhcpo",null,Se,{active:l(u)==="advanced"}),he=Dt(Q,1,"svelte-zuhcpo",null,he,{active:l(u)==="passwd"}),Fe=Dt(De,1,"svelte-zuhcpo",null,Fe,{active:l(u)==="listeners"}),Ne=Dt(ge,1,"svelte-zuhcpo",null,Ne,{active:l(u)==="certs"}),pe=Dt(Oe,1,"svelte-zuhcpo",null,pe,{active:l(u)==="ssh"}),Ot=Dt(lt,1,"svelte-zuhcpo",null,Ot,{active:l(u)==="logs"})}),j("click",V,()=>x(u,"status")),j("click",J,()=>x(u,"users")),j("click",ae,()=>x(u,"brokerconfig")),j("click",ve,()=>x(u,"advanced")),j("click",Q,()=>x(u,"passwd")),j("click",De,()=>x(u,"listeners")),j("click",ge,()=>x(u,"certs")),j("click",Oe,()=>x(u,"ssh")),j("click",lt,()=>x(u,"logs")),D(o,M),Xs()}lo(["click"]);var oie=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q"></span>'),rie=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="MQTT broker not connected"></span>'),aie=F('<span class="nav-dot nav-dot--warn nav-dot--blink svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),lie=F('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="MQTT connected"></span>'),cie=F('<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>'),die=F('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="All Matter devices online"></span>'),uie=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Some Matter devices offline"></span>'),hie=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="No Matter devices online"></span>'),fie=F('<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>'),gie=F('<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>'),pie=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="Errors in recent logs"></span>'),xie=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Warnings in recent logs"></span>'),vie=F('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),mie=F('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),_ie=F('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),bie=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>'),Cie=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>'),Eie=F('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),yie=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),wie=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),Sie=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> <dt class="svelte-1n46o8q">EL util</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL lag mean</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL lag max</dt><dd class="svelte-1n46o8q"> </dd></dl>'),Die=F('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),Aie=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>'),kie=F('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><!></div></div>'),Bie=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>'),Fie=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" 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>'),Lie=F('<div class="login-error svelte-1n46o8q"> </div>'),Iie=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>'),Pie=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>'),Tie=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>'),Mie=F("<!> <!> <!> <!>",1);function Rie(o,e){Zs(e,!0);const t=["scripts","mqtt","matter","security","db","logs","config","packages"];function i(){const vt=location.hash.slice(1);return t.includes(vt)?vt:"scripts"}let n=B(_i(i())),s=B(null),r=B(!1),a=B(!1),d=B(!1),u=B(!1),f=B("none"),g=B(""),p=B(!1),C=B(""),b=B(""),E=B(!1),y=B(!1);j$(()=>{x(p,!0)});async function A(){x(b,""),x(E,!0);try{await q$(l(C)),x(C,""),x(p,!1)}catch(vt){x(b,vt.message??"Login failed",!0)}finally{x(E,!1)}}async function I(){if(l(f)==="proxy"&&l(g)){window.location.href=l(g);return}await G$(),x(p,!0)}let M=B(null),R=B(!1),P=B(!1),V=B(!1),U=B(!1),J=B(_i([])),re=B(0),ae=B(!1),ie=B(_i([]));const ve=At(()=>l(ie).filter(vt=>vt.online).length),Se=At(()=>l(ie).length===0?"none":l(ve)===l(ie).length?"all":l(ve)>0?"some":"offline");let Q=B(!1),he=B(!1);async function De(){if(!await l(M).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;x(R,!0);let vt;try{vt=(await xf()).startedAt}catch{}try{await _F()}catch{}const rt=Date.now()+6e4;for(;Date.now()<rt;){await new Promise(wt=>setTimeout(wt,250));try{const wt=await xf();if(vt===void 0||wt.startedAt!==vt){location.reload();return}}catch{}}location.reload()}async function Fe(){x(d,!0);try{const vt=await J$();l(s)&&x(s,{...l(s),latestVersion:vt.latestVersion??void 0},!0)}catch{}finally{x(d,!1)}}async function ge(){var wt,ui;if(!await l(M).show(`Update to v${(wt=l(s))==null?void 0:wt.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;x(a,!1),x(u,!0);const vt=(ui=l(s))==null?void 0:ui.startedAt;try{await Q$()}catch{}const rt=Date.now()+18e4;for(;Date.now()<rt;){await new Promise(ci=>setTimeout(ci,1e3));try{const ci=await xf();if(vt===void 0||ci.startedAt!==vt){location.reload();return}}catch{x(u,!1),x(R,!0)}}location.reload()}function Ne(vt){x(n,vt,!0),location.hash=vt}oo(async()=>{location.hash||(location.hash=l(n));const vt=()=>{x(n,i(),!0)};window.addEventListener("hashchange",vt);try{const Re=await U$();x(f,Re.mode,!0),x(g,Re.proxyLogoutUrl??"",!0),l(f)==="password"&&(await fetch("/she/scripts")).status===401&&x(p,!0)}catch{}x(y,!0);async function rt(){var Re,Ee,zt;try{x(s,await xf(),!0)}catch{}try{const[ii,Vt]=await Promise.all([EF(),Zl()]);x(J,Array.isArray(Vt.pinnedPackages)?Vt.pinnedPackages:[],!0),x(re,Object.keys(ii).filter(Fi=>!l(J).includes(Fi)).length,!0);const Ai=l(ae);x(ae,((Re=Vt.broker)==null?void 0:Re.enabled)===!0),Ai&&!l(ae)&&l(n)==="security"&&Ne("scripts")}catch{}!((Ee=l(s))!=null&&Ee.matterEnabled)&&l(n)==="matter"&&Ne("scripts"),!((zt=l(s))!=null&&zt.dbEnabled)&&l(n)==="db"&&Ne("scripts")}rt();const wt=setInterval(rt,5e3),ui=mr("mqtt:status",Re=>{Re.connected===!1?(x(U,!0),x(P,!1),x(V,!1)):(x(U,!1),x(P,Re.ready===!1),x(V,Re.ready===!0))}),ci=mr("matter:deviceList",Re=>{Array.isArray(Re.devices)&&x(ie,Re.devices.map(Ee=>({nodeId:String(Ee.nodeId),online:!!Ee.online})),!0)}),hi=mr("matter:deviceStatus",Re=>{if(Re.nodeId===void 0)return;const Ee=String(Re.nodeId),zt=!!Re.online;x(ie,l(ie).map(ii=>ii.nodeId===Ee?{...ii,online:zt}:ii),!0)}),Ct=FF();x(Q,Ct.some(Re=>Re.level==="error"),!0),x(he,!l(Q)&&Ct.some(Re=>Re.level==="warn"),!0);const ai=lS(Re=>{Re.level==="error"?(x(Q,!0),x(he,!1)):Re.level==="warn"&&!l(Q)&&x(he,!0)});return()=>{window.removeEventListener("hashchange",vt),clearInterval(wt),ui(),ci(),hi(),ai()}});var Oe=Mie();Ts("click",l6,()=>{l(r)&&x(r,!1),l(a)&&x(a,!1)});var pe=dt(Oe);{var lt=vt=>{var rt=Fie(),wt=m(rt),ui=v(m(wt),2);let ci;var hi=v(ui,2);let Ct;var ai=v(m(hi),2);{var Re=T=>{var H=oie();z(()=>gn(H,"title",`${l(re)??""} package update${l(re)===1?"":"s"} available`)),D(T,H)};O(ai,T=>{l(re)>0&&T(Re)})}var Ee=v(hi,2);let zt;var ii=v(m(Ee),2);{var Vt=T=>{var H=rie();D(T,H)},Ai=T=>{var H=aie();D(T,H)},Fi=T=>{var H=lie();D(T,H)};O(ii,T=>{l(U)?T(Vt):l(P)?T(Ai,1):l(V)&&T(Fi,2)})}var mi=v(Ee,2);{var ln=T=>{var H=cie();let Y;z(()=>Y=Dt(H,1,"svelte-1n46o8q",null,Y,{active:l(n)==="security"})),j("click",H,()=>Ne("security")),D(T,H)};O(mi,T=>{l(ae)&&T(ln)})}var sn=v(mi,2);{var dn=T=>{var H=fie();let Y;var ne=v(m(H),2);{var le=We=>{var be=die();D(We,be)},oe=We=>{var be=uie();D(We,be)},ye=We=>{var be=hie();D(We,be)};O(ne,We=>{l(Se)==="all"?We(le):l(Se)==="some"?We(oe,1):l(Se)==="offline"&&We(ye,2)})}z(()=>Y=Dt(H,1,"svelte-1n46o8q",null,Y,{active:l(n)==="matter"})),j("click",H,()=>Ne("matter")),D(T,H)};O(sn,T=>{var H;(H=l(s))!=null&&H.matterEnabled&&T(dn)})}var bn=v(sn,2);{var ft=T=>{var H=gie();let Y;z(()=>Y=Dt(H,1,"svelte-1n46o8q",null,Y,{active:l(n)==="db"})),j("click",H,()=>Ne("db")),D(T,H)};O(bn,T=>{var H;(H=l(s))!=null&&H.dbEnabled&&T(ft)})}var qt=v(bn,2);let Ti;var ki=v(m(qt),2);{var bi=T=>{var H=pie();D(T,H)},yn=T=>{var H=xie();D(T,H)};O(ki,T=>{l(Q)?T(bi):l(he)&&T(yn,1)})}var mn=v(qt,4),_n=v(m(mn),2),qe=m(_n),Xt=m(qe);Xt.nodeValue="v1.20.1 ";var yi=v(Xt);{var Ut=T=>{var H=vie();D(T,H)};O(yi,T=>{var H,Y;(H=l(s))!=null&&H.latestVersion&&!((Y=l(s))!=null&&Y.docker)&&T(Ut)})}var Li=v(qe,2);{var qi=T=>{var H=Cie(),Y=m(H),ne=v(m(Y));ne.textContent="v1.20.1";var le=v(ne,2);{var oe=de=>{var $e=mie(),Ft=v(dt($e)),je=m(Ft);z(()=>N(je,`v${l(s).latestVersion??""}`)),D(de,$e)},ye=de=>{var $e=_ie();D(de,$e)};O(le,de=>{var $e;($e=l(s))!=null&&$e.latestVersion?de(oe):de(ye,-1)})}var We=v(Y,2),be=m(We);{var Le=de=>{var $e=bie(),Ft=v(m($e));z(()=>N(Ft,` Update to v${l(s).latestVersion??""}`)),j("click",$e,ge),D(de,$e)};O(be,de=>{var $e;($e=l(s))!=null&&$e.latestVersion&&de(Le)})}var Me=v(be,2),nt=m(Me);let Jt;var ee=v(nt);z(()=>{Me.disabled=l(d),Jt=Dt(nt,0,"svelte-1n46o8q",null,Jt,{spinning:l(d)}),N(ee,` ${l(d)?"Checking…":"Check for updates"}`)}),j("click",H,de=>de.stopPropagation()),j("click",Me,Fe),D(T,H)};O(Li,T=>{var H;l(a)&&!((H=l(s))!=null&&H.docker)&&T(qi)})}var Gi=v(_n,2),K=m(Gi),Ae=v(K,2);{var ot=T=>{var H=kie(),Y=m(H);{var ne=be=>{var Le=Sie(),Me=m(Le);{var nt=$t=>{const wi=At(()=>Math.floor((Date.now()-l(s).startedAt)/1e3)),Xi=At(()=>Math.floor(l(wi)/86400)),$i=At(()=>Math.floor(l(wi)%86400/3600)),Hi=At(()=>Math.floor(l(wi)%3600/60));var we=Eie(),it=v(dt(we)),ut=m(it);z(()=>N(ut,`${l(Xi)>0?l(Xi)+"d ":""}${l($i)>0||l(Xi)>0?l($i)+"h ":""}${l(Hi)??""}m`)),D($t,we)};O(Me,$t=>{l(s).startedAt&&$t(nt)})}var Jt=v(Me,3),ee=m(Jt),de=v(Jt,3),$e=m(de),Ft=v(de,3),je=m(Ft),ze=v(Ft,2);{var kt=$t=>{var wi=yie(),Xi=v(dt(wi)),$i=m(Xi),Hi=v(Xi,3),we=m(Hi);z(()=>{N($i,l(s).matterNodes??0),N(we,l(s).matterEndpoints??0)}),D($t,wi)};O(ze,$t=>{l(s).matterEnabled&&$t(kt)})}var ct=v(ze,2);{var Qe=$t=>{var wi=wie(),Xi=v(dt(wi)),$i=m(Xi),Hi=v(Xi,3),we=m(Hi);z(()=>{N($i,l(s).dbDocs??"—"),N(we,l(s).dbViews??"—")}),D($t,wi)};O(ct,$t=>{l(s).dbEnabled&&$t(Qe)})}var mt=v(ct,3),_t=m(mt),tt=v(mt,3),Bt=m(tt),ei=v(tt,3),Mt=m(ei),Kt=v(ei,3),Ze=m(Kt),Et=v(Kt,3),Zt=m(Et),ji=v(Et,3),Wt=m(ji);z(()=>{N(ee,l(s).scripts),N($e,l(s).topics),N(je,l(s).mqttMsgPerSec??"—"),N(_t,l(s).handlers??"—"),N(Bt,l(s).memMb!=null?l(s).memMb+" MB":"—"),N(Mt,l(s).cpuPercent!=null?l(s).cpuPercent+" %":"—"),N(Ze,l(s).eluPercent!=null?l(s).eluPercent+" %":"—"),N(Zt,l(s).elMeanMs!=null?l(s).elMeanMs+" ms":"—"),N(Wt,l(s).elMaxMs!=null?l(s).elMaxMs+" ms":"—")}),D(be,Le)},le=be=>{var Le=Die();D(be,Le)};O(Y,be=>{l(s)?be(ne):be(le,-1)})}var oe=v(Y,2),ye=m(oe);{var We=be=>{var Le=Aie();j("click",Le,()=>{x(r,!1),De()}),D(be,Le)};O(ye,be=>{var Le;(Le=l(s))!=null&&Le.docker||be(We)})}j("click",H,be=>be.stopPropagation()),D(T,H)};O(Ae,T=>{l(r)&&T(ot)})}var Ge=v(Gi,2);let Pt;var Yt=v(Ge,2);{var gt=T=>{var H=Bie();j("click",H,I),D(T,H)};O(Yt,T=>{l(f)==="password"&&T(gt)})}var et=v(wt,2),X=m(et);ks(gl(X,{}),T=>x(M,T,!0),()=>l(M));var Pe=v(X,2);let ce;var fe=m(Pe);{let T=At(()=>l(n)==="scripts");SZ(fe,{get active(){return l(T)}})}var Gt=v(Pe,2);let ni;var gi=m(Gt);DJ(gi,{});var fi=v(Gt,2);let Ii;var pi=m(fi);aJ(pi,{});var Ci=v(fi,2);let He;var Ye=m(Ci);SQ(Ye,{});var jt=v(Ci,2);let Qt;var Mi=m(jt);sie(Mi,{});var oi=v(jt,2);let $;var ue=m(oi);kY(ue,{});var Ce=v(oi,2);let _e;var Je=m(Ce);xX(Je,{});var Ve=v(Ce,2);let St;var q=m(Ve);EX(q,{}),z(()=>{ci=Dt(ui,1,"svelte-1n46o8q",null,ci,{active:l(n)==="scripts"}),Ct=Dt(hi,1,"svelte-1n46o8q",null,Ct,{active:l(n)==="packages"}),zt=Dt(Ee,1,"svelte-1n46o8q",null,zt,{active:l(n)==="mqtt"}),Ti=Dt(qt,1,"svelte-1n46o8q",null,Ti,{active:l(n)==="logs"}),Pt=Dt(Ge,1,"nav-settings svelte-1n46o8q",null,Pt,{active:l(n)==="config"}),ce=Dt(Pe,1,"page-wrap svelte-1n46o8q",null,ce,{hidden:l(n)!=="scripts"}),ni=Dt(Gt,1,"page-wrap svelte-1n46o8q",null,ni,{hidden:l(n)!=="packages"}),Ii=Dt(fi,1,"page-wrap svelte-1n46o8q",null,Ii,{hidden:l(n)!=="mqtt"}),He=Dt(Ci,1,"page-wrap svelte-1n46o8q",null,He,{hidden:l(n)!=="matter"}),Qt=Dt(jt,1,"page-wrap svelte-1n46o8q",null,Qt,{hidden:l(n)!=="security"}),$=Dt(oi,1,"page-wrap svelte-1n46o8q",null,$,{hidden:l(n)!=="db"}),_e=Dt(Ce,1,"page-wrap svelte-1n46o8q",null,_e,{hidden:l(n)!=="config"}),St=Dt(Ve,1,"page-wrap svelte-1n46o8q",null,St,{hidden:l(n)!=="logs"})}),j("click",ui,()=>Ne("scripts")),j("click",hi,()=>Ne("packages")),j("click",Ee,()=>Ne("mqtt")),j("click",qt,()=>{Ne("logs"),x(Q,!1),x(he,!1)}),j("click",qe,T=>{T.stopPropagation(),x(a,!l(a)),x(r,!1)}),j("click",K,T=>{T.stopPropagation(),x(r,!l(r)),x(a,!1)}),j("click",Ge,()=>Ne("config")),D(vt,rt)};O(pe,vt=>{l(y)&&!l(p)&&vt(lt)})}var Ot=v(pe,2);{var Xe=vt=>{var rt=Iie(),wt=m(rt),ui=v(m(wt),4),ci=v(m(ui),2),hi=v(ui,2);{var Ct=Ee=>{var zt=Lie(),ii=m(zt);z(()=>N(ii,l(b))),D(Ee,zt)};O(hi,Ee=>{l(b)&&Ee(Ct)})}var ai=v(hi,2),Re=m(ai);z(()=>{ci.disabled=l(E),ai.disabled=l(E)||!l(C),N(Re,l(E)?"Signing in…":"Sign in")}),Ts("submit",wt,Ee=>{Ee.preventDefault(),A()}),yt(ci,()=>l(C),Ee=>x(C,Ee)),D(vt,rt)};O(Ot,vt=>{l(p)&&vt(Xe)})}var ht=v(Ot,2);{var me=vt=>{var rt=Pie();D(vt,rt)};O(ht,vt=>{l(R)&&vt(me)})}var Be=v(ht,2);{var st=vt=>{var rt=Tie();D(vt,rt)};O(Be,vt=>{l(u)&&vt(st)})}D(o,Oe),Xs()}lo(["click"]);aP(Rie,{target:document.getElementById("app")});export{W6 as t};