smart-home-engine 1.15.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/index-BWK6XOv0.js +234 -0
- package/dist/web/assets/{index-LTpStzqg.css → index-C-4azUYf.css} +1 -1
- package/dist/web/assets/{tsMode-acXHtETC.js → tsMode-WXSFC0ZU.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/sandbox/shedb-sandbox.js +56 -1
- package/src/web/broker-api.js +144 -0
- package/src/web/shedb.js +29 -2
- package/dist/web/assets/index-Vw4M_nL7.js +0 -232
|
@@ -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-WXSFC0ZU.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var i3=Object.defineProperty;var TS=o=>{throw TypeError(o)};var n3=(o,e,t)=>e in o?i3(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var Bn=(o,e,t)=>n3(o,typeof e!="symbol"?e+"":e,t),iC=(o,e,t)=>e.has(o)||TS("Cannot "+t);var ke=(o,e,t)=>(iC(o,e,"read from private field"),t?t.call(o):e.get(o)),En=(o,e,t)=>e.has(o)?TS("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),yn=(o,e,t,i)=>(iC(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),ts=(o,e,t)=>(iC(o,e,"access private method"),t);import{_ as gA,m as pA,l as Fi,A as Ao,C as Ze,I as ss,D as wp,a as Cs,g as xA,M as gi,b as Qi,E as la,c as q,r as Vn,d as Rr,e as S,f as s3,h as Qn,R as wn,S as qi,i as lo,j as Nr,k as Ln,n as un,o as Re,p as wt,K as Ds,q as Si,s as zt,t as Ns,u as ee,v as bn,O as Ha,w as Fs,P as Ii,x as nC,y as Sp,z as vA,B as ml,F as ca,G as s1,H as Ys,U as jn,J as Lf,L as Pi,N as wl,Q as o3,T as Eo,V as o1,W as r3,X as mA,$ as wi,Y as Rn,Z as Fn,a0 as as,a1 as tn,a2 as er,a3 as Bg,a4 as Ht,a5 as Yx,a6 as a3,a7 as l3,a8 as Rs,a9 as c3,aa as da,ab as ko,ac as Ri,ad as _A,ae as is,af as d3,ag as u3,ah as wo,ai as a0,aj as As,ak as V_,al as vo,am as Gc,an as Pw,ao as j_,ap as Ks,aq as If,ar as Zs,as as $_,at as U_,au as h3,av as Dp,aw as l0,ax as Ml,ay as f3,az as c0,aA as g3,aB as Tw,aC as p3,aD as x3,aE as MS,aF as bs,aG as _l,aH as mo,aI as ln,aJ as gl,aK as v3,aL as ja,aM as Yo,aN as Us,aO as ua,aP as Mw,aQ as Os,aR as vs,aS as Dv,aT as an,aU as bA,aV as m3,aW as Rw,aX as q_,aY as Nw,aZ as Ow,a_ as Ld,a$ as _3,b0 as Hw,b1 as b3,b2 as Ww,b3 as Rl,b4 as Nl,b5 as Pf,b6 as Fg,b7 as Ho,b8 as Ap,b9 as Av,ba as sC,bb as qn,bc as zw,bd as kp,be as G_,bf as C3,bg as CA,bh as Lg,bi as Tf,bj as Ig,bk as Bp,bl as K_,bm as Pn,bn as Kc,bo as Fp,bp as E3,bq as y3,br as Vw,bs as w3,bt as kv,bu as gr,bv as jw,bw as Mf,bx as Ol,by as d0,bz as vn,bA as Rf,bB as EA,bC as Lp,bD as S3,bE as Id,bF as _i,bG as RS,bH as Qx,bI as yA,bJ as Wr,bK as sa,bL as Zn,bM as Nf,bN as Fr,bO as Of,bP as rs,bQ as Pg,bR as Zu,bS as r1,bT as wA,bU as SA,bV as DA,bW as $w,bX as Po,bY as Wn,bZ as Ip,b_ as AA,b$ as bl,c0 as Z_,c1 as D3,c2 as zh,c3 as NS,c4 as Pp,c5 as kA,c6 as Vh,c7 as A3,c8 as yr,c9 as X_,ca as k3,cb as Bo,cc as ha,cd as Tp,ce as Tg,cf as BA,cg as ur,ch as Mp,ci as Y_,cj as B3,ck as F3,cl as L3,cm as u0,cn as $a,co as qs,cp as I3,cq as Uw,cr as P3,cs as T3,ct as OS,cu as M3,cv as Rp,cw as Sl,cx as a1,cy as Bu,cz as Dl,cA as R3,cB as Wa,cC as Lr,cD as qo,cE as HS,cF as uo,cG as Np,cH as Oc,cI as Ua,cJ as N3,cK as fa,cL as Mg,cM as Q_,cN as FA,cO as O3,cP as H3,cQ as qw,cR as W3,cS as Rg,cT as z3,cU as uc,cV as Ng,cW as WS,cX as V3,cY as j3,cZ as Ka,c_ as $3,c$ as Gw,d0 as LA,d1 as IA,d2 as PA,d3 as TA,d4 as U3,d5 as q3,d6 as MA,d7 as RA,d8 as G3,d9 as Kw,da as K3,db as Z3,dc as ds,dd as X3,de as Zw,df as Y3,dg as jh,dh as zS,di as Q3,dj as J3,dk as e4,dl as t4,dm as i4,dn as n4,dp as Hf,dq as J_,dr as l1,ds as s4,dt as o4,du as VS,dv as c1,dw as r4,dx as jS,dy as oC,dz as a4,dA as NA,dB as l4,dC as OA,dD as d1,dE as c4,dF as d4,dG as u4,dH as HA,dI as WA,dJ as h4,dK as Bv,dL as zA,dM as eb,dN as f4,dO as g4,dP as Hc,dQ as Xw,dR as p4,dS as $S,dT as US,dU as x4,dV as $h,dW as VA,dX as v4,dY as m4,dZ as _4,d_ as b4,d$ as jA,e0 as $A,e1 as UA,e2 as qA,e3 as C4,e4 as za,e5 as qS,e6 as E4,e7 as Op,e8 as y4,e9 as $0,ea as GA,eb as GS,ec as Og,ed as KA,ee as Fv,ef as w4,eg as ZA,eh as S4,ei as XA,ej as D4,ek as A4,el as YA,em as QA,en as Al,eo as tb,ep as k4,eq as JA,er as Qo,es as Pd,et as ek,eu as B4,ev as F4,ew as tk,ex as ik,ey as L4,ez as nk,eA as sk,eB as Hg,eC as I4,eD as P4,eE as T4,eF as M4,eG as P0,eH as KS,eI as R4,eJ as N4,eK as O4,eL as Lv,eM as eo,eN as H4,eO as u1,eP as Xu,eQ as W4,eR as hl,eS as z4,eT as V4,eU as ok,eV as j4,eW as ag,eX as $4,eY as U4,eZ as q4,e_ as G4,e$ as ZS,f0 as XS,f1 as YS,f2 as Yu,f3 as Yw,f4 as rk,f5 as h1,f6 as Jx,f7 as ak,f8 as Iv,f9 as K4,fa as Z4,fb as X4,fc as Y4,fd as Qw,fe as lk,ff as Q4,fg as Pv,fh as ck,fi as dk,fj as J4,fk as eL,fl as tL,fm as iL,fn as nL,fo as sL,fp as oL,fq as rL,fr as uk,fs as aL,ft as Tv,fu as hk,fv as lL,fw as fk,fx as cL,fy as gk,fz as pk,fA as dL,fB as QS,fC as xk,fD as JS,fE as uL,fF as rC,fG as e8,fH as hL,fI as fL,fJ as gL,fK as Ia,fL as Wc,fM as pL,fN as t8,fO as ev,fP as xL,fQ as pl,fR as ib,fS as f1,fT as vL,fU as vk,fV as mk,fW as ho,fX as i8,fY as vx,fZ as Jw,f_ as mL,f$ as _L,g0 as bL,g1 as CL,g2 as EL,g3 as yL,g4 as wL,g5 as SL,g6 as n8,g7 as DL,g8 as AL,g9 as kL,ga as Wf,gb as lg,gc as _k,gd as BL,ge as e9,gf as tv,gg as mx,gh as aC,gi as FL,gj as LL,gk as bk,gl as IL,gm as t9,gn as PL,go as TL,gp as Ck,gq as nb,gr as ML,gs as Mv,gt as i9,gu as n9,gv as s9,gw as Ek,gx as yk,gy as wk,gz as Sk,gA as Dk,gB as Ak,gC as kk,gD as s8,gE as Bk,gF as mh,gG as RL,gH as NL,gI as OL,gJ as HL,gK as Fk,gL as WL,gM as zL,gN as o8,gO as g1,gP as mc,gQ as VL,gR as jL,gS as $L,gT as UL,gU as qL,gV as GL,gW as r8,gX as o9,gY as p1,gZ as KL,g_ as x1,g$ as ZL,h0 as XL,h1 as YL,h2 as QL,h3 as r9,h4 as Lk,h5 as a8,h6 as l8,h7 as JL,h8 as e7,h9 as t7,ha as c8,hb as lC,hc as i7,hd as n7,he as s7,hf as cC,hg as Ik,hh as Pk,hi as Tk,hj as Mk,hk as kl,hl as Rk,hm as a9,hn as d8,ho as o7,hp as Nk,hq as r7,hr as a7,hs as sb,ht as ob,hu as Qu,hv as rb,hw as Hp,hx as l7,hy as ab,hz as c7,hA as d7,hB as u7,hC as Ok,hD as T0,hE as h7,hF as f7,hG as g7,hH as p7,hI as Wp,hJ as x7,hK as Hk,hL as Wk,hM as zk,hN as v1,hO as v7,hP as m7,hQ as _7,hR as b7,hS as C7,hT as m1,hU as E7,hV as y7,hW as w7,hX as S7,hY as D7,hZ as A7,h_ as k7,h$ as B7,i0 as Vk,i1 as F7,i2 as L7,i3 as I7,i4 as u8,i5 as P7,i6 as T7,i7 as vd,i8 as Vo,i9 as _1,ia as jk,ib as M7,ic as R7}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 $k=!1;var l9=Array.isArray,N7=Array.prototype.indexOf,Rv=Array.prototype.includes,lb=Array.from,O7=Object.defineProperty,lf=Object.getOwnPropertyDescriptor,H7=Object.getOwnPropertyDescriptors,W7=Object.prototype,z7=Array.prototype,Uk=Object.getPrototypeOf,h8=Object.isExtensible;const cb=()=>{};function V7(o){for(var e=0;e<o.length;e++)o[e]()}function qk(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function j7(o,e,t=!1){return o===void 0?t?e():e:o}function f8(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 po=2,zf=4,db=8,Gk=1<<24,oa=16,aa=32,zc=64,b1=128,Tr=512,to=1024,so=2048,qa=4096,Mo=8192,Mr=16384,h0=32768,C1=1<<25,Vf=65536,Nv=1<<17,$7=1<<18,f0=1<<19,U7=1<<20,Ra=1<<25,Fu=65536,Ov=1<<21,cf=1<<22,_c=1<<23,Td=Symbol("$state"),q7=Symbol("legacy props"),G7=Symbol(""),iv=Symbol("attributes"),E1=Symbol("class"),y1=Symbol("style"),U0=Symbol("text"),nv=Symbol("form reset"),ub=new class extends Error{constructor(){super(...arguments);Bn(this,"name","StaleReactionError");Bn(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var uA;const K7=!!((uA=globalThis.document)!=null&&uA.contentType)&&globalThis.document.contentType.includes("xml");function Kk(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Z7(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function X7(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Y7(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Q7(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function J7(o){throw new Error("https://svelte.dev/e/effect_orphan")}function eI(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function tI(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function iI(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function nI(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function sI(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function oI(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const rI=1,aI=2,Zk=4,lI=8,cI=16,dI=1,uI=4,hI=8,fI=16,gI=1,pI=2,Js=Symbol("uninitialized"),Xk="http://www.w3.org/1999/xhtml",xI="http://www.w3.org/2000/svg",vI="http://www.w3.org/1998/Math/MathML";function mI(){console.warn("https://svelte.dev/e/derived_inert")}function _I(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function bI(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Yk(o){return o===this.v}function CI(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function Qk(o){return!CI(o,this.v)}let EI=!1,go=null;function jf(o){go=o}function Is(o,e=!1,t){go={p:go,i:!1,c:null,e:null,s:o,x:null,r:zn,l:null}}function Ps(o){var e=go,t=e.e;if(t!==null){e.e=null;for(var i of t)b6(i)}return o!==void 0&&(e.x=o),e.i=!0,go=e.p,o??{}}function Jk(){return!0}let Ed=[];function e6(){var o=Ed;Ed=[],V7(o)}function bc(o){if(Ed.length===0&&!dg){var e=Ed;queueMicrotask(()=>{e===Ed&&e6()})}Ed.push(o)}function yI(){for(;Ed.length>0;)e6()}function t6(o){var e=zn;if(e===null)return Hn.f|=_c,o;if((e.f&h0)===0&&(e.f&zf)===0)throw o;hc(o,e)}function hc(o,e){for(;e!==null;){if((e.f&b1)!==0){if((e.f&h0)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const wI=-7169;function Vs(o,e){o.f=o.f&wI|e}function c9(o){(o.f&Tr)!==0||o.deps===null?Vs(o,to):Vs(o,qa)}function i6(o){if(o!==null)for(const e of o)(e.f&po)===0||(e.f&Fu)===0||(e.f^=Fu,i6(e.deps))}function n6(o,e,t){(o.f&so)!==0?e.add(o):(o.f&qa)!==0&&t.add(o),i6(o.deps),Vs(o,to)}let _x=!1;function SI(o){var e=_x;try{return _x=!1,[o(),_x]}finally{_x=e}}let dC=null,_h=null,sn=null,cg=null,co=null,w1=null,dg=!1,uC=!1,Uh=null,sv=null;var g8=0;let DI=1;var ff,lc,Dd,gf,pf,xf,ll,vf,jo,mp,cl,Zr,ka,mf,Ad,us,S1,q0,D1,s6,o6,Mh,AI,G0;const Zm=class Zm{constructor(){En(this,us);Bn(this,"id",DI++);En(this,ff,!1);Bn(this,"linked",!0);En(this,lc,null);En(this,Dd,null);Bn(this,"async_deriveds",new Map);Bn(this,"current",new Map);Bn(this,"previous",new Map);En(this,gf,new Set);En(this,pf,new Set);En(this,xf,0);En(this,ll,new Map);En(this,vf,null);En(this,jo,[]);En(this,mp,[]);En(this,cl,new Set);En(this,Zr,new Set);En(this,ka,new Map);En(this,mf,new Set);Bn(this,"is_fork",!1);En(this,Ad,!1);_h===null?dC=_h=this:(yn(_h,Dd,this),yn(this,lc,_h)),_h=this}skip_effect(e){ke(this,ka).has(e)||ke(this,ka).set(e,{d:[],m:[]}),ke(this,mf).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=ke(this,ka).get(e);if(i){ke(this,ka).delete(e);for(var n of i.d)Vs(n,so),t(n);for(n of i.m)Vs(n,qa),t(n)}ke(this,mf).add(e)}capture(e,t,i=!1){e.v!==Js&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&_c)===0&&(this.current.set(e,[t,i]),co==null||co.set(e,t)),this.is_fork||(e.v=t)}activate(){sn=this}deactivate(){sn=null,co=null}flush(){try{uC=!0,sn=this,ts(this,us,q0).call(this)}finally{g8=0,w1=null,Uh=null,sv=null,uC=!1,sn=null,co=null,Md.clear()}}discard(){var e;for(const t of ke(this,pf))t(this);ke(this,pf).clear(),ts(this,us,G0).call(this),(e=ke(this,vf))==null||e.resolve()}register_created_effect(e){ke(this,mp).push(e)}increment(e,t){if(yn(this,xf,ke(this,xf)+1),e){let i=ke(this,ll).get(t)??0;ke(this,ll).set(t,i+1)}}decrement(e,t){if(yn(this,xf,ke(this,xf)-1),e){let i=ke(this,ll).get(t)??0;i===1?ke(this,ll).delete(t):ke(this,ll).set(t,i-1)}ke(this,Ad)||(yn(this,Ad,!0),bc(()=>{yn(this,Ad,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)ke(this,cl).add(i);for(const i of t)ke(this,Zr).add(i);e.clear(),t.clear()}oncommit(e){ke(this,gf).add(e)}ondiscard(e){ke(this,pf).add(e)}settled(){return(ke(this,vf)??yn(this,vf,qk())).promise}static ensure(){if(sn===null){const e=sn=new Zm;!uC&&!dg&&bc(()=>{ke(e,ff)||e.flush()})}return sn}apply(){{co=null;return}}schedule(e){var n;if(w1=e,(n=e.b)!=null&&n.is_pending&&(e.f&(zf|db|Gk))!==0&&(e.f&h0)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(Uh!==null&&t===zn&&(Hn===null||(Hn.f&po)===0))return;if((i&(zc|aa))!==0){if((i&to)===0)return;t.f^=to}}ke(this,jo).push(t)}};ff=new WeakMap,lc=new WeakMap,Dd=new WeakMap,gf=new WeakMap,pf=new WeakMap,xf=new WeakMap,ll=new WeakMap,vf=new WeakMap,jo=new WeakMap,mp=new WeakMap,cl=new WeakMap,Zr=new WeakMap,ka=new WeakMap,mf=new WeakMap,Ad=new WeakMap,us=new WeakSet,S1=function(){if(this.is_fork)return!0;for(const i of ke(this,ll).keys()){for(var e=i,t=!1;e.parent!==null;){if(ke(this,ka).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},q0=function(){var d,u,f,g;yn(this,ff,!0),g8++>1e3&&(ts(this,us,G0).call(this),BI());for(const p of ke(this,cl))ke(this,Zr).delete(p),Vs(p,so),this.schedule(p);for(const p of ke(this,Zr))Vs(p,qa),this.schedule(p);const e=ke(this,jo);yn(this,jo,[]),this.apply();var t=Uh=[],i=[],n=sv=[];for(const p of e)try{ts(this,us,D1).call(this,p,t,i)}catch(C){throw l6(p),ts(this,us,S1).call(this)||this.discard(),C}if(sn=null,n.length>0){var s=Zm.ensure();for(const p of n)s.schedule(p)}if(Uh=null,sv=null,ts(this,us,S1).call(this)){ts(this,us,Mh).call(this,i),ts(this,us,Mh).call(this,t);for(const[p,C]of ke(this,ka))a6(p,C);n.length>0&&ts(d=sn,us,q0).call(d);return}const r=ts(this,us,s6).call(this);if(r){ts(this,us,Mh).call(this,i),ts(this,us,Mh).call(this,t),ts(u=r,us,o6).call(u,this);return}ke(this,cl).clear(),ke(this,Zr).clear();for(const p of ke(this,gf))p(this);ke(this,gf).clear(),cg=this,p8(i),p8(t),cg=null,(f=ke(this,vf))==null||f.resolve();var a=sn;if(ke(this,xf)===0&&(ke(this,jo).length===0||a!==null)&&ts(this,us,G0).call(this),ke(this,jo).length>0)if(a!==null){const p=a;ke(p,jo).push(...ke(this,jo).filter(C=>!ke(p,jo).includes(C)))}else a=this;a!==null&&ts(g=a,us,q0).call(g)},D1=function(e,t,i){e.f^=to;for(var n=e.first;n!==null;){var s=n.f,r=(s&(aa|zc))!==0,a=r&&(s&to)!==0,d=a||(s&Mo)!==0||ke(this,ka).has(n);if(!d&&n.fn!==null){r?n.f^=to:(s&zf)!==0?t.push(n):Vp(n)&&((s&oa)!==0&&ke(this,Zr).add(n),Uf(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}}},s6=function(){for(var e=ke(this,lc);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=ke(e,lc)}return null},o6=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,cl),ke(e,Zr));const t=n=>{var s=n.reactions;if(s!==null)for(const d of s){var r=d.f;if((r&po)!==0)t(d);else{var a=d;r&(cf|oa)&&!this.async_deriveds.has(a)&&(ke(this,Zr).delete(a),Vs(a,so),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),ts(i=e,us,G0).call(i),sn=this,ts(this,us,q0).call(this)},Mh=function(e){for(var t=0;t<e.length;t+=1)n6(e[t],ke(this,cl),ke(this,Zr))},AI=function(){var f;for(let g=dC;g!==null;g=ke(g,Dd)){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,ff)){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,mf))g.unskip_effect(p,C=>{var b;(C.f&(oa|cf))!==0?g.schedule(C):ts(b=g,us,Mh).call(b,[C])});g.activate();var s=new Set,r=new Map;for(var a of t)r6(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,mp))(p.f&(Mr|Mo|Nv))===0&&d9(p,d,r)&&((p.f&(cf|oa))!==0?(Vs(p,so),g.schedule(p)):ke(g,cl).add(p));if(ke(g,jo).length>0&&!ke(g,Ad)){g.apply();for(var u of ke(g,jo))ts(f=g,us,D1).call(f,u,[],[]);yn(g,jo,[])}g.deactivate()}}}},G0=function(){if(this.linked){var e=ke(this,lc),t=ke(this,Dd);e===null?dC=t:yn(e,Dd,t),t===null?_h=e:yn(t,lc,e),this.linked=!1}};let Lu=Zm;function kI(o){var e=dg;dg=!0;try{for(var t;;){if(yI(),sn===null)return t;sn.flush()}}finally{dg=e}}function BI(){try{eI()}catch(o){hc(o,w1)}}let qr=null;function p8(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(Mr|Mo))===0&&Vp(i)&&(qr=new Set,Uf(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&y6(i),(qr==null?void 0:qr.size)>0)){Md.clear();for(const n of qr){if((n.f&(Mr|Mo))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)qr.has(r)&&(qr.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const d=s[a];(d.f&(Mr|Mo))===0&&Uf(d)}}qr.clear()}}qr=null}}function r6(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&po)!==0?r6(n,e,t,i):(s&(cf|oa))!==0&&(s&so)===0&&d9(n,e,i)&&(Vs(n,so),u9(n))}}function d9(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(Rv.call(e,n))return!0;if((n.f&po)!==0&&d9(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function u9(o){sn.schedule(o)}function a6(o,e){if(!((o.f&aa)!==0&&(o.f&to)!==0)){(o.f&so)!==0?e.d.push(o):(o.f&qa)!==0&&e.m.push(o),Vs(o,to);for(var t=o.first;t!==null;)a6(t,e),t=t.next}}function l6(o){Vs(o,to);for(var e=o.first;e!==null;)l6(e),e=e.next}function FI(o){let e=0,t=Iu(0),i;return()=>{p9()&&(l(t),fb(()=>(e===0&&(i=Wl(()=>o(()=>ug(t)))),e+=1,()=>{bc(()=>{e-=1,e===0&&(i==null||i(),i=void 0,ug(t))})})))}}var LI=Vf|f0;function II(o,e,t,i){new PI(o,e,t,i)}var Sr,Iw,Dr,kd,$o,Ar,Lo,ar,dl,Bd,cc,_f,_p,bp,ul,Xm,js,TI,MI,RI,A1,ov,rv,k1,B1;class PI{constructor(e,t,i,n){En(this,js);Bn(this,"parent");Bn(this,"is_pending",!1);Bn(this,"transform_error");En(this,Sr);En(this,Iw,null);En(this,Dr);En(this,kd);En(this,$o);En(this,Ar,null);En(this,Lo,null);En(this,ar,null);En(this,dl,null);En(this,Bd,0);En(this,cc,0);En(this,_f,!1);En(this,_p,new Set);En(this,bp,new Set);En(this,ul,null);En(this,Xm,FI(()=>(yn(this,ul,Iu(ke(this,Bd))),()=>{yn(this,ul,null)})));var s;yn(this,Sr,e),yn(this,Dr,t),yn(this,kd,r=>{var a=zn;a.b=this,a.f|=b1,i(r)}),this.parent=zn.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),yn(this,$o,m9(()=>{ts(this,js,A1).call(this)},LI))}defer_effect(e){n6(e,ke(this,_p),ke(this,bp))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!ke(this,Dr).pending}update_pending_count(e,t){ts(this,js,k1).call(this,e,t),yn(this,Bd,ke(this,Bd)+e),!(!ke(this,ul)||ke(this,_f))&&(yn(this,_f,!0),bc(()=>{yn(this,_f,!1),ke(this,ul)&&$f(ke(this,ul),ke(this,Bd))}))}get_effect_pending(){return ke(this,Xm).call(this),l(ke(this,ul))}error(e){if(!ke(this,Dr).onerror&&!ke(this,Dr).failed)throw e;sn!=null&&sn.is_fork?(ke(this,Ar)&&sn.skip_effect(ke(this,Ar)),ke(this,Lo)&&sn.skip_effect(ke(this,Lo)),ke(this,ar)&&sn.skip_effect(ke(this,ar)),sn.oncommit(()=>{ts(this,js,B1).call(this,e)})):ts(this,js,B1).call(this,e)}}Sr=new WeakMap,Iw=new WeakMap,Dr=new WeakMap,kd=new WeakMap,$o=new WeakMap,Ar=new WeakMap,Lo=new WeakMap,ar=new WeakMap,dl=new WeakMap,Bd=new WeakMap,cc=new WeakMap,_f=new WeakMap,_p=new WeakMap,bp=new WeakMap,ul=new WeakMap,Xm=new WeakMap,js=new WeakSet,TI=function(){try{yn(this,Ar,kr(()=>ke(this,kd).call(this,ke(this,Sr))))}catch(e){this.error(e)}},MI=function(e){const t=ke(this,Dr).failed;t&&yn(this,ar,kr(()=>{t(ke(this,Sr),()=>e,()=>()=>{})}))},RI=function(){const e=ke(this,Dr).pending;e&&(this.is_pending=!0,yn(this,Lo,kr(()=>e(ke(this,Sr)))),bc(()=>{var t=yn(this,dl,document.createDocumentFragment()),i=Cl();t.append(i),yn(this,Ar,ts(this,js,rv).call(this,()=>kr(()=>ke(this,kd).call(this,i)))),ke(this,cc)===0&&(ke(this,Sr).before(t),yn(this,dl,null),Nd(ke(this,Lo),()=>{yn(this,Lo,null)}),ts(this,js,ov).call(this,sn))}))},A1=function(){try{if(this.is_pending=this.has_pending_snippet(),yn(this,cc,0),yn(this,Bd,0),yn(this,Ar,kr(()=>{ke(this,kd).call(this,ke(this,Sr))})),ke(this,cc)>0){var e=yn(this,dl,document.createDocumentFragment());b9(ke(this,Ar),e);const t=ke(this,Dr).pending;yn(this,Lo,kr(()=>t(ke(this,Sr))))}else ts(this,js,ov).call(this,sn)}catch(t){this.error(t)}},ov=function(e){this.is_pending=!1,e.transfer_effects(ke(this,_p),ke(this,bp))},rv=function(e){var t=zn,i=Hn,n=go;Ga(ke(this,$o)),Or(ke(this,$o)),jf(ke(this,$o).ctx);try{return Lu.ensure(),e()}catch(s){return t6(s),null}finally{Ga(t),Or(i),jf(n)}},k1=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&ts(i=this.parent,js,k1).call(i,e,t);return}yn(this,cc,ke(this,cc)+e),ke(this,cc)===0&&(ts(this,js,ov).call(this,t),ke(this,Lo)&&Nd(ke(this,Lo),()=>{yn(this,Lo,null)}),ke(this,dl)&&(ke(this,Sr).before(ke(this,dl)),yn(this,dl,null)))},B1=function(e){ke(this,Ar)&&(Jo(ke(this,Ar)),yn(this,Ar,null)),ke(this,Lo)&&(Jo(ke(this,Lo)),yn(this,Lo,null)),ke(this,ar)&&(Jo(ke(this,ar)),yn(this,ar,null));var t=ke(this,Dr).onerror;let i=ke(this,Dr).failed;var n=!1,s=!1;const r=()=>{if(n){bI();return}n=!0,s&&oI(),ke(this,ar)!==null&&Nd(ke(this,ar),()=>{yn(this,ar,null)}),ts(this,js,rv).call(this,()=>{ts(this,js,A1).call(this)})},a=d=>{try{s=!0,t==null||t(d,r),s=!1}catch(u){hc(u,ke(this,$o)&&ke(this,$o).parent)}i&&yn(this,ar,ts(this,js,rv).call(this,()=>{try{return kr(()=>{var u=zn;u.b=this,u.f|=b1,i(ke(this,Sr),()=>d,()=>r)})}catch(u){return hc(u,ke(this,$o).parent),null}}))};bc(()=>{var d;try{d=this.transform_error(e)}catch(u){hc(u,ke(this,$o)&&ke(this,$o).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(a,u=>hc(u,ke(this,$o)&&ke(this,$o).parent)):a(d)})};function NI(o,e,t,i){const n=Wg;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=zn,a=OI(),d=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((r.f&Mr)===0){a();try{i(p)}catch(C){hc(C,r)}Hv()}}var f=c6();if(t.length===0){d.then(()=>u(e.map(n))).finally(f);return}function g(){Promise.all(t.map(p=>HI(p))).then(p=>u([...e.map(n),...p])).catch(p=>hc(p,r)).finally(f)}d?d.then(()=>{a(),g(),Hv()}):g()}function OI(){var o=zn,e=Hn,t=go,i=sn;return function(s=!0){Ga(o),Or(e),jf(t),s&&(o.f&Mr)===0&&(i==null||i.activate(),i==null||i.apply())}}function Hv(o=!0){Ga(null),Or(null),jf(null),o&&(sn==null||sn.deactivate())}function c6(){var o=zn,e=o.b,t=sn,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 Wg(o){var e=po|so;return zn!==null&&(zn.f|=f0),{ctx:go,deps:null,effects:null,equals:Yk,f:e,fn:o,reactions:null,rv:0,v:Js,wv:0,parent:zn,ac:null}}const bx=Symbol("obsolete");function HI(o,e,t){let i=zn;i===null&&Z7();var n=void 0,s=Iu(Js),r=!Hn,a=new Set;return YI(()=>{var C,b;var d=zn,u=qk();n=u.promise;try{Promise.resolve(o()).then(u.resolve,E=>{E!==ub&&u.reject(E)}).finally(Hv)}catch(E){u.reject(E),Hv()}var f=sn;if(r){if((d.f&h0)!==0)var g=c6();if((C=i.b)!=null&&C.is_rendered())(b=f.async_deriveds.get(d))==null||b.reject(bx);else for(const E of a.values())E.reject(bx);a.add(u),f.async_deriveds.set(d,u)}const p=(E,w=void 0)=>{g==null||g(),a.delete(u),w!==bx&&(f.activate(),w?(s.f|=_c,$f(s,w)):((s.f&_c)!==0&&(s.f^=_c),$f(s,E)),f.deactivate())};u.promise.then(p,E=>p(null,E||"unknown"))}),x9(()=>{for(const d of a)d.reject(bx)}),new Promise(d=>{function u(f){function g(){f===n?d(s):u(n)}f.then(g,g)}u(n)})}function Rt(o){const e=Wg(o);return D6(e),e}function h9(o){const e=Wg(o);return e.equals=Qk,e}function WI(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)Jo(e[t])}}function f9(o){var e,t=zn,i=o.parent;if(!Bl&&i!==null&&o.v!==Js&&(i.f&(Mr|Mo))!==0)return mI(),o.v;Ga(i);try{o.f&=~Fu,WI(o),e=F6(o)}finally{Ga(t)}return e}function d6(o){var e=f9(o);if(!o.equals(e)&&(o.wv=k6(),(!(sn!=null&&sn.is_fork)||o.deps===null)&&(sn!==null?(sn.capture(o,e,!0),cg==null||cg.capture(o,e,!0)):o.v=e,o.deps===null))){Vs(o,to);return}Bl||(co!==null?(p9()||sn!=null&&sn.is_fork)&&co.set(o,e):c9(o))}function zI(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(ub),i.fn!==null&&(i.teardown=cb),i.ac=null,zg(i,0),_9(i))}function u6(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&Uf(e)}let Wv=new Set;const Md=new Map;let h6=!1;function Iu(o,e){var t={f:0,v:o,reactions:null,equals:Yk,rv:0,wv:0};return t}function B(o,e){const t=Iu(o);return D6(t),t}function VI(o,e=!1,t=!0){const i=Iu(o);return e||(i.equals=Qk),i}function x(o,e,t=!1){Hn!==null&&(!ra||(Hn.f&Nv)!==0)&&Jk()&&(Hn.f&(po|oa|cf|Nv))!==0&&(Va===null||!Va.has(o))&&sI();let i=t?Di(e):e;return $f(o,i,sv)}function $f(o,e,t=null){if(!o.equals(e)){Md.set(o,Bl?e:o.v);var i=Lu.ensure();if(i.capture(o,e),(o.f&po)!==0){const n=o;(o.f&so)!==0&&f9(n),co===null&&c9(n)}o.wv=k6(),f6(o,so,t),zn!==null&&(zn.f&to)!==0&&(zn.f&(aa|zc))===0&&(wr===null?JI([o]):wr.push(o)),!i.is_fork&&Wv.size>0&&!h6&&jI()}return e}function jI(){h6=!1;for(const o of Wv){(o.f&to)!==0&&Vs(o,qa);let e;try{e=Vp(o)}catch{e=!0}e&&Uf(o)}Wv.clear()}function x8(o,e=1){var t=l(o),i=e===1?t++:t--;return x(o,t),i}function ug(o){x(o,o.v+1)}function f6(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&so)===0;if(d&&Vs(r,e),(a&Nv)!==0)Wv.add(r);else if((a&po)!==0){var u=r;co==null||co.delete(u),(a&Fu)===0&&(a&Tr&&(zn===null||(zn.f&Ov)===0)&&(r.f|=Fu),f6(u,qa,t))}else if(d){var f=r;(a&oa)!==0&&qr!==null&&qr.add(f),t!==null?t.push(f):u9(f)}}}function Di(o){if(typeof o!="object"||o===null||Td in o)return o;const e=Uk(o);if(e!==W7&&e!==z7)return o;var t=new Map,i=l9(o),n=B(0),s=Od,r=a=>{if(Od===s)return a();var d=Hn,u=Od;Or(null),b8(s);var f=a();return Or(d),b8(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)&&iI();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(Js));t.set(d,f),ug(n)}}else x(u,Js),ug(n);return!0},get(a,d,u){var C;if(d===Td)return o;var f=t.get(d),g=d in a;if(f===void 0&&(!g||(C=lf(a,d))!=null&&C.writable)&&(f=r(()=>{var b=Di(g?a[d]:Js),E=B(b);return E}),t.set(d,f)),f!==void 0){var p=l(f);return p===Js?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!==Js)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(a,d){var p;if(d===Td)return!0;var u=t.get(d),f=u!==void 0&&u.v!==Js||Reflect.has(a,d);if(u!==void 0||zn!==null&&(!f||(p=lf(a,d))!=null&&p.writable)){u===void 0&&(u=r(()=>{var C=f?Di(a[d]):Js,b=B(C);return b}),t.set(d,u));var g=l(u);if(g===Js)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,Js):C in a&&(b=r(()=>B(Js)),t.set(C+"",b))}if(g===void 0)(!p||(M=lf(a,d))!=null&&M.writable)&&(g=r(()=>B(void 0)),x(g,Di(u)),t.set(d,g));else{p=g.v!==Js;var E=r(()=>Di(u));x(g,E)}var w=Reflect.getOwnPropertyDescriptor(a,d);if(w!=null&&w.set&&w.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)}ug(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!==Js});for(var[u,f]of t)f.v!==Js&&!(u in a)&&d.push(u);return d},setPrototypeOf(){nI()}})}function v8(o){try{if(o!==null&&typeof o=="object"&&Td in o)return o[Td]}catch{}return o}function $I(o,e){return Object.is(v8(o),v8(e))}var Rd,g6,p6,x6,v6;function UI(){if(Rd===void 0){Rd=window,g6=document,p6=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;x6=lf(e,"firstChild").get,v6=lf(e,"nextSibling").get,h8(o)&&(o[E1]=void 0,o[iv]=null,o[y1]=void 0,o.__e=void 0),h8(t)&&(t[U0]=void 0)}}function Cl(o=""){return document.createTextNode(o)}function Na(o){return x6.call(o)}function zp(o){return v6.call(o)}function m(o,e){return Na(o)}function Et(o,e=!1){{var t=Na(o);return t instanceof Comment&&t.data===""?zp(t):t}}function v(o,e=1,t=!1){let i=o;for(;e--;)i=zp(i);return i}function qI(o){o.textContent=""}function m6(){return!1}function _6(o,e,t){return e==null||e===Xk?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let m8=!1;function GI(){m8||(m8=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[nv])==null||e.call(t)})},{capture:!0}))}function hb(o){var e=Hn,t=zn;Or(null),Ga(null);try{return o()}finally{Or(e),Ga(t)}}function g9(o,e,t,i=t){o.addEventListener(e,()=>hb(t));const n=o[nv];n?o[nv]=()=>{n(),i(!0)}:o[nv]=()=>i(!0),GI()}function KI(o){zn===null&&(Hn===null&&J7(),Q7()),Bl&&Y7()}function ZI(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function Hl(o,e){var t=zn;t!==null&&(t.f&Mo)!==0&&(o|=Mo);var i={ctx:go,deps:null,nodes:null,f:o|so|Tr,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};sn==null||sn.register_created_effect(i);var n=i;if((o&zf)!==0)Uh!==null?Uh.push(i):Lu.ensure().schedule(i);else if(e!==null){try{Uf(i)}catch(r){throw Jo(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&f0)===0&&(n=n.first,(o&oa)!==0&&(o&Vf)!==0&&n!==null&&(n.f|=Vf))}if(n!==null&&(n.parent=t,t!==null&&ZI(n,t),Hn!==null&&(Hn.f&po)!==0&&(o&zc)===0)){var s=Hn;(s.effects??(s.effects=[])).push(n)}return i}function p9(){return Hn!==null&&!ra}function x9(o){const e=Hl(db,null);return Vs(e,to),e.teardown=o,e}function Kn(o){KI();var e=zn.f,t=!Hn&&(e&aa)!==0&&go!==null&&!go.i;if(t){var i=go;(i.e??(i.e=[])).push(o)}else return b6(o)}function b6(o){return Hl(zf|U7,o)}function XI(o){Lu.ensure();const e=Hl(zc|f0,o);return(t={})=>new Promise(i=>{t.outro?Nd(e,()=>{Jo(e),i(void 0)}):(Jo(e),i(void 0))})}function v9(o){return Hl(zf,o)}function YI(o){return Hl(cf|f0,o)}function fb(o,e=0){return Hl(db|e,o)}function z(o,e=[],t=[],i=[]){NI(i,e,t,n=>{Hl(db,()=>o(...n.map(l)))})}function m9(o,e=0){var t=Hl(oa|e,o);return t}function kr(o){return Hl(aa|f0,o)}function C6(o){var e=o.teardown;if(e!==null){const t=Bl,i=Hn;_8(!0),Or(null);try{e.call(null)}finally{_8(t),Or(i)}}}function _9(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&hb(()=>{n.abort(ub)});var i=t.next;(t.f&zc)!==0?t.parent=null:Jo(t,e),t=i}}function QI(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&aa)===0&&Jo(e),e=t}}function Jo(o,e=!0){var t=!1;(e||(o.f&$7)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(E6(o.nodes.start,o.nodes.end),t=!0),Vs(o,C1),_9(o,e&&!t),zg(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();C6(o),o.f^=C1,o.f|=Mr;var n=o.parent;n!==null&&n.first!==null&&y6(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function E6(o,e){for(;o!==null;){var t=o===e?null:zp(o);o.remove(),o=t}}function y6(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 Nd(o,e,t=!0){var i=[];w6(o,i,!0);var n=()=>{t&&Jo(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function w6(o,e,t){if((o.f&Mo)===0){o.f^=Mo;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&zc)===0){var r=(n.f&Vf)!==0||(n.f&aa)!==0&&(o.f&oa)!==0;w6(n,e,r?t:!1)}n=s}}}function zv(o){S6(o,!0)}function S6(o,e){if((o.f&Mo)!==0){o.f^=Mo,(o.f&to)===0&&(Vs(o,so),Lu.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&Vf)!==0||(t.f&aa)!==0;S6(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 b9(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:zp(t);e.append(t),t=n}}let av=!1,Bl=!1;function _8(o){Bl=o}let Hn=null,ra=!1;function Or(o){Hn=o}let zn=null;function Ga(o){zn=o}let Va=null;function D6(o){Hn!==null&&(Va??(Va=new Set)).add(o)}let Uo=null,or=0,wr=null;function JI(o){wr=o}let A6=1,yd=0,Od=yd;function b8(o){Od=o}function k6(){return++A6}function Vp(o){var e=o.f;if((e&so)!==0)return!0;if(e&po&&(o.f&=~Fu),(e&qa)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(Vp(s)&&d6(s),s.wv>o.wv)return!0}(e&Tr)!==0&&co===null&&Vs(o,to)}return!1}function B6(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Va!==null&&Va.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&po)!==0?B6(s,e,!1):e===s&&(t?Vs(s,so):(s.f&to)!==0&&Vs(s,qa),u9(s))}}function F6(o){var E;var e=Uo,t=or,i=wr,n=Hn,s=Va,r=go,a=ra,d=Od,u=o.f;Uo=null,or=0,wr=null,Hn=(u&(aa|zc))===0?o:null,Va=null,jf(o.ctx),ra=!1,Od=++yd,o.ac!==null&&(hb(()=>{o.ac.abort(ub)}),o.ac=null);try{o.f|=Ov;var f=o.fn,g=f();o.f|=h0;var p=o.deps,C=sn==null?void 0:sn.is_fork;if(Uo!==null){var b;if(C||zg(o,or),p!==null&&or>0)for(p.length=or+Uo.length,b=0;b<Uo.length;b++)p[or+b]=Uo[b];else o.deps=p=Uo;if(p9()&&(o.f&Tr)!==0)for(b=or;b<p.length;b++)((E=p[b]).reactions??(E.reactions=[])).push(o)}else!C&&p!==null&&or<p.length&&(zg(o,or),p.length=or);if(Jk()&&wr!==null&&!ra&&p!==null&&(o.f&(po|qa|so))===0)for(b=0;b<wr.length;b++)B6(wr[b],o);if(n!==null&&n!==o){if(yd++,n.deps!==null)for(let w=0;w<t;w+=1)n.deps[w].rv=yd;if(e!==null)for(const w of e)w.rv=yd;wr!==null&&(i===null?i=wr:i.push(...wr))}return(o.f&_c)!==0&&(o.f^=_c),g}catch(w){return t6(w)}finally{o.f^=Ov,Uo=e,or=t,wr=i,Hn=n,Va=s,jf(r),ra=a,Od=d}}function eP(o,e){let t=e.reactions;if(t!==null){var i=N7.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&po)!==0&&(Uo===null||!Rv.call(Uo,e))){var s=e;(s.f&Tr)!==0&&(s.f^=Tr,s.f&=~Fu),s.v!==Js&&c9(s),zI(s),zg(s,0)}}function zg(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)eP(o,t[i])}function Uf(o){var e=o.f;if((e&Mr)===0){Vs(o,to);var t=zn,i=av;zn=o,av=!0;try{(e&(oa|Gk))!==0?QI(o):_9(o),C6(o);var n=F6(o);o.teardown=typeof n=="function"?n:null,o.wv=A6;var s;$k&&EI&&(o.f&so)!==0&&o.deps}finally{av=i,zn=t}}}async function fl(){await Promise.resolve(),kI()}function l(o){var e=o.f,t=(e&po)!==0;if(Hn!==null&&!ra){var i=zn!==null&&(zn.f&Mr)!==0;if(!i&&(Va===null||!Va.has(o))){var n=Hn.deps;if((Hn.f&Ov)!==0)o.rv<yd&&(o.rv=yd,Uo===null&&n!==null&&n[or]===o?or++:Uo===null?Uo=[o]:Uo.push(o));else{Hn.deps??(Hn.deps=[]),Rv.call(Hn.deps,o)||Hn.deps.push(o);var s=o.reactions;s===null?o.reactions=[Hn]:Rv.call(s,Hn)||s.push(Hn)}}}if(Bl&&Md.has(o))return Md.get(o);if(t){var r=o;if(Bl){var a=r.v;return((r.f&to)===0&&r.reactions!==null||I6(r))&&(a=f9(r)),Md.set(r,a),a}var d=(r.f&Tr)===0&&!ra&&Hn!==null&&(av||(Hn.f&Tr)!==0),u=(r.f&h0)===0;Vp(r)&&(d&&(r.f|=Tr),d6(r)),d&&!u&&(u6(r),L6(r))}if(co!=null&&co.has(o))return co.get(o);if((o.f&_c)!==0)throw o.v;return o.v}function L6(o){if(o.f|=Tr,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&po)!==0&&(e.f&Tr)===0&&(u6(e),L6(e))}function I6(o){if(o.v===Js)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(Md.has(e)||(e.f&po)!==0&&I6(e))return!0;return!1}function Wl(o){var e=ra;try{return ra=!0,o()}finally{ra=e}}const tP=["touchstart","touchmove"];function iP(o){return tP.includes(o)}const wd=Symbol("events"),P6=new Set,F1=new Set;function nP(o,e,t,i={}){function n(s){if(i.capture||L1.call(e,s),!s.cancelBubble)return hb(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?bc(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function xs(o,e,t,i,n){var s={capture:i,passive:n},r=nP(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&x9(()=>{e.removeEventListener(o,r,s)})}function j(o,e,t){(e[wd]??(e[wd]={}))[o]=t}function Gs(o){for(var e=0;e<o.length;e++)P6.add(o[e]);for(var t of F1)t(o)}let C8=null;function L1(o){var E,w;var e=this,t=e.ownerDocument,i=o.type,n=((E=o.composedPath)==null?void 0:E.call(o))||[],s=n[0]||o.target;C8=o;var r=0,a=C8===o&&o[wd];if(a){var d=n.indexOf(a);if(d!==-1&&(e===document||e===window)){o[wd]=e;return}var u=n.indexOf(e);if(u===-1)return;d<=u&&(r=d)}if(s=n[r]||o.target,s!==e){O7(o,"currentTarget",{configurable:!0,get(){return s||t}});var f=Hn,g=zn;Or(null),Ga(null);try{for(var p,C=[];s!==null&&s!==e;){try{var b=(w=s[wd])==null?void 0:w[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[wd]=e,delete o.currentTarget,Or(f),Ga(g)}}}var hA;const hC=((hA=globalThis==null?void 0:globalThis.window)==null?void 0:hA.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function sP(o){return(hC==null?void 0:hC.createHTML(o))??o}function T6(o){var e=_6("template");return e.innerHTML=sP(o.replaceAll("<!>","<!---->")),e.content}function Pu(o,e){var t=zn;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function F(o,e){var t=(e&gI)!==0,i=(e&pI)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=T6(s?o:"<!>"+o),t||(n=Na(n)));var r=i||p6?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=Na(r),d=r.lastChild;Pu(a,d)}else Pu(r,r);return r}}function oP(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=T6(n),a=Na(r);s=Na(a)}var d=s.cloneNode(!0);return Pu(d,d),d}}function gb(o,e){return oP(o,e,"svg")}function oo(o=""){{var e=Cl(o+"");return Pu(e,e),e}}function Ss(){var o=document.createDocumentFragment(),e=document.createComment(""),t=Cl();return o.append(e,t),Pu(e,t),o}function D(o,e){o!==null&&o.before(e)}function O(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[U0]??(o[U0]=o.nodeValue))&&(o[U0]=t,o.nodeValue=`${t}`)}function rP(o,e){return aP(o,e)}const Cx=new Map;function aP(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){UI();var d=void 0,u=XI(()=>{var f=t??e.appendChild(Cl());II(f,{pending:()=>{}},C=>{Is({});var b=go;s&&(b.c=s),n&&(i.$$events=n),d=o(C,i)||{},Ps()},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 w=iP(E);for(const M of[e,document]){var A=Cx.get(M);A===void 0&&(A=new Map,Cx.set(M,A));var I=A.get(E);I===void 0?(M.addEventListener(E,L1,{passive:w}),A.set(E,1)):A.set(E,I+1)}}}};return p(lb(P6)),F1.add(p),()=>{var w;for(var C of g)for(const A of[e,document]){var b=Cx.get(A),E=b.get(C);--E==0?(A.removeEventListener(C,L1),b.delete(C),b.size===0&&Cx.delete(A)):b.set(C,E)}F1.delete(p),f!==t&&((w=f.parentNode)==null||w.removeChild(f))}});return lP.set(d,u),d}let lP=new WeakMap;var Xr,Ba,lr,Fd,Cp,Ep,Ym;class cP{constructor(e,t=!0){Bn(this,"anchor");En(this,Xr,new Map);En(this,Ba,new Map);En(this,lr,new Map);En(this,Fd,new Set);En(this,Cp,!0);En(this,Ep,e=>{if(ke(this,Xr).has(e)){var t=ke(this,Xr).get(e),i=ke(this,Ba).get(t);if(i)zv(i),ke(this,Fd).delete(t);else{var n=ke(this,lr).get(t);n&&(zv(n.effect),ke(this,Ba).set(t,n.effect),ke(this,lr).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of ke(this,Xr)){if(ke(this,Xr).delete(s),s===e)break;const a=ke(this,lr).get(r);a&&(Jo(a.effect),ke(this,lr).delete(r))}for(const[s,r]of ke(this,Ba)){if(s===t||ke(this,Fd).has(s))continue;const a=()=>{if(Array.from(ke(this,Xr).values()).includes(s)){var u=document.createDocumentFragment();b9(r,u),u.append(Cl()),ke(this,lr).set(s,{effect:r,fragment:u})}else Jo(r);ke(this,Fd).delete(s),ke(this,Ba).delete(s)};ke(this,Cp)||!i?(ke(this,Fd).add(s),Nd(r,a,!1)):a()}}});En(this,Ym,e=>{ke(this,Xr).delete(e);const t=Array.from(ke(this,Xr).values());for(const[i,n]of ke(this,lr))t.includes(i)||(Jo(n.effect),ke(this,lr).delete(i))});this.anchor=e,yn(this,Cp,t)}ensure(e,t){var i=sn,n=m6();if(t&&!ke(this,Ba).has(e)&&!ke(this,lr).has(e))if(n){var s=document.createDocumentFragment(),r=Cl();s.append(r),ke(this,lr).set(e,{effect:kr(()=>t(r)),fragment:s})}else ke(this,Ba).set(e,kr(()=>t(this.anchor)));if(ke(this,Xr).set(i,e),n){for(const[a,d]of ke(this,Ba))a===e?i.unskip_effect(d):i.skip_effect(d);for(const[a,d]of ke(this,lr))a===e?i.unskip_effect(d.effect):i.skip_effect(d.effect);i.oncommit(ke(this,Ep)),i.ondiscard(ke(this,Ym))}else ke(this,Ep).call(this,i)}}Xr=new WeakMap,Ba=new WeakMap,lr=new WeakMap,Fd=new WeakMap,Cp=new WeakMap,Ep=new WeakMap,Ym=new WeakMap;function H(o,e,t=!1){var i=new cP(o),n=t?Vf:0;function s(r,a){i.ensure(r,a)}m9(()=>{var r=!1;e((a,d=0)=>{r=!0,s(d,a)}),r||s(-1,null)},n)}function Hi(o,e){return e}function dP(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let g=e[a];Nd(g,()=>{if(s){if(s.pending.delete(g),s.done.add(g),s.pending.size===0){var p=o.outrogroups;I1(o,lb(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;qI(f),f.append(u),o.items.clear()}I1(o,e,!d)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function I1(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|=Ra;const r=document.createDocumentFragment();b9(s,r)}else Jo(e[n],t)}}var E8;function li(o,e,t,i,n,s=null){var r=o,a=new Map,d=(e&Zk)!==0;if(d){var u=o;r=u.appendChild(Cl())}var f=null,g=h9(()=>{var M=t();return l9(M)?M:M==null?[]:lb(M)}),p,C=new Map,b=!0;function E(M){(I.effect.f&Mr)===0&&(I.pending.delete(M),I.fallback=f,uP(I,p,r,e,i),f!==null&&(p.length===0?(f.f&Ra)===0?zv(f):(f.f^=Ra,K0(f,null,r)):Nd(f,()=>{f=null})))}function w(M){I.pending.delete(M)}var A=m9(()=>{p=l(g);for(var M=p.length,R=new Set,P=sn,V=m6(),$=0;$<M;$+=1){var Q=p[$],re=i(Q,$),he=b?null:a.get(re);he?(he.v&&$f(he.v,Q),he.i&&$f(he.i,$),V&&P.unskip_effect(he.e)):(he=hP(a,b?r:E8??(E8=Cl()),Q,re,$,n,e,t),b||(he.e.f|=Ra),a.set(re,he)),R.add(re)}if(M===0&&s&&!f&&(b?f=kr(()=>s(r)):(f=kr(()=>s(E8??(E8=Cl()))),f.f|=Ra)),M>R.size&&X7(),!b)if(C.set(P,R),V){for(const[Z,ce]of a)R.has(Z)||P.skip_effect(ce.e);P.oncommit(E),P.ondiscard(w)}else E(P);l(g)}),I={effect:A,items:a,pending:C,outrogroups:null,fallback:f};b=!1}function M0(o){for(;o!==null&&(o.f&aa)===0;)o=o.next;return o}function uP(o,e,t,i,n){var he,Z,ce,_e,se,ue,Se,Te,xe;var s=(i&lI)!==0,r=e.length,a=o.items,d=M0(o.effect.first),u,f=null,g,p=[],C=[],b,E,w,A;if(s)for(A=0;A<r;A+=1)b=e[A],E=n(b,A),w=a.get(E).e,(w.f&Ra)===0&&((Z=(he=w.nodes)==null?void 0:he.a)==null||Z.measure(),(g??(g=new Set)).add(w));for(A=0;A<r;A+=1){if(b=e[A],E=n(b,A),w=a.get(E).e,o.outrogroups!==null)for(const Oe of o.outrogroups)Oe.pending.delete(w),Oe.done.delete(w);if((w.f&Mo)!==0&&(zv(w),s&&((_e=(ce=w.nodes)==null?void 0:ce.a)==null||_e.unfix(),(g??(g=new Set)).delete(w))),(w.f&Ra)!==0)if(w.f^=Ra,w===d)K0(w,null,t);else{var I=f?f.next:d;w===o.effect.last&&(o.effect.last=w.prev),w.prev&&(w.prev.next=w.next),w.next&&(w.next.prev=w.prev),Zl(o,f,w),Zl(o,w,I),K0(w,I,t),f=w,p=[],C=[],d=M0(f.next);continue}if(w!==d){if(u!==void 0&&u.has(w)){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)K0(p[R],M,t);for(R=0;R<C.length;R+=1)u.delete(C[R]);Zl(o,P.prev,V.next),Zl(o,f,P),Zl(o,V,M),d=M,f=V,A-=1,p=[],C=[]}else u.delete(w),K0(w,d,t),Zl(o,w.prev,w.next),Zl(o,w,f===null?o.effect.first:f.next),Zl(o,f,w),f=w;continue}for(p=[],C=[];d!==null&&d!==w;)(u??(u=new Set)).add(d),C.push(d),d=M0(d.next);if(d===null)continue}(w.f&Ra)===0&&p.push(w),f=w,d=M0(w.next)}if(o.outrogroups!==null){for(const Oe of o.outrogroups)Oe.pending.size===0&&(I1(o,lb(Oe.done)),(se=o.outrogroups)==null||se.delete(Oe));o.outrogroups.size===0&&(o.outrogroups=null)}if(d!==null||u!==void 0){var $=[];if(u!==void 0)for(w of u)(w.f&Mo)===0&&$.push(w);for(;d!==null;)(d.f&Mo)===0&&d!==o.fallback&&$.push(d),d=M0(d.next);var Q=$.length;if(Q>0){var re=(i&Zk)!==0&&r===0?t:null;if(s){for(A=0;A<Q;A+=1)(Se=(ue=$[A].nodes)==null?void 0:ue.a)==null||Se.measure();for(A=0;A<Q;A+=1)(xe=(Te=$[A].nodes)==null?void 0:Te.a)==null||xe.fix()}dP(o,$,re)}}s&&bc(()=>{var Oe,We;if(g!==void 0)for(w of g)(We=(Oe=w.nodes)==null?void 0:Oe.a)==null||We.apply()})}function hP(o,e,t,i,n,s,r,a){var d=(r&rI)!==0?(r&cI)===0?VI(t,!1,!1):Iu(t):null,u=(r&aI)!==0?Iu(n):null;return{v:d,i:u,e:kr(()=>(s(e,d??t,u??n,a),()=>{o.delete(i)}))}}function K0(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&Ra)===0?e.nodes.start:t;i!==null;){var r=zp(i);if(s.before(i),i===n)return;i=r}}function Zl(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=zn;if(a!==(a=e()??"")){if(t){u.nodes=null,d.innerHTML=a,a!==""&&Pu(Na(d),d.lastChild);return}if(u.nodes!==null&&(E6(u.nodes.start,u.nodes.end),u.nodes=null),a!==""){var f=i?xI:n?vI:void 0,g=_6(i?"svg":n?"math":"template",f);g.innerHTML=a;var p=i||n?g:g.content;if(Pu(Na(p),p.lastChild),i||n)for(;Na(p);)r.before(Na(p));else r.before(p)}}})}function M6(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=M6(o[e]))&&(i&&(i+=" "),i+=t)}else for(t in o)o[t]&&(i&&(i+=" "),i+=t);return i}function fP(){for(var o,e,t=0,i="",n=arguments.length;t<n;t++)(o=arguments[t])&&(e=M6(o))&&(i&&(i+=" "),i+=e);return i}function hg(o){return typeof o=="object"?fP(o):o??""}const y8=[...`
|
|
3
|
+
\r\f \v\uFEFF`];function gP(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||y8.includes(i[r-1]))&&(a===i.length||y8.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function w8(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 fC(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function pP(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(fC)),n&&d.push(...Object.keys(n).map(fC));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=fC(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+=w8(i)),n&&(t+=w8(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function Ft(o,e,t,i,n,s){var r=o[E1];if(r!==t||r===void 0){var a=gP(t,i,s);a==null?o.removeAttribute("class"):e?o.className=a:o.setAttribute("class",a),o[E1]=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 gC(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 Co(o,e,t,i){var n=o[y1];if(n!==e){var s=pP(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[y1]=e}else i&&(Array.isArray(i)?(gC(o,t==null?void 0:t[0],i[0]),gC(o,t==null?void 0:t[1],i[1],"important")):gC(o,t,i));return i}function Vv(o,e,t=!1){if(o.multiple){if(e==null)return;if(!l9(e))return _I();for(var i of o.options)i.selected=e.includes(fg(i));return}for(i of o.options){var n=fg(i);if($I(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function P1(o){var e=new MutationObserver(()=>{Vv(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),x9(()=>{e.disconnect()})}function Ls(o,e,t=e){var i=new WeakSet,n=!0;g9(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),fg);else{var d=o.querySelector(r)??o.querySelector("option:not([disabled])");a=d&&fg(d)}t(a),o.__value=a,sn!==null&&i.add(sn)}),v9(()=>{var s=e();if(o===document.activeElement){var r=sn;if(i.has(r))return}if(Vv(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=fg(a),t(s))}o.__value=s,n=!1}),P1(o)}function fg(o){return"__value"in o?o.__value:o.value}const xP=Symbol("is custom element"),vP=Symbol("is html"),mP=K7?"progress":"PROGRESS";function T1(o,e){var t=C9(o);t.value===(t.value=e??void 0)||o.value===e&&(e!==0||o.nodeName!==mP)||(o.value=e??"")}function Zo(o,e){var t=C9(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function rn(o,e,t,i){var n=C9(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[G7]=t),t==null?o.removeAttribute(e):typeof t!="string"&&_P(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function C9(o){return o[iv]??(o[iv]={[xP]:o.nodeName.includes("-"),[vP]:o.namespaceURI===Xk})}var S8=new Map;function _P(o){var e=o.getAttribute("is")||o.nodeName,t=S8.get(e);if(t)return t;S8.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=H7(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=Uk(n)}return t}function Nt(o,e,t=e){var i=new WeakSet;g9(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=pC(o)?xC(s):s,t(s),sn!==null&&i.add(sn),await fl(),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))}}}),Wl(e)==null&&o.value&&(t(pC(o)?xC(o.value):o.value),sn!==null&&i.add(sn)),fb(()=>{var n=e();if(o===document.activeElement){var s=sn;if(i.has(s))return}pC(o)&&n===xC(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function ws(o,e,t=e){g9(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),Wl(e)==null&&t(o.checked),fb(()=>{var i=e();o.checked=!!i})}function pC(o){var e=o.type;return e==="number"||e==="range"}function xC(o){return o===""?null:+o}var dc,bf,yp,Qm,R6;const Jm=class Jm{constructor(e){En(this,Qm);En(this,dc,new WeakMap);En(this,bf);En(this,yp);yn(this,yp,e)}observe(e,t){var i=ke(this,dc).get(e)||new Set;return i.add(t),ke(this,dc).set(e,i),ts(this,Qm,R6).call(this).observe(e,ke(this,yp)),()=>{var n=ke(this,dc).get(e);n.delete(t),n.size===0&&(ke(this,dc).delete(e),ke(this,bf).unobserve(e))}}};dc=new WeakMap,bf=new WeakMap,yp=new WeakMap,Qm=new WeakSet,R6=function(){return ke(this,bf)??yn(this,bf,new ResizeObserver(e=>{for(var t of e){Jm.entries.set(t.target,t);for(var i of ke(this,dc).get(t.target)||[])i(t)}}))},Bn(Jm,"entries",new WeakMap);let M1=Jm;var bP=new M1({box:"border-box"});function CP(o,e,t){var i=bP.observe(o,()=>t(o[e]));v9(()=>(Wl(()=>t(o[e])),i))}function vC(o,e){return o===e||(o==null?void 0:o[Td])===e}function cs(o={},e,t,i){var n=go.r,s=zn;return v9(()=>{var r,a;return fb(()=>{r=a,a=[],Wl(()=>{vC(t(...a),o)||(e(o,...a),r&&vC(t(...r),o)&&e(null,...r))})}),()=>{let d=s;for(;d!==n&&d.parent!==null&&d.parent.f&C1;)d=d.parent;const u=()=>{a&&vC(t(...a),o)&&e(null,...a)},f=d.teardown;d.teardown=()=>{u(),f==null||f()}}}),o}function Tu(o,e,t,i){var R;var n=!0,s=(t&hI)!==0,r=(t&fI)!==0,a=i,d=!0,u=void 0,f=()=>r&&n?(u??(u=Wg(i)),l(u)):(d&&(d=!1,a=r?Wl(i):i),a);let g;if(s){var p=Td in o||q7 in o;g=((R=lf(o,e))==null?void 0:R.set)??(p&&e in o?P=>o[e]=P:void 0)}var C,b=!1;s?[C,b]=SI(()=>o[e]):C=o[e],C===void 0&&i!==void 0&&(C=f(),g&&(tI(),g(C)));var E;if(E=()=>{var P=o[e];return P===void 0?f():(d=!0,P)},(t&uI)===0)return E;if(g){var w=o.$$legacy;return(function(P,V){return arguments.length>0?((!V||w||b)&&g(V?E():P),P):E()})}var A=!1,I=((t&dI)!==0?Wg:h9)(()=>(A=!1,E()));s&&l(I);var M=zn;return(function(P,V){if(arguments.length>0){const $=V?l(I):s?Di(P):P;return x(I,$),A=!0,a!==void 0&&(a=$),P}return Bl&&A||(M.f&Mr)!==0?I.v:l(I)})}function $s(o){go===null&&Kk(),Kn(()=>{const e=Wl(o);if(typeof e=="function")return e})}function jp(o){go===null&&Kk(),$s(()=>()=>Wl(o))}const EP="5";var fA;typeof window<"u"&&((fA=window.__svelte??(window.__svelte={})).v??(fA.v=new Set)).add(EP);/*!-----------------------------------------------------------------------------
|
|
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 yP=Object.defineProperty,wP=Object.getOwnPropertyDescriptor,SP=Object.getOwnPropertyNames,DP=Object.prototype.hasOwnProperty,AP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of SP(e))!DP.call(o,n)&&n!==t&&yP(o,n,{get:()=>e[n],enumerable:!(i=wP(e,n))||i.enumerable});return o},kP=(o,e,t)=>(AP(o,e,"default"),t),$p={};kP($p,pA);var BP=class{constructor(e,t,i){this._onDidChange=new $p.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)}},FP={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},LP={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},N6=new BP("json",FP,LP),IP=()=>O6().then(o=>o.getWorker());$p.languages.json={jsonDefaults:N6,getWorker:IP};function O6(){return gA(()=>import("./jsonMode-tUihOf0o.js"),__vite__mapDeps([0,1,2]))}$p.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});$p.languages.onLanguage("json",()=>{O6().then(o=>o.setupMode(N6))});/*!-----------------------------------------------------------------------------
|
|
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 PP=Object.defineProperty,TP=Object.getOwnPropertyDescriptor,MP=Object.getOwnPropertyNames,RP=Object.prototype.hasOwnProperty,NP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of MP(e))!RP.call(o,n)&&n!==t&&PP(o,n,{get:()=>e[n],enumerable:!(i=TP(e,n))||i.enumerable});return o},OP=(o,e,t)=>(NP(o,e,"default"),t),HP="5.4.5",qf={};OP(qf,pA);var H6=(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))(H6||{}),W6=(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))(W6||{}),z6=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(z6||{}),V6=(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))(V6||{}),j6=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(j6||{}),$6=class{constructor(o,e,t,i,n){this._onDidChange=new qf.Emitter,this._onDidExtraLibsChange=new qf.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(o),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(o,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===o)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:o,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(o){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),o&&o.length>0)for(const e of o){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(o){this._compilerOptions=o||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(o){this._diagnosticsOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(o){this._workerOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(o){this._inlayHintsOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(o){}setEagerModelSync(o){this._eagerModelSync=o}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(o){this._modeConfiguration=o||Object.create(null),this._onDidChange.fire(void 0)}},WP=HP,U6={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},q6=new $6({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},U6),G6=new $6({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},U6),zP=()=>pb().then(o=>o.getTypeScriptWorker()),VP=()=>pb().then(o=>o.getJavaScriptWorker());qf.languages.typescript={ModuleKind:H6,JsxEmit:W6,NewLineKind:z6,ScriptTarget:V6,ModuleResolutionKind:j6,typescriptVersion:WP,typescriptDefaults:q6,javascriptDefaults:G6,getTypeScriptWorker:zP,getJavaScriptWorker:VP};function pb(){return gA(()=>import("./tsMode-WXSFC0ZU.js"),__vite__mapDeps([3,1,2]))}qf.languages.onLanguage("typescript",()=>pb().then(o=>o.setupTypeScript(q6)));qf.languages.onLanguage("javascript",()=>pb().then(o=>o.setupJavaScript(G6)));class jP extends Ao{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Fi("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Qi.map,toggled:Ze.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Ze.has("isInDiffEditor"),menu:{when:Ze.has("isInDiffEditor"),id:gi.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(ss),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class K6 extends Ao{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Fi("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:Ze.has("isInDiffEditor")})}run(e,...t){const i=e.get(ss),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class Z6 extends Ao{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Fi("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:Ze.has("isInDiffEditor")})}run(e,...t){const i=e.get(ss),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const Up=Fi("diffEditor","Diff Editor");class $P extends la{constructor(){super({id:"diffEditor.switchSide",title:Fi("switchSide","Switch Side"),icon:Qi.arrowSwap,precondition:Ze.has("isInDiffEditor"),f1:!0,category:Up})}runEditorCommand(e,t,i){const n=g0(e);if(n instanceof wp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class UP extends la{constructor(){super({id:"diffEditor.exitCompareMove",title:Fi("exitCompareMove","Exit Compare Move"),icon:Qi.close,precondition:q.comparingMovedCode,f1:!1,category:Up,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=g0(e);n instanceof wp&&n.exitCompareMove()}}class qP extends la{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Fi("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Qi.fold,precondition:Ze.has("isInDiffEditor"),f1:!0,category:Up})}runEditorCommand(e,t,...i){const n=g0(e);n instanceof wp&&n.collapseAllUnchangedRegions()}}class GP extends la{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Fi("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Qi.unfold,precondition:Ze.has("isInDiffEditor"),f1:!0,category:Up})}runEditorCommand(e,t,...i){const n=g0(e);n instanceof wp&&n.showAllUnchangedRegions()}}class R1 extends Ao{constructor(){super({id:"diffEditor.revert",title:Fi("revert","Revert"),f1:!1,category:Up})}run(e,t){const i=KP(e,t.originalUri,t.modifiedUri);i instanceof wp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const X6=Fi("accessibleDiffViewer","Accessible Diff Viewer"),e_=class e_ extends Ao{constructor(){super({id:e_.id,title:Fi("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:X6,precondition:Ze.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=g0(e);t==null||t.accessibleDiffViewerNext()}};e_.id="editor.action.accessibleDiffViewer.next";let Vg=e_;const t_=class t_ extends Ao{constructor(){super({id:t_.id,title:Fi("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:X6,precondition:Ze.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=g0(e);t==null||t.accessibleDiffViewerPrev()}};t_.id="editor.action.accessibleDiffViewer.prev";let jv=t_;function KP(o,e,t){return o.get(Cs).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 g0(o){const t=o.get(Cs).listDiffEditors(),i=xA();if(i)for(const n of t){const s=n.getContainerDomNode();if(ZP(s,i))return n}return null}function ZP(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}Vn(jP);Vn(K6);Vn(Z6);Rr.appendMenuItem(gi.EditorTitle,{command:{id:new Z6().desc.id,title:S("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:Ze.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Ze.has("isInDiffEditor")},order:11,group:"1_diff",when:Ze.and(q.diffEditorRenderSideBySideInlineBreakpointReached,Ze.has("isInDiffEditor"))});Rr.appendMenuItem(gi.EditorTitle,{command:{id:new K6().desc.id,title:S("showMoves","Show Moved Code Blocks"),icon:Qi.move,toggled:s3.create("config.diffEditor.experimental.showMoves",!0),precondition:Ze.has("isInDiffEditor")},order:10,group:"1_diff",when:Ze.has("isInDiffEditor")});Vn(R1);for(const o of[{icon:Qi.arrowRight,key:q.diffEditorInlineMode.toNegated()},{icon:Qi.discard,key:q.diffEditorInlineMode}])Rr.appendMenuItem(gi.DiffEditorHunkToolbar,{command:{id:new R1().desc.id,title:S("revertHunk","Revert Block"),icon:o.icon},when:Ze.and(q.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),Rr.appendMenuItem(gi.DiffEditorSelectionToolbar,{command:{id:new R1().desc.id,title:S("revertSelection","Revert Selection"),icon:o.icon},when:Ze.and(q.diffEditorModifiedWritable,o.key),order:5,group:"primary"});Vn($P);Vn(UP);Vn(qP);Vn(GP);Rr.appendMenuItem(gi.EditorTitle,{command:{id:Vg.id,title:S("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:Ze.has("isInDiffEditor")},order:10,group:"2_diff",when:Ze.and(q.accessibleDiffViewerVisible.negate(),Ze.has("isInDiffEditor"))});Qn.registerCommandAlias("editor.action.diffReview.next",Vg.id);Vn(Vg);Qn.registerCommandAlias("editor.action.diffReview.prev",jv.id);Vn(jv);var XP=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},YP=function(o,e){return function(t,i){e(t,i,o)}},N1;const xb=new wn("selectionAnchorSet",!1);var Vd;let Vc=(Vd=class{static get(e){return e.getContribution(N1.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=xb.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(qi.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new lo().appendText(S("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Nr(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(qi.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()}},N1=Vd,Vd.ID="editor.contrib.selectionAnchorController",Vd);Vc=N1=XP([YP(1,Ln)],Vc);class QP extends wt{constructor(){super({id:"editor.action.setSelectionAnchor",label:S("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2080),weight:100}})}async run(e,t){var i;(i=Vc.get(t))==null||i.setSelectionAnchor()}}class JP extends wt{constructor(){super({id:"editor.action.goToSelectionAnchor",label:S("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:xb})}async run(e,t){var i;(i=Vc.get(t))==null||i.goToSelectionAnchor()}}class eT extends wt{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:S("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:xb,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2089),weight:100}})}async run(e,t){var i;(i=Vc.get(t))==null||i.selectFromAnchorToCursor()}}class tT extends wt{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:S("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:xb,kbOpts:{kbExpr:q.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=Vc.get(t))==null||i.cancelSelectionAnchor()}}un(Vc.ID,Vc,4);Re(QP);Re(JP);Re(eT);Re(tT);const iT=Si("editorOverviewRuler.bracketMatchForeground","#A0A0A0",S("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class nT extends wt{constructor(){super({id:"editor.action.jumpToBracket",label:S("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=Mu.get(t))==null||i.jumpToBracket()}}class sT extends wt{constructor(){super({id:"editor.action.selectToBracket",label:S("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Fi("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=Mu.get(t))==null||s.selectToBracket(n)}}class oT extends wt{constructor(){super({id:"editor.action.removeBrackets",label:S("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=Mu.get(t))==null||i.removeBrackets(this.id)}}class rT{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const nc=class nc extends zt{static get(e){return e.getContribution(nc.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Ns(()=>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 qi(r.lineNumber,r.column,r.lineNumber,r.column):new qi(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const u=t.bracketPairs.findNextBracket(s);u&&u.range&&(r=t.bracketPairs.matchBracket(u.range.getStartPosition()))}let a=null,d=null;if(r){r.sort(ee.compareRangesUsingStarts);const[u,f]=r;if(a=e?u.getStartPosition():u.getEndPosition(),d=e?f.getEndPosition():f.getStartPosition(),f.containsPosition(s)){const g=a;a=d,d=g}}a&&d&&i.push(new qi(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(Ii.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=nc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!b&&this._matchBrackets==="always"&&(b=t.bracketPairs.findEnclosingBrackets(C,20),E=nc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[d++]=new rT(C,b,E)}}this._lastBracketsData=a,this._lastVersionId=i}};nc.ID="editor.contrib.bracketMatchingController",nc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=bn.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Fs(iT),position:Ha.Center}}),nc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=bn.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let Mu=nc;un(Mu.ID,Mu,1);Re(sT);Re(nT);Re(oT);Rr.appendMenuItem(gi.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:S({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class aT{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&s===e.getLineMaxColumn(i)))if(this._isMovingLeft){const r=new ee(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new ee(i,s,i,s),a)}else{const r=new ee(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new ee(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new qi(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new qi(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class Y6 extends wt{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 aT(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class lT extends Y6{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:S("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:q.writable})}}class cT extends Y6{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:S("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:q.writable})}}Re(lT);Re(cT);class dT extends wt{constructor(){super({id:"editor.action.transposeLetters",label:S("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:q.writable,kbOpts:{kbExpr:q.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():nC.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),g=nC.leftPosition(i,f),p=nC.leftPosition(i,g),C=i.getValueInRange(ee.fromPositions(p,g)),b=i.getValueInRange(ee.fromPositions(g,f)),E=ee.fromPositions(p,f);n.push(new Sp(E,b+C))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Re(dT);const vb=(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 E9(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function uT(o,e,t){const i={id:vb(),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 ml.some(this,([i,n])=>n.asFile())&&t.push("files"),e5($v(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 $v(e)}}function $v(o){return o.toLowerCase()}function J6(o,e){return e5($v(o),e.map($v))}function e5(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 mb=Object.freeze({create:o=>vA(o.map(e=>e.toString())).join(`\r
|
|
14
|
+
`),split:o=>o.split(`\r
|
|
15
|
+
`),parse:o=>mb.split(o).filter(e=>!e.startsWith("#"))}),wa=class wa{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+wa.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new wa((this.value?[this.value,...e]:e).join(wa.sep))}};wa.sep=".",wa.None=new wa("@@none@@"),wa.Empty=new wa("");let ns=wa;const D8={EDITORS:"CodeEditors",FILES:"CodeFiles"};class hT{}const fT={DragAndDropContribution:"workbench.contributions.dragAndDrop"};ca.add(fT.DragAndDropContribution,new hT);const Sg=class Sg{constructor(){}static getInstance(){return Sg.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};Sg.INSTANCE=new Sg;let O1=Sg;function t5(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,E9(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,gT(n))}}return e}function gT(o){const e=o.path?jn.parse(o.path):void 0;return uT(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const pT=Object.freeze([D8.EDITORS,D8.FILES,s1.RESOURCES,s1.INTERNAL_URI_LIST]);function i5(o,e=!1){const t=t5(o),i=t.get(s1.INTERNAL_URI_LIST);if(i)t.replace(Ys.uriList,i);else if(e||!t.has(Ys.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(jn.file(a).toString()):n.push(jn.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Ys.uriList,E9(mb.create(n)))}for(const n of pT)t.delete(n);return t}var y9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jg=function(o,e){return function(t,i){e(t,i,o)}};class w9{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 Dg=class Dg extends w9{constructor(){super(...arguments),this.kind=Dg.kind,this.dropMimeTypes=[Ys.text],this.pasteMimeTypes=[Ys.text]}async getEdit(e,t){const i=e.get(Ys.text);if(!i||e.has(Ys.uriList))return;const n=await i.asString();return{handledMimeType:Ys.text,title:S("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};Dg.id="text",Dg.kind=new ns("text.plain");let Ru=Dg;class n5 extends w9{constructor(){super(...arguments),this.kind=new ns("uri.absolute"),this.dropMimeTypes=[Ys.uriList],this.pasteMimeTypes=[Ys.uriList]}async getEdit(e,t){const i=await s5(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:d})=>a.scheme===Eo.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:Ys.uriList,insertText:s,title:r,kind:this.kind}}}let Uv=class extends w9{constructor(e){super(),this._workspaceContextService=e,this.kind=new ns("uri.relative"),this.dropMimeTypes=[Ys.uriList],this.pasteMimeTypes=[Ys.uriList]}async getEdit(e,t){const i=await s5(e);if(!i.length||t.isCancellationRequested)return;const n=wl(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?o3(r.uri,s):void 0}));if(n.length)return{handledMimeType:Ys.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}}};Uv=y9([jg(0,Lf)],Uv);class xT{constructor(){this.kind=new ns("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Ys.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var d;if(n.triggerKind!==o1.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 s5(o){const e=o.get(Ys.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of mb.parse(t))try{i.push({uri:jn.parse(n),originalText:n})}catch{}return i}let H1=class extends zt{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Ru)),this._register(e.documentDropEditProvider.register("*",new n5)),this._register(e.documentDropEditProvider.register("*",new Uv(t)))}};H1=y9([jg(0,Pi),jg(1,Lf)],H1);let W1=class extends zt{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Ru)),this._register(e.documentPasteEditProvider.register("*",new n5)),this._register(e.documentPasteEditProvider.register("*",new Uv(t))),this._register(e.documentPasteEditProvider.register("*",new xT))}};W1=y9([jg(0,Pi),jg(1,Lf)],W1);const br=class br{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=br._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(br.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(br.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(br.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(br.isVariableCharacter(i)||br.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 br._table[i]>"u"&&!br.isDigitCharacter(i)&&!br.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};br._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let z1=br;class p0{constructor(){this._children=[]}appendChild(e){return e instanceof To&&this._children[this._children.length-1]instanceof To?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 qp)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let To=class o5 extends p0{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new o5(this.value)}};class r5 extends p0{}class hr extends r5{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 x0?this._children[0]:void 0}clone(){const e=new hr(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class x0 extends p0{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof To&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new x0;return this.options.forEach(e.appendChild,e),e}}class S9 extends p0{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 Yr&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Yr){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new S9;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 Yr extends p0{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 Yr(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class $g extends r5{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 To(t)],!0):!1}clone(){const e=new $g(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function A8(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class qp extends p0{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof hr&&(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 A8([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof hr&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof $g&&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 qp;return this._children=this.children.map(t=>t.clone()),e}walk(e){A8(this.children,e)}}class Nu{constructor(){this._scanner=new z1,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 qp;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 hr&&(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 hr(d.index);g.transform=d.transform;for(const p of f){const C=p.clone();g.appendChild(C),C instanceof hr&&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 hr(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 To(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 hr(Number(t)):new $g(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 hr(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new To("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new x0;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 To(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 $g(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new To("${"+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 S9;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 To(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 Yr(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Yr(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 Yr(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Yr(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Yr(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 Yr(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Yr(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new To(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function a5(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 r3(o,{range:s,text:typeof t.insertText=="string"?Nu.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function l5(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 vT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mT=function(o,e){return function(t,i){e(t,i,o)}};const _T=bn.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:mA,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),i_=class i_ extends zt{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=wi(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=wi("span.icon");this.domNode.append(t),t.classList.add(...Rn.asClassNameArray(Qi.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(Fn(this.domNode,as.CLICK,n=>{this.delegate.cancel()}))}getId(){return i_.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)}};i_.baseId="editor.widget.inlineProgressWidget";let V1=i_,qv=class extends zt{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=Bg(()=>{const a=ee.fromPositions(e);this._currentDecorations.set([{range:a,options:_T}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(V1,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()}};qv=vT([mT(2,tn)],qv);var bT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},k8=function(o,e){return function(t,i){e(t,i,o)}},lv,Ec;let Ro=(Ec=class{static get(e){return e.getContribution(lv.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new er,this._messageListeners=new Ht,this._mouseOverMessage=!1,this._editor=e,this._visible=lv.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){Nr(Yx(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Yx(e)?a3(e,{actionHandler:{callback:n=>{this.closeMessage(),l3(this._openerService,n,Yx(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new B8(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Rs.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&c3(xA(),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(Fn(this._messageWidget.value.getDomNode(),as.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Fn(this._messageWidget.value.getDomNode(),as.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new ee(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(B8.fadeOut(this._messageWidget.value))}},lv=Ec,Ec.ID="editor.contrib.messageController",Ec.MESSAGE_VISIBLE=new wn("messageVisible",!1,S("messageVisible","Whether the editor is currently showing an inline message")),Ec);Ro=lv=bT([k8(1,Ln),k8(2,da)],Ro);const CT=ko.bindToContribution(Ro.get);Ri(new CT({id:"leaveEditorMessage",precondition:Ro.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let B8=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)}};un(Ro.ID,Ro,4);function mC(o,e){return e&&(o.stack||o.stacktrace)?S("stackTrace.format","{0}: {1}",L8(o),F8(o.stack)||F8(o.stacktrace)):L8(o)}function F8(o){return Array.isArray(o)?o.join(`
|
|
16
|
+
`):o}function L8(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 Gv(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=wl(o),i=Gv(t[0],e);return t.length>1?S("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(_A(o))return o;if(o.detail){const t=o.detail;if(t.error)return mC(t.error,e);if(t.exception)return mC(t.exception,e)}return o.stack?mC(o,e):o.message?o.message:S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}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},df=function(o,e){return function(t,i){e(t,i,o)}},j1,jd;let $1=(jd=class extends zt{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(is(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(is((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{s.containsPosition(g.position)||this.dispose()})),this._register(Rs.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=wi(".post-edit-widget"),this.button=this._register(new d3(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Fn(this.domNode,as.CLICK,()=>this.showSelector()))}getId(){return j1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=wo(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>u3({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},j1=jd,jd.baseId="editor.widget.postEditWidget",jd);$1=j1=c5([df(7,a0),df(8,Ln),df(9,As)],$1);let Kv=class extends zt{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(Rs.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 w=>{const A=this._editor.getModel();A&&(await A.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:w,allEdits:t.allEdits},i,n,s))},u=(w,A)=>{Gc(w)||(this._notificationService.error(A),i&&this.show(e[0],t,d))};let f;try{f=await n(a,s)}catch(w){return u(w,S("resolveError",`Error resolving edit '{0}':
|
|
17
|
+
{1}`,a.title,Gv(w)))}if(s.isCancellationRequested)return;const g=a5(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(w){return u(w,S("applyError",`Error applying edit '{0}':
|
|
18
|
+
{1}`,a.title,Gv(w)))}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($1,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()}};Kv=c5([df(4,tn),df(5,V_),df(6,vo)],Kv);var ET=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bh=function(o,e){return function(t,i){e(t,i,o)}},gd;const d5="editor.changePasteType",D9=new wn("pasteWidgetVisible",!1,S("pasteWidgetVisible","Whether the paste widget is showing")),_C="application/vnd.code.copyMetadata";var $d;let Fl=($d=class extends zt{static get(e){return e.getContribution(gd.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(Fn(d,"copy",u=>this.handleCopy(u))),this._register(Fn(d,"cut",u=>this.handleCopy(u))),this._register(Fn(d,"paste",u=>this.handlePaste(u),!0)),this._pasteProgressManager=this._register(new qv("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Kv,"pasteIntoEditor",e,D9,{id:d5,label:S("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},Pw().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,w,A,I;if(!this._editor.hasTextFocus()||((w=(E=this._clipboardService).clearInternalState)==null||w.call(E),!e.clipboardData||!this.isPasteAsEnabled()))return;const t=this._editor.getModel(),i=this._editor.getSelections();if(!t||!(i!=null&&i.length))return;const n=this._editor.getOption(37);let s=i;const r=i.length===1&&i[0].isEmpty();if(r){if(!n)return;s=[new ee(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=(A=this._editor._getViewModel())==null?void 0:A.getPlainTextToCopy(i,n,j_),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=t5(e.clipboardData),p=f.flatMap(M=>M.copyMimeTypes??[]),C=vb();this.setCopyMetadata(e.clipboardData,{id:C,providerCopyMimeTypes:p,defaultPastePayload:u});const b=Ks(async M=>{const R=wl(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,$]of P)g.replace(V,$);return g});(I=gd._currentCopyOperation)==null||I.dataTransferPromise.cancel(),gd._currentCopyOperation={handle:C,dataTransferPromise:b}}async handlePaste(e){var d,u,f;if(!e.clipboardData||!this._editor.hasTextFocus())return;(d=Ro.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=i5(e.clipboardData);s.delete(_C);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],Ys.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=>J6(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=Ro.get(this._editor))==null||i.showMessage(S("pasteAsError","No paste edits for '{0}' found",t instanceof ns?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new If(r,3,void 0),d=Ks(async u=>{const f=this._editor;if(!f.hasModel())return;const g=f.getModel(),p=new Ht,C=p.add(new Zs(u));p.add(a.token.onCancellationRequested(()=>C.cancel()));const b=C.token;try{if(await this.mergeInDataFromCopy(i,n,b),b.isCancellationRequested)return;const E=e.filter(I=>this.isSupportedPasteProvider(I,i));if(!E.length||E.length===1&&E[0]instanceof Ru)return this.applyDefaultPasteHandler(i,n,b,s);const w={triggerKind:o1.Automatic},A=await this.getPasteEdits(E,i,g,t,w,b);if(p.add(A),b.isCancellationRequested)return;if(A.edits.length===1&&A.edits[0].provider instanceof Ru)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 $,Q;try{const re=(Q=($=M.provider).resolveDocumentPasteEdit)==null?void 0:Q.call($,M,R),he=new $_,Z=re&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),S("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([he.p,re]),{cancel:()=>(he.cancel(),V(new U_))},0);return Z&&(M.additionalEdit=Z.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=Ks(async a=>{const d=this._editor;if(!d.hasModel())return;const u=d.getModel(),f=new Ht,g=f.add(new If(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:o1.PasteAs,only:e&&e instanceof ns?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 ns?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 w=a5(u.uri,i,E);await this._bulkEditService.apply(w,{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(_C,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(_C);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=h3.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=gd._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await gd._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(Ys.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(Ys.uriList,E9(mb.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new Ht,d=await Dp(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){Gc(C)||console.error(C);return}})),r),u=wl(d??[]).flat().filter(f=>!s.only||s.only.contains(f.kind));return{edits:l5(u),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(Ys.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 ns?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},gd=$d,$d.ID="editor.contrib.copyPasteActionController",$d);Fl=gd=ET([bh(1,tn),bh(2,V_),bh(3,l0),bh(4,Pi),bh(5,Ml),bh(6,f3)],Fl);const Ou="9_cutcopypaste",yT=c0||document.queryCommandSupported("cut"),u5=c0||document.queryCommandSupported("copy"),wT=typeof navigator.clipboard>"u"||g3?document.queryCommandSupported("paste"):!0;function A9(o){return o.register(),o}const ST=yT?A9(new Tw({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:c0?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:gi.MenubarEditMenu,group:"2_ccp",title:S({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:gi.EditorContext,group:Ou,title:S("actions.clipboard.cutLabel","Cut"),when:q.writable,order:1},{menuId:gi.CommandPalette,group:"",title:S("actions.clipboard.cutLabel","Cut"),order:1},{menuId:gi.SimpleEditorContext,group:Ou,title:S("actions.clipboard.cutLabel","Cut"),when:q.writable,order:1}]})):void 0,DT=u5?A9(new Tw({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:c0?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:gi.MenubarEditMenu,group:"2_ccp",title:S({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:gi.EditorContext,group:Ou,title:S("actions.clipboard.copyLabel","Copy"),order:2},{menuId:gi.CommandPalette,group:"",title:S("actions.clipboard.copyLabel","Copy"),order:1},{menuId:gi.SimpleEditorContext,group:Ou,title:S("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Rr.appendMenuItem(gi.MenubarEditMenu,{submenu:gi.MenubarCopy,title:Fi("copy as","Copy As"),group:"2_ccp",order:3});Rr.appendMenuItem(gi.EditorContext,{submenu:gi.EditorContextCopy,title:Fi("copy as","Copy As"),group:Ou,order:3});Rr.appendMenuItem(gi.EditorContext,{submenu:gi.EditorContextShare,title:Fi("share","Share"),group:"11_share",order:-1,when:Ze.and(Ze.notEquals("resourceScheme","output"),q.editorTextFocus)});Rr.appendMenuItem(gi.ExplorerContext,{submenu:gi.ExplorerContextShare,title:Fi("share","Share"),group:"11_share",order:-1});const bC=wT?A9(new Tw({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:c0?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:gi.MenubarEditMenu,group:"2_ccp",title:S({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:gi.EditorContext,group:Ou,title:S("actions.clipboard.pasteLabel","Paste"),when:q.writable,order:4},{menuId:gi.CommandPalette,group:"",title:S("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:gi.SimpleEditorContext,group:Ou,title:S("actions.clipboard.pasteLabel","Paste"),when:q.writable,order:4}]})):void 0;class AT extends wt{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:q.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(MS.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),MS.forceCopyWithSyntaxHighlighting=!1)}}function h5(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(Cs).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)=>(Pw().execCommand(e),!0)))}h5(ST,"cut");h5(DT,"copy");bC&&(bC.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(Cs),i=o.get(l0),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=Fl.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():p3?(async()=>{const a=await i.readText();if(a!==""){const d=x3.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}),bC.addImplementation(0,"generic-dom",(o,e)=>(Pw().execCommand("paste"),!0)));u5&&Re(AT);const Xn=new class{constructor(){this.QuickFix=new ns("quickfix"),this.Refactor=new ns("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 ns("notebook"),this.Source=new ns("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var Wo;(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"})(Wo||(Wo={}));function kT(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>f5(e,t,o.include))||!o.includeSourceActions&&Xn.Source.contains(e))}function BT(o,e){const t=e.kind?new ns(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>f5(t,i,o.include))||!o.includeSourceActions&&t&&Xn.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function f5(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Pa{static fromUser(e,t){return!e||typeof e!="object"?new Pa(t.kind,t.apply,!1):new Pa(Pa.getKindFromUser(e,t.kind),Pa.getApplyFromUser(e,t.apply),Pa.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 ns(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 FT{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){bs(n)}i&&(this.action.edit=i.edit)}return this}}const g5="editor.action.codeAction",k9="editor.action.quickFix",p5="editor.action.autoFix",x5="editor.action.refactor",v5="editor.action.sourceAction",U1="editor.action.organizeImports",q1="editor.action.fixAll";class gg extends zt{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:Yo(e.diagnostics)?Yo(t.diagnostics)?gg.codeActionsPreferredComparator(e,t):-1:Yo(t.diagnostics)?1:gg.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(gg.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Xn.QuickFix.contains(new ns(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 I8={actions:[],documentation:void 0};async function qh(o,e,t,i,n,s){var E;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],Xn.Notebook]},d={only:(E=r.include)==null?void 0:E.value,trigger:i.type},u=new v3(e,s),f=i.type===2,g=LT(o,e,f?a:r),p=new Ht,C=g.map(async w=>{try{n.report(w);const A=await w.provideCodeActions(e,t,d,u.token);if(A&&p.add(A),u.token.isCancellationRequested)return I8;const I=((A==null?void 0:A.actions)||[]).filter(R=>R&&BT(r,R)),M=PT(w,I,r.include);return{actions:I.map(R=>new FT(R,w)),documentation:M}}catch(A){if(Gc(A))throw A;return bs(A),I8}}),b=o.onDidChange(()=>{const w=o.all(e);ja(w,g)||u.cancel()});try{const w=await Promise.all(C),A=w.map(M=>M.actions).flat(),I=[...wl(w.map(M=>M.documentation)),...IT(o,e,i,A)];return new gg(A,I,p)}finally{b.dispose(),u.dispose()}}function LT(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>kT(t,new ns(n))):!0)}function*IT(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 PT(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new ns(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 ns(n.kind)))return s.command}}var Sd;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(Sd||(Sd={}));async function TT(o,e,t,i,n=ln.None){var u;const s=o.get(V_),r=o.get(Us),a=o.get(ua),d=o.get(vo);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!==Sd.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=MT(f);d.error(typeof g=="string"?g:S("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function MT(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}Qn.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof jn))throw _l();const{codeActionProvider:s}=o.get(Pi),r=o.get(mo).getModel(e);if(!r)throw _l();const a=qi.isISelection(t)?qi.liftSelection(t):ee.isIRange(t)?r.validateRange(t):void 0;if(!a)throw _l();const d=typeof i=="string"?new ns(i):void 0,u=await qh(s,r,a,{type:1,triggerAction:Wo.Default,filter:{includeSourceActions:!0,include:d}},gl.None,ln.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(ln.None));try{return await Promise.all(f),u.validActions.map(p=>p.action)}finally{setTimeout(()=>u.dispose(),100)}});var RT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},NT=function(o,e){return function(t,i){e(t,i,o)}},G1,Ud;let K1=(Ud=class{constructor(e){this.keybindingService=e}getResolver(){const e=new Mw(()=>this.keybindingService.getKeybindings().filter(t=>G1.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===U1?i={kind:Xn.SourceOrganizeImports.value}:t.command===q1&&(i={kind:Xn.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Pa.fromUser(i,{kind:ns.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 ns(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)}},G1=Ud,Ud.codeActionCommands=[x5,g5,v5,U1,q1],Ud);K1=G1=RT([NT(0,As)],K1);Si("symbolIcon.arrayForeground",Os,S("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.booleanForeground",Os,S("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("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."));Si("symbolIcon.colorForeground",Os,S("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.constantForeground",Os,S("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("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."));Si("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."));Si("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."));Si("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."));Si("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."));Si("symbolIcon.fileForeground",Os,S("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.folderForeground",Os,S("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("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."));Si("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."));Si("symbolIcon.keyForeground",Os,S("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.keywordForeground",Os,S("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("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."));Si("symbolIcon.moduleForeground",Os,S("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.namespaceForeground",Os,S("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.nullForeground",Os,S("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.numberForeground",Os,S("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.objectForeground",Os,S("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.operatorForeground",Os,S("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.packageForeground",Os,S("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.propertyForeground",Os,S("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.referenceForeground",Os,S("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.snippetForeground",Os,S("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.stringForeground",Os,S("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.structForeground",Os,S("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.textForeground",Os,S("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.typeParameterForeground",Os,S("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("symbolIcon.unitForeground",Os,S("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Si("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 m5=Object.freeze({kind:ns.Empty,title:S("codeAction.widget.id.more","More Actions...")}),OT=Object.freeze([{kind:Xn.QuickFix,title:S("codeAction.widget.id.quickfix","Quick Fix")},{kind:Xn.RefactorExtract,title:S("codeAction.widget.id.extract","Extract"),icon:Qi.wrench},{kind:Xn.RefactorInline,title:S("codeAction.widget.id.inline","Inline"),icon:Qi.wrench},{kind:Xn.RefactorRewrite,title:S("codeAction.widget.id.convert","Rewrite"),icon:Qi.wrench},{kind:Xn.RefactorMove,title:S("codeAction.widget.id.move","Move"),icon:Qi.wrench},{kind:Xn.SurroundWith,title:S("codeAction.widget.id.surround","Surround With"),icon:Qi.surroundWith},{kind:Xn.Source,title:S("codeAction.widget.id.source","Source Action"),icon:Qi.symbolFile},m5]);function HT(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:m5,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=OT.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new ns(s.action.kind):ns.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:Qi.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var WT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zT=function(o,e){return function(t,i){e(t,i,o)}},Rh;const P8=vs("gutter-lightbulb",Qi.lightBulb,S("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),T8=vs("gutter-lightbulb-auto-fix",Qi.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.")),M8=vs("gutter-lightbulb-sparkle",Qi.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.")),R8=vs("gutter-lightbulb-aifix-auto-fix",Qi.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.")),N8=vs("gutter-lightbulb-sparkle-filled",Qi.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 Gr;(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})(Gr||(Gr={}));var xl;let Ug=(xl=class extends zt{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new an),this.onClick=this._onClick.event,this._state=Gr.Hidden,this._gutterState=Gr.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+P8.id,"codicon-"+R8.id,"codicon-"+T8.id,"codicon-"+M8.id,"codicon-"+N8.id],this.gutterDecoration=Rh.GUTTER_DECORATION,this._domNode=wi("div.lightBulbWidget"),this._domNode.role="listbox",this._register(bA.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(m3(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=wo(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(Fn(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(Rs.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(p5))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(k9))==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}=wo(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=Rw(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 w=!1;if(E)for(const P of E){const V=P.options.glyphMarginClassName;if(V&&!this.lightbulbClasses.some($=>V.includes($))){w=!0;break}}let A=a,I=1;if(!C){const P=V=>{const $=r.getLineContent(V);return/^\s*$|^\s+/.test($)||$.length<=I};if(a>1&&!b(a-1)){const V=r.getLineCount(),$=a===V,Q=a>1&&P(a-1),re=!$&&P(a+1),he=P(a),Z=!re&&!Q;if(!re&&!Q&&!w)return this.gutterState=new Gr.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Rh._posPref}),this.renderGutterLightbub(),this.hide();Q||$||Q&&!he?A-=1:(re||Z&&he)&&(A+=1)}else if(a===1&&(a===r.getLineCount()||!P(a+1)&&!P(a)))if(this.gutterState=new Gr.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Rh._posPref}),w)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 Gr.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Rh._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!==Gr.Hidden&&(this.state=Gr.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==Gr.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=Gr.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=Qi.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Qi.lightbulbSparkleAutofix:e=Qi.lightbulbAutofix:this.state.actions.hasAIFix?e=Qi.lightbulbSparkle:e=Qi.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=Rn.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=N8,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=R8:e=T8:this.gutterState.actions.hasAIFix?e=M8:e=P8,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=bn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Rn.asClassName(e),glyphMargin:{position:Dv.Left},stickiness:1});this.gutterDecoration=i}renderGutterLightbub(){const e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new ee(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new ee(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=S("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=S("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=S("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=S("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}},Rh=xl,xl.GUTTER_DECORATION=bn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Rn.asClassName(Qi.lightBulb),glyphMargin:{position:Dv.Left},stickiness:1}),xl.ID="editor.contrib.lightbulbWidget",xl._posPref=[0],xl);Ug=Rh=WT([zT(1,As)],Ug);var _5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Z1=function(o,e){return function(t,i){e(t,i,o)}};const b5="acceptSelectedCodeAction",C5="previewSelectedCodeAction";class VT{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 X1=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 Nw(e,Ow);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=Rn.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Ld(e.group.icon.color.id))):(i.icon.className=Rn.asClassName(Qi.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=E5(e.label),i.keybinding.set(e.keybinding),_3(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(b5))==null?void 0:a.getLabel(),s=(d=this._keybindingService.lookupKeybinding(C5))==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()}};X1=_5([Z1(1,As)],X1);class jT extends UIEvent{constructor(){super("acceptSelectedAction")}}class O8 extends UIEvent{constructor(){super("previewSelectedAction")}}function $T(o){if(o.kind==="action")return o.label}let Y1=class extends zt{constructor(e,t,i,n,s,r){super(),this._delegate=n,this._contextViewService=s,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Zs),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:d=>d.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:d=>d.kind};this._list=this._register(new Hw(e,this.domNode,a,[new X1(t,this._keybindingService),new VT],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:$T},accessibilityProvider:{getAriaLabel:d=>{if(d.kind==="action"){let u=d.label?E5(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(b3),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 O8:new jT;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 O8):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([])}};Y1=_5([Z1(4,q_),Z1(5,As)],Y1);function E5(o){return o.replace(/\r\n|\r|\n/g," ")}var UT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CC=function(o,e){return function(t,i){e(t,i,o)}};Si("actionBar.toggledBackground",Ww,S("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Hu={Visible:new wn("codeActionMenuVisible",!1,S("codeActionMenuVisible","Whether the action widget list is visible"))},Ju=Rl("actionWidgetService");let Wu=class extends zt{get isVisible(){return Hu.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=Hu.Visible.bindTo(this._contextKeyService),u=this._instantiationService.createInstance(Y1,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 Ht,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(Fn(a,as.MOUSE_DOWN,b=>b.stopPropagation()));const d=document.createElement("div"),u=e.appendChild(d);u.classList.add("context-view-pointerBlock"),s.add(Fn(u,as.POINTER_MOVE,()=>u.remove())),s.add(Fn(u,as.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(Pf(e));return s.add(p.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=wi(e),n=new Fg(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};Wu=UT([CC(0,q_),CC(1,Ln),CC(2,tn)],Wu);Nl(Ju,Wu,1);const Gp=1100;Vn(class extends Ao{constructor(){super({id:"hideCodeActionWidget",title:Fi("hideCodeActionWidget.title","Hide action widget"),precondition:Hu.Visible,keybinding:{weight:Gp,primary:9,secondary:[1033]}})}run(o){o.get(Ju).hide(!0)}});Vn(class extends Ao{constructor(){super({id:"selectPrevCodeAction",title:Fi("selectPrevCodeAction.title","Select previous action"),precondition:Hu.Visible,keybinding:{weight:Gp,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.focusPrevious()}});Vn(class extends Ao{constructor(){super({id:"selectNextCodeAction",title:Fi("selectNextCodeAction.title","Select next action"),precondition:Hu.Visible,keybinding:{weight:Gp,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.focusNext()}});Vn(class extends Ao{constructor(){super({id:b5,title:Fi("acceptSelected.title","Accept selected action"),precondition:Hu.Visible,keybinding:{weight:Gp,primary:3,secondary:[2137]}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.acceptSelected()}});Vn(class extends Ao{constructor(){super({id:C5,title:Fi("previewSelected.title","Preview selected action"),precondition:Hu.Visible,keybinding:{weight:Gp,primary:2051}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.acceptSelected(!0)}});const y5=new wn("supportedCodeAction",""),H8="_typescript.applyFixAllCodeAction";class qT extends zt{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new Ap),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=>Av(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:Wo.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!==sC.Off){{if(i===sC.On)return t;if(i===sC.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 md;(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(Gc(r))return w5;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(md||(md={}));const w5=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class GT extends zt{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=md.Empty,this._onDidChangeState=this._register(new an),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=y5.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(md.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(md.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 qT(this._editor,this._markerService,i=>{var d;if(!i){this.setState(md.Empty);return}const n=i.selection.getStartPosition(),s=Ks(async u=>{var f,g,p,C,b,E,w,A,I,M;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===Wo.QuickFix||(g=(f=i.trigger.filter)==null?void 0:f.include)!=null&&g.contains(Xn.QuickFix))){const R=await qh(this._registry,e,i.selection,i.trigger,gl.None,u),P=[...R.allActions];if(u.isCancellationRequested)return w5;const V=(p=R.validActions)==null?void 0:p.some(Q=>Q.action.kind?Xn.QuickFix.contains(new ns(Q.action.kind)):!1),$=this._markerService.read({resource:e.uri});if(V){for(const Q of R.validActions)(b=(C=Q.action.command)==null?void 0:C.arguments)!=null&&b.some(re=>typeof re=="string"&&re.includes(H8))&&(Q.action.diagnostics=[...$.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&&$.length>0){const Q=i.selection.getPosition();let re=Q,he=Number.MAX_VALUE;const Z=[...R.validActions];for(const _e of $){const se=_e.endColumn,ue=_e.endLineNumber,Se=_e.startLineNumber;if(ue===Q.lineNumber||Se===Q.lineNumber){re=new Ii(ue,se);const Te={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(E=i.trigger.filter)!=null&&E.include?(w=i.trigger.filter)==null?void 0:w.include:Xn.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((A=i.trigger.context)==null?void 0:A.notAvailableMessage)||"",position:re}},xe=new qi(re.lineNumber,re.column,re.lineNumber,re.column),Oe=await qh(this._registry,e,xe,Te,gl.None,u);if(Oe.validActions.length!==0){for(const We of Oe.validActions)(M=(I=We.action.command)==null?void 0:I.arguments)!=null&&M.some(be=>typeof be=="string"&&be.includes(H8))&&(We.action.diagnostics=[...$.filter(be=>be.relatedInformation)]);R.allActions.length===0&&P.push(...Oe.allActions),Math.abs(Q.column-se)<he?Z.unshift(...Oe.validActions):Z.push(...Oe.validActions)}he=Math.abs(Q.column-se)}}const ce=Z.filter((_e,se,ue)=>ue.findIndex(Se=>Se.action.title===_e.action.title)===se);return ce.sort((_e,se)=>_e.action.isPreferred&&!se.action.isPreferred?-1:!_e.action.isPreferred&&se.action.isPreferred||_e.action.isAI&&!se.action.isAI?1:!_e.action.isAI&&se.action.isAI?-1:0),{validActions:ce,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 Ho,P=await qh(this._registry,e,i.selection,i.trigger,gl.None,u);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:P.validActions.length,duration:R.elapsed()}),P}return qh(this._registry,e,i.selection,i.trigger,gl.None,u)});i.trigger.type===1&&((d=this._progressService)==null||d.showWhile(s,250));const r=new md.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:Wo.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 KT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ma=function(o,e){return function(t,i){e(t,i,o)}},Nh;const ZT="quickfix-edit-highlight";var yc;let Gf=(yc=class extends zt{static get(e){return e.getContribution(Nh.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 GT(this._editor,s.codeActionProvider,t,i,r,d,this._telemetryService)),this._register(this._model.onDidChangeState(p=>this.update(p))),this._lightBulbWidget=new Mw(()=>{const p=this._editor.getContribution(Ug.ID);return p&&this._register(p.onClick(C=>this.showCodeActionsFromLightbulb(C.actions,C))),p}),this._resolver=n.createInstance(K1),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,Sd.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=Ro.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(TT,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:Wo.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){qn(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,Sd.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const g=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(g&&g.action.disabled){(r=Ro.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=Ro.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=Ii.isIPosition(t)?this.toCoords(t):t,d={onSelect:async(u,f)=>{this._applyCodeAction(u,!0,!!f,i.fromLightbulb?Sd.FromAILightbulb:Sd.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 ns(p);g=[Xn.RefactorExtract,Xn.RefactorInline,Xn.RefactorRewrite,Xn.RefactorMove,Xn.Source].some(w=>w.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:Nh.DECORATION})):p.map(E=>({range:E,options:Nh.DECORATION}));n.set(b)}else if(C&&C.length>0){const b=C.map(w=>({range:w,options:Nh.DECORATION}));n.set(b);const E=C[0];if(E.startLineNumber&&E.startColumn){const w=(g=(f=this._editor.getModel())==null?void 0:f.getWordAtPosition({lineNumber:E.startLineNumber,column:E.startColumn}))==null?void 0:g.word;Tf(S("editingNewSelection","Context: {0} at line {1} and column {2}.",w,E.startLineNumber,E.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,HT(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=wo(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}},Nh=yc,yc.ID="editor.contrib.codeActionController",yc.DECORATION=bn.register({description:"quickfix-highlight",className:ZT}),yc);Gf=Nh=KT([ma(1,zw),ma(2,Ln),ma(3,tn),ma(4,Pi),ma(5,kp),ma(6,Us),ma(7,ss),ma(8,Ju),ma(9,tn),ma(10,ua)],Gf);G_((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(C3));const i=o.getColor(CA);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Lg(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Kp(o){return Ze.regex(y5.keys()[0],new RegExp("(\\s|^)"+Ig(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 eh(o,e,t,i,n=Wo.Default){if(o.hasModel()){const s=Gf.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class XT extends wt{constructor(){super({id:k9,label:S("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:Ze.and(q.writable,q.hasCodeActionsProvider),kbOpts:{kbExpr:q.textInputFocus,primary:2137,weight:100}})}run(e,t){return eh(t,S("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,Wo.QuickFix)}}class YT extends ko{constructor(){super({id:g5,precondition:Ze.and(q.writable,q.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:B9}]}})}runEditorCommand(e,t,i){const n=Pa.fromUser(i,{kind:ns.Empty,apply:"ifSingle"});return eh(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 QT extends wt{constructor(){super({id:x5,label:S("refactor.label","Refactor..."),alias:"Refactor...",precondition:Ze.and(q.writable,q.hasCodeActionsProvider),kbOpts:{kbExpr:q.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Ze.and(q.writable,Kp(Xn.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:B9}]}})}run(e,t,i){const n=Pa.fromUser(i,{kind:Xn.Refactor,apply:"never"});return eh(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:Xn.Refactor.contains(n.kind)?n.kind:ns.None,onlyIncludePreferredActions:n.preferred},n.apply,Wo.Refactor)}}class JT extends wt{constructor(){super({id:v5,label:S("source.label","Source Action..."),alias:"Source Action...",precondition:Ze.and(q.writable,q.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Ze.and(q.writable,Kp(Xn.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:B9}]}})}run(e,t,i){const n=Pa.fromUser(i,{kind:Xn.Source,apply:"never"});return eh(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:Xn.Source.contains(n.kind)?n.kind:ns.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,Wo.SourceAction)}}class eM extends wt{constructor(){super({id:U1,label:S("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:Ze.and(q.writable,Kp(Xn.SourceOrganizeImports)),kbOpts:{kbExpr:q.textInputFocus,primary:1581,weight:100}})}run(e,t){return eh(t,S("editor.action.organize.noneMessage","No organize imports action available"),{include:Xn.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",Wo.OrganizeImports)}}class tM extends wt{constructor(){super({id:q1,label:S("fixAll.label","Fix All"),alias:"Fix All",precondition:Ze.and(q.writable,Kp(Xn.SourceFixAll))})}run(e,t){return eh(t,S("fixAll.noneMessage","No fix all action available"),{include:Xn.SourceFixAll,includeSourceActions:!0},"ifSingle",Wo.FixAll)}}class iM extends wt{constructor(){super({id:p5,label:S("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:Ze.and(q.writable,Kp(Xn.QuickFix)),kbOpts:{kbExpr:q.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return eh(t,S("editor.action.autoFix.noneMessage","No auto fixes available"),{include:Xn.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",Wo.AutoFix)}}un(Gf.ID,Gf,3);un(Ug.ID,Ug,4);Re(XT);Re(QT);Re(JT);Re(eM);Re(iM);Re(tM);Ri(new YT);ca.as(Bp.Configuration).registerConfiguration({...K_,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:S("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});ca.as(Bp.Configuration).registerConfiguration({...K_,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}}});ca.as(Bp.Configuration).registerConfiguration({...K_,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 Q1{constructor(){this.lenses=[],this._disposables=new Ht}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 S5(o,e,t){const i=o.ordered(e),n=new Map,s=new Q1,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){bs(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}Qn.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Pn(jn.isUri(t)),Pn(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Pi),s=o.get(mo).getModel(t);if(!s)throw _l();const r=[],a=new Ht;return S5(n,s,ln.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,ln.None)).then(g=>r.push(g||f.symbol)));return Promise.all(u)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var nM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sM=function(o,e){return function(t,i){e(t,i,o)}};const D5=Rl("ICodeLensCache");class W8{constructor(e,t){this.lineCount=e,this.data=t}}let J1=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Fp(20,.75);const t="codelens/cache";E3(y3,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=Rs.filter(e.onWillSaveState,r=>r.reason===Vw.SHUTDOWN);Rs.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 Q1;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new W8(e.getLineCount(),n);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const s of i.data.lenses)n.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],s=[];for(const a of n.lines)s.push({range:new ee(a,1,a,11)});const r=new Q1;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new W8(n.lineCount,r))}}catch{}}};J1=nM([sM(0,Kc)],J1);Nl(D5,J1,1);class oM{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 Ag=class Ag{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${Ag._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=w3(r.command.title.trim());if(r.command.id){const d=`c${Ag._idPool++}`;i.push(wi("a",{id:d,title:r.command.tooltip,role:"button"},...a)),this._commands.set(d,r.command)}else i.push(wi("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(wi("span",void 0," | "))}}n?(kv(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):kv(this._domNode,wi("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}};Ag._idPool=0;let eE=Ag;class EC{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 z8=bn.register({collapseOnReplaceEdit:!0,description:"codelens"});class V8{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:z8},g=>this._decorationIds[f]=g),a?a=ee.plusRange(a,u.symbol.range):a=ee.lift(u.symbol.range)}),this._viewZone=new oM(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 eE(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t==null||t.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&ee.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:z8},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 rM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},R0=function(o,e){return function(t,i){e(t,i,o)}},Cf;let qg=(Cf=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 Ht,this._localToDispose=new Ht,this._lenses=[],this._oldCodeLensModels=new Ht,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Ns(()=>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",jw.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&&Bg(()=>{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 Ns(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=Ks(r=>S5(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()},qn)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(is(()=>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 EC;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(is(()=>{if(this._editor.getModel()){const n=Mf.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 EC;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=Mf.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(d=>{const u=new EC;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 V8(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 V8(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=Ks(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},bs):(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=>{qn(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}},Cf.ID="css.editor.codeLens",Cf);qg=rM([R0(1,Pi),R0(2,gr),R0(3,Us),R0(4,vo),R0(5,D5)],qg);un(qg.ID,qg,1);Re(class extends wt{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:q.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(Ml),n=e.get(Us),s=e.get(vo),r=t.getSelection().positionLineNumber,a=t.getContribution(qg.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 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},tE=function(o,e){return function(t,i){e(t,i,o)}};let Gg=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 vn(new Rf(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),d=r?vn.Format.CSS.formatRGB(a):vn.Format.CSS.formatRGBA(a),u=r?vn.Format.CSS.formatHSL(a):vn.Format.CSS.formatHSLA(a),f=r?vn.Format.CSS.formatHex(a):vn.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}};Gg=A5([tE(0,Ol)],Gg);let iE=class extends zt{constructor(e,t){super(),this._register(e.colorProvider.register("*",new Gg(t)))}};iE=A5([tE(0,Pi),tE(1,Ol)],iE);d0(iE);async function k5(o,e,t,i=!0){return F9(new aM,o,e,t,i)}function B5(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class aM{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 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({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(s)}}class cM{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,ln.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function F9(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 Gg)r=f;else try{await o.compute(f,t,i,a)&&(s=!0)}catch(g){bs(g)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function F5(o,e){const{colorProvider:t}=o.get(Pi),i=o.get(mo).getModel(e);if(!i)throw _l();const n=o.get(ss).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}Qn.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof jn))throw _l();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=F5(o,t);return F9(new lM,n,i,ln.None,s)});Qn.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof jn)||!Array.isArray(t)||t.length!==4||!ee.isIRange(s))throw _l();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:d}=F5(o,n),[u,f,g,p]=t;return F9(new cM({range:s,color:{red:u,green:f,blue:g,alpha:p}}),a,r,ln.None,d)});var dM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yC=function(o,e){return function(t,i){e(t,i,o)}},nE;const L5=Object.create({});var wc;let Kf=(wc=class extends zt{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Ht),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new EA(this._editor),this._decoratorLimitReporter=new uM,this._colorDecorationClassRefs=this._register(new Ht),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:nE.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 Ap,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Ks(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Ho(!1),n=await k5(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){qn(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 Rf(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:mA,inlineClassName:`${p.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:L5}}})}const n=i<e.length?i:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(ee.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}},nE=wc,wc.ID="editor.contrib.colorDetector",wc.RECOMPUTE_TIME=1e3,wc);Kf=nE=dM([yC(1,ss),yC(2,Pi),yC(3,gr)],Kf);class uM{constructor(){this._onDidChange=new an,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}un(Kf.ID,Kf,1);class hM{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 an,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new an,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new an,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){i=n;break}if(i===-1){const n=t.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(n)){i=s;break}}i!==-1&&i!==this.presentationIndex&&(this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const Ko=wi;class fM extends zt{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=Ko(".colorpicker-header"),_i(e,this._domNode),this._pickedColorNode=_i(this._domNode,Ko(".picked-color")),_i(this._pickedColorNode,Ko("span.codicon.codicon-color-mode")),this._pickedColorPresentation=_i(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=_i(this._domNode,Ko(".original-color")),this._originalColorNode.style.backgroundColor=vn.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(RS)||vn.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(RS)||vn.white})),this._register(Fn(this._pickedColorNode,as.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Fn(this._originalColorNode,as.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=vn.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 gM(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=vn.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 gM extends zt{constructor(e){super(),this._onClicked=this._register(new an),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),_i(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),_i(this._button,t),_i(t,Ko(".button"+Rn.asCSSSelector(vs("color-picker-close",Qi.close,S("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Fn(this._button,as.CLICK,()=>{this._onClicked.fire()}))}}class pM extends zt{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Ko(".colorpicker-body"),_i(e,this._domNode),this._saturationBox=new xM(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 vM(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 mM(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 _M(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 vn(new Qx(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new vn(new Qx(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new vn(new Qx(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 xM extends zt{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new an,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new an,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Ko(".saturation-wrap"),_i(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",_i(this._domNode,this._canvas),this.selection=Ko(".saturation-selection"),_i(this._domNode,this.selection),this.layout(),this._register(Fn(this._domNode,as.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 yA);const t=wo(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=Fn(e.target.ownerDocument,as.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 vn(new Qx(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=vn.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 I5 extends zt{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new an,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new an,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=_i(e,Ko(".standalone-strip")),this.overlay=_i(this.domNode,Ko(".standalone-overlay"))):(this.domNode=_i(e,Ko(".strip")),this.overlay=_i(this.domNode,Ko(".overlay"))),this.slider=_i(this.domNode,Ko(".slider")),this.slider.style.top="0px",this._register(Fn(this.domNode,as.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 yA),i=wo(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=Fn(e.target.ownerDocument,as.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 vM extends I5{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 vn(new Rf(t,i,n,1)),r=new vn(new Rf(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class mM extends I5{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class _M extends zt{constructor(e){super(),this._onClicked=this._register(new an),this.onClicked=this._onClicked.event,this._button=_i(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Fn(this._button,as.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class bM extends Lp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(S3.getInstance(Id(e)).onDidChange(()=>this.layout())),this._domNode=Ko(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new fM(this._domNode,this.model,n,s)),this.body=this._register(new pM(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class wC{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 cv{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 zu{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const th=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var P5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},T5=function(o,e){return function(t,i){e(t,i,o)}};class CM{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 Kg=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return sa.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=Kf.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 M5(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=R5(this,this._editor,this._themeService,t,e);if(!i)return new zu([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new zu([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};Kg=P5([T5(1,Wr)],Kg);class EM{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let Zg=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!Kf.get(this._editor))return null;const s=await k5(i,this._editor.getModel(),ln.None);let r=null,a=null;for(const g of s){const p=g.colorInfo;ee.containsRange(p.range,e.range)&&(r=p,a=g.provider)}const d=r??e,u=a??t,f=!!r;return{colorHover:await M5(this,this._editor.getModel(),d,u),foundInEditor:f}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new ee(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await dv(this._editor.getModel(),t,this._color,i,e),i=N5(this._editor,i,t))}renderHoverParts(e,t){return R5(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};Zg=P5([T5(1,Wr)],Zg);async function M5(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:d}=t.color,u=new Rf(Math.round(s*255),Math.round(r*255),Math.round(a*255),d),f=new vn(u),g=await B5(e,t,i,ln.None),p=new hM(f,[],0);return p.colorPresentations=g||[],p.guessColorPresentation(f,n),o instanceof Kg?new CM(o,ee.lift(t.range),p,i):new EM(o,ee.lift(t.range),p,i)}function R5(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const p=e.getOption(67)+8;n.setMinimumDimensions(new Zn(302,p))}const s=new Ht,r=i[0],a=e.getModel(),d=r.model,u=s.add(new bM(n.fragment,d,e.getOption(144),t,o instanceof Zg));let f=!1,g=new ee(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof Zg){const p=r.model.color;o.color=p,dv(a,d,p,g,r),s.add(d.onColorFlushed(C=>{o.color=C}))}else s.add(d.onColorFlushed(async p=>{await dv(a,d,p,g,r),f=!0,g=N5(e,g,d)}));return s.add(d.onDidChangeColor(p=>{dv(a,d,p,g,r)})),s.add(e.onDidChangeModelContent(p=>{f?f=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:u,disposables:s}}function N5(o,e,t){const i=[],n=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};i.push(n),t.presentation.additionalTextEdits&&i.push(...t.presentation.additionalTextEdits);const s=ee.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function dv(o,e,t,i,n){const s=await B5(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,ln.None);e.colorPresentations=s||[]}const O5="editor.action.showHover",yM="editor.action.showDefinitionPreviewHover",wM="editor.action.scrollUpHover",SM="editor.action.scrollDownHover",DM="editor.action.scrollLeftHover",AM="editor.action.scrollRightHover",kM="editor.action.pageUpHover",BM="editor.action.pageDownHover",FM="editor.action.goToTopHover",LM="editor.action.goToBottomHover",_b="editor.action.increaseHoverVerbosityLevel",IM=S({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),bb="editor.action.decreaseHoverVerbosityLevel",PM=S({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),H5="editor.action.inlineSuggest.commit",W5="editor.action.inlineSuggest.showPrevious",z5="editor.action.inlineSuggest.showNext";var L9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}},uv;let sE=class extends zt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Po(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=Wn(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 Ii(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Ip((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=AA((u,f)=>{const g=f.add(this.instantiationService.createInstance(Zf,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(g),f.add(is(()=>e.removeContentWidget(g))),f.add(rs(p=>{this.position.read(p)&&r.lastTriggerKind.read(p)!==bl.Explicit&&r.triggerExplicitly()})),g}),d=Z_(this,(u,f)=>!!this.position.read(u)||!!f);s.add(rs(u=>{d.read(u)&&a.read(u)}))}))}};sE=L9([Br(2,tn)],sE);const TM=vs("inline-suggestion-hints-next",Qi.chevronRight,S("parameterHintsNextIcon","Icon for show next parameter hint.")),MM=vs("inline-suggestion-hints-previous",Qi.chevronLeft,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Sc;let Zf=(Sc=class extends zt{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new Nf(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${uv.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Fr("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Fr("div@toolBar")]),this.previousAction=this.createCommandAction(W5,S("previous","Previous"),Rn.asClassName(MM)),this.availableSuggestionCountAction=new Nf("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(z5,S("next","Next"),Rn.asClassName(TM)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(gi.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Ns(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Ns(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(d.createInstance(oE,this.nodes.toolBar,gi.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:p=>p.startsWith("primary")},actionViewItemProvider:(p,C)=>{if(p instanceof Of)return d.createInstance(NM,p,void 0);if(p===this.availableSuggestionCountAction){const b=new RM(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=>{uv._dropDownVisible=p})),this._register(rs(p=>{this._position.read(p),this.editor.layoutContentWidget(this)})),this._register(rs(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(rs(p=>{const b=this._extraCommands.read(p).map(E=>({class:void 0,id:E.id,enabled:!0,tooltip:E.tooltip||"",label:E.title,run:w=>this._commandService.executeCommand(E.id)}));for(const[E,w]of this.inlineCompletionsActionsMenus.getActions())for(const A of w)A instanceof Of&&b.push(A);b.length>0&&b.unshift(new Pg),this.toolBar.setAdditionalSecondaryActions(b)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},uv=Sc,Sc._dropDownVisible=!1,Sc.id=0,Sc);Zf=uv=L9([Br(6,Us),Br(7,tn),Br(8,As),Br(9,Ln),Br(10,Zu)],Zf);class RM extends r1{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 NM=class extends wA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Fr("div.keybinding").root;this._register(new Nw(t,Ow,{disableTitle:!0,...SA})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},oE=class extends DA{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=[];$w(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){ja(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){ja(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};oE=L9([Br(3,Zu),Br(4,Ln),Br(5,a0),Br(6,As),Br(7,Us),Br(8,ua)],oE);function Cb(o,e,t){const i=wo(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let OM=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class V5 extends zt{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new an),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Ns(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Ns(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Ns(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=D3(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){qn(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 OM(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 I9{constructor(){this._onDidWillResize=new an,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new an,this.onDidResize=this._onDidResize.event,this._sashListener=new Ht,this._size=new Zn(0,0),this._minSize=new Zn(0,0),this._maxSize=new Zn(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new zh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new zh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new zh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:NS.North}),this._southSash=new zh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:NS.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(Rs.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(Rs.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(Rs.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(Rs.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 Zn(t,e);Zn.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 HM=30,WM=24;class zM extends zt{constructor(e,t=new Zn(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new I9),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=Zn.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 Zn(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?Ii.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:wo(t).top+i.top-HM}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=wo(t),s=Pp(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-WM}_findPositionPreference(e,t){const i=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),s=Math.min(Math.max(n,i),e),r=Math.min(e,s);let a;return this._editor.getOption(60).above?a=r<=n?1:2:a=r<=i?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}}var VM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ex=function(o,e){return function(t,i){e(t,i,o)}},Ea;const j8=30,jM=6;var Dc;let rE=(Dc=class extends zM{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 Zn(a,r);super(e,d),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new kA),this._onDidResize=this._register(new an),this.onDidResize=this._onDidResize.event,this._minimumSize=d,this._hoverVisibleKey=q.hoverVisible.bindTo(t),this._hoverFocusedKey=q.hoverFocused.bindTo(t),_i(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(Pf(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 Ea.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 Ea._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Ea._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){Ea._applyMaxDimensions(this._hover.contentsDomNode,e,t),Ea._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 Zn(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Ea._lastDimensions=new Zn(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=jM;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?Pp(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=wo(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=$8(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=$8(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,Ea._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Ea._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=Vh(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&&A3(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 Zn(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 Zn(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 Zn(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=Vh(e),i=yr(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=Vh(e),i=yr(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=Vh(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-j8})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+j8})}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})}},Ea=Dc,Dc.ID="editor.contrib.resizableContentHoverWidget",Dc._lastDimensions=new Zn(0,0),Dc);rE=Ea=VM([Ex(1,Ln),Ex(2,ss),Ex(3,X_),Ex(4,As)],rE);function $8(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 Zv{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 sa.EMPTY;const i=Zv._getLineDecorations(this._editor,t);return sa.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):sa.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=Zv._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return wl(t)}}class j5{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 $M(this,this.anchor,t,this.isComplete)}}class $M extends j5{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}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},qM=function(o,e){return function(t,i){e(t,i,o)}};const U8=wi;let Xv=class extends zt{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=U8("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=_i(this.hoverElement,U8("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(k3.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=_i(this.actionsElement,e);return this._hasContent=!0,t}};Xv=UM([qM(0,As)],Xv);class GM{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function KM(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(bs);if(!(!s||!ZM(s)))return new GM(o,s,e)}function P9(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,d)=>KM(a,d,e,t,i));return sa.fromPromises(r).coalesce()}function $5(o,e,t,i,n=!1){return P9(o,e,t,i,n).map(s=>s.hover).toPromise()}Bo("_executeHoverProvider",(o,e,t)=>{const i=o.get(Pi);return $5(i.hoverProvider,e,t,ln.None)});Bo("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(Pi);return $5(i.hoverProvider,e,t,ln.None,!0)});function ZM(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var XM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dd=function(o,e){return function(t,i){e(t,i,o)}};const Gh=wi,YM=vs("hover-increase-verbosity",Qi.add,S("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),QM=vs("hover-decrease-verbosity",Qi.remove,S("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Ir{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 U5{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case ur.Increase:return this.hover.canIncreaseVerbosity??!1;case ur.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let Xg=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 Ir(this,e.range,[new lo().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 Ir(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 Ir(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,w=b.range.endLineNumber===n?b.range.endColumn:s,A=b.options.hoverMessage;if(!A||Tg(A))continue;b.options.beforeContentClassName&&(C=!0);const I=new ee(e.range.startLineNumber,E,e.range.startLineNumber,w);r.push(new Ir(this,I,BA(A),C,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return sa.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):sa.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return P9(e,t,s,n).filter(d=>!Tg(d.hover.contents)).map(d=>{const u=d.hover.range?ee.lift(d.hover.range):i.range,f=new U5(d.hover,d.provider,s);return new Ir(this,u,d.hover.contents,!1,d.ordinal,f)})}renderHoverParts(e,t){return this._renderedHoverParts=new JM(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))}};Xg=XM([dd(1,ha),dd(2,da),dd(3,ss),dd(4,Pi),dd(5,As),dd(6,Tp),dd(7,Us)],Xg);class yx{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class JM{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 Ht,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(is(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(Mp(n=>n.ordinal,Y_)),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 Ht;if(r.add(i),!s)return new yx(e,n,r);const a=s.supportsVerbosityAction(ur.Increase),d=s.supportsVerbosityAction(ur.Decrease);if(!a&&!d)return new yx(e,n,r);const u=Gh("div.verbosity-actions");return n.prepend(u),r.add(this._renderHoverExpansionAction(u,ur.Increase,a)),r.add(this._renderHoverExpansionAction(u,ur.Decrease,d)),new yx(e,n,r)}_renderMarkdownHover(e,t){return q5(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new Ht,s=t===ur.Increase,r=_i(e,Gh(Rn.asCSSSelector(s?YM:QM)));r.tabIndex=0;const a=new B3("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,tR(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const d=()=>this._commandService.executeCommand(t===ur.Increase?_b:bb);return n.add(new F3(r,d)),n.add(new L3(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 U5(a,r.hoverProvider,r.hoverPosition),u=s.hoverPart,f=new Ir(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===ur.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new Zs;this._ongoingHoverOperations.set(s,{verbosityDelta:n,tokenSource:a});const d={verbosityRequest:{verbosityDelta:n,previousHover:e.hover}};let u;try{u=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,d))}catch(f){bs(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 yx(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 eR(o,e,t,i,n){e.sort(Mp(r=>r.ordinal,Y_));const s=[];for(const r of e)s.push(q5(t,r,i,n,o.onContentsChanged));return new zu(s)}function q5(o,e,t,i,n){const s=new Ht,r=Gh("div.hover-row"),a=Gh("div.hover-row-contents");r.appendChild(a);const d=e.contents;for(const f of d){if(Tg(f))continue;const g=Gh("div.markdown-hover"),p=_i(g,Gh("div.hover-contents")),C=s.add(new u0({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 tR(o,e){switch(e){case ur.Increase:{const t=o.lookupKeybinding(_b);return t?S("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):S("increaseVerbosity","Increase Hover Verbosity")}case ur.Decrease:{const t=o.lookupKeybinding(bb);return t?S("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):S("decreaseVerbosity","Decrease Hover Verbosity")}}}function aE(o,e){return!!o[e]}class SC{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=aE(e.event,t.triggerModifier),this.hasSideBySideModifier=aE(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class q8{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=aE(e,t.triggerModifier)}}class wx{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 G8(o){return o==="altKey"?$a?new wx(57,"metaKey",6,"altKey"):new wx(5,"ctrlKey",6,"altKey"):$a?new wx(6,"altKey",57,"metaKey"):new wx(6,"altKey",5,"ctrlKey")}class Eb extends zt{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new an),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new an),this.onExecute=this._onExecute.event,this._onCancel=this._register(new an),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=G8(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=G8(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 SC(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new SC(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new SC(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new q8(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new q8(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 G5{constructor(e,t){this.range=e,this.direction=t}}class T9{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new T9(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){bs(t),this._isResolved=!1}}}const nf=class nf{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??nf._emptyInlayHintList,a])}catch(u){bs(u)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new U_;return new nf(i,s,t)}constructor(e,t,i){this._disposables=new Ht,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=nf._getRangeAtPosition(i,d);let g;f.getStartPosition().isBefore(d)?(g=ee.fromPositions(f.getStartPosition(),d),u="after"):(g=ee.fromPositions(d,f.getEndPosition()),u="before"),n.push(new T9(a,new G5(g,u),r))}}this.items=n.sort((s,r)=>Ii.compare(s.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new ee(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),r=t.column-1,a=s.findTokenIndexAtOffset(r);let d=s.getStartOffset(a),u=s.getEndOffset(a);return u-d===1&&(d===r&&a>1?(d=s.getStartOffset(a-1),u=s.getEndOffset(a-1)):u===r&&a<s.getCount()-1&&(d=s.getStartOffset(a+1),u=s.getEndOffset(a+1))),new ee(i,d+1,i,u+1)}};nf._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let Yv=nf;function iR(o){return jn.from({scheme:Eo.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}var nR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},il=function(o,e){return function(t,i){e(t,i,o)}};let Hr=class extends I3{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){Uw(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Hr=nR([il(4,tn),il(5,Cs),il(6,Us),il(7,Ln),il(8,Wr),il(9,vo),il(10,X_),il(11,qs),il(12,Pi)],Hr);const K8=new vn(new Rf(0,122,204)),sR={showArrow:!0,showFrame:!0,className:"",frameColor:K8,arrowColor:K8,keepEditorSelection:!1},oR="vs.editor.contrib.zoneWidget";class rR{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 aR{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const n_=class n_{constructor(e){this._editor=e,this._ruleName=n_._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),OS(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(){OS(this._ruleName),M3(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:ee.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};n_._IdGenerator=new T3(".arrow-decoration-");let lE=n_;class lR{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Ht,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=P3(t),Uw(this.options,sR,!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 lE(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){var t;if(this.domNode.style.height=`${e}px`,this.container){const i=e-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const n=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(n))}(t=this._resizeSash)==null||t.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=ee.isIRange(e)?ee.lift(e):ee.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options: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 rR(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 aR(oR+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const p=this.options.frameWidth?this.options.frameWidth:u;this.container.style.borderTopWidth=p+"px",this.container.style.borderBottomWidth=p+"px"}const f=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=d+"px",this.container.style.height=f+"px",this.container.style.overflow="hidden"),this._doLayout(f,s),this.options.keepEditorSelection||this.editor.setSelection(e);const g=this.editor.getModel();if(g){const p=g.validateRange(new ee(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(p,p.startLineNumber===g.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new zh(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 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},Z5=function(o,e){return function(t,i){e(t,i,o)}};const X5=Rl("IPeekViewService");Nl(X5,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 So;(function(o){o.inPeekEditor=new wn("inReferenceSearchEditor",!0,S("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(So||(So={}));var Ef;let Qv=(Ef=class{constructor(e,t){e instanceof Hr&&So.inPeekEditor.bindTo(t)}dispose(){}},Ef.ID="editor.contrib.referenceController",Ef);Qv=K5([Z5(1,Ln)],Qv);un(Qv.ID,Qv,0);function cR(o){const e=o.get(Cs).getFocusedCodeEditor();return e instanceof Hr?e.getParentEditor():e}const dR={headerBackgroundColor:vn.white,primaryHeadingColor:vn.fromHex("#333333"),secondaryHeadingColor:vn.fromHex("#6c6c6cb3")};let Jv=class extends lR{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new an,this.onDidClose=this._onDidClose.event,Uw(this.options,dR,!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=wi(".head"),this._bodyElement=wi(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=wi(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Dl(this._titleElement,"click",s=>this._onTitleClick(s))),_i(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=wi("span.filename"),this._secondaryHeading=wi("span.dirname"),this._metaHeading=wi("span.meta"),_i(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=wi(".peekview-actions");_i(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Fg(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new Nf("peekview.close",S("label.close","Close"),Rn.asClassName(Qi.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:R3.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:Wa(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Lr(this._metaHeading)):qo(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`)}};Jv=K5([Z5(2,tn)],Jv);const uR=Si("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:vn.black,hcLight:vn.white},S("peekViewTitleBackground","Background color of the peek view title area.")),Y5=Si("peekViewTitleLabel.foreground",{dark:vn.white,light:vn.black,hcDark:vn.white,hcLight:Rp},S("peekViewTitleForeground","Color of the peek view title.")),Q5=Si("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},S("peekViewTitleInfoForeground","Color of the peek view title info.")),hR=Si("peekView.border",{dark:a1,light:a1,hcDark:Sl,hcLight:Sl},S("peekViewBorder","Color of the peek view borders and arrow.")),fR=Si("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:vn.black,hcLight:vn.white},S("peekViewResultsBackground","Background color of the peek view result list."));Si("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:vn.white,hcLight:Rp},S("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));Si("peekViewResult.fileForeground",{dark:vn.white,light:"#1E1E1E",hcDark:vn.white,hcLight:Rp},S("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));Si("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},S("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));Si("peekViewResult.selectionForeground",{dark:vn.white,light:"#6C6C6C",hcDark:vn.white,hcLight:Rp},S("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const J5=Si("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:vn.black,hcLight:vn.white},S("peekViewEditorBackground","Background color of the peek view editor."));Si("peekViewEditorGutter.background",J5,S("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));Si("peekViewEditorStickyScroll.background",J5,S("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));Si("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},S("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));Si("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},S("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));Si("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Bu,hcLight:Bu},S("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class jc{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=N3.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,Ua(this.uri),this.range.startLineNumber,this.range.startColumn):S("aria.oneReference","in {0} on line {1} at column {2}",Ua(this.uri),this.range.startLineNumber,this.range.startColumn)}}class gR{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:s,endLineNumber:r,endColumn:a}=e,d=i.getWordUntilPosition({lineNumber:n,column:s-t}),u=new ee(n,d.startColumn,n,s),f=new ee(r,a,r,1073741824),g=i.getValueInRange(u).replace(/^\s+/,""),p=i.getValueInRange(e),C=i.getValueInRange(f).replace(/\s+$/,"");return{value:g+p+C,highlight:{start:g.length,end:g.length+p.length}}}}class Yg{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new Oc}dispose(){uo(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}",Ua(this.uri),this.uri.fsPath):S("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,Ua(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 gR(i))}catch(i){qn(i)}return this}}class No{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new an,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(No._compareReferences);let n;for(const s of e)if((!n||!HS.isEqual(n.uri,s.uri,!0))&&(n=new Yg(this,s.uri),this.groups.push(n)),n.children.length===0||No._compareReferences(s,n.children[n.children.length-1])!==0){const r=new jc(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){uo(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new No(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?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:Np(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,s)=>n.prefixLen>s.prefixLen?-1:n.prefixLen<s.prefixLen?1:n.offsetDist<s.offsetDist?-1:n.offsetDist>s.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&ee.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return HS.compare(e.uri,t.uri)||ee.compareRangesUsingStarts(e.range,t.range)}}var yb=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wb=function(o,e){return function(t,i){e(t,i,o)}},cE;let dE=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof No||e instanceof Yg}getChildren(e){if(e instanceof No)return e.groups;if(e instanceof Yg)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};dE=yb([wb(0,fa)],dE);class pR{getHeight(){return 23}getTemplateId(e){return e instanceof Yg?em.id:tm.id}}let uE=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof jc){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return Ua(e.uri)}};uE=yb([wb(0,As)],uE);class xR{getId(e){return e instanceof jc?e.id:e.uri}}let hE=class extends zt{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new FA(i,{supportHighlights:!0})),this.badge=new O3(_i(i,wi(".count")),{},H3),e.appendChild(i)}set(e,t){const i=qw(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))}};hE=yb([wb(1,Mg)],hE);var qd;let em=(qd=class{constructor(e){this._instantiationService=e,this.templateId=cE.id}renderTemplate(e){return this._instantiationService.createInstance(hE,e)}renderElement(e,t,i){i.set(e.element,Q_(e.filterData))}disposeTemplate(e){e.dispose()}},cE=qd,qd.id="FileReferencesRenderer",qd);em=cE=yb([wb(0,tn)],em);class vR extends zt{constructor(e){super(),this.label=this._register(new W3(e))}set(e,t){var n;const i=(n=e.parent.getPreview(e))==null?void 0:n.preview(e.range);if(!i||!i.value)this.label.set(`${Ua(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!Rg.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,Q_(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}const s_=class s_{constructor(){this.templateId=s_.id}renderTemplate(e){return new vR(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};s_.id="OneReferenceRenderer";let tm=s_;class mR{getWidgetAriaLabel(){return S("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var _R=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ch=function(o,e){return function(t,i){e(t,i,o)}};const o_=class o_{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Ht,this._callOnModelChange=new Ht,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:o_.DecorationOptions}),i.push(n))}this._editor.changeDecorations(n=>{const s=n.deltaDecorations([],t);for(let r=0;r<s.length;r++)this._decorations.set(s[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,n]of this._decorations){const s=t.getDecorationRange(i);if(!s)continue;let r=!1;if(!ee.equalsRange(s,n.range)){if(ee.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,d=s.endColumn-s.startColumn;a!==d&&(r=!0)}r?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=s}}for(let i=0,n=e.length;i<n;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}};o_.DecorationOptions=bn.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let fE=o_;class bR{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 CR extends j3{}let gE=class extends Jv{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 Ht,this._callOnDispose=new Ht,this._onDidSelectReference=new an,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new Zn(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(),uo(this._preview),uo(this._previewNotAvailableMessage),uo(this._tree),uo(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(hR)||vn.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(uR)||vn.transparent,primaryHeadingColor:e.getColor(Y5),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=_i(e,wi("div.messages")),qo(this._messageContainer),this._splitView=new z3(e,{orientation:1}),this._previewContainer=_i(e,wi("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(Hr,this._previewContainer,t,{},this.editor),qo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(uc,S("missingPreviewMessage","no preview available"),Ng,uc.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=_i(e,wi("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new mR,keyboardNavigationLabelProvider:this._instantiationService.createInstance(uE),identityProvider:new xR,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:fR}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Dl(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(CR,"ReferencesWidget",this._treeContainer,new pR,[this._instantiationService.createInstance(em),this._instantiationService.createInstance(tm)],this._instantiationService.createInstance(dE),i),this._splitView.addView({onDidChange:Rs.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},WS.Distribute),this._splitView.addView({onDidChange:Rs.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)}},WS.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 jc&&(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")})),qo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new Zn(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"),Lr(this._messageContainer),Promise.resolve(void 0)):(qo(this._messageContainer),this._decorationsManager=new fE(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"),Lr(this._treeContainer),Lr(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 jc)return e;if(e instanceof Yg&&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!==Eo.inMemory?this.setTitle(V3(e.uri),this._uriLabel.getUriLabel(qw(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}uo(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=ee.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};gE=_R([Ch(3,Wr),Ch(4,fa),Ch(5,tn),Ch(6,X5),Ch(7,Mg),Ch(8,As)],gE);var ER=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Eh=function(o,e){return function(t,i){e(t,i,o)}},hv;const ih=new wn("referenceSearchVisible",!1,S("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var Gd;let Vu=(Gd=class{static get(e){return e.getContribution(hv.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 Ht,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=ih.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=bR.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(gE,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 Ii(e.startLineNumber,e.startColumn),p=this._model.nearestReference(f,g);if(p)return this._widget.setSelection(p).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},d=>{this._notificationService.error(d)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),s?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){var t,i;(t=this._widget)==null||t.dispose(),(i=this._model)==null||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){var n;(n=this._widget)==null||n.hide(),this._ignoreModelChangeEvent=!0;const i=ee.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(s=>{if(this._ignoreModelChangeEvent=!1,!s||!this._widget){this.closeWidget();return}if(this._editor===s)this._widget.show(i),this._widget.focusOnReferenceTree();else{const r=hv.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,Ks(d=>Promise.resolve(a)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,qn(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)}},hv=Gd,Gd.ID="editor.contrib.referencesController",Gd);Vu=hv=ER([Eh(2,Ln),Eh(3,Cs),Eh(4,vo),Eh(5,tn),Eh(6,Kc),Eh(7,ss)],Vu);function nh(o,e){const t=cR(o);if(!t)return;const i=Vu.get(t);i&&e(i)}Ka.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ds(2089,60),when:Ze.or(ih,So.inPeekEditor),handler(o){nh(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});Ka.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Ze.or(ih,So.inPeekEditor),handler(o){nh(o,e=>{e.goToNextOrPreviousReference(!0)})}});Ka.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Ze.or(ih,So.inPeekEditor),handler(o){nh(o,e=>{e.goToNextOrPreviousReference(!1)})}});Qn.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Qn.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Qn.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Qn.registerCommand("closeReferenceSearch",o=>nh(o,e=>e.closeWidget()));Ka.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Ze.and(So.inPeekEditor,Ze.not("config.editor.stablePeek"))});Ka.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Ze.and(ih,Ze.not("config.editor.stablePeek"),Ze.or(q.editorTextFocus,$3.negate()))});Ka.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Ze.and(ih,LA,IA.negate(),PA.negate()),handler(o){var i;const t=(i=o.get(Gw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof jc&&nh(o,n=>n.revealReference(t[0]))}});Ka.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Ze.and(ih,LA,IA.negate(),PA.negate()),handler(o){var i;const t=(i=o.get(Gw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof jc&&nh(o,n=>n.openReference(t[0],!0,!0))}});Qn.registerCommand("openReference",o=>{var i;const t=(i=o.get(Gw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof jc&&nh(o,n=>n.openReference(t[0],!1,!0))});var eB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Z0=function(o,e){return function(t,i){e(t,i,o)}};const M9=new wn("hasSymbols",!1,S("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),Sb=Rl("ISymbolNavigationService");let pE=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=M9.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 xE(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(Av(g.uri,a.uri))u=!0,f=f||ee.containsPosition(g.range,d);else if(u)break;(!u||!f)&&this.reset()});this._currentState=TA(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:ee.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){var i;(i=this._currentMessage)==null||i.dispose();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?S("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):S("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};pE=eB([Z0(0,Ln),Z0(1,Cs),Z0(2,vo),Z0(3,As)],pE);Nl(Sb,pE,1);Ri(new class extends ko{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:M9,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(Sb).revealNext(e)}});Ka.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:M9,primary:9,handler(o){o.get(Sb).reset()}});let xE=class{constructor(e){this._listener=new Map,this._disposables=new Ht,this._onDidChange=new an,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(),uo(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,TA(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)}};xE=eB([Z0(0,Cs)],xE);function vE(o,e){return e.uri.scheme===o.uri.scheme?!0:!U3(e.uri,Eo.walkThroughSnippet,Eo.vscodeChatCodeBlock,Eo.vscodeChatCodeCompareBlock)}async function Zp(o,e,t,i,n){const r=t.ordered(o,i).map(d=>Promise.resolve(n(d,o,e)).then(void 0,u=>{bs(u)})),a=await Promise.all(r);return wl(a.flat()).filter(d=>vE(o,d))}function Xp(o,e,t,i,n){return Zp(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function R9(o,e,t,i,n){return Zp(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function N9(o,e,t,i,n){return Zp(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function O9(o,e,t,i,n){return Zp(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function Yp(o,e,t,i,n,s){return Zp(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=>vE(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=>vE(a,C));return f&&f.length===1?f:u})}async function Za(o){const e=await o(),t=new No(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}Bo("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Pi),n=Xp(i.definitionProvider,e,t,!1,ln.None);return Za(()=>n)});Bo("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Pi),n=Xp(i.definitionProvider,e,t,!0,ln.None);return Za(()=>n)});Bo("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Pi),n=O9(i.typeDefinitionProvider,e,t,!1,ln.None);return Za(()=>n)});Bo("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Pi),n=O9(i.typeDefinitionProvider,e,t,!0,ln.None);return Za(()=>n)});Bo("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Pi),n=R9(i.declarationProvider,e,t,!1,ln.None);return Za(()=>n)});Bo("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(Pi),n=R9(i.declarationProvider,e,t,!0,ln.None);return Za(()=>n)});Bo("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Pi),n=Yp(i.referenceProvider,e,t,!1,!1,ln.None);return Za(()=>n)});Bo("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(Pi),n=Yp(i.referenceProvider,e,t,!1,!0,ln.None);return Za(()=>n)});Bo("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Pi),n=N9(i.implementationProvider,e,t,!1,ln.None);return Za(()=>n)});Bo("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(Pi),n=N9(i.implementationProvider,e,t,!0,ln.None);return Za(()=>n)});Rr.appendMenuItem(gi.EditorContext,{submenu:gi.EditorContextPeek,title:S("peek.submenu","Peek"),group:"navigation",order:100});class Xf{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof Xf||Ii.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const Cr=class Cr extends la{static all(){return Cr._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of ml.wrap(t.menu))(i.id===gi.EditorContext||i.id===gi.EditorContextPeek)&&(i.when=Ze.and(e.precondition,i.when));return t}constructor(e,t){super(Cr._patchConfig(t)),this.configuration=e,Cr._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(vo),r=e.get(Cs),a=e.get(kp),d=e.get(Sb),u=e.get(Pi),f=e.get(tn),g=t.getModel(),p=t.getPosition(),C=Xf.is(i)?i:new Xf(g,p),b=new If(t,5),E=Dp(this._getLocationModel(u,C.model,C.position,b.token),b.token).then(async w=>{var M;if(!w||b.token.isCancellationRequested)return;Nr(w.ariaMessage);let A;if(w.referenceAt(g.uri,p)){const R=this._getAlternativeCommand(t);!Cr._activeAlternativeCommands.has(R)&&Cr._allSymbolNavigationCommands.has(R)&&(A=Cr._allSymbolNavigationCommands.get(R))}const I=w.references.length;if(I===0){if(!this.configuration.muteMessage){const R=g.getWordAtPosition(p);(M=Ro.get(t))==null||M.showMessage(this._getNoResultFoundMessage(R),p)}}else if(I===1&&A)Cr._activeAlternativeCommands.add(this.desc.id),f.invokeFunction(R=>A.runEditorCommand(R,t,i,n).finally(()=>{Cr._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,d,t,w,n)},w=>{s.error(w)}).finally(()=>{b.dispose()});return a.showWhile(E,250),E}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof Hr)&&(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(q3(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:ee.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const d=a.getModel(),u=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===d&&u.clear()},350)}return a}}_openInPeek(e,t,i){const n=Vu.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),Ks(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};Cr._allSymbolNavigationCommands=new Map,Cr._activeAlternativeCommands=new Set;let Ll=Cr;class Qp extends Ll{async _getLocationModel(e,t,i,n){return new No(await Xp(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 Ac;Vn((Ac=class extends Qp{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Ac.id,title:{...Fi("actions.goToDecl.label","Go to Definition"),mnemonicTitle:S({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:q.hasDefinitionProvider,keybinding:[{when:q.editorTextFocus,primary:70,weight:100},{when:Ze.and(q.editorTextFocus,MA),primary:2118,weight:100}],menu:[{id:gi.EditorContext,group:"navigation",order:1.1},{id:gi.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Qn.registerCommandAlias("editor.action.goToDeclaration",Ac.id)}},Ac.id="editor.action.revealDefinition",Ac));var kc;Vn((kc=class extends Qp{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:kc.id,title:Fi("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:Ze.and(q.hasDefinitionProvider,q.isInEmbeddedEditor.toNegated()),keybinding:[{when:q.editorTextFocus,primary:Ds(2089,70),weight:100},{when:Ze.and(q.editorTextFocus,MA),primary:Ds(2089,2118),weight:100}]}),Qn.registerCommandAlias("editor.action.openDeclarationToTheSide",kc.id)}},kc.id="editor.action.revealDefinitionAside",kc));var Bc;Vn((Bc=class extends Qp{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Bc.id,title:Fi("actions.previewDecl.label","Peek Definition"),precondition:Ze.and(q.hasDefinitionProvider,So.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),keybinding:{when:q.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:gi.EditorContextPeek,group:"peek",order:2}}),Qn.registerCommandAlias("editor.action.previewDeclaration",Bc.id)}},Bc.id="editor.action.peekDefinition",Bc));class tB extends Ll{async _getLocationModel(e,t,i,n){return new No(await R9(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 Kd;Vn((Kd=class extends tB{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Kd.id,title:{...Fi("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:S({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:Ze.and(q.hasDeclarationProvider,q.isInEmbeddedEditor.toNegated()),menu:[{id:gi.EditorContext,group:"navigation",order:1.3},{id:gi.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")}},Kd.id="editor.action.revealDeclaration",Kd));Vn(class extends tB{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Fi("actions.peekDecl.label","Peek Declaration"),precondition:Ze.and(q.hasDeclarationProvider,So.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),menu:{id:gi.EditorContextPeek,group:"peek",order:3}})}});class iB extends Ll{async _getLocationModel(e,t,i,n){return new No(await O9(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 Zd;Vn((Zd=class extends iB{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Zd.ID,title:{...Fi("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:S({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:q.hasTypeDefinitionProvider,keybinding:{when:q.editorTextFocus,primary:0,weight:100},menu:[{id:gi.EditorContext,group:"navigation",order:1.4},{id:gi.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Zd.ID="editor.action.goToTypeDefinition",Zd));var Xd;Vn((Xd=class extends iB{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Xd.ID,title:Fi("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:Ze.and(q.hasTypeDefinitionProvider,So.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),menu:{id:gi.EditorContextPeek,group:"peek",order:4}})}},Xd.ID="editor.action.peekTypeDefinition",Xd));class nB extends Ll{async _getLocationModel(e,t,i,n){return new No(await N9(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 Yd;Vn((Yd=class extends nB{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Yd.ID,title:{...Fi("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:S({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:q.hasImplementationProvider,keybinding:{when:q.editorTextFocus,primary:2118,weight:100},menu:[{id:gi.EditorContext,group:"navigation",order:1.45},{id:gi.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},Yd.ID="editor.action.goToImplementation",Yd));var Qd;Vn((Qd=class extends nB{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Qd.ID,title:Fi("actions.peekImplementation.label","Peek Implementations"),precondition:Ze.and(q.hasImplementationProvider,So.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),keybinding:{when:q.editorTextFocus,primary:3142,weight:100},menu:{id:gi.EditorContextPeek,group:"peek",order:5}})}},Qd.ID="editor.action.peekImplementation",Qd));class sB extends Ll{_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}}Vn(class extends sB{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Fi("goToReferences.label","Go to References"),mnemonicTitle:S({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:Ze.and(q.hasReferenceProvider,So.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),keybinding:{when:q.editorTextFocus,primary:1094,weight:100},menu:[{id:gi.EditorContext,group:"navigation",order:1.45},{id:gi.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new No(await Yp(e.referenceProvider,t,i,!0,!1,n),S("ref.title","References"))}});Vn(class extends sB{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Fi("references.action.label","Peek References"),precondition:Ze.and(q.hasReferenceProvider,So.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),menu:{id:gi.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new No(await Yp(e.referenceProvider,t,i,!1,!1,n),S("ref.title","References"))}});class yR extends Ll{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Fi("label.generic","Go to Any Symbol"),precondition:Ze.and(So.notInPeekEditor,q.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new No(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""}}Qn.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:jn},{name:"position",description:"The position at which to start",constraint:Ii.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)=>{Pn(jn.isUri(e)),Pn(Ii.isIPosition(t)),Pn(Array.isArray(i)),Pn(typeof n>"u"||typeof n=="string"),Pn(typeof r>"u"||typeof r=="boolean");const a=o.get(Cs),d=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(RA(d))return d.setPosition(t),d.revealPositionInCenterIfOutsideViewport(t,0),d.invokeWithinContext(u=>{const f=new class extends yR{_getNoResultFoundMessage(g){return s||super._getNoResultFoundMessage(g)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);u.get(tn).invokeFunction(f.run.bind(f),d)})}});Qn.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:jn},{name:"position",description:"The position at which to start",constraint:Ii.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(Us).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});Qn.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Pn(jn.isUri(e)),Pn(Ii.isIPosition(t));const i=o.get(Pi),n=o.get(Cs);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!RA(s)||!s.hasModel())return;const r=Vu.get(s);if(!r)return;const a=Ks(u=>Yp(i.referenceProvider,s.getModel(),Ii.lift(t),!1,!1,u).then(f=>new No(f,S("ref.title","References")))),d=new ee(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(d,a,!1))})}});Qn.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function wR(o,e,t,i){const n=o.get(fa),s=o.get(a0),r=o.get(Us),a=o.get(tn),d=o.get(vo);if(await i.item.resolve(ln.None),!i.part.location)return;const u=i.part.location,f=[],g=new Set(Rr.getMenuItems(gi.EditorContext).map(C=>G3(C)?C.command.id:vb()));for(const C of Ll.all())g.has(C.desc.id)&&f.push(new Nf(C.desc.id,Of.label(C.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const b=await n.createModelReference(u.uri);try{const E=new Xf(b.object.textEditorModel,ee.getStartPosition(u.range)),w=i.item.anchor.range;await a.invokeFunction(C.runEditorCommand.bind(C),e,E,w)}finally{b.dispose()}}));if(i.part.command){const{command:C}=i.part;f.push(new Pg),f.push(new Nf(C.id,C.title,void 0,!0,async()=>{try{await r.executeCommand(C.id,...C.arguments??[])}catch(b){d.notify({severity:Kw.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=wo(t);return{x:C.left,y:C.top+C.height+8}},getActions:()=>f,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function oB(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(Ln),u=So.inPeekEditor.getValue(d),f=!a&&t.getOption(89)&&!u;return new Qp({openToSide:a,openInPeek:f,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new Xf(s.object.textEditorModel,ee.getStartPosition(i.range)),ee.lift(i.range))}),s.dispose()}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},yh=function(o,e){return function(t,i){e(t,i,o)}},Oh;class im{constructor(){this._entries=new Fp(50)}get(e){const t=im._key(e);return this._entries.get(t)}set(e,t){const i=im._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const rB=Rl("IInlayHintsCache");Nl(rB,im,1);class mE{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class DR{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var vl;let Qg=(vl=class{static get(e){return e.getContribution(Oh.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 Ht,this._sessionDisposables=new Ht,this._decorationsMetadata=new Map,this._ruleFactory=new EA(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(K3.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(is(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new Ns(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new Zs;const d=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const u=n.token,f=await Yv.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){qn(u)}finally{n.dispose(),d.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(is(()=>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 Ht,t=e.add(new Eb(this._editor)),i=new Ht;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[s]=n,r=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!r||!a){i.clear();return}const d=new Zs;i.add(is(()=>d.dispose(!0))),r.item.resolve(d.token),this._activeInlayHintPart=r.part.command||r.part.location?new DR(r,s.hasTriggerModifier):void 0;const u=a.validatePosition(r.item.hint.position).lineNumber,f=new ee(u,1,u,a.getLineMaxColumn(u)),g=this._getInlineHintsForRange(f);this._updateHintsDecorators([f],g),i.add(is(()=>{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(oB,n,this._editor,r.location):Z3.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(ln.None),Yo(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>ds.replace(ee.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!X3(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(wR,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 Zw&&(t==null?void 0:t.attachedData)instanceof mE)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:Kw.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 G5(s,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const s of i.sort(ee.compareRangesUsingStarts)){const r=t.validateRange(new ee(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!ee.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=ee.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var b,E;const i=[],n=(w,A,I,M,R)=>{const P={content:I,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:A.className,cursorStops:M,attachedData:R};i.push({item:w,classNameRef:A,decoration:{range:w.anchor.range,options:{description:"InlayHint",showIfCollapsed:w.anchor.range.isEmpty(),collapseOnReplaceEdit:!w.anchor.range.isEmpty(),stickiness:0,[w.anchor.direction]:this._activeRenderMode===0?P:void 0}}})},s=(w,A)=>{const I=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(w,I," ",A?jh.Right:jh.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 w of t){if(g.line!==w.anchor.range.startLineNumber&&(g={line:w.anchor.range.startLineNumber,totalLen:0}),g.totalLen>Oh._MAX_LABEL_LEN)continue;w.hint.paddingLeft&&s(w,!1);const A=typeof w.hint.label=="string"?[{label:w.hint.label}]:w.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}), ${jw.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};Yo(w.hint.textEdits)&&(V.cursor="default"),this._fillInColors(V,w.hint),(M.command||M.location)&&((b=this._activeInlayHintPart)==null?void 0:b.part.item)===w&&this._activeInlayHintPart.part.index===I&&(V.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(V.color=Fs(Y3),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 $=M.label;g.totalLen+=$.length;let Q=!1;const re=g.totalLen-Oh._MAX_LABEL_LEN;if(re>0&&($=$.slice(0,-re)+"…",Q=!0),n(w,this._ruleFactory.createClassNameRef(V),AR($),P&&!w.hint.paddingRight?jh.Right:jh.None,new mE(w,I)),Q)break}if(w.hint.paddingRight&&s(w,!0),i.length>Oh._MAX_DECORATORS)break}const p=[];for(const[w,A]of this._decorationsMetadata){const I=(E=this._editor.getModel())==null?void 0:E.getDecorationRange(w);I&&e.some(M=>M.containsRange(I))&&(p.push(w),A.classNameRef.dispose(),this._decorationsMetadata.delete(w))}const C=Mf.capture(this._editor);this._editor.changeDecorations(w=>{const A=w.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===zS.Parameter?(e.backgroundColor=Fs(Q3),e.color=Fs(J3)):t.kind===zS.Type?(e.backgroundColor=Fs(e4),e.color=Fs(t4)):(e.backgroundColor=Fs(i4),e.color=Fs(n4))}_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()}},Oh=vl,vl.ID="editor.contrib.InlayHints",vl._MAX_DECORATORS=1500,vl._MAX_LABEL_LEN=43,vl);Qg=Oh=SR([yh(1,Pi),yh(2,gr),yh(3,rB),yh(4,Us),yh(5,vo),yh(6,tn)],Qg);function AR(o){return o.replace(/[ \t]/g," ")}Qn.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Pn(jn.isUri(t)),Pn(ee.isIRange(i));const{inlayHintsProvider:n}=o.get(Pi),s=await o.get(fa).createModelReference(t);try{const r=await Yv.create(n,s.object.textEditorModel,[ee.lift(i)],ln.None),a=r.items.map(d=>d.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});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},Xl=function(o,e){return function(t,i){e(t,i,o)}};class Z8 extends cv{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let nm=class extends Xg{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(!Qg.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof Zw&&i.attachedData instanceof mE?new Z8(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof Z8?new sa(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 lo().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Ir(this,e.range,[r],!1,0)),Yo(s.item.hint.textEdits)&&n.emitOne(new Ir(this,e.range,[new lo().appendText(S("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new lo().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Ir(this,e.range,[a],!1,1)),s.part.location||s.part.command){let u;const g=this._editor.getOption(78)==="altKey"?$a?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):$a?S("links.navigate.kb.alt.mac","option + click"):S("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?u=new lo().appendText(S("hint.defAndCommand","Go to Definition ({0}), right click for more",g)):s.part.location?u=new lo().appendText(S("hint.def","Go to Definition ({0})",g)):s.part.command&&(u=new lo(`[${S("hint.cmd","Execute Command")}](${iR(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),u&&n.emitOne(new Ir(this,e.range,[u],!1,1e4))}const d=await this._resolveInlayHintLabelPartHover(s,i);for await(const u of d)n.emitOne(u)}):sa.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return sa.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)?P9(this._languageFeaturesService.hoverProvider,r,new Ii(n.startLineNumber,n.startColumn),t).filter(a=>!Tg(a.hover.contents)).map(a=>new Ir(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):sa.EMPTY}finally{s.dispose()}}};nm=kR([Xl(1,ha),Xl(2,da),Xl(3,As),Xl(4,Tp),Xl(5,ss),Xl(6,fa),Xl(7,Pi),Xl(8,Us)],nm);class H9 extends zt{constructor(e,t,i,n,s,r){super();const a=t.anchor,d=t.hoverParts;this._renderedHoverParts=this._register(new _E(e,i,d,r,s));const{showAtPosition:u,showAtSecondaryPosition:f}=H9.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 Ii(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,w=Math.min(r,E);r=Math.max(w,n)}f.forceShowAtRange&&(a=g)}let d,u;if(a){const f=a.getStartPosition();d=f,u=f}else d=t.getStartPosition(),u=new Ii(s,r);return{showAtPosition:d,showAtSecondaryPosition:u}}}class BR{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 r_=class r_ extends zt{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 zt.None;let i=t[0].range;for(const s of t){const r=s.range;i=ee.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:r_._DECORATION_OPTIONS}]),is(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new Xv(n),r={fragment:this._fragment,statusBar:s,...i},a=new Ht;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})),is(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new zu([])}_renderStatusBar(e,t){if(t.hasContent)return new BR(e,t)}_registerListenersOnRenderedParts(){const e=new Ht;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(Fn(n,as.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Fn(n,as.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Xg&&!(i instanceof nm));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof Kg)}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 Hf;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};r_._DECORATION_OPTIONS=bn.register({description:"content-hover-highlight",className:"hoverHighlight"});let _E=r_;var FR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},X8=function(o,e){return function(t,i){e(t,i,o)}};let bE=class extends zt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new an),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(rE,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new Zv(this._editor,this._participants),this._hoverOperation=this._register(new V5(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of th.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 j5(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Dl(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Dl(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(J_.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 H9(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 wC(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 wC(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||!Cb(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new wC(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}};bE=FR([X8(1,tn),X8(2,As)],bE);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},Y8=function(o,e){return function(t,i){e(t,i,o)}},CE,Jd;let ro=(Jd=class extends zt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new an),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Ht,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Ns(()=>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(CE.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?Cb(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===O5||t.commandId===_b||t.commandId===bb)&&((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)||Zf.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(bE,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()}},CE=Jd,Jd.ID="editor.contrib.contentHover",Jd);ro=CE=LR([Y8(1,tn),Y8(2,As)],ro);const kS=class kS extends zt{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!==L5||!i.range)return;const n=this._editor.getContribution(ro.ID);if(n&&!n.isColorPickerVisible){const s=new ee(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};kS.ID="editor.contrib.colorContribution";let sm=kS;un(sm.ID,sm,2);th.register(Kg);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},Kh=function(o,e){return function(t,i){e(t,i,o)}},EE,yE,eu;let ju=(eu=class extends zt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=q.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=q.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(wE,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(EE.ID)}},EE=eu,eu.ID="editor.contrib.standaloneColorPickerController",eu);ju=EE=aB([Kh(1,Ln),Kh(2,tn)],ju);un(ju.ID,ju,1);const Q8=8,IR=22;var tu;let wE=(tu=class extends zt{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 an),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(Zg,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(Pf(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 yE.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 PR(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 Gg(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 Xv(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-IR-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)}},yE=tu,tu.ID="editor.contrib.standaloneColorPickerWidget",tu);wE=yE=aB([Kh(3,tn),Kh(4,As),Kh(5,Pi),Kh(6,Ol)],wE);class PR{constructor(e,t){this.value=e,this.foundInEditor=t}}class TR extends la{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Fi("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:gi.CommandPalette}],metadata:{description:Fi("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=ju.get(t))==null||i.showOrFocus()}}class MR extends wt{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:q.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Fi("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=ju.get(t))==null||i.hide()}}class RR extends wt{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:q.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Fi("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=ju.get(t))==null||i.insertColor()}}Re(MR);Re(RR);Vn(TR);class gc{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 w=g.substring(C+t.length),A=p.substring(0,b);(w.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=gc._createRemoveBlockCommentOperations(new ee(a,C+t.length+1,u,b+1),t,i)):(E=gc._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=E.length===1?i:null);for(const w of E)r.addTrackedEditOperation(w.range,w.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return ee.isEmpty(e)?n.push(ds.delete(new ee(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(ds.delete(new ee(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(ds.delete(new ee(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return ee.isEmpty(e)?s.push(ds.replace(new ee(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(ds.insert(new Ii(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(ds.insert(new Ii(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 qi(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 qi(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class ol{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),w=l1(E);if(w===-1){C.ignore=r,C.commentStrOffset=E.length;continue}if(u=!1,C.ignore=!1,C.commentStrOffset=w,f&&!gc._haystackHasNeedleAtOffset(E,C.commentStr,w)&&(e===0?f=!1:e===1||(C.ignore=!0)),f&&t){const A=w+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=ol._gatherPreflightCommentStrings(i,n,s,d);return u===null?{supported:!1}:ol._analyzeLines(e,t,i,u,n,r,a,d)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=ol._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(ol._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new Ii(n.positionLineNumber,n.positionColumn);for(let a=0,d=s.length;a<d;a++)t.addEditOperation(s[a].range,s[a].text),ee.isEmpty(s[a].range)&&ee.getStartPosition(s[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(s[a].text||"").length);this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let s=t.startLineNumber,r=t.endLineNumber;const a=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let d=e.getLineContent(s).lastIndexOf(i,a-1),u=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return d!==-1&&u===-1&&(u=e.getLineContent(s).indexOf(n,d+i.length),r=s),d===-1&&u!==-1&&(d=e.getLineContent(r).lastIndexOf(i,u),s=r),t.isEmpty()&&(d===-1||u===-1)&&(d=e.getLineContent(s).indexOf(i),d!==-1&&(u=e.getLineContent(s).indexOf(n,d+i.length))),d!==-1&&e.getLineContent(s).charCodeAt(d+i.length)===32&&(i+=" "),u!==-1&&e.getLineContent(r).charCodeAt(u-1)===32&&(n=" "+n,u-=1),d!==-1&&u!==-1?gc._createRemoveBlockCommentOperations(new ee(s,d+i.length+1,r,u+1),i,n):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const n=e.getLanguageIdAtPosition(i.startLineNumber,1),s=this.languageConfigurationService.getLanguageConfiguration(n).comments;if(!s||!s.blockCommentStartToken||!s.blockCommentEndToken)return;const r=s.blockCommentStartToken,a=s.blockCommentEndToken;let d=this._attemptRemoveBlockComment(e,i,r,a);if(!d){if(i.isEmpty()){const u=e.getLineContent(i.startLineNumber);let f=l1(u);f===-1&&(f=u.length),d=gc._createAddBlockCommentOperations(new ee(i.startLineNumber,f+1,i.startLineNumber,u.length+1),r,a,this._insertSpace)}else d=gc._createAddBlockCommentOperations(new ee(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);d.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const u of d)t.addEditOperation(u.range,u.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new ee(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
|
|
19
|
+
`),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=ol._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 qi(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(ds.delete(new ee(t+n,r.commentStrOffset+1,t+n,r.commentStrOffset+r.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],n=this._insertSpace?" ":"";for(let s=0,r=e.length;s<r;s++){const a=e[s];a.ignore||i.push(ds.insert(new Ii(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=ol.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=ol.nextVisibleColumn(g,n,f.charCodeAt(r)===9,1);g>s?t[d].commentStrOffset=r-1:t[d].commentStrOffset=r}}}class W9 extends wt{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(qs);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),d=t.getSelections().map((f,g)=>({selection:f,index:g,ignoreFirstLine:!1}));d.sort((f,g)=>ee.compareRangesUsingStarts(f.selection,g.selection));let u=d[0];for(let f=1;f<d.length;f++){const g=d[f];u.selection.endLineNumber===g.selection.startLineNumber&&(u.index<g.index?g.ignoreFirstLine=!0:(u.ignoreFirstLine=!0,u=g))}for(const f of d)s.push(new ol(i,f.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,f.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class NR extends W9{constructor(){super(0,{id:"editor.action.commentLine",label:S("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:gi.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class OR extends W9{constructor(){super(1,{id:"editor.action.addCommentLine",label:S("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2081),weight:100}})}}class HR extends W9{constructor(){super(2,{id:"editor.action.removeCommentLine",label:S("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2099),weight:100}})}}class WR extends wt{constructor(){super({id:"editor.action.blockComment",label:S("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:gi.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(qs);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new gc(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}Re(NR);Re(OR);Re(HR);Re(WR);var zR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ud=function(o,e){return function(t,i){e(t,i,o)}},SE,iu;let Yf=(iu=class{static get(e){return e.getContribution(SE.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 Ht,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&&s4(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 o4){const u=this._getMenuActions(e,d.item.submenu);u.length>0&&(i.push(new VS(d.id,d.label,u)),a++)}else i.push(d),a++;a&&i.push(new Pg)}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=wo(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)&&!c1;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 r1(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const d=r;return typeof d.getActionViewItem=="function"?d.getActionViewItem():new r1(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()||r4(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 VS(`menu-action-${++i}`,u,f,void 0),r=(u,f,g,p,C)=>{if(!f)return n({label:u,enabled:f,run:()=>{}});const b=w=>()=>{this._configurationService.updateValue(g,w)},E=[];for(const w of C)E.push(n({label:w.label,checked:p===w.value,run:b(w.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 Pg),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)&&!c1;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()}},SE=iu,iu.ID="editor.contrib.contextmenu",iu);Yf=SE=zR([ud(1,a0),ud(2,q_),ud(3,Ln),ud(4,As),ud(5,Zu),ud(6,ss),ud(7,Lf)],Yf);class VR extends wt{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:q.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=Yf.get(t))==null||i.showContextMenu()}}un(Yf.ID,Yf,2);Re(VR);class DC{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 AC{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const a_=class a_ extends zt{static get(e){return e.getContribution(a_.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 DC(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new AC(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 AC(new DC(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 AC(new DC(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}};a_.ID="editor.contrib.cursorUndoRedoController";let Qf=a_;class jR extends wt{constructor(){super({id:"cursorUndo",label:S("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=Qf.get(t))==null||n.cursorUndo()}}class $R extends wt{constructor(){super({id:"cursorRedo",label:S("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=Qf.get(t))==null||n.cursorRedo()}}un(Qf.ID,Qf,0);Re(jR);Re($R);class UR{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new ee(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new qi(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 qi(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 qi(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 qi(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 qi(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 wh(o){return $a?o.altKey:o.ctrlKey}const sc=class sc extends zt{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)||(wh(e)&&(this._modifierPressed=!0),this._mouseDown&&wh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(wh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===sc.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}wh(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 Ii(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 qi(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new qi(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(wh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(sc.ID,new UR(this._dragSelection,t,wh(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){this._dndDecorationIds.set([{range:new ee(e.lineNumber,e.column,e.lineNumber,e.column),options:sc._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()}};sc.ID="editor.contrib.dragAndDrop",sc.TRIGGER_KEY_VALUE=$a?6:5,sc._DECORATION_OPTIONS=bn.register({description:"dnd-target",className:"dnd-target"});let om=sc;un(om.ID,om,2);un(Fl.ID,Fl,0);d0(W1);Ri(new class extends ko{constructor(){super({id:d5,precondition:D9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=Fl.get(e))==null?void 0:t.changePasteType()}});Ri(new class extends ko{constructor(){super({id:"editor.hidePasteWidget",precondition:D9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=Fl.get(e))==null||t.clearWidgets()}});var nu;Re((nu=class extends wt{constructor(){super({id:"editor.action.pasteAs",label:S("pasteAs","Paste As..."),alias:"Paste As...",precondition:q.writable,metadata:{description:"Paste as",args:[{name:"args",schema:nu.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=Fl.get(t))==null?void 0:s.pasteAs(n?new ns(n):void 0)}},nu.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.")}}},nu));Re(class extends wt{constructor(){super({id:"editor.action.pasteAsText",label:S("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:q.writable})}run(o,e){var t;return(t=Fl.get(e))==null?void 0:t.pasteAs({providerId:Ru.id})}});class qR{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 J8{constructor(e){this.identifier=e}}const lB=Rl("treeViewsDndService");Nl(lB,qR,1);var GR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sx=function(o,e){return function(t,i){e(t,i,o)}},DE;const cB="editor.experimental.dropIntoEditor.defaultProvider",dB="editor.changeDropType",z9=new wn("dropWidgetVisible",!1,S("dropWidgetVisible","Whether the drop widget is showing"));var su;let Jf=(su=class extends zt{static get(e){return e.getContribution(DE.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=O1.getInstance(),this._dropProgressManager=this._register(t.createInstance(qv,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(Kv,"dropIntoEditor",e,z9,{id:dB,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=Ks(async r=>{const a=new Ht,d=a.add(new If(e,1,void 0,r));try{const u=await this.extractDataTransferData(i);if(u.size===0||d.token.isCancellationRequested)return;const f=e.getModel();if(!f)return;const g=this._languageFeaturesService.documentDropEditProvider.ordered(f).filter(C=>C.dropMimeTypes?C.dropMimeTypes.some(b=>u.matches(b)):!0),p=a.add(await this.getDropEdits(g,f,t,u,d));if(d.token.isCancellationRequested)return;if(p.edits.length){const C=this.getInitialActiveEditIndex(f,p.edits),b=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([ee.fromPositions(t)],{activeEditIndex:C,allEdits:p.edits},b,async E=>E,r)}}finally{a.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,S("dropIntoEditorProgress","Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),this._currentOperation=n}async getDropEdits(e,t,i,n,s){const r=new Ht,a=await Dp(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=wl(a??[]).flat();return{edits:l5(d),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(cB,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new ns(s),a=t.findIndex(d=>r.value===d.providerId&&d.handledMimeType&&J6(n,[d.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new Q6;const t=i5(e.dataTransfer);if(this.treeItemsTransfer.hasData(J8.prototype)){const i=this.treeItemsTransfer.getData(J8.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}},DE=su,su.ID="editor.contrib.dropIntoEditorController",su);Jf=DE=GR([Sx(1,tn),Sx(2,ss),Sx(3,Pi),Sx(4,lB)],Jf);un(Jf.ID,Jf,2);d0(H1);Ri(new class extends ko{constructor(){super({id:dB,precondition:z9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=Jf.get(e))==null||i.changeDropType()}});Ri(new class extends ko{constructor(){super({id:"editor.hideDropWidget",precondition:z9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=Jf.get(e))==null||i.clearWidgets()}});ca.as(Bp.Configuration).registerConfiguration({...K_,properties:{[cB]:{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 no=class no{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===no._FIND_MATCH_DECORATION||n===no._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,no._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,no._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(n.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const r=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);s=new ee(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,no._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=no._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=no._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),u=this._editor.getLayoutInfo().height/a,f=Math.max(2,Math.ceil(3/u));let g=e[0].range.startLineNumber,p=e[0].range.endLineNumber;for(let C=1,b=e.length;C<b;C++){const E=e[C].range;p+f>=E.startLineNumber?E.endLineNumber>p&&(p=E.endLineNumber):(s.push({range:new ee(g,1,p,1),options:no._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),g=E.startLineNumber,p=E.endLineNumber)}s.push({range:new ee(g,1,p,1),options:no._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,no._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}};no._CURRENT_FIND_MATCH_DECORATION=bn.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Fs(oC),position:Ha.Center},minimap:{color:Fs(jS),position:1}}),no._FIND_MATCH_DECORATION=bn.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Fs(oC),position:Ha.Center},minimap:{color:Fs(jS),position:1}}),no._FIND_MATCH_NO_OVERVIEW_DECORATION=bn.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),no._FIND_MATCH_ONLY_OVERVIEW_DECORATION=bn.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Fs(oC),position:Ha.Center}}),no._RANGE_HIGHLIGHT_DECORATION=bn.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),no._FIND_SCOPE_DECORATION=bn.register({description:"find-scope",className:"findScope",isWholeLine:!0});let AE=no;class KR{constructor(e,t,i){this._editorSelection=e,this._ranges=t,this._replaceStrings=i,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){const i=[];for(let r=0;r<this._ranges.length;r++)i.push({range:this._ranges[r],text:this._replaceStrings[r]});i.sort((r,a)=>ee.compareRangesUsingStarts(r.range,a.range));const n=[];let s=i[0];for(let r=1;r<i.length;r++)s.range.endLineNumber===i[r].range.startLineNumber&&s.range.endColumn===i[r].range.startColumn?(s.range=s.range.plusRange(i[r].range),s.text=s.text+i[r].text):(n.push(s),s=i[r]);n.push(s);for(const r of n)t.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}}function uB(o,e){if(o&&o[0]!==""){const t=eD(o,e,"-"),i=eD(o,e,"_");return t&&!i?tD(o,e,"-"):!t&&i?tD(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():a4(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 eD(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function tD(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=uB([n[a]],r)+t}),s.slice(0,-1)}class iD{constructor(e){this.staticValue=e,this.kind=0}}class ZR{constructor(e){this.pieces=e,this.kind=1}}class e0{static fromStaticValue(e){return new e0([Hd.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new iD(""):e.length===1&&e[0].staticValue!==null?this._state=new iD(e[0].staticValue):this._state=new ZR(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?uB(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=e0._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 Hd{static staticValue(e){return new Hd(e,-1,null)}static caseOps(e,t){return new Hd(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 XR{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++]=Hd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Hd.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Hd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new e0(this._result)}}function YR(o){if(!o||o.length===0)return new e0(null);const e=[],t=new XR(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 zl=new wn("findWidgetVisible",!1);zl.toNegated();const Db=new wn("findInputFocussed",!1),V9=new wn("replaceInputFocussed",!1),Dx={primary:545,mac:{primary:2593}},Ax={primary:565,mac:{primary:2613}},kx={primary:560,mac:{primary:2608}},Bx={primary:554,mac:{primary:2602}},Fx={primary:558,mac:{primary:2606}},Un={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"},pc=19999,QR=240;class pg{constructor(e,t){this._toDispose=new Ht,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Ap,this._decorations=new AE(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Ns(()=>{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,uo(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)},QR)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let d=a.endLineNumber;return a.endColumn===1&&(d=d-1),new ee(a.startLineNumber,1,d,this._editor.getModel().getLineMaxColumn(d))}return a}));const n=this._findMatches(i,!1,pc);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=NA(n.map(d=>d.range),d=>ee.compareRangesUsingStarts(d,s)>=0);r=a>0?a-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),e&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===1?(i===1?i=s.getLineCount():i--,n=s.getLineMaxColumn(i)):n--,new Ii(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()<pc){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=pg._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 Ii(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 Ii(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<pc){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=pg._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 Ii(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?YR(this._state.replaceString):e0.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 Sp(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new Ii(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=>pg._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>=pc?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new l4(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 OA(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 KR(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 qi(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 l_=class l_ extends Lp{constructor(e,t,i){super(),this._hideSoon=this._register(new Ns(()=>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:Ld(WA),inputActiveOptionForeground:Ld(HA),inputActiveOptionBackground:Ld(Ww)},s=this._register(d1());this.caseSensitive=this._register(new c4({appendTitle:this._keybindingLabelFor(Un.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 d4({appendTitle:this._keybindingLabelFor(Un.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 u4({appendTitle:this._keybindingLabelFor(Un.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(Fn(this._domNode,as.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(Fn(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 l_.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")}};l_.ID="editor.contrib.findOptionsWidget";let kE=l_;function Lx(o,e){return o===1?!0:o===2?!1:e}class JR extends zt{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Lx(this._isRegexOverride,this._isRegex)}get wholeWord(){return Lx(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Lx(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Lx(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 an),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(e,t,i){const n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,s=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,s=!0),typeof i<"u"&&(ee.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var f;const n={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;const r=this.isRegex,a=this.wholeWord,d=this.matchCase,u=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,s=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,s=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,s=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,s=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&((f=e.searchScope)!=null&&f.every(g=>{var p;return(p=this._searchScope)==null?void 0:p.some(C=>!ee.equalsRange(C,g))})||(this._searchScope=e.searchScope,n.searchScope=!0,s=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,s=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,s=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,s=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,r!==this.isRegex&&(s=!0,n.isRegex=!0),a!==this.wholeWord&&(s=!0,n.wholeWord=!0),d!==this.matchCase&&(s=!0,n.matchCase=!0),u!==this.preserveCase&&(s=!0,n.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=pc}}const eN=S("defaultLabel","input"),tN=S("label.preserveCaseToggle","Preserve Case");class iN extends zA{constructor(e){super({icon:Qi.preserveCase,title:tN+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??eb("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class nN extends Lp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new an),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new an),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new an),this._onInput=this._register(new an),this._onKeyUp=this._register(new an),this._onPreserveCaseKeyDown=this._register(new an),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||eN;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 h4(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 iN({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(),Bv.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 hB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fB=function(o,e){return function(t,i){e(t,i,o)}};const j9=new wn("suggestWidgetVisible",!1,S("suggestWidgetVisible","Whether suggestion are visible")),$9="historyNavigationWidgetFocus",gB="historyNavigationForwardsEnabled",pB="historyNavigationBackwardsEnabled";let El;const Ix=[];function xB(o,e){if(Ix.includes(e))throw new Error("Cannot register the same widget multiple times");Ix.push(e);const t=new Ht,i=new wn($9,!1).bindTo(o),n=new wn(gB,!0).bindTo(o),s=new wn(pB,!0).bindTo(o),r=()=>{i.set(!0),El=e},a=()=>{i.set(!1),El===e&&(El=void 0)};return g4(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(is(()=>{Ix.splice(Ix.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let BE=class extends f4{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(xB(s,this.inputBox))}};BE=hB([fB(3,Ln)],BE);let FE=class extends nN{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(xB(r,this.inputBox))}};FE=hB([fB(3,Ln)],FE);Ka.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Ze.and(Ze.has($9),Ze.equals(pB,!0),Ze.not("isComposing"),j9.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{El==null||El.showPreviousValue()}});Ka.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Ze.and(Ze.has($9),Ze.equals(gB,!0),Ze.not("isComposing"),j9.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{El==null||El.showNextValue()}});function nD(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 sD=vs("find-collapsed",Qi.chevronRight,S("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),oD=vs("find-expanded",Qi.chevronDown,S("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),sN=vs("find-selection",Qi.selection,S("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),oN=vs("find-replace",Qi.replace,S("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),rN=vs("find-replace-all",Qi.replaceAll,S("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),aN=vs("find-previous-match",Qi.arrowUp,S("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),lN=vs("find-next-match",Qi.arrowDown,S("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),cN=S("label.findDialog","Find / Replace"),dN=S("label.find","Find"),uN=S("placeholder.find","Find"),hN=S("label.previousMatchButton","Previous Match"),fN=S("label.nextMatchButton","Next Match"),gN=S("label.toggleSelectionFind","Find in Selection"),pN=S("label.closeButton","Close"),xN=S("label.replace","Replace"),vN=S("placeholder.replace","Replace"),mN=S("label.replaceButton","Replace"),_N=S("label.replaceAllButton","Replace All"),bN=S("label.toggleReplaceButton","Toggle Replace"),CN=S("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",pc),EN=S("label.matchesLocation","{0} of {1}"),rD=S("label.noResults","No results"),_a=419,yN=275,wN=yN-54;let N0=69;const SN=33,aD="ctrlEnterReplaceAll.windows.donotask",lD=$a?256:2048;class kC{constructor(e){this.afterLineNumber=e,this.heightInPx=SN,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function cD(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function dD(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const c_=class c_ extends Lp{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(aD,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Hc(500),this._register(is(()=>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 kC(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=Db.bindTo(r),this._findFocusTracker=this._register(Pf(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=V9.bindTo(r),this._replaceFocusTracker=this._register(Pf(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 kC(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 c_.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=yr(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,qn)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){var t;this._matchesCount.style.minWidth=N0+"px",this._state.matchesCount>=pc?this._matchesCount.title=CN: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>=pc&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=Xw(EN,n,i)}else e=rD;this._matchesCount.appendChild(document.createTextNode(e)),Nr(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),N0=Math.max(N0,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===rD)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=wo(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=p4(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 kC(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&&yr(this._domNode)>_a){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=yr(this._findInput.domNode);return}if(_a+28+n>=i&&(r=!0),_a+28+n-N0>=i&&(a=!0),_a+28+n-N0>=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=yr(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!ee.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(lD|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 cD(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return dD(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(lD|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{j_&&c0&&!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(aD,!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 cD(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return dD(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:wN,label:dN,placeholder:uN,appendCaseSensitiveLabel:this._keybindingLabelFor(Un.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(Un.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(Un.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:()=>nD(this._keybindingService),inputBoxStyles:US,toggleStyles:$S},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()})),x4&&this._register(this._findInput.onMouseDown(f=>this._onFindInputMouseDown(f))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(d1());this._prevBtn=this._register(new Sh({label:hN+this._keybindingLabelFor(Un.PreviousMatchFindAction),icon:aN,hoverDelegate:i,onTrigger:()=>{$h(this._codeEditor.getAction(Un.PreviousMatchFindAction)).run().then(void 0,qn)}},this._hoverService)),this._nextBtn=this._register(new Sh({label:fN+this._keybindingLabelFor(Un.NextMatchFindAction),icon:lN,hoverDelegate:i,onTrigger:()=>{$h(this._codeEditor.getAction(Un.NextMatchFindAction)).run().then(void 0,qn)}},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 zA({icon:sN,title:gN+this._keybindingLabelFor(Un.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Ld(Ww),inputActiveOptionBorder:Ld(WA),inputActiveOptionForeground:Ld(HA)})),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 Sh({label:pN+this._keybindingLabelFor(Un.CloseFindWidgetCommand),icon:VA,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 FE(null,void 0,{label:xN,placeholder:vN,appendPreserveCaseLabel:this._keybindingLabelFor(Un.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>nD(this._keybindingService),inputBoxStyles:US,toggleStyles:$S},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(d1());this._replaceBtn=this._register(new Sh({label:mN+this._keybindingLabelFor(Un.ReplaceOneAction),icon:oN,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:f=>{f.equals(1026)&&(this._closeBtn.focus(),f.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Sh({label:_N+this._keybindingLabelFor(Un.ReplaceAllAction),icon:rN,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 Sh({label:bN,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=yr(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=cN,this._domNode.role="dialog",this._domNode.style.width=`${_a}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 zh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let u=_a;this._register(this._resizeSash.onDidStart(()=>{u=yr(this._domNode)})),this._register(this._resizeSash.onDidChange(f=>{this._resized=!0;const g=u+f.startX-f.currentX;if(g<_a)return;const p=parseFloat(v4(this._domNode).maxWidth)||0;g>p||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=yr(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const f=yr(this._domNode);if(f<_a)return;let g=_a;if(!this._resized||f===_a){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=yr(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};c_.ID="editor.contrib.findWidget";let LE=c_;class Sh extends Lp{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+Rn.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??eb("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(...Rn.asClassNameArray(sD)),this._domNode.classList.add(...Rn.asClassNameArray(oD))):(this._domNode.classList.remove(...Rn.asClassNameArray(oD)),this._domNode.classList.add(...Rn.asClassNameArray(sD)))}}G_((o,e)=>{const t=o.getColor(CA);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${Lg(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(m4);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${Lg(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(Sl);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(_4);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(b4);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var vB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},cr=function(o,e){return function(t,i){e(t,i,o)}},IE;const DN=524288;function PE(o,e="single",t=!1){if(!o.hasModel())return null;const i=o.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const n=o.getConfiguredWordAtPosition(i.getStartPosition());if(n&&t===!1)return n.word}else if(o.getModel().getValueLengthInRange(i)<DN)return o.getModel().getValueInRange(i)}return null}var ou;let Do=(ou=class extends zt{get editor(){return this._editor}static get(e){return e.getContribution(IE.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=zl.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new Hc(500),this._state=this._register(new JR),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!!Db.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=Ig(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=PE(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=Ig(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=PE(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 pg(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)}},IE=ou,ou.ID="editor.contrib.findController",ou);Do=IE=vB([cr(1,Ln),cr(2,Kc),cr(3,l0),cr(4,vo),cr(5,Tp)],Do);let TE=class extends Do{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 LE(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new kE(this._editor,this._state,this._keybindingService))}};TE=vB([cr(1,q_),cr(2,Ln),cr(3,As),cr(4,Wr),cr(5,vo),cr(6,Kc),cr(7,l0),cr(8,Tp)],TE);const AN=jA(new $A({id:Un.StartFindAction,label:S("startFindAction","Find"),alias:"Find",precondition:Ze.or(q.focus,Ze.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:gi.MenubarEditMenu,group:"3_find",title:S({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));AN.addImplementation(0,(o,e,t)=>{const i=Do.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 kN={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 BN extends wt{constructor(){super({id:Un.StartFindWithArgs,label:S("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:kN})}async run(e,t,i){const n=Do.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 FN extends wt{constructor(){super({id:Un.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=Do.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 mB extends wt{async run(e,t){const i=Do.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 LN extends mB{constructor(){super({id:Un.NextMatchFindAction,label:S("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:q.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Ze.and(q.focus,Db),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class IN extends mB{constructor(){super({id:Un.PreviousMatchFindAction,label:S("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:q.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Ze.and(q.focus,Db),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class PN extends wt{constructor(){super({id:Un.GoToMatchFindAction,label:S("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:zl}),this._highlightDecorations=[]}run(e,t,i){const n=Do.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(vo).notify({severity:Kw.Warning,message:S("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get(Ml),a=new Ht,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:Fs(UA),position:Ha.Full}}}])})}}class _B extends wt{async run(e,t){const i=Do.get(t);if(!i)return;const n=PE(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 TN extends _B{constructor(){super({id:Un.NextSelectionMatchFindAction,label:S("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class MN extends _B{constructor(){super({id:Un.PreviousSelectionMatchFindAction,label:S("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const RN=jA(new $A({id:Un.StartFindReplaceAction,label:S("startReplace","Replace"),alias:"Replace",precondition:Ze.or(q.focus,Ze.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:gi.MenubarEditMenu,group:"3_find",title:S({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));RN.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=Do.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})});un(Do.ID,TE,0);Re(BN);Re(FN);Re(LN);Re(IN);Re(PN);Re(TN);Re(MN);const ga=ko.bindToContribution(Do.get);Ri(new ga({id:Un.CloseFindWidgetCommand,precondition:zl,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:Ze.and(q.focus,Ze.not("isComposing")),primary:9,secondary:[1033]}}));Ri(new ga({id:Un.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:q.focus,primary:Dx.primary,mac:Dx.mac,win:Dx.win,linux:Dx.linux}}));Ri(new ga({id:Un.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:q.focus,primary:Ax.primary,mac:Ax.mac,win:Ax.win,linux:Ax.linux}}));Ri(new ga({id:Un.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:q.focus,primary:kx.primary,mac:kx.mac,win:kx.win,linux:kx.linux}}));Ri(new ga({id:Un.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:q.focus,primary:Bx.primary,mac:Bx.mac,win:Bx.win,linux:Bx.linux}}));Ri(new ga({id:Un.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:q.focus,primary:Fx.primary,mac:Fx.mac,win:Fx.win,linux:Fx.linux}}));Ri(new ga({id:Un.ReplaceOneAction,precondition:zl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:q.focus,primary:3094}}));Ri(new ga({id:Un.ReplaceOneAction,precondition:zl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:Ze.and(q.focus,V9),primary:3}}));Ri(new ga({id:Un.ReplaceAllAction,precondition:zl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:q.focus,primary:2563}}));Ri(new ga({id:Un.ReplaceAllAction,precondition:zl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:Ze.and(q.focus,V9),primary:void 0,mac:{primary:2051}}}));Ri(new ga({id:Un.SelectAllMatchesAction,precondition:zl,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:q.focus,primary:515}}));const NN={0:" ",1:"u",2:"r"},uD=65535,Qr=16777215,hD=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 Go{constructor(e,t,i){if(e.length!==t.length||e.length>uD)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>Qr||r>Qr)throw new Error("startLineNumber or endLineNumber must not exceed "+Qr);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]&Qr}getEndLineNumber(e){return this._endIndexes[e]&Qr}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 ON(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&hD)>>>24)+((this._endIndexes[e]&hD)>>>16);return t===uD?-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]=`[${NN[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&Qr,endLineNumber:this._endIndexes[e]&Qr,type:this._types?this._types[e]:void 0,isCollapsed:this.isCollapsed(e),source:this.getSource(e)}}static fromFoldRanges(e){const t=e.length,i=new Uint32Array(t),n=new Uint32Array(t);let s=[],r=!1;for(let d=0;d<t;d++){const u=e[d];i[d]=u.startLineNumber,n[d]=u.endLineNumber,s.push(u.type),u.type&&(r=!0)}r||(s=void 0);const a=new Go(i,n,s);for(let d=0;d<t;d++)e[d].isCollapsed&&a.setCollapsed(d,!0),a.setSource(d,e[d].source);return a}static sanitizeAndMerge(e,t,i,n){i=i??Number.MAX_VALUE;const s=(w,A)=>Array.isArray(w)?(I=>I<A?w[I]:void 0):(I=>I<A?w.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 w;if(g&&(!f||f.startLineNumber>=g.startLineNumber))f&&f.startLineNumber===g.startLineNumber?(g.source===1?w=g:(w=f,w.isCollapsed=g.isCollapsed&&(f.endLineNumber===g.endLineNumber||!(n!=null&&n.startsInside(f.startLineNumber+1,f.endLineNumber+1))),w.source=0),f=r(++d)):(w=g,g.isCollapsed&&g.source===0&&(w.source=2)),g=a(++u);else{let A=u,I=g;for(;;){if(!I||I.startLineNumber>f.endLineNumber){w=f;break}if(I.source===1&&I.endLineNumber>f.endLineNumber)break;I=a(++A)}f=r(++d)}if(w){for(;C&&C.endLineNumber<w.startLineNumber;)C=p.pop();w.endLineNumber>w.startLineNumber&&w.startLineNumber>b&&w.endLineNumber<=i&&(!C||C.endLineNumber>=w.endLineNumber)&&(E.push(w),b=w.startLineNumber,C&&p.push(C),C=w)}}return E}}class ON{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 HN{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new an,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Go(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((i,n)=>i.regionIndex-n.regionIndex);const t={};this._decorationProvider.changeDecorations(i=>{let n=0,s=-1,r=-1;const a=d=>{for(;n<d;){const u=this._regions.getEndLineNumber(n),f=this._regions.isCollapsed(n);if(u<=s){const g=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(f,u<=r,g))}f&&u>r&&(r=u),n++}};for(const d of e){const u=d.regionIndex,f=this._editorDecorationIds[u];if(f&&!t[f]){t[f]=!0,a(u);const g=!this._regions.isCollapsed(u);this._regions.setCollapsed(u,g),s=Math.max(s,this._regions.getEndLineNumber(u))}}a(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){const t=new Array,i=n=>{for(const s of e)if(!(s.startLineNumber>n.endLineNumber||n.startLineNumber>s.endLineNumber))return!0;return!1};for(let n=0;n<this._regions.length;n++){const s=this._regions.toFoldRange(n);(s.source===0||!i(s))&&t.push(s)}this.updatePost(Go.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=Go.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(Go.fromFoldRanges(n))}updatePost(e){const t=[];let i=-1;for(let n=0,s=e.length;n<s;n++){const r=e.getStartLineNumber(n),a=e.getEndLineNumber(n),d=e.isCollapsed(n),u=e.getSource(n)!==0,f={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:f,options:this._decorationProvider.getDecorationOption(d,a<=i,u)}),d&&a>i&&(i=a)}this._decorationProvider.changeDecorations(n=>this._editorDecorationIds=n.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){const t=[];for(let i=0,n=this._regions.length;i<n;i++){let s=this.regions.isCollapsed(i);const r=this.regions.getSource(i);if(s||r!==0){const a=this._regions.toFoldRange(i),d=this._textModel.getDecorationRange(this._editorDecorationIds[i]);d&&(s&&(e!=null&&e.startsInside(d.startLineNumber+1,d.endLineNumber))&&(s=!1),t.push({startLineNumber:d.startLineNumber,endLineNumber:d.endLineNumber,type:a.type,isCollapsed:s,source:r}))}}return t}getMemento(){const e=this._currentFoldedOrManualRanges(),t=[],i=this._textModel.getLineCount();for(let n=0,s=e.length;n<s;n++){const r=e[n];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>i)continue;const a=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);t.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;const t=[],i=this._textModel.getLineCount();for(const s of e){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>i)continue;const r=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||r===s.checksum)&&t.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const n=Go.sanitizeAndMerge(this._regions,t,i);this.updatePost(Go.fromFoldRanges(n))}_getLinesChecksum(e,t){return qA(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 U9(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 v0(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 bB(o,e,t,i){const n=[];for(const s of i){const r=o.getAllRegionsAtLine(s,(a,d)=>a.isCollapsed!==e&&d<=t);n.push(...r)}o.toggleCollapseState(n)}function WN(o,e,t){const i=[];for(const n of t){const s=o.getAllRegionsAtLine(n,r=>r.isCollapsed!==e);s.length>0&&i.push(s[0])}o.toggleCollapseState(i)}function zN(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 CB(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 q9(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 G9(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 VN(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 jN(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 $N(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 UN{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new an,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||C4(t.text)[0]!==0))}updateHiddenRanges(){let e=!1;const t=[];let i=0,n=0,s=Number.MAX_VALUE,r=-1;const a=this._foldingModel.regions;for(;i<a.length;i++){if(!a.isCollapsed(i))continue;const d=a.getStartLineNumber(i)+1,u=a.getEndLineNumber(i);s<=d&&u<=r||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===d&&this._hiddenRanges[n].endLineNumber===u?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new ee(d,1,u,1))),s=d,r=u)}(this._hasLineChanges||e||n<this._hiddenRanges.length)&&this.applyHiddenRanges(t)}applyHiddenRanges(e){this._hiddenRanges=e,this._hasLineChanges=!1,this._updateEventEmitter.fire(e)}hasRanges(){return this._hiddenRanges.length>0}isHidden(e){return fD(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!qN(r,n))&&(n=fD(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 qN(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function fD(o,e){const t=NA(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const GN=5e3,KN="indent";class K9{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=KN}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(YN(this.editorModel,i,n,this.foldingRangesLimit))}}let ZN=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>Qr||t>Qr)return;const n=this._length;this._startIndexes[n]=e,this._endIndexes[n]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const i=new Uint32Array(this._length),n=new Uint32Array(this._length);for(let s=this._length-1,r=0;s>=0;s--,r++)i[r]=this._startIndexes[s],n[r]=this._endIndexes[s];return new Go(i,n)}else{this._foldingRangesLimit.update(this._length,t);let i=0,n=this._indentOccurrences.length;for(let d=0;d<this._indentOccurrences.length;d++){const u=this._indentOccurrences[d];if(u){if(u+i>t){n=d;break}i+=u}}const s=e.getOptions().tabSize,r=new Uint32Array(t),a=new Uint32Array(t);for(let d=this._length-1,u=0;d>=0;d--){const f=this._startIndexes[d],g=e.getLineContent(f),p=Rw(g,s);(p<n||p===n&&i++<t)&&(r[u]=f,a[u]=this._endIndexes[d],u++)}return new Go(r,a)}}};const XN={limit:GN,update:()=>{}};function YN(o,e,t,i=XN){const n=o.getOptions().tabSize,s=new ZN(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=Rw(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 QN=Si("editor.foldBackground",{light:za(qS,.3),dark:za(qS,.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);Si("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."));Si("editorGutter.foldingControlForeground",E4,S("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const rm=vs("folding-expanded",Qi.chevronDown,S("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),am=vs("folding-collapsed",Qi.chevronRight,S("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),gD=vs("folding-manual-collapsed",am,S("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),pD=vs("folding-manual-expanded",rm,S("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),FC={color:Fs(QN),position:1},Dh=S("linesCollapsed","Click to expand the range."),Px=S("linesExpanded","Click to collapse the range."),_s=class _s{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?_s.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?_s.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:_s.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:_s.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?_s.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:_s.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?_s.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:_s.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?_s.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:_s.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?_s.MANUALLY_EXPANDED_VISUAL_DECORATION:_s.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};_s.COLLAPSED_VISUAL_DECORATION=bn.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(am)}),_s.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=bn.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:FC,isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(am)}),_s.MANUALLY_COLLAPSED_VISUAL_DECORATION=bn.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(gD)}),_s.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=bn.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:FC,isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(gD)}),_s.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=bn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Dh}),_s.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=bn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:FC,isWholeLine:!0,linesDecorationsTooltip:Dh}),_s.EXPANDED_VISUAL_DECORATION=bn.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Rn.asClassName(rm),linesDecorationsTooltip:Px}),_s.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=bn.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Rn.asClassName(rm),linesDecorationsTooltip:Px}),_s.MANUALLY_EXPANDED_VISUAL_DECORATION=bn.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Rn.asClassName(pD),linesDecorationsTooltip:Px}),_s.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=bn.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Rn.asClassName(pD),linesDecorationsTooltip:Px}),_s.NO_CONTROLS_EXPANDED_RANGE_DECORATION=bn.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),_s.HIDDEN_RANGE_DECORATION=bn.register({description:"folding-hidden-range-decoration",stickiness:1});let ME=_s;const JN={},eO="syntax";class Z9{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=eO,this.disposables=new Ht,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return tO(this.providers,this.editorModel,e).then(t=>{var i;return t?nO(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function tO(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,JN,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})}},bs));return Promise.all(n).then(s=>i)}class iO{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>Qr||t>Qr)return;const s=this._length;this._startIndexes[s]=e,this._endIndexes[s]=t,this._nestingLevels[s]=n,this._types[s]=i,this._length++,n<30&&(this._nestingLevelCounts[n]=(this._nestingLevelCounts[n]||0)+1)}toIndentRanges(){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let n=0;n<this._length;n++)t[n]=this._startIndexes[n],i[n]=this._endIndexes[n];return new Go(t,i,this._types)}else{this._foldingRangesLimit.update(this._length,e);let t=0,i=this._nestingLevelCounts.length;for(let a=0;a<this._nestingLevelCounts.length;a++){const d=this._nestingLevelCounts[a];if(d){if(d+t>e){i=a;break}t+=d}}const n=new Uint32Array(e),s=new Uint32Array(e),r=[];for(let a=0,d=0;a<this._length;a++){const u=this._nestingLevels[a];(u<i||u===i&&t++<e)&&(n[d]=this._startIndexes[a],s[d]=this._endIndexes[a],r[d]=this._types[a],d++)}return new Go(n,s,r)}}}function nO(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 iO(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 sO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},O0=function(o,e){return function(t,i){e(t,i,o)}},pd;const Qs=new wn("foldingEnabled",!1);var ru;let $c=(ru=class extends zt{static get(e){return e.getContribution(pd.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=pd._foldingRangeSelector)==null?void 0:n.call(pd,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 Ht),this.editor=e,this._foldingLimitReporter=new EB(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 ME(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=Qs.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(d=>{if(d.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),d.hasChanged(47)&&this.onModelChanged(),d.hasChanged(111)||d.hasChanged(45)){const u=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=u.get(111),this.foldingDecorationProvider.showFoldingHighlights=u.get(45),this.triggerFoldingModelChanged()}d.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),d.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),d.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new HN(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new UN(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Hc(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Ns(()=>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 K9(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=pd.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new Z9(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 Ho,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=Ks(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const u=s.setCollapsedAllOfType(Op.Imports.value,!0);u&&(r=Mf.capture(this.editor),this._currentModelHasFoldedImports=u)}const a=this.editor.getSelections();e.update(s,oO(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=>(qn(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,qn)}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)}},pd=ru,ru.ID="editor.contrib.folding",ru);$c=pd=sO([O0(1,Ln),O0(2,qs),O0(3,vo),O0(4,gr),O0(5,Pi)],$c);class EB{constructor(e){this.editor=e,this._onDidChange=new an,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 io extends wt{runEditorCommand(e,t,i){const n=e.get(qs),s=$c.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 oO(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 yB(o){if(!$0(o)){if(!GA(o))return!1;const e=o;if(!$0(e.levels)&&!GS(e.levels)||!$0(e.direction)&&!_A(e.direction)||!$0(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(GS)))return!1}return!0}class rO extends io{constructor(){super({id:"editor.unfold",label:S("unfoldAction.label","Unfold"),alias:"Unfold",precondition:Qs,kbOpts:{kbExpr:q.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:yB,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"?bB(t,!1,s,r):v0(t,!1,s,r)}}class aO extends io{constructor(){super({id:"editor.unfoldRecursively",label:S("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2142),weight:100}})}invoke(e,t,i,n){v0(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class lO extends io{constructor(){super({id:"editor.fold",label:S("foldAction.label","Fold"),alias:"Fold",precondition:Qs,kbOpts:{kbExpr:q.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:yB,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=this.getLineNumbers(n,i),r=n&&n.levels,a=n&&n.direction;typeof r!="number"&&typeof a!="string"?WN(t,!0,s):a==="up"?bB(t,!0,r||1,s):v0(t,!0,r||1,s)}}class cO extends io{constructor(){super({id:"editor.toggleFold",label:S("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);U9(t,1,n)}}class dO extends io{constructor(){super({id:"editor.foldRecursively",label:S("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);v0(t,!0,Number.MAX_VALUE,n)}}class uO extends io{constructor(){super({id:"editor.toggleFoldRecursively",label:S("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);U9(t,Number.MAX_VALUE,n)}}class hO extends io{constructor(){super({id:"editor.foldAllBlockComments",label:S("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())G9(t,Op.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*"+Ig(a.blockCommentStartToken));q9(t,d,!0)}}}}class fO extends io{constructor(){super({id:"editor.foldAllMarkerRegions",label:S("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())G9(t,Op.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);q9(t,d,!0)}}}}class gO extends io{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:S("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())G9(t,Op.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);q9(t,d,!1)}}}}class pO extends io{constructor(){super({id:"editor.foldAllExcept",label:S("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);CB(t,!0,n)}}class xO extends io{constructor(){super({id:"editor.unfoldAllExcept",label:S("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);CB(t,!1,n)}}class vO extends io{constructor(){super({id:"editor.foldAll",label:S("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2069),weight:100}})}invoke(e,t,i){v0(t,!0)}}class mO extends io{constructor(){super({id:"editor.unfoldAll",label:S("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2088),weight:100}})}invoke(e,t,i){v0(t,!1)}}const sf=class sf extends io{getFoldingLevel(){return parseInt(this.id.substr(sf.ID_PREFIX.length))}invoke(e,t,i){zN(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};sf.ID_PREFIX="editor.foldLevel",sf.ID=e=>sf.ID_PREFIX+e;let lm=sf;class _O extends io{constructor(){super({id:"editor.gotoParentFold",label:S("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=VN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class bO extends io{constructor(){super({id:"editor.gotoPreviousFold",label:S("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Qs,kbOpts:{kbExpr:q.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 io{constructor(){super({id:"editor.gotoNextFold",label:S("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Qs,kbOpts:{kbExpr:q.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 io{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:S("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2135),weight:100}})}invoke(e,t,i){var r;const n=[],s=i.getSelections();if(s){for(const a of s){let d=a.endLineNumber;a.endColumn===1&&--d,d>a.startLineNumber&&(n.push({startLineNumber:a.startLineNumber,endLineNumber:d,type:void 0,isCollapsed:!0,source:1}),i.setSelection({startLineNumber:a.startLineNumber,startColumn:1,endLineNumber:a.startLineNumber,endColumn:1}))}if(n.length>0){n.sort((d,u)=>d.startLineNumber-u.startLineNumber);const a=Go.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(Go.fromFoldRanges(a))}}}}class yO extends io{constructor(){super({id:"editor.removeManualFoldingRanges",label:S("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(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()}}}un($c.ID,$c,0);Re(rO);Re(aO);Re(lO);Re(dO);Re(uO);Re(vO);Re(mO);Re(hO);Re(fO);Re(gO);Re(pO);Re(xO);Re(cO);Re(_O);Re(bO);Re(CO);Re(EO);Re(yO);for(let o=1;o<=7;o++)y4(new lm({id:lm.ID(o),label:S("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2048|21+o),weight:100}}));Qn.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof jn))throw _l();const i=o.get(Pi),n=o.get(mo).getModel(t);if(!n)throw _l();const s=o.get(ss);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(qs),a=s.getValue("editor.foldingStrategy",{resource:t}),d={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(C,b)=>{}},u=new K9(n,r,d);let f=u;if(a!=="indentation"){const C=$c.getFoldingRangeProviders(i,n);C.length&&(f=new Z9(n,C,()=>{},d,u))}const g=await f.compute(ln.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?Op.fromValue(b):void 0})}return p}finally{f.dispose()}});class wO extends wt{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){Og.setZoomLevel(Og.getZoomLevel()+1)}}class SO extends wt{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){Og.setZoomLevel(Og.getZoomLevel()-1)}}class DO extends wt{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){Og.setZoomLevel(0)}}Re(wO);Re(SO);Re(DO);var wB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xg=function(o,e){return function(t,i){e(t,i,o)}},yf;let cm=(yf=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new Ht,this._sessionDisposables=new Ht,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 Fv;for(const n of t.autoFormatTriggerCharacters)i.add(n.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(n=>{const s=n.charCodeAt(n.length-1);i.has(s)&&this._trigger(String.fromCharCode(s))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=new Zs,s=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){n.cancel(),s.dispose();return}for(let a=0,d=r.changes.length;a<d;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){n.cancel(),s.dispose();return}});w4(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||Yo(r)&&(this._accessibilitySignalService.playSignal(ZA.format,{userGesture:!1}),S4.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},yf.ID="editor.contrib.autoFormat",yf);cm=wB([xg(1,Pi),xg(2,Ol),xg(3,KA)],cm);var wf;let dm=(wf=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Ht,this._callOnModel=new Ht,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(XA,this.editor,e,2,gl.None,ln.None,!1).catch(qn))}},wf.ID="editor.contrib.formatOnPaste",wf);dm=wB([xg(1,Pi),xg(2,tn)],dm);class AO extends wt{constructor(){super({id:"editor.action.formatDocument",label:S("formatDocument.label","Format Document"),alias:"Format Document",precondition:Ze.and(q.notInCompositeEditor,q.writable,q.hasDocumentFormattingProvider),kbOpts:{kbExpr:q.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(tn);await e.get(kp).showWhile(i.invokeFunction(D4,t,1,gl.None,ln.None,!0),250)}}}class kO extends wt{constructor(){super({id:"editor.action.formatSelection",label:S("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:Ze.and(q.writable,q.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2084),weight:100},contextMenuOpts:{when:q.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(tn),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new ee(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(kp).showWhile(i.invokeFunction(XA,t,s,1,gl.None,ln.None,!0),250)}}un(cm.ID,cm,2);un(dm.ID,dm,2);Re(AO);Re(kO);Qn.registerCommand("editor.action.format",async o=>{const e=o.get(Cs).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(Us);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var BO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LC=function(o,e){return function(t,i){e(t,i,o)}};class Zh{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 RE extends Zh{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class SB extends Zh{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class al extends Zh{static create(e,t,i){const n=new Zs(i),s=new al(t.uri),r=e.ordered(t),a=r.map((u,f)=>{const g=Zh.findId(`provider_${f}`,s),p=new SB(g,s,u.displayName??"Unknown Outline Provider",f);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(C=>{for(const b of C||[])al._makeOutlineElement(b,p);return p},C=>(bs(C),p)).then(C=>{Zh.empty(C)?C.remove():s._groups.set(g,C)})}),d=e.onDidChange(()=>{const u=e.ordered(t);ja(u,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?al.create(e,t,i):s._compact()).finally(()=>{n.dispose(),d.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=Zh.findId(e,t),n=new RE(i,t,e);if(e.children)for(const s of e.children)al._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=ml.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 RE?e.push(t.symbol):e.push(...ml.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>ee.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return al._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>Ii.compare(ee.getStartPosition(i.range),ee.getStartPosition(n.range))||Ii.compare(ee.getEndPosition(n.range),ee.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||i,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&al._flattenDocumentSymbols(e,n.children,n.name)}}const Jp=Rl("IOutlineModelService");let NE=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Ht,this._cache=new Fp(10,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(n=>{this._cache.delete(n.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,n=i.ordered(e);let s=this._cache.get(e.id);if(!s||s.versionId!==e.getVersionId()||!ja(s.provider,n)){const a=new Zs;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:al.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()}}};NE=BO([LC(0,Pi),LC(1,gr),LC(2,mo)],NE);Nl(Jp,NE,1);Qn.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;Pn(jn.isUri(t));const i=o.get(Jp),s=await o.get(fa).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,ln.None)).getTopLevelSymbols()}finally{s.dispose()}});const Sa=class Sa extends zt{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=Sa.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=Sa.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=Sa.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=Sa.suppressSuggestions.bindTo(this.contextKeyService),this._register(rs(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(rs(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=l1(f);C===-1&&(C=f.length-1),s=C>0;const b=n.textModel.getOptions().tabSize;r=A4.visibleColumnFromColumn(f,C+1,b)<b}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};Sa.inlineSuggestionVisible=new wn("inlineSuggestionVisible",!1,S("inlineSuggestionVisible","Whether an inline suggestion is visible")),Sa.inlineSuggestionHasIndentation=new wn("inlineSuggestionHasIndentation",!1,S("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),Sa.inlineSuggestionHasIndentationLessThanTabSize=new wn("inlineSuggestionHasIndentationLessThanTabSize",!0,S("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),Sa.suppressSuggestions=new wn("inlineSuggestionSuppressSuggestions",void 0,S("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let Oo=Sa;function FO(o){const e=new Ht,t=e.add(YA());return e.add(rs(i=>{t.setStyle(o.read(i))})),e}class Jg{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 Al(ee.fromPositions(new Ii(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 um{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=tb(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 OE{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new um(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=tb(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 xD(o,e){return ja(o,e,DB)}function DB(o,e){return o===e?!0:!o||!e?!1:o instanceof Jg&&e instanceof Jg||o instanceof OE&&e instanceof OE?o.equals(e):!1}const LO=[];function IO(){return LO}class AB{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new Hf(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new ee(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function kB(o,e){const t=new Ht,i=o.createDecorationsCollection();return t.add(k4({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function PO(o,e){return new Ii(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function vD(o,e){return new Ii(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var TO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},MO=function(o,e){return function(t,i){e(t,i,o)}};const mD="ghost-text";let HE=class extends zt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Qo(this,!1),this.currentTextModel=Po(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Wn(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 OE?r.columnRange:void 0,d=[],u=[];function f(E,w){if(u.length>0){const A=u[u.length-1];w&&A.decorations.push(new Hg(A.content.length+1,A.content.length+1+E[0].length,w,0)),A.content+=E[0],E=E.slice(1)}for(const A of E)u.push({content:A,decorations:w?[new Hg(1,A.length+1,w,0)]:[]})}const g=s.getLineContent(r.lineNumber);let p,C=0;for(const E of r.parts){let w=E.lines;p===void 0?(d.push({column:E.column,text:w[0],preview:E.preview}),w=w.slice(1)):f([g.substring(C,E.column-1)],void 0),w.length>0&&(f(w,mD),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 AB(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=Wn(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];s.replacedRange&&r.push({range:s.replacedRange.toRange(s.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const a of s.inlineTexts)r.push({range:ee.fromPositions(new Ii(s.lineNumber,a.column)),options:{description:mD,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:jh.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new RO(this.editor,this.languageService.languageIdCodec,Wn(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(is(()=>{this.isDisposed.set(!0,void 0)})),this._register(kB(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};HE=TO([MO(2,ha)],HE);class RO extends zt{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=Pd("editorOptionChanged",Rs.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(rs(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");NO(d,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:d,afterColumnAffinity:1})}})}}function NO(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 ek(1e4);p.appendString('<div class="suggest-preview-text">');for(let E=0,w=t.length;E<w;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=sk(I),R=B4(I),P=F4.createEmpty(I,n);tk(new ik(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!==L4.OFF,null),p),p.appendString("</div>")}p.appendString("</div>"),nk(o,f);const C=p.build(),b=_D?_D.createHTML(C):C;o.innerHTML=b}const _D=JA("editorGhostText",{createHTML:o=>o});function OO(o,e){const t=new M4,i=new P4(t,u=>e.getLanguageConfiguration(u)),n=new I4(new HO([o]),i),s=T4(n,[],void 0,!0);let r="";const a=o.getLineContent();function d(u,f){if(u.kind===2)if(d(u.openingBracket,f),f=P0(f,u.openingBracket.length),u.child&&(d(u.child,f),f=P0(f,u.child.length)),u.closingBracket)d(u.closingBracket,f),f=P0(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(KS(f),KS(P0(f,u.length)));else if(u.kind===4)for(const g of u.children)d(g,f),f=P0(f,g.length)}}return d(s,R4),r}class HO{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 BB(o,e,t,i,n=ln.None,s){const r=e instanceof Ii?VO(e,t):e,a=o.all(t),d=new N4;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&&bs(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${M.map(P=>P.toString?P.toString():""+P).join(" -> ")}`));const R=new $_;return f.set(A,R.p),(async()=>{var P;if(!M){const V=u(A);for(const $ of V){const Q=await C($);if(Q&&Q.items.length>0)return}}try{return e instanceof Ii?await A.provideInlineCompletions(t,e,i,n):await((P=A.provideInlineEdits)==null?void 0:P.call(A,t,e,i,n))}catch(V){bs(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,w=[];for(const A of b){const I=A.completions;if(!I)continue;const M=new zO(I,A.provider);w.push(M);for(const R of I.items){const P=hm.from(R,M,r,t,s);E.set(P.hash(),P)}}return new WO(Array.from(E.values()),new Set(E.keys()),w)}class WO{constructor(e,t,i){this.completions=e,this.hashs=t,this.providerResults=i}has(e){return this.hashs.has(e.hash())}dispose(){for(const e of this.providerResults)e.removeRef()}}class zO{constructor(e,t){this.inlineCompletions=e,this.provider=t,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,this.refCount===0&&this.provider.freeInlineCompletions(this.inlineCompletions)}}class hm{static from(e,t,i,n,s){let r,a,d=e.range?ee.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=bD(r,d.getStartPosition(),n,s);const u=r.length-e.insertText.length;u!==0&&(d=new ee(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+u))}a=void 0}else if("snippet"in e.insertText){const u=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=bD(e.insertText.snippet,d.getStartPosition(),n,s);const g=e.insertText.snippet.length-u;g!==0&&(d=new ee(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+g))}const f=new Nu().parse(e.insertText.snippet);f.children.length===1&&f.children[0]instanceof To?(r=f.children[0].value,a=void 0):(r=f.toString(),a={snippet:e.insertText.snippet,range:d})}else O4(e.insertText);return new hm(r,e.command,d,r,a,e.additionalTextEdits||IO(),e,t)}constructor(e,t,i,n,s,r,a,d){this.filterText=e,this.command=t,this.range=i,this.insertText=n,this.snippetInfo=s,this.additionalTextEdits=r,this.sourceInlineCompletion=a,this.source=d,e=e.replace(/\r\n|\r/g,`
|
|
34
|
+
`),n=e.replace(/\r\n|\r/g,`
|
|
35
|
+
`)}withRange(e){return new hm(this.filterText,this.command,e,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}toSingleTextEdit(){return new Al(this.range,this.insertText)}}function VO(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new ee(o.lineNumber,t.startColumn,o.lineNumber,i):ee.fromPositions(o,o.with(void 0,i))}function bD(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?OO(a,i):o}function Wd(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=Np(n,o.text),r=Lv.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),d=ee.fromPositions(r,o.range.getEndPosition());return new Al(d,a)}function FB(o,e){return o.text.startsWith(e.text)&&jO(o.range,e.range)}function CD(o,e,t,i,n=0){let s=Wd(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=eo(r).length;if(s.range.startColumn-1<=a){const b=eo(s.text).length,E=r.substring(s.range.startColumn-1,a),[w,A]=[s.range.getStartPosition(),s.range.getEndPosition()],I=w.column+E.length<=A.column?w.delta(0,E.length):A,M=ee.fromPositions(I,A),R=s.text.startsWith(E)?s.text.substring(E.length):s.text.substring(b);s=new Al(M,R)}const u=e.getValueInRange(s.range),f=$O(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 w=b.modifiedStart+b.modifiedLength,A=Math.max(b.modifiedStart,Math.min(w,C)),I=s.text.substring(b.modifiedStart,A),M=s.text.substring(A,Math.max(b.modifiedStart,w));I.length>0&&p.push(new um(E,I,!1)),M.length>0&&p.push(new um(E,M,!0))}return new Jg(g,p)}function jO(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let ba;function $O(o,e){if((ba==null?void 0:ba.originalValue)===o&&(ba==null?void 0:ba.newValue)===e)return ba==null?void 0:ba.changes;{let t=yD(o,e,!0);if(t){const i=ED(t);if(i>0){const n=yD(o,e,!1);n&&ED(n)<i&&(t=n)}}return ba={originalValue:o,newValue:e,changes:t},t}}function ED(o){let e=0;for(const t of o)e+=t.originalLength;return e}function yD(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 H4({getElements:()=>a},{getElements:()=>d}).ComputeDiff(!1).changes}var UO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wD=function(o,e){return function(t,i){e(t,i,o)}};let WE=class extends zt{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=u1("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=u1("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var f,g;const n=new GO(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if((f=this._updateOperation.value)!=null&&f.request.satisfies(n))return this._updateOperation.value.promise;if((g=s.get())!=null&&g.request.satisfies(n))return Promise.resolve(!0);const r=!!this._updateOperation.value;this._updateOperation.clear();const a=new Zs,d=(async()=>{if((r||t.triggerKind===bl.Automatic)&&await qO(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 BB(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 w=new ZO(b,n,this.textModel,this.versionId);if(i){const A=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!b.has(A)&&w.prepend(i.inlineCompletion,A.range,!0)}return this._updateOperation.clear(),Xu(A=>{s.set(w,A)}),!0})(),u=new KO(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()}};WE=UO([wD(3,Pi),wD(4,qs)],WE);function qO(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 GO{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&W4(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,V4())&&(e.context.triggerKind===bl.Automatic||this.context.triggerKind===bl.Explicit)&&this.versionId===e.versionId}}class KO{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class ZO{get inlineCompletions(){return this._inlineCompletions}constructor(e,t,i,n){this.inlineCompletionProviderResult=e,this.request=t,this._textModel=i,this._versionId=n,this._refCount=1,this._prependedInlineCompletionItems=[];const s=i.deltaDecorations([],e.completions.map(r=>({range:r.range,options:{description:"inline-completion-tracking-range"}})));this._inlineCompletions=e.completions.map((r,a)=>new SD(r,s[a],this._textModel,this._versionId))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,this._refCount===0){setTimeout(()=>{this._textModel.isDisposed()||this._textModel.deltaDecorations(this._inlineCompletions.map(e=>e.decorationId),[])},0),this.inlineCompletionProviderResult.dispose();for(const e of this._prependedInlineCompletionItems)e.source.removeRef()}}prepend(e,t,i){i&&e.source.addRef();const n=this._textModel.deltaDecorations([],[{range:t,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new SD(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class SD{get forwardStable(){return this.inlineCompletion.source.inlineCompletions.enableForwardStability??!1}constructor(e,t,i,n){this.inlineCompletion=e,this.decorationId=t,this._textModel=i,this._modelVersion=n,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._updatedRange=hl({owner:this,equalsFn:ee.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??IC)}toSingleTextEdit(e){return new Al(this._updatedRange.read(e)??IC,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=Wd(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)&&!!z4(p,f)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&Lv.ofRange(i).isGreaterThanOrEqualTo(Lv.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Al(this._updatedRange.read(e)??IC,this.inlineCompletion.filterText)}}const IC=new ee(1,1,1,1),Xi={Visible:j9,HasFocusedSuggestion:new wn("suggestWidgetHasFocusedSuggestion",!1,S("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new wn("suggestWidgetDetailsVisible",!1,S("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new wn("suggestWidgetMultipleSuggestions",!1,S("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new wn("suggestionMakesTextEdit",!0,S("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new wn("acceptSuggestionOnEnter",!0,S("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new wn("suggestionHasInsertAndReplaceRange",!1,S("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new wn("suggestionInsertMode",void 0,{type:"string",description:S("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new wn("suggestionCanResolve",!1,S("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},Cc=new gi("suggestWidgetStatusBar");class XO{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=Rg.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:(s=t.label)==null?void 0:s.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,ee.isIRange(t.range)?(this.editStart=new Ii(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new Ii(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new Ii(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||ee.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new Ii(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new Ii(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new Ii(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||ee.spansMultipleLines(t.range.insert)||ee.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof n.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new Ho(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{Gc(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const d_=class d_{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}};d_.default=new d_;let ep=d_;class YO{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function X9(o,e,t,i=ep.default,n={triggerKind:0},s=ln.None){const r=new Ho;t=t.clone();const a=e.getWordAtPosition(t),d=a?new ee(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):ee.fromPositions(t),u={replace:d,insert:d.setEndPosition(t.lineNumber,t.column)},f=[],g=new Ht,p=[];let C=!1;const b=(w,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=Nu.guessNeedsClipboard(P.insertText)),f.push(new XO(t,P,A,w)),M=!0}return ok(A)&&g.add(A),p.push({providerName:w._debugDisplayName??"unknown_provider",elapsedProvider:A.duration??-1,elapsedOverall:I.elapsed()}),M},E=(async()=>{})();for(const w of o.orderedGroups(e)){let A=!1;if(await Promise.all(w.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 Ho,R=await I.provideCompletionItems(e,t,n,s);A=b(I,R,M)||A}catch(M){bs(M)}})),A||s.isCancellationRequested)break}return await E,s.isCancellationRequested?(g.dispose(),Promise.reject(new U_)):new YO(f.sort(eH(i.snippetSortOrder)),C,{entries:p,elapsed:r.elapsed()},g)}function Y9(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 QO(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return Y9(o,e)}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 Y9(o,e)}const Ab=new Map;Ab.set(0,QO);Ab.set(2,JO);Ab.set(1,Y9);function eH(o){return Ab.get(o)}Qn.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;Pn(jn.isUri(t)),Pn(Ii.isIPosition(i)),Pn(typeof n=="string"||!n),Pn(typeof s=="number"||!s);const{completionProvider:r}=o.get(Pi),a=await o.get(fa).createModelReference(t);try{const d={incomplete:!1,suggestions:[]},u=[],f=a.object.textEditorModel.validatePosition(i),g=await X9(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(ln.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 tH(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class Xh{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 DD(o,e=j_){return j4(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var iH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nH=function(o,e){return function(t,i){e(t,i,o)}};class AD{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 kD{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=eo(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(u=>u===e?!1:(u instanceof To&&(a=eo(tb(u.value).pop())),!0));const d=Np(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 BD{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return ag(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=ag(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return $4(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(qw(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 FD{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=>!U4(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let fm=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}}};fm=iH([nH(2,qs)],fm);const Da=class Da{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 Da.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return Da.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return Da.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return Da.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}}};Da.dayNames=[S("Sunday","Sunday"),S("Monday","Monday"),S("Tuesday","Tuesday"),S("Wednesday","Wednesday"),S("Thursday","Thursday"),S("Friday","Friday"),S("Saturday","Saturday")],Da.dayNamesShort=[S("SundayShort","Sun"),S("MondayShort","Mon"),S("TuesdayShort","Tue"),S("WednesdayShort","Wed"),S("ThursdayShort","Thu"),S("FridayShort","Fri"),S("SaturdayShort","Sat")],Da.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")],Da.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 gm=Da;class LD{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=q4(this._workspaceService.getWorkspace());if(!G4(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(ZS(e))return ag(e.uri.path);let t=ag(e.configPath.path);return t.endsWith(XS)&&(t=t.substr(0,t.length-XS.length-1)),t}_resoveWorkspacePath(e){if(ZS(e))return DD(e.uri.fsPath);const t=ag(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?DD(i):"/"}}class ID{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 vb()}}var sH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},oH=function(o,e){return function(t,i){e(t,i,o)}},Ur;const Er=class Er{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=YS(t.placeholders,hr.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const n=this._snippet.offset(i),s=this._snippet.fullLen(i),r=ee.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Er._decor.inactiveFinal:Er._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(ds.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 qi(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(d,a.isFinalTabstop?Er._decor.activeFinal:Er._decor.active),s.add(a);for(const f of this._snippet.enclosingPlaceholders(a)){const g=this._placeholderDecorations.get(f);n.changeDecorationOptions(g,f.isFinalTabstop?Er._decor.activeFinal:Er._decor.active),s.add(f)}}for(const[a,d]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(d,a.isFinalTabstop?Er._decor.inactiveFinal:Er._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof hr){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 x0,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const r=s._snippet.placeholderInfo.last.index;for(const d of s._snippet.placeholderInfo.all)d.isFinalTabstop?d.index=n.index+(r+1)/this._nestingLevel:d.index=n.index+d.index/this._nestingLevel;this._snippet.replace(n,s._snippet.children);const a=this._placeholderDecorations.get(n);i.removeDecoration(a),this._placeholderDecorations.delete(n);for(const d of s._snippet.placeholders){const u=s._snippet.offset(d),f=s._snippet.fullLen(d),g=ee.fromPositions(t.getPositionAt(s._offset+u),t.getPositionAt(s._offset+u+f)),p=i.addDecoration(g,Er._decor.inactive);this._placeholderDecorations.set(d,p)}}this._placeholderGroups=YS(this._snippet.placeholders,hr.compareByIndex)})}};Er._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 pm=Er;const PD={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let xm=Ur=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=eo(r,0,t.column-1);let d;return n.walk(u=>{if(!(u instanceof To)||u.parent instanceof x0||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 To(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=qi.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(Lf)),b=e.invokeWithinContext(R=>new BD(R.get(Mg),p)),E=()=>a,w=p.getValueInRange(Ur.adjustSelection(p,e.getSelection(),i,0)),A=p.getValueInRange(Ur.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)=>ee.compareRangesUsingStarts(R.selection,P.selection));for(const{selection:R,idx:P}of M){let V=Ur.adjustSelection(p,R,i,0),$=Ur.adjustSelection(p,R,0,n);w!==p.getValueInRange(V)&&(V=R),A!==p.getValueInRange($)&&($=R);const Q=R.setStartPosition(V.startLineNumber,V.startColumn).setEndPosition($.endLineNumber,$.endColumn),re=new Nu().parse(t,!0,s),he=Q.getStartPosition(),Z=Ur.adjustWhitespace(p,he,r||P>0&&I!==p.getLineFirstNonWhitespaceColumn(R.positionLineNumber),re);re.resolveVariables(new AD([b,new FD(E,P,M.length,e.getOption(79)==="spread"),new kD(p,R,P,d),new fm(p,R,u),new gm,new LD(C),new ID])),f[P]=ds.replace(Q,re.toString()),f[P].identifier={major:P,minor:0},f[P]._isTracked=!0,g[P]=new pm(e,re,Z)}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 Nu,g=new qp,p=new AD([e.invokeWithinContext(b=>new BD(b.get(Mg),u)),new FD(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new kD(u,e.getSelection(),0,r),new fm(u,e.getSelection(),a),new gm,new LD(e.invokeWithinContext(b=>b.get(Lf))),new ID]);t=t.sort((b,E)=>ee.compareRangesUsingStarts(b.range,E.range));let C=0;for(let b=0;b<t.length;b++){const{range:E,template:w}=t[b];if(b>0){const P=t[b-1].range,V=ee.fromPositions(P.getEndPosition(),E.getStartPosition()),$=new To(u.getValueInRange(V));g.appendChild($),C+=$.value.length}const A=f.parseFragment(w,g);Ur.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=ds.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 pm(e,g,"")]}}constructor(e,t,i=PD,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){uo(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"?Ur.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Ur.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=>qi.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=PD){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Ur.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=>qi.fromPositions(d.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const n=i.move(e);t.push(...n)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;const t=new Map;for(const i of this._snippets){const n=i.computePossibleSelections();if(t.size===0)for(const[s,r]of n){r.sort(ee.compareRangesUsingStarts);for(const a of e)if(r[0].containsRange(a)){t.set(s,[]);break}}if(t.size===0)return!1;t.forEach((s,r)=>{s.push(...n.get(r))})}e.sort(ee.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(ee.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};xm=Ur=sH([oH(3,qs)],xm);var rH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tx=function(o,e){return function(t,i){e(t,i,o)}},Hh;const TD={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var Ta;let xo=(Ta=class{static get(e){return e.getContribution(Hh.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Ht,this._modelVersionId=-1,this._inSnippet=Hh.InSnippetMode.bindTo(n),this._hasNextTabstop=Hh.HasNextTabstop.bindTo(n),this._hasPrevTabstop=Hh.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"?TD:{...TD,...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?(Pn(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new xm(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()||!Ii.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(w=>w.value===C),E=[];for(let w=0;w<p.choice.options.length;w++){const A=p.choice.options[w];E.push({kind:13,label:A.value,insertText:A.value,sortText:"a".repeat(w+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(()=>{tH(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()}},Hh=Ta,Ta.ID="snippetController2",Ta.InSnippetMode=new wn("inSnippetMode",!1,S("inSnippetMode","Whether the editor in current in snippet mode")),Ta.HasNextTabstop=new wn("hasNextTabstop",!1,S("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),Ta.HasPrevTabstop=new wn("hasPrevTabstop",!1,S("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),Ta);xo=Hh=rH([Tx(1,Yu),Tx(2,Pi),Tx(3,Ln),Tx(4,qs)],xo);un(xo.ID,xo,4);const kb=ko.bindToContribution(xo.get);Ri(new kb({id:"jumpToNextSnippetPlaceholder",precondition:Ze.and(xo.InSnippetMode,xo.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:q.textInputFocus,primary:2}}));Ri(new kb({id:"jumpToPrevSnippetPlaceholder",precondition:Ze.and(xo.InSnippetMode,xo.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:q.textInputFocus,primary:1026}}));Ri(new kb({id:"leaveSnippet",precondition:xo.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:q.textInputFocus,primary:9,secondary:[1033]}}));Ri(new kb({id:"acceptSnippet",precondition:xo.InSnippetMode,handler:o=>o.finish()}));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},PC=function(o,e){return function(t,i){e(t,i,o)}};let zE=class extends zt{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(WE,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=Qo(this,!1),this._forceUpdateExplicitlySignal=Yw(this),this._selectedInlineCompletionId=Qo(this,void 0),this._primaryPosition=Wn(this,b=>this._positions.read(b)[0]??new Ii(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([rl.Redo,rl.Undo,rl.AcceptWord]),this._fetchInlineCompletionsPromise=rk({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:bl.Automatic}),handleChange:(b,E)=>(b.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(b.change))?E.preserveCurrentCompletion=!0:b.didChange(this._forceUpdateExplicitlySignal)&&(E.inlineCompletionTriggerKind=bl.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 $=this._source.inlineCompletions.get();Xu(Q=>{(!$||A.request.versionId>$.request.versionId)&&this._source.inlineCompletions.set(A.clone(),Q),this._source.clearSuggestWidgetInlineCompletions(Q)})}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=hl({owner:this,equalsFn:h1()},b=>{const E=this._source.inlineCompletions.read(b);if(!E)return[];const w=this._primaryPosition.read(b);return E.inlineCompletions.filter(I=>I.isVisible(this.textModel,w,b))}),this.selectedInlineCompletionIndex=Wn(this,b=>{const E=this._selectedInlineCompletionId.read(b),w=this._filteredInlineCompletionItems.read(b),A=this._selectedInlineCompletionId===void 0?-1:w.findIndex(I=>I.semanticId===E);return A===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):A}),this.selectedInlineCompletion=Wn(this,b=>{const E=this._filteredInlineCompletionItems.read(b),w=this.selectedInlineCompletionIndex.read(b);return E[w]}),this.activeCommands=hl({owner:this,equalsFn:h1()},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=Wn(this,b=>{if(this.lastTriggerKind.read(b)===bl.Explicit)return this._filteredInlineCompletionItems.read(b).length}),this.state=hl({owner:this,equalsFn:(b,E)=>!b||!E?b===E:xD(b.ghostTexts,E.ghostTexts)&&b.inlineCompletion===E.inlineCompletion&&b.suggestItem===E.suggestItem},b=>{const E=this.textModel,w=this.selectedSuggestItem.read(b);if(w){const A=Wd(w.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),$=this._positions.read(b),Q=[R,...TC(this.textModel,$,R)],re=Q.map((Z,ce)=>CD(Z,E,V,$[ce],P)).filter(Jx),he=re[0]??new Jg(R.range.endLineNumber,[]);return{edits:Q,primaryGhostText:he,ghostTexts:re,inlineCompletion:I==null?void 0:I.completion,suggestItem:w}}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,...TC(this.textModel,R,I)],V=P.map(($,Q)=>CD($,E,M,R[Q],0)).filter(Jx);return V[0]?{edits:P,primaryGhostText:V[0],ghostTexts:V,inlineCompletion:A,suggestItem:void 0}:void 0}}),this.ghostTexts=hl({owner:this,equalsFn:xD},b=>{const E=this.state.read(b);if(E)return E.ghostTexts}),this.primaryGhostText=hl({owner:this,equalsFn:DB},b=>{const E=this.state.read(b);if(E)return E==null?void 0:E.primaryGhostText}),this._register(ak(this._fetchInlineCompletionsPromise));let C;this._register(rs(b=>{var A,I;const E=this.state.read(b),w=E==null?void 0:E.inlineCompletion;if((w==null?void 0:w.semanticId)!==(C==null?void 0:C.semanticId)&&(C=w,w)){const M=w.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?rl.Undo:e!=null&&e.isRedoing?rl.Redo:this.isAcceptingPartially?rl.AcceptWord:rl.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){Iv(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){Iv(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(Jx);return K4(s,a=>{let d=a.toSingleTextEdit(t);return d=Wd(d,i,ee.fromPositions(d.range.getStartPosition(),e.range.getEndPosition())),FB(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 Hf;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",[ds.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=xo.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=MD(s).map(a=>qi.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>ds.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,bs),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 Hf;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 Ii(s.lineNumber,a.column),u=a.text,f=t(d,u);if(f===u.length&&s.parts.length===1){this.accept(e);return}const g=u.substring(0,f),p=this._positions.get(),C=p[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const b=ee.fromPositions(C,d),E=e.getModel().getValueInRange(b)+g,w=new Al(b,E),A=[w,...TC(this.textModel,p,w)],I=MD(A).map(M=>qi.fromPositions(M));e.executeEdits("inlineSuggestion.accept",A.map(M=>ds.replace(M.range,M.text))),e.setSelections(I,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const b=ee.fromPositions(r.range.getStartPosition(),Lv.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=Wd(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})}};zE=aH([PC(9,tn),PC(10,Us),PC(11,qs)],zE);var rl;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(rl||(rl={}));function TC(o,e,t){if(e.length===1)return[];const i=e[0],n=e.slice(1),s=t.range.getStartPosition(),r=t.range.getEndPosition(),a=o.getValueInRange(ee.fromPositions(i,r)),d=vD(i,s);if(d.lineNumber<1)return qn(new Hf(`positionWithinTextEdit line number should be bigger than 0.
|
|
36
|
+
Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const u=lH(t.text,d);return n.map(f=>{const g=PO(vD(f,s),r),p=o.getValueInRange(ee.fromPositions(f,g)),C=Np(a,p),b=ee.fromPositions(f,f.delta(0,C));return new Al(b,u)})}function lH(o,e){let t="";const i=X4(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 MD(o){const e=Z4.createSortPermutation(o,Mp(s=>s.range,ee.compareRangesUsingStarts)),i=new QA(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}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},RD=function(o,e){return function(t,i){e(t,i,o)}},X0;class Q9{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 ND extends Q9{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class dH extends Q9{constructor(){super("recentlyUsed"),this._cache=new Fp(300,.66),this._seq=0}memorize(e,t,i){const n=`${e.getLanguageId()}/${i.textLabel}`;this._cache.set(n,{touch:this._seq++,type:i.completion.kind,insertText:i.completion.insertText})}select(e,t,i){if(i.length===0)return 0;const n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,i);const s=i[0].score[0];let r=-1,a=-1,d=-1;for(let u=0;u<i.length&&i[u].score[0]===s;u++){const f=`${e.getLanguageId()}/${i[u].textLabel}`,g=this._cache.peek(f);if(g&&g.touch>d&&g.type===i[u].completion.kind&&g.insertText===i[u].completion.insertText&&(d=g.touch,a=u),i[u].completion.preselect&&r===-1)return r=u}return a!==-1?a:r!==-1?r:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:Qw.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class uH extends Q9{constructor(){super("recentlyUsedByPrefix"),this._trie=Y4.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:Qw.fromString(i.type),this._trie.set(t,i)}}}var Fc;let VE=(Fc=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Ht,this._persistSoon=new Ns(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===Vw.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=X0._strategyCtors.get(i)||ND;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,d=this._storageService.get(`${X0._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(`${X0._storagePrefix}/${this._strategy.name}`,i,t,1)}}},X0=Fc,Fc._strategyCtors=new Map([["recentlyUsedByPrefix",uH],["recentlyUsed",dH],["first",ND]]),Fc._storagePrefix="suggest/memories",Fc);VE=X0=cH([RD(0,Kc),RD(1,ss)],VE);const Bb=Rl("ISuggestMemories");Nl(Bb,VE,1);var hH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fH=function(o,e){return function(t,i){e(t,i,o)}},jE,au;let vm=(au=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=jE.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)}},jE=au,au.AtEnd=new wn("atEndOfWord",!1),au);vm=jE=hH([fH(1,Ln)],vm);var gH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},pH=function(o,e){return function(t,i){e(t,i,o)}},Y0,lu;let t0=(lu=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=Y0.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(Y0._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=Y0._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},Y0=lu,lu.OtherSuggestions=new wn("hasOtherSuggestions",!1),lu);t0=Y0=gH([pH(1,Ln)],t0);class xH{constructor(e,t,i,n){this._disposables=new Ht,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||!Yo(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new Fv;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 rr=class rr{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>rr._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>rr._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>=rr._maxRounds){e();break}if(!n){e();break}const d=i.bracketPairs.findNextBracket(n);if(!d){e();break}if(Date.now()-a>rr._maxDuration){setTimeout(()=>rr._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 lk,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>=rr._maxRounds&&s.size===0){e();break}if(!n){e();break}const u=i.bracketPairs.findPrevBracket(n);if(!u){e();break}if(Date.now()-d>rr._maxDuration){setTimeout(()=>rr._bracketsLeftYield(e,t+1,i,n,s,r));break}if(u.bracketInfo.isOpeningBracket){const g=u.bracketInfo.bracketText;let p=a.has(g)?a.get(g):0;if(p-=1,a.set(g,Math.max(0,p)),p<0){const C=s.get(g);if(C){const b=C.shift();C.size===0&&s.delete(g);const E=ee.fromPositions(u.range.getEndPosition(),b.getStartPosition()),w=ee.fromPositions(u.range.getStartPosition(),b.getEndPosition());r.push({range:E}),r.push({range:w}),rr._addBracketLeading(i,w,r)}}}else{const g=u.bracketInfo.getOpeningBrackets()[0].bracketText,p=a.has(g)?a.get(g):0;a.set(g,p+1)}n=u.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const n=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(n);s!==0&&s!==t.startColumn&&(i.push({range:ee.fromPositions(new Ii(n,s),t.getEndPosition())}),i.push({range:ee.fromPositions(new Ii(n,1),t.getEndPosition())}));const r=n-1;if(r>0){const a=e.getLineFirstNonWhitespaceColumn(r);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(r)&&(i.push({range:ee.fromPositions(new Ii(r,a),t.getEndPosition())}),i.push({range:ee.fromPositions(new Ii(r,1),t.getEndPosition())}))}}};rr._maxDuration=30,rr._maxRounds=2;let mm=rr;const Aa=class Aa{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return Aa.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return Aa.None;const[s]=await new mm().provideSelectionRanges(i,[n]);if(s.length===0)return Aa.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return Aa.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends Aa{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(Q4(g))return 2<<20;const p=Pv(g,ee.fromPositions(d),ee.compareRangesUsingStarts),C=p>=0?g[p]:g[Math.max(0,~p-1)];let b=s.length;for(const E of s){if(!ee.containsRange(E.range,C))break;b-=1}return b}}}};Aa.None=new class extends Aa{distance(){return 0}};let _m=Aa,OD=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class rc{constructor(e,t,i,n,s,r,a=ck.default,d=void 0){this.clipboardText=d,this._snippetCompareFn=rc._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=rc._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=rc._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?dk:J4;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=Rg.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=Rg.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;eL(f.completion.filterText,f.textLabel)===0?f.score=E:(f.score=tL(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?iL(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 rc._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 rc._compareCompletionItems(e,t)}}var vH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yl=function(o,e){return function(t,i){e(t,i,o)}},$E;class hd{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 mH(o,e,t){if(!e.getContextKeyValue(Oo.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(Oo.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function _H(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(Oo.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let bm=$E=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 Ht,this._triggerCharacterListener=new Ht,this._triggerQuickSuggest=new Ap,this._triggerState=void 0,this._completionDisposables=new Ht,this._onDidCancel=new an,this._onDidTrigger=new an,this._onDidSuggest=new an,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new qi(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(){uo(this._triggerCharacterListener),uo([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(!_H(this._editor,this._contextKeyService,this._configurationService)||hd.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="";sL(i.charCodeAt(i.length-1))?oL(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;Xh.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=xo.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!hd.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(!Xh.isAllOff(n)){if(!Xh.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(Xh.valueFor(n,r)!=="on")return}mH(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){Pn(this._editor.hasModel()),Pn(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new hd(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 hd(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let n={triggerKind:e.triggerKind??0};e.triggerCharacter&&(n={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new Zs;const s=this._editor.getOption(113);let r=1;switch(s){case"top":r=0;break;case"bottom":r=2;break}const{itemKind:a,showDeprecated:d}=$E.createSuggestFilter(this._editor),u=new ep(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=_m.create(this._editorWorkerService,this._editor),g=X9(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),u,n,this._requestToken.token);Promise.all([g,f]).then(async([E,w])=>{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 hd(I,this._editor.getPosition(),e),R={...ck.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new rc(E.items,this._context.column,{leadingLineContent:M.leadingLineContent,characterCountDelta:M.column-this._context.column},w,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(qn)}_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(eo(e.leadingLineContent)!==eo(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(hd.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=hd.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})}}}}};bm=$E=vH([Yl(1,Ol),Yl(2,l0),Yl(3,ua),Yl(4,Yu),Yl(5,Ln),Yl(6,ss),Yl(7,Pi),Yl(8,nL)],bm);const u_=class u_{constructor(e,t){this._disposables=new Ht,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)>u_._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()}};u_._maxSelectionLength=51200;let UE=u_;var bH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},MC=function(o,e){return function(t,i){e(t,i,o)}};let qE=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Ht,this.element=_i(e,wi(".suggest-status-bar"));const r=(a=>a instanceof Of?i.createInstance(rL,a,{useComma:!0}):void 0);this._leftActions=new Fg(this.element,{actionViewItemProvider:r}),this._rightActions=new Fg(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],n=[];for(const[s,r]of e.getActions())s==="left"?i.push(...r):n.push(...r);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(n)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};qE=bH([MC(2,tn),MC(3,Zu),MC(4,Ln)],qE);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},EH=function(o,e){return function(t,i){e(t,i,o)}};function J9(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let GE=class{constructor(e,t){this._editor=e,this._onDidClose=new an,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new an,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Ht,this._renderDisposeable=new Ht,this._borderWidth=1,this._size=new Zn(330,0),this.domNode=wi(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(u0,{editor:e}),this._body=wi(".body"),this._scrollbar=new uk(this._body,{alwaysConsumeMouseWheel:!0}),_i(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=_i(this._body,wi(".header")),this._close=_i(this._header,wi("span"+Rn.asCSSSelector(Qi.close))),this._close.title=S("details.close","Close"),this._type=_i(this._header,wi("p.type")),this._docs=_i(this._body,wi("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 lo().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!J9(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,Lr(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else Wa(this._type),this._type.title="",qo(this._type),this.domNode.classList.add("no-type");if(Wa(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),Wa(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 Zn(e,t);Zn.equals(i,this._size)||(this._size=i,aL(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}};GE=CH([EH(1,tn)],GE);class yH{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Ht,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new I9,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=Pp(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new Zn(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,$=new Zn(P,n.height-e.top-s.borderHeight-s.verticalPadding),Q=$.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:P-t.width,maxSizeTop:$,maxSizeBottom:Q,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),$=new Zn(P,n.height-e.top-s.borderHeight-s.verticalPadding),Q=$.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:P-t.width,maxSizeTop:$,maxSizeBottom:Q,minSize:r.with(Math.min(P,r.width))}})(),f=(function(){const P=e.left,V=-s.borderWidth+e.top+e.height,$=new Zn(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:V,left:P,fit:$.height-t.height,maxSizeBottom:$,maxSizeTop:$,minSize:r.with($.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 w=Math.max(p.maxSizeTop.height,p.maxSizeBottom.height);E>w&&(E=w);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 Oa;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Oa||(Oa={}));const wH=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Mx(o,e,t,i,n){if(Rn.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(jn.isUri(n))return[];const s=i===Oa.ROOT_FOLDER?["rootfolder-icon"]:i===Oa.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===Eo.data)r=Tv.parseMetaData(t).get(Tv.META_DATA_LABEL);else{const a=t.path.match(wH);a?(r=Rx(a[2].toLowerCase()),a[1]&&s.push(`${Rx(a[1].toLowerCase())}-name-dir-icon`)):r=Rx(t.authority.toLowerCase())}if(i===Oa.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===Oa.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=SH(o,e,t);a&&s.push(`${Rx(a)}-lang-file-icon`)}}return s}function SH(o,e,t){if(!t)return null;let i=null;if(t.scheme===Eo.data){const s=Tv.parseMetaData(t).get(Tv.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==Ng?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function Rx(o){return o.replace(/[\s]/g,"/")}var DH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RC=function(o,e){return function(t,i){e(t,i,o)}};function LB(o){return`suggest-aria-id:${o}`}const AH=vs("suggest-more-info",Qi.chevronRight,S("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var ta;const kH=new(ta=class{extract(e,t){if(e.textLabel.match(ta._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(ta._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=ta._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},ta._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*\))/,ta._regexStrict=new RegExp(`^${ta._regexRelaxed.source}$`,"i"),ta);let KE=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new an,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Ht,i=e;i.classList.add("show-file-icons");const n=_i(e,wi(".icon")),s=_i(n,wi("span.colorspan")),r=_i(e,wi(".contents")),a=_i(r,wi(".main")),d=_i(a,wi(".icon-label.codicon")),u=_i(a,wi("span.left")),f=_i(a,wi("span.right")),g=new FA(u,{supportHighlights:!0,supportIcons:!0});t.add(g);const p=_i(u,wi("span.signature-label")),C=_i(u,wi("span.qualifier-label")),b=_i(f,wi("span.details-label")),E=_i(f,wi("span.readMore"+Rn.asCSSSelector(AH)));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,$=I.fontWeight,Q=I.letterSpacing,re=`${P}px`,he=`${V}px`,Z=`${Q}px`;i.style.fontSize=re,i.style.fontWeight=$,i.style.letterSpacing=Z,a.style.fontFamily=M,a.style.fontFeatureSettings=R,a.style.lineHeight=he,n.style.height=he,n.style.width=he,E.style.height=he,E.style.width=he}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=LB(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:Q_(e.score)},r=[];if(n.kind===19&&kH.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=Mx(this._modelService,this._languageService,jn.from({scheme:"fake",path:e.textLabel}),Oa.FILE),d=Mx(this._modelService,this._languageService,jn.from({scheme:"fake",path:n.detail}),Oa.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=[Mx(this._modelService,this._languageService,jn.from({scheme:"fake",path:e.textLabel}),Oa.FOLDER),Mx(this._modelService,this._languageService,jn.from({scheme:"fake",path:n.detail}),Oa.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Rn.asClassNameArray(Qw.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=NC(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=NC(n.label.detail||""),i.detailsLabel.textContent=NC(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Lr(i.detailsLabel):qo(i.detailsLabel),J9(e)?(i.right.classList.add("can-expand-details"),Lr(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"),qo(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};KE=DH([RC(1,mo),RC(2,ha),RC(3,Wr)],KE);function NC(o){return o.replace(/\r\n|\r|\n/g,"")}var BH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nx=function(o,e){return function(t,i){e(t,i,o)}},Wh;Si("editorSuggestWidget.background",hk,S("editorSuggestWidgetBackground","Background color of the suggest widget."));Si("editorSuggestWidget.border",lL,S("editorSuggestWidgetBorder","Border color of the suggest widget."));const FH=Si("editorSuggestWidget.foreground",Rp,S("editorSuggestWidgetForeground","Foreground color of the suggest widget."));Si("editorSuggestWidget.selectedForeground",fk,S("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));Si("editorSuggestWidget.selectedIconForeground",cL,S("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const LH=Si("editorSuggestWidget.selectedBackground",gk,S("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));Si("editorSuggestWidget.highlightForeground",pk,S("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));Si("editorSuggestWidget.focusHighlightForeground",dL,S("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));Si("editorSuggestWidgetStatus.foreground",za(FH,.5),S("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class IH{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Hr}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(Zn.is(t))return Zn.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}var Lc;let ZE=(Lc=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 Ap,this._disposables=new Ht,this._onDidSelect=new QS,this._onDidFocus=new QS,this._onDidHide=new an,this._onDidShow=new an,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new an,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new I9,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new PH(this,e),this._persistedSize=new IH(t,e);class r{constructor(C,b,E=!1,w=!1){this.persistedSize=C,this.currentSize=b,this.persistHeight=E,this.persistWidth=w}}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:w}=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)??w.height),(!a.persistWidth||Math.abs(a.currentSize.width-I)<=A)&&(I=((b=a.persistedSize)==null?void 0:b.width)??w.width),this._persistedSize.store(new Zn(I,M))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=_i(this.element.domNode,wi(".message")),this._listElement=_i(this.element.domNode,wi(".tree"));const d=this._disposables.add(s.createInstance(GE,this.editor));d.onDidClose(this.toggleDetails,this,this._disposables),this._details=new yH(d,this.editor);const u=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);u();const f=s.createInstance(KE,this.editor);this._disposables.add(f),this._disposables.add(f.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Hw("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,w=Xw("{0}{1}",E||"",b?typeof b=="string"?b:b.value:"");return S("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",C,w)}}}),this._list.style(xk({listInactiveFocusBackground:LH,listInactiveFocusOutline:Bu})),this._status=s.createInstance(qE,this.element.domNode,Cc);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=Xi.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Xi.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Xi.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Xi.HasFocusedSuggestion.bindTo(i),this._disposables.add(Dl(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=Lg(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=Ks(async s=>{const r=Bg(()=>{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:LB(i)}))}).catch(qn)),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:qo(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=Wh.LOADING_MESSAGE,qo(this._listElement,this._status.element),Lr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Tf(Wh.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Wh.NO_SUGGESTIONS_MESSAGE,qo(this._listElement,this._status.element),Lr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Tf(Wh.NO_SUGGESTIONS_MESSAGE);break;case 3:qo(this._messageElement),Lr(this._listElement,this._status.element),this._show();break;case 4:qo(this._messageElement),Lr(this._listElement,this._status.element),this._show();break;case 5:qo(this._messageElement),Lr(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=Bg(()=>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=JS(Id(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")):(J9(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=JS(Id(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=Pp(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 Zn(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=wo(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),w=p.top+C.top-i.verticalPadding,A=Math.min(w,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&&w>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 Zn(u,i.defaultSize.height),this.element.maxSize=new Zn(d,I),this.element.minSize=new Zn(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=uL(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 Zn(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}},Wh=Lc,Lc.LOADING_MESSAGE=S("suggestWidget.loading","Loading..."),Lc.NO_SUGGESTIONS_MESSAGE=S("suggestWidget.noSuggestions","No suggestions."),Lc);ZE=Wh=BH([Nx(1,Kc),Nx(2,Ln),Nx(3,Wr),Nx(4,tn)],ZE);class PH{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 Zn(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 TH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ah=function(o,e){return function(t,i){e(t,i,o)}},XE;class MH{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(ee.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}var cu;let Pr=(cu=class{static get(e){return e.getContribution(XE.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 Ht,this._selectors=new RH(g=>g.priority),this._onWillInsertSuggestItem=new an,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(bm,this.editor),this._selectors.register({priority:0,select:(g,p,C)=>this._memoryService.select(g,p,C)});const d=Xi.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 rC(Id(e.getDomNode()),()=>{const g=this._instantiationService.createInstance(ZE,this.editor);this._toDispose.add(g),this._toDispose.add(g.onDidSelect(w=>this._insertSuggestion(w,0),this));const p=new xH(this.editor,g,this.model,w=>this._insertSuggestion(w,2));this._toDispose.add(p);const C=Xi.MakesTextEdit.bindTo(this._contextKeyService),b=Xi.HasInsertAndReplaceRange.bindTo(this._contextKeyService),E=Xi.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(is(()=>{C.reset(),b.reset(),E.reset()})),this._toDispose.add(g.onDidFocus(({item:w})=>{const A=this.editor.getPosition(),I=w.editStart.column,M=A.column;let R=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!w.completion.additionalTextEdits&&!(w.completion.insertTextRules&4)&&M-I===w.completion.insertText.length&&(R=this.editor.getModel().getValueInRange({startLineNumber:A.lineNumber,startColumn:I,endLineNumber:A.lineNumber,endColumn:M})!==w.completion.insertText),C.set(R),b.set(!Ii.equals(w.editInsertEnd,w.editReplaceEnd)),E.set(!!w.provider.resolveCompletionItem||!!w.completion.documentation||w.completion.detail!==w.completion.label)})),this._toDispose.add(g.onDetailsKeyDown(w=>{if(w.toKeyCodeChord().equals(new e8(!0,!1,!1,!1,33))||$a&&w.toKeyCodeChord().equals(new e8(!1,!1,!1,!0,33))){w.stopPropagation();return}w.toKeyCodeChord().isModifierKey()||this.editor.focus()})),g})),this._overtypingCapturer=this._toDispose.add(new rC(Id(e.getDomNode()),()=>this._toDispose.add(new UE(this.editor,this.model)))),this._alternatives=this._toDispose.add(new rC(Id(e.getDomNode()),()=>this._toDispose.add(new t0(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(vm,e)),this._toDispose.add(this.model.onDidTrigger(g=>{this.widget.value.showTriggered(g.auto,g.shy?250:50),this._lineSuffix.value=new MH(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=Xi.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=xo.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],d=new Zs;t&1||this.editor.pushUndoStop();const u=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const f=r.isResolved;let g=-1,p=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const b=Mf.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(E=>{let w=ee.lift(E.range);if(w.startLineNumber===r.position.lineNumber&&w.startColumn>r.position.column){const A=this.editor.getPosition().column-r.position.column,I=A,M=ee.spansMultipleLines(w)?0:A;w=new ee(w.startLineNumber,w.startColumn+I,w.endLineNumber,w.endColumn+M)}return ds.replaceMove(w,E.text)})),b.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!f){const b=new Ho;let E;const w=n.onDidChangeContent(R=>{if(R.isFlush){d.cancel(),w.dispose();return}for(const P of R.changes){const V=ee.getEndPosition(P.range);(!E||Ii.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=>Ii.isBefore(E,ee.getStartPosition(P.range))))return!1;I&&this.editor.pushUndoStop();const R=Mf.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(P=>ds.replaceMove(ee.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(()=>{w.dispose(),M.dispose()}))}let{insertText:C}=r.completion;if(r.completion.insertTextRules&4||(C=Nu.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===Cm.id)this.model.trigger({auto:!0,retrigger:!0});else{const b=new Ho;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(E=>{r.completion.extensionId?bs(E):qn(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:qA(Ua(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:hL(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:g})}getOverwriteInfo(e,t){Pn(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(Yo(e.completion.additionalTextEdits)){const t=S("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);Nr(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};Rs.once(this.model.onDidTrigger)(s=>{const r=[];Rs.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{uo(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(uo(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)}},XE=cu,cu.ID="editor.contrib.suggestController",cu);Pr=XE=TH([Ah(1,Bb),Ah(2,Us),Ah(3,Ln),Ah(4,tn),Ah(5,Yu),Ah(6,ua)],Pr);class RH{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}const h_=class h_ extends wt{constructor(){super({id:h_.id,label:S("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:Ze.and(q.writable,q.hasCompletionItemProvider,Xi.Visible.toNegated()),kbOpts:{kbExpr:q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Pr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};h_.id="editor.action.triggerSuggest";let Cm=h_;un(Pr.ID,Pr,2);Re(Cm);const tr=190,_o=ko.bindToContribution(Pr.get);Ri(new _o({id:"acceptSelectedSuggestion",precondition:Ze.and(Xi.Visible,Xi.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Ze.and(Xi.Visible,q.textInputFocus),weight:tr},{primary:3,kbExpr:Ze.and(Xi.Visible,q.textInputFocus,Xi.AcceptSuggestionsOnEnter,Xi.MakesTextEdit),weight:tr}],menuOpts:[{menuId:Cc,title:S("accept.insert","Insert"),group:"left",order:1,when:Xi.HasInsertAndReplaceRange.toNegated()},{menuId:Cc,title:S("accept.insert","Insert"),group:"left",order:1,when:Ze.and(Xi.HasInsertAndReplaceRange,Xi.InsertMode.isEqualTo("insert"))},{menuId:Cc,title:S("accept.replace","Replace"),group:"left",order:1,when:Ze.and(Xi.HasInsertAndReplaceRange,Xi.InsertMode.isEqualTo("replace"))}]}));Ri(new _o({id:"acceptAlternativeSelectedSuggestion",precondition:Ze.and(Xi.Visible,q.textInputFocus,Xi.HasFocusedSuggestion),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:Cc,group:"left",order:2,when:Ze.and(Xi.HasInsertAndReplaceRange,Xi.InsertMode.isEqualTo("insert")),title:S("accept.replace","Replace")},{menuId:Cc,group:"left",order:2,when:Ze.and(Xi.HasInsertAndReplaceRange,Xi.InsertMode.isEqualTo("replace")),title:S("accept.insert","Insert")}]}));Qn.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Ri(new _o({id:"hideSuggestWidget",precondition:Xi.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:9,secondary:[1033]}}));Ri(new _o({id:"selectNextSuggestion",precondition:Ze.and(Xi.Visible,Ze.or(Xi.MultipleSuggestions,Xi.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));Ri(new _o({id:"selectNextPageSuggestion",precondition:Ze.and(Xi.Visible,Ze.or(Xi.MultipleSuggestions,Xi.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:12,secondary:[2060]}}));Ri(new _o({id:"selectLastSuggestion",precondition:Ze.and(Xi.Visible,Ze.or(Xi.MultipleSuggestions,Xi.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));Ri(new _o({id:"selectPrevSuggestion",precondition:Ze.and(Xi.Visible,Ze.or(Xi.MultipleSuggestions,Xi.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Ri(new _o({id:"selectPrevPageSuggestion",precondition:Ze.and(Xi.Visible,Ze.or(Xi.MultipleSuggestions,Xi.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:11,secondary:[2059]}}));Ri(new _o({id:"selectFirstSuggestion",precondition:Ze.and(Xi.Visible,Ze.or(Xi.MultipleSuggestions,Xi.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));Ri(new _o({id:"focusSuggestion",precondition:Ze.and(Xi.Visible,Xi.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Ri(new _o({id:"focusAndAcceptSuggestion",precondition:Ze.and(Xi.Visible,Xi.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));Ri(new _o({id:"toggleSuggestionDetails",precondition:Ze.and(Xi.Visible,Xi.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:Cc,group:"right",order:1,when:Ze.and(Xi.DetailsVisible,Xi.CanResolve),title:S("detail.more","Show Less")},{menuId:Cc,group:"right",order:1,when:Ze.and(Xi.DetailsVisible.toNegated(),Xi.CanResolve),title:S("detail.less","Show More")}]}));Ri(new _o({id:"toggleExplainMode",precondition:Xi.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Ri(new _o({id:"toggleSuggestionFocus",precondition:Xi.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2570,mac:{primary:778}}}));Ri(new _o({id:"insertBestCompletion",precondition:Ze.and(q.textInputFocus,Ze.equals("config.editor.tabCompletion","on"),vm.AtEnd,Xi.Visible.toNegated(),t0.OtherSuggestions.toNegated(),xo.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(GA(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:tr,primary:2}}));Ri(new _o({id:"insertNextSuggestion",precondition:Ze.and(q.textInputFocus,Ze.equals("config.editor.tabCompletion","on"),t0.OtherSuggestions,Xi.Visible.toNegated(),xo.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2}}));Ri(new _o({id:"insertPrevSuggestion",precondition:Ze.and(q.textInputFocus,Ze.equals("config.editor.tabCompletion","on"),t0.OtherSuggestions,Xi.Visible.toNegated(),xo.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:1026}}));Re(class extends wt{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=Pr.get(e))==null||t.resetWidgetSize()}});class NH extends zt{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 an),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=Pr.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?Wd(g,f):void 0;if(!p)return-1;const C=Ii.lift(d),b=u.map((w,A)=>{const I=vg.fromSuggestion(n,f,C,w,this.isShiftKeyPressed),M=Wd(I.toSingleTextEdit(),f),R=FB(p,M);return{index:A,valid:R,prefixLength:M.text.length,suggestItem:w}}).filter(w=>w&&w.valid&&w.prefixLength>0),E=fL(b,Mp(w=>w.prefixLength,Y_));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(Rs.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=vg.fromSuggestion(n,u,d,a.item,this.isShiftKeyPressed);this.onWillAccept(f)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!OH(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Pr.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 vg.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Pr.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Pr.get(this.editor);e==null||e.forceRenderingAbove()}}class vg{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const u=new Nu().parse(r);u.children.length<100&&xm.adjustWhitespace(t,i,!0,u),r=u.toString(),a=!0}const d=e.getOverwriteInfo(n,s);return new vg(ee.fromPositions(i.delta(0,-d.overwriteBefore),i.delta(0,Math.max(d.overwriteAfter,0))),r,n.completion.kind,a)}constructor(e,t,i,n){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=n}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new gL(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Al(this.range,this.insertText)}}function OH(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var HH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nl=function(o,e){return function(t,i){e(t,i,o)}},YE,du;let fr=(du=class extends zt{static get(e){return e.getContribution(YE.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=Ia(this.editor),this._positions=Wn(this,p=>{var C;return((C=this._editorObs.selections.read(p))==null?void 0:C.map(b=>b.getEndPosition()))??[new Ii(1,1)]}),this._suggestWidgetAdaptor=this._register(new NH(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=Po(this,p=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(C=>p(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Po(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Po(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Po(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=Wn(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=Wc(this,p=>{if(this._editorObs.isReadonly.read(p))return;const C=this._editorObs.model.read(p);return C?this._instantiationService.createInstance(zE,C,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Po(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Po(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Po(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=Wn(this,p=>{const C=this.model.read(p);return(C==null?void 0:C.ghostTexts.read(p))??[]}),this._stablizedGhostTexts=WH(this._ghostTexts,this._store),this._ghostTextWidgets=pL(this,this._stablizedGhostTexts,(p,C)=>C.add(this._instantiationService.createInstance(HE,this.editor,{ghostText:p,minReservedLineCount:pl(0),targetTextModel:this.model.map(b=>b==null?void 0:b.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=Yw(this),this._fontFamily=Po(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new Oo(this._contextKeyService,this.model)),this._register(t8(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([ev.Tab.id,ev.DeleteLeft.id,ev.DeleteRight.id,H5,"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(t8(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||Zf.dropDownVisible||Xu(p=>{var C;(C=this.model.get())==null||C.stop(p)})})),this._register(rs(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(is(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const g=Z_(this,(p,C)=>{var w;const b=this.model.read(p),E=b==null?void 0:b.state.read(p);return this._suggestWidgetSelectedItem.get()?C:(w=E==null?void 0:E.inlineCompletion)==null?void 0:w.semanticId});this._register(xL(Wn(p=>(this._playAccessibilitySignal.read(p),g.read(p),{})),async(p,C,b)=>{const E=this.model.get(),w=E==null?void 0:E.state.get();if(!w||!E)return;const A=E.textModel.getLineContent(w.primaryGhostText.lineNumber);await ib(50,f1(b)),await vL(this._suggestWidgetSelectedItem,$0,()=>!1,f1(b)),await this._accessibilitySignalService.playSignal(ZA.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(w.primaryGhostText.renderForScreenReader(A))})),this._register(new sE(this.editor,this.model,this._instantiationService)),this._register(FO(Wn(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())),Nr(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 Ii(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},YE=du,du.ID="editor.contrib.inlineCompletionsController",du);fr=YE=HH([nl(1,tn),nl(2,Ln),nl(3,ss),nl(4,Us),nl(5,gr),nl(6,Pi),nl(7,KA),nl(8,As),nl(9,X_)],fr);function WH(o,e){const t=Qo("result",[]),i=[];return e.add(rs(n=>{const s=o.read(n);Xu(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=Qo("item",s[a]));t.set([...i],r)}i.forEach((a,d)=>a.set(s[d],r))})})),t}const f_=class f_ extends wt{constructor(){super({id:f_.ID,label:S("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Ze.and(q.writable,Oo.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=fr.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};f_.ID=z5;let QE=f_;const g_=class g_ extends wt{constructor(){super({id:g_.ID,label:S("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Ze.and(q.writable,Oo.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=fr.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};g_.ID=W5;let JE=g_;class zH extends wt{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:S("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:q.writable})}async run(e,t){const i=fr.get(t);await vk(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 VH extends wt{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:Ze.and(q.writable,Oo.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Ze.and(q.writable,Oo.inlineSuggestionVisible)},menuOpts:[{menuId:gi.InlineSuggestionToolbar,title:S("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=fr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class jH extends wt{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:Ze.and(q.writable,Oo.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:gi.InlineSuggestionToolbar,title:S("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=fr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class $H extends wt{constructor(){super({id:H5,label:S("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:Oo.inlineSuggestionVisible,menuOpts:[{menuId:gi.InlineSuggestionToolbar,title:S("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Ze.and(Oo.inlineSuggestionVisible,q.tabMovesFocus.toNegated(),Oo.inlineSuggestionHasIndentationLessThanTabSize,Xi.Visible.toNegated(),q.hoverFocused.toNegated())}})}async run(e,t){var n;const i=fr.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const p_=class p_ extends wt{constructor(){super({id:p_.ID,label:S("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:Oo.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=fr.get(t);Xu(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};p_.ID="editor.action.inlineSuggest.hide";let ey=p_;const x_=class x_ extends Ao{constructor(){super({id:x_.ID,title:S("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:gi.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Ze.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(ss),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};x_.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let ty=x_;var UH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},H0=function(o,e){return function(t,i){e(t,i,o)}};class qH{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 iy=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=fr.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 cv(1e3,this,ee.fromPositions(this._editor.getModel().validatePosition(n.positionBefore||n.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new cv(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new cv(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=fr.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new qH(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Ht,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(Zf,this._editor,!1,pl(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 zu([d])}renderScreenReaderText(e,t){const i=new Ht,n=wi,s=n("div.hover-row.markdown-hover"),r=_i(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new u0({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 lo().appendText(f).appendCodeblock("text",u)));r.replaceChildren(g.element)};return i.add(rs(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 kv(r)})),e.fragment.appendChild(s),i}};iy=UH([H0(1,ha),H0(2,da),H0(3,X_),H0(4,tn),H0(5,ua)],iy);class GH{}const Fb=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}};un(fr.ID,fr,3);Re(zH);Re(QE);Re(JE);Re(VH);Re(jH);Re($H);Re(ey);Vn(ty);th.register(iy);Fb.register(new GH);var KH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},OC=function(o,e){return function(t,i){e(t,i,o)}},Q0,Ic;let tp=(Ic=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Ht,this.toUnhookForKeyboard=new Ht,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Eb(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=>{qn(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(Q0.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 mk(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Ks(a=>this.findDefinition(e,a));let n;try{n=await this.previousPromise}catch(a){qn(a);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?ee.lift(n[0].originSelectionRange):new ee(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:d}of n)d&&(a=ee.plusRange(a,d));this.addDecoration(a,new lo().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 lo().appendCodeblock(p||"",g):void 0),d.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Q0.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+Q0.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new ee(t,1,s+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){var i;return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(((i=e.target.detail.injectedText)==null?void 0:i.options)instanceof Zw)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Xp(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 Qp({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(Ln);return So.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},Q0=Ic,Ic.ID="editor.contrib.gotodefinitionatposition",Ic.MAX_SOURCE_PREVIEW_LINES=8,Ic);tp=Q0=KH([OC(1,fa),OC(2,ha),OC(3,Pi)],tp);un(tp.ID,tp,2);var IB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Em=function(o,e){return function(t,i){e(t,i,o)}};class HD{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let ny=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new an,this.onDidChange=this._onDidChange.event,this._dispoables=new Ht,this._markers=[],this._nextIdx=-1,jn.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=i8(a.resource.toString(),d.resource.toString());return u===0&&(n==="position"?u=ee.compareRangesUsingStarts(a,d)||ho.compare(a.severity,d.severity):u=ho.compare(a.severity,d.severity)||ee.compareRangesUsingStarts(a,d)),u},r=()=>{this._markers=this._markerService.read({resource:jn.isUri(e)?e:void 0,severities:ho.Error|ho.Warning|ho.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 HD(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=Pv(this._markers,{resource:e.uri},(r,a)=>i8(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=ee.lift(this._markers[r]);if(a.isEmpty()){const d=e.getWordAtPosition(a.getStartPosition());d&&(a=new ee(a.startLineNumber,d.startColumn,a.startLineNumber,d.endColumn))}if(t&&(a.containsPosition(t)||t.isBeforeOrEqual(a.getStartPosition()))){this._nextIdx=r,n=!0;break}if(this._markers[r].resource.toString()!==e.uri.toString())break}n||(this._nextIdx=i?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const n=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex(n=>n.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(ee.containsPosition(this._markers[i],t))return new HD(this._markers[i],i+1,this._markers.length)}}};ny=IB([Em(1,zw),Em(2,ss)],ny);const PB=Rl("IMarkerNavigationService");let sy=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new lk}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new ny(e,this._markerService,this._configService)}};sy=IB([Em(0,zw),Em(1,ss)],sy);Nl(PB,sy,1);var oy;(function(o){function e(t){switch(t){case vx.Ignore:return"severity-ignore "+Rn.asClassName(Qi.info);case vx.Info:return Rn.asClassName(Qi.info);case vx.Warning:return Rn.asClassName(Qi.warning);case vx.Error:return Rn.asClassName(Qi.error);default:return""}}o.className=e})(oy||(oy={}));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},kh=function(o,e){return function(t,i){e(t,i,o)}},ry;class XH{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 Ht,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(Dl(this._relatedBlock,"click",a=>{a.preventDefault();const d=this._relatedDiagnostics.get(a.target);d&&i(d)})),this._scrollable=new wL(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(){uo(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=tb(i);this._lines=a.length,this._longestLineLength=0;for(const p of a)this._longestLineLength=Math.max(p.length+r,this._longestLineLength);Wa(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=wi("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=_i(this._codeLink,wi("span"));C.innerText=s.value,p.appendChild(this._codeLink)}}if(Wa(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Yo(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 w=document.createElement("span");w.innerText=C.message,b.appendChild(E),b.appendChild(w),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 ho.Error:t=S("Error","Error");break;case ho.Warning:t=S("Warning","Warning");break;case ho.Info:t=S("Info","Info");break;case ho.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 uu;let ip=(uu=class extends Jv{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 Ht,this._onDidSelectRelatedInformation=new an,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=ho.Warning,this._backgroundColor=vn.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(eW);let t=ay,i=YH;this._severity===ho.Warning?(t=fv,i=QH):this._severity===ho.Info&&(t=ly,i=JH);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(Y5),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(ry.TitleMenu,this._contextKeyService);$w(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=_i(e,wi(""))}_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 XH(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const n=ee.lift(e),s=this.editor.getPosition(),r=s&&n.containsPosition(s)?s:n.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const d=i>1?S("problems","{0} of {1} problems",t,i):S("change","{0} of {1} problem",t,i);this.setTitle(Ua(a.uri),d)}this._icon.className=`codicon ${oy.className(ho.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()}},ry=uu,uu.TitleMenu=new gi("gotoErrorTitleMenu"),uu);ip=ry=ZH([kh(1,Wr),kh(2,da),kh(3,Zu),kh(4,tn),kh(5,Ln),kh(6,Mg)],ip);const WD=Jw(_L,mL),zD=Jw(CL,bL),VD=Jw(a1,EL),ay=Si("editorMarkerNavigationError.background",{dark:WD,light:WD,hcDark:Sl,hcLight:Sl},S("editorMarkerNavigationError","Editor marker navigation widget error color.")),YH=Si("editorMarkerNavigationError.headerBackground",{dark:za(ay,.1),light:za(ay,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),fv=Si("editorMarkerNavigationWarning.background",{dark:zD,light:zD,hcDark:Sl,hcLight:Sl},S("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),QH=Si("editorMarkerNavigationWarning.headerBackground",{dark:za(fv,.1),light:za(fv,.1),hcDark:"#0C141F",hcLight:za(fv,.2)},S("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),ly=Si("editorMarkerNavigationInfo.background",{dark:VD,light:VD,hcDark:Sl,hcLight:Sl},S("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),JH=Si("editorMarkerNavigationInfo.headerBackground",{dark:za(ly,.1),light:za(ly,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),eW=Si("editorMarkerNavigation.background",yL,S("editorMarkerNavigationBackground","Editor marker navigation widget background."));var tW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ox=function(o,e){return function(t,i){e(t,i,o)}},J0,hu;let $u=(hu=class{static get(e){return e.getContribution(J0.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Ht,this._editor=e,this._widgetVisible=TB.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(ip,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{var n,s,r;(!((n=this._model)!=null&&n.selected)||!ee.containsPosition((s=this._model)==null?void 0:s.selected.marker,i.position))&&((r=this._model)==null||r.resetIndex())})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:ee.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new Ii(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=J0.get(r))==null||i.close(),(n=J0.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},J0=hu,hu.ID="editor.contrib.markerController",hu);$u=J0=tW([Ox(1,PB),Ox(2,Ln),Ox(3,Cs),Ox(4,tn)],$u);class Lb extends wt{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=$u.get(t))==null||i.nagivate(this._next,this._multiFile))}}const bd=class bd extends Lb{constructor(){super(!0,!1,{id:bd.ID,label:bd.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:578,weight:100},menuOpts:{menuId:ip.TitleMenu,title:bd.LABEL,icon:vs("marker-navigation-next",Qi.arrowDown,S("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};bd.ID="editor.action.marker.next",bd.LABEL=S("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let ym=bd;const Cd=class Cd extends Lb{constructor(){super(!1,!1,{id:Cd.ID,label:Cd.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:1602,weight:100},menuOpts:{menuId:ip.TitleMenu,title:Cd.LABEL,icon:vs("marker-navigation-previous",Qi.arrowUp,S("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};Cd.ID="editor.action.marker.prev",Cd.LABEL=S("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let cy=Cd;class iW extends Lb{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:q.focus,primary:66,weight:100},menuOpts:{menuId:gi.MenubarGoMenu,title:S({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class nW extends Lb{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:q.focus,primary:1090,weight:100},menuOpts:{menuId:gi.MenubarGoMenu,title:S({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}un($u.ID,$u,4);Re(ym);Re(cy);Re(iW);Re(nW);const TB=new wn("markersNavigationVisible",!1),sW=ko.bindToContribution($u.get);Ri(new sW({id:"closeMarkersNavigation",precondition:TB,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:q.focus,primary:9,secondary:[1033]}}));var Kr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(Kr||(Kr={}));class oW extends wt{constructor(){super({id:O5,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:Fi("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:[Kr.NoAutoFocus,Kr.FocusIfVisible,Kr.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:Kr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=ro.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=Kr.FocusIfVisible;Object.values(Kr).includes(s)?r=s:typeof s=="boolean"&&s&&(r=Kr.AutoFocusImmediately);const a=u=>{const f=t.getPosition(),g=new ee(f.lineNumber,f.column,f.lineNumber,f.column);n.showContentHover(g,1,1,u)},d=t.getOption(2)===2;n.isHoverVisible?r!==Kr.NoAutoFocus?n.focus():a(d):a(d||r===Kr.AutoFocusImmediately)}}class rW extends wt{constructor(){super({id:yM,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:Fi("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=ro.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new ee(n.lineNumber,n.column,n.lineNumber,n.column),r=tp.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class aW extends wt{constructor(){super({id:wM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:16,weight:100},metadata:{description:Fi("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollUp()}}class lW extends wt{constructor(){super({id:SM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:18,weight:100},metadata:{description:Fi("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollDown()}}class cW extends wt{constructor(){super({id:DM,label:S({key:"scrollLeftHover",comment:["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:15,weight:100},metadata:{description:Fi("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollLeft()}}class dW extends wt{constructor(){super({id:AM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:17,weight:100},metadata:{description:Fi("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollRight()}}class uW extends wt{constructor(){super({id:kM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:Fi("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.pageUp()}}class hW extends wt{constructor(){super({id:BM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:Fi("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.pageDown()}}class fW extends wt{constructor(){super({id:FM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:Fi("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.goToTop()}}class gW extends wt{constructor(){super({id:LM,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:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:Fi("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.goToBottom()}}class pW extends wt{constructor(){super({id:_b,label:IM,alias:"Increase Hover Verbosity Level",precondition:q.hoverVisible})}run(e,t,i){const n=ro.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(ur.Increase,s,i==null?void 0:i.focus)}}class xW extends wt{constructor(){super({id:bb,label:PM,alias:"Decrease Hover Verbosity Level",precondition:q.hoverVisible})}run(e,t,i){var r;const n=ro.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=ro.get(t))==null||r.updateHoverVerbosityLevel(ur.Decrease,s,i==null?void 0:i.focus)}}var vW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}};const _r=wi;class mW{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 jD={type:1,filter:{include:Xn.QuickFix},triggerAction:Wo.QuickFixHover};let dy=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];for(const a of t){const d=a.range.startLineNumber===n?a.range.startColumn:1,u=a.range.endLineNumber===n?a.range.endColumn:s,f=this._markerDecorationsService.getMarker(i.uri,a);if(!f)continue;const g=new ee(e.range.startLineNumber,d,e.range.startLineNumber,u);r.push(new mW(this,g,f))}return r}renderHoverParts(e,t){if(!t.length)return new zu([]);const i=new Ht,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)=>ho.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new zu(n)}_renderMarkerHover(e){const t=new Ht,i=_r("div.hover-row"),n=_i(i,_r("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:d}=e.marker;this._editor.applyFontInfo(n);const u=_i(n,_r("span"));if(u.style.whiteSpace="pre-wrap",u.innerText=r,s||a)if(a&&typeof a!="string"){const g=_r("span");if(s){const E=_i(g,_r("span"));E.innerText=s}const p=_i(g,_r("a.code-link"));p.setAttribute("href",a.target.toString()),t.add(Fn(p,"click",E=>{this._openerService.open(a.target,{allowCommands:!0}),E.preventDefault(),E.stopPropagation()}));const C=_i(p,_r("span"));C.innerText=a.value;const b=_i(n,g);b.style.opacity="0.6",b.style.paddingLeft="6px"}else{const g=_i(n,_r("span"));g.style.opacity="0.6",g.style.paddingLeft="6px",g.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(Yo(d))for(const{message:g,resource:p,startLineNumber:C,startColumn:b}of d){const E=_i(n,_r("div"));E.style.marginTop="8px";const w=_i(E,_r("a"));w.innerText=`${Ua(p)}(${C}, ${b}): `,w.style.cursor="pointer",t.add(Fn(w,"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(qn)}}));const A=_i(E,_r("span"));A.innerText=g,this._editor.applyFontInfo(A)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===ho.Error||t.marker.severity===ho.Warning||t.marker.severity===ho.Info){const n=$u.get(this._editor);n&&e.statusBar.addAction({label:S("view problem","View Problem"),commandId:ym.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(_r("div"));this.recentMarkerCodeActionsInfo&&(n8.makeKey(this.recentMarkerCodeActionsInfo.marker)===n8.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?zt.None:Bg(()=>n.textContent=S("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(is(()=>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(is(()=>{d||a.dispose()})),e.statusBar.addAction({label:S("quick fixes","Quick Fix..."),commandId:k9,run:u=>{d=!0;const f=Gf.get(this._editor),g=wo(u);e.hide(),f==null||f.showCodeActions(jD,a,{x:g.left,y:g.top,width:g.width,height:g.height})}})},qn)}}getCodeActions(e){return Ks(t=>qh(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ee(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),jD,gl.None,t))}};dy=vW([HC(1,SL),HC(2,da),HC(3,Pi)],dy);class _W{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=Dv.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)??Dv.Center;if(!n&&a!==this._laneOrLine)continue;const d=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!d||Tg(d)||i.push(...BA(d).map(e))}return i}}var bW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$D=function(o,e){return function(t,i){e(t,i,o)}},uy;const UD=wi;var fu;let hy=(fu=class extends zt{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Ht),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new kA),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new u0({editor:this._editor},t,i)),this._computer=new _W(this._editor),this._hoverOperation=this._register(new V5(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(Dl(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return uy.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=UD("div.hover-row.markdown-hover"),r=_i(s,UD("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||!Cb(t,e.x,e.y))&&this.hide()}},uy=fu,fu.ID="editor.contrib.modesGlyphHoverWidget",fu);hy=uy=bW([$D(1,ha),$D(2,da)],hy);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},EW=function(o,e){return function(t,i){e(t,i,o)}},Sf;let wm=(Sf=class extends zt{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Ht,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Ns(()=>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?Cb(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(hy,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},Sf.ID="editor.contrib.marginHover",Sf);wm=CW([EW(1,tn)],wm);class yW{}class wW{}class SW{}un(ro.ID,ro,2);un(wm.ID,wm,2);Re(oW);Re(rW);Re(aW);Re(lW);Re(cW);Re(dW);Re(uW);Re(hW);Re(fW);Re(gW);Re(pW);Re(xW);th.register(Xg);th.register(dy);G_((o,e)=>{const t=o.getColor(DL);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)}; }`))});Fb.register(new yW);Fb.register(new wW);Fb.register(new SW);function Io(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function mg(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 MB(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 AL(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,w)=>(w=w||1,Wf.shiftIndent(E,E.length+w,r,a,d)),f=(E,w)=>(w=w||1,Wf.unshiftIndent(E,E.length+w,r,a,d)),g=[],p=o.getLineContent(t);let C=eo(p),b=C;s.shouldIncrease(t)?(b=u(b),C=u(C)):s.shouldIndentNextLine(t)&&(b=u(b)),t++;for(let E=t;E<=i;E++){if(DW(o,E))continue;const w=o.getLineContent(E),A=eo(w),I=b;s.shouldDecrease(E,I)&&(b=f(b),C=f(C)),A!==b&&g.push(ds.replaceMove(new qi(E,1,E,A.length+1),kL(b,a,d))),!s.shouldIgnore(E)&&(s.shouldIncrease(E,I)?(C=u(C),b=C):s.shouldIndentNextLine(E,I)?b=u(b):b=C)}return g}function DW(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var AW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kW=function(o,e){return function(t,i){e(t,i,o)}};const v_=class v_ extends wt{constructor(){super({id:v_.ID,label:S("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:q.writable,metadata:{description:Fi("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 PW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};v_.ID="editor.action.indentationToSpaces";let fy=v_;const m_=class m_ extends wt{constructor(){super({id:m_.ID,label:S("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:q.writable,metadata:{description:Fi("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 TW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};m_.ID="editor.action.indentationToTabs";let gy=m_;class eS extends wt{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(Ml),n=e.get(mo),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 __=class __ extends eS{constructor(){super(!1,!1,{id:__.ID,label:S("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:Fi("indentUsingTabsDescription","Use indentation with tabs.")}})}};__.ID="editor.action.indentUsingTabs";let py=__;const b_=class b_ extends eS{constructor(){super(!0,!1,{id:b_.ID,label:S("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:Fi("indentUsingSpacesDescription","Use indentation with spaces.")}})}};b_.ID="editor.action.indentUsingSpaces";let xy=b_;const C_=class C_ extends eS{constructor(){super(!0,!0,{id:C_.ID,label:S("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:Fi("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};C_.ID="editor.action.changeTabDisplaySize";let vy=C_;const E_=class E_ extends wt{constructor(){super({id:E_.ID,label:S("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:Fi("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(mo),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};E_.ID="editor.action.detectIndentation";let my=E_;class BW extends wt{constructor(){super({id:"editor.action.reindentlines",label:S("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:q.writable,metadata:{description:Fi("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(qs),n=t.getModel();if(!n)return;const s=MB(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class FW extends wt{constructor(){super({id:"editor.action.reindentselectedlines",label:S("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:q.writable,metadata:{description:Fi("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(qs),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=MB(n,i,d,u);r.push(...f)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class LW{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const n of this._edits)t.addEditOperation(ee.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}var Df;let Sm=(Df=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Ht,this.callOnModel=new Ht,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)||IW(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=>Wf.shiftIndent(b,b.length+1,r,a,d),unshiftIndent:b=>Wf.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=lg(s,i,i.getLanguageId(),g,f,this._languageConfigurationService);if(b!==null){const E=eo(p),w=Io(b,r),A=Io(E,r);if(w!==A){const I=mg(w,r,d);u.push({range:new ee(g,1,g,E.length+1),text:I}),p=I+p.substring(E.length)}else{const I=_k(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=lg(s,{tokenization:{getLineTokens:w=>i.tokenization.getLineTokens(w),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(w,A)=>i.getLanguageIdAtPosition(w,A)},getLineContent:w=>w===C?p:i.getLineContent(w)},i.getLanguageId(),g+1,f,this._languageConfigurationService);if(E!==null){const w=Io(E,r),A=Io(eo(i.getLineContent(g+1)),r);if(w!==A){const I=w-A;for(let M=g+1;M<=e.endLineNumber;M++){const R=i.getLineContent(M),P=eo(R),$=Io(P,r)+I,Q=mg($,r,d);Q!==P&&u.push({range:new ee(M,1,M,P.length+1),text:Q})}}}}if(u.length>0){this.editor.pushUndoStop();const b=new LW(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()}},Df.ID="editor.contrib.autoIndentOnPaste",Df);Sm=AW([kW(1,qs)],Sm);function IW(o,e){const t=i=>BL(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function RB(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r<t;r++)n+=" ";const s=new RegExp(n,"gi");for(let r=1,a=o.getLineCount();r<=a;r++){let d=o.getLineFirstNonWhitespaceColumn(r);if(d===0&&(d=o.getLineMaxColumn(r)),d===1)continue;const u=new ee(r,1,r,d),f=o.getValueInRange(u),g=i?f.replace(/\t/ig,n):f.replace(s," ");e.addEditOperation(u,g)}}class PW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),RB(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class TW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),RB(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}un(Sm.ID,Sm,2);Re(fy);Re(gy);Re(py);Re(xy);Re(vy);Re(my);Re(BW);Re(FW);un(Qg.ID,Qg,1);th.register(nm);class MW{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 qi(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new qi(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var RW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},NW=function(o,e){return function(t,i){e(t,i,o)}},gv,Pc;let i0=(Pc=class{static get(e){return e.getContribution(gv.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 mk(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=Ks(u=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(u=>{var b;if(!u||!u.range||!u.value||!r.validate(this.editor))return;const f=ee.lift(u.range);let g=u.range;const p=u.value.length-(s.endColumn-s.startColumn);g={startLineNumber:g.startLineNumber,startColumn:g.startColumn,endLineNumber:g.endLineNumber,endColumn:g.startColumn+u.value.length},p>1&&(s=new qi(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+p-1));const C=new MW(f,s,u.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,C),this.editor.pushUndoStop(),this.decorations.set([{range:g,options:gv.DECORATION}]),(b=this.decorationRemover)==null||b.cancel(),this.decorationRemover=ib(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(qn)}).catch(qn)):Promise.resolve(void 0)}},gv=Pc,Pc.ID="editor.contrib.inPlaceReplaceController",Pc.DECORATION=bn.register({description:"in-place-replace",className:"valueSetReplacement"}),Pc);i0=gv=RW([NW(1,Ol)],i0);class OW extends wt{constructor(){super({id:"editor.action.inPlaceReplace.up",label:S("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=i0.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class HW extends wt{constructor(){super({id:"editor.action.inPlaceReplace.down",label:S("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=i0.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}un(i0.ID,i0,4);Re(OW);Re(HW);class WW extends wt{constructor(){super({id:"expandLineSelection",label:S("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:q.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,e9.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}Re(WW);class zW{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=VW(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 VW(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=tv(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++]=ds.delete(new ee(a,C,a,f))}return i}class NB{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
|
|
48
|
+
`);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new ee(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
|
|
49
|
+
`):this._isCopyingDown?t.addEditOperation(new ee(i.startLineNumber,1,i.startLineNumber,1),s+`
|
|
50
|
+
`):t.addEditOperation(new ee(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
|
|
51
|
+
`+s),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let n=i.startLineNumber,s=i.startColumn,r=i.endLineNumber,a=i.endColumn;this._startLineNumberDelta!==0&&(n=n+this._startLineNumberDelta,s=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,a=1),i=qi.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var jW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$W=function(o,e){return function(t,i){e(t,i,o)}};let _y=class{constructor(e,t,i,n){this._languageConfigurationService=n,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){const i=()=>e.getLanguageId(),n=(g,p)=>e.getLanguageIdAtPosition(g,p),s=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===s){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let r=this._selection;r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,e.getLineMaxColumn(r.endLineNumber-1)));const{tabSize:a,indentSize:d,insertSpaces:u}=e.getOptions(),f=this.buildIndentConverter(a,d,u);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const g=r.startLineNumber,p=this._isMovingDown?g+1:g-1;e.getLineMaxColumn(p)===1?t.addEditOperation(new ee(1,1,1,1),null):(t.addEditOperation(new ee(g,1,g,1),e.getLineContent(p)),t.addEditOperation(new ee(p,1,p,e.getLineMaxColumn(p)),null)),r=new qi(p,1,p,1)}else{let g,p;if(this._isMovingDown){g=r.endLineNumber+1,p=e.getLineContent(g),t.addEditOperation(new ee(g-1,e.getLineMaxColumn(g-1),g,e.getLineMaxColumn(g)),null);let C=p;if(this.shouldAutoIndent(e,r)){const b=this.matchEnterRule(e,f,a,g,r.startLineNumber-1);if(b!==null){const w=eo(e.getLineContent(g)),A=b+Io(w,a);C=mg(A,a,u)+this.trimStart(p)}else{const w={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=lg(this._autoIndent,w,e.getLanguageIdAtPosition(g,1),r.startLineNumber,f,this._languageConfigurationService);if(A!==null){const I=eo(e.getLineContent(g)),M=Io(A,a),R=Io(I,a);M!==R&&(C=mg(M,a,u)+this.trimStart(p))}}t.addEditOperation(new ee(r.startLineNumber,1,r.startLineNumber,1),C+`
|
|
52
|
+
`);const E=this.matchEnterRuleMovingDown(e,f,a,r.startLineNumber,g,C);if(E!==null)E!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,u,E);else{const w={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=lg(this._autoIndent,w,e.getLanguageIdAtPosition(g,1),r.startLineNumber+1,f,this._languageConfigurationService);if(A!==null){const I=eo(e.getLineContent(r.startLineNumber)),M=Io(A,a),R=Io(I,a);if(M!==R){const P=M-R;this.getIndentEditsOfMovingBlock(e,t,r,a,u,P)}}}}else t.addEditOperation(new ee(r.startLineNumber,1,r.startLineNumber,1),C+`
|
|
53
|
+
`)}else if(g=r.startLineNumber-1,p=e.getLineContent(g),t.addEditOperation(new ee(g,1,g+1,1),null),t.addEditOperation(new ee(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
|
|
54
|
+
`+p),this.shouldAutoIndent(e,r)){const C={tokenization:{getLineTokens:E=>E===g?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===g?e.getLineContent(r.startLineNumber):e.getLineContent(E)},b=this.matchEnterRule(e,f,a,r.startLineNumber,r.startLineNumber-2);if(b!==null)b!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,u,b);else{const E=lg(this._autoIndent,C,e.getLanguageIdAtPosition(r.startLineNumber,1),g,f,this._languageConfigurationService);if(E!==null){const w=eo(e.getLineContent(r.startLineNumber)),A=Io(E,a),I=Io(w,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=>Wf.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>Wf.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===mx.None||s.indentAction===mx.Indent?r=s.indentation+s.appendText:s.indentAction===mx.IndentOutdent?r=s.indentation:s.indentAction===mx.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const d=eo(e.getLineContent(n));let u=eo(r);const f=_k(e,n,this._languageConfigurationService);f!==null&&f&2&&(u=t.unshiftIndent(u));const g=Io(u,i),p=Io(d,i);return g-p}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(tv(r)>=0){const a=e.getLineMaxColumn(s),d=aC(this._autoIndent,e,new ee(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}else{let a=n-1;for(;a>=1;){const f=e.getLineContent(a);if(tv(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=aC(this._autoIndent,e,new ee(a,d,a,d),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,u)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let f;if(a===s&&r!==void 0?f=r:f=e.getLineContent(a),tv(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=aC(this._autoIndent,e,new ee(a,d,a,d),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,u)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),n=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==n||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,n,s,r){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const d=e.getLineContent(a),u=eo(d),g=Io(u,n)+r,p=mg(g,n,s);p!==u&&(t.addEditOperation(new ee(a,1,a,u.length+1),p),a===i.endLineNumber&&i.endColumn<=u.length+1&&p===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};_y=jW([$W(3,qs)],_y);const of=class of{static getCollator(){return of._COLLATOR||(of._COLLATOR=new Intl.Collator),of._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=UW(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=OB(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}};of._COLLATOR=null;let np=of;function OB(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(np.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function UW(o,e,t){const i=OB(o,e,t);return i?ds.replace(new ee(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
|
|
55
|
+
`)):null}class HB extends wt{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((r,a)=>({selection:r,index:a,ignore:!1}));i.sort((r,a)=>ee.compareRangesUsingStarts(r.selection,a.selection));let n=i[0];for(let r=1;r<i.length;r++){const a=i[r];n.selection.endLineNumber===a.selection.startLineNumber&&(n.index<a.index?a.ignore=!0:(n.ignore=!0,n=a))}const s=[];for(const r of i)s.push(new NB(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class qW extends HB{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:S("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class GW extends HB{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:S("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class KW extends wt{constructor(){super({id:"editor.action.duplicateSelection",label:S("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:q.writable,menuOpts:{menuId:gi.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 NB(a,!0));else{const d=new qi(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new FL(d,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class WB extends wt{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(qs),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new _y(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class ZW extends WB{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:S("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class XW extends WB{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:S("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class zB extends wt{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 qi(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!np.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new np(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class YW extends zB{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:S("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:q.writable})}}class QW extends zB{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:S("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:q.writable})}}class JW extends wt{constructor(){super({id:"editor.action.removeDuplicateLines",label:S("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:q.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 qi(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 w=i.getLineContent(E);f.has(w)||(g.push(w),f.add(w))}const p=new qi(u.startLineNumber,1,u.endLineNumber,i.getLineMaxColumn(u.endLineNumber)),C=u.startLineNumber-r,b=new qi(C,1,C+g.length-1,g[g.length-1].length);n.push(ds.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 y_=class y_ extends wt{constructor(){super({id:y_.ID,label:S("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(f=>new Ii(f.positionLineNumber,f.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(ss),a=t.getModel(),d=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),u=new zW(s,n,d);t.pushUndoStop(),t.executeCommands(this.id,[u]),t.pushUndoStop()}};y_.ID="editor.action.trimTrailingWhitespace";let by=y_;class ez extends wt{constructor(){super({id:"editor.action.deleteLines",label:S("lines.delete","Delete Line"),alias:"Delete Line",precondition:q.writable,kbOpts:{kbExpr:q.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(ds.replace(new qi(g,C,p,b),"")),a.push(new qi(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 tz extends wt{constructor(){super({id:"editor.action.indentLines",label:S("lines.indent","Indent Line"),alias:"Indent Line",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,LL.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class iz extends wt{constructor(){super({id:"editor.action.outdentLines",label:S("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2140,weight:100}})}run(e,t){ev.Outdent.runEditorCommand(e,t,null)}}class nz extends wt{constructor(){super({id:"editor.action.insertLineBefore",label:S("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,bk.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class sz extends wt{constructor(){super({id:"editor.action.insertLineAfter",label:S("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,bk.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class VB extends wt{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let d=0,u=n.length-1;d<u;d++){const f=n[d],g=n[d+1];ee.intersectRanges(f,g)===null?s.push(f):n[d+1]=ee.plusRange(f,g)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(d=>ds.replace(d,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class oz extends VB{constructor(){super({id:"deleteAllLeft",label:S("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:q.writable,kbOpts:{kbExpr:q.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 qi(d,r.startColumn,d,r.startColumn)}else a=new qi(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);s+=r.endLineNumber-r.startLineNumber,r.intersectRanges(e)?i=a:n.push(a)}),i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const n=e.getModel();return n===null?[]:(i.sort(ee.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const r=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:n.getLineLength(r)+1;return new ee(r,a,s.startLineNumber,1)}else return new ee(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new ee(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class rz extends VB{constructor(){super({id:"deleteAllRight",label:S("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:q.writable,kbOpts:{kbExpr:q.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 qi(d.startLineNumber-a,d.startColumn,d.startLineNumber-a,d.startColumn);d.intersectRanges(e)?i=u:n.push(u)}return i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getModel();if(t===null)return[];const i=e.getSelections();if(i===null)return[];const n=i.map(s=>{if(s.isEmpty()){const r=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===r?new ee(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new ee(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(ee.compareRangesUsingStarts),n}}class az extends wt{constructor(){super({id:"editor.action.joinLines",label:S("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let n=t.getSelection();if(n===null)return;i.sort(ee.compareRangesUsingStarts);const s=[],r=i.reduce((p,C)=>p.isEmpty()?p.endLineNumber===C.startLineNumber?(n.equalsSelection(p)&&(n=C),C):C.startLineNumber>p.endLineNumber+1?(s.push(p),C):new qi(p.startLineNumber,p.startColumn,C.endLineNumber,C.endColumn):C.startLineNumber>p.endLineNumber?(s.push(p),C):new qi(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,w=1;let A=0,I,M;const R=a.getLineLength(b.endLineNumber)-b.endColumn;if(b.isEmpty()||b.startLineNumber===b.endLineNumber){const $=b.getStartPosition();$.lineNumber<a.getLineCount()?(I=E+1,M=a.getLineMaxColumn(I)):(I=$.lineNumber,M=a.getLineMaxColumn($.lineNumber))}else I=b.endLineNumber,M=a.getLineMaxColumn(I);let P=a.getLineContent(E);for(let $=E+1;$<=I;$++){const Q=a.getLineContent($),re=a.getLineFirstNonWhitespaceColumn($);if(re>=1){let he=!0;P===""&&(he=!1),he&&(P.charAt(P.length-1)===" "||P.charAt(P.length-1)===" ")&&(he=!1,P=P.replace(/[\s\uFEFF\xA0]+$/g," "));const Z=Q.substr(re-1);P+=(he?" ":"")+Z,he?A=Z.length+1:A=Z.length}else A=0}const V=new ee(E,w,I,M);if(!V.isEmpty()){let $;b.isEmpty()?(d.push(ds.replace(V,P)),$=new qi(V.startLineNumber-g,P.length-A+1,E-g,P.length-A+1)):b.startLineNumber===b.endLineNumber?(d.push(ds.replace(V,P)),$=new qi(b.startLineNumber-g,b.startColumn,b.endLineNumber-g,b.endColumn)):(d.push(ds.replace(V,P)),$=new qi(b.startLineNumber-g,b.startColumn,b.startLineNumber-g,P.length-R)),ee.intersectRanges(V,n)!==null?f=$:u.push($)}g+=V.endLineNumber-V.startLineNumber}u.unshift(f),t.pushUndoStop(),t.executeEdits(this.id,d,u),t.pushUndoStop()}}class lz extends wt{constructor(){super({id:"editor.action.transpose",label:S("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:q.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=[];for(let r=0,a=i.length;r<a;r++){const d=i[r];if(!d.isEmpty())continue;const u=d.getStartPosition(),f=n.getLineMaxColumn(u.lineNumber);if(u.column>=f){if(u.lineNumber===n.getLineCount())continue;const g=new ee(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new Sp(new qi(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p))}else{const g=new ee(u.lineNumber,Math.max(1,u.column-1),u.lineNumber,u.column+1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new OA(g,p,new qi(u.lineNumber,u.column+1,u.lineNumber,u.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class sh extends wt{run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=t.getOption(132),r=[];for(const a of i)if(a.isEmpty()){const d=a.getStartPosition(),u=t.getConfiguredWordAtPosition(d);if(!u)continue;const f=new ee(d.lineNumber,u.startColumn,d.lineNumber,u.endColumn),g=n.getValueInRange(f);r.push(ds.replace(f,this._modifyText(g,s)))}else{const d=n.getValueInRange(a);r.push(ds.replace(a,this._modifyText(d,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class cz extends sh{constructor(){super({id:"editor.action.transformToUppercase",label:S("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:q.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class dz extends sh{constructor(){super({id:"editor.action.transformToLowercase",label:S("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:q.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class yl{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 w_=class w_ extends sh{constructor(){super({id:"editor.action.transformToTitlecase",label:S("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:q.writable})}_modifyText(e,t){const i=w_.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};w_.titleBoundary=new yl("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let Dm=w_;const rf=class rf extends sh{constructor(){super({id:"editor.action.transformToSnakecase",label:S("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:q.writable})}_modifyText(e,t){const i=rf.caseBoundary.get(),n=rf.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};rf.caseBoundary=new yl("(\\p{Ll})(\\p{Lu})","gmu"),rf.singleLetters=new yl("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let _g=rf;const S_=class S_ extends sh{constructor(){super({id:"editor.action.transformToCamelcase",label:S("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:q.writable})}_modifyText(e,t){const i=S_.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("")}};S_.wordBoundary=new yl("[_\\s-]","gm");let Am=S_;const af=class af extends sh{constructor(){super({id:"editor.action.transformToPascalcase",label:S("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:q.writable})}_modifyText(e,t){const i=af.wordBoundary.get(),n=af.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("")}};af.wordBoundary=new yl("[_\\s-]","gm"),af.wordBoundaryToMaintain=new yl("(?<=\\.)","gm");let km=af;const oc=class oc extends sh{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:q.writable})}_modifyText(e,t){const i=oc.caseBoundary.get(),n=oc.singleLetters.get(),s=oc.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};oc.caseBoundary=new yl("(\\p{Ll})(\\p{Lu})","gmu"),oc.singleLetters=new yl("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),oc.underscoreBoundary=new yl("(\\S)(_)(\\S)","gm");let Bm=oc;Re(qW);Re(GW);Re(KW);Re(ZW);Re(XW);Re(YW);Re(QW);Re(JW);Re(by);Re(ez);Re(tz);Re(iz);Re(nz);Re(sz);Re(oz);Re(rz);Re(az);Re(lz);Re(cz);Re(dz);_g.caseBoundary.isSupported()&&_g.singleLetters.isSupported()&&Re(_g);Am.wordBoundary.isSupported()&&Re(Am);km.wordBoundary.isSupported()&&Re(km);Dm.titleBoundary.isSupported()&&Re(Dm);Bm.isSupported()&&Re(Bm);var uz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hx=function(o,e){return function(t,i){e(t,i,o)}},pv;const jB=new wn("LinkedEditingInputVisible",!1),hz="linked-editing-decoration";var Tc;let n0=(Tc=class extends zt{static get(e){return e.getContribution(pv.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Ht),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=jB.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 Ht),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(Rs.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new Hc(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new Hc(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=Np(u,f);g+=C,u=u.substr(C),f=f.substr(C);const b=IL(u,f);p-=b,u=u.substr(0,u.length-b),f=f.substr(0,f.length-b),(g!==p||f.length!==0)&&s.push({range:new ee(d.startLineNumber,g,d.endLineNumber,p),text:f})}}if(s.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const r=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",s),this._editor._getViewModel().setPrevEditOperationType(r)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}const t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}const i=this._editor.getModel(),n=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const r=this._currentDecorations.getRange(0);if(r&&r.containsPosition(t))return}}this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;const s=this._currentRequestCts=new Zs;try{const r=new Ho(!1),a=await $B(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let d=[];a!=null&&a.ranges&&(d=a.ranges),this._currentWordPattern=(a==null?void 0:a.wordPattern)||this._languageWordPattern;let u=!1;for(let g=0,p=d.length;g<p;g++)if(ee.containsPosition(d[g],t)){if(u=!0,g!==0){const C=d[g];d.splice(g,1),d.unshift(C)}break}if(!u){this.clearRanges();return}const f=d.map(g=>({range:g,options:pv.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(f),this._syncRangesToken++}catch(r){Gc(r)||qn(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},pv=Tc,Tc.ID="editor.contrib.linkedEditing",Tc.DECORATION=bn.register({description:"linked-editing",stickiness:0,className:hz}),Tc);n0=pv=uz([Hx(1,Ln),Hx(2,Pi),Hx(3,qs),Hx(4,gr)],n0);class fz extends wt{constructor(){super({id:"editor.action.linkedEditing",label:S("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:Ze.and(q.writable,q.hasRenameProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(Cs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return jn.isUri(n)&&Ii.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))))},qn):super.runCommand(e,t)}run(e,t){const i=n0.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const gz=ko.bindToContribution(n0.get);Ri(new gz({id:"cancelLinkedEditingInput",precondition:jB,handler:o=>o.clearRanges(),kbOpts:{kbExpr:q.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function $B(o,e,t,i){const n=o.ordered(e);return t9(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){bs(r);return}}),s=>!!s&&Yo(s==null?void 0:s.ranges))}Si("editor.linkedEditingBackground",{dark:vn.fromHex("#f00").transparent(.3),light:vn.fromHex("#f00").transparent(.3),hcDark:vn.fromHex("#f00").transparent(.3),hcLight:vn.white},S("editorLinkedEditingBackground","Background color when the editor auto renames on type."));Bo("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(Pi);return $B(i,e,t,ln.None)});un(n0.ID,n0,1);Re(fz);let pz=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 Fm{constructor(e){this._disposables=new Ht;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new pz(r,n));t=Fm._union(t,s),ok(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){const i=[];let n,s,r,a;for(n=0,r=0,s=e.length,a=t.length;n<s&&r<a;){const d=e[n],u=t[r];if(ee.areIntersectingOrTouching(d.range,u.range)){n++;continue}ee.compareRangesUsingStarts(d.range,u.range)<0?(i.push(d),n++):(i.push(u),r++)}for(;n<s;n++)i.push(e[n]);for(;r<a;r++)i.push(t[r]);return i}}function UB(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])},bs));return Promise.all(n).then(()=>{const s=new Fm(wl(i));return t.isCancellationRequested?(s.dispose(),new Fm([])):s})}Qn.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;Pn(t instanceof jn),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(Pi),s=o.get(mo).getModel(t);if(!s)return[];const r=await UB(n,s,ln.None);if(!r)return[];for(let d=0;d<Math.min(i,r.links.length);d++)await r.links[d].resolve(ln.None);const a=r.links.slice(0);return r.dispose(),a});var xz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wx=function(o,e){return function(t,i){e(t,i,o)}},Cy,gu;let sp=(gu=class extends zt{static get(e){return e.getContribution(Cy.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 Ns(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new Eb(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=Ks(t=>UB(this.providers,e,t));try{const t=new Ho(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){qn(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(uf.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 uf(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(ln.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===Eo.file&&s.startsWith(`${Eo.file}:`)){const a=jn.parse(s);if(a.scheme===Eo.file){const d=PL(a);let u=null;d.startsWith("/./")||d.startsWith("\\.\\")?u=`.${d.substr(1)}`:(d.startsWith("//./")||d.startsWith("\\\\.\\"))&&(u=`.${d.substr(2)}`),u&&(s=TL(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.")):qn(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()}},Cy=gu,gu.ID="editor.linkDetector",gu);sp=Cy=xz([Wx(1,da),Wx(2,vo),Wx(3,Pi),Wx(4,gr)],sp);const qD={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 uf{static decoration(e,t){return{range:e.range,options:uf._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?qD.active:qD.general};return n.hoverMessage=vz(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,uf._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,uf._getOptions(this.link,t,!1))}}function vz(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?$a?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):$a?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 lo("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new lo().appendText(`${i} (${n})`)}class mz extends wt{constructor(){super({id:"editor.action.openLink",label:S("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=sp.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)}}}un(sp.ID,sp,1);Re(mz);const BS=class BS extends zt{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})}))}};BS.ID="editor.contrib.longLinesHelper";let Lm=BS;un(Lm.ID,Lm,2);const _z=Si("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);Si("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);Si("editor.wordHighlightTextBackground",_z,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 bz=Si("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Bu,hcLight:Bu},S("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));Si("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Bu,hcLight:Bu},S("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));Si("editor.wordHighlightTextBorder",bz,S("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const Cz=Si("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),Ez=Si("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),yz=Si("editorOverviewRuler.wordHighlightTextForeground",Ck,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),wz=bn.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Fs(Ez),position:Ha.Center},minimap:{color:Fs(nb),position:1}}),Sz=bn.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Fs(yz),position:Ha.Center},minimap:{color:Fs(nb),position:1}}),Dz=bn.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Fs(Ck),position:Ha.Center},minimap:{color:Fs(nb),position:1}}),Az=bn.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),kz=bn.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Fs(Cz),position:Ha.Center},minimap:{color:Fs(nb),position:1}});function Bz(o){return o===Mv.Write?wz:o===Mv.Text?Sz:kz}function Fz(o){return o?Az:Dz}G_((o,e)=>{const t=o.getColor(ML);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var Lz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Iz=function(o,e){return function(t,i){e(t,i,o)}},Ey;function Zc(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);Tf(n)}}class Pz extends wt{constructor(){super({id:"editor.action.insertCursorAbove",label:S("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:gi.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,e9.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),Zc(r,s.getCursorStates())}}class Tz extends wt{constructor(){super({id:"editor.action.insertCursorBelow",label:S("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:gi.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,e9.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),Zc(r,s.getCursorStates())}}class Mz extends wt{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:q.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:gi.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 qi(n,s,n,s))}e.endColumn>1&&i.push(new qi(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),Zc(r,s.getCursorStates())}}class Rz extends wt{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 qi(d,i[0].startColumn,d,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),Zc(a,r.getCursorStates())}}class Nz extends wt{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 qi(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),Zc(r,s.getCursorStates())}}class zx{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class op{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new op(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 qi(d.startLineNumber,g.startColumn,d.startLineNumber,g.endColumn)}else u=e.getModel().getValueInRange(d).replace(/\r\n/g,`
|
|
57
|
+
`);return new op(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 zx(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 zx(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 qi(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 zx(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 zx(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 qi(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 D_=class D_ extends zt{static get(e){return e.getContribution(D_.ID)}constructor(e){super(),this._sessionDispose=this._register(new Ht),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=op.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 qi(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(!qB(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 qi(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};D_.ID="editor.contrib.multiCursorController";let s0=D_;class m0 extends wt{run(e,t){const i=s0.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=Do.get(t);if(r)this._run(i,r);else{const a=e.get(tn).createInstance(Do,t);this._run(i,a),a.dispose()}Zc(s,n.getCursorStates())}}}class Oz extends m0{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:q.focus,primary:2082,weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class Hz extends m0{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:gi.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class Wz extends m0{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:q.focus,primary:Ds(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class zz extends m0{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 Vz extends m0{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:q.focus,primary:3114,weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"3_multi",title:S({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class jz extends m0{constructor(){super({id:"editor.action.changeAll",label:S("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:Ze.and(q.writable,q.editorTextFocus),kbOpts:{kbExpr:q.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class $z{constructor(e,t,i,n,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=n,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort(ee.compareRangesUsingStarts)),this._cachedFindMatches}}var pu;let Im=(pu=class extends zt{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Ns(()=>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=Do.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(Ey._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=s0.get(i);if(!s)return null;const r=Do.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(!qB(i.getModel(),f,p))return null}a=op.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 $z(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(132):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),n=this.editor.getSelections();n.sort(ee.compareRangesUsingStarts);const s=[];for(let u=0,f=0,g=i.length,p=n.length;u<g;){const C=i[u];if(f>=p)s.push(C),u++;else{const b=ee.compareRangesUsingStarts(C,n[f]);b<0?((n[f].isEmpty()||!ee.areIntersecting(C,n[f]))&&s.push(C),u++):(b>0||u++,f++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,d=s.map(u=>({range:u,options:Fz(a)}));this._decorations.set(d)}dispose(){this._setState(null),super.dispose()}},Ey=pu,pu.ID="editor.contrib.selectionHighlighter",pu);Im=Ey=Lz([Iz(1,Pi)],Im);function qB(o,e,t){const i=GD(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=GD(o,r,!t);if(i!==a)return!1}return!0}function GD(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class Uz extends wt{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),Zc(s,n.getCursorStates()))}}class qz extends wt{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),Zc(s,n.getCursorStates()))}}un(s0.ID,s0,4);un(Im.ID,Im,1);Re(Pz);Re(Tz);Re(Mz);Re(Oz);Re(Hz);Re(Wz);Re(zz);Re(Vz);Re(jz);Re(Rz);Re(Nz);Re(Uz);Re(qz);const Gz="editor.action.inlineEdit.accept",Kz="editor.action.inlineEdit.reject",Zz="editor.action.inlineEdit.jumpTo",Xz="editor.action.inlineEdit.jumpBack";var Yz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Qz=function(o,e){return function(t,i){e(t,i,o)}};const WC="inline-edit";let yy=class extends zt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Qo(this,!1),this.currentTextModel=Po(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Wn(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 Hg(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 Hg(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,WC),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,WC),b===void 0&&M.column<=C.length&&(b=M.column)),E=M.column-1}b!==void 0&&p([C.substring(E)],void 0)}const w=b!==void 0?new AB(b,C.length+1):void 0,A=d||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:f,additionalLines:g,hiddenRange:w,lineNumber:A,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:d,isPureRemove:u}}),this.decorations=Wn(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];if(s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"inline-edit-hidden",description:"inline-edit-hidden"}}),s.range){const a=[];if(s.isSingleLine)a.push(s.range);else if(!s.isPureRemove){const d=s.range.endLineNumber-s.range.startLineNumber;for(let u=0;u<d;u++){const f=s.range.startLineNumber+u,g=s.targetTextModel.getLineFirstNonWhitespaceColumn(f),p=s.targetTextModel.getLineLastNonWhitespaceColumn(f),C=new ee(f,g,f,p);a.push(C)}}for(const d of a)r.push({range:d,options:i9})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new ee(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:n9})}for(const a of s.inlineTexts)r.push({range:ee.fromPositions(new Ii(s.lineNumber,a.column)),options:{description:WC,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:jh.Left},showIfCollapsed:!0}});return r}),this._register(is(()=>{this.isDisposed.set(!0,void 0)})),this._register(kB(this.editor,this.decorations))}};yy=Yz([Qz(2,ha)],yy);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},Fa=function(o,e){return function(t,i){e(t,i,o)}},xv;let wy=class extends zt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Po(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=Wn(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 Ii(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Ip((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(Sy,this.editor,!0,this.position));e.addContentWidget(a),s.add(is(()=>e.removeContentWidget(a)))}))}};wy=tS([Fa(2,tn)],wy);var Mc;let Sy=(Mc=class extends zt{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${xv.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Fr("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Fr("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(gi.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(Dy,this.nodes.toolBar,this.editor,gi.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,d)=>{if(a instanceof Of)return n.createInstance(Jz,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{xv._dropDownVisible=a})),this._register(rs(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(rs(a=>{const d=[];for(const[u,f]of this.inlineCompletionsActionsMenus.getActions())for(const g of f)g instanceof Of&&d.push(g);d.length>0&&d.unshift(new Pg),this.toolBar.setAdditionalSecondaryActions(d)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},xv=Mc,Mc._dropDownVisible=!1,Mc.id=0,Mc);Sy=xv=tS([Fa(3,tn),Fa(4,Ln),Fa(5,Zu)],Sy);class Jz extends wA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Fr("div.keybinding").root;this._register(new Nw(t,Ow,{disableTitle:!0,...SA})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let Dy=class extends DA{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=[];$w(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){ja(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Dy=tS([Fa(4,Zu),Fa(5,Ln),Fa(6,a0),Fa(7,As),Fa(8,Us),Fa(9,ua)],Dy);var GB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vv=function(o,e){return function(t,i){e(t,i,o)}},eg,Ay;function*eV(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function zC(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 xu;let ky=(xu=class extends zt{static _createUniqueUri(){return jn.from({scheme:"inline-edit-widget",path:new Date().toString()+String(eg._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=Wn(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(eV(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 Ii(p,g);return{top:a.range.startLineNumber,left:C}}),this._text=Wn(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const d=zC(a.text.split(`
|
|
58
|
+
`));return{text:d.text.join(`
|
|
59
|
+
`),shift:d.shift}}),this._originalModel=Wc(()=>this._modelService.createModel("",null,eg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=Wc(()=>this._modelService.createModel("",null,eg._createUniqueUri())).keepObserved(this._store),this._diff=Wn(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=Wn(this,r=>{const a=this._model.read(r);if(!a)return;const d=this._editor.getModel();if(!d)return;const u=zC(d.getValueInRange(a.range).split(`
|
|
60
|
+
`)).text.join(`
|
|
61
|
+
`),f=zC(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 Ek.fromFn(async()=>{const p=await g.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},ln.None);if(!p.identical)return p.changes})}),this._register(Ip((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(is(()=>e.removeOverlayWidget(u)))}))}},eg=xu,xu._modelId=0,xu);ky=eg=GB([vv(2,tn),vv(3,s9),vv(4,mo)],ky);var vu;let By=(vu=class extends zt{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${Ay.id++}`,this.allowEditorOverflow=!1,this._nodes=wi("div.inlineEditSideBySide",void 0),this._scrollChanged=Pd("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(Hr,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=Ia(this._previewEditor),this._editorObs=Ia(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(uc,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??Ng,uc.DEFAULT_CREATION_OPTIONS,null)),this._setText=Wn(d=>{const u=this._text.read(d);u&&this._previewTextModel.setValue(u)}).recomputeInitiallyAndOnChange(this._store),this._decorations=Wn(this,d=>{this._setText.read(d);const u=this._position.read(d);if(!u)return{org:[],mod:[]};const f=this._diff.read(d);if(!f)return{org:[],mod:[]};const g=[],p=[];if(f.length===1&&f[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const C=this._shift.get(),b=E=>new ee(E.startLineNumber+u.top-1,E.startColumn+C,E.endLineNumber+u.top-1,E.endColumn+C);for(const E of f)if(E.original.isEmpty||g.push({range:b(E.original.toInclusiveRange()),options:n9}),E.modified.isEmpty||p.push({range:E.modified.toInclusiveRange(),options:yk}),E.modified.isEmpty||E.original.isEmpty)E.original.isEmpty||g.push({range:b(E.original.toInclusiveRange()),options:wk}),E.modified.isEmpty||p.push({range:E.modified.toInclusiveRange(),options:Sk});else for(const w of E.innerChanges||[])E.original.contains(w.originalRange.startLineNumber)&&g.push({range:b(w.originalRange),options:w.originalRange.isEmpty()?Dk:i9}),E.modified.contains(w.modifiedRange.startLineNumber)&&p.push({range:w.modifiedRange,options:w.modifiedRange.isEmpty()?Ak:kk});return{org:g,mod:p}}),this._originalDecorations=Wn(this,d=>this._decorations.read(d).org),this._modifiedDecorations=Wn(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(rs(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(rs(d=>{this._position.read(d),this._editor.layoutOverlayWidget(this)})),this._register(rs(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 Ii(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}}}},Ay=vu,vu.id=0,vu);By=Ay=GB([vv(5,tn)],By);var tV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}},tg,dr;let fo=(dr=class extends zt{static get(e){return e.getContribution(tg.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=tg.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=tg.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=Qo(this,void 0),this._currentWidget=Wc(this._currentEdit,b=>{const E=this._currentEdit.read(b);if(!E)return;const w=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 Jg(w,[new um(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(yy,this.editor,{ghostText:pl(M),minReservedLineCount:pl(0),targetTextModel:pl(this.editor.getModel()??void 0),range:pl(E.range)})}),this._isAccepting=Qo(this,!1),this._enabled=Po(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Po(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const u=Pd("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(rs(b=>{this._enabled.read(b)&&(u.read(b),!this._isAccepting.read(b)&&this.getInlineEdit(e,!0))}));const f=Po(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(rs(b=>{if(!this._enabled.read(b))return;const E=f.read(b);E&&this.checkCursorPosition(E)})),this._register(rs(b=>{const E=this._currentEdit.read(b);if(this._isCursorAtInlineEditContext.set(!1),!E){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const w=e.getPosition();w&&this.checkCursorPosition(w)}));const g=Pd("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(rs(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=Pd("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(rs(b=>{this._enabled.read(b)&&(p.read(b),this.getInlineEdit(e,!0))}));const C=this._register(YA());this._register(rs(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 wy(this.editor,this._currentWidget,this.instantiationService)),this._register(new ky(this.editor,this._currentEdit,this.instantiationService,this._diffProviderFactoryService,this._modelService))}checkCursorPosition(e){if(!this._currentEdit){this._isCursorAtInlineEditContext.set(!1);return}const t=this._currentEdit.get();if(!t){this._isCursorAtInlineEditContext.set(!1);return}this._isCursorAtInlineEditContext.set(ee.containsPosition(t.range,e))}validateInlineEdit(e,t){var i;if(t.text.includes(`
|
|
71
|
+
`)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const s=t.range.endLineNumber,r=t.range.endColumn,a=((i=e.getModel())==null?void 0:i.getLineLength(s))??0;if(r!==a+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const n=i.getVersionId(),s=this.languageFeaturesService.inlineEditProvider.all(i);if(s.length===0)return;const r=s[0];this._currentRequestCts=new Zs;const a=this._currentRequestCts.token,d=t?s8.Automatic:s8.Invoke;if(t&&await iV(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",[ds.replace(ee.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,bs),this.freeEdit(e),Xu(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=Ii.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,bs),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)}},tg=dr,dr.ID="editor.contrib.inlineEditController",dr.inlineEditVisibleKey="inlineEditVisible",dr.inlineEditVisibleContext=new wn(dr.inlineEditVisibleKey,!1),dr.cursorAtInlineEditKey="cursorAtInlineEdit",dr.cursorAtInlineEditContext=new wn(dr.cursorAtInlineEditKey,!1),dr);fo=tg=tV([fd(1,tn),fd(2,Ln),fd(3,Pi),fd(4,Us),fd(5,ss),fd(6,s9),fd(7,mo)],fo);function iV(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 nV=class extends wt{constructor(){super({id:Gz,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:Ze.and(q.writable,fo.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:Ze.and(q.writable,fo.inlineEditVisibleContext,fo.cursorAtInlineEditContext)}],menuOpts:[{menuId:gi.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=fo.get(t);await(i==null?void 0:i.accept())}};class sV extends wt{constructor(){const e=Ze.and(q.writable,Ze.not(fo.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=fo.get(t);i==null||i.trigger()}}class oV extends wt{constructor(){const e=Ze.and(q.writable,fo.inlineEditVisibleContext,Ze.not(fo.cursorAtInlineEditKey));super({id:Zz,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:gi.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=fo.get(t);i==null||i.jumpToCurrent()}}class rV extends wt{constructor(){const e=Ze.and(q.writable,fo.cursorAtInlineEditContext);super({id:Xz,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:gi.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=fo.get(t);i==null||i.jumpBack()}}class aV extends wt{constructor(){const e=Ze.and(q.writable,fo.inlineEditVisibleContext);super({id:Kz,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:gi.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=fo.get(t);await(i==null?void 0:i.clear())}}Re(nV);Re(aV);Re(oV);Re(rV);Re(sV);un(fo.ID,fo,3);const lV="editor.action.inlineEdits.accept",cV="editor.action.inlineEdits.showPrevious",dV="editor.action.inlineEdits.showNext",o0=new wn("inlineEditsVisible",!1,S("inlineEditsVisible","Whether an inline edit is visible")),uV=new wn("inlineEditsIsPinned",!1,S("isPinned","Whether an inline edit is visible")),FS=class FS extends zt{constructor(e){super(),this._editor=e,this._editorObs=Ia(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=hl({owner:this,equalsFn:Bk},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=hV(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=AA((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=Fr("div.editorPlaceholder");i.add(rs(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(rs(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(rs(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:pl(0),position:pl(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};FS.ID="editor.contrib.placeholderText";let rp=FS;function hV(o,e){return Z_(o,(t,i)=>i===!0?!0:e(t))}var fV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gV=function(o,e){return function(t,i){e(t,i,o)}};class pV{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let Fy=class extends zt{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=Ia(this._editor),this._elements=Fr("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[Fr("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[Fr("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),Fr("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),Fr("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),mh("svg",{style:{overflow:"visible",pointerEvents:"none"}},[mh("defs",[mh("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[mh("stop",{offset:"0%",class:"gradient-stop"}),mh("stop",{offset:"100%",class:"gradient-stop"})])]),mh("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(uc,"",Ng,uc.DEFAULT_CREATION_OPTIONS,null)),this._setText=Wn(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(uc,"",Ng,uc.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(Hr,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:RL},{contributions:NL.getSomeEditorContributions([Pr.ID,rp.ID,Yf.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(Hr,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=Ia(this._previewEditor),this._decorations=Wn(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:n9}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:yk}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||d.push({range:g.original.toInclusiveRange(),options:wk}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:Sk});else for(const p of g.innerChanges||[])g.original.contains(p.originalRange.startLineNumber)&&d.push({range:p.originalRange,options:p.originalRange.isEmpty()?Dk:i9}),g.modified.contains(p.modifiedRange.startLineNumber)&&u.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?Ak:kk});return u}),this._layout1=Wn(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=Wn(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 Yh(f,g),b=new Yh(f,p),E=p-g,w=50,A=this._editor.getOption(67)*a.newLines.length,I=E-A,M=new Yh(f+w,g+I/2),R=new Yh(f+w,p-I/2);return{topCode:C,bottomCode:b,codeHeight:E,topEdit:M,bottomEdit:R,editHeight:A}});const s=Wn(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(OL(this._elements.root,{display:Wn(this,r=>s.read(r)?"block":"none")})),this._register(HL(this._editor.getDomNode(),this._elements.root)),this._register(Ia(e).createOverlayWidget({domNode:this._elements.root,position:pl(null),allowEditorOverflow:!1,minContentWidthInPx:Wn(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(rs(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,w=new vV().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",w),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(mV(xV(this._userPrompt,r=>r??"",r=>r),Ia(this._promptEditor).value)),this._register(rs(r=>{const a=Ia(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};Fy=fV([gV(3,tn)],Fy);function xV(o,e,t){return Fk(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class Yh{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new Yh(this.x+e,this.y)}}class vV{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 mV(o,e){const t=new Ht;return t.add(rs(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(rs(i=>{const n=e.read(i);o.set(n,void 0)})),t}var _V=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},VC=function(o,e){return function(t,i){e(t,i,o)}},ig,mu;let Ly=(mu=class extends zt{static _createUniqueUri(){return jn.from({scheme:"inline-edits",path:new Date().toString()+String(ig._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=Yw(this),this._selectedInlineCompletionId=Qo(this,void 0),this._isActive=Qo(this,!1),this._originalModel=Wc(()=>this._modelService.createModel("",null,ig._createUniqueUri())).keepObserved(this._store),this._modifiedModel=Wc(()=>this._modelService.createModel("",null,ig._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new CV(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(d=>!!d),this.userPrompt=Qo(this,void 0),this.inlineEdit=Wn(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=Wn(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(w){var I;const A=((I=w[0].match(/^\s*/))==null?void 0:I[0])??"";return w.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 Ek.fromFn(async()=>{const w=await E.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},ln.None);if(!w.identical)return new pV(WL.fromRangeInclusive(f),p(g),w.changes)})}),this._fetchStore=this._register(new Ht),this._inlineEditsFetchResult=u1(this,void 0),this._inlineEdits=hl({owner:this,equalsFn:Bk},d=>{var u;return((u=this._inlineEditsFetchResult.read(d))==null?void 0:u.completions.map(f=>new bV(f)))??[]}),this._fetchInlineEditsPromise=rk({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:bl.Automatic}),handleChange:(d,u)=>(d.didChange(this._forceUpdateExplicitlySignal)&&(u.inlineCompletionTriggerKind=bl.Explicit),!0)},async(d,u)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(d),this._textModelVersionId.read(d);function f(E,w){return w(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=f1(this._fetchStore);await ib(200,C);const b=await BB(this.languageFeaturesService.inlineCompletionsProvider,g,this.textModel,p,C);C.isCancellationRequested||this._inlineEditsFetchResult.set(b,void 0)}),this._filteredInlineEditItems=hl({owner:this,equalsFn:h1()},d=>this._inlineEdits.read(d)),this.selectedInlineCompletionIndex=Wn(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=Wn(this,d=>{const u=this._filteredInlineEditItems.read(d),f=this.selectedInlineCompletionIndex.read(d);return u[f]}),this._register(ak(this._fetchInlineEditsPromise))}async triggerExplicitly(e){Iv(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){Iv(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 Hf;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},ig=mu,mu._modelId=0,mu);Ly=ig=_V([VC(4,Pi),VC(5,s9),VC(6,mo)],Ly);class bV{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class CV extends zt{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=Qo(this,[]),this.range=Wn(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(is(()=>{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 EV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},W0=function(o,e){return function(t,i){e(t,i,o)}},Iy,_u;let Il=(_u=class extends zt{static get(e){return e.getContribution(Iy.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=zL("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Ia(this.editor),this._selection=Wn(this,a=>this._editorObs.cursorSelection.read(a)??new qi(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=Wc(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(g1(Ly,a),d,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=Z_(this,(a,d)=>{var u;return d||((u=this.model.read(a))==null?void 0:u.inlineEdit.read(a))!==void 0}),this._widget=Wc(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(g1(Fy,a),this.editor,this.model.map((d,u)=>d==null?void 0:d.inlineEdit.read(u)),yV(d=>{var u;return((u=this.model.read(d))==null?void 0:u.userPrompt)??Qo("empty","")}))}),this._register(o8(o0,this._contextKeyService,a=>{var d;return!!((d=this.model.read(a))!=null&&d.inlineEdit.read(a))})),this._register(o8(uV,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)}},Iy=_u,_u.ID="editor.contrib.inlineEditsController",_u);Il=Iy=EV([W0(1,tn),W0(2,Ln),W0(3,gr),W0(4,Pi),W0(5,ss)],Il);function yV(o){return Fk(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function ex(o){return{label:o.value,alias:o.original}}const A_=class A_ extends wt{constructor(){super({id:A_.ID,...ex(Fi("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:Ze.and(q.writable,o0),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Il.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};A_.ID=dV;let Py=A_;const k_=class k_ extends wt{constructor(){super({id:k_.ID,...ex(Fi("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:Ze.and(q.writable,o0),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Il.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};k_.ID=cV;let Ty=k_;class wV extends wt{constructor(){super({id:"editor.action.inlineEdits.trigger",...ex(Fi("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:q.writable})}async run(e,t){const i=Il.get(t);await vk(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class SV extends wt{constructor(){super({id:lV,...ex(Fi("action.inlineEdits.accept","Accept Inline Edit")),precondition:o0,menuOpts:{menuId:gi.InlineEditsActions,title:S("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:Qi.check},kbOpts:{primary:2058,weight:2e4,kbExpr:o0}})}async run(e,t){var n;t instanceof Hr&&(t=t.getParentEditor());const i=Il.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const B_=class B_ extends wt{constructor(){super({id:B_.ID,...ex(Fi("action.inlineEdits.hide","Hide Inline Edit")),precondition:o0,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Il.get(t);Xu(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};B_.ID="editor.action.inlineEdits.hide";let My=B_;un(Il.ID,Il,3);Re(wV);Re(Py);Re(Ty);Re(SV);Re(My);const Uu={Visible:new wn("parameterHintsVisible",!1),MultipleSignatures:new wn("parameterHintsMultipleSignatures",!1)};async function KB(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){bs(a)}}Qn.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Pn(jn.isUri(t)),Pn(Ii.isIPosition(i)),Pn(typeof n=="string"||!n);const s=o.get(Pi),r=await o.get(fa).createModelReference(t);try{const a=await KB(s.signatureHelpProvider,r.object.textEditorModel,Ii.lift(i),{triggerKind:mc.Invoke,isRetrigger:!1,triggerCharacter:n},ln.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var ic;(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})(ic||(ic={}));const F_=class F_ extends zt{constructor(e,t,i=F_.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new an),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=ic.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new er),this.triggerChars=new Fv,this.retriggerChars=new Fv,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new Hc(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=ic.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(qn)}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 ic.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const n=this._pendingTriggers.reduce(DV);this._pendingTriggers=[];const s={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),a=this.editor.getPosition();this.state=new ic.Pending(Ks(d=>KB(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 ic.Active(d.value),this._lastSignatureHelpResult.value=d,this._onChangedHints.fire(this.state.hints),!0)}catch(d){return e===this.triggerId&&(this.state=ic.Default),qn(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()}};F_.DEFAULT_DELAY=120;let Ry=F_;function DV(o,e){switch(e.triggerKind){case mc.Invoke:return e;case mc.ContentChange:return o;case mc.TriggerCharacter:default:return e}}var AV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}},Ny;const zo=wi,kV=vs("parameter-hints-next",Qi.chevronDown,S("parameterHintsNextIcon","Icon for show next parameter hint.")),BV=vs("parameter-hints-previous",Qi.chevronUp,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var bu;let Oy=(bu=class extends zt{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Ht),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new u0({editor:e},s,n)),this.keyVisible=Uu.Visible.bindTo(i),this.keyMultipleSignatures=Uu.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=zo(".editor-widget.parameter-hints-widget"),t=_i(e,zo(".phwrapper"));t.tabIndex=-1;const i=_i(t,zo(".controls")),n=_i(i,zo(".button"+Rn.asCSSSelector(BV))),s=_i(i,zo(".overloads")),r=_i(i,zo(".button"+Rn.asCSSSelector(kV)));this._register(Fn(n,"click",p=>{Bv.stop(p),this.previous()})),this._register(Fn(r,"click",p=>{Bv.stop(p),this.next()}));const a=zo(".body"),d=new uk(a,{alwaysConsumeMouseWheel:!0});this._register(d),t.appendChild(d.getDomNode());const u=_i(a,zo(".signature")),f=_i(a,zo(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:u,overloads:s,docs:f,scrollbar:d},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(p=>{this.visible&&this.editor.layoutContentWidget(this)}));const g=()=>{if(!this.domNodes)return;const p=this.editor.getOption(50),C=this.domNodes.element;C.style.fontSize=`${p.fontSize}px`,C.style.lineHeight=`${p.lineHeight/p.fontSize}`,C.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",p.fontFamily),C.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",jw.fontFamily)};g(),this._register(Rs.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=_i(this.domNodes.signature,zo(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const u=_i(n,zo("span"));u.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const u=zo("span.documentation");if(typeof a.documentation=="string")u.textContent=a.documentation;else{const f=this.renderMarkdownDocs(a.documentation);u.appendChild(f.element)}_i(this.domNodes.docs,zo("p",{},u))}if(i.documentation!==void 0)if(typeof i.documentation=="string")_i(this.domNodes.docs,zo("p",{},i.documentation));else{const u=this.renderMarkdownDocs(i.documentation);_i(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&&(Nr(S("hint","{0}, hint",u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new Ho,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"&&$h(t.documentation).length>0||t&&typeof t.documentation=="object"&&$h(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&$h(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&$h(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),_i(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|^)${Ig(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 Ny.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)}},Ny=bu,bu.ID="editor.widget.parameterHintsWidget",bu);Oy=Ny=AV([Vx(2,Ln),Vx(3,da),Vx(4,ha),Vx(5,ua)],Oy);Si("editorHoverWidget.highlightForeground",pk,S("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var FV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}},Hy,Cu;let r0=(Cu=class extends zt{static get(e){return e.getContribution(Hy.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Ry(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 Mw(()=>this._register(t.createInstance(Oy,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)}},Hy=Cu,Cu.ID="editor.controller.parameterHints",Cu);r0=Hy=FV([KD(1,tn),KD(2,Pi)],r0);class LV extends wt{constructor(){super({id:"editor.action.triggerParameterHints",label:S("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:q.hasSignatureHelpProvider,kbOpts:{kbExpr:q.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=r0.get(t);i==null||i.trigger({triggerKind:mc.Invoke})}}un(r0.ID,r0,2);Re(LV);const iS=175,nS=ko.bindToContribution(r0.get);Ri(new nS({id:"closeParameterHints",precondition:Uu.Visible,handler:o=>o.cancel(),kbOpts:{weight:iS,kbExpr:q.focus,primary:9,secondary:[1033]}}));Ri(new nS({id:"showPrevParameterHint",precondition:Ze.and(Uu.Visible,Uu.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:iS,kbExpr:q.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Ri(new nS({id:"showNextParameterHint",precondition:Ze.and(Uu.Visible,Uu.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:iS,kbExpr:q.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));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},PV=function(o,e){return function(t,i){e(t,i,o)}};class TV{constructor(e){this.instantiationService=e}init(...e){}}function MV(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=Ip((n,s)=>{const r=g1(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function RV(o){return VL()?MV(o,Wy):o()}let Wy=class extends TV{constructor(e,t){super(t),this.init(e)}};Wy=IV([PV(1,tn)],Wy);un(rp.ID,RV(()=>rp),0);Si("editor.placeholder.foreground",jL,S("placeholderForeground","Foreground color of the placeholder text in the editor."));var NV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jx=function(o,e){return function(t,i){e(t,i,o)}};const _0=new wn("renameInputVisible",!1,S("renameInputVisible","Whether the rename input widget is visible"));new wn("renameInputFocused",!1,S("renameInputFocused","Whether the rename input widget is focused"));let zy=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 Ht,this._visibleContextKey=_0.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Ho,this._inputWithButton=new OV,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 sS(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($L),i=e.getColor(UL);this._domNode.style.backgroundColor=String(e.getColor(hk)??""),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(qL)??"");const n=e.getColor(GL);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(r8)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(r8)??""),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;Pn(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=Pp(this.getDomNode().ownerDocument.body),t=wo(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}=ap.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;Pn(this._renameCandidateListView),Pn(this._nPxAvailableAbove!==void 0),Pn(this._nPxAvailableBelow!==void 0);const t=Vh(this._inputWithButton.domNode),i=Vh(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:yr(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 Ht;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(Fn(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),d.add(Fn(this._inputWithButton.button,as.KEY_DOWN,f=>{const g=new o9(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 Ii(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(is(()=>{this._renameCts=void 0,s.dispose(!0)})),d.add(is(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),d.add(is(()=>this._candidates.clear()));const u=new $_;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"),Pn(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),Pn(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Zs;const i=t?p1.Invoke:p1.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){Pn(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!ee.isEmpty(i)&&!ee.spansMultipleLines(i)&&ee.containsRange(e,i)&&(n=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:n,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const n=(...u)=>this._trace("_updateRenameCandidates",...u);n("start");const s=await Dp(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"&&Jx(u.value)?u.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=vA(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)}};zy=NV([jx(2,Wr),jx(3,As),jx(4,Ln),jx(5,Yu)],zy);class sS{constructor(e,t){this._disposables=new Ht,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=sS._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(xk({listInactiveFocusForeground:fk,listInactiveFocusBackground:gk}))}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`,Tf(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}=ap.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 ap(r,i)}renderElement(r,a,d){d.populate(r)}disposeTemplate(r){r.dispose()}};return new Hw("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class OV{constructor(){this._onDidInputChange=new an,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Ht}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=KL().setupManagedHover(eb("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Fn(this.input,as.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Fn(this.input,as.KEY_DOWN,e=>{const t=new o9(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Fn(this.input,as.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Fn(this.input,as.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(Fn(this.input,as.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Pn(this._inputNode),this._inputNode}get button(){return Pn(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=x1(Qi.sparkle)),Wa(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=x1(Qi.primitiveSquare)),Wa(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 kg=class kg{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=`${kg._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=x1(Qi.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),nk(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(ZL.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+kg._PADDING*2}}dispose(){}};kg._PADDING=2;let ap=kg;var HV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ql=function(o,e){return function(t,i){e(t,i,o)}},Vy;class oS{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const n=this._providers[this._providerRenameIdx];if(!n.resolveRenameLocation)break;const s=await n.resolveRenameLocation(this.model,this.position,e);if(s){if(s.rejectReason){t.push(s.rejectReason);continue}return s}}this._providerRenameIdx=0;const i=this.model.getWordAtPosition(this.position);return i?{range:new ee(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
|
|
76
|
+
`):void 0}:{range:ee.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
|
|
77
|
+
`):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
|
|
78
|
+
`)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(S("no result","No result.")),n);return r}}async function WV(o,e,t,i){const n=new oS(e,t,o),s=await n.resolveRenameLocation(ln.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,ln.None)}var Eu;let Uc=(Eu=class{static get(e){return e.getContribution(Vy.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 Ht,this._cts=new Zs,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(zy,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var b,E;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Zs,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new oS(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new If(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const w=i.resolveRenameLocation(n.token);this._progressService.showWhile(w,250),s=await w,e("resolved rename location")}catch(w){w instanceof U_?e("resolve rename location cancelled",JSON.stringify(w,null," ")):(e("resolve rename location failed",w instanceof Error?w:JSON.stringify(w,null," ")),(typeof w=="string"||Yx(w))&&((b=Ro.get(this.editor))==null||b.showMessage(w||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=Ro.get(this.editor))==null||E.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new If(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 w=>[w,await w.supportsAutomaticNewSymbolNamesTriggerKind??!1])),f=(w,A)=>{let I=u.slice();return w===p1.Automatic&&(I=I.filter(([M,R])=>R)),I.map(([M])=>M.provideNewSymbolNames(a,s.range,w,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=Dp(i.provideRenameEdits(p.newName,r.token),r.token).then(async w=>{if(!w){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(w.rejectReason){e(`returning early - rejected with reason: ${w.rejectReason}`),this._notificationService.info(w.rejectReason);return}this.editor.setSelection(ee.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(w,{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&&Nr(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)})},w=>{e("error when providing rename edits",JSON.stringify(w,null," ")),this._notificationService.error(S("rename.failed","Rename failed to compute edits")),this._logService.error(w)}).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)}},Vy=Eu,Eu.ID="editor.contrib.renameController",Eu);Uc=Vy=HV([Ql(1,tn),Ql(2,vo),Ql(3,V_),Ql(4,kp),Ql(5,Yu),Ql(6,XL),Ql(7,Pi),Ql(8,ua)],Uc);class zV extends wt{constructor(){super({id:"editor.action.rename",label:S("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:Ze.and(q.writable,q.hasRenameProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(Cs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return jn.isUri(n)&&Ii.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))))},qn):super.runCommand(e,t)}run(e,t){const i=e.get(Yu),n=Uc.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}un(Uc.ID,Uc,4);Re(zV);const rS=ko.bindToContribution(Uc.get);Ri(new rS({id:"acceptRenameInput",precondition:_0,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Ze.and(q.focus,Ze.not("isComposing")),primary:3}}));Ri(new rS({id:"acceptRenameInputWithPreview",precondition:Ze.and(_0,Ze.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Ze.and(q.focus,Ze.not("isComposing")),primary:2051}}));Ri(new rS({id:"cancelRenameInput",precondition:_0,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:q.focus,primary:9,secondary:[1033]}}));Vn(class extends Ao{constructor(){super({id:"focusNextRenameSuggestion",title:{...Fi("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:_0,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(Cs).getFocusedCodeEditor();if(!t)return;const i=Uc.get(t);i&&i.focusNextRenameSuggestion()}});Vn(class extends Ao{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Fi("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:_0,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(Cs).getFocusedCodeEditor();if(!t)return;const i=Uc.get(t);i&&i.focusPreviousRenameSuggestion()}});Bo("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Pn(typeof n=="string");const{renameProvider:s}=o.get(Pi);return WV(s,e,t,n)});Bo("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Pi),s=await new oS(e,t,i).resolveRenameLocation(ln.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});ca.as(Bp.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 VV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}},Af;let Pm=(Af=class extends zt{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 Ns(()=>{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=>jV(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()}},Af.ID="editor.sectionHeaderDetector",Af);Pm=VV([ZD(1,qs),ZD(2,Ol)],Pm);function jV(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}})}}un(Pm.ID,Pm,1);function $V(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 UV(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return YL()||$V(e),QL.wrap(e)}function ZB(o){const e=new Uint32Array(qV(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 UV(e)}function qV(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 Ib(o){return o&&!!o.data}function XB(o){return o&&Array.isArray(o.edits)}class GV{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function YB(o,e){return o.has(e)}function KV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function QB(o,e,t,i,n){const s=KV(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||!Ib(d)&&!XB(d))&&(d=null),new GV(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 ZV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class XV{constructor(e,t){this.provider=e,this.tokens=t}}function YV(o,e){return o.has(e)}function JB(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function aS(o,e,t,i){const n=JB(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(d){bs(d),a=null}return(!a||!Ib(a))&&(a=null),new XV(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}Qn.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Pn(t instanceof jn);const i=o.get(mo).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Pi),s=ZV(n,i);return s?s[0].getLegend():o.get(Us).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Qn.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Pn(t instanceof jn);const i=o.get(mo).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Pi);if(!YB(n,i))return o.get(Us).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await QB(n,i,null,null,ln.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!Ib(a))return;const d=ZB({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),d});Qn.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Pn(t instanceof jn);const n=o.get(mo).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Pi),r=JB(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!ee.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await aS(s,n,ee.lift(i),ln.None);if(a)return a.provider.getLegend()});Qn.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Pn(t instanceof jn),Pn(ee.isIRange(i));const n=o.get(mo).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Pi),r=await aS(s,n,ee.lift(i),ln.None);if(!(!r||!r.tokens))return ZB({id:0,type:"full",data:r.tokens.data})});const lS="editor.semanticHighlighting";function mv(o,e,t){var n;const i=(n=t.getValue(lS,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}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},La=function(o,e){return function(t,i){e(t,i,o)}},tc;let jy=class extends zt{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=f=>{this._watchers[f.uri.toString()]=new $y(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()];mv(f,i,n)?g||a(f):g&&d(f,g)}};t.getModels().forEach(f=>{mv(f,i,n)&&a(f)}),this._register(t.onModelAdded(f=>{mv(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(lS)&&u()})),this._register(i.onDidColorThemeChange(u))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};jy=eF([La(0,r9),La(1,mo),La(2,Wr),La(3,ss),La(4,gr),La(5,Pi)],jy);var Rc;let $y=(Rc=class extends zt{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:tc.REQUEST_MIN_DELAY,max:tc.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Ns(()=>this._fetchDocumentSemanticTokensNow(),tc.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=()=>{uo(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),uo(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!YB(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Zs,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=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 Ho(!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&&(Gc(d)||typeof d.message=="string"&&d.message.indexOf("busy")!==-1)||qn(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(XB(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&&(tc._copy(d,f-b,u,g-b,b),g-=b),C.data&&(tc._copy(C.data,0,u,g-C.data.length,C.data.length),g-=C.data.length),f=C.start}f>0&&tc._copy(d,0,u,0,f),t={resultId:t.resultId,data:u}}}if(Ib(t)){this._currentDocumentResponse=new QV(e,t.resultId,t.data);const a=Lk(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()}},tc=Rc,Rc.REQUEST_MIN_DELAY=300,Rc.REQUEST_MAX_DELAY=2e3,Rc);$y=tc=eF([La(1,r9),La(2,Wr),La(3,gr),La(4,Pi)],$y);class QV{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}d0(jy);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},z0=function(o,e){return function(t,i){e(t,i,o)}},kf;let Tm=(kf=class extends zt{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 Ns(()=>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(lS)&&(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(!mv(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!YV(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=Ks(r=>Promise.resolve(aS(this._provider,e,t,r))),s=new Ho(!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,Lk(d,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},kf.ID="editor.contrib.viewportSemanticTokens",kf);Tm=JV([z0(1,r9),z0(2,Wr),z0(3,ss),z0(4,gr),z0(5,Pi)],Tm);un(Tm.ID,Tm,1);class ej{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(a8(g)&&l8(f))break;f=g}for(d+=1;u<s.length;u++){const g=s.charCodeAt(u);if(l8(g)&&a8(f))break;if(g===95||g===45)break;f=g}d<u&&e.push({range:new ee(i.lineNumber,r+d,i.lineNumber,r+u)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new ee(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new ee(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var tj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ij=function(o,e){return function(t,i){e(t,i,o)}},Uy;class cS{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 cS(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var yu;let lp=(yu=class{static get(e){return e.getContribution(Uy.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 iF(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),ln.None).then(s=>{var r;if(!(!Yo(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!ja(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 cS(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=>qi.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},Uy=yu,yu.ID="editor.contrib.smartSelectController",yu);lp=Uy=tj([ij(1,Pi)],lp);class tF extends wt{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=lp.get(t);i&&await i.run(this._forward)}}class nj extends tF{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:S("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Qn.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class sj extends tF{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:S("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:gi.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}un(lp.ID,lp,4);Re(nj);Re(sj);async function iF(o,e,t,i,n){const s=o.all(e).concat(new ej(i.selectSubwords));s.length===1&&s.unshift(new mm);const r=[],a=[];for(const d of s)r.push(Promise.resolve(d.provideSelectionRanges(e,t,n)).then(u=>{if(Yo(u)&&u.length===t.length)for(let f=0;f<t.length;f++){a[f]||(a[f]=[]);for(const g of u[f])ee.isIRange(g.range)&&ee.containsPosition(g.range,t[f])&&a[f].push(ee.lift(g.range))}},bs));return await Promise.all(r),a.map(d=>{if(d.length===0)return[];d.sort((p,C)=>Ii.isBefore(p.getStartPosition(),C.getStartPosition())?1:Ii.isBefore(C.getStartPosition(),p.getStartPosition())||Ii.isBefore(p.getEndPosition(),C.getEndPosition())?-1:Ii.isBefore(C.getEndPosition(),p.getEndPosition())?1:0);const u=[];let f;for(const p of d)(!f||ee.containsRange(p,f)&&!ee.equalsRange(p,f))&&(u.push(p),f=p);if(!i.selectLeadingAndTrailingWhitespace)return u;const g=[u[0]];for(let p=1;p<u.length;p++){const C=u[p-1],b=u[p];if(b.startLineNumber!==C.startLineNumber||b.endLineNumber!==C.endLineNumber){const E=new ee(C.startLineNumber,e.getLineFirstNonWhitespaceColumn(C.startLineNumber),C.endLineNumber,e.getLineLastNonWhitespaceColumn(C.endLineNumber));E.containsRange(C)&&!E.equalsRange(C)&&b.containsRange(E)&&!b.equalsRange(E)&&g.push(E);const w=new ee(C.startLineNumber,1,C.endLineNumber,e.getLineMaxColumn(C.endLineNumber));w.containsRange(C)&&!w.equalsRange(E)&&b.containsRange(w)&&!b.equalsRange(w)&&g.push(w)}g.push(b)}return g})}Qn.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Pn(jn.isUri(t));const n=o.get(Pi).selectionRangeProvider,s=await o.get(fa).createModelReference(t);try{return iF(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ln.None)}finally{s.dispose()}});const oj=Object.freeze({View:Fi("view","View"),Help:Fi("help","Help"),Test:Fi("test","Test"),File:Fi("file","File"),Preferences:Fi("preferences","Preferences"),Developer:Fi({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class bg{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&&ja(this.startLineNumbers,e.startLineNumbers)&&ja(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new bg([],[],0)}}const XD=JA("stickyScrollViewLayer",{createHTML:o=>o}),jC="data-sticky-line-index",YD="data-sticky-is-line",rj="data-sticky-is-line-number",QD="data-sticky-is-folding-icon";class aj extends zt{constructor(e){super(),this._editor=e,this._foldingIconStore=new Ht,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 Hr),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(Fn(this._lineNumbersDomNode,as.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Fn(this._lineNumbersDomNode,as.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 Ii(t,1)).lineNumber,a=s.getViewLineRenderingData(r),d=this._editor.getOption(68);let u;try{u=Hg.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{u=[]}const f=new ik(!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 ek(2e3),p=tk(f,g);let C;XD?C=XD.createHTML(g.build()):C=g.build();const b=document.createElement("span");b.setAttribute(jC,String(e)),b.setAttribute(YD,""),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(jC,String(e)),E.setAttribute(rj,""),E.className="sticky-line-number",E.style.lineHeight=`${this._lineHeight}px`;const w=n.contentLeft;E.style.width=`${w}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 lj(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 cj(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=JL(t.characterMapping,e,0);return new Ii(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,jC);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,YD)!==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 lj{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 cj{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=Rn.asClassName(e?am:rm)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class Cg{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class Mm{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class nF{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var Pb=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},cp=function(o,e){return function(t,i){e(t,i,o)}},Eg;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(Eg||(Eg={}));var xc;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(xc||(xc={}));let qy=class extends zt{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Hc(300)),this._updateOperation=this._register(new Ht),this._editor.getOption(116).defaultModel){case Eg.OUTLINE_MODEL:this._modelProviders.push(new Gy(this._editor,n));case Eg.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new Zy(this._editor,t,n));case Eg.INDENTATION_MODEL:this._modelProviders.push(new Ky(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 xc.CANCELED:return this._updateOperation.clear(),null;case xc.VALID:return t.stickyModel}}return null}).catch(t=>(qn(t),null))}};qy=Pb([cp(2,tn),cp(3,Pi)],qy);class sF extends zt{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,xc.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=Ks(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?xc.CANCELED:(this._stickyModel=this.createStickyModel(e,i),xc.VALID):this._invalid()).then(void 0,i=>(qn(i),xc.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let Gy=class extends sF{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return al.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 nF(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(ml.first(e.children.values())instanceof SB){const a=ml.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 Cg(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),f=new Cg(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 Mm(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 Cg(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Mm(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 RE?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};Gy=Pb([cp(1,Pi)],Gy);class oF extends sF{constructor(e){super(e),this._foldingLimitReporter=new EB(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new nF(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new Mm(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 Mm(new Cg(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(d),i.push(d)}return n}}let Ky=class extends oF{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new K9(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};Ky=Pb([cp(1,qs)],Ky);let Zy=class extends oF{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=$c.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new Z9(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}};Zy=Pb([cp(2,Pi)],Zy);var dj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}};class uj{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let Xy=class extends zt{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new an),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Ht),this._updateSoon=this._register(new Ns(()=>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(is(()=>{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 qy(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new Zs,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,n,s){if(t.children.length===0)return;let r=s;const a=[];for(let f=0;f<t.children.length;f++){const g=t.children[f];g.range&&a.push(g.range.startLineNumber)}const d=this.updateIndex(Pv(a,e.startLineNumber,(f,g)=>f-g)),u=this.updateIndex(Pv(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 uj(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}};Xy=dj([JD(1,Pi),JD(2,qs)],Xy);var hj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Bh=function(o,e){return function(t,i){e(t,i,o)}},Yy,wu;let Pl=(wu=class extends zt{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 Ht,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 aj(this._editor),this._stickyLineCandidateProvider=new Xy(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=bg.Empty,this._onDidResize(),this._readConfiguration();const d=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(f=>{this._readConfigurationChange(f)})),this._register(Fn(d,as.CONTEXT_MENU,async f=>{this._onContextMenu(Id(d),f)})),this._stickyScrollFocusedContextKey=q.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=q.stickyScrollVisible.bindTo(this._contextKeyService);const u=this._register(Pf(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(Fn(d,as.MOUSE_DOWN,f=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(Yy.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 Ht,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(ee.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Ht),t=this._register(new Eb(this._editor,{extractLineNumberFromMouseEvent:s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const r=s.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new ee(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(Dl(n,as.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 Ii(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 Ii(u,1)}this._revealPosition(d)})),this._register(Dl(n,as.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(Fn(n,as.MOUSE_LEAVE,s=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,r])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:d,textElement:u}=a;if(!d.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=d,e.clear();else if(u.style.textDecoration==="underline")return;const f=new Zs;e.add(is(()=>f.dispose(!0)));let g;Xp(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Ii(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(is(()=>{g.style.textDecoration="none"}))):g||(g=C,g.style.textDecoration="underline",e.add(is(()=>{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(oB,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new e7(e,t);this._contextMenuService.showContextMenu({menuId:gi.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;U9(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=$c.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=bg.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 Cg(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,w=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>w&&E<=I&&(s.push(g),r.push(p+1));if(s.length===t)break}}}return this._endLineNumbers=r,new bg(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},Yy=wu,wu.ID="store.contrib.stickyScrollController",wu);Pl=Yy=hj([Bh(1,a0),Bh(2,Pi),Bh(3,tn),Bh(4,qs),Bh(5,gr),Bh(6,Ln)],Pl);class fj extends Ao{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Fi("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:S({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Fi("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:oj.View,toggled:{condition:Ze.equals("config.editor.stickyScroll.enabled",!0),title:S("stickyScroll","Sticky Scroll"),mnemonicTitle:S({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:gi.CommandPalette},{id:gi.MenubarAppearanceMenu,group:"4_editor",order:3},{id:gi.StickyScrollContext}]})}async run(e){const t=e.get(ss),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const Tb=100;class gj extends la{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Fi("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:S({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:Ze.and(Ze.has("config.editor.stickyScroll.enabled"),q.stickyScrollVisible),menu:[{id:gi.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Pl.get(t))==null||i.focus()}}class pj extends la{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Fi("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Tb,primary:18}})}runEditorCommand(e,t){var i;(i=Pl.get(t))==null||i.focusNext()}}class xj extends la{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Fi("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Tb,primary:16}})}runEditorCommand(e,t){var i;(i=Pl.get(t))==null||i.focusPrevious()}}class vj extends la{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Fi("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Tb,primary:3}})}runEditorCommand(e,t){var i;(i=Pl.get(t))==null||i.goToFocused()}}class mj extends la{constructor(){super({id:"editor.action.selectEditor",title:Fi("selectEditor.title","Select Editor"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Tb,primary:9}})}runEditorCommand(e,t){var i;(i=Pl.get(t))==null||i.selectEditor()}}un(Pl.ID,Pl,1);Vn(fj);Vn(gj);Vn(xj);Vn(pj);Vn(vj);Vn(mj);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},ng=function(o,e){return function(t,i){e(t,i,o)}};class _j{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 Qy=class extends t7{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=ml.slice(t,i),s=ml.slice(t,0,i);let r=5;for(const a of ml.concat(n,s)){if(a.score===Rg.Default)continue;const d=new ee(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new _j(d,u,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve(ln.None)}return e}};Qy=rF([ng(5,Bb)],Qy);let Jy=class extends zt{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(Xh.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(Xh.valueFor(r,d)!=="inline")return;let u=e.getWordAtPosition(t),f;if(u!=null&&u.word||(f=this._getTriggerCharacterInfo(e,t)),!(u!=null&&u.word)&&!f||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let g;const p=e.getValueInRange(new ee(t.lineNumber,1,t.lineNumber,t.column));if(!f&&((C=this._lastResult)!=null&&C.canBeReused(e,t.lineNumber,u))){const b=new OD(p,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=b,this._lastResult.acquire(),g=this._lastResult}else{const b=await X9(this._languageFeatureService.completionProvider,e,t,new ep(void 0,bm.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 w=new rc(b.items,t.column,new OD(p,0),_m.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},E);g=new Qy(e,t.lineNumber,u,w,b,this._suggestMemoryService)}return this._lastResult=g,g}handleItemDidShow(e,t){t.completion.resolve(ln.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(ee.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(const r of this._languageFeatureService.completionProvider.all(e))(s=r.triggerCharacters)!=null&&s.includes(i)&&n.add(r);if(n.size!==0)return{providers:n,ch:i}}};Jy=rF([ng(0,Pi),ng(1,l0),ng(2,Bb),ng(3,Cs)],Jy);d0(Jy);class bj extends wt{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 Ho;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}Re(bj);const L_=class L_ extends Ao{constructor(){super({id:L_.ID,title:Fi({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:Fi("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=!c8.getTabFocusMode();c8.setTabFocusMode(t),t?Nr(S("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):Nr(S("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};L_.ID="editor.action.toggleTabFocusMode";let ew=L_;Vn(ew);var Cj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},e2=function(o,e){return function(t,i){e(t,i,o)}};let tw=class extends zt{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=_i(e,wi("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??eb("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new lC(this.el,"click")),a=this._register(new lC(this.el,"keypress")),d=Rs.chain(a.event,g=>g.map(p=>new o9(p)).filter(p=>p.keyCode===3)),u=this._register(new lC(this.el,i7.Tap)).event;this._register(bA.addTarget(this.el));const f=Rs.any(r.event,d,u);this._register(f(g=>{this.enabled&&(Bv.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)}};tw=Cj([e2(3,Tp),e2(4,da)],tw);var aF=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lF=function(o,e){return function(t,i){e(t,i,o)}};const Ej=26;let iw=class extends zt{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(nw))}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,Ej)}};iw=aF([lF(1,tn)],iw);let nw=class extends zt{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(u0,{}),this.element=wi("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=wi("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Wa(this.element)}show(e){Wa(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=_i(this.element,wi("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(wi(`div${Rn.asCSSSelector(e.icon)}`));const n=_i(this.element,wi("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=_i(this.element,wi("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(tw,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=_i(this.element,wi("div.action-container"));this.actionBar=this._register(new Fg(s)),this.actionBar.push(this._register(new Nf("banner.close","Close Banner",Rn.asClassName(VA),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};nw=aF([lF(0,tn)],nw);var dS=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hf=function(o,e){return function(t,i){e(t,i,o)}};const yj=vs("extensions-warning-message",Qi.warning,S("warningIcon","Icon shown with a warning message in the extensions editor."));var Bf;let dp=(Bf=class extends zt{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 hp};else if(s.ambiguousCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new qu};else if(s.invisibleCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new up};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:yj,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(iw,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=wj(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"?n7:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new sw(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Sj(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},Bf.ID="editor.contrib.unicodeHighlighter",Bf);dp=dS([hf(1,Ol),hf(2,s7),hf(3,tn)],dp);function wj(o,e){return{nonBasicASCII:e.nonBasicASCII===cC?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===cC?!o:e.includeComments,includeStrings:e.includeStrings===cC?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let sw=class extends zt{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 Ns(()=>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:Rm.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!Ik(t,e))return null;const i=t.getValueInRange(e.range);return{reason:dF(i,this._options),inComment:Tk(t,e),inString:Pk(t,e)}}};sw=dS([hf(3,Ol)],sw);class Sj extends zt{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 Ns(()=>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=Mk.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:Rm.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 Ik(t,e)?{reason:dF(i,this._options),inComment:Tk(t,e),inString:Pk(t,e)}:null}}const cF=S("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let ow=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(dp.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=$C(g);let C;switch(u.reason.kind){case 0:{sk(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,$C(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,$C(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"),w=`command:${Nm.ID}?${encodeURIComponent(JSON.stringify(b))}`,A=new lo("",!0).appendMarkdown(C).appendText(" ").appendLink(w,E,cF);s.push(new Ir(this,d.range,[A],!1,a++))}return s}renderHoverParts(e,t){return eR(e,t,this._editor,this._languageService,this._openerService)}};ow=dS([hf(1,ha),hf(2,da)],ow);function rw(o){return`U+${o.toString(16).padStart(4,"0")}`}function $C(o){let e=`\`${rw(o)}\``;return Rk.isInvisibleCharacter(o)||(e+=` "${`${Dj(o)}`}"`),e}function Dj(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function dF(o,e){return Mk.computeUnicodeHighlightReason(o,e)}const I_=class I_{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}};I_.instance=new I_;let Rm=I_;class Aj extends wt{constructor(){super({id:qu.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(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(kl.includeComments,!1,2)}}class kj extends wt{constructor(){super({id:qu.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(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(kl.includeStrings,!1,2)}}const P_=class P_ extends wt{constructor(){super({id:P_.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(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(kl.ambiguousCharacters,!1,2)}};P_.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let qu=P_;const T_=class T_ extends wt{constructor(){super({id:T_.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(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(kl.invisibleCharacters,!1,2)}};T_.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let up=T_;const M_=class M_ extends wt{constructor(){super({id:M_.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(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(kl.nonBasicASCII,!1,2)}};M_.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let hp=M_;const R_=class R_ extends wt{constructor(){super({id:R_.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(Ml),f=e.get(ss);function g(b){return Rk.isInvisibleCharacter(b)?S("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",rw(b)):S("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${rw(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()=>{Fj(f,[b])}});if(p.push({label:g(n),run:()=>Bj(f,[n])}),a){const b=new Aj;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(r){const b=new kj;p.push({label:b.label,run:async()=>b.runAction(f)})}if(s.kind===0){const b=new qu;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===1){const b=new up;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===2){const b=new hp;p.push({label:b.label,run:async()=>b.runAction(f)})}else Lj(s);const C=await u.pick(p,{title:cF});C&&await C.run()}};R_.ID="editor.action.unicodeHighlight.showExcludeOptions";let Nm=R_;async function Bj(o,e){const t=o.getValue(kl.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(kl.allowedCharacters,i,2)}async function Fj(o,e){var n;const t=(n=o.inspect(kl.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(kl.allowedLocales,i,2)}function Lj(o){throw new Error(`Unexpected value: ${o}`)}Re(qu);Re(up);Re(hp);Re(Nm);un(dp.ID,dp,1);th.register(ow);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},t2=function(o,e){return function(t,i){e(t,i,o)}};const uF="ignoreUnusualLineTerminators";function Pj(o,e,t){o.setModelProperty(e.uri,uF,t)}function Tj(o,e){return o.getModelProperty(e.uri,uF)}var Ff;let Om=(Ff=class extends zt{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()||Tj(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`.",Ua(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){Pj(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},Ff.ID="editor.contrib.unusualLineTerminatorsDetector",Ff);Om=Ij([t2(1,a9),t2(2,Cs)],Om);un(Om.ID,Om,1);var Mj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rj=function(o,e){return function(t,i){e(t,i,o)}};class i2{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,d8,!1).map(a=>({range:a.range,kind:Mv.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new Oc,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,d8,!1).map(f=>({range:f.range,kind:Mv.Text}));u&&s.set(a.uri,u)}return s}}let aw=class extends zt{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new i2)),this._register(e.multiDocumentHighlightProvider.register("*",new i2))}};aw=Mj([Rj(0,Pi)],aw);var hF=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_v=function(o,e){return function(t,i){e(t,i,o)}},gs,lw;const uS=new wn("hasWordHighlights",!1);function fF(o,e,t,i){const n=o.ordered(e);return t9(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,bs)),s=>s!=null).then(s=>{if(s){const r=new Oc;return r.set(e.uri,s),r}return new Oc})}function Nj(o,e,t,i,n,s){const r=o.ordered(e);return t9(r.map(a=>()=>{const d=s.filter(u=>r7(u)).filter(u=>a7(a.selector,u.uri,u.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,d,n)).then(void 0,bs)}),a=>a!=null)}class gF{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=Ks(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new ee(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,s=t.startColumn,r=t.endColumn,a=this._getCurrentWordRange(e,t);let d=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let u=0,f=i.length;!d&&u<f;u++){const g=i.getRange(u);g&&g.startLineNumber===n&&g.startColumn<=s&&g.endColumn>=r&&(d=!0)}return d}cancel(){this.result.cancel()}}class Oj extends gF{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return fF(this._providers,e,t.getPosition(),n).then(s=>s||new Oc)}}class Hj extends gF{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return Nj(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new Oc)}}function Wj(o,e,t,i,n){return new Oj(e,t,n,o)}function zj(o,e,t,i,n,s){return new Hj(e,t,n,o,s)}Bo("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Pi),n=await fF(i.documentHighlightProvider,e,t,ln.None);return n==null?void 0:n.get(e.uri)});var Nc;let cw=(Nc=class{constructor(e,t,i,n,s){this.toUnhook=new Ht,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Oc,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new Hc(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=uS.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=>{o7(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():gs.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=gs.query)==null?void 0:d.modelInfo)==null?void 0:u.model);break;case"multiFile":gs.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,gs.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(ee.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);Nr(`${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);Nr(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=gs.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),gs.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()||Av(n.getModel().uri,e==null?void 0:e.uri))continue;const s=gs.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=qc.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)gs.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==Eo.vscodeNotebookCell&&((i=(t=gs.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==Eo.vscodeNotebookCell?(gs.query=null,this._run()):(n=gs.query)!=null&&n.modelInfo&&(gs.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)!==Eo.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===Eo.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const d=a.getModel();d&&d!==e&&d.uri.scheme===Eo.vscodeNotebookCell&&s.push(d)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!Nk(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){gs.query=null,this._stopAll();return}const a=r.startColumn,d=r.endColumn,u=this._getWord();if(!u||u.startColumn>a||u.endColumn<d){gs.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),gs.query={modelInfo:{model:this.model,selection:r},word:u}}else if(!gs.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(Av(this.editor.getModel().uri,(n=gs.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(!gs.query||!gs.query.modelInfo||gs.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(gs.query.modelInfo.model,gs.query.modelInfo.selection,gs.query.word,a),(s=this.workerRequest)==null||s.result.then(d=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=d||[],this._beginRenderDecorations())},qn)}}computeWithModel(e,t,i,n){return n.length?zj(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):Wj(this.providers,e,t,i,this.editor.getOption(132))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){var t,i,n;this.renderDecorationsTimer=-1;const e=this.codeEditorService.listCodeEditors();for(const s of e){const r=qc.get(s);if(!r)continue;const a=[],d=(t=s.getModel())==null?void 0:t.uri;if(d&&this.workerRequestValue.has(d)){const u=gs.storedDecorationIDs.get(d),f=this.workerRequestValue.get(d);if(f)for(const p of f)p.range&&a.push({range:p.range,options:Bz(p.kind)});let g=[];s.changeDecorations(p=>{g=p.deltaDecorations(u??[],a)}),gs.storedDecorationIDs=gs.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()}},gs=Nc,Nc.storedDecorationIDs=new Oc,Nc.query=null,Nc);cw=gs=hF([_v(4,Cs)],cw);var Su;let qc=(Su=class extends zt{static get(e){return e.getContribution(lw.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new cw(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()}},lw=Su,Su.ID="editor.contrib.wordHighlighter",Su);qc=lw=hF([_v(1,Ln),_v(2,Pi),_v(3,Cs)],qc);class pF extends wt{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=qc.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class Vj extends pF{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:uS,kbOpts:{kbExpr:q.editorTextFocus,primary:65,weight:100}})}}class jj extends pF{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:uS,kbOpts:{kbExpr:q.editorTextFocus,primary:1089,weight:100}})}}class $j extends wt{constructor(){super({id:"editor.action.wordHighlight.trigger",label:S("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=qc.get(t);n&&n.restoreViewState(!0)}}un(qc.ID,qc,0);Re(Vj);Re(jj);Re($j);d0(aw);class Mb extends ko{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=Qu(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,d=r.map(u=>{const f=new Ii(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=>l7.fromModelSelection(u))),d.length===1){const u=new Ii(d[0].positionLineNumber,d[0].positionColumn);t.revealPosition(u,0)}}_moveTo(e,t,i){return i?new qi(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new qi(t.lineNumber,t.column,t.lineNumber,t.column)}}class Xc extends Mb{_move(e,t,i,n,s){return Hp.moveWordLeft(e,t,i,n,s)}}class Yc extends Mb{_move(e,t,i,n,s){return Hp.moveWordRight(e,t,i,n)}}class Uj extends Xc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class qj extends Xc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class Gj extends Xc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Ze.and(q.textInputFocus,(e=Ze.and(sb,ob))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class Kj extends Xc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class Zj extends Xc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class Xj extends Xc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Ze.and(q.textInputFocus,(e=Ze.and(sb,ob))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class Yj extends Xc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(rb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Qj extends Xc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(rb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Jj extends Yc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class e$ extends Yc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Ze.and(q.textInputFocus,(e=Ze.and(sb,ob))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class t$ extends Yc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class i$ extends Yc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class n$ extends Yc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Ze.and(q.textInputFocus,(e=Ze.and(sb,ob))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class s$ extends Yc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class o$ extends Yc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(rb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class r$ extends Yc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(rb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Rb extends ko{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(qs);if(!t.hasModel())return;const s=Qu(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 Sp(b,"")});t.pushUndoStop(),t.executeCommands(this.id,p),t.pushUndoStop()}}class hS extends Rb{_delete(e,t){const i=Hp.deleteWordLeft(e,t);return i||new ee(1,1,1,1)}}class fS extends Rb{_delete(e,t){const i=Hp.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new ee(n,s,n,s)}}class a$ extends hS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:q.writable})}}class l$ extends hS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:q.writable})}}class c$ extends hS{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class d$ extends fS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:q.writable})}}class u$ extends fS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:q.writable})}}class h$ extends fS{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class f$ extends wt{constructor(){super({id:"deleteInsideWord",precondition:q.writable,label:S("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=Qu(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(d=>{const u=Hp.deleteInsideWord(n,s,d);return new Sp(u,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}Ri(new Uj);Ri(new qj);Ri(new Gj);Ri(new Kj);Ri(new Zj);Ri(new Xj);Ri(new Jj);Ri(new e$);Ri(new t$);Ri(new i$);Ri(new n$);Ri(new s$);Ri(new Yj);Ri(new Qj);Ri(new o$);Ri(new r$);Ri(new a$);Ri(new l$);Ri(new c$);Ri(new d$);Ri(new u$);Ri(new h$);Re(f$);class g$ extends Rb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=ab.deleteWordPartLeft(e);return i||new ee(1,1,1,1)}}class p$ extends Rb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=ab.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new ee(n,s,n,s)}}class xF extends Mb{_move(e,t,i,n,s){return ab.moveWordPartLeft(e,t,i,s)}}class x$ extends xF{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Qn.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class v$ extends xF{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Qn.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class vF extends Mb{_move(e,t,i,n,s){return ab.moveWordPartRight(e,t,i)}}class m$ extends vF{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class _$ extends vF{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}Ri(new g$);Ri(new p$);Ri(new x$);Ri(new v$);Ri(new m$);Ri(new _$);const LS=class LS extends zt{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=Ro.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new lo(S("editor.simple.readonly","Cannot edit in read-only input")):t=new lo(S("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};LS.ID="editor.contrib.readOnlyMessageController";let Hm=LS;un(Hm.ID,Hm,2);var b$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}};let dw=class extends zt{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Qo(this,void 0);const n=Pd("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=Pd("_textModel.onDidChangeContent",Rs.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(Ip(async(r,a)=>{n.read(r),s.read(r);const d=a.add(new u7),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(d7(Mp(s=>s.range.endLineNumber-s.range.startLineNumber,Y_))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};dw=b$([n2(1,Pi),n2(2,Jp)],dw);c7.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(dw,o));const IS=class IS extends zt{constructor(e){super(),this.editor=e,this.widget=null,c1&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new uw(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};IS.ID="editor.contrib.iPadShowKeyboard";let Wm=IS;const N_=class N_ extends zt{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Fn(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Fn(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return N_.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};N_.ID="editor.contrib.ShowKeyboardWidget";let uw=N_;un(Wm.ID,Wm,3);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},s2=function(o,e){return function(t,i){e(t,i,o)}},hw,Du;let fp=(Du=class extends zt{static get(e){return e.getContribution(hw.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(J_.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 fw(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},hw=Du,Du.ID="editor.contrib.inspectTokens",Du);fp=hw=C$([s2(1,Ok),s2(2,ha)],fp);class E$ extends wt{constructor(){super({id:"editor.action.inspectTokens",label:p7.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=fp.get(t);i==null||i.launch()}}function y$(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 w$(o,e){const t=J_.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>h7,tokenize:(n,s,r)=>g7(e,r),tokenizeEncoded:(n,s,r)=>f7(i,r)}}const O_=class O_ extends zt{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=w$(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 O_._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)}kv(this._domNode,wi("h2.tm-token",void 0,y$(r),wi("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),_i(this._domNode,wi("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;_i(this._domNode,wi("table.tm-metadata-table",void 0,wi("tbody",void 0,wi("tr",void 0,wi("td.tm-metadata-key",void 0,"language"),wi("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),wi("tr",void 0,wi("td.tm-metadata-key",void 0,"token type"),wi("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),wi("tr",void 0,wi("td.tm-metadata-key",void 0,"font style"),wi("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),wi("tr",void 0,wi("td.tm-metadata-key",void 0,"foreground"),wi("td.tm-metadata-value",void 0,`${a?vn.Format.CSS.formatHex(a.foreground):"-?-"}`)),wi("tr",void 0,wi("td.tm-metadata-key",void 0,"background"),wi("td.tm-metadata-value",void 0,`${a?vn.Format.CSS.formatHex(a.background):"-?-"}`))))),_i(this._domNode,wi("hr.tokens-inspect-separator")),i<t.tokens1.length&&_i(this._domNode,wi("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=J_.getColorMap(),i=T0.getLanguageId(e),n=T0.getTokenType(e),s=T0.getFontStyle(e),r=T0.getForeground(e),a=T0.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]}}};O_._ID="editor.contrib.inspectTokensWidget";let fw=O_;un(fp.ID,fp,4);Re(E$);var S$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},o2=function(o,e){return function(t,i){e(t,i,o)}},sg,Au;let gw=(Au=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=ca.as(Wp.Quickaccess)}provide(e){const t=new Ht;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(sg.PREFIX.length));n&&n.prefix&&n.prefix!==sg.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==sg.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}})}},sg=Au,Au.PREFIX="?",Au);gw=sg=S$([o2(0,Ml),o2(1,As)],gw);ca.as(Wp.Quickaccess).registerQuickAccessProvider({ctor:gw,prefix:"",helpEntries:[{description:x7.helpQuickAccessActionLabel}]});class mF{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new Ht;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 Ht,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=Hk(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(Wk(t.onCancellationRequested)(()=>{var u;return(u=r.restoreViewState)==null?void 0:u.call(r)}))}n.add(is(()=>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&&Tf(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return Nk(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:Fs(UA),position:Ha.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 H_=class H_ extends mF{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,zt.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Ht;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(H_.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=Hk(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(is(()=>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}};H_.PREFIX=":";let pw=H_;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},A$=function(o,e){return function(t,i){e(t,i,o)}};let gp=class extends pw{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Rs.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};gp=D$([A$(0,Cs)],gp);var ku;let _F=(ku=class extends wt{constructor(){super({id:ku.ID,label:zk.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Ml).quickAccess.show(gp.PREFIX)}},ku.ID="editor.action.gotoLine",ku);Re(_F);ca.as(Wp.Quickaccess).registerQuickAccessProvider({ctor:gp,prefix:gp.PREFIX,helpEntries:[{description:zk.gotoLineActionLabel,commandId:_F.ID}]});const bF=[void 0,[]];function UC(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?k$(o,n.values,t,i):CF(o,e,t,i)}function k$(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,d]=CF(o,r,t,i);if(typeof a!="number")return bF;n+=a,s.push(...d)}return[n,B$(s)]}function CF(o,e,t,i){const n=dk(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],Q_(n)]:bF}function B$(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!F$(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 F$(o,e){return!(o.end<e.start||e.end<o.start)}function r2(o){return o.startsWith('"')&&o.endsWith('"')}const EF=" ";function xw(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=a2(o),s=t.indexOf(v1)>=0,r=r2(o);let a;const d=o.split(EF);if(d.length>1)for(const u of d){const f=r2(u),{pathNormalized:g,normalized:p,normalizedLowercase:C}=a2(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 a2(o){let e;j_?e=o.replace(/\//g,v1):e=o.replace(/\\/g,v1);const t=v7(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function l2(o){return Array.isArray(o)?xw(o.map(e=>e.original).join(EF)):xw(o.original)}var L$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},c2=function(o,e){return function(t,i){e(t,i,o)}},bv,ia;let zd=(ia=class extends mF{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.")),zt.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):zt.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Ht;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 $_,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(is(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var g;const r=e.editor,a=new Ht;a.add(i.onDidAccept(p=>{var b;const[C]=i.selectedItems;C&&C.range&&(this.gotoLocation(e,{range:C.range.selection,keyMods:i.keyMods,preserveFocus:p.inBackground}),(b=s==null?void 0:s.handleAccept)==null||b.call(s,C),p.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:p})=>{p&&p.range&&(this.gotoLocation(e,{range:p.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const d=this.getDocumentSymbols(t,n);let u;const f=async p=>{u==null||u.dispose(!0),i.busy=!1,u=new Zs(n),i.busy=!0;try{const C=xw(i.value.substr(bv.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=C7(b,w=>!!(w.type!=="separator"&&w.range&&ee.containsPosition(w.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 w,A;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(bv.SCOPE_PREFIX)===0,d=a?1:0;let u,f;t.values&&t.values.length>1?(u=l2(t.values[0]),f=l2(t.values.slice(1))):u=t;let g;const p=(A=(w=this.options)==null?void 0:w.openSideBySideDirection)==null?void 0:A.call(w);p&&(g=[{iconClass:p==="right"?Rn.asClassName(Qi.splitHorizontal):Rn.asClassName(Qi.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=m7(M.name),P=`$(${_7.toIcon(M.kind).id}) ${R}`,V=P.length-R.length;let $=M.containerName;i!=null&&i.extraContainerLabel&&($?$=`${i.extraContainerLabel} • ${$}`:$=i.extraContainerLabel);let Q,re,he,Z;if(t.original.length>d){let _e=!1;if(u!==t&&([Q,re]=UC(P,{...t,values:void 0},d,V),typeof Q=="number"&&(_e=!0)),typeof Q!="number"&&([Q,re]=UC(P,u,d,V),typeof Q!="number"))continue;if(!_e&&f){if($&&f.original.length>0&&([he,Z]=UC($,f)),typeof he!="number")continue;typeof Q=="number"&&(Q+=he)}}const ce=M.tags&&M.tags.indexOf(1)>=0;C.push({index:I,kind:M.kind,score:Q,label:P,ariaLabel:b7(M.name,M.kind),description:$,highlights:ce?void 0:{label:re,description:Z},range:{selection:ee.collapseToStart(M.selectionRange),decoration:M.range},uri:s.uri,symbolName:R,strikethrough:ce,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=Xw(GC[I]||qC,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=GC[e.kind]||qC,n=GC[t.kind]||qC,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()}},bv=ia,ia.PREFIX="@",ia.SCOPE_PREFIX=":",ia.PREFIX_BY_CATEGORY=`${ia.PREFIX}${ia.SCOPE_PREFIX}`,ia);zd=bv=L$([c2(0,Pi),c2(1,Jp)],zd);const qC=S("property","properties ({0})"),GC={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 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},KC=function(o,e){return function(t,i){e(t,i,o)}};let vw=class extends zd{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Rs.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};vw=I$([KC(0,Cs),KC(1,Pi),KC(2,Jp)],vw);const W_=class W_ extends wt{constructor(){super({id:W_.ID,label:m1.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:q.hasDocumentSymbolProvider,kbOpts:{kbExpr:q.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Ml).quickAccess.show(zd.PREFIX,{itemActivation:E7.NONE})}};W_.ID="editor.action.quickOutline";let zm=W_;Re(zm);ca.as(Wp.Quickaccess).registerQuickAccessProvider({ctor:vw,prefix:zd.PREFIX,helpEntries:[{description:m1.quickOutlineActionLabel,prefix:zd.PREFIX,commandId:zm.ID},{description:m1.quickOutlineByCategoryActionLabel,prefix:zd.PREFIX_BY_CATEGORY}]});function P$(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class yg{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 P$(yg.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=yg.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=yg.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 T$(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 Qh;(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"})(Qh||(Qh={}));function ZC(o){return Array.isArray(o.items)}function d2(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class M$ extends zt{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var u;const n=new Ht;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 w;const f=r.value=new Ht;s==null||s.dispose(!0),e.busy=!1,s=new Zs(t);const g=s.token;let p=e.value.substring(this.prefix.length);(w=this.options)!=null&&w.shouldSkipTrimPickFilter||(p=p.trim());const C=this._getPicks(p,f,g,i),b=(A,I)=>{var P;let M,R;if(ZC(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)&&(y7(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 ib(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;ZC(A.picks)?(P=A.picks.items,V=A.picks.active):P=A.picks;let $,Q;if(ZC(R)?($=R.items,Q=R.active):$=R,$.length>0||!I){let re;if(!V&&!Q){const he=e.activeItems[0];he&&P.indexOf(he)!==-1&&(re=he)}b({items:[...P,...$],active:V||Q||re})}}finally{g.isCancellationRequested||(e.busy=!1),M=!0}})()])};if(C!==null)if(d2(C))await E(C);else if(!(C instanceof Promise))b(C);else{e.busy=!0;try{const A=await C;if(g.isCancellationRequested)return;d2(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 Qh.NO_ACTION:break;case Qh.CLOSE_PICKER:e.hide();break;case Qh.REFRESH_PICKER:a();break;case Qh.REMOVE_ITEM:{const w=e.items.indexOf(g);if(w!==-1){const A=e.items.slice(),I=A.splice(w,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 yF=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(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)}},xd,ys,Ma;let mw=(Ma=class extends M${constructor(e,t,i,n,s,r){super(xd.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(_w)),this.options=e}async _getPicks(e,t,i,n){var C,b;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=Wk(()=>{const E=new yg;E.updateDocuments(s.map(A=>({key:A.commandId,textChunks:[this.getTfIdfChunk(A)]})));const w=E.calculateScores(e,i);return T$(w).filter(A=>A.score>xd.TFIDF_THRESHOLD).slice(0,xd.TFIDF_MAX_RESULTS)}),a=[];for(const E of s){const w=xd.WORD_FILTER(e,E.label)??void 0,A=E.commandAlias?xd.WORD_FILTER(e,E.commandAlias)??void 0:void 0;if(w||A)E.highlights={label:w,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 w=d.get(E.label);w?(E.description=E.commandId,w.description=w.commandId):d.set(E.label,E)}a.sort((E,w)=>{if(E.tfIdfScore&&w.tfIdfScore)return E.tfIdfScore===w.tfIdfScore?E.label.localeCompare(w.label):w.tfIdfScore-E.tfIdfScore;if(E.tfIdfScore)return 1;if(w.tfIdfScore)return-1;const A=this.commandsHistory.peek(E.commandId),I=this.commandsHistory.peek(w.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(w.commandId);if(M&&R)return 0;if(M)return-1;if(R)return 1}return E.label.localeCompare(w.label)});const u=[];let f=!1,g=!0,p=!!this.options.suggestedCommandIds;for(let E=0;E<a.length;E++){const w=a[E];E===0&&this.commandsHistory.peek(w.commandId)&&(u.push({type:"separator",label:S("recentlyUsed","recently used")}),f=!0),g&&w.tfIdfScore!==void 0&&(u.push({type:"separator",label:S("suggested","similar commands")}),g=!1),p&&w.tfIdfScore===void 0&&!this.commandsHistory.peek(w.commandId)&&((C=this.options.suggestedCommandIds)!=null&&C.has(w.commandId))&&(u.push({type:"separator",label:S("commonlyUsed","commonly used")}),f=!0,p=!1),f&&w.tfIdfScore===void 0&&!this.commandsHistory.peek(w.commandId)&&!((b=this.options.suggestedCommandIds)!=null&&b.has(w.commandId))&&(u.push({type:"separator",label:S("morecCommands","other commands")}),f=!1),u.push(this.toCommandPick(w,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 w=E.map(I=>this.toCommandPick(I,n));return g&&((A=w[0])==null?void 0:A.type)!=="separator"&&w.unshift({type:"separator",label:S("suggested","similar commands")}),w})()}: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){Gc(r)||this.dialogService.error(S("canNotRun","Command '{0}' resulted in an error",e.label),Gv(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}},xd=Ma,Ma.PREFIX=">",Ma.TFIDF_THRESHOLD=.5,Ma.TFIDF_MAX_RESULTS=5,Ma.WORD_FILTER=w7(A7,D7,S7),Ma);mw=xd=yF([ac(1,tn),ac(2,As),ac(3,Us),ac(4,ua),ac(5,a9)],mw);var na;let _w=(na=class extends zt{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===Vw.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=ys.getConfiguredCommandHistoryLength(this.configurationService),ys.cache&&ys.cache.limit!==this.configuredCommandsHistoryLength&&(ys.cache.limit=this.configuredCommandsHistoryLength,ys.hasChanges=!0))}load(){const e=this.storageService.get(ys.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=ys.cache=new Fp(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,r)=>s.value-r.value),n.forEach(s=>i.set(s.key,s.value))}ys.counter=this.storageService.getNumber(ys.PREF_KEY_COUNTER,0,ys.counter)}push(e){ys.cache&&(ys.cache.set(e,ys.counter++),ys.hasChanges=!0)}peek(e){var t;return(t=ys.cache)==null?void 0:t.peek(e)}saveState(){if(!ys.cache||!ys.hasChanges)return;const e={usesLRU:!0,entries:[]};ys.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(ys.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(ys.PREF_KEY_COUNTER,ys.counter,0,0),ys.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:ys.DEFAULT_COMMANDS_HISTORY_LENGTH}},ys=na,na.DEFAULT_COMMANDS_HISTORY_LENGTH=50,na.PREF_KEY_CACHE="commandPalette.mru.cache",na.PREF_KEY_COUNTER="commandPalette.mru.counter",na.counter=1,na.hasChanges=!1,na);_w=ys=yF([ac(0,Kc),ac(1,ss),ac(2,Yu)],_w);class R$ extends mw{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&&(k7(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:B7(n.label)||n.id})}return t}}var N$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Fh=function(o,e){return function(t,i){e(t,i,o)}};let pp=class extends R${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[]}};pp=N$([Fh(0,tn),Fh(1,Cs),Fh(2,As),Fh(3,Us),Fh(4,ua),Fh(5,a9)],pp);const z_=class z_ extends wt{constructor(){super({id:z_.ID,label:Vk.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Ml).quickAccess.show(pp.PREFIX)}};z_.ID="editor.action.quickCommand";let Vm=z_;Re(Vm);ca.as(Wp.Quickaccess).registerQuickAccessProvider({ctor:pp,prefix:pp.PREFIX,helpEntries:[{description:Vk.quickCommandHelp,commandId:Vm.ID}]});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},Lh=function(o,e){return function(t,i){e(t,i,o)}};let bw=class extends Vu{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};bw=O$([Lh(1,Ln),Lh(2,Cs),Lh(3,vo),Lh(4,tn),Lh(5,Kc),Lh(6,ss)],bw);un(Vu.ID,bw,4);class H$ extends wt{constructor(){super({id:"editor.action.toggleHighContrast",label:F7.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(Ok),n=i.getColorTheme();Lg(n.type)?(i.setTheme(this._originalThemeName||(u8(n.type)?L7:I7)),this._originalThemeName=null):(i.setTheme(u8(n.type)?P7:T7),this._originalThemeName=n.themeName)}}Re(H$);const wF="she-theme";function W$(){return localStorage.getItem(wF)??"system"}function z$(o){localStorage.setItem(wF,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o),window.dispatchEvent(new CustomEvent("she:theme-changed"))}function Jh(){const o=document.documentElement.getAttribute("data-theme");return o==="light"?"vs":o==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}let Cw=null;function V$(o){Cw=o}function j$(o={}){return{"Content-Type":"application/json",...o}}async function jt(o,e,t){const i=await fetch(e,{method:o,headers:j$(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw Cw&&Cw(),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 $$(){return await(await fetch("/she/auth/mode")).json()}async function U$(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 q$(){await fetch("/she/auth/logout",{method:"POST"})}async function G$(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 K$(){return jt("GET","/she/scripts/tree")}function $x(o){return jt("GET",`/she/scripts/${o}`)}function Jl(o,e){return jt("PUT",`/she/scripts/${o}`,{content:e})}function u2(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),jt("GET",`/she/scripts/search?${t}`)}function Ux(o){return jt("DELETE",`/she/scripts/${o}`)}function h2(o,e){return jt("POST",`/she/scripts/${o}/rename`,{newPath:e})}function Z$(o){return jt("POST","/she/scripts/mkdir",{path:o})}function X$(){return jt("GET","/she/git/status")}function ef(){return jt("GET","/she/status")}function SF(){return jt("POST","/she/restart")}function Y$(){return jt("POST","/she/update")}function Q$(){return jt("POST","/she/check-update")}function J$(o,e){return jt("POST","/she/git/commit",{path:o,message:e})}function f2(o,e){return jt("POST","/she/git/commit",{files:o,message:e})}function g2(o){return jt("POST","/she/git/commit",{message:o})}function qx(o){return jt("POST","/she/git/push",{remote:o})}function eU(o,e){return jt("GET",`/she/git/log?path=${encodeURIComponent(o)}&limit=${e}`)}function tU(o,e){return jt("GET",`/she/git/show?hash=${encodeURIComponent(o)}&path=${encodeURIComponent(e)}`)}function Tl(){return jt("GET","/she/config")}function xp(o){return jt("PUT","/she/config",o)}function oh(o){return o.split("/").map(encodeURIComponent).join("/")}function DF(){return jt("GET","/she/db/docs")}function iU(o){return jt("GET",`/she/db/docs/${oh(o)}`)}function p2(o,e){return jt("PUT",`/she/db/docs/${oh(o)}`,e)}function nU(o){return jt("DELETE",`/she/db/docs/${oh(o)}`)}function AF(){return jt("GET","/she/db/views")}function sU(o){return jt("GET",`/she/db/views/${oh(o)}`)}function x2(o,e){return jt("PUT",`/she/db/views/${oh(o)}`,e)}function oU(o){return jt("DELETE",`/she/db/views/${oh(o)}`)}function rU(){return jt("GET","/she/deps")}function aU(o){return jt("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function lU(o,e){return jt("POST","/she/deps/install",{name:o,version:null})}function cU(o){return jt("POST","/she/deps/remove",{name:o})}function dU(o){return jt("POST","/she/deps/update",{name:o})}function kF(){return jt("GET","/she/deps/outdated")}function uU(){return jt("POST","/she/deps/check-outdated")}function hU(){return jt("GET","/she/ai/conversations")}function v2(o){return jt("GET",`/she/ai/conversations/${encodeURIComponent(o)}`)}function fU(o,e,t){return jt("PUT",`/she/ai/conversations/${encodeURIComponent(o)}`,{title:e,messages:t})}function gU(o){return jt("DELETE",`/she/ai/conversations/${encodeURIComponent(o)}`)}function XC(o){return jt("GET",`/she/db/views/${oh(o)}/result`)}function gS(){return jt("GET","/she/matter/devices")}function Cv(o){return jt("GET",`/she/matter/devices/${o}`)}function pU(o){return jt("POST","/she/matter/commission",o)}function xU(o){return jt("DELETE",`/she/matter/devices/${o}`)}function vU(o,e,t,i,n){return jt("POST",`/she/matter/devices/${o}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function BF(){return jt("GET","/she/mqtt/state")}function m2(o,e,t=!1,i=0){return jt("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function FF(){return jt("GET","/she/ai/config")}function LF(){return jt("GET","/she/ai/models")}function Ew(o){return jt("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}function IF(o){return jt("POST","/she/ai/prompt",o)}async function PF(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 Nb(){return jt("GET","/she/broker/status")}function mU(){return jt("GET","/she/broker/local/check")}function _U(){return jt("GET","/she/broker/ip-addresses")}function tx(){return jt("GET","/she/broker/config")}function bU(o=500){return jt("GET",`/she/broker/logs?limit=${o}`)}function TF(o){return jt("PUT","/she/broker/config",o)}function CU(o,e){return jt("PUT","/she/broker/config/raw",{content:o,checksum:e})}function EU(){return jt("GET","/she/broker/config/backups")}function yU(o){return jt("POST","/she/broker/config/restore",{backup:o})}function Ob(){return jt("POST","/she/broker/reload")}function wU(){return jt("POST","/she/broker/restart")}function SU(){return jt("POST","/she/broker/wizard/deactivate")}function DU(){return jt("POST","/she/broker/wizard/reinit")}function AU(){return jt("GET","/she/broker/wizard/diagnose")}function kU(o){return jt("GET",`/she/broker/passwd?file=${encodeURIComponent(o)}`)}function _2(o,e,t){return jt("POST","/she/broker/passwd",{file:o,username:e,password:t})}function BU(o,e){return jt("DELETE",`/she/broker/passwd/${encodeURIComponent(e)}`,{file:o})}function FU(o){return jt("GET",`/she/broker/acl?file=${encodeURIComponent(o)}`)}function LU(o,e){return jt("PUT","/she/broker/acl",{file:o,content:e})}function IU(){return jt("GET","/she/broker/users")}function PU(o,e){return jt("POST","/she/broker/users",{username:o,password:e})}function TU(o){return jt("DELETE",`/she/broker/users/${encodeURIComponent(o)}`)}function MU(o,e){return jt("PUT",`/she/broker/users/${encodeURIComponent(o)}/password`,{password:e})}function RU(o,e){return jt("POST",`/she/broker/users/${encodeURIComponent(o)}/roles`,{rolename:e})}function NU(o,e){return jt("DELETE",`/she/broker/users/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function MF(){return jt("GET","/she/broker/roles")}function OU(o){return jt("POST","/she/broker/roles",{rolename:o})}function HU(o){return jt("DELETE",`/she/broker/roles/${encodeURIComponent(o)}`)}function WU(o,e){return jt("POST",`/she/broker/roles/${encodeURIComponent(o)}/acls`,e)}function zU(o,e,t){return jt("DELETE",`/she/broker/roles/${encodeURIComponent(o)}/acls`,{acltype:e,topic:t})}function VU(){return jt("GET","/she/broker/groups")}function jU(o){return jt("POST","/she/broker/groups",{groupname:o})}function $U(o){return jt("DELETE",`/she/broker/groups/${encodeURIComponent(o)}`)}function b2(o,e){return jt("POST",`/she/broker/groups/${encodeURIComponent(o)}/clients`,{username:e})}function C2(o,e){return jt("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/clients/${encodeURIComponent(e)}`)}function UU(o,e){return jt("POST",`/she/broker/groups/${encodeURIComponent(o)}/roles`,{rolename:e})}function qU(o,e){return jt("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function GU(){return jt("GET","/she/broker/acl-defaults")}function KU(o){return jt("PUT","/she/broker/acl-defaults",{acls:o})}function ZU(o){return jt("GET",`/she/broker/acl-check?${new URLSearchParams({topic:o})}`)}function XU(){return jt("GET","/she/broker/anonymous-group")}function YU(o){return jt("PUT","/she/broker/anonymous-group",{groupname:o})}function QU(){return jt("GET","/she/broker/ca/server")}function JU(o){return jt("POST","/she/broker/ca/server/generate",o)}function eq(o){return jt("POST","/she/broker/ca/server/csr",o)}function YC(o){return jt("POST","/she/broker/ca/server/import",o)}function tq(){return jt("GET","/she/broker/ca/trusted")}function iq(o){return jt("POST","/she/broker/ca/trusted",{pem:o})}function nq(o){return jt("DELETE",`/she/broker/ca/trusted/${encodeURIComponent(o)}`)}function sq(o){return jt("GET",`/she/broker/fs/complete?path=${encodeURIComponent(o)}`)}function oq(o){return jt("POST","/she/broker/ca/server/pathlink",o)}function rq(o){return jt("POST","/she/broker/ca/trusted/addpath",{path:o})}const aq=2e3,Ev=[],lq=500,yv=[];function RF(){return Ev.slice()}function cq(){return yv.slice()}let vc=null;const jm=new Set,tf=new Map;let yw=null,wv=null;function pS(){return wv||(wv=fetch("/she/logs/history").then(o=>o.ok?o.json():[]).catch(()=>[])),wv}function vp(){let o=jm.size;for(const e of tf.values())o+=e.size;return o}function dq(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function xS(){if(vc)return;pS();const o=dq(),e=new WebSocket(o);vc=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};Ev.length>=aq&&Ev.shift(),Ev.push(s),jm.forEach(r=>r(s))}if(i.type==="brokerLog"){const s={level:i.level,msg:i.msg,ts:i.ts};yv.length>=lq&&yv.shift(),yv.push(s)}const n=tf.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{vc===e&&(vc=null,wv=null),vp()>0&&(yw=setTimeout(xS,3e3))},e.onerror=()=>{e.close()}}function NF(){yw&&clearTimeout(yw),vc==null||vc.close(),vc=null}function vS(o){return jm.add(o),vp()===1&&xS(),()=>{jm.delete(o),vp()===0&&NF()}}function Xo(o,e){return tf.has(o)||tf.set(o,new Set),tf.get(o).add(e),vp()===1&&xS(),()=>{var t;(t=tf.get(o))==null||t.delete(e),vp()===0&&NF()}}var uq=F('<button class="cancel svelte-1eh8v5n">Cancel</button>'),hq=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 Xa(o,e){Is(e,!0);let t=B(!1),i=B(""),n=B("Confirm"),s=B(!1),r=B(!1),a=null;function d(E,w){return x(i,E,!0),x(n,(w==null?void 0:w.confirm)??(w!=null&&w.alert?"OK":"Confirm"),!0),x(s,(w==null?void 0:w.danger)??!1,!0),x(r,(w==null?void 0:w.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=Ss();xs("keydown",Rd,f);var C=Et(p);{var b=E=>{var w=hq(),A=Et(w),I=v(A,2),M=m(I),R=m(M),P=v(M,2),V=m(P);{var $=Z=>{var ce=uq();j("click",ce,()=>u(!1)),D(Z,ce)};H(V,Z=>{l(r)||Z($)})}var Q=v(V,2);let re;var he=m(Q);z(()=>{O(R,l(i)),re=Ft(Q,1,"svelte-1eh8v5n",null,re,{danger:l(s)}),O(he,l(n))}),j("click",A,()=>u(!1)),j("click",Q,()=>u(!0)),D(E,w)};H(C,E=>{l(t)&&E(b)})}return D(o,p),Ps(g)}Gs(["click"]);var fq=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 gq(o,e){Is(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=Ss();xs("keydown",Rd,p);var E=Et(b);{var w=A=>{var I=fq(),M=Et(I),R=v(M,2),P=m(R),V=m(P),$=v(P,2);cs($,ce=>x(d,ce),()=>l(d));var Q=v($,2),re=m(Q),he=v(re,2),Z=m(he);z(ce=>{O(V,l(i)),rn($,"placeholder",l(n)),he.disabled=ce,O(Z,l(s))},[()=>!l(r).trim()]),j("click",M,g),j("keydown",$,ce=>{ce.key==="Enter"&&(ce.preventDefault(),f())}),Nt($,()=>l(r),ce=>x(r,ce)),j("click",re,g),j("click",he,f),D(A,I)};H(E,A=>{l(t)&&A(w)})}return D(o,b),Ps(C)}Gs(["click","keydown"]);function mS(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var QC,E2;function pq(){if(E2)return QC;E2=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(De=>{const at=K[De],Qe=typeof at;(Qe==="object"||Qe==="function")&&!Object.isFrozen(at)&&o(at)}),K}class e{constructor(De){De.data===void 0&&(De.data={}),this.data=De.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(K){return K.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(K,...De){const at=Object.create(null);for(const Qe in K)at[Qe]=K[Qe];return De.forEach(function(Qe){for(const Wt in Qe)at[Wt]=Qe[Wt]}),at}const n="</span>",s=K=>!!K.scope,r=(K,{prefix:De})=>{if(K.startsWith("language:"))return K.replace("language:","language-");if(K.includes(".")){const at=K.split(".");return[`${De}${at.shift()}`,...at.map((Qe,Wt)=>`${Qe}${"_".repeat(Wt+1)}`)].join(" ")}return`${De}${K}`};class a{constructor(De,at){this.buffer="",this.classPrefix=at.classPrefix,De.walk(this)}addText(De){this.buffer+=t(De)}openNode(De){if(!s(De))return;const at=r(De.scope,{prefix:this.classPrefix});this.span(at)}closeNode(De){s(De)&&(this.buffer+=n)}value(){return this.buffer}span(De){this.buffer+=`<span class="${De}">`}}const d=(K={})=>{const De={children:[]};return Object.assign(De,K),De};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(De){this.top.children.push(De)}openNode(De){const at=d({scope:De});this.add(at),this.stack.push(at)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(De){return this.constructor._walk(De,this.rootNode)}static _walk(De,at){return typeof at=="string"?De.addText(at):at.children&&(De.openNode(at),at.children.forEach(Qe=>this._walk(De,Qe)),De.closeNode(at)),De}static _collapse(De){typeof De!="string"&&De.children&&(De.children.every(at=>typeof at=="string")?De.children=[De.children.join("")]:De.children.forEach(at=>{u._collapse(at)}))}}class f extends u{constructor(De){super(),this.options=De}addText(De){De!==""&&this.add(De)}startScope(De){this.openNode(De)}endScope(){this.closeNode()}__addSublanguage(De,at){const Qe=De.root;at&&(Qe.scope=`language:${at}`),this.add(Qe)}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(at=>g(at)).join("")}function w(K){const De=K[K.length-1];return typeof De=="object"&&De.constructor===Object?(K.splice(K.length-1,1),De):{}}function A(...K){return"("+(w(K).capture?"":"?:")+K.map(Qe=>g(Qe)).join("|")+")"}function I(K){return new RegExp(K.toString()+"|").exec("").length-1}function M(K,De){const at=K&&K.exec(De);return at&&at.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function P(K,{joinWith:De}){let at=0;return K.map(Qe=>{at+=1;const Wt=at;let si=g(Qe),St="";for(;si.length>0;){const et=R.exec(si);if(!et){St+=si;break}St+=si.substring(0,et.index),si=si.substring(et.index+et[0].length),et[0][0]==="\\"&&et[1]?St+="\\"+String(Number(et[1])+Wt):(St+=et[0],et[0]==="("&&at++)}return St}).map(Qe=>`(${Qe})`).join(De)}const V=/\b\B/,$="[a-zA-Z]\\w*",Q="[a-zA-Z_]\\w*",re="\\b\\d+(\\.\\d+)?",he="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Z="\\b(0b[01]+)",ce="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",_e=(K={})=>{const De=/^#![ ]*\//;return K.binary&&(K.begin=E(De,/.*\b/,K.binary,/\b.*/)),i({scope:"meta",begin:De,end:/$/,relevance:0,"on:begin":(at,Qe)=>{at.index!==0&&Qe.ignoreMatch()}},K)},se={begin:"\\\\[\\s\\S]",relevance:0},ue={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[se]},Se={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[se]},Te={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/},xe=function(K,De,at={}){const Qe=i({scope:"comment",begin:K,end:De,contains:[]},at);Qe.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 Wt=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 Qe.contains.push({begin:E(/[ ]+/,"(",Wt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Qe},Oe=xe("//","$"),We=xe("/\\*","\\*/"),be=xe("#","$"),dt={scope:"number",begin:re,relevance:0},Pt={scope:"number",begin:he,relevance:0},it={scope:"number",begin:Z,relevance:0},yt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[se,{begin:/\[/,end:/\]/,relevance:0,contains:[se]}]},Ee={scope:"title",begin:$,relevance:0},He={scope:"title",begin:Q,relevance:0},mt={begin:"\\.\\s*"+Q,relevance:0};var ft=Object.freeze({__proto__:null,APOS_STRING_MODE:ue,BACKSLASH_ESCAPE:se,BINARY_NUMBER_MODE:it,BINARY_NUMBER_RE:Z,COMMENT:xe,C_BLOCK_COMMENT_MODE:We,C_LINE_COMMENT_MODE:Oe,C_NUMBER_MODE:Pt,C_NUMBER_RE:he,END_SAME_AS_BEGIN:function(K){return Object.assign(K,{"on:begin":(De,at)=>{at.data._beginMatch=De[1]},"on:end":(De,at)=>{at.data._beginMatch!==De[1]&&at.ignoreMatch()}})},HASH_COMMENT_MODE:be,IDENT_RE:$,MATCH_NOTHING_RE:V,METHOD_GUARD:mt,NUMBER_MODE:dt,NUMBER_RE:re,PHRASAL_WORDS_MODE:Te,QUOTE_STRING_MODE:Se,REGEXP_MODE:yt,RE_STARTERS_RE:ce,SHEBANG:_e,TITLE_MODE:Ee,UNDERSCORE_IDENT_RE:Q,UNDERSCORE_TITLE_MODE:He});function Lt(K,De){K.input[K.index-1]==="."&&De.ignoreMatch()}function ni(K,De){K.className!==void 0&&(K.scope=K.className,delete K.className)}function pi(K,De){De&&K.beginKeywords&&(K.begin="\\b("+K.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",K.__beforeBegin=Lt,K.keywords=K.keywords||K.beginKeywords,delete K.beginKeywords,K.relevance===void 0&&(K.relevance=0))}function xi(K,De){Array.isArray(K.illegal)&&(K.illegal=A(...K.illegal))}function Dt(K,De){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 ci(K,De){K.relevance===void 0&&(K.relevance=1)}const ze=(K,De)=>{if(!K.beforeMatch)return;if(K.starts)throw new Error("beforeMatch cannot be used with starts");const at=Object.assign({},K);Object.keys(K).forEach(Qe=>{delete K[Qe]}),K.keywords=at.keywords,K.begin=E(at.beforeMatch,p(at.begin)),K.starts={relevance:0,contains:[Object.assign(at,{endsParent:!0})]},K.relevance=0,delete at.beforeMatch},we=["of","and","for","in","not","or","if","then","parent","list","value"],ti="keyword";function mi(K,De,at=ti){const Qe=Object.create(null);return typeof K=="string"?Wt(at,K.split(" ")):Array.isArray(K)?Wt(at,K):Object.keys(K).forEach(function(si){Object.assign(Qe,mi(K[si],De,si))}),Qe;function Wt(si,St){De&&(St=St.map(et=>et.toLowerCase())),St.forEach(function(et){const Y=et.split("|");Qe[Y[0]]=[si,Ut(Y[0],Y[1])]})}}function Ut(K,De){return De?Number(De):Bi(K)?0:1}function Bi(K){return we.includes(K.toLowerCase())}const Ki={},Ci=K=>{console.error(K)},pn=(K,...De)=>{console.log(`WARN: ${K}`,...De)},nn=(K,De)=>{Ki[`${K}/${De}`]||(console.log(`Deprecated as of ${K}. ${De}`),Ki[`${K}/${De}`]=!0)},cn=new Error;function on(K,De,{key:at}){let Qe=0;const Wt=K[at],si={},St={};for(let et=1;et<=De.length;et++)St[et+Qe]=Wt[et],si[et+Qe]=!0,Qe+=I(De[et-1]);K[at]=St,K[at]._emit=si,K[at]._multi=!0}function vt(K){if(Array.isArray(K.begin)){if(K.skip||K.excludeBegin||K.returnBegin)throw Ci("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),cn;if(typeof K.beginScope!="object"||K.beginScope===null)throw Ci("beginScope must be object"),cn;on(K,K.begin,{key:"beginScope"}),K.begin=P(K.begin,{joinWith:""})}}function Jt(K){if(Array.isArray(K.end)){if(K.skip||K.excludeEnd||K.returnEnd)throw Ci("skip, excludeEnd, returnEnd not compatible with endScope: {}"),cn;if(typeof K.endScope!="object"||K.endScope===null)throw Ci("endScope must be object"),cn;on(K,K.end,{key:"endScope"}),K.end=P(K.end,{joinWith:""})}}function Ni(K){K.scope&&typeof K.scope=="object"&&K.scope!==null&&(K.beginScope=K.scope,delete K.scope)}function zi(K){Ni(K),typeof K.beginScope=="string"&&(K.beginScope={_wrap:K.beginScope}),typeof K.endScope=="string"&&(K.endScope={_wrap:K.endScope}),vt(K),Jt(K)}function ui(K){function De(St,et){return new RegExp(g(St),"m"+(K.case_insensitive?"i":"")+(K.unicodeRegex?"u":"")+(et?"g":""))}class at{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(et,Y){Y.position=this.position++,this.matchIndexes[this.matchAt]=Y,this.regexes.push([Y,et]),this.matchAt+=I(et)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const et=this.regexes.map(Y=>Y[1]);this.matcherRe=De(P(et,{joinWith:"|"}),!0),this.lastIndex=0}exec(et){this.matcherRe.lastIndex=this.lastIndex;const Y=this.matcherRe.exec(et);if(!Y)return null;const Ie=Y.findIndex((pe,ii)=>ii>0&&pe!==void 0),le=this.matchIndexes[Ie];return Y.splice(0,Ie),Object.assign(Y,le)}}class Qe{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 Y=new at;return this.rules.slice(et).forEach(([Ie,le])=>Y.addRule(Ie,le)),Y.compile(),this.multiRegexes[et]=Y,Y}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(et,Y){this.rules.push([et,Y]),Y.type==="begin"&&this.count++}exec(et){const Y=this.getMatcher(this.regexIndex);Y.lastIndex=this.lastIndex;let Ie=Y.exec(et);if(this.resumingScanAtSamePosition()&&!(Ie&&Ie.index===this.lastIndex)){const le=this.getMatcher(0);le.lastIndex=this.lastIndex+1,Ie=le.exec(et)}return Ie&&(this.regexIndex+=Ie.position+1,this.regexIndex===this.count&&this.considerAll()),Ie}}function Wt(St){const et=new Qe;return St.contains.forEach(Y=>et.addRule(Y.begin,{rule:Y,type:"begin"})),St.terminatorEnd&&et.addRule(St.terminatorEnd,{type:"end"}),St.illegal&&et.addRule(St.illegal,{type:"illegal"}),et}function si(St,et){const Y=St;if(St.isCompiled)return Y;[ni,Dt,zi,ze].forEach(le=>le(St,et)),K.compilerExtensions.forEach(le=>le(St,et)),St.__beforeBegin=null,[pi,xi,ci].forEach(le=>le(St,et)),St.isCompiled=!0;let Ie=null;return typeof St.keywords=="object"&&St.keywords.$pattern&&(St.keywords=Object.assign({},St.keywords),Ie=St.keywords.$pattern,delete St.keywords.$pattern),Ie=Ie||/\w+/,St.keywords&&(St.keywords=mi(St.keywords,K.case_insensitive)),Y.keywordPatternRe=De(Ie,!0),et&&(St.begin||(St.begin=/\B|\b/),Y.beginRe=De(Y.begin),!St.end&&!St.endsWithParent&&(St.end=/\B|\b/),St.end&&(Y.endRe=De(Y.end)),Y.terminatorEnd=g(Y.end)||"",St.endsWithParent&&et.terminatorEnd&&(Y.terminatorEnd+=(St.end?"|":"")+et.terminatorEnd)),St.illegal&&(Y.illegalRe=De(St.illegal)),St.contains||(St.contains=[]),St.contains=[].concat(...St.contains.map(function(le){return hn(le==="self"?St:le)})),St.contains.forEach(function(le){si(le,Y)}),St.starts&&si(St.starts,et),Y.matcher=Wt(Y),Y}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||{}),si(K)}function fn(K){return K?K.endsWithParent||fn(K.starts):!1}function hn(K){return K.variants&&!K.cachedVariants&&(K.cachedVariants=K.variants.map(function(De){return i(K,{variants:null},De)})),K.cachedVariants?K.cachedVariants:fn(K)?i(K,{starts:K.starts?i(K.starts):null}):Object.isFrozen(K)?i(K):K}var xn="11.11.1";class Ye extends Error{constructor(De,at){super(De),this.name="HTMLInjectionError",this.html=at}}const oi=t,hi=i,Ei=Symbol("nomatch"),Oi=7,Gi=function(K){const De=Object.create(null),at=Object.create(null),Qe=[];let Wt=!0;const si="Could not find the language '{}', did you forget to load/include a language module?",St={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 Y(U){return et.noHighlightRe.test(U)}function Ie(U){let T=U.className+" ";T+=U.parentNode?U.parentNode.className:"";const W=et.languageDetectRe.exec(T);if(W){const J=vi(W[1]);return J||(pn(si.replace("{}",W[1])),pn("Falling back to no-highlight mode for this block.",U)),J?W[1]:"no-highlight"}return T.split(/\s+/).find(J=>Y(J)||vi(J))}function le(U,T,W){let J="",ie="";typeof T=="object"?(J=U,W=T.ignoreIllegals,ie=T.language):(nn("10.7.0","highlight(lang, code, ...args) has been deprecated."),nn("10.7.0",`Please use highlight(code, options) instead.
|
|
80
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),ie=U,J=T),W===void 0&&(W=!0);const ae={code:J,language:ie};gt("before:highlight",ae);const oe=ae.result?ae.result:pe(ae.language,ae.code,W);return oe.code=ae.code,gt("after:highlight",oe),oe}function pe(U,T,W,J){const ie=Object.create(null);function ae(ve,Ge){return ve.keywords[Ge]}function oe(){if(!ot.keywords){Ve.addText(Me);return}let ve=0;ot.keywordPatternRe.lastIndex=0;let Ge=ot.keywordPatternRe.exec(Me),_t="";for(;Ge;){_t+=Me.substring(ve,Ge.index);const Vt=qe.case_insensitive?Ge[0].toLowerCase():Ge[0],Ct=ae(ot,Vt);if(Ct){const[Ot,bi]=Ct;if(Ve.addText(_t),_t="",ie[Vt]=(ie[Vt]||0)+1,ie[Vt]<=Oi&&(Je+=bi),Ot.startsWith("_"))_t+=Ge[0];else{const $i=qe.classNameAliases[Ot]||Ot;Ce(Ge[0],$i)}}else _t+=Ge[0];ve=ot.keywordPatternRe.lastIndex,Ge=ot.keywordPatternRe.exec(Me)}_t+=Me.substring(ve),Ve.addText(_t)}function Ae(){if(Me==="")return;let ve=null;if(typeof ot.subLanguage=="string"){if(!De[ot.subLanguage]){Ve.addText(Me);return}ve=pe(ot.subLanguage,Me,!0,fe[ot.subLanguage]),fe[ot.subLanguage]=ve._top}else ve=di(Me,ot.subLanguage.length?ot.subLanguage:null);ot.relevance>0&&(Je+=ve.relevance),Ve.__addSublanguage(ve._emitter,ve.language)}function $e(){ot.subLanguage!=null?Ae():oe(),Me=""}function Ce(ve,Ge){ve!==""&&(Ve.startScope(Ge),Ve.addText(ve),Ve.endScope())}function Pe(ve,Ge){let _t=1;const Vt=Ge.length-1;for(;_t<=Vt;){if(!ve._emit[_t]){_t++;continue}const Ct=qe.classNameAliases[ve[_t]]||ve[_t],Ot=Ge[_t];Ct?Ce(Ot,Ct):(Me=Ot,oe(),Me=""),_t++}}function Ne(ve,Ge){return ve.scope&&typeof ve.scope=="string"&&Ve.openNode(qe.classNameAliases[ve.scope]||ve.scope),ve.beginScope&&(ve.beginScope._wrap?(Ce(Me,qe.classNameAliases[ve.beginScope._wrap]||ve.beginScope._wrap),Me=""):ve.beginScope._multi&&(Pe(ve.beginScope,Ge),Me="")),ot=Object.create(ve,{parent:{value:ot}}),ot}function ct(ve,Ge,_t){let Vt=M(ve.endRe,_t);if(Vt){if(ve["on:end"]){const Ct=new e(ve);ve["on:end"](Ge,Ct),Ct.isMatchIgnored&&(Vt=!1)}if(Vt){for(;ve.endsParent&&ve.parent;)ve=ve.parent;return ve}}if(ve.endsWithParent)return ct(ve.parent,Ge,_t)}function ri(ve){return ot.matcher.regexIndex===0?(Me+=ve[0],1):(rt=!0,0)}function X(ve){const Ge=ve[0],_t=ve.rule,Vt=new e(_t),Ct=[_t.__beforeBegin,_t["on:begin"]];for(const Ot of Ct)if(Ot&&(Ot(ve,Vt),Vt.isMatchIgnored))return ri(Ge);return _t.skip?Me+=Ge:(_t.excludeBegin&&(Me+=Ge),$e(),!_t.returnBegin&&!_t.excludeBegin&&(Me=Ge)),Ne(_t,ve),_t.returnBegin?0:Ge.length}function de(ve){const Ge=ve[0],_t=T.substring(ve.index),Vt=ct(ot,ve,_t);if(!Vt)return Ei;const Ct=ot;ot.endScope&&ot.endScope._wrap?($e(),Ce(Ge,ot.endScope._wrap)):ot.endScope&&ot.endScope._multi?($e(),Pe(ot.endScope,ve)):Ct.skip?Me+=Ge:(Ct.returnEnd||Ct.excludeEnd||(Me+=Ge),$e(),Ct.excludeEnd&&(Me=Ge));do ot.scope&&Ve.closeNode(),!ot.skip&&!ot.subLanguage&&(Je+=ot.relevance),ot=ot.parent;while(ot!==Vt.parent);return Vt.starts&&Ne(Vt.starts,ve),Ct.returnEnd?0:Ge.length}function Ke(){const ve=[];for(let Ge=ot;Ge!==qe;Ge=Ge.parent)Ge.scope&&ve.unshift(Ge.scope);ve.forEach(Ge=>Ve.openNode(Ge))}let Tt={};function Ue(ve,Ge){const _t=Ge&&Ge[0];if(Me+=ve,_t==null)return $e(),0;if(Tt.type==="begin"&&Ge.type==="end"&&Tt.index===Ge.index&&_t===""){if(Me+=T.slice(Ge.index,Ge.index+1),!Wt){const Vt=new Error(`0 width match regex (${U})`);throw Vt.languageName=U,Vt.badRule=Tt.rule,Vt}return 1}if(Tt=Ge,Ge.type==="begin")return X(Ge);if(Ge.type==="illegal"&&!W){const Vt=new Error('Illegal lexeme "'+_t+'" for mode "'+(ot.scope||"<unnamed>")+'"');throw Vt.mode=ot,Vt}else if(Ge.type==="end"){const Vt=de(Ge);if(Vt!==Ei)return Vt}if(Ge.type==="illegal"&&_t==="")return Me+=`
|
|
81
|
+
`,1;if(st>1e5&&st>Ge.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Me+=_t,_t.length}const qe=vi(U);if(!qe)throw Ci(si.replace("{}",U)),new Error('Unknown language: "'+U+'"');const It=ui(qe);let pt="",ot=J||It;const fe={},Ve=new et.__emitter(et);Ke();let Me="",Je=0,kt=0,st=0,rt=!1;try{if(qe.__emitTokens)qe.__emitTokens(T,Ve);else{for(ot.matcher.considerAll();;){st++,rt?rt=!1:ot.matcher.considerAll(),ot.matcher.lastIndex=kt;const ve=ot.matcher.exec(T);if(!ve)break;const Ge=T.substring(kt,ve.index),_t=Ue(Ge,ve);kt=ve.index+_t}Ue(T.substring(kt))}return Ve.finalize(),pt=Ve.toHTML(),{language:U,value:pt,relevance:Je,illegal:!1,_emitter:Ve,_top:ot}}catch(ve){if(ve.message&&ve.message.includes("Illegal"))return{language:U,value:oi(T),illegal:!0,relevance:0,_illegalBy:{message:ve.message,index:kt,context:T.slice(kt-100,kt+100),mode:ve.mode,resultSoFar:pt},_emitter:Ve};if(Wt)return{language:U,value:oi(T),illegal:!1,relevance:0,errorRaised:ve,_emitter:Ve,_top:ot};throw ve}}function ii(U){const T={value:oi(U),illegal:!1,relevance:0,_top:St,_emitter:new et.__emitter(et)};return T._emitter.addText(U),T}function di(U,T){T=T||et.languages||Object.keys(De);const W=ii(U),J=T.filter(vi).filter(je).map($e=>pe($e,U,!1));J.unshift(W);const ie=J.sort(($e,Ce)=>{if($e.relevance!==Ce.relevance)return Ce.relevance-$e.relevance;if($e.language&&Ce.language){if(vi($e.language).supersetOf===Ce.language)return 1;if(vi(Ce.language).supersetOf===$e.language)return-1}return 0}),[ae,oe]=ie,Ae=ae;return Ae.secondBest=oe,Ae}function ne(U,T,W){const J=T&&at[T]||W;U.classList.add("hljs"),U.classList.add(`language-${J}`)}function nt(U){let T=null;const W=Ie(U);if(Y(W))return;if(gt("before:highlightElement",{el:U,language:W}),U.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",U);return}if(U.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(U)),et.throwUnescapedHTML))throw new Ye("One of your code blocks includes unescaped HTML.",U.innerHTML);T=U;const J=T.textContent,ie=W?le(J,{language:W,ignoreIllegals:!0}):di(J);U.innerHTML=ie.value,U.dataset.highlighted="yes",ne(U,W,ie.language),U.result={language:ie.language,re:ie.relevance,relevance:ie.relevance},ie.secondBest&&(U.secondBest={language:ie.secondBest.language,relevance:ie.secondBest.relevance}),gt("after:highlightElement",{el:U,result:ie,text:J})}function $t(U){et=hi(et,U)}const qt=()=>{Xe(),nn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Gt(){Xe(),nn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Be=!1;function Xe(){function U(){Xe()}if(document.readyState==="loading"){Be||window.addEventListener("DOMContentLoaded",U,!1),Be=!0;return}document.querySelectorAll(et.cssSelector).forEach(nt)}function Zt(U,T){let W=null;try{W=T(K)}catch(J){if(Ci("Language definition for '{}' could not be registered.".replace("{}",U)),Wt)Ci(J);else throw J;W=St}W.name||(W.name=U),De[U]=W,W.rawDefinition=T.bind(null,K),W.aliases&&me(W.aliases,{languageName:U})}function ei(U){delete De[U];for(const T of Object.keys(at))at[T]===U&&delete at[T]}function Li(){return Object.keys(De)}function vi(U){return U=(U||"").toLowerCase(),De[U]||De[at[U]]}function me(U,{languageName:T}){typeof U=="string"&&(U=[U]),U.forEach(W=>{at[W.toLowerCase()]=T})}function je(U){const T=vi(U);return T&&!T.disableAutodetect}function tt(U){U["before:highlightBlock"]&&!U["before:highlightElement"]&&(U["before:highlightElement"]=T=>{U["before:highlightBlock"](Object.assign({block:T.el},T))}),U["after:highlightBlock"]&&!U["after:highlightElement"]&&(U["after:highlightElement"]=T=>{U["after:highlightBlock"](Object.assign({block:T.el},T))})}function Le(U){tt(U),Qe.push(U)}function ht(U){const T=Qe.indexOf(U);T!==-1&&Qe.splice(T,1)}function gt(U,T){const W=U;Qe.forEach(function(J){J[W]&&J[W](T)})}function Xt(U){return nn("10.7.0","highlightBlock will be removed entirely in v12.0"),nn("10.7.0","Please use highlightElement now."),nt(U)}Object.assign(K,{highlight:le,highlightAuto:di,highlightAll:Xe,highlightElement:nt,highlightBlock:Xt,configure:$t,initHighlighting:qt,initHighlightingOnLoad:Gt,registerLanguage:Zt,unregisterLanguage:ei,listLanguages:Li,getLanguage:vi,registerAliases:me,autoDetection:je,inherit:hi,addPlugin:Le,removePlugin:ht}),K.debugMode=function(){Wt=!1},K.safeMode=function(){Wt=!0},K.versionString=xn,K.regex={concat:E,lookahead:p,either:A,optional:b,anyNumberOfTimes:C};for(const U in ft)typeof ft[U]=="object"&&o(ft[U]);return Object.assign(K,ft),K},ji=Gi({});return ji.newInstance=()=>Gi({}),QC=ji,ji.HighlightJS=ji,ji.default=ji,QC}var xq=pq();const $m=mS(xq),y2="[A-Za-z$_][0-9A-Za-z$_]*",vq=["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"],mq=["true","false","null","undefined","NaN","Infinity"],OF=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],HF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],WF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],_q=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],bq=[].concat(WF,OF,HF);function zF(o){const e=o.regex,t=(xe,{after:Oe})=>{const We="</"+xe[0].slice(1);return xe.input.indexOf(We,Oe)!==-1},i=y2,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(xe,Oe)=>{const We=xe[0].length+xe.index,be=xe.input[We];if(be==="<"||be===","){Oe.ignoreMatch();return}be===">"&&(t(xe,{after:We})||Oe.ignoreMatch());let dt;const Pt=xe.input.substring(We);if(dt=Pt.match(/^\s*=/)){Oe.ignoreMatch();return}if((dt=Pt.match(/^\s+extends\s+/))&&dt.index===0){Oe.ignoreMatch();return}}},a={$pattern:y2,keyword:vq,literal:mq,built_in:bq,"variable.language":_q},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"}},w={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,w,{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},$={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,e.concat(i,"(",e.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},Q={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...OF,...HF]}},re={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},he={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ce(xe){return e.concat("(?!",xe.join("|"),")")}const _e={match:e.concat(/\b/,ce([...WF,"super","import"].map(xe=>`${xe}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},se={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ue={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},Se="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",Te={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Se)],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:Q},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),re,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,C,b,E,w,I,{match:/\$\d+/},g,Q,{scope:"attr",match:i+e.lookahead(":"),relevance:0},Te,{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:Se,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"]}]}]},he,{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},se,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},_e,Z,$,ue,{match:/\$[(.]/}]}}function _S(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rh=_S();function VF(o){rh=o}var _d={exec:()=>null};function Ih(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 Yn(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(yo.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var Cq=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),yo={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:Ih(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ih(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}>`))},Eq=/^(?:[ \t]*(?:\n|$))+/,yq=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wq=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ix=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Sq=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bS=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,jF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$F=Yn(jF).replace(/bull/g,bS).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(),Dq=Yn(jF).replace(/bull/g,bS).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(),CS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Aq=/^[^\n]+/,ES=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,kq=Yn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ES).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Bq=Yn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bS).getRegex(),Hb="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",yS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fq=Yn("^ {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",yS).replace("tag",Hb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),UF=Yn(CS).replace("hr",ix).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",Hb).getRegex(),Lq=Yn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",UF).getRegex(),wS={blockquote:Lq,code:yq,def:kq,fences:wq,heading:Sq,hr:ix,html:Fq,lheading:$F,list:Bq,newline:Eq,paragraph:UF,table:_d,text:Aq},w2=Yn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ix).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",Hb).getRegex(),Iq={...wS,lheading:Dq,table:w2,paragraph:Yn(CS).replace("hr",ix).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",w2).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",Hb).getRegex()},Pq={...wS,html:Yn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yS).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:_d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yn(CS).replace("hr",ix).replace("heading",` *#{1,6} *[^
|
|
82
|
+
]`).replace("lheading",$F).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Tq=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Mq=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qF=/^( {2,}|\\)\n(?!\s*$)/,Rq=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,b0=/[\p{P}\p{S}]/u,Wb=/[\s\p{P}\p{S}]/u,SS=/[^\s\p{P}\p{S}]/u,Nq=Yn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Wb).getRegex(),GF=/(?!~)[\p{P}\p{S}]/u,Oq=/(?!~)[\s\p{P}\p{S}]/u,Hq=/(?:[^\s\p{P}\p{S}]|~)/u,Wq=Yn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Cq?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),KF=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,zq=Yn(KF,"u").replace(/punct/g,b0).getRegex(),Vq=Yn(KF,"u").replace(/punct/g,GF).getRegex(),ZF="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",jq=Yn(ZF,"gu").replace(/notPunctSpace/g,SS).replace(/punctSpace/g,Wb).replace(/punct/g,b0).getRegex(),$q=Yn(ZF,"gu").replace(/notPunctSpace/g,Hq).replace(/punctSpace/g,Oq).replace(/punct/g,GF).getRegex(),Uq=Yn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,SS).replace(/punctSpace/g,Wb).replace(/punct/g,b0).getRegex(),qq=Yn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,b0).getRegex(),Gq="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Kq=Yn(Gq,"gu").replace(/notPunctSpace/g,SS).replace(/punctSpace/g,Wb).replace(/punct/g,b0).getRegex(),Zq=Yn(/\\(punct)/,"gu").replace(/punct/g,b0).getRegex(),Xq=Yn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Yq=Yn(yS).replace("(?:-->|$)","-->").getRegex(),Qq=Yn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Yq).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Um=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Jq=Yn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Um).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),XF=Yn(/^!?\[(label)\]\[(ref)\]/).replace("label",Um).replace("ref",ES).getRegex(),YF=Yn(/^!?\[(ref)\](?:\[\])?/).replace("ref",ES).getRegex(),eG=Yn("reflink|nolink(?!\\()","g").replace("reflink",XF).replace("nolink",YF).getRegex(),S2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,DS={_backpedal:_d,anyPunctuation:Zq,autolink:Xq,blockSkip:Wq,br:qF,code:Mq,del:_d,delLDelim:_d,delRDelim:_d,emStrongLDelim:zq,emStrongRDelimAst:jq,emStrongRDelimUnd:Uq,escape:Tq,link:Jq,nolink:YF,punctuation:Nq,reflink:XF,reflinkSearch:eG,tag:Qq,text:Rq,url:_d},tG={...DS,link:Yn(/^!?\[(label)\]\((.*?)\)/).replace("label",Um).getRegex(),reflink:Yn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Um).getRegex()},ww={...DS,emStrongRDelimAst:$q,emStrongLDelim:Vq,delLDelim:qq,delRDelim:Kq,url:Yn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",S2).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:Yn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",S2).getRegex()},iG={...ww,br:Yn(qF).replace("{2,}","*").getRegex(),text:Yn(ww.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Gx={normal:wS,gfm:Iq,pedantic:Pq},V0={normal:DS,gfm:ww,breaks:iG,pedantic:tG},nG={"&":"&","<":"<",">":">",'"':""","'":"'"},D2=o=>nG[o];function ya(o,e){if(e){if(yo.escapeTest.test(o))return o.replace(yo.escapeReplace,D2)}else if(yo.escapeTestNoEncode.test(o))return o.replace(yo.escapeReplaceNoEncode,D2);return o}function A2(o){try{o=encodeURI(o).replace(yo.percentDecode,"%")}catch{return null}return o}function k2(o,e){var s;let t=o.replace(yo.findPipe,(r,a,d)=>{let u=!1,f=a;for(;--f>=0&&d[f]==="\\";)u=!u;return u?"|":" |"}),i=t.split(yo.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(yo.slashPipe,"|");return i}function ec(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 B2(o){let e=o.split(`
|
|
83
|
+
`),t=e.length-1;for(;t>=0&&yo.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
|
|
84
|
+
`)}function sG(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 oG(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 F2(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 rG(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 qm=class{constructor(o){Bn(this,"options");Bn(this,"rules");Bn(this,"lexer");this.options=o||rh}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]:B2(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=rG(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=ec(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:ec(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:ec(e[0],`
|
|
88
|
+
`)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=ec(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=oG(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),w=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)||w.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)||w.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=B2(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:ec(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=k2(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:ec(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(k2(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:ec(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=ec(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=sG(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)),F2(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 F2(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}}}},Jr=class Sw{constructor(e){Bn(this,"tokens");Bn(this,"options");Bn(this,"state");Bn(this,"inlineQueue");Bn(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rh,this.options.tokenizer=this.options.tokenizer||new qm,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:yo,block:Gx.normal,inline:V0.normal};this.options.pedantic?(t.block=Gx.pedantic,t.inline=V0.pedantic):this.options.gfm&&(t.block=Gx.gfm,this.options.breaks?t.inline=V0.breaks:t.inline=V0.gfm),this.tokenizer.rules=t}static get rules(){return{block:Gx,inline:V0}}static lex(e,t){return new Sw(t).lex(e)}static lexInline(e,t){return new Sw(t).inlineTokens(e)}lex(e){e=e.replace(yo.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(yo.tabCharGlobal," ").replace(yo.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(w=>(b=w.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 w=t.at(-1);b.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=b.raw,w.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 w=1/0,A=e.slice(1),I;this.options.extensions.startInline.forEach(M=>{I=M.call({lexer:this},A),typeof I=="number"&&I>=0&&(w=Math.min(w,I))}),w<1/0&&w>=0&&(E=e.substring(0,w+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 w=t.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=b.raw,w.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)}},Gm=class{constructor(o){Bn(this,"options");Bn(this,"parser");this.options=o||rh}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match(yo.notSpaceStart))==null?void 0:s[0],n=o.replace(yo.endingNewline,"")+`
|
|
126
|
+
`;return i?'<pre><code class="language-'+ya(i)+'">'+(t?n:ya(n,!0))+`</code></pre>
|
|
127
|
+
`:"<pre><code>"+(t?n:ya(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>${ya(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=A2(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+ya(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=A2(o);if(n===null)return ya(t);o=n;let s=`<img src="${o}" alt="${ya(t)}"`;return e&&(s+=` title="${ya(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:ya(o.text)}},AS=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}},ea=class Dw{constructor(e){Bn(this,"options");Bn(this,"renderer");Bn(this,"textRenderer");this.options=e||rh,this.options.renderer=this.options.renderer||new Gm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new AS}static parse(e,t){return new Dw(t).parse(e)}static parseInline(e,t){return new Dw(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}},Xx,og=(Xx=class{constructor(o){Bn(this,"options");Bn(this,"block");this.options=o||rh}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?Jr.lex:Jr.lexInline}provideParser(o=this.block){return o?ea.parse:ea.parseInline}},Bn(Xx,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Bn(Xx,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Xx),aG=class{constructor(...o){Bn(this,"defaults",_S());Bn(this,"options",this.setOptions);Bn(this,"parse",this.parseMarkdown(!0));Bn(this,"parseInline",this.parseMarkdown(!1));Bn(this,"Parser",ea);Bn(this,"Renderer",Gm);Bn(this,"TextRenderer",AS);Bn(this,"Lexer",Jr);Bn(this,"Tokenizer",qm);Bn(this,"Hooks",og);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 Gm(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 qm(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 og;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];og.passThroughHooks.has(s)?n[r]=u=>{if(this.defaults.async&&og.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 Jr.lex(o,e??this.defaults)}parser(o,e){return ea.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?Jr.lex:Jr.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?ea.parse:ea.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?Jr.lex:Jr.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?ea.parse:ea.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>"+ya(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},Gu=new aG;function os(o,e){return Gu.parse(o,e)}os.options=os.setOptions=function(o){return Gu.setOptions(o),os.defaults=Gu.defaults,VF(os.defaults),os};os.getDefaults=_S;os.defaults=rh;os.use=function(...o){return Gu.use(...o),os.defaults=Gu.defaults,VF(os.defaults),os};os.walkTokens=function(o,e){return Gu.walkTokens(o,e)};os.parseInline=Gu.parseInline;os.Parser=ea;os.parser=ea.parse;os.Renderer=Gm;os.TextRenderer=AS;os.Lexer=Jr;os.lexer=Jr.lex;os.Tokenizer=qm;os.Hooks=og;os.parse=os;os.options;os.setOptions;os.use;os.walkTokens;os.parseInline;ea.parse;Jr.lex;var lG=F('<span class="chat-model svelte-10ayso4"><!></span>'),cG=F('<button class="clear-btn svelte-10ayso4" title="New conversation">+</button>'),dG=F('<p class="history-empty svelte-10ayso4">No saved conversations.</p>'),uG=F('<li><button class="history-load svelte-10ayso4"> </button> <button class="history-del svelte-10ayso4" title="Delete">✕</button></li>'),hG=F('<ul class="history-list svelte-10ayso4"></ul>'),fG=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>'),gG=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>'),pG=F('Chatting in context of <code class="svelte-10ayso4"> </code>',1),xG=F('<button class="chip svelte-10ayso4"> </button>'),vG=F('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),mG=F('<div class="msg-content user-text svelte-10ayso4"> </div>'),L2=F('<span class="tool-args svelte-10ayso4"> </span>'),I2=F('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),P2=F('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),T2=F('<div class="tool-events svelte-10ayso4"></div>'),M2=F('<div class="text-block svelte-10ayso4"></div>'),_G=F('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),bG=F('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),CG=F('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),EG=F('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),yG=F('<button class="expand-btn svelte-10ayso4"> </button>'),wG=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>'),SG=F('<!> <div class="msg-content svelte-10ayso4"></div>',1),DG=F("<div><!></div>"),AG=F('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),kG=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>'),BG=F('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),FG=F('<div class="chat-error svelte-10ayso4"> </div>'),LG=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>'),IG=F('<span><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4"> </button></span>'),PG=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>'),TG=F('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),MG=F('<button class="send-btn svelte-10ayso4">↑</button>'),RG=F('<option class="svelte-10ayso4"> </option>'),NG=F('<select class="model-select svelte-10ayso4"></select>'),OG=F('<span class="model-name svelte-10ayso4"> </span>'),HG=F('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),WG=F('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),zG=F('<p class="info-status svelte-10ayso4">Loading…</p>'),VG=F('<p class="info-status info-err svelte-10ayso4"> </p>'),jG=F('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),$G=F('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),UG=F('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),qG=F('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),GG=F('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),KG=F('<div class="running-model svelte-10ayso4"> </div>'),ZG=F('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),XG=F('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),YG=F('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),QG=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>'),JG=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 eK(o,e){Is(e,!0),$m.registerLanguage("javascript",zF),os.use({breaks:!0,gfm:!0});let t=Tu(e,"currentScript",3,null),i=Tu(e,"extraFiles",31,()=>Di([])),n=B(Di([])),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(Di(localStorage.getItem(f)??g())),C=B(Di([])),b=B(!1);Kn(()=>{localStorage.setItem(f,l(p))});let E=B(Di([])),w=B(Di(localStorage.getItem("she:selectedModel")??"")),A=B(null);const I=Rt(()=>{var X;return l(A)!==null&&((X=t())==null?void 0:X.path)===l(A)});let M=B(Di(new Set)),R=B(!1),P=B(null),V=B(!1),$=B(""),Q=B(0),re=null,he=B(0);const Z=["[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 ce=B(!0),_e=B(!0),se=B(!0),ue=B(!1),Se,Te=B(Di([])),xe,Oe;const We=Rt(()=>({apiref:l(ce),tools:l(_e)})),be=Rt(()=>{var X;return((X=l(u))==null?void 0:X.configured)??!1}),dt=Rt(()=>{var X;return l(be)||!!((X=l(u))!=null&&X.provider)&&!!l(w)}),Pt=Rt(()=>l(Q)+new TextEncoder().encode(l(r)).length),it=Rt(()=>l(se)?t():null);Kn(()=>{var de;const X=(de=t())==null?void 0:de.path;x(se,!0),l(A)!==null&&X!==l(A)&&x(A,null)}),Kn(()=>{var Tt;if(!l(I))return;const X=l(n).at(-1);if(!X||X.role!=="assistant")return;const Ke=Ee(X.content).find(Ue=>Ue.type==="code"&&Dt(Ue.lang));if(Ke){const Ue=ci(Ke.text);(Tt=e.onApply)==null||Tt.call(e,Ue?Ue.code:Ke.text)}});async function yt(){try{const X=await FF();x(u,X,!0),X.configured&&!l(w)&&x(w,X.model,!0)}catch{}}Kn(()=>(window.addEventListener("she:config-changed",yt),()=>window.removeEventListener("she:config-changed",yt))),Kn(()=>{l(w)&&localStorage.setItem("she:selectedModel",l(w))}),Kn(()=>{var X;(X=l(u))!=null&&X.provider&&LF().then(de=>{x(E,de.models,!0),!l(w)&&de.models.length>0&&x(w,de.models[0],!0)}).catch(()=>{})}),Kn(()=>{l(w),x(P,null),x($,"")}),Kn(()=>{var de,Ke;if(((de=l(u))==null?void 0:de.provider)!=="ollama")return;const X=l(w)||((Ke=l(u))==null?void 0:Ke.model);!X||l(P)||Ew(X).then(Tt=>{x(P,Tt,!0)}).catch(()=>{})}),Kn(()=>{if(!l(a))return;x(he,Math.floor(Math.random()*Z.length),!0);const X=setInterval(()=>{x(he,(l(he)+1)%Z.length)},1e4);return()=>clearInterval(X)}),Kn(()=>{var X;Oe&&(l(n).length+(((X=l(s))==null?void 0:X.length)??0),requestAnimationFrame(()=>{Oe&&(Oe.scrollTop=Oe.scrollHeight)}))}),Kn(()=>{const X=l(We),de=l(it),Ke=i();l(dt)&&IF({context:X,currentScript:de??null,extraFiles:Ke.length>0?Ke:void 0}).then(Tt=>{x(Q,new TextEncoder().encode(Tt.prompt).length,!0)}).catch(()=>{})});function Ee(X){const de=X.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
|
|
145
|
+
$2
|
|
146
|
+
`),Ke=[],Tt=/```(\w*)\n([\s\S]*?)```/g;let Ue=0,qe;for(;(qe=Tt.exec(de))!==null;)qe.index>Ue&&Ke.push({type:"text",text:de.slice(Ue,qe.index)}),Ke.push({type:"code",lang:qe[1]||"text",text:qe[2].trimEnd()}),Ue=qe.index+qe[0].length;return Ue<de.length&&Ke.push({type:"text",text:de.slice(Ue)}),Ke}const He=15;function mt(X){return X.split(`
|
|
147
|
+
`).length>He}function At(X){const de=new Set(l(M));de.has(X)?de.delete(X):de.add(X),x(M,de,!0)}function ft(X,de){if(Dt(de))try{return $m.highlight(X,{language:"javascript"}).value}catch{}return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Lt(X){return os.parse(X)}function ni(X){const de=X.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
|
|
148
|
+
$2
|
|
149
|
+
`),Ke=[],Tt=/```(\w*)\n([\s\S]*?)```/g;let Ue=0,qe;for(;(qe=Tt.exec(de))!==null;)qe.index>Ue&&Ke.push({type:"text",text:de.slice(Ue,qe.index)}),Ke.push({type:"code",lang:qe[1]||"text",text:qe[2].trimEnd()}),Ue=qe.index+qe[0].length;const It=de.slice(Ue),pt=It.match(/```(\w*)\n([\s\S]*)$/);return pt?(pt.index>0&&Ke.push({type:"text",text:It.slice(0,pt.index)}),Ke.push({type:"code",lang:pt[1]||"text",text:pt[2]})):It&&Ke.push({type:"text",text:It}),Ke}function pi(X){navigator.clipboard.writeText(X).catch(()=>{})}function xi(X,de=!1){var Ke;de&&t()&&x(A,t().path,!0),(Ke=e.onApply)==null||Ke.call(e,X)}function Dt(X){return!X||X==="js"||X==="javascript"}function ci(X){const de=X.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return de?{filename:de[1],code:X.slice(de[0].length)}:null}function ze(X){return X>=1e9?`${(X/1e9).toFixed(1)} GB`:X>=1e6?`${(X/1e6).toFixed(0)} MB`:X>=1024?`${(X/1024).toFixed(1)} kB`:`${X} B`}async function we(){if(x(R,!0),!(l(P)||l(V))){x(V,!0),x($,"");try{x(P,await Ew(l(w)||l(u).model),!0)}catch(X){x($,X.message,!0)}x(V,!1)}}function ti(X){const de=X.match(/\.([^.]+)$/);return de?de[1].toUpperCase():"?"}function mi(X){switch(X){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return X}}function Ut(X){i(i().filter((de,Ke)=>Ke!==X))}function Bi(){Se.click()}async function Ki(X){if(!(!X||X.length===0))for(const de of Array.from(X)){const Ke=await de.text();i([...i(),{name:de.name,content:Ke}])}}function Ci(X){const de=X.target;Ki(de.files),de.value=""}function pn(X){var de;X.preventDefault(),x(ue,!1),Ki(((de=X.dataTransfer)==null?void 0:de.files)??null)}function nn(X){var de;(de=X.dataTransfer)!=null&&de.types.includes("Files")&&(X.preventDefault(),x(ue,!0))}function cn(){x(ue,!1)}async function on(){try{x(C,await hU(),!0)}catch{}}async function vt(){var de;if(l(n).length===0)return;const X=((de=l(n).find(Ke=>Ke.role==="user"))==null?void 0:de.content.slice(0,80))??l(p);try{await fU(l(p),X,l(n)),await on()}catch{}}async function Jt(X){try{const de=await v2(X);x(n,de.messages,!0),x(p,X,!0),x(b,!1),x(d,"")}catch{}}async function Ni(X){try{await gU(X),await on(),X===l(p)&&zi()}catch{}}function zi(){x(n,[],!0),x(d,""),x(p,g(),!0),x(b,!1)}$s(async()=>{yt();try{const X=await v2(l(p));x(n,X.messages,!0)}catch{}await on()});async function ui(){const X=l(r).trim();if(!X||l(a))return;x(r,""),x(d,""),x(a,!0);const de={role:"user",content:X};x(n,[...l(n),de],!0),re=new AbortController,x(Te,[],!0);try{await PF({messages:l(n),currentScript:l(it),context:l(We),modelOverride:l(w)||void 0,extraFiles:i().length>0?i():void 0},Ke=>{x(s,(l(s)??"")+Ke)},re.signal,Ke=>{x(Te,[...l(Te),Ke],!0)}),x(n,[...l(n),{role:"assistant",content:l(s)??"",toolEvents:l(Te).length>0?[...l(Te)]:void 0}],!0),x(Te,[],!0)}catch(Ke){if(Ke.name==="AbortError"){const Tt=l(s);Tt&&Tt.trim()&&x(n,[...l(n),{role:"assistant",content:Tt+`
|
|
150
|
+
|
|
151
|
+
*[stopped]*`,toolEvents:l(Te).length>0?[...l(Te)]:void 0}],!0)}else x(d,Ke.message,!0)}finally{re=null,x(s,null),x(Te,[],!0),x(a,!1),vt()}}function fn(){re==null||re.abort()}function hn(X){X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),ui())}function xn(){zi()}const Ye=["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 oi(X){x(r,X,!0),xe==null||xe.focus()}var hi=JG(),Ei=Et(hi),Oi=m(Ei),Gi=v(m(Oi),2);{var ji=X=>{var de=lG(),Ke=m(de);{var Tt=It=>{var pt=oo();z(()=>O(pt,`${l(u).provider??""} · ${(l(w)||l(u).model)??""}`)),D(It,pt)},Ue=It=>{var pt=oo();z(()=>O(pt,`${l(u).provider??""} · pick a model below`)),D(It,pt)},qe=It=>{var pt=oo("Not configured");D(It,pt)};H(Ke,It=>{l(dt)?It(Tt):l(u).provider?It(Ue,1):It(qe,-1)})}z(()=>rn(de,"title",`Provider: ${l(u).provider??""}`)),D(X,de)};H(Gi,X=>{l(u)&&X(ji)})}var K=v(Gi,2);let De;var at=v(K,2);{var Qe=X=>{var de=cG();j("click",de,xn),D(X,de)};H(at,X=>{l(n).length>0&&X(Qe)})}var Wt=v(Oi,2);{var si=X=>{var de=fG(),Ke=m(de),Tt=v(m(Ke),2),Ue=v(Ke,2);{var qe=pt=>{var ot=dG();D(pt,ot)},It=pt=>{var ot=hG();li(ot,21,()=>l(C),fe=>fe.id,(fe,Ve)=>{var Me=uG();let Je;var kt=m(Me),st=m(kt),rt=v(kt,2);z(()=>{Je=Ft(Me,1,"history-item svelte-10ayso4",null,Je,{"history-active":l(Ve).id===l(p)}),rn(kt,"title",l(Ve).id),O(st,l(Ve).title||l(Ve).id)}),j("click",kt,()=>Jt(l(Ve).id)),j("click",rt,()=>Ni(l(Ve).id)),D(fe,Me)}),D(pt,ot)};H(Ue,pt=>{l(C).length===0?pt(qe):pt(It,-1)})}j("click",Tt,zi),D(X,de)};H(Wt,X=>{l(b)&&X(si)})}var St=v(Wt,2),et=m(St);{var Y=X=>{var de=gG();D(X,de)},Ie=X=>{var de=vG(),Ke=m(de),Tt=m(Ke);{var Ue=pt=>{var ot=pG(),fe=v(Et(ot)),Ve=m(fe);z(Me=>O(Ve,Me),[()=>t().path.split("/").pop()]),D(pt,ot)},qe=pt=>{var ot=oo("No script open. Ask a general she scripting question.");D(pt,ot)};H(Tt,pt=>{t()?pt(Ue):pt(qe,-1)})}var It=v(Ke,2);li(It,17,()=>Ye,Hi,(pt,ot)=>{var fe=xG(),Ve=m(fe);z(()=>O(Ve,l(ot))),j("click",fe,()=>oi(l(ot))),D(pt,fe)}),D(X,de)};H(et,X=>{l(be)?l(n).length===0&&l(s)===null&&X(Ie,1):X(Y)})}var le=v(et,2);li(le,17,()=>l(n),Hi,(X,de,Ke)=>{var Tt=DG(),Ue=m(Tt);{var qe=pt=>{var ot=mG(),fe=m(ot);z(()=>O(fe,l(de).content)),D(pt,ot)},It=pt=>{const ot=Rt(()=>Ee(l(de).content));var fe=SG(),Ve=Et(fe);{var Me=kt=>{var st=T2();li(st,21,()=>l(de).toolEvents,Hi,(rt,ve)=>{var Ge=Ss(),_t=Et(Ge);{var Vt=Ot=>{var bi=I2(),$i=v(m(bi),2),Ai=m($i),ai=v($i,2);{var Mt=Kt=>{var Qt=L2(),Yt=m(Qt);z(Wi=>O(Yt,Wi),[()=>Object.entries(l(ve).args).map(([Wi,Ui])=>`${Wi}=${JSON.stringify(Ui)}`).join(", ")]),D(Kt,Qt)},Bt=Rt(()=>l(ve).args&&Object.keys(l(ve).args).length>0);H(ai,Kt=>{l(Bt)&&Kt(Mt)})}z(Kt=>O(Ai,Kt),[()=>l(ve).name.replace(/_/g," ")]),D(Ot,bi)},Ct=Ot=>{var bi=P2(),$i=v(m(bi),2),Ai=m($i);z(ai=>O(Ai,ai),[()=>l(ve).name.replace(/_/g," ")]),D(Ot,bi)};H(_t,Ot=>{l(ve).type==="tool_call"?Ot(Vt):Ot(Ct,-1)})}D(rt,Ge)}),D(kt,st)};H(Ve,kt=>{var st;(st=l(de).toolEvents)!=null&&st.length&&kt(Me)})}var Je=v(Ve,2);li(Je,21,()=>l(ot),Hi,(kt,st,rt)=>{var ve=Ss(),Ge=Et(ve);{var _t=Ct=>{var Ot=M2();fc(Ot,()=>Lt(l(st).text),!0),D(Ct,Ot)},Vt=Ct=>{const Ot=Rt(()=>Dt(l(st).lang)?ci(l(st).text):null),bi=Rt(()=>l(Ot)?l(Ot).code:l(st).text),$i=Rt(()=>`${Ke}:${rt}`),Ai=Rt(()=>mt(l(bi))),ai=Rt(()=>l(M).has(l($i)));var Mt=wG(),Bt=m(Mt),Kt=m(Bt),Qt=m(Kt),Yt=v(Kt,2),Wi=m(Yt),Ui=v(Wi,2);{var mn=Gn=>{var ms=_G();j("click",ms,()=>e.onCreateFile(l(Ot).filename,l(Ot).code)),D(Gn,ms)},Vi=Gn=>{var ms=EG(),ir=Et(ms),zr=v(ir,2);{var Ya=pr=>{var Vr=bG();D(pr,Vr)},Vl=pr=>{var Vr=CG();j("click",Vr,()=>xi(l(st).text,!0)),D(pr,Vr)};H(zr,pr=>{l(I)?pr(Ya):pr(Vl,-1)})}j("click",ir,()=>xi(l(st).text)),D(Gn,ms)},An=Rt(()=>Dt(l(st).lang)&&t());H(Ui,Gn=>{l(Ot)&&e.onCreateFile?Gn(mn):l(An)&&Gn(Vi,1)})}var Jn=v(Bt,2);let In;var es=m(Jn),Ji=m(es);fc(Ji,()=>ft(l(bi),l(st).lang??""),!0);var Ts=v(es,2);{var Tn=Gn=>{var ms=yG(),ir=m(ms);z(()=>O(ir,l(ai)?"▲ collapse":"▼ expand")),j("click",ms,()=>At(l($i))),D(Gn,ms)};H(Ts,Gn=>{l(Ai)&&Gn(Tn)})}z(()=>{O(Qt,l(Ot)?`new: ${l(Ot).filename}`:l(st).lang),In=Ft(Jn,1,"code-body svelte-10ayso4",null,In,{collapsed:l(Ai)&&!l(ai)})}),j("click",Wi,()=>pi(l(bi))),D(Ct,Mt)};H(Ge,Ct=>{l(st).type==="text"?Ct(_t):Ct(Vt,-1)})}D(kt,ve)}),D(pt,fe)};H(Ue,pt=>{l(de).role==="user"?pt(qe):pt(It,-1)})}z(()=>Ft(Tt,1,`message ${l(de).role??""}`,"svelte-10ayso4")),D(X,Tt)});var pe=v(le,2);{var ii=X=>{var de=T2();li(de,21,()=>l(Te),Hi,(Ke,Tt)=>{var Ue=Ss(),qe=Et(Ue);{var It=ot=>{var fe=I2(),Ve=v(m(fe),2),Me=m(Ve),Je=v(Ve,2);{var kt=rt=>{var ve=L2(),Ge=m(ve);z(_t=>O(Ge,_t),[()=>Object.entries(l(Tt).args).map(([_t,Vt])=>`${_t}=${JSON.stringify(Vt)}`).join(", ")]),D(rt,ve)},st=Rt(()=>l(Tt).args&&Object.keys(l(Tt).args).length>0);H(Je,rt=>{l(st)&&rt(kt)})}z(rt=>O(Me,rt),[()=>l(Tt).name.replace(/_/g," ")]),D(ot,fe)},pt=ot=>{var fe=P2(),Ve=v(m(fe),2),Me=m(Ve);z(Je=>O(Me,Je),[()=>l(Tt).name.replace(/_/g," ")]),D(ot,fe)};H(qe,ot=>{l(Tt).type==="tool_call"?ot(It):ot(pt,-1)})}D(Ke,Ue)}),D(X,de)};H(pe,X=>{l(Te).length>0&&X(ii)})}var di=v(pe,2);{var ne=X=>{var de=AG(),Ke=m(de),Tt=m(Ke),Ue=m(Tt);z(()=>O(Ue,Z[l(he)])),D(X,de)};H(di,X=>{l(a)&&l(s)===null&&l(Te).length===0&&X(ne)})}var nt=v(di,2);{var $t=X=>{var de=BG(),Ke=m(de);li(Ke,21,()=>ni(l(s)),Hi,(Tt,Ue)=>{var qe=Ss(),It=Et(qe);{var pt=fe=>{var Ve=M2();fc(Ve,()=>Lt(l(Ue).text),!0),D(fe,Ve)},ot=fe=>{var Ve=kG(),Me=m(Ve),Je=m(Me),kt=m(Je),st=v(Me,2),rt=m(st);fc(rt,()=>ft(l(Ue).text,l(Ue).lang??""),!0),z(()=>O(kt,l(Ue).lang)),D(fe,Ve)};H(It,fe=>{l(Ue).type==="text"?fe(pt):fe(ot,-1)})}D(Tt,qe)}),D(X,de)};H(nt,X=>{l(s)!==null&&X($t)})}cs(St,X=>Oe=X,()=>Oe);var qt=v(St,2);{var Gt=X=>{var de=FG(),Ke=m(de);z(()=>O(Ke,l(d))),D(X,de)};H(qt,X=>{l(d)&&X(Gt)})}var Be=v(qt,2),Xe=m(Be),Zt=m(Xe),ei=v(Xe,2),Li=m(ei),vi=v(ei,2),me=m(vi),je=v(me);{var tt=X=>{const de=Rt(()=>Math.min(100,Math.round(l(Pt)/4/l(P).contextLength*100)));var Ke=LG(),Tt=m(Ke),Ue=v(m(Tt));z((qe,It)=>{rn(Ke,"title",`~${l(de)??""}% of ${qe??""} token context window used`),rn(Ue,"stroke",l(de)>80?"var(--fg-err)":l(de)>50?"var(--fg-warn)":"var(--fg-ok)"),rn(Ue,"stroke-dasharray",`${It??""} 31.4`)},[()=>l(P).contextLength.toLocaleString(),()=>(l(de)/100*31.4).toFixed(1)]),D(X,Ke)};H(je,X=>{var de;(de=l(P))!=null&&de.contextLength&&X(tt)})}var Le=v(Be,2),ht=m(Le);{var gt=X=>{const de=Rt(()=>ti(t().path.split("/").pop()??t().path));var Ke=IG();let Tt;var Ue=m(Ke),qe=m(Ue),It=v(Ue,2),pt=m(It),ot=v(It,2),fe=m(ot);z((Ve,Me)=>{Tt=Ft(Ke,1,"file-chip svelte-10ayso4",null,Tt,{inactive:!l(se)}),Ft(Ue,1,`badge badge-${Ve??""}`,"svelte-10ayso4"),O(qe,Me),O(pt,t().path),rn(ot,"title",l(se)?"Remove from context":"Re-add to context"),O(fe,l(se)?"×":"+")},[()=>l(de).toLowerCase(),()=>mi(l(de))]),j("click",ot,()=>x(se,!l(se))),D(X,Ke)};H(ht,X=>{t()&&X(gt)})}var Xt=v(ht,2);li(Xt,17,i,Hi,(X,de,Ke)=>{const Tt=Rt(()=>ti(l(de).name));var Ue=PG(),qe=m(Ue),It=m(qe),pt=v(qe,2),ot=m(pt),fe=v(pt,2);z((Ve,Me)=>{Ft(qe,1,`badge badge-${Ve??""}`,"svelte-10ayso4"),O(It,Me),O(ot,l(de).name)},[()=>l(Tt).toLowerCase(),()=>mi(l(Tt))]),j("click",fe,()=>Ut(Ke)),D(X,Ue)});var U=v(Xt,2),T=v(U,2);cs(T,X=>Se=X,()=>Se);var W=v(Le,2);let J;var ie=m(W);let ae;var oe=m(ie);cs(oe,X=>xe=X,()=>xe);var Ae=v(ie,2);{var $e=X=>{var de=TG();j("click",de,fn),D(X,de)},Ce=X=>{var de=MG();z(Ke=>de.disabled=Ke,[()=>!l(r).trim()||!l(dt)]),j("click",de,ui),D(X,de)};H(Ae,X=>{l(a)?X($e):X(Ce,-1)})}var Pe=v(W,2);{var Ne=X=>{var de=WG(),Ke=m(de),Tt=m(Ke),Ue=v(Ke,2);{var qe=fe=>{var Ve=NG();li(Ve,21,()=>l(E),Hi,(Me,Je)=>{var kt=RG(),st=m(kt),rt={};z(()=>{O(st,l(Je)),rt!==(rt=l(Je))&&(kt.value=(kt.__value=l(Je))??"")}),D(Me,kt)}),z(()=>Ve.disabled=l(a)),Ls(Ve,()=>l(w),Me=>x(w,Me)),D(fe,Ve)},It=fe=>{var Ve=OG(),Me=m(Ve);z(()=>O(Me,l(w)||l(u).model)),D(fe,Ve)};H(Ue,fe=>{l(E).length>0?fe(qe):fe(It,-1)})}var pt=v(Ue,2);{var ot=fe=>{var Ve=HG();j("click",Ve,we),D(fe,Ve)};H(pt,fe=>{l(u).provider==="ollama"&&fe(ot)})}z(()=>O(Tt,l(u).provider)),D(X,de)};H(Pe,X=>{var de;(de=l(u))!=null&&de.provider&&(l(be)||l(E).length>0)&&X(Ne)})}var ct=v(Ei,2);{var ri=X=>{var de=QG(),Ke=m(de),Tt=m(Ke),Ue=m(Tt),qe=m(Ue),It=v(Ue,2),pt=v(Tt,2),ot=m(pt);{var fe=Je=>{var kt=zG();D(Je,kt)},Ve=Je=>{var kt=VG(),st=m(kt);z(()=>O(st,l($))),D(Je,kt)},Me=Je=>{var kt=YG(),st=m(kt);{var rt=Bt=>{var Kt=jG(),Qt=v(Et(Kt)),Yt=m(Qt);z(()=>O(Yt,l(P).version)),D(Bt,Kt)};H(st,Bt=>{l(P).version&&Bt(rt)})}var ve=v(st,2);{var Ge=Bt=>{var Kt=$G(),Qt=v(Et(Kt)),Yt=m(Qt);z(()=>O(Yt,l(P).details.family)),D(Bt,Kt)};H(ve,Bt=>{var Kt;(Kt=l(P).details)!=null&&Kt.family&&Bt(Ge)})}var _t=v(ve,2);{var Vt=Bt=>{var Kt=UG(),Qt=v(Et(Kt)),Yt=m(Qt);z(()=>O(Yt,l(P).details.parameter_size)),D(Bt,Kt)};H(_t,Bt=>{var Kt;(Kt=l(P).details)!=null&&Kt.parameter_size&&Bt(Vt)})}var Ct=v(_t,2);{var Ot=Bt=>{var Kt=qG(),Qt=v(Et(Kt)),Yt=m(Qt);z(()=>O(Yt,l(P).details.quantization_level)),D(Bt,Kt)};H(Ct,Bt=>{var Kt;(Kt=l(P).details)!=null&&Kt.quantization_level&&Bt(Ot)})}var bi=v(Ct,2);{var $i=Bt=>{var Kt=GG(),Qt=v(Et(Kt)),Yt=m(Qt);z(()=>O(Yt,l(P).details.format)),D(Bt,Kt)};H(bi,Bt=>{var Kt;(Kt=l(P).details)!=null&&Kt.format&&Bt($i)})}var Ai=v(bi,2);{var ai=Bt=>{var Kt=ZG(),Qt=v(Et(Kt),2);li(Qt,21,()=>l(P).running,Hi,(Yt,Wi)=>{var Ui=KG(),mn=m(Ui);z(Vi=>O(mn,`${l(Wi).name??""} · ${Vi??""} VRAM`),[()=>ze(l(Wi).size_vram)]),D(Yt,Ui)}),D(Bt,Kt)},Mt=Bt=>{var Kt=XG();D(Bt,Kt)};H(Ai,Bt=>{l(P).running&&l(P).running.length>0?Bt(ai):l(P).running!==null&&Bt(Mt,1)})}D(Je,kt)};H(ot,Je=>{l(V)?Je(fe):l($)?Je(Ve,1):l(P)&&Je(Me,2)})}z(()=>{var Je;return O(qe,`Ollama · ${(l(w)||((Je=l(u))==null?void 0:Je.model))??""}`)}),j("click",de,()=>x(R,!1)),j("click",Ke,Je=>Je.stopPropagation()),j("click",It,()=>x(R,!1)),D(X,de)};H(ct,X=>{l(R)&&X(ri)})}z(X=>{De=Ft(K,1,"icon-hdr-btn svelte-10ayso4",null,De,{active:l(b)}),O(me,X),J=Ft(W,1,"input-row svelte-10ayso4",null,J,{"drag-over":l(ue)}),ae=Ft(ie,1,"textarea-wrap svelte-10ayso4",null,ae,{loading:l(a)}),rn(oe,"placeholder",l(dt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":l(be)?"Select a model above to start chatting":"AI not configured"),oe.disabled=l(a)||!l(dt)},[()=>ze(l(Pt))]),j("click",K,()=>x(b,!l(b))),ws(Zt,()=>l(ce),X=>x(ce,X)),ws(Li,()=>l(_e),X=>x(_e,X)),j("click",U,Bi),j("change",T,Ci),xs("dragover",W,nn),xs("dragleave",W,cn),xs("drop",W,pn),j("keydown",oe,hn),Nt(oe,()=>l(r),X=>x(r,X)),D(o,hi),Ps()}Gs(["click","change","keydown"]);const tK={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"]},iK={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 Aw=[],kw=[],Bw=[];const Km=new Map;let QF=[];const Fw=new Map,Lw=new Map;async function R2(){try{Aw=(await BF()).map(e=>e.topic)}catch{}}async function N2(){try{const[o,e]=await Promise.all([DF(),AF()]);kw=o,Bw=e}catch{}}async function O2(){try{const o=await gS();QF=o.map(e=>e.nodeId),Fw.clear(),Lw.clear();for(const e of o)e.name&&(Fw.set(e.nodeId,e.name),Lw.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!Km.has(e.nodeId))try{Km.set(e.nodeId,await Cv(e.nodeId))}catch{}}))}catch{}}function nK(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=sK(u),g=oK(u);if(f===0)return{type:"matter-nodeId",prefix:g};if(f===1){const p=Ph(u,0);if(p)return{type:"matter-endpointId",nodeId:p}}if(f===2){const p=Ph(u,0),C=H2(u,1)??Ph(u,1);if(p&&C!==null)return{type:"matter-cluster",nodeId:p,endpointId:C}}if(f>=3){const p=Ph(u,0),C=H2(u,1)??Ph(u,1),b=Ph(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 sK(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 oK(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function Ph(o,e){var s;const i=(s=JF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function H2(o,e){var s;const i=(s=JF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function JF(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 Ku=vd.CompletionItemKind;function rK(o,e){return(e?Aw.filter(i=>i.startsWith(e)):Aw).map(i=>({label:i,kind:Ku.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function aK(o,e,t){const i=t?[...kw,...Bw]:kw;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:Ku.Value,insertText:s,range:o,detail:Bw.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function lK(o,e){return QF.map(t=>{const i=Fw.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:Ku.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function e3(o){return Lw.get(o)??o}function cK(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 dK(o,e){const t=Km.get(e3(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:Ku.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function uK(o,e,t){const i=Km.get(e3(e));if(!i)return[];const n=cK(i,t);return n?n.clusters.map(s=>({label:s.name,kind:Ku.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function hK(o,e,t){return(t?iK[e]??[]:tK[e]??[]).map(n=>({label:n,kind:t?Ku.Function:Ku.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let W2=!1;function fK(){W2||(W2=!0,R2(),N2(),O2(),setInterval(R2,15e3),setInterval(N2,1e4),setInterval(O2,6e4),vd.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=nK(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:rK(a,i.prefix)};case"db":return{suggestions:aK(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:lK(a,i.prefix)};case"matter-endpointId":return{suggestions:dK(a,i.nodeId)};case"matter-cluster":return{suggestions:uK(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:hK(a,i.cluster,i.isSend)};default:return null}}}))}var gK=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),pK=F('<button class="svelte-1pyfjii">Show git history</button>'),xK=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),vK=F('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),mK=F('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),z2=F('<span class="git-mod svelte-1pyfjii" title="Uncommitted changes">M</span>'),_K=F('<ul class="tree-children svelte-1pyfjii"></ul>'),bK=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>'),CK=F('<span class="dirty-dot svelte-1pyfjii">●</span>'),EK=F('<span class="run-dot svelte-1pyfjii" title="Running">●</span>'),yK=F('<span class="err-dot svelte-1pyfjii">●</span>'),wK=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>'),SK=F('<span class="dis-spacer svelte-1pyfjii"></span>'),DK=F('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!><!> <!> <!></button> <!></div></li>'),AK=F('<div class="err svelte-1pyfjii"> </div>'),kK=F('<button title="Case sensitive">Aa</button> <button title="Use regex">.*</button> <button title="Replace">⇄</button>',1),BK=F('<div class="search-input-row svelte-1pyfjii"><input placeholder="Replace with…" class="svelte-1pyfjii"/> <button class="svelte-1pyfjii"> </button></div>'),FK=F('<div class="search-status svelte-1pyfjii">Searching…</div>'),LK=F('<div class="search-status search-err svelte-1pyfjii"> </div>'),IK=F('<div class="search-status svelte-1pyfjii">No results.</div>'),PK=F('<div class="search-status search-trunc svelte-1pyfjii">Showing first 500 matches.</div>'),TK=F('<button class="search-match-row svelte-1pyfjii"><span class="search-lnum svelte-1pyfjii"> </span> <span class="search-preview svelte-1pyfjii"> </span></button>'),MK=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>'),JC=F("<!> <!>",1),RK=F('<div class="search-status svelte-1pyfjii">No files found.</div>'),NK=F('<div class="search-status search-trunc svelte-1pyfjii">Showing first 200 results.</div>'),OK=F('<button class="search-match-row search-file-result svelte-1pyfjii"><span class="search-preview svelte-1pyfjii"> </span></button>'),HK=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>'),WK=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>'),zK=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>'),VK=F('<div class="history-empty svelte-1pyfjii">Loading…</div>'),jK=F('<div class="history-empty svelte-1pyfjii">No commits found.</div>'),$K=F('<button class="history-row svelte-1pyfjii"><span class="history-subject svelte-1pyfjii"> </span> <span class="history-meta svelte-1pyfjii"> </span></button>'),UK=F('<button class="history-load-more svelte-1pyfjii"> </button>'),qK=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>'),GK=F('<span class="tab-dirty svelte-1pyfjii">●</span>'),KK=F('<div role="tab" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),ZK=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>'),XK=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>'),YK=F('<div class="changes-err svelte-1pyfjii"> </div>'),QK=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),JK=F('<div class="changes-wrap svelte-1pyfjii"><button class="git-changes svelte-1pyfjii"> </button> <!></div>'),eZ=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),tZ=F('<div class="changes-wrap svelte-1pyfjii"><button class="git-ahead svelte-1pyfjii"> </button> <!></div>'),iZ=F('<span class="git-behind svelte-1pyfjii"> </span>'),nZ=F('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),sZ=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 & Commit</button></div>',1),oZ=F('<button class="danger svelte-1pyfjii">Delete</button>'),rZ=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 & 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>`),aZ=F('<button class="svelte-1pyfjii">Always accept in this session</button>'),lZ=F('<button class="svelte-1pyfjii">Disable auto-accept</button>'),cZ=F('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),dZ=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>'),uZ=F('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),hZ=F('<div class="diff-container svelte-1pyfjii"></div>'),fZ=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>'),gZ=F('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),pZ=F('<span class="log-file svelte-1pyfjii"> </span>'),xZ=F("<option> </option>"),vZ=F('<select class="log-filter-level svelte-1pyfjii"></select> <input class="log-filter-text svelte-1pyfjii" type="search" placeholder="Filter…"/> <label class="log-filter-regex svelte-1pyfjii" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-1pyfjii"/> <span class="log-filter-checkmark svelte-1pyfjii"></span> Regex</label> <button class="log-clear svelte-1pyfjii">Clear</button>',1),mZ=F('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),_Z=F('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),bZ=F('<div class="log-body svelte-1pyfjii"><!> <!></div>'),CZ=F('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),EZ=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)">⌕</button> <button title="Refresh" class="refresh svelte-1pyfjii">↻</button></div> <!> <!> <ul class="tree svelte-1pyfjii"><li role="presentation"></li> <!></ul> <!></aside> <div class="sidebar-resize-handle svelte-1pyfjii" role="separator"></div> <div class="editor-area svelte-1pyfjii"><!> <div class="editor-toolbar svelte-1pyfjii"><span class="filename svelte-1pyfjii"> </span> <!> <div class="split-wrap svelte-1pyfjii"><div class="split-btn svelte-1pyfjii"><button class="split-main svelte-1pyfjii"> </button> <button class="split-arrow svelte-1pyfjii" aria-label="Save options">▾</button></div> <!></div> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><line x1="5.5" y1="5" x2="4" y2="2.5"></line><line x1="10.5" y1="5" x2="12" y2="2.5"></line><path d="M3 11 V7 A5 3.5 0 0 0 13 7 V11 Z" stroke-linejoin="round"></path><circle cx="6" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle><circle cx="10" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle></svg> AI</button></div> <div class="editor-body svelte-1pyfjii"><div class="editor-left svelte-1pyfjii"><div class="editor-stack svelte-1pyfjii"><div class="editor-container svelte-1pyfjii"></div> <!> <!> <!></div> <div><!> <div class="log-header svelte-1pyfjii"><button class="log-toggle svelte-1pyfjii"> <!></button> <!></div> <!></div></div> <!></div></div></div>',1);function yZ(o,e){Is(e,!0);let t=B(Di([])),i=B(Di({})),n=B(null),s=B(null),r=B(null),a=B(null),d=B(Di([])),u=B(null),f=B(!1),g=B(""),p=B(!1),C=B(!0),b=B(null),E=B(!1),w=B(!1),A=B(null),I=B(Di([])),M=B(!1),R=B(30),P=B(void 0),V=null,$=null,Q=null,re=B(!1),he=B(""),Z=B(!1),ce=B(void 0),_e=B(Di(new Set));const se=new Set;let ue=B(Di(new Set)),Se=B(Di([])),Te=B(!1),xe=B("text"),Oe=B(""),We=B(!1),be=B(!1),dt=B(!1),Pt=B(""),it=B(Di([])),yt=B(Di([])),Ee=B(!1),He=B(!1),mt=B(""),At=B(void 0),ft=B(Di([])),Lt=B(!1),ni=B(!1),pi=null,xi=B(void 0),Dt=B(!1),ci=B(!1),ze=null;function we(){l(xi)&&(x(Dt,l(xi).scrollLeft>0),x(ci,l(xi).scrollLeft+l(xi).clientWidth<l(xi).scrollWidth-1))}function ti(G){var ge;(ge=l(xi))==null||ge.scrollBy({left:G*200,behavior:"smooth"})}function mi(G="text"){x(Te,!0),x(xe,G,!0),fl().then(()=>{var ge;return(ge=l(At))==null?void 0:ge.focus()})}function Ut(){x(Te,!1),x(Oe,""),x(it,[],!0),x(yt,[],!0),x(Ee,!1),x(mt,""),x(dt,!1),x(Lt,!1)}function Bi(){pi&&clearTimeout(pi),pi=setTimeout(Ki,300)}async function Ki(){const G=l(Oe).trim();if(!G){x(it,[],!0),x(yt,[],!0),x(Ee,!1),x(mt,"");return}x(He,!0),x(mt,"");try{if(l(xe)==="files"){const ge=await u2(G,{mode:"files"});x(yt,ge.results,!0),x(Ee,ge.truncated,!0)}else{const ge=await u2(G,{regex:l(be),caseSensitive:l(We)});x(it,ge.results,!0),x(Ee,ge.truncated,!0)}}catch(ge){x(mt,ge.message||"Search failed",!0)}finally{x(He,!1)}}async function Ci(G,ge){await It(G),hi&&(hi.revealLineInCenter(ge.line),hi.setPosition({lineNumber:ge.line,column:ge.col}),hi.focus())}function pn(G){return G.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function nn(){if(!l(Oe).trim()||!l(it).length)return;x(ni,!0);const G=[],ge="g"+(l(We)?"":"i");for(const ut of l(it))try{const xt=await $x(ut.path),lt=l(be)?new RegExp(l(Oe),ge):new RegExp(pn(l(Oe)),ge),fi=xt.content.replace(lt,l(Pt));fi!==xt.content&&G.push({path:ut.path,checked:!0,original:xt.content,replaced:fi,changes:ut.matches.length})}catch{}x(ft,G,!0),x(ni,!1),x(Lt,!0)}async function cn(){for(const G of l(ft).filter(ge=>ge.checked))try{await Jl(G.path,G.replaced);const ge=l(d).find(ut=>ut.path===G.path);ge!=null&&ge.model&&(ge.model.setValue(G.replaced),ge.savedContent=G.replaced,ge.dirty=!1)}catch{}x(Lt,!1),await Ki()}function on(G){G.ctrlKey&&G.shiftKey&&G.key==="F"&&(G.preventDefault(),l(Te)&&l(xe)==="text"?Ut():mi("text"))}Kn(()=>{l(xi)&&(ze==null||ze.disconnect(),ze=new ResizeObserver(we),ze.observe(l(xi)),we())});let vt=B("all"),Jt=B(""),Ni=B(!1);const zi=["all","debug","info","warn","error"],ui={debug:0,info:1,warn:2,error:3};function fn(G){if(l(vt)!=="all"&&ui[G.level]<ui[l(vt)])return!1;if(!l(Jt))return!0;if(l(Ni))try{return new RegExp(l(Jt),"i").test(G.msg)}catch{}return G.msg.toLowerCase().includes(l(Jt).toLowerCase())}let hn=B(null);function xn(G){const ge=G.currentTarget.getBoundingClientRect();x(hn,{x:ge.left,y:ge.top},!0)}function Ye(){x(hn,null)}let oi,hi,Ei,Oi=!1,Gi=null,ji=null,K=!1,De=!1,at=B(!1),Qe=B(null),Wt=B(!1),si=B(!1),St=B(void 0),et=null,Y=null,Ie=null,le=B(Di(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),pe=B(Di(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),ii=B(Di(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),di=B(Di(parseInt(localStorage.getItem("she-scripts-history-height")??"220",10))),ne=!1,nt=0,$t=0,qt=!1,Gt=0,Be=0,Xe=!1,Zt=0,ei=0,Li=!1,vi=0,me=0;const je=Rt(()=>{var G;return l(u)&&l(oe)?{path:l(u),content:((G=l(oe).model)==null?void 0:G.getValue())??l(oe).savedContent}:null}),tt=Rt(()=>{var G;return new Set(((G=l(b))==null?void 0:G.changes.map(ge=>ge.file))??[])}),Le=Rt(()=>{const G=new Set;for(const ge of l(tt)){const ut=ge.split("/");for(let xt=1;xt<ut.length;xt++)G.add(ut.slice(0,xt).join("/"))}return G});let ht=B(!1),gt=B(!1),Xt=B(""),U=B(!1),T=B(""),W=B(Di(new Set));async function J(){var G;if(!(!l(Xt).trim()||l(W).size===0)){x(U,!0),x(T,"");try{const ge=l(b).changes.filter(ut=>l(W).has(ut.file)).map(ut=>ut.file);if(ge.length===l(b).changes.length?await g2(l(Xt).trim()):await f2(ge,l(Xt).trim()),l(w))try{await qx()}catch{}x(Xt,""),await fe(),(G=l(b))!=null&&G.changes.length?x(W,new Set(l(b).changes.map(ut=>ut.file)),!0):x(ht,!1)}catch(ge){x(T,ge.message,!0)}finally{x(U,!1)}}}let ie,ae,oe=Rt(()=>l(d).find(G=>G.path===l(u))??null);const Ae="she-tabs",$e="she-active-tab",Ce="she-log-open",Pe="she-chat-open";let Ne=Tu(e,"active",3,!0);Kn(()=>{De&&(localStorage.setItem(Ae,JSON.stringify(l(d).map(G=>G.path))),l(u)?localStorage.setItem($e,l(u)):localStorage.removeItem($e))}),Kn(()=>{De&&localStorage.setItem(Pe,String(l(at)))}),Kn(()=>{Ne()&&hi&&hi.layout()});const ct=`
|
|
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 ri(G){l(d).some(ge=>ge.dirty)&&G.preventDefault()}$s(async()=>{var fi,Ti;window.addEventListener("beforeunload",ri),x(C,localStorage.getItem(Ce)!=="false"),x(at,localStorage.getItem(Pe)==="true"),vd.typescript.javascriptDefaults.addExtraLib(ct,"she-api.d.ts"),vd.typescript.javascriptDefaults.setCompilerOptions({target:vd.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),vd.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),fK(),Ei=Vo.createModel("","javascript"),hi=Vo.create(oi,{model:Ei,theme:Jh(),automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),hi.addCommand(_1.CtrlCmd|_1.Shift|jk.KeyF,()=>{l(Te)&&l(xe)==="text"?Ut():mi("text")}),(fi=hi.getDomNode())==null||fi.addEventListener("keydown",Mi=>{(Mi.ctrlKey||Mi.metaKey)&&Mi.key==="s"&&(Mi.preventDefault(),Me())}),hi.onDidChangeModelContent(()=>{if(Oi)return;const Mi=l(d).find(Yi=>Yi.path===l(u));Mi&&(Mi.dirty=hi.getValue()!==Mi.savedContent),Tn&&clearTimeout(Tn),Tn=setTimeout(Gn,600)}),Gi=vS(Mi=>{const Yi=Mi.msg.match(/^([^:\n]+\.js):\s/);if(!Yi)return;const Zi=Yi[1];if(Mi.level==="error")se.add(Zi),l(_e).has(Zi)||x(_e,new Set([...l(_e),Zi]),!0);else if(se.has(Zi)){se.delete(Zi);const dn=new Set(l(_e));dn.delete(Zi),x(_e,dn,!0)}const gn=l(d).find(dn=>dn.path===Zi);gn&&(gn.logEntries=[...gn.logEntries.slice(-199),Mi],gn.path===l(u)&&l(C)&&l(ce)&&fl().then(()=>{l(ce)&&(l(ce).scrollTop=l(ce).scrollHeight)}))}),ji=Xo("script:running",Mi=>{const Yi=Mi.path;if(Mi.running)x(ue,new Set([...l(ue),Yi]),!0);else{const Zi=new Set(l(ue));Zi.delete(Yi),x(ue,Zi,!0)}}),await X(),fe();try{const Mi=await Tl();typeof Mi.gitAutoCommit=="boolean"&&x(E,Mi.gitAutoCommit,!0),typeof Mi.gitAutoPush=="boolean"&&x(w,Mi.gitAutoPush,!0)}catch{}try{const Mi=await getDaemonStatus();x(ue,new Set(Mi.runningScripts??[]),!0)}catch{}const G=JSON.parse(localStorage.getItem(Ae)??"[]"),ge=localStorage.getItem($e);for(const Mi of G)await qe(Mi,!1);const ut=ge&&l(d).some(Mi=>Mi.path===ge)?ge:((Ti=l(d)[0])==null?void 0:Ti.path)??null;ut&&await pt(ut),De=!0;const xt=()=>Vo.setTheme(Jh()),lt=window.matchMedia("(prefers-color-scheme: dark)");return window.addEventListener("she:theme-changed",xt),lt.addEventListener("change",xt),()=>{window.removeEventListener("she:theme-changed",xt),lt.removeEventListener("change",xt)}}),jp(()=>{var G;window.removeEventListener("beforeunload",ri),ze==null||ze.disconnect(),Tn&&clearTimeout(Tn),Gi==null||Gi(),ji==null||ji();for(const ge of l(d))(G=ge.model)==null||G.dispose();Ei==null||Ei.dispose(),hi==null||hi.dispose()});async function X(){try{if(x(t,await K$(),!0),!K){let ge=function(ut){for(const xt of ut)xt.type==="dir"&&(G[xt.path]=!0,xt.children&&ge(xt.children))};K=!0;const G={};ge(l(t)),x(i,G,!0)}x(g,"")}catch(G){x(g,G.message,!0)}}function de(G){l(i)[G]=!l(i)[G]}function Ke(G){switch(G){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return G}}async function Tt(G,ge){try{ge?await Jl(`${G}/.shelib`,""):await Ux(`${G}/.shelib`),await X(),await Ve("all",ge?`lib ${G}`:`unlib ${G}`)}catch(ut){x(g,ut.message,!0)}}async function Ue(G,ge){const ut=G.split("/").pop(),xt=G.includes("/")?G.slice(0,G.lastIndexOf("/")):"",lt=xt?`${xt}/.shedisable-${ut}`:`.shedisable-${ut}`;try{ge?await Jl(lt,""):await Ux(lt),await X(),await Ve("all",ge?`disable ${G}`:`enable ${G}`)}catch(fi){x(g,fi.message,!0)}}async function qe(G,ge=!0){var ut;if(l(d).some(xt=>xt.path===G)){ge&&await pt(G);return}try{const{content:xt}=await $x(G),lt=M7.parse(`file:///she-scripts/${encodeURIComponent(G)}`);(ut=Vo.getModel(lt))==null||ut.dispose();const fi=Vo.createModel(xt,Ts(G),lt);let Ti=[];try{Ti=(await pS()).filter(Yi=>{const Zi=Yi.msg.match(/^([^:\n]+\.js):\s/);return Zi&&Zi[1]===G})}catch{}x(d,[...l(d),{path:G,dirty:!1,savedContent:xt,model:fi,logEntries:Ti}],!0),ge&&await pt(G)}catch(xt){x(g,xt.message,!0)}}async function It(G){await qe(G,!0)}async function pt(G){var ut,xt;const ge=l(d).find(lt=>lt.path===G);ge!=null&&ge.model&&(Ct(),x(Qe,null),x(u,G,!0),Oi=!0,hi.setModel(ge.model),Oi=!1,Gn(),await fl(),(xt=(ut=l(xi))==null?void 0:ut.querySelector(`[data-tab-path="${CSS.escape(G)}"]`))==null||xt.scrollIntoView({inline:"nearest",block:"nearest"}),we())}async function ot(G){var xt;const ge=l(d).find(lt=>lt.path===G);if(!ge||ge.dirty&&!await ie.show(`Discard unsaved changes to ${G}?`,{confirm:"Discard"}))return;const ut=l(d).findIndex(lt=>lt.path===G);if((xt=ge.model)==null||xt.dispose(),x(d,l(d).filter(lt=>lt.path!==G),!0),l(u)===G){const lt=l(d)[ut]??l(d)[ut-1]??null;lt?await pt(lt.path):(x(u,null),hi.setModel(Ei))}}async function fe(){try{x(b,await X$(),!0)}catch{x(b,null)}}async function Ve(G,ge){if(l(b))try{if(G==="all"?await g2(ge):await f2(G,ge),l(w))try{await qx()}catch{}await fe()}catch{}}async function Me(){if(!l(u))return;const G=l(d).find(ge=>ge.path===l(u));if(G){x(f,!0);try{const ge=hi.getValue();await Jl(l(u),ge),G.savedContent=ge,G.dirty=!1,x(g,""),l(E)?await Ve([l(u)],`update ${l(u)}`):fe()}catch(ge){x(g,ge.message,!0)}finally{x(f,!1)}}}async function Je(){if(!l(u)||(await Me(),l(g)))return;const G=await ae.show("Commit message:",{initial:`update ${l(u)}`,placeholder:"Update script",confirm:"Commit"});if(G)try{if(await J$(l(u),G),l(w))try{await qx()}catch{}fe()}catch(ge){x(g,"Git: "+ge.message)}}async function kt(){x(p,!1);try{await qx(),await fe(),x(g,"")}catch(G){x(g,"Git push: "+G.message)}}function st(G){const ge=Date.now()-new Date(G).getTime(),ut=Math.floor(ge/1e3);if(ut<60)return"just now";const xt=Math.floor(ut/60);if(xt<60)return`${xt}m ago`;const lt=Math.floor(xt/60);if(lt<24)return`${lt}h ago`;const fi=Math.floor(lt/24);if(fi<30)return`${fi}d ago`;const Ti=Math.floor(fi/30);return Ti<12?`${Ti}mo ago`:`${Math.floor(Ti/12)}y ago`}async function rt(G){Ai(),x(A,G,!0),x(I,[],!0),x(R,30),await ve()}async function ve(){if(l(A)){x(M,!0);try{x(I,await eU(l(A).path,l(R)),!0)}catch{}finally{x(M,!1)}}}async function Ge(){x(R,l(R)+30),await ve()}function _t(){x(A,null),x(I,[],!0),Ct()}async function Vt(G){if(!l(A))return;Ct(),await It(l(A).path);let ge;try{ge=await tU(G.hash,l(A).path)}catch{return}if(x(he,G.hash,!0),x(Z,ge.binary,!0),x(re,!0),ge.binary||ge.content===null)return;let ut="";const xt=l(d).find(fi=>fi.path===l(A).path);if(xt!=null&&xt.model)ut=xt.model.getValue();else try{ut=(await $x(l(A).path)).content}catch{}if(await fl(),!l(P))return;const lt=Ts(l(A).path);$=Vo.createModel(ge.content,lt),Q=Vo.createModel(ut,lt),V=Vo.createDiffEditor(l(P),{theme:Jh(),readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),V.setModel({original:$,modified:Q})}function Ct(){x(re,!1),x(Z,!1),V==null||V.dispose(),V=null,$==null||$.dispose(),$=null,Q==null||Q.dispose(),Q=null}async function Ot(){const G=l(n)?`${l(n)}/`:"",ge=await ae.show("New script name:",{placeholder:G?`${G}myscript.js`:"myscript.js",initial:G,confirm:"Create"});if(!ge)return;const ut=ge.endsWith(".js")?`/* global she */
|
|
217
|
+
'use strict';
|
|
218
|
+
|
|
219
|
+
`:"";await Jl(ge,ut),await X(),await qe(ge,!0)}async function bi(){const G=l(n)?`${l(n)}/`:"",ge=await ae.show("New folder name:",{placeholder:G?`${G}subfolder`:"myfolder",initial:G,confirm:"Create"});ge&&(await Z$(ge),l(i)[ge]=!0,await X())}function $i(G,ge){G.preventDefault();const ut=180,xt=200,lt=Math.min(G.clientX,window.innerWidth-ut),fi=Math.min(G.clientY,window.innerHeight-xt);x(s,{x:lt,y:fi,entry:ge},!0)}function Ai(){x(s,null)}async function ai(G){Ai(),x(n,G,!0),l(i)[G]=!0,await Ot()}async function Mt(G){Ai(),x(n,G,!0),await bi()}async function Bt(G){Ai();const ge=G.path.includes("/")?G.path.slice(0,G.path.lastIndexOf("/")+1):"",ut=await ae.show(G.type==="dir"?"Rename folder:":"Rename script:",{initial:G.name,placeholder:G.name,confirm:"Rename"});if(!ut||ut===G.name)return;const xt=ge+ut;try{await h2(G.path,xt);const lt=l(d).find(fi=>fi.path===G.path);lt&&(lt.path=xt,l(u)===G.path&&x(u,xt)),await X(),await Ve("all",`rename ${G.path} → ${xt}`)}catch(lt){x(g,lt.message,!0)}}function Kt(G){if(!G.children)return 0;let ge=0;for(const ut of G.children)ge++,ut.type==="dir"&&(ge+=Kt(ut));return ge}async function Qt(G){Ai();let ge=`Delete ${G.type==="dir"?"folder":"file"} "${G.path}"?`;if(G.type==="dir"){const ut=Kt(G);ut>0&&(ge+=` This will also delete ${ut} item${ut===1?"":"s"} inside.`)}if(await ie.show(ge,{confirm:"Delete",danger:!0})){if(G.type==="dir")for(const ut of[...l(d)])ut.path.startsWith(G.path+"/")&&await ot(ut.path);else await ot(G.path);await Ux(G.path),await X(),await Ve("all",`delete ${G.path}`)}}async function Yt(G){Ai();const{content:ge}=await $x(G.path);l(Se).some(ut=>ut.name===G.path)||x(Se,[...l(Se),{name:G.path,content:ge}],!0),x(at,!0)}function Wi(G,ge){var ut;x(r,ge,!0),(ut=G.dataTransfer)==null||ut.setData("text/plain",ge)}function Ui(G,ge){if(G.preventDefault(),l(r)&&(l(r)===ge||ge.startsWith(l(r)+"/"))){G.dataTransfer&&(G.dataTransfer.dropEffect="none"),x(a,null);return}G.dataTransfer&&(G.dataTransfer.dropEffect="move"),x(a,ge,!0)}function mn(){x(a,null)}async function Vi(G,ge){var Ti,Mi,Yi;G.preventDefault(),x(a,null);const ut=Array.from(((Ti=G.dataTransfer)==null?void 0:Ti.items)??[]).filter(Zi=>Zi.kind==="file");if(ut.length>0&&!l(r)){for(const Zi of ut){const gn=(Mi=Zi.webkitGetAsEntry)==null?void 0:Mi.call(Zi);gn&&await An(gn,ge,!0)}await X();return}const xt=l(r)??((Yi=G.dataTransfer)==null?void 0:Yi.getData("text/plain"));if(x(r,null),!xt||xt===ge||ge.startsWith(xt+"/"))return;const lt=xt.split("/").pop(),fi=ge?`${ge}/${lt}`:lt;if(fi!==xt)try{await h2(xt,fi);for(const Zi of l(d))if(Zi.path===xt)l(u)===xt&&x(u,fi,!0),Zi.path=fi;else if(Zi.path.startsWith(xt+"/")){const gn=fi+Zi.path.slice(xt.length);l(u)===Zi.path&&x(u,gn),Zi.path=gn}await X(),await Ve("all",`rename ${xt} → ${fi}`)}catch(Zi){x(g,Zi.message,!0)}}async function An(G,ge,ut){if(G.isFile){const lt=await(await new Promise((Ti,Mi)=>G.file(Ti,Mi))).text(),fi=ge?`${ge}/${G.name}`:G.name;await Jl(fi,lt),ut&&G.name.endsWith(".js")&&await Ue(fi,!0)}else if(G.isDirectory){const xt=G.createReader();let lt=[],fi;do fi=await new Promise((Ti,Mi)=>xt.readEntries(Ti,Mi)),lt=[...lt,...fi];while(fi.length>0);for(const Ti of lt)await An(Ti,ge?`${ge}/${G.name}`:G.name,!1);if(ut){const Ti=ge?`${ge}/${G.name}`:G.name;await Ue(Ti,!0)}}}async function Jn(){if(!l(u)||!await ie.show(`Delete ${l(u)}?`,{confirm:"Delete",danger:!0}))return;const G=l(u);await ot(G),await Ux(G),await X(),await Ve("all",`delete ${G}`)}function In(){l(oe)&&(l(oe).logEntries=[])}function es(){x(C,!l(C)),localStorage.setItem(Ce,String(l(C)))}function Ji(G){return new Date(G).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ts(G){var xt;const ge=((xt=G.split(".").pop())==null?void 0:xt.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"}[ge]??"plaintext"}let Tn=null;async function Gn(){const G=l(d).find(ut=>ut.path===l(u));if(!(G!=null&&G.model))return;const ge=G.model;try{const fi=(await(await(await vd.typescript.getJavaScriptWorker())(ge.uri)).getSyntacticDiagnostics(ge.uri.toString())).map(Ti=>{const Mi=ge.getPositionAt(Ti.start??0),Yi=ge.getPositionAt((Ti.start??0)+(Ti.length??0));return{severity:R7.Error,startLineNumber:Mi.lineNumber,startColumn:Mi.column,endLineNumber:Yi.lineNumber,endColumn:Yi.column,message:typeof Ti.messageText=="string"?Ti.messageText:JSON.stringify(Ti.messageText),source:"she-syntax"}});if(Vo.setModelMarkers(ge,"she-syntax",fi),l(u)){if(fi.length>0)se.add(l(u)),l(_e).has(l(u))||x(_e,new Set([...l(_e),l(u)]),!0);else if(se.has(l(u))){se.delete(l(u));const Ti=new Set(l(_e));Ti.delete(l(u)),x(_e,Ti,!0)}}}catch{}}function ms(G){ne=!0,nt=G.clientX,$t=l(le),G.preventDefault()}function ir(G){qt=!0,Gt=G.clientY,Be=l(pe),G.preventDefault()}function zr(G){Xe=!0,Zt=G.clientX,ei=l(ii),G.preventDefault()}function Ya(G){Li=!0,vi=G.clientY,me=l(di),G.preventDefault()}function Vl(G){ne&&x(le,Math.max(140,Math.min(500,$t+G.clientX-nt)),!0),qt&&x(pe,Math.max(60,Math.min(500,Be-(G.clientY-Gt))),!0),Xe&&x(ii,Math.max(200,Math.min(700,ei-(G.clientX-Zt))),!0),Li&&x(di,Math.max(80,Math.min(600,me-(G.clientY-vi))),!0)}function pr(){ne&&(ne=!1,localStorage.setItem("she-scripts-sidebar-width",String(l(le)))),qt&&(qt=!1,localStorage.setItem("she-scripts-log-height",String(l(pe)))),Xe&&(Xe=!1,localStorage.setItem("she-scripts-chat-width",String(l(ii)))),Li&&(Li=!1,localStorage.setItem("she-scripts-history-height",String(l(di))))}function Vr(G){(G.ctrlKey||G.metaKey)&&G.key==="s"&&(G.preventDefault(),Me()),G.key==="Escape"&&(x(p,!1),x(s,null),x(gt,!1))}async function Qc(G,ge){const ut=await ae.show("Save new script as:",{placeholder:"myscript.js",initial:G,confirm:"Create"});if(ut)try{await Jl(ut,ge),await X(),await qe(ut,!0)}catch(xt){x(g,xt.message,!0)}}async function Ms(G){var ut,xt;if(l(Wt)&&l(u)){x(Qe,G,!0),await ao();return}if(x(Qe,G,!0),await fl(),!l(St))return;Y==null||Y.dispose(),Ie==null||Ie.dispose(),et==null||et.dispose();const ge=((xt=(ut=l(oe))==null?void 0:ut.model)==null?void 0:xt.getValue())??"";Y=Vo.createModel(ge,"javascript"),Ie=Vo.createModel(G,"javascript"),et=Vo.createDiffEditor(l(St),{theme:Jh(),readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),et.setModel({original:Y,modified:Ie})}Kn(()=>{l(u),x(Wt,!1),x(si,!1)});async function ao(){if(l(Qe)===null||!l(u))return;const G=l(Qe);x(Qe,null);const ge=l(d).find(ut=>ut.path===l(u));ge!=null&&ge.model&&(Oi=!0,ge.model.setValue(G),Oi=!1,ge.dirty=!1,ge.savedContent=G);try{await Jl(l(u),G),x(g,""),l(E)?await Ve([l(u)],`update ${l(u)}`):fe()}catch(ut){x(g,ut.message,!0)}jl()}function ah(){x(Qe,null),jl()}function jl(){et==null||et.dispose(),et=null,Y==null||Y.dispose(),Y=null,Ie==null||Ie.dispose(),Ie=null}var nr=EZ();xs("keydown",Rd,Vr),xs("mousemove",Rd,Vl),xs("mouseup",Rd,pr);var Jc=Et(nr);cs(Xa(Jc,{}),G=>ie=G,()=>ie);var $l=v(Jc,2);cs(gq($l,{}),G=>ae=G,()=>ae);var Qa=v($l,2);{var C0=G=>{var ge=vK(),ut=Et(ge),xt=v(ut,2);let lt;var fi=m(xt);{var Ti=Yi=>{var Zi=gK(),gn=Et(Zi),dn=v(gn,2),Dn=v(dn,4),Sn=v(Dn,2);j("click",gn,()=>ai(l(s).entry.path)),j("click",dn,()=>Mt(l(s).entry.path)),j("click",Dn,()=>Bt(l(s).entry)),j("click",Sn,()=>Qt(l(s).entry)),D(Yi,Zi)},Mi=Yi=>{var Zi=xK(),gn=Et(Zi),dn=v(gn,2),Dn=v(dn,2),Sn=v(Dn,2);{var kn=Cn=>{var $n=pK();j("click",$n,()=>rt(l(s).entry)),D(Cn,$n)};H(Sn,Cn=>{l(b)&&Cn(kn)})}var hs=v(Sn,4);j("click",gn,()=>It(l(s).entry.path)),j("click",dn,()=>Bt(l(s).entry)),j("click",Dn,()=>Yt(l(s).entry)),j("click",hs,()=>Qt(l(s).entry)),D(Yi,Zi)};H(fi,Yi=>{l(s).entry.type==="dir"?Yi(Ti):Yi(Mi,-1)})}z(()=>lt=Co(xt,"",lt,{left:`${l(s).x??""}px`,top:`${l(s).y??""}px`})),j("click",ut,Ai),j("contextmenu",ut,Yi=>{Yi.preventDefault(),Ai()}),D(G,ge)};H(Qa,G=>{l(s)&&G(C0)})}var ed=v(Qa,2);{var lh=G=>{var ge=mK();let ut;z(()=>ut=Co(ge,"",ut,{left:`${l(hn).x??""}px`,top:`${l(hn).y-4}px`})),D(G,ge)};H(ed,G=>{l(hn)&&G(lh)})}var td=v(ed,2),id=m(td);let Ul;{const G=(xt,lt=cb,fi)=>{let Ti=h9(()=>j7(fi==null?void 0:fi(),!1));var Mi=Ss(),Yi=Et(Mi);{var Zi=dn=>{var Dn=bK(),Sn=m(Dn);let kn;var hs=m(Sn);let Cn;var $n=v(hs,2);let Hs;var bo=m($n),Ws=v($n,2);{var ks=_=>{var y=z2();D(_,y)},fs=Rt(()=>l(tt).has(lt().path)||l(Le).has(lt().path));H(Ws,_=>{l(fs)&&_(ks)})}var ls=v(Ws,2),Xs=m(ls),Mn=v(ls,2),ps=m(Mn),c=v(Sn,2);{var h=_=>{var y=_K();li(y,21,()=>lt().children,k=>k.path,(k,N)=>{G(k,()=>l(N),()=>lt().disabled||l(Ti))}),D(_,y)};H(c,_=>{l(i)[lt().path]&<().children&&_(h)})}z(()=>{kn=Ft(Sn,1,"dir-row svelte-1pyfjii",null,kn,{"dir-selected":l(n)===lt().path,"drag-target":l(a)===lt().path}),rn(Sn,"aria-selected",l(n)===lt().path),Cn=Ft(hs,1,"chevron svelte-1pyfjii",null,Cn,{open:l(i)[lt().path]}),Hs=Ft($n,1,"dir-name svelte-1pyfjii",null,Hs,{lib:lt().lib}),O(bo,lt().name),Zo(Xs,lt().lib),Zo(ps,lt().disabled)}),xs("dragstart",Sn,_=>Wi(_,lt().path)),xs("dragover",Sn,_=>Ui(_,lt().path)),xs("dragleave",Sn,mn),xs("drop",Sn,_=>Vi(_,lt().path)),j("contextmenu",Sn,_=>$i(_,lt())),j("click",hs,()=>de(lt().path)),j("click",$n,()=>{x(n,lt().path,!0),l(i)[lt().path]=!0}),j("keydown",$n,_=>_.key==="Enter"&&x(n,lt().path,!0)),xs("mouseenter",ls,xn),xs("mouseleave",ls,Ye),j("change",Xs,()=>Tt(lt().path,!lt().lib)),j("change",ps,()=>Ue(lt().path,!lt().disabled)),D(dn,Dn)},gn=dn=>{const Dn=Rt(()=>l(_e).has(lt().path)),Sn=Rt(()=>l(tt).has(lt().path)),kn=Rt(()=>l(d).some(ki=>ki.path===lt().path&&ki.dirty)),hs=Rt(()=>(lt().name.split(".").pop()??"txt").toUpperCase()),Cn=Rt(()=>lt().name.endsWith(".js"));var $n=DK();let Hs;var bo=m($n),Ws=m(bo);let ks;var fs=m(Ws);let ls;var Xs=m(fs),Mn=v(fs,2),ps=m(Mn),c=v(Mn,2);{var h=ki=>{var _n=z2();D(ki,_n)};H(c,ki=>{l(Sn)&&ki(h)})}var _=v(c);{var y=ki=>{var _n=CK();D(ki,_n)};H(_,ki=>{l(kn)&&ki(y)})}var k=v(_,2);{var N=ki=>{var _n=EK();D(ki,_n)},te=Rt(()=>l(Cn)&&l(ue).has(lt().path)&&!l(Dn));H(k,ki=>{l(te)&&ki(N)})}var ye=v(k,2);{var Fe=ki=>{var _n=yK();D(ki,_n)};H(ye,ki=>{l(Dn)&&ki(Fe)})}var bt=v(Ws,2);{var yi=ki=>{var _n=wK();let Nn;var Es=m(_n);z(()=>{Nn=Ft(_n,1,"dis-label svelte-1pyfjii",null,Nn,{"dis-locked":l(Ti)}),rn(_n,"title",l(Ti)?"Disabled by parent directory":"Disable — this script will not be executed"),Zo(Es,lt().disabled),Es.disabled=l(Ti)}),j("change",Es,()=>Ue(lt().path,!lt().disabled)),D(ki,_n)},en=ki=>{var _n=SK();D(ki,_n)};H(bt,ki=>{l(Cn)?ki(yi):ki(en,-1)})}z((ki,_n,Nn)=>{Hs=Ft($n,1,"tree-file svelte-1pyfjii",null,Hs,ki),ks=Ft(Ws,1,"svelte-1pyfjii",null,ks,{lib:lt().lib,dis:lt().disabled,err:l(Dn)}),ls=Ft(fs,1,`badge badge-${_n??""}`,"svelte-1pyfjii",ls,{"badge-shelib":lt().lib}),O(Xs,Nn),O(ps,lt().name)},[()=>({active:l(d).some(ki=>ki.path===lt().path),"active-tab":lt().path===l(u)}),()=>l(hs).toLowerCase(),()=>Ke(l(hs))]),xs("dragstart",$n,ki=>Wi(ki,lt().path)),j("contextmenu",$n,ki=>$i(ki,lt())),j("click",Ws,()=>It(lt().path)),D(dn,$n)};H(Yi,dn=>{lt().type==="dir"?dn(Zi):dn(gn,-1)})}D(xt,Mi)};var pa=m(id),E0=m(pa),y0=v(E0,2),ql=v(y0,2);let ge;var Ja=v(ql,2),nx=v(pa,2);{var nd=xt=>{var lt=AK(),fi=m(lt);z(()=>O(fi,l(g))),D(xt,lt)};H(nx,xt=>{l(g)&&xt(nd)})}var Fo=v(nx,2);{var sx=xt=>{var lt=zK(),fi=m(lt),Ti=m(fi);let Mi;var Yi=v(Ti,2);let Zi;var gn=v(Yi,2),dn=v(fi,2),Dn=m(dn);cs(Dn,Mn=>x(At,Mn),()=>l(At));var Sn=v(Dn,2);{var kn=Mn=>{var ps=kK(),c=Et(ps);let h;var _=v(c,2);let y;var k=v(_,2);let N;z(()=>{h=Ft(c,1,"svelte-1pyfjii",null,h,{active:l(We)}),y=Ft(_,1,"svelte-1pyfjii",null,y,{active:l(be)}),N=Ft(k,1,"svelte-1pyfjii",null,N,{active:l(dt)})}),j("click",c,()=>{x(We,!l(We)),Bi()}),j("click",_,()=>{x(be,!l(be)),Bi()}),j("click",k,()=>x(dt,!l(dt))),D(Mn,ps)};H(Sn,Mn=>{l(xe)==="text"&&Mn(kn)})}var hs=v(dn,2);{var Cn=Mn=>{var ps=BK(),c=m(ps),h=v(c,2),_=m(h);z(y=>{h.disabled=y,O(_,l(ni)?"…":"Preview")},[()=>!l(Oe).trim()||l(it).length===0||l(ni)]),Nt(c,()=>l(Pt),y=>x(Pt,y)),j("click",h,nn),D(Mn,ps)};H(hs,Mn=>{l(xe)==="text"&&l(dt)&&Mn(Cn)})}var $n=v(hs,2),Hs=m($n);{var bo=Mn=>{var ps=FK();D(Mn,ps)},Ws=Mn=>{var ps=LK(),c=m(ps);z(()=>O(c,l(mt))),D(Mn,ps)},ks=Mn=>{var ps=Ss(),c=Et(ps);{var h=y=>{var k=Ss(),N=Et(k);{var te=Fe=>{var bt=IK();D(Fe,bt)},ye=Fe=>{var bt=JC(),yi=Et(bt);{var en=_n=>{var Nn=PK();D(_n,Nn)};H(yi,_n=>{l(Ee)&&_n(en)})}var ki=v(yi,2);li(ki,17,()=>l(it),Hi,(_n,Nn)=>{var Es=MK(),zs=m(Es),$r=m(zs),Kb=m($r),Zb=v($r,2),Xb=m(Zb),xx=v(zs,2);li(xx,17,()=>l(Nn).matches,Hi,(Yb,vh)=>{var Bs=TK(),cd=m(Bs),Qb=m(cd),Jb=v(cd,2),eC=m(Jb);z(()=>{O(Qb,l(vh).line),O(eC,l(vh).preview)}),j("click",Bs,()=>Ci(l(Nn).path,l(vh))),D(Yb,Bs)}),z(()=>{O(Kb,l(Nn).path),O(Xb,l(Nn).matches.length)}),j("click",zs,()=>It(l(Nn).path)),D(_n,Es)}),D(Fe,bt)};H(N,Fe=>{l(it).length===0?Fe(te):Fe(ye,-1)})}D(y,k)},_=y=>{var k=Ss(),N=Et(k);{var te=Fe=>{var bt=RK();D(Fe,bt)},ye=Fe=>{var bt=JC(),yi=Et(bt);{var en=_n=>{var Nn=NK();D(_n,Nn)};H(yi,_n=>{l(Ee)&&_n(en)})}var ki=v(yi,2);li(ki,17,()=>l(yt),Hi,(_n,Nn)=>{var Es=OK(),zs=m(Es),$r=m(zs);z(()=>O($r,l(Nn))),j("click",Es,()=>It(l(Nn))),D(_n,Es)}),D(Fe,bt)};H(N,Fe=>{l(yt).length===0?Fe(te):Fe(ye,-1)})}D(y,k)};H(c,y=>{l(xe)==="text"?y(h):y(_,-1)})}D(Mn,ps)},fs=Rt(()=>l(Oe).trim());H(Hs,Mn=>{l(He)?Mn(bo):l(mt)?Mn(Ws,1):l(fs)&&Mn(ks,2)})}var ls=v($n,2);{var Xs=Mn=>{var ps=WK(),c=m(ps),h=m(c),_=m(h),y=v(h,2),k=m(y),N=v(k,2),te=v(c,2);li(te,21,()=>l(ft),Hi,(ye,Fe,bt)=>{var yi=HK(),en=m(yi),ki=v(en,4),_n=m(ki),Nn=v(ki,2),Es=m(Nn);z(()=>{O(_n,l(Fe).path),O(Es,`${l(Fe).changes??""}×`)}),ws(en,()=>l(Fe).checked,zs=>l(Fe).checked=zs),D(ye,yi)}),z((ye,Fe)=>{O(_,`Replace in ${ye??""} file(s)`),k.disabled=Fe},[()=>l(ft).filter(ye=>ye.checked).length,()=>l(ft).filter(ye=>ye.checked).length===0]),j("click",k,cn),j("click",N,()=>x(Lt,!1)),D(Mn,ps)};H(ls,Mn=>{l(Lt)&&Mn(Xs)})}z(()=>{Mi=Ft(Ti,1,"svelte-1pyfjii",null,Mi,{active:l(xe)==="text"}),Zi=Ft(Yi,1,"svelte-1pyfjii",null,Zi,{active:l(xe)==="files"}),rn(Dn,"placeholder",l(xe)==="text"?"Find in files…":"Find files…")}),j("click",Ti,()=>{x(xe,"text"),Bi()}),j("click",Yi,()=>{x(xe,"files"),Bi()}),j("click",gn,Ut),j("input",Dn,Bi),j("keydown",Dn,Mn=>Mn.key==="Escape"&&Ut()),Nt(Dn,()=>l(Oe),Mn=>x(Oe,Mn)),D(xt,lt)};H(Fo,xt=>{l(Te)&&xt(sx)})}var w0=v(Fo,2),sd=m(w0);let ut;var S0=v(sd,2);li(S0,17,()=>l(t),xt=>xt.path,(xt,lt)=>{G(xt,()=>l(lt))});var D0=v(w0,2);{var zb=xt=>{var lt=qK();let fi;var Ti=m(lt),Mi=v(Ti,2),Yi=m(Mi),Zi=m(Yi),gn=v(Yi,2),dn=v(Mi,2),Dn=m(dn);{var Sn=Cn=>{var $n=VK();D(Cn,$n)},kn=Cn=>{var $n=jK();D(Cn,$n)},hs=Cn=>{var $n=JC(),Hs=Et($n);li(Hs,17,()=>l(I),ks=>ks.hash,(ks,fs)=>{var ls=$K(),Xs=m(ls),Mn=m(Xs),ps=v(Xs,2),c=m(ps);z((h,_)=>{O(Mn,l(fs).subject),O(c,`${h??""} · ${_??""}`)},[()=>l(fs).hash.slice(0,7),()=>st(l(fs).date)]),j("click",ls,()=>Vt(l(fs))),D(ks,ls)});var bo=v(Hs,2);{var Ws=ks=>{var fs=UK(),ls=m(fs);z(()=>{fs.disabled=l(M),O(ls,l(M)?"Loading…":"Load more")}),j("click",fs,Ge),D(ks,fs)};H(bo,ks=>{l(I).length>=l(R)&&ks(Ws)})}D(Cn,$n)};H(Dn,Cn=>{l(M)&&l(I).length===0?Cn(Sn):l(I).length===0?Cn(kn,1):Cn(hs,-1)})}z(()=>{fi=Co(lt,"",fi,{height:`${l(di)??""}px`}),rn(Yi,"title",l(A).path),O(Zi,`History: ${l(A).name??""}`)}),j("mousedown",Ti,Ya),j("click",gn,_t),D(xt,lt)};H(D0,xt=>{l(A)&&xt(zb)})}z(()=>{ge=Ft(ql,1,"search-toggle svelte-1pyfjii",null,ge,{active:l(Te)}),ut=Ft(sd,1,"tree-root-drop svelte-1pyfjii",null,ut,{"drag-target":l(a)===""})}),j("click",E0,Ot),j("click",y0,bi),j("click",ql,()=>l(Te)?Ut():mi("text")),j("click",Ja,X),xs("dragover",sd,xt=>Ui(xt,"")),xs("dragleave",sd,mn),xs("drop",sd,xt=>Vi(xt,""))}var ox=v(id,2),rx=v(ox,2),ax=m(rx);{var sr=G=>{var ge=ZK(),ut=m(ge),xt=v(ut,2);li(xt,21,()=>l(d),fi=>fi.path,(fi,Ti)=>{var Mi=KK();let Yi;var Zi=m(Mi),gn=m(Zi),dn=v(Zi,2);{var Dn=kn=>{var hs=GK();D(kn,hs)};H(dn,kn=>{l(Ti).dirty&&kn(Dn)})}var Sn=v(dn,2);z(kn=>{Yi=Ft(Mi,1,"tab svelte-1pyfjii",null,Yi,{active:l(Ti).path===l(u)}),rn(Mi,"data-tab-path",l(Ti).path),O(gn,kn)},[()=>l(Ti).path.split("/").pop()]),j("click",Mi,()=>pt(l(Ti).path)),j("keydown",Mi,kn=>kn.key==="Enter"&&pt(l(Ti).path)),j("click",Sn,kn=>{kn.stopPropagation(),ot(l(Ti).path)}),D(fi,Mi)}),cs(xt,fi=>x(xi,fi),()=>l(xi));var lt=v(xt,2);z(()=>{ut.disabled=!l(Dt),lt.disabled=!l(ci)}),j("click",ut,()=>ti(-1)),xs("scroll",xt,we),xs("wheel",xt,fi=>{fi.preventDefault(),l(xi).scrollLeft+=fi.deltaY,we()}),j("click",lt,()=>ti(1)),D(G,ge)};H(ax,G=>{l(d).length>0&&G(sr)})}var el=v(ax,2),lx=m(el),jr=m(lx),cx=v(lx,2);{var Gl=G=>{var ge=nZ(),ut=m(ge),xt=m(ut),lt=v(ut,2);{var fi=gn=>{var dn=JK(),Dn=m(dn),Sn=m(Dn),kn=v(Dn,2);{var hs=Cn=>{var $n=QK(),Hs=Et($n),bo=v(Hs,2),Ws=v(m(bo),2);li(Ws,21,()=>l(b).changes,Hi,(c,h)=>{var _=XK(),y=m(_),k=m(y),N=v(y,2),te=m(N),ye=v(N,2),Fe=m(ye);z(bt=>{Zo(k,bt),O(te,l(h).status),O(Fe,l(h).file)},[()=>l(W).has(l(h).file)]),j("change",k,()=>{const bt=new Set(l(W));bt.has(l(h).file)?bt.delete(l(h).file):bt.add(l(h).file),x(W,bt,!0)}),D(c,_)});var ks=v(Ws,2),fs=m(ks),ls=v(fs,2),Xs=m(ls),Mn=v(ks,2);{var ps=c=>{var h=YK(),_=m(h);z(()=>O(_,l(T))),D(c,h)};H(Mn,c=>{l(T)&&c(ps)})}z(c=>{var h;ls.disabled=c,O(Xs,l(U)?"…":l(W).size===((h=l(b))==null?void 0:h.changes.length)?"Commit all":`Commit ${l(W).size}`)},[()=>!l(Xt).trim()||l(U)||l(W).size===0]),j("click",Hs,()=>x(ht,!1)),j("keydown",fs,c=>c.key==="Enter"&&J()),Nt(fs,()=>l(Xt),c=>x(Xt,c)),j("click",ls,J),D(Cn,$n)};H(kn,Cn=>{l(ht)&&Cn(hs)})}z(()=>{rn(Dn,"title",`${l(b).changes.length??""} uncommitted change(s) — click to view`),O(Sn,`✎${l(b).changes.length??""}`)}),j("click",Dn,()=>{l(ht)||x(W,new Set(l(b).changes.map(Cn=>Cn.file)),!0),x(ht,!l(ht)),x(T,"")}),D(gn,dn)};H(lt,gn=>{l(b).changes.length>0&&gn(fi)})}var Ti=v(lt,2);{var Mi=gn=>{var dn=tZ(),Dn=m(dn),Sn=m(Dn),kn=v(Dn,2);{var hs=Cn=>{var $n=eZ(),Hs=Et($n),bo=v(Hs,2),Ws=m(bo),ks=m(Ws),fs=v(Ws,2),ls=m(fs);z(()=>O(ks,`${l(b).ahead??""} unpushed commit(s)`)),j("click",Hs,()=>x(gt,!1)),j("click",ls,()=>{x(gt,!1),kt()}),D(Cn,$n)};H(kn,Cn=>{l(gt)&&Cn(hs)})}z(()=>{rn(Dn,"title",`${l(b).ahead??""} commit(s) ahead of upstream — click to push`),O(Sn,`↑${l(b).ahead??""}`)}),j("click",Dn,()=>x(gt,!l(gt))),D(gn,dn)};H(Ti,gn=>{l(b).ahead>0&&gn(Mi)})}var Yi=v(Ti,2);{var Zi=gn=>{var dn=iZ(),Dn=m(dn);z(()=>{rn(dn,"title",`${l(b).behind??""} commit(s) behind upstream`),O(Dn,`↓${l(b).behind??""}`)}),D(gn,dn)};H(Yi,gn=>{l(b).behind>0&&gn(Zi)})}z(()=>{rn(ut,"title",`Branch: ${l(b).branch??""}`),O(xt,`⎇ ${l(b).branch??""}`)}),D(G,ge)};H(cx,G=>{l(b)&&G(Gl)})}var dx=v(cx,2),Kl=m(dx),od=m(Kl),ch=m(od),ux=v(od,2),xa=v(Kl,2);{var dh=G=>{var ge=sZ(),ut=Et(ge),xt=v(ut,2),lt=m(xt),fi=v(lt,2);j("click",ut,()=>x(p,!1)),j("click",lt,()=>{x(p,!1),Me()}),j("click",fi,()=>{x(p,!1),Je()}),D(G,ge)};H(xa,G=>{l(p)&&G(dh)})}var hx=v(dx,2);{var A0=G=>{var ge=oZ();j("click",ge,Jn),D(G,ge)};H(hx,G=>{l(u)&&G(A0)})}var k0=v(hx,2);let xr;var Vb=v(el,2),tl=m(Vb),fx=m(tl),vr=m(fx);cs(vr,G=>oi=G,()=>oi);var rd=v(vr,2);{var gx=G=>{var ge=rZ();D(G,ge)};H(rd,G=>{l(u)||G(gx)})}var uh=v(rd,2);{var hh=G=>{var ge=dZ(),ut=m(ge),xt=m(ut),lt=v(m(xt)),fi=m(lt),Ti=v(xt,2),Mi=m(Ti),Yi=m(Mi),Zi=m(Yi),gn=m(Zi),dn=v(Zi,2),Dn=v(Yi,2);{var Sn=Cn=>{var $n=cZ(),Hs=Et($n),bo=v(Hs,2),Ws=m(bo);{var ks=ls=>{var Xs=aZ();j("click",Xs,()=>{x(si,!1),x(Wt,!0),ao()}),D(ls,Xs)},fs=ls=>{var Xs=lZ();j("click",Xs,()=>{x(si,!1),x(Wt,!1)}),D(ls,Xs)};H(Ws,ls=>{l(Wt)?ls(fs,-1):ls(ks)})}j("click",Hs,()=>x(si,!1)),D(Cn,$n)};H(Dn,Cn=>{l(si)&&Cn(Sn)})}var kn=v(Mi,2),hs=v(ut,2);cs(hs,Cn=>x(St,Cn),()=>l(St)),z(Cn=>{O(fi,Cn),O(gn,l(Wt)?"Auto-accept ✓":"Accept")},[()=>{var Cn;return(Cn=l(u))==null?void 0:Cn.split("/").pop()}]),j("click",Zi,ao),j("click",dn,()=>x(si,!l(si))),j("click",kn,ah),D(G,ge)};H(uh,G=>{l(Qe)!==null&&G(hh)})}var B0=v(uh,2);{var fh=G=>{var ge=fZ(),ut=m(ge),xt=m(ut),lt=v(m(xt)),fi=m(lt),Ti=v(lt,2),Mi=m(Ti),Yi=v(xt,2),Zi=m(Yi),gn=v(ut,2);{var dn=Sn=>{var kn=uZ();D(Sn,kn)},Dn=Sn=>{var kn=hZ();cs(kn,hs=>x(P,hs),()=>l(P)),D(Sn,kn)};H(gn,Sn=>{l(Z)?Sn(dn):Sn(Dn,-1)})}z(Sn=>{var kn;O(fi,Sn),O(Mi,(kn=l(A))==null?void 0:kn.name)},[()=>l(he).slice(0,7)]),j("click",Zi,Ct),D(G,ge)};H(B0,G=>{l(re)&&G(fh)})}var va=v(fx,2);let ad,gh;var F0=m(va);{var jb=G=>{var ge=gZ();j("mousedown",ge,ir),D(G,ge)};H(F0,G=>{l(C)&&G(jb)})}var ld=v(F0,2),L0=m(ld),I0=m(L0),$b=v(I0);{var px=G=>{var ge=pZ(),ut=m(ge);z(xt=>O(ut,`— ${xt??""}`),[()=>l(u).split("/").pop()]),D(G,ge)};H($b,G=>{l(u)&&G(px)})}var Ub=v(L0,2);{var mr=G=>{var ge=vZ(),ut=Et(ge);li(ut,21,()=>zi,Hi,(Mi,Yi)=>{var Zi=xZ(),gn=m(Zi),dn={};z(()=>{O(gn,l(Yi)),dn!==(dn=l(Yi))&&(Zi.value=(Zi.__value=l(Yi))??"")}),D(Mi,Zi)});var xt=v(ut,2),lt=v(xt,2),fi=m(lt),Ti=v(lt,2);Ls(ut,()=>l(vt),Mi=>x(vt,Mi)),Nt(xt,()=>l(Jt),Mi=>x(Jt,Mi)),ws(fi,()=>l(Ni),Mi=>x(Ni,Mi)),j("click",Ti,In),D(G,ge)};H(Ub,G=>{l(C)&&G(mr)})}var ph=v(ld,2);{var qb=G=>{var ge=bZ(),ut=m(ge);li(ut,17,()=>{var fi;return(((fi=l(oe))==null?void 0:fi.logEntries)??[]).filter(fn)},fi=>fi.ts+fi.msg,(fi,Ti)=>{var Mi=mZ(),Yi=m(Mi),Zi=m(Yi),gn=v(Yi,2),dn=m(gn),Dn=v(gn,2),Sn=m(Dn);z((kn,hs)=>{Ft(Mi,1,`log-line ${l(Ti).level??""}`,"svelte-1pyfjii"),O(Zi,kn),O(dn,hs),O(Sn,l(Ti).msg)},[()=>Ji(l(Ti).ts),()=>l(Ti).level.toUpperCase()]),D(fi,Mi)});var xt=v(ut,2);{var lt=fi=>{var Ti=_Z();D(fi,Ti)};H(xt,fi=>{var Ti;(((Ti=l(oe))==null?void 0:Ti.logEntries.length)??0)===0&&fi(lt)})}cs(ge,fi=>x(ce,fi),()=>l(ce)),D(G,ge)};H(ph,G=>{l(C)&&G(qb)})}var xh=v(tl,2);{var Gb=G=>{var ge=CZ(),ut=Et(ge),xt=v(ut,2);let lt;var fi=m(xt);eK(fi,{get currentScript(){return l(je)},onApply:Ms,onCreateFile:Qc,get extraFiles(){return l(Se)},set extraFiles(Ti){x(Se,Ti,!0)}}),z(()=>lt=Co(xt,"",lt,{width:`${l(ii)??""}px`})),j("mousedown",ut,zr),D(G,ge)};H(xh,G=>{l(at)&&G(Gb)})}z(()=>{var G;Ul=Co(id,"",Ul,{width:`${l(le)??""}px`}),O(jr,l(u)??"No file selected"),od.disabled=!((G=l(oe))!=null&&G.dirty)||l(f),O(ch,l(f)?"Saving…":"Save"),ux.disabled=!l(u),xr=Ft(k0,1,"ai-toggle svelte-1pyfjii",null,xr,{"ai-open":l(at)}),rn(k0,"title",l(at)?"Close AI assistant":"Open AI assistant"),ad=Ft(va,1,"log-panel svelte-1pyfjii",null,ad,{collapsed:!l(C)}),gh=Co(va,"",gh,{height:l(C)?`${l(pe)}px`:"26px"}),O(I0,`${l(C)?"▾":"▸"} Script Log `)}),j("keydown",td,on),j("mousedown",ox,ms),j("click",od,Me),j("click",ux,()=>x(p,!l(p))),j("click",k0,()=>x(at,!l(at))),j("click",L0,es),D(o,nr),Ps()}Gs(["click","contextmenu","keydown","change","input","mousedown"]);var rg={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 wZ=rg.exports,V2;function SZ(){return V2||(V2=1,(function(o,e){(function(t,i){i(e)})(wZ,(function(t){var i="1.9.4";function n(c){var h,_,y,k;for(_=1,y=arguments.length;_<y;_++){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 y=_.call(arguments,2);return function(){return c.apply(h,y.length?y.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 y,k,N,te;return te=function(){y=!1,k&&(N.apply(_,k),k=!1)},N=function(){y?k=arguments:(c.apply(_,arguments),setTimeout(te,h),y=!0)},N}function f(c,h,_){var y=h[1],k=h[0],N=y-k;return c===y&&_?c:((c-k)%N+N)%N+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 w(c,h,_){var y=[];for(var k in c)y.push(encodeURIComponent(_?k.toUpperCase():k)+"="+encodeURIComponent(c[k]));return(!h||h.indexOf("?")===-1?"?":"&")+y.join("&")}var A=/\{ *([\w_ -]+) *\}/g;function I(c,h){return c.replace(A,function(_,y){var k=h[y];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 $=0;function Q(c){var h=+new Date,_=Math.max(0,16-(h-$));return $=h+_,window.setTimeout(c,_)}var re=window.requestAnimationFrame||V("RequestAnimationFrame")||Q,he=window.cancelAnimationFrame||V("CancelAnimationFrame")||V("CancelRequestAnimationFrame")||function(c){window.clearTimeout(c)};function Z(c,h,_){if(_&&re===Q)c.call(h);else return re.call(window,r(c,h))}function ce(c){c&&he.call(window,c)}var _e={__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:w,template:I,isArray:M,indexOf:R,emptyImageUrl:P,requestFn:re,cancelFn:he,requestAnimFrame:Z,cancelAnimFrame:ce};function se(){}se.extend=function(c){var h=function(){E(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},_=h.__super__=this.prototype,y=s(_);y.constructor=h,h.prototype=y;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&&(ue(c.includes),n.apply(null,[y].concat(c.includes))),n(y,c),delete y.statics,delete y.includes,y.options&&(y.options=_.options?s(_.options):{},n(y.options,c.options)),y._initHooks=[],y.callInitHooks=function(){if(!this._initHooksCalled){_.callInitHooks&&_.callInitHooks.call(this),this._initHooksCalled=!0;for(var N=0,te=y._initHooks.length;N<te;N++)y._initHooks[N].call(this)}},h},se.include=function(c){var h=this.prototype.options;return n(this.prototype,c),c.options&&(this.prototype.options=h,this.mergeOptions(c.options)),this},se.mergeOptions=function(c){return n(this.prototype.options,c),this},se.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 ue(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 Se={on:function(c,h,_){if(typeof c=="object")for(var y in c)this._on(y,c[y],h);else{c=b(c);for(var k=0,N=c.length;k<N;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 y in c)this._off(y,c[y],h);else{c=b(c);for(var k=arguments.length===1,N=0,te=c.length;N<te;N++)k?this._off(c[N]):this._off(c[N],h,_)}return this},_on:function(c,h,_,y){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:_};y&&(k.once=!0),this._events=this._events||{},this._events[c]=this._events[c]||[],this._events[c].push(k)}},_off:function(c,h,_){var y,k,N;if(this._events&&(y=this._events[c],!!y)){if(arguments.length===1){if(this._firingCount)for(k=0,N=y.length;k<N;k++)y[k].fn=g;delete this._events[c];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var te=this._listens(c,h,_);if(te!==!1){var ye=y[te];this._firingCount&&(ye.fn=g,this._events[c]=y=y.slice()),y.splice(te,1)}}},fire:function(c,h,_){if(!this.listens(c,_))return this;var y=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 N=0,te=k.length;N<te;N++){var ye=k[N],Fe=ye.fn;ye.once&&this.off(c,Fe,ye.ctx),Fe.call(ye.ctx||this,y)}this._firingCount--}}return _&&this._propagateEvent(y),this},listens:function(c,h,_,y){typeof c!="string"&&console.warn('"string" type argument expected');var k=h;typeof h!="function"&&(y=!!h,k=void 0,_=void 0);var N=this._events&&this._events[c];if(N&&N.length&&this._listens(c,k,_)!==!1)return!0;if(y){for(var te in this._eventParents)if(this._eventParents[te].listens(c,h,_,y))return!0}return!1},_listens:function(c,h,_){if(!this._events)return!1;var y=this._events[c]||[];if(!h)return!!y.length;_===this&&(_=void 0);for(var k=0,N=y.length;k<N;k++)if(y[k].fn===h&&y[k].ctx===_)return k;return!1},once:function(c,h,_){if(typeof c=="object")for(var y in c)this._on(y,c[y],h,!0);else{c=b(c);for(var k=0,N=c.length;k<N;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)}};Se.addEventListener=Se.on,Se.removeEventListener=Se.clearAllEventListeners=Se.off,Se.addOneTimeEventListener=Se.once,Se.fireEvent=Se.fire,Se.hasEventListeners=Se.listens;var Te=se.extend(Se);function xe(c,h,_){this.x=_?Math.round(c):c,this.y=_?Math.round(h):h}var Oe=Math.trunc||function(c){return c>0?Math.floor(c):Math.ceil(c)};xe.prototype={clone:function(){return new xe(this.x,this.y)},add:function(c){return this.clone()._add(We(c))},_add:function(c){return this.x+=c.x,this.y+=c.y,this},subtract:function(c){return this.clone()._subtract(We(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 xe(this.x*c.x,this.y*c.y)},unscaleBy:function(c){return new xe(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=Oe(this.x),this.y=Oe(this.y),this},distanceTo:function(c){c=We(c);var h=c.x-this.x,_=c.y-this.y;return Math.sqrt(h*h+_*_)},equals:function(c){return c=We(c),c.x===this.x&&c.y===this.y},contains:function(c){return c=We(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 We(c,h,_){return c instanceof xe?c:M(c)?new xe(c[0],c[1]):c==null?c:typeof c=="object"&&"x"in c&&"y"in c?new xe(c.x,c.y):new xe(c,h,_)}function be(c,h){if(c)for(var _=h?[c,h]:c,y=0,k=_.length;y<k;y++)this.extend(_[y])}be.prototype={extend:function(c){var h,_;if(!c)return this;if(c instanceof xe||typeof c[0]=="number"||"x"in c)h=_=We(c);else if(c=dt(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 We((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,c)},getBottomLeft:function(){return We(this.min.x,this.max.y)},getTopRight:function(){return We(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 xe?c=We(c):c=dt(c),c instanceof be?(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=dt(c);var h=this.min,_=this.max,y=c.min,k=c.max,N=k.x>=h.x&&y.x<=_.x,te=k.y>=h.y&&y.y<=_.y;return N&&te},overlaps:function(c){c=dt(c);var h=this.min,_=this.max,y=c.min,k=c.max,N=k.x>h.x&&y.x<_.x,te=k.y>h.y&&y.y<_.y;return N&&te},isValid:function(){return!!(this.min&&this.max)},pad:function(c){var h=this.min,_=this.max,y=Math.abs(h.x-_.x)*c,k=Math.abs(h.y-_.y)*c;return dt(We(h.x-y,h.y-k),We(_.x+y,_.y+k))},equals:function(c){return c?(c=dt(c),this.min.equals(c.getTopLeft())&&this.max.equals(c.getBottomRight())):!1}};function dt(c,h){return!c||c instanceof be?c:new be(c,h)}function Pt(c,h){if(c)for(var _=h?[c,h]:c,y=0,k=_.length;y<k;y++)this.extend(_[y])}Pt.prototype={extend:function(c){var h=this._southWest,_=this._northEast,y,k;if(c instanceof yt)y=c,k=c;else if(c instanceof Pt){if(y=c._southWest,k=c._northEast,!y||!k)return this}else return c?this.extend(Ee(c)||it(c)):this;return!h&&!_?(this._southWest=new yt(y.lat,y.lng),this._northEast=new yt(k.lat,k.lng)):(h.lat=Math.min(y.lat,h.lat),h.lng=Math.min(y.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,y=Math.abs(h.lat-_.lat)*c,k=Math.abs(h.lng-_.lng)*c;return new Pt(new yt(h.lat-y,h.lng-k),new yt(_.lat+y,_.lng+k))},getCenter:function(){return new yt((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 yt(this.getNorth(),this.getWest())},getSouthEast:function(){return new yt(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 yt||"lat"in c?c=Ee(c):c=it(c);var h=this._southWest,_=this._northEast,y,k;return c instanceof Pt?(y=c.getSouthWest(),k=c.getNorthEast()):y=k=c,y.lat>=h.lat&&k.lat<=_.lat&&y.lng>=h.lng&&k.lng<=_.lng},intersects:function(c){c=it(c);var h=this._southWest,_=this._northEast,y=c.getSouthWest(),k=c.getNorthEast(),N=k.lat>=h.lat&&y.lat<=_.lat,te=k.lng>=h.lng&&y.lng<=_.lng;return N&&te},overlaps:function(c){c=it(c);var h=this._southWest,_=this._northEast,y=c.getSouthWest(),k=c.getNorthEast(),N=k.lat>h.lat&&y.lat<_.lat,te=k.lng>h.lng&&y.lng<_.lng;return N&&te},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(c,h){return c?(c=it(c),this._southWest.equals(c.getSouthWest(),h)&&this._northEast.equals(c.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function it(c,h){return c instanceof Pt?c:new Pt(c,h)}function yt(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=+_)}yt.prototype={equals:function(c,h){if(!c)return!1;c=Ee(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 mt.distance(this,Ee(c))},wrap:function(){return mt.wrapLatLng(this)},toBounds:function(c){var h=180*c/40075017,_=h/Math.cos(Math.PI/180*this.lat);return it([this.lat-h,this.lng-_],[this.lat+h,this.lng+_])},clone:function(){return new yt(this.lat,this.lng,this.alt)}};function Ee(c,h,_){return c instanceof yt?c:M(c)&&typeof c[0]!="object"?c.length===3?new yt(c[0],c[1],c[2]):c.length===2?new yt(c[0],c[1]):null:c==null?c:typeof c=="object"&&"lat"in c?new yt(c.lat,"lng"in c?c.lng:c.lon,c.alt):h===void 0?null:new yt(c,h,_)}var He={latLngToPoint:function(c,h){var _=this.projection.project(c),y=this.scale(h);return this.transformation._transform(_,y)},pointToLatLng:function(c,h){var _=this.scale(h),y=this.transformation.untransform(c,_);return this.projection.unproject(y)},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),y=this.transformation.transform(h.min,_),k=this.transformation.transform(h.max,_);return new be(y,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,y=c.alt;return new yt(_,h,y)},wrapLatLngBounds:function(c){var h=c.getCenter(),_=this.wrapLatLng(h),y=h.lat-_.lat,k=h.lng-_.lng;if(y===0&&k===0)return c;var N=c.getSouthWest(),te=c.getNorthEast(),ye=new yt(N.lat-y,N.lng-k),Fe=new yt(te.lat-y,te.lng-k);return new Pt(ye,Fe)}},mt=n({},He,{wrapLng:[-180,180],R:6371e3,distance:function(c,h){var _=Math.PI/180,y=c.lat*_,k=h.lat*_,N=Math.sin((h.lat-c.lat)*_/2),te=Math.sin((h.lng-c.lng)*_/2),ye=N*N+Math.cos(y)*Math.cos(k)*te*te,Fe=2*Math.atan2(Math.sqrt(ye),Math.sqrt(1-ye));return this.R*Fe}}),At=6378137,ft={R:At,MAX_LATITUDE:85.0511287798,project:function(c){var h=Math.PI/180,_=this.MAX_LATITUDE,y=Math.max(Math.min(_,c.lat),-_),k=Math.sin(y*h);return new xe(this.R*c.lng*h,this.R*Math.log((1+k)/(1-k))/2)},unproject:function(c){var h=180/Math.PI;return new yt((2*Math.atan(Math.exp(c.y/this.R))-Math.PI/2)*h,c.x*h/this.R)},bounds:(function(){var c=At*Math.PI;return new be([-c,-c],[c,c])})()};function Lt(c,h,_,y){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=y}Lt.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 xe((c.x/h-this._b)/this._a,(c.y/h-this._d)/this._c)}};function ni(c,h,_,y){return new Lt(c,h,_,y)}var pi=n({},mt,{code:"EPSG:3857",projection:ft,transformation:(function(){var c=.5/(Math.PI*ft.R);return ni(c,.5,-c,.5)})()}),xi=n({},pi,{code:"EPSG:900913"});function Dt(c){return document.createElementNS("http://www.w3.org/2000/svg",c)}function ci(c,h){var _="",y,k,N,te,ye,Fe;for(y=0,N=c.length;y<N;y++){for(ye=c[y],k=0,te=ye.length;k<te;k++)Fe=ye[k],_+=(k?"L":"M")+Fe.x+" "+Fe.y;_+=h?pe.svg?"z":"x":""}return _||"M0 0"}var ze=document.documentElement.style,we="ActiveXObject"in window,ti=we&&!document.addEventListener,mi="msLaunchUri"in navigator&&!("documentMode"in document),Ut=le("webkit"),Bi=le("android"),Ki=le("android 2")||le("android 3"),Ci=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),pn=Bi&&le("Google")&&Ci<537&&!("AudioNode"in window),nn=!!window.opera,cn=!mi&&le("chrome"),on=le("gecko")&&!Ut&&!nn&&!we,vt=!cn&&le("safari"),Jt=le("phantom"),Ni="OTransition"in ze,zi=navigator.platform.indexOf("Win")===0,ui=we&&"transition"in ze,fn="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Ki,hn="MozPerspective"in ze,xn=!window.L_DISABLE_3D&&(ui||fn||hn)&&!Ni&&!Jt,Ye=typeof orientation<"u"||le("mobile"),oi=Ye&&Ut,hi=Ye&&fn,Ei=!window.PointerEvent&&window.MSPointerEvent,Oi=!!(window.PointerEvent||Ei),Gi="ontouchstart"in window||!!window.TouchEvent,ji=!window.L_NO_TOUCH&&(Gi||Oi),K=Ye&&nn,De=Ye&&on,at=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Qe=(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})(),Wt=(function(){return!!document.createElement("canvas").getContext})(),si=!!(document.createElementNS&&Dt("svg").createSVGRect),St=!!si&&(function(){var c=document.createElement("div");return c.innerHTML="<svg/>",(c.firstChild&&c.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),et=!si&&(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}})(),Y=navigator.platform.indexOf("Mac")===0,Ie=navigator.platform.indexOf("Linux")===0;function le(c){return navigator.userAgent.toLowerCase().indexOf(c)>=0}var pe={ie:we,ielt9:ti,edge:mi,webkit:Ut,android:Bi,android23:Ki,androidStock:pn,opera:nn,chrome:cn,gecko:on,safari:vt,phantom:Jt,opera12:Ni,win:zi,ie3d:ui,webkit3d:fn,gecko3d:hn,any3d:xn,mobile:Ye,mobileWebkit:oi,mobileWebkit3d:hi,msPointer:Ei,pointer:Oi,touch:ji,touchNative:Gi,mobileOpera:K,mobileGecko:De,retina:at,passiveEvents:Qe,canvas:Wt,svg:si,vml:et,inlineSvg:St,mac:Y,linux:Ie},ii=pe.msPointer?"MSPointerDown":"pointerdown",di=pe.msPointer?"MSPointerMove":"pointermove",ne=pe.msPointer?"MSPointerUp":"pointerup",nt=pe.msPointer?"MSPointerCancel":"pointercancel",$t={touchstart:ii,touchmove:di,touchend:ne,touchcancel:nt},qt={touchstart:tt,touchmove:je,touchend:je,touchcancel:je},Gt={},Be=!1;function Xe(c,h,_){return h==="touchstart"&&me(),qt[h]?(_=qt[h].bind(this,_),c.addEventListener($t[h],_,!1),_):(console.warn("wrong event specified:",h),g)}function Zt(c,h,_){if(!$t[h]){console.warn("wrong event specified:",h);return}c.removeEventListener($t[h],_,!1)}function ei(c){Gt[c.pointerId]=c}function Li(c){Gt[c.pointerId]&&(Gt[c.pointerId]=c)}function vi(c){delete Gt[c.pointerId]}function me(){Be||(document.addEventListener(ii,ei,!0),document.addEventListener(di,Li,!0),document.addEventListener(ne,vi,!0),document.addEventListener(nt,vi,!0),Be=!0)}function je(c,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var _ in Gt)h.touches.push(Gt[_]);h.changedTouches=[h],c(h)}}function tt(c,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Yt(h),je(c,h)}function Le(c){var h={},_,y;for(y in c)_=c[y],h[y]=_&&_.bind?_.bind(c):_;return c=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var ht=200;function gt(c,h){c.addEventListener("dblclick",h);var _=0,y;function k(N){if(N.detail!==1){y=N.detail;return}if(!(N.pointerType==="mouse"||N.sourceCapabilities&&!N.sourceCapabilities.firesTouchEvents)){var te=Ui(N);if(!(te.some(function(Fe){return Fe instanceof HTMLLabelElement&&Fe.attributes.for})&&!te.some(function(Fe){return Fe instanceof HTMLInputElement||Fe instanceof HTMLSelectElement}))){var ye=Date.now();ye-_<=ht?(y++,y===2&&h(Le(N))):y=1,_=ye}}}return c.addEventListener("click",k),{dblclick:h,simDblclick:k}}function Xt(c,h){c.removeEventListener("dblclick",h.dblclick),c.removeEventListener("click",h.simDblclick)}var U=Tt(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),T=Tt(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),W=T==="webkitTransition"||T==="OTransition"?T+"End":"transitionend";function J(c){return typeof c=="string"?document.getElementById(c):c}function ie(c,h){var _=c.style[h]||c.currentStyle&&c.currentStyle[h];if((!_||_==="auto")&&document.defaultView){var y=document.defaultView.getComputedStyle(c,null);_=y?y[h]:null}return _==="auto"?null:_}function ae(c,h,_){var y=document.createElement(c);return y.className=h||"",_&&_.appendChild(y),y}function oe(c){var h=c.parentNode;h&&h.removeChild(c)}function Ae(c){for(;c.firstChild;)c.removeChild(c.firstChild)}function $e(c){var h=c.parentNode;h&&h.lastChild!==c&&h.appendChild(c)}function Ce(c){var h=c.parentNode;h&&h.firstChild!==c&&h.insertBefore(c,h.firstChild)}function Pe(c,h){if(c.classList!==void 0)return c.classList.contains(h);var _=X(c);return _.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(_)}function Ne(c,h){if(c.classList!==void 0)for(var _=b(h),y=0,k=_.length;y<k;y++)c.classList.add(_[y]);else if(!Pe(c,h)){var N=X(c);ri(c,(N?N+" ":"")+h)}}function ct(c,h){c.classList!==void 0?c.classList.remove(h):ri(c,C((" "+X(c)+" ").replace(" "+h+" "," ")))}function ri(c,h){c.className.baseVal===void 0?c.className=h:c.className.baseVal=h}function X(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&&Ke(c,h)}function Ke(c,h){var _=!1,y="DXImageTransform.Microsoft.Alpha";try{_=c.filters.item(y)}catch{if(h===1)return}h=Math.round(h*100),_?(_.Enabled=h!==100,_.Opacity=h):c.style.filter+=" progid:"+y+"(opacity="+h+")"}function Tt(c){for(var h=document.documentElement.style,_=0;_<c.length;_++)if(c[_]in h)return c[_];return!1}function Ue(c,h,_){var y=h||new xe(0,0);c.style[U]=(pe.ie3d?"translate("+y.x+"px,"+y.y+"px)":"translate3d("+y.x+"px,"+y.y+"px,0)")+(_?" scale("+_+")":"")}function qe(c,h){c._leaflet_pos=h,pe.any3d?Ue(c,h):(c.style.left=h.x+"px",c.style.top=h.y+"px")}function It(c){return c._leaflet_pos||new xe(0,0)}var pt,ot,fe;if("onselectstart"in document)pt=function(){Ct(window,"selectstart",Yt)},ot=function(){bi(window,"selectstart",Yt)};else{var Ve=Tt(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);pt=function(){if(Ve){var c=document.documentElement.style;fe=c[Ve],c[Ve]="none"}},ot=function(){Ve&&(document.documentElement.style[Ve]=fe,fe=void 0)}}function Me(){Ct(window,"dragstart",Yt)}function Je(){bi(window,"dragstart",Yt)}var kt,st;function rt(c){for(;c.tabIndex===-1;)c=c.parentNode;c.style&&(ve(),kt=c,st=c.style.outlineStyle,c.style.outlineStyle="none",Ct(window,"keydown",ve))}function ve(){kt&&(kt.style.outlineStyle=st,kt=void 0,st=void 0,bi(window,"keydown",ve))}function Ge(c){do c=c.parentNode;while((!c.offsetWidth||!c.offsetHeight)&&c!==document.body);return c}function _t(c){var h=c.getBoundingClientRect();return{x:h.width/c.offsetWidth||1,y:h.height/c.offsetHeight||1,boundingClientRect:h}}var Vt={__proto__:null,TRANSFORM:U,TRANSITION:T,TRANSITION_END:W,get:J,getStyle:ie,create:ae,remove:oe,empty:Ae,toFront:$e,toBack:Ce,hasClass:Pe,addClass:Ne,removeClass:ct,setClass:ri,getClass:X,setOpacity:de,testProp:Tt,setTransform:Ue,setPosition:qe,getPosition:It,get disableTextSelection(){return pt},get enableTextSelection(){return ot},disableImageDrag:Me,enableImageDrag:Je,preventOutline:rt,restoreOutline:ve,getSizedParentNode:Ge,getScale:_t};function Ct(c,h,_,y){if(h&&typeof h=="object")for(var k in h)ai(c,k,h[k],_);else{h=b(h);for(var N=0,te=h.length;N<te;N++)ai(c,h[N],_,y)}return this}var Ot="_leaflet_events";function bi(c,h,_,y){if(arguments.length===1)$i(c),delete c[Ot];else if(h&&typeof h=="object")for(var k in h)Mt(c,k,h[k],_);else if(h=b(h),arguments.length===2)$i(c,function(ye){return R(h,ye)!==-1});else for(var N=0,te=h.length;N<te;N++)Mt(c,h[N],_,y);return this}function $i(c,h){for(var _ in c[Ot]){var y=_.split(/\d/)[0];(!h||h(y))&&Mt(c,y,null,null,_)}}var Ai={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ai(c,h,_,y){var k=h+d(_)+(y?"_"+d(y):"");if(c[Ot]&&c[Ot][k])return this;var N=function(ye){return _.call(y||c,ye||window.event)},te=N;!pe.touchNative&&pe.pointer&&h.indexOf("touch")===0?N=Xe(c,h,N):pe.touch&&h==="dblclick"?N=gt(c,N):"addEventListener"in c?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?c.addEventListener(Ai[h]||h,N,pe.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(N=function(ye){ye=ye||window.event,Jn(c,ye)&&te(ye)},c.addEventListener(Ai[h],N,!1)):c.addEventListener(h,te,!1):c.attachEvent("on"+h,N),c[Ot]=c[Ot]||{},c[Ot][k]=N}function Mt(c,h,_,y,k){k=k||h+d(_)+(y?"_"+d(y):"");var N=c[Ot]&&c[Ot][k];if(!N)return this;!pe.touchNative&&pe.pointer&&h.indexOf("touch")===0?Zt(c,h,N):pe.touch&&h==="dblclick"?Xt(c,N):"removeEventListener"in c?c.removeEventListener(Ai[h]||h,N,!1):c.detachEvent("on"+h,N),c[Ot][k]=null}function Bt(c){return c.stopPropagation?c.stopPropagation():c.originalEvent?c.originalEvent._stopped=!0:c.cancelBubble=!0,this}function Kt(c){return ai(c,"wheel",Bt),this}function Qt(c){return Ct(c,"mousedown touchstart dblclick contextmenu",Bt),c._leaflet_disable_click=!0,this}function Yt(c){return c.preventDefault?c.preventDefault():c.returnValue=!1,this}function Wi(c){return Yt(c),Bt(c),this}function Ui(c){if(c.composedPath)return c.composedPath();for(var h=[],_=c.target;_;)h.push(_),_=_.parentNode;return h}function mn(c,h){if(!h)return new xe(c.clientX,c.clientY);var _=_t(h),y=_.boundingClientRect;return new xe((c.clientX-y.left)/_.x-h.clientLeft,(c.clientY-y.top)/_.y-h.clientTop)}var Vi=pe.linux&&pe.chrome?window.devicePixelRatio:pe.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function An(c){return pe.edge?c.wheelDeltaY/2:c.deltaY&&c.deltaMode===0?-c.deltaY/Vi: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 Jn(c,h){var _=h.relatedTarget;if(!_)return!0;try{for(;_&&_!==c;)_=_.parentNode}catch{return!1}return _!==c}var In={__proto__:null,on:Ct,off:bi,stopPropagation:Bt,disableScrollPropagation:Kt,disableClickPropagation:Qt,preventDefault:Yt,stop:Wi,getPropagationPath:Ui,getMousePosition:mn,getWheelDelta:An,isExternalTarget:Jn,addListener:Ct,removeListener:bi},es=Te.extend({run:function(c,h,_,y){this.stop(),this._el=c,this._inProgress=!0,this._duration=_||.25,this._easeOutPower=1/Math.max(y||.5,.2),this._startPos=It(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=Z(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(),qe(this._el,_),this.fire("step")},_complete:function(){ce(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(c){return 1-Math.pow(1-c,this._easeOutPower)}}),Ji=Te.extend({options:{crs:pi,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(Ee(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=T&&pe.any3d&&!pe.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ct(this._proxy,W,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(Ee(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 y=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(c,h,_.zoom):this._tryAnimatedPan(c,_.pan);if(y)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||(pe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+c,h)},zoomOut:function(c,h){return c=c||(pe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-c,h)},setZoomAround:function(c,h,_){var y=this.getZoomScale(h),k=this.getSize().divideBy(2),N=c instanceof xe?c:this.latLngToContainerPoint(c),te=N.subtract(k).multiplyBy(1-1/y),ye=this.containerPointToLatLng(k.add(te));return this.setView(ye,h,{zoom:_})},_getBoundsCenterZoom:function(c,h){h=h||{},c=c.getBounds?c.getBounds():it(c);var _=We(h.paddingTopLeft||h.padding||[0,0]),y=We(h.paddingBottomRight||h.padding||[0,0]),k=this.getBoundsZoom(c,!1,_.add(y));if(k=typeof h.maxZoom=="number"?Math.min(h.maxZoom,k):k,k===1/0)return{center:c.getCenter(),zoom:k};var N=y.subtract(_).divideBy(2),te=this.project(c.getSouthWest(),k),ye=this.project(c.getNorthEast(),k),Fe=this.unproject(te.add(ye).divideBy(2).add(N),k);return{center:Fe,zoom:k}},fitBounds:function(c,h){if(c=it(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=We(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 es,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){Ne(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||!pe.any3d)return this.setView(c,h,_);this._stop();var y=this.project(this.getCenter()),k=this.project(c),N=this.getSize(),te=this._zoom;c=Ee(c),h=h===void 0?te:h;var ye=Math.max(N.x,N.y),Fe=ye*this.getZoomScale(te,h),bt=k.distanceTo(y)||1,yi=1.42,en=yi*yi;function ki(Bs){var cd=Bs?-1:1,Qb=Bs?Fe:ye,Jb=Fe*Fe-ye*ye+cd*en*en*bt*bt,eC=2*Qb*en*bt,tC=Jb/eC,PS=Math.sqrt(tC*tC+1)-tC,t3=PS<1e-9?-18:Math.log(PS);return t3}function _n(Bs){return(Math.exp(Bs)-Math.exp(-Bs))/2}function Nn(Bs){return(Math.exp(Bs)+Math.exp(-Bs))/2}function Es(Bs){return _n(Bs)/Nn(Bs)}var zs=ki(0);function $r(Bs){return ye*(Nn(zs)/Nn(zs+yi*Bs))}function Kb(Bs){return ye*(Nn(zs)*Es(zs+yi*Bs)-_n(zs))/en}function Zb(Bs){return 1-Math.pow(1-Bs,1.5)}var Xb=Date.now(),xx=(ki(1)-zs)/yi,Yb=_.duration?1e3*_.duration:1e3*xx*.8;function vh(){var Bs=(Date.now()-Xb)/Yb,cd=Zb(Bs)*xx;Bs<=1?(this._flyToFrame=Z(vh,this),this._move(this.unproject(y.add(k.subtract(y).multiplyBy(Kb(cd)/bt)),te),this.getScaleZoom(ye/$r(cd),te),{flyTo:!0})):this._move(c,h)._moveEnd(!0)}return this._moveStart(!0,_.noMoveStart),vh.call(this),this},flyToBounds:function(c,h){var _=this._getBoundsCenterZoom(c,h);return this.flyTo(_.center,_.zoom,h)},setMaxBounds:function(c){return c=it(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(),y=this._limitCenter(_,this._zoom,it(c));return _.equals(y)||this.panTo(y,h),this._enforcingBounds=!1,this},panInside:function(c,h){h=h||{};var _=We(h.paddingTopLeft||h.padding||[0,0]),y=We(h.paddingBottomRight||h.padding||[0,0]),k=this.project(this.getCenter()),N=this.project(c),te=this.getPixelBounds(),ye=dt([te.min.add(_),te.max.subtract(y)]),Fe=ye.getSize();if(!ye.contains(N)){this._enforcingBounds=!0;var bt=N.subtract(ye.getCenter()),yi=ye.extend(N).getSize().subtract(Fe);k.x+=bt.x<0?-yi.x:yi.x,k.y+=bt.y<0?-yi.y:yi.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(),y=h.divideBy(2).round(),k=_.divideBy(2).round(),N=y.subtract(k);return!N.x&&!N.y?this:(c.animate&&c.pan?this.panBy(N):(c.pan&&this._rawPanBy(N),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,y=new yt(h,_),k=y.toBounds(c.coords.accuracy*2),N=this._locateOptions;if(N.setView){var te=this.getBoundsZoom(k);this.setView(y,N.maxZoom?Math.min(te,N.maxZoom):te)}var ye={latlng:y,bounds:k,timestamp:c.timestamp};for(var Fe in c.coords)typeof c.coords[Fe]=="number"&&(ye[Fe]=c.coords[Fe]);this.fire("locationfound",ye)}},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&&(ce(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":""),y=ae("div",_,h||this._mapPane);return c&&(this._panes[c]=y),y},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 Pt(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=it(c),_=We(_||[0,0]);var y=this.getZoom()||0,k=this.getMinZoom(),N=this.getMaxZoom(),te=c.getNorthWest(),ye=c.getSouthEast(),Fe=this.getSize().subtract(_),bt=dt(this.project(ye,y),this.project(te,y)).getSize(),yi=pe.any3d?this.options.zoomSnap:1,en=Fe.x/bt.x,ki=Fe.y/bt.y,_n=h?Math.max(en,ki):Math.min(en,ki);return y=this.getScaleZoom(_n,y),yi&&(y=Math.round(y/(yi/100))*(yi/100),y=h?Math.ceil(y/yi)*yi:Math.floor(y/yi)*yi),Math.max(k,Math.min(N,y))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new xe(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 be(_,_.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 y=_.zoom(c*_.scale(h));return isNaN(y)?1/0:y},project:function(c,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(Ee(c),h)},unproject:function(c,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(We(c),h)},layerPointToLatLng:function(c){var h=We(c).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(c){var h=this.project(Ee(c))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(c){return this.options.crs.wrapLatLng(Ee(c))},wrapLatLngBounds:function(c){return this.options.crs.wrapLatLngBounds(it(c))},distance:function(c,h){return this.options.crs.distance(Ee(c),Ee(h))},containerPointToLayerPoint:function(c){return We(c).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(c){return We(c).add(this._getMapPanePos())},containerPointToLatLng:function(c){var h=this.containerPointToLayerPoint(We(c));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(c){return this.layerPointToContainerPoint(this.latLngToLayerPoint(Ee(c)))},mouseEventToContainerPoint:function(c){return mn(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=J(c);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ct(h,"scroll",this._onScroll,this),this._containerId=d(h)},_initLayout:function(){var c=this._container;this._fadeAnimated=this.options.fadeAnimation&&pe.any3d,Ne(c,"leaflet-container"+(pe.touch?" leaflet-touch":"")+(pe.retina?" leaflet-retina":"")+(pe.ielt9?" leaflet-oldie":"")+(pe.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=ie(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),qe(this._mapPane,new xe(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Ne(c.markerPane,"leaflet-zoom-hide"),Ne(c.shadowPane,"leaflet-zoom-hide"))},_resetView:function(c,h,_){qe(this._mapPane,new xe(0,0));var y=!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"),y&&this.fire("load")},_moveStart:function(c,h){return c&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(c,h,_,y){h===void 0&&(h=this._zoom);var k=this._zoom!==h;return this._zoom=h,this._lastCenter=c,this._pixelOrigin=this._getNewPixelOrigin(c),y?_&&_.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 ce(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(c){qe(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?bi:Ct;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),pe.any3d&&this.options.transform3DLimit&&(c?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ce(this._resizeRequest),this._resizeRequest=Z(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 _=[],y,k=h==="mouseout"||h==="mouseover",N=c.target||c.srcElement,te=!1;N;){if(y=this._targets[d(N)],y&&(h==="click"||h==="preclick")&&this._draggableMoved(y)){te=!0;break}if(y&&y.listens(h,!0)&&(k&&!Jn(N,c)||(_.push(y),k))||N===this._container)break;N=N.parentNode}return!_.length&&!te&&!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"&&rt(h),this._fireDOMEvent(c,_)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(c,h,_){if(c.type==="click"){var y=n({},c);y.type="preclick",this._fireDOMEvent(y,y.type,_)}var k=this._findEventTargets(c,h);if(_){for(var N=[],te=0;te<_.length;te++)_[te].listens(h,!0)&&N.push(_[te]);k=N.concat(k)}if(k.length){h==="contextmenu"&&Yt(c);var ye=k[0],Fe={originalEvent:c};if(c.type!=="keypress"&&c.type!=="keydown"&&c.type!=="keyup"){var bt=ye.getLatLng&&(!ye._radius||ye._radius<=10);Fe.containerPoint=bt?this.latLngToContainerPoint(ye.getLatLng()):this.mouseEventToContainerPoint(c),Fe.layerPoint=this.containerPointToLayerPoint(Fe.containerPoint),Fe.latlng=bt?ye.getLatLng():this.layerPointToLatLng(Fe.layerPoint)}for(te=0;te<k.length;te++)if(k[te].fire(h,Fe,!0),Fe.originalEvent._stopped||k[te].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 It(this._mapPane)||new xe(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 y=this._getNewPixelOrigin(_,h);return this.project(c,h)._subtract(y)},_latLngBoundsToNewLayerBounds:function(c,h,_){var y=this._getNewPixelOrigin(_,h);return dt([this.project(c.getSouthWest(),h)._subtract(y),this.project(c.getNorthWest(),h)._subtract(y),this.project(c.getSouthEast(),h)._subtract(y),this.project(c.getNorthEast(),h)._subtract(y)])},_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 y=this.project(c,h),k=this.getSize().divideBy(2),N=new be(y.subtract(k),y.add(k)),te=this._getBoundsOffset(N,_,h);return Math.abs(te.x)<=1&&Math.abs(te.y)<=1?c:this.unproject(y.add(te),h)},_limitOffset:function(c,h){if(!h)return c;var _=this.getPixelBounds(),y=new be(_.min.add(c),_.max.add(c));return c.add(this._getBoundsOffset(y,h))},_getBoundsOffset:function(c,h,_){var y=dt(this.project(h.getNorthEast(),_),this.project(h.getSouthWest(),_)),k=y.min.subtract(c.min),N=y.max.subtract(c.max),te=this._rebound(k.x,-N.x),ye=this._rebound(k.y,-N.y);return new xe(te,ye)},_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(),y=pe.any3d?this.options.zoomSnap:1;return y&&(c=Math.round(c/y)*y),Math.max(h,Math.min(_,c))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ct(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=ae("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(c),this.on("zoomanim",function(h){var _=U,y=this._proxy.style[_];Ue(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),y===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();Ue(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 y=this.getZoomScale(h),k=this._getCenterOffset(c)._divideBy(1-1/y);return _.animate!==!0&&!this.getSize().contains(k)?!1:(Z(function(){this._moveStart(!0,_.noMoveStart||!1)._animateZoom(c,h,!0)},this),!0)},_animateZoom:function(c,h,_,y){this._mapPane&&(_&&(this._animatingZoom=!0,this._animateToCenter=c,this._animateToZoom=h,Ne(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:c,zoom:h,noUpdate:y}),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&&ct(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 Ts(c,h){return new Ji(c,h)}var Tn=se.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(),y=c._controlCorners[_];return Ne(h,"leaflet-control"),_.indexOf("bottom")!==-1?y.insertBefore(h,y.firstChild):y.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()}}),Gn=function(c){return new Tn(c)};Ji.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=ae("div",h+"control-container",this._container);function y(k,N){var te=h+k+" "+h+N;c[k+N]=ae("div",te,_)}y("top","left"),y("top","right"),y("bottom","left"),y("bottom","right")},_clearControlPos:function(){for(var c in this._controlCorners)oe(this._controlCorners[c]);oe(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ms=Tn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(c,h,_,y){return _<y?-1:y<_?1:0}},initialize:function(c,h,_){E(this,_),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var y in c)this._addLayer(c[y],y);for(y in h)this._addLayer(h[y],y,!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 Tn.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(){Ne(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?(Ne(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=c+"px"):ct(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ct(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var c="leaflet-control-layers",h=this._container=ae("div",c),_=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Qt(h),Kt(h);var y=this._section=ae("section",c+"-list");_&&(this._map.on("click",this.collapse,this),Ct(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var k=this._layersLink=ae("a",c+"-toggle",h);k.href="#",k.title="Layers",k.setAttribute("role","button"),Ct(k,{keydown:function(N){N.keyCode===13&&this._expandSafely()},click:function(N){Yt(N),this._expandSafely()}},this),_||this.expand(),this._baseLayersList=ae("div",c+"-base",y),this._separator=ae("div",c+"-separator",y),this._overlaysList=ae("div",c+"-overlays",y),h.appendChild(y)},_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(y,k){return this.options.sortFunction(y.layer,k.layer,y.name,k.name)},this)),this.options.autoZIndex&&c.setZIndex&&(this._lastZIndex++,c.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Ae(this._baseLayersList),Ae(this._overlaysList),this._layerControlInputs=[];var c,h,_,y,k=0;for(_=0;_<this._layers.length;_++)y=this._layers[_],this._addItem(y),h=h||y.overlay,c=c||!y.overlay,k+=y.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"':"")+"/>",y=document.createElement("div");return y.innerHTML=_,y.firstChild},_addItem:function(c){var h=document.createElement("label"),_=this._map.hasLayer(c.layer),y;c.overlay?(y=document.createElement("input"),y.type="checkbox",y.className="leaflet-control-layers-selector",y.defaultChecked=_):y=this._createRadioElement("leaflet-base-layers_"+d(this),_),this._layerControlInputs.push(y),y.layerId=d(c.layer),Ct(y,"click",this._onInputClick,this);var k=document.createElement("span");k.innerHTML=" "+c.name;var N=document.createElement("span");h.appendChild(N),N.appendChild(y),N.appendChild(k);var te=c.overlay?this._overlaysList:this._baseLayersList;return te.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var c=this._layerControlInputs,h,_,y=[],k=[];this._handlingClick=!0;for(var N=c.length-1;N>=0;N--)h=c[N],_=this._getLayer(h.layerId).layer,h.checked?y.push(_):h.checked||k.push(_);for(N=0;N<k.length;N++)this._map.hasLayer(k[N])&&this._map.removeLayer(k[N]);for(N=0;N<y.length;N++)this._map.hasLayer(y[N])||this._map.addLayer(y[N]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var c=this._layerControlInputs,h,_,y=this._map.getZoom(),k=c.length-1;k>=0;k--)h=c[k],_=this._getLayer(h.layerId).layer,h.disabled=_.options.minZoom!==void 0&&y<_.options.minZoom||_.options.maxZoom!==void 0&&y>_.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var c=this._section;this._preventClick=!0,Ct(c,"click",Yt),this.expand();var h=this;setTimeout(function(){bi(c,"click",Yt),h._preventClick=!1})}}),ir=function(c,h,_){return new ms(c,h,_)},zr=Tn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(c){var h="leaflet-control-zoom",_=ae("div",h+" leaflet-bar"),y=this.options;return this._zoomInButton=this._createButton(y.zoomInText,y.zoomInTitle,h+"-in",_,this._zoomIn),this._zoomOutButton=this._createButton(y.zoomOutText,y.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,_,y,k){var N=ae("a",_,y);return N.innerHTML=c,N.href="#",N.title=h,N.setAttribute("role","button"),N.setAttribute("aria-label",h),Qt(N),Ct(N,"click",Wi),Ct(N,"click",k,this),Ct(N,"click",this._refocusOnMap,this),N},_updateDisabled:function(){var c=this._map,h="leaflet-disabled";ct(this._zoomInButton,h),ct(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||c._zoom===c.getMinZoom())&&(Ne(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||c._zoom===c.getMaxZoom())&&(Ne(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ji.mergeOptions({zoomControl:!0}),Ji.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new zr,this.addControl(this.zoomControl))});var Ya=function(c){return new zr(c)},Vl=Tn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(c){var h="leaflet-control-scale",_=ae("div",h),y=this.options;return this._addScales(y,h+"-line",_),c.on(y.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=ae("div",h,_)),c.imperial&&(this._iScale=ae("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,_,y,k;h>5280?(_=h/5280,y=this._getRoundNum(_),this._updateScale(this._iScale,y+" mi",y/_)):(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*_}}),pr=function(c){return new Vl(c)},Vr='<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>',Qc=Tn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(pe.inlineSvg?Vr+" ":"")+"Leaflet</a>"},initialize:function(c){E(this,c),this._attributions={}},onAdd:function(c){c.attributionControl=this,this._container=ae("div","leaflet-control-attribution"),Qt(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> ')}}});Ji.mergeOptions({attributionControl:!0}),Ji.addInitHook(function(){this.options.attributionControl&&new Qc().addTo(this)});var Ms=function(c){return new Qc(c)};Tn.Layers=ms,Tn.Zoom=zr,Tn.Scale=Vl,Tn.Attribution=Qc,Gn.layers=ir,Gn.zoom=Ya,Gn.scale=pr,Gn.attribution=Ms;var ao=se.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}});ao.addTo=function(c,h){return c.addHandler(h,this),this};var ah={Events:Se},jl=pe.touch?"touchstart mousedown":"mousedown",nr=Te.extend({options:{clickTolerance:3},initialize:function(c,h,_,y){E(this,y),this._element=c,this._dragStartTarget=h||c,this._preventOutline=_},enable:function(){this._enabled||(Ct(this._dragStartTarget,jl,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(nr._dragging===this&&this.finishDrag(!0),bi(this._dragStartTarget,jl,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(c){if(this._enabled&&(this._moved=!1,!Pe(this._element,"leaflet-zoom-anim"))){if(c.touches&&c.touches.length!==1){nr._dragging===this&&this.finishDrag();return}if(!(nr._dragging||c.shiftKey||c.which!==1&&c.button!==1&&!c.touches)&&(nr._dragging=this,this._preventOutline&&rt(this._element),Me(),pt(),!this._moving)){this.fire("down");var h=c.touches?c.touches[0]:c,_=Ge(this._element);this._startPoint=new xe(h.clientX,h.clientY),this._startPos=It(this._element),this._parentScale=_t(_);var y=c.type==="mousedown";Ct(document,y?"mousemove":"touchmove",this._onMove,this),Ct(document,y?"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 xe(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,Yt(c),this._moved||(this.fire("dragstart"),this._moved=!0,Ne(document.body,"leaflet-dragging"),this._lastTarget=c.target||c.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Ne(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),qe(this._element,this._newPos),this.fire("drag",c)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(c){ct(document.body,"leaflet-dragging"),this._lastTarget&&(ct(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),bi(document,"mousemove touchmove",this._onMove,this),bi(document,"mouseup touchend touchcancel",this._onUp,this),Je(),ot();var h=this._moved&&this._moving;this._moving=!1,nr._dragging=!1,h&&this.fire("dragend",{noInertia:c,distance:this._newPos.distanceTo(this._startPos)})}});function Jc(c,h,_){var y,k=[1,4,2,8],N,te,ye,Fe,bt,yi,en,ki;for(N=0,yi=c.length;N<yi;N++)c[N]._code=Ja(c[N],h);for(ye=0;ye<4;ye++){for(en=k[ye],y=[],N=0,yi=c.length,te=yi-1;N<yi;te=N++)Fe=c[N],bt=c[te],Fe._code&en?bt._code&en||(ki=ql(bt,Fe,en,h,_),ki._code=Ja(ki,h),y.push(ki)):(bt._code&en&&(ki=ql(bt,Fe,en,h,_),ki._code=Ja(ki,h),y.push(ki)),y.push(Fe));c=y}return c}function $l(c,h){var _,y,k,N,te,ye,Fe,bt,yi;if(!c||c.length===0)throw new Error("latlngs not passed");Fo(c)||(console.warn("latlngs are not flat! Only the first ring will be used"),c=c[0]);var en=Ee([0,0]),ki=it(c),_n=ki.getNorthWest().distanceTo(ki.getSouthWest())*ki.getNorthEast().distanceTo(ki.getNorthWest());_n<1700&&(en=Qa(c));var Nn=c.length,Es=[];for(_=0;_<Nn;_++){var zs=Ee(c[_]);Es.push(h.project(Ee([zs.lat-en.lat,zs.lng-en.lng])))}for(ye=Fe=bt=0,_=0,y=Nn-1;_<Nn;y=_++)k=Es[_],N=Es[y],te=k.y*N.x-N.y*k.x,Fe+=(k.x+N.x)*te,bt+=(k.y+N.y)*te,ye+=te*3;ye===0?yi=Es[0]:yi=[Fe/ye,bt/ye];var $r=h.unproject(We(yi));return Ee([$r.lat+en.lat,$r.lng+en.lng])}function Qa(c){for(var h=0,_=0,y=0,k=0;k<c.length;k++){var N=Ee(c[k]);h+=N.lat,_+=N.lng,y++}return Ee([h/y,_/y])}var C0={__proto__:null,clipPolygon:Jc,polygonCenter:$l,centroid:Qa};function ed(c,h){if(!h||!c.length)return c.slice();var _=h*h;return c=pa(c,_),c=id(c,_),c}function lh(c,h,_){return Math.sqrt(nd(c,h,_,!0))}function td(c,h,_){return nd(c,h,_)}function id(c,h){var _=c.length,y=typeof Uint8Array<"u"?Uint8Array:Array,k=new y(_);k[0]=k[_-1]=1,Ul(c,k,h,0,_-1);var N,te=[];for(N=0;N<_;N++)k[N]&&te.push(c[N]);return te}function Ul(c,h,_,y,k){var N=0,te,ye,Fe;for(ye=y+1;ye<=k-1;ye++)Fe=nd(c[ye],c[y],c[k],!0),Fe>N&&(te=ye,N=Fe);N>_&&(h[te]=1,Ul(c,h,_,y,te),Ul(c,h,_,te,k))}function pa(c,h){for(var _=[c[0]],y=1,k=0,N=c.length;y<N;y++)nx(c[y],c[k])>h&&(_.push(c[y]),k=y);return k<N-1&&_.push(c[N-1]),_}var E0;function y0(c,h,_,y,k){var N=y?E0:Ja(c,_),te=Ja(h,_),ye,Fe,bt;for(E0=te;;){if(!(N|te))return[c,h];if(N&te)return!1;ye=N||te,Fe=ql(c,h,ye,_,k),bt=Ja(Fe,_),ye===N?(c=Fe,N=bt):(h=Fe,te=bt)}}function ql(c,h,_,y,k){var N=h.x-c.x,te=h.y-c.y,ye=y.min,Fe=y.max,bt,yi;return _&8?(bt=c.x+N*(Fe.y-c.y)/te,yi=Fe.y):_&4?(bt=c.x+N*(ye.y-c.y)/te,yi=ye.y):_&2?(bt=Fe.x,yi=c.y+te*(Fe.x-c.x)/N):_&1&&(bt=ye.x,yi=c.y+te*(ye.x-c.x)/N),new xe(bt,yi,k)}function Ja(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 nx(c,h){var _=h.x-c.x,y=h.y-c.y;return _*_+y*y}function nd(c,h,_,y){var k=h.x,N=h.y,te=_.x-k,ye=_.y-N,Fe=te*te+ye*ye,bt;return Fe>0&&(bt=((c.x-k)*te+(c.y-N)*ye)/Fe,bt>1?(k=_.x,N=_.y):bt>0&&(k+=te*bt,N+=ye*bt)),te=c.x-k,ye=c.y-N,y?te*te+ye*ye:new xe(k,N)}function Fo(c){return!M(c[0])||typeof c[0][0]!="object"&&typeof c[0][0]<"u"}function sx(c){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Fo(c)}function w0(c,h){var _,y,k,N,te,ye,Fe,bt;if(!c||c.length===0)throw new Error("latlngs not passed");Fo(c)||(console.warn("latlngs are not flat! Only the first ring will be used"),c=c[0]);var yi=Ee([0,0]),en=it(c),ki=en.getNorthWest().distanceTo(en.getSouthWest())*en.getNorthEast().distanceTo(en.getNorthWest());ki<1700&&(yi=Qa(c));var _n=c.length,Nn=[];for(_=0;_<_n;_++){var Es=Ee(c[_]);Nn.push(h.project(Ee([Es.lat-yi.lat,Es.lng-yi.lng])))}for(_=0,y=0;_<_n-1;_++)y+=Nn[_].distanceTo(Nn[_+1])/2;if(y===0)bt=Nn[0];else for(_=0,N=0;_<_n-1;_++)if(te=Nn[_],ye=Nn[_+1],k=te.distanceTo(ye),N+=k,N>y){Fe=(N-y)/k,bt=[ye.x-Fe*(ye.x-te.x),ye.y-Fe*(ye.y-te.y)];break}var zs=h.unproject(We(bt));return Ee([zs.lat+yi.lat,zs.lng+yi.lng])}var sd={__proto__:null,simplify:ed,pointToSegmentDistance:lh,closestPointOnSegment:td,clipSegment:y0,_getEdgeIntersection:ql,_getBitCode:Ja,_sqClosestPointOnSegment:nd,isFlat:Fo,_flat:sx,polylineCenter:w0},S0={project:function(c){return new xe(c.lng,c.lat)},unproject:function(c){return new yt(c.y,c.x)},bounds:new be([-180,-90],[180,90])},D0={R:6378137,R_MINOR:6356752314245179e-9,bounds:new be([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(c){var h=Math.PI/180,_=this.R,y=c.lat*h,k=this.R_MINOR/_,N=Math.sqrt(1-k*k),te=N*Math.sin(y),ye=Math.tan(Math.PI/4-y/2)/Math.pow((1-te)/(1+te),N/2);return y=-_*Math.log(Math.max(ye,1e-10)),new xe(c.lng*h*_,y)},unproject:function(c){for(var h=180/Math.PI,_=this.R,y=this.R_MINOR/_,k=Math.sqrt(1-y*y),N=Math.exp(-c.y/_),te=Math.PI/2-2*Math.atan(N),ye=0,Fe=.1,bt;ye<15&&Math.abs(Fe)>1e-7;ye++)bt=k*Math.sin(te),bt=Math.pow((1-bt)/(1+bt),k/2),Fe=Math.PI/2-2*Math.atan(N*bt)-te,te+=Fe;return new yt(te*h,c.x*h/_)}},zb={__proto__:null,LonLat:S0,Mercator:D0,SphericalMercator:ft},ox=n({},mt,{code:"EPSG:3395",projection:D0,transformation:(function(){var c=.5/(Math.PI*D0.R);return ni(c,.5,-c,.5)})()}),rx=n({},mt,{code:"EPSG:4326",projection:S0,transformation:ni(1/180,1,-1/180,.5)}),ax=n({},He,{projection:S0,transformation:ni(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,y=h.lat-c.lat;return Math.sqrt(_*_+y*y)},infinite:!0});He.Earth=mt,He.EPSG3395=ox,He.EPSG3857=pi,He.EPSG900913=xi,He.EPSG4326=rx,He.Simple=ax;var sr=Te.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})}}});Ji.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 y in this._zoomBoundLayers){var k=this._zoomBoundLayers[y].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 el=sr.extend({initialize:function(c,h){E(this,h),this._layers={};var _,y;if(c)for(_=0,y=c.length;_<y;_++)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),_,y;for(_ in this._layers)y=this._layers[_],y[c]&&y[c].apply(y,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)}}),lx=function(c,h){return new el(c,h)},jr=el.extend({addLayer:function(c){return this.hasLayer(c)?this:(c.addEventParent(this),el.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),el.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 Pt;for(var h in this._layers){var _=this._layers[h];c.extend(_.getBounds?_.getBounds():_.getLatLng())}return c}}),cx=function(c,h){return new jr(c,h)},Gl=se.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 y=this._createImg(_,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(y,c),(this.options.crossOrigin||this.options.crossOrigin==="")&&(y.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),y},_setIconStyles:function(c,h){var _=this.options,y=_[h+"Size"];typeof y=="number"&&(y=[y,y]);var k=We(y),N=We(h==="shadow"&&_.shadowAnchor||_.iconAnchor||k&&k.divideBy(2,!0));c.className="leaflet-marker-"+h+" "+(_.className||""),N&&(c.style.marginLeft=-N.x+"px",c.style.marginTop=-N.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 pe.retina&&this.options[c+"RetinaUrl"]||this.options[c+"Url"]}});function dx(c){return new Gl(c)}var Kl=Gl.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 Kl.imagePath!="string"&&(Kl.imagePath=this._detectIconPath()),(this.options.imagePath||Kl.imagePath)+Gl.prototype._getIconUrl.call(this,c)},_stripUrl:function(c){var h=function(_,y,k){var N=y.exec(_);return N&&N[k]};return c=h(c,/^url\((['"])?(.+)\1\)$/,2),c&&h(c,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var c=ae("div","leaflet-default-icon-path",document.body),h=ie(c,"background-image")||ie(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):""}}),od=ao.extend({initialize:function(c){this._marker=c},addHooks:function(){var c=this._marker._icon;this._draggable||(this._draggable=new nr(c,c,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Ne(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&&ct(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(c){var h=this._marker,_=h._map,y=this._marker.options.autoPanSpeed,k=this._marker.options.autoPanPadding,N=It(h._icon),te=_.getPixelBounds(),ye=_.getPixelOrigin(),Fe=dt(te.min._subtract(ye).add(k),te.max._subtract(ye).subtract(k));if(!Fe.contains(N)){var bt=We((Math.max(Fe.max.x,N.x)-Fe.max.x)/(te.max.x-Fe.max.x)-(Math.min(Fe.min.x,N.x)-Fe.min.x)/(te.min.x-Fe.min.x),(Math.max(Fe.max.y,N.y)-Fe.max.y)/(te.max.y-Fe.max.y)-(Math.min(Fe.min.y,N.y)-Fe.min.y)/(te.min.y-Fe.min.y)).multiplyBy(y);_.panBy(bt,{animate:!1}),this._draggable._newPos._add(bt),this._draggable._startPos._add(bt),qe(h._icon,this._draggable._newPos),this._onDrag(c),this._panRequest=Z(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&&(ce(this._panRequest),this._panRequest=Z(this._adjustPan.bind(this,c)))},_onDrag:function(c){var h=this._marker,_=h._shadow,y=It(h._icon),k=h._map.layerPointToLatLng(y);_&&qe(_,y),h._latlng=k,c.latlng=k,c.oldLatLng=this._oldLatLng,h.fire("move",c).fire("drag",c)},_onDragEnd:function(c){ce(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",c)}}),ch=sr.extend({options:{icon:new Kl,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=Ee(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=Ee(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),y=!1;_!==this._icon&&(this._icon&&this._removeIcon(),y=!0,c.title&&(_.title=c.title),_.tagName==="IMG"&&(_.alt=c.alt||"")),Ne(_,h),c.keyboard&&(_.tabIndex="0",_.setAttribute("role","button")),this._icon=_,c.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ct(_,"focus",this._panOnFocus,this);var k=c.icon.createShadow(this._shadow),N=!1;k!==this._shadow&&(this._removeShadow(),N=!0),k&&(Ne(k,h),k.alt=""),this._shadow=k,c.opacity<1&&this._updateOpacity(),y&&this.getPane().appendChild(this._icon),this._initInteraction(),k&&N&&this.getPane(c.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&bi(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&&qe(this._icon,c),this._shadow&&qe(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&&(Ne(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),od)){var c=this.options.draggable;this.dragging&&(c=this.dragging.enabled(),this.dragging.disable()),this.dragging=new od(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?We(h.iconSize):We(0,0),y=h.iconAnchor?We(h.iconAnchor):We(0,0);c.panInside(this._latlng,{paddingTopLeft:y,paddingBottomRight:_.subtract(y)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ux(c,h){return new ch(c,h)}var xa=sr.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)}}),dh=xa.extend({options:{fill:!0,radius:10},initialize:function(c,h){E(this,h),this._latlng=Ee(c),this._radius=this.options.radius},setLatLng:function(c){var h=this._latlng;return this._latlng=Ee(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 xa.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(),y=[c+_,h+_];this._pxBounds=new be(this._point.subtract(y),this._point.add(y))},_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 hx(c,h){return new dh(c,h)}var A0=dh.extend({initialize:function(c,h,_){if(typeof h=="number"&&(h=n({},_,{radius:h})),E(this,h),this._latlng=Ee(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 Pt(this._map.layerPointToLatLng(this._point.subtract(c)),this._map.layerPointToLatLng(this._point.add(c)))},setStyle:xa.prototype.setStyle,_project:function(){var c=this._latlng.lng,h=this._latlng.lat,_=this._map,y=_.options.crs;if(y.distance===mt.distance){var k=Math.PI/180,N=this._mRadius/mt.R/k,te=_.project([h+N,c]),ye=_.project([h-N,c]),Fe=te.add(ye).divideBy(2),bt=_.unproject(Fe).lat,yi=Math.acos((Math.cos(N*k)-Math.sin(h*k)*Math.sin(bt*k))/(Math.cos(h*k)*Math.cos(bt*k)))/k;(isNaN(yi)||yi===0)&&(yi=N/Math.cos(Math.PI/180*h)),this._point=Fe.subtract(_.getPixelOrigin()),this._radius=isNaN(yi)?0:Fe.x-_.project([bt,c-yi]).x,this._radiusY=Fe.y-te.y}else{var en=y.unproject(y.project(this._latlng).subtract([this._mRadius,0]));this._point=_.latLngToLayerPoint(this._latlng),this._radius=this._point.x-_.latLngToLayerPoint(en).x}this._updateBounds()}});function k0(c,h,_){return new A0(c,h,_)}var xr=xa.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,y=nd,k,N,te=0,ye=this._parts.length;te<ye;te++)for(var Fe=this._parts[te],bt=1,yi=Fe.length;bt<yi;bt++){k=Fe[bt-1],N=Fe[bt];var en=y(c,k,N,!0);en<h&&(h=en,_=y(c,k,N))}return _&&(_.distance=Math.sqrt(h)),_},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return w0(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(c,h){return h=h||this._defaultShape(),c=Ee(c),h.push(c),this._bounds.extend(c),this.redraw()},_setLatLngs:function(c){this._bounds=new Pt,this._latlngs=this._convertLatLngs(c)},_defaultShape:function(){return Fo(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(c){for(var h=[],_=Fo(c),y=0,k=c.length;y<k;y++)_?(h[y]=Ee(c[y]),this._bounds.extend(h[y])):h[y]=this._convertLatLngs(c[y]);return h},_project:function(){var c=new be;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 xe(c,c);this._rawPxBounds&&(this._pxBounds=new be([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(c,h,_){var y=c[0]instanceof yt,k=c.length,N,te;if(y){for(te=[],N=0;N<k;N++)te[N]=this._map.latLngToLayerPoint(c[N]),_.extend(te[N]);h.push(te)}else for(N=0;N<k;N++)this._projectLatlngs(c[N],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,_,y,k,N,te,ye,Fe;for(_=0,k=0,N=this._rings.length;_<N;_++)for(Fe=this._rings[_],y=0,te=Fe.length;y<te-1;y++)ye=y0(Fe[y],Fe[y+1],c,y,!0),ye&&(h[k]=h[k]||[],h[k].push(ye[0]),(ye[1]!==Fe[y+1]||y===te-2)&&(h[k].push(ye[1]),k++))}},_simplifyPoints:function(){for(var c=this._parts,h=this.options.smoothFactor,_=0,y=c.length;_<y;_++)c[_]=ed(c[_],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(c,h){var _,y,k,N,te,ye,Fe=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(c))return!1;for(_=0,N=this._parts.length;_<N;_++)for(ye=this._parts[_],y=0,te=ye.length,k=te-1;y<te;k=y++)if(!(!h&&y===0)&&lh(c,ye[k],ye[y])<=Fe)return!0;return!1}});function Vb(c,h){return new xr(c,h)}xr._flat=sx;var tl=xr.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 $l(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(c){var h=xr.prototype._convertLatLngs.call(this,c),_=h.length;return _>=2&&h[0]instanceof yt&&h[0].equals(h[_-1])&&h.pop(),h},_setLatLngs:function(c){xr.prototype._setLatLngs.call(this,c),Fo(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Fo(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var c=this._renderer._bounds,h=this.options.weight,_=new xe(h,h);if(c=new be(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 y=0,k=this._rings.length,N;y<k;y++)N=Jc(this._rings[y],c,!0),N.length&&this._parts.push(N)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(c){var h=!1,_,y,k,N,te,ye,Fe,bt;if(!this._pxBounds||!this._pxBounds.contains(c))return!1;for(N=0,Fe=this._parts.length;N<Fe;N++)for(_=this._parts[N],te=0,bt=_.length,ye=bt-1;te<bt;ye=te++)y=_[te],k=_[ye],y.y>c.y!=k.y>c.y&&c.x<(k.x-y.x)*(c.y-y.y)/(k.y-y.y)+y.x&&(h=!h);return h||xr.prototype._containsPoint.call(this,c,!0)}});function fx(c,h){return new tl(c,h)}var vr=jr.extend({initialize:function(c,h){E(this,h),this._layers={},c&&this.addData(c)},addData:function(c){var h=M(c)?c:c.features,_,y,k;if(h){for(_=0,y=h.length;_<y;_++)k=h[_],(k.geometries||k.geometry||k.features||k.coordinates)&&this.addData(k);return this}var N=this.options;if(N.filter&&!N.filter(c))return this;var te=rd(c,N);return te?(te.feature=ad(c),te.defaultOptions=te.options,this.resetStyle(te),N.onEachFeature&&N.onEachFeature(c,te),this.addLayer(te)):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 rd(c,h){var _=c.type==="Feature"?c.geometry:c,y=_?_.coordinates:null,k=[],N=h&&h.pointToLayer,te=h&&h.coordsToLatLng||uh,ye,Fe,bt,yi;if(!y&&!_)return null;switch(_.type){case"Point":return ye=te(y),gx(N,c,ye,h);case"MultiPoint":for(bt=0,yi=y.length;bt<yi;bt++)ye=te(y[bt]),k.push(gx(N,c,ye,h));return new jr(k);case"LineString":case"MultiLineString":return Fe=hh(y,_.type==="LineString"?0:1,te),new xr(Fe,h);case"Polygon":case"MultiPolygon":return Fe=hh(y,_.type==="Polygon"?1:2,te),new tl(Fe,h);case"GeometryCollection":for(bt=0,yi=_.geometries.length;bt<yi;bt++){var en=rd({geometry:_.geometries[bt],type:"Feature",properties:c.properties},h);en&&k.push(en)}return new jr(k);case"FeatureCollection":for(bt=0,yi=_.features.length;bt<yi;bt++){var ki=rd(_.features[bt],h);ki&&k.push(ki)}return new jr(k);default:throw new Error("Invalid GeoJSON object.")}}function gx(c,h,_,y){return c?c(h,_):new ch(_,y&&y.markersInheritOptions&&y)}function uh(c){return new yt(c[1],c[0],c[2])}function hh(c,h,_){for(var y=[],k=0,N=c.length,te;k<N;k++)te=h?hh(c[k],h-1,_):(_||uh)(c[k]),y.push(te);return y}function B0(c,h){return c=Ee(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,_,y){for(var k=[],N=0,te=c.length;N<te;N++)k.push(h?fh(c[N],Fo(c[N])?0:h-1,_,y):B0(c[N],y));return!h&&_&&k.length>0&&k.push(k[0].slice()),k}function va(c,h){return c.feature?n({},c.feature,{geometry:h}):ad(h)}function ad(c){return c.type==="Feature"||c.type==="FeatureCollection"?c:{type:"Feature",properties:{},geometry:c}}var gh={toGeoJSON:function(c){return va(this,{type:"Point",coordinates:B0(this.getLatLng(),c)})}};ch.include(gh),A0.include(gh),dh.include(gh),xr.include({toGeoJSON:function(c){var h=!Fo(this._latlngs),_=fh(this._latlngs,h?1:0,!1,c);return va(this,{type:(h?"Multi":"")+"LineString",coordinates:_})}}),tl.include({toGeoJSON:function(c){var h=!Fo(this._latlngs),_=h&&!Fo(this._latlngs[0]),y=fh(this._latlngs,_?2:h?1:0,!0,c);return h||(y=[y]),va(this,{type:(_?"Multi":"")+"Polygon",coordinates:y})}}),el.include({toMultiPoint:function(c){var h=[];return this.eachLayer(function(_){h.push(_.toGeoJSON(c).geometry.coordinates)}),va(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",y=[];return this.eachLayer(function(k){if(k.toGeoJSON){var N=k.toGeoJSON(c);if(_)y.push(N.geometry);else{var te=ad(N);te.type==="FeatureCollection"?y.push.apply(y,te.features):y.push(te)}}}),_?va(this,{geometries:y,type:"GeometryCollection"}):{type:"FeatureCollection",features:y}}});function F0(c,h){return new vr(c,h)}var jb=F0,ld=sr.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(c,h,_){this._url=c,this._bounds=it(h),E(this,_)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Ne(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&&$e(this._image),this},bringToBack:function(){return this._map&&Ce(this._image),this},setUrl:function(c){return this._url=c,this._image&&(this._image.src=c),this},setBounds:function(c){return this._bounds=it(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:ae("img");if(Ne(h,"leaflet-image-layer"),this._zoomAnimated&&Ne(h,"leaflet-zoom-animated"),this.options.className&&Ne(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;Ue(this._image,_,h)},_reset:function(){var c=this._image,h=new be(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),_=h.getSize();qe(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()}}),L0=function(c,h,_){return new ld(c,h,_)},I0=ld.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:ae("video");if(Ne(h,"leaflet-image-layer"),this._zoomAnimated&&Ne(h,"leaflet-zoom-animated"),this.options.className&&Ne(h,this.options.className),h.onselectstart=g,h.onmousemove=g,h.onloadeddata=r(this.fire,this,"load"),c){for(var _=h.getElementsByTagName("source"),y=[],k=0;k<_.length;k++)y.push(_[k].src);this._url=_.length>0?y:[h.src];return}M(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(h.style,"objectFit")&&(h.style.objectFit="fill"),h.autoplay=!!this.options.autoplay,h.loop=!!this.options.loop,h.muted=!!this.options.muted,h.playsInline=!!this.options.playsInline;for(var N=0;N<this._url.length;N++){var te=ae("source");te.src=this._url[N],h.appendChild(te)}}});function $b(c,h,_){return new I0(c,h,_)}var px=ld.extend({_initImage:function(){var c=this._image=this._url;Ne(c,"leaflet-image-layer"),this._zoomAnimated&&Ne(c,"leaflet-zoom-animated"),this.options.className&&Ne(c,this.options.className),c.onselectstart=g,c.onmousemove=g}});function Ub(c,h,_){return new px(c,h,_)}var mr=sr.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(c,h){c&&(c instanceof yt||M(c))?(this._latlng=Ee(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&&(Ne(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&&(ct(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(c){return this._latlng=Ee(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&&$e(this._container),this},bringToBack:function(){return this._map&&Ce(this._container),this},_prepareOpen:function(c){var h=this._source;if(!h._map)return!1;if(h instanceof jr){h=null;var _=this._source._layers;for(var y in _)if(_[y]._map){h=_[y];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=We(this.options.offset),_=this._getAnchor();this._zoomAnimated?qe(this._container,c.add(_)):h=h.add(c).add(_);var y=this._containerBottom=-h.y,k=this._containerLeft=-Math.round(this._containerWidth/2)+h.x;this._container.style.bottom=y+"px",this._container.style.left=k+"px"}},_getAnchor:function(){return[0,0]}});Ji.include({_initOverlay:function(c,h,_,y){var k=h;return k instanceof c||(k=new c(y).setContent(h)),_&&k.setLatLng(_),k}}),sr.include({_initOverlay:function(c,h,_,y){var k=_;return k instanceof c?(E(k,y),k._source=this):(k=h&&!y?h:new c(y,this),k.setContent(_)),k}});var ph=mr.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,mr.prototype.openOn.call(this,c)},onAdd:function(c){mr.prototype.onAdd.call(this,c),c.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof xa||this._source.on("preclick",Bt))},onRemove:function(c){mr.prototype.onRemove.call(this,c),c.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof xa||this._source.off("preclick",Bt))},getEvents:function(){var c=mr.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=ae("div",c+" "+(this.options.className||"")+" leaflet-zoom-animated"),_=this._wrapper=ae("div",c+"-content-wrapper",h);if(this._contentNode=ae("div",c+"-content",_),Qt(h),Kt(this._contentNode),Ct(h,"contextmenu",Bt),this._tipContainer=ae("div",c+"-tip-container",h),this._tip=ae("div",c+"-tip",this._tipContainer),this.options.closeButton){var y=this._closeButton=ae("a",c+"-close-button",h);y.setAttribute("role","button"),y.setAttribute("aria-label","Close popup"),y.href="#close",y.innerHTML='<span aria-hidden="true">×</span>',Ct(y,"click",function(k){Yt(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 y=c.offsetHeight,k=this.options.maxHeight,N="leaflet-popup-scrolled";k&&y>k?(h.height=k+"px",Ne(c,N)):ct(c,N),this._containerWidth=this._container.offsetWidth},_animateZoom:function(c){var h=this._map._latLngToNewLayerPoint(this._latlng,c.zoom,c.center),_=this._getAnchor();qe(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(ie(this._container,"marginBottom"),10)||0,_=this._container.offsetHeight+h,y=this._containerWidth,k=new xe(this._containerLeft,-_-this._containerBottom);k._add(It(this._container));var N=c.layerPointToContainerPoint(k),te=We(this.options.autoPanPadding),ye=We(this.options.autoPanPaddingTopLeft||te),Fe=We(this.options.autoPanPaddingBottomRight||te),bt=c.getSize(),yi=0,en=0;N.x+y+Fe.x>bt.x&&(yi=N.x+y-bt.x+Fe.x),N.x-yi-ye.x<0&&(yi=N.x-ye.x),N.y+_+Fe.y>bt.y&&(en=N.y+_-bt.y+Fe.y),N.y-en-ye.y<0&&(en=N.y-ye.y),(yi||en)&&(this.options.keepInView&&(this._autopanning=!0),c.fire("autopanstart").panBy([yi,en]))}},_getAnchor:function(){return We(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),qb=function(c,h){return new ph(c,h)};Ji.mergeOptions({closePopupOnClick:!0}),Ji.include({openPopup:function(c,h,_){return this._initOverlay(ph,c,h,_).openOn(this),this},closePopup:function(c){return c=arguments.length?c:this._popup,c&&c.close(),this}}),sr.include({bindPopup:function(c,h){return this._popup=this._initOverlay(ph,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 jr||(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)){Wi(c);var h=c.layer||c.target;if(this._popup._source===h&&!(h instanceof xa)){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 xh=mr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(c){mr.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){mr.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=mr.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=ae("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+d(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(c){var h,_,y=this._map,k=this._container,N=y.latLngToContainerPoint(y.getCenter()),te=y.layerPointToContainerPoint(c),ye=this.options.direction,Fe=k.offsetWidth,bt=k.offsetHeight,yi=We(this.options.offset),en=this._getAnchor();ye==="top"?(h=Fe/2,_=bt):ye==="bottom"?(h=Fe/2,_=0):ye==="center"?(h=Fe/2,_=bt/2):ye==="right"?(h=0,_=bt/2):ye==="left"?(h=Fe,_=bt/2):te.x<N.x?(ye="right",h=0,_=bt/2):(ye="left",h=Fe+(yi.x+en.x)*2,_=bt/2),c=c.subtract(We(h,_,!0)).add(yi).add(en),ct(k,"leaflet-tooltip-right"),ct(k,"leaflet-tooltip-left"),ct(k,"leaflet-tooltip-top"),ct(k,"leaflet-tooltip-bottom"),Ne(k,"leaflet-tooltip-"+ye),qe(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 We(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Gb=function(c,h){return new xh(c,h)};Ji.include({openTooltip:function(c,h,_){return this._initOverlay(xh,c,h,_).openOn(this),this},closeTooltip:function(c){return c.close(),this}}),sr.include({bindTooltip:function(c,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(xh,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 jr||(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&&(Ct(h,"focus",function(){this._tooltip._source=c,this.openTooltip()},this),Ct(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,_,y;this._tooltip.options.sticky&&c.originalEvent&&(_=this._map.mouseEventToContainerPoint(c.originalEvent),y=this._map.containerPointToLayerPoint(_),h=this._map.layerPointToLatLng(y)),this._tooltip.setLatLng(h)}});var G=Gl.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?(Ae(h),h.appendChild(_.html)):h.innerHTML=_.html!==!1?_.html:"",_.bgPos){var y=We(_.bgPos);h.style.backgroundPosition=-y.x+"px "+-y.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function ge(c){return new G(c)}Gl.Default=Kl;var ut=sr.extend({options:{tileSize:256,opacity:1,updateWhenIdle:pe.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&&($e(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Ce(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 xe?c:new xe(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),y=0,k=h.length,N;y<k;y++)N=h[y].style.zIndex,h[y]!==this._container&&N&&(_=c(_,+N));isFinite(_)&&(this.options.zIndex=_+c(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!pe.ielt9){de(this._container,this.options.opacity);var c=+new Date,h=!1,_=!1;for(var y in this._tiles){var k=this._tiles[y];if(!(!k.current||!k.loaded)){var N=Math.min(1,(c-k.loaded)/200);de(k.el,N),N<1?h=!0:(k.active?_=!0:this._onOpaqueTile(k),k.active=!0)}}_&&!this._noPrune&&this._pruneTiles(),h&&(ce(this._fadeFrame),this._fadeFrame=Z(this._updateOpacity,this))}},_onOpaqueTile:g,_initContainer:function(){this._container||(this._container=ae("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var 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 y=this._levels[c],k=this._map;return y||(y=this._levels[c]={},y.el=ae("div","leaflet-tile-container leaflet-zoom-animated",this._container),y.el.style.zIndex=h,y.origin=k.project(k.unproject(k.getPixelOrigin()),c).round(),y.zoom=c,this._setZoomTransform(y,k.getCenter(),k.getZoom()),g(y.el.offsetWidth),this._onCreateLevel(y)),this._level=y,y}},_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 y=h.coords;this._retainParent(y.x,y.y,y.z,y.z-5)||this._retainChildren(y.x,y.y,y.z,y.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,_,y){var k=Math.floor(c/2),N=Math.floor(h/2),te=_-1,ye=new xe(+k,+N);ye.z=+te;var Fe=this._tileCoordsToKey(ye),bt=this._tiles[Fe];return bt&&bt.active?(bt.retain=!0,!0):(bt&&bt.loaded&&(bt.retain=!0),te>y?this._retainParent(k,N,te,y):!1)},_retainChildren:function(c,h,_,y){for(var k=2*c;k<2*c+2;k++)for(var N=2*h;N<2*h+2;N++){var te=new xe(k,N);te.z=_+1;var ye=this._tileCoordsToKey(te),Fe=this._tiles[ye];if(Fe&&Fe.active){Fe.retain=!0;continue}else Fe&&Fe.loaded&&(Fe.retain=!0);_+1<y&&this._retainChildren(k,N,_+1,y)}},_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,_,y){var k=Math.round(h);this.options.maxZoom!==void 0&&k>this.options.maxZoom||this.options.minZoom!==void 0&&k<this.options.minZoom?k=void 0:k=this._clampZoom(k);var N=this.options.updateWhenZooming&&k!==this._tileZoom;(!y||N)&&(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 y=this._map.getZoomScale(_,c.zoom),k=c.origin.multiplyBy(y).subtract(this._map._getNewPixelOrigin(h,_)).round();pe.any3d?Ue(c.el,k,y):qe(c.el,k)},_resetGrid:function(){var c=this._map,h=c.options.crs,_=this._tileSize=this.getTileSize(),y=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]],y).x/_.x),Math.ceil(c.project([0,h.wrapLng[1]],y).x/_.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(c.project([h.wrapLat[0],0],y).y/_.x),Math.ceil(c.project([h.wrapLat[1],0],y).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(),y=h.getZoomScale(_,this._tileZoom),k=h.project(c,this._tileZoom).floor(),N=h.getSize().divideBy(y*2);return new be(k.subtract(N),k.add(N))},_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 y=this._getTiledPixelBounds(c),k=this._pxBoundsToTileRange(y),N=k.getCenter(),te=[],ye=this.options.keepBuffer,Fe=new be(k.getBottomLeft().subtract([ye,-ye]),k.getTopRight().add([ye,-ye]));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 bt in this._tiles){var yi=this._tiles[bt].coords;(yi.z!==this._tileZoom||!Fe.contains(new xe(yi.x,yi.y)))&&(this._tiles[bt].current=!1)}if(Math.abs(_-this._tileZoom)>1){this._setView(c,_);return}for(var en=k.min.y;en<=k.max.y;en++)for(var ki=k.min.x;ki<=k.max.x;ki++){var _n=new xe(ki,en);if(_n.z=this._tileZoom,!!this._isValidTile(_n)){var Nn=this._tiles[this._tileCoordsToKey(_n)];Nn?Nn.current=!0:te.push(_n)}}if(te.sort(function(zs,$r){return zs.distanceTo(N)-$r.distanceTo(N)}),te.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Es=document.createDocumentFragment();for(ki=0;ki<te.length;ki++)this._addTile(te[ki],Es);this._level.el.appendChild(Es)}}}},_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 y=this._tileCoordsToBounds(c);return it(this.options.bounds).overlaps(y)},_keyToBounds:function(c){return this._tileCoordsToBounds(this._keyToTileCoords(c))},_tileCoordsToNwSe:function(c){var h=this._map,_=this.getTileSize(),y=c.scaleBy(_),k=y.add(_),N=h.unproject(y,c.z),te=h.unproject(k,c.z);return[N,te]},_tileCoordsToBounds:function(c){var h=this._tileCoordsToNwSe(c),_=new Pt(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 xe(+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){Ne(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,pe.ielt9&&this.options.opacity<1&&de(c,this.options.opacity)},_addTile:function(c,h){var _=this._getTilePos(c),y=this._tileCoordsToKey(c),k=this.createTile(this._wrapCoords(c),r(this._tileReady,this,c));this._initTile(k),this.createTile.length<2&&Z(r(this._tileReady,this,c,null,k)),qe(k,_),this._tiles[y]={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 y=this._tileCoordsToKey(c);_=this._tiles[y],_&&(_.loaded=+new Date,this._map._fadeAnimated?(de(_.el,0),ce(this._fadeFrame),this._fadeFrame=Z(this._updateOpacity,this)):(_.active=!0,this._pruneTiles()),h||(Ne(_.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:_.el,coords:c})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),pe.ielt9||!this._map._fadeAnimated?Z(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 xe(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 be(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 xt(c){return new ut(c)}var lt=ut.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&&pe.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 Ct(_,"load",r(this._tileOnLoad,this,h,_)),Ct(_,"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:pe.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){pe.ielt9?setTimeout(r(c,this,null,h),0):c(null,h)},_tileOnError:function(c,h,_){var y=this.options.errorTileUrl;y&&h.getAttribute("src")!==y&&(h.src=y),c(_,h)},_onTileRemove:function(c){c.tile.onload=null},_getZoomForUrl:function(){var c=this._tileZoom,h=this.options.maxZoom,_=this.options.zoomReverse,y=this.options.zoomOffset;return _&&(c=h-c),c+y},_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),ut.prototype._removeTile.call(this,c)},_tileReady:function(c,h,_){if(!(!this._map||_&&_.getAttribute("src")===P))return ut.prototype._tileReady.call(this,c,h,_)}});function fi(c,h){return new lt(c,h)}var Ti=lt.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 y in h)y in this.options||(_[y]=h[y]);h=E(this,h);var k=h.detectRetina&&pe.retina?2:1,N=this.getTileSize();_.width=N.x*k,_.height=N.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,lt.prototype.onAdd.call(this,c)},getTileUrl:function(c){var h=this._tileCoordsToNwSe(c),_=this._crs,y=dt(_.project(h[0]),_.project(h[1])),k=y.min,N=y.max,te=(this._wmsVersion>=1.3&&this._crs===rx?[k.y,k.x,N.y,N.x]:[k.x,k.y,N.x,N.y]).join(","),ye=lt.prototype.getTileUrl.call(this,c);return ye+w(this.wmsParams,ye,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+te},setParams:function(c,h){return n(this.wmsParams,c),h||this.redraw(),this}});function Mi(c,h){return new Ti(c,h)}lt.WMS=Ti,fi.wms=Mi;var Yi=sr.extend({options:{padding:.1},initialize:function(c){E(this,c),d(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Ne(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),y=this._map.getSize().multiplyBy(.5+this.options.padding),k=this._map.project(this._center,h),N=y.multiplyBy(-_).add(k).subtract(this._map._getNewPixelOrigin(c,h));pe.any3d?Ue(this._container,N,_):qe(this._container,N)},_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 be(_,_.add(h.multiplyBy(1+c*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Zi=Yi.extend({options:{tolerance:0},getEvents:function(){var c=Yi.prototype.getEvents.call(this);return c.viewprereset=this._onViewPreReset,c},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Yi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var c=this._container=document.createElement("canvas");Ct(c,"mousemove",this._onMouseMove,this),Ct(c,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ct(c,"mouseout",this._handleMouseOut,this),c._leaflet_disable_events=!0,this._ctx=c.getContext("2d")},_destroyContainer:function(){ce(this._redrawRequest),delete this._ctx,oe(this._container),bi(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)){Yi.prototype._update.call(this);var c=this._bounds,h=this._container,_=c.getSize(),y=pe.retina?2:1;qe(h,c.min),h.width=y*_.x,h.height=y*_.y,h.style.width=_.x+"px",h.style.height=_.y+"px",pe.retina&&this._ctx.scale(2,2),this._ctx.translate(-c.min.x,-c.min.y),this.fire("update")}},_reset:function(){Yi.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,y=h.prev;_?_.prev=y:this._drawLast=y,y?y.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(/[, ]+/),_=[],y,k;for(k=0;k<h.length;k++){if(y=Number(h[k]),isNaN(y))return;_.push(y)}c.options._dashArray=_}else c.options._dashArray=c.options.dashArray},_requestRedraw:function(c){this._map&&(this._extendRedrawBounds(c),this._redrawRequest=this._redrawRequest||Z(this._redraw,this))},_extendRedrawBounds:function(c){if(c._pxBounds){var h=(c.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new be,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 y=this._drawFirst;y;y=y.next)c=y.layer,(!h||c._pxBounds&&c._pxBounds.intersects(h))&&c._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(c,h){if(this._drawing){var _,y,k,N,te=c._parts,ye=te.length,Fe=this._ctx;if(ye){for(Fe.beginPath(),_=0;_<ye;_++){for(y=0,k=te[_].length;y<k;y++)N=te[_][y],Fe[y?"lineTo":"moveTo"](N.x,N.y);h&&Fe.closePath()}this._fillStroke(Fe,c)}}},_updateCircle:function(c){if(!(!this._drawing||c._empty())){var h=c._point,_=this._ctx,y=Math.max(Math.round(c._radius),1),k=(Math.max(Math.round(c._radiusY),1)||y)/y;k!==1&&(_.save(),_.scale(1,k)),_.beginPath(),_.arc(h.x,h.y/k,y,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),_,y,k=this._drawFirst;k;k=k.next)_=k.layer,_.options.interactive&&_._containsPoint(h)&&(!(c.type==="click"||c.type==="preclick")||!this._map._draggableMoved(_))&&(y=_);this._fireEvent(y?[y]:!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&&(ct(this._container,"leaflet-interactive"),this._fireEvent([h],c,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(c,h){if(!this._mouseHoverThrottled){for(var _,y,k=this._drawFirst;k;k=k.next)_=k.layer,_.options.interactive&&_._containsPoint(h)&&(y=_);y!==this._hoveredLayer&&(this._handleMouseOut(c),y&&(Ne(this._container,"leaflet-interactive"),this._fireEvent([y],c,"mouseover"),this._hoveredLayer=y)),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,y=h.prev;if(_)_.prev=y;else return;y?y.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,y=h.prev;if(y)y.next=_;else return;_?_.prev=y:y&&(this._drawLast=y),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(c)}}});function gn(c){return pe.canvas?new Zi(c):null}var dn=(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">')}})(),Dn={_initContainer:function(){this._container=ae("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Yi.prototype._update.call(this),this.fire("update"))},_initPath:function(c){var h=c._container=dn("shape");Ne(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",c._path=dn("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,y=c.options,k=c._container;k.stroked=!!y.stroke,k.filled=!!y.fill,y.stroke?(h||(h=c._stroke=dn("stroke")),k.appendChild(h),h.weight=y.weight+"px",h.color=y.color,h.opacity=y.opacity,y.dashArray?h.dashStyle=M(y.dashArray)?y.dashArray.join(" "):y.dashArray.replace(/( *, *)/g," "):h.dashStyle="",h.endcap=y.lineCap.replace("butt","flat"),h.joinstyle=y.lineJoin):h&&(k.removeChild(h),c._stroke=null),y.fill?(_||(_=c._fill=dn("fill")),k.appendChild(_),_.color=y.fillColor||y.color,_.opacity=y.fillOpacity):_&&(k.removeChild(_),c._fill=null)},_updateCircle:function(c){var h=c._point.round(),_=Math.round(c._radius),y=Math.round(c._radiusY||_);this._setPath(c,c._empty()?"M0 0":"AL "+h.x+","+h.y+" "+_+","+y+" 0,"+65535*360)},_setPath:function(c,h){c._path.v=h},_bringToFront:function(c){$e(c._container)},_bringToBack:function(c){Ce(c._container)}},Sn=pe.vml?dn:Dt,kn=Yi.extend({_initContainer:function(){this._container=Sn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Sn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){oe(this._container),bi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Yi.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)),qe(_,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=Sn("path");c.options.className&&Ne(h,c.options.className),c.options.interactive&&Ne(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,ci(c._parts,h))},_updateCircle:function(c){var h=c._point,_=Math.max(Math.round(c._radius),1),y=Math.max(Math.round(c._radiusY),1)||_,k="a"+_+","+y+" 0 1,0 ",N=c._empty()?"M0 0":"M"+(h.x-_)+","+h.y+k+_*2+",0 "+k+-_*2+",0 ";this._setPath(c,N)},_setPath:function(c,h){c._path.setAttribute("d",h)},_bringToFront:function(c){$e(c._path)},_bringToBack:function(c){Ce(c._path)}});pe.vml&&kn.include(Dn);function hs(c){return pe.svg||pe.vml?new kn(c):null}Ji.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&&gn(c)||hs(c)}});var Cn=tl.extend({initialize:function(c,h){tl.prototype.initialize.call(this,this._boundsToLatLngs(c),h)},setBounds:function(c){return this.setLatLngs(this._boundsToLatLngs(c))},_boundsToLatLngs:function(c){return c=it(c),[c.getSouthWest(),c.getNorthWest(),c.getNorthEast(),c.getSouthEast()]}});function $n(c,h){return new Cn(c,h)}kn.create=Sn,kn.pointsToPath=ci,vr.geometryToLayer=rd,vr.coordsToLatLng=uh,vr.coordsToLatLngs=hh,vr.latLngToCoords=B0,vr.latLngsToCoords=fh,vr.getFeature=va,vr.asFeature=ad,Ji.mergeOptions({boxZoom:!0});var Hs=ao.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(){Ct(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){bi(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(),pt(),Me(),this._startPoint=this._map.mouseEventToContainerPoint(c),Ct(document,{contextmenu:Wi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(c){this._moved||(this._moved=!0,this._box=ae("div","leaflet-zoom-box",this._container),Ne(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(c);var h=new be(this._point,this._startPoint),_=h.getSize();qe(this._box,h.min),this._box.style.width=_.x+"px",this._box.style.height=_.y+"px"},_finish:function(){this._moved&&(oe(this._box),ct(this._container,"leaflet-crosshair")),ot(),Je(),bi(document,{contextmenu:Wi,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 Pt(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())}});Ji.addInitHook("addHandler","boxZoom",Hs),Ji.mergeOptions({doubleClickZoom:!0});var bo=ao.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(),y=h.options.zoomDelta,k=c.originalEvent.shiftKey?_-y:_+y;h.options.doubleClickZoom==="center"?h.setZoom(k):h.setZoomAround(c.containerPoint,k)}});Ji.addInitHook("addHandler","doubleClickZoom",bo),Ji.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Ws=ao.extend({addHooks:function(){if(!this._draggable){var c=this._map;this._draggable=new nr(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))}Ne(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ct(this._map._container,"leaflet-grab"),ct(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=it(this._map.options.maxBounds);this._offsetLimit=dt(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,y=this._draggable._newPos.x,k=(y-h+_)%c+h-_,N=(y+h+_)%c-h-_,te=Math.abs(k+_)<Math.abs(N+_)?k:N;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=te},_onDragEnd:function(c){var h=this._map,_=h.options,y=!_.inertia||c.noInertia||this._times.length<2;if(h.fire("dragend",c),y)h.fire("moveend");else{this._prunePositions(+new Date);var k=this._lastPos.subtract(this._positions[0]),N=(this._lastTime-this._times[0])/1e3,te=_.easeLinearity,ye=k.multiplyBy(te/N),Fe=ye.distanceTo([0,0]),bt=Math.min(_.inertiaMaxSpeed,Fe),yi=ye.multiplyBy(bt/Fe),en=bt/(_.inertiaDeceleration*te),ki=yi.multiplyBy(-en/2).round();!ki.x&&!ki.y?h.fire("moveend"):(ki=h._limitOffset(ki,h.options.maxBounds),Z(function(){h.panBy(ki,{duration:en,easeLinearity:te,noMoveStart:!0,animate:!0})}))}}});Ji.addInitHook("addHandler","dragging",Ws),Ji.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ks=ao.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"),Ct(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(),bi(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,y=c.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(y,_)}},_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,y,k;for(y=0,k=_.left.length;y<k;y++)h[_.left[y]]=[-1*c,0];for(y=0,k=_.right.length;y<k;y++)h[_.right[y]]=[c,0];for(y=0,k=_.down.length;y<k;y++)h[_.down[y]]=[0,c];for(y=0,k=_.up.length;y<k;y++)h[_.up[y]]=[0,-1*c]},_setZoomDelta:function(c){var h=this._zoomKeys={},_=this.keyCodes,y,k;for(y=0,k=_.zoomIn.length;y<k;y++)h[_.zoomIn[y]]=c;for(y=0,k=_.zoomOut.length;y<k;y++)h[_.zoomOut[y]]=-c},_addHooks:function(){Ct(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){bi(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(c){if(!(c.altKey||c.ctrlKey||c.metaKey)){var h=c.keyCode,_=this._map,y;if(h in this._panKeys){if(!_._panAnim||!_._panAnim._inProgress)if(y=this._panKeys[h],c.shiftKey&&(y=We(y).multiplyBy(3)),_.options.maxBounds&&(y=_._limitOffset(We(y),_.options.maxBounds)),_.options.worldCopyJump){var k=_.wrapLatLng(_.unproject(_.project(_.getCenter()).add(y)));_.panTo(k)}else _.panBy(y)}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;Wi(c)}}});Ji.addInitHook("addHandler","keyboard",ks),Ji.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var fs=ao.extend({addHooks:function(){Ct(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){bi(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(c){var h=An(c),_=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(c),this._startTime||(this._startTime=+new Date);var y=Math.max(_-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),y),Wi(c)},_performZoom:function(){var c=this._map,h=c.getZoom(),_=this._map.options.zoomSnap||0;c._stop();var y=this._delta/(this._map.options.wheelPxPerZoomLevel*4),k=4*Math.log(2/(1+Math.exp(-Math.abs(y))))/Math.LN2,N=_?Math.ceil(k/_)*_:k,te=c._limitZoom(h+(this._delta>0?N:-N))-h;this._delta=0,this._startTime=null,te&&(c.options.scrollWheelZoom==="center"?c.setZoom(h+te):c.setZoomAround(this._lastMousePos,h+te))}});Ji.addInitHook("addHandler","scrollWheelZoom",fs);var ls=600;Ji.mergeOptions({tapHold:pe.touchNative&&pe.safari&&pe.mobile,tapTolerance:15});var Xs=ao.extend({addHooks:function(){Ct(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){bi(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 xe(h.clientX,h.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(Ct(document,"touchend",Yt),Ct(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),ls),Ct(document,"touchend touchcancel contextmenu",this._cancel,this),Ct(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function c(){bi(document,"touchend",Yt),bi(document,"touchend touchcancel",c)},_cancel:function(){clearTimeout(this._holdTimeout),bi(document,"touchend touchcancel contextmenu",this._cancel,this),bi(document,"touchmove",this._onMove,this)},_onMove:function(c){var h=c.touches[0];this._newPos=new xe(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(_)}});Ji.addInitHook("addHandler","tapHold",Xs),Ji.mergeOptions({touchZoom:pe.touch,bounceAtZoomLimits:!0});var Mn=ao.extend({addHooks:function(){Ne(this._map._container,"leaflet-touch-zoom"),Ct(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ct(this._map._container,"leaflet-touch-zoom"),bi(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]),y=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(y)._divideBy(2))),this._startDist=_.distanceTo(y),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),Ct(document,"touchmove",this._onTouchMove,this),Ct(document,"touchend touchcancel",this._onTouchEnd,this),Yt(c)}},_onTouchMove:function(c){if(!(!c.touches||c.touches.length!==2||!this._zooming)){var h=this._map,_=h.mouseEventToContainerPoint(c.touches[0]),y=h.mouseEventToContainerPoint(c.touches[1]),k=_.distanceTo(y)/this._startDist;if(this._zoom=h.getScaleZoom(k,this._startZoom),!h.options.bounceAtZoomLimits&&(this._zoom<h.getMinZoom()&&k<1||this._zoom>h.getMaxZoom()&&k>1)&&(this._zoom=h._limitZoom(this._zoom)),h.options.touchZoom==="center"){if(this._center=this._startLatLng,k===1)return}else{var N=_._add(y)._divideBy(2)._subtract(this._centerPoint);if(k===1&&N.x===0&&N.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(N),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),ce(this._animRequest);var te=r(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=Z(te,this,!0),Yt(c)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ce(this._animRequest),bi(document,"touchmove",this._onTouchMove,this),bi(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))}});Ji.addInitHook("addHandler","touchZoom",Mn),Ji.BoxZoom=Hs,Ji.DoubleClickZoom=bo,Ji.Drag=Ws,Ji.Keyboard=ks,Ji.ScrollWheelZoom=fs,Ji.TapHold=Xs,Ji.TouchZoom=Mn,t.Bounds=be,t.Browser=pe,t.CRS=He,t.Canvas=Zi,t.Circle=A0,t.CircleMarker=dh,t.Class=se,t.Control=Tn,t.DivIcon=G,t.DivOverlay=mr,t.DomEvent=In,t.DomUtil=Vt,t.Draggable=nr,t.Evented=Te,t.FeatureGroup=jr,t.GeoJSON=vr,t.GridLayer=ut,t.Handler=ao,t.Icon=Gl,t.ImageOverlay=ld,t.LatLng=yt,t.LatLngBounds=Pt,t.Layer=sr,t.LayerGroup=el,t.LineUtil=sd,t.Map=Ji,t.Marker=ch,t.Mixin=ah,t.Path=xa,t.Point=xe,t.PolyUtil=C0,t.Polygon=tl,t.Polyline=xr,t.Popup=ph,t.PosAnimation=es,t.Projection=zb,t.Rectangle=Cn,t.Renderer=Yi,t.SVG=kn,t.SVGOverlay=px,t.TileLayer=lt,t.Tooltip=xh,t.Transformation=Lt,t.Util=_e,t.VideoOverlay=I0,t.bind=r,t.bounds=dt,t.canvas=gn,t.circle=k0,t.circleMarker=hx,t.control=Gn,t.divIcon=ge,t.extend=n,t.featureGroup=cx,t.geoJSON=F0,t.geoJson=jb,t.gridLayer=xt,t.icon=dx,t.imageOverlay=L0,t.latLng=Ee,t.latLngBounds=it,t.layerGroup=lx,t.map=Ts,t.marker=ux,t.point=We,t.polygon=fx,t.polyline=Vb,t.popup=qb,t.rectangle=$n,t.setOptions=E,t.stamp=d,t.svg=hs,t.svgOverlay=Ub,t.tileLayer=fi,t.tooltip=Gb,t.transformation=ni,t.version=i,t.videoOverlay=$b;var ps=window.L;t.noConflict=function(){return window.L=ps,this},window.L=t}))})(rg,rg.exports)),rg.exports}var DZ=SZ();const j0=mS(DZ),AZ="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=",kZ="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==",BZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",On=(o,e=cb)=>{var t=FZ(),i=v(m(t),2),n=m(i);z(()=>O(n,e())),D(o,t)};var FZ=F('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),LZ=F("<button> </button>"),IZ=F('<span class="err svelte-767znw"> </span>'),PZ=F('<span class="ok svelte-767znw"> </span>'),TZ=F('<div class="loading svelte-767znw">Loading…</div>'),MZ=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>'),RZ=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>'),NZ=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),OZ=F('<div class="field-error svelte-767znw"> </div>'),HZ=F('<div class="field-ok svelte-767znw"> </div>'),WZ=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>'),zZ=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),VZ=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>'),jZ=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>'),$Z=F('<div class="field svelte-767znw"><label class="svelte-767znw">Storage path <!></label> <input id="matter-storage-input" type="text" class="svelte-767znw"/></div>'),UZ=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>'),qZ=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>'),GZ=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>'),KZ=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>'),j2=F("<option> </option>"),ZZ=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>'),XZ=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>'),YZ=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>'),QZ=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),JZ=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>'),eX=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>'),tX=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>'),iX=F('<span class="free-badge svelte-767znw">FREE</span> ',1),nX=F(' — <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),sX=F("<div><!> <!></div>"),oX=F('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),rX=F('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),aX=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>'),lX=F('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),cX=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 dX(o,e){Is(e,!0),delete j0.Icon.Default.prototype._getIconUrl,j0.Icon.Default.mergeOptions({iconUrl:AZ,iconRetinaUrl:kZ,shadowUrl:BZ});let t=B(Di(W$())),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),w=B(!1),A=B(!1),I=B(""),M=B(!1),R=B(8080),P=B(""),V=B("none"),$=B(""),Q=B("X-Remote-User"),re=B(""),he=B(!1),Z=B(""),ce=B(""),_e=B(""),se=B(!1),ue=B(!1),Se=B(!1),Te=B(""),xe=B(48.7408),Oe=B(9.1778),We=B(!1),be=B(void 0),dt=B(!1),Pt=B(null),it=B("info"),yt=B(!0),Ee=B(""),He=B(""),mt=B(!1),At=B(!1),ft=B("");const Lt=[{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 ni=B("ollama"),pi=B("ollama"),xi=B(""),Dt=B(""),ci=B("");const ze={};let we="ollama";function ti(ne,nt){return ne==="anthropic"?"anthropic":ne==="ollama"?"ollama":nt?nt.includes("localhost:1234")?"lmstudio":nt.includes("groq.com")?"groq":nt.includes("googleapis.com")?"gemini":"openai":"openai"}function mi(){ze[we]={baseUrl:l(xi),model:l(Dt),apiKey:l(ci)};const ne=Lt.find($t=>$t.id===l(ni));if(!ne)return;x(pi,ne.provider,!0);const nt=ze[l(ni)];x(xi,(nt==null?void 0:nt.baseUrl)??ne.baseUrl,!0),x(Dt,(nt==null?void 0:nt.model)??ne.defaultModel,!0),x(ci,(nt==null?void 0:nt.apiKey)??"",!0),we=l(ni)}const Ut=Rt(()=>Lt.find(ne=>ne.id===l(ni)));let Bi=B(Di({}));const Ki=new Set(["url","name","variablePrefix","disableVariables","mqttUsername","mqttPassword","mqttCa","mqttCert","mqttKey","mqttVersion","port","bindAddress","auth","password","proxyHeader","proxyLogoutUrl","dir","disableWatch","gitAutoCommit","gitAutoPush","latitude","longitude","timezone","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai","broker","matter-storage"]);Kn(()=>{if(!l(be))return;const ne=typeof l(xe)=="number"?l(xe):48.7408,nt=typeof l(Oe)=="number"?l(Oe):9.1778,$t=j0.map(l(be)).setView([ne,nt],10);j0.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo($t);const qt=j0.marker([ne,nt],{draggable:!0}).addTo($t);x(Pt,qt,!0);const Gt=Be=>{x(xe,+Be.lat.toFixed(6)),x(Oe,+Be.lng.toFixed(6))};return qt.on("dragend",()=>Gt(qt.getLatLng())),$t.on("click",Be=>{qt.setLatLng(Be.latlng),Gt(Be.latlng)}),()=>{x(Pt,null),$t.remove()}}),Kn(()=>{!l(Pt)||l(xe)===""||l(Oe)===""||l(Pt).setLatLng([Number(l(xe)),Number(l(Oe))])});let Ci;function pn(){if(!navigator.geolocation){Ci.show("Geolocation is not supported by this browser.",{alert:!0});return}x(dt,!0),navigator.geolocation.getCurrentPosition(ne=>{x(xe,+ne.coords.latitude.toFixed(6)),x(Oe,+ne.coords.longitude.toFixed(6)),x(dt,!1)},()=>{x(dt,!1)})}let nn=B(!0),cn=B(!1),on=B(""),vt=B(""),Jt=B(""),Ni=B("appearance");const zi=[{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:"logging",label:"Logging",terms:["verbosity","debug","info","warn","error"]},{id:"ai",label:"AI Assistant",terms:["llm","ollama","openai","anthropic","model","provider","base url"]}];let ui=Rt(()=>zi.filter(ne=>{const nt=l(Jt).trim().toLowerCase();return!nt||ne.label.toLowerCase().includes(nt)||ne.terms.some($t=>$t.includes(nt))}));function fn(ne){var nt;x(Ni,ne,!0),(nt=document.getElementById("sec-"+ne))==null||nt.scrollIntoView({behavior:"smooth",block:"start"})}$s(async()=>{try{const ne=await ef();ne.dataDir&&x(i,ne.dataDir,!0)}catch{}try{const ne=await Tl();if(typeof ne.url=="string"&&ne.url)try{const Be=new URL(ne.url);x(n,Be.protocol.replace(":",""),!0),x(s,Be.host,!0)}catch{x(s,ne.url,!0)}typeof ne.mqttUsername=="string"&&x(r,ne.mqttUsername,!0),typeof ne.mqttPassword=="string"&&x(a,ne.mqttPassword,!0),typeof ne.mqttCa=="string"&&x(d,ne.mqttCa,!0),typeof ne.mqttCert=="string"&&x(u,ne.mqttCert,!0),typeof ne.mqttKey=="string"&&x(f,ne.mqttKey,!0),typeof ne.mqttVersion=="string"&&x(C,ne.mqttVersion,!0),typeof ne.name=="string"&&x(g,ne.name,!0),typeof ne.variablePrefix=="string"&&x(p,ne.variablePrefix,!0),typeof ne.disableVariables=="boolean"&&x(b,ne.disableVariables,!0),typeof ne.port=="number"&&x(R,ne.port,!0),typeof ne.bindAddress=="string"&&x(P,ne.bindAddress,!0),typeof ne.auth=="string"&&x(V,ne.auth,!0),typeof ne.proxyHeader=="string"&&x(Q,ne.proxyHeader,!0),typeof ne.proxyLogoutUrl=="string"&&x(re,ne.proxyLogoutUrl,!0),typeof ne.dir=="string"&&x(_e,ne.dir,!0),typeof ne.disableWatch=="boolean"&&x(se,ne.disableWatch,!0),typeof ne.gitAutoCommit=="boolean"&&x(ue,ne.gitAutoCommit,!0),typeof ne.gitAutoPush=="boolean"&&x(Se,ne.gitAutoPush,!0),typeof ne.latitude=="number"&&x(xe,ne.latitude,!0),typeof ne.longitude=="number"&&x(Oe,ne.longitude,!0),typeof ne.timezone=="string"&&x(Te,ne.timezone,!0),typeof ne.verbosity=="string"&&x(it,ne.verbosity,!0),typeof ne.dbPath=="string"?(x(yt,ne.dbPath!==""),x(Ee,ne.dbPath,!0)):(x(yt,!0),x(Ee,"")),typeof ne.dbPrefix=="string"&&x(He,ne.dbPrefix,!0),typeof ne.dbPublish=="boolean"&&x(mt,ne.dbPublish,!0),typeof ne.dbRetain=="boolean"&&x(At,ne.dbRetain,!0);const nt=ne.redis;nt!=null&&nt.url&&x(ft,nt.url,!0);const $t=ne.broker;x(E,($t==null?void 0:$t.enabled)===!0);const qt=ne["matter-storage"];x(A,!!qt),x(I,qt&&typeof qt=="string"&&qt!=="true"?qt:"",!0);const Gt=ne.ai;Gt!=null&&Gt.provider&&x(pi,Gt.provider,!0),Gt!=null&&Gt.baseUrl&&x(xi,Gt.baseUrl,!0),Gt!=null&&Gt.model&&x(Dt,Gt.model,!0),Gt!=null&&Gt.apiKey&&x(ci,Gt.apiKey,!0),x(ni,ti(l(pi),l(xi)),!0),we=l(ni),x(Bi,Object.fromEntries(Object.entries(ne).filter(([Be])=>!Ki.has(Be))),!0),$t&&x(Bi,{...l(Bi),broker:$t},!0)}catch(ne){x(vt,ne.message,!0)}finally{x(nn,!1)}});async function hn(){if(x(ce,""),x(Z,""),l(V)==="password"&&!l($)){x(ce,"A password is required to enable password authentication.");return}x(he,!0);try{await G$(l(V),l(V)==="password"?l($):void 0,l(V)==="proxy"?l(Q):void 0,l(V)==="proxy"?l(re):void 0),x($,""),x(Z,"Authentication settings saved.")}catch(ne){x(ce,ne.message,!0)}finally{x(he,!1)}}async function xn(ne){if(ne){x(yt,!0);return}let nt=0;try{nt=(await ef()).dbDocs??0}catch{}nt>0&&!await Ci.show(`sheDB contains ${nt} document${nt===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(yt,!1)}async function Ye(ne){if(ne){x(A,!0);return}x(M,!0);try{const nt=await gS();if(nt.length>0){await Ci.show(`Cannot disable the Matter controller: ${nt.length} device${nt.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 oi(ne){var nt;if(ne){x(E,!0);return}x(w,!0);try{const $t=await Nb();if((nt=$t.dynsec)!=null&&nt.configured){await Ci.show("Cannot disable mosquitto management: the dynamic security plugin is still configured. Remove it first via Broker → Status.",{alert:!0});return}if($t.sshConfigured&&!await Ci.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(w,!1)}x(E,!1)}async function hi(){x(vt,""),x(on,"");const ne={...l(Bi)};l(s)&&(ne.url=`${l(n)}://${l(s)}`),ne.name=l(g),ne.variablePrefix=l(p),l(C)&&(ne.mqttVersion=l(C)),l(b)&&(ne.disableVariables=!0),l(r)&&(ne.mqttUsername=l(r)),l(a)&&(ne.mqttPassword=l(a)),l(d)&&(ne.mqttCa=l(d)),l(u)&&(ne.mqttCert=l(u)),l(f)&&(ne.mqttKey=l(f)),l(R)!==""&&(ne.port=Number(l(R))),l(P)&&(ne.bindAddress=l(P)),l(_e)&&(ne.dir=l(_e)),l(se)&&(ne.disableWatch=!0),l(ue)&&(ne.gitAutoCommit=!0),l(Se)&&(ne.gitAutoPush=!0),l(xe)!==""&&(ne.latitude=Number(l(xe))),l(Oe)!==""&&(ne.longitude=Number(l(Oe))),l(Te)&&(ne.timezone=l(Te)),ne.verbosity=l(it),l(yt)?l(Ee)&&(ne.dbPath=l(Ee),l(He)&&(ne.dbPrefix=l(He)),l(mt)&&(ne.dbPublish=!0,l(At)&&(ne.dbRetain=!0))):ne.dbPath="",l(ft)&&(ne.redis={url:l(ft)});const nt=l(Bi).broker??{},{enabled:$t,...qt}=nt;l(E)?ne.broker={...qt,enabled:!0}:Object.keys(qt).length>0&&(ne.broker=qt),l(A)&&(ne["matter-storage"]=l(I)||!0),l(pi)&&(ne.ai={provider:l(pi),...l(xi)?{baseUrl:l(xi)}:{},...l(Dt)?{model:l(Dt)}:{},...l(ci)?{apiKey:l(ci)}:{}}),x(cn,!0);try{const Gt=await xp(ne);window.dispatchEvent(new CustomEvent("she:config-changed")),x(on,Gt.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(Gt){x(vt,Gt.message,!0)}finally{x(cn,!1)}}var Ei=cX(),Oi=Et(Ei);cs(Xa(Oi,{}),ne=>Ci=ne,()=>Ci);var Gi=v(Oi,2),ji=m(Gi),K=m(ji),De=v(m(K),2),at=v(K,2);li(at,21,()=>zi,ne=>ne.id,(ne,nt)=>{var $t=Ss(),qt=Et($t);{var Gt=Xe=>{var Zt=LZ();let ei;var Li=m(Zt);z(()=>{ei=Ft(Zt,1,"section-link svelte-767znw",null,ei,{active:l(Ni)===l(nt).id}),O(Li,l(nt).label)}),j("click",Zt,()=>fn(l(nt).id)),D(Xe,Zt)},Be=Rt(()=>l(ui).some(Xe=>Xe.id===l(nt).id));H(qt,Xe=>{l(Be)&&Xe(Gt)})}D(ne,$t)});var Qe=v(ji,2),Wt=m(Qe),si=v(m(Wt),2);{var St=ne=>{var nt=IZ(),$t=m(nt);z(()=>O($t,l(vt))),D(ne,nt)};H(si,ne=>{l(vt)&&ne(St)})}var et=v(si,2);{var Y=ne=>{var nt=PZ(),$t=m(nt);z(()=>O($t,l(on))),D(ne,nt)};H(et,ne=>{l(on)&&ne(Y)})}var Ie=v(et,2),le=m(Ie),pe=v(Wt,2);{var ii=ne=>{var nt=TZ();D(ne,nt)},di=ne=>{var nt=lX(),$t=m(nt);{var qt=fe=>{var Ve=MZ(),Me=v(m(Ve),2),Je=v(m(Me),2),kt=m(Je);kt.value=kt.__value="dark";var st=v(kt);st.value=st.__value="light";var rt=v(st);rt.value=rt.__value="system",j("change",Je,()=>z$(l(t))),Ls(Je,()=>l(t),ve=>x(t,ve)),D(fe,Ve)},Gt=Rt(()=>l(ui).some(fe=>fe.id==="appearance"));H($t,fe=>{l(Gt)&&fe(qt)})}var Be=v($t,2);{var Xe=fe=>{var Ve=WZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var st=v(Je,2),rt=m(st);rt.value=rt.__value="none";var ve=v(rt);ve.value=ve.__value="password";var Ge=v(ve);Ge.value=Ge.__value="proxy";var _t=v(Me,2);{var Vt=Qt=>{var Yt=RZ(),Wi=m(Yt),Ui=m(Wi),mn=v(Ui);On(mn,()=>"Set a new password. Leave empty to keep the current password (if already set).");var Vi=v(Wi,2);z(()=>O(Ui,`${l($)?"New password":"Password"} `)),Nt(Vi,()=>l($),An=>x($,An)),D(Qt,Yt)};H(_t,Qt=>{l(V)==="password"&&Qt(Vt)})}var Ct=v(_t,2);{var Ot=Qt=>{var Yt=NZ(),Wi=Et(Yt),Ui=m(Wi),mn=v(m(Ui));On(mn,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var Vi=v(Ui,2),An=v(Wi,2),Jn=m(An),In=v(m(Jn));On(In,()=>"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 es=v(Jn,2);Nt(Vi,()=>l(Q),Ji=>x(Q,Ji)),Nt(es,()=>l(re),Ji=>x(re,Ji)),D(Qt,Yt)};H(Ct,Qt=>{l(V)==="proxy"&&Qt(Ot)})}var bi=v(Ct,2);{var $i=Qt=>{var Yt=OZ(),Wi=m(Yt);z(()=>O(Wi,l(ce))),D(Qt,Yt)};H(bi,Qt=>{l(ce)&&Qt($i)})}var Ai=v(bi,2);{var ai=Qt=>{var Yt=HZ(),Wi=m(Yt);z(()=>O(Wi,l(Z))),D(Qt,Yt)};H(Ai,Qt=>{l(Z)&&Qt(ai)})}var Mt=v(Ai,2),Bt=v(m(Mt),2),Kt=m(Bt);z(()=>{Bt.disabled=l(he)||l(V)==="password"&&!l($),O(Kt,l(he)?"Saving…":"Apply authentication settings")}),Ls(st,()=>l(V),Qt=>x(V,Qt)),j("click",Bt,hn),D(fe,Ve)},Zt=Rt(()=>l(ui).some(fe=>fe.id==="auth"));H(Be,fe=>{l(Zt)&&fe(Xe)})}var ei=v(Be,2);{var Li=fe=>{var Ve=VZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var st=v(Je,2),rt=m(st);rt.value=rt.__value="mqtt";var ve=v(rt);ve.value=ve.__value="mqtts";var Ge=v(ve);Ge.value=Ge.__value="ws";var _t=v(Ge);_t.value=_t.__value="wss";var Vt=v(Me,2),Ct=m(Vt),Ot=v(m(Ct));On(Ot,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var bi=v(Ct,2),$i=v(Vt,2),Ai=m($i),ai=v(m(Ai));On(ai,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var Mt=v(Ai,2),Bt=v($i,2),Kt=m(Bt),Qt=v(m(Kt));On(Qt,()=>"MQTT broker password. Stored in plain text in config.json.");var Yt=v(Kt,2),Wi=v(Bt,2);{var Ui=Ms=>{var ao=zZ(),ah=Et(ao),jl=m(ah),nr=v(m(jl));On(nr,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var Jc=v(jl,2),$l=v(ah,2),Qa=m($l),C0=v(m(Qa));On(C0,()=>"PEM-encoded client certificate for mutual TLS authentication.");var ed=v(Qa,2),lh=v($l,2),td=m(lh),id=v(m(td));On(id,()=>"PEM-encoded private key matching the client certificate.");var Ul=v(td,2);Nt(Jc,()=>l(d),pa=>x(d,pa)),Nt(ed,()=>l(u),pa=>x(u,pa)),Nt(Ul,()=>l(f),pa=>x(f,pa)),D(Ms,ao)};H(Wi,Ms=>{(l(n)==="mqtts"||l(n)==="wss")&&Ms(Ui)})}var mn=v(Wi,2),Vi=m(mn),An=v(m(Vi));On(An,()=>"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 Jn=v(Vi,2),In=m(Jn);In.value=In.__value="";var es=v(In);es.value=es.__value="5";var Ji=v(mn,2),Ts=m(Ji),Tn=v(m(Ts));On(Tn,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var Gn=v(Ts,2),ms=v(Ji,2),ir=m(ms),zr=v(m(ir));On(zr,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var Ya=v(ir,2),Vl=v(ms,2),pr=v(m(Vl),2),Vr=m(pr),Qc=v(Vr,4);On(Qc,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),Ls(st,()=>l(n),Ms=>x(n,Ms)),Nt(bi,()=>l(s),Ms=>x(s,Ms)),Nt(Mt,()=>l(r),Ms=>x(r,Ms)),Nt(Yt,()=>l(a),Ms=>x(a,Ms)),Ls(Jn,()=>l(C),Ms=>x(C,Ms)),Nt(Gn,()=>l(g),Ms=>x(g,Ms)),Nt(Ya,()=>l(p),Ms=>x(p,Ms)),ws(Vr,()=>l(b),Ms=>x(b,Ms)),D(fe,Ve)},vi=Rt(()=>l(ui).some(fe=>fe.id==="mqtt"));H(ei,fe=>{l(vi)&&fe(Li)})}var me=v(ei,2);{var je=fe=>{var Ve=jZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"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 st=v(Je,2);let rt;var ve=m(st),Ge=v(ve,4);{var _t=Vt=>{var Ct=oo("— checking…");D(Vt,Ct)};H(Ge,Vt=>{l(w)&&Vt(_t)})}z(()=>{rt=Ft(st,1,"check-label svelte-767znw",null,rt,{muted:l(w)}),Zo(ve,l(E)),ve.disabled=l(w)}),j("change",ve,Vt=>oi(Vt.target.checked)),D(fe,Ve)},tt=Rt(()=>l(ui).some(fe=>fe.id==="broker"));H(me,fe=>{l(tt)&&fe(je)})}var Le=v(me,2);{var ht=fe=>{var Ve=UZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"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 st=v(Je,2);let rt;var ve=m(st),Ge=v(ve,4);{var _t=Ot=>{var bi=oo("— checking…");D(Ot,bi)};H(Ge,Ot=>{l(M)&&Ot(_t)})}var Vt=v(Me,2);{var Ct=Ot=>{var bi=$Z(),$i=m(bi),Ai=v(m($i));On(Ai,()=>"Path to the Matter controller storage directory. Leave empty to use the default ({dataDir}/matter).");var ai=v($i,2);z(()=>rn(ai,"placeholder",`${l(i)??""}/matter (default)`)),Nt(ai,()=>l(I),Mt=>x(I,Mt)),D(Ot,bi)};H(Vt,Ot=>{l(A)&&Ot(Ct)})}z(()=>{rt=Ft(st,1,"check-label svelte-767znw",null,rt,{muted:l(M)}),Zo(ve,l(A)),ve.disabled=l(M)}),j("change",ve,Ot=>Ye(Ot.target.checked)),D(fe,Ve)},gt=Rt(()=>l(ui).some(fe=>fe.id==="matter"));H(Le,fe=>{l(gt)&&fe(ht)})}var Xt=v(Le,2);{var U=fe=>{var Ve=qZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var st=v(Je,2),rt=v(Me,2),ve=m(rt),Ge=v(m(ve));On(Ge,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var _t=v(ve,2);Nt(st,()=>l(R),Vt=>x(R,Vt)),Nt(_t,()=>l(P),Vt=>x(P,Vt)),D(fe,Ve)},T=Rt(()=>l(ui).some(fe=>fe.id==="webserver"));H(Xt,fe=>{l(T)&&fe(U)})}var W=v(Xt,2);{var J=fe=>{var Ve=GZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var st=v(Je,2),rt=v(Me,2),ve=v(m(rt),2),Ge=m(ve),_t=v(Ge,4);On(_t,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),z(()=>rn(st,"placeholder",`${l(i)??""}/scripts (default)`)),Nt(st,()=>l(_e),Vt=>x(_e,Vt)),ws(Ge,()=>l(se),Vt=>x(se,Vt)),D(fe,Ve)},ie=Rt(()=>l(ui).some(fe=>fe.id==="scripts"));H(W,fe=>{l(ie)&&fe(J)})}var ae=v(W,2);{var oe=fe=>{var Ve=KZ(),Me=v(m(Ve),2),Je=v(m(Me),2),kt=m(Je),st=v(kt,4);On(st,()=>"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 rt=v(Me,2),ve=v(m(rt),2),Ge=m(ve),_t=v(Ge,4);On(_t,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),ws(kt,()=>l(ue),Vt=>x(ue,Vt)),ws(Ge,()=>l(Se),Vt=>x(Se,Vt)),D(fe,Ve)},Ae=Rt(()=>l(ui).some(fe=>fe.id==="git"));H(ae,fe=>{l(Ae)&&fe(oe)})}var $e=v(ae,2);{var Ce=fe=>{var Ve=XZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"IANA timezone for cron scheduling (e.g. Europe/Berlin). Leave empty to use the system timezone. Requires daemon restart.");var st=v(Je,2),rt=v(st,2);li(rt,20,()=>{var Vi;return((Vi=Intl.supportedValuesOf)==null?void 0:Vi.call(Intl,"timeZone"))??[]},Hi,(Vi,An)=>{var Jn=j2(),In=m(Jn),es={};z(()=>{O(In,An),es!==(es=An)&&(Jn.value=(Jn.__value=An)??"")}),D(Vi,Jn)});var ve=v(Me,2),Ge=m(ve),_t=v(m(Ge));On(_t,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Vt=v(Ge,2),Ct=v(ve,2),Ot=m(Ct),bi=v(m(Ot));On(bi,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var $i=v(Ot,2),Ai=v(Ct,2),ai=v(m(Ai),2),Mt=m(ai),Bt=m(Mt);{var Kt=Vi=>{var An=oo("…");D(Vi,An)},Qt=Vi=>{var An=oo("📍 Use my location");D(Vi,An)};H(Bt,Vi=>{l(dt)?Vi(Kt):Vi(Qt,-1)})}var Yt=v(Mt,2),Wi=m(Yt),Ui=v(Ai,2);{var mn=Vi=>{var An=ZZ(),Jn=v(m(An),2);cs(Jn,In=>x(be,In),()=>l(be)),D(Vi,An)};H(Ui,Vi=>{l(We)&&Vi(mn)})}z(()=>{Mt.disabled=l(dt),O(Wi,l(We)?"Hide map":"Pick on map")}),Nt(st,()=>l(Te),Vi=>x(Te,Vi)),Nt(Vt,()=>l(xe),Vi=>x(xe,Vi)),Nt($i,()=>l(Oe),Vi=>x(Oe,Vi)),j("click",Mt,pn),j("click",Yt,()=>x(We,!l(We))),D(fe,Ve)},Pe=Rt(()=>l(ui).some(fe=>fe.id==="solar"));H($e,fe=>{l(Pe)&&fe(Ce)})}var Ne=v($e,2);{var ct=fe=>{var Ve=JZ(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"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 st=v(Je,2),rt=m(st),ve=v(Me,2);{var Ge=_t=>{var Vt=QZ(),Ct=Et(Vt),Ot=m(Ct),bi=v(m(Ot));On(bi,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to use the default.");var $i=v(Ot,2),Ai=v(Ct,2),ai=m(Ai),Mt=v(m(ai));On(Mt,()=>"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 Bt=v(ai,2),Kt=v(Ai,2),Qt=v(m(Kt),2),Yt=m(Qt),Wi=v(Yt,4);On(Wi,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var Ui=v(Kt,2);{var mn=Vi=>{var An=YZ(),Jn=v(m(An),2),In=m(Jn),es=v(In,4);On(es,()=>"When enabled, MQTT messages for document changes are published as retained messages."),ws(In,()=>l(At),Ji=>x(At,Ji)),D(Vi,An)};H(Ui,Vi=>{l(mt)&&Vi(mn)})}z(()=>rn($i,"placeholder",`defaults to ${l(i)??""}/db`)),Nt($i,()=>l(Ee),Vi=>x(Ee,Vi)),Nt(Bt,()=>l(He),Vi=>x(He,Vi)),ws(Yt,()=>l(mt),Vi=>x(mt,Vi)),D(_t,Vt)};H(ve,_t=>{l(yt)&&_t(Ge)})}z(()=>Zo(rt,l(yt))),j("change",rt,_t=>xn(_t.target.checked)),D(fe,Ve)},ri=Rt(()=>l(ui).some(fe=>fe.id==="shedb"));H(Ne,fe=>{l(ri)&&fe(ct)})}var X=v(Ne,2);{var de=fe=>{var Ve=eX(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"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 st=v(Je,2);Nt(st,()=>l(ft),rt=>x(ft,rt)),D(fe,Ve)},Ke=Rt(()=>l(ui).some(fe=>fe.id==="redis"));H(X,fe=>{l(Ke)&&fe(de)})}var Tt=v(X,2);{var Ue=fe=>{var Ve=tX(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var st=v(Je,2),rt=m(st);rt.value=rt.__value="debug";var ve=v(rt);ve.value=ve.__value="info";var Ge=v(ve);Ge.value=Ge.__value="warn";var _t=v(Ge);_t.value=_t.__value="error",Ls(st,()=>l(it),Vt=>x(it,Vt)),D(fe,Ve)},qe=Rt(()=>l(ui).some(fe=>fe.id==="logging"));H(Tt,fe=>{l(qe)&&fe(Ue)})}var It=v(Tt,2);{var pt=fe=>{var Ve=aX(),Me=v(m(Ve),2),Je=m(Me),kt=v(m(Je));On(kt,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var st=v(Je,2);li(st,21,()=>Lt,Hi,(ai,Mt)=>{var Bt=j2(),Kt=m(Bt),Qt={};z(()=>{O(Kt,l(Mt).label),Qt!==(Qt=l(Mt).id)&&(Bt.value=(Bt.__value=l(Mt).id)??"")}),D(ai,Bt)});var rt=v(Me,2);{var ve=ai=>{var Mt=sX();let Bt;var Kt=m(Mt);{var Qt=Ui=>{var mn=iX(),Vi=v(Et(mn));z(()=>O(Vi,` ${l(Ut).freeNote??""}`)),D(Ui,mn)};H(Kt,Ui=>{l(Ut).freeNote&&Ui(Qt)})}var Yt=v(Kt,2);{var Wi=Ui=>{var mn=nX(),Vi=v(Et(mn));z(()=>rn(Vi,"href",l(Ut).apiKeyUrl)),D(Ui,mn)};H(Yt,Ui=>{l(Ut).apiKeyUrl&&Ui(Wi)})}z(()=>Bt=Ft(Mt,1,"preset-note svelte-767znw",null,Bt,{free:!!l(Ut).freeNote})),D(ai,Mt)};H(rt,ai=>{var Mt,Bt;((Mt=l(Ut))!=null&&Mt.freeNote||(Bt=l(Ut))!=null&&Bt.apiKeyUrl)&&ai(ve)})}var Ge=v(rt,2);{var _t=ai=>{var Mt=oX(),Bt=m(Mt),Kt=v(m(Bt));On(Kt,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var Qt=v(Bt,2);z(()=>{var Yt;return rn(Qt,"placeholder",l(ni)==="ollama"?"http://localhost:11434":l(ni)==="lmstudio"?"http://localhost:1234":((Yt=l(Ut))==null?void 0:Yt.baseUrl)??"")}),Nt(Qt,()=>l(xi),Yt=>x(xi,Yt)),D(ai,Mt)};H(Ge,ai=>{l(ni)!=="anthropic"&&ai(_t)})}var Vt=v(Ge,2),Ct=m(Vt),Ot=v(m(Ct));On(Ot,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var bi=v(Ct,2),$i=v(Vt,2);{var Ai=ai=>{var Mt=rX(),Bt=m(Mt),Kt=v(m(Bt));On(Kt,()=>"Stored in config.json. Not needed for local providers.");var Qt=v(Bt,2);Nt(Qt,()=>l(ci),Yt=>x(ci,Yt)),D(ai,Mt)};H($i,ai=>{l(ni)!=="ollama"&&l(ni)!=="lmstudio"&&ai(Ai)})}z(()=>{var ai;return rn(bi,"placeholder",((ai=l(Ut))==null?void 0:ai.defaultModel)||"e.g. llama3.2")}),j("change",st,mi),Ls(st,()=>l(ni),ai=>x(ni,ai)),Nt(bi,()=>l(Dt),ai=>x(Dt,ai)),D(fe,Ve)},ot=Rt(()=>l(ui).some(fe=>fe.id==="ai"));H(It,fe=>{l(ot)&&fe(pt)})}D(ne,nt)};H(pe,ne=>{l(nn)?ne(ii):ne(di,-1)})}z(()=>{Ie.disabled=l(cn),O(le,l(cn)?"Saving…":"Save")}),Nt(De,()=>l(Jt),ne=>x(Jt,ne)),j("click",Ie,hi),D(o,Ei),Ps()}Gs(["click","change"]);var uX=F('<span class="history-loading svelte-18loop9" title="Loading log history…">↺</span>'),hX=F("<option> </option>"),fX=F('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),gX=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 pX(o,e){Is(e,!0);const t=2e3;let i=B(Di(RF())),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};vS(Z=>{x(i,[...l(i).slice(-1999),Z],!0)}),$s(async()=>{try{const Z=await pS(),ce=new Set(l(i).map(se=>se.ts+se.msg)),_e=Z.filter(se=>!ce.has(se.ts+se.msg));x(i,[..._e,...l(i)].slice(-t),!0)}catch{}x(n,!1),s&&(s.scrollTop=s.scrollHeight)}),Kn(()=>{l(i).length,l(r)&&s&&(s.scrollTop=s.scrollHeight)});function p(){x(i,[],!0)}function C(Z){if(l(a)!=="all"&&g[Z.level]<g[l(a)])return!1;if(!l(d))return!0;if(l(u))try{return new RegExp(l(d),"i").test(Z.msg)}catch{}return Z.msg.toLowerCase().includes(l(d).toLowerCase())}function b(Z){return new Date(Z).toLocaleTimeString()}var E=gX(),w=m(E),A=v(m(w),2);{var I=Z=>{var ce=uX();D(Z,ce)};H(A,Z=>{l(n)&&Z(I)})}var M=v(A,2);li(M,21,()=>f,Hi,(Z,ce)=>{var _e=hX(),se=m(_e),ue={};z(()=>{O(se,l(ce)),ue!==(ue=l(ce))&&(_e.value=(_e.__value=l(ce))??"")}),D(Z,_e)});var R=v(M,2),P=v(R,2),V=m(P),$=v(P,2),Q=m($),re=v($,2),he=v(w,2);li(he,21,()=>l(i).filter(C),Z=>Z.ts+Z.msg,(Z,ce)=>{var _e=fX(),se=m(_e),ue=m(se),Se=v(se,2),Te=m(Se),xe=v(Se,2),Oe=m(xe);z((We,be)=>{Ft(_e,1,`line ${l(ce).level??""}`,"svelte-18loop9"),O(ue,We),O(Te,be),O(Oe,l(ce).msg)},[()=>b(l(ce).ts),()=>l(ce).level.toUpperCase()]),D(Z,_e)}),cs(he,Z=>s=Z,()=>s),Ls(M,()=>l(a),Z=>x(a,Z)),Nt(R,()=>l(d),Z=>x(d,Z)),ws(V,()=>l(u),Z=>x(u,Z)),ws(Q,()=>l(r),Z=>x(r,Z)),j("click",re,p),D(o,E),Ps()}Gs(["click"]);function $2(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 xX=F('<span class="chat-model svelte-1twuiul"><!></span>'),vX=F('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),mX=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>'),_X=F('Working on view <code class="svelte-1twuiul"> </code>',1),bX=F('<button class="chip svelte-1twuiul"> </button>'),CX=F('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),EX=F('<div class="msg-content user-text svelte-1twuiul"> </div>'),U2=F('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),q2=F('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),G2=F('<div class="tool-events svelte-1twuiul"></div>'),K2=F('<div class="text-block svelte-1twuiul"></div>'),yX=F('<button class="expand-btn svelte-1twuiul"> </button>'),wX=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>'),SX=F('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),DX=F('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),AX=F("<div><!></div>"),kX=F('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),BX=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>'),FX=F('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),LX=F('<div class="chat-error svelte-1twuiul"> </div>'),IX=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>'),PX=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>'),TX=F('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),MX=F('<button class="send-btn svelte-1twuiul">↑</button>'),RX=F('<option class="svelte-1twuiul"> </option>'),NX=F('<select class="model-select svelte-1twuiul"></select>'),OX=F('<span class="model-name svelte-1twuiul"> </span>'),HX=F('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),WX=F('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),zX=F('<p class="info-status svelte-1twuiul">Loading…</p>'),VX=F('<p class="info-status info-err svelte-1twuiul"> </p>'),jX=F('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),$X=F('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),UX=F('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),qX=F('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),GX=F('<div class="running-model svelte-1twuiul"> </div>'),KX=F('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),ZX=F('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),XX=F('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),YX=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>'),QX=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 JX(o,e){Is(e,!0),$m.registerLanguage("javascript",zF),os.use({breaks:!0,gfm:!0});let t=Tu(e,"currentView",3,null);const i="she:viewchat:messages";let n=B(Di(JSON.parse(localStorage.getItem(i)??"[]"))),s=B(null),r=B(""),a=B(!1),d=B(""),u=B(null),f=B(Di([])),g=B(Di(localStorage.getItem("she:selectedModel")??""));Kn(()=>{localStorage.setItem(i,JSON.stringify(l(n)))});let p=B(Di(new Set)),C=B(!1),b=B(null),E=B(!1),w=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),$=B(Di([])),Q=B(!0),re=B(!1),he,Z=B(Di([])),ce=B(0),_e,se;const ue=Rt(()=>({apiref:!1,shedb:l(R),sampleDocs:l(P),tools:l(V)})),Se=Rt(()=>{var U;return((U=l(u))==null?void 0:U.configured)??!1}),Te=Rt(()=>l(ce)+new TextEncoder().encode(l(r)).length),xe=Rt(()=>l(Q)?t():null);async function Oe(){try{const U=await FF();x(u,U,!0),U.configured&&!l(g)&&x(g,U.model,!0)}catch{}}Kn(()=>(window.addEventListener("she:config-changed",Oe),()=>window.removeEventListener("she:config-changed",Oe))),$s(()=>{Oe()}),Kn(()=>{l(g)&&localStorage.setItem("she:selectedModel",l(g))}),Kn(()=>{var U;(U=l(u))!=null&&U.provider&&LF().then(T=>{x(f,T.models,!0),!l(g)&&T.models.length>0&&x(g,T.models[0],!0)}).catch(()=>{})}),Kn(()=>{l(g),x(b,null),x(w,"")}),Kn(()=>{const U=l(ue),T=l(xe),W=l($);l(Se)&&IF({context:U,currentView:T??null,extraFiles:W.length>0?W:void 0}).then(J=>{x(ce,new TextEncoder().encode(J.prompt).length,!0)}).catch(()=>{})}),Kn(()=>{if(!l(a))return;x(I,Math.floor(Math.random()*M.length),!0);const U=setInterval(()=>{x(I,(l(I)+1)%M.length)},1e4);return()=>clearInterval(U)}),Kn(()=>{var U;se&&(l(n).length+(((U=l(s))==null?void 0:U.length)??0),requestAnimationFrame(()=>{se&&(se.scrollTop=se.scrollHeight)}))});function We(U){const T=[],W=/```(\w*)\n([\s\S]*?)```/g;let J=0,ie;for(;(ie=W.exec(U))!==null;)ie.index>J&&T.push({type:"text",text:U.slice(J,ie.index)}),T.push({type:"code",lang:ie[1]||"text",text:ie[2].trimEnd()}),J=ie.index+ie[0].length;return J<U.length&&T.push({type:"text",text:U.slice(J)}),T}function be(U){const T=[],W=/```(\w*)\n([\s\S]*?)```/g;let J=0,ie;for(;(ie=W.exec(U))!==null;)ie.index>J&&T.push({type:"text",text:U.slice(J,ie.index)}),T.push({type:"code",lang:ie[1]||"text",text:ie[2].trimEnd()}),J=ie.index+ie[0].length;const ae=U.slice(J),oe=ae.match(/```(\w*)\n([\s\S]*)$/);return oe?(oe.index>0&&T.push({type:"text",text:ae.slice(0,oe.index)}),T.push({type:"code",lang:oe[1]||"text",text:oe[2]})):ae&&T.push({type:"text",text:ae}),T}function dt(U){const T={};for(const W of U)if(W.type==="code"){if(W.lang==="filter")T.filter=W.text.trim();else if(ft(W.lang)){const J=W.text.split(`
|
|
223
|
+
`)[0].trim();J==="// @view-map"?T.map=W.text.split(`
|
|
224
|
+
`).slice(1).join(`
|
|
225
|
+
`).trim():J==="// @view-reduce"&&(T.reduce=W.text.split(`
|
|
226
|
+
`).slice(1).join(`
|
|
227
|
+
`).trim())}}return T}function Pt(U){return U.filter!==void 0||U.map!==void 0||U.reduce!==void 0}function it(U){const T=[];return U.filter!==void 0&&T.push("filter"),U.map!==void 0&&T.push("map"),U.reduce!==void 0&&T.push("reduce"),`Apply ${T.join(" + ")}`}const yt=15;function Ee(U){return U.split(`
|
|
228
|
+
`).length>yt}function He(U){const T=new Set(l(p));T.has(U)?T.delete(U):T.add(U),x(p,T,!0)}function mt(U,T){if(ft(T))try{return $m.highlight(U,{language:"javascript"}).value}catch{}return U.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function At(U){return os.parse(U)}function ft(U){return!U||U==="js"||U==="javascript"}function Lt(U){navigator.clipboard.writeText(U).catch(()=>{})}async function ni(){if(x(C,!0),!(l(b)||l(E))){x(E,!0),x(w,"");try{x(b,await Ew(l(g)||l(u).model),!0)}catch(U){x(w,U.message,!0)}x(E,!1)}}function pi(U){return U>=1e9?`${(U/1e9).toFixed(1)} GB`:U>=1e6?`${(U/1e6).toFixed(0)} MB`:`${U} B`}function xi(U){const T=U.match(/\.([^.]+)$/);return T?T[1].toUpperCase():"?"}function Dt(U){switch(U){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return U}}function ci(U){x($,l($).filter((T,W)=>W!==U),!0)}function ze(){he.click()}async function we(U){if(!(!U||U.length===0))for(const T of Array.from(U)){const W=await T.text();x($,[...l($),{name:T.name,content:W}],!0)}}function ti(U){const T=U.target;we(T.files),T.value=""}function mi(U){var T;U.preventDefault(),x(re,!1),we(((T=U.dataTransfer)==null?void 0:T.files)??null)}function Ut(U){var T;(T=U.dataTransfer)!=null&&T.types.includes("Files")&&(U.preventDefault(),x(re,!0))}function Bi(){x(re,!1)}async function Ki(){const U=l(r).trim();if(!(!U||l(a))){x(r,""),x(d,""),x(a,!0),x(n,[...l(n),{role:"user",content:U}],!0),A=new AbortController,x(Z,[],!0);try{await PF({messages:l(n),currentView:l(xe),context:l(ue),modelOverride:l(g)||void 0,extraFiles:l($).length>0?l($):void 0},T=>{x(s,(l(s)??"")+T)},A.signal,T=>{x(Z,[...l(Z),T],!0)}),x(n,[...l(n),{role:"assistant",content:l(s)??"",toolEvents:l(Z).length>0?[...l(Z)]:void 0}],!0),x(Z,[],!0)}catch(T){if(T.name==="AbortError"){const W=l(s);W!=null&&W.trim()&&x(n,[...l(n),{role:"assistant",content:W+`
|
|
229
|
+
|
|
230
|
+
*[stopped]*`,toolEvents:l(Z).length>0?[...l(Z)]:void 0}],!0)}else x(d,T.message,!0)}finally{A=null,x(s,null),x(Z,[],!0),x(a,!1)}}}function Ci(){A==null||A.abort()}function pn(U){U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),Ki())}function nn(){x(n,[],!0),x(d,"")}const cn=["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 on(U){x(r,U,!0),_e==null||_e.focus()}var vt=QX(),Jt=Et(vt),Ni=m(Jt),zi=v(m(Ni),2);{var ui=U=>{var T=xX(),W=m(T);{var J=ae=>{var oe=oo();z(()=>O(oe,`${l(u).provider??""} · ${(l(g)||l(u).model)??""}`)),D(ae,oe)},ie=ae=>{var oe=oo("Not configured");D(ae,oe)};H(W,ae=>{l(Se)?ae(J):ae(ie,-1)})}z(()=>rn(T,"title",`Provider: ${l(u).provider??""}`)),D(U,T)};H(zi,U=>{l(u)&&U(ui)})}var fn=v(zi,2);{var hn=U=>{var T=vX();j("click",T,nn),D(U,T)};H(fn,U=>{l(n).length>0&&U(hn)})}var xn=v(Ni,2),Ye=m(xn);{var oi=U=>{var T=mX();D(U,T)},hi=U=>{var T=CX(),W=m(T),J=m(W);{var ie=Ae=>{var $e=_X(),Ce=v(Et($e)),Pe=m(Ce);z(()=>O(Pe,t().id)),D(Ae,$e)},ae=Ae=>{var $e=oo("No view selected. Ask a general sheDB view question.");D(Ae,$e)};H(J,Ae=>{t()?Ae(ie):Ae(ae,-1)})}var oe=v(W,2);li(oe,17,()=>cn,Hi,(Ae,$e)=>{var Ce=bX(),Pe=m(Ce);z(()=>O(Pe,l($e))),j("click",Ce,()=>on(l($e))),D(Ae,Ce)}),D(U,T)};H(Ye,U=>{l(Se)?l(n).length===0&&l(s)===null&&U(hi,1):U(oi)})}var Ei=v(Ye,2);li(Ei,17,()=>l(n),Hi,(U,T,W)=>{var J=AX(),ie=m(J);{var ae=Ae=>{var $e=EX(),Ce=m($e);z(()=>O(Ce,l(T).content)),D(Ae,$e)},oe=Ae=>{const $e=Rt(()=>We(l(T).content)),Ce=Rt(()=>dt(l($e)));var Pe=DX(),Ne=Et(Pe);{var ct=Ue=>{var qe=G2();li(qe,21,()=>l(T).toolEvents,Hi,(It,pt)=>{var ot=Ss(),fe=Et(ot);{var Ve=Je=>{var kt=U2(),st=v(m(kt)),rt=m(st);z(ve=>O(rt,ve),[()=>l(pt).name.replace(/_/g," ")]),D(Je,kt)},Me=Je=>{var kt=q2(),st=v(m(kt)),rt=m(st);z(ve=>O(rt,ve),[()=>l(pt).name.replace(/_/g," ")]),D(Je,kt)};H(fe,Je=>{l(pt).type==="tool_call"?Je(Ve):Je(Me,-1)})}D(It,ot)}),D(Ue,qe)};H(Ne,Ue=>{var qe;(qe=l(T).toolEvents)!=null&&qe.length&&Ue(ct)})}var ri=v(Ne,2),X=m(ri);li(X,17,()=>l($e),Hi,(Ue,qe,It)=>{var pt=Ss(),ot=Et(pt);{var fe=Me=>{var Je=K2();fc(Je,()=>At(l(qe).text),!0),D(Me,Je)},Ve=Me=>{const Je=Rt(()=>`${W}:${It}`),kt=Rt(()=>Ee(l(qe).text)),st=Rt(()=>l(p).has(l(Je))),rt=Rt(()=>l(qe).lang==="filter");var ve=wX(),Ge=m(ve),_t=m(Ge),Vt=m(_t),Ct=v(_t,2),Ot=m(Ct),bi=v(Ge,2);let $i;var Ai=m(bi),ai=m(Ai);fc(ai,()=>mt(l(qe).text,l(qe).lang??""),!0);var Mt=v(Ai,2);{var Bt=Kt=>{var Qt=yX(),Yt=m(Qt);z(()=>O(Yt,l(st)?"▲ collapse":"▼ expand")),j("click",Qt,()=>He(l(Je))),D(Kt,Qt)};H(Mt,Kt=>{l(kt)&&Kt(Bt)})}z(()=>{O(Vt,l(rt)?"filter":l(qe).lang),$i=Ft(bi,1,"code-body svelte-1twuiul",null,$i,{collapsed:l(kt)&&!l(st)})}),j("click",Ot,()=>Lt(l(qe).text)),D(Me,ve)};H(ot,Me=>{l(qe).type==="text"?Me(fe):Me(Ve,-1)})}D(Ue,pt)});var de=v(X,2);{var Ke=Ue=>{var qe=SX(),It=m(qe),pt=m(It);z(ot=>O(pt,ot),[()=>it(l(Ce))]),j("click",It,()=>e.onApplyView(l(Ce))),D(Ue,qe)},Tt=Rt(()=>Pt(l(Ce))&&e.onApplyView);H(de,Ue=>{l(Tt)&&Ue(Ke)})}D(Ae,Pe)};H(ie,Ae=>{l(T).role==="user"?Ae(ae):Ae(oe,-1)})}z(()=>Ft(J,1,`message ${l(T).role??""}`,"svelte-1twuiul")),D(U,J)});var Oi=v(Ei,2);{var Gi=U=>{var T=G2();li(T,21,()=>l(Z),Hi,(W,J)=>{var ie=Ss(),ae=Et(ie);{var oe=$e=>{var Ce=U2(),Pe=v(m(Ce)),Ne=m(Pe);z(ct=>O(Ne,ct),[()=>l(J).name.replace(/_/g," ")]),D($e,Ce)},Ae=$e=>{var Ce=q2(),Pe=v(m(Ce)),Ne=m(Pe);z(ct=>O(Ne,ct),[()=>l(J).name.replace(/_/g," ")]),D($e,Ce)};H(ae,$e=>{l(J).type==="tool_call"?$e(oe):$e(Ae,-1)})}D(W,ie)}),D(U,T)};H(Oi,U=>{l(Z).length>0&&U(Gi)})}var ji=v(Oi,2);{var K=U=>{var T=kX(),W=m(T),J=m(W),ie=m(J);z(()=>O(ie,M[l(I)])),D(U,T)};H(ji,U=>{l(a)&&l(s)===null&&l(Z).length===0&&U(K)})}var De=v(ji,2);{var at=U=>{var T=FX(),W=m(T);li(W,21,()=>be(l(s)),Hi,(J,ie)=>{var ae=Ss(),oe=Et(ae);{var Ae=Ce=>{var Pe=K2();fc(Pe,()=>At(l(ie).text),!0),D(Ce,Pe)},$e=Ce=>{var Pe=BX(),Ne=m(Pe),ct=m(Ne),ri=m(ct),X=v(Ne,2),de=m(X);fc(de,()=>mt(l(ie).text,l(ie).lang??""),!0),z(()=>O(ri,l(ie).lang)),D(Ce,Pe)};H(oe,Ce=>{l(ie).type==="text"?Ce(Ae):Ce($e,-1)})}D(J,ae)}),D(U,T)};H(De,U=>{l(s)!==null&&U(at)})}cs(xn,U=>se=U,()=>se);var Qe=v(xn,2);{var Wt=U=>{var T=LX(),W=m(T);z(()=>O(W,l(d))),D(U,T)};H(Qe,U=>{l(d)&&U(Wt)})}var si=v(Qe,2),St=m(si),et=m(St),Y=v(St,2),Ie=m(Y),le=v(Y,2),pe=m(le),ii=v(le,2),di=m(ii),ne=v(si,2),nt=m(ne);{var $t=U=>{var T=IX();let W;var J=v(m(T),2),ie=m(J),ae=v(J,2),oe=m(ae);z(()=>{W=Ft(T,1,"file-chip svelte-1twuiul",null,W,{inactive:!l(Q)}),O(ie,t().id),rn(ae,"title",l(Q)?"Remove from context":"Re-add to context"),O(oe,l(Q)?"×":"+")}),j("click",ae,()=>x(Q,!l(Q))),D(U,T)};H(nt,U=>{t()&&U($t)})}var qt=v(nt,2);li(qt,17,()=>l($),Hi,(U,T,W)=>{const J=Rt(()=>xi(l(T).name));var ie=PX(),ae=m(ie),oe=m(ae),Ae=v(ae,2),$e=m(Ae),Ce=v(Ae,2);z((Pe,Ne)=>{Ft(ae,1,`badge badge-${Pe??""}`,"svelte-1twuiul"),O(oe,Ne),O($e,l(T).name)},[()=>l(J).toLowerCase(),()=>Dt(l(J))]),j("click",Ce,()=>ci(W)),D(U,ie)});var Gt=v(qt,2),Be=v(Gt,2);cs(Be,U=>he=U,()=>he);var Xe=v(ne,2);let Zt;var ei=m(Xe);let Li;var vi=m(ei);cs(vi,U=>_e=U,()=>_e);var me=v(ei,2);{var je=U=>{var T=TX();j("click",T,Ci),D(U,T)},tt=U=>{var T=MX();z(W=>T.disabled=W,[()=>!l(r).trim()||!l(Se)]),j("click",T,Ki),D(U,T)};H(me,U=>{l(a)?U(je):U(tt,-1)})}var Le=v(Xe,2);{var ht=U=>{var T=WX(),W=m(T),J=m(W),ie=v(W,2);{var ae=Ce=>{var Pe=NX();li(Pe,21,()=>l(f),Hi,(Ne,ct)=>{var ri=RX(),X=m(ri),de={};z(()=>{O(X,l(ct)),de!==(de=l(ct))&&(ri.value=(ri.__value=l(ct))??"")}),D(Ne,ri)}),z(()=>Pe.disabled=l(a)),Ls(Pe,()=>l(g),Ne=>x(g,Ne)),D(Ce,Pe)},oe=Ce=>{var Pe=OX(),Ne=m(Pe);z(()=>O(Ne,l(g)||l(u).model)),D(Ce,Pe)};H(ie,Ce=>{l(f).length>0?Ce(ae):Ce(oe,-1)})}var Ae=v(ie,2);{var $e=Ce=>{var Pe=HX();j("click",Pe,ni),D(Ce,Pe)};H(Ae,Ce=>{l(u).provider==="ollama"&&Ce($e)})}z(()=>O(J,l(u).provider)),D(U,T)};H(Le,U=>{l(Se)&&l(u)&&U(ht)})}var gt=v(Jt,2);{var Xt=U=>{var T=YX(),W=m(T),J=m(W),ie=m(J),ae=m(ie),oe=v(ie,2),Ae=v(J,2),$e=m(Ae);{var Ce=ct=>{var ri=zX();D(ct,ri)},Pe=ct=>{var ri=VX(),X=m(ri);z(()=>O(X,l(w))),D(ct,ri)},Ne=ct=>{var ri=XX(),X=m(ri);{var de=Me=>{var Je=jX(),kt=v(Et(Je)),st=m(kt);z(()=>O(st,l(b).version)),D(Me,Je)};H(X,Me=>{l(b).version&&Me(de)})}var Ke=v(X,2);{var Tt=Me=>{var Je=$X(),kt=v(Et(Je)),st=m(kt);z(()=>O(st,l(b).details.family)),D(Me,Je)};H(Ke,Me=>{var Je;(Je=l(b).details)!=null&&Je.family&&Me(Tt)})}var Ue=v(Ke,2);{var qe=Me=>{var Je=UX(),kt=v(Et(Je)),st=m(kt);z(()=>O(st,l(b).details.parameter_size)),D(Me,Je)};H(Ue,Me=>{var Je;(Je=l(b).details)!=null&&Je.parameter_size&&Me(qe)})}var It=v(Ue,2);{var pt=Me=>{var Je=qX(),kt=v(Et(Je)),st=m(kt);z(()=>O(st,l(b).details.quantization_level)),D(Me,Je)};H(It,Me=>{var Je;(Je=l(b).details)!=null&&Je.quantization_level&&Me(pt)})}var ot=v(It,2);{var fe=Me=>{var Je=KX(),kt=v(Et(Je),2);li(kt,21,()=>l(b).running,Hi,(st,rt)=>{var ve=GX(),Ge=m(ve);z(_t=>O(Ge,`${l(rt).name??""} · ${_t??""} VRAM`),[()=>pi(l(rt).size_vram)]),D(st,ve)}),D(Me,Je)},Ve=Me=>{var Je=ZX();D(Me,Je)};H(ot,Me=>{l(b).running&&l(b).running.length>0?Me(fe):l(b).running!==null&&Me(Ve,1)})}D(ct,ri)};H($e,ct=>{l(E)?ct(Ce):l(w)?ct(Pe,1):l(b)&&ct(Ne,2)})}z(()=>{var ct;return O(ae,`Ollama · ${(l(g)||((ct=l(u))==null?void 0:ct.model))??""}`)}),j("click",T,()=>x(C,!1)),j("click",W,ct=>ct.stopPropagation()),j("click",oe,()=>x(C,!1)),D(U,T)};H(gt,U=>{l(C)&&U(Xt)})}z(U=>{O(di,U),Zt=Ft(Xe,1,"input-row svelte-1twuiul",null,Zt,{"drag-over":l(re)}),Li=Ft(ei,1,"textarea-wrap svelte-1twuiul",null,Li,{loading:l(a)}),rn(vi,"placeholder",l(Se)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),vi.disabled=l(a)||!l(Se)},[()=>pi(l(Te))]),ws(et,()=>l(R),U=>x(R,U)),ws(Ie,()=>l(P),U=>x(P,U)),ws(pe,()=>l(V),U=>x(V,U)),j("click",Gt,ze),j("change",Be,ti),xs("dragover",Xe,Ut),xs("dragleave",Xe,Bi),xs("drop",Xe,mi),j("keydown",vi,pn),Nt(vi,()=>l(r),U=>x(r,U)),D(o,vt),Ps()}Gs(["click","change","keydown"]);var eY=F('<div class="me svelte-1pxdb1"></div>');function wg(o,e){Is(e,!0);let t=Tu(e,"value",15,""),i=Tu(e,"language",3,"javascript"),n,s,r=!1;function a(){Vo.setTheme(Jh())}$s(()=>{const u=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=Vo.create(n,{value:t(),language:i(),theme:Jh(),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(_1.CtrlCmd|jk.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)}}),jp(()=>s==null?void 0:s.dispose()),Kn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var d=eY();cs(d,u=>n=u,()=>n),D(o,d),Ps()}const Z2=o=>{var e=tY();D(o,e)};var tY=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 — 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>'),iY=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>'),X2=F('<div class="form-error svelte-rrt0o"> </div>'),nY=F('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),Y2=F("<li> </li>"),Q2=F('<div class="error-bar svelte-rrt0o"> </div>'),J2=F('<div class="loading svelte-rrt0o">Loading…</div>'),sY=F('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),oY=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),rY=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>'),aY=F('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),lY=gb('<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>'),cY=gb('<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>'),dY=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),uY=F('<span class="badge-error svelte-rrt0o">error</span>'),hY=F('<span class="badge-ok svelte-rrt0o"> </span>'),fY=F('<pre class="result-error svelte-rrt0o"> </pre>'),gY=F('<pre class="result-json svelte-rrt0o"> </pre>'),pY=F('<div class="view-result-fill svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),xY=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 · 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>'),vY=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),mY=F('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),_Y=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>'),bY=F('<!> <div role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>',1);function CY(o,e){Is(e,!0);let t=B(Di([])),i=B(null),n=B("{}"),s=B(!1),r=B(null);const a="she-db-selected-view";let d=B(Di([])),u=B(Di(localStorage.getItem(a))),f=B("#"),g=B("// emit(this.someProperty)"),p=B(""),C=B(""),b=B(!1),E=B(!1),w=B(null),A=B(!1),I=B(null),M=B("she/db/view/");const R="she-db-panel";let P=B(Di(localStorage.getItem(R)??"docs")),V=B(""),$=B(!1),Q=B(null),re=B(""),he=B(!1),Z=B(null);const ce="she-db-sidebar-width";let _e=B(Di(parseInt(localStorage.getItem(ce)??"220",10))),se=!1,ue=0,Se=0;const Te="she-db-chat-width",xe="she-db-chat-open";let Oe=B(localStorage.getItem(xe)==="true"),We=B(Di(parseInt(localStorage.getItem(Te)??"320",10))),be=!1,dt=0,Pt=0;const it="she-db-map-height",yt="she-db-reduce-height";let Ee=B(Di(parseInt(localStorage.getItem(it)??"240",10))),He=B(Di(parseInt(localStorage.getItem(yt)??"160",10))),mt=!1,At=0,ft=0,Lt=!1,ni=0,pi=0;const xi=Rt(()=>l(u)?{id:l(u),filter:l(f),map:l(g),reduce:l(p)}:null);function Dt(le){le.filter!==void 0&&x(f,le.filter,!0),le.map!==void 0&&x(g,le.map,!0),le.reduce!==void 0&&x(p,le.reduce,!0)}Kn(()=>{localStorage.setItem(xe,String(l(Oe)))}),Kn(()=>{localStorage.setItem(R,l(P))}),Kn(()=>{l(u)?localStorage.setItem(a,l(u)):localStorage.removeItem(a)});function ci(le){se=!0,ue=le.clientX,Se=l(_e),le.preventDefault()}function ze(le){se&&x(_e,Math.max(140,Math.min(500,Se+le.clientX-ue)),!0),be&&x(We,Math.max(240,Math.min(600,Pt-(le.clientX-dt))),!0),mt&&x(Ee,Math.max(60,Math.min(600,ft+le.clientY-At)),!0),Lt&&x(He,Math.max(40,Math.min(400,pi+le.clientY-ni)),!0)}function we(){se&&(se=!1,localStorage.setItem(ce,String(l(_e)))),be&&(be=!1,localStorage.setItem(Te,String(l(We)))),mt&&(mt=!1,localStorage.setItem(it,String(l(Ee)))),Lt&&(Lt=!1,localStorage.setItem(yt,String(l(He))))}function ti(le){be=!0,dt=le.clientX,Pt=l(We),le.preventDefault()}async function mi(){try{x(t,await DF(),!0)}catch{}}async function Ut(){try{x(d,await AF(),!0)}catch{}}async function Bi(le){x(i,le,!0),x(r,null),x(s,!0);try{const pe=await iU(le);x(n,JSON.stringify(pe,null,2),!0)}catch(pe){x(r,pe instanceof Error?pe.message:String(pe),!0)}finally{x(s,!1)}}async function Ki(){if(l(i)){x(r,null);try{const le=JSON.parse(l(n));await p2(l(i),le)}catch(le){x(r,le instanceof Error?le.message:String(le),!0)}}}let Ci;async function pn(){if(l(i)&&await Ci.show(`Delete document "${l(i)}"?`,{confirm:"Delete",danger:!0}))try{await nU(l(i)),x(i,null),x(n,"{}")}catch(le){x(r,le instanceof Error?le.message:String(le),!0)}}async function nn(){const le=l(V).trim();if(le){x(Q,null);try{await p2(le,{}),x($,!1),x(V,""),await Bi(le)}catch(pe){x(Q,pe instanceof Error?pe.message:String(pe),!0)}}}async function cn(le){x(u,le,!0),x(I,null),x(A,!0),x(w,null);try{const pe=await sU(le);x(f,pe.filter??"",!0),x(g,pe.map,!0),x(p,pe.reduce??"",!0),x(C,pe.description??"",!0),x(b,pe.mqttpub??!1,!0),x(E,pe.retain??!1,!0),x(w,await XC(le).catch(()=>null),!0)}catch(pe){x(I,pe instanceof Error?pe.message:String(pe),!0)}finally{x(A,!1)}}async function on(){if(l(u)){x(I,null);try{const le={map:l(g)};l(f).trim()&&(le.filter=l(f).trim()),l(p).trim()&&(le.reduce=l(p).trim()),l(C).trim()&&(le.description=l(C).trim()),l(b)&&(le.mqttpub=!0),l(E)&&(le.retain=!0),await x2(l(u),le)}catch(le){x(I,le instanceof Error?le.message:String(le),!0)}}}async function vt(){if(l(u))try{x(w,await XC(l(u)),!0)}catch(le){x(I,le instanceof Error?le.message:String(le),!0)}}async function Jt(){if(l(u)&&await Ci.show(`Delete view "${l(u)}"?`,{confirm:"Delete",danger:!0}))try{await oU(l(u)),x(u,null),x(f,""),x(g,"// emit(this.someProperty)"),x(p,""),x(C,""),x(b,!1),x(E,!1),x(w,null)}catch(le){x(I,le instanceof Error?le.message:String(le),!0)}}async function Ni(){if(!l(re).trim())return;const le=l(re).trim();x(Z,null);try{await x2(le,{map:"// emit(this.someProperty)"}),x(he,!1),x(re,""),await Ut(),await cn(le)}catch(pe){x(Z,pe instanceof Error?pe.message:String(pe),!0)}}let zi=B(""),ui=B("");function fn(le){return le.includes("#")||le.includes("+")}let hn=Rt(()=>[...l(t)].filter(le=>l(zi)?fn(l(zi))?$2(le,l(zi))!==null:le.toLowerCase().includes(l(zi).toLowerCase()):!0).sort()),xn=Rt(()=>[...l(d)].filter(le=>l(ui)?fn(l(ui))?$2(le,l(ui))!==null:le.toLowerCase().includes(l(ui).toLowerCase()):!0).sort()),Ye=B(!1),oi=null;function hi(){try{navigator.clipboard.writeText(`${l(M)}${l(u)}`)}catch{}x(Ye,!0),oi&&clearTimeout(oi),oi=setTimeout(()=>x(Ye,!1),1500)}$s(()=>{mi(),Ut().then(()=>{l(u)&&l(d).includes(l(u))?cn(l(u)):x(u,null)}),Tl().then(ne=>{const nt=ne.dbPrefix||"she/db/",$t=nt.endsWith("/")?nt:nt+"/";x(M,$t+"view/")}).catch(()=>{});const le=Xo("db:ids",ne=>{x(t,ne.ids??[],!0)}),pe=Xo("db:viewIds",ne=>{x(d,ne.ids??[],!0)}),ii=Xo("db:change",async ne=>{const nt=ne.id;l(i)===nt&&(ne.doc===null?(x(i,null),x(n,"{}")):x(n,JSON.stringify(ne.doc,null,2),!0))}),di=Xo("db:viewUpdate",async ne=>{const nt=ne.id;l(u)===nt&&x(w,await XC(nt).catch(()=>null),!0)});return()=>{le(),pe(),ii(),di()}});var Ei=bY(),Oi=Et(Ei);cs(Xa(Oi,{}),le=>Ci=le,()=>Ci);var Gi=v(Oi,2);let ji;var K=m(Gi),De=m(K);let at;var Qe=v(De,2);let Wt;var si=v(Qe,2);{var St=le=>{var pe=iY();let ii;z(()=>{ii=Ft(pe,1,"ai-toggle svelte-rrt0o",null,ii,{"ai-open":l(Oe)}),rn(pe,"title",l(Oe)?"Close AI assistant":"Open AI assistant")}),j("click",pe,()=>x(Oe,!l(Oe))),D(le,pe)};H(si,le=>{l(P)==="views"&&le(St)})}var et=v(K,2);{var Y=le=>{var pe=rY(),ii=m(pe);let di;var ne=m(ii),nt=m(ne),$t=v(ne,2);{var qt=je=>{var tt=nY(),Le=Et(tt),ht=m(Le),gt=v(ht,2),Xt=v(Le,2);{var U=T=>{var W=X2(),J=m(W);z(()=>O(J,l(Q))),D(T,W)};H(Xt,T=>{l(Q)&&T(U)})}j("keydown",ht,T=>T.key==="Enter"&&nn()),Nt(ht,()=>l(V),T=>x(V,T)),j("click",gt,nn),D(je,tt)};H($t,je=>{l($)&&je(qt)})}var Gt=v($t,2),Be=m(Gt),Xe=v(Gt,2);li(Xe,20,()=>l(hn),je=>je,(je,tt)=>{var Le=Y2();let ht;var gt=m(Le);z(()=>{ht=Ft(Le,1,"flat-item svelte-rrt0o",null,ht,{"active-item":l(i)===tt}),O(gt,tt)}),j("click",Le,()=>Bi(tt)),D(je,Le)});var Zt=v(ii,2),ei=v(Zt,2),Li=m(ei);{var vi=je=>{var tt=oY(),Le=Et(tt),ht=m(Le),gt=m(ht),Xt=v(ht,2),U=v(Xt,2),T=v(Le,2);{var W=oe=>{var Ae=Q2(),$e=m(Ae);z(()=>O($e,l(r))),D(oe,Ae)};H(T,oe=>{l(r)&&oe(W)})}var J=v(T,2);{var ie=oe=>{var Ae=J2();D(oe,Ae)},ae=oe=>{var Ae=sY(),$e=m(Ae);wg($e,{language:"json",get value(){return l(n)},set value(Ce){x(n,Ce,!0)}}),D(oe,Ae)};H(J,oe=>{l(s)?oe(ie):oe(ae,-1)})}z(()=>O(gt,l(i))),j("click",Xt,Ki),j("click",U,pn),D(je,tt)},me=je=>{Z2(je)};H(Li,je=>{l(i)?je(vi):je(me,-1)})}z(()=>di=Co(ii,"",di,{width:`${l(_e)??""}px`})),j("click",nt,()=>{x($,!l($)),x(Q,null)}),Nt(Be,()=>l(zi),je=>x(zi,je)),j("mousedown",Zt,ci),D(le,pe)},Ie=le=>{var pe=_Y(),ii=m(pe);let di;var ne=m(ii),nt=m(ne),$t=v(ne,2);{var qt=Le=>{var ht=aY(),gt=Et(ht),Xt=m(gt),U=v(Xt,2),T=v(gt,2);{var W=J=>{var ie=X2(),ae=m(ie);z(()=>O(ae,l(Z))),D(J,ie)};H(T,J=>{l(Z)&&J(W)})}j("keydown",Xt,J=>J.key==="Enter"&&Ni()),Nt(Xt,()=>l(re),J=>x(re,J)),j("click",U,Ni),D(Le,ht)};H($t,Le=>{l(he)&&Le(qt)})}var Gt=v($t,2),Be=m(Gt),Xe=v(Gt,2);li(Xe,20,()=>l(xn),Le=>Le,(Le,ht)=>{var gt=Y2();let Xt;var U=m(gt);z(()=>{Xt=Ft(gt,1,"flat-item svelte-rrt0o",null,Xt,{"active-item":l(u)===ht}),O(U,ht)}),j("click",gt,()=>cn(ht)),D(Le,gt)});var Zt=v(ii,2),ei=v(Zt,2),Li=m(ei);{var vi=Le=>{var ht=vY(),gt=Et(ht),Xt=m(gt),U=m(Xt),T=v(Xt,2),W=v(T,2),J=v(W,2),ie=v(gt,2);{var ae=Ce=>{var Pe=Q2(),Ne=m(Pe);z(()=>O(Ne,l(I))),D(Ce,Pe)};H(ie,Ce=>{l(I)&&Ce(ae)})}var oe=v(ie,2);{var Ae=Ce=>{var Pe=J2();D(Ce,Pe)},$e=Ce=>{var Pe=xY(),Ne=m(Pe),ct=m(Ne),ri=v(m(ct),2),X=m(ri),de=v(ct,2),Ke=v(m(de),2),Tt=m(Ke),Ue=v(de,2),qe=v(m(Ue),2);let It;var pt=m(qe);wg(pt,{language:"javascript",onSave:on,get value(){return l(g)},set value(Ot){x(g,Ot,!0)}});var ot=v(qe,2),fe=v(Ue,2),Ve=v(m(fe),2);let Me;var Je=m(Ve);wg(Je,{language:"javascript",onSave:on,get value(){return l(p)},set value(Ot){x(p,Ot,!0)}});var kt=v(Ve,2),st=v(fe,2),rt=m(st),ve=m(rt),Ge=v(rt,2);{var _t=Ot=>{var bi=dY(),$i=Et(bi),Ai=m($i),ai=m(Ai),Mt=v(Ai,2),Bt=m(Mt);{var Kt=Ui=>{var mn=lY();D(Ui,mn)},Qt=Ui=>{var mn=cY();D(Ui,mn)};H(Bt,Ui=>{l(Ye)?Ui(Kt):Ui(Qt,-1)})}var Yt=v($i,2),Wi=m(Yt);z(()=>{O(ai,`${l(M)??""}${l(u)??""}`),rn(Mt,"title",l(Ye)?"Copied!":"Copy topic")}),j("click",Mt,hi),ws(Wi,()=>l(E),Ui=>x(E,Ui)),D(Ot,bi)};H(Ge,Ot=>{l(b)&&Ot(_t)})}var Vt=v(Ne,2);{var Ct=Ot=>{var bi=pY(),$i=m(bi),Ai=v(m($i));{var ai=Yt=>{var Wi=uY();D(Yt,Wi)},Mt=Yt=>{var Wi=hY(),Ui=m(Wi);z(()=>O(Ui,`${l(w).length??0??""} items · rev ${l(w)._rev??""}`)),D(Yt,Wi)};H(Ai,Yt=>{l(w).error?Yt(ai):Yt(Mt,-1)})}var Bt=v($i,2);{var Kt=Yt=>{var Wi=fY(),Ui=m(Wi);z(()=>O(Ui,l(w).error)),D(Yt,Wi)},Qt=Yt=>{var Wi=gY(),Ui=m(Wi);z(mn=>O(Ui,mn),[()=>JSON.stringify(l(w).result,null,2)]),D(Yt,Wi)};H(Bt,Yt=>{l(w).error?Yt(Kt):Yt(Qt,-1)})}D(Ot,bi)};H(Vt,Ot=>{l(w)&&Ot(Ct)})}z(()=>{It=Co(qe,"",It,{height:`${l(Ee)??""}px`}),Me=Co(Ve,"",Me,{height:`${l(He)??""}px`})}),Nt(X,()=>l(C),Ot=>x(C,Ot)),Nt(Tt,()=>l(f),Ot=>x(f,Ot)),j("mousedown",ot,Ot=>{mt=!0,At=Ot.clientY,ft=l(Ee),Ot.preventDefault()}),j("mousedown",kt,Ot=>{Lt=!0,ni=Ot.clientY,pi=l(He),Ot.preventDefault()}),ws(ve,()=>l(b),Ot=>x(b,Ot)),D(Ce,Pe)};H(oe,Ce=>{l(A)?Ce(Ae):Ce($e,-1)})}z(()=>O(U,l(u))),j("click",T,on),j("click",W,vt),j("click",J,Jt),D(Le,ht)},me=Le=>{Z2(Le)};H(Li,Le=>{l(u)?Le(vi):Le(me,-1)})}var je=v(ei,2);{var tt=Le=>{var ht=mY(),gt=Et(ht),Xt=v(gt,2);let U;var T=m(Xt);JX(T,{get currentView(){return l(xi)},onApplyView:Dt}),z(()=>U=Co(Xt,"",U,{width:`${l(We)??""}px`})),j("mousedown",gt,ti),D(Le,ht)};H(je,Le=>{l(Oe)&&Le(tt)})}z(()=>di=Co(ii,"",di,{width:`${l(_e)??""}px`})),j("click",nt,()=>{x(he,!l(he)),x(Z,null)}),Nt(Be,()=>l(ui),Le=>x(ui,Le)),j("mousedown",Zt,ci),D(le,pe)};H(et,le=>{l(P)==="docs"?le(Y):le(Ie,-1)})}z(()=>{ji=Ft(Gi,1,"db-root svelte-rrt0o",null,ji,{"row-dragging":mt||Lt}),at=Ft(De,1,"svelte-rrt0o",null,at,{active:l(P)==="docs"}),Wt=Ft(Qe,1,"svelte-rrt0o",null,Wt,{active:l(P)==="views"})}),j("mousemove",Gi,ze),j("mouseup",Gi,we),xs("mouseleave",Gi,we),j("click",De,()=>x(P,"docs")),j("click",Qe,()=>x(P,"views")),D(o,Ei),Ps()}Gs(["mousemove","mouseup","click","keydown","mousedown"]);var Sv={exports:{}},EY=Sv.exports,eA;function yY(){return eA||(eA=1,(function(o,e){(function(i,n){o.exports=n()})(typeof self<"u"?self:EY,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],w=0;w<p;w++)C[b+w]=s.addOrSubtractGF(C[b+w],this.field.multiply(E,g[w]));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 w=E[b],A=a.extract(p,w),I=r.decode(A.matrix);if(I)return{binaryData:I.bytes,data:I.text,chunks:I.chunks,version:I.version,location:{topRightCorner:A.mappingFunction(w.dimension,0),topLeftCorner:A.mappingFunction(0,0),bottomRightCorner:A.mappingFunction(w.dimension,w.dimension),bottomLeftCorner:A.mappingFunction(0,w.dimension),topRightFinderPattern:w.topRight,topLeftFinderPattern:w.topLeft,bottomLeftFinderPattern:w.bottomLeft,bottomRightAlignmentPattern:w.alignmentPattern}}}return null}var f={inversionAttempts:"attemptBoth"};function g(p,C,b,E){E===void 0&&(E={});var w=f;Object.keys(w||{}).forEach(function($){w[$]=E[$]||w[$]});var A=w.inversionAttempts==="attemptBoth"||w.inversionAttempts==="invertFirst",I=w.inversionAttempts==="onlyInvert"||w.inversionAttempts==="invertFirst",M=s.binarize(p,C,b,A),R=M.binarized,P=M.inverted,V=u(I?P:R);return!V&&(w.inversionAttempts==="attemptBoth"||w.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),w=0;w<p;w++)for(var A=0;A<C;A++){var I=g[(A*p+w)*4+0],M=g[(A*p+w)*4+1],R=g[(A*p+w)*4+2];E.set(w,A,.2126*I+.7152*M+.0722*R)}for(var P=Math.ceil(p/r),V=Math.ceil(C/r),$=new u(P,V),Q=0;Q<V;Q++)for(var re=0;re<P;re++){for(var he=0,Z=1/0,ce=0,A=0;A<r;A++)for(var w=0;w<r;w++){var _e=E.get(re*r+w,Q*r+A);he+=_e,Z=Math.min(Z,_e),ce=Math.max(ce,_e)}var se=he/Math.pow(r,2);if(ce-Z<=a&&(se=Z/2,Q>0&&re>0)){var ue=($.get(re,Q-1)+2*$.get(re-1,Q)+$.get(re-1,Q-1))/4;Z<ue&&(se=ue)}$.set(re,Q,se)}var Se=s.BitMatrix.createEmpty(p,C),Te=null;b&&(Te=s.BitMatrix.createEmpty(p,C));for(var Q=0;Q<V;Q++)for(var re=0;re<P;re++){for(var xe=d(re,2,P-3),Oe=d(Q,2,V-3),he=0,We=-2;We<=2;We++)for(var be=-2;be<=2;be++)he+=$.get(xe+We,Oe+be);for(var dt=he/25,We=0;We<r;We++)for(var be=0;be<r;be++){var w=re*r+We,A=Q*r+be,Pt=E.get(w,A);Se.set(w,A,Pt<=dt),b&&Te.set(w,A,!(Pt<=dt))}}return b?{binarized:Se,inverted:Te}:{binarized:Se}}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,$=0;V;)$++,V&=V-1;return $}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 $=0,Q=R.alignmentPatternCenters;$<Q.length;$++)for(var re=Q[$],he=0,Z=R.alignmentPatternCenters;he<Z.length;he++){var ce=Z[he];re===6&&ce===6||re===6&&ce===P-7||re===P-7&&ce===6||V.setRegion(re-2,ce-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 $=p[V.dataMask],Q=R.height,re=C(P),he=[],Z=0,ce=0,_e=!0,se=Q-1;se>0;se-=2){se===6&&se--;for(var ue=0;ue<Q;ue++)for(var Se=_e?Q-1-ue:ue,Te=0;Te<2;Te++){var xe=se-Te;if(!re.get(xe,Se)){ce++;var Oe=R.get(xe,Se);$({y:Se,x:xe})&&(Oe=!Oe),Z=f(Oe,Z),ce===8&&(he.push(Z),ce=0,Z=0)}}_e=!_e}return he}function E(R){var P=R.height,V=Math.floor((P-17)/4);if(V<=6)return d.VERSIONS[V-1];for(var $=0,Q=5;Q>=0;Q--)for(var re=P-9;re>=P-11;re--)$=f(R.get(re,Q),$);for(var he=0,re=5;re>=0;re--)for(var Q=P-9;Q>=P-11;Q--)he=f(R.get(re,Q),he);for(var Z=1/0,ce,_e=0,se=d.VERSIONS;_e<se.length;_e++){var ue=se[_e];if(ue.infoBits===$||ue.infoBits===he)return ue;var Se=u($,ue.infoBits);Se<Z&&(ce=ue,Z=Se),Se=u(he,ue.infoBits),Se<Z&&(ce=ue,Z=Se)}if(Z<=3)return ce}function w(R){for(var P=0,V=0;V<=8;V++)V!==6&&(P=f(R.get(V,8),P));for(var $=7;$>=0;$--)$!==6&&(P=f(R.get(8,$),P));for(var Q=R.height,re=0,$=Q-1;$>=Q-7;$--)re=f(R.get(8,$),re);for(var V=Q-8;V<Q;V++)re=f(R.get(V,8),re);for(var he=1/0,Z=null,ce=0,_e=g;ce<_e.length;ce++){var se=_e[ce],ue=se.bits,Se=se.formatInfo;if(ue===P||ue===re)return Se;var Te=u(P,ue);Te<he&&(Z=Se,he=Te),P!==re&&(Te=u(re,ue),Te<he&&(Z=Se,he=Te))}return he<=3?Z:null}function A(R,P,V){var $=P.errorCorrectionLevels[V],Q=[],re=0;if($.ecBlocks.forEach(function(Oe){for(var We=0;We<Oe.numBlocks;We++)Q.push({numDataCodewords:Oe.dataCodewordsPerBlock,codewords:[]}),re+=Oe.dataCodewordsPerBlock+$.ecCodewordsPerBlock}),R.length<re)return null;R=R.slice(0,re);for(var he=$.ecBlocks[0].dataCodewordsPerBlock,Z=0;Z<he;Z++)for(var ce=0,_e=Q;ce<_e.length;ce++){var se=_e[ce];se.codewords.push(R.shift())}if($.ecBlocks.length>1)for(var ue=$.ecBlocks[0].numBlocks,Se=$.ecBlocks[1].numBlocks,Z=0;Z<Se;Z++)Q[ue+Z].codewords.push(R.shift());for(;R.length>0;)for(var Te=0,xe=Q;Te<xe.length;Te++){var se=xe[Te];se.codewords.push(R.shift())}return Q}function I(R){var P=E(R);if(!P)return null;var V=w(R);if(!V)return null;var $=b(R,P,V),Q=A($,P,V.errorCorrectionLevel);if(!Q)return null;for(var re=Q.reduce(function(Te,xe){return Te+xe.numDataCodewords},0),he=new Uint8ClampedArray(re),Z=0,ce=0,_e=Q;ce<_e.length;ce++){var se=_e[ce],ue=a.decode(se.codewords,se.codewords.length-se.numDataCodewords);if(!ue)return null;for(var Se=0;Se<se.numDataCodewords;Se++)he[Z++]=ue[Se]}try{return r.decode(he,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 $=V+1;$<R.height;$++)R.get(V,$)!==R.get($,V)&&(R.set(V,$,!R.get(V,$)),R.set($,V,!R.get($,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,w){for(var A=[],I="",M=[10,12,14][w],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),$=Math.floor(P/10)%10,Q=P%10;A.push(48+V,48+$,48+Q),I+=V.toString()+$.toString()+Q.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),$=P%10;A.push(48+V,48+$),I+=V.toString()+$.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,w){for(var A=[],I="",M=[9,11,13][w],R=E.readBits(M);R>=2;){var P=E.readBits(11),V=Math.floor(P/45),$=P%45;A.push(f[V].charCodeAt(0),f[$].charCodeAt(0)),I+=f[V]+f[$],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,w){for(var A=[],I="",M=[8,16,16][w],R=E.readBits(M),P=0;P<R;P++){var V=E.readBits(8);A.push(V)}try{I+=decodeURIComponent(A.map(function($){return"%"+("0"+$.toString(16)).substr(-2)}).join(""))}catch{}return{bytes:A,text:I}}function C(E,w){for(var A=[],I="",M=[8,10,12][w],R=E.readBits(M),P=0;P<R;P++){var V=E.readBits(13),$=Math.floor(V/192)<<8|V%192;$<7936?$+=33088:$+=49472,A.push($>>8,$&255),I+=String.fromCharCode(r.shiftJISTable[$])}return{bytes:A,text:I}}function b(E,w){for(var A,I,M,R,P=new s.BitStream(E),V=w<=9?0:w<=26?1:2,$={text:"",bytes:[],chunks:[],version:w};P.available()>=4;){var Q=P.readBits(4);if(Q===d.Terminator)return $;if(Q===d.ECI)P.readBits(1)===0?$.chunks.push({type:a.ECI,assignmentNumber:P.readBits(7)}):P.readBits(1)===0?$.chunks.push({type:a.ECI,assignmentNumber:P.readBits(14)}):P.readBits(1)===0?$.chunks.push({type:a.ECI,assignmentNumber:P.readBits(21)}):$.chunks.push({type:a.ECI,assignmentNumber:-1});else if(Q===d.Numeric){var re=u(P,V);$.text+=re.text,(A=$.bytes).push.apply(A,re.bytes),$.chunks.push({type:a.Numeric,text:re.text})}else if(Q===d.Alphanumeric){var he=g(P,V);$.text+=he.text,(I=$.bytes).push.apply(I,he.bytes),$.chunks.push({type:a.Alphanumeric,text:he.text})}else if(Q===d.Byte){var Z=p(P,V);$.text+=Z.text,(M=$.bytes).push.apply(M,Z.bytes),$.chunks.push({type:a.Byte,bytes:Z.bytes,text:Z.text})}else if(Q===d.Kanji){var ce=C(P,V);$.text+=ce.text,(R=$.bytes).push.apply(R,ce.bytes),$.chunks.push({type:a.Kanji,bytes:ce.bytes,text:ce.text})}}if(P.available()===0||P.readBits(P.available())===0)return $}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 w=p,A=C,I=g.zero,M=g.one;A.degree()>=b/2;){var R=w,P=I;if(w=A,I=M,w.isZero())return null;A=R;for(var V=g.zero,$=w.getCoefficient(w.degree()),Q=g.inverse($);A.degree()>=w.degree()&&!A.isZero();){var re=A.degree()-w.degree(),he=g.multiply(A.getCoefficient(A.degree()),Q);V=V.addOrSubtract(g.buildMonomial(re,he)),A=A.addOrSubtract(w.multiplyByMonomial(re,he))}if(M=V.multiplyPoly(I).addOrSubtract(P),A.degree()>=w.degree())return null}var Z=M.getCoefficient(0);if(Z===0)return null;var ce=g.inverse(Z);return[M.multiply(ce),A.multiply(ce)]}function d(g,p){var C=p.degree();if(C===1)return[p.getCoefficient(1)];for(var b=new Array(C),E=0,w=1;w<g.size&&E<C;w++)p.evaluateAt(w)===0&&(b[E]=g.inverse(w),E++);return E!==C?null:b}function u(g,p,C){for(var b=C.length,E=new Array(b),w=0;w<b;w++){for(var A=g.inverse(C[w]),I=1,M=0;M<b;M++)w!==M&&(I=g.multiply(I,s.addOrSubtractGF(1,g.multiply(C[M],A))));E[w]=g.multiply(p.evaluateAt(A),g.inverse(I)),g.generatorBase!==0&&(E[w]=g.multiply(E[w],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),w=new Uint8ClampedArray(p),A=!1,I=0;I<p;I++){var M=E.evaluateAt(b.exp(I+b.generatorBase));w[w.length-1-I]=M,M!==0&&(A=!0)}if(!A)return C;var R=new r.default(b,w),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(b,P[1],V),Q=0;Q<V.length;Q++){var re=C.length-1-b.log(V[Q]);if(re<0)return null;C[re]=s.addOrSubtractGF(C[re],$[Q])}return C}i.decode=f}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.VERSIONS=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}]}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0);function r(f,g,p,C){var b=f.x-g.x+p.x-C.x,E=f.y-g.y+p.y-C.y;if(b===0&&E===0)return{a11:g.x-f.x,a12:g.y-f.y,a13:0,a21:p.x-g.x,a22:p.y-g.y,a23:0,a31:f.x,a32:f.y,a33:1};var w=g.x-p.x,A=C.x-p.x,I=g.y-p.y,M=C.y-p.y,R=w*M-A*I,P=(b*M-A*E)/R,V=(w*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),w=function(V,$){var Q=b.a13*V+b.a23*$+b.a33;return{x:(b.a11*V+b.a21*$+b.a31)/Q,y:(b.a12*V+b.a22*$+b.a32)/Q}},A=0;A<g.dimension;A++)for(var I=0;I<g.dimension;I++){var M=I+.5,R=A+.5,P=w(M,R);E.set(I,A,f.get(Math.floor(P.x),Math.floor(P.y)))}return{matrix:E,mappingFunction:w}}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,$,Q,re,he=d(M,R),Z=d(R,P),ce=d(M,P),_e,se,ue;return Z>=he&&Z>=ce?(V=[R,M,P],_e=V[0],se=V[1],ue=V[2]):ce>=Z&&ce>=he?($=[M,R,P],_e=$[0],se=$[1],ue=$[2]):(Q=[M,P,R],_e=Q[0],se=Q[1],ue=Q[2]),(ue.x-se.x)*(_e.y-se.y)-(ue.y-se.y)*(_e.x-se.x)<0&&(re=[ue,_e],_e=re[0],ue=re[1]),{bottomLeft:_e,topLeft:se,topRight:ue}}function g(M,R,P,V){var $=(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($<1)throw new Error("Invalid module size");var Q=Math.round(d(M,R)/$),re=Math.round(d(M,P)/$),he=Math.floor((Q+re)/2)+7;switch(he%4){case 0:he++;break;case 2:he--;break}return{dimension:he,moduleSize:$}}function p(M,R,P,V){var $=[{x:Math.floor(M.x),y:Math.floor(M.y)}],Q=Math.abs(R.y-M.y)>Math.abs(R.x-M.x),re,he,Z,ce;Q?(re=Math.floor(M.y),he=Math.floor(M.x),Z=Math.floor(R.y),ce=Math.floor(R.x)):(re=Math.floor(M.x),he=Math.floor(M.y),Z=Math.floor(R.x),ce=Math.floor(R.y));for(var _e=Math.abs(Z-re),se=Math.abs(ce-he),ue=Math.floor(-_e/2),Se=re<Z?1:-1,Te=he<ce?1:-1,xe=!0,Oe=re,We=he;Oe!==Z+Se;Oe+=Se){var be=Q?We:Oe,dt=Q?Oe:We;if(P.get(be,dt)!==xe&&(xe=!xe,$.push({x:be,y:dt}),$.length===V+1))break;if(ue+=se,ue>0){if(We===ce)break;We+=Te,ue-=_e}}for(var Pt=[],it=0;it<V;it++)$[it]&&$[it+1]?Pt.push(d($[it],$[it+1])):Pt.push(0);return Pt}function C(M,R,P,V){var $,Q=R.y-M.y,re=R.x-M.x,he=p(M,R,P,Math.ceil(V/2)),Z=p(M,{x:M.x-re,y:M.y-Q},P,Math.ceil(V/2)),ce=he.shift()+Z.shift()-1;return($=Z.concat(ce)).concat.apply($,he)}function b(M,R){var P=u(M)/u(R),V=0;return R.forEach(function($,Q){V+=Math.pow(M[Q]-$*P,2)}),{averageSize:P,error:V}}function E(M,R,P){try{var V=C(M,{x:-1,y:M.y},P,R.length),$=C(M,{x:M.x,y:-1},P,R.length),Q={x:Math.max(0,M.x-M.y)-1,y:Math.max(0,M.y-M.x)-1},re=C(M,Q,P,R.length),he={x:Math.min(P.width,M.x+M.y)+1,y:Math.min(P.height,M.y+M.x)+1},Z=C(M,he,P,R.length),ce=b(V,R),_e=b($,R),se=b(re,R),ue=b(Z,R),Se=Math.sqrt(ce.error*ce.error+_e.error*_e.error+se.error*se.error+ue.error*ue.error),Te=(ce.averageSize+_e.averageSize+se.averageSize+ue.averageSize)/4,xe=(Math.pow(ce.averageSize-Te,2)+Math.pow(_e.averageSize-Te,2)+Math.pow(se.averageSize-Te,2)+Math.pow(ue.averageSize-Te,2))/Te;return Se+xe}catch{return 1/0}}function w(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 $=(P+V)/2,Q=Math.round(R.y);M.get(Math.round($),Q);)Q--;for(var re=Math.round(R.y);M.get(Math.round($),re);)re++;var he=(Q+re)/2;return{x:$,y:he}}function A(M){for(var R=[],P=[],V=[],$=[],Q=function(be){for(var dt=0,Pt=!1,it=[0,0,0,0,0],yt=function(He){var mt=M.get(He,be);if(mt===Pt)dt++;else{it=[it[1],it[2],it[3],it[4],dt],dt=1,Pt=mt;var At=u(it)/7,ft=Math.abs(it[0]-At)<At&&Math.abs(it[1]-At)<At&&Math.abs(it[2]-3*At)<3*At&&Math.abs(it[3]-At)<At&&Math.abs(it[4]-At)<At&&!mt,Lt=u(it.slice(-3))/3,ni=Math.abs(it[2]-Lt)<Lt&&Math.abs(it[3]-Lt)<Lt&&Math.abs(it[4]-Lt)<Lt&&mt;if(ft){var pi=He-it[3]-it[4],xi=pi-it[2],Dt={startX:xi,endX:pi,y:be},ci=P.filter(function(ti){return xi>=ti.bottom.startX&&xi<=ti.bottom.endX||pi>=ti.bottom.startX&&xi<=ti.bottom.endX||xi<=ti.bottom.startX&&pi>=ti.bottom.endX&&it[2]/(ti.bottom.endX-ti.bottom.startX)<a&&it[2]/(ti.bottom.endX-ti.bottom.startX)>r});ci.length>0?ci[0].bottom=Dt:P.push({top:Dt,bottom:Dt})}if(ni){var ze=He-it[4],we=ze-it[3],Dt={startX:we,y:be,endX:ze},ci=$.filter(function(Ut){return we>=Ut.bottom.startX&&we<=Ut.bottom.endX||ze>=Ut.bottom.startX&&we<=Ut.bottom.endX||we<=Ut.bottom.startX&&ze>=Ut.bottom.endX&&it[2]/(Ut.bottom.endX-Ut.bottom.startX)<a&&it[2]/(Ut.bottom.endX-Ut.bottom.startX)>r});ci.length>0?ci[0].bottom=Dt:$.push({top:Dt,bottom:Dt})}}},Ee=-1;Ee<=M.width;Ee++)yt(Ee);R.push.apply(R,P.filter(function(He){return He.bottom.y!==be&&He.bottom.y-He.top.y>=2})),P=P.filter(function(He){return He.bottom.y===be}),V.push.apply(V,$.filter(function(He){return He.bottom.y!==be})),$=$.filter(function(He){return He.bottom.y===be})},re=0;re<=M.height;re++)Q(re);R.push.apply(R,P.filter(function(be){return be.bottom.y-be.top.y>=2})),V.push.apply(V,$);var he=R.filter(function(be){return be.bottom.y-be.top.y>=2}).map(function(be){var dt=(be.top.startX+be.top.endX+be.bottom.startX+be.bottom.endX)/4,Pt=(be.top.y+be.bottom.y+1)/2;if(M.get(Math.round(dt),Math.round(Pt))){var it=[be.top.endX-be.top.startX,be.bottom.endX-be.bottom.startX,be.bottom.y-be.top.y+1],yt=u(it)/it.length,Ee=E({x:Math.round(dt),y:Math.round(Pt)},[1,1,3,1,1],M);return{score:Ee,x:dt,y:Pt,size:yt}}}).filter(function(be){return!!be}).sort(function(be,dt){return be.score-dt.score}).map(function(be,dt,Pt){if(dt>s)return null;var it=Pt.filter(function(Ee,He){return dt!==He}).map(function(Ee){return{x:Ee.x,y:Ee.y,score:Ee.score+Math.pow(Ee.size-be.size,2)/be.size,size:Ee.size}}).sort(function(Ee,He){return Ee.score-He.score});if(it.length<2)return null;var yt=be.score+it[0].score+it[1].score;return{points:[be].concat(it.slice(0,2)),score:yt}}).filter(function(be){return!!be}).sort(function(be,dt){return be.score-dt.score});if(he.length===0)return null;var Z=f(he[0].points[0],he[0].points[1],he[0].points[2]),ce=Z.topRight,_e=Z.topLeft,se=Z.bottomLeft,ue=I(M,V,ce,_e,se),Se=[];ue&&Se.push({alignmentPattern:{x:ue.alignmentPattern.x,y:ue.alignmentPattern.y},bottomLeft:{x:se.x,y:se.y},dimension:ue.dimension,topLeft:{x:_e.x,y:_e.y},topRight:{x:ce.x,y:ce.y}});var Te=w(M,ce),xe=w(M,_e),Oe=w(M,se),We=I(M,V,Te,xe,Oe);return We&&Se.push({alignmentPattern:{x:We.alignmentPattern.x,y:We.alignmentPattern.y},bottomLeft:{x:Oe.x,y:Oe.y},topLeft:{x:xe.x,y:xe.y},topRight:{x:Te.x,y:Te.y},dimension:We.dimension}),Se.length===0?null:Se}i.locate=A;function I(M,R,P,V,$){var Q,re,he;try{Q=g(V,P,$,M),re=Q.dimension,he=Q.moduleSize}catch{return null}var Z={x:P.x-V.x+$.x,y:P.y-V.y+$.y},ce=(d(V,$)+d(V,P))/2/he,_e=1-3/ce,se={x:V.x+_e*(Z.x-V.x),y:V.y+_e*(Z.y-V.y)},ue=R.map(function(Te){var xe=(Te.top.startX+Te.top.endX+Te.bottom.startX+Te.bottom.endX)/4,Oe=(Te.top.y+Te.bottom.y+1)/2;if(M.get(Math.floor(xe),Math.floor(Oe))){var We=[Te.top.endX-Te.top.startX,Te.bottom.endX-Te.bottom.startX,Te.bottom.y-Te.top.y+1];u(We)/We.length;var be=E({x:Math.floor(xe),y:Math.floor(Oe)},[1,1,1],M),dt=be+d({x:xe,y:Oe},se);return{x:xe,y:Oe,score:dt}}}).filter(function(Te){return!!Te}).sort(function(Te,xe){return Te.score-xe.score}),Se=ce>=15&&ue.length?ue[0]:se;return{alignmentPattern:Se,dimension:re}}})]).default})})(Sv)),Sv.exports}var wY=yY();const SY=mS(wY);var DY=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),AY=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),tA=F('<p class="err svelte-1ua3isv"> </p>'),kY=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>'),BY=F('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),FY=F('<span class="device-name svelte-1ua3isv"> </span>'),LY=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>'),IY=F('<li class="empty svelte-1ua3isv">No paired devices</li>'),PY=F('<p class="info svelte-1ua3isv">Loading…</p>'),TY=F('<p class="device-subtitle svelte-1ua3isv"> </p>'),MY=F('<span class="ep-chip svelte-1ua3isv"> </span>'),RY=F('<span class="attr-id svelte-1ua3isv"> </span>'),NY=F('<button class="attr-action-btn svelte-1ua3isv"> </button>'),OY=F('<div class="attr-actions svelte-1ua3isv"></div>'),HY=F('<span class="cmd-sep svelte-1ua3isv">,</span>'),WY=F('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),zY=F('<span class="cmd-id svelte-1ua3isv"> </span>'),VY=F("<!> <!>",1),jY=F('<span class="cmd-list svelte-1ua3isv"></span>'),$Y=F(' <span class="cmd-id svelte-1ua3isv"> </span>',1),UY=F('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),qY=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>'),GY=F('<th class="svelte-1ua3isv"> </th>'),KY=F('<td class="svelte-1ua3isv"> </td>'),ZY=F('<tr class="svelte-1ua3isv"></tr>'),XY=F('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),YY=F('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),QY=F('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),JY=F('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),eQ=F('<span class="attr-val svelte-1ua3isv"> </span>'),tQ=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>'),iQ=F('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),nQ=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>'),sQ=F('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),oQ=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>'),rQ=F('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),aQ=F('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),lQ=F('<span class="stream-badge svelte-1ua3isv"> </span>'),cQ=F('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),e1=F(' <span class="e-sub svelte-1ua3isv"> </span>',1),dQ=F('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),uQ=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),hQ=F('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),fQ=F('<div class="stream-body svelte-1ua3isv"><!></div>'),gQ=F('<p class="scan-err svelte-1ua3isv"> </p>'),pQ=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),xQ=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),vQ=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 mQ(o,e){Is(e,!0);const t={onOff:{onOff:[{label:"On",command:"on"},{label:"Off",command:"off"},{label:"Toggle",command:"toggle"}]},levelControl:{currentLevel:[{label:"Step ▲",command:"stepWithOnOff",args:{stepMode:0,stepSize:25,transitionTime:5}},{label:"Step ▼",command:"stepWithOnOff",args:{stepMode:1,stepSize:25,transitionTime:5}}]},windowCovering:{currentPositionLiftPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}],currentPositionTiltPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}]}};async function i(Y,Ie,le,pe,ii){try{await vU(Y,Ie,le,pe,ii)}catch(di){console.error("matter command failed",di)}}const n={identify:{0:"identify",1:"triggerEffect"},groups:{0:"addGroup",1:"viewGroup",2:"getGroupMembership",3:"removeGroup",4:"removeAllGroups",5:"addGroupIfIdentifying"},scenes:{0:"addScene",1:"viewScene",2:"removeScene",3:"removeAllScenes",4:"storeScene",5:"recallScene",6:"getSceneMembership",64:"enhancedAddScene",65:"enhancedViewScene",66:"copyScene"},onOff:{0:"off",1:"on",2:"toggle",64:"offWithEffect",65:"onWithRecallGlobalScene",66:"onWithTimedOff"},levelControl:{0:"moveToLevel",1:"move",2:"step",3:"stop",4:"moveToLevelWithOnOff",5:"moveWithOnOff",6:"stepWithOnOff",7:"stopWithOnOff",8:"moveToClosestFrequency"},colorControl:{0:"moveToHue",1:"moveHue",2:"stepHue",3:"moveToSaturation",4:"moveSaturation",5:"stepSaturation",6:"moveToHueAndSaturation",7:"moveToColor",8:"moveColor",9:"stepColor",10:"moveToColorTemperature",64:"enhancedMoveToHue",65:"enhancedMoveHue",66:"enhancedStepHue",67:"enhancedMoveToHueAndSaturation",68:"colorLoopSet",71:"stopMoveStep",75:"moveColorTemperature",76:"stepColorTemperature"},thermostat:{0:"setpointRaiseLower",1:"setWeeklySchedule",2:"getWeeklySchedule",3:"clearWeeklySchedule"},doorLock:{0:"lockDoor",1:"unlockDoor",3:"unlockWithTimeout",11:"setWeekDaySchedule",12:"getWeekDaySchedule",13:"clearWeekDaySchedule",14:"setYearDaySchedule",15:"getYearDaySchedule",16:"clearYearDaySchedule",17:"setHolidaySchedule",18:"getHolidaySchedule",19:"clearHolidaySchedule",26:"setUser",27:"getUser",28:"clearUser",34:"setCredential",36:"getCredential",38:"clearCredential"},windowCovering:{0:"upOrOpen",1:"downOrClose",2:"stopMotion",4:"goToLiftValue",5:"goToLiftPercentage",7:"goToTiltValue",8:"goToTiltPercentage"},fanControl:{0:"step"}};function s(Y,Ie){const le=n[Y];return Ie.map(pe=>{const ii=typeof pe=="number"?pe:Number(pe);return{id:ii,name:(le==null?void 0:le[ii])??null}})}const r={10:"Door Lock",11:"Door Lock Controller",14:"Aggregator",15:"Generic Switch",17:"On/Off Plug-In Unit",18:"Dimmable Plug-In Unit",19:"Pump",20:"On/Off Light Switch",21:"Dimmer Switch",22:"Color Dimmer Switch",23:"Control Bridge",24:"Pump Controller",256:"On/Off Light",257:"Dimmable Light",268:"Extended Color Light",269:"Color Temperature Light",262:"Light Sensor",263:"Occupancy Sensor",514:"Window Covering",515:"Window Covering Controller",768:"Heating/Cooling Unit",769:"Thermostat",770:"Temperature Sensor",771:"Pressure Sensor",772:"Flow Sensor",773:"Humidity Sensor",774:"On/Off Sensor",2112:"Air Quality Sensor"},a={generatedCommandList:65528,acceptedCommandList:65529,eventList:65530,attributeList:65531,featureMap:65532,clusterRevision:65533},d={descriptor:{deviceTypeList:0,serverList:1,clientList:2,partsList:3,tagList:4},basicInformation:{dataModelRevision:0,vendorName:1,vendorID:2,vendorId:2,productName:3,productID:4,productId:4,nodeLabel:5,location:6,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,localConfigDisabled:16,reachable:17,uniqueID:18,uniqueId:18,capabilityMinima:19,productAppearance:20,specificationVersion:21,maxPathsPerInvoke:22},bridgedDeviceBasicInformation:{vendorName:1,vendorID:2,vendorId:2,productName:3,productId:4,nodeLabel:5,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,reachable:17,uniqueID:18,uniqueId:18,productAppearance:20},identify:{identifyTime:0,identifyType:1},groups:{nameSupport:0},onOff:{onOff:0,globalSceneControl:16384,onTime:16385,offWaitTime:16386,startUpOnOff:16387},levelControl:{currentLevel:0,remainingTime:1,minLevel:2,maxLevel:3,currentFrequency:4,minFrequency:5,maxFrequency:6,options:15,onOffTransitionTime:16,onLevel:17,onTransitionTime:18,offTransitionTime:19,defaultMoveRate:20,startUpCurrentLevel:16384},colorControl:{currentHue:0,currentSaturation:1,remainingTime:2,currentX:3,currentY:4,colorTemperatureMireds:7,colorMode:8,options:15,enhancedCurrentHue:16384,enhancedColorMode:16385,colorLoopActive:16386,colorLoopDirection:16387,colorLoopTime:16388,colorCapabilities:16394,colorTempPhysicalMinMireds:16395,colorTempPhysicalMaxMireds:16396,coupleColorTempToLevelMinMireds:16397,startUpColorTemperatureMireds:16400},thermostat:{localTemperature:0,outdoorTemperature:1,occupancy:2,absMinHeatSetpointLimit:3,absMaxHeatSetpointLimit:4,absMinCoolSetpointLimit:5,absMaxCoolSetpointLimit:6,piCoolingDemand:7,piHeatingDemand:8,localTemperatureCalibration:16,occupiedCoolingSetpoint:17,occupiedHeatingSetpoint:18,unoccupiedCoolingSetpoint:19,unoccupiedHeatingSetpoint:20,minHeatSetpointLimit:21,maxHeatSetpointLimit:22,minCoolSetpointLimit:23,maxCoolSetpointLimit:24,minSetpointDeadBand:25,remoteSensing:26,controlSequenceOfOperation:27,systemMode:28,thermostatRunningMode:30,startOfWeek:32,numberOfWeeklyTransitions:33,numberOfDailyTransitions:34,temperatureSetpointHold:35,temperatureSetpointHoldDuration:36,thermostatProgrammingOperationMode:37,thermostatRunningState:41,setpointChangeSource:48,setpointChangeAmount:49,setpointChangeSourceTimestamp:50,occupiedSetback:52,unoccupiedSetback:55,emergencyHeatDelta:58},windowCovering:{type:0,physicalClosedLimitLift:1,physicalClosedLimitTilt:2,currentPositionLift:3,currentPositionTilt:4,numberOfActuationsLift:5,numberOfActuationsTilt:6,configStatus:7,currentPositionLiftPercentage:8,currentPositionTiltPercentage:9,operationalStatus:10,targetPositionLiftPercent100ths:11,targetPositionTiltPercent100ths:12,endProductType:13,currentPositionLiftPercent100ths:14,currentPositionTiltPercent100ths:15,installedOpenLimitLift:16,installedClosedLimitLift:17,installedOpenLimitTilt:18,installedClosedLimitTilt:19,mode:23,safetyStatus:26},doorLock:{lockState:0,lockType:1,actuatorEnabled:2,doorState:3,numberOfTotalUsersSupported:17,numberOfPINUsersSupported:18,maxPINCodeLength:23,minPINCodeLength:24,language:33,autoRelockTime:35,soundVolume:36,operatingMode:37,supportedOperatingModes:38,wrongCodeEntryLimit:48},fanControl:{fanMode:0,fanModeSequence:1,percentSetting:2,percentCurrent:3,speedMax:4,speedSetting:5,speedCurrent:6,rockSupport:7,rockSetting:8,windSupport:9,windSetting:10,airflowDirectionSupport:11,airflowDirection:12},occupancySensing:{occupancy:0,occupancySensorType:1,occupancySensorTypeBitmap:2,holdTime:3,pirOccupiedToUnoccupiedDelay:16,pirUnoccupiedToOccupiedDelay:17},illuminanceMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,lightSensorType:4},temperatureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},pressureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,scaledValue:16,minScaledValue:17,maxScaledValue:18,scale:20},flowMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},relativeHumidityMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},powerSource:{status:0,order:1,description:2,batVoltage:11,batPercentRemaining:12,batTimeRemaining:13,batChargeLevel:14,batReplacementNeeded:15,batReplaceability:16,batPresent:17,activeBatFaults:18,batChargeState:26}};function u(Y){return"0x"+Y.toString(16).toUpperCase().padStart(4,"0")}let f=B(Di([])),g=Di(new Map);function p(Y){if(Y==null)return"—";if(typeof Y=="boolean"||typeof Y=="number")return String(Y);if(typeof Y=="string")return Y.length>50?Y.slice(0,47)+"…":Y;const Ie=JSON.stringify(Y);return Ie.length>60?Ie.slice(0,57)+"…":Ie}function C(Y){return Y==null?"—":typeof Y=="boolean"||typeof Y=="number"?String(Y):typeof Y=="string"?Y:JSON.stringify(Y)}function b(Y){return Y!==null&&typeof Y=="object"&&!Array.isArray(Y)}function E(Y){return Array.isArray(Y)&&Y.length>0&&Y.every(b)}function w(Y,Ie){return!!(Ie==="attributeList"||Array.isArray(Y)&&Y.length===0||b(Y)&&Object.keys(Y).length===0)}function A(Y){return new Date(Y).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const I=500,M=20,R=32;let P=0,V=B(Di([])),$=B(!0),Q=B(180),re=Rt(()=>{const Y=Math.max(1,Math.floor((l(Q)-R)/M)+1);return l(V).slice(0,Y)});function he(Y){Y.preventDefault();const Ie=Y.clientY,le=l(Q);function pe(di){x(Q,Math.max(60,Math.min(600,le+Ie-di.clientY)),!0)}function ii(){document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",ii)}document.addEventListener("mousemove",pe),document.addEventListener("mouseup",ii)}let Z=B(null),ce=B(!1),_e=B(null),se=B(!1),ue=B("passcode"),Se=B(""),Te=B(""),xe=B(""),Oe=B(!1),We=B(null),be=B(""),dt=B(!1),Pt=B(""),it=B(void 0),yt=B(void 0),Ee=null,He=null;function mt(){He!==null&&(cancelAnimationFrame(He),He=null),Ee&&(Ee.getTracks().forEach(Y=>Y.stop()),Ee=null),x(dt,!1),x(Pt,"")}function At(Y){mt(),x(ue,"pairingCode"),x(xe,Y,!0)}function ft(){if(!l(yt))return null;const Y=l(yt).getContext("2d",{willReadFrequently:!0}),{width:Ie,height:le}=l(yt);if(!Ie||!le)return null;const pe=Y.getImageData(0,0,Ie,le);return SY(pe.data,pe.width,pe.height,{inversionAttempts:"dontInvert"})}async function Lt(){if(x(dt,!0),x(Pt,""),await fl(),!l(it)||!l(yt))return;try{Ee=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}),l(it).srcObject=Ee,await l(it).play()}catch(Ie){x(Pt,"Camera unavailable: "+(Ie instanceof Error?Ie.message:String(Ie)));return}const Y=()=>{var Ie;if(!(!l(it)||!l(yt)||!Ee)){if(l(it).readyState===l(it).HAVE_ENOUGH_DATA){l(yt).width=l(it).videoWidth,l(yt).height=l(it).videoHeight,l(yt).getContext("2d",{willReadFrequently:!0}).drawImage(l(it),0,0);const pe=ft();if((Ie=pe==null?void 0:pe.data)!=null&&Ie.startsWith("MT:")){At(pe.data);return}}He=requestAnimationFrame(Y)}};He=requestAnimationFrame(Y)}function ni(Y){var pe;const Ie=(pe=Y.target.files)==null?void 0:pe[0];if(!Ie)return;const le=new FileReader;le.onload=ii=>{const di=new Image;di.onload=()=>{var $t;if(!l(yt))return;l(yt).width=di.width,l(yt).height=di.height,l(yt).getContext("2d",{willReadFrequently:!0}).drawImage(di,0,0);const nt=ft();($t=nt==null?void 0:nt.data)!=null&&$t.startsWith("MT:")?At(nt.data):x(Pt,"No Matter QR code found in image.")},di.src=ii.target.result},le.readAsDataURL(Ie)}const pi="she:matter:selectedNodeId";async function xi(){try{x(f,await gS(),!0);for(const Y of l(f))Cv(Y.nodeId).then(Ie=>{g.set(Y.nodeId,Ie)}).catch(()=>{});if(l(f).length>0&&!l(Z)){const Y=localStorage.getItem(pi),Ie=Y&&l(f).find(le=>le.nodeId===Y)?Y:l(f)[0].nodeId;Dt(Ie)}}catch{x(f,[],!0)}}async function Dt(Y){x(ce,!0),x(_e,null);try{x(Z,await Cv(Y),!0),g.set(Y,l(Z)),localStorage.setItem(pi,Y)}catch(Ie){x(_e,Ie instanceof Error?Ie.message:String(Ie),!0)}finally{x(ce,!1)}}let ci;async function ze(Y){var Ie;if(await ci.show(`Unpair device ${Y}?`,{confirm:"Unpair",danger:!0}))try{await xU(Y),((Ie=l(Z))==null?void 0:Ie.nodeId)===Y&&x(Z,null),await xi()}catch(le){x(_e,le instanceof Error?le.message:String(le),!0)}}async function we(){x(Oe,!0),x(We,null);try{let Y;l(ue)==="passcode"?(Y={passcode:Number(l(Se))},l(Te)&&(Y={...Y,discriminator:Number(l(Te))})):Y={pairingCode:l(xe).trim()},l(be).trim()&&(Y={...Y,discoveryAddress:l(be).trim()}),await pU(Y),x(se,!1),x(Se,""),x(Te,""),x(xe,""),x(be,""),await xi()}catch(Y){x(We,Y instanceof Error?Y.message:String(Y),!0)}finally{x(Oe,!1)}}$s(()=>{xi()});const ti=Xo("matter:deviceList",Y=>{if(!Array.isArray(Y.devices))return;const Ie=Y.devices;for(const le of Ie)g.has(le.nodeId)||Cv(le.nodeId).then(pe=>{g.set(le.nodeId,pe)}).catch(()=>{});x(f,Ie,!0)}),mi=Xo("matter:deviceStatus",Y=>{if(Y.nodeId===void 0)return;const Ie=String(Y.nodeId),le=!!Y.online;x(f,l(f).map(pe=>pe.nodeId===Ie?{...pe,online:le}:pe),!0),x(V,[{id:P++,kind:"status",nodeId:Ie,online:le,ts:Date.now()},...l(V).slice(0,I-1)],!0)}),Ut=Xo("matter:attr",Y=>{const Ie=String(Y.nodeId),le=Y.endpointId,pe=String(Y.clusterName),ii=String(Y.attrName),di=Y.value;if(l(Z)&&l(Z).nodeId===Ie){const nt=l(Z).endpoints.find(qt=>qt.endpointId===le),$t=nt==null?void 0:nt.clusters.find(qt=>qt.name===pe);$t&&($t.attrs[ii]=di)}const ne=g.get(Ie);if(ne){const nt=ne.endpoints.find(qt=>qt.endpointId===le),$t=nt==null?void 0:nt.clusters.find(qt=>qt.name===pe);$t&&($t.attrs[ii]=di)}x(V,[{id:P++,kind:"attr",nodeId:Ie,endpointId:le,clusterName:pe,attrName:ii,value:di,ts:Y.ts??Date.now()},...l(V).slice(0,I-1)],!0)});jp(()=>{ti(),mi(),Ut(),mt()});var Bi=vQ(),Ki=Et(Bi);cs(Xa(Ki,{}),Y=>ci=Y,()=>ci);var Ci=v(Ki,2),pn=m(Ci),nn=m(pn),cn=m(nn),on=v(m(cn),2),vt=v(cn,2);{var Jt=Y=>{var Ie=kY(),le=m(Ie),pe=m(le);let ii;var di=v(pe,2);let ne;var nt=v(le,2);{var $t=vi=>{var me=DY(),je=Et(me),tt=v(m(je)),Le=v(je,2),ht=v(m(Le));Nt(tt,()=>l(Se),gt=>x(Se,gt)),Nt(ht,()=>l(Te),gt=>x(Te,gt)),D(vi,me)},qt=vi=>{var me=AY(),je=Et(me),tt=v(m(je)),Le=v(je,2),ht=m(Le),gt=v(ht,2),Xt=v(m(gt),2);Nt(tt,()=>l(xe),U=>x(xe,U)),j("click",ht,Lt),j("change",Xt,ni),D(vi,me)};H(nt,vi=>{l(ue)==="passcode"?vi($t):vi(qt,-1)})}var Gt=v(nt,2),Be=v(m(Gt)),Xe=v(Gt,2);{var Zt=vi=>{var me=tA(),je=m(me);z(()=>O(je,l(We))),D(vi,me)};H(Xe,vi=>{l(We)&&vi(Zt)})}var ei=v(Xe,2),Li=m(ei);z(()=>{ii=Ft(pe,1,"svelte-1ua3isv",null,ii,{active:l(ue)==="passcode"}),ne=Ft(di,1,"svelte-1ua3isv",null,ne,{active:l(ue)==="pairingCode"}),ei.disabled=l(Oe),O(Li,l(Oe)?"Commissioning…":"Commission")}),j("click",pe,()=>x(ue,"passcode")),j("click",di,()=>x(ue,"pairingCode")),Nt(Be,()=>l(be),vi=>x(be,vi)),j("click",ei,we),D(Y,Ie)};H(vt,Y=>{l(se)&&Y(Jt)})}var Ni=v(vt,2),zi=m(Ni);li(zi,17,()=>l(f),Y=>Y.nodeId,(Y,Ie)=>{var le=LY();let pe;var ii=m(le),di=m(ii);let ne;var nt=v(di,2),$t=m(nt);{var qt=Xe=>{var Zt=BY(),ei=Et(Zt),Li=m(ei),vi=v(ei,2),me=m(vi);z(()=>{O(Li,l(Ie).name),O(me,`#${l(Ie).nodeId??""}`)}),D(Xe,Zt)},Gt=Xe=>{var Zt=FY(),ei=m(Zt);z(()=>O(ei,`Node ${l(Ie).nodeId??""}`)),D(Xe,Zt)};H($t,Xe=>{l(Ie).name?Xe(qt):Xe(Gt,-1)})}var Be=v(ii,2);z(()=>{var Xe;pe=Ft(le,1,"svelte-1ua3isv",null,pe,{selected:((Xe=l(Z))==null?void 0:Xe.nodeId)===l(Ie).nodeId}),ne=Ft(di,1,"status-dot svelte-1ua3isv",null,ne,{online:l(Ie).online})}),j("click",ii,()=>Dt(l(Ie).nodeId)),j("click",Be,()=>ze(l(Ie).nodeId)),D(Y,le)});var ui=v(zi,2);{var fn=Y=>{var Ie=IY();D(Y,Ie)};H(ui,Y=>{l(f).length===0&&Y(fn)})}var hn=v(nn,2),xn=m(hn);{var Ye=Y=>{var Ie=PY();D(Y,Ie)},oi=Y=>{var Ie=tA(),le=m(Ie);z(()=>O(le,l(_e))),D(Y,Ie)},hi=Y=>{var Ie=rQ(),le=Et(Ie),pe=m(le),ii=m(pe),di=v(pe,2);{var ne=Gt=>{var Be=TY(),Xe=m(Be);z(()=>O(Xe,l(Z).subtitle)),D(Gt,Be)};H(di,Gt=>{l(Z).subtitle&&Gt(ne)})}var nt=v(di,2),$t=m(nt),qt=v(le,2);li(qt,17,()=>l(Z).endpoints,Gt=>Gt.endpointId,(Gt,Be)=>{var Xe=oQ(),Zt=m(Xe),ei=m(Zt),Li=v(ei),vi=m(Li),me=v(Li,2);li(me,21,()=>l(Be).clusters,Hi,(ht,gt)=>{var Xt=MY(),U=m(Xt);z(()=>O(U,l(gt).name)),D(ht,Xt)});var je=v(Zt,2);{var tt=ht=>{var gt=nQ(),Xt=v(m(gt));li(Xt,21,()=>l(Be).clusters,Hi,(U,T)=>{var W=iQ(),J=Et(W),ie=m(J),ae=m(ie),oe=v(J,2);li(oe,17,()=>Object.entries(l(T).attrs),Hi,(Ae,$e)=>{var Ce=Rt(()=>f8(l($e),2));let Pe=()=>l(Ce)[0],Ne=()=>l(Ce)[1];var ct=Ss(),ri=Et(ct);{var X=Ke=>{const Tt=Rt(()=>{var Mt;return(Mt=t[l(T).name])==null?void 0:Mt[Pe()]}),Ue=Rt(()=>(Pe()==="acceptedCommandList"||Pe()==="generatedCommandList")&&Array.isArray(Ne())),qe=Rt(()=>{var Mt;return((Mt=d[l(T).name])==null?void 0:Mt[Pe()])??a[Pe()]});var It=tQ(),pt=m(It),ot=m(pt),fe=m(ot),Ve=v(ot);{var Me=Mt=>{var Bt=RY(),Kt=m(Bt);z(Qt=>O(Kt,`(${Qt??""})`),[()=>u(l(qe))]),D(Mt,Bt)};H(Ve,Mt=>{l(qe)!==void 0&&Mt(Me)})}var Je=v(pt),kt=m(Je);{var st=Mt=>{var Bt=OY();li(Bt,21,()=>l(Tt),Hi,(Kt,Qt)=>{var Yt=NY(),Wi=m(Yt);z(()=>O(Wi,l(Qt).label)),j("click",Yt,()=>i(l(Z).nodeId,l(Be).endpointId,l(T).name,l(Qt).command,l(Qt).args)),D(Kt,Yt)}),D(Mt,Bt)};H(kt,Mt=>{l(Tt)&&Mt(st)})}var rt=v(Je),ve=m(rt);{var Ge=Mt=>{var Bt=jY();li(Bt,21,()=>s(l(T).name,Ne()),Hi,(Kt,Qt,Yt)=>{var Wi=VY(),Ui=Et(Wi);{var mn=In=>{var es=HY();D(In,es)};H(Ui,In=>{Yt>0&&In(mn)})}var Vi=v(Ui,2);{var An=In=>{var es=WY(),Ji=Et(es),Ts=m(Ji),Tn=v(Ji),Gn=m(Tn);z(()=>{O(Ts,l(Qt).name),O(Gn,`(${l(Qt).id??""})`)}),D(In,es)},Jn=In=>{var es=zY(),Ji=m(es);z(()=>O(Ji,l(Qt).id)),D(In,es)};H(Vi,In=>{l(Qt).name?In(An):In(Jn,-1)})}D(Kt,Wi)}),D(Mt,Bt)},_t=Mt=>{var Bt=qY(),Kt=v(m(Bt));li(Kt,21,Ne,Hi,(Qt,Yt)=>{const Wi=Rt(()=>l(Yt)),Ui=Rt(()=>l(Wi).deviceType),mn=Rt(()=>r[l(Ui)]);var Vi=UY(),An=m(Vi),Jn=m(An);{var In=Tn=>{var Gn=$Y(),ms=Et(Gn),ir=v(ms),zr=m(ir);z(Ya=>{O(ms,`${l(mn)??""} `),O(zr,`(${Ya??""})`)},[()=>u(l(Ui))]),D(Tn,Gn)},es=Tn=>{var Gn=oo();z(ms=>O(Gn,ms),[()=>u(l(Ui))]),D(Tn,Gn)};H(Jn,Tn=>{l(mn)?Tn(In):Tn(es,-1)})}var Ji=v(An),Ts=m(Ji);z(Tn=>O(Ts,Tn),[()=>C(l(Wi).revision)]),D(Qt,Vi)}),D(Mt,Bt)},Vt=Rt(()=>Pe()==="deviceTypeList"&&Array.isArray(Ne())),Ct=Mt=>{const Bt=Rt(()=>[...new Set(Ne().flatMap(Ui=>Object.keys(Ui)))]);var Kt=XY(),Qt=m(Kt),Yt=m(Qt);li(Yt,21,()=>l(Bt),Hi,(Ui,mn)=>{var Vi=GY(),An=m(Vi);z(()=>O(An,l(mn))),D(Ui,Vi)});var Wi=v(Qt);li(Wi,21,Ne,Hi,(Ui,mn)=>{var Vi=ZY();li(Vi,21,()=>l(Bt),Hi,(An,Jn)=>{var In=KY(),es=m(In);z(Ji=>O(es,Ji),[()=>C(l(mn)[l(Jn)])]),D(An,In)}),D(Ui,Vi)}),D(Mt,Kt)},Ot=Rt(()=>E(Ne())),bi=Mt=>{var Bt=QY(),Kt=m(Bt);li(Kt,21,()=>Object.entries(Ne()),Hi,(Qt,Yt)=>{var Wi=Rt(()=>f8(l(Yt),2));let Ui=()=>l(Wi)[0],mn=()=>l(Wi)[1];var Vi=YY(),An=m(Vi),Jn=m(An),In=v(An),es=m(In);z(Ji=>{O(Jn,Ui()),O(es,Ji)},[()=>C(mn())]),D(Qt,Vi)}),D(Mt,Bt)},$i=Rt(()=>b(Ne())),Ai=Mt=>{var Bt=JY(),Kt=m(Bt);z(()=>{rn(Bt,"href",Ne()),O(Kt,Ne())}),D(Mt,Bt)},ai=Mt=>{var Bt=eQ(),Kt=m(Bt);z(Qt=>O(Kt,Qt),[()=>C(Ne())]),D(Mt,Bt)};H(ve,Mt=>{l(Ue)?Mt(Ge):l(Vt)?Mt(_t,1):l(Ot)?Mt(Ct,2):l($i)?Mt(bi,3):(Pe()==="productUrl"||Pe()==="productURL")&&typeof Ne()=="string"?Mt(Ai,4):Mt(ai,-1)})}z(()=>{rn(pt,"title",Pe()),O(fe,Pe())}),D(Ke,It)},de=Rt(()=>!w(Ne(),Pe()));H(ri,Ke=>{l(de)&&Ke(X)})}D(Ae,ct)}),z(()=>O(ae,l(T).name)),D(U,W)}),D(ht,gt)},Le=ht=>{var gt=sQ();D(ht,gt)};H(je,ht=>{l(Be).clusters.length>0?ht(tt):ht(Le,-1)})}z(()=>{O(ei,`${l(Be).name??`Endpoint ${l(Be).endpointId}`??""} `),O(vi,`ep${l(Be).endpointId??""}`)}),D(Gt,Xe)}),z(()=>{O(ii,l(Z).name??`Node ${l(Z).nodeId}`),O($t,`Node ID: ${l(Z).nodeId??""}`)}),D(Y,Ie)},Ei=Y=>{var Ie=aQ();D(Y,Ie)};H(xn,Y=>{l(ce)?Y(Ye):l(_e)?Y(oi,1):l(Z)?Y(hi,2):Y(Ei,-1)})}var Oi=v(pn,2),Gi=m(Oi),ji=v(Gi,2),K=v(m(ji),2);{var De=Y=>{var Ie=lQ(),le=m(Ie);z(()=>O(le,l(V).length)),D(Y,Ie)};H(K,Y=>{!l($)&&l(V).length>0&&Y(De)})}var at=v(K,2),Qe=m(at),Wt=v(ji,2);{var si=Y=>{var Ie=fQ(),le=m(Ie);{var pe=di=>{var ne=cQ();D(di,ne)},ii=di=>{var ne=Ss(),nt=Et(ne);li(nt,17,()=>l(re),$t=>$t.id,($t,qt)=>{const Gt=Rt(()=>{var tt,Le;return((tt=g.get(l(qt).nodeId))==null?void 0:tt.name)??((Le=l(f).find(ht=>ht.nodeId===l(qt).nodeId))==null?void 0:Le.name)??null}),Be=Rt(()=>{var tt,Le;return l(qt).endpointId!==void 0?((Le=(tt=g.get(l(qt).nodeId))==null?void 0:tt.endpoints.find(ht=>ht.endpointId===l(qt).endpointId))==null?void 0:Le.name)??null:null}),Xe=Rt(()=>l(qt).attrName??l(qt).clusterName);var Zt=hQ(),ei=m(Zt),Li=m(ei),vi=v(ei,2);{var me=tt=>{var Le=dQ(),ht=v(Et(Le),2),gt=m(ht),Xt=v(gt);{var U=ie=>{var ae=e1(),oe=v(Et(ae)),Ae=m(oe);z(()=>O(Ae,`(#${l(qt).nodeId??""})`)),D(ie,ae)};H(Xt,ie=>{l(Gt)&&ie(U)})}var T=v(ht,2);let W;var J=m(T);z(()=>{O(gt,l(Gt)??`#${l(qt).nodeId}`),W=Ft(T,1,"e-val svelte-1ua3isv",null,W,{"e-online":l(qt).online,"e-offline":!l(qt).online}),O(J,l(qt).online?"online":"offline")}),D(tt,Le)},je=tt=>{var Le=uQ(),ht=v(Et(Le),2),gt=m(ht),Xt=v(gt);{var U=Ne=>{var ct=e1(),ri=v(Et(ct)),X=m(ri);z(()=>O(X,`(#${l(qt).nodeId??""})`)),D(Ne,ct)};H(Xt,Ne=>{l(Gt)&&Ne(U)})}var T=v(ht,2),W=m(T),J=v(W);{var ie=Ne=>{var ct=e1(),ri=v(Et(ct)),X=m(ri);z(()=>O(X,`(ep ${l(qt).endpointId??""})`)),D(Ne,ct)};H(J,Ne=>{l(Be)&&Ne(ie)})}var ae=v(T,2),oe=m(ae),Ae=v(ae,2),$e=m(Ae),Ce=v(Ae,2),Pe=m(Ce);z(Ne=>{O(gt,l(Gt)??`#${l(qt).nodeId}`),O(W,l(Be)??`ep${l(qt).endpointId}`),O(oe,l(qt).clusterName),O($e,l(Xe)),O(Pe,Ne)},[()=>p(l(qt).value)]),D(tt,Le)};H(vi,tt=>{l(qt).kind==="status"?tt(me):tt(je,-1)})}z(tt=>O(Li,tt),[()=>A(l(qt).ts)]),D($t,Zt)}),D(di,ne)};H(le,di=>{l(re).length===0?di(pe):di(ii,-1)})}D(Y,Ie)};H(Wt,Y=>{l($)&&Y(si)})}var St=v(Ci,2);{var et=Y=>{var Ie=xQ(),le=Et(Ie),pe=v(le,2),ii=m(pe),di=v(m(ii),2),ne=v(ii,2);{var nt=Gt=>{var Be=gQ(),Xe=m(Be);z(()=>O(Xe,l(Pt))),D(Gt,Be)},$t=Gt=>{var Be=pQ(),Xe=Et(Be),Zt=m(Xe);cs(Zt,ei=>x(it,ei),()=>l(it)),D(Gt,Be)};H(ne,Gt=>{l(Pt)?Gt(nt):Gt($t,-1)})}var qt=v(ne,2);cs(qt,Gt=>x(yt,Gt),()=>l(yt)),j("click",le,mt),j("click",di,mt),D(Y,Ie)};H(St,Y=>{l(dt)&&Y(et)})}z(()=>{Co(Oi,l($)?`height: ${l(Q)}px;`:""),O(Qe,l($)?"▾":"▸")}),j("click",on,()=>x(se,!l(se))),j("mousedown",Gi,he),j("click",at,()=>{x($,!l($))}),D(o,Bi),Ps()}Gs(["click","change","mousedown"]);var _Q=F("<button>›</button>"),bQ=F('<span class="chev-ph svelte-1vejtrc"></span>'),CQ=F('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),EQ=F("<button>🔒</button>"),yQ=F('<span class="acl-loading">Loading…</span>'),wQ=F("<span> </span>"),SQ=F('<span class="acl-dyn svelte-1vejtrc" title="per-user/client pattern — cannot evaluate statically">⚠%u/%c</span>'),DQ=F('<span class="acl-members svelte-1vejtrc"> </span>'),AQ=F('<span class="acl-group svelte-1vejtrc"> </span>'),kQ=F('<span> <strong class="svelte-1vejtrc"> </strong> <!> <!> <!></span>'),BQ=F('<div class="acl-sec svelte-1vejtrc"><span class="acl-sec-hdr svelte-1vejtrc"> </span> <!></div>'),FQ=F('<div class="acl-panel svelte-1vejtrc"><!></div>'),LQ=F('<div class="tc svelte-1vejtrc"></div>'),IQ=F('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!> <!></div> <!> <!></div>'),PQ=F('<button class="acl-refresh svelte-1vejtrc" title="Refresh ACL data">↺</button>'),TQ=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),MQ=F("<option></option>"),RQ=F('<span class="pub-ok svelte-1vejtrc">✓</span>'),NQ=F('<span class="pub-err svelte-1vejtrc"> </span>'),OQ=F('<div class="info svelte-1vejtrc">Loading…</div>'),HQ=F('<div class="info err svelte-1vejtrc"> </div>'),WQ=F('<div class="info svelte-1vejtrc">No topics match.</div>'),zQ=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>'),VQ=F('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),jQ=F('<div class="info svelte-1vejtrc">No topics yet.</div>'),$Q=F('<div class="tree-wrap svelte-1vejtrc"><!></div>'),UQ=F('<span class="stream-badge"> </span>'),qQ=F('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),GQ=F('<span class="s-ret svelte-1vejtrc" title="retained snapshot">⊛</span>'),KQ=F('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),ZQ=F('<div class="stream-body svelte-1vejtrc"><!></div>'),XQ=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),YQ=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>'),QQ=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),JQ=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 eJ(o,e){Is(e,!0);const t=(T,W=cb)=>{const J=Rt(()=>l(g).has(W().path)),ie=Rt(()=>l(a)>=0&&W().children.size>0),ae=Rt(()=>l(a)>=0&&W().isLeaf&&!n.has(W().path));var oe=IQ(),Ae=m(oe);let $e;var Ce=m(Ae);{var Pe=fe=>{var Ve=_Q();let Me;z(()=>{Me=Ft(Ve,1,"chev svelte-1vejtrc",null,Me,{open:l(J)}),rn(Ve,"aria-label",l(J)?"Collapse":"Expand")}),j("click",Ve,()=>p(W().path)),D(fe,Ve)},Ne=fe=>{var Ve=bQ();D(fe,Ve)};H(Ce,fe=>{l(ie)?fe(Pe):fe(Ne,-1)})}var ct=v(Ce,2),ri=m(ct),X=v(ct,2);{var de=fe=>{var Ve=CQ(),Me=Et(Ve),Je=m(Me),kt=v(Me,2),st=m(kt);z((rt,ve,Ge)=>{rn(Me,"title",rt),O(Je,ve),O(st,Ge)},[()=>{var rt;return pi((rt=ci(W().path))==null?void 0:rt.val)},()=>{var rt;return pi((rt=ci(W().path))==null?void 0:rt.val)},()=>{var rt;return((rt=ci(W().path))==null?void 0:rt.ts)!=null?xi(ci(W().path).ts):""}]),D(fe,Ve)},Ke=Rt(()=>W().isLeaf&&i.has(W().path));H(X,fe=>{l(Ke)&&fe(de)})}var Tt=v(X,2);{var Ue=fe=>{const Ve=Rt(()=>!!l(Bi)&&cn(W().path));var Me=EQ();let Je;z(()=>{Je=Ft(Me,1,"acl-badge svelte-1vejtrc",null,Je,{matched:l(Ve)}),rn(Me,"title",l(Ve)?"Has explicit ACL — click to inspect":"No explicit ACL — click to inspect defaults")}),j("click",Me,kt=>{kt.stopPropagation(),vt(W().path)}),D(fe,Me)};H(Tt,fe=>{l(mi)&&W().isLeaf&&fe(Ue)})}var qe=v(Ae,2);{var It=fe=>{var Ve=FQ(),Me=m(Ve);{var Je=st=>{var rt=yQ();D(st,rt)},kt=st=>{var rt=Ss(),ve=Et(rt);li(ve,17,()=>[{label:"Send",section:l(Ci).send},{label:"Subscribe",section:l(Ci).subscribe},{label:"Receive",section:l(Ci).receive}],Hi,(Ge,_t)=>{var Vt=BQ(),Ct=m(Vt),Ot=m(Ct),bi=v(Ct,2);{var $i=ai=>{var Mt=wQ();let Bt;var Kt=m(Mt);z(()=>{Bt=Ft(Mt,1,"acl-def svelte-1vejtrc",null,Bt,{allow:l(_t).section.default,deny:!l(_t).section.default}),O(Kt,`${l(_t).section.default?"allow":"deny"} (default)`)}),D(ai,Mt)},Ai=ai=>{var Mt=Ss(),Bt=Et(Mt);li(Bt,17,()=>l(_t).section.roles,Hi,(Kt,Qt)=>{var Yt=kQ();let Wi;var Ui=m(Yt),mn=v(Ui),Vi=m(mn),An=v(mn,2);{var Jn=Ts=>{var Tn=SQ();D(Ts,Tn)};H(An,Ts=>{l(Qt).dynamic&&Ts(Jn)})}var In=v(An,2);{var es=Ts=>{var Tn=DQ(),Gn=m(Tn);z(ms=>O(Gn,ms),[()=>l(Qt).users.join(", ")]),D(Ts,Tn)};H(In,Ts=>{l(Qt).users.length>0&&Ts(es)})}var Ji=v(In,2);li(Ji,17,()=>l(Qt).groups,Hi,(Ts,Tn)=>{var Gn=AQ(),ms=m(Gn);z(()=>O(ms,l(Tn).groupname)),D(Ts,Gn)}),z(()=>{Wi=Ft(Yt,1,"acl-role svelte-1vejtrc",null,Wi,{allow:l(Qt).allow,deny:!l(Qt).allow}),O(Ui,`${l(Qt).allow?"✓":"✗"} `),O(Vi,l(Qt).rolename)}),D(Kt,Yt)}),D(ai,Mt)};H(bi,ai=>{l(_t).section.roles.length===0?ai($i):ai(Ai,-1)})}z(()=>O(Ot,l(_t).label)),D(Ge,Vt)}),D(st,rt)};H(Me,st=>{l(pn)?st(Je):l(Ci)&&st(kt,1)})}D(fe,Ve)};H(qe,fe=>{l(mi)&&W().isLeaf&&l(Ki)===W().path&&fe(It)})}var pt=v(qe,2);{var ot=fe=>{var Ve=LQ();li(Ve,21,()=>[...W().children.values()].sort((Me,Je)=>Me.seg.localeCompare(Je.seg)),Me=>Me.path,(Me,Je)=>{t(Me,()=>l(Je))}),D(fe,Ve)};H(pt,fe=>{l(ie)&&l(J)&&fe(ot)})}z(()=>{$e=Ft(Ae,1,"tr svelte-1vejtrc",null,$e,{stale:l(ae)}),O(ri,W().seg)}),j("click",Ae,()=>{x(ce,W().path+"/#")}),j("contextmenu",Ae,fe=>{fe.preventDefault(),x(be,{x:fe.clientX,y:fe.clientY,topic:W().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(),x8(a)}))}const u=new Map;function f(T){const W=T.split("/");let J=u,ie="";for(let ae=0;ae<W.length;ae++){const oe=W[ae];ie=ae===0?oe:`${ie}/${oe}`,J.has(oe)||J.set(oe,{seg:oe,path:ie,children:new Map,isLeaf:!1});const Ae=J.get(oe);ae===W.length-1&&(Ae.isLeaf=!0),J=Ae.children}}let g=B(Di(new Set));function p(T){const W=new Set(l(g));W.has(T)?W.delete(T):W.add(T),x(g,W,!0)}let C=B("");const b=24,E=5;let w=B(0),A=B(300),I=Rt(()=>{if(l(a),!l(C))return[];const T=l(C).toLowerCase().split(/\s+/).filter(Boolean),W=[];for(const[J,ie]of i){const ae=J.toLowerCase();T.every(oe=>ae.includes(oe))&&W.push({topic:J,...ie})}return W.sort((J,ie)=>J.topic.localeCompare(ie.topic))}),M=Rt(()=>{const T=l(I).length,W=Math.max(0,Math.floor(l(w)/b)-E),J=Math.min(T,Math.ceil((l(w)+l(A))/b)+E);return{start:W,end:J,totalH:T*b,top:W*b}});const R=1e3,P=200,V=20,$=36;let Q=0,re=B(Di([])),he=B(Di([])),Z=B(!0),ce=B("#"),_e=B(200);Kn(()=>{const T=l(ce).trim(),W=Wl(()=>l(re)),J=!T||T==="#"?W.slice(0,P):W.filter(ie=>se(T,ie.topic)).slice(0,P);if(T&&T!=="#"){const ie=new Set(J.map(oe=>oe.topic)),ae=[];for(const[oe,Ae]of i)ie.has(oe)||se(T,oe)&&ae.push({id:-(ae.length+1),topic:oe,val:Ae.val,ts:Ae.ts,retained:!0});ae.sort((oe,Ae)=>oe.topic.localeCompare(Ae.topic)),x(he,[...J,...ae],!0)}else x(he,J,!0)});function se(T,W){if(T==="#")return!0;const J=T.split("/"),ie=W.split("/");for(let ae=0;ae<J.length;ae++){if(J[ae]==="#")return!0;if(ae>=ie.length||J[ae]!=="+"&&J[ae]!==ie[ae])return!1}return J.length===ie.length}function ue(T){T.preventDefault();const W=T.clientY,J=l(_e);function ie(oe){x(_e,Math.max(60,Math.min(800,J+W-oe.clientY)),!0)}function ae(){document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ae)}document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ae)}let Se=Rt(()=>{const T=Math.max(1,Math.floor((l(_e)-$)/V)+1);return l(he).slice(0,T)}),Te=B(!0),xe=B(null);async function Oe(){x(Te,!0),x(xe,null);try{const T=await BF();for(const W of T)i.set(W.topic,{val:W.val,ts:W.ts}),f(W.topic)}catch(T){x(xe,T instanceof Error?T.message:String(T),!0)}finally{x(Te,!1),x8(a)}}const We=Xo("mqtt",T=>{const{topic:W,val:J,ts:ie}=T;i.set(W,{val:J,ts:ie}),n.add(W),s.add(W),d();const ae={id:Q++,topic:W,val:J,ts:ie};x(re,[ae,...l(re).slice(0,R-1)],!0);const oe=l(ce).trim();(!oe||oe==="#"||se(oe,W))&&x(he,[ae,...l(he).filter(Ae=>!(Ae.retained&&Ae.topic===W)).slice(0,P-1)],!0)});let be=B(null),dt=B(null);async function Pt(T,W){const J=[T];if(W){const ie=T+"/";for(const ae of i.keys())ae.startsWith(ie)&&J.push(ae)}for(const ie of J)await m2(ie,"",!0,0)}let it=Rt(()=>(l(a),[...i.keys()].sort())),yt=B(""),Ee=B(""),He=B(!1),mt=B(0),At=B(!1),ft=B(null),Lt=B(!1);async function ni(){if(l(yt)){x(At,!0),x(ft,null),x(Lt,!1);try{await m2(l(yt),l(Ee),l(He),l(mt)),x(Lt,!0),setTimeout(()=>{x(Lt,!1)},2e3)}catch(T){x(ft,T instanceof Error?T.message:String(T),!0)}finally{x(At,!1)}}}function pi(T){return T==null?"":typeof T=="object"?JSON.stringify(T):String(T)}function xi(T){return new Date(T).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Dt(T){return new Date(T).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function ci(T){return l(a),i.get(T)}let ze=Rt(()=>(l(a),[...u.values()].sort((T,W)=>T.seg.localeCompare(W.seg)))),we=Rt(()=>(l(a),i.size)),ti=B(!1),mi=B(!1),Ut=B(!1),Bi=B(null),Ki=B(null),Ci=B(null),pn=B(!1);function nn(T,W,J){return W.includes("%u")||W.includes("%c")?"dynamic":T==="subscribeLiteral"||T==="unsubscribeLiteral"?W===J?"match":"no-match":se(W,J)?"match":"no-match"}function cn(T){if(!l(Bi))return!1;for(const W of l(Bi).roles)if(W.acls){for(const J of W.acls)if(nn(J.acltype,J.topic,T)!=="no-match")return!0}return!1}async function on(){x(Ut,!0);try{const T=await MF();x(Bi,{roles:T.roles},!0)}catch{x(Bi,null),x(mi,!1)}finally{x(Ut,!1)}}async function vt(T){if(l(Ki)===T){x(Ki,null),x(Ci,null);return}x(Ki,T,!0),x(Ci,null),x(pn,!0);try{x(Ci,await ZU(T),!0)}catch{x(Ci,null)}finally{x(pn,!1)}}async function Jt(){l(mi)?(x(mi,!1),x(Ki,null),x(Ci,null)):(x(mi,!0),x(Ki,null),x(Ci,null),l(Bi)||await on())}const Ni=Xo("mqtt:status",()=>{Oe()});$s(Oe),$s(async()=>{var T;try{const W=await Nb();x(ti,!!((T=W.dynsec)!=null&&T.dynsecReady),!0)}catch{x(ti,!1)}}),jp(()=>{We(),Ni(),r!==null&&cancelAnimationFrame(r)});var zi=JQ(),ui=m(zi),fn=v(m(ui),2);{var hn=T=>{var W=TQ(),J=Et(W);let ie;var ae=v(m(J),2);{var oe=Ce=>{var Pe=oo("…");D(Ce,Pe)};H(ae,Ce=>{l(Ut)&&Ce(oe)})}var Ae=v(J,2);{var $e=Ce=>{var Pe=PQ();z(()=>Pe.disabled=l(Ut)),j("click",Pe,on),D(Ce,Pe)};H(Ae,Ce=>{l(mi)&&Ce($e)})}z(()=>{ie=Ft(J,1,"acl-btn svelte-1vejtrc",null,ie,{active:l(mi)}),J.disabled=l(Ut)}),j("click",J,Jt),D(T,W)};H(fn,T=>{l(ti)&&T(hn)})}var xn=v(ui,2),Ye=m(xn),oi=m(Ye),hi=v(oi,2);li(hi,20,()=>l(it),T=>T,(T,W)=>{var J=MQ(),ie={};z(()=>{ie!==(ie=W)&&(J.value=(J.__value=W)??"")}),D(T,J)});var Ei=v(hi,2),Oi=v(Ei,2),Gi=m(Oi),ji=v(Oi,2),K=m(ji);K.value=K.__value=0;var De=v(K);De.value=De.__value=1;var at=v(De);at.value=at.__value=2;var Qe=v(ji,2),Wt=v(Qe,2);{var si=T=>{var W=RQ();D(T,W)};H(Wt,T=>{l(Lt)&&T(si)})}var St=v(Wt,2);{var et=T=>{var W=NQ(),J=m(W);z(()=>O(J,l(ft))),D(T,W)};H(St,T=>{l(ft)&&T(et)})}var Y=v(Ye,2),Ie=m(Y),le=v(Ie,2),pe=m(le);{var ii=T=>{var W=oo();z(()=>O(W,`${l(I).length??""} /`)),D(T,W)};H(pe,T=>{l(C)&&T(ii)})}var di=v(pe),ne=v(Y,2);{var nt=T=>{var W=OQ();D(T,W)},$t=T=>{var W=HQ(),J=m(W);z(()=>O(J,l(xe))),D(T,W)},qt=T=>{var W=Ss(),J=Et(W);{var ie=oe=>{var Ae=WQ();D(oe,Ae)},ae=oe=>{var Ae=VQ(),$e=m(Ae),Ce=m($e);li(Ce,21,()=>l(I).slice(l(M).start,l(M).end),Pe=>Pe.topic,(Pe,Ne)=>{var ct=zQ(),ri=m(ct),X=m(ri),de=v(ri,2),Ke=m(de),Tt=v(de,2),Ue=m(Tt);z((qe,It,pt)=>{O(X,l(Ne).topic),rn(de,"title",qe),O(Ke,It),O(Ue,pt)},[()=>pi(l(Ne).val),()=>pi(l(Ne).val),()=>xi(l(Ne).ts)]),D(Pe,ct)}),z(()=>{Co($e,`height: ${l(M).totalH??""}px; position: relative;`),Co(Ce,`top: ${l(M).top??""}px;`)}),xs("scroll",Ae,Pe=>{x(w,Pe.currentTarget.scrollTop,!0)}),CP(Ae,"clientHeight",Pe=>x(A,Pe)),D(oe,Ae)};H(J,oe=>{l(I).length===0?oe(ie):oe(ae,-1)})}D(T,W)},Gt=T=>{var W=$Q(),J=m(W);{var ie=oe=>{var Ae=jQ();D(oe,Ae)},ae=oe=>{var Ae=Ss(),$e=Et(Ae);li($e,17,()=>l(ze),Ce=>Ce.path,(Ce,Pe)=>{t(Ce,()=>l(Pe))}),D(oe,Ae)};H(J,oe=>{l(ze).length===0?oe(ie):oe(ae,-1)})}D(T,W)};H(ne,T=>{l(Te)?T(nt):l(xe)?T($t,1):l(C)?T(qt,2):T(Gt,-1)})}var Be=v(xn,2),Xe=m(Be),Zt=v(Xe,2),ei=m(Zt),Li=v(ei,2);{var vi=T=>{var W=UQ(),J=m(W);z(()=>O(J,l(he).length)),D(T,W)};H(Li,T=>{!l(Z)&&l(he).length>0&&T(vi)})}var me=v(Li,2),je=m(me),tt=v(Zt,2);{var Le=T=>{var W=ZQ(),J=m(W);{var ie=oe=>{var Ae=qQ();D(oe,Ae)},ae=oe=>{var Ae=Ss(),$e=Et(Ae);li($e,17,()=>l(Se),Ce=>Ce.id,(Ce,Pe)=>{var Ne=KQ();let ct;var ri=m(Ne),X=m(ri),de=v(ri,2);{var Ke=pt=>{var ot=GQ();D(pt,ot)};H(de,pt=>{l(Pe).retained&&pt(Ke)})}var Tt=v(de,2),Ue=m(Tt),qe=v(Tt,2),It=m(qe);z((pt,ot,fe)=>{ct=Ft(Ne,1,"sr svelte-1vejtrc",null,ct,{retained:l(Pe).retained}),O(X,pt),O(Ue,l(Pe).topic),rn(qe,"title",ot),O(It,fe)},[()=>Dt(l(Pe).ts),()=>pi(l(Pe).val),()=>pi(l(Pe).val)]),D(Ce,Ne)}),D(oe,Ae)};H(J,oe=>{l(Se).length===0?oe(ie):oe(ae,-1)})}D(T,W)};H(tt,T=>{l(Z)&&T(Le)})}var ht=v(Be,2);{var gt=T=>{var W=XQ(),J=Et(W),ie=v(J,2);let ae;var oe=m(ie),Ae=v(oe,2);z(()=>ae=Co(ie,"",ae,{left:`${l(be).x??""}px`,top:`${l(be).y??""}px`})),j("click",J,()=>x(be,null)),j("contextmenu",J,$e=>{$e.preventDefault(),x(be,null)}),j("click",oe,()=>{navigator.clipboard.writeText(l(be).topic),x(be,null)}),j("click",Ae,()=>{const $e=l(be).topic,Ce=$e+"/",Pe=[...i.keys()].some(Ne=>Ne.startsWith(Ce));x(dt,{topic:$e,hasChildren:Pe,recursive:!1},!0),x(be,null)}),D(T,W)};H(ht,T=>{l(be)&&T(gt)})}var Xt=v(ht,2);{var U=T=>{var W=QQ(),J=Et(W),ie=v(J,2),ae=v(m(ie),2),oe=m(ae),Ae=v(m(oe)),$e=m(Ae),Ce=v(oe,2);{var Pe=X=>{var de=YQ(),Ke=m(de);ws(Ke,()=>l(dt).recursive,Tt=>l(dt).recursive=Tt),D(X,de)};H(Ce,X=>{l(dt).hasChildren&&X(Pe)})}var Ne=v(ae,2),ct=m(Ne),ri=v(ct,2);z(()=>O($e,l(dt).topic)),j("click",J,()=>x(dt,null)),j("click",ct,()=>x(dt,null)),j("click",ri,()=>{const{topic:X,recursive:de}=l(dt);x(dt,null),Pt(X,de)}),D(T,W)};H(Xt,T=>{l(dt)&&T(U)})}z(()=>{Qe.disabled=l(At)||!l(yt),O(di,` ${l(we)??""}`),Co(Be,l(Z)?`height: ${l(_e)}px;`:""),O(je,l(Z)?"▾":"▸")}),Nt(oi,()=>l(yt),T=>x(yt,T)),Nt(Ei,()=>l(Ee),T=>x(Ee,T)),ws(Gi,()=>l(He),T=>x(He,T)),Ls(ji,()=>l(mt),T=>x(mt,T)),j("click",Qe,ni),Nt(Ie,()=>l(C),T=>x(C,T)),j("mousedown",Xe,ue),Nt(ei,()=>l(ce),T=>x(ce,T)),j("click",me,()=>{x(Z,!l(Z))}),D(o,zi),Ps()}Gs(["click","contextmenu","mousedown"]);var tJ=F('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),iJ=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>'),nJ=F('<div class="err svelte-twakcj"> </div>'),sJ=F('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),oJ=F('<p class="empty svelte-twakcj">No packages installed.</p>'),rJ=F('<p class="empty svelte-twakcj">No match.</p>'),aJ=F("<span> </span>"),lJ=gb('<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>'),cJ=gb('<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>'),dJ=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>'),uJ=F('<span class="result-author svelte-twakcj"> </span>'),hJ=F('<span class="result-date svelte-twakcj"> </span>'),fJ=F('<span class="result-desc svelte-twakcj"> </span>'),gJ=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>'),pJ=F('<div class="results-list svelte-twakcj"></div>'),xJ=F('<pre class="npm-output svelte-twakcj"> </pre>'),vJ=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>`),mJ=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 _J(o,e){Is(e,!0);let t=B(Di([])),i=B(""),n=B(Di({})),s=B(Di([])),r=B(!1),a=B(""),d=B(Di([])),u=B(!1),f=B(!1),g=B(!1),p=B(""),C=B(""),b=Di({});const E=Rt(()=>l(i).trim()?l(t).filter(vt=>vt.name.toLowerCase().includes(l(i).toLowerCase())):l(t)),w=Rt(()=>Object.keys(l(n)).filter(vt=>!l(s).includes(vt)).length);$s(async()=>{await Promise.all([A(),I(),M()])});async function A(){try{x(t,await rU(),!0),x(p,"")}catch(vt){x(p,vt.message,!0)}}async function I(){try{x(n,await kF(),!0)}catch{}}async function M(){try{const vt=await Tl();x(s,Array.isArray(vt.pinnedPackages)?vt.pinnedPackages:[],!0)}catch{}}async function R(vt){const Jt=l(s).includes(vt)?l(s).filter(Ni=>Ni!==vt):[...l(s),vt];x(s,Jt,!0);try{const Ni=await Tl();await xp({...Ni,pinnedPackages:Jt})}catch{}}async function P(){x(r,!0);try{x(n,await uU(),!0)}catch{}finally{x(r,!1)}}async function V(){const vt=l(a).trim();if(!vt){x(d,[],!0);return}x(g,!0),x(p,"");try{x(d,await aU(vt),!0)}catch(Jt){x(p,Jt.message,!0)}finally{x(g,!1)}}function $(vt){if(!vt)return"";try{return new Date(vt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function Q(vt,Jt){b[vt]=!0,x(p,""),x(C,"");try{const Ni=await lU(vt,Jt);x(C,Ni.stdout||Ni.stderr||"Done.",!0),x(u,!0),await A()}catch(Ni){x(p,Ni.message,!0)}finally{b[vt]=!1}}async function re(vt){b[vt]=!0,x(p,""),x(C,"");try{const Jt=await cU(vt);x(C,Jt.stdout||Jt.stderr||"Done.",!0),x(u,!0);const Ni={...l(n)};delete Ni[vt],x(n,Ni,!0),await A()}catch(Jt){x(p,Jt.message,!0)}finally{b[vt]=!1}}async function he(vt){b[vt]=!0,x(p,""),x(C,"");try{const Jt=await dU(vt);x(C,Jt.stdout||Jt.stderr||"Done.",!0),x(u,!0);const Ni={...l(n)};delete Ni[vt],x(n,Ni,!0),await A()}catch(Jt){x(p,Jt.message,!0)}finally{b[vt]=!1}}let Z;async function ce(){if(await Z.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){x(f,!0);try{await SF()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var _e=mJ(),se=Et(_e);cs(Xa(se,{}),vt=>Z=vt,()=>Z);var ue=v(se,2),Se=m(ue);{var Te=vt=>{var Jt=tJ();D(vt,Jt)},xe=vt=>{var Jt=iJ(),Ni=v(m(Jt));j("click",Ni,ce),D(vt,Jt)};H(Se,vt=>{l(f)?vt(Te):l(u)&&vt(xe,1)})}var Oe=v(Se,2);{var We=vt=>{var Jt=nJ(),Ni=m(Jt);z(()=>O(Ni,l(p))),D(vt,Jt)};H(Oe,vt=>{l(p)&&vt(We)})}var be=v(Oe,2),dt=m(be),Pt=m(dt),it=v(m(Pt),2),yt=m(it),Ee=v(it,2);{var He=vt=>{var Jt=sJ(),Ni=m(Jt);z(()=>O(Ni,`${l(w)??""} outdated`)),D(vt,Jt)};H(Ee,vt=>{l(w)>0&&vt(He)})}var mt=v(Ee,2),At=m(mt);let ft;var Lt=v(Pt,2),ni=m(Lt),pi=v(Lt,2),xi=m(pi);{var Dt=vt=>{var Jt=oJ();D(vt,Jt)},ci=vt=>{var Jt=rJ();D(vt,Jt)},ze=vt=>{var Jt=Ss(),Ni=Et(Jt);li(Ni,17,()=>l(E),zi=>zi.name,(zi,ui)=>{var fn=dJ();let hn;var xn=m(fn),Ye=m(xn),oi=m(Ye),hi=v(Ye,2),Ei=m(hi),Oi=v(hi,2);{var Gi=Y=>{var Ie=aJ();let le;var pe=m(Ie);z(ii=>{le=Ft(Ie,1,"dep-latest svelte-twakcj",null,le,ii),O(pe,`→ v${l(n)[l(ui).name].latest??""}`)},[()=>({"dep-latest--pinned":l(s).includes(l(ui).name)})]),D(Y,Ie)};H(Oi,Y=>{l(n)[l(ui).name]&&Y(Gi)})}var ji=v(xn,2),K=m(ji);let De;var at=v(K,2);let Qe;var Wt=m(at);{var si=Y=>{var Ie=lJ();D(Y,Ie)},St=Y=>{var Ie=cJ();D(Y,Ie)};H(Wt,Y=>{b[l(ui).name]?Y(si):Y(St,-1)})}var et=v(at,2);z((Y,Ie,le)=>{hn=Ft(fn,1,"dep-row svelte-twakcj",null,hn,{"dep-busy":!!b[l(ui).name]}),rn(Ye,"href",l(ui).url??`https://www.npmjs.com/package/${l(ui).name}`),O(oi,l(ui).name),O(Ei,l(ui).installedVersion??l(ui).version),De=Ft(K,1,"icon-btn svelte-twakcj",null,De,Y),rn(K,"title",Ie),Qe=Ft(at,1,"icon-btn svelte-twakcj",null,Qe,le),at.disabled=!!b[l(ui).name],rn(at,"title",l(n)[l(ui).name]?`Update to v${l(n)[l(ui).name].latest}`:"Update to latest"),et.disabled=!!b[l(ui).name]},[()=>({"icon-btn--pinned":l(s).includes(l(ui).name)}),()=>l(s).includes(l(ui).name)?"Unpin package":"Pin package (suppress update dot)",()=>({"icon-btn--update":!!l(n)[l(ui).name]&&!l(s).includes(l(ui).name)})]),j("click",K,()=>R(l(ui).name)),j("click",at,()=>he(l(ui).name)),j("click",et,()=>re(l(ui).name)),D(zi,fn)}),D(vt,Jt)};H(xi,vt=>{l(t).length===0?vt(Dt):l(E).length===0?vt(ci,1):vt(ze,-1)})}var we=v(dt,2),ti=v(m(we),2),mi=m(ti),Ut=v(mi,2),Bi=m(Ut),Ki=v(ti,2);{var Ci=vt=>{var Jt=pJ();li(Jt,21,()=>l(d),Ni=>Ni.name,(Ni,zi)=>{var ui=gJ(),fn=m(ui),hn=m(fn),xn=m(hn),Ye=v(hn,2),oi=m(Ye),hi=v(Ye,2);{var Ei=Qe=>{var Wt=uJ(),si=m(Wt);z(()=>O(si,l(zi).author)),D(Qe,Wt)};H(hi,Qe=>{l(zi).author&&Qe(Ei)})}var Oi=v(hi,2);{var Gi=Qe=>{var Wt=hJ(),si=m(Wt);z(St=>{rn(Wt,"title",l(zi).date),O(si,St)},[()=>$(l(zi).date)]),D(Qe,Wt)};H(Oi,Qe=>{l(zi).date&&Qe(Gi)})}var ji=v(Oi,2);{var K=Qe=>{var Wt=fJ(),si=m(Wt);z(()=>O(si,l(zi).description)),D(Qe,Wt)};H(ji,Qe=>{l(zi).description&&Qe(K)})}var De=v(fn,2),at=m(De);z(()=>{rn(hn,"href",l(zi).url??`https://www.npmjs.com/package/${l(zi).name}`),O(xn,l(zi).name),O(oi,l(zi).version),De.disabled=!!b[l(zi).name],O(at,b[l(zi).name]?"Installing…":"Install")}),j("click",De,()=>Q(l(zi).name)),D(Ni,ui)}),D(vt,Jt)};H(Ki,vt=>{l(d).length>0&&vt(Ci)})}var pn=v(Ki,2);{var nn=vt=>{var Jt=xJ(),Ni=m(Jt);z(()=>O(Ni,l(C))),D(vt,Jt)};H(pn,vt=>{l(C)&&vt(nn)})}var cn=v(pn,2);{var on=vt=>{var Jt=vJ();D(vt,Jt)};H(cn,vt=>{!l(d).length&&!l(C)&&vt(on)})}z(()=>{O(yt,l(t).length),mt.disabled=l(r),ft=Ft(At,0,"svelte-twakcj",null,ft,{spinning:l(r)}),Ut.disabled=l(g),O(Bi,l(g)?"Searching…":"Search")}),j("click",mt,P),Nt(ni,()=>l(i),vt=>x(i,vt)),j("keydown",mi,vt=>vt.key==="Enter"&&V()),Nt(mi,()=>l(a),vt=>x(a,vt)),j("click",Ut,V),D(o,_e),Ps()}Gs(["click","keydown"]);var bJ=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>'),Ca=F('<div class="err svelte-3itf14"> </div>'),CJ=F('<div class="empty svelte-3itf14">No users found.</div>'),EJ=F('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),Th=F("<option> </option>"),Kx=F('<div class="inline-err svelte-3itf14"> </div>'),iA=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),yJ=F('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove from group">×</button></span>'),wJ=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),SJ=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>'),DJ=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>'),AJ=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>'),kJ=F('<div class="empty svelte-3itf14">No roles found.</div>'),BJ=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>'),FJ=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>'),LJ=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>'),IJ=F('<div class="empty svelte-3itf14">No groups found.</div>'),PJ=F('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove member">×</button></span>'),TJ=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),MJ=F('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),RJ=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>'),NJ=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>'),OJ=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>'),nA=F('<div class="empty svelte-3itf14">Loading…</div>'),HJ=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>'),WJ=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>'),zJ=F('<div class="anon-current svelte-3itf14">Current: <span class="mono svelte-3itf14"> </span></div>'),VJ=F('<div class="anon-current muted svelte-3itf14">No anonymous group configured.</div>'),jJ=F('<div class="anon-row svelte-3itf14"><select class="svelte-3itf14"><option>— none —</option><!></select> <button class="svelte-3itf14"> </button></div> <!>',1),$J=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>'),UJ=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>'),qJ=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>'),GJ=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>'),KJ=F('<tr class="svelte-3itf14"><td class="mono small svelte-3itf14"> </td><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"> </td><td class="svelte-3itf14"><button class="danger">✕</button></td></tr>'),ZJ=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>'),XJ=F('<div class="empty svelte-3itf14">No ACL rules yet.</div>'),YJ=F('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-3itf14"><h3 class="svelte-3itf14">ACLs for role <em class="svelte-3itf14"> </em></h3> <!> <div class="acl-add-row svelte-3itf14"><select class="svelte-3itf14"></select> <input placeholder="topic or pattern" class="svelte-3itf14"/> <label class="allow-toggle svelte-3itf14"><input type="checkbox" class="svelte-3itf14"/> Allow</label> <button class="svelte-3itf14">Add</button></div> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Close</button></div></div></div>'),QJ=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>'),JJ=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 eee(o,e){Is(e,!0);let t=Tu(e,"dynsecReady",3,!1),i,n=B(Di([])),s=B(Di([])),r=B(Di([])),a=B(""),d=B(""),u=B(""),f=B("users"),g=B(null),p=B(""),C=B(""),b=B(!1);const E=Rt(()=>l(g)?l(g).kind==="user-roles"?l(s).map(me=>me.rolename).filter(me=>{var je,tt;return!((tt=(je=l(n).find(Le=>Le.username===l(g).target))==null?void 0:je.roles)!=null&&tt.some(Le=>Le.rolename===me))}):l(g).kind==="user-groups"?l(r).map(me=>me.groupname).filter(me=>{var je,tt;return!((tt=(je=l(n).find(Le=>Le.username===l(g).target))==null?void 0:je.groups)!=null&&tt.some(Le=>Le.groupname===me))}):l(g).kind==="group-members"?l(n).map(me=>me.username).filter(me=>{var je,tt;return!((tt=(je=l(r).find(Le=>Le.groupname===l(g).target))==null?void 0:je.clients)!=null&&tt.some(Le=>Le.username===me))}):l(s).map(me=>me.rolename).filter(me=>{var je,tt;return!((tt=(je=l(r).find(Le=>Le.groupname===l(g).target))==null?void 0:je.roles)!=null&&tt.some(Le=>Le.rolename===me))}):[]);function w(me,je){x(g,{kind:me,target:je},!0),x(p,""),x(C,"")}async function A(){if(!(!l(g)||!l(p))){x(b,!0),x(C,"");try{const{kind:me,target:je}=l(g);me==="user-roles"?await RU(je,l(p)):me==="user-groups"?await b2(l(p),je):me==="group-members"?await b2(je,l(p)):await UU(je,l(p)),x(g,null),x(p,""),await Ci()}catch(me){x(C,me.message,!0)}finally{x(b,!1)}}}async function I(me,je){try{await NU(me,je),await Ci()}catch(tt){x(a,tt.message,!0)}}async function M(me,je){try{await C2(je,me),await Ci()}catch(tt){x(a,tt.message,!0)}}async function R(me,je){try{await C2(me,je),await Ci()}catch(tt){x(u,tt.message,!0)}}async function P(me,je){try{await qU(me,je),await Ci()}catch(tt){x(u,tt.message,!0)}}let V=B(!1),$=B(""),Q=B(""),re=B(!1),he=B(""),Z=B(!1),ce=B(!1),_e=B(""),se=B(""),ue=B(""),Se=B(!1),Te=B(!1),xe=B(""),Oe=B(""),We=B(!1),be=B(null),dt=B(!1),Pt=B("publishClientSend"),it=B(""),yt=B(!0),Ee=B(""),He=B(!1),mt=B(""),At=B(""),ft=B(!1),Lt=B(Di([])),ni=B(""),pi=B(!1),xi=B(null),Dt=B(""),ci=B(""),ze=B(!1),we=B(!1);const ti=[{acltype:"publishClientSend",label:"Publish (send)"},{acltype:"publishClientReceive",label:"Publish (receive)"},{acltype:"subscribe",label:"Subscribe"},{acltype:"unsubscribe",label:"Unsubscribe"}];async function mi(){var me,je;x(we,!1),x(ni,""),x(ci,"");try{const[tt,Le]=await Promise.allSettled([GU(),XU()]);if(tt.status==="fulfilled"){const ht=Object.fromEntries(tt.value.acls.map(gt=>[gt.acltype,gt.allow]));x(Lt,ti.map(({acltype:gt})=>({acltype:gt,allow:ht[gt]??(gt==="publishClientReceive"||gt==="unsubscribe")})),!0)}else x(ni,((me=tt.reason)==null?void 0:me.message)??"Failed to load default ACLs",!0);Le.status==="fulfilled"?(x(xi,Le.value.group,!0),x(Dt,Le.value.group??"",!0)):x(ci,((je=Le.reason)==null?void 0:je.message)??"Failed to load anonymous group",!0)}finally{x(we,!0)}}async function Ut(me,je){x(Lt,l(Lt).map(tt=>tt.acltype===me?{...tt,allow:je}:tt),!0),x(pi,!0),x(ni,"");try{await KU(l(Lt))}catch(tt){x(ni,tt.message,!0)}finally{x(pi,!1)}}async function Bi(){x(ze,!0),x(ci,"");try{await YU(l(Dt)||null),x(xi,l(Dt)||null,!0)}catch(me){x(ci,me.message,!0)}finally{x(ze,!1)}}const Ki=["publishClientSend","publishClientReceive","subscribeLiteral","subscribePattern","unsubscribeLiteral","unsubscribePattern"];async function Ci(){var me,je,tt;try{const[Le,ht,gt]=await Promise.allSettled([IU(),MF(),VU()]);Le.status==="fulfilled"?(x(n,Le.value.users,!0),x(a,"")):x(a,((me=Le.reason)==null?void 0:me.message)??"Failed to load users",!0),ht.status==="fulfilled"?(x(s,ht.value.roles,!0),x(d,"")):x(d,((je=ht.reason)==null?void 0:je.message)??"Failed to load roles",!0),gt.status==="fulfilled"?(x(r,gt.value.groups,!0),x(u,"")):x(u,((tt=gt.reason)==null?void 0:tt.message)??"Failed to load groups",!0)}catch{}}$s(()=>{Ci()});async function pn(){x(he,""),x(Z,!0);try{await PU(l($),l(Q)),x($,""),x(Q,""),x(V,!1),await Ci()}catch(me){x(he,me.message??"Failed to create user",!0)}finally{x(Z,!1)}}async function nn(me){if(await i.show(`Delete user “${me}”?`,{confirm:"Delete",danger:!0}))try{await TU(me),await Ci()}catch(je){x(a,je.message,!0)}}async function cn(me){x(_e,me,!0),x(se,""),x(ue,""),x(ce,!0)}async function on(){x(ue,""),x(Se,!0);try{await MU(l(_e),l(se)),x(ce,!1)}catch(me){x(ue,me.message,!0)}finally{x(Se,!1)}}async function vt(){x(Oe,""),x(We,!0);try{await OU(l(xe)),x(xe,""),x(Te,!1),await Ci()}catch(me){x(Oe,me.message??"Failed to create role",!0)}finally{x(We,!1)}}async function Jt(me){var je;if(await i.show(`Delete role “${me}”?`,{confirm:"Delete",danger:!0}))try{await HU(me),((je=l(be))==null?void 0:je.rolename)===me&&(x(be,null),x(dt,!1)),await Ci()}catch(tt){x(d,tt.message,!0)}}function Ni(me){x(be,me,!0),x(dt,!0),x(Pt,"publishClientSend"),x(it,""),x(yt,!0),x(Ee,"")}async function zi(){if(l(be)){x(Ee,"");try{await WU(l(be).rolename,{acltype:l(Pt),topic:l(it),allow:l(yt)}),x(it,""),await Ci(),x(be,l(s).find(me=>me.rolename===l(be).rolename)??l(be),!0)}catch(me){x(Ee,me.message,!0)}}}async function ui(me,je,tt){try{await zU(me,je,tt),await Ci(),x(be,l(s).find(Le=>Le.rolename===me)??l(be),!0)}catch(Le){x(Ee,Le.message,!0)}}async function fn(){x(At,""),x(ft,!0);try{await jU(l(mt)),x(mt,""),x(He,!1),await Ci()}catch(me){x(At,me.message??"Failed to create group",!0)}finally{x(ft,!1)}}async function hn(me){if(await i.show(`Delete group “${me}”?`,{confirm:"Delete",danger:!0}))try{await $U(me),await Ci()}catch(je){x(u,je.message,!0)}}var xn=JJ(),Ye=Et(xn),oi=m(Ye);{var hi=me=>{var je=bJ();D(me,je)};H(oi,me=>{t()||me(hi)})}var Ei=v(oi,2),Oi=m(Ei);let Gi;var ji=v(Oi,2);let K;var De=v(ji,2);let at;var Qe=v(De,2);let Wt;var si=v(Qe,2),St=v(Ei,2);{var et=me=>{var je=AJ(),tt=m(je),Le=v(m(tt),2),ht=v(tt,2);{var gt=W=>{var J=Ca(),ie=m(J);z(()=>O(ie,l(a))),D(W,J)};H(ht,W=>{l(a)&&W(gt)})}var Xt=v(ht,2);{var U=W=>{var J=CJ();D(W,J)},T=W=>{var J=DJ(),ie=v(m(J));li(ie,21,()=>l(n),Hi,(ae,oe)=>{var Ae=SJ(),$e=m(Ae),Ce=m($e),Pe=v($e),Ne=m(Pe),ct=m(Ne),ri=m(ct);li(ri,17,()=>l(oe).roles??[],Hi,(st,rt)=>{var ve=EJ(),Ge=m(ve),_t=v(Ge);z(()=>O(Ge,l(rt).rolename)),j("click",_t,()=>I(l(oe).username,l(rt).rolename)),D(st,ve)});var X=v(ri,2),de=v(ct,2);{var Ke=st=>{var rt=iA(),ve=Et(rt),Ge=m(ve),_t=m(Ge);_t.value=_t.__value="";var Vt=v(_t);li(Vt,17,()=>l(E),Hi,(Ai,ai)=>{var Mt=Th(),Bt=m(Mt),Kt={};z(()=>{O(Bt,l(ai)),Kt!==(Kt=l(ai))&&(Mt.value=(Mt.__value=l(ai))??"")}),D(Ai,Mt)});var Ct=v(Ge,2),Ot=v(Ct,2),bi=v(ve,2);{var $i=Ai=>{var ai=Kx(),Mt=m(ai);z(()=>O(Mt,l(C))),D(Ai,ai)};H(bi,Ai=>{l(C)&&Ai($i)})}z(()=>Ct.disabled=!l(p)||l(b)),Ls(Ge,()=>l(p),Ai=>x(p,Ai)),j("click",Ct,A),j("click",Ot,()=>x(g,null)),D(st,rt)};H(de,st=>{var rt;((rt=l(g))==null?void 0:rt.kind)==="user-roles"&&l(g).target===l(oe).username&&st(Ke)})}var Tt=v(Pe),Ue=m(Tt),qe=m(Ue),It=m(qe);li(It,17,()=>l(oe).groups??[],Hi,(st,rt)=>{var ve=yJ(),Ge=m(ve),_t=v(Ge);z(()=>O(Ge,l(rt).groupname)),j("click",_t,()=>M(l(oe).username,l(rt).groupname)),D(st,ve)});var pt=v(It,2),ot=v(qe,2);{var fe=st=>{var rt=wJ(),ve=Et(rt),Ge=m(ve),_t=m(Ge);_t.value=_t.__value="";var Vt=v(_t);li(Vt,17,()=>l(E),Hi,(Ai,ai)=>{var Mt=Th(),Bt=m(Mt),Kt={};z(()=>{O(Bt,l(ai)),Kt!==(Kt=l(ai))&&(Mt.value=(Mt.__value=l(ai))??"")}),D(Ai,Mt)});var Ct=v(Ge,2),Ot=v(Ct,2),bi=v(ve,2);{var $i=Ai=>{var ai=Kx(),Mt=m(ai);z(()=>O(Mt,l(C))),D(Ai,ai)};H(bi,Ai=>{l(C)&&Ai($i)})}z(()=>Ct.disabled=!l(p)||l(b)),Ls(Ge,()=>l(p),Ai=>x(p,Ai)),j("click",Ct,A),j("click",Ot,()=>x(g,null)),D(st,rt)};H(ot,st=>{var rt;((rt=l(g))==null?void 0:rt.kind)==="user-groups"&&l(g).target===l(oe).username&&st(fe)})}var Ve=v(Tt),Me=m(Ve),Je=m(Me),kt=v(Je,2);z(()=>O(Ce,l(oe).username)),j("click",X,()=>w("user-roles",l(oe).username)),j("click",pt,()=>w("user-groups",l(oe).username)),j("click",Je,()=>cn(l(oe).username)),j("click",kt,()=>nn(l(oe).username)),D(ae,Ae)}),D(W,J)};H(Xt,W=>{l(n).length===0?W(U):W(T,-1)})}j("click",Le,()=>{x(V,!0),x(he,"")}),D(me,je)};H(St,me=>{l(f)==="users"&&me(et)})}var Y=v(St,2);{var Ie=me=>{var je=LJ(),tt=m(je),Le=v(m(tt),2),ht=v(tt,2);{var gt=W=>{var J=Ca(),ie=m(J);z(()=>O(ie,l(d))),D(W,J)};H(ht,W=>{l(d)&&W(gt)})}var Xt=v(ht,2);{var U=W=>{var J=kJ();D(W,J)},T=W=>{var J=FJ(),ie=v(m(J));li(ie,21,()=>l(s),Hi,(ae,oe)=>{var Ae=BJ(),$e=m(Ae),Ce=m($e),Pe=v($e),Ne=m(Pe),ct=v(Pe),ri=m(ct),X=m(ri),de=v(X,2);z(()=>{var Ke;O(Ce,l(oe).rolename),O(Ne,((Ke=l(oe).acls)==null?void 0:Ke.length)??0)}),j("click",X,()=>Ni(l(oe))),j("click",de,()=>Jt(l(oe).rolename)),D(ae,Ae)}),D(W,J)};H(Xt,W=>{l(s).length===0?W(U):W(T,-1)})}j("click",Le,()=>{x(Te,!0),x(Oe,""),x(xe,"")}),D(me,je)};H(Y,me=>{l(f)==="roles"&&me(Ie)})}var le=v(Y,2);{var pe=me=>{var je=OJ(),tt=m(je),Le=v(m(tt),2),ht=v(tt,2);{var gt=W=>{var J=Ca(),ie=m(J);z(()=>O(ie,l(u))),D(W,J)};H(ht,W=>{l(u)&&W(gt)})}var Xt=v(ht,2);{var U=W=>{var J=IJ();D(W,J)},T=W=>{var J=NJ(),ie=v(m(J));li(ie,21,()=>l(r),Hi,(ae,oe)=>{var Ae=RJ(),$e=m(Ae),Ce=m($e),Pe=v($e),Ne=m(Pe),ct=m(Ne),ri=m(ct);li(ri,17,()=>l(oe).clients??[],Hi,(kt,st)=>{var rt=PJ(),ve=m(rt),Ge=v(ve);z(()=>O(ve,l(st).username)),j("click",Ge,()=>R(l(oe).groupname,l(st).username)),D(kt,rt)});var X=v(ri,2),de=v(ct,2);{var Ke=kt=>{var st=TJ(),rt=Et(st),ve=m(rt),Ge=m(ve);Ge.value=Ge.__value="";var _t=v(Ge);li(_t,17,()=>l(E),Hi,($i,Ai)=>{var ai=Th(),Mt=m(ai),Bt={};z(()=>{O(Mt,l(Ai)),Bt!==(Bt=l(Ai))&&(ai.value=(ai.__value=l(Ai))??"")}),D($i,ai)});var Vt=v(ve,2),Ct=v(Vt,2),Ot=v(rt,2);{var bi=$i=>{var Ai=Kx(),ai=m(Ai);z(()=>O(ai,l(C))),D($i,Ai)};H(Ot,$i=>{l(C)&&$i(bi)})}z(()=>Vt.disabled=!l(p)||l(b)),Ls(ve,()=>l(p),$i=>x(p,$i)),j("click",Vt,A),j("click",Ct,()=>x(g,null)),D(kt,st)};H(de,kt=>{var st;((st=l(g))==null?void 0:st.kind)==="group-members"&&l(g).target===l(oe).groupname&&kt(Ke)})}var Tt=v(Pe),Ue=m(Tt),qe=m(Ue),It=m(qe);li(It,17,()=>l(oe).roles??[],Hi,(kt,st)=>{var rt=MJ(),ve=m(rt),Ge=v(ve);z(()=>O(ve,l(st).rolename)),j("click",Ge,()=>P(l(oe).groupname,l(st).rolename)),D(kt,rt)});var pt=v(It,2),ot=v(qe,2);{var fe=kt=>{var st=iA(),rt=Et(st),ve=m(rt),Ge=m(ve);Ge.value=Ge.__value="";var _t=v(Ge);li(_t,17,()=>l(E),Hi,($i,Ai)=>{var ai=Th(),Mt=m(ai),Bt={};z(()=>{O(Mt,l(Ai)),Bt!==(Bt=l(Ai))&&(ai.value=(ai.__value=l(Ai))??"")}),D($i,ai)});var Vt=v(ve,2),Ct=v(Vt,2),Ot=v(rt,2);{var bi=$i=>{var Ai=Kx(),ai=m(Ai);z(()=>O(ai,l(C))),D($i,Ai)};H(Ot,$i=>{l(C)&&$i(bi)})}z(()=>Vt.disabled=!l(p)||l(b)),Ls(ve,()=>l(p),$i=>x(p,$i)),j("click",Vt,A),j("click",Ct,()=>x(g,null)),D(kt,st)};H(ot,kt=>{var st;((st=l(g))==null?void 0:st.kind)==="group-roles"&&l(g).target===l(oe).groupname&&kt(fe)})}var Ve=v(Tt),Me=m(Ve),Je=m(Me);z(()=>O(Ce,l(oe).groupname)),j("click",X,()=>w("group-members",l(oe).groupname)),j("click",pt,()=>w("group-roles",l(oe).groupname)),j("click",Je,()=>hn(l(oe).groupname)),D(ae,Ae)}),D(W,J)};H(Xt,W=>{l(r).length===0?W(U):W(T,-1)})}j("click",Le,()=>{x(He,!0),x(At,""),x(mt,"")}),D(me,je)};H(le,me=>{l(f)==="groups"&&me(pe)})}var ii=v(le,2);{var di=me=>{var je=$J(),tt=m(je),Le=v(m(tt),4);{var ht=Ae=>{var $e=Ca(),Ce=m($e);z(()=>O(Ce,l(ni))),D(Ae,$e)};H(Le,Ae=>{l(ni)&&Ae(ht)})}var gt=v(Le,2);{var Xt=Ae=>{var $e=nA();D(Ae,$e)},U=Ae=>{var $e=WJ(),Ce=v(m($e));li(Ce,21,()=>ti,Hi,(Pe,Ne)=>{let ct=()=>l(Ne).acltype,ri=()=>l(Ne).label;const X=Rt(()=>l(Lt).find(fe=>fe.acltype===ct()));var de=HJ();let Ke;var Tt=m(de),Ue=m(Tt),qe=v(Tt),It=m(qe),pt=v(qe),ot=m(pt);z(()=>{var fe,Ve;Ke=Ft(de,1,"svelte-3itf14",null,Ke,{saving:l(pi)}),O(Ue,ri()),rn(It,"name",ct()),Zo(It,((fe=l(X))==null?void 0:fe.allow)===!0),rn(ot,"name",ct()),Zo(ot,((Ve=l(X))==null?void 0:Ve.allow)===!1)}),j("change",It,()=>Ut(ct(),!0)),j("change",ot,()=>Ut(ct(),!1)),D(Pe,de)}),D(Ae,$e)};H(gt,Ae=>{l(we)?Ae(U,-1):Ae(Xt)})}var T=v(tt,2),W=v(m(T),4);{var J=Ae=>{var $e=Ca(),Ce=m($e);z(()=>O(Ce,l(ci))),D(Ae,$e)};H(W,Ae=>{l(ci)&&Ae(J)})}var ie=v(W,2);{var ae=Ae=>{var $e=nA();D(Ae,$e)},oe=Ae=>{var $e=jJ(),Ce=Et($e),Pe=m(Ce),Ne=m(Pe);Ne.value=Ne.__value="";var ct=v(Ne);li(ct,17,()=>l(r),Hi,(Ue,qe)=>{var It=Th(),pt=m(It),ot={};z(()=>{O(pt,l(qe).groupname),ot!==(ot=l(qe).groupname)&&(It.value=(It.__value=l(qe).groupname)??"")}),D(Ue,It)});var ri=v(Pe,2),X=m(ri),de=v(Ce,2);{var Ke=Ue=>{var qe=zJ(),It=v(m(qe)),pt=m(It);z(()=>O(pt,l(xi))),D(Ue,qe)},Tt=Ue=>{var qe=VJ();D(Ue,qe)};H(de,Ue=>{l(xi)?Ue(Ke):Ue(Tt,-1)})}z(()=>{ri.disabled=l(ze)||l(Dt)===(l(xi)??""),O(X,l(ze)?"Saving…":"Save")}),Ls(Pe,()=>l(Dt),Ue=>x(Dt,Ue)),j("click",ri,Bi),D(Ae,$e)};H(ie,Ae=>{l(we)?Ae(oe,-1):Ae(ae)})}D(me,je)};H(ii,me=>{l(f)==="settings"&&me(di)})}var ne=v(Ye,2);{var nt=me=>{var je=UJ(),tt=m(je),Le=v(m(tt),2),ht=v(m(Le)),gt=v(Le,2),Xt=v(m(gt)),U=m(Xt),T=v(U,2),W=m(T),J=v(gt,2);{var ie=Ce=>{var Pe=Ca(),Ne=m(Pe);z(()=>O(Ne,l(he))),D(Ce,Pe)};H(J,Ce=>{l(he)&&Ce(ie)})}var ae=v(J,2),oe=m(ae),Ae=v(oe,2),$e=m(Ae);z(()=>{rn(U,"type",l(re)?"text":"password"),O(W,l(re)?"Hide":"Show"),Ae.disabled=l(Z)||!l($)||!l(Q),O($e,l(Z)?"Creating…":"Create")}),Nt(ht,()=>l($),Ce=>x($,Ce)),Nt(U,()=>l(Q),Ce=>x(Q,Ce)),j("click",T,()=>x(re,!l(re))),j("click",oe,()=>x(V,!1)),j("click",Ae,pn),D(me,je)};H(ne,me=>{l(V)&&me(nt)})}var $t=v(ne,2);{var qt=me=>{var je=qJ(),tt=m(je),Le=m(tt),ht=v(m(Le)),gt=m(ht),Xt=v(Le,2),U=v(m(Xt)),T=v(Xt,2);{var W=Ae=>{var $e=Ca(),Ce=m($e);z(()=>O(Ce,l(ue))),D(Ae,$e)};H(T,Ae=>{l(ue)&&Ae(W)})}var J=v(T,2),ie=m(J),ae=v(ie,2),oe=m(ae);z(()=>{O(gt,l(_e)),ae.disabled=l(Se)||!l(se),O(oe,l(Se)?"Saving…":"Set password")}),Nt(U,()=>l(se),Ae=>x(se,Ae)),j("click",ie,()=>x(ce,!1)),j("click",ae,on),D(me,je)};H($t,me=>{l(ce)&&me(qt)})}var Gt=v($t,2);{var Be=me=>{var je=GJ(),tt=m(je),Le=v(m(tt),2),ht=v(m(Le)),gt=v(Le,2);{var Xt=ie=>{var ae=Ca(),oe=m(ae);z(()=>O(oe,l(Oe))),D(ie,ae)};H(gt,ie=>{l(Oe)&&ie(Xt)})}var U=v(gt,2),T=m(U),W=v(T,2),J=m(W);z(()=>{W.disabled=l(We)||!l(xe),O(J,l(We)?"Creating…":"Create")}),Nt(ht,()=>l(xe),ie=>x(xe,ie)),j("click",T,()=>x(Te,!1)),j("click",W,vt),D(me,je)};H(Gt,me=>{l(Te)&&me(Be)})}var Xe=v(Gt,2);{var Zt=me=>{var je=YJ(),tt=m(je),Le=m(tt),ht=v(m(Le)),gt=m(ht),Xt=v(Le,2);{var U=ct=>{var ri=ZJ(),X=v(m(ri));li(X,21,()=>l(be).acls??[],Hi,(de,Ke)=>{var Tt=KJ(),Ue=m(Tt),qe=m(Ue),It=v(Ue),pt=m(It),ot=v(It),fe=m(ot),Ve=v(ot),Me=m(Ve);z(()=>{O(qe,l(Ke).acltype),O(pt,l(Ke).topic),O(fe,l(Ke).allow?"✓":"✗")}),j("click",Me,()=>ui(l(be).rolename,l(Ke).acltype,l(Ke).topic)),D(de,Tt)}),D(ct,ri)},T=ct=>{var ri=XJ();D(ct,ri)};H(Xt,ct=>{var ri;(((ri=l(be).acls)==null?void 0:ri.length)??0)>0?ct(U):ct(T,-1)})}var W=v(Xt,2),J=m(W);li(J,21,()=>Ki,Hi,(ct,ri)=>{var X=Th(),de=m(X),Ke={};z(()=>{O(de,l(ri)),Ke!==(Ke=l(ri))&&(X.value=(X.__value=l(ri))??"")}),D(ct,X)});var ie=v(J,2),ae=v(ie,2),oe=m(ae),Ae=v(ae,2),$e=v(W,2);{var Ce=ct=>{var ri=Ca(),X=m(ri);z(()=>O(X,l(Ee))),D(ct,ri)};H($e,ct=>{l(Ee)&&ct(Ce)})}var Pe=v($e,2),Ne=m(Pe);z(()=>{O(gt,l(be).rolename),Ae.disabled=!l(it)}),Ls(J,()=>l(Pt),ct=>x(Pt,ct)),Nt(ie,()=>l(it),ct=>x(it,ct)),ws(oe,()=>l(yt),ct=>x(yt,ct)),j("click",Ae,zi),j("click",Ne,()=>x(dt,!1)),D(me,je)};H(Xe,me=>{l(dt)&&l(be)&&me(Zt)})}var ei=v(Xe,2);{var Li=me=>{var je=QJ(),tt=m(je),Le=v(m(tt),2),ht=v(m(Le)),gt=v(Le,2);{var Xt=ie=>{var ae=Ca(),oe=m(ae);z(()=>O(oe,l(At))),D(ie,ae)};H(gt,ie=>{l(At)&&ie(Xt)})}var U=v(gt,2),T=m(U),W=v(T,2),J=m(W);z(()=>{W.disabled=l(ft)||!l(mt),O(J,l(ft)?"Creating…":"Create")}),Nt(ht,()=>l(mt),ie=>x(mt,ie)),j("click",T,()=>x(He,!1)),j("click",W,fn),D(me,je)};H(ei,me=>{l(He)&&me(Li)})}var vi=v(ei,2);cs(Xa(vi,{}),me=>i=me,()=>i),z(()=>{Gi=Ft(Oi,1,"svelte-3itf14",null,Gi,{active:l(f)==="users"}),K=Ft(ji,1,"svelte-3itf14",null,K,{active:l(f)==="roles"}),at=Ft(De,1,"svelte-3itf14",null,at,{active:l(f)==="groups"}),Wt=Ft(Qe,1,"svelte-3itf14",null,Wt,{active:l(f)==="settings"})}),j("click",Oi,()=>x(f,"users")),j("click",ji,()=>x(f,"roles")),j("click",De,()=>x(f,"groups")),j("click",Qe,()=>{x(f,"settings"),l(we)||mi()}),j("click",si,Ci),D(o,xn),Ps()}Gs(["click","change"]);var sA=F('<div class="err svelte-9i68x"> </div>'),tee=F('<div class="ok svelte-9i68x">Saved.</div>'),iee=F('<div class="reload-msg svelte-9i68x"> </div>'),nee=F('<div class="loading svelte-9i68x">Loading…</div>'),see=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>'),oee=F("<option></option>"),ree=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>'),aee=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>'),lee=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>'),cee=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>'),dee=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>'),uee=F('<div class="empty svelte-9i68x">No listeners configured. Click "+ Add listener" to create one.</div>'),hee=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),fee=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 & Reload mosquitto"> </button></div></div> <!> <!> <!> <!> <!></div>');function gee(o,e){Is(e,!0);let t=B(null),i=B(""),n=B(!1),s=B(""),r=B(!1),a=B(!1),d=B(""),u=B(Di([])),f=B(null),g=B(!1),p=B(""),C=B(Di([])),b=B(Di(new Set));$s(()=>{E(),_U().then(Ee=>{x(C,Ee.addresses,!0)}).catch(()=>{})});async function E(){try{x(t,await tx(),!0),x(u,JSON.parse(JSON.stringify(l(t).listeners)),!0),x(f,l(t).checksum,!0);const Ee=l(t).managed.allow_anonymous;x(p,Ee==="true"||Ee==="false"?Ee:"",!0),x(g,l(t).managed.per_listener_settings==="true"),x(i,"")}catch(Ee){x(i,Ee.message??"Failed to load broker config",!0)}}function w(){x(u,[...l(u),{port:1883,bindAddress:"",protocol:"mqtt",tls:{}}],!0),x(b,new Set(l(b)),!0)}function A(Ee){const He=new Set(l(b));He.has(Ee)?He.delete(Ee):He.add(Ee),x(b,He,!0)}function I(Ee){x(u,l(u).filter((He,mt)=>mt!==Ee),!0)}async function M(){if(l(t)){x(n,!0),x(s,""),x(r,!1);try{const Ee={...l(t).managed};l(g)?(Ee.per_listener_settings="true",delete Ee.allow_anonymous):(delete Ee.per_listener_settings,l(p)?Ee.allow_anonymous=l(p):delete Ee.allow_anonymous),await TF({listeners:l(u),managed:Ee,passthrough:l(t).passthrough,checksum:l(f)}),x(r,!0),setTimeout(()=>x(r,!1),3e3),await E()}catch(Ee){x(s,Ee.message??"Save failed",!0)}finally{x(n,!1)}}}async function R(){x(a,!0),x(d,"");try{const Ee=await Ob();x(d,Ee.stderr||Ee.stdout||"Reloaded",!0)}catch(Ee){x(d,"Error: "+(Ee.message??"reload failed"))}finally{x(a,!1)}}function P(Ee){var He,mt,At,ft,Lt;return!!((He=Ee.tls)!=null&&He.enabled||(mt=Ee.tls)!=null&&mt.certfile||(At=Ee.tls)!=null&&At.keyfile||(ft=Ee.tls)!=null&&ft.capath||(Lt=Ee.tls)!=null&&Lt.cafile)}function V(Ee,He){He?Ee.tls={...Ee.tls,enabled:!0}:Ee.tls={},x(u,[...l(u)],!0)}var $=fee(),Q=m($),re=v(m(Q),2),he=m(re),Z=v(he,2),ce=m(Z),_e=v(Z,2),se=m(_e),ue=v(Q,2);{var Se=Ee=>{var He=sA(),mt=m(He);z(()=>O(mt,l(i))),D(Ee,He)};H(ue,Ee=>{l(i)&&Ee(Se)})}var Te=v(ue,2);{var xe=Ee=>{var He=sA(),mt=m(He);z(()=>O(mt,l(s))),D(Ee,He)};H(Te,Ee=>{l(s)&&Ee(xe)})}var Oe=v(Te,2);{var We=Ee=>{var He=tee();D(Ee,He)};H(Oe,Ee=>{l(r)&&Ee(We)})}var be=v(Oe,2);{var dt=Ee=>{var He=iee(),mt=m(He);z(()=>O(mt,l(d))),D(Ee,He)};H(be,Ee=>{l(d)&&Ee(dt)})}var Pt=v(be,2);{var it=Ee=>{var He=nee();D(Ee,He)},yt=Ee=>{var He=hee(),mt=Et(He),At=m(mt),ft=m(At),Lt=v(At,2);{var ni=ze=>{var we=see(),ti=v(m(we),2),mi=m(ti);mi.value=mi.__value="";var Ut=v(mi);Ut.value=Ut.__value="true";var Bi=v(Ut);Bi.value=Bi.__value="false",Ls(ti,()=>l(p),Ki=>x(p,Ki)),D(ze,we)};H(Lt,ze=>{l(g)||ze(ni)})}var pi=v(mt,2),xi=m(pi);li(xi,17,()=>l(u),Hi,(ze,we,ti)=>{var mi=dee(),Ut=m(mi),Bi=m(Ut),Ki=m(Bi),Ci=v(Bi,2),pn=v(Ut,2),nn=m(pn),cn=v(m(nn)),on=v(nn,2),vt=v(m(on)),Jt=m(vt);Jt.value=Jt.__value="mqtt";var Ni=v(Jt);Ni.value=Ni.__value="websockets";var zi=v(on,2),ui=v(m(zi));rn(ui,"list",`bind-addr-list-${ti}`);var fn=v(zi,2),hn=m(fn),xn=v(pn,2);rn(xn,"id",`bind-addr-list-${ti}`),li(xn,21,()=>l(C),Hi,(Qe,Wt)=>{var si=oee(),St={};z(()=>{St!==(St=l(Wt))&&(si.value=(si.__value=l(Wt))??"")}),D(Qe,si)});var Ye=v(xn,2);{var oi=Qe=>{var Wt=ree(),si=m(Wt),St=m(si),et=v(m(St)),Y=v(St,2),Ie=v(m(Y)),le=v(si,2),pe=m(le),ii=v(m(pe)),di=v(pe,2),ne=v(m(di)),nt=v(le,2),$t=m(nt),qt=v(m($t)),Gt=v($t,2),Be=v(m(Gt)),Xe=m(Be);Xe.value=Xe.__value="";var Zt=v(Xe);Zt.value=Zt.__value="tlsv1.3";var ei=v(Zt);ei.value=ei.__value="tlsv1.2";var Li=v(nt,2),vi=m(Li),me=m(vi),je=v(vi,2),tt=m(je);Nt(et,()=>l(we).tls.certfile,Le=>l(we).tls.certfile=Le),Nt(Ie,()=>l(we).tls.keyfile,Le=>l(we).tls.keyfile=Le),Nt(ii,()=>l(we).tls.cafile,Le=>l(we).tls.cafile=Le),Nt(ne,()=>l(we).tls.capath,Le=>l(we).tls.capath=Le),Nt(qt,()=>l(we).tls.crlfile,Le=>l(we).tls.crlfile=Le),Ls(Be,()=>l(we).tls.tls_version,Le=>l(we).tls.tls_version=Le),ws(me,()=>l(we).tls.require_certificate,Le=>l(we).tls.require_certificate=Le),ws(tt,()=>l(we).tls.use_identity_as_username,Le=>l(we).tls.use_identity_as_username=Le),D(Qe,Wt)},hi=Rt(()=>P(l(we)));H(Ye,Qe=>{l(hi)&&Qe(oi)})}var Ei=v(Ye,2),Oi=m(Ei),Gi=v(Ei,2);{var ji=Qe=>{var Wt=lee(),si=m(Wt),St=m(si),et=v(m(St)),Y=v(St,2),Ie=v(m(Y)),le=v(Y,2),pe=v(m(le)),ii=m(pe);ii.value=ii.__value="";var di=v(ii);di.value=di.__value="0";var ne=v(di);ne.value=ne.__value="1";var nt=v(ne);nt.value=nt.__value="2";var $t;P1(pe);var qt=v(si,2);{var Gt=Xe=>{var Zt=aee(),ei=m(Zt),Li=m(ei);ws(Li,()=>l(we).tls.use_subject_as_username,vi=>l(we).tls.use_subject_as_username=vi),D(Xe,Zt)},Be=Rt(()=>P(l(we)));H(qt,Xe=>{l(Be)&&Xe(Gt)})}z(Xe=>{$t!==($t=Xe)&&(pe.value=(pe.__value=Xe)??"",Vv(pe,Xe))},[()=>l(we).max_qos!==void 0?String(l(we).max_qos):""]),Nt(et,()=>l(we).mount_point,Xe=>l(we).mount_point=Xe),Nt(Ie,()=>l(we).max_connections,Xe=>l(we).max_connections=Xe),j("change",pe,Xe=>{const Zt=Xe.target.value;l(we).max_qos=Zt===""?void 0:Number(Zt),x(u,[...l(u)],!0)}),D(Qe,Wt)},K=Rt(()=>l(b).has(ti));H(Gi,Qe=>{l(K)&&Qe(ji)})}var De=v(Gi,2);{var at=Qe=>{var Wt=cee(),si=v(m(Wt),2),St=m(si),et=v(m(St)),Y=m(et);Y.value=Y.__value="";var Ie=v(Y);Ie.value=Ie.__value="true";var le=v(Ie);le.value=le.__value="false";var pe;P1(et);var ii=v(St,2),di=v(m(ii)),ne=v(ii,2),nt=v(m(ne));z(()=>{pe!==(pe=l(we).allow_anonymous===void 0?"":l(we).allow_anonymous?"true":"false")&&(et.value=et.__value=l(we).allow_anonymous===void 0?"":l(we).allow_anonymous?"true":"false",Vv(et,l(we).allow_anonymous===void 0?"":l(we).allow_anonymous?"true":"false"))}),j("change",et,$t=>{const qt=$t.target.value;l(we).allow_anonymous=qt===""?void 0:qt==="true",x(u,[...l(u)],!0)}),Nt(di,()=>l(we).password_file,$t=>l(we).password_file=$t),Nt(nt,()=>l(we).acl_file,$t=>l(we).acl_file=$t),D(Qe,Wt)};H(De,Qe=>{l(g)&&Qe(at)})}z((Qe,Wt)=>{O(Ki,`Port ${l(we).port??""}`),Zo(hn,Qe),O(Oi,`${Wt??""} Advanced`)},[()=>P(l(we)),()=>l(b).has(ti)?"▾":"▸"]),j("click",Ci,()=>I(ti)),Nt(cn,()=>l(we).port,Qe=>l(we).port=Qe),Ls(vt,()=>l(we).protocol,Qe=>l(we).protocol=Qe),Nt(ui,()=>l(we).bindAddress,Qe=>l(we).bindAddress=Qe),j("change",hn,Qe=>V(l(we),Qe.target.checked)),j("click",Ei,()=>A(ti)),D(ze,mi)});var Dt=v(xi,2);{var ci=ze=>{var we=uee();D(ze,we)};H(Dt,ze=>{l(u).length===0&&ze(ci)})}ws(ft,()=>l(g),ze=>x(g,ze)),D(Ee,He)};H(Pt,Ee=>{l(t)===null&&!l(i)?Ee(it):Ee(yt,-1)})}z(()=>{Z.disabled=l(n),O(ce,l(n)?"Saving…":"Save"),_e.disabled=l(a),O(se,l(a)?"Reloading…":"Apply & Reload")}),j("click",he,w),j("click",Z,M),j("click",_e,R),D(o,$),Ps()}Gs(["click","change"]);var oA=F('<div class="err svelte-1by6o5t"> </div>'),pee=F('<div class="ok svelte-1by6o5t">Saved.</div>'),xee=F('<div class="reload-msg svelte-1by6o5t"> </div>'),t1=F('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <span class="checkmark svelte-1by6o5t"></span> </label>'),vee=F('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <span class="checkmark svelte-1by6o5t"></span> <strong> </strong></label>'),mee=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 & 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 & 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 & 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),_ee=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 bee(o,e){Is(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(""),w=B(""),A=B(""),I=B(""),M=B(""),R=B(""),P=B(""),V=B(""),$=B("");const Q=["file","stdout","stderr","syslog","topic","none"],re=["error","warning","notice","information","debug"],he=["connect","disconnect","subscribe","unsubscribe","publish","receive","websockets"],Z=["all"];[...re,...he,...Z];let ce=B(Di(new Set)),_e=B(Di(new Set));function se(ze,we){const ti=new Set(ze);return ti.has(we)?ti.delete(we):ti.add(we),ti}function ue(ze){if(!l(t))return"";const we=l(t).managed[ze];return Array.isArray(we)?we[0]:we??""}function Se(ze){if(!l(t))return new Set;const we=l(t).managed[ze];return we?new Set(Array.isArray(we)?we:[we]):new Set}$s(()=>Te());async function Te(){try{x(t,await tx(),!0),x(u,l(t).checksum,!0),x(f,ue("persistence"),!0),x(g,ue("persistence_location"),!0),x(p,ue("sys_interval"),!0);const ze=l(t).managed.include_dir;x(C,ze?Array.isArray(ze)?ze.join(`
|
|
231
|
+
`):ze:"",!0),x(b,ue("max_connections"),!0),x(E,ue("max_inflight_messages"),!0),x(w,ue("max_queued_messages"),!0),x(A,ue("max_packet_size"),!0),x(I,ue("message_size_limit"),!0),x(M,ue("max_keepalive"),!0),x(R,ue("persistent_client_expiration"),!0),x(P,ue("retain_available"),!0),x(V,ue("set_tcp_nodelay"),!0),x($,ue("connection_messages"),!0),x(ce,Se("log_dest"),!0),x(_e,Se("log_type"),!0),x(i,"")}catch(ze){x(i,ze.message??"Failed to load config",!0)}}async function xe(){if(l(t)){x(n,!0),x(s,""),x(r,!1);try{let we=function(mi,Ut){Ut!==""?ze[mi]=Ut:delete ze[mi]};const ze={...l(t).managed};we("persistence",l(f)),we("persistence_location",l(g)),we("sys_interval",l(p));const ti=l(C).split(`
|
|
232
|
+
`).map(mi=>mi.trim()).filter(Boolean);ti.length>0?ze.include_dir=ti.length===1?ti[0]:ti:delete ze.include_dir,we("max_connections",l(b)),we("max_inflight_messages",l(E)),we("max_queued_messages",l(w)),we("max_packet_size",l(A)),we("message_size_limit",l(I)),we("max_keepalive",l(M)),we("persistent_client_expiration",l(R)),we("retain_available",l(P)),we("set_tcp_nodelay",l(V)),we("connection_messages",l($)),l(ce).size>0?ze.log_dest=l(ce).size===1?[...l(ce)][0]:[...l(ce)]:delete ze.log_dest,l(_e).size>0?ze.log_type=l(_e).size===1?[...l(_e)][0]:[...l(_e)]:delete ze.log_type,await TF({listeners:l(t).listeners,managed:ze,passthrough:l(t).passthrough,checksum:l(u)}),x(r,!0),setTimeout(()=>x(r,!1),3e3),await Te()}catch(ze){x(s,ze.message??"Save failed",!0)}finally{x(n,!1)}}}async function Oe(){x(a,!0),x(d,"");try{const ze=await Ob();x(d,ze.stderr||ze.stdout||"Reloaded",!0)}catch(ze){x(d,"Error: "+(ze.message??"reload failed"))}finally{x(a,!1)}}var We=_ee(),be=m(We),dt=v(m(be),2),Pt=m(dt),it=m(Pt),yt=v(Pt,2),Ee=m(yt),He=v(be,2);{var mt=ze=>{var we=oA(),ti=m(we);z(()=>O(ti,l(i))),D(ze,we)};H(He,ze=>{l(i)&&ze(mt)})}var At=v(He,2);{var ft=ze=>{var we=oA(),ti=m(we);z(()=>O(ti,l(s))),D(ze,we)};H(At,ze=>{l(s)&&ze(ft)})}var Lt=v(At,2);{var ni=ze=>{var we=pee();D(ze,we)};H(Lt,ze=>{l(r)&&ze(ni)})}var pi=v(Lt,2);{var xi=ze=>{var we=xee(),ti=m(we);z(()=>O(ti,l(d))),D(ze,we)};H(pi,ze=>{l(d)&&ze(xi)})}var Dt=v(pi,2);{var ci=ze=>{var we=mee(),ti=Et(we),mi=v(m(ti),2),Ut=m(mi),Bi=m(Ut),Ki=v(m(Bi),2),Ci=m(Ki);Ci.value=Ci.__value="";var pn=v(Ci);pn.value=pn.__value="true";var nn=v(pn);nn.value=nn.__value="false";var cn=v(Ut,2),on=m(cn),vt=v(m(on),2),Jt=v(cn,2),Ni=m(Jt),zi=v(m(Ni),2),ui=v(mi,2),fn=m(ui),hn=v(m(fn),2);rn(hn,"rows",3);var xn=v(ti,2),Ye=v(m(xn),2),oi=v(m(Ye),2);li(oi,21,()=>Q,Hi,(Ue,qe)=>{var It=t1(),pt=m(It),ot=v(pt,3);z(fe=>{Zo(pt,fe),O(ot,` ${l(qe)??""}`)},[()=>l(ce).has(l(qe))]),j("change",pt,()=>{x(ce,se(l(ce),l(qe)),!0)}),D(Ue,It)});var hi=v(Ye,2),Ei=v(m(hi),2),Oi=m(Ei),Gi=v(m(Oi),2);li(Gi,17,()=>re,Hi,(Ue,qe)=>{var It=t1(),pt=m(It),ot=v(pt,3);z(fe=>{Zo(pt,fe),O(ot,` ${l(qe)??""}`)},[()=>l(_e).has(l(qe))]),j("change",pt,()=>{x(_e,se(l(_e),l(qe)),!0)}),D(Ue,It)});var ji=v(Oi,2),K=v(m(ji),2);li(K,17,()=>he,Hi,(Ue,qe)=>{var It=t1(),pt=m(It),ot=v(pt,3);z(fe=>{Zo(pt,fe),O(ot,` ${l(qe)??""}`)},[()=>l(_e).has(l(qe))]),j("change",pt,()=>{x(_e,se(l(_e),l(qe)),!0)}),D(Ue,It)});var De=v(ji,2),at=m(De);li(at,17,()=>Z,Hi,(Ue,qe)=>{var It=vee(),pt=m(It),ot=v(pt,4),fe=m(ot);z(Ve=>{Zo(pt,Ve),O(fe,l(qe))},[()=>l(_e).has(l(qe))]),j("change",pt,()=>{x(_e,se(l(_e),l(qe)),!0)}),D(Ue,It)});var Qe=v(xn,2),Wt=v(m(Qe),2),si=m(Wt),St=m(si),et=v(m(St),2),Y=v(si,2),Ie=m(Y),le=v(m(Ie),2),pe=v(Y,2),ii=m(pe),di=v(m(ii),2),ne=v(pe,2),nt=m(ne),$t=v(m(nt),2),qt=v(Qe,2),Gt=v(m(qt),2),Be=m(Gt),Xe=m(Be),Zt=v(m(Xe),2),ei=v(Be,2),Li=m(ei),vi=v(m(Li),2),me=v(qt,2),je=v(m(me),2),tt=m(je),Le=m(tt),ht=v(m(Le),2),gt=v(tt,2),Xt=m(gt),U=v(m(Xt),2),T=m(U);T.value=T.__value="";var W=v(T);W.value=W.__value="true";var J=v(W);J.value=J.__value="false";var ie=v(me,2),ae=v(m(ie),2),oe=m(ae),Ae=m(oe),$e=v(m(Ae),2),Ce=m($e);Ce.value=Ce.__value="";var Pe=v(Ce);Pe.value=Pe.__value="true";var Ne=v(Pe);Ne.value=Ne.__value="false";var ct=v(oe,2),ri=m(ct),X=v(m(ri),2),de=m(X);de.value=de.__value="";var Ke=v(de);Ke.value=Ke.__value="true";var Tt=v(Ke);Tt.value=Tt.__value="false",Ls(Ki,()=>l(f),Ue=>x(f,Ue)),Nt(vt,()=>l(g),Ue=>x(g,Ue)),Nt(zi,()=>l(p),Ue=>x(p,Ue)),Nt(hn,()=>l(C),Ue=>x(C,Ue)),Nt(et,()=>l(b),Ue=>x(b,Ue)),Nt(le,()=>l(M),Ue=>x(M,Ue)),Nt(di,()=>l(E),Ue=>x(E,Ue)),Nt($t,()=>l(w),Ue=>x(w,Ue)),Nt(Zt,()=>l(A),Ue=>x(A,Ue)),Nt(vi,()=>l(I),Ue=>x(I,Ue)),Nt(ht,()=>l(R),Ue=>x(R,Ue)),Ls(U,()=>l(P),Ue=>x(P,Ue)),Ls($e,()=>l(V),Ue=>x(V,Ue)),Ls(X,()=>l($),Ue=>x($,Ue)),D(ze,we)};H(Dt,ze=>{l(t)&&ze(ci)})}z(()=>{Pt.disabled=l(n),O(it,l(n)?"Saving…":"Save"),yt.disabled=l(a),O(Ee,l(a)?"Reloading…":"Apply & Reload")}),j("click",Pt,xe),j("click",yt,Oe),D(o,We),Ps()}Gs(["click","change"]);var sl=F('<div class="err svelte-9auejo"> </div>'),Cee=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>'),Eee=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>'),yee=F('<div class="empty svelte-9auejo">No trusted CA certs. Add one to enable client certificate authentication.</div>'),wee=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>'),See=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>'),Dee=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>'),rA=F('<button class="btn-primary svelte-9auejo"> </button>'),Aee=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>'),kee=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),Bee=F('<div class="ok svelte-9auejo">✓ Certificate installed.</div>'),Fee=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),Lee=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>'),Iee=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),Pee=F('<span class="file-name mono small svelte-9auejo"> </span>'),Tee=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),Mee=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>'),i1=F("<option></option>"),Ree=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>'),Nee=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),Oee=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),Hee=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>'),Wee=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 zee(o,e){Is(e,!0);let t=B(null),i=B(Di([])),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(""),w=B(!1),A=B(""),I=B(""),M=B(""),R=B(!1),P=B(""),V=B(!1),$=B(!1),Q=B("pem"),re=B(""),he=B(""),Z=B(""),ce=B(""),_e=B(""),se=B(!1),ue=B(!1),Se=B(""),Te=B(!1),xe=B(""),Oe=B(""),We=B(!1),be=B(""),dt=B(Di([])),Pt=B(Di([])),it=B(!1),yt=B("pem"),Ee=B(""),He=B(!1),mt=B(""),At=B(""),ft=B(Di([])),Lt=B(!1),ni=B("");async function pi(){try{const[Be,Xe]=await Promise.allSettled([QU(),tq()]);Be.status==="fulfilled"&&x(t,Be.value.server,!0),Xe.status==="fulfilled"&&x(i,Xe.value.certs,!0),x(n,"")}catch(Be){x(n,Be.message,!0)}}$s(()=>{pi()});async function xi(){x(g,""),x(f,!0),x(p,null);try{const Be=l(d).split(",").map(Zt=>Zt.trim()).filter(Boolean),Xe=await JU({cn:l(a),san:Be,days:l(u)});x(p,{fingerprint:Xe.fingerprint,expires:Xe.expires},!0),await pi()}catch(Be){x(g,Be.message,!0)}finally{x(f,!1)}}async function Dt(){x(A,""),x(w,!0),x(I,"");try{const Be=l(E).split(",").map(Zt=>Zt.trim()).filter(Boolean),Xe=await eq({cn:l(b),san:Be});x(I,Xe.csrPem,!0)}catch(Be){x(A,Be.message,!0)}finally{x(w,!1)}}async function ci(){x(P,""),x(R,!0),x(V,!1);try{if(!l(M).trim())throw new Error("Paste the signed certificate PEM");await YC({cert:l(M)}),x(V,!0),await pi()}catch(Be){x(P,Be.message,!0)}finally{x(R,!1)}}function ze(){navigator.clipboard.writeText(l(I)).catch(()=>{})}function we(Be){var ei;const Xe=(ei=Be.target.files)==null?void 0:ei[0];if(!Xe)return;x(ce,Xe.name,!0);const Zt=new FileReader;Zt.onload=()=>{const Li=Zt.result;x(Z,btoa(String.fromCharCode(...new Uint8Array(Li))),!0)},Zt.readAsArrayBuffer(Xe)}async function ti(){x(Se,""),x(ue,!0);try{if(l(Q)==="p12"){if(!l(Z))throw new Error("Select a .p12 / .pfx file");await YC({p12base64:l(Z),passphrase:l(_e)})}else{if(!l(re).trim())throw new Error("Certificate PEM is required");await YC({cert:l(re),key:l(he)||void 0})}x($,!1),await pi()}catch(Be){x(Se,Be.message,!0)}finally{x(ue,!1)}}function mi(Be){let Xe;return Zt=>{const ei=Zt.target.value;clearTimeout(Xe),Xe=setTimeout(async()=>{if(!ei.startsWith("/")||ei.length<2){Be([]);return}try{Be((await sq(ei)).suggestions)}catch{Be([])}},280)}}const Ut=mi(Be=>{x(dt,Be,!0)}),Bi=mi(Be=>{x(Pt,Be,!0)}),Ki=mi(Be=>{x(ft,Be,!0)});async function Ci(){x(be,""),x(We,!0);try{await oq({certPath:l(xe),keyPath:l(Oe)}),x(Te,!1),await pi()}catch(Be){x(be,Be.message,!0)}finally{x(We,!1)}}async function pn(){x(mt,""),x(He,!0);try{await iq(l(Ee)),x(Ee,""),x(it,!1),await pi()}catch(Be){x(mt,Be.message,!0)}finally{x(He,!1)}}async function nn(){x(ni,""),x(Lt,!0);try{await rq(l(At)),x(At,""),x(it,!1),await pi()}catch(Be){x(ni,Be.message,!0)}finally{x(Lt,!1)}}async function cn(Be){if(confirm("Remove this trusted CA cert?"))try{await nq(Be),await pi()}catch(Xe){x(s,Xe.message,!0)}}function on(Be){const Xe=new Date(Be).getTime()-Date.now();return Xe<0?"expired":Xe<30*864e5?"expiring":""}function vt(Be){return new Date(Be).toLocaleDateString()}var Jt=Wee(),Ni=Et(Jt),zi=m(Ni),ui=m(zi),fn=v(zi,2);{var hn=Be=>{var Xe=sl(),Zt=m(Xe);z(()=>O(Zt,l(n))),D(Be,Xe)};H(fn,Be=>{l(n)&&Be(hn)})}var xn=v(fn,2);{var Ye=Be=>{var Xe=sl(),Zt=m(Xe);z(()=>O(Zt,l(s))),D(Be,Xe)};H(xn,Be=>{l(s)&&Be(Ye)})}var oi=v(xn,2),hi=m(oi),Ei=v(m(hi),2),Oi=v(Ei,2),Gi=v(Oi,2),ji=v(Gi,2),K=v(hi,2);{var De=Be=>{var Xe=Cee(),Zt=m(Xe),ei=v(m(Zt)),Li=m(ei),vi=v(ei,3),me=m(vi),je=v(vi,3),tt=m(je);z((Le,ht)=>{O(Li,l(t).cn),O(me,l(t).fingerprint),Ft(je,1,Le,"svelte-9auejo"),O(tt,ht)},[()=>hg(on(l(t).expires)),()=>vt(l(t).expires)]),D(Be,Xe)},at=Be=>{var Xe=Eee();D(Be,Xe)};H(K,Be=>{l(t)?Be(De):Be(at,-1)})}var Qe=v(oi,2),Wt=m(Qe),si=v(m(Wt),2),St=v(Wt,2);{var et=Be=>{var Xe=yee();D(Be,Xe)},Y=Be=>{var Xe=See(),Zt=v(m(Xe));li(Zt,21,()=>l(i),Hi,(ei,Li)=>{var vi=wee(),me=m(vi),je=m(me),tt=v(me),Le=m(tt),ht=v(tt),gt=m(ht),Xt=v(ht),U=m(Xt);z((T,W,J)=>{O(je,l(Li).cn),O(Le,`${T??""}…`),Ft(ht,1,W,"svelte-9auejo"),O(gt,J)},[()=>l(Li).fingerprint.slice(0,29),()=>hg(on(l(Li).expires)),()=>vt(l(Li).expires)]),j("click",U,()=>cn(l(Li).fingerprint)),D(ei,vi)}),D(Be,Xe)};H(St,Be=>{l(i).length===0?Be(et):Be(Y,-1)})}var Ie=v(Ni,2);{var le=Be=>{var Xe=Aee(),Zt=m(Xe),ei=v(m(Zt),2),Li=v(m(ei)),vi=v(ei,2),me=v(m(vi)),je=v(vi,2),tt=v(m(je)),Le=v(je,2);{var ht=ie=>{var ae=sl(),oe=m(ae);z(()=>O(oe,l(g))),D(ie,ae)};H(Le,ie=>{l(g)&&ie(ht)})}var gt=v(Le,2);{var Xt=ie=>{var ae=Dee(),oe=v(m(ae),2),Ae=v(m(oe)),$e=m(Ae),Ce=v(Ae,2),Pe=m(Ce);z(Ne=>{O($e,l(p).fingerprint),O(Pe,Ne)},[()=>vt(l(p).expires)]),D(ie,ae)};H(gt,ie=>{l(p)&&ie(Xt)})}var U=v(gt,2),T=m(U),W=v(T,2);{var J=ie=>{var ae=rA(),oe=m(ae);z(()=>{ae.disabled=l(f),O(oe,l(f)?"Generating…":"Generate")}),j("click",ae,xi),D(ie,ae)};H(W,ie=>{l(p)||ie(J)})}Nt(Li,()=>l(a),ie=>x(a,ie)),Nt(me,()=>l(d),ie=>x(d,ie)),Nt(tt,()=>l(u),ie=>x(u,ie)),j("click",T,()=>x(r,!1)),D(Be,Xe)};H(Ie,Be=>{l(r)&&Be(le)})}var pe=v(Ie,2);{var ii=Be=>{var Xe=Lee(),Zt=m(Xe),ei=v(m(Zt),2);{var Li=me=>{var je=kee(),tt=Et(je),Le=v(m(tt)),ht=v(tt,2),gt=v(m(ht)),Xt=v(ht,4);{var U=ae=>{var oe=sl(),Ae=m(oe);z(()=>O(Ae,l(A))),D(ae,oe)};H(Xt,ae=>{l(A)&&ae(U)})}var T=v(Xt,2),W=m(T),J=v(W,2),ie=m(J);z(()=>{J.disabled=l(w),O(ie,l(w)?"Generating…":"Generate key + CSR")}),Nt(Le,()=>l(b),ae=>x(b,ae)),Nt(gt,()=>l(E),ae=>x(E,ae)),j("click",W,()=>x(C,!1)),j("click",J,Dt),D(me,je)},vi=me=>{var je=Fee(),tt=v(Et(je),2),Le=v(m(tt)),ht=v(tt,2),gt=m(ht),Xt=v(gt,2),U=v(ht,4),T=v(m(U)),W=v(U,2);{var J=Pe=>{var Ne=sl(),ct=m(Ne);z(()=>O(ct,l(P))),D(Pe,Ne)};H(W,Pe=>{l(P)&&Pe(J)})}var ie=v(W,2);{var ae=Pe=>{var Ne=Bee();D(Pe,Ne)};H(ie,Pe=>{l(V)&&Pe(ae)})}var oe=v(ie,2),Ae=m(oe),$e=v(Ae,2);{var Ce=Pe=>{var Ne=rA(),ct=m(Ne);z(ri=>{Ne.disabled=ri,O(ct,l(R)?"Uploading…":"Upload signed cert")},[()=>l(R)||!l(M).trim()]),j("click",Ne,ci),D(Pe,Ne)};H($e,Pe=>{l(V)||Pe(Ce)})}z(Pe=>{T1(Le,l(I)),rn(Xt,"href",`data:application/pkcs10;charset=utf-8,${Pe??""}`)},[()=>encodeURIComponent(l(I))]),j("click",gt,ze),Nt(T,()=>l(M),Pe=>x(M,Pe)),j("click",Ae,()=>x(C,!1)),D(me,je)};H(ei,me=>{l(I)?me(vi,-1):me(Li)})}D(Be,Xe)};H(pe,Be=>{l(C)&&Be(ii)})}var di=v(pe,2);{var ne=Be=>{var Xe=Mee(),Zt=m(Xe),ei=v(m(Zt),2),Li=m(ei);let vi;var me=v(Li,2);let je;var tt=v(ei,2);{var Le=ie=>{var ae=Iee(),oe=Et(ae),Ae=v(m(oe)),$e=v(oe,2),Ce=v(m($e));Nt(Ae,()=>l(re),Pe=>x(re,Pe)),Nt(Ce,()=>l(he),Pe=>x(he,Pe)),D(ie,ae)},ht=ie=>{var ae=Tee(),oe=Et(ae),Ae=v(m(oe)),$e=m(Ae),Ce=v($e,2);{var Pe=Ke=>{var Tt=Pee(),Ue=m(Tt);z(()=>O(Ue,l(ce))),D(Ke,Tt)};H(Ce,Ke=>{l(ce)&&Ke(Pe)})}var Ne=v(oe,2),ct=v(m(Ne)),ri=m(ct),X=v(ri,2),de=m(X);z(()=>{rn(ri,"type",l(se)?"text":"password"),O(de,l(se)?"Hide":"Show")}),j("change",$e,we),Nt(ri,()=>l(_e),Ke=>x(_e,Ke)),j("click",X,()=>x(se,!l(se))),D(ie,ae)};H(tt,ie=>{l(Q)==="pem"?ie(Le):ie(ht,-1)})}var gt=v(tt,2);{var Xt=ie=>{var ae=sl(),oe=m(ae);z(()=>O(oe,l(Se))),D(ie,ae)};H(gt,ie=>{l(Se)&&ie(Xt)})}var U=v(gt,2),T=m(U),W=v(T,2),J=m(W);z(()=>{vi=Ft(Li,1,"svelte-9auejo",null,vi,{active:l(Q)==="pem"}),je=Ft(me,1,"svelte-9auejo",null,je,{active:l(Q)==="p12"}),W.disabled=l(ue),O(J,l(ue)?"Importing…":"Import")}),j("click",Li,()=>x(Q,"pem")),j("click",me,()=>x(Q,"p12")),j("click",T,()=>x($,!1)),j("click",W,ti),D(Be,Xe)};H(di,Be=>{l($)&&Be(ne)})}var nt=v(di,2);{var $t=Be=>{var Xe=Ree(),Zt=m(Xe),ei=v(m(Zt),4),Li=v(m(ei)),vi=v(Li,2);li(vi,21,()=>l(dt),Hi,(W,J)=>{var ie=i1(),ae={};z(()=>{ae!==(ae=l(J))&&(ie.value=(ie.__value=l(J))??"")}),D(W,ie)});var me=v(ei,2),je=v(m(me)),tt=v(je,2);li(tt,21,()=>l(Pt),Hi,(W,J)=>{var ie=i1(),ae={};z(()=>{ae!==(ae=l(J))&&(ie.value=(ie.__value=l(J))??"")}),D(W,ie)});var Le=v(me,2);{var ht=W=>{var J=sl(),ie=m(J);z(()=>O(ie,l(be))),D(W,J)};H(Le,W=>{l(be)&&W(ht)})}var gt=v(Le,2),Xt=m(gt),U=v(Xt,2),T=m(U);z(W=>{U.disabled=W,O(T,l(We)?"Installing…":"Install")},[()=>l(We)||!l(xe).trim()||!l(Oe).trim()]),j("input",Li,Ut),Nt(Li,()=>l(xe),W=>x(xe,W)),j("input",je,Bi),Nt(je,()=>l(Oe),W=>x(Oe,W)),j("click",Xt,()=>x(Te,!1)),j("click",U,Ci),D(Be,Xe)};H(nt,Be=>{l(Te)&&Be($t)})}var qt=v(nt,2);{var Gt=Be=>{var Xe=Hee(),Zt=m(Xe),ei=v(m(Zt),2),Li=m(ei);let vi;var me=v(Li,2);let je;var tt=v(ei,2);{var Le=gt=>{var Xt=Nee(),U=Et(Xt),T=v(m(U)),W=v(U,2);{var J=$e=>{var Ce=sl(),Pe=m(Ce);z(()=>O(Pe,l(mt))),D($e,Ce)};H(W,$e=>{l(mt)&&$e(J)})}var ie=v(W,2),ae=m(ie),oe=v(ae,2),Ae=m(oe);z($e=>{oe.disabled=$e,O(Ae,l(He)?"Adding…":"Add CA cert")},[()=>l(He)||!l(Ee).trim()]),Nt(T,()=>l(Ee),$e=>x(Ee,$e)),j("click",ae,()=>x(it,!1)),j("click",oe,pn),D(gt,Xt)},ht=gt=>{var Xt=Oee(),U=v(Et(Xt),2),T=v(m(U)),W=v(T,2);li(W,21,()=>l(ft),Hi,(Ce,Pe)=>{var Ne=i1(),ct={};z(()=>{ct!==(ct=l(Pe))&&(Ne.value=(Ne.__value=l(Pe))??"")}),D(Ce,Ne)});var J=v(U,2);{var ie=Ce=>{var Pe=sl(),Ne=m(Pe);z(()=>O(Ne,l(ni))),D(Ce,Pe)};H(J,Ce=>{l(ni)&&Ce(ie)})}var ae=v(J,2),oe=m(ae),Ae=v(oe,2),$e=m(Ae);z(Ce=>{Ae.disabled=Ce,O($e,l(Lt)?"Adding…":"Add CA cert")},[()=>l(Lt)||!l(At).trim()]),j("input",T,Ki),Nt(T,()=>l(At),Ce=>x(At,Ce)),j("click",oe,()=>x(it,!1)),j("click",Ae,nn),D(gt,Xt)};H(tt,gt=>{l(yt)==="pem"?gt(Le):gt(ht,-1)})}z(()=>{vi=Ft(Li,1,"svelte-9auejo",null,vi,{active:l(yt)==="pem"}),je=Ft(me,1,"svelte-9auejo",null,je,{active:l(yt)==="path"})}),j("click",Li,()=>x(yt,"pem")),j("click",me,()=>x(yt,"path")),D(Be,Xe)};H(qt,Be=>{l(it)&&Be(Gt)})}j("click",ui,pi),j("click",Ei,()=>{x(r,!0),x(g,""),x(p,null)}),j("click",Oi,()=>{x(C,!0),x(A,""),x(I,""),x(M,""),x(V,!1),x(P,"")}),j("click",Gi,()=>{x($,!0),x(Se,""),x(Q,"pem"),x(re,""),x(he,""),x(Z,""),x(ce,""),x(_e,""),x(se,!1)}),j("click",ji,()=>{x(Te,!0),x(be,""),x(xe,""),x(Oe,""),x(dt,[],!0),x(Pt,[],!0)}),j("click",si,()=>{x(it,!0),x(mt,""),x(Ee,""),x(yt,"pem"),x(ni,""),x(At,""),x(ft,[],!0)}),D(o,Jt),Ps()}Gs(["click","change","input"]);var Zx=F('<div class="err svelte-17yczfe"> </div>'),Vee=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>'),jee=F('<div class="checking svelte-17yczfe">Checking…</div>'),$ee=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>'),Uee=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>'),qee=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),Gee=F('<div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div>'),Kee=F("<span> </span>"),Zee=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),Xee=F('<div class="ok svelte-17yczfe">Saved.</div>'),Yee=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 Qee(o,e){Is(e,!0);let t=B(Di({})),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),w=B(""),A=B(Di({}));$s(async()=>{try{const[ft,Lt,ni]=await Promise.all([Tl(),Nb(),fetch("/she/broker/ssh/pubkey").then(xi=>xi.json()).catch(()=>({publicKey:null}))]);x(A,ft,!0),Lt.sshKeyDefault&&x(a,Lt.sshKeyDefault,!0);const pi=l(A).broker??{};x(t,pi.ssh??{},!0),l(t).port||(l(t).port=22),l(t).identityFile||(l(t).identityFile=l(a)),ni.publicKey&&x(p,ni.publicKey,!0),x(d,l(t).host?"ssh":"local",!0),l(d)==="local"&&I()}catch(ft){x(i,ft.message,!0)}});async function I(){x(f,!0),x(g,"");try{x(u,await mU(),!0)}catch(ft){x(g,ft.message??"Check failed",!0)}finally{x(f,!1)}}async function M(){x(n,!0),x(r,""),x(s,!1);try{const ft=l(A).broker??{},Lt=l(d)==="local"?{...l(t),host:""}:l(t),ni={...l(A),broker:{...ft,ssh:Lt}};await xp(ni),x(s,!0),setTimeout(()=>x(s,!1),3e3)}catch(ft){x(r,ft.message,!0)}finally{x(n,!1)}}async function R(){x(C,!0),x(b,"");try{const ft=await fetch("/she/broker/ssh/keygen",{method:"POST",headers:{"Content-Type":"application/json"}}),Lt=await ft.json();if(!ft.ok)throw new Error(Lt.error??ft.statusText);x(p,Lt.publicKey,!0)}catch(ft){x(b,ft.message,!0)}finally{x(C,!1)}}async function P(){x(E,!0),x(w,"");try{const ft=await fetch("/she/broker/ssh/test",{method:"POST",headers:{"Content-Type":"application/json"}}),Lt=await ft.json();if(!ft.ok)throw new Error(Lt.error??ft.statusText);x(w,Lt.ok?"✓ Connection successful":"✗ "+(Lt.error??"Failed"),!0)}catch(ft){x(w,"✗ "+ft.message)}finally{x(E,!1)}}function V(ft){navigator.clipboard.writeText(ft).catch(()=>{})}const $=Rt(()=>l(t).identityFile&&l(t).user&&l(t).host?`ssh-copy-id -i ${l(t).identityFile}.pub ${l(t).user}@${l(t).host}`:"");var Q=Yee(),re=m(Q);{var he=ft=>{var Lt=Zx(),ni=m(Lt);z(()=>O(ni,l(i))),D(ft,Lt)};H(re,ft=>{l(i)&&ft(he)})}var Z=v(re,2),ce=v(m(Z),2),_e=m(ce);let se;var ue=v(_e,2);let Se;var Te=v(ce,2),xe=m(Te),Oe=v(Z,2);{var We=ft=>{var Lt=$ee(),ni=v(m(Lt),4);{var pi=mi=>{var Ut=Zx(),Bi=m(Ut);z(()=>O(Bi,l(g))),D(mi,Ut)};H(ni,mi=>{l(g)&&mi(pi)})}var xi=v(ni,2);{var Dt=mi=>{var Ut=Vee(),Bi=m(Ut),Ki=m(Bi);let Ci;var pn=m(Ki),nn=v(Ki,4);let cn;var on=m(nn),vt=v(Bi,2),Jt=m(vt);let Ni;var zi=m(Jt),ui=v(Jt,4);let fn;var hn=m(ui);z(()=>{Ci=Ft(Ki,1,"check-icon svelte-17yczfe",null,Ci,{ok:l(u).mosquittoCtrl,fail:!l(u).mosquittoCtrl}),O(pn,l(u).mosquittoCtrl?"✓":"✗"),cn=Ft(nn,1,"check-note svelte-17yczfe",null,cn,{ok:l(u).mosquittoCtrl,fail:!l(u).mosquittoCtrl}),O(on,l(u).mosquittoCtrl?"found in PATH":"not found — install the mosquitto or mosquitto-clients package"),Ni=Ft(Jt,1,"check-icon svelte-17yczfe",null,Ni,{ok:l(u).mosquitto,fail:!l(u).mosquitto}),O(zi,l(u).mosquitto?"✓":"✗"),fn=Ft(ui,1,"check-note svelte-17yczfe",null,fn,{ok:l(u).mosquitto,fail:!l(u).mosquitto}),O(hn,l(u).mosquitto?"found in PATH":"not found — install the mosquitto package")}),D(mi,Ut)},ci=mi=>{var Ut=jee();D(mi,Ut)};H(xi,mi=>{l(u)?mi(Dt):l(f)&&mi(ci,1)})}var ze=v(xi,2),we=m(ze),ti=m(we);z(()=>{we.disabled=l(f),O(ti,l(f)?"Checking…":l(u)?"Re-check":"Check tools")}),j("click",we,I),D(ft,Lt)};H(Oe,ft=>{l(d)==="local"&&ft(We)})}var be=v(Oe,2);{var dt=ft=>{var Lt=Zee(),ni=Et(Lt),pi=v(m(ni),4),xi=m(pi),Dt=v(m(xi)),ci=v(xi,2),ze=v(m(ci)),we=v(ci,2),ti=v(m(we)),mi=v(we,2),Ut=v(m(mi)),Bi=v(ni,2),Ki=v(m(Bi),2),Ci=v(m(Ki)),pn=m(Ci),nn=v(Ki,2);{var cn=Ye=>{var oi=qee(),hi=Et(oi),Ei=v(m(hi)),Oi=m(Ei),Gi=v(Oi,2),ji=v(hi,2);{var K=Wt=>{var si=Uee(),St=v(m(si)),et=m(St),Y=v(et,2);z(()=>T1(et,l($))),j("click",Y,()=>V(l($))),D(Wt,si)};H(ji,Wt=>{l($)&&Wt(K)})}var De=v(ji,2),at=m(De),Qe=m(at);z(()=>{T1(Oi,l(p)),at.disabled=l(C),O(Qe,l(C)?"Generating…":"Regenerate keypair")}),j("click",Gi,()=>V(l(p))),j("click",at,R),D(Ye,oi)},on=Ye=>{var oi=Gee(),hi=m(oi),Ei=m(hi);z(()=>{hi.disabled=l(C),O(Ei,l(C)?"Generating…":"Generate keypair")}),j("click",hi,R),D(Ye,oi)};H(nn,Ye=>{l(p)?Ye(cn):Ye(on,-1)})}var vt=v(nn,2);{var Jt=Ye=>{var oi=Zx(),hi=m(oi);z(()=>O(hi,l(b))),D(Ye,oi)};H(vt,Ye=>{l(b)&&Ye(Jt)})}var Ni=v(Bi,2),zi=v(m(Ni),2),ui=m(zi),fn=m(ui),hn=v(ui,2);{var xn=Ye=>{var oi=Kee();let hi;var Ei=m(oi);z(Oi=>{hi=Ft(oi,1,"test-result svelte-17yczfe",null,hi,Oi),O(Ei,l(w))},[()=>({ok:l(w).startsWith("✓"),fail:l(w).startsWith("✗")})]),D(Ye,oi)};H(hn,Ye=>{l(w)&&Ye(xn)})}z(()=>{rn(Ut,"placeholder",l(a)),O(pn,l(t).identityFile||l(a)),ui.disabled=l(E)||!l(t).host,O(fn,l(E)?"Testing…":"Test SSH connection")}),Nt(Dt,()=>l(t).host,Ye=>l(t).host=Ye),Nt(ze,()=>l(t).port,Ye=>l(t).port=Ye),Nt(ti,()=>l(t).user,Ye=>l(t).user=Ye),Nt(Ut,()=>l(t).identityFile,Ye=>l(t).identityFile=Ye),j("click",ui,P),D(ft,Lt)};H(be,ft=>{l(d)==="ssh"&&ft(dt)})}var Pt=v(be,2);{var it=ft=>{var Lt=Zx(),ni=m(Lt);z(()=>O(ni,l(r))),D(ft,Lt)};H(Pt,ft=>{l(r)&&ft(it)})}var yt=v(Pt,2);{var Ee=ft=>{var Lt=Xee();D(ft,Lt)};H(yt,ft=>{l(s)&&ft(Ee)})}var He=v(yt,2),mt=m(He),At=m(mt);z(()=>{se=Ft(_e,1,"svelte-17yczfe",null,se,{active:l(d)==="local"}),Se=Ft(ue,1,"svelte-17yczfe",null,Se,{active:l(d)==="ssh"}),O(xe,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"),mt.disabled=l(n),O(At,l(n)?"Saving…":"Save")}),j("click",_e,()=>{x(d,"local"),l(u)||I()}),j("click",ue,()=>x(d,"ssh")),j("click",mt,M),D(o,Q),Ps()}Gs(["click"]);var Jee=F("<button> </button>"),ete=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 & Reload</em>.</span>',1),tte=F('<code>log_dest topic</code> is configured — waiting for messages…<br/> <span class="hint svelte-1yc29ow">If nothing appears, mosquitto may need a full restart for the change to take effect.</span>',1),ite=F('Waiting for log messages…<br/> <span class="hint svelte-1yc29ow">Make sure <code class="svelte-1yc29ow">log_dest topic</code> is set in mosquitto.conf.</span>',1),nte=F('<div class="empty svelte-1yc29ow"><!></div>'),ste=F('<div class="entry svelte-1yc29ow"><span class="ts svelte-1yc29ow"> </span> <span> </span> <span class="msg svelte-1yc29ow"> </span></div>'),ote=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 rte(o,e){Is(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(Di([])),r=B(!0),a=B(Di(new Set(["D","I","N","W","E"]))),d=B(void 0),u=B(!1),f=B(null),g=null;$s(async()=>{const Z=await bU().catch(()=>[]),ce=cq(),_e=new Set,se=[...Z,...ce].filter(ue=>n.has(ue.level)).map(ue=>({ts:ue.ts,level:ue.level,msg:ue.msg}));se.sort((ue,Se)=>ue.ts-Se.ts),x(s,se.filter(ue=>{const Se=`${ue.ts}\0${ue.msg}`;return _e.has(Se)?!1:(_e.add(Se),!0)}).slice(-500),!0),l(s).length>0&&(x(u,!0),fl().then(p)),g=Xo("brokerLog",ue=>{n.has(ue.level)&&(x(u,!0),x(s,[...l(s).slice(-499),{ts:ue.ts,level:ue.level,msg:ue.msg}],!0),l(r)&&fl().then(p))}),tx().then(ue=>{const Se=ue.managed.log_dest,Te=Array.isArray(Se)?Se:Se?[Se]:[];x(f,Te.includes("topic"),!0)}).catch(()=>{x(f,null)})}),jp(()=>{g==null||g()});function p(){l(d)&&(l(d).scrollTop=l(d).scrollHeight)}function C(Z){const ce=new Set(l(a));ce.has(Z)?ce.delete(Z):ce.add(Z),x(a,ce,!0)}function b(){x(s,[],!0),x(u,!1)}let E=Rt(()=>l(s).filter(Z=>l(a).has(Z.level)));function w(Z){const ce=new Date(Z);return ce.toTimeString().slice(0,8)+"."+String(ce.getMilliseconds()).padStart(3,"0")}var A=ote(),I=m(A),M=m(I);li(M,20,()=>["D","I","N","W","E"],Hi,(Z,ce)=>{var _e=Jee();let se;var ue=m(_e);z(Se=>{se=Ft(_e,1,`lvl-btn ${i[ce]??""}`,"svelte-1yc29ow",se,Se),rn(_e,"title",`Toggle ${ce??""} messages`),O(ue,t[ce])},[()=>({active:l(a).has(ce)})]),j("click",_e,()=>C(ce)),D(Z,_e)});var R=v(M,4),P=m(R),V=v(R,2),$=v(I,2),Q=m($);{var re=Z=>{var ce=nte(),_e=m(ce);{var se=Se=>{var Te=Ss(),xe=Et(Te);{var Oe=dt=>{var Pt=ete();D(dt,Pt)},We=dt=>{var Pt=tte();D(dt,Pt)},be=dt=>{var Pt=ite();D(dt,Pt)};H(xe,dt=>{l(f)===!1?dt(Oe):l(f)===!0?dt(We,1):dt(be,-1)})}D(Se,Te)},ue=Se=>{var Te=oo("No messages match the current filter.");D(Se,Te)};H(_e,Se=>{l(u)?Se(ue,-1):Se(se)})}D(Z,ce)},he=Z=>{var ce=Ss(),_e=Et(ce);li(_e,17,()=>l(E),se=>se.ts+se.msg,(se,ue)=>{var Se=ste(),Te=m(Se),xe=m(Te),Oe=v(Te,2),We=m(Oe),be=v(Oe,2),dt=m(be);z(Pt=>{O(xe,Pt),Ft(Oe,1,`badge ${i[l(ue).level]??""}`,"svelte-1yc29ow"),O(We,t[l(ue).level]),O(dt,l(ue).msg)},[()=>w(l(ue).ts)]),D(se,Se)}),D(Z,ce)};H(Q,Z=>{l(E).length===0?Z(re):Z(he,-1)})}cs($,Z=>x(d,Z),()=>l(d)),ws(P,()=>l(r),Z=>x(r,Z)),j("click",V,b),D(o,A),Ps()}Gs(["click"]);var ate=F('<div class="err svelte-d31be1"> </div>'),lte=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>'),cte=F('<div class="step svelte-d31be1"><p class="svelte-d31be1"> </p></div>'),dte=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>'),ute=F('<p class="hint svelte-d31be1">Restarting mosquitto… this may take a few seconds.</p>'),hte=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>`),fte=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>'),gte=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>'),pte=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 xte(o,e){Is(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(se){x(i,se.message,!0)}finally{x(n,!1)}}async function E(){x(n,!0),x(i,"");try{const se=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)})}),ue=await se.json();if(!se.ok||!ue.ok)throw new Error(ue.error??"Bootstrap failed");x(d,ue,!0);const Se=await Tl(),Te=Se.broker??{};await xp({...Se,broker:{...Te,dynsec:{adminUsername:ue.adminUsername,adminPassword:ue.adminPassword}}}),await DU().catch(()=>{}),x(t,"restart")}catch(se){x(i,se.message,!0)}finally{x(n,!1)}}async function w(){x(f,!0),x(i,"");try{await wU(),await new Promise(se=>setTimeout(se,2e3)),x(u,!0),x(t,"done")}catch(se){x(i,se.message,!0)}finally{x(f,!1)}}async function A(){x(C,!0),x(i,"");try{const se=await Tl(),ue=se.broker??{};await xp({...se,broker:{...ue,dynsec:{adminUsername:l(g),adminPassword:l(p)}}}),x(t,"done")}catch(se){x(i,se.message,!0)}finally{x(C,!1)}}var I=pte(),M=m(I),R=v(m(M),2),P=v(M,2);{var V=se=>{var ue=ate(),Se=m(ue);z(()=>O(Se,l(i))),D(se,ue)};H(P,se=>{l(i)&&se(V)})}var $=v(P,2);{var Q=se=>{var ue=lte(),Se=v(m(ue),6),Te=m(Se);z(()=>Te.disabled=l(n)),j("click",Te,()=>{x(t,"probe"),b()}),D(se,ue)},re=se=>{var ue=cte(),Se=m(ue),Te=m(Se);z(()=>O(Te,l(n)?"Probing dynsec…":"Checking dynsec status…")),D(se,ue)},he=se=>{var ue=dte(),Se=v(m(ue),2),Te=v(m(Se)),xe=v(Se,2),Oe=v(m(xe)),We=v(xe,2),be=v(m(We)),dt=v(We,2),Pt=m(dt),it=m(Pt);z(()=>{Pt.disabled=l(n)||!l(s),O(it,l(n)?"Bootstrapping…":"Bootstrap dynsec")}),Nt(Te,()=>l(s),yt=>x(s,yt)),Nt(Oe,()=>l(r),yt=>x(r,yt)),Nt(be,()=>l(a),yt=>x(a,yt)),j("click",Pt,E),D(se,ue)},Z=se=>{var ue=hte(),Se=v(m(ue),2),Te=v(m(Se),3),xe=m(Te),Oe=v(Se,4),We=m(Oe),be=m(We),dt=v(We,2),Pt=v(Oe,2);{var it=yt=>{var Ee=ute();D(yt,Ee)};H(Pt,yt=>{l(f)&&yt(it)})}z(()=>{O(xe,l(d).confFilePath),We.disabled=l(f),O(be,l(f)?"Restarting…":"Restart mosquitto now")}),j("click",We,w),j("click",dt,()=>{x(t,"done")}),D(se,ue)},ce=se=>{var ue=fte(),Se=v(m(ue),4),Te=m(Se);j("click",Te,function(...xe){var Oe;(Oe=e.onDone)==null||Oe.apply(this,xe)}),D(se,ue)},_e=se=>{var ue=gte(),Se=v(m(ue),2),Te=v(m(Se)),xe=v(Se,2),Oe=v(m(xe)),We=v(xe,2),be=m(We),dt=v(be,2),Pt=m(dt);z(()=>{dt.disabled=l(C)||!l(g)||!l(p),O(Pt,l(C)?"Saving…":"Save credentials")}),Nt(Te,()=>l(g),it=>x(g,it)),Nt(Oe,()=>l(p),it=>x(p,it)),j("click",be,()=>x(t,"intro")),j("click",dt,A),D(se,ue)};H($,se=>{l(t)==="intro"?se(Q):l(t)==="probe"?se(re,1):l(t)==="config"?se(he,2):l(t)==="restart"&&l(d)?se(Z,3):l(t)==="done"?se(ce,4):l(t)==="manual"&&se(_e,5)})}j("click",R,()=>x(t,"manual")),D(o,I),Ps()}Gs(["click"]);var aA=F('<div class="err svelte-bwar3a"> </div>'),vte=F('<div class="ok svelte-bwar3a">Saved.</div>'),mte=F('<div class="reload-msg svelte-bwar3a"> </div>'),_te=F('<div class="loading svelte-bwar3a">Loading…</div>'),bte=F('<li class="svelte-bwar3a"><span class="backup-name svelte-bwar3a"> </span> <button class="btn-restore svelte-bwar3a"> </button></li>'),Cte=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>'),Ete=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 yte(o,e){Is(e,!0);let t=B(""),i=B(null),n=B(Di([])),s=B(!0),r=B(""),a=B(!1),d=B(""),u=B(!1),f=B(!1),g=B(""),p=B(""),C;$s(()=>{b()});async function b(){x(s,!0),x(r,"");try{const He=await tx();x(t,He.raw??"",!0),x(i,He.checksum,!0),x(n,He.backups??[],!0)}catch(He){x(r,He.message??"Failed to load config",!0)}finally{x(s,!1)}}async function E(){var He;x(a,!0),x(d,""),x(u,!1);try{await CU(l(t),l(i)),x(u,!0),await b(),x(u,!0)}catch(mt){(He=mt.message)!=null&&He.includes("external_modify")||mt.status===409?x(d,"mosquitto.conf was modified externally since last read. Reload first."):x(d,mt.message??"Save failed",!0)}finally{x(a,!1)}}async function w(){x(f,!0),x(g,"");try{const He=await Ob();x(g,He.stderr||He.stdout||"Reloaded",!0)}catch(He){x(g,"Error: "+(He.message??"reload failed"))}finally{x(f,!1)}}async function A(He){if(await C.show(`Restore backup "${He}"? Current mosquitto.conf will be overwritten.`,{confirm:"Restore",danger:!0})){x(p,He,!0),x(d,"");try{await yU(He),await b()}catch(mt){x(d,mt.message??"Restore failed",!0)}finally{x(p,"")}}}async function I(){try{const He=await EU();x(n,He.backups,!0)}catch{}}function M(He){const mt=He.match(/\.bak-(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})/);return mt?`${mt[1]}-${mt[2]}-${mt[3]} ${mt[4]}:${mt[5]}:${mt[6]}`:He}var R=Ete(),P=Et(R),V=m(P),$=v(m(V),2),Q=m($),re=m(Q),he=v(Q,2),Z=m(he),ce=v(V,2);{var _e=He=>{var mt=aA(),At=m(mt);z(()=>O(At,l(r))),D(He,mt)};H(ce,He=>{l(r)&&He(_e)})}var se=v(ce,2);{var ue=He=>{var mt=aA(),At=m(mt);z(()=>O(At,l(d))),D(He,mt)};H(se,He=>{l(d)&&He(ue)})}var Se=v(se,2);{var Te=He=>{var mt=vte();D(He,mt)};H(Se,He=>{l(u)&&He(Te)})}var xe=v(Se,2);{var Oe=He=>{var mt=mte(),At=m(mt);z(()=>O(At,l(g))),D(He,mt)};H(xe,He=>{l(g)&&He(Oe)})}var We=v(xe,2),be=m(We);{var dt=He=>{var mt=_te();D(He,mt)},Pt=He=>{wg(He,{language:"ini",onSave:E,get value(){return l(t)},set value(mt){x(t,mt,!0)}})};H(be,He=>{l(s)?He(dt):He(Pt,-1)})}var it=v(We,2);{var yt=He=>{var mt=Cte(),At=m(mt),ft=v(m(At),2),Lt=v(At,2);li(Lt,21,()=>l(n),Hi,(ni,pi)=>{var xi=bte(),Dt=m(xi),ci=m(Dt),ze=v(Dt,2),we=m(ze);z(ti=>{O(ci,ti),ze.disabled=l(p)===l(pi),O(we,l(p)===l(pi)?"Restoring…":"Restore")},[()=>M(l(pi))]),j("click",ze,()=>A(l(pi))),D(ni,xi)}),j("click",ft,I),D(He,mt)};H(it,He=>{l(n).length>0&&He(yt)})}var Ee=v(P,2);cs(Xa(Ee,{}),He=>C=He,()=>C),z(()=>{Q.disabled=l(a)||l(s),O(re,l(a)?"Saving…":"Save"),he.disabled=l(f),O(Z,l(f)?"Reloading…":"Apply & Reload")}),j("click",Q,E),j("click",he,w),D(o,R),Ps()}Gs(["click"]);var wte=F('<div class="reload-msg svelte-1q1ovna"> </div>'),n1=F('<div class="err svelte-1q1ovna"> </div>'),lA=F('<div class="ok svelte-1q1ovna"> </div>'),cA=F('<div class="loading svelte-1q1ovna">Loading…</div>'),Ste=F('<span class="inline-err svelte-1q1ovna"> </span>'),Dte=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>'),Ate=F('<button class="svelte-1q1ovna">Change password</button> <button class="btn-danger svelte-1q1ovna"> </button>',1),kte=F('<tr><td class="user-name svelte-1q1ovna"> </td><td class="user-actions svelte-1q1ovna"><!></td></tr>'),Bte=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>'),Fte=F('<p class="empty svelte-1q1ovna">No users found — file may not exist yet.</p>'),Lte=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),Ite=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 <username></code> followed by <code class="svelte-1q1ovna">topic [read|write|readwrite] <pattern></code>.
|
|
233
|
+
Requires <code class="svelte-1q1ovna">acl_file</code> set in mosquitto.conf and no dynsec plugin.
|
|
234
|
+
After saving, click <strong>Apply & Reload</strong> above to activate changes.</p></section></div> <!>`,1);function Pte(o,e){Is(e,!0);let t=B("/etc/mosquitto/passwd"),i=B(Di([])),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),w=B(""),A=B(null),I=B("/etc/mosquitto/acl"),M=B(""),R=B(!1),P=B(""),V=B(""),$=B(!1),Q=B(!1),re=B(""),he;$s(async()=>{try{const Ye=await tx(),oi=Ye.listeners.find(Ei=>Ei.password_file);oi!=null&&oi.password_file&&x(t,oi.password_file,!0);const hi=Ye.listeners.find(Ei=>Ei.acl_file);hi!=null&&hi.acl_file&&x(I,hi.acl_file,!0),!(oi!=null&&oi.password_file)&&Ye.managed.password_file&&x(t,String(Ye.managed.password_file),!0),!(hi!=null&&hi.acl_file)&&Ye.managed.acl_file&&x(I,String(Ye.managed.acl_file),!0)}catch{}await Z(),await Se()});async function Z(){if(l(t)){x(n,!0),x(s,""),x(r,"");try{const Ye=await kU(l(t));x(i,Ye.users,!0)}catch(Ye){x(s,Ye.message??"Failed to load password file",!0)}finally{x(n,!1)}}}async function ce(){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 _2(l(t),l(a).trim(),l(d)),x(a,""),x(d,""),x(u,""),x(r,"User added."),await Z()}catch(Ye){x(g,Ye.message??"Failed to add user",!0)}finally{x(f,!1)}}async function _e(Ye){x(p,Ye,!0),x(C,""),x(b,""),x(w,"")}async function se(){if(!l(C)){x(w,"Password required");return}if(l(C)!==l(b)){x(w,"Passwords do not match");return}x(E,!0),x(w,""),x(r,"");try{await _2(l(t),l(p),l(C)),x(p,null),x(r,"Password updated.")}catch(Ye){x(w,Ye.message??"Failed to change password",!0)}finally{x(E,!1)}}async function ue(Ye){if(await he.show(`Delete user "${Ye}" from ${l(t)}?`,{confirm:"Delete",danger:!0})){x(A,Ye,!0),x(s,""),x(r,"");try{await BU(l(t),Ye),x(r,`User "${Ye}" deleted.`),await Z()}catch(oi){x(s,oi.message??"Delete failed",!0)}finally{x(A,null)}}}async function Se(){if(l(I)){x(R,!0),x(P,""),x(V,"");try{const Ye=await FU(l(I));x(M,Ye.content,!0)}catch(Ye){x(P,Ye.message??"Failed to load ACL file",!0)}finally{x(R,!1)}}}async function Te(){x($,!0),x(P,""),x(V,"");try{await LU(l(I),l(M)),x(V,"ACL file saved.")}catch(Ye){x(P,Ye.message??"Save failed",!0)}finally{x($,!1)}}async function xe(){x(Q,!0),x(re,"");try{const Ye=await Ob();x(re,Ye.stderr||Ye.stdout||"Reloaded",!0)}catch(Ye){x(re,"Error: "+(Ye.message??"reload failed"))}finally{x(Q,!1)}}var Oe=Ite(),We=Et(Oe),be=m(We),dt=m(be),Pt=v(m(dt),2),it=m(Pt),yt=m(it),Ee=v(dt,2),He=m(Ee),mt=v(m(He),2),At=v(He,2),ft=v(Ee,2);{var Lt=Ye=>{var oi=wte(),hi=m(oi);z(()=>O(hi,l(re))),D(Ye,oi)};H(ft,Ye=>{l(re)&&Ye(Lt)})}var ni=v(ft,2);{var pi=Ye=>{var oi=n1(),hi=m(oi);z(()=>O(hi,l(s))),D(Ye,oi)};H(ni,Ye=>{l(s)&&Ye(pi)})}var xi=v(ni,2);{var Dt=Ye=>{var oi=lA(),hi=m(oi);z(()=>O(hi,l(r))),D(Ye,oi)};H(xi,Ye=>{l(r)&&Ye(Dt)})}var ci=v(xi,2);{var ze=Ye=>{var oi=cA();D(Ye,oi)},we=Ye=>{var oi=Lte(),hi=Et(oi);{var Ei=et=>{var Y=Bte(),Ie=v(m(Y));li(Ie,21,()=>l(i),Hi,(le,pe)=>{var ii=kte(),di=m(ii),ne=m(di),nt=v(di),$t=m(nt);{var qt=Be=>{var Xe=Dte(),Zt=m(Xe),ei=v(Zt,2),Li=v(ei,2);{var vi=Le=>{var ht=Ste(),gt=m(ht);z(()=>O(gt,l(w))),D(Le,ht)};H(Li,Le=>{l(w)&&Le(vi)})}var me=v(Li,2),je=m(me),tt=v(me,2);z(()=>{me.disabled=l(E),O(je,l(E)?"…":"Save")}),Nt(Zt,()=>l(C),Le=>x(C,Le)),Nt(ei,()=>l(b),Le=>x(b,Le)),j("click",me,se),j("click",tt,()=>x(p,null)),D(Be,Xe)},Gt=Be=>{var Xe=Ate(),Zt=Et(Xe),ei=v(Zt,2),Li=m(ei);z(()=>{ei.disabled=l(A)===l(pe),O(Li,l(A)===l(pe)?"…":"Delete")}),j("click",Zt,()=>_e(l(pe))),j("click",ei,()=>ue(l(pe))),D(Be,Xe)};H($t,Be=>{l(p)===l(pe)?Be(qt):Be(Gt,-1)})}z(()=>O(ne,l(pe))),D(le,ii)}),D(et,Y)},Oi=et=>{var Y=Fte();D(et,Y)};H(hi,et=>{l(i).length>0?et(Ei):l(s)||et(Oi,1)})}var Gi=v(hi,2),ji=v(m(Gi),2),K=m(ji),De=v(K,2),at=v(De,2),Qe=v(at,2),Wt=m(Qe),si=v(ji,2);{var St=et=>{var Y=n1(),Ie=m(Y);z(()=>O(Ie,l(g))),D(et,Y)};H(si,et=>{l(g)&&et(St)})}z(()=>{Qe.disabled=l(f),O(Wt,l(f)?"Adding…":"Add")}),Nt(K,()=>l(a),et=>x(a,et)),Nt(De,()=>l(d),et=>x(d,et)),Nt(at,()=>l(u),et=>x(u,et)),j("click",Qe,ce),D(Ye,oi)};H(ci,Ye=>{l(n)?Ye(ze):Ye(we,-1)})}var ti=v(be,2),mi=m(ti),Ut=v(m(mi),2),Bi=m(Ut),Ki=m(Bi),Ci=v(mi,2),pn=m(Ci),nn=v(m(pn),2),cn=v(pn,2),on=v(Ci,2);{var vt=Ye=>{var oi=n1(),hi=m(oi);z(()=>O(hi,l(P))),D(Ye,oi)};H(on,Ye=>{l(P)&&Ye(vt)})}var Jt=v(on,2);{var Ni=Ye=>{var oi=lA(),hi=m(oi);z(()=>O(hi,l(V))),D(Ye,oi)};H(Jt,Ye=>{l(V)&&Ye(Ni)})}var zi=v(Jt,2),ui=m(zi);{var fn=Ye=>{var oi=cA();D(Ye,oi)},hn=Ye=>{wg(Ye,{language:"plaintext",onSave:Te,get value(){return l(M)},set value(oi){x(M,oi,!0)}})};H(ui,Ye=>{l(R)?Ye(fn):Ye(hn,-1)})}var xn=v(We,2);cs(Xa(xn,{}),Ye=>he=Ye,()=>he),z(()=>{it.disabled=l(Q),O(yt,l(Q)?"Reloading…":"Apply & Reload"),At.disabled=l(n),Bi.disabled=l($),O(Ki,l($)?"Saving…":"Save"),cn.disabled=l(R)}),j("click",it,xe),j("change",mt,Z),Nt(mt,()=>l(t),Ye=>x(t,Ye)),j("click",At,Z),j("click",Bi,Te),j("change",nn,Se),Nt(nn,()=>l(I),Ye=>x(I,Ye)),j("click",cn,Se),D(o,Oe),Ps()}Gs(["click","change"]);var Tte=F('<div class="loading svelte-zuhcpo">Loading…</div>'),Mte=F('<div class="error-banner svelte-zuhcpo"> </div>'),Rte=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>'),Nte=F('<button class="btn-wizard-inline svelte-zuhcpo">Setup Wizard ↗</button>'),Ote=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>'),Hte=F('<div class="error-inline svelte-zuhcpo"> </div>'),Wte=F('<button class="diag-btn svelte-zuhcpo"> </button>'),dA=F('<p class="diag-issue svelte-zuhcpo"> </p>'),zte=F('<p class="diag-ok-msg svelte-zuhcpo">✓ dynamic-security.json looks correct. Verify mosquitto restarted with the plugin loaded.</p>'),Vte=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),jte=F('<div><!></div> <button class="diag-btn svelte-zuhcpo" style="margin-top:6px"> </button>',1),$te=F('<button class="wizard-btn svelte-zuhcpo">Run Setup Wizard</button>'),Ute=F('<div class="diag-area svelte-zuhcpo"><!> <!></div>'),qte=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>'),Gte=F('<div style="margin-top: 20px;"><!></div>'),Kte=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),Zte=F('<div class="tab-content svelte-zuhcpo"><!></div>'),Xte=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 Yte(o,e){Is(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(Di(localStorage.getItem(d)??"status"));Kn(()=>{localStorage.setItem(d,l(u))});let f=B(null),g=B(""),p=B(!0);async function C(){try{x(f,await Nb(),!0),x(g,"")}catch(Dt){x(g,Dt.message??"Failed to load broker status",!0)}finally{x(p,!1)}}$s(()=>{C();const Dt=setInterval(C,1e4);return()=>clearInterval(Dt)});async function b(){x(r,!0),x(a,null);try{x(a,await AU(),!0)}catch(Dt){x(a,{ok:!1,dynSecPath:"",issues:[Dt.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 SU(),await C()}catch(Dt){x(s,Dt.message??"Deactivate failed",!0)}finally{x(n,!1)}}}function w(Dt){var ze;if(!((ze=l(f))!=null&&ze.sys))return"—";const ci=l(f).sys[Dt];return ci?String(ci.val??"—"):"—"}function A(Dt){if(Dt==="—")return Dt;const ci=Dt.match(/^(\d+)/),ze=ci?parseInt(ci[1]):NaN;if(isNaN(ze))return Dt;const we=Math.floor(ze/86400),ti=Math.floor(ze%86400/3600),mi=Math.floor(ze%3600/60),Ut=ze%60,Bi=Ki=>String(Ki).padStart(2,"0");return we>0?`${we}d ${Bi(ti)}:${Bi(mi)}:${Bi(Ut)}`:`${Bi(ti)}:${Bi(mi)}:${Bi(Ut)}`}function I(Dt){if(Dt==="—")return Dt;const ci=parseInt(Dt);return isNaN(ci)?Dt:ci<1024?`${ci} B`:ci<1048576?`${(ci/1024).toFixed(1)} KB`:ci<1073741824?`${(ci/1048576).toFixed(1)} MB`:`${(ci/1073741824).toFixed(1)} GB`}var M=Xte(),R=Et(M),P=m(R),V=m(P);let $;var Q=v(V,2);let re;var he=v(Q,2);let Z;var ce=v(he,2);let _e;var se=v(ce,2);let ue;var Se=v(se,2);let Te;var xe=v(Se,2);let Oe;var We=v(xe,2);let be;var dt=v(We,2);let Pt;var it=v(P,2);{var yt=Dt=>{var ci=Zte(),ze=m(ci);{var we=Ut=>{var Bi=Tte();D(Ut,Bi)},ti=Ut=>{var Bi=Mte(),Ki=m(Bi);z(()=>O(Ki,l(g))),D(Ut,Bi)},mi=Ut=>{var Bi=Kte(),Ki=Et(Bi),Ci=m(Ki),pn=m(Ci),nn=v(m(pn),4),cn=m(nn),on=v(pn,2);{var vt=Ei=>{var Oi=Rte(),Gi=m(Oi);let ji;var K=v(Gi,4);let De;var at=m(K);{var Qe=Y=>{var Ie=oo("plugin active");D(Y,Ie)},Wt=Y=>{var Ie=oo("connected — plugin not responding");D(Y,Ie)},si=Y=>{var Ie=oo("disconnected");D(Y,Ie)};H(at,Y=>{l(f).dynsec.dynsecReady?Y(Qe):l(f).dynsec.connected?Y(Wt,1):Y(si,-1)})}var St=v(K,2),et=m(St);z(()=>{ji=Ft(Gi,1,"dot svelte-zuhcpo",null,ji,{ok:l(f).dynsec.dynsecReady,warn:l(f).dynsec.connected&&!l(f).dynsec.dynsecReady,"dot-err":!l(f).dynsec.connected}),De=Ft(K,1,"conn-detail svelte-zuhcpo",null,De,{ok:l(f).dynsec.dynsecReady,warn:l(f).dynsec.connected&&!l(f).dynsec.dynsecReady,err:!l(f).dynsec.connected}),St.disabled=l(n),O(et,l(n)?"…":"deactivate")}),j("click",St,E),D(Ei,Oi)},Jt=Ei=>{var Oi=Ote(),Gi=v(m(Oi),6);{var ji=K=>{var De=Nte();j("click",De,()=>x(t,!0)),D(K,De)};H(Gi,K=>{l(t)||K(ji)})}D(Ei,Oi)};H(on,Ei=>{l(f).dynsec.configured?Ei(vt):Ei(Jt,-1)})}var Ni=v(on,2);{var zi=Ei=>{var Oi=Hte(),Gi=m(Oi);z(()=>O(Gi,l(s))),D(Ei,Oi)};H(Ni,Ei=>{l(s)&&Ei(zi)})}var ui=v(Ci,2);{var fn=Ei=>{var Oi=Ute(),Gi=m(Oi);{var ji=Qe=>{var Wt=Wte(),si=m(Wt);z(()=>{Wt.disabled=l(r),O(si,l(r)?"Running diagnostics…":"Run diagnostics")}),j("click",Wt,b),D(Qe,Wt)},K=Qe=>{var Wt=jte(),si=Et(Wt);let St;var et=m(si);{var Y=ii=>{var di=dA(),ne=m(di);z(()=>O(ne,`⚠ ${l(a).error??""}`)),D(ii,di)},Ie=ii=>{var di=Vte(),ne=Et(di),nt=v(m(ne)),$t=m(nt),qt=v(ne,2),Gt=v(m(qt)),Be=m(Gt),Xe=v(qt,2),Zt=v(m(Xe)),ei=m(Zt),Li=v(Xe,2),vi=v(m(Li)),me=m(vi),je=v(Li,2);li(je,17,()=>l(a).issues,Hi,(ht,gt)=>{var Xt=dA(),U=m(Xt);z(()=>O(U,`⚠ ${l(gt)??""}`)),D(ht,Xt)});var tt=v(je,2);{var Le=ht=>{var gt=zte();D(ht,gt)};H(tt,ht=>{l(a).ok&&ht(Le)})}z(()=>{O($t,l(a).dynSecPath),Ft(Gt,1,hg(l(a).adminClientExists?"ok":"fail"),"svelte-zuhcpo"),O(Be,l(a).adminClientExists?"✓ yes":"✗ no"),Ft(Zt,1,hg(l(a).hasAdminRole?"ok":"fail"),"svelte-zuhcpo"),O(ei,l(a).hasAdminRole?"✓ yes":"✗ no"),Ft(vi,1,hg(l(a).hasControlSendAcl?"ok":"fail"),"svelte-zuhcpo"),O(me,l(a).hasControlSendAcl?"✓ present":"✗ missing")}),D(ii,di)};H(et,ii=>{l(a).error?ii(Y):ii(Ie,-1)})}var le=v(si,2),pe=m(le);z(()=>{St=Ft(si,1,"diag-card svelte-zuhcpo",null,St,{"diag-ok":l(a).ok,"diag-fail":!l(a).ok}),le.disabled=l(r),O(pe,l(r)?"Running…":"Re-run")}),j("click",le,b),D(Qe,Wt)};H(Gi,Qe=>{l(a)?Qe(K,-1):Qe(ji)})}var De=v(Gi,2);{var at=Qe=>{var Wt=$te();j("click",Wt,()=>x(t,!0)),D(Qe,Wt)};H(De,Qe=>{l(t)||Qe(at)})}D(Ei,Oi)};H(ui,Ei=>{l(f).dynsec.configured&&l(f).dynsec.connected&&!l(f).dynsec.dynsecReady&&Ei(fn)})}var hn=v(ui,2);{var xn=Ei=>{var Oi=qte(),Gi=m(Oi),ji=v(m(Gi)),K=m(ji),De=v(ji,3),at=m(De),Qe=v(De,3),Wt=m(Qe),si=v(Qe,3),St=m(si),et=v(si,3),Y=m(et),Ie=v(et,3),le=m(Ie);z((pe,ii,di,ne,nt,$t,qt,Gt,Be,Xe,Zt,ei)=>{O(K,pe),O(at,ii),O(Wt,`${di??""} connected · ${ne??""} max · ${nt??""} total`),O(St,`${$t??""} rcv · ${qt??""} sent · ${Gt??""} stored`),O(Y,`${Be??""} retained · ${Xe??""} subscriptions`),O(le,`${Zt??""} in · ${ei??""} out`)},[()=>w("$SYS/broker/version"),()=>A(w("$SYS/broker/uptime")),()=>w("$SYS/broker/clients/connected"),()=>w("$SYS/broker/clients/maximum"),()=>w("$SYS/broker/clients/total"),()=>w("$SYS/broker/messages/received"),()=>w("$SYS/broker/messages/sent"),()=>w("$SYS/broker/messages/stored"),()=>w("$SYS/broker/retained messages/count"),()=>w("$SYS/broker/subscriptions/count"),()=>I(w("$SYS/broker/bytes/received")),()=>I(w("$SYS/broker/bytes/sent"))]),D(Ei,Oi)},Ye=Rt(()=>Object.keys(l(f).sys).length>0);H(hn,Ei=>{l(Ye)&&Ei(xn)})}var oi=v(Ki,2);{var hi=Ei=>{var Oi=Gte(),Gi=m(Oi);xte(Gi,{onDone:()=>{x(t,!1),C()}}),D(Ei,Oi)};H(oi,Ei=>{l(t)&&(!l(f).dynsec.configured||!l(f).dynsec.dynsecReady)&&Ei(hi)})}z(()=>O(cn,l(f).sshConfigured?`ssh — ${l(f).sshHost}`:"local")),D(Ut,Bi)};H(ze,Ut=>{l(p)?Ut(we):l(g)?Ut(ti,1):l(f)&&Ut(mi,2)})}D(Dt,ci)},Ee=Dt=>{{let ci=Rt(()=>{var ze;return((ze=l(f))==null?void 0:ze.dynsec.dynsecReady)??!1});eee(Dt,{get dynsecReady(){return l(ci)}})}},He=Dt=>{bee(Dt,{})},mt=Dt=>{yte(Dt,{})},At=Dt=>{Pte(Dt,{})},ft=Dt=>{gee(Dt,{})},Lt=Dt=>{zee(Dt,{})},ni=Dt=>{Qee(Dt,{})},pi=Dt=>{rte(Dt,{})};H(it,Dt=>{l(u)==="status"?Dt(yt):l(u)==="users"?Dt(Ee,1):l(u)==="brokerconfig"?Dt(He,2):l(u)==="advanced"?Dt(mt,3):l(u)==="passwd"?Dt(At,4):l(u)==="listeners"?Dt(ft,5):l(u)==="certs"?Dt(Lt,6):l(u)==="ssh"?Dt(ni,7):l(u)==="logs"&&Dt(pi,8)})}var xi=v(R,2);cs(Xa(xi,{}),Dt=>i=Dt,()=>i),z(()=>{$=Ft(V,1,"svelte-zuhcpo",null,$,{active:l(u)==="status"}),re=Ft(Q,1,"svelte-zuhcpo",null,re,{active:l(u)==="users"}),Z=Ft(he,1,"svelte-zuhcpo",null,Z,{active:l(u)==="brokerconfig"}),_e=Ft(ce,1,"svelte-zuhcpo",null,_e,{active:l(u)==="advanced"}),ue=Ft(se,1,"svelte-zuhcpo",null,ue,{active:l(u)==="passwd"}),Te=Ft(Se,1,"svelte-zuhcpo",null,Te,{active:l(u)==="listeners"}),Oe=Ft(xe,1,"svelte-zuhcpo",null,Oe,{active:l(u)==="certs"}),be=Ft(We,1,"svelte-zuhcpo",null,be,{active:l(u)==="ssh"}),Pt=Ft(dt,1,"svelte-zuhcpo",null,Pt,{active:l(u)==="logs"})}),j("click",V,()=>x(u,"status")),j("click",Q,()=>x(u,"users")),j("click",he,()=>x(u,"brokerconfig")),j("click",ce,()=>x(u,"advanced")),j("click",se,()=>x(u,"passwd")),j("click",Se,()=>x(u,"listeners")),j("click",xe,()=>x(u,"certs")),j("click",We,()=>x(u,"ssh")),j("click",dt,()=>x(u,"logs")),D(o,M),Ps()}Gs(["click"]);var Qte=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q"></span>'),Jte=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="MQTT broker not connected"></span>'),eie=F('<span class="nav-dot nav-dot--warn nav-dot--blink svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),tie=F('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="MQTT connected"></span>'),iie=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>'),nie=F('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="All Matter devices online"></span>'),sie=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Some Matter devices offline"></span>'),oie=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="No Matter devices online"></span>'),rie=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>'),aie=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>'),lie=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="Errors in recent logs"></span>'),cie=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Warnings in recent logs"></span>'),die=F('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),uie=F('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),hie=F('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),fie=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>'),gie=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>'),pie=F('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),xie=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),vie=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),mie=F('<dl class="svelte-1n46o8q"><!> <dt class="svelte-1n46o8q">Scripts</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT topics</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT msg/s</dt><dd class="svelte-1n46o8q"> </dd> <!> <!> <dt class="svelte-1n46o8q">Handlers</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Memory</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">CPU</dt><dd class="svelte-1n46o8q"> </dd></dl>'),_ie=F('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),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"><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>'),Cie=F('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><!></div></div>'),Eie=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>'),yie=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>'),wie=F('<div class="login-error svelte-1n46o8q"> </div>'),Sie=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>'),Die=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>'),Aie=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>'),kie=F("<!> <!> <!> <!>",1);function Bie(o,e){Is(e,!0);const t=["scripts","mqtt","matter","security","db","logs","config","packages"];function i(){const At=location.hash.slice(1);return t.includes(At)?At:"scripts"}let n=B(Di(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),w=B(!1);V$(()=>{x(p,!0)});async function A(){x(b,""),x(E,!0);try{await U$(l(C)),x(C,""),x(p,!1)}catch(At){x(b,At.message??"Login failed",!0)}finally{x(E,!1)}}async function I(){if(l(f)==="proxy"&&l(g)){window.location.href=l(g);return}await q$(),x(p,!0)}let M=B(null),R=B(!1),P=B(!1),V=B(!1),$=B(!1),Q=B(Di([])),re=B(0),he=B(!1),Z=B(Di([]));const ce=Rt(()=>l(Z).filter(At=>At.online).length),_e=Rt(()=>l(Z).length===0?"none":l(ce)===l(Z).length?"all":l(ce)>0?"some":"offline");let se=B(!1),ue=B(!1);async function Se(){if(!await l(M).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;x(R,!0);let At;try{At=(await ef()).startedAt}catch{}try{await SF()}catch{}const ft=Date.now()+6e4;for(;Date.now()<ft;){await new Promise(Lt=>setTimeout(Lt,250));try{const Lt=await ef();if(At===void 0||Lt.startedAt!==At){location.reload();return}}catch{}}location.reload()}async function Te(){x(d,!0);try{const At=await Q$();l(s)&&x(s,{...l(s),latestVersion:At.latestVersion??void 0},!0)}catch{}finally{x(d,!1)}}async function xe(){var Lt,ni;if(!await l(M).show(`Update to v${(Lt=l(s))==null?void 0:Lt.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;x(a,!1),x(u,!0);const At=(ni=l(s))==null?void 0:ni.startedAt;try{await Y$()}catch{}const ft=Date.now()+18e4;for(;Date.now()<ft;){await new Promise(pi=>setTimeout(pi,1e3));try{const pi=await ef();if(At===void 0||pi.startedAt!==At){location.reload();return}}catch{x(u,!1),x(R,!0)}}location.reload()}function Oe(At){x(n,At,!0),location.hash=At}$s(async()=>{location.hash||(location.hash=l(n));const At=()=>{x(n,i(),!0)};window.addEventListener("hashchange",At);try{const ze=await $$();x(f,ze.mode,!0),x(g,ze.proxyLogoutUrl??"",!0),l(f)==="password"&&(await fetch("/she/scripts")).status===401&&x(p,!0)}catch{}x(w,!0);async function ft(){var ze,we,ti;try{x(s,await ef(),!0)}catch{}try{const[mi,Ut]=await Promise.all([kF(),Tl()]);x(Q,Array.isArray(Ut.pinnedPackages)?Ut.pinnedPackages:[],!0),x(re,Object.keys(mi).filter(Ki=>!l(Q).includes(Ki)).length,!0);const Bi=l(he);x(he,((ze=Ut.broker)==null?void 0:ze.enabled)===!0),Bi&&!l(he)&&l(n)==="security"&&Oe("scripts")}catch{}!((we=l(s))!=null&&we.matterEnabled)&&l(n)==="matter"&&Oe("scripts"),!((ti=l(s))!=null&&ti.dbEnabled)&&l(n)==="db"&&Oe("scripts")}ft();const Lt=setInterval(ft,5e3),ni=Xo("mqtt:status",ze=>{ze.connected===!1?(x($,!0),x(P,!1),x(V,!1)):(x($,!1),x(P,ze.ready===!1),x(V,ze.ready===!0))}),pi=Xo("matter:deviceList",ze=>{Array.isArray(ze.devices)&&x(Z,ze.devices.map(we=>({nodeId:String(we.nodeId),online:!!we.online})),!0)}),xi=Xo("matter:deviceStatus",ze=>{if(ze.nodeId===void 0)return;const we=String(ze.nodeId),ti=!!ze.online;x(Z,l(Z).map(mi=>mi.nodeId===we?{...mi,online:ti}:mi),!0)}),Dt=RF();x(se,Dt.some(ze=>ze.level==="error"),!0),x(ue,!l(se)&&Dt.some(ze=>ze.level==="warn"),!0);const ci=vS(ze=>{ze.level==="error"?(x(se,!0),x(ue,!1)):ze.level==="warn"&&!l(se)&&x(ue,!0)});return()=>{window.removeEventListener("hashchange",At),clearInterval(Lt),ni(),pi(),xi(),ci()}});var We=kie();xs("click",g6,()=>{l(r)&&x(r,!1),l(a)&&x(a,!1)});var be=Et(We);{var dt=At=>{var ft=yie(),Lt=m(ft),ni=v(m(Lt),2);let pi;var xi=v(ni,2);let Dt;var ci=v(m(xi),2);{var ze=T=>{var W=Qte();z(()=>rn(W,"title",`${l(re)??""} package update${l(re)===1?"":"s"} available`)),D(T,W)};H(ci,T=>{l(re)>0&&T(ze)})}var we=v(xi,2);let ti;var mi=v(m(we),2);{var Ut=T=>{var W=Jte();D(T,W)},Bi=T=>{var W=eie();D(T,W)},Ki=T=>{var W=tie();D(T,W)};H(mi,T=>{l($)?T(Ut):l(P)?T(Bi,1):l(V)&&T(Ki,2)})}var Ci=v(we,2);{var pn=T=>{var W=iie();let J;z(()=>J=Ft(W,1,"svelte-1n46o8q",null,J,{active:l(n)==="security"})),j("click",W,()=>Oe("security")),D(T,W)};H(Ci,T=>{l(he)&&T(pn)})}var nn=v(Ci,2);{var cn=T=>{var W=rie();let J;var ie=v(m(W),2);{var ae=$e=>{var Ce=nie();D($e,Ce)},oe=$e=>{var Ce=sie();D($e,Ce)},Ae=$e=>{var Ce=oie();D($e,Ce)};H(ie,$e=>{l(_e)==="all"?$e(ae):l(_e)==="some"?$e(oe,1):l(_e)==="offline"&&$e(Ae,2)})}z(()=>J=Ft(W,1,"svelte-1n46o8q",null,J,{active:l(n)==="matter"})),j("click",W,()=>Oe("matter")),D(T,W)};H(nn,T=>{var W;(W=l(s))!=null&&W.matterEnabled&&T(cn)})}var on=v(nn,2);{var vt=T=>{var W=aie();let J;z(()=>J=Ft(W,1,"svelte-1n46o8q",null,J,{active:l(n)==="db"})),j("click",W,()=>Oe("db")),D(T,W)};H(on,T=>{var W;(W=l(s))!=null&&W.dbEnabled&&T(vt)})}var Jt=v(on,2);let Ni;var zi=v(m(Jt),2);{var ui=T=>{var W=lie();D(T,W)},fn=T=>{var W=cie();D(T,W)};H(zi,T=>{l(se)?T(ui):l(ue)&&T(fn,1)})}var hn=v(Jt,4),xn=v(m(hn),2),Ye=m(xn),oi=m(Ye);oi.nodeValue="v1.17.0 ";var hi=v(oi);{var Ei=T=>{var W=die();D(T,W)};H(hi,T=>{var W,J;(W=l(s))!=null&&W.latestVersion&&!((J=l(s))!=null&&J.docker)&&T(Ei)})}var Oi=v(Ye,2);{var Gi=T=>{var W=gie(),J=m(W),ie=v(m(J));ie.textContent="v1.17.0";var ae=v(ie,2);{var oe=de=>{var Ke=uie(),Tt=v(Et(Ke)),Ue=m(Tt);z(()=>O(Ue,`v${l(s).latestVersion??""}`)),D(de,Ke)},Ae=de=>{var Ke=hie();D(de,Ke)};H(ae,de=>{var Ke;(Ke=l(s))!=null&&Ke.latestVersion?de(oe):de(Ae,-1)})}var $e=v(J,2),Ce=m($e);{var Pe=de=>{var Ke=fie(),Tt=v(m(Ke));z(()=>O(Tt,` Update to v${l(s).latestVersion??""}`)),j("click",Ke,xe),D(de,Ke)};H(Ce,de=>{var Ke;(Ke=l(s))!=null&&Ke.latestVersion&&de(Pe)})}var Ne=v(Ce,2),ct=m(Ne);let ri;var X=v(ct);z(()=>{Ne.disabled=l(d),ri=Ft(ct,0,"svelte-1n46o8q",null,ri,{spinning:l(d)}),O(X,` ${l(d)?"Checking…":"Check for updates"}`)}),j("click",W,de=>de.stopPropagation()),j("click",Ne,Te),D(T,W)};H(Oi,T=>{var W;l(a)&&!((W=l(s))!=null&&W.docker)&&T(Gi)})}var ji=v(xn,2),K=m(ji),De=v(K,2);{var at=T=>{var W=Cie(),J=m(W);{var ie=Ce=>{var Pe=mie(),Ne=m(Pe);{var ct=rt=>{const ve=Rt(()=>Math.floor((Date.now()-l(s).startedAt)/1e3)),Ge=Rt(()=>Math.floor(l(ve)/86400)),_t=Rt(()=>Math.floor(l(ve)%86400/3600)),Vt=Rt(()=>Math.floor(l(ve)%3600/60));var Ct=pie(),Ot=v(Et(Ct)),bi=m(Ot);z(()=>O(bi,`${l(Ge)>0?l(Ge)+"d ":""}${l(_t)>0||l(Ge)>0?l(_t)+"h ":""}${l(Vt)??""}m`)),D(rt,Ct)};H(Ne,rt=>{l(s).startedAt&&rt(ct)})}var ri=v(Ne,3),X=m(ri),de=v(ri,3),Ke=m(de),Tt=v(de,3),Ue=m(Tt),qe=v(Tt,2);{var It=rt=>{var ve=xie(),Ge=v(Et(ve)),_t=m(Ge),Vt=v(Ge,3),Ct=m(Vt);z(()=>{O(_t,l(s).matterNodes??0),O(Ct,l(s).matterEndpoints??0)}),D(rt,ve)};H(qe,rt=>{l(s).matterEnabled&&rt(It)})}var pt=v(qe,2);{var ot=rt=>{var ve=vie(),Ge=v(Et(ve)),_t=m(Ge),Vt=v(Ge,3),Ct=m(Vt);z(()=>{O(_t,l(s).dbDocs??"—"),O(Ct,l(s).dbViews??"—")}),D(rt,ve)};H(pt,rt=>{l(s).dbEnabled&&rt(ot)})}var fe=v(pt,3),Ve=m(fe),Me=v(fe,3),Je=m(Me),kt=v(Me,3),st=m(kt);z(()=>{O(X,l(s).scripts),O(Ke,l(s).topics),O(Ue,l(s).mqttMsgPerSec??"—"),O(Ve,l(s).handlers??"—"),O(Je,l(s).memMb!=null?l(s).memMb+" MB":"—"),O(st,l(s).cpuPercent!=null?l(s).cpuPercent+" %":"—")}),D(Ce,Pe)},ae=Ce=>{var Pe=_ie();D(Ce,Pe)};H(J,Ce=>{l(s)?Ce(ie):Ce(ae,-1)})}var oe=v(J,2),Ae=m(oe);{var $e=Ce=>{var Pe=bie();j("click",Pe,()=>{x(r,!1),Se()}),D(Ce,Pe)};H(Ae,Ce=>{var Pe;(Pe=l(s))!=null&&Pe.docker||Ce($e)})}j("click",W,Ce=>Ce.stopPropagation()),D(T,W)};H(De,T=>{l(r)&&T(at)})}var Qe=v(ji,2);let Wt;var si=v(Qe,2);{var St=T=>{var W=Eie();j("click",W,I),D(T,W)};H(si,T=>{l(f)==="password"&&T(St)})}var et=v(Lt,2),Y=m(et);cs(Xa(Y,{}),T=>x(M,T,!0),()=>l(M));var Ie=v(Y,2);let le;var pe=m(Ie);{let T=Rt(()=>l(n)==="scripts");yZ(pe,{get active(){return l(T)}})}var ii=v(Ie,2);let di;var ne=m(ii);_J(ne,{});var nt=v(ii,2);let $t;var qt=m(nt);eJ(qt,{});var Gt=v(nt,2);let Be;var Xe=m(Gt);mQ(Xe,{});var Zt=v(Gt,2);let ei;var Li=m(Zt);Yte(Li,{});var vi=v(Zt,2);let me;var je=m(vi);CY(je,{});var tt=v(vi,2);let Le;var ht=m(tt);dX(ht,{});var gt=v(tt,2);let Xt;var U=m(gt);pX(U,{}),z(()=>{pi=Ft(ni,1,"svelte-1n46o8q",null,pi,{active:l(n)==="scripts"}),Dt=Ft(xi,1,"svelte-1n46o8q",null,Dt,{active:l(n)==="packages"}),ti=Ft(we,1,"svelte-1n46o8q",null,ti,{active:l(n)==="mqtt"}),Ni=Ft(Jt,1,"svelte-1n46o8q",null,Ni,{active:l(n)==="logs"}),Wt=Ft(Qe,1,"nav-settings svelte-1n46o8q",null,Wt,{active:l(n)==="config"}),le=Ft(Ie,1,"page-wrap svelte-1n46o8q",null,le,{hidden:l(n)!=="scripts"}),di=Ft(ii,1,"page-wrap svelte-1n46o8q",null,di,{hidden:l(n)!=="packages"}),$t=Ft(nt,1,"page-wrap svelte-1n46o8q",null,$t,{hidden:l(n)!=="mqtt"}),Be=Ft(Gt,1,"page-wrap svelte-1n46o8q",null,Be,{hidden:l(n)!=="matter"}),ei=Ft(Zt,1,"page-wrap svelte-1n46o8q",null,ei,{hidden:l(n)!=="security"}),me=Ft(vi,1,"page-wrap svelte-1n46o8q",null,me,{hidden:l(n)!=="db"}),Le=Ft(tt,1,"page-wrap svelte-1n46o8q",null,Le,{hidden:l(n)!=="config"}),Xt=Ft(gt,1,"page-wrap svelte-1n46o8q",null,Xt,{hidden:l(n)!=="logs"})}),j("click",ni,()=>Oe("scripts")),j("click",xi,()=>Oe("packages")),j("click",we,()=>Oe("mqtt")),j("click",Jt,()=>{Oe("logs"),x(se,!1),x(ue,!1)}),j("click",Ye,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",Qe,()=>Oe("config")),D(At,ft)};H(be,At=>{l(w)&&!l(p)&&At(dt)})}var Pt=v(be,2);{var it=At=>{var ft=Sie(),Lt=m(ft),ni=v(m(Lt),4),pi=v(m(ni),2),xi=v(ni,2);{var Dt=we=>{var ti=wie(),mi=m(ti);z(()=>O(mi,l(b))),D(we,ti)};H(xi,we=>{l(b)&&we(Dt)})}var ci=v(xi,2),ze=m(ci);z(()=>{pi.disabled=l(E),ci.disabled=l(E)||!l(C),O(ze,l(E)?"Signing in…":"Sign in")}),xs("submit",Lt,we=>{we.preventDefault(),A()}),Nt(pi,()=>l(C),we=>x(C,we)),D(At,ft)};H(Pt,At=>{l(p)&&At(it)})}var yt=v(Pt,2);{var Ee=At=>{var ft=Die();D(At,ft)};H(yt,At=>{l(R)&&At(Ee)})}var He=v(yt,2);{var mt=At=>{var ft=Aie();D(At,ft)};H(He,At=>{l(u)&&At(mt)})}D(o,We),Ps()}Gs(["click"]);rP(Bie,{target:document.getElementById("app")});export{q6 as t};
|