smart-home-engine 1.48.1 → 1.48.3

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonMode-BRIqcXAV.js","assets/monaco-langs-DKJI_o9J.js","assets/monaco-langs-DyX1CsEw.css","assets/tsMode-Bw4L07QT.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonMode-BRIqcXAV.js","assets/monaco-langs-DKJI_o9J.js","assets/monaco-langs-DyX1CsEw.css","assets/tsMode-Daa0DLzL.js"])))=>i.map(i=>d[i]);
2
2
  var xF=Object.defineProperty;var A2=r=>{throw TypeError(r)};var mF=(r,e,t)=>e in r?xF(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var es=(r,e,t)=>mF(r,typeof e!="symbol"?e+"":e,t),yb=(r,e,t)=>e.has(r)||A2("Cannot "+t);var Zt=(r,e,t)=>(yb(r,e,"read from private field"),t?t.call(r):e.get(r)),Zn=(r,e,t)=>e.has(r)?A2("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Yn=(r,e,t,i)=>(yb(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),Ms=(r,e,t)=>(yb(r,e,"access private method"),t);import{_ as e6,m as t6,l as Yi,A as fr,C as si,I as Hs,D as G0,a as ao,g as i6,M as Hi,b as mn,E as Ya,c as le,r as gs,d as Ea,e as F,f as _F,h as Ts,R as Xn,S as pn,i as qo,j as Sa,k as ns,n as On,o as Qt,p as yi,K as co,q as Ui,s as Pi,t as go,u as Ge,v as qn,O as Bl,w as ho,P as Xi,x as wb,y as K0,z as n6,B as rc,F as Xa,G as ey,H as Ao,U as xs,J as lp,L as Qi,N as hc,Q as bF,T as lr,V as ty,W as CF,X as s6,$ as qi,Y as as,Z as is,a0 as Vs,a1 as Ln,a2 as zr,a3 as Jg,a4 as Li,a5 as _x,a6 as yF,a7 as wF,a8 as po,a9 as EF,aa as Qa,ab as pr,ac as nn,ad as o6,ae as Rs,af as SF,ag as kF,ah as dr,ai as zp,aj as uo,ak as d1,al as tr,am as Id,an as AS,ao as u1,ap as yo,aq as cp,ar as wo,as as h1,at as f1,au as DF,av as Z0,aw as Wp,ax as wc,ay as AF,az as jp,aA as BF,aB as BS,aC as FF,aD as LF,aE as B2,aF as ro,aG as ac,aH as ir,aI as Rn,aJ as tc,aK as IF,aL as Tl,aM as Nr,aN as bo,aO as Ja,aP as FS,aQ as vo,aR as io,aS as Kx,aT as Mn,aU as r6,aV as PF,aW as LS,aX as p1,aY as IS,aZ as PS,a_ as uu,a$ as TF,b0 as TS,b1 as MF,b2 as MS,b3 as Ec,b4 as Sc,b5 as dp,b6 as e0,b7 as Er,b8 as Y0,b9 as Zx,ba as Eb,bb as Ds,bc as RS,bd as X0,be as g1,bf as RF,bg as a6,bh as t0,bi as up,bj as i0,bk as Q0,bl as v1,bm as ss,bn as Pd,bo as J0,bp as NF,bq as OF,br as NS,bs as HF,bt as Yx,bu as Jr,bv as OS,bw as hp,bx as kc,by as Vp,bz as Vn,bA as fp,bB as l6,bC as ev,bD as zF,bE as hu,bF as zi,bG as F2,bH as bx,bI as c6,bJ as Aa,bK as Ua,bL as Ls,bM as pp,bN as xa,bO as gp,bP as js,bQ as n0,bR as Dh,bS as iy,bT as d6,bU as u6,bV as h6,bW as HS,bX as mr,bY as fs,bZ as tv,b_ as f6,b$ as lc,c0 as x1,c1 as WF,c2 as vf,c3 as L2,c4 as iv,c5 as p6,c6 as xf,c7 as jF,c8 as la,c9 as m1,ca as VF,cb as gr,cc as el,cd as nv,ce as s0,cf as g6,cg as Zr,ch as sv,ci as _1,cj as $F,ck as qF,cl as UF,cm as $p,cn as Ml,co as Co,cp as GF,cq as zS,cr as KF,cs as ZF,ct as I2,cu as YF,cv as ov,cw as fc,cx as ny,cy as lh,cz as pc,cA as XF,cB as Fl,cC as ma,cD as Tr,cE as P2,cF as Go,cG as rv,cH as yd,cI as Rl,cJ as QF,cK as tl,cL as o0,cM as b1,cN as v6,cO as JF,cP as eL,cQ as WS,cR as tL,cS as r0,cT as iL,cU as Xc,cV as a0,cW as T2,cX as nL,cY as sL,cZ as Hl,c_ as oL,c$ as jS,d0 as x6,d1 as m6,d2 as _6,d3 as b6,d4 as rL,d5 as aL,d6 as C6,d7 as y6,d8 as lL,d9 as VS,da as cL,db as dL,dc as Ys,dd as uL,de as $S,df as hL,dg as mf,dh as M2,di as fL,dj as pL,dk as gL,dl as vL,dm as xL,dn as mL,dp as vp,dq as C1,dr as sy,ds as _L,dt as bL,du as R2,dv as oy,dw as CL,dx as N2,dy as Sb,dz as yL,dA as w6,dB as wL,dC as E6,dD as ry,dE as EL,dF as SL,dG as kL,dH as S6,dI as k6,dJ as DL,dK as Xx,dL as D6,dM as y1,dN as AL,dO as BL,dP as wd,dQ as qS,dR as FL,dS as O2,dT as H2,dU as LL,dV as _f,dW as A6,dX as IL,dY as PL,dZ as TL,d_ as ML,d$ as B6,e0 as F6,e1 as L6,e2 as I6,e3 as RL,e4 as Ll,e5 as z2,e6 as NL,e7 as av,e8 as OL,e9 as vg,ea as P6,eb as W2,ec as l0,ed as T6,ee as Qx,ef as HL,eg as M6,eh as zL,ei as R6,ej as WL,ek as jL,el as N6,em as O6,en as gc,eo as w1,ep as VL,eq as H6,er as Or,es as fu,et as z6,eu as $L,ev as qL,ew as W6,ex as j6,ey as UL,ez as V6,eA as $6,eB as c0,eC as GL,eD as KL,eE as ZL,eF as YL,eG as og,eH as j2,eI as XL,eJ as QL,eK as JL,eL as Jx,eM as Io,eN as eI,eO as ay,eP as Ah,eQ as tI,eR as ec,eS as iI,eT as nI,eU as q6,eV as sI,eW as Pg,eX as oI,eY as rI,eZ as aI,e_ as lI,e$ as V2,f0 as $2,f1 as q2,f2 as Bh,f3 as US,f4 as U6,f5 as ly,f6 as Cx,f7 as G6,f8 as em,f9 as cI,fa as dI,fb as uI,fc as hI,fd as GS,fe as K6,ff as fI,fg as tm,fh as Z6,fi as Y6,fj as pI,fk as gI,fl as vI,fm as xI,fn as mI,fo as _I,fp as bI,fq as CI,fr as X6,fs as yI,ft as im,fu as Q6,fv as wI,fw as J6,fx as EI,fy as e5,fz as t5,fA as SI,fB as U2,fC as i5,fD as G2,fE as kI,fF as kb,fG as K2,fH as DI,fI as AI,fJ as BI,fK as wl,fL as Ed,fM as FI,fN as Z2,fO as yx,fP as LI,fQ as ic,fR as E1,fS as cy,fT as II,fU as n5,fV as s5,fW as Ko,fX as Y2,fY as Nv,fZ as KS,f_ as PI,f$ as TI,g0 as MI,g1 as RI,g2 as NI,g3 as OI,g4 as HI,g5 as zI,g6 as X2,g7 as WI,g8 as jI,g9 as VI,ga as xp,gb as Tg,gc as o5,gd as $I,ge as ZS,gf as wx,gg as Ov,gh as Db,gi as qI,gj as UI,gk as r5,gl as GI,gm as YS,gn as KI,go as ZI,gp as a5,gq as S1,gr as YI,gs as nm,gt as XS,gu as QS,gv as JS,gw as l5,gx as c5,gy as d5,gz as u5,gA as h5,gB as f5,gC as p5,gD as Q2,gE as g5,gF as Uh,gG as XI,gH as QI,gI as JI,gJ as eP,gK as v5,gL as tP,gM as iP,gN as J2,gO as dy,gP as nd,gQ as nP,gR as sP,gS as oP,gT as rP,gU as aP,gV as lP,gW as e8,gX as e9,gY as uy,gZ as cP,g_ as hy,g$ as dP,h0 as uP,h1 as hP,h2 as fP,h3 as t9,h4 as x5,h5 as t8,h6 as i8,h7 as pP,h8 as gP,h9 as vP,ha as n8,hb as Ab,hc as xP,hd as mP,he as _P,hf as Bb,hg as m5,hh as _5,hi as b5,hj as C5,hk as vc,hl as y5,hm as i9,hn as s8,ho as bP,hp as w5,hq as CP,hr as yP,hs as k1,ht as D1,hu as Fh,hv as A1,hw as lv,hx as wP,hy as B1,hz as EP,hA as SP,hB as kP,hC as E5,hD as rg,hE as DP,hF as AP,hG as BP,hH as FP,hI as cv,hJ as LP,hK as S5,hL as k5,hM as D5,hN as fy,hO as IP,hP as PP,hQ as TP,hR as MP,hS as RP,hT as py,hU as NP,hV as OP,hW as HP,hX as zP,hY as WP,hZ as jP,h_ as VP,h$ as $P,i0 as A5,i1 as qP,i2 as UP,i3 as GP,i4 as o8,i5 as KP,i6 as ZP,i7 as $a,i8 as $o,i9 as gy,ia as B5,ib as YP,ic as XP}from"./monaco-langs-DKJI_o9J.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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).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 F5=!1;var n9=Array.isArray,QP=Array.prototype.indexOf,sm=Array.prototype.includes,F1=Array.from,JP=Object.defineProperty,Mf=Object.getOwnPropertyDescriptor,eT=Object.getOwnPropertyDescriptors,tT=Object.prototype,iT=Array.prototype,L5=Object.getPrototypeOf,r8=Object.isExtensible;const ar=()=>{};function nT(r){for(var e=0;e<r.length;e++)r[e]()}function I5(){var r,e,t=new Promise((i,n)=>{r=i,e=n});return{promise:t,resolve:r,reject:e}}function sT(r,e,t=!1){return r===void 0?t?e():e:r}function om(r,e){if(Array.isArray(r))return r;if(!(Symbol.iterator in r))return Array.from(r);const t=[];for(const i of r)if(t.push(i),t.length===e)break;return t}const Jo=2,mp=4,L1=8,P5=1<<24,Ga=16,Za=32,Sd=64,vy=128,Ca=512,Po=1024,Oo=2048,Nl=4096,br=8192,ya=16384,qp=32768,xy=1<<25,_p=65536,rm=1<<17,oT=1<<18,Up=1<<19,rT=1<<20,Dl=1<<25,ch=65536,am=1<<21,Rf=1<<22,sd=1<<23,pu=Symbol("$state"),aT=Symbol("legacy props"),lT=Symbol(""),Ex=Symbol("attributes"),my=Symbol("class"),_y=Symbol("style"),xg=Symbol("text"),Sx=Symbol("form reset"),I1=new class extends Error{constructor(){super(...arguments);es(this,"name","StaleReactionError");es(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var XA;const cT=!!((XA=globalThis.document)!=null&&XA.contentType)&&globalThis.document.contentType.includes("xml");function T5(r){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function dT(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function uT(r,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function hT(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function fT(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function pT(r){throw new Error("https://svelte.dev/e/effect_orphan")}function gT(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function vT(r){throw new Error("https://svelte.dev/e/props_invalid_value")}function xT(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function mT(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function _T(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function bT(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const CT=1,yT=2,M5=4,wT=8,ET=16,ST=1,kT=4,DT=8,AT=16,R5=1,BT=2,Lo=Symbol("uninitialized"),N5="http://www.w3.org/1999/xhtml",FT="http://www.w3.org/2000/svg",LT="http://www.w3.org/1998/Math/MathML";function IT(){console.warn("https://svelte.dev/e/derived_inert")}function PT(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function TT(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function O5(r){return r===this.v}function MT(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function H5(r){return!MT(r,this.v)}let RT=!1,Qo=null;function bp(r){Qo=r}function ls(r,e=!1,t){Qo={p:Qo,i:!1,c:null,e:null,s:r,x:null,r:ps,l:null}}function cs(r){var e=Qo,t=e.e;if(t!==null){e.e=null;for(var i of t)l3(i)}return r!==void 0&&(e.x=r),e.i=!0,Qo=e.p,r??{}}function z5(){return!0}let iu=[];function W5(){var r=iu;iu=[],nT(r)}function Il(r){if(iu.length===0&&!Rg){var e=iu;queueMicrotask(()=>{e===iu&&W5()})}iu.push(r)}function NT(){for(;iu.length>0;)W5()}function j5(r){var e=ps;if(e===null)return hs.f|=sd,r;if((e.f&qp)===0&&(e.f&mp)===0)throw r;Qc(r,e)}function Qc(r,e){for(;e!==null;){if((e.f&vy)!==0){if((e.f&qp)===0)throw r;try{e.b.error(r);return}catch(t){r=t}}e=e.parent}throw r}const OT=-7169;function mo(r,e){r.f=r.f&OT|e}function s9(r){(r.f&Ca)!==0||r.deps===null?mo(r,Po):mo(r,Nl)}function V5(r){if(r!==null)for(const e of r)(e.f&Jo)===0||(e.f&ch)===0||(e.f^=ch,V5(e.deps))}function $5(r,e,t){(r.f&Oo)!==0?e.add(r):(r.f&Nl)!==0&&t.add(r),V5(r.deps),mo(r,Po)}let Hv=!1;function HT(r){var e=Hv;try{return Hv=!1,[r(),Hv]}finally{Hv=e}}let Fb=null,Gh=null,Pn=null,Mg=null,Uo=null,by=null,Rg=!1,Lb=!1,bf=null,kx=null;var a8=0;let zT=1;var $f,Kc,ru,qf,Uf,Gf,Yl,Kf,Lr,W0,Xl,Ma,_l,Zf,au,Xs,Cy,mg,yy,q5,U5,df,WT,_g;const x_=class x_{constructor(){Zn(this,Xs);es(this,"id",zT++);Zn(this,$f,!1);es(this,"linked",!0);Zn(this,Kc,null);Zn(this,ru,null);es(this,"async_deriveds",new Map);es(this,"current",new Map);es(this,"previous",new Map);Zn(this,qf,new Set);Zn(this,Uf,new Set);Zn(this,Gf,0);Zn(this,Yl,new Map);Zn(this,Kf,null);Zn(this,Lr,[]);Zn(this,W0,[]);Zn(this,Xl,new Set);Zn(this,Ma,new Set);Zn(this,_l,new Map);Zn(this,Zf,new Set);es(this,"is_fork",!1);Zn(this,au,!1);Gh===null?Fb=Gh=this:(Yn(Gh,ru,this),Yn(this,Kc,Gh)),Gh=this}skip_effect(e){Zt(this,_l).has(e)||Zt(this,_l).set(e,{d:[],m:[]}),Zt(this,Zf).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=Zt(this,_l).get(e);if(i){Zt(this,_l).delete(e);for(var n of i.d)mo(n,Oo),t(n);for(n of i.m)mo(n,Nl),t(n)}Zt(this,Zf).add(e)}capture(e,t,i=!1){e.v!==Lo&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&sd)===0&&(this.current.set(e,[t,i]),Uo==null||Uo.set(e,t)),this.is_fork||(e.v=t)}activate(){Pn=this}deactivate(){Pn=null,Uo=null}flush(){try{Lb=!0,Pn=this,Ms(this,Xs,mg).call(this)}finally{a8=0,by=null,bf=null,kx=null,Lb=!1,Pn=null,Uo=null,gu.clear()}}discard(){var e;for(const t of Zt(this,Uf))t(this);Zt(this,Uf).clear(),Ms(this,Xs,_g).call(this),(e=Zt(this,Kf))==null||e.resolve()}register_created_effect(e){Zt(this,W0).push(e)}increment(e,t){if(Yn(this,Gf,Zt(this,Gf)+1),e){let i=Zt(this,Yl).get(t)??0;Zt(this,Yl).set(t,i+1)}}decrement(e,t){if(Yn(this,Gf,Zt(this,Gf)-1),e){let i=Zt(this,Yl).get(t)??0;i===1?Zt(this,Yl).delete(t):Zt(this,Yl).set(t,i-1)}Zt(this,au)||(Yn(this,au,!0),Il(()=>{Yn(this,au,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)Zt(this,Xl).add(i);for(const i of t)Zt(this,Ma).add(i);e.clear(),t.clear()}oncommit(e){Zt(this,qf).add(e)}ondiscard(e){Zt(this,Uf).add(e)}settled(){return(Zt(this,Kf)??Yn(this,Kf,I5())).promise}static ensure(){if(Pn===null){const e=Pn=new x_;!Lb&&!Rg&&Il(()=>{Zt(e,$f)||e.flush()})}return Pn}apply(){{Uo=null;return}}schedule(e){var n;if(by=e,(n=e.b)!=null&&n.is_pending&&(e.f&(mp|L1|P5))!==0&&(e.f&qp)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(bf!==null&&t===ps&&(hs===null||(hs.f&Jo)===0))return;if((i&(Sd|Za))!==0){if((i&Po)===0)return;t.f^=Po}}Zt(this,Lr).push(t)}};$f=new WeakMap,Kc=new WeakMap,ru=new WeakMap,qf=new WeakMap,Uf=new WeakMap,Gf=new WeakMap,Yl=new WeakMap,Kf=new WeakMap,Lr=new WeakMap,W0=new WeakMap,Xl=new WeakMap,Ma=new WeakMap,_l=new WeakMap,Zf=new WeakMap,au=new WeakMap,Xs=new WeakSet,Cy=function(){if(this.is_fork)return!0;for(const i of Zt(this,Yl).keys()){for(var e=i,t=!1;e.parent!==null;){if(Zt(this,_l).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},mg=function(){var d,u,g,x;Yn(this,$f,!0),a8++>1e3&&(Ms(this,Xs,_g).call(this),VT());for(const m of Zt(this,Xl))Zt(this,Ma).delete(m),mo(m,Oo),this.schedule(m);for(const m of Zt(this,Ma))mo(m,Nl),this.schedule(m);const e=Zt(this,Lr);Yn(this,Lr,[]),this.apply();var t=bf=[],i=[],n=kx=[];for(const m of e)try{Ms(this,Xs,yy).call(this,m,t,i)}catch(C){throw Z5(m),Ms(this,Xs,Cy).call(this)||this.discard(),C}if(Pn=null,n.length>0){var s=x_.ensure();for(const m of n)s.schedule(m)}if(bf=null,kx=null,Ms(this,Xs,Cy).call(this)){Ms(this,Xs,df).call(this,i),Ms(this,Xs,df).call(this,t);for(const[m,C]of Zt(this,_l))K5(m,C);n.length>0&&Ms(d=Pn,Xs,mg).call(d);return}const a=Ms(this,Xs,q5).call(this);if(a){Ms(this,Xs,df).call(this,i),Ms(this,Xs,df).call(this,t),Ms(u=a,Xs,U5).call(u,this);return}Zt(this,Xl).clear(),Zt(this,Ma).clear();for(const m of Zt(this,qf))m(this);Zt(this,qf).clear(),Mg=this,l8(i),l8(t),Mg=null,(g=Zt(this,Kf))==null||g.resolve();var l=Pn;if(Zt(this,Gf)===0&&(Zt(this,Lr).length===0||l!==null)&&Ms(this,Xs,_g).call(this),Zt(this,Lr).length>0)if(l!==null){const m=l;Zt(m,Lr).push(...Zt(this,Lr).filter(C=>!Zt(m,Lr).includes(C)))}else l=this;l!==null&&Ms(x=l,Xs,mg).call(x)},yy=function(e,t,i){e.f^=Po;for(var n=e.first;n!==null;){var s=n.f,a=(s&(Za|Sd))!==0,l=a&&(s&Po)!==0,d=l||(s&br)!==0||Zt(this,_l).has(n);if(!d&&n.fn!==null){a?n.f^=Po:(s&mp)!==0?t.push(n):hv(n)&&((s&Ga)!==0&&Zt(this,Ma).add(n),yp(n));var u=n.first;if(u!==null){n=u;continue}}for(;n!==null;){var g=n.next;if(g!==null){n=g;break}n=n.parent}}},q5=function(){for(var e=Zt(this,Kc);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=Zt(e,Kc)}return null},U5=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 a=this.async_deriveds.get(n);a&&s.promise.then(a.resolve).catch(a.reject)}this.transfer_effects(Zt(e,Xl),Zt(e,Ma));const t=n=>{var s=n.reactions;if(s!==null)for(const d of s){var a=d.f;if((a&Jo)!==0)t(d);else{var l=d;a&(Rf|Ga)&&!this.async_deriveds.has(l)&&(Zt(this,Ma).delete(l),mo(l,Oo),this.schedule(l))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),Ms(i=e,Xs,_g).call(i),Pn=this,Ms(this,Xs,mg).call(this)},df=function(e){for(var t=0;t<e.length;t+=1)$5(e[t],Zt(this,Xl),Zt(this,Ma))},WT=function(){var g;for(let x=Fb;x!==null;x=Zt(x,ru)){var e=x.id<this.id,t=[];for(const[m,[C,_]]of this.current){if(x.current.has(m)){var i=x.current.get(m)[0];if(e&&C!==i)x.current.set(m,[C,_]);else continue}t.push(m)}if(e)for(const[m,C]of this.async_deriveds){const _=x.async_deriveds.get(m);_&&C.promise.then(_.resolve).catch(_.reject)}if(Zt(x,$f)){var n=[...x.current.keys()].filter(m=>!x.current.get(m)[1]&&!this.current.has(m));if(n.length===0)e&&x.discard();else if(t.length>0){if(e)for(const m of Zt(this,Zf))x.unskip_effect(m,C=>{var _;(C.f&(Ga|Rf))!==0?x.schedule(C):Ms(_=x,Xs,df).call(_,[C])});x.activate();var s=new Set,a=new Map;for(var l of t)G5(l,n,s,a);a=new Map;var d=[...x.current].filter(([m,C])=>{const _=this.current.get(m);return _?_[0]!==C[0]||_[1]!==C[1]:!0}).map(([m])=>m);if(d.length>0)for(const m of Zt(this,W0))(m.f&(ya|br|rm))===0&&o9(m,d,a)&&((m.f&(Rf|Ga))!==0?(mo(m,Oo),x.schedule(m)):Zt(x,Xl).add(m));if(Zt(x,Lr).length>0&&!Zt(x,au)){x.apply();for(var u of Zt(x,Lr))Ms(g=x,Xs,yy).call(g,u,[],[]);Yn(x,Lr,[])}x.deactivate()}}}},_g=function(){if(this.linked){var e=Zt(this,Kc),t=Zt(this,ru);e===null?Fb=t:Yn(e,ru,t),t===null?Gh=e:Yn(t,Kc,e),this.linked=!1}};let dh=x_;function jT(r){var e=Rg;Rg=!0;try{for(var t;;){if(NT(),Pn===null)return t;Pn.flush()}}finally{Rg=e}}function VT(){try{gT()}catch(r){Qc(r,by)}}let Ia=null;function l8(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var i=r[t++];if((i.f&(ya|br))===0&&hv(i)&&(Ia=new Set,yp(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&u3(i),(Ia==null?void 0:Ia.size)>0)){gu.clear();for(const n of Ia){if((n.f&(ya|br))!==0)continue;const s=[n];let a=n.parent;for(;a!==null;)Ia.has(a)&&(Ia.delete(a),s.push(a)),a=a.parent;for(let l=s.length-1;l>=0;l--){const d=s[l];(d.f&(ya|br))===0&&yp(d)}}Ia.clear()}}Ia=null}}function G5(r,e,t,i){if(!t.has(r)&&(t.add(r),r.reactions!==null))for(const n of r.reactions){const s=n.f;(s&Jo)!==0?G5(n,e,t,i):(s&(Rf|Ga))!==0&&(s&Oo)===0&&o9(n,e,i)&&(mo(n,Oo),r9(n))}}function o9(r,e,t){const i=t.get(r);if(i!==void 0)return i;if(r.deps!==null)for(const n of r.deps){if(sm.call(e,n))return!0;if((n.f&Jo)!==0&&o9(n,e,t))return t.set(n,!0),!0}return t.set(r,!1),!1}function r9(r){Pn.schedule(r)}function K5(r,e){if(!((r.f&Za)!==0&&(r.f&Po)!==0)){(r.f&Oo)!==0?e.d.push(r):(r.f&Nl)!==0&&e.m.push(r),mo(r,Po);for(var t=r.first;t!==null;)K5(t,e),t=t.next}}function Z5(r){mo(r,Po);for(var e=r.first;e!==null;)Z5(e),e=e.next}function $T(r){let e=0,t=uh(0),i;return()=>{c9()&&(o(t),uv(()=>(e===0&&(i=Ho(()=>r(()=>Ng(t)))),e+=1,()=>{Il(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Ng(t))})})))}}var qT=_p|Up;function UT(r,e,t,i){new GT(r,e,t,i)}var da,DS,ua,lu,Ir,ha,vr,qr,Ql,cu,Zc,Yf,j0,V0,Jl,m_,_o,KT,ZT,YT,wy,Dx,Ax,Ey,Sy;class GT{constructor(e,t,i,n){Zn(this,_o);es(this,"parent");es(this,"is_pending",!1);es(this,"transform_error");Zn(this,da);Zn(this,DS,null);Zn(this,ua);Zn(this,lu);Zn(this,Ir);Zn(this,ha,null);Zn(this,vr,null);Zn(this,qr,null);Zn(this,Ql,null);Zn(this,cu,0);Zn(this,Zc,0);Zn(this,Yf,!1);Zn(this,j0,new Set);Zn(this,V0,new Set);Zn(this,Jl,null);Zn(this,m_,$T(()=>(Yn(this,Jl,uh(Zt(this,cu))),()=>{Yn(this,Jl,null)})));var s;Yn(this,da,e),Yn(this,ua,t),Yn(this,lu,a=>{var l=ps;l.b=this,l.f|=vy,i(a)}),this.parent=ps.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(a=>a),Yn(this,Ir,R1(()=>{Ms(this,_o,wy).call(this)},qT))}defer_effect(e){$5(e,Zt(this,j0),Zt(this,V0))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!Zt(this,ua).pending}update_pending_count(e,t){Ms(this,_o,Ey).call(this,e,t),Yn(this,cu,Zt(this,cu)+e),!(!Zt(this,Jl)||Zt(this,Yf))&&(Yn(this,Yf,!0),Il(()=>{Yn(this,Yf,!1),Zt(this,Jl)&&Cp(Zt(this,Jl),Zt(this,cu))}))}get_effect_pending(){return Zt(this,m_).call(this),o(Zt(this,Jl))}error(e){if(!Zt(this,ua).onerror&&!Zt(this,ua).failed)throw e;Pn!=null&&Pn.is_fork?(Zt(this,ha)&&Pn.skip_effect(Zt(this,ha)),Zt(this,vr)&&Pn.skip_effect(Zt(this,vr)),Zt(this,qr)&&Pn.skip_effect(Zt(this,qr)),Pn.oncommit(()=>{Ms(this,_o,Sy).call(this,e)})):Ms(this,_o,Sy).call(this,e)}}da=new WeakMap,DS=new WeakMap,ua=new WeakMap,lu=new WeakMap,Ir=new WeakMap,ha=new WeakMap,vr=new WeakMap,qr=new WeakMap,Ql=new WeakMap,cu=new WeakMap,Zc=new WeakMap,Yf=new WeakMap,j0=new WeakMap,V0=new WeakMap,Jl=new WeakMap,m_=new WeakMap,_o=new WeakSet,KT=function(){try{Yn(this,ha,fa(()=>Zt(this,lu).call(this,Zt(this,da))))}catch(e){this.error(e)}},ZT=function(e){const t=Zt(this,ua).failed;t&&Yn(this,qr,fa(()=>{t(Zt(this,da),()=>e,()=>()=>{})}))},YT=function(){const e=Zt(this,ua).pending;e&&(this.is_pending=!0,Yn(this,vr,fa(()=>e(Zt(this,da)))),Il(()=>{var t=Yn(this,Ql,document.createDocumentFragment()),i=cc();t.append(i),Yn(this,ha,Ms(this,_o,Ax).call(this,()=>fa(()=>Zt(this,lu).call(this,i)))),Zt(this,Zc)===0&&(Zt(this,da).before(t),Yn(this,Ql,null),vu(Zt(this,vr),()=>{Yn(this,vr,null)}),Ms(this,_o,Dx).call(this,Pn))}))},wy=function(){try{if(this.is_pending=this.has_pending_snippet(),Yn(this,Zc,0),Yn(this,cu,0),Yn(this,ha,fa(()=>{Zt(this,lu).call(this,Zt(this,da))})),Zt(this,Zc)>0){var e=Yn(this,Ql,document.createDocumentFragment());h9(Zt(this,ha),e);const t=Zt(this,ua).pending;Yn(this,vr,fa(()=>t(Zt(this,da))))}else Ms(this,_o,Dx).call(this,Pn)}catch(t){this.error(t)}},Dx=function(e){this.is_pending=!1,e.transfer_effects(Zt(this,j0),Zt(this,V0))},Ax=function(e){var t=ps,i=hs,n=Qo;Ol(Zt(this,Ir)),ka(Zt(this,Ir)),bp(Zt(this,Ir).ctx);try{return dh.ensure(),e()}catch(s){return j5(s),null}finally{Ol(t),ka(i),bp(n)}},Ey=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&Ms(i=this.parent,_o,Ey).call(i,e,t);return}Yn(this,Zc,Zt(this,Zc)+e),Zt(this,Zc)===0&&(Ms(this,_o,Dx).call(this,t),Zt(this,vr)&&vu(Zt(this,vr),()=>{Yn(this,vr,null)}),Zt(this,Ql)&&(Zt(this,da).before(Zt(this,Ql)),Yn(this,Ql,null)))},Sy=function(e){Zt(this,ha)&&(Hr(Zt(this,ha)),Yn(this,ha,null)),Zt(this,vr)&&(Hr(Zt(this,vr)),Yn(this,vr,null)),Zt(this,qr)&&(Hr(Zt(this,qr)),Yn(this,qr,null));var t=Zt(this,ua).onerror;let i=Zt(this,ua).failed;var n=!1,s=!1;const a=()=>{if(n){TT();return}n=!0,s&&bT(),Zt(this,qr)!==null&&vu(Zt(this,qr),()=>{Yn(this,qr,null)}),Ms(this,_o,Ax).call(this,()=>{Ms(this,_o,wy).call(this)})},l=d=>{try{s=!0,t==null||t(d,a),s=!1}catch(u){Qc(u,Zt(this,Ir)&&Zt(this,Ir).parent)}i&&Yn(this,qr,Ms(this,_o,Ax).call(this,()=>{try{return fa(()=>{var u=ps;u.b=this,u.f|=vy,i(Zt(this,da),()=>d,()=>a)})}catch(u){return Qc(u,Zt(this,Ir).parent),null}}))};Il(()=>{var d;try{d=this.transform_error(e)}catch(u){Qc(u,Zt(this,Ir)&&Zt(this,Ir).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(l,u=>Qc(u,Zt(this,Ir)&&Zt(this,Ir).parent)):l(d)})};function XT(r,e,t,i){const n=d0;var s=r.filter(m=>!m.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var a=ps,l=QT(),d=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(m=>m.promise)):null;function u(m){if((a.f&ya)===0){l();try{i(m)}catch(C){Qc(C,a)}lm()}}var g=Y5();if(t.length===0){d.then(()=>u(e.map(n))).finally(g);return}function x(){Promise.all(t.map(m=>JT(m))).then(m=>u([...e.map(n),...m])).catch(m=>Qc(m,a)).finally(g)}d?d.then(()=>{l(),x(),lm()}):x()}function QT(){var r=ps,e=hs,t=Qo,i=Pn;return function(s=!0){Ol(r),ka(e),bp(t),s&&(r.f&ya)===0&&(i==null||i.activate(),i==null||i.apply())}}function lm(r=!0){Ol(null),ka(null),bp(null),r&&(Pn==null||Pn.deactivate())}function Y5(){var r=ps,e=r.b,t=Pn,i=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(i,r),()=>{e==null||e.update_pending_count(-1,t),t.decrement(i,r)}}function d0(r){var e=Jo|Oo;return ps!==null&&(ps.f|=Up),{ctx:Qo,deps:null,effects:null,equals:O5,f:e,fn:r,reactions:null,rv:0,v:Lo,wv:0,parent:ps,ac:null}}const zv=Symbol("obsolete");function JT(r,e,t){let i=ps;i===null&&dT();var n=void 0,s=uh(Lo),a=!hs,l=new Set;return dM(()=>{var C,_;var d=ps,u=I5();n=u.promise;try{Promise.resolve(r()).then(u.resolve,E=>{E!==I1&&u.reject(E)}).finally(lm)}catch(E){u.reject(E),lm()}var g=Pn;if(a){if((d.f&qp)!==0)var x=Y5();if((C=i.b)!=null&&C.is_rendered())(_=g.async_deriveds.get(d))==null||_.reject(zv);else for(const E of l.values())E.reject(zv);l.add(u),g.async_deriveds.set(d,u)}const m=(E,S=void 0)=>{x==null||x(),l.delete(u),S!==zv&&(g.activate(),S?(s.f|=sd,Cp(s,S)):((s.f&sd)!==0&&(s.f^=sd),Cp(s,E)),g.deactivate())};u.promise.then(m,E=>m(null,E||"unknown"))}),M1(()=>{for(const d of l)d.reject(zv)}),new Promise(d=>{function u(g){function x(){g===n?d(s):u(n)}g.then(x,x)}u(n)})}function ct(r){const e=d0(r);return p3(e),e}function a9(r){const e=d0(r);return e.equals=H5,e}function eM(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Hr(e[t])}}function l9(r){var e,t=ps,i=r.parent;if(!xc&&i!==null&&r.v!==Lo&&(i.f&(ya|br))!==0)return IT(),r.v;Ol(i);try{r.f&=~ch,eM(r),e=m3(r)}finally{Ol(t)}return e}function X5(r){var e=l9(r);if(!r.equals(e)&&(r.wv=v3(),(!(Pn!=null&&Pn.is_fork)||r.deps===null)&&(Pn!==null?(Pn.capture(r,e,!0),Mg==null||Mg.capture(r,e,!0)):r.v=e,r.deps===null))){mo(r,Po);return}xc||(Uo!==null?(c9()||Pn!=null&&Pn.is_fork)&&Uo.set(r,e):s9(r))}function tM(r){var e,t;if(r.effects!==null)for(const i of r.effects)(i.teardown||i.ac)&&((e=i.teardown)==null||e.call(i),(t=i.ac)==null||t.abort(I1),i.fn!==null&&(i.teardown=ar),i.ac=null,u0(i,0),u9(i))}function Q5(r){if(r.effects!==null)for(const e of r.effects)e.teardown&&e.fn!==null&&yp(e)}let cm=new Set;const gu=new Map;let J5=!1;function uh(r,e){var t={f:0,v:r,reactions:null,equals:O5,rv:0,wv:0};return t}function A(r,e){const t=uh(r);return p3(t),t}function iM(r,e=!1,t=!0){const i=uh(r);return e||(i.equals=H5),i}function p(r,e,t=!1){hs!==null&&(!Ka||(hs.f&rm)!==0)&&z5()&&(hs.f&(Jo|Ga|Rf|rm))!==0&&(Pl===null||!Pl.has(r))&&_T();let i=t?Ci(e):e;return Cp(r,i,kx)}function Cp(r,e,t=null){if(!r.equals(e)){gu.set(r,xc?e:r.v);var i=dh.ensure();if(i.capture(r,e),(r.f&Jo)!==0){const n=r;(r.f&Oo)!==0&&l9(n),Uo===null&&s9(n)}r.wv=v3(),e3(r,Oo,t),ps!==null&&(ps.f&Po)!==0&&(ps.f&(Za|Sd))===0&&(ca===null?hM([r]):ca.push(r)),!i.is_fork&&cm.size>0&&!J5&&nM()}return e}function nM(){J5=!1;for(const r of cm){(r.f&Po)!==0&&mo(r,Nl);let e;try{e=hv(r)}catch{e=!0}e&&yp(r)}cm.clear()}function ky(r,e=1){var t=o(r),i=e===1?t++:t--;return p(r,t),i}function Ng(r){p(r,r.v+1)}function e3(r,e,t){var i=r.reactions;if(i!==null)for(var n=i.length,s=0;s<n;s++){var a=i[s],l=a.f,d=(l&Oo)===0;if(d&&mo(a,e),(l&rm)!==0)cm.add(a);else if((l&Jo)!==0){var u=a;Uo==null||Uo.delete(u),(l&ch)===0&&(l&Ca&&(ps===null||(ps.f&am)===0)&&(a.f|=ch),e3(u,Nl,t))}else if(d){var g=a;(l&Ga)!==0&&Ia!==null&&Ia.add(g),t!==null?t.push(g):r9(g)}}}function Ci(r){if(typeof r!="object"||r===null||pu in r)return r;const e=L5(r);if(e!==tT&&e!==iT)return r;var t=new Map,i=n9(r),n=A(0),s=xu,a=l=>{if(xu===s)return l();var d=hs,u=xu;ka(null),h8(s);var g=l();return ka(d),h8(u),g};return i&&t.set("length",A(r.length)),new Proxy(r,{defineProperty(l,d,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&xT();var g=t.get(d);return g===void 0?a(()=>{var x=A(u.value);return t.set(d,x),x}):p(g,u.value,!0),!0},deleteProperty(l,d){var u=t.get(d);if(u===void 0){if(d in l){const g=a(()=>A(Lo));t.set(d,g),Ng(n)}}else p(u,Lo),Ng(n);return!0},get(l,d,u){var C;if(d===pu)return r;var g=t.get(d),x=d in l;if(g===void 0&&(!x||(C=Mf(l,d))!=null&&C.writable)&&(g=a(()=>{var _=Ci(x?l[d]:Lo),E=A(_);return E}),t.set(d,g)),g!==void 0){var m=o(g);return m===Lo?void 0:m}return Reflect.get(l,d,u)},getOwnPropertyDescriptor(l,d){var u=Reflect.getOwnPropertyDescriptor(l,d);if(u&&"value"in u){var g=t.get(d);g&&(u.value=o(g))}else if(u===void 0){var x=t.get(d),m=x==null?void 0:x.v;if(x!==void 0&&m!==Lo)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return u},has(l,d){var m;if(d===pu)return!0;var u=t.get(d),g=u!==void 0&&u.v!==Lo||Reflect.has(l,d);if(u!==void 0||ps!==null&&(!g||(m=Mf(l,d))!=null&&m.writable)){u===void 0&&(u=a(()=>{var C=g?Ci(l[d]):Lo,_=A(C);return _}),t.set(d,u));var x=o(u);if(x===Lo)return!1}return g},set(l,d,u,g){var O;var x=t.get(d),m=d in l;if(i&&d==="length")for(var C=u;C<x.v;C+=1){var _=t.get(C+"");_!==void 0?p(_,Lo):C in l&&(_=a(()=>A(Lo)),t.set(C+"",_))}if(x===void 0)(!m||(O=Mf(l,d))!=null&&O.writable)&&(x=a(()=>A(void 0)),p(x,Ci(u)),t.set(d,x));else{m=x.v!==Lo;var E=a(()=>Ci(u));p(x,E)}var S=Reflect.getOwnPropertyDescriptor(l,d);if(S!=null&&S.set&&S.set.call(g,u),!m){if(i&&typeof d=="string"){var I=t.get("length"),M=Number(d);Number.isInteger(M)&&M>=I.v&&p(I,M+1)}Ng(n)}return!0},ownKeys(l){o(n);var d=Reflect.ownKeys(l).filter(x=>{var m=t.get(x);return m===void 0||m.v!==Lo});for(var[u,g]of t)g.v!==Lo&&!(u in l)&&d.push(u);return d},setPrototypeOf(){mT()}})}function c8(r){try{if(r!==null&&typeof r=="object"&&pu in r)return r[pu]}catch{}return r}function t3(r,e){return Object.is(c8(r),c8(e))}var wa,i3,n3,s3,o3;function sM(){if(wa===void 0){wa=window,i3=document,n3=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;s3=Mf(e,"firstChild").get,o3=Mf(e,"nextSibling").get,r8(r)&&(r[my]=void 0,r[Ex]=null,r[_y]=void 0,r.__e=void 0),r8(t)&&(t[xg]=void 0)}}function cc(r=""){return document.createTextNode(r)}function Xr(r){return s3.call(r)}function dv(r){return o3.call(r)}function f(r,e){return Xr(r)}function Dt(r,e=!1){{var t=Xr(r);return t instanceof Comment&&t.data===""?dv(t):t}}function h(r,e=1,t=!1){let i=r;for(;e--;)i=dv(i);return i}function oM(r){r.textContent=""}function r3(){return!1}function a3(r,e,t){return e==null||e===N5?t?document.createElement(r,{is:t}):document.createElement(r):t?document.createElementNS(e,r,{is:t}):document.createElementNS(e,r)}let d8=!1;function rM(){d8||(d8=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var e;if(!r.defaultPrevented)for(const t of r.target.elements)(e=t[Sx])==null||e.call(t)})},{capture:!0}))}function P1(r){var e=hs,t=ps;ka(null),Ol(null);try{return r()}finally{ka(e),Ol(t)}}function T1(r,e,t,i=t){r.addEventListener(e,()=>P1(t));const n=r[Sx];n?r[Sx]=()=>{n(),i(!0)}:r[Sx]=()=>i(!0),rM()}function aM(r){ps===null&&(hs===null&&pT(),fT()),xc&&hT()}function lM(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Dc(r,e){var t=ps;t!==null&&(t.f&br)!==0&&(r|=br);var i={ctx:Qo,deps:null,nodes:null,f:r|Oo|Ca,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};Pn==null||Pn.register_created_effect(i);var n=i;if((r&mp)!==0)bf!==null?bf.push(i):dh.ensure().schedule(i);else if(e!==null){try{yp(i)}catch(a){throw Hr(i),a}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&Up)===0&&(n=n.first,(r&Ga)!==0&&(r&_p)!==0&&n!==null&&(n.f|=_p))}if(n!==null&&(n.parent=t,t!==null&&lM(n,t),hs!==null&&(hs.f&Jo)!==0&&(r&Sd)===0)){var s=hs;(s.effects??(s.effects=[])).push(n)}return i}function c9(){return hs!==null&&!Ka}function M1(r){const e=Dc(L1,null);return mo(e,Po),e.teardown=r,e}function cn(r){aM();var e=ps.f,t=!hs&&(e&Za)!==0&&Qo!==null&&!Qo.i;if(t){var i=Qo;(i.e??(i.e=[])).push(r)}else return l3(r)}function l3(r){return Dc(mp|rT,r)}function cM(r){dh.ensure();const e=Dc(Sd|Up,r);return(t={})=>new Promise(i=>{t.outro?vu(e,()=>{Hr(e),i(void 0)}):(Hr(e),i(void 0))})}function d9(r){return Dc(mp,r)}function dM(r){return Dc(Rf|Up,r)}function uv(r,e=0){return Dc(L1|e,r)}function P(r,e=[],t=[],i=[]){XT(i,e,t,n=>{Dc(L1,()=>r(...n.map(o)))})}function R1(r,e=0){var t=Dc(Ga|e,r);return t}function fa(r){return Dc(Za|Up,r)}function c3(r){var e=r.teardown;if(e!==null){const t=xc,i=hs;u8(!0),ka(null);try{e.call(null)}finally{u8(t),ka(i)}}}function u9(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){const n=t.ac;n!==null&&P1(()=>{n.abort(I1)});var i=t.next;(t.f&Sd)!==0?t.parent=null:Hr(t,e),t=i}}function uM(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Za)===0&&Hr(e),e=t}}function Hr(r,e=!0){var t=!1;(e||(r.f&oT)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(d3(r.nodes.start,r.nodes.end),t=!0),mo(r,xy),u9(r,e&&!t),u0(r,0);var i=r.nodes&&r.nodes.t;if(i!==null)for(const s of i)s.stop();c3(r),r.f^=xy,r.f|=ya;var n=r.parent;n!==null&&n.first!==null&&u3(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=r.b=null}function d3(r,e){for(;r!==null;){var t=r===e?null:dv(r);r.remove(),r=t}}function u3(r){var e=r.parent,t=r.prev,i=r.next;t!==null&&(t.next=i),i!==null&&(i.prev=t),e!==null&&(e.first===r&&(e.first=i),e.last===r&&(e.last=t))}function vu(r,e,t=!0){var i=[];h3(r,i,!0);var n=()=>{t&&Hr(r),e&&e()},s=i.length;if(s>0){var a=()=>--s||n();for(var l of i)l.out(a)}else n()}function h3(r,e,t){if((r.f&br)===0){r.f^=br;var i=r.nodes&&r.nodes.t;if(i!==null)for(const l of i)(l.is_global||t)&&e.push(l);for(var n=r.first;n!==null;){var s=n.next;if((n.f&Sd)===0){var a=(n.f&_p)!==0||(n.f&Za)!==0&&(r.f&Ga)!==0;h3(n,e,a?t:!1)}n=s}}}function dm(r){f3(r,!0)}function f3(r,e){if((r.f&br)!==0){r.f^=br,(r.f&Po)===0&&(mo(r,Oo),dh.ensure().schedule(r));for(var t=r.first;t!==null;){var i=t.next,n=(t.f&_p)!==0||(t.f&Za)!==0;f3(t,n?e:!1),t=i}var s=r.nodes&&r.nodes.t;if(s!==null)for(const a of s)(a.is_global||e)&&a.in()}}function h9(r,e){if(r.nodes)for(var t=r.nodes.start,i=r.nodes.end;t!==null;){var n=t===i?null:dv(t);e.append(t),t=n}}let Bx=!1,xc=!1;function u8(r){xc=r}let hs=null,Ka=!1;function ka(r){hs=r}let ps=null;function Ol(r){ps=r}let Pl=null;function p3(r){hs!==null&&(Pl??(Pl=new Set)).add(r)}let Pr=null,Vr=0,ca=null;function hM(r){ca=r}let g3=1,nu=0,xu=nu;function h8(r){xu=r}function v3(){return++g3}function hv(r){var e=r.f;if((e&Oo)!==0)return!0;if(e&Jo&&(r.f&=~ch),(e&Nl)!==0){for(var t=r.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(hv(s)&&X5(s),s.wv>r.wv)return!0}(e&Ca)!==0&&Uo===null&&mo(r,Po)}return!1}function x3(r,e,t=!0){var i=r.reactions;if(i!==null&&!(Pl!==null&&Pl.has(r)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&Jo)!==0?x3(s,e,!1):e===s&&(t?mo(s,Oo):(s.f&Po)!==0&&mo(s,Nl),r9(s))}}function m3(r){var E;var e=Pr,t=Vr,i=ca,n=hs,s=Pl,a=Qo,l=Ka,d=xu,u=r.f;Pr=null,Vr=0,ca=null,hs=(u&(Za|Sd))===0?r:null,Pl=null,bp(r.ctx),Ka=!1,xu=++nu,r.ac!==null&&(P1(()=>{r.ac.abort(I1)}),r.ac=null);try{r.f|=am;var g=r.fn,x=g();r.f|=qp;var m=r.deps,C=Pn==null?void 0:Pn.is_fork;if(Pr!==null){var _;if(C||u0(r,Vr),m!==null&&Vr>0)for(m.length=Vr+Pr.length,_=0;_<Pr.length;_++)m[Vr+_]=Pr[_];else r.deps=m=Pr;if(c9()&&(r.f&Ca)!==0)for(_=Vr;_<m.length;_++)((E=m[_]).reactions??(E.reactions=[])).push(r)}else!C&&m!==null&&Vr<m.length&&(u0(r,Vr),m.length=Vr);if(z5()&&ca!==null&&!Ka&&m!==null&&(r.f&(Jo|Nl|Oo))===0)for(_=0;_<ca.length;_++)x3(ca[_],r);if(n!==null&&n!==r){if(nu++,n.deps!==null)for(let S=0;S<t;S+=1)n.deps[S].rv=nu;if(e!==null)for(const S of e)S.rv=nu;ca!==null&&(i===null?i=ca:i.push(...ca))}return(r.f&sd)!==0&&(r.f^=sd),x}catch(S){return j5(S)}finally{r.f^=am,Pr=e,Vr=t,ca=i,hs=n,Pl=s,bp(a),Ka=l,xu=d}}function fM(r,e){let t=e.reactions;if(t!==null){var i=QP.call(t,r);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&Jo)!==0&&(Pr===null||!sm.call(Pr,e))){var s=e;(s.f&Ca)!==0&&(s.f^=Ca,s.f&=~ch),s.v!==Lo&&s9(s),tM(s),u0(s,0)}}function u0(r,e){var t=r.deps;if(t!==null)for(var i=e;i<t.length;i++)fM(r,t[i])}function yp(r){var e=r.f;if((e&ya)===0){mo(r,Po);var t=ps,i=Bx;ps=r,Bx=!0;try{(e&(Ga|P5))!==0?uM(r):u9(r),c3(r);var n=m3(r);r.teardown=typeof n=="function"?n:null,r.wv=g3;var s;F5&&RT&&(r.f&Oo)!==0&&r.deps}finally{Bx=i,ps=t}}}async function ga(){await Promise.resolve(),jT()}function o(r){var e=r.f,t=(e&Jo)!==0;if(hs!==null&&!Ka){var i=ps!==null&&(ps.f&ya)!==0;if(!i&&(Pl===null||!Pl.has(r))){var n=hs.deps;if((hs.f&am)!==0)r.rv<nu&&(r.rv=nu,Pr===null&&n!==null&&n[Vr]===r?Vr++:Pr===null?Pr=[r]:Pr.push(r));else{hs.deps??(hs.deps=[]),sm.call(hs.deps,r)||hs.deps.push(r);var s=r.reactions;s===null?r.reactions=[hs]:sm.call(s,hs)||s.push(hs)}}}if(xc&&gu.has(r))return gu.get(r);if(t){var a=r;if(xc){var l=a.v;return((a.f&Po)===0&&a.reactions!==null||b3(a))&&(l=l9(a)),gu.set(a,l),l}var d=(a.f&Ca)===0&&!Ka&&hs!==null&&(Bx||(hs.f&Ca)!==0),u=(a.f&qp)===0;hv(a)&&(d&&(a.f|=Ca),X5(a)),d&&!u&&(Q5(a),_3(a))}if(Uo!=null&&Uo.has(r))return Uo.get(r);if((r.f&sd)!==0)throw r.v;return r.v}function _3(r){if(r.f|=Ca,r.deps!==null)for(const e of r.deps)(e.reactions??(e.reactions=[])).push(r),(e.f&Jo)!==0&&(e.f&Ca)===0&&(Q5(e),_3(e))}function b3(r){if(r.v===Lo)return!0;if(r.deps===null)return!1;for(const e of r.deps)if(gu.has(e)||(e.f&Jo)!==0&&b3(e))return!0;return!1}function Ho(r){var e=Ka;try{return Ka=!0,r()}finally{Ka=e}}const pM=["touchstart","touchmove"];function gM(r){return pM.includes(r)}const su=Symbol("events"),C3=new Set,Dy=new Set;function vM(r,e,t,i={}){function n(s){if(i.capture||Ay.call(e,s),!s.cancelBubble)return P1(()=>t==null?void 0:t.call(this,s))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?Il(()=>{e.addEventListener(r,n,i)}):e.addEventListener(r,n,i),n}function ws(r,e,t,i,n){var s={capture:i,passive:n},a=vM(r,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&M1(()=>{e.removeEventListener(r,a,s)})}function z(r,e,t){(e[su]??(e[su]={}))[r]=t}function ms(r){for(var e=0;e<r.length;e++)C3.add(r[e]);for(var t of Dy)t(r)}let f8=null;function Ay(r){var E,S;var e=this,t=e.ownerDocument,i=r.type,n=((E=r.composedPath)==null?void 0:E.call(r))||[],s=n[0]||r.target;f8=r;var a=0,l=f8===r&&r[su];if(l){var d=n.indexOf(l);if(d!==-1&&(e===document||e===window)){r[su]=e;return}var u=n.indexOf(e);if(u===-1)return;d<=u&&(a=d)}if(s=n[a]||r.target,s!==e){JP(r,"currentTarget",{configurable:!0,get(){return s||t}});var g=hs,x=ps;ka(null),Ol(null);try{for(var m,C=[];s!==null&&s!==e;){try{var _=(S=s[su])==null?void 0:S[i];_!=null&&(!s.disabled||r.target===s)&&_.call(s,r)}catch(I){m?C.push(I):m=I}if(r.cancelBubble)break;a++,s=a<n.length?n[a]:null}if(m){for(let I of C)queueMicrotask(()=>{throw I});throw m}}finally{r[su]=e,delete r.currentTarget,ka(g),Ol(x)}}}var QA;const Ib=((QA=globalThis==null?void 0:globalThis.window)==null?void 0:QA.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:r=>r});function xM(r){return(Ib==null?void 0:Ib.createHTML(r))??r}function y3(r){var e=a3("template");return e.innerHTML=xM(r.replaceAll("<!>","<!---->")),e.content}function kd(r,e){var t=ps;t.nodes===null&&(t.nodes={start:r,end:e,a:null,t:null})}function k(r,e){var t=(e&R5)!==0,i=(e&BT)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=y3(s?r:"<!>"+r),t||(n=Xr(n)));var a=i||n3?document.importNode(n,!0):n.cloneNode(!0);if(t){var l=Xr(a),d=a.lastChild;kd(l,d)}else kd(a,a);return a}}function mM(r,e,t="svg"){var i=!r.startsWith("<!>"),n=(e&R5)!==0,s=`<${t}>${i?r:"<!>"+r}</${t}>`,a;return()=>{if(!a){var l=y3(s),d=Xr(l);if(n)for(a=document.createDocumentFragment();Xr(d);)a.appendChild(Xr(d));else a=Xr(d)}var u=a.cloneNode(!0);if(n){var g=Xr(u),x=u.lastChild;kd(g,x)}else kd(u,u);return u}}function Wo(r,e){return mM(r,e,"svg")}function kn(r=""){{var e=cc(r+"");return kd(e,e),e}}function ks(){var r=document.createDocumentFragment(),e=document.createComment(""),t=cc();return r.append(e,t),kd(e,t),r}function y(r,e){r!==null&&r.before(e)}function B(r,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(r[xg]??(r[xg]=r.nodeValue))&&(r[xg]=t,r.nodeValue=`${t}`)}function _M(r,e){return bM(r,e)}const Wv=new Map;function bM(r,{target:e,anchor:t,props:i={},events:n,context:s,intro:a=!0,transformError:l}){sM();var d=void 0,u=cM(()=>{var g=t??e.appendChild(cc());UT(g,{pending:()=>{}},C=>{ls({});var _=Qo;s&&(_.c=s),n&&(i.$$events=n),d=r(C,i)||{},cs()},l);var x=new Set,m=C=>{for(var _=0;_<C.length;_++){var E=C[_];if(!x.has(E)){x.add(E);var S=gM(E);for(const O of[e,document]){var I=Wv.get(O);I===void 0&&(I=new Map,Wv.set(O,I));var M=I.get(E);M===void 0?(O.addEventListener(E,Ay,{passive:S}),I.set(E,1)):I.set(E,M+1)}}}};return m(F1(C3)),Dy.add(m),()=>{var S;for(var C of x)for(const I of[e,document]){var _=Wv.get(I),E=_.get(C);--E==0?(I.removeEventListener(C,Ay),_.delete(C),_.size===0&&Wv.delete(I)):_.set(C,E)}Dy.delete(m),g!==t&&((S=g.parentNode)==null||S.removeChild(g))}});return CM.set(d,u),d}let CM=new WeakMap;var Ra,bl,Ur,du,$0,q0,__;class w3{constructor(e,t=!0){es(this,"anchor");Zn(this,Ra,new Map);Zn(this,bl,new Map);Zn(this,Ur,new Map);Zn(this,du,new Set);Zn(this,$0,!0);Zn(this,q0,e=>{if(Zt(this,Ra).has(e)){var t=Zt(this,Ra).get(e),i=Zt(this,bl).get(t);if(i)dm(i),Zt(this,du).delete(t);else{var n=Zt(this,Ur).get(t);n&&(dm(n.effect),Zt(this,bl).set(t,n.effect),Zt(this,Ur).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,a]of Zt(this,Ra)){if(Zt(this,Ra).delete(s),s===e)break;const l=Zt(this,Ur).get(a);l&&(Hr(l.effect),Zt(this,Ur).delete(a))}for(const[s,a]of Zt(this,bl)){if(s===t||Zt(this,du).has(s))continue;const l=()=>{if(Array.from(Zt(this,Ra).values()).includes(s)){var u=document.createDocumentFragment();h9(a,u),u.append(cc()),Zt(this,Ur).set(s,{effect:a,fragment:u})}else Hr(a);Zt(this,du).delete(s),Zt(this,bl).delete(s)};Zt(this,$0)||!i?(Zt(this,du).add(s),vu(a,l,!1)):l()}}});Zn(this,__,e=>{Zt(this,Ra).delete(e);const t=Array.from(Zt(this,Ra).values());for(const[i,n]of Zt(this,Ur))t.includes(i)||(Hr(n.effect),Zt(this,Ur).delete(i))});this.anchor=e,Yn(this,$0,t)}ensure(e,t){var i=Pn,n=r3();if(t&&!Zt(this,bl).has(e)&&!Zt(this,Ur).has(e))if(n){var s=document.createDocumentFragment(),a=cc();s.append(a),Zt(this,Ur).set(e,{effect:fa(()=>t(a)),fragment:s})}else Zt(this,bl).set(e,fa(()=>t(this.anchor)));if(Zt(this,Ra).set(i,e),n){for(const[l,d]of Zt(this,bl))l===e?i.unskip_effect(d):i.skip_effect(d);for(const[l,d]of Zt(this,Ur))l===e?i.unskip_effect(d.effect):i.skip_effect(d.effect);i.oncommit(Zt(this,q0)),i.ondiscard(Zt(this,__))}else Zt(this,q0).call(this,i)}}Ra=new WeakMap,bl=new WeakMap,Ur=new WeakMap,du=new WeakMap,$0=new WeakMap,q0=new WeakMap,__=new WeakMap;function T(r,e,t=!1){var i=new w3(r),n=t?_p:0;function s(a,l){i.ensure(a,l)}R1(()=>{var a=!1;e((l,d=0)=>{a=!0,s(d,l)}),a||s(-1,null)},n)}const yM=Symbol("NaN");function E3(r,e,t){var i=new w3(r);R1(()=>{var n=e();n!==n&&(n=yM),i.ensure(n,t)})}function Ki(r,e){return e}function wM(r,e,t){for(var i=[],n=e.length,s,a=e.length,l=0;l<n;l++){let x=e[l];vu(x,()=>{if(s){if(s.pending.delete(x),s.done.add(x),s.pending.size===0){var m=r.outrogroups;By(r,F1(s.done)),m.delete(s),m.size===0&&(r.outrogroups=null)}}else a-=1},!1)}if(a===0){var d=i.length===0&&t!==null;if(d){var u=t,g=u.parentNode;oM(g),g.append(u),r.items.clear()}By(r,e,!d)}else s={pending:new Set(e),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(s)}function By(r,e,t=!0){var i;if(r.pending.size>0){i=new Set;for(const a of r.pending.values())for(const l of a)i.add(r.items.get(l).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=Dl;const a=document.createDocumentFragment();h9(s,a)}else Hr(e[n],t)}}var p8;function gi(r,e,t,i,n,s=null){var a=r,l=new Map,d=(e&M5)!==0;if(d){var u=r;a=u.appendChild(cc())}var g=null,x=a9(()=>{var O=t();return n9(O)?O:O==null?[]:F1(O)}),m,C=new Map,_=!0;function E(O){(M.effect.f&ya)===0&&(M.pending.delete(O),M.fallback=g,EM(M,m,a,e,i),g!==null&&(m.length===0?(g.f&Dl)===0?dm(g):(g.f^=Dl,bg(g,null,a)):vu(g,()=>{g=null})))}function S(O){M.pending.delete(O)}var I=R1(()=>{m=o(x);for(var O=m.length,R=new Set,H=Pn,G=r3(),q=0;q<O;q+=1){var te=m[q],ye=i(te,q),Ne=_?null:l.get(ye);Ne?(Ne.v&&Cp(Ne.v,te),Ne.i&&Cp(Ne.i,q),G&&H.unskip_effect(Ne.e)):(Ne=SM(l,_?a:p8??(p8=cc()),te,ye,q,n,e,t),_||(Ne.e.f|=Dl),l.set(ye,Ne)),R.add(ye)}if(O===0&&s&&!g&&(_?g=fa(()=>s(a)):(g=fa(()=>s(p8??(p8=cc()))),g.f|=Dl)),O>R.size&&uT(),!_)if(C.set(H,R),G){for(const[ge,Ae]of l)R.has(ge)||H.skip_effect(Ae.e);H.oncommit(E),H.ondiscard(S)}else E(H);o(x)}),M={effect:I,items:l,pending:C,outrogroups:null,fallback:g};_=!1}function ag(r){for(;r!==null&&(r.f&Za)===0;)r=r.next;return r}function EM(r,e,t,i,n){var Ne,ge,Ae,dt,he,We,de,je,fe;var s=(i&wT)!==0,a=e.length,l=r.items,d=ag(r.effect.first),u,g=null,x,m=[],C=[],_,E,S,I;if(s)for(I=0;I<a;I+=1)_=e[I],E=n(_,I),S=l.get(E).e,(S.f&Dl)===0&&((ge=(Ne=S.nodes)==null?void 0:Ne.a)==null||ge.measure(),(x??(x=new Set)).add(S));for(I=0;I<a;I+=1){if(_=e[I],E=n(_,I),S=l.get(E).e,r.outrogroups!==null)for(const Ft of r.outrogroups)Ft.pending.delete(S),Ft.done.delete(S);if((S.f&br)!==0&&(dm(S),s&&((dt=(Ae=S.nodes)==null?void 0:Ae.a)==null||dt.unfix(),(x??(x=new Set)).delete(S))),(S.f&Dl)!==0)if(S.f^=Dl,S===d)bg(S,null,t);else{var M=g?g.next:d;S===r.effect.last&&(r.effect.last=S.prev),S.prev&&(S.prev.next=S.next),S.next&&(S.next.prev=S.prev),Pc(r,g,S),Pc(r,S,M),bg(S,M,t),g=S,m=[],C=[],d=ag(g.next);continue}if(S!==d){if(u!==void 0&&u.has(S)){if(m.length<C.length){var O=C[0],R;g=O.prev;var H=m[0],G=m[m.length-1];for(R=0;R<m.length;R+=1)bg(m[R],O,t);for(R=0;R<C.length;R+=1)u.delete(C[R]);Pc(r,H.prev,G.next),Pc(r,g,H),Pc(r,G,O),d=O,g=G,I-=1,m=[],C=[]}else u.delete(S),bg(S,d,t),Pc(r,S.prev,S.next),Pc(r,S,g===null?r.effect.first:g.next),Pc(r,g,S),g=S;continue}for(m=[],C=[];d!==null&&d!==S;)(u??(u=new Set)).add(d),C.push(d),d=ag(d.next);if(d===null)continue}(S.f&Dl)===0&&m.push(S),g=S,d=ag(S.next)}if(r.outrogroups!==null){for(const Ft of r.outrogroups)Ft.pending.size===0&&(By(r,F1(Ft.done)),(he=r.outrogroups)==null||he.delete(Ft));r.outrogroups.size===0&&(r.outrogroups=null)}if(d!==null||u!==void 0){var q=[];if(u!==void 0)for(S of u)(S.f&br)===0&&q.push(S);for(;d!==null;)(d.f&br)===0&&d!==r.fallback&&q.push(d),d=ag(d.next);var te=q.length;if(te>0){var ye=(i&M5)!==0&&a===0?t:null;if(s){for(I=0;I<te;I+=1)(de=(We=q[I].nodes)==null?void 0:We.a)==null||de.measure();for(I=0;I<te;I+=1)(fe=(je=q[I].nodes)==null?void 0:je.a)==null||fe.fix()}wM(r,q,ye)}}s&&Il(()=>{var Ft,Te;if(x!==void 0)for(S of x)(Te=(Ft=S.nodes)==null?void 0:Ft.a)==null||Te.apply()})}function SM(r,e,t,i,n,s,a,l){var d=(a&CT)!==0?(a&ET)===0?iM(t,!1,!1):uh(t):null,u=(a&yT)!==0?uh(n):null;return{v:d,i:u,e:fa(()=>(s(e,d??t,u??n,l),()=>{r.delete(i)}))}}function bg(r,e,t){if(r.nodes)for(var i=r.nodes.start,n=r.nodes.end,s=e&&(e.f&Dl)===0?e.nodes.start:t;i!==null;){var a=dv(i);if(s.before(i),i===n)return;i=a}}function Pc(r,e,t){e===null?r.effect.first=t:e.next=t,t===null?r.effect.last=e:t.prev=e}function Jc(r,e,t=!1,i=!1,n=!1,s=!1){var a=r,l="";if(t)var d=r;P(()=>{var u=ps;if(l!==(l=e()??"")){if(t){u.nodes=null,d.innerHTML=l,l!==""&&kd(Xr(d),d.lastChild);return}if(u.nodes!==null&&(d3(u.nodes.start,u.nodes.end),u.nodes=null),l!==""){var g=i?FT:n?LT:void 0,x=a3(i?"svg":n?"math":"template",g);x.innerHTML=l;var m=i||n?x:x.content;if(kd(Xr(m),m.lastChild),i||n)for(;Xr(m);)a.before(Xr(m));else a.before(m)}}})}function S3(r){var e,t,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var n=r.length;for(e=0;e<n;e++)r[e]&&(t=S3(r[e]))&&(i&&(i+=" "),i+=t)}else for(t in r)r[t]&&(i&&(i+=" "),i+=t);return i}function kM(){for(var r,e,t=0,i="",n=arguments.length;t<n;t++)(r=arguments[t])&&(e=S3(r))&&(i&&(i+=" "),i+=e);return i}function Nf(r){return typeof r=="object"?kM(r):r??""}const g8=[...`
3
3
  \r\f \v\uFEFF`];function DM(r,e,t){var i=r==null?"":""+r;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,a=0;(a=i.indexOf(n,a))>=0;){var l=a+s;(a===0||g8.includes(i[a-1]))&&(l===i.length||g8.includes(i[l]))?i=(a===0?"":i.substring(0,a))+i.substring(l+1):a=l}}return i===""?null:i}function v8(r,e=!1){var t=e?" !important;":";",i="";for(var n of Object.keys(r)){var s=r[n];s!=null&&s!==""&&(i+=" "+n+": "+s+t)}return i}function Pb(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function AM(r,e){if(e){var t="",i,n;if(Array.isArray(e)?(i=e[0],n=e[1]):i=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,a=0,l=!1,d=[];i&&d.push(...Object.keys(i).map(Pb)),n&&d.push(...Object.keys(n).map(Pb));var u=0,g=-1;const E=r.length;for(var x=0;x<E;x++){var m=r[x];if(l?m==="/"&&r[x-1]==="*"&&(l=!1):s?s===m&&(s=!1):m==="/"&&r[x+1]==="*"?l=!0:m==='"'||m==="'"?s=m:m==="("?a++:m===")"&&a--,!l&&s===!1&&a===0){if(m===":"&&g===-1)g=x;else if(m===";"||x===E-1){if(g!==-1){var C=Pb(r.substring(u,g).trim());if(!d.includes(C)){m!==";"&&x++;var _=r.substring(u,x).trim();t+=" "+_+";"}}u=x+1,g=-1}}}}return i&&(t+=v8(i)),n&&(t+=v8(n,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function Xt(r,e,t,i,n,s){var a=r[my];if(a!==t||a===void 0){var l=DM(t,i,s);l==null?r.removeAttribute("class"):e?r.className=l:r.setAttribute("class",l),r[my]=t}else if(s&&n!==s)for(var d in s){var u=!!s[d];(n==null||u!==!!n[d])&&r.classList.toggle(d,u)}return s}function Tb(r,e={},t,i){for(var n in t){var s=t[n];e[n]!==s&&(t[n]==null?r.style.removeProperty(n):r.style.setProperty(n,s,i))}}function Do(r,e,t,i){var n=r[_y];if(n!==e){var s=AM(e,i);s==null?r.removeAttribute("style"):r.style.cssText=s,r[_y]=e}else i&&(Array.isArray(i)?(Tb(r,t==null?void 0:t[0],i[0]),Tb(r,t==null?void 0:t[1],i[1],"important")):Tb(r,t,i));return i}function hh(r,e,t=!1){if(r.multiple){if(e==null)return;if(!n9(e))return PT();for(var i of r.options)i.selected=e.includes(Og(i));return}for(i of r.options){var n=Og(i);if(t3(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function wp(r){var e=new MutationObserver(()=>{hh(r,r.__value)});e.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),M1(()=>{e.disconnect()})}function to(r,e,t=e){var i=new WeakSet,n=!0;T1(r,"change",s=>{var a=s?"[selected]":":checked",l;if(r.multiple)l=[].map.call(r.querySelectorAll(a),Og);else{var d=r.querySelector(a)??r.querySelector("option:not([disabled])");l=d&&Og(d)}t(l),r.__value=l,Pn!==null&&i.add(Pn)}),d9(()=>{var s=e();if(r===document.activeElement){var a=Pn;if(i.has(a))return}if(hh(r,s,n),n&&s===void 0){var l=r.querySelector(":checked");l!==null&&(s=Og(l),t(s))}r.__value=s,n=!1}),wp(r)}function Og(r){return"__value"in r?r.__value:r.value}const BM=Symbol("is custom element"),FM=Symbol("is html"),LM=cT?"progress":"PROGRESS";function qa(r,e){var t=f9(r);t.value===(t.value=e??void 0)||r.value===e&&(e!==0||r.nodeName!==LM)||(r.value=e??"")}function Zo(r,e){var t=f9(r);t.checked!==(t.checked=e??void 0)&&(r.checked=e)}function xi(r,e,t,i){var n=f9(r);n[e]!==(n[e]=t)&&(e==="loading"&&(r[lT]=t),t==null?r.removeAttribute(e):typeof t!="string"&&IM(r).includes(e)?r[e]=t:r.setAttribute(e,t))}function f9(r){return r[Ex]??(r[Ex]={[BM]:r.nodeName.includes("-"),[FM]:r.namespaceURI===N5})}var x8=new Map;function IM(r){var e=r.getAttribute("is")||r.nodeName,t=x8.get(e);if(t)return t;x8.set(e,t=[]);for(var i,n=r,s=Element.prototype;s!==n;){i=eT(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&t.push(a);n=L5(n)}return t}function ui(r,e,t=e){var i=new WeakSet;T1(r,"input",async n=>{var s=n?r.defaultValue:r.value;if(s=Rb(r)?Nb(s):s,t(s),Pn!==null&&i.add(Pn),await ga(),s!==(s=e())){var a=r.selectionStart,l=r.selectionEnd,d=r.value.length;if(r.value=s??"",l!==null){var u=r.value.length;a===l&&l===d&&u>d?(r.selectionStart=u,r.selectionEnd=u):(r.selectionStart=a,r.selectionEnd=Math.min(l,u))}}}),Ho(e)==null&&r.value&&(t(Rb(r)?Nb(r.value):r.value),Pn!==null&&i.add(Pn)),uv(()=>{var n=e();if(r===document.activeElement){var s=Pn;if(i.has(s))return}Rb(r)&&n===Nb(r.value)||r.type==="date"&&!n&&!r.value||n!==r.value&&(r.value=n??"")})}const Mb=new Set;function Of(r,e,t,i,n=i){var s=t.getAttribute("type")==="checkbox",a=r;if(e!==null)for(var l of e)a=a[l]??(a[l]=[]);a.push(t),T1(t,"change",()=>{var d=t.__value;s&&(d=PM(a,d,t.checked)),n(d)},()=>n(s?[]:null)),uv(()=>{var d=i();s?(d=d||[],t.checked=d.includes(t.__value)):t.checked=t3(t.__value,d)}),M1(()=>{var d=a.indexOf(t);d!==-1&&a.splice(d,1)}),Mb.has(a)||(Mb.add(a),Il(()=>{a.sort((d,u)=>d.compareDocumentPosition(u)===4?-1:1),Mb.delete(a)})),Il(()=>{})}function Ss(r,e,t=e){T1(r,"change",i=>{var n=i?r.defaultChecked:r.checked;t(n)}),Ho(e)==null&&t(r.checked),uv(()=>{var i=e();r.checked=!!i})}function PM(r,e,t){for(var i=new Set,n=0;n<r.length;n+=1)r[n].checked&&i.add(r[n].__value);return t||i.delete(e),Array.from(i)}function Rb(r){var e=r.type;return e==="number"||e==="range"}function Nb(r){return r===""?null:+r}var Yc,Xf,U0,b_,k3;const C_=class C_{constructor(e){Zn(this,b_);Zn(this,Yc,new WeakMap);Zn(this,Xf);Zn(this,U0);Yn(this,U0,e)}observe(e,t){var i=Zt(this,Yc).get(e)||new Set;return i.add(t),Zt(this,Yc).set(e,i),Ms(this,b_,k3).call(this).observe(e,Zt(this,U0)),()=>{var n=Zt(this,Yc).get(e);n.delete(t),n.size===0&&(Zt(this,Yc).delete(e),Zt(this,Xf).unobserve(e))}}};Yc=new WeakMap,Xf=new WeakMap,U0=new WeakMap,b_=new WeakSet,k3=function(){return Zt(this,Xf)??Yn(this,Xf,new ResizeObserver(e=>{for(var t of e){C_.entries.set(t.target,t);for(var i of Zt(this,Yc).get(t.target)||[])i(t)}}))},es(C_,"entries",new WeakMap);let Fy=C_;var TM=new Fy({box:"border-box"});function MM(r,e,t){var i=TM.observe(r,()=>t(r[e]));d9(()=>(Ho(()=>t(r[e])),i))}function Ob(r,e){return r===e||(r==null?void 0:r[pu])===e}function ts(r={},e,t,i){var n=Qo.r,s=ps;return d9(()=>{var a,l;return uv(()=>{a=l,l=[],Ho(()=>{Ob(t(...l),r)||(e(r,...l),a&&Ob(t(...a),r)&&e(null,...a))})}),()=>{let d=s;for(;d!==n&&d.parent!==null&&d.parent.f&xy;)d=d.parent;const u=()=>{l&&Ob(t(...l),r)&&e(null,...l)},g=d.teardown;d.teardown=()=>{u(),g==null||g()}}}),r}function $n(r,e,t,i){var R;var n=!0,s=(t&DT)!==0,a=(t&AT)!==0,l=i,d=!0,u=void 0,g=()=>a&&n?(u??(u=d0(i)),o(u)):(d&&(d=!1,l=a?Ho(i):i),l);let x;if(s){var m=pu in r||aT in r;x=((R=Mf(r,e))==null?void 0:R.set)??(m&&e in r?H=>r[e]=H:void 0)}var C,_=!1;s?[C,_]=HT(()=>r[e]):C=r[e],C===void 0&&i!==void 0&&(C=g(),x&&(vT(),x(C)));var E;if(E=()=>{var H=r[e];return H===void 0?g():(d=!0,H)},(t&kT)===0)return E;if(x){var S=r.$$legacy;return(function(H,G){return arguments.length>0?((!G||S||_)&&x(G?E():H),H):E()})}var I=!1,M=((t&ST)!==0?d0:a9)(()=>(I=!1,E()));s&&o(M);var O=ps;return(function(H,G){if(arguments.length>0){const q=G?o(M):s?Ci(H):H;return p(M,q),I=!0,l!==void 0&&(l=q),H}return xc&&I||(O.f&ya)!==0?M.v:o(M)})}function Os(r){Qo===null&&T5(),cn(()=>{const e=Ho(r);if(typeof e=="function")return e})}function Lh(r){Qo===null&&T5(),Os(()=>()=>Ho(r))}const RM="5";var JA;typeof window<"u"&&((JA=window.__svelte??(window.__svelte={})).v??(JA.v=new Set)).add(RM);/*!-----------------------------------------------------------------------------
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10,7 +10,7 @@ var xF=Object.defineProperty;var A2=r=>{throw TypeError(r)};var mF=(r,e,t)=>e in
10
10
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
11
11
  * Released under the MIT license
12
12
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
13
- *-----------------------------------------------------------------------------*/var GM=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,ZM=Object.getOwnPropertyNames,YM=Object.prototype.hasOwnProperty,XM=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ZM(e))!YM.call(r,n)&&n!==t&&GM(r,n,{get:()=>e[n],enumerable:!(i=KM(e,n))||i.enumerable});return r},QM=(r,e,t)=>(XM(r,e,"default"),t),JM="5.4.5",Ep={};QM(Ep,t6);var B3=(r=>(r[r.None=0]="None",r[r.CommonJS=1]="CommonJS",r[r.AMD=2]="AMD",r[r.UMD=3]="UMD",r[r.System=4]="System",r[r.ES2015=5]="ES2015",r[r.ESNext=99]="ESNext",r))(B3||{}),F3=(r=>(r[r.None=0]="None",r[r.Preserve=1]="Preserve",r[r.React=2]="React",r[r.ReactNative=3]="ReactNative",r[r.ReactJSX=4]="ReactJSX",r[r.ReactJSXDev=5]="ReactJSXDev",r))(F3||{}),L3=(r=>(r[r.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",r[r.LineFeed=1]="LineFeed",r))(L3||{}),I3=(r=>(r[r.ES3=0]="ES3",r[r.ES5=1]="ES5",r[r.ES2015=2]="ES2015",r[r.ES2016=3]="ES2016",r[r.ES2017=4]="ES2017",r[r.ES2018=5]="ES2018",r[r.ES2019=6]="ES2019",r[r.ES2020=7]="ES2020",r[r.ESNext=99]="ESNext",r[r.JSON=100]="JSON",r[r.Latest=99]="Latest",r))(I3||{}),P3=(r=>(r[r.Classic=1]="Classic",r[r.NodeJs=2]="NodeJs",r))(P3||{}),T3=class{constructor(r,e,t,i,n){this._onDidChange=new Ep.Emitter,this._onDidExtraLibsChange=new Ep.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(r),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(r,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===r)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:r,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(r){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),r&&r.length>0)for(const e of r){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(r){this._compilerOptions=r||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(r){this._diagnosticsOptions=r||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(r){this._workerOptions=r||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(r){this._inlayHintsOptions=r||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(r){}setEagerModelSync(r){this._eagerModelSync=r}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(r){this._modeConfiguration=r||Object.create(null),this._onDidChange.fire(void 0)}},eR=JM,M3={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},R3=new T3({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},M3),N3=new T3({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},M3),tR=()=>N1().then(r=>r.getTypeScriptWorker()),iR=()=>N1().then(r=>r.getJavaScriptWorker());Ep.languages.typescript={ModuleKind:B3,JsxEmit:F3,NewLineKind:L3,ScriptTarget:I3,ModuleResolutionKind:P3,typescriptVersion:eR,typescriptDefaults:R3,javascriptDefaults:N3,getTypeScriptWorker:tR,getJavaScriptWorker:iR};function N1(){return e6(()=>import("./tsMode-Bw4L07QT.js"),__vite__mapDeps([3,1,2]))}Ep.languages.onLanguage("typescript",()=>N1().then(r=>r.setupTypeScript(R3)));Ep.languages.onLanguage("javascript",()=>N1().then(r=>r.setupJavaScript(N3)));class nR extends fr{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Yi("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:mn.map,toggled:si.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:si.has("isInDiffEditor"),menu:{when:si.has("isInDiffEditor"),id:Hi.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Hs),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class O3 extends fr{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Yi("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:si.has("isInDiffEditor")})}run(e,...t){const i=e.get(Hs),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class H3 extends fr{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Yi("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:si.has("isInDiffEditor")})}run(e,...t){const i=e.get(Hs),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const pv=Yi("diffEditor","Diff Editor");class sR extends Ya{constructor(){super({id:"diffEditor.switchSide",title:Yi("switchSide","Switch Side"),icon:mn.arrowSwap,precondition:si.has("isInDiffEditor"),f1:!0,category:pv})}runEditorCommand(e,t,i){const n=Gp(e);if(n instanceof G0){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class oR extends Ya{constructor(){super({id:"diffEditor.exitCompareMove",title:Yi("exitCompareMove","Exit Compare Move"),icon:mn.close,precondition:le.comparingMovedCode,f1:!1,category:pv,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Gp(e);n instanceof G0&&n.exitCompareMove()}}class rR extends Ya{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Yi("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:mn.fold,precondition:si.has("isInDiffEditor"),f1:!0,category:pv})}runEditorCommand(e,t,...i){const n=Gp(e);n instanceof G0&&n.collapseAllUnchangedRegions()}}class aR extends Ya{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Yi("showAllUnchangedRegions","Show All Unchanged Regions"),icon:mn.unfold,precondition:si.has("isInDiffEditor"),f1:!0,category:pv})}runEditorCommand(e,t,...i){const n=Gp(e);n instanceof G0&&n.showAllUnchangedRegions()}}class Ly extends fr{constructor(){super({id:"diffEditor.revert",title:Yi("revert","Revert"),f1:!1,category:pv})}run(e,t){const i=lR(e,t.originalUri,t.modifiedUri);i instanceof G0&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const z3=Yi("accessibleDiffViewer","Accessible Diff Viewer"),y_=class y_ extends fr{constructor(){super({id:y_.id,title:Yi("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:z3,precondition:si.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Gp(e);t==null||t.accessibleDiffViewerNext()}};y_.id="editor.action.accessibleDiffViewer.next";let h0=y_;const w_=class w_ extends fr{constructor(){super({id:w_.id,title:Yi("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:z3,precondition:si.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Gp(e);t==null||t.accessibleDiffViewerPrev()}};w_.id="editor.action.accessibleDiffViewer.prev";let um=w_;function lR(r,e,t){return r.get(ao).listDiffEditors().find(s=>{var d,u;const a=s.getModifiedEditor(),l=s.getOriginalEditor();return a&&((d=a.getModel())==null?void 0:d.uri.toString())===t.toString()&&l&&((u=l.getModel())==null?void 0:u.uri.toString())===e.toString()})||null}function Gp(r){const t=r.get(ao).listDiffEditors(),i=i6();if(i)for(const n of t){const s=n.getContainerDomNode();if(cR(s,i))return n}return null}function cR(r,e){let t=e;for(;t;){if(t===r)return!0;t=t.parentElement}return!1}gs(nR);gs(O3);gs(H3);Ea.appendMenuItem(Hi.EditorTitle,{command:{id:new H3().desc.id,title:F("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:si.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:si.has("isInDiffEditor")},order:11,group:"1_diff",when:si.and(le.diffEditorRenderSideBySideInlineBreakpointReached,si.has("isInDiffEditor"))});Ea.appendMenuItem(Hi.EditorTitle,{command:{id:new O3().desc.id,title:F("showMoves","Show Moved Code Blocks"),icon:mn.move,toggled:_F.create("config.diffEditor.experimental.showMoves",!0),precondition:si.has("isInDiffEditor")},order:10,group:"1_diff",when:si.has("isInDiffEditor")});gs(Ly);for(const r of[{icon:mn.arrowRight,key:le.diffEditorInlineMode.toNegated()},{icon:mn.discard,key:le.diffEditorInlineMode}])Ea.appendMenuItem(Hi.DiffEditorHunkToolbar,{command:{id:new Ly().desc.id,title:F("revertHunk","Revert Block"),icon:r.icon},when:si.and(le.diffEditorModifiedWritable,r.key),order:5,group:"primary"}),Ea.appendMenuItem(Hi.DiffEditorSelectionToolbar,{command:{id:new Ly().desc.id,title:F("revertSelection","Revert Selection"),icon:r.icon},when:si.and(le.diffEditorModifiedWritable,r.key),order:5,group:"primary"});gs(sR);gs(oR);gs(rR);gs(aR);Ea.appendMenuItem(Hi.EditorTitle,{command:{id:h0.id,title:F("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:si.has("isInDiffEditor")},order:10,group:"2_diff",when:si.and(le.accessibleDiffViewerVisible.negate(),si.has("isInDiffEditor"))});Ts.registerCommandAlias("editor.action.diffReview.next",h0.id);gs(h0);Ts.registerCommandAlias("editor.action.diffReview.prev",um.id);gs(um);var dR=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uR=function(r,e){return function(t,i){e(t,i,r)}},Iy;const O1=new Xn("selectionAnchorSet",!1);var Cu;let Dd=(Cu=class{static get(e){return e.getContribution(Iy.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=O1.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(pn.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new qo().appendText(F("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Sa(F("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(pn.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()}},Iy=Cu,Cu.ID="editor.contrib.selectionAnchorController",Cu);Dd=Iy=dR([uR(1,ns)],Dd);class hR extends yi{constructor(){super({id:"editor.action.setSelectionAnchor",label:F("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:co(2089,2080),weight:100}})}async run(e,t){var i;(i=Dd.get(t))==null||i.setSelectionAnchor()}}class fR extends yi{constructor(){super({id:"editor.action.goToSelectionAnchor",label:F("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:O1})}async run(e,t){var i;(i=Dd.get(t))==null||i.goToSelectionAnchor()}}class pR extends yi{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:F("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:O1,kbOpts:{kbExpr:le.editorTextFocus,primary:co(2089,2089),weight:100}})}async run(e,t){var i;(i=Dd.get(t))==null||i.selectFromAnchorToCursor()}}class gR extends yi{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:F("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:O1,kbOpts:{kbExpr:le.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=Dd.get(t))==null||i.cancelSelectionAnchor()}}On(Dd.ID,Dd,4);Qt(hR);Qt(fR);Qt(pR);Qt(gR);const vR=Ui("editorOverviewRuler.bracketMatchForeground","#A0A0A0",F("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class xR extends yi{constructor(){super({id:"editor.action.jumpToBracket",label:F("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=fh.get(t))==null||i.jumpToBracket()}}class mR extends yi{constructor(){super({id:"editor.action.selectToBracket",label:F("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Yi("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=fh.get(t))==null||s.selectToBracket(n)}}class _R extends yi{constructor(){super({id:"editor.action.removeBrackets",label:F("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=fh.get(t))==null||i.removeBrackets(this.id)}}class bR{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const jc=class jc extends Pi{static get(e){return e.getContribution(jc.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new go(()=>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 a=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?a=s[1].getStartPosition():s[1].containsPosition(n)&&(a=s[0].getStartPosition());else{const l=e.bracketPairs.findEnclosingBrackets(n);if(l)a=l[1].getStartPosition();else{const d=e.bracketPairs.findNextBracket(n);d&&d.range&&(a=d.range.getStartPosition())}}return a?new pn(a.lineNumber,a.column,a.lineNumber,a.column):new pn(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 a=t.bracketPairs.matchBracket(s);if(!a&&(a=t.bracketPairs.findEnclosingBrackets(s),!a)){const u=t.bracketPairs.findNextBracket(s);u&&u.range&&(a=t.bracketPairs.matchBracket(u.range.getStartPosition()))}let l=null,d=null;if(a){a.sort(Ge.compareRangesUsingStarts);const[u,g]=a;if(l=e?u.getStartPosition():u.getEndPosition(),d=e?g.getEndPosition():g.getStartPosition(),g.containsPosition(s)){const x=l;l=d,d=x}}l&&d&&i.push(new pn(l.lineNumber,l.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 a=0;for(let x=0,m=e.length;x<m;x++){const C=e[x];C.isEmpty()&&(s[a++]=C.getStartPosition())}s.length>1&&s.sort(Xi.compare);const l=[];let d=0,u=0;const g=n.length;for(let x=0,m=s.length;x<m;x++){const C=s[x];for(;u<g&&n[u].position.isBefore(C);)u++;if(u<g&&n[u].position.equals(C))l[d++]=n[u];else{let _=t.bracketPairs.matchBracket(C,20),E=jc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(C,20),E=jc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),l[d++]=new bR(C,_,E)}}this._lastBracketsData=l,this._lastVersionId=i}};jc.ID="editor.contrib.bracketMatchingController",jc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=qn.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ho(vR),position:Bl.Center}}),jc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=qn.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let fh=jc;On(fh.ID,fh,1);Qt(mR);Qt(xR);Qt(_R);Ea.appendMenuItem(Hi.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:F({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class CR{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 a=new Ge(i,n-1,i,n),l=e.getValueInRange(a);t.addEditOperation(a,null),t.addEditOperation(new Ge(i,s,i,s),l)}else{const a=new Ge(i,s,i,s+1),l=e.getValueInRange(a);t.addEditOperation(a,null),t.addEditOperation(new Ge(i,n,i,n),l)}}computeCursorState(e,t){return this._isMovingLeft?new pn(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new pn(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class W3 extends yi{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 CR(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class yR extends W3{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:F("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:le.writable})}}class wR extends W3{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:F("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:le.writable})}}Qt(yR);Qt(wR);class ER extends yi{constructor(){super({id:"editor.action.transposeLetters",label:F("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:le.writable,kbOpts:{kbExpr:le.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 a of s){if(!a.isEmpty())continue;const l=a.startLineNumber,d=a.startColumn,u=i.getLineMaxColumn(l);if(l===1&&(d===1||d===2&&u===2))continue;const g=d===u?a.getPosition():wb.rightPosition(i,a.getPosition().lineNumber,a.getPosition().column),x=wb.leftPosition(i,g),m=wb.leftPosition(i,x),C=i.getValueInRange(Ge.fromPositions(m,x)),_=i.getValueInRange(Ge.fromPositions(x,g)),E=Ge.fromPositions(m,g);n.push(new K0(E,_+C))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Qt(ER);const H1=(function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let r;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?r=crypto.getRandomValues.bind(crypto):r=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(){r(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 p9(r){return{asString:async()=>r,asFile:()=>{},value:typeof r=="string"?r:void 0}}function SR(r,e,t){const i={id:H1(),name:r,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class j3{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 rc.some(this,([i,n])=>n.asFile())&&t.push("files"),$3(hm(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 hm(e)}}function hm(r){return r.toLowerCase()}function V3(r,e){return $3(hm(r),e.map(hm))}function $3(r,e){if(r==="*/*")return e.length>0;if(e.includes(r))return!0;const t=r.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(a=>a.startsWith(n+"/")):!1}const z1=Object.freeze({create:r=>n6(r.map(e=>e.toString())).join(`\r
13
+ *-----------------------------------------------------------------------------*/var GM=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,ZM=Object.getOwnPropertyNames,YM=Object.prototype.hasOwnProperty,XM=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ZM(e))!YM.call(r,n)&&n!==t&&GM(r,n,{get:()=>e[n],enumerable:!(i=KM(e,n))||i.enumerable});return r},QM=(r,e,t)=>(XM(r,e,"default"),t),JM="5.4.5",Ep={};QM(Ep,t6);var B3=(r=>(r[r.None=0]="None",r[r.CommonJS=1]="CommonJS",r[r.AMD=2]="AMD",r[r.UMD=3]="UMD",r[r.System=4]="System",r[r.ES2015=5]="ES2015",r[r.ESNext=99]="ESNext",r))(B3||{}),F3=(r=>(r[r.None=0]="None",r[r.Preserve=1]="Preserve",r[r.React=2]="React",r[r.ReactNative=3]="ReactNative",r[r.ReactJSX=4]="ReactJSX",r[r.ReactJSXDev=5]="ReactJSXDev",r))(F3||{}),L3=(r=>(r[r.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",r[r.LineFeed=1]="LineFeed",r))(L3||{}),I3=(r=>(r[r.ES3=0]="ES3",r[r.ES5=1]="ES5",r[r.ES2015=2]="ES2015",r[r.ES2016=3]="ES2016",r[r.ES2017=4]="ES2017",r[r.ES2018=5]="ES2018",r[r.ES2019=6]="ES2019",r[r.ES2020=7]="ES2020",r[r.ESNext=99]="ESNext",r[r.JSON=100]="JSON",r[r.Latest=99]="Latest",r))(I3||{}),P3=(r=>(r[r.Classic=1]="Classic",r[r.NodeJs=2]="NodeJs",r))(P3||{}),T3=class{constructor(r,e,t,i,n){this._onDidChange=new Ep.Emitter,this._onDidExtraLibsChange=new Ep.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(r),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(r,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===r)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:r,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(r){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),r&&r.length>0)for(const e of r){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(r){this._compilerOptions=r||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(r){this._diagnosticsOptions=r||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(r){this._workerOptions=r||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(r){this._inlayHintsOptions=r||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(r){}setEagerModelSync(r){this._eagerModelSync=r}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(r){this._modeConfiguration=r||Object.create(null),this._onDidChange.fire(void 0)}},eR=JM,M3={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},R3=new T3({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},M3),N3=new T3({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},M3),tR=()=>N1().then(r=>r.getTypeScriptWorker()),iR=()=>N1().then(r=>r.getJavaScriptWorker());Ep.languages.typescript={ModuleKind:B3,JsxEmit:F3,NewLineKind:L3,ScriptTarget:I3,ModuleResolutionKind:P3,typescriptVersion:eR,typescriptDefaults:R3,javascriptDefaults:N3,getTypeScriptWorker:tR,getJavaScriptWorker:iR};function N1(){return e6(()=>import("./tsMode-Daa0DLzL.js"),__vite__mapDeps([3,1,2]))}Ep.languages.onLanguage("typescript",()=>N1().then(r=>r.setupTypeScript(R3)));Ep.languages.onLanguage("javascript",()=>N1().then(r=>r.setupJavaScript(N3)));class nR extends fr{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Yi("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:mn.map,toggled:si.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:si.has("isInDiffEditor"),menu:{when:si.has("isInDiffEditor"),id:Hi.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Hs),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class O3 extends fr{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Yi("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:si.has("isInDiffEditor")})}run(e,...t){const i=e.get(Hs),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class H3 extends fr{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Yi("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:si.has("isInDiffEditor")})}run(e,...t){const i=e.get(Hs),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const pv=Yi("diffEditor","Diff Editor");class sR extends Ya{constructor(){super({id:"diffEditor.switchSide",title:Yi("switchSide","Switch Side"),icon:mn.arrowSwap,precondition:si.has("isInDiffEditor"),f1:!0,category:pv})}runEditorCommand(e,t,i){const n=Gp(e);if(n instanceof G0){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class oR extends Ya{constructor(){super({id:"diffEditor.exitCompareMove",title:Yi("exitCompareMove","Exit Compare Move"),icon:mn.close,precondition:le.comparingMovedCode,f1:!1,category:pv,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Gp(e);n instanceof G0&&n.exitCompareMove()}}class rR extends Ya{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Yi("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:mn.fold,precondition:si.has("isInDiffEditor"),f1:!0,category:pv})}runEditorCommand(e,t,...i){const n=Gp(e);n instanceof G0&&n.collapseAllUnchangedRegions()}}class aR extends Ya{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Yi("showAllUnchangedRegions","Show All Unchanged Regions"),icon:mn.unfold,precondition:si.has("isInDiffEditor"),f1:!0,category:pv})}runEditorCommand(e,t,...i){const n=Gp(e);n instanceof G0&&n.showAllUnchangedRegions()}}class Ly extends fr{constructor(){super({id:"diffEditor.revert",title:Yi("revert","Revert"),f1:!1,category:pv})}run(e,t){const i=lR(e,t.originalUri,t.modifiedUri);i instanceof G0&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const z3=Yi("accessibleDiffViewer","Accessible Diff Viewer"),y_=class y_ extends fr{constructor(){super({id:y_.id,title:Yi("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:z3,precondition:si.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Gp(e);t==null||t.accessibleDiffViewerNext()}};y_.id="editor.action.accessibleDiffViewer.next";let h0=y_;const w_=class w_ extends fr{constructor(){super({id:w_.id,title:Yi("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:z3,precondition:si.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Gp(e);t==null||t.accessibleDiffViewerPrev()}};w_.id="editor.action.accessibleDiffViewer.prev";let um=w_;function lR(r,e,t){return r.get(ao).listDiffEditors().find(s=>{var d,u;const a=s.getModifiedEditor(),l=s.getOriginalEditor();return a&&((d=a.getModel())==null?void 0:d.uri.toString())===t.toString()&&l&&((u=l.getModel())==null?void 0:u.uri.toString())===e.toString()})||null}function Gp(r){const t=r.get(ao).listDiffEditors(),i=i6();if(i)for(const n of t){const s=n.getContainerDomNode();if(cR(s,i))return n}return null}function cR(r,e){let t=e;for(;t;){if(t===r)return!0;t=t.parentElement}return!1}gs(nR);gs(O3);gs(H3);Ea.appendMenuItem(Hi.EditorTitle,{command:{id:new H3().desc.id,title:F("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:si.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:si.has("isInDiffEditor")},order:11,group:"1_diff",when:si.and(le.diffEditorRenderSideBySideInlineBreakpointReached,si.has("isInDiffEditor"))});Ea.appendMenuItem(Hi.EditorTitle,{command:{id:new O3().desc.id,title:F("showMoves","Show Moved Code Blocks"),icon:mn.move,toggled:_F.create("config.diffEditor.experimental.showMoves",!0),precondition:si.has("isInDiffEditor")},order:10,group:"1_diff",when:si.has("isInDiffEditor")});gs(Ly);for(const r of[{icon:mn.arrowRight,key:le.diffEditorInlineMode.toNegated()},{icon:mn.discard,key:le.diffEditorInlineMode}])Ea.appendMenuItem(Hi.DiffEditorHunkToolbar,{command:{id:new Ly().desc.id,title:F("revertHunk","Revert Block"),icon:r.icon},when:si.and(le.diffEditorModifiedWritable,r.key),order:5,group:"primary"}),Ea.appendMenuItem(Hi.DiffEditorSelectionToolbar,{command:{id:new Ly().desc.id,title:F("revertSelection","Revert Selection"),icon:r.icon},when:si.and(le.diffEditorModifiedWritable,r.key),order:5,group:"primary"});gs(sR);gs(oR);gs(rR);gs(aR);Ea.appendMenuItem(Hi.EditorTitle,{command:{id:h0.id,title:F("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:si.has("isInDiffEditor")},order:10,group:"2_diff",when:si.and(le.accessibleDiffViewerVisible.negate(),si.has("isInDiffEditor"))});Ts.registerCommandAlias("editor.action.diffReview.next",h0.id);gs(h0);Ts.registerCommandAlias("editor.action.diffReview.prev",um.id);gs(um);var dR=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uR=function(r,e){return function(t,i){e(t,i,r)}},Iy;const O1=new Xn("selectionAnchorSet",!1);var Cu;let Dd=(Cu=class{static get(e){return e.getContribution(Iy.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=O1.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(pn.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new qo().appendText(F("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Sa(F("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(pn.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()}},Iy=Cu,Cu.ID="editor.contrib.selectionAnchorController",Cu);Dd=Iy=dR([uR(1,ns)],Dd);class hR extends yi{constructor(){super({id:"editor.action.setSelectionAnchor",label:F("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:co(2089,2080),weight:100}})}async run(e,t){var i;(i=Dd.get(t))==null||i.setSelectionAnchor()}}class fR extends yi{constructor(){super({id:"editor.action.goToSelectionAnchor",label:F("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:O1})}async run(e,t){var i;(i=Dd.get(t))==null||i.goToSelectionAnchor()}}class pR extends yi{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:F("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:O1,kbOpts:{kbExpr:le.editorTextFocus,primary:co(2089,2089),weight:100}})}async run(e,t){var i;(i=Dd.get(t))==null||i.selectFromAnchorToCursor()}}class gR extends yi{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:F("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:O1,kbOpts:{kbExpr:le.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=Dd.get(t))==null||i.cancelSelectionAnchor()}}On(Dd.ID,Dd,4);Qt(hR);Qt(fR);Qt(pR);Qt(gR);const vR=Ui("editorOverviewRuler.bracketMatchForeground","#A0A0A0",F("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class xR extends yi{constructor(){super({id:"editor.action.jumpToBracket",label:F("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=fh.get(t))==null||i.jumpToBracket()}}class mR extends yi{constructor(){super({id:"editor.action.selectToBracket",label:F("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Yi("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=fh.get(t))==null||s.selectToBracket(n)}}class _R extends yi{constructor(){super({id:"editor.action.removeBrackets",label:F("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=fh.get(t))==null||i.removeBrackets(this.id)}}class bR{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const jc=class jc extends Pi{static get(e){return e.getContribution(jc.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new go(()=>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 a=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?a=s[1].getStartPosition():s[1].containsPosition(n)&&(a=s[0].getStartPosition());else{const l=e.bracketPairs.findEnclosingBrackets(n);if(l)a=l[1].getStartPosition();else{const d=e.bracketPairs.findNextBracket(n);d&&d.range&&(a=d.range.getStartPosition())}}return a?new pn(a.lineNumber,a.column,a.lineNumber,a.column):new pn(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 a=t.bracketPairs.matchBracket(s);if(!a&&(a=t.bracketPairs.findEnclosingBrackets(s),!a)){const u=t.bracketPairs.findNextBracket(s);u&&u.range&&(a=t.bracketPairs.matchBracket(u.range.getStartPosition()))}let l=null,d=null;if(a){a.sort(Ge.compareRangesUsingStarts);const[u,g]=a;if(l=e?u.getStartPosition():u.getEndPosition(),d=e?g.getEndPosition():g.getStartPosition(),g.containsPosition(s)){const x=l;l=d,d=x}}l&&d&&i.push(new pn(l.lineNumber,l.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 a=0;for(let x=0,m=e.length;x<m;x++){const C=e[x];C.isEmpty()&&(s[a++]=C.getStartPosition())}s.length>1&&s.sort(Xi.compare);const l=[];let d=0,u=0;const g=n.length;for(let x=0,m=s.length;x<m;x++){const C=s[x];for(;u<g&&n[u].position.isBefore(C);)u++;if(u<g&&n[u].position.equals(C))l[d++]=n[u];else{let _=t.bracketPairs.matchBracket(C,20),E=jc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(C,20),E=jc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),l[d++]=new bR(C,_,E)}}this._lastBracketsData=l,this._lastVersionId=i}};jc.ID="editor.contrib.bracketMatchingController",jc._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=qn.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ho(vR),position:Bl.Center}}),jc._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=qn.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let fh=jc;On(fh.ID,fh,1);Qt(mR);Qt(xR);Qt(_R);Ea.appendMenuItem(Hi.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:F({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class CR{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 a=new Ge(i,n-1,i,n),l=e.getValueInRange(a);t.addEditOperation(a,null),t.addEditOperation(new Ge(i,s,i,s),l)}else{const a=new Ge(i,s,i,s+1),l=e.getValueInRange(a);t.addEditOperation(a,null),t.addEditOperation(new Ge(i,n,i,n),l)}}computeCursorState(e,t){return this._isMovingLeft?new pn(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new pn(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class W3 extends yi{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 CR(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class yR extends W3{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:F("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:le.writable})}}class wR extends W3{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:F("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:le.writable})}}Qt(yR);Qt(wR);class ER extends yi{constructor(){super({id:"editor.action.transposeLetters",label:F("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:le.writable,kbOpts:{kbExpr:le.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 a of s){if(!a.isEmpty())continue;const l=a.startLineNumber,d=a.startColumn,u=i.getLineMaxColumn(l);if(l===1&&(d===1||d===2&&u===2))continue;const g=d===u?a.getPosition():wb.rightPosition(i,a.getPosition().lineNumber,a.getPosition().column),x=wb.leftPosition(i,g),m=wb.leftPosition(i,x),C=i.getValueInRange(Ge.fromPositions(m,x)),_=i.getValueInRange(Ge.fromPositions(x,g)),E=Ge.fromPositions(m,g);n.push(new K0(E,_+C))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Qt(ER);const H1=(function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let r;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?r=crypto.getRandomValues.bind(crypto):r=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(){r(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 p9(r){return{asString:async()=>r,asFile:()=>{},value:typeof r=="string"?r:void 0}}function SR(r,e,t){const i={id:H1(),name:r,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class j3{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 rc.some(this,([i,n])=>n.asFile())&&t.push("files"),$3(hm(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 hm(e)}}function hm(r){return r.toLowerCase()}function V3(r,e){return $3(hm(r),e.map(hm))}function $3(r,e){if(r==="*/*")return e.length>0;if(e.includes(r))return!0;const t=r.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(a=>a.startsWith(n+"/")):!1}const z1=Object.freeze({create:r=>n6(r.map(e=>e.toString())).join(`\r
14
14
  `),split:r=>r.split(`\r
15
15
  `),parse:r=>z1.split(r).filter(e=>!e.startsWith("#"))}),gl=class gl{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+gl.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new gl((this.value?[this.value,...e]:e).join(gl.sep))}};gl.sep=".",gl.None=new gl("@@none@@"),gl.Empty=new gl("");let Ns=gl;const m8={EDITORS:"CodeEditors",FILES:"CodeFiles"};class kR{}const DR={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Xa.add(DR.DragAndDropContribution,new kR);const Zg=class Zg{constructor(){}static getInstance(){return Zg.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};Zg.INSTANCE=new Zg;let Py=Zg;function q3(r){const e=new j3;for(const t of r.items){const i=t.type;if(t.kind==="string"){const n=new Promise(s=>t.getAsString(s));e.append(i,p9(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,AR(n))}}return e}function AR(r){const e=r.path?xs.parse(r.path):void 0;return SR(r.name,e,async()=>new Uint8Array(await r.arrayBuffer()))}const BR=Object.freeze([m8.EDITORS,m8.FILES,ey.RESOURCES,ey.INTERNAL_URI_LIST]);function U3(r,e=!1){const t=q3(r),i=t.get(ey.INTERNAL_URI_LIST);if(i)t.replace(Ao.uriList,i);else if(e||!t.has(Ao.uriList)){const n=[];for(const s of r.items){const a=s.getAsFile();if(a){const l=a.path;try{l?n.push(xs.file(l).toString()):n.push(xs.parse(a.name,!0).toString())}catch{}}}n.length&&t.replace(Ao.uriList,p9(z1.create(n)))}for(const n of BR)t.delete(n);return t}var g9=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},f0=function(r,e){return function(t,i){e(t,i,r)}};class v9{async provideDocumentPasteEdits(e,t,i,n,s){const a=await this.getEdit(i,s);if(a)return{edits:[{insertText:a.insertText,title:a.title,kind:a.kind,handledMimeType:a.handledMimeType,yieldTo:a.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 Yg=class Yg extends v9{constructor(){super(...arguments),this.kind=Yg.kind,this.dropMimeTypes=[Ao.text],this.pasteMimeTypes=[Ao.text]}async getEdit(e,t){const i=e.get(Ao.text);if(!i||e.has(Ao.uriList))return;const n=await i.asString();return{handledMimeType:Ao.text,title:F("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};Yg.id="text",Yg.kind=new Ns("text.plain");let ph=Yg;class G3 extends v9{constructor(){super(...arguments),this.kind=new Ns("uri.absolute"),this.dropMimeTypes=[Ao.uriList],this.pasteMimeTypes=[Ao.uriList]}async getEdit(e,t){const i=await K3(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:l,originalText:d})=>l.scheme===lr.file?l.fsPath:(n++,d)).join(" ");let a;return n>0?a=i.length>1?F("defaultDropProvider.uriList.uris","Insert Uris"):F("defaultDropProvider.uriList.uri","Insert Uri"):a=i.length>1?F("defaultDropProvider.uriList.paths","Insert Paths"):F("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Ao.uriList,insertText:s,title:a,kind:this.kind}}}let fm=class extends v9{constructor(e){super(),this._workspaceContextService=e,this.kind=new Ns("uri.relative"),this.dropMimeTypes=[Ao.uriList],this.pasteMimeTypes=[Ao.uriList]}async getEdit(e,t){const i=await K3(e);if(!i.length||t.isCancellationRequested)return;const n=hc(i.map(({uri:s})=>{const a=this._workspaceContextService.getWorkspaceFolder(s);return a?bF(a.uri,s):void 0}));if(n.length)return{handledMimeType:Ao.uriList,insertText:n.join(" "),title:i.length>1?F("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):F("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};fm=g9([f0(0,lp)],fm);class FR{constructor(){this.kind=new Ns("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Ao.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var d;if(n.triggerKind!==ty.PasteAs&&!((d=n.only)!=null&&d.contains(this.kind)))return;const a=i.get("text/html"),l=await(a==null?void 0:a.asString());if(!(!l||s.isCancellationRequested))return{dispose(){},edits:[{insertText:l,yieldTo:this._yieldTo,title:F("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function K3(r){const e=r.get(Ao.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of z1.parse(t))try{i.push({uri:xs.parse(n),originalText:n})}catch{}return i}let Ty=class extends Pi{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new ph)),this._register(e.documentDropEditProvider.register("*",new G3)),this._register(e.documentDropEditProvider.register("*",new fm(t)))}};Ty=g9([f0(0,Qi),f0(1,lp)],Ty);let My=class extends Pi{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new ph)),this._register(e.documentPasteEditProvider.register("*",new G3)),this._register(e.documentPasteEditProvider.register("*",new fm(t))),this._register(e.documentPasteEditProvider.register("*",new FR))}};My=g9([f0(0,Qi),f0(1,lp)],My);const oa=class oa{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=oa._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(oa.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(oa.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(oa.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(oa.isVariableCharacter(i)||oa.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 oa._table[i]>"u"&&!oa.isDigitCharacter(i)&&!oa.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};oa._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let Ry=oa;class Kp{constructor(){this._children=[]}appendChild(e){return e instanceof _r&&this._children[this._children.length-1]instanceof _r?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 a(l,d){for(const u of l)u.parent=d,a(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 gv)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let _r=class Z3 extends Kp{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new Z3(this.value)}};class Y3 extends Kp{}class Yr extends Y3{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 Zp?this._children[0]:void 0}clone(){const e=new Yr(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class Zp extends Kp{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof _r&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new Zp;return this.options.forEach(e.appendChild,e),e}}class x9 extends Kp{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 Na&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Na){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new x9;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class Na extends Kp{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 Na(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class p0 extends Y3{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 _r(t)],!0):!1}clone(){const e=new p0(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function _8(r,e){const t=[...r];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class gv extends Kp{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Yr&&(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 _8([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Yr&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof p0&&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 gv;return this._children=this.children.map(t=>t.clone()),e}walk(e){_8(this.children,e)}}class gh{constructor(){this._scanner=new Ry,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 gv;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 Yr&&(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 a=(d,u)=>{const g=n.get(d.index);if(!g)return;const x=new Yr(d.index);x.transform=d.transform;for(const m of g){const C=m.clone();x.appendChild(C),C instanceof Yr&&n.has(C.index)&&!u.has(C.index)&&(u.add(C.index),a(C,u),u.delete(C.index))}t.replace(d,[x])},l=new Set;for(const d of s)a(d,l);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 Yr(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 _r(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 Yr(Number(t)):new p0(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 Yr(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new _r("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const a=new Zp;for(;;){if(this._parseChoiceElement(a)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(a),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 _r(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 p0(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new _r("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseTransform(e){const t=new x9;let i="",n="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,i+=s;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,t.appendChild(new _r(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 Na(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Na(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 Na(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Na(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Na(Number(n),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const a=this._until(4);if(a)return e.appendChild(new Na(Number(n),void 0,s,a)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Na(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new _r(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function X3(r,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 CF(r,{range:s,text:typeof t.insertText=="string"?gh.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function Q3(r){function e(a,l){return"mimeType"in a?a.mimeType===l.handledMimeType:!!l.kind&&a.kind.contains(l.kind)}const t=new Map;for(const a of r)for(const l of a.yieldTo??[])for(const d of r)if(d!==a&&e(l,d)){let u=t.get(a);u||(u=[],t.set(a,u)),u.push(d)}if(!t.size)return Array.from(r);const i=new Set,n=[];function s(a){if(!a.length)return[];const l=a[0];if(n.includes(l))return console.warn("Yield to cycle detected",l),a;if(i.has(l))return s(a.slice(1));let d=[];const u=t.get(l);return u&&(n.push(l),d=s(u),n.pop()),i.add(l),[...d,l,...s(a.slice(1))]}return s(Array.from(r))}var LR=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IR=function(r,e){return function(t,i){e(t,i,r)}};const PR=qn.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:s6,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),E_=class E_ extends Pi{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=qi(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=qi("span.icon");this.domNode.append(t),t.classList.add(...as.asClassNameArray(mn.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(is(this.domNode,Vs.CLICK,n=>{this.delegate.cancel()}))}getId(){return E_.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)}};E_.baseId="editor.widget.inlineProgressWidget";let Ny=E_,pm=class extends Pi{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new zr),this._currentWidget=this._register(new zr),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,n,s){const a=this._operationIdPool++;this._currentOperation=a,this.clear(),this._showPromise.value=Jg(()=>{const l=Ge.fromPositions(e);this._currentDecorations.set([{range:l,options:PR}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(Ny,this.id,this._editor,l,t,n))},s??this._showDelay);try{return await i}finally{this._currentOperation===a&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};pm=LR([IR(2,Ln)],pm);var TR=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},b8=function(r,e){return function(t,i){e(t,i,r)}},Fx,rd;let Cr=(rd=class{static get(e){return e.getContribution(Fx.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new zr,this._messageListeners=new Li,this._mouseOverMessage=!1,this._editor=e,this._visible=Fx.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){Sa(_x(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=_x(e)?yF(e,{actionHandler:{callback:n=>{this.closeMessage(),wF(this._openerService,n,_x(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new C8(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(po.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&EF(i6(),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(is(this._messageWidget.value.getDomNode(),Vs.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(is(this._messageWidget.value.getDomNode(),Vs.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 Ge(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(C8.fadeOut(this._messageWidget.value))}},Fx=rd,rd.ID="editor.contrib.messageController",rd.MESSAGE_VISIBLE=new Xn("messageVisible",!1,F("messageVisible","Whether the editor is currently showing an inline message")),rd);Cr=Fx=TR([b8(1,ns),b8(2,Qa)],Cr);const MR=pr.bindToContribution(Cr.get);nn(new MR({id:"leaveEditorMessage",precondition:Cr.MESSAGE_VISIBLE,handler:r=>r.closeMessage(),kbOpts:{weight:130,primary:9}}));let C8=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 a=document.createElement("div");typeof n=="string"?(a.classList.add("message"),a.textContent=n):(n.classList.add("message"),a.appendChild(n)),this._domNode.appendChild(a);const l=document.createElement("div");l.classList.add("anchor","below"),this._domNode.appendChild(l),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};On(Cr.ID,Cr,4);function Hb(r,e){return e&&(r.stack||r.stacktrace)?F("stackTrace.format","{0}: {1}",w8(r),y8(r.stack)||y8(r.stacktrace)):w8(r)}function y8(r){return Array.isArray(r)?r.join(`
16
16
  `):r}function w8(r){return r.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${r.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof r.code=="string"&&typeof r.errno=="number"&&typeof r.syscall=="string"?F("nodeExceptionMessage","A system error occurred ({0})",r.message):r.message||F("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function gm(r=null,e=!1){if(!r)return F("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(r)){const t=hc(r),i=gm(t[0],e);return t.length>1?F("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(o6(r))return r;if(r.detail){const t=r.detail;if(t.error)return Hb(t.error,e);if(t.exception)return Hb(t.exception,e)}return r.stack?Hb(r,e):r.message?r.message:F("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var J3=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hf=function(r,e){return function(t,i){e(t,i,r)}},Oy,yu;let Hy=(yu=class extends Pi{constructor(e,t,i,n,s,a,l,d,u,g){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=a,this.onSelectNewEdit=l,this._contextMenuService=d,this._keybindingService=g,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(u),this.visibleContext.set(!0),this._register(Rs(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Rs((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(x=>{s.containsPosition(x.position)||this.dispose()})),this._register(po.runAndSubscribe(g.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=qi(".post-edit-widget"),this.button=this._register(new SF(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(is(this.domNode,Vs.CLICK,()=>this.showSelector()))}getId(){return Oy.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=dr(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>kF({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},Oy=yu,yu.baseId="editor.widget.postEditWidget",yu);Hy=Oy=J3([Hf(7,zp),Hf(8,ns),Hf(9,uo)],Hy);let vm=class extends Pi{constructor(e,t,i,n,s,a,l){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=s,this._bulkEditService=a,this._notificationService=l,this._currentWidget=this._register(new zr),this._register(po.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,s){const a=this._editor.getModel();if(!a||!e.length)return;const l=t.allEdits.at(t.activeEditIndex);if(!l)return;const d=async S=>{const I=this._editor.getModel();I&&(await I.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:S,allEdits:t.allEdits},i,n,s))},u=(S,I)=>{Id(S)||(this._notificationService.error(I),i&&this.show(e[0],t,d))};let g;try{g=await n(l,s)}catch(S){return u(S,F("resolveError",`Error resolving edit '{0}':
@@ -76,7 +76,7 @@ var xF=Object.defineProperty;var A2=r=>{throw TypeError(r)};var mF=(r,e,t)=>e in
76
76
  `):void 0}:{range:Ge.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
77
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
78
  `)};const a=await s.provideRenameEdits(this.model,this.position,e,n);if(a){if(a.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(a.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(F("no result","No result.")),n);return a}}async function eq(r,e,t,i){const n=new X9(e,t,r),s=await n.resolveRenameLocation(Rn.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,Rn.None)}var th;let Fd=(th=class{static get(e){return e.getContribution(NE.ID)}constructor(e,t,i,n,s,a,l,d,u){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=a,this._configService=l,this._languageFeaturesService=d,this._telemetryService=u,this._disposableStore=new Li,this._cts=new wo,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(RE,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var _,E;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new wo,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new X9(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new cp(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const S=i.resolveRenameLocation(n.token);this._progressService.showWhile(S,250),s=await S,e("resolved rename location")}catch(S){S instanceof f1?e("resolve rename location cancelled",JSON.stringify(S,null," ")):(e("resolve rename location failed",S instanceof Error?S:JSON.stringify(S,null," ")),(typeof S=="string"||_x(S))&&((_=Cr.get(this.editor))==null||_.showMessage(S||F("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=Cr.get(this.editor))==null||E.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const a=new cp(this.editor,5,s.range,this._cts.token),l=this.editor.getModel(),d=this._languageFeaturesService.newSymbolNamesProvider.all(l),u=await Promise.all(d.map(async S=>[S,await S.supportsAutomaticNewSymbolNamesTriggerKind??!1])),g=(S,I)=>{let M=u.slice();return S===uy.Automatic&&(M=M.filter(([O,R])=>R)),M.map(([O])=>O.provideNewSymbolNames(l,s.range,S,I))};e("creating rename input field and awaiting its result");const x=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),m=await this._renameWidget.getInput(s.range,s.text,x,d.length>0?g:void 0,a);if(e("received response from rename input field"),d.length>0&&this._reportTelemetry(d.length,l.getLanguageId(),m),typeof m=="boolean"){e(`returning early - rename input field response - ${m}`),m&&this.editor.focus(),a.dispose();return}this.editor.focus(),e("requesting rename edits");const C=Z0(i.provideRenameEdits(m.newName,a.token),a.token).then(async S=>{if(!S){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(S.rejectReason){e(`returning early - rejected with reason: ${S.rejectReason}`),this._notificationService.info(S.rejectReason);return}this.editor.setSelection(Ge.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(S,{editor:this.editor,showPreview:m.wantsPreview,label:F("label","Renaming '{0}' to '{1}'",s==null?void 0:s.text,m.newName),code:"undoredo.rename",quotableLabel:F("quotableLabel","Renaming {0} to {1}",s==null?void 0:s.text,m.newName),respectAutoSaveConfig:!0}).then(I=>{e("edits applied"),I.ariaSummary&&Sa(F("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,m.newName,I.ariaSummary))}).catch(I=>{e(`error when applying edits ${JSON.stringify(I,null," ")}`),this._notificationService.error(F("rename.failedApply","Rename failed to apply edits")),this._logService.error(I)})},S=>{e("error when providing rename edits",JSON.stringify(S,null," ")),this._notificationService.error(F("rename.failed","Rename failed to compute edits")),this._logService.error(S)}).finally(()=>{a.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)}},NE=th,th.ID="editor.contrib.renameController",th);Fd=NE=J$([Rc(1,Ln),Rc(2,tr),Rc(3,d1),Rc(4,X0),Rc(5,Bh),Rc(6,uP),Rc(7,Qi),Rc(8,Ja)],Fd);class tq extends yi{constructor(){super({id:"editor.action.rename",label:F("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:si.and(le.writable,le.hasRenameProvider),kbOpts:{kbExpr:le.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(ao),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return xs.isUri(n)&&Xi.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(a=>{a&&(a.setPosition(s),a.invokeWithinContext(l=>(this.reportTelemetry(l,a),this.run(l,a))))},Ds):super.runCommand(e,t)}run(e,t){const i=e.get(Bh),n=Fd.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}On(Fd.ID,Fd,4);Qt(tq);const Q9=pr.bindToContribution(Fd.get);nn(new Q9({id:"acceptRenameInput",precondition:Qp,handler:r=>r.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:si.and(le.focus,si.not("isComposing")),primary:3}}));nn(new Q9({id:"acceptRenameInputWithPreview",precondition:si.and(Qp,si.has("config.editor.rename.enablePreview")),handler:r=>r.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:si.and(le.focus,si.not("isComposing")),primary:2051}}));nn(new Q9({id:"cancelRenameInput",precondition:Qp,handler:r=>r.cancelRenameInput(),kbOpts:{weight:199,kbExpr:le.focus,primary:9,secondary:[1033]}}));gs(class extends fr{constructor(){super({id:"focusNextRenameSuggestion",title:{...Yi("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:Qp,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(ao).getFocusedCodeEditor();if(!t)return;const i=Fd.get(t);i&&i.focusNextRenameSuggestion()}});gs(class extends fr{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Yi("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:Qp,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(ao).getFocusedCodeEditor();if(!t)return;const i=Fd.get(t);i&&i.focusPreviousRenameSuggestion()}});gr("_executeDocumentRenameProvider",function(r,e,t,...i){const[n]=i;ss(typeof n=="string");const{renameProvider:s}=r.get(Qi);return eq(s,e,t,n)});gr("_executePrepareRename",async function(r,e,t){const{renameProvider:i}=r.get(Qi),s=await new X9(e,t,i).resolveRenameLocation(Rn.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});Xa.as(Q0.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:F("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var iq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wk=function(r,e){return function(t,i){e(t,i,r)}},sp;let t_=(sp=class extends Pi{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 a;const s=(a=this.editor.getModel())==null?void 0:a.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 go(()=>{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 a=t.validateRange(s.range),l=t.tokenization.getLineTokens(a.startLineNumber),d=l.findTokenIndexAtOffset(a.startColumn-1),u=l.getStandardTokenType(d);return l.getLanguageId(d)===t.getLanguageId()&&u===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>nq(s));this.editor.changeDecorations(s=>{const a=s.deltaDecorations(i,n);this.currentOccurrences={};for(let l=0,d=a.length;l<d;l++){const u={sectionHeader:e[l],decorationId:a[l]};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()}},sp.ID="editor.sectionHeaderDetector",sp);t_=iq([Wk(1,Co),Wk(2,kc)],t_);function nq(r){return{range:r.range,options:qn.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:r.hasSeparatorLine?2:1,sectionHeaderText:r.text}})}}On(t_.ID,t_,1);function sq(r){for(let e=0,t=r.length;e<t;e+=4){const i=r[e+0],n=r[e+1],s=r[e+2],a=r[e+3];r[e+0]=a,r[e+1]=s,r[e+2]=n,r[e+3]=i}}function oq(r){const e=new Uint8Array(r.buffer,r.byteOffset,r.length*4);return hP()||sq(e),fP.wrap(e)}function HB(r){const e=new Uint32Array(rq(r));let t=0;if(e[t++]=r.id,r.type==="full")e[t++]=1,e[t++]=r.data.length,e.set(r.data,t),t+=r.data.length;else{e[t++]=2,e[t++]=r.deltas.length;for(const i of r.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 oq(e)}function rq(r){let e=0;if(e+=2,r.type==="full")e+=1+r.data.length;else{e+=1,e+=3*r.deltas.length;for(const t of r.deltas)t.data&&(e+=t.data.length)}return e}function eb(r){return r&&!!r.data}function zB(r){return r&&Array.isArray(r.edits)}class aq{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function WB(r,e){return r.has(e)}function lq(r,e){const t=r.orderedGroups(e);return t.length>0?t[0]:[]}async function jB(r,e,t,i,n){const s=lq(r,e),a=await Promise.all(s.map(async l=>{let d,u=null;try{d=await l.provideDocumentSemanticTokens(e,l===t?i:null,n)}catch(g){u=g,d=null}return(!d||!eb(d)&&!zB(d))&&(d=null),new aq(l,d,u)}));for(const l of a){if(l.error)throw l.error;if(l.tokens)return l}return a.length>0?a[0]:null}function cq(r,e){const t=r.orderedGroups(e);return t.length>0?t[0]:null}class dq{constructor(e,t){this.provider=e,this.tokens=t}}function uq(r,e){return r.has(e)}function VB(r,e){const t=r.orderedGroups(e);return t.length>0?t[0]:[]}async function J9(r,e,t,i){const n=VB(r,e),s=await Promise.all(n.map(async a=>{let l;try{l=await a.provideDocumentRangeSemanticTokens(e,t,i)}catch(d){ro(d),l=null}return(!l||!eb(l))&&(l=null),new dq(a,l)}));for(const a of s)if(a.tokens)return a;return s.length>0?s[0]:null}Ts.registerCommand("_provideDocumentSemanticTokensLegend",async(r,...e)=>{const[t]=e;ss(t instanceof xs);const i=r.get(ir).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=r.get(Qi),s=cq(n,i);return s?s[0].getLegend():r.get(bo).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Ts.registerCommand("_provideDocumentSemanticTokens",async(r,...e)=>{const[t]=e;ss(t instanceof xs);const i=r.get(ir).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=r.get(Qi);if(!WB(n,i))return r.get(bo).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await jB(n,i,null,null,Rn.None);if(!s)return;const{provider:a,tokens:l}=s;if(!l||!eb(l))return;const d=HB({id:0,type:"full",data:l.data});return l.resultId&&a.releaseDocumentSemanticTokens(l.resultId),d});Ts.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(r,...e)=>{const[t,i]=e;ss(t instanceof xs);const n=r.get(ir).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=r.get(Qi),a=VB(s,n);if(a.length===0)return;if(a.length===1)return a[0].getLegend();if(!i||!Ge.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),a[0].getLegend();const l=await J9(s,n,Ge.lift(i),Rn.None);if(l)return l.provider.getLegend()});Ts.registerCommand("_provideDocumentRangeSemanticTokens",async(r,...e)=>{const[t,i]=e;ss(t instanceof xs),ss(Ge.isIRange(i));const n=r.get(ir).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=r.get(Qi),a=await J9(s,n,Ge.lift(i),Rn.None);if(!(!a||!a.tokens))return HB({id:0,type:"full",data:a.tokens.data})});const e2="editor.semanticHighlighting";function zx(r,e,t){var n;const i=(n=t.getValue(e2,{overrideIdentifier:r.getLanguageId(),resource:r.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var $B=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yl=function(r,e){return function(t,i){e(t,i,r)}},zc;let OE=class extends Pi{constructor(e,t,i,n,s,a){super(),this._watchers=Object.create(null);const l=g=>{this._watchers[g.uri.toString()]=new HE(g,e,i,s,a)},d=(g,x)=>{x.dispose(),delete this._watchers[g.uri.toString()]},u=()=>{for(const g of t.getModels()){const x=this._watchers[g.uri.toString()];zx(g,i,n)?x||l(g):x&&d(g,x)}};t.getModels().forEach(g=>{zx(g,i,n)&&l(g)}),this._register(t.onModelAdded(g=>{zx(g,i,n)&&l(g)})),this._register(t.onModelRemoved(g=>{const x=this._watchers[g.uri.toString()];x&&d(g,x)})),this._register(n.onDidChangeConfiguration(g=>{g.affectsConfiguration(e2)&&u()})),this._register(i.onDidColorThemeChange(u))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};OE=$B([yl(0,t9),yl(1,ir),yl(2,Aa),yl(3,Hs),yl(4,Jr),yl(5,Qi)],OE);var bd;let HE=(bd=class extends Pi{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:zc.REQUEST_MIN_DELAY,max:zc.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new go(()=>this._fetchDocumentSemanticTokensNow(),zc.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 a=()=>{Go(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const l of this._provider.all(e))typeof l.onDidChange=="function"&&this._documentProvidersChangeListeners.push(l.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};a(),this._register(this._provider.onDidChange(()=>{a(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(l=>{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),Go(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!WB(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new wo,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=jB(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],a=this._model.onDidChangeContent(d=>{s.push(d)}),l=new Er(!1);n.then(d=>{if(this._debounceInformation.update(this._model,l.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,a.dispose(),!d)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:u,tokens:g}=d,x=this._semanticTokensStylingService.getStyling(u);this._setDocumentSemanticTokens(u,g||null,x,s)}},d=>{d&&(Id(d)||typeof d.message=="string"&&d.message.indexOf("busy")!==-1)||Ds(d),this._currentDocumentRequestCancellationTokenSource=null,a.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 a=0;a<s;a++)i[n+a]=e[t+a]}_setDocumentSemanticTokens(e,t,i,n){const s=this._currentDocumentResponse,a=()=>{(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),a();return}if(zB(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let l=0;for(const m of t.edits)l+=(m.data?m.data.length:0)-m.deleteCount;const d=s.data,u=new Uint32Array(d.length+l);let g=d.length,x=u.length;for(let m=t.edits.length-1;m>=0;m--){const C=t.edits[m];if(C.start>d.length){i.warnInvalidEditStart(s.resultId,t.resultId,m,C.start,d.length),this._model.tokenization.setSemanticTokens(null,!0);return}const _=g-(C.start+C.deleteCount);_>0&&(zc._copy(d,g-_,u,x-_,_),x-=_),C.data&&(zc._copy(C.data,0,u,x-C.data.length,C.data.length),x-=C.data.length),g=C.start}g>0&&zc._copy(d,0,u,0,g),t={resultId:t.resultId,data:u}}}if(eb(t)){this._currentDocumentResponse=new hq(e,t.resultId,t.data);const l=x5(t,i,this._model.getLanguageId());if(n.length>0)for(const d of n)for(const u of l)for(const g of d.changes)u.applyEdit(g.range,g.text);this._model.tokenization.setSemanticTokens(l,!0)}else this._model.tokenization.setSemanticTokens(null,!0);a()}},zc=bd,bd.REQUEST_MIN_DELAY=300,bd.REQUEST_MAX_DELAY=2e3,bd);HE=zc=$B([yl(1,t9),yl(2,Aa),yl(3,Jr),yl(4,Qi)],HE);class hq{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}Vp(OE);var fq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fg=function(r,e){return function(t,i){e(t,i,r)}},op;let i_=(op=class extends Pi{constructor(e,t,i,n,s,a){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=a.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new go(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const l=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{l()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelContent(d=>{this._cancelAll(),l()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),l()})),this._register(this._configurationService.onDidChangeConfiguration(d=>{d.affectsConfiguration(e2)&&(this._cancelAll(),l())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),l()})),l()}_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(!zx(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!uq(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=yo(a=>Promise.resolve(J9(this._provider,e,t,a))),s=new Er(!1);return n.then(a=>{if(this._debounceInformation.update(e,s.elapsed()),!a||!a.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:l,tokens:d}=a,u=this._semanticTokensStylingService.getStyling(l);e.tokenization.setPartialSemanticTokens(t,x5(d,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},op.ID="editor.contrib.viewportSemanticTokens",op);i_=fq([fg(1,t9),fg(2,Aa),fg(3,Hs),fg(4,Jr),fg(5,Qi)],i_);On(i_.ID,i_,1);class pq{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:a}=n,l=i.column-a;let d=l,u=l,g=0;for(;d>=0;d--){const x=s.charCodeAt(d);if(d!==l&&(x===95||x===45))break;if(t8(x)&&i8(g))break;g=x}for(d+=1;u<s.length;u++){const x=s.charCodeAt(u);if(i8(x)&&t8(g))break;if(x===95||x===45)break;g=x}d<u&&e.push({range:new Ge(i.lineNumber,a+d,i.lineNumber,a+u)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new Ge(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 Ge(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var gq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vq=function(r,e){return function(t,i){e(t,i,r)}},zE;class t2{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 t2(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var ih;let I0=(ih=class{static get(e){return e.getContribution(zE.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 UB(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),Rn.None).then(s=>{var a;if(!(!Nr(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!Tl(this._editor.getSelections(),t,(l,d)=>l.equalsSelection(d)))){for(let l=0;l<s.length;l++)s[l]=s[l].filter(d=>d.containsPosition(t[l].getStartPosition())&&d.containsPosition(t[l].getEndPosition())),s[l].unshift(t[l]);this._state=s.map(l=>new t2(0,l)),(a=this._selectionListener)==null||a.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{var l;this._ignoreSelection||((l=this._selectionListener)==null||l.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const n=this._state.map(s=>pn.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},zE=ih,ih.ID="editor.contrib.smartSelectController",ih);I0=zE=gq([vq(1,Qi)],I0);class qB extends yi{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=I0.get(t);i&&await i.run(this._forward)}}class xq extends qB{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:F("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:Hi.MenubarSelectionMenu,group:"1_basic",title:F({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Ts.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class mq extends qB{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:F("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:Hi.MenubarSelectionMenu,group:"1_basic",title:F({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}On(I0.ID,I0,4);Qt(xq);Qt(mq);async function UB(r,e,t,i,n){const s=r.all(e).concat(new pq(i.selectSubwords));s.length===1&&s.unshift(new zm);const a=[],l=[];for(const d of s)a.push(Promise.resolve(d.provideSelectionRanges(e,t,n)).then(u=>{if(Nr(u)&&u.length===t.length)for(let g=0;g<t.length;g++){l[g]||(l[g]=[]);for(const x of u[g])Ge.isIRange(x.range)&&Ge.containsPosition(x.range,t[g])&&l[g].push(Ge.lift(x.range))}},ro));return await Promise.all(a),l.map(d=>{if(d.length===0)return[];d.sort((m,C)=>Xi.isBefore(m.getStartPosition(),C.getStartPosition())?1:Xi.isBefore(C.getStartPosition(),m.getStartPosition())||Xi.isBefore(m.getEndPosition(),C.getEndPosition())?-1:Xi.isBefore(C.getEndPosition(),m.getEndPosition())?1:0);const u=[];let g;for(const m of d)(!g||Ge.containsRange(m,g)&&!Ge.equalsRange(m,g))&&(u.push(m),g=m);if(!i.selectLeadingAndTrailingWhitespace)return u;const x=[u[0]];for(let m=1;m<u.length;m++){const C=u[m-1],_=u[m];if(_.startLineNumber!==C.startLineNumber||_.endLineNumber!==C.endLineNumber){const E=new Ge(C.startLineNumber,e.getLineFirstNonWhitespaceColumn(C.startLineNumber),C.endLineNumber,e.getLineLastNonWhitespaceColumn(C.endLineNumber));E.containsRange(C)&&!E.equalsRange(C)&&_.containsRange(E)&&!_.equalsRange(E)&&x.push(E);const S=new Ge(C.startLineNumber,1,C.endLineNumber,e.getLineMaxColumn(C.endLineNumber));S.containsRange(C)&&!S.equalsRange(E)&&_.containsRange(S)&&!_.equalsRange(S)&&x.push(S)}x.push(_)}return x})}Ts.registerCommand("_executeSelectionRangeProvider",async function(r,...e){const[t,i]=e;ss(xs.isUri(t));const n=r.get(Qi).selectionRangeProvider,s=await r.get(tl).createModelReference(t);try{return UB(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},Rn.None)}finally{s.dispose()}});const _q=Object.freeze({View:Yi("view","View"),Help:Yi("help","Help"),Test:Yi("test","Test"),File:Yi("file","File"),Preferences:Yi("preferences","Preferences"),Developer:Yi({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class qg{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&&Tl(this.startLineNumbers,e.startLineNumbers)&&Tl(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new qg([],[],0)}}const jk=H6("stickyScrollViewLayer",{createHTML:r=>r}),dC="data-sticky-line-index",Vk="data-sticky-is-line",bq="data-sticky-is-line-number",$k="data-sticky-is-folding-icon";class Cq extends Pi{constructor(e){super(),this._editor=e,this._foldingIconStore=new Li,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 Da),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,a=n?0:this._findLineToRebuildWidgetFrom(e,i);this._renderRootNode(s,t,a),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 l of this._renderedStickyLines)this._updateTopAndZIndexOfStickyLine(l);const n=this._editor.getLayoutInfo(),s=this._lineNumbers.slice(i);for(const[l,d]of s.entries()){const u=this._renderChildNode(l+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 a=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${a}px`,this._linesDomNodeScrollable.style.height=`${a}px`,this._rootDomNode.style.height=`${a}px`,this._rootDomNode.style.marginLeft="0px",this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(l=>l.scrollWidth))+n.verticalScrollbarWidth,this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(111)==="mouseover"&&(this._foldingIconStore.add(is(this._lineNumbersDomNode,Vs.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(is(this._lineNumbersDomNode,Vs.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 a=s.coordinatesConverter.convertModelPositionToViewPosition(new Xi(t,1)).lineNumber,l=s.getViewLineRenderingData(a),d=this._editor.getOption(68);let u;try{u=c0.filter(l.inlineDecorations,a,l.minColumn,l.maxColumn)}catch{u=[]}const g=new j6(!0,!0,l.content,l.continuesWithWrappedLine,l.isBasicASCII,l.containsRTL,0,l.tokens,u,l.tabSize,l.startVisibleColumn,1,1,1,500,"none",!0,!0,null),x=new z6(2e3),m=W6(g,x);let C;jk?C=jk.createHTML(x.build()):C=x.build();const _=document.createElement("span");_.setAttribute(dC,String(e)),_.setAttribute(Vk,""),_.setAttribute("role","listitem"),_.tabIndex=0,_.className="sticky-line-content",_.classList.add(`stickyLine${t}`),_.style.lineHeight=`${this._lineHeight}px`,_.innerHTML=C;const E=document.createElement("span");E.setAttribute(dC,String(e)),E.setAttribute(bq,""),E.className="sticky-line-number",E.style.lineHeight=`${this._lineHeight}px`;const S=n.contentLeft;E.style.width=`${S}px`;const I=document.createElement("span");d.renderType===1||d.renderType===3&&t%10===0?I.innerText=t.toString():d.renderType===2&&(I.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),I.className="sticky-line-number-inner",I.style.lineHeight=`${this._lineHeight}px`,I.style.width=`${n.lineNumbersWidth}px`,I.style.paddingLeft=`${n.lineNumbersLeft}px`,E.appendChild(I);const M=this._renderFoldingIconForLine(i,t);M&&E.appendChild(M.domNode),this._editor.applyFontInfo(_),this._editor.applyFontInfo(I),E.style.lineHeight=`${this._lineHeight}px`,_.style.lineHeight=`${this._lineHeight}px`,E.style.height=`${this._lineHeight}px`,_.style.height=`${this._lineHeight}px`;const O=new yq(e,t,_,E,M,m.characterMapping,_.scrollWidth);return this._updateTopAndZIndexOfStickyLine(O)}_updateTopAndZIndexOfStickyLine(e){var g;const t=e.index,i=e.lineDomNode,n=e.lineNumberDomNode,s=t===this._lineNumbers.length-1,a="0",l="1";i.style.zIndex=s?a:l,n.style.zIndex=s?a:l;const d=`${t*this._lineHeight+this._lastLineRelativePosition+((g=e.foldingIcon)!=null&&g.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),a=n.getStartLineNumber(s);if(!(t===a))return;const d=n.isCollapsed(s),u=new wq(d,a,n.getEndLineNumber(s),this._lineHeight);return u.setVisible(this._isOnGlyphMargin?!0:d||i==="always"),u.domNode.setAttribute($k,""),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=pP(t.characterMapping,e,0);return new Xi(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,dC);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,Vk)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,$k)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class yq{constructor(e,t,i,n,s,a,l){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=a,this.scrollWidth=l}}class wq{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=as.asClassName(e?Bm:Am)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class Ug{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class n_{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class GB{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var tb=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},P0=function(r,e){return function(t,i){e(t,i,r)}},Gg;(function(r){r.OUTLINE_MODEL="outlineModel",r.FOLDING_PROVIDER_MODEL="foldingProviderModel",r.INDENTATION_MODEL="indentationModel"})(Gg||(Gg={}));var id;(function(r){r[r.VALID=0]="VALID",r[r.INVALID=1]="INVALID",r[r.CANCELED=2]="CANCELED"})(id||(id={}));let WE=class extends Pi{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new wd(300)),this._updateOperation=this._register(new Li),this._editor.getOption(116).defaultModel){case Gg.OUTLINE_MODEL:this._modelProviders.push(new jE(this._editor,n));case Gg.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new $E(this._editor,t,n));case Gg.INDENTATION_MODEL:this._modelProviders.push(new VE(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 id.CANCELED:return this._updateOperation.clear(),null;case id.VALID:return t.stickyModel}}return null}).catch(t=>(Ds(t),null))}};WE=tb([P0(2,Ln),P0(3,Qi)],WE);class KB extends Pi{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,id.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=yo(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?id.CANCELED:(this._stickyModel=this.createStickyModel(e,i),id.VALID):this._invalid()).then(void 0,i=>(Ds(i),id.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let jE=class extends KB{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return Zl.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){var a;const{stickyOutlineElement:i,providerID:n}=this._stickyModelFromOutlineModel(t,(a=this._stickyModel)==null?void 0:a.outlineProviderId),s=this._editor.getModel();return new GB(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(rc.first(e.children.values())instanceof gB){const l=rc.find(e.children.values(),d=>d.id===t);if(l)i=l.children;else{let d="",u=-1,g;for(const[x,m]of e.children.entries()){const C=this._findSumOfRangesOfGroup(m);C>u&&(g=m,u=C,d=m.id)}t=d,i=g.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((l,d)=>{const u=new Ug(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber),g=new Ug(d.symbol.range.startLineNumber,d.symbol.range.endLineNumber);return this._comparator(u,g)});for(const l of s)n.push(this._stickyModelFromOutlineElement(l,l.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new n_(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 a of s.children.values())i.push(this._stickyModelFromOutlineElement(a,s.symbol.selectionRange.startLineNumber));i.sort((s,a)=>this._comparator(s.range,a.range));const n=new Ug(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new n_(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 Lw?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};jE=tb([P0(1,Qi)],jE);class ZB extends KB{constructor(e){super(e),this._foldingLimitReporter=new hB(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new GB(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new n_(void 0,[],void 0);for(let s=0;s<t;s++){const a=e.getParentIndex(s);let l;a!==-1?l=i[a]:l=n;const d=new n_(new Ug(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],l);l.children.push(d),i.push(d)}return n}}let VE=class extends ZB{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new z9(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};VE=tb([P0(1,Co)],VE);let $E=class extends ZB{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=Bd.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new W9(e.getModel(),n,t,this._foldingLimitReporter,void 0)))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){var t;return((t=this.provider)==null?void 0:t.compute(e))??null}};$E=tb([P0(2,Qi)],$E);var Eq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qk=function(r,e){return function(t,i){e(t,i,r)}};class Sq{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let qE=class extends Pi{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new Mn),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Li),this._updateSoon=this._register(new go(()=>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(Rs(()=>{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 WE(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new wo,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 a=s;const l=[];for(let g=0;g<t.children.length;g++){const x=t.children[g];x.range&&l.push(x.range.startLineNumber)}const d=this.updateIndex(tm(l,e.startLineNumber,(g,x)=>g-x)),u=this.updateIndex(tm(l,e.startLineNumber+n,(g,x)=>g-x));for(let g=d;g<=u;g++){const x=t.children[g];if(!x)return;if(x.range){const m=x.range.startLineNumber,C=x.range.endLineNumber;e.startLineNumber<=C+1&&m-1<=e.endLineNumber&&m!==a&&(a=m,i.push(new Sq(m,C-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,x,i,n+1,m))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,x,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 a of i)t=t.filter(l=>!(l.startLineNumber>=a.startLineNumber&&l.endLineNumber<=a.endLineNumber+1));return t}};qE=Eq([qk(1,Qi),qk(2,Co)],qE);var kq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sf=function(r,e){return function(t,i){e(t,i,r)}},UE,nh;let Cc=(nh=class extends Pi{constructor(e,t,i,n,s,a,l){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=n,this._contextKeyService=l,this._sessionStore=new Li,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 Cq(this._editor),this._stickyLineCandidateProvider=new qE(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=qg.Empty,this._onDidResize(),this._readConfiguration();const d=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(g=>{this._readConfigurationChange(g)})),this._register(is(d,Vs.CONTEXT_MENU,async g=>{this._onContextMenu(hu(d),g)})),this._stickyScrollFocusedContextKey=le.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=le.stickyScrollVisible.bindTo(this._contextKeyService);const u=this._register(dp(d));this._register(u.onDidBlur(g=>{this._positionRevealed===!1&&d.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(u.onDidFocus(g=>{this.focus()})),this._registerMouseListeners(),this._register(is(d,Vs.MOUSE_DOWN,g=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(UE.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 Li,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(Ge.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Li),t=this._register(new $1(this._editor,{extractLineNumberFromMouseEvent:s=>{const a=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return a?a.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const a=s.target.element;if(!a||a.innerText!==a.innerHTML)return null;const l=this._stickyScrollWidget.getEditorPositionFromNode(a);return l?{range:new Ge(l.lineNumber,l.column,l.lineNumber,l.column+a.innerText.length),textElement:a}:null},n=this._stickyScrollWidget.getDomNode();this._register(pc(n,Vs.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 g=new Xi(this._endLineNumbers[u],1);this._revealLineInCenterIfOutsideViewport(g);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 Xi(u,1)}this._revealPosition(d)})),this._register(pc(n,Vs.MOUSE_MOVE,s=>{if(s.shiftKey){const a=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(a===null||this._showEndForLine!==null&&this._showEndForLine===a)return;this._showEndForLine=a,this._renderStickyScroll();return}this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(is(n,Vs.MOUSE_LEAVE,s=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,a])=>{const l=i(s);if(!l||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:d,textElement:u}=l;if(!d.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=d,e.clear();else if(u.style.textDecoration==="underline")return;const g=new wo;e.add(Rs(()=>g.dispose(!0)));let x;_v(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Xi(d.startLineNumber,d.startColumn+1),!1,g.token).then((m=>{if(!g.token.isCancellationRequested)if(m.length!==0){this._candidateDefinitionsLength=m.length;const C=u;x!==C?(e.clear(),x=C,x.style.textDecoration="underline",e.add(Rs(()=>{x.style.textDecoration="none"}))):x||(x=C,x.style.textDecoration="underline",e.add(Rs(()=>{x.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 a=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);a&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:a.lineNumber,column:1})),this._instaService.invokeFunction(Z4,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new gP(e,t);this._contextMenuService.showContextMenu({menuId:Hi.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;N9(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 a=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(a)||(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=Bd.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=qg.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=[],a=[],l=this._editor.getVisibleRanges();if(l.length!==0){const d=new Ug(l[0].startLineNumber,l[l.length-1].endLineNumber),u=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(d);for(const g of u){const x=g.startLineNumber,m=g.endLineNumber,C=g.nestingDepth;if(m-x>0){const _=(C-1)*e,E=C*e,S=this._editor.getBottomForLineNumber(x)-i,I=this._editor.getTopForLineNumber(m)-i,M=this._editor.getBottomForLineNumber(m)-i;if(_>I&&_<=M){s.push(x),a.push(m+1),n=M-E;break}else E>S&&E<=M&&(s.push(x),a.push(m+1));if(s.length===t)break}}}return this._endLineNumbers=a,new qg(s,a,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},UE=nh,nh.ID="store.contrib.stickyScrollController",nh);Cc=UE=kq([sf(1,zp),sf(2,Qi),sf(3,Ln),sf(4,Co),sf(5,Jr),sf(6,ns)],Cc);class Dq extends fr{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Yi("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:F({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Yi("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:_q.View,toggled:{condition:si.equals("config.editor.stickyScroll.enabled",!0),title:F("stickyScroll","Sticky Scroll"),mnemonicTitle:F({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:Hi.CommandPalette},{id:Hi.MenubarAppearanceMenu,group:"4_editor",order:3},{id:Hi.StickyScrollContext}]})}async run(e){const t=e.get(Hs),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const ib=100;class Aq extends Ya{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Yi("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:F({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:si.and(si.has("config.editor.stickyScroll.enabled"),le.stickyScrollVisible),menu:[{id:Hi.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Cc.get(t))==null||i.focus()}}class Bq extends Ya{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Yi("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:le.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ib,primary:18}})}runEditorCommand(e,t){var i;(i=Cc.get(t))==null||i.focusNext()}}class Fq extends Ya{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Yi("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:le.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ib,primary:16}})}runEditorCommand(e,t){var i;(i=Cc.get(t))==null||i.focusPrevious()}}class Lq extends Ya{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Yi("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:le.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ib,primary:3}})}runEditorCommand(e,t){var i;(i=Cc.get(t))==null||i.goToFocused()}}class Iq extends Ya{constructor(){super({id:"editor.action.selectEditor",title:Yi("selectEditor.title","Select Editor"),precondition:le.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ib,primary:9}})}runEditorCommand(e,t){var i;(i=Cc.get(t))==null||i.selectEditor()}}On(Cc.ID,Cc,1);gs(Dq);gs(Aq);gs(Fq);gs(Bq);gs(Lq);gs(Iq);var YB=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Bg=function(r,e){return function(t,i){e(t,i,r)}};class Pq{constructor(e,t,i,n,s,a){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=n,this.command=s,this.completion=a}}let GE=class extends vP{constructor(e,t,i,n,s,a){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=n,this._suggestMemoryService=a}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=rc.slice(t,i),s=rc.slice(t,0,i);let a=5;for(const l of rc.concat(n,s)){if(l.score===r0.Default)continue;const d=new Ge(l.editStart.lineNumber,l.editStart.column,l.editInsertEnd.lineNumber,l.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=l.completion.insertTextRules&&l.completion.insertTextRules&4?{snippet:l.completion.insertText}:l.completion.insertText;e.push(new Pq(d,u,l.filterTextLow??l.labelLow,l.completion.additionalTextEdits,l.completion.command,l)),a-->=0&&l.resolve(Rn.None)}return e}};GE=YB([Bg(5,X1)],GE);let KE=class extends Pi{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 _ of this._editorService.listCodeEditors())if(_.getModel()===e){s=_;break}if(!s)return;const a=s.getOption(90);if(Sf.isAllOff(a))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const l=e.tokenization.getLineTokens(t.lineNumber),d=l.getStandardTokenType(l.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Sf.valueFor(a,d)!=="inline")return;let u=e.getWordAtPosition(t),g;if(u!=null&&u.word||(g=this._getTriggerCharacterInfo(e,t)),!(u!=null&&u.word)&&!g||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let x;const m=e.getValueInRange(new Ge(t.lineNumber,1,t.lineNumber,t.column));if(!g&&((C=this._lastResult)!=null&&C.canBeReused(e,t.lineNumber,u))){const _=new Fk(m,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=_,this._lastResult.acquire(),x=this._lastResult}else{const _=await j9(this._languageFeatureService.completionProvider,e,t,new E0(void 0,jm.createSuggestFilter(s).itemKind,g==null?void 0:g.providers),g&&{triggerKind:1,triggerCharacter:g.ch},n);let E;_.needsClipboard&&(E=await this._clipboardService.readText());const S=new qc(_.items,t.column,new Fk(m,0),Wm.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},E);x=new GE(e,t.lineNumber,u,S,_,this._suggestMemoryService)}return this._lastResult=x,x}handleItemDidShow(e,t){t.completion.resolve(Rn.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(Ge.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(const a of this._languageFeatureService.completionProvider.all(e))(s=a.triggerCharacters)!=null&&s.includes(i)&&n.add(a);if(n.size!==0)return{providers:n,ch:i}}};KE=YB([Bg(0,Qi),Bg(1,Wp),Bg(2,X1),Bg(3,ao)],KE);Vp(KE);class Tq extends yi{constructor(){super({id:"editor.action.forceRetokenize",label:F("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 Er;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}Qt(Tq);const J_=class J_ extends fr{constructor(){super({id:J_.ID,title:Yi({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:Yi("tabMovesFocusDescriptions","Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!n8.getTabFocusMode();n8.setTabFocusMode(t),t?Sa(F("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):Sa(F("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};J_.ID="editor.action.toggleTabFocusMode";let ZE=J_;gs(ZE);var Mq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Uk=function(r,e){return function(t,i){e(t,i,r)}};let YE=class extends Pi{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=zi(e,qi("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??y1("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const a=this._register(new Ab(this.el,"click")),l=this._register(new Ab(this.el,"keypress")),d=po.chain(l.event,x=>x.map(m=>new e9(m)).filter(m=>m.keyCode===3)),u=this._register(new Ab(this.el,xP.Tap)).event;this._register(r6.addTarget(this.el));const g=po.any(a.event,d,u);this._register(g(x=>{this.enabled&&(Xx.stop(x,!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)}};YE=Mq([Uk(3,nv),Uk(4,Qa)],YE);var XB=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},QB=function(r,e){return function(t,i){e(t,i,r)}};const Rq=26;let XE=class extends Pi{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(QE))}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,Rq)}};XE=XB([QB(1,Ln)],XE);let QE=class extends Pi{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance($p,{}),this.element=qi("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=qi("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Fl(this.element)}show(e){Fl(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=zi(this.element,qi("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(qi(`div${as.asCSSSelector(e.icon)}`));const n=zi(this.element,qi("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=zi(this.element,qi("div.message-actions-container")),e.actions)for(const a of e.actions)this._register(this.instantiationService.createInstance(YE,this.messageActionsContainer,{...a,tabIndex:-1},{}));const s=zi(this.element,qi("div.action-container"));this.actionBar=this._register(new e0(s)),this.actionBar.push(this._register(new pp("banner.close","Close Banner",as.asClassName(A6),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};QE=XB([QB(0,Ln)],QE);var i2=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wf=function(r,e){return function(t,i){e(t,i,r)}};const Nq=io("extensions-warning-message",mn.warning,F("warningIcon","Icon shown with a warning message in the extensions editor."));var rp;let T0=(rp=class extends Pi{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 a=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let l;if(s.nonBasicAsciiCharacterCount>=a)l={message:F("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new R0};else if(s.ambiguousCharacterCount>=a)l={message:F("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new Eh};else if(s.invisibleCharacterCount>=a)l={message:F("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new M0};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:l.message,icon:Nq,actions:[{label:l.command.shortLabel,href:`command:${l.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(XE,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=Oq(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"?mP:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new JE(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Hq(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},rp.ID="editor.contrib.unicodeHighlighter",rp);T0=i2([Wf(1,kc),Wf(2,_P),Wf(3,Ln)],T0);function Oq(r,e){return{nonBasicASCII:e.nonBasicASCII===Bb?!r:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Bb?!r:e.includeComments,includeStrings:e.includeStrings===Bb?!r:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let JE=class extends Pi{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 go(()=>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:s_.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!m5(t,e))return null;const i=t.getValueInRange(e.range);return{reason:e7(i,this._options),inComment:b5(t,e),inString:_5(t,e)}}};JE=i2([Wf(3,kc)],JE);class Hq extends Pi{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 go(()=>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=C5.computeUnicodeHighlights(this._model,this._options,n);for(const a of s.ranges)i.ranges.push(a);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:s_.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 m5(t,e)?{reason:e7(i,this._options),inComment:b5(t,e),inString:_5(t,e)}:null}}const JB=F("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let eS=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(T0.ID);if(!n)return[];const s=[],a=new Set;let l=300;for(const d of t){const u=n.getDecorationInfo(d);if(!u)continue;const x=i.getValueInRange(d.range).codePointAt(0),m=uC(x);let C;switch(u.reason.kind){case 0:{$6(u.reason.confusableWith)?C=F("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",m,uC(u.reason.confusableWith.codePointAt(0))):C=F("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",m,uC(u.reason.confusableWith.codePointAt(0)));break}case 1:C=F("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",m);break;case 2:C=F("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",m);break}if(a.has(C))continue;a.add(C);const _={codePoint:x,reason:u.reason,inComment:u.inComment,inString:u.inString},E=F("unicodeHighlight.adjustSettings","Adjust settings"),S=`command:${o_.ID}?${encodeURIComponent(JSON.stringify(_))}`,I=new qo("",!0).appendMarkdown(C).appendText(" ").appendLink(S,E,JB);s.push(new _a(this,d.range,[I],!1,l++))}return s}renderHoverParts(e,t){return pO(e,t,this._editor,this._languageService,this._openerService)}};eS=i2([Wf(1,el),Wf(2,Qa)],eS);function tS(r){return`U+${r.toString(16).padStart(4,"0")}`}function uC(r){let e=`\`${tS(r)}\``;return y5.isInvisibleCharacter(r)||(e+=` "${`${zq(r)}`}"`),e}function zq(r){return r===96?"`` ` ``":"`"+String.fromCodePoint(r)+"`"}function e7(r,e){return C5.computeUnicodeHighlightReason(r,e)}const e1=class e1{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=qn.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}};e1.instance=new e1;let s_=e1;class Wq extends yi{constructor(){super({id:Eh.ID,label:F("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=F("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e==null?void 0:e.get(Hs);n&&this.runAction(n)}async runAction(e){await e.updateValue(vc.includeComments,!1,2)}}class jq extends yi{constructor(){super({id:Eh.ID,label:F("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=F("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e==null?void 0:e.get(Hs);n&&this.runAction(n)}async runAction(e){await e.updateValue(vc.includeStrings,!1,2)}}const t1=class t1 extends yi{constructor(){super({id:t1.ID,label:F("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=F("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Hs);n&&this.runAction(n)}async runAction(e){await e.updateValue(vc.ambiguousCharacters,!1,2)}};t1.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let Eh=t1;const i1=class i1 extends yi{constructor(){super({id:i1.ID,label:F("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=F("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Hs);n&&this.runAction(n)}async runAction(e){await e.updateValue(vc.invisibleCharacters,!1,2)}};i1.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let M0=i1;const n1=class n1 extends yi{constructor(){super({id:n1.ID,label:F("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=F("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Hs);n&&this.runAction(n)}async runAction(e){await e.updateValue(vc.nonBasicASCII,!1,2)}};n1.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let R0=n1;const s1=class s1 extends yi{constructor(){super({id:s1.ID,label:F("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:n,reason:s,inString:a,inComment:l}=i,d=String.fromCodePoint(n),u=e.get(wc),g=e.get(Hs);function x(_){return y5.isInvisibleCharacter(_)?F("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",tS(_)):F("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${tS(_)} "${d}"`)}const m=[];if(s.kind===0)for(const _ of s.notAmbiguousInLocales)m.push({label:F("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',_),run:async()=>{$q(g,[_])}});if(m.push({label:x(n),run:()=>Vq(g,[n])}),l){const _=new Wq;m.push({label:_.label,run:async()=>_.runAction(g)})}else if(a){const _=new jq;m.push({label:_.label,run:async()=>_.runAction(g)})}if(s.kind===0){const _=new Eh;m.push({label:_.label,run:async()=>_.runAction(g)})}else if(s.kind===1){const _=new M0;m.push({label:_.label,run:async()=>_.runAction(g)})}else if(s.kind===2){const _=new R0;m.push({label:_.label,run:async()=>_.runAction(g)})}else qq(s);const C=await u.pick(m,{title:JB});C&&await C.run()}};s1.ID="editor.action.unicodeHighlight.showExcludeOptions";let o_=s1;async function Vq(r,e){const t=r.getValue(vc.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await r.updateValue(vc.allowedCharacters,i,2)}async function $q(r,e){var n;const t=(n=r.inspect(vc.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 r.updateValue(vc.allowedLocales,i,2)}function qq(r){throw new Error(`Unexpected value: ${r}`)}Qt(Eh);Qt(M0);Qt(R0);Qt(o_);On(T0.ID,T0,1);Th.register(eS);var Uq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Gk=function(r,e){return function(t,i){e(t,i,r)}};const t7="ignoreUnusualLineTerminators";function Gq(r,e,t){r.setModelProperty(e.uri,t7,t)}function Kq(r,e){return r.getModelProperty(e.uri,t7)}var ap;let r_=(ap=class extends Pi{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()||Kq(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:F("unusualLineTerminators.title","Unusual Line Terminators"),message:F("unusualLineTerminators.message","Detected unusual line terminators"),detail:F("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`.",Rl(e.uri)),primaryButton:F({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:F("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){Gq(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},ap.ID="editor.contrib.unusualLineTerminatorsDetector",ap);r_=Uq([Gk(1,i9),Gk(2,ao)],r_);On(r_.ID,r_,1);var Zq=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yq=function(r,e){return function(t,i){e(t,i,r)}};class Kk{constructor(){this.selector={language:"*"}}provideDocumentHighlights(e,t,i){const n=[],s=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return s?e.isDisposed()?void 0:e.findMatches(s.word,!0,!1,!0,s8,!1).map(l=>({range:l.range,kind:nm.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new yd,a=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!a)return Promise.resolve(s);for(const l of[e,...i]){if(l.isDisposed())continue;const u=l.findMatches(a.word,!0,!1,!0,s8,!1).map(g=>({range:g.range,kind:nm.Text}));u&&s.set(l.uri,u)}return s}}let iS=class extends Pi{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new Kk)),this._register(e.multiDocumentHighlightProvider.register("*",new Kk))}};iS=Zq([Yq(0,Qi)],iS);var i7=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wx=function(r,e){return function(t,i){e(t,i,r)}},eo,nS;const n2=new Xn("hasWordHighlights",!1);function n7(r,e,t,i){const n=r.ordered(e);return YS(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,ro)),s=>s!=null).then(s=>{if(s){const a=new yd;return a.set(e.uri,s),a}return new yd})}function Xq(r,e,t,i,n,s){const a=r.ordered(e);return YS(a.map(l=>()=>{const d=s.filter(u=>CP(u)).filter(u=>yP(l.selector,u.uri,u.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(l.provideMultiDocumentHighlights(e,t,d,n)).then(void 0,ro)}),l=>l!=null)}class s7{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=yo(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new Ge(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,s=t.startColumn,a=t.endColumn,l=this._getCurrentWordRange(e,t);let d=!!(this._wordRange&&this._wordRange.equalsRange(l));for(let u=0,g=i.length;!d&&u<g;u++){const x=i.getRange(u);x&&x.startLineNumber===n&&x.startColumn<=s&&x.endColumn>=a&&(d=!0)}return d}cancel(){this.result.cancel()}}class Qq extends s7{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return n7(this._providers,e,t.getPosition(),n).then(s=>s||new yd)}}class Jq extends s7{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return Xq(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new yd)}}function eU(r,e,t,i,n){return new Qq(e,t,n,r)}function tU(r,e,t,i,n,s){return new Jq(e,t,n,r,s)}gr("_executeDocumentHighlights",async(r,e,t)=>{const i=r.get(Qi),n=await n7(i.documentHighlightProvider,e,t,Rn.None);return n==null?void 0:n.get(e.uri)});var Cd;let sS=(Cd=class{constructor(e,t,i,n,s){this.toUnhook=new Li,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new yd,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new wd(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=n2.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(81),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(a=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(a)})})),this.toUnhook.add(e.onDidFocusEditorText(a=>{this.occurrencesHighlight!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}))})),this.toUnhook.add(e.onDidChangeModelContent(a=>{bP(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(a=>{!a.newModelUrl&&a.oldModelUrl?this._stopSingular():eo.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(a=>{var d,u;const l=this.editor.getOption(81);if(this.occurrencesHighlight!==l)switch(this.occurrencesHighlight=l,l){case"off":this._stopAll();break;case"singleFile":this._stopAll((u=(d=eo.query)==null?void 0:d.modelInfo)==null?void 0:u.model);break;case"multiFile":eo.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",l);break}})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,eo.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(Ge.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 a=this.editor.getModel().getLineContent(n.startLineNumber);Sa(`${a}, ${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 a=this.editor.getModel().getLineContent(n.startLineNumber);Sa(`${a}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=eo.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),eo.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()||Zx(n.getModel().uri,e==null?void 0:e.uri))continue;const s=eo.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const a=Ld.get(n);a!=null&&a.wordHighlighter&&a.wordHighlighter.decorations.length>0&&(a.wordHighlighter.decorations.clear(),a.wordHighlighter.workerRequest=null,a.wordHighlighter._hasWordHighlights.set(!1))}for(const n of i)eo.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==lr.vscodeNotebookCell&&((i=(t=eo.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==lr.vscodeNotebookCell?(eo.query=null,this._run()):(n=eo.query)!=null&&n.modelInfo&&(eo.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)!==lr.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===lr.vscodeNotebookCell){const s=[],a=this.codeEditorService.listCodeEditors();for(const l of a){const d=l.getModel();d&&d!==e&&d.uri.scheme===lr.vscodeNotebookCell&&s.push(d)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!w5(s))continue;const a=s.getModel();a&&e===a.modified&&i.push(a.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of n){const a=s.getModel();a&&a!==e&&i.push(a)}return i}_run(e){var n,s;let t;if(this.editor.hasTextFocus()){const a=this.editor.getSelection();if(!a||a.startLineNumber!==a.endLineNumber){eo.query=null,this._stopAll();return}const l=a.startColumn,d=a.endColumn,u=this._getWord();if(!u||u.startColumn>l||u.endColumn<d){eo.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,a,this.decorations),eo.query={modelInfo:{model:this.model,selection:a},word:u}}else if(!eo.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(Zx(this.editor.getModel().uri,(n=eo.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 a=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const l=this.getOtherModelsToHighlight(this.editor.getModel());if(!eo.query||!eo.query.modelInfo||eo.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(eo.query.modelInfo.model,eo.query.modelInfo.selection,eo.query.word,l),(s=this.workerRequest)==null||s.result.then(d=>{a===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=d||[],this._beginRenderDecorations())},Ds)}}computeWithModel(e,t,i,n){return n.length?tU(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):eU(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 a=Ld.get(s);if(!a)continue;const l=[],d=(t=s.getModel())==null?void 0:t.uri;if(d&&this.workerRequestValue.has(d)){const u=eo.storedDecorationIDs.get(d),g=this.workerRequestValue.get(d);if(g)for(const m of g)m.range&&l.push({range:m.range,options:VV(m.kind)});let x=[];s.changeDecorations(m=>{x=m.deltaDecorations(u??[],l)}),eo.storedDecorationIDs=eo.storedDecorationIDs.set(d,x),l.length>0&&((i=a.wordHighlighter)==null||i.decorations.set(l),(n=a.wordHighlighter)==null||n._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}},eo=Cd,Cd.storedDecorationIDs=new yd,Cd.query=null,Cd);sS=eo=i7([Wx(4,ao)],sS);var sh;let Ld=(sh=class extends Pi{static get(e){return e.getContribution(nS.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new sS(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,n))};this._register(e.onDidChangeModel(a=>{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()}},nS=sh,sh.ID="editor.contrib.wordHighlighter",sh);Ld=nS=i7([Wx(1,ns),Wx(2,Qi),Wx(3,ao)],Ld);class o7 extends yi{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=Ld.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class iU extends o7{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:F("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:n2,kbOpts:{kbExpr:le.editorTextFocus,primary:65,weight:100}})}}class nU extends o7{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:F("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:n2,kbOpts:{kbExpr:le.editorTextFocus,primary:1089,weight:100}})}}class sU extends yi{constructor(){super({id:"editor.action.wordHighlight.trigger",label:F("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:le.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=Ld.get(t);n&&n.restoreViewState(!0)}}On(Ld.ID,Ld,0);Qt(iU);Qt(nU);Qt(sU);Vp(iS);class nb extends pr{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=Fh(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections(),l=a.length>1,d=a.map(u=>{const g=new Xi(u.positionLineNumber,u.positionColumn),x=this._move(n,s,g,this._wordNavigationType,l);return this._moveTo(u,x,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,d.map(u=>wP.fromModelSelection(u))),d.length===1){const u=new Xi(d[0].positionLineNumber,d[0].positionColumn);t.revealPosition(u,0)}}_moveTo(e,t,i){return i?new pn(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new pn(t.lineNumber,t.column,t.lineNumber,t.column)}}class Md extends nb{_move(e,t,i,n,s){return lv.moveWordLeft(e,t,i,n,s)}}class Rd extends nb{_move(e,t,i,n,s){return lv.moveWordRight(e,t,i,n)}}class oU extends Md{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class rU extends Md{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class aU extends Md{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:si.and(le.textInputFocus,(e=si.and(k1,D1))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class lU extends Md{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class cU extends Md{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class dU extends Md{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:si.and(le.textInputFocus,(e=si.and(k1,D1))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class uU extends Md{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(Fh(A1.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class hU extends Md{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Fh(A1.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class fU extends Rd{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class pU extends Rd{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:si.and(le.textInputFocus,(e=si.and(k1,D1))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class gU extends Rd{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class vU extends Rd{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class xU extends Rd{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:si.and(le.textInputFocus,(e=si.and(k1,D1))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class mU extends Rd{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class _U extends Rd{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(Fh(A1.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class bU extends Rd{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Fh(A1.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class sb extends pr{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(Co);if(!t.hasModel())return;const s=Fh(t.getOption(132),t.getOption(131)),a=t.getModel(),l=t.getSelections(),d=t.getOption(6),u=t.getOption(11),g=n.getLanguageConfiguration(a.getLanguageId()).getAutoClosingPairs(),x=t._getViewModel(),m=l.map(C=>{const _=this._delete({wordSeparators:s,model:a,selection:C,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:d,autoClosingQuotes:u,autoClosingPairs:g,autoClosedCharacters:x.getCursorAutoClosedCharacters()},this._wordNavigationType);return new K0(_,"")});t.pushUndoStop(),t.executeCommands(this.id,m),t.pushUndoStop()}}class s2 extends sb{_delete(e,t){const i=lv.deleteWordLeft(e,t);return i||new Ge(1,1,1,1)}}class o2 extends sb{_delete(e,t){const i=lv.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new Ge(n,s,n,s)}}class CU extends s2{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:le.writable})}}class yU extends s2{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:le.writable})}}class wU extends s2{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:le.writable,kbOpts:{kbExpr:le.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class EU extends o2{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:le.writable})}}class SU extends o2{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:le.writable})}}class kU extends o2{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:le.writable,kbOpts:{kbExpr:le.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class DU extends yi{constructor(){super({id:"deleteInsideWord",precondition:le.writable,label:F("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=Fh(t.getOption(132),t.getOption(131)),s=t.getModel(),l=t.getSelections().map(d=>{const u=lv.deleteInsideWord(n,s,d);return new K0(u,"")});t.pushUndoStop(),t.executeCommands(this.id,l),t.pushUndoStop()}}nn(new oU);nn(new rU);nn(new aU);nn(new lU);nn(new cU);nn(new dU);nn(new fU);nn(new pU);nn(new gU);nn(new vU);nn(new xU);nn(new mU);nn(new uU);nn(new hU);nn(new _U);nn(new bU);nn(new CU);nn(new yU);nn(new wU);nn(new EU);nn(new SU);nn(new kU);Qt(DU);class AU extends sb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:le.writable,kbOpts:{kbExpr:le.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=B1.deleteWordPartLeft(e);return i||new Ge(1,1,1,1)}}class BU extends sb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:le.writable,kbOpts:{kbExpr:le.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=B1.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new Ge(n,s,n,s)}}class r7 extends nb{_move(e,t,i,n,s){return B1.moveWordPartLeft(e,t,i,s)}}class FU extends r7{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:le.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Ts.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class LU extends r7{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:le.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Ts.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class a7 extends nb{_move(e,t,i,n,s){return B1.moveWordPartRight(e,t,i)}}class IU extends a7{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:le.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class PU extends a7{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:le.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}nn(new AU);nn(new BU);nn(new FU);nn(new LU);nn(new IU);nn(new PU);const S2=class S2 extends Pi{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=Cr.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new qo(F("editor.simple.readonly","Cannot edit in read-only input")):t=new qo(F("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};S2.ID="editor.contrib.readOnlyMessageController";let a_=S2;On(a_.ID,a_,2);var TU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Zk=function(r,e){return function(t,i){e(t,i,r)}};let oS=class extends Pi{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Or(this,void 0);const n=fu("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=fu("_textModel.onDidChangeContent",po.debounce(a=>this._textModel.onDidChangeContent(a),()=>{},100));this._register(tv(async(a,l)=>{n.read(a),s.read(a);const d=l.add(new kP),u=await this._outlineModelService.getOrCreate(this._textModel,d.token);l.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(SP(sv(s=>s.range.endLineNumber-s.range.startLineNumber,_1))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};oS=TU([Zk(1,Qi),Zk(2,yv)],oS);EP.setBreadcrumbsSourceFactory((r,e)=>e.createInstance(oS,r));const k2=class k2 extends Pi{constructor(e){super(),this.editor=e,this.widget=null,oy&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new rS(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};k2.ID="editor.contrib.iPadShowKeyboard";let l_=k2;const o1=class o1 extends Pi{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(is(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(is(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return o1.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};o1.ID="editor.contrib.ShowKeyboardWidget";let rS=o1;On(l_.ID,l_,3);var MU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yk=function(r,e){return function(t,i){e(t,i,r)}},aS,oh;let N0=(oh=class extends Pi{static get(e){return e.getContribution(aS.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(C1.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 lS(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},aS=oh,oh.ID="editor.contrib.inspectTokens",oh);N0=aS=MU([Yk(1,E5),Yk(2,el)],N0);class RU extends yi{constructor(){super({id:"editor.action.inspectTokens",label:FP.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=N0.get(t);i==null||i.launch()}}function NU(r){let e="";for(let t=0,i=r.length;t<i;t++){const n=r.charCodeAt(t);switch(n){case 9:e+="→";break;case 32:e+="·";break;default:e+=String.fromCharCode(n)}}return e}function OU(r,e){const t=C1.get(e);if(t)return t;const i=r.encodeLanguageId(e);return{getInitialState:()=>DP,tokenize:(n,s,a)=>BP(e,a),tokenizeEncoded:(n,s,a)=>AP(i,a)}}const r1=class r1 extends Pi{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=OU(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 r1._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 a="";if(i<t.tokens1.length){const d=t.tokens1[i].offset,u=i+1<t.tokens1.length?t.tokens1[i+1].offset:s.length;a=s.substring(d,u)}Yx(this._domNode,qi("h2.tm-token",void 0,NU(a),qi("span.tm-token-length",void 0,`${a.length} ${a.length===1?"char":"chars"}`))),zi(this._domNode,qi("hr.tokens-inspect-separator",{style:"clear:both"}));const l=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;zi(this._domNode,qi("table.tm-metadata-table",void 0,qi("tbody",void 0,qi("tr",void 0,qi("td.tm-metadata-key",void 0,"language"),qi("td.tm-metadata-value",void 0,`${l?l.languageId:"-?-"}`)),qi("tr",void 0,qi("td.tm-metadata-key",void 0,"token type"),qi("td.tm-metadata-value",void 0,`${l?this._tokenTypeToString(l.tokenType):"-?-"}`)),qi("tr",void 0,qi("td.tm-metadata-key",void 0,"font style"),qi("td.tm-metadata-value",void 0,`${l?this._fontStyleToString(l.fontStyle):"-?-"}`)),qi("tr",void 0,qi("td.tm-metadata-key",void 0,"foreground"),qi("td.tm-metadata-value",void 0,`${l?Vn.Format.CSS.formatHex(l.foreground):"-?-"}`)),qi("tr",void 0,qi("td.tm-metadata-key",void 0,"background"),qi("td.tm-metadata-value",void 0,`${l?Vn.Format.CSS.formatHex(l.background):"-?-"}`))))),zi(this._domNode,qi("hr.tokens-inspect-separator")),i<t.tokens1.length&&zi(this._domNode,qi("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=C1.getColorMap(),i=rg.getLanguageId(e),n=rg.getTokenType(e),s=rg.getFontStyle(e),a=rg.getForeground(e),l=rg.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:n,fontStyle:s,foreground:t[a],background:t[l]}}_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]}}};r1._ID="editor.contrib.inspectTokensWidget";let lS=r1;On(N0.ID,N0,4);Qt(RU);var HU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Xk=function(r,e){return function(t,i){e(t,i,r)}},Fg,rh;let cS=(rh=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=Xa.as(cv.Quickaccess)}provide(e){const t=new Li;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(Fg.PREFIX.length));n&&n.prefix&&n.prefix!==Fg.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==Fg.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:F("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}},Fg=rh,rh.PREFIX="?",rh);cS=Fg=HU([Xk(0,wc),Xk(1,uo)],cS);Xa.as(cv.Quickaccess).registerQuickAccessProvider({ctor:cS,prefix:"",helpEntries:[{description:LP.helpQuickAccessActionLabel}]});class l7{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var a;const n=new Li;e.canAcceptInBackground=!!((a=this.options)!=null&&a.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new zr);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 Li,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const a={editor:s},l=S5(s);if(l){let d=s.saveViewState()??void 0;n.add(l.onDidChangeCursorPosition(()=>{d=s.saveViewState()??void 0})),a.restoreViewState=()=>{d&&s===this.activeTextEditorControl&&s.restoreViewState(d)},n.add(k5(t.onCancellationRequested)(()=>{var u;return(u=a.restoreViewState)==null?void 0:u.call(a)}))}n.add(Rs(()=>this.clearDecorations(s))),n.add(this.provideWithTextEditor(a,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&&up(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return w5(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:ho(L6),position:Bl.Full}}}],[a,l]=i.deltaDecorations(n,s);this.rangeHighlightDecorationId={rangeHighlightId:a,overviewRulerDecorationId:l}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}const a1=class a1 extends l7{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=F("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Pi.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Li;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 a=()=>{const d=this.parsePosition(n,t.value.trim().substr(a1.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 g=this.toRange(d.lineNumber,d.column);n.revealRangeInCenter(g,0),this.addDecorations(n,g)};a(),s.add(t.onDidChangeValue(()=>a()));const l=S5(n);return l&&l.getOptions().get(68).renderType===2&&(l.updateOptions({lineNumbers:"on"}),s.add(Rs(()=>l.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)?F("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):F("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?F("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):F("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}};a1.PREFIX=":";let dS=a1;var zU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},WU=function(r,e){return function(t,i){e(t,i,r)}};let O0=class extends dS{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=po.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};O0=zU([WU(0,ao)],O0);var ah;let c7=(ah=class extends yi{constructor(){super({id:ah.ID,label:D5.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:le.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(wc).quickAccess.show(O0.PREFIX)}},ah.ID="editor.action.gotoLine",ah);Qt(c7);Xa.as(cv.Quickaccess).registerQuickAccessProvider({ctor:O0,prefix:O0.PREFIX,helpEntries:[{description:D5.gotoLineActionLabel,commandId:c7.ID}]});const d7=[void 0,[]];function hC(r,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?jU(r,n.values,t,i):u7(r,e,t,i)}function jU(r,e,t,i){let n=0;const s=[];for(const a of e){const[l,d]=u7(r,a,t,i);if(typeof l!="number")return d7;n+=l,s.push(...d)}return[n,VU(s)]}function u7(r,e,t,i){const n=Y6(e.original,e.originalLowercase,t,r,r.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],b1(n)]:d7}function VU(r){const e=r.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!$U(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 $U(r,e){return!(r.end<e.start||e.end<r.start)}function Qk(r){return r.startsWith('"')&&r.endsWith('"')}const h7=" ";function uS(r){typeof r!="string"&&(r="");const e=r.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=Jk(r),s=t.indexOf(fy)>=0,a=Qk(r);let l;const d=r.split(h7);if(d.length>1)for(const u of d){const g=Qk(u),{pathNormalized:x,normalized:m,normalizedLowercase:C}=Jk(u);m&&(l||(l=[]),l.push({original:u,originalLowercase:u.toLowerCase(),pathNormalized:x,normalized:m,normalizedLowercase:C,expectContiguousMatch:g}))}return{original:r,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:l,containsPathSeparator:s,expectContiguousMatch:a}}function Jk(r){let e;u1?e=r.replace(/\//g,fy):e=r.replace(/\\/g,fy);const t=IP(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function eD(r){return Array.isArray(r)?uS(r.map(e=>e.original).join(h7)):uS(r.original)}var qU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tD=function(r,e){return function(t,i){e(t,i,r)}},jx,ja;let bu=(ja=class extends l7{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,F("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),Pi.None}provideWithTextEditor(e,t,i,n){const s=e.editor,a=this.getModel(s);return a?this._languageFeaturesService.documentSymbolProvider.has(a)?this.doProvideWithEditorSymbols(e,a,t,i,n):this.doProvideWithoutEditorSymbols(e,a,t,i):Pi.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Li;return this.provideLabelPick(i,F("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 h1,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(Rs(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var x;const a=e.editor,l=new Li;l.add(i.onDidAccept(m=>{var _;const[C]=i.selectedItems;C&&C.range&&(this.gotoLocation(e,{range:C.range.selection,keyMods:i.keyMods,preserveFocus:m.inBackground}),(_=s==null?void 0:s.handleAccept)==null||_.call(s,C),m.inBackground||i.hide())})),l.add(i.onDidTriggerItemButton(({item:m})=>{m&&m.range&&(this.gotoLocation(e,{range:m.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const d=this.getDocumentSymbols(t,n);let u;const g=async m=>{u==null||u.dispose(!0),i.busy=!1,u=new wo(n),i.busy=!0;try{const C=uS(i.value.substr(jx.PREFIX.length).trim()),_=await this.doGetSymbolPicks(d,C,void 0,u.token,t);if(n.isCancellationRequested)return;if(_.length>0){if(i.items=_,m&&C.original.length===0){const E=RP(_,S=>!!(S.type!=="separator"&&S.range&&Ge.containsPosition(S.range.decoration,m)));E&&(i.activeItems=[E])}}else C.original.length>0?this.provideLabelPick(i,F("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,F("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return l.add(i.onDidChangeValue(()=>g(void 0))),g((x=a.getSelection())==null?void 0:x.getPosition()),l.add(i.onDidChangeActive(()=>{const[m]=i.activeItems;m&&m.range&&(a.revealRangeInCenter(m.range.selection,0),this.addDecorations(a,m.range.decoration))})),l}async doGetSymbolPicks(e,t,i,n,s){var S,I;const a=await e;if(n.isCancellationRequested)return[];const l=t.original.indexOf(jx.SCOPE_PREFIX)===0,d=l?1:0;let u,g;t.values&&t.values.length>1?(u=eD(t.values[0]),g=eD(t.values.slice(1))):u=t;let x;const m=(I=(S=this.options)==null?void 0:S.openSideBySideDirection)==null?void 0:I.call(S);m&&(x=[{iconClass:m==="right"?as.asClassName(mn.splitHorizontal):as.asClassName(mn.splitVertical),tooltip:m==="right"?F("openToSide","Open to the Side"):F("openToBottom","Open to the Bottom")}]);const C=[];for(let M=0;M<a.length;M++){const O=a[M],R=PP(O.name),H=`$(${TP.toIcon(O.kind).id}) ${R}`,G=H.length-R.length;let q=O.containerName;i!=null&&i.extraContainerLabel&&(q?q=`${i.extraContainerLabel} • ${q}`:q=i.extraContainerLabel);let te,ye,Ne,ge;if(t.original.length>d){let dt=!1;if(u!==t&&([te,ye]=hC(H,{...t,values:void 0},d,G),typeof te=="number"&&(dt=!0)),typeof te!="number"&&([te,ye]=hC(H,u,d,G),typeof te!="number"))continue;if(!dt&&g){if(q&&g.original.length>0&&([Ne,ge]=hC(q,g)),typeof Ne!="number")continue;typeof te=="number"&&(te+=Ne)}}const Ae=O.tags&&O.tags.indexOf(1)>=0;C.push({index:M,kind:O.kind,score:te,label:H,ariaLabel:MP(O.name,O.kind),description:q,highlights:Ae?void 0:{label:ye,description:ge},range:{selection:Ge.collapseToStart(O.selectionRange),decoration:O.range},uri:s.uri,symbolName:R,strikethrough:Ae,buttons:x})}const _=C.sort((M,O)=>l?this.compareByKindAndScore(M,O):this.compareByScore(M,O));let E=[];if(l){let H=function(){O&&typeof M=="number"&&R>0&&(O.label=qS(pC[M]||fC,R))},M,O,R=0;for(const G of _)M!==G.kind?(H(),M=G.kind,R=1,O={type:"separator"},E.push(O)):R++,E.push(G);H()}else _.length>0&&(E=[{label:F("symbols","symbols ({0})",C.length),type:"separator"},..._]);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=pC[e.kind]||fC,n=pC[t.kind]||fC,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()}},jx=ja,ja.PREFIX="@",ja.SCOPE_PREFIX=":",ja.PREFIX_BY_CATEGORY=`${ja.PREFIX}${ja.SCOPE_PREFIX}`,ja);bu=jx=qU([tD(0,Qi),tD(1,yv)],bu);const fC=F("property","properties ({0})"),pC={5:F("method","methods ({0})"),11:F("function","functions ({0})"),8:F("_constructor","constructors ({0})"),12:F("variable","variables ({0})"),4:F("class","classes ({0})"),22:F("struct","structs ({0})"),23:F("event","events ({0})"),24:F("operator","operators ({0})"),10:F("interface","interfaces ({0})"),2:F("namespace","namespaces ({0})"),3:F("package","packages ({0})"),25:F("typeParameter","type parameters ({0})"),1:F("modules","modules ({0})"),6:F("property","properties ({0})"),9:F("enum","enumerations ({0})"),21:F("enumMember","enumeration members ({0})"),14:F("string","strings ({0})"),0:F("file","files ({0})"),17:F("array","arrays ({0})"),15:F("number","numbers ({0})"),16:F("boolean","booleans ({0})"),18:F("object","objects ({0})"),19:F("key","keys ({0})"),7:F("field","fields ({0})"),13:F("constant","constants ({0})")};var UU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gC=function(r,e){return function(t,i){e(t,i,r)}};let hS=class extends bu{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=po.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};hS=UU([gC(0,ao),gC(1,Qi),gC(2,yv)],hS);const l1=class l1 extends yi{constructor(){super({id:l1.ID,label:py.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:le.hasDocumentSymbolProvider,kbOpts:{kbExpr:le.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(wc).quickAccess.show(bu.PREFIX,{itemActivation:NP.NONE})}};l1.ID="editor.action.quickOutline";let c_=l1;Qt(c_);Xa.as(cv.Quickaccess).registerQuickAccessProvider({ctor:hS,prefix:bu.PREFIX,helpEntries:[{description:py.quickOutlineActionLabel,prefix:bu.PREFIX,commandId:c_.ID},{description:py.quickOutlineByCategoryActionLabel,prefix:bu.PREFIX_BY_CATEGORY}]});function GU(r){const e=new Map;for(const t of r)e.set(t,(e.get(t)??0)+1);return e}class Kg{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[a,l]of this.documents){if(t.isCancellationRequested)return[];for(const d of l.chunks){const u=this.computeSimilarityScore(d,i,n);u>0&&s.push({key:a,score:u})}}return s}static termFrequencies(e){return GU(Kg.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=Kg.termFrequencies(n);for(const a of s.keys())this.chunkOccurrences.set(a,(this.chunkOccurrences.get(a)??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 a=s-1;a<=0?this.chunkOccurrences.delete(n):this.chunkOccurrences.set(n,a)}}}}computeSimilarityScore(e,t,i){let n=0;for(const[s,a]of Object.entries(t)){const l=e.tf.get(s);if(!l)continue;let d=i.get(s);typeof d!="number"&&(d=this.computeIdf(s),i.set(s,d));const u=l*d;n+=u*a}return n}computeEmbedding(e){const t=Kg.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 KU(r){var i;const e=r.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 Df;(function(r){r[r.NO_ACTION=0]="NO_ACTION",r[r.CLOSE_PICKER=1]="CLOSE_PICKER",r[r.REFRESH_PICKER=2]="REFRESH_PICKER",r[r.REMOVE_ITEM=3]="REMOVE_ITEM"})(Df||(Df={}));function vC(r){return Array.isArray(r.items)}function iD(r){const e=r;return!!e.picks&&e.additionalPicks instanceof Promise}class ZU extends Pi{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var u;const n=new Li;e.canAcceptInBackground=!!((u=this.options)!=null&&u.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const a=n.add(new zr),l=async()=>{var S;const g=a.value=new Li;s==null||s.dispose(!0),e.busy=!1,s=new wo(t);const x=s.token;let m=e.value.substring(this.prefix.length);(S=this.options)!=null&&S.shouldSkipTrimPickFilter||(m=m.trim());const C=this._getPicks(m,g,x,i),_=(I,M)=>{var H;let O,R;if(vC(I)?(O=I.items,R=I.active):O=I,O.length===0){if(M)return!1;(m.length>0||e.hideInput)&&((H=this.options)!=null&&H.noResultsPick)&&(OP(this.options.noResultsPick)?O=[this.options.noResultsPick(m)]:O=[this.options.noResultsPick])}return e.items=O,R&&(e.activeItems=[R]),!0},E=async I=>{let M=!1,O=!1;await Promise.all([(async()=>{typeof I.mergeDelay=="number"&&(await E1(I.mergeDelay),x.isCancellationRequested)||O||(M=_(I.picks,!0))})(),(async()=>{e.busy=!0;try{const R=await I.additionalPicks;if(x.isCancellationRequested)return;let H,G;vC(I.picks)?(H=I.picks.items,G=I.picks.active):H=I.picks;let q,te;if(vC(R)?(q=R.items,te=R.active):q=R,q.length>0||!M){let ye;if(!G&&!te){const Ne=e.activeItems[0];Ne&&H.indexOf(Ne)!==-1&&(ye=Ne)}_({items:[...H,...q],active:G||te||ye})}}finally{x.isCancellationRequested||(e.busy=!1),O=!0}})()])};if(C!==null)if(iD(C))await E(C);else if(!(C instanceof Promise))_(C);else{e.busy=!0;try{const I=await C;if(x.isCancellationRequested)return;iD(I)?await E(I):_(I)}finally{x.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>l())),l(),n.add(e.onDidAccept(g=>{var m;if(i!=null&&i.handleAccept){g.inBackground||e.hide(),(m=i.handleAccept)==null||m.call(i,e.activeItems[0]);return}const[x]=e.selectedItems;typeof(x==null?void 0:x.accept)=="function"&&(g.inBackground||e.hide(),x.accept(e.keyMods,g))}));const d=async(g,x)=>{var C;if(typeof x.trigger!="function")return;const m=((C=x.buttons)==null?void 0:C.indexOf(g))??-1;if(m>=0){const _=x.trigger(m,e.keyMods),E=typeof _=="number"?_:await _;if(t.isCancellationRequested)return;switch(E){case Df.NO_ACTION:break;case Df.CLOSE_PICKER:e.hide();break;case Df.REFRESH_PICKER:l();break;case Df.REMOVE_ITEM:{const S=e.items.indexOf(x);if(S!==-1){const I=e.items.slice(),M=I.splice(S,1),O=e.activeItems.filter(H=>H!==M[0]),R=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=I,O&&(e.activeItems=O),e.keepScrollPosition=R}break}}}};return n.add(e.onDidTriggerItemButton(({button:g,item:x})=>d(g,x))),n.add(e.onDidTriggerSeparatorButton(({button:g,separator:x})=>d(g,x))),n}}var f7=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Uc=function(r,e){return function(t,i){e(t,i,r)}},Xd,lo,kl;let fS=(kl=class extends ZU{constructor(e,t,i,n,s,a){super(Xd.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=a,this.commandsHistory=this._register(this.instantiationService.createInstance(pS)),this.options=e}async _getPicks(e,t,i,n){var C,_;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const a=k5(()=>{const E=new Kg;E.updateDocuments(s.map(I=>({key:I.commandId,textChunks:[this.getTfIdfChunk(I)]})));const S=E.calculateScores(e,i);return KU(S).filter(I=>I.score>Xd.TFIDF_THRESHOLD).slice(0,Xd.TFIDF_MAX_RESULTS)}),l=[];for(const E of s){const S=Xd.WORD_FILTER(e,E.label)??void 0,I=E.commandAlias?Xd.WORD_FILTER(e,E.commandAlias)??void 0:void 0;if(S||I)E.highlights={label:S,detail:this.options.showAlias?I:void 0},l.push(E);else if(e===E.commandId)l.push(E);else if(e.length>=3){const M=a();if(i.isCancellationRequested)return[];const O=M.find(R=>R.key===E.commandId);O&&(E.tfIdfScore=O.score,l.push(E))}}const d=new Map;for(const E of l){const S=d.get(E.label);S?(E.description=E.commandId,S.description=S.commandId):d.set(E.label,E)}l.sort((E,S)=>{if(E.tfIdfScore&&S.tfIdfScore)return E.tfIdfScore===S.tfIdfScore?E.label.localeCompare(S.label):S.tfIdfScore-E.tfIdfScore;if(E.tfIdfScore)return 1;if(S.tfIdfScore)return-1;const I=this.commandsHistory.peek(E.commandId),M=this.commandsHistory.peek(S.commandId);if(I&&M)return I>M?-1:1;if(I)return-1;if(M)return 1;if(this.options.suggestedCommandIds){const O=this.options.suggestedCommandIds.has(E.commandId),R=this.options.suggestedCommandIds.has(S.commandId);if(O&&R)return 0;if(O)return-1;if(R)return 1}return E.label.localeCompare(S.label)});const u=[];let g=!1,x=!0,m=!!this.options.suggestedCommandIds;for(let E=0;E<l.length;E++){const S=l[E];E===0&&this.commandsHistory.peek(S.commandId)&&(u.push({type:"separator",label:F("recentlyUsed","recently used")}),g=!0),x&&S.tfIdfScore!==void 0&&(u.push({type:"separator",label:F("suggested","similar commands")}),x=!1),m&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&((C=this.options.suggestedCommandIds)!=null&&C.has(S.commandId))&&(u.push({type:"separator",label:F("commonlyUsed","commonly used")}),g=!0,m=!1),g&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&!((_=this.options.suggestedCommandIds)!=null&&_.has(S.commandId))&&(u.push({type:"separator",label:F("morecCommands","other commands")}),g=!1),u.push(this.toCommandPick(S,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:u,additionalPicks:(async()=>{var I;const E=await this.getAdditionalCommandPicks(s,l,e,i);if(i.isCancellationRequested)return[];const S=E.map(M=>this.toCommandPick(M,n));return x&&((I=S[0])==null?void 0:I.type)!=="separator"&&S.unshift({type:"separator",label:F("suggested","similar commands")}),S})()}:u}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?F("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(a){Id(a)||this.dialogService.error(F("canNotRun","Command '{0}' resulted in an error",e.label),gm(a))}}}}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=kl,kl.PREFIX=">",kl.TFIDF_THRESHOLD=.5,kl.TFIDF_MAX_RESULTS=5,kl.WORD_FILTER=HP(jP,WP,zP),kl);fS=Xd=f7([Uc(1,Ln),Uc(2,uo),Uc(3,bo),Uc(4,Ja),Uc(5,i9)],fS);var Va;let pS=(Va=class extends Pi{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===NS.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=lo.getConfiguredCommandHistoryLength(this.configurationService),lo.cache&&lo.cache.limit!==this.configuredCommandsHistoryLength&&(lo.cache.limit=this.configuredCommandsHistoryLength,lo.hasChanges=!0))}load(){const e=this.storageService.get(lo.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=lo.cache=new J0(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,a)=>s.value-a.value),n.forEach(s=>i.set(s.key,s.value))}lo.counter=this.storageService.getNumber(lo.PREF_KEY_COUNTER,0,lo.counter)}push(e){lo.cache&&(lo.cache.set(e,lo.counter++),lo.hasChanges=!0)}peek(e){var t;return(t=lo.cache)==null?void 0:t.peek(e)}saveState(){if(!lo.cache||!lo.hasChanges)return;const e={usesLRU:!0,entries:[]};lo.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(lo.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(lo.PREF_KEY_COUNTER,lo.counter,0,0),lo.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:lo.DEFAULT_COMMANDS_HISTORY_LENGTH}},lo=Va,Va.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Va.PREF_KEY_CACHE="commandPalette.mru.cache",Va.PREF_KEY_COUNTER="commandPalette.mru.counter",Va.counter=1,Va.hasChanges=!1,Va);pS=lo=f7([Uc(0,Pd),Uc(1,Hs),Uc(2,Bh)],pS);class YU extends fS{constructor(e,t,i,n,s,a){super(e,t,i,n,s,a)}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&&(VP(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:$P(n.label)||n.id})}return t}}var XU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},of=function(r,e){return function(t,i){e(t,i,r)}};let H0=class extends YU{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,n,s,a){super({showAlias:!1},e,i,n,s,a),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};H0=XU([of(0,Ln),of(1,ao),of(2,uo),of(3,bo),of(4,Ja),of(5,i9)],H0);const c1=class c1 extends yi{constructor(){super({id:c1.ID,label:A5.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:le.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(wc).quickAccess.show(H0.PREFIX)}};c1.ID="editor.action.quickCommand";let d_=c1;Qt(d_);Xa.as(cv.Quickaccess).registerQuickAccessProvider({ctor:H0,prefix:H0.PREFIX,helpEntries:[{description:A5.quickCommandHelp,commandId:d_.ID}]});var QU=function(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rf=function(r,e){return function(t,i){e(t,i,r)}};let gS=class extends bh{constructor(e,t,i,n,s,a,l){super(!0,e,t,i,n,s,a,l)}};gS=QU([rf(1,ns),rf(2,ao),rf(3,tr),rf(4,Ln),rf(5,Pd),rf(6,Hs)],gS);On(bh.ID,gS,4);class JU extends yi{constructor(){super({id:"editor.action.toggleHighContrast",label:qP.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(E5),n=i.getColorTheme();t0(n.type)?(i.setTheme(this._originalThemeName||(o8(n.type)?UP:GP)),this._originalThemeName=null):(i.setTheme(o8(n.type)?KP:ZP),this._originalThemeName=n.themeName)}}Qt(JU);const p7="she-theme";function eG(){return localStorage.getItem(p7)??"system"}function tG(r){localStorage.setItem(p7,r);const e=document.documentElement;r==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",r),window.dispatchEvent(new CustomEvent("she:theme-changed"))}function Af(){const r=document.documentElement.getAttribute("data-theme");return r==="light"?"vs":r==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}let vS=null;function iG(r){vS=r}function nG(r={}){return{"Content-Type":"application/json",...r}}async function oi(r,e,t){const i=await fetch(e,{method:r,headers:nG(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw vS&&vS(),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 sG(){return await(await fetch("/she/auth/mode")).json()}async function oG(r){const e=await fetch("/she/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})});if(!e.ok){const t=await e.json().catch(()=>({error:e.statusText}));throw new Error(t.error??"Login failed")}}async function rG(){await fetch("/she/auth/logout",{method:"POST"})}async function aG(r,e,t,i){const n=await fetch("/she/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:r,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 g7(){return oi("GET","/she/scripts/tree")}function dx(r){return oi("GET",`/she/scripts/${r}`)}function Nc(r,e){return oi("PUT",`/she/scripts/${r}`,{content:e})}function nD(r,e={}){const t=new URLSearchParams({q:r});return e.regex&&t.set("regex","true"),e.caseSensitive&&t.set("caseSensitive","true"),e.mode&&t.set("mode",e.mode),oi("GET",`/she/scripts/search?${t}`)}function ux(r){return oi("DELETE",`/she/scripts/${r}`)}function sD(r,e){return oi("POST",`/she/scripts/${r}/rename`,{newPath:e})}function lG(r){return oi("POST","/she/scripts/mkdir",{path:r})}function cG(){return oi("GET","/she/git/status")}function Gc(){return oi("GET","/she/status")}function dG(){return oi("GET","/she/secrets")}function uG(r,e,t,i=!0){return oi("PUT",`/she/secrets/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,{value:t,secret:i})}function hG(r,e){return oi("POST",`/she/secrets/${encodeURIComponent(r)}/${encodeURIComponent(e)}/secret`)}function oD(r,e){return oi("DELETE",`/she/secrets/${encodeURIComponent(r)}`+(e?`/${encodeURIComponent(e)}`:""))}function v7(){return oi("POST","/she/restart")}function fG(){return oi("POST","/she/update")}function pG(){return oi("POST","/she/check-update")}function gG(r,e){return oi("POST","/she/git/commit",{path:r,message:e})}function rD(r,e){return oi("POST","/she/git/commit",{files:r,message:e})}function aD(r){return oi("POST","/she/git/commit",{message:r})}function hx(r){return oi("POST","/she/git/push",{remote:r})}function vG(r,e){return oi("GET",`/she/git/log?path=${encodeURIComponent(r)}&limit=${e}`)}function xG(r,e){return oi("GET",`/she/git/show?hash=${encodeURIComponent(r)}&path=${encodeURIComponent(e)}`)}function yc(){return oi("GET","/she/config")}function mG(r){return oi("PUT","/she/config",r)}function z0(r,e){return oi("PATCH","/she/config",e===void 0?{path:r}:{path:r,value:e})}function Oh(r){return r.split("/").map(encodeURIComponent).join("/")}function x7(){return oi("GET","/she/db/docs")}function _G(r){return oi("GET",`/she/db/docs/${Oh(r)}`)}function lD(r,e){return oi("PUT",`/she/db/docs/${Oh(r)}`,e)}function bG(r){return oi("DELETE",`/she/db/docs/${Oh(r)}`)}function m7(){return oi("GET","/she/db/views")}function CG(r){return oi("GET",`/she/db/views/${Oh(r)}`)}function cD(r,e){return oi("PUT",`/she/db/views/${Oh(r)}`,e)}function yG(r){return oi("DELETE",`/she/db/views/${Oh(r)}`)}function wG(){return oi("GET","/she/deps")}function EG(r){return oi("GET",`/she/deps/search?q=${encodeURIComponent(r)}`)}function SG(r,e){return oi("POST","/she/deps/install",{name:r,version:null})}function kG(r){return oi("POST","/she/deps/remove",{name:r})}function DG(r){return oi("POST","/she/deps/update",{name:r})}function _7(){return oi("GET","/she/deps/outdated")}function AG(){return oi("POST","/she/deps/check-outdated")}function BG(){return oi("GET","/she/ai/conversations")}function dD(r){return oi("GET",`/she/ai/conversations/${encodeURIComponent(r)}`)}function FG(r,e,t){return oi("PUT",`/she/ai/conversations/${encodeURIComponent(r)}`,{title:e,messages:t})}function LG(r){return oi("DELETE",`/she/ai/conversations/${encodeURIComponent(r)}`)}function xC(r){return oi("GET",`/she/db/views/${Oh(r)}/result`)}function r2(){return oi("GET","/she/matter/devices")}function Vx(r){return oi("GET",`/she/matter/devices/${r}`)}function IG(r){return oi("POST","/she/matter/commission",r)}function PG(r){return oi("DELETE",`/she/matter/devices/${r}`)}function TG(r,e){return oi("POST",`/she/matter/devices/${r}/rename`,{name:e})}function MG(r,e,t,i,n){return oi("POST",`/she/matter/devices/${r}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function b7(){return oi("GET","/she/mqtt/state")}function uD(r,e,t=!1,i=0){return oi("POST","/she/mqtt/publish",{topic:r,payload:e,retain:t,qos:i})}function RG(r){const e=r?`?prefix=${encodeURIComponent(r)}`:"";return oi("GET",`/she/mqtt/ha-discovery${e}`)}function NG(r){return oi("DELETE","/she/mqtt/ha-discovery",{topics:r})}function C7(){return oi("GET","/she/ai/config")}function y7(){return oi("GET","/she/ai/models")}function xS(r){return oi("GET",`/she/ai/model-info?model=${encodeURIComponent(r)}`)}function w7(r){return oi("POST","/she/ai/prompt",r)}async function E7(r,e,t,i){const s=await fetch("/she/ai/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),signal:t});if(!s.ok){const u=await s.json().catch(()=>({error:s.statusText}));throw new Error(u.error??s.statusText)}const a=s.body.getReader(),l=new TextDecoder;let d="";try{for(;;){const{done:u,value:g}=await a.read();if(u)break;d+=l.decode(g,{stream:!0});const x=d.split(`
79
- `);d=x.pop()??"";for(const m of x){if(!m.startsWith("data: "))continue;const C=m.slice(6).trim();if(C==="[DONE]")return;try{const _=JSON.parse(C);if(_.error)throw new Error(_.error);if(_.type==="tool_call"||_.type==="tool_result"){i==null||i({type:_.type,name:_.name??"",args:_.args,content:_.content});continue}_.token&&e(_.token)}catch(_){if(_ instanceof SyntaxError)continue;throw _}}}}finally{a.releaseLock()}}function ob(){return oi("GET","/she/broker/status")}function OG(){return oi("GET","/she/broker/local/check")}function HG(){return oi("GET","/she/broker/ip-addresses")}function Ev(){return oi("GET","/she/broker/config")}function zG(r=500){return oi("GET",`/she/broker/logs?limit=${r}`)}function S7(r){return oi("PUT","/she/broker/config",r)}function WG(r,e){return oi("PUT","/she/broker/config/raw",{content:r,checksum:e})}function jG(){return oi("GET","/she/broker/config/backups")}function VG(r){return oi("POST","/she/broker/config/restore",{backup:r})}function rb(){return oi("POST","/she/broker/reload")}function $G(){return oi("POST","/she/broker/restart")}function qG(){return oi("POST","/she/broker/wizard/deactivate")}function UG(){return oi("POST","/she/broker/wizard/reinit")}function GG(){return oi("GET","/she/broker/wizard/diagnose")}function KG(r){return oi("GET",`/she/broker/passwd?file=${encodeURIComponent(r)}`)}function hD(r,e,t){return oi("POST","/she/broker/passwd",{file:r,username:e,password:t})}function ZG(r,e){return oi("DELETE",`/she/broker/passwd/${encodeURIComponent(e)}`,{file:r})}function YG(r){return oi("GET",`/she/broker/acl?file=${encodeURIComponent(r)}`)}function XG(r,e){return oi("PUT","/she/broker/acl",{file:r,content:e})}function QG(){return oi("GET","/she/broker/users")}function JG(r,e){return oi("POST","/she/broker/users",{username:r,password:e})}function eK(r){return oi("DELETE",`/she/broker/users/${encodeURIComponent(r)}`)}function tK(r,e){return oi("PUT",`/she/broker/users/${encodeURIComponent(r)}/password`,{password:e})}function iK(r,e){return oi("POST",`/she/broker/users/${encodeURIComponent(r)}/roles`,{rolename:e})}function nK(r,e){return oi("DELETE",`/she/broker/users/${encodeURIComponent(r)}/roles/${encodeURIComponent(e)}`)}function k7(){return oi("GET","/she/broker/roles")}function sK(r){return oi("POST","/she/broker/roles",{rolename:r})}function oK(r){return oi("DELETE",`/she/broker/roles/${encodeURIComponent(r)}`)}function rK(r,e){return oi("POST",`/she/broker/roles/${encodeURIComponent(r)}/acls`,e)}function aK(r,e,t){return oi("DELETE",`/she/broker/roles/${encodeURIComponent(r)}/acls`,{acltype:e,topic:t})}function lK(){return oi("GET","/she/broker/groups")}function cK(r){return oi("POST","/she/broker/groups",{groupname:r})}function dK(r){return oi("DELETE",`/she/broker/groups/${encodeURIComponent(r)}`)}function fD(r,e){return oi("POST",`/she/broker/groups/${encodeURIComponent(r)}/clients`,{username:e})}function pD(r,e){return oi("DELETE",`/she/broker/groups/${encodeURIComponent(r)}/clients/${encodeURIComponent(e)}`)}function uK(r,e){return oi("POST",`/she/broker/groups/${encodeURIComponent(r)}/roles`,{rolename:e})}function hK(r,e){return oi("DELETE",`/she/broker/groups/${encodeURIComponent(r)}/roles/${encodeURIComponent(e)}`)}function fK(){return oi("GET","/she/broker/acl-defaults")}function pK(r){return oi("PUT","/she/broker/acl-defaults",{acls:r})}function gK(r){return oi("GET",`/she/broker/acl-check?${new URLSearchParams({topic:r})}`)}function vK(){return oi("GET","/she/broker/anonymous-group")}function xK(r){return oi("PUT","/she/broker/anonymous-group",{groupname:r})}function mK(){return oi("GET","/she/broker/ca/server")}function _K(r){return oi("POST","/she/broker/ca/server/generate",r)}function bK(r){return oi("POST","/she/broker/ca/server/csr",r)}function mC(r){return oi("POST","/she/broker/ca/server/import",r)}function CK(){return oi("GET","/she/broker/ca/trusted")}function yK(r){return oi("POST","/she/broker/ca/trusted",{pem:r})}function wK(r){return oi("DELETE",`/she/broker/ca/trusted/${encodeURIComponent(r)}`)}function EK(r){return oi("GET",`/she/broker/fs/complete?path=${encodeURIComponent(r)}`)}function SK(r){return oi("POST","/she/broker/ca/server/pathlink",r)}function kK(r){return oi("POST","/she/broker/ca/trusted/addpath",{path:r})}function D7(){return oi("GET","/she/services/instances")}function DK(r){return oi("POST",`/she/services/instances/${encodeURIComponent(r)}/restart`)}function AK(r,e){return oi("POST",`/she/services/instances/${encodeURIComponent(r)}/loglevel`,{level:e})}function BK(r){return oi("GET",`/she/services/instances/${encodeURIComponent(r)}/retained`)}function FK(r,e=!0){return oi("DELETE",`/she/services/instances/${encodeURIComponent(r)}/retained`,{discovery:e})}const mS="-";function LK(r,e,t){return oi("POST",`${Ba(r,e,mS)}/migrate`,{name:t})}function IK(r,e,t={}){return oi("POST",`/she/services/hosts/${encodeURIComponent(r)}/adapters/${encodeURIComponent(e)}/discover`,t)}const Nd=r=>`/she/services/hosts/${encodeURIComponent(r)}`,Ba=(r,e,t)=>`${Nd(r)}/units/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,Sv=(r,e)=>`${Nd(r)}/adapters/${encodeURIComponent(e)}`;function pa(r=!1){return oi("GET",r?"/she/services/hosts?refresh=1":"/she/services/hosts")}function PK(r,e,t=!1){return oi("GET",`${Sv(r,e)}/schema${t?"?refresh=1":""}`)}function TK(r,e,t,i,n="own"){return oi("POST",`${Sv(r,e)}/install`,{instance:t,env:i,brokerMode:n})}function gD(r,e,t=!1){return oi("POST",`${Sv(r,e)}/update`,{force:t})}function vD(r,e,t,i){return oi("POST",`${Ba(r,e,t)}/${i}`)}function MK(r,e){return oi("POST",`${Nd(r)}/adapters/${encodeURIComponent(e)}/uninstall`)}function RK(r,e,t){return oi("DELETE",Ba(r,e,t))}function NK(r,e,t,i=200){return oi("GET",`${Ba(r,e,t)}/logs?n=${i}`)}function xD(r,e,t){return oi("POST",`${Ba(r,e,t)}/logs/follow`)}function OK(r,e,t){return oi("DELETE",`${Ba(r,e,t)}/logs/follow`)}function HK(r,e,t){return oi("GET",`${Ba(r,e,t)}/env`)}function zK(r,e,t,i,n,s,a={}){return oi("PUT",`${Ba(r,e,t)}/env`,{env:i,restart:n,brokerMode:s,rotate:a.rotate===!0})}function WK(){return oi("GET","/she/services/ssh/pubkey")}function jK(){return oi("POST","/she/services/ssh/keygen")}function VK(r){return oi("POST",`${Nd(r)}/test`)}function $K(r,e="lts"){return oi("POST",`${Nd(r)}/node/update`,{channel:e})}function qK(r=!1){return oi("GET",`/she/services/node/releases${r?"?refresh=1":""}`)}function UK(r){return oi("POST",`${Nd(r)}/instances/restart-all`)}function GK(r){return oi("POST","/she/services/setup/token",{origin:r})}function KK(r){return oi("GET",`/she/services/setup/token/${encodeURIComponent(r)}`)}function mD(r){return oi("POST","/she/services/ssh/test",r)}function _D(r){return oi("POST",`${Nd(r)}/helper/deploy`)}function ZK(r,e,t=!1){return oi("POST",`${Nd(r)}/helper/remove`,{mode:e,force:t})}function YK(r,e,t){return oi("GET",`${Ba(r,e,t)}/files`)}function XK(r,e,t,i){return oi("GET",`${Ba(r,e,t)}/file?path=${encodeURIComponent(i)}`)}function QK(r,e,t,i,n,s=!1){return oi("PUT",`${Ba(r,e,t)}/file`,{path:i,content:n,restart:s})}function JK(r,e,t,i,n){return oi("POST",`${Ba(r,e,t)}/file/create`,{option:i,path:n})}function eZ(r,e,t){return oi("GET",`${Sv(r,e)}/asset?path=${encodeURIComponent(t)}`)}function tZ(r=!1){return oi("GET",r?"/she/services/catalog?refresh=1":"/she/services/catalog")}function iZ(r,e){return oi("POST",`${Sv(r,e)}/install-package`)}const nZ=2e3,$x=[],sZ=500,qx=[];function A7(){return $x.slice()}function oZ(){return qx.slice()}let nc=null;const u_=new Set,Bf=new Map;let jf=null,Ux=null;function a2(){return Ux||(Ux=fetch("/she/logs/history").then(r=>r.ok?r.json():[]).catch(()=>[])),Ux}function Hp(){let r=u_.size;for(const e of Bf.values())r+=e.size;return r}function rZ(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function ab(){if(nc)return;a2();const r=rZ(),e=new WebSocket(r);nc=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};$x.length>=nZ&&$x.shift(),$x.push(s),u_.forEach(a=>a(s))}if(i.type==="brokerLog"){const s={level:i.level,msg:i.msg,ts:i.ts};qx.length>=sZ&&qx.shift(),qx.push(s)}const n=Bf.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{nc===e&&(nc=null,Ux=null),Hp()>0&&(jf=setTimeout(ab,3e3))},e.onerror=()=>{e.close()}}function aZ(){nc||Hp()===0||(jf&&(clearTimeout(jf),jf=null),ab())}function B7(){jf&&clearTimeout(jf),nc==null||nc.close(),nc=null}function l2(r){return u_.add(r),Hp()===1&&ab(),()=>{u_.delete(r),Hp()===0&&B7()}}function Xo(r,e){return Bf.has(r)||Bf.set(r,new Set),Bf.get(r).add(e),Hp()===1&&ab(),()=>{var t;(t=Bf.get(r))==null||t.delete(e),Hp()===0&&B7()}}function lb(r){const e=new Date(r);return e.toTimeString().slice(0,8)+"."+String(e.getMilliseconds()).padStart(3,"0")}const _C=/([^\s():,]+\.js)(?::(\d+)(?::(\d+))?)?/g;function F7(r,e){const t=[];let i=0;_C.lastIndex=0;for(let n=_C.exec(r);n!==null;n=_C.exec(r)){const s=e(n[1]);s&&(n.index>i&&t.push({text:r.slice(i,n.index)}),t.push({text:n[0],link:{path:s,line:n[2]?Number(n[2]):void 0,column:n[3]?Number(n[3]):void 0}}),i=n.index+n[0].length)}return i<r.length&&t.push({text:r.slice(i)}),t}function L7(r){return e=>{const t=e.replace(/\\/g,"/");if(r.has(t))return t;for(const i of r)if(t.endsWith("/"+i))return i;return null}}function c2(r,e=new Set){for(const t of r)t.type==="file"?e.add(t.path):t.children&&c2(t.children,e);return e}var lZ=k('<button class="cancel svelte-1eh8v5n">Cancel</button>'),cZ=k('<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 kr(r,e){ls(e,!0);let t=A(!1),i=A(""),n=A("Confirm"),s=A(!1),a=A(!1),l=null;function d(E,S){return p(i,E,!0),p(n,(S==null?void 0:S.confirm)??(S!=null&&S.alert?"OK":"Confirm"),!0),p(s,(S==null?void 0:S.danger)??!1,!0),p(a,(S==null?void 0:S.alert)??!1,!0),p(t,!0),new Promise(I=>l=I)}function u(E){p(t,!1),l==null||l(E),l=null}function g(E){o(t)&&(E.key==="Escape"&&u(!1),E.key==="Enter"&&u(!0))}var x={show:d},m=ks();ws("keydown",wa,g);var C=Dt(m);{var _=E=>{var S=cZ(),I=Dt(S),M=h(I,2),O=f(M),R=f(O),H=h(O,2),G=f(H);{var q=ge=>{var Ae=lZ();z("click",Ae,()=>u(!1)),y(ge,Ae)};T(G,ge=>{o(a)||ge(q)})}var te=h(G,2);let ye;var Ne=f(te);P(()=>{B(R,o(i)),ye=Xt(te,1,"svelte-1eh8v5n",null,ye,{danger:o(s)}),B(Ne,o(n))}),z("click",I,()=>u(!1)),z("click",te,()=>u(!0)),y(E,S)};T(C,E=>{o(t)&&E(_)})}return y(r,m),cs(x)}ms(["click"]);var dZ=k('<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 d2(r,e){ls(e,!0);let t=A(!1),i=A(""),n=A(""),s=A("OK"),a=A(""),l=null,d=A(void 0);function u(I,M){return p(i,I,!0),p(n,(M==null?void 0:M.placeholder)??"",!0),p(s,(M==null?void 0:M.confirm)??"OK",!0),p(a,(M==null?void 0:M.initial)??"",!0),p(t,!0),setTimeout(()=>{if(o(d)){o(d).focus();const O=o(d).value.length;o(d).setSelectionRange(O,O)}},0),new Promise(O=>l=O)}function g(){const I=o(a).trim();I&&(p(t,!1),l==null||l(I),l=null,p(a,""))}function x(){p(t,!1),l==null||l(null),l=null,p(a,"")}function m(I){o(t)&&I.key==="Escape"&&(I.stopPropagation(),x())}var C={show:u},_=ks();ws("keydown",wa,m);var E=Dt(_);{var S=I=>{var M=dZ(),O=Dt(M),R=h(O,2),H=f(R),G=f(H),q=h(H,2);ts(q,Ae=>p(d,Ae),()=>o(d));var te=h(q,2),ye=f(te),Ne=h(ye,2),ge=f(Ne);P(Ae=>{B(G,o(i)),xi(q,"placeholder",o(n)),Ne.disabled=Ae,B(ge,o(s))},[()=>!o(a).trim()]),z("click",O,x),z("keydown",q,Ae=>{Ae.key==="Enter"&&(Ae.preventDefault(),g())}),ui(q,()=>o(a),Ae=>p(a,Ae)),z("click",ye,x),z("click",Ne,g),y(I,M)};T(E,I=>{o(t)&&I(S)})}return y(r,_),cs(C)}ms(["click","keydown"]);function u2(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var bC,bD;function uZ(){if(bD)return bC;bD=1;function r($){return $ instanceof Map?$.clear=$.delete=$.set=function(){throw new Error("map is read-only")}:$ instanceof Set&&($.add=$.clear=$.delete=function(){throw new Error("set is read-only")}),Object.freeze($),Object.getOwnPropertyNames($).forEach(be=>{const Le=$[be],at=typeof Le;(at==="object"||at==="function")&&!Object.isFrozen(Le)&&r(Le)}),$}class e{constructor(be){be.data===void 0&&(be.data={}),this.data=be.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i($,...be){const Le=Object.create(null);for(const at in $)Le[at]=$[at];return be.forEach(function(at){for(const St in at)Le[St]=at[St]}),Le}const n="</span>",s=$=>!!$.scope,a=($,{prefix:be})=>{if($.startsWith("language:"))return $.replace("language:","language-");if($.includes(".")){const Le=$.split(".");return[`${be}${Le.shift()}`,...Le.map((at,St)=>`${at}${"_".repeat(St+1)}`)].join(" ")}return`${be}${$}`};class l{constructor(be,Le){this.buffer="",this.classPrefix=Le.classPrefix,be.walk(this)}addText(be){this.buffer+=t(be)}openNode(be){if(!s(be))return;const Le=a(be.scope,{prefix:this.classPrefix});this.span(Le)}closeNode(be){s(be)&&(this.buffer+=n)}value(){return this.buffer}span(be){this.buffer+=`<span class="${be}">`}}const d=($={})=>{const be={children:[]};return Object.assign(be,$),be};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(be){this.top.children.push(be)}openNode(be){const Le=d({scope:be});this.add(Le),this.stack.push(Le)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(be){return this.constructor._walk(be,this.rootNode)}static _walk(be,Le){return typeof Le=="string"?be.addText(Le):Le.children&&(be.openNode(Le),Le.children.forEach(at=>this._walk(be,at)),be.closeNode(Le)),be}static _collapse(be){typeof be!="string"&&be.children&&(be.children.every(Le=>typeof Le=="string")?be.children=[be.children.join("")]:be.children.forEach(Le=>{u._collapse(Le)}))}}class g extends u{constructor(be){super(),this.options=be}addText(be){be!==""&&this.add(be)}startScope(be){this.openNode(be)}endScope(){this.closeNode()}__addSublanguage(be,Le){const at=be.root;Le&&(at.scope=`language:${Le}`),this.add(at)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function x($){return $?typeof $=="string"?$:$.source:null}function m($){return E("(?=",$,")")}function C($){return E("(?:",$,")*")}function _($){return E("(?:",$,")?")}function E(...$){return $.map(Le=>x(Le)).join("")}function S($){const be=$[$.length-1];return typeof be=="object"&&be.constructor===Object?($.splice($.length-1,1),be):{}}function I(...$){return"("+(S($).capture?"":"?:")+$.map(at=>x(at)).join("|")+")"}function M($){return new RegExp($.toString()+"|").exec("").length-1}function O($,be){const Le=$&&$.exec(be);return Le&&Le.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function H($,{joinWith:be}){let Le=0;return $.map(at=>{Le+=1;const St=Le;let ke=x(at),He="";for(;ke.length>0;){const re=R.exec(ke);if(!re){He+=ke;break}He+=ke.substring(0,re.index),ke=ke.substring(re.index+re[0].length),re[0][0]==="\\"&&re[1]?He+="\\"+String(Number(re[1])+St):(He+=re[0],re[0]==="("&&Le++)}return He}).map(at=>`(${at})`).join(be)}const G=/\b\B/,q="[a-zA-Z]\\w*",te="[a-zA-Z_]\\w*",ye="\\b\\d+(\\.\\d+)?",Ne="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ge="\\b(0b[01]+)",Ae="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",dt=($={})=>{const be=/^#![ ]*\//;return $.binary&&($.begin=E(be,/.*\b/,$.binary,/\b.*/)),i({scope:"meta",begin:be,end:/$/,relevance:0,"on:begin":(Le,at)=>{Le.index!==0&&at.ignoreMatch()}},$)},he={begin:"\\\\[\\s\\S]",relevance:0},We={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[he]},de={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[he]},je={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/},fe=function($,be,Le={}){const at=i({scope:"comment",begin:$,end:be,contains:[]},Le);at.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 St=I("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 at.contains.push({begin:E(/[ ]+/,"(",St,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),at},Ft=fe("//","$"),Te=fe("/\\*","\\*/"),Be=fe("#","$"),Je={scope:"number",begin:ye,relevance:0},It={scope:"number",begin:Ne,relevance:0},ue={scope:"number",begin:ge,relevance:0},xe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[he,{begin:/\[/,end:/\]/,relevance:0,contains:[he]}]},Fe={scope:"title",begin:q,relevance:0},Ye={scope:"title",begin:te,relevance:0},nt={begin:"\\.\\s*"+te,relevance:0};var ci=Object.freeze({__proto__:null,APOS_STRING_MODE:We,BACKSLASH_ESCAPE:he,BINARY_NUMBER_MODE:ue,BINARY_NUMBER_RE:ge,COMMENT:fe,C_BLOCK_COMMENT_MODE:Te,C_LINE_COMMENT_MODE:Ft,C_NUMBER_MODE:It,C_NUMBER_RE:Ne,END_SAME_AS_BEGIN:function($){return Object.assign($,{"on:begin":(be,Le)=>{Le.data._beginMatch=be[1]},"on:end":(be,Le)=>{Le.data._beginMatch!==be[1]&&Le.ignoreMatch()}})},HASH_COMMENT_MODE:Be,IDENT_RE:q,MATCH_NOTHING_RE:G,METHOD_GUARD:nt,NUMBER_MODE:Je,NUMBER_RE:ye,PHRASAL_WORDS_MODE:je,QUOTE_STRING_MODE:de,REGEXP_MODE:xe,RE_STARTERS_RE:Ae,SHEBANG:dt,TITLE_MODE:Fe,UNDERSCORE_IDENT_RE:te,UNDERSCORE_TITLE_MODE:Ye});function Rt($,be){$.input[$.index-1]==="."&&be.ignoreMatch()}function Ke($,be){$.className!==void 0&&($.scope=$.className,delete $.className)}function vt($,be){be&&$.beginKeywords&&($.begin="\\b("+$.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",$.__beforeBegin=Rt,$.keywords=$.keywords||$.beginKeywords,delete $.beginKeywords,$.relevance===void 0&&($.relevance=0))}function Ze($,be){Array.isArray($.illegal)&&($.illegal=I(...$.illegal))}function ee($,be){if($.match){if($.begin||$.end)throw new Error("begin & end are not supported with match");$.begin=$.match,delete $.match}}function ht($,be){$.relevance===void 0&&($.relevance=1)}const qe=($,be)=>{if(!$.beforeMatch)return;if($.starts)throw new Error("beforeMatch cannot be used with starts");const Le=Object.assign({},$);Object.keys($).forEach(at=>{delete $[at]}),$.keywords=Le.keywords,$.begin=E(Le.beforeMatch,m(Le.begin)),$.starts={relevance:0,contains:[Object.assign(Le,{endsParent:!0})]},$.relevance=0,delete Le.beforeMatch},Ue=["of","and","for","in","not","or","if","then","parent","list","value"],Z="keyword";function Se($,be,Le=Z){const at=Object.create(null);return typeof $=="string"?St(Le,$.split(" ")):Array.isArray($)?St(Le,$):Object.keys($).forEach(function(ke){Object.assign(at,Se($[ke],be,ke))}),at;function St(ke,He){be&&(He=He.map(re=>re.toLowerCase())),He.forEach(function(re){const X=re.split("|");at[X[0]]=[ke,Oe(X[0],X[1])]})}}function Oe($,be){return be?Number(be):$t($)?0:1}function $t($){return Ue.includes($.toLowerCase())}const Ht={},zt=$=>{console.error($)},Ut=($,...be)=>{console.log(`WARN: ${$}`,...be)},et=($,be)=>{Ht[`${$}/${be}`]||(console.log(`Deprecated as of ${$}. ${be}`),Ht[`${$}/${be}`]=!0)},rt=new Error;function w($,be,{key:Le}){let at=0;const St=$[Le],ke={},He={};for(let re=1;re<=be.length;re++)He[re+at]=St[re],ke[re+at]=!0,at+=M(be[re-1]);$[Le]=He,$[Le]._emit=ke,$[Le]._multi=!0}function V($){if(Array.isArray($.begin)){if($.skip||$.excludeBegin||$.returnBegin)throw zt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),rt;if(typeof $.beginScope!="object"||$.beginScope===null)throw zt("beginScope must be object"),rt;w($,$.begin,{key:"beginScope"}),$.begin=H($.begin,{joinWith:""})}}function Y($){if(Array.isArray($.end)){if($.skip||$.excludeEnd||$.returnEnd)throw zt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),rt;if(typeof $.endScope!="object"||$.endScope===null)throw zt("endScope must be object"),rt;w($,$.end,{key:"endScope"}),$.end=H($.end,{joinWith:""})}}function oe($){$.scope&&typeof $.scope=="object"&&$.scope!==null&&($.beginScope=$.scope,delete $.scope)}function Ee($){oe($),typeof $.beginScope=="string"&&($.beginScope={_wrap:$.beginScope}),typeof $.endScope=="string"&&($.endScope={_wrap:$.endScope}),V($),Y($)}function lt($){function be(He,re){return new RegExp(x(He),"m"+($.case_insensitive?"i":"")+($.unicodeRegex?"u":"")+(re?"g":""))}class Le{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(re,X){X.position=this.position++,this.matchIndexes[this.matchAt]=X,this.regexes.push([X,re]),this.matchAt+=M(re)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const re=this.regexes.map(X=>X[1]);this.matcherRe=be(H(re,{joinWith:"|"}),!0),this.lastIndex=0}exec(re){this.matcherRe.lastIndex=this.lastIndex;const X=this.matcherRe.exec(re);if(!X)return null;const Ve=X.findIndex((Ce,Lt)=>Lt>0&&Ce!==void 0),Me=this.matchIndexes[Ve];return X.splice(0,Ve),Object.assign(X,Me)}}class at{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(re){if(this.multiRegexes[re])return this.multiRegexes[re];const X=new Le;return this.rules.slice(re).forEach(([Ve,Me])=>X.addRule(Ve,Me)),X.compile(),this.multiRegexes[re]=X,X}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(re,X){this.rules.push([re,X]),X.type==="begin"&&this.count++}exec(re){const X=this.getMatcher(this.regexIndex);X.lastIndex=this.lastIndex;let Ve=X.exec(re);if(this.resumingScanAtSamePosition()&&!(Ve&&Ve.index===this.lastIndex)){const Me=this.getMatcher(0);Me.lastIndex=this.lastIndex+1,Ve=Me.exec(re)}return Ve&&(this.regexIndex+=Ve.position+1,this.regexIndex===this.count&&this.considerAll()),Ve}}function St(He){const re=new at;return He.contains.forEach(X=>re.addRule(X.begin,{rule:X,type:"begin"})),He.terminatorEnd&&re.addRule(He.terminatorEnd,{type:"end"}),He.illegal&&re.addRule(He.illegal,{type:"illegal"}),re}function ke(He,re){const X=He;if(He.isCompiled)return X;[Ke,ee,Ee,qe].forEach(Me=>Me(He,re)),$.compilerExtensions.forEach(Me=>Me(He,re)),He.__beforeBegin=null,[vt,Ze,ht].forEach(Me=>Me(He,re)),He.isCompiled=!0;let Ve=null;return typeof He.keywords=="object"&&He.keywords.$pattern&&(He.keywords=Object.assign({},He.keywords),Ve=He.keywords.$pattern,delete He.keywords.$pattern),Ve=Ve||/\w+/,He.keywords&&(He.keywords=Se(He.keywords,$.case_insensitive)),X.keywordPatternRe=be(Ve,!0),re&&(He.begin||(He.begin=/\B|\b/),X.beginRe=be(X.begin),!He.end&&!He.endsWithParent&&(He.end=/\B|\b/),He.end&&(X.endRe=be(X.end)),X.terminatorEnd=x(X.end)||"",He.endsWithParent&&re.terminatorEnd&&(X.terminatorEnd+=(He.end?"|":"")+re.terminatorEnd)),He.illegal&&(X.illegalRe=be(He.illegal)),He.contains||(He.contains=[]),He.contains=[].concat(...He.contains.map(function(Me){return Xe(Me==="self"?He:Me)})),He.contains.forEach(function(Me){ke(Me,X)}),He.starts&&ke(He.starts,re),X.matcher=St(X),X}if($.compilerExtensions||($.compilerExtensions=[]),$.contains&&$.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return $.classNameAliases=i($.classNameAliases||{}),ke($)}function j($){return $?$.endsWithParent||j($.starts):!1}function Xe($){return $.variants&&!$.cachedVariants&&($.cachedVariants=$.variants.map(function(be){return i($,{variants:null},be)})),$.cachedVariants?$.cachedVariants:j($)?i($,{starts:$.starts?i($.starts):null}):Object.isFrozen($)?i($):$}var Ct="11.11.1";class ce extends Error{constructor(be,Le){super(be),this.name="HTMLInjectionError",this.html=Le}}const Qe=t,pt=i,At=Symbol("nomatch"),jt=7,we=function($){const be=Object.create(null),Le=Object.create(null),at=[];let St=!0;const ke="Could not find the language '{}', did you forget to load/include a language module?",He={disableAutodetect:!0,name:"Plain text",contains:[]};let re={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function X(W){return re.noHighlightRe.test(W)}function Ve(W){let Q=W.className+" ";Q+=W.parentNode?W.parentNode.className:"";const ae=re.languageDetectRe.exec(Q);if(ae){const me=Re(ae[1]);return me||(Ut(ke.replace("{}",ae[1])),Ut("Falling back to no-highlight mode for this block.",W)),me?ae[1]:"no-highlight"}return Q.split(/\s+/).find(me=>X(me)||Re(me))}function Me(W,Q,ae){let me="",Ie="";typeof Q=="object"?(me=W,ae=Q.ignoreIllegals,Ie=Q.language):(et("10.7.0","highlight(lang, code, ...args) has been deprecated."),et("10.7.0",`Please use highlight(code, options) instead.
79
+ `);d=x.pop()??"";for(const m of x){if(!m.startsWith("data: "))continue;const C=m.slice(6).trim();if(C==="[DONE]")return;try{const _=JSON.parse(C);if(_.error)throw new Error(_.error);if(_.type==="tool_call"||_.type==="tool_result"){i==null||i({type:_.type,name:_.name??"",args:_.args,content:_.content});continue}_.token&&e(_.token)}catch(_){if(_ instanceof SyntaxError)continue;throw _}}}}finally{a.releaseLock()}}function ob(){return oi("GET","/she/broker/status")}function OG(){return oi("GET","/she/broker/local/check")}function HG(){return oi("GET","/she/broker/ip-addresses")}function Ev(){return oi("GET","/she/broker/config")}function zG(r=500){return oi("GET",`/she/broker/logs?limit=${r}`)}function S7(r){return oi("PUT","/she/broker/config",r)}function WG(r,e){return oi("PUT","/she/broker/config/raw",{content:r,checksum:e})}function jG(){return oi("GET","/she/broker/config/backups")}function VG(r){return oi("POST","/she/broker/config/restore",{backup:r})}function rb(){return oi("POST","/she/broker/reload")}function $G(){return oi("POST","/she/broker/restart")}function qG(){return oi("POST","/she/broker/wizard/deactivate")}function UG(){return oi("POST","/she/broker/wizard/reinit")}function GG(){return oi("GET","/she/broker/wizard/diagnose")}function KG(r){return oi("GET",`/she/broker/passwd?file=${encodeURIComponent(r)}`)}function hD(r,e,t){return oi("POST","/she/broker/passwd",{file:r,username:e,password:t})}function ZG(r,e){return oi("DELETE",`/she/broker/passwd/${encodeURIComponent(e)}`,{file:r})}function YG(r){return oi("GET",`/she/broker/acl?file=${encodeURIComponent(r)}`)}function XG(r,e){return oi("PUT","/she/broker/acl",{file:r,content:e})}function QG(){return oi("GET","/she/broker/users")}function JG(r,e){return oi("POST","/she/broker/users",{username:r,password:e})}function eK(r){return oi("DELETE",`/she/broker/users/${encodeURIComponent(r)}`)}function tK(r,e){return oi("PUT",`/she/broker/users/${encodeURIComponent(r)}/password`,{password:e})}function iK(r,e){return oi("POST",`/she/broker/users/${encodeURIComponent(r)}/roles`,{rolename:e})}function nK(r,e){return oi("DELETE",`/she/broker/users/${encodeURIComponent(r)}/roles/${encodeURIComponent(e)}`)}function k7(){return oi("GET","/she/broker/roles")}function sK(r){return oi("POST","/she/broker/roles",{rolename:r})}function oK(r){return oi("DELETE",`/she/broker/roles/${encodeURIComponent(r)}`)}function rK(r,e){return oi("POST",`/she/broker/roles/${encodeURIComponent(r)}/acls`,e)}function aK(r,e,t){return oi("DELETE",`/she/broker/roles/${encodeURIComponent(r)}/acls`,{acltype:e,topic:t})}function lK(){return oi("GET","/she/broker/groups")}function cK(r){return oi("POST","/she/broker/groups",{groupname:r})}function dK(r){return oi("DELETE",`/she/broker/groups/${encodeURIComponent(r)}`)}function fD(r,e){return oi("POST",`/she/broker/groups/${encodeURIComponent(r)}/clients`,{username:e})}function pD(r,e){return oi("DELETE",`/she/broker/groups/${encodeURIComponent(r)}/clients/${encodeURIComponent(e)}`)}function uK(r,e){return oi("POST",`/she/broker/groups/${encodeURIComponent(r)}/roles`,{rolename:e})}function hK(r,e){return oi("DELETE",`/she/broker/groups/${encodeURIComponent(r)}/roles/${encodeURIComponent(e)}`)}function fK(){return oi("GET","/she/broker/acl-defaults")}function pK(r){return oi("PUT","/she/broker/acl-defaults",{acls:r})}function gK(r){return oi("GET",`/she/broker/acl-check?${new URLSearchParams({topic:r})}`)}function vK(){return oi("GET","/she/broker/anonymous-group")}function xK(r){return oi("PUT","/she/broker/anonymous-group",{groupname:r})}function mK(){return oi("GET","/she/broker/ca/server")}function _K(r){return oi("POST","/she/broker/ca/server/generate",r)}function bK(r){return oi("POST","/she/broker/ca/server/csr",r)}function mC(r){return oi("POST","/she/broker/ca/server/import",r)}function CK(){return oi("GET","/she/broker/ca/trusted")}function yK(r){return oi("POST","/she/broker/ca/trusted",{pem:r})}function wK(r){return oi("DELETE",`/she/broker/ca/trusted/${encodeURIComponent(r)}`)}function EK(r){return oi("GET",`/she/broker/fs/complete?path=${encodeURIComponent(r)}`)}function SK(r){return oi("POST","/she/broker/ca/server/pathlink",r)}function kK(r){return oi("POST","/she/broker/ca/trusted/addpath",{path:r})}function D7(r=!1){return oi("GET","/she/services/instances"+(r?"?refresh=1":""))}function DK(r){return oi("POST",`/she/services/instances/${encodeURIComponent(r)}/restart`)}function AK(r,e){return oi("POST",`/she/services/instances/${encodeURIComponent(r)}/loglevel`,{level:e})}function BK(r){return oi("GET",`/she/services/instances/${encodeURIComponent(r)}/retained`)}function FK(r,e=!0){return oi("DELETE",`/she/services/instances/${encodeURIComponent(r)}/retained`,{discovery:e})}const mS="-";function LK(r,e,t){return oi("POST",`${Ba(r,e,mS)}/migrate`,{name:t})}function IK(r,e,t={}){return oi("POST",`/she/services/hosts/${encodeURIComponent(r)}/adapters/${encodeURIComponent(e)}/discover`,t)}const Nd=r=>`/she/services/hosts/${encodeURIComponent(r)}`,Ba=(r,e,t)=>`${Nd(r)}/units/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,Sv=(r,e)=>`${Nd(r)}/adapters/${encodeURIComponent(e)}`;function pa(r=!1){return oi("GET",r?"/she/services/hosts?refresh=1":"/she/services/hosts")}function PK(r,e,t=!1){return oi("GET",`${Sv(r,e)}/schema${t?"?refresh=1":""}`)}function TK(r,e,t,i,n="own"){return oi("POST",`${Sv(r,e)}/install`,{instance:t,env:i,brokerMode:n})}function gD(r,e,t=!1){return oi("POST",`${Sv(r,e)}/update`,{force:t})}function vD(r,e,t,i){return oi("POST",`${Ba(r,e,t)}/${i}`)}function MK(r,e){return oi("POST",`${Nd(r)}/adapters/${encodeURIComponent(e)}/uninstall`)}function RK(r,e,t){return oi("DELETE",Ba(r,e,t))}function NK(r,e,t,i=200){return oi("GET",`${Ba(r,e,t)}/logs?n=${i}`)}function xD(r,e,t){return oi("POST",`${Ba(r,e,t)}/logs/follow`)}function OK(r,e,t){return oi("DELETE",`${Ba(r,e,t)}/logs/follow`)}function HK(r,e,t){return oi("GET",`${Ba(r,e,t)}/env`)}function zK(r,e,t,i,n,s,a={}){return oi("PUT",`${Ba(r,e,t)}/env`,{env:i,restart:n,brokerMode:s,rotate:a.rotate===!0})}function WK(){return oi("GET","/she/services/ssh/pubkey")}function jK(){return oi("POST","/she/services/ssh/keygen")}function VK(r){return oi("POST",`${Nd(r)}/test`)}function $K(r,e="lts"){return oi("POST",`${Nd(r)}/node/update`,{channel:e})}function qK(r=!1){return oi("GET",`/she/services/node/releases${r?"?refresh=1":""}`)}function UK(r){return oi("POST",`${Nd(r)}/instances/restart-all`)}function GK(r){return oi("POST","/she/services/setup/token",{origin:r})}function KK(r){return oi("GET",`/she/services/setup/token/${encodeURIComponent(r)}`)}function mD(r){return oi("POST","/she/services/ssh/test",r)}function _D(r){return oi("POST",`${Nd(r)}/helper/deploy`)}function ZK(r,e,t=!1){return oi("POST",`${Nd(r)}/helper/remove`,{mode:e,force:t})}function YK(r,e,t){return oi("GET",`${Ba(r,e,t)}/files`)}function XK(r,e,t,i){return oi("GET",`${Ba(r,e,t)}/file?path=${encodeURIComponent(i)}`)}function QK(r,e,t,i,n,s=!1){return oi("PUT",`${Ba(r,e,t)}/file`,{path:i,content:n,restart:s})}function JK(r,e,t,i,n){return oi("POST",`${Ba(r,e,t)}/file/create`,{option:i,path:n})}function eZ(r,e,t){return oi("GET",`${Sv(r,e)}/asset?path=${encodeURIComponent(t)}`)}function tZ(r=!1){return oi("GET",r?"/she/services/catalog?refresh=1":"/she/services/catalog")}function iZ(r,e){return oi("POST",`${Sv(r,e)}/install-package`)}const nZ=2e3,$x=[],sZ=500,qx=[];function A7(){return $x.slice()}function oZ(){return qx.slice()}let nc=null;const u_=new Set,Bf=new Map;let jf=null,Ux=null;function a2(){return Ux||(Ux=fetch("/she/logs/history").then(r=>r.ok?r.json():[]).catch(()=>[])),Ux}function Hp(){let r=u_.size;for(const e of Bf.values())r+=e.size;return r}function rZ(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function ab(){if(nc)return;a2();const r=rZ(),e=new WebSocket(r);nc=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};$x.length>=nZ&&$x.shift(),$x.push(s),u_.forEach(a=>a(s))}if(i.type==="brokerLog"){const s={level:i.level,msg:i.msg,ts:i.ts};qx.length>=sZ&&qx.shift(),qx.push(s)}const n=Bf.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{nc===e&&(nc=null,Ux=null),Hp()>0&&(jf=setTimeout(ab,3e3))},e.onerror=()=>{e.close()}}function aZ(){nc||Hp()===0||(jf&&(clearTimeout(jf),jf=null),ab())}function B7(){jf&&clearTimeout(jf),nc==null||nc.close(),nc=null}function l2(r){return u_.add(r),Hp()===1&&ab(),()=>{u_.delete(r),Hp()===0&&B7()}}function Xo(r,e){return Bf.has(r)||Bf.set(r,new Set),Bf.get(r).add(e),Hp()===1&&ab(),()=>{var t;(t=Bf.get(r))==null||t.delete(e),Hp()===0&&B7()}}function lb(r){const e=new Date(r);return e.toTimeString().slice(0,8)+"."+String(e.getMilliseconds()).padStart(3,"0")}const _C=/([^\s():,]+\.js)(?::(\d+)(?::(\d+))?)?/g;function F7(r,e){const t=[];let i=0;_C.lastIndex=0;for(let n=_C.exec(r);n!==null;n=_C.exec(r)){const s=e(n[1]);s&&(n.index>i&&t.push({text:r.slice(i,n.index)}),t.push({text:n[0],link:{path:s,line:n[2]?Number(n[2]):void 0,column:n[3]?Number(n[3]):void 0}}),i=n.index+n[0].length)}return i<r.length&&t.push({text:r.slice(i)}),t}function L7(r){return e=>{const t=e.replace(/\\/g,"/");if(r.has(t))return t;for(const i of r)if(t.endsWith("/"+i))return i;return null}}function c2(r,e=new Set){for(const t of r)t.type==="file"?e.add(t.path):t.children&&c2(t.children,e);return e}var lZ=k('<button class="cancel svelte-1eh8v5n">Cancel</button>'),cZ=k('<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 kr(r,e){ls(e,!0);let t=A(!1),i=A(""),n=A("Confirm"),s=A(!1),a=A(!1),l=null;function d(E,S){return p(i,E,!0),p(n,(S==null?void 0:S.confirm)??(S!=null&&S.alert?"OK":"Confirm"),!0),p(s,(S==null?void 0:S.danger)??!1,!0),p(a,(S==null?void 0:S.alert)??!1,!0),p(t,!0),new Promise(I=>l=I)}function u(E){p(t,!1),l==null||l(E),l=null}function g(E){o(t)&&(E.key==="Escape"&&u(!1),E.key==="Enter"&&u(!0))}var x={show:d},m=ks();ws("keydown",wa,g);var C=Dt(m);{var _=E=>{var S=cZ(),I=Dt(S),M=h(I,2),O=f(M),R=f(O),H=h(O,2),G=f(H);{var q=ge=>{var Ae=lZ();z("click",Ae,()=>u(!1)),y(ge,Ae)};T(G,ge=>{o(a)||ge(q)})}var te=h(G,2);let ye;var Ne=f(te);P(()=>{B(R,o(i)),ye=Xt(te,1,"svelte-1eh8v5n",null,ye,{danger:o(s)}),B(Ne,o(n))}),z("click",I,()=>u(!1)),z("click",te,()=>u(!0)),y(E,S)};T(C,E=>{o(t)&&E(_)})}return y(r,m),cs(x)}ms(["click"]);var dZ=k('<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 d2(r,e){ls(e,!0);let t=A(!1),i=A(""),n=A(""),s=A("OK"),a=A(""),l=null,d=A(void 0);function u(I,M){return p(i,I,!0),p(n,(M==null?void 0:M.placeholder)??"",!0),p(s,(M==null?void 0:M.confirm)??"OK",!0),p(a,(M==null?void 0:M.initial)??"",!0),p(t,!0),setTimeout(()=>{if(o(d)){o(d).focus();const O=o(d).value.length;o(d).setSelectionRange(O,O)}},0),new Promise(O=>l=O)}function g(){const I=o(a).trim();I&&(p(t,!1),l==null||l(I),l=null,p(a,""))}function x(){p(t,!1),l==null||l(null),l=null,p(a,"")}function m(I){o(t)&&I.key==="Escape"&&(I.stopPropagation(),x())}var C={show:u},_=ks();ws("keydown",wa,m);var E=Dt(_);{var S=I=>{var M=dZ(),O=Dt(M),R=h(O,2),H=f(R),G=f(H),q=h(H,2);ts(q,Ae=>p(d,Ae),()=>o(d));var te=h(q,2),ye=f(te),Ne=h(ye,2),ge=f(Ne);P(Ae=>{B(G,o(i)),xi(q,"placeholder",o(n)),Ne.disabled=Ae,B(ge,o(s))},[()=>!o(a).trim()]),z("click",O,x),z("keydown",q,Ae=>{Ae.key==="Enter"&&(Ae.preventDefault(),g())}),ui(q,()=>o(a),Ae=>p(a,Ae)),z("click",ye,x),z("click",Ne,g),y(I,M)};T(E,I=>{o(t)&&I(S)})}return y(r,_),cs(C)}ms(["click","keydown"]);function u2(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var bC,bD;function uZ(){if(bD)return bC;bD=1;function r($){return $ instanceof Map?$.clear=$.delete=$.set=function(){throw new Error("map is read-only")}:$ instanceof Set&&($.add=$.clear=$.delete=function(){throw new Error("set is read-only")}),Object.freeze($),Object.getOwnPropertyNames($).forEach(be=>{const Le=$[be],at=typeof Le;(at==="object"||at==="function")&&!Object.isFrozen(Le)&&r(Le)}),$}class e{constructor(be){be.data===void 0&&(be.data={}),this.data=be.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i($,...be){const Le=Object.create(null);for(const at in $)Le[at]=$[at];return be.forEach(function(at){for(const St in at)Le[St]=at[St]}),Le}const n="</span>",s=$=>!!$.scope,a=($,{prefix:be})=>{if($.startsWith("language:"))return $.replace("language:","language-");if($.includes(".")){const Le=$.split(".");return[`${be}${Le.shift()}`,...Le.map((at,St)=>`${at}${"_".repeat(St+1)}`)].join(" ")}return`${be}${$}`};class l{constructor(be,Le){this.buffer="",this.classPrefix=Le.classPrefix,be.walk(this)}addText(be){this.buffer+=t(be)}openNode(be){if(!s(be))return;const Le=a(be.scope,{prefix:this.classPrefix});this.span(Le)}closeNode(be){s(be)&&(this.buffer+=n)}value(){return this.buffer}span(be){this.buffer+=`<span class="${be}">`}}const d=($={})=>{const be={children:[]};return Object.assign(be,$),be};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(be){this.top.children.push(be)}openNode(be){const Le=d({scope:be});this.add(Le),this.stack.push(Le)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(be){return this.constructor._walk(be,this.rootNode)}static _walk(be,Le){return typeof Le=="string"?be.addText(Le):Le.children&&(be.openNode(Le),Le.children.forEach(at=>this._walk(be,at)),be.closeNode(Le)),be}static _collapse(be){typeof be!="string"&&be.children&&(be.children.every(Le=>typeof Le=="string")?be.children=[be.children.join("")]:be.children.forEach(Le=>{u._collapse(Le)}))}}class g extends u{constructor(be){super(),this.options=be}addText(be){be!==""&&this.add(be)}startScope(be){this.openNode(be)}endScope(){this.closeNode()}__addSublanguage(be,Le){const at=be.root;Le&&(at.scope=`language:${Le}`),this.add(at)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function x($){return $?typeof $=="string"?$:$.source:null}function m($){return E("(?=",$,")")}function C($){return E("(?:",$,")*")}function _($){return E("(?:",$,")?")}function E(...$){return $.map(Le=>x(Le)).join("")}function S($){const be=$[$.length-1];return typeof be=="object"&&be.constructor===Object?($.splice($.length-1,1),be):{}}function I(...$){return"("+(S($).capture?"":"?:")+$.map(at=>x(at)).join("|")+")"}function M($){return new RegExp($.toString()+"|").exec("").length-1}function O($,be){const Le=$&&$.exec(be);return Le&&Le.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function H($,{joinWith:be}){let Le=0;return $.map(at=>{Le+=1;const St=Le;let ke=x(at),He="";for(;ke.length>0;){const re=R.exec(ke);if(!re){He+=ke;break}He+=ke.substring(0,re.index),ke=ke.substring(re.index+re[0].length),re[0][0]==="\\"&&re[1]?He+="\\"+String(Number(re[1])+St):(He+=re[0],re[0]==="("&&Le++)}return He}).map(at=>`(${at})`).join(be)}const G=/\b\B/,q="[a-zA-Z]\\w*",te="[a-zA-Z_]\\w*",ye="\\b\\d+(\\.\\d+)?",Ne="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ge="\\b(0b[01]+)",Ae="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",dt=($={})=>{const be=/^#![ ]*\//;return $.binary&&($.begin=E(be,/.*\b/,$.binary,/\b.*/)),i({scope:"meta",begin:be,end:/$/,relevance:0,"on:begin":(Le,at)=>{Le.index!==0&&at.ignoreMatch()}},$)},he={begin:"\\\\[\\s\\S]",relevance:0},We={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[he]},de={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[he]},je={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/},fe=function($,be,Le={}){const at=i({scope:"comment",begin:$,end:be,contains:[]},Le);at.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 St=I("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 at.contains.push({begin:E(/[ ]+/,"(",St,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),at},Ft=fe("//","$"),Te=fe("/\\*","\\*/"),Be=fe("#","$"),Je={scope:"number",begin:ye,relevance:0},It={scope:"number",begin:Ne,relevance:0},ue={scope:"number",begin:ge,relevance:0},xe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[he,{begin:/\[/,end:/\]/,relevance:0,contains:[he]}]},Fe={scope:"title",begin:q,relevance:0},Ye={scope:"title",begin:te,relevance:0},nt={begin:"\\.\\s*"+te,relevance:0};var ci=Object.freeze({__proto__:null,APOS_STRING_MODE:We,BACKSLASH_ESCAPE:he,BINARY_NUMBER_MODE:ue,BINARY_NUMBER_RE:ge,COMMENT:fe,C_BLOCK_COMMENT_MODE:Te,C_LINE_COMMENT_MODE:Ft,C_NUMBER_MODE:It,C_NUMBER_RE:Ne,END_SAME_AS_BEGIN:function($){return Object.assign($,{"on:begin":(be,Le)=>{Le.data._beginMatch=be[1]},"on:end":(be,Le)=>{Le.data._beginMatch!==be[1]&&Le.ignoreMatch()}})},HASH_COMMENT_MODE:Be,IDENT_RE:q,MATCH_NOTHING_RE:G,METHOD_GUARD:nt,NUMBER_MODE:Je,NUMBER_RE:ye,PHRASAL_WORDS_MODE:je,QUOTE_STRING_MODE:de,REGEXP_MODE:xe,RE_STARTERS_RE:Ae,SHEBANG:dt,TITLE_MODE:Fe,UNDERSCORE_IDENT_RE:te,UNDERSCORE_TITLE_MODE:Ye});function Rt($,be){$.input[$.index-1]==="."&&be.ignoreMatch()}function Ke($,be){$.className!==void 0&&($.scope=$.className,delete $.className)}function vt($,be){be&&$.beginKeywords&&($.begin="\\b("+$.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",$.__beforeBegin=Rt,$.keywords=$.keywords||$.beginKeywords,delete $.beginKeywords,$.relevance===void 0&&($.relevance=0))}function Ze($,be){Array.isArray($.illegal)&&($.illegal=I(...$.illegal))}function ee($,be){if($.match){if($.begin||$.end)throw new Error("begin & end are not supported with match");$.begin=$.match,delete $.match}}function ht($,be){$.relevance===void 0&&($.relevance=1)}const qe=($,be)=>{if(!$.beforeMatch)return;if($.starts)throw new Error("beforeMatch cannot be used with starts");const Le=Object.assign({},$);Object.keys($).forEach(at=>{delete $[at]}),$.keywords=Le.keywords,$.begin=E(Le.beforeMatch,m(Le.begin)),$.starts={relevance:0,contains:[Object.assign(Le,{endsParent:!0})]},$.relevance=0,delete Le.beforeMatch},Ue=["of","and","for","in","not","or","if","then","parent","list","value"],Z="keyword";function Se($,be,Le=Z){const at=Object.create(null);return typeof $=="string"?St(Le,$.split(" ")):Array.isArray($)?St(Le,$):Object.keys($).forEach(function(ke){Object.assign(at,Se($[ke],be,ke))}),at;function St(ke,He){be&&(He=He.map(re=>re.toLowerCase())),He.forEach(function(re){const X=re.split("|");at[X[0]]=[ke,Oe(X[0],X[1])]})}}function Oe($,be){return be?Number(be):$t($)?0:1}function $t($){return Ue.includes($.toLowerCase())}const Ht={},zt=$=>{console.error($)},Ut=($,...be)=>{console.log(`WARN: ${$}`,...be)},et=($,be)=>{Ht[`${$}/${be}`]||(console.log(`Deprecated as of ${$}. ${be}`),Ht[`${$}/${be}`]=!0)},rt=new Error;function w($,be,{key:Le}){let at=0;const St=$[Le],ke={},He={};for(let re=1;re<=be.length;re++)He[re+at]=St[re],ke[re+at]=!0,at+=M(be[re-1]);$[Le]=He,$[Le]._emit=ke,$[Le]._multi=!0}function V($){if(Array.isArray($.begin)){if($.skip||$.excludeBegin||$.returnBegin)throw zt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),rt;if(typeof $.beginScope!="object"||$.beginScope===null)throw zt("beginScope must be object"),rt;w($,$.begin,{key:"beginScope"}),$.begin=H($.begin,{joinWith:""})}}function Y($){if(Array.isArray($.end)){if($.skip||$.excludeEnd||$.returnEnd)throw zt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),rt;if(typeof $.endScope!="object"||$.endScope===null)throw zt("endScope must be object"),rt;w($,$.end,{key:"endScope"}),$.end=H($.end,{joinWith:""})}}function oe($){$.scope&&typeof $.scope=="object"&&$.scope!==null&&($.beginScope=$.scope,delete $.scope)}function Ee($){oe($),typeof $.beginScope=="string"&&($.beginScope={_wrap:$.beginScope}),typeof $.endScope=="string"&&($.endScope={_wrap:$.endScope}),V($),Y($)}function lt($){function be(He,re){return new RegExp(x(He),"m"+($.case_insensitive?"i":"")+($.unicodeRegex?"u":"")+(re?"g":""))}class Le{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(re,X){X.position=this.position++,this.matchIndexes[this.matchAt]=X,this.regexes.push([X,re]),this.matchAt+=M(re)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const re=this.regexes.map(X=>X[1]);this.matcherRe=be(H(re,{joinWith:"|"}),!0),this.lastIndex=0}exec(re){this.matcherRe.lastIndex=this.lastIndex;const X=this.matcherRe.exec(re);if(!X)return null;const Ve=X.findIndex((Ce,Lt)=>Lt>0&&Ce!==void 0),Me=this.matchIndexes[Ve];return X.splice(0,Ve),Object.assign(X,Me)}}class at{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(re){if(this.multiRegexes[re])return this.multiRegexes[re];const X=new Le;return this.rules.slice(re).forEach(([Ve,Me])=>X.addRule(Ve,Me)),X.compile(),this.multiRegexes[re]=X,X}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(re,X){this.rules.push([re,X]),X.type==="begin"&&this.count++}exec(re){const X=this.getMatcher(this.regexIndex);X.lastIndex=this.lastIndex;let Ve=X.exec(re);if(this.resumingScanAtSamePosition()&&!(Ve&&Ve.index===this.lastIndex)){const Me=this.getMatcher(0);Me.lastIndex=this.lastIndex+1,Ve=Me.exec(re)}return Ve&&(this.regexIndex+=Ve.position+1,this.regexIndex===this.count&&this.considerAll()),Ve}}function St(He){const re=new at;return He.contains.forEach(X=>re.addRule(X.begin,{rule:X,type:"begin"})),He.terminatorEnd&&re.addRule(He.terminatorEnd,{type:"end"}),He.illegal&&re.addRule(He.illegal,{type:"illegal"}),re}function ke(He,re){const X=He;if(He.isCompiled)return X;[Ke,ee,Ee,qe].forEach(Me=>Me(He,re)),$.compilerExtensions.forEach(Me=>Me(He,re)),He.__beforeBegin=null,[vt,Ze,ht].forEach(Me=>Me(He,re)),He.isCompiled=!0;let Ve=null;return typeof He.keywords=="object"&&He.keywords.$pattern&&(He.keywords=Object.assign({},He.keywords),Ve=He.keywords.$pattern,delete He.keywords.$pattern),Ve=Ve||/\w+/,He.keywords&&(He.keywords=Se(He.keywords,$.case_insensitive)),X.keywordPatternRe=be(Ve,!0),re&&(He.begin||(He.begin=/\B|\b/),X.beginRe=be(X.begin),!He.end&&!He.endsWithParent&&(He.end=/\B|\b/),He.end&&(X.endRe=be(X.end)),X.terminatorEnd=x(X.end)||"",He.endsWithParent&&re.terminatorEnd&&(X.terminatorEnd+=(He.end?"|":"")+re.terminatorEnd)),He.illegal&&(X.illegalRe=be(He.illegal)),He.contains||(He.contains=[]),He.contains=[].concat(...He.contains.map(function(Me){return Xe(Me==="self"?He:Me)})),He.contains.forEach(function(Me){ke(Me,X)}),He.starts&&ke(He.starts,re),X.matcher=St(X),X}if($.compilerExtensions||($.compilerExtensions=[]),$.contains&&$.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return $.classNameAliases=i($.classNameAliases||{}),ke($)}function j($){return $?$.endsWithParent||j($.starts):!1}function Xe($){return $.variants&&!$.cachedVariants&&($.cachedVariants=$.variants.map(function(be){return i($,{variants:null},be)})),$.cachedVariants?$.cachedVariants:j($)?i($,{starts:$.starts?i($.starts):null}):Object.isFrozen($)?i($):$}var Ct="11.11.1";class ce extends Error{constructor(be,Le){super(be),this.name="HTMLInjectionError",this.html=Le}}const Qe=t,pt=i,At=Symbol("nomatch"),jt=7,we=function($){const be=Object.create(null),Le=Object.create(null),at=[];let St=!0;const ke="Could not find the language '{}', did you forget to load/include a language module?",He={disableAutodetect:!0,name:"Plain text",contains:[]};let re={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function X(W){return re.noHighlightRe.test(W)}function Ve(W){let Q=W.className+" ";Q+=W.parentNode?W.parentNode.className:"";const ae=re.languageDetectRe.exec(Q);if(ae){const me=Re(ae[1]);return me||(Ut(ke.replace("{}",ae[1])),Ut("Falling back to no-highlight mode for this block.",W)),me?ae[1]:"no-highlight"}return Q.split(/\s+/).find(me=>X(me)||Re(me))}function Me(W,Q,ae){let me="",Ie="";typeof Q=="object"?(me=W,ae=Q.ignoreIllegals,Ie=Q.language):(et("10.7.0","highlight(lang, code, ...args) has been deprecated."),et("10.7.0",`Please use highlight(code, options) instead.
80
80
  https://github.com/highlightjs/highlight.js/issues/2277`),Ie=W,me=Q),ae===void 0&&(ae=!0);const st={code:me,language:Ie};U("before:highlight",st);const mt=st.result?st.result:Ce(st.language,st.code,ae);return mt.code=st.code,U("after:highlight",mt),mt}function Ce(W,Q,ae,me){const Ie=Object.create(null);function st(Nt,ri){return Nt.keywords[ri]}function mt(){if(!Pt.keywords){Et.addText(kt);return}let Nt=0;Pt.keywordPatternRe.lastIndex=0;let ri=Pt.keywordPatternRe.exec(kt),bi="";for(;ri;){bi+=kt.substring(Nt,ri.index);const Oi=Vt.case_insensitive?ri[0].toLowerCase():ri[0],wi=st(Pt,Oi);if(wi){const[Ji,en]=wi;if(Et.addText(bi),bi="",Ie[Oi]=(Ie[Oi]||0)+1,Ie[Oi]<=jt&&(di+=en),Ji.startsWith("_"))bi+=ri[0];else{const Cn=Vt.classNameAliases[Ji]||Ji;Wt(ri[0],Cn)}}else bi+=ri[0];Nt=Pt.keywordPatternRe.lastIndex,ri=Pt.keywordPatternRe.exec(kt)}bi+=kt.substring(Nt),Et.addText(bi)}function Ot(){if(kt==="")return;let Nt=null;if(typeof Pt.subLanguage=="string"){if(!be[Pt.subLanguage]){Et.addText(kt);return}Nt=Ce(Pt.subLanguage,kt,!0,hi[Pt.subLanguage]),hi[Pt.subLanguage]=Nt._top}else Nt=ti(kt,Pt.subLanguage.length?Pt.subLanguage:null);Pt.relevance>0&&(di+=Nt.relevance),Et.__addSublanguage(Nt._emitter,Nt.language)}function Kt(){Pt.subLanguage!=null?Ot():mt(),kt=""}function Wt(Nt,ri){Nt!==""&&(Et.startScope(ri),Et.addText(Nt),Et.endScope())}function qt(Nt,ri){let bi=1;const Oi=ri.length-1;for(;bi<=Oi;){if(!Nt._emit[bi]){bi++;continue}const wi=Vt.classNameAliases[Nt[bi]]||Nt[bi],Ji=ri[bi];wi?Wt(Ji,wi):(kt=Ji,mt(),kt=""),bi++}}function Yt(Nt,ri){return Nt.scope&&typeof Nt.scope=="string"&&Et.openNode(Vt.classNameAliases[Nt.scope]||Nt.scope),Nt.beginScope&&(Nt.beginScope._wrap?(Wt(kt,Vt.classNameAliases[Nt.beginScope._wrap]||Nt.beginScope._wrap),kt=""):Nt.beginScope._multi&&(qt(Nt.beginScope,ri),kt="")),Pt=Object.create(Nt,{parent:{value:Pt}}),Pt}function ni(Nt,ri,bi){let Oi=O(Nt.endRe,bi);if(Oi){if(Nt["on:end"]){const wi=new e(Nt);Nt["on:end"](ri,wi),wi.isMatchIgnored&&(Oi=!1)}if(Oi){for(;Nt.endsParent&&Nt.parent;)Nt=Nt.parent;return Nt}}if(Nt.endsWithParent)return ni(Nt.parent,ri,bi)}function Ai(Nt){return Pt.matcher.regexIndex===0?(kt+=Nt[0],1):(Fi=!0,0)}function Pe(Nt){const ri=Nt[0],bi=Nt.rule,Oi=new e(bi),wi=[bi.__beforeBegin,bi["on:begin"]];for(const Ji of wi)if(Ji&&(Ji(Nt,Oi),Oi.isMatchIgnored))return Ai(ri);return bi.skip?kt+=ri:(bi.excludeBegin&&(kt+=ri),Kt(),!bi.returnBegin&&!bi.excludeBegin&&(kt=ri)),Yt(bi,Nt),bi.returnBegin?0:ri.length}function $e(Nt){const ri=Nt[0],bi=Q.substring(Nt.index),Oi=ni(Pt,Nt,bi);if(!Oi)return At;const wi=Pt;Pt.endScope&&Pt.endScope._wrap?(Kt(),Wt(ri,Pt.endScope._wrap)):Pt.endScope&&Pt.endScope._multi?(Kt(),qt(Pt.endScope,Nt)):wi.skip?kt+=ri:(wi.returnEnd||wi.excludeEnd||(kt+=ri),Kt(),wi.excludeEnd&&(kt=ri));do Pt.scope&&Et.closeNode(),!Pt.skip&&!Pt.subLanguage&&(di+=Pt.relevance),Pt=Pt.parent;while(Pt!==Oi.parent);return Oi.starts&&Yt(Oi.starts,Nt),wi.returnEnd?0:ri.length}function Gt(){const Nt=[];for(let ri=Pt;ri!==Vt;ri=ri.parent)ri.scope&&Nt.unshift(ri.scope);Nt.forEach(ri=>Et.openNode(ri))}let ai={};function _e(Nt,ri){const bi=ri&&ri[0];if(kt+=Nt,bi==null)return Kt(),0;if(ai.type==="begin"&&ri.type==="end"&&ai.index===ri.index&&bi===""){if(kt+=Q.slice(ri.index,ri.index+1),!St){const Oi=new Error(`0 width match regex (${W})`);throw Oi.languageName=W,Oi.badRule=ai.rule,Oi}return 1}if(ai=ri,ri.type==="begin")return Pe(ri);if(ri.type==="illegal"&&!ae){const Oi=new Error('Illegal lexeme "'+bi+'" for mode "'+(Pt.scope||"<unnamed>")+'"');throw Oi.mode=Pt,Oi}else if(ri.type==="end"){const Oi=$e(ri);if(Oi!==At)return Oi}if(ri.type==="illegal"&&bi==="")return kt+=`
81
81
  `,1;if(_i>1e5&&_i>ri.index*3)throw new Error("potential infinite loop, way more iterations than matches");return kt+=bi,bi.length}const Vt=Re(W);if(!Vt)throw zt(ke.replace("{}",W)),new Error('Unknown language: "'+W+'"');const _t=lt(Vt);let bt="",Pt=me||_t;const hi={},Et=new re.__emitter(re);Gt();let kt="",di=0,ki=0,_i=0,Fi=!1;try{if(Vt.__emitTokens)Vt.__emitTokens(Q,Et);else{for(Pt.matcher.considerAll();;){_i++,Fi?Fi=!1:Pt.matcher.considerAll(),Pt.matcher.lastIndex=ki;const Nt=Pt.matcher.exec(Q);if(!Nt)break;const ri=Q.substring(ki,Nt.index),bi=_e(ri,Nt);ki=Nt.index+bi}_e(Q.substring(ki))}return Et.finalize(),bt=Et.toHTML(),{language:W,value:bt,relevance:di,illegal:!1,_emitter:Et,_top:Pt}}catch(Nt){if(Nt.message&&Nt.message.includes("Illegal"))return{language:W,value:Qe(Q),illegal:!0,relevance:0,_illegalBy:{message:Nt.message,index:ki,context:Q.slice(ki-100,ki+100),mode:Nt.mode,resultSoFar:bt},_emitter:Et};if(St)return{language:W,value:Qe(Q),illegal:!1,relevance:0,errorRaised:Nt,_emitter:Et,_top:Pt};throw Nt}}function Lt(W){const Q={value:Qe(W),illegal:!1,relevance:0,_top:He,_emitter:new re.__emitter(re)};return Q._emitter.addText(W),Q}function ti(W,Q){Q=Q||re.languages||Object.keys(be);const ae=Lt(W),me=Q.filter(Re).filter(se).map(Kt=>Ce(Kt,W,!1));me.unshift(ae);const Ie=me.sort((Kt,Wt)=>{if(Kt.relevance!==Wt.relevance)return Wt.relevance-Kt.relevance;if(Kt.language&&Wt.language){if(Re(Kt.language).supersetOf===Wt.language)return 1;if(Re(Wt.language).supersetOf===Kt.language)return-1}return 0}),[st,mt]=Ie,Ot=st;return Ot.secondBest=mt,Ot}function xt(W,Q,ae){const me=Q&&Le[Q]||ae;W.classList.add("hljs"),W.classList.add(`language-${me}`)}function ve(W){let Q=null;const ae=Ve(W);if(X(ae))return;if(U("before:highlightElement",{el:W,language:ae}),W.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",W);return}if(W.children.length>0&&(re.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(W)),re.throwUnescapedHTML))throw new ce("One of your code blocks includes unescaped HTML.",W.innerHTML);Q=W;const me=Q.textContent,Ie=ae?Me(me,{language:ae,ignoreIllegals:!0}):ti(me);W.innerHTML=Ie.value,W.dataset.highlighted="yes",xt(W,ae,Ie.language),W.result={language:Ie.language,re:Ie.relevance,relevance:Ie.relevance},Ie.secondBest&&(W.secondBest={language:Ie.secondBest.language,relevance:Ie.secondBest.relevance}),U("after:highlightElement",{el:W,result:Ie,text:me})}function it(W){re=pt(re,W)}const Mt=()=>{ut(),et("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Jt(){ut(),et("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ft=!1;function ut(){function W(){ut()}if(document.readyState==="loading"){ft||window.addEventListener("DOMContentLoaded",W,!1),ft=!0;return}document.querySelectorAll(re.cssSelector).forEach(ve)}function Bt(W,Q){let ae=null;try{ae=Q($)}catch(me){if(zt("Language definition for '{}' could not be registered.".replace("{}",W)),St)zt(me);else throw me;ae=He}ae.name||(ae.name=W),be[W]=ae,ae.rawDefinition=Q.bind(null,$),ae.aliases&&ne(ae.aliases,{languageName:W})}function ei(W){delete be[W];for(const Q of Object.keys(Le))Le[Q]===W&&delete Le[Q]}function J(){return Object.keys(be)}function Re(W){return W=(W||"").toLowerCase(),be[W]||be[Le[W]]}function ne(W,{languageName:Q}){typeof W=="string"&&(W=[W]),W.forEach(ae=>{Le[ae.toLowerCase()]=Q})}function se(W){const Q=Re(W);return Q&&!Q.disableAutodetect}function De(W){W["before:highlightBlock"]&&!W["before:highlightElement"]&&(W["before:highlightElement"]=Q=>{W["before:highlightBlock"](Object.assign({block:Q.el},Q))}),W["after:highlightBlock"]&&!W["after:highlightElement"]&&(W["after:highlightElement"]=Q=>{W["after:highlightBlock"](Object.assign({block:Q.el},Q))})}function pe(W){De(W),at.push(W)}function gt(W){const Q=at.indexOf(W);Q!==-1&&at.splice(Q,1)}function U(W,Q){const ae=W;at.forEach(function(me){me[ae]&&me[ae](Q)})}function ot(W){return et("10.7.0","highlightBlock will be removed entirely in v12.0"),et("10.7.0","Please use highlightElement now."),ve(W)}Object.assign($,{highlight:Me,highlightAuto:ti,highlightAll:ut,highlightElement:ve,highlightBlock:ot,configure:it,initHighlighting:Mt,initHighlightingOnLoad:Jt,registerLanguage:Bt,unregisterLanguage:ei,listLanguages:J,getLanguage:Re,registerAliases:ne,autoDetection:se,inherit:pt,addPlugin:pe,removePlugin:gt}),$.debugMode=function(){St=!1},$.safeMode=function(){St=!0},$.versionString=Ct,$.regex={concat:E,lookahead:m,either:I,optional:_,anyNumberOfTimes:C};for(const W in ci)typeof ci[W]=="object"&&r(ci[W]);return Object.assign($,ci),$},tt=we({});return tt.newInstance=()=>we({}),bC=tt,tt.HighlightJS=tt,tt.default=tt,bC}var hZ=uZ();const h_=u2(hZ),CD="[A-Za-z$_][0-9A-Za-z$_]*",fZ=["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"],pZ=["true","false","null","undefined","NaN","Infinity"],I7=["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"],P7=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],T7=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],gZ=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],vZ=[].concat(T7,I7,P7);function M7(r){const e=r.regex,t=(fe,{after:Ft})=>{const Te="</"+fe[0].slice(1);return fe.input.indexOf(Te,Ft)!==-1},i=CD,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(fe,Ft)=>{const Te=fe[0].length+fe.index,Be=fe.input[Te];if(Be==="<"||Be===","){Ft.ignoreMatch();return}Be===">"&&(t(fe,{after:Te})||Ft.ignoreMatch());let Je;const It=fe.input.substring(Te);if(Je=It.match(/^\s*=/)){Ft.ignoreMatch();return}if((Je=It.match(/^\s+extends\s+/))&&Je.index===0){Ft.ignoreMatch();return}}},l={$pattern:CD,keyword:fZ,literal:pZ,built_in:vZ,"variable.language":gZ},d="[0-9](_?[0-9])*",u=`\\.(${d})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",x={className:"number",variants:[{begin:`(\\b(${g})((${u})|\\.)?|(${u}))[eE][+-]?(${d})\\b`},{begin:`\\b(${g})\\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},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},_={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,m],subLanguage:"css"}},E={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,m]},M={className:"comment",variants:[r.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}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},O=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,_,E,S,{match:/\$\d+/},x];m.contains=O.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(O)});const R=[].concat(M,m.contains),H=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(R)}]),G={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:H},q={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"}}]},te={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:{_:[...I7,...P7]}},ye={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Ne={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[G],illegal:/%/},ge={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ae(fe){return e.concat("(?!",fe.join("|"),")")}const dt={match:e.concat(/\b/,Ae([...T7,"super","import"].map(fe=>`${fe}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},he={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},We={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},G]},de="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",je={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(de)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[G]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:H,CLASS_REFERENCE:te},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),ye,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,_,E,S,M,{match:/\$\d+/},x,te,{scope:"attr",match:i+e.lookahead(":"),relevance:0},je,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[M,r.REGEXP_MODE,{className:"function",begin:de,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:H}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:n.begin,end:n.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},Ne,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[G,r.inherit(r.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},he,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[G]},dt,ge,q,We,{match:/\$[(.]/}]}}function h2(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hh=h2();function R7(r){Hh=r}var Jd={exec:()=>null};function af(r){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),n=e[i];return n||(n=r(i),e[i]=n),n}}function Ps(r,e=""){let t=typeof r=="string"?r:r.source,i={replace:(n,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(cr.caret,"$1"),t=t.replace(n,a),i},getRegex:()=>new RegExp(t,e)};return i}var xZ=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),cr={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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:af(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:af(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:af(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:af(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:af(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:af(r=>new RegExp(`^ {0,${r}}>`))},mZ=/^(?:[ \t]*(?:\n|$))+/,_Z=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,bZ=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,kv=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,CZ=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,f2=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,N7=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,O7=Ps(N7).replace(/bull/g,f2).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(),yZ=Ps(N7).replace(/bull/g,f2).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(),p2=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wZ=/^[^\n]+/,g2=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,EZ=Ps(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",g2).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),SZ=Ps(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,f2).getRegex(),cb="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",v2=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,kZ=Ps("^ {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",v2).replace("tag",cb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),H7=Ps(p2).replace("hr",kv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cb).getRegex(),DZ=Ps(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",H7).getRegex(),x2={blockquote:DZ,code:_Z,def:EZ,fences:bZ,heading:CZ,hr:kv,html:kZ,lheading:O7,list:SZ,newline:mZ,paragraph:H7,table:Jd,text:wZ},yD=Ps("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cb).getRegex(),AZ={...x2,lheading:yZ,table:yD,paragraph:Ps(p2).replace("hr",kv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",yD).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cb).getRegex()},BZ={...x2,html:Ps(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",v2).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:Jd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ps(p2).replace("hr",kv).replace("heading",` *#{1,6} *[^
82
82
  ]`).replace("lheading",O7).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},FZ=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,LZ=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,z7=/^( {2,}|\\)\n(?!\s*$)/,IZ=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jp=/[\p{P}\p{S}]/u,db=/[\s\p{P}\p{S}]/u,m2=/[^\s\p{P}\p{S}]/u,PZ=Ps(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,db).getRegex(),W7=/(?!~)[\p{P}\p{S}]/u,TZ=/(?!~)[\s\p{P}\p{S}]/u,MZ=/(?:[^\s\p{P}\p{S}]|~)/u,RZ=Ps(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xZ?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),j7=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,NZ=Ps(j7,"u").replace(/punct/g,Jp).getRegex(),OZ=Ps(j7,"u").replace(/punct/g,W7).getRegex(),V7="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",HZ=Ps(V7,"gu").replace(/notPunctSpace/g,m2).replace(/punctSpace/g,db).replace(/punct/g,Jp).getRegex(),zZ=Ps(V7,"gu").replace(/notPunctSpace/g,MZ).replace(/punctSpace/g,TZ).replace(/punct/g,W7).getRegex(),WZ=Ps("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,m2).replace(/punctSpace/g,db).replace(/punct/g,Jp).getRegex(),jZ=Ps(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Jp).getRegex(),VZ="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",$Z=Ps(VZ,"gu").replace(/notPunctSpace/g,m2).replace(/punctSpace/g,db).replace(/punct/g,Jp).getRegex(),qZ=Ps(/\\(punct)/,"gu").replace(/punct/g,Jp).getRegex(),UZ=Ps(/^<(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(),GZ=Ps(v2).replace("(?:-->|$)","-->").getRegex(),KZ=Ps("^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",GZ).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),f_=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ZZ=Ps(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",f_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$7=Ps(/^!?\[(label)\]\[(ref)\]/).replace("label",f_).replace("ref",g2).getRegex(),q7=Ps(/^!?\[(ref)\](?:\[\])?/).replace("ref",g2).getRegex(),YZ=Ps("reflink|nolink(?!\\()","g").replace("reflink",$7).replace("nolink",q7).getRegex(),wD=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_2={_backpedal:Jd,anyPunctuation:qZ,autolink:UZ,blockSkip:RZ,br:z7,code:LZ,del:Jd,delLDelim:Jd,delRDelim:Jd,emStrongLDelim:NZ,emStrongRDelimAst:HZ,emStrongRDelimUnd:WZ,escape:FZ,link:ZZ,nolink:q7,punctuation:PZ,reflink:$7,reflinkSearch:YZ,tag:KZ,text:IZ,url:Jd},XZ={..._2,link:Ps(/^!?\[(label)\]\((.*?)\)/).replace("label",f_).getRegex(),reflink:Ps(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",f_).getRegex()},_S={..._2,emStrongRDelimAst:zZ,emStrongLDelim:OZ,delLDelim:jZ,delRDelim:$Z,url:Ps(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wD).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:Ps(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wD).getRegex()},QZ={..._S,br:Ps(z7).replace("{2,}","*").getRegex(),text:Ps(_S.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},fx={normal:x2,gfm:AZ,pedantic:BZ},pg={normal:_2,gfm:_S,breaks:QZ,pedantic:XZ},JZ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ED=r=>JZ[r];function pl(r,e){if(e){if(cr.escapeTest.test(r))return r.replace(cr.escapeReplace,ED)}else if(cr.escapeTestNoEncode.test(r))return r.replace(cr.escapeReplaceNoEncode,ED);return r}function SD(r){try{r=encodeURI(r).replace(cr.percentDecode,"%")}catch{return null}return r}function kD(r,e){var s;let t=r.replace(cr.findPipe,(a,l,d)=>{let u=!1,g=l;for(;--g>=0&&d[g]==="\\";)u=!u;return u?"|":" |"}),i=t.split(cr.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(cr.slashPipe,"|");return i}function Oc(r,e,t){let i=r.length;if(i===0)return"";let n=0;for(;n<i&&r.charAt(i-n-1)===e;)n++;return r.slice(0,i-n)}function DD(r){let e=r.split(`
@@ -273,7 +273,7 @@ sudo chmod -R g+rwX ${o(ge)}`);var We=Fse(),de=Dt(We);ts(kr(de,{}),Z=>p(H,Z,!0),
273
273
  `+j.slice(Qe,pt),Qe=pt+1),At=jt;return we+=`
274
274
  `,j.length-Qe>Xe&&At>Qe?we+=j.slice(Qe,At)+`
275
275
  `+j.slice(At+1):we+=j.slice(Qe),we.slice(1)}function zt(j){let Xe="",Ct=0;for(let ce=0;ce<j.length;Ct>=65536?ce+=2:ce++){Ct=Rt(j,ce);const Qe=he[Ct];!Qe&&Fe(Ct)?(Xe+=j[ce],Ct>=65536&&(Xe+=j[ce+1])):Xe+=Qe||fe(Ct)}return Xe}function Ut(j,Xe,Ct){let ce="";const Qe=j.tag;for(let pt=0,At=Ct.length;pt<At;pt+=1){let jt=Ct[pt];j.replacer&&(jt=j.replacer.call(Ct,String(pt),jt)),(Y(j,Xe,jt,!1,!1)||typeof jt>"u"&&Y(j,Xe,null,!1,!1))&&(ce!==""&&(ce+=","+(j.condenseFlow?"":" ")),ce+=j.dump)}j.tag=Qe,j.dump="["+ce+"]"}function et(j,Xe,Ct,ce){let Qe="";const pt=j.tag;for(let At=0,jt=Ct.length;At<jt;At+=1){let we=Ct[At];j.replacer&&(we=j.replacer.call(Ct,String(At),we)),(Y(j,Xe+1,we,!0,!0,!1,!0)||typeof we>"u"&&Y(j,Xe+1,null,!0,!0,!1,!0))&&((!ce||Qe!=="")&&(Qe+=It(j,Xe)),j.dump&&l===j.dump.charCodeAt(0)?Qe+="-":Qe+="- ",Qe+=j.dump)}j.tag=pt,j.dump=Qe||"[]"}function rt(j,Xe,Ct){let ce="";const Qe=j.tag,pt=Object.keys(Ct);for(let At=0,jt=pt.length;At<jt;At+=1){let we="";ce!==""&&(we+=", "),j.condenseFlow&&(we+='"');const tt=pt[At];let $=Ct[tt];j.replacer&&($=j.replacer.call(Ct,tt,$)),Y(j,Xe,tt,!1,!1)&&(j.dump.length>1024&&(we+="? "),we+=j.dump+(j.condenseFlow?'"':"")+":"+(j.condenseFlow?"":" "),Y(j,Xe,$,!1,!1)&&(we+=j.dump,ce+=we))}j.tag=Qe,j.dump="{"+ce+"}"}function w(j,Xe,Ct,ce){let Qe="";const pt=j.tag,At=Object.keys(Ct);if(j.sortKeys===!0)At.sort();else if(typeof j.sortKeys=="function")At.sort(j.sortKeys);else if(j.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let jt=0,we=At.length;jt<we;jt+=1){let tt="";(!ce||Qe!=="")&&(tt+=It(j,Xe));const $=At[jt];let be=Ct[$];if(j.replacer&&(be=j.replacer.call(Ct,$,be)),!Y(j,Xe+1,$,!0,!0,!0))continue;const Le=j.tag!==null&&j.tag!=="?"||j.dump&&j.dump.length>1024;Le&&(j.dump&&l===j.dump.charCodeAt(0)?tt+="?":tt+="? "),tt+=j.dump,Le&&(tt+=It(j,Xe)),Y(j,Xe+1,be,!0,Le)&&(j.dump&&l===j.dump.charCodeAt(0)?tt+=":":tt+=": ",tt+=j.dump,Qe+=tt)}j.tag=pt,j.dump=Qe||"{}"}function V(j,Xe,Ct){const ce=Ct?j.explicitTypes:j.implicitTypes;for(let Qe=0,pt=ce.length;Qe<pt;Qe+=1){const At=ce[Qe];if((At.instanceOf||At.predicate)&&(!At.instanceOf||typeof Xe=="object"&&Xe instanceof At.instanceOf)&&(!At.predicate||At.predicate(Xe))){if(Ct?At.multi&&At.representName?j.tag=At.representName(Xe):j.tag=At.tag:j.tag="?",At.represent){const jt=j.styleMap[At.tag]||At.defaultStyle;let we;if(i.call(At.represent)==="[object Function]")we=At.represent(Xe,jt);else if(n.call(At.represent,jt))we=At.represent[jt](Xe,jt);else throw new e("!<"+At.tag+'> tag resolver accepts not "'+jt+'" style');j.dump=we}return!0}}return!1}function Y(j,Xe,Ct,ce,Qe,pt,At){j.tag=null,j.dump=Ct,V(j,Ct,!1)||V(j,Ct,!0);const jt=i.call(j.dump),we=ce;ce&&(ce=j.flowLevel<0||j.flowLevel>Xe);const tt=jt==="[object Object]"||jt==="[object Array]";let $,be;if(tt&&($=j.duplicates.indexOf(Ct),be=$!==-1),(j.tag!==null&&j.tag!=="?"||be||j.indent!==2&&Xe>0)&&(Qe=!1),be&&j.usedDuplicates[$])j.dump="*ref_"+$;else{if(tt&&be&&!j.usedDuplicates[$]&&(j.usedDuplicates[$]=!0),jt==="[object Object]")ce&&Object.keys(j.dump).length!==0?(w(j,Xe,j.dump,Qe),be&&(j.dump="&ref_"+$+j.dump)):(rt(j,Xe,j.dump),be&&(j.dump="&ref_"+$+" "+j.dump));else if(jt==="[object Array]")ce&&j.dump.length!==0?(j.noArrayIndent&&!At&&Xe>0?et(j,Xe-1,j.dump,Qe):et(j,Xe,j.dump,Qe),be&&(j.dump="&ref_"+$+j.dump)):(Ut(j,Xe,j.dump),be&&(j.dump="&ref_"+$+" "+j.dump));else if(jt==="[object String]")j.tag!=="?"&&Z(j,j.dump,Xe,pt,we);else{if(jt==="[object Undefined]")return!1;if(j.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+jt)}if(j.tag!==null&&j.tag!=="?"){let Le=encodeURI(j.tag[0]==="!"?j.tag.slice(1):j.tag).replace(/!/g,"%21");j.tag[0]==="!"?Le="!"+Le:Le.slice(0,18)==="tag:yaml.org,2002:"?Le="!!"+Le.slice(18):Le="!<"+Le+">",j.dump=Le+" "+j.dump}}return!0}function oe(j,Xe){const Ct=[],ce=[];Ee(j,Ct,ce);const Qe=ce.length;for(let pt=0;pt<Qe;pt+=1)Xe.duplicates.push(Ct[ce[pt]]);Xe.usedDuplicates=new Array(Qe)}function Ee(j,Xe,Ct){if(j!==null&&typeof j=="object"){const ce=Xe.indexOf(j);if(ce!==-1)Ct.indexOf(ce)===-1&&Ct.push(ce);else if(Xe.push(j),Array.isArray(j))for(let Qe=0,pt=j.length;Qe<pt;Qe+=1)Ee(j[Qe],Xe,Ct);else{const Qe=Object.keys(j);for(let pt=0,At=Qe.length;pt<At;pt+=1)Ee(j[Qe[pt]],Xe,Ct)}}}function lt(j,Xe){Xe=Xe||{};const Ct=new Be(Xe);Ct.noRefs||oe(j,Ct);let ce=j;return Ct.replacer&&(ce=Ct.replacer.call({"":ce},"",ce)),Y(Ct,0,ce,!0,!0)?Ct.dump+`
276
- `:""}return GC.dump=lt,GC}var NA;function cre(){if(NA)return rr;NA=1;const r=are(),e=lre();function t(i,n){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return rr.Type=Dr(),rr.Schema=Y7(),rr.FAILSAFE_SCHEMA=eF(),rr.JSON_SCHEMA=oF(),rr.CORE_SCHEMA=rF(),rr.DEFAULT_SCHEMA=C2(),rr.load=r.load,rr.loadAll=r.loadAll,rr.dump=e.dump,rr.YAMLException=Av(),rr.types={binary:cF(),float:sF(),map:J7(),null:tF(),pairs:uF(),set:hF(),timestamp:aF(),bool:iF(),int:nF(),merge:lF(),omap:dF(),seq:Q7(),str:X7()},rr.safeLoad=t("safeLoad","load"),rr.safeLoadAll=t("safeLoadAll","loadAll"),rr.safeDump=t("safeDump","dump"),rr}var dre=cre();const fF=ore(dre),{Type:hfe,Schema:ffe,FAILSAFE_SCHEMA:pfe,JSON_SCHEMA:gfe,CORE_SCHEMA:vfe,DEFAULT_SCHEMA:xfe,load:mfe,loadAll:_fe,dump:bfe,YAMLException:Cfe,types:yfe,safeLoad:wfe,safeLoadAll:Efe,safeDump:Sfe}=fF;var ure=k('<div class="muted pad svelte-bdu03r">Loading…</div>'),hre=k('<span class="muted svelte-bdu03r" title="Guessed from the option name — the adapter does not declare this file">guessed</span>'),fre=k('<div class="muted desc svelte-bdu03r"> </div>'),OA=k("<button> </button>"),pre=k('<div class="mono muted svelte-bdu03r"> <span class="warn svelte-bdu03r">— missing</span></div> <button class="ghost sm svelte-bdu03r"> </button>',1),gre=k('<div class="mono muted svelte-bdu03r"> <span title="binary — not edited here">(binary)</span></div>'),vre=k('<div class="mono muted svelte-bdu03r"> </div> <div class="muted warn svelte-bdu03r"> <button class="link svelte-bdu03r"> </button> and move the content over.</div>',1),xre=k('<div class="muted svelte-bdu03r">not set</div> <button class="ghost sm svelte-bdu03r"> </button>',1),mre=k('<div class="opt svelte-bdu03r"><div class="opt-head svelte-bdu03r"><span class="mono key svelte-bdu03r"> </span> <span class="badge svelte-bdu03r"> </span> <!></div> <!> <!></div>'),_re=k('<div class="group-title svelte-bdu03r">Adapter files</div> <!>',1),bre=k('<div class="muted pad svelte-bdu03r">No files.</div>'),Cre=k('<span class="mono muted svelte-bdu03r"> </span>'),yre=k('<div class="file svelte-bdu03r"><!> <span class="muted size svelte-bdu03r"> </span></div>'),wre=k('<!> <div class="group-title svelte-bdu03r" style="margin-top:8px"> </div> <!> <!>',1),Ere=k('<div class="err pad svelte-bdu03r"> </div>'),Sre=k('<span class="muted svelte-bdu03r" title="JSON schema shipped by the adapter"> </span>'),kre=k('<span class="err svelte-bdu03r"> </span>'),Dre=k('<span class="ok svelte-bdu03r"> </span>'),Are=k('<span class="muted svelte-bdu03r"> </span>'),Bre=k('<div class="edbar svelte-bdu03r"><span class="mono path svelte-bdu03r"> </span> <!> <span class="spacer svelte-bdu03r"></span> <!> <button class="svelte-bdu03r"> </button> <button title="Save and restart the instance" class="svelte-bdu03r">Save &amp; restart</button> <!></div> <div class="monaco svelte-bdu03r"><!></div>',1),Fre=k('<div class="muted pad svelte-bdu03r">Pick a file on the left.</div>'),Lre=k('<div class="files svelte-bdu03r"><div class="list svelte-bdu03r"><!> <!></div> <div class="editor svelte-bdu03r"><!></div></div>');function Ire(r,e){ls(e,!0);let t=A(Ci([])),i=A(Ci([])),n=A(Ci([])),s=A(!0),a=A(""),l=A(null),d=A(""),u=A(""),g=A(null),x=A(null),m=A(null),C=A(Ci([])),_=A(Ci([])),E=A(!1),S=A(""),I=ct(()=>o(d)!==o(u)),M=ct(()=>o(g)==="json"?"json":o(g)==="yaml"?"yaml":"plaintext"),O=ct(()=>o(_).filter(Je=>Je.severity===8).length+o(C).length);async function R(){p(s,!0),p(a,"");try{const Je=await YK(e.host,e.adapter,e.instance);p(t,Je.options,!0),p(i,Je.files,!0),p(n,Je.dirs,!0)}catch(Je){p(a,Je.message??String(Je),!0)}finally{p(s,!1)}}Os(R);function H(Je){return o(t).find(It=>It.path===Je)}async function G(Je,It){if(!(o(I)&&!confirm("Discard unsaved changes?"))){p(S,""),p(a,"");try{const ue=await XK(e.host,e.adapter,e.instance,Je);p(l,ue.path,!0),p(d,ue.content,!0),p(u,ue.content,!0),p(g,It??ue.format,!0),p(x,null),p(m,null),p(C,[],!0),p(_,[],!0);const xe=H(Je);if(xe!=null&&xe.schema&&o(g)==="json")try{const Fe=await eZ(e.host,e.adapter,xe.schema);p(x,JSON.parse(Fe.content),!0),p(m,xe.schema,!0)}catch{}}catch(ue){p(a,ue.message??String(ue),!0)}}}cn(()=>{var Je,It;if(o(g)!=="yaml"){p(C,[],!0);return}try{fF.load(o(d)),p(C,[],!0)}catch(ue){const xe=(((Je=ue==null?void 0:ue.mark)==null?void 0:Je.line)??0)+1,Fe=(((It=ue==null?void 0:ue.mark)==null?void 0:It.column)??0)+1;p(C,[{severity:8,message:(ue==null?void 0:ue.reason)??String(ue),startLineNumber:xe,startColumn:Fe,endLineNumber:xe,endColumn:Fe+1}],!0)}});async function q(Je){var It;if(o(l)){p(E,!0),p(S,""),p(a,"");try{const ue=await QK(e.host,e.adapter,e.instance,o(l),o(d),Je);p(u,o(d),!0),p(S,ue.restarted?"Saved and restarted.":"Saved.",!0),(It=e.onchanged)==null||It.call(e),R()}catch(ue){p(a,ue.message??String(ue),!0)}finally{p(E,!1)}}}async function te(Je){p(S,""),p(a,"");try{const It=await JK(e.host,e.adapter,e.instance,Je.key);p(S,`Created ${It.path} and set ${It.envName} — restart the instance to use it.`),await R();const ue=o(i).find(xe=>xe.path===It.path);await G(It.path,(ue==null?void 0:ue.format)??Je.format)}catch(It){p(a,It.message??String(It),!0)}}function ye(Je){return Je<1024?`${Je} B`:Je<1048576?`${(Je/1024).toFixed(1)} KB`:`${(Je/1048576).toFixed(1)} MB`}function Ne(Je){return Je?new Date(Je*1e3).toLocaleString():""}var ge=Lre(),Ae=f(ge),dt=f(Ae);{var he=Je=>{var It=ure();y(Je,It)},We=Je=>{var It=wre(),ue=Dt(It);{var xe=Rt=>{var Ke=_re(),vt=h(Dt(Ke),2);gi(vt,17,()=>o(t),Ze=>Ze.key,(Ze,ee)=>{var ht=mre(),qe=f(ht),Ue=f(qe),Z=f(Ue),Se=h(Ue,2),Oe=f(Se),$t=h(Se,2);{var Ht=V=>{var Y=hre();y(V,Y)};T($t,V=>{o(ee).declared||V(Ht)})}var zt=h(qe,2);{var Ut=V=>{var Y=fre(),oe=f(Y);P(()=>B(oe,o(ee).describe)),y(V,Y)};T(zt,V=>{o(ee).describe&&V(Ut)})}var et=h(zt,2);{var rt=V=>{var Y=ks(),oe=Dt(Y);{var Ee=Ct=>{var ce=OA();let Qe;var pt=f(ce);P(()=>{Qe=Xt(ce,1,"path-link mono svelte-bdu03r",null,Qe,{active:o(l)===o(ee).path}),B(pt,o(ee).path)}),z("click",ce,()=>G(o(ee).path,o(ee).format)),y(Ct,ce)},lt=Ct=>{var ce=pre(),Qe=Dt(ce),pt=f(Qe),At=h(Qe,2),jt=f(At);P(()=>{B(pt,`${o(ee).path??""} `),B(jt,`Create${o(ee).example?" from example":""}`)}),z("click",At,()=>te(o(ee))),y(Ct,ce)},j=Ct=>{var ce=gre(),Qe=f(ce);P(()=>B(Qe,`${o(ee).path??""} `)),y(Ct,ce)},Xe=Ct=>{var ce=vre(),Qe=Dt(ce),pt=f(Qe),At=h(Qe,2),jt=f(At),we=h(jt),tt=f(we);P($=>{B(pt,o(ee).path),B(jt,`outside ${$??""} — she only edits files there. `),B(tt,`Create${o(ee).example?" from example":""} in /etc/${e.adapter??""}/`)},[()=>o(n).join(" and ")]),z("click",we,()=>te(o(ee))),y(Ct,ce)};T(oe,Ct=>{o(ee).managed&&o(ee).exists&&o(ee).editable?Ct(Ee):o(ee).managed&&!o(ee).exists?Ct(lt,1):o(ee).editable?Ct(Xe,-1):Ct(j,2)})}y(V,Y)},w=V=>{var Y=xre(),oe=h(Dt(Y),2),Ee=f(oe);P(()=>B(Ee,`Create${o(ee).example?" from example":""}`)),z("click",oe,()=>te(o(ee))),y(V,Y)};T(et,V=>{o(ee).path?V(rt):V(w,-1)})}P(()=>{B(Z,`--${o(ee).key??""}`),B(Oe,o(ee).format)}),y(Ze,ht)}),y(Rt,Ke)};T(ue,Rt=>{o(t).length&&Rt(xe)})}var Fe=h(ue,2),Ye=f(Fe),nt=h(Fe,2);{var yt=Rt=>{var Ke=bre();y(Rt,Ke)};T(nt,Rt=>{o(i).length===0&&Rt(yt)})}var ci=h(nt,2);gi(ci,17,()=>o(i),Rt=>Rt.path,(Rt,Ke)=>{var vt=ks(),Ze=Dt(vt);{var ee=ht=>{var qe=yre(),Ue=f(qe);{var Z=Ht=>{var zt=OA();let Ut;var et=f(zt);P(rt=>{Ut=Xt(zt,1,"path-link mono svelte-bdu03r",null,Ut,{active:o(l)===o(Ke).path}),xi(zt,"title",rt),B(et,o(Ke).path)},[()=>Ne(o(Ke).mtime)]),z("click",zt,()=>G(o(Ke).path,o(Ke).format)),y(Ht,zt)},Se=Ht=>{var zt=Cre(),Ut=f(zt);P(et=>{xi(zt,"title",et),B(Ut,o(Ke).path)},[()=>/\.env$/.test(o(Ke).path)?"edited through the Config tab":"not a text format she edits"]),y(Ht,zt)};T(Ue,Ht=>{o(Ke).editable?Ht(Z):Ht(Se,-1)})}var Oe=h(Ue,2),$t=f(Oe);P(Ht=>B($t,Ht),[()=>ye(o(Ke).size)]),y(ht,qe)};T(Ze,ht=>{o(Ke).kind==="file"&&ht(ee)})}y(Rt,vt)}),P(Rt=>B(Ye,Rt),[()=>o(n).join(" · ")]),y(Je,It)};T(dt,Je=>{o(s)?Je(he):Je(We,-1)})}var de=h(dt,2);{var je=Je=>{var It=Ere(),ue=f(It);P(()=>B(ue,o(a))),y(Je,It)};T(de,Je=>{o(a)&&Je(je)})}var fe=h(Ae,2),Ft=f(fe);{var Te=Je=>{var It=Bre(),ue=Dt(It),xe=f(ue),Fe=f(xe),Ye=h(xe,2);{var nt=Z=>{var Se=Sre(),Oe=f(Se);P(()=>B(Oe,`schema: ${o(m)??""}`)),y(Z,Se)};T(Ye,Z=>{o(m)&&Z(nt)})}var yt=h(Ye,4);{var ci=Z=>{var Se=kre(),Oe=f(Se);P(()=>B(Oe,`${o(O)??""} problem${o(O)===1?"":"s"}`)),y(Z,Se)},Rt=Z=>{var Se=Dre(),Oe=f(Se);P(()=>B(Oe,`valid ${o(g)??""}`)),y(Z,Se)};T(yt,Z=>{o(O)>0?Z(ci):(o(g)==="json"||o(g)==="yaml")&&Z(Rt,1)})}var Ke=h(yt,2),vt=f(Ke),Ze=h(Ke,2),ee=h(Ze,2);{var ht=Z=>{var Se=Are(),Oe=f(Se);P(()=>B(Oe,o(S))),y(Z,Se)};T(ee,Z=>{o(S)&&Z(ht)})}var qe=h(ue,2),Ue=f(qe);E3(Ue,()=>o(l),Z=>{Vf(Z,{get language(){return o(M)},get jsonSchema(){return o(x)},get markers(){return o(C)},onMarkers:Se=>p(_,Se,!0),onSave:()=>q(!1),get value(){return o(d)},set value(Se){p(d,Se,!0)}})}),P(()=>{B(Fe,o(l)),Ke.disabled=o(E)||!o(I),B(vt,o(E)?"Saving…":"Save"),Ze.disabled=o(E)||!o(I)&&o(O)>0}),z("click",Ke,()=>q(!1)),z("click",Ze,()=>q(!0)),y(Je,It)},Be=Je=>{var It=Fre();y(Je,It)};T(Ft,Je=>{o(l)?Je(Te):Je(Be,-1)})}y(r,ge),cs()}ms(["click"]);var Pre=k('<span class="badge svelte-1zltuz" title="pre-core single-instance unit — migrate it from the Instances tab">old unit</span>'),Tre=k("<span> </span>"),Mre=k("<button>Files</button>"),Rre=k("<button>Config</button> <!> <button>Logs</button>",1),Nre=k('<span class="muted tabs-note svelte-1zltuz"> </span>'),KC=k('<div class="muted svelte-1zltuz"> </div>'),Ore=k('<div class="err-box svelte-1zltuz"> </div>'),Hre=k('<button class="ghost svelte-1zltuz" title="Set a new random password for the dynsec client and restart the instance">Rotate password</button>'),zre=k('<span class="muted svelte-1zltuz"> </span>'),Wre=k('<!> <!> <div class="actions svelte-1zltuz"><button class="svelte-1zltuz"> </button> <button class="svelte-1zltuz">Save &amp; restart</button> <!> <!></div>',1),jre=k('<div class="body svelte-1zltuz"><!></div>'),Vre=k("<option> </option>"),$re=k('<span class="err svelte-1zltuz"> </span>'),qre=k('<div><span class="ts svelte-1zltuz"> </span><span class="lvl svelte-1zltuz"> </span><span class="msg svelte-1zltuz"> </span></div>'),Ure=k('<div class="muted empty svelte-1zltuz">No journal entries.</div>'),Gre=k('<div class="logbar svelte-1zltuz"><select class="svelte-1zltuz"></select> <input class="filter-in svelte-1zltuz" type="search" placeholder="Filter messages…"/> <label class="check-label svelte-1zltuz" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-1zltuz"/> <span class="checkmark svelte-1zltuz"></span> Regex</label> <label class="check-label svelte-1zltuz" title="Keep receiving new journal lines"><input type="checkbox" class="svelte-1zltuz"/> <span class="checkmark svelte-1zltuz"></span> Follow</label> <label class="check-label svelte-1zltuz"><input type="checkbox" class="svelte-1zltuz"/> <span class="checkmark svelte-1zltuz"></span> Auto-scroll</label> <button class="ghost sm svelte-1zltuz" title="Reload the last 500 journal lines">↺</button> <button class="ghost sm svelte-1zltuz">Clear</button></div> <div class="logmeta svelte-1zltuz"><span class="muted mono svelte-1zltuz"> </span> <span class="muted svelte-1zltuz"> <!> lines<!></span> <!></div> <div class="log svelte-1zltuz"><!> <!></div>',1),Kre=k('<span class="badge-upd svelte-1zltuz"> </span>'),Zre=k('<div class="muted svelte-1zltuz" style="margin:6px 0 4px"> </div> <pre class="mono json svelte-1zltuz"> </pre>',1),Yre=k('<div class="muted svelte-1zltuz">Unmanaged — only <span class="mono svelte-1zltuz"> </span> is known; no <span class="mono svelte-1zltuz"> </span>, so this could be any client publishing that topic (an ESPHome device, a script, a pre-core adapter).</div>'),Xre=k('<dl class="kv svelte-1zltuz"><dt class="svelte-1zltuz">adapter</dt><dd class="mono svelte-1zltuz"> <!><!></dd> <dt class="svelte-1zltuz">connected</dt><dd class="svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">uptime</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">host</dt><dd class="svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">spec</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">node</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">started</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">maintenance</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">status topics</dt><dd class="svelte-1zltuz"> <span class="mono svelte-1zltuz"> </span></dd> <dt class="svelte-1zltuz">info updated</dt><dd class="svelte-1zltuz"> </dd></dl> <!>',1),Qre=k('<span class="muted svelte-1zltuz">(pre-core layout)</span>'),Jre=k('<dl class="kv svelte-1zltuz"><dt class="svelte-1zltuz">unit</dt><dd class="mono svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">host</dt><dd class="svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">state</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">since</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">restarts</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">env file</dt><dd class="mono svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">state dir</dt><dd class="mono svelte-1zltuz"> </dd></dl>'),eae=k('<div class="body svelte-1zltuz"><div class="info-title svelte-1zltuz">MQTT</div> <!> <div class="info-title svelte-1zltuz" style="margin-top:14px">systemd</div> <!></div>'),tae=k('<div class="detail svelte-1zltuz"><div class="head svelte-1zltuz"><div><span class="title svelte-1zltuz"> </span><!> <span class="sub mono svelte-1zltuz"> <!> </span> <!></div> <button class="ghost sm svelte-1zltuz">Close</button></div> <div class="tabs svelte-1zltuz"><!> <button>Info</button> <!></div> <!></div>');function iae(r,e){ls(e,!0);let t=$n(e,"unit",3,null),i=$n(e,"mqtt",3,null),n=$n(e,"hostname",3,null),s=$n(e,"label",3,null),a=$n(e,"legacy",3,!1),l=$n(e,"tab",15,"config"),d=ct(()=>!!e.host&&!!t()&&!!e.adapter);cn(()=>{!o(d)&&l()!=="info"&&l("info")}),cn(()=>{a()&&l()==="files"&&l("config")});const u=()=>e.host,g=()=>e.adapter;let x=A(Ci({})),m=A(Ci([])),C=A(null),_=A(null),E=A(null),S=A("own"),I=A("own"),M=A(!0),O=A(""),R=A(!1),H=A("");async function G(){p(M,!0),p(O,"");try{const we=await HK(u(),g(),e.instance);p(x,we.env,!0),p(m,we.secrets,!0),p(C,we.schema,!0),p(_,we.sheBroker,!0),p(E,we.dynsec,!0),p(S,we.brokerMode,!0),p(I,we.brokerMode,!0)}catch(we){p(O,we.message??String(we),!0)}finally{p(M,!1)}}async function q(we,tt=!1){var $;p(R,!0),p(H,""),p(O,"");try{const be=await zK(u(),g(),e.instance,o(x),we,o(S),{rotate:tt});p(H,tt?"New password set on the broker"+(be.restarted?" and instance restarted.":" — restart the instance to use it."):be.restarted?"Saved and restarted.":"Saved — takes effect on the next restart.",!0),($=e.onchanged)==null||$.call(e),await G()}catch(be){p(O,be.message??String(be),!0)}finally{p(R,!1)}}const te=["all","debug","info","warn","error"],ye={debug:0,info:1,warn:2,error:3},Ne=3e3;let ge=A(Ci([])),Ae=A(""),dt=A(!1),he=A(!1),We=A(!0),de=A(!0),je=A("all"),fe=A(""),Ft=A(!1),Te=A(void 0),Be=A(!1),Je=null,It=null,ue=ct(()=>a()?`${e.adapter}`:`${e.adapter}@${e.instance}`),xe=ct(()=>s()??e.instance),Fe=ct(()=>{let we=null;if(o(fe)&&o(Ft))try{we=new RegExp(o(fe),"i")}catch{we=null}const tt=o(fe).toLowerCase();return o(ge).filter($=>o(je)!=="all"&&ye[$.level]<ye[o(je)]?!1:o(fe)?we?we.test($.msg):$.msg.toLowerCase().includes(tt):!0)});async function Ye(){p(Ae,""),p(dt,!0);try{p(ge,(await NK(u(),g(),e.instance,500)).entries,!0),nt()}catch(we){p(Ae,we.message??String(we),!0)}finally{p(dt,!1)}}function nt(){o(de)&&requestAnimationFrame(()=>{o(Te)&&(o(Te).scrollTop=o(Te).scrollHeight)})}async function yt(){if(!o(he))try{await xD(u(),g(),e.instance),p(he,!0),Je=Xo("serviceLog",we=>{we.host!==e.host||we.unit!==o(ue)||(p(ge,[...o(ge).slice(-(Ne-1)),{ts:we.ts,level:we.level,msg:we.msg,pid:we.pid??null}],!0),nt())}),It=setInterval(()=>{xD(u(),g(),e.instance).catch(()=>{})},300*1e3)}catch(we){p(Ae,we.message??String(we),!0),p(We,!1)}}function ci(){o(he)&&(p(he,!1),Je==null||Je(),Je=null,It&&(clearInterval(It),It=null),OK(u(),g(),e.instance).catch(()=>{}))}function Rt(){p(ge,[],!0)}cn(()=>{!o(d)||l()!=="logs"||o(Be)||(p(Be,!0),Ye())}),cn(()=>{o(Be)&&(o(We)?yt():ci())}),cn(()=>{o(de)&&nt()}),Os(()=>(o(d)&&G(),()=>ci()));function Ke(we){return we?new Date(we).toLocaleString():"—"}function vt(){const we=i();if(!we||we.started===null||!(we.connected&&we.connected>0))return"—";const tt=Math.max(0,Math.round((Date.now()-we.started)/1e3)),$=Math.floor(tt/86400),be=Math.floor(tt%86400/3600),Le=Math.floor(tt%3600/60);return $>0?`${$}d ${be}h`:be>0?`${be}h ${Le}m`:`${Le}m`}function Ze(){var tt;const we=(tt=i())==null?void 0:tt.connected;return we===2?"online (2)":we===1?"device offline (1)":we===0?"down (0)":"unknown"}var ee=tae(),ht=f(ee),qe=f(ht),Ue=f(qe),Z=f(Ue),Se=h(Ue);{var Oe=we=>{var tt=Pre();y(we,tt)};T(Se,we=>{a()&&we(Oe)})}var $t=h(Se,2),Ht=f($t),zt=h(Ht);{var Ut=we=>{var tt=kn();P(()=>B(tt,` @${i().version??""}`)),y(we,tt)};T(zt,we=>{var tt;(tt=i())!=null&&tt.version&&we(Ut)})}var et=h(zt),rt=h($t,2);{var w=we=>{var tt=Tre();let $;var be=f(tt);P(()=>{$=Xt(tt,1,"badge svelte-1zltuz",null,$,{ok:t().active==="active",err:t().active==="failed"}),xi(tt,"title",`systemd: ${t().active??""}/${t().sub??""}, ${t().unitFile??""}`),B(be,`${t().active??""}${t().unitFile==="disabled"?" · disabled":""}`)}),y(we,tt)};T(rt,we=>{t()&&we(w)})}var V=h(qe,2),Y=h(ht,2),oe=f(Y);{var Ee=we=>{var tt=Rre(),$=Dt(tt);let be;var Le=h($,2);{var at=He=>{var re=Mre();let X;P(()=>X=Xt(re,1,"svelte-1zltuz",null,X,{active:l()==="files"})),z("click",re,()=>l("files")),y(He,re)};T(Le,He=>{a()||He(at)})}var St=h(Le,2);let ke;P(()=>{be=Xt($,1,"svelte-1zltuz",null,be,{active:l()==="config"}),ke=Xt(St,1,"svelte-1zltuz",null,ke,{active:l()==="logs"})}),z("click",$,()=>l("config")),z("click",St,()=>l("logs")),y(we,tt)};T(oe,we=>{o(d)&&we(Ee)})}var lt=h(oe,2);let j;var Xe=h(lt,2);{var Ct=we=>{var tt=Nre(),$=f(tt);P(()=>B($,e.host===null?"host not managed — add it on the Adapters page, tab Hosts":"not installed on a managed host")),y(we,tt)};T(Xe,we=>{o(d)||we(Ct)})}var ce=h(Y,2);{var Qe=we=>{var tt=jre(),$=f(tt);{var be=at=>{var St=KC(),ke=f(St);P(()=>B(ke,`Loading ${a()?`/etc/default/${e.adapter}`:`/etc/${e.adapter}/${e.instance}.env`}…`)),y(at,St)},Le=at=>{var St=Wre(),ke=Dt(St);{var He=it=>{var Mt=Ore(),Jt=f(Mt);P(()=>B(Jt,o(O))),y(it,Mt)};T(ke,it=>{o(O)&&it(He)})}var re=h(ke,2);Z7(re,{get schema(){return o(C)},get secrets(){return o(m)},mode:"edit",get sheBroker(){return o(_)},get dynsec(){return o(E)},get env(){return o(x)},set env(it){p(x,it,!0)},get brokerMode(){return o(S)},set brokerMode(it){p(S,it,!0)}});var X=h(re,2),Ve=f(X),Me=f(Ve),Ce=h(Ve,2),Lt=h(Ce,2);{var ti=it=>{var Mt=Hre();P(()=>Mt.disabled=o(R)),z("click",Mt,()=>q(!0,!0)),y(it,Mt)};T(Lt,it=>{o(S)==="dynsec"&&o(I)==="dynsec"&&it(ti)})}var xt=h(Lt,2);{var ve=it=>{var Mt=zre(),Jt=f(Mt);P(()=>B(Jt,o(H))),y(it,Mt)};T(xt,it=>{o(H)&&it(ve)})}P(()=>{Ve.disabled=o(R),B(Me,o(R)?"Saving…":"Save"),Ce.disabled=o(R)}),z("click",Ve,()=>q(!1)),z("click",Ce,()=>q(!0)),y(at,St)};T($,at=>{o(M)?at(be):at(Le,-1)})}y(we,tt)},pt=we=>{{let tt=ct(u),$=ct(g);Ire(we,{get host(){return o(tt)},get adapter(){return o($)},get instance(){return e.instance},get onchanged(){return e.onchanged}})}},At=we=>{var tt=Gre(),$=Dt(tt),be=f($);gi(be,20,()=>te,se=>se,(se,De)=>{var pe=Vre(),gt=f(pe),U={};P(()=>{B(gt,De),U!==(U=De)&&(pe.value=(pe.__value=De)??"")}),y(se,pe)});var Le=h(be,2),at=h(Le,2),St=f(at),ke=h(at,2),He=f(ke),re=h(ke,2),X=f(re),Ve=h(re,2),Me=h(Ve,2),Ce=h($,2),Lt=f(Ce),ti=f(Lt),xt=h(Lt,2),ve=f(xt),it=h(ve);{var Mt=se=>{var De=kn();P(()=>B(De,` / ${o(ge).length??""}`)),y(se,De)};T(it,se=>{o(Fe).length!==o(ge).length&&se(Mt)})}var Jt=h(it,2);{var ft=se=>{var De=kn();De.nodeValue=" · following",y(se,De)};T(Jt,se=>{o(he)&&se(ft)})}var ut=h(xt,2);{var Bt=se=>{var De=$re(),pe=f(De);P(()=>B(pe,o(Ae))),y(se,De)};T(ut,se=>{o(Ae)&&se(Bt)})}var ei=h(Ce,2),J=f(ei);gi(J,17,()=>o(Fe),Ki,(se,De)=>{var pe=qre(),gt=f(pe),U=f(gt),ot=h(gt),W=f(ot),Q=h(ot),ae=f(Q);P((me,Ie)=>{Xt(pe,1,`line ${o(De).level??""}`,"svelte-1zltuz"),B(U,me),B(W,Ie),B(ae,o(De).msg)},[()=>lb(o(De).ts),()=>o(De).level.toUpperCase()]),y(se,pe)});var Re=h(J,2);{var ne=se=>{var De=Ure();y(se,De)};T(Re,se=>{o(ge).length===0&&!o(Ae)&&!o(dt)&&se(ne)})}ts(ei,se=>p(Te,se),()=>o(Te)),P(()=>{Ve.disabled=o(dt),B(ti,`journalctl -u ${o(ue)??""}`),B(ve,o(Fe).length)}),to(be,()=>o(je),se=>p(je,se)),ui(Le,()=>o(fe),se=>p(fe,se)),Ss(St,()=>o(Ft),se=>p(Ft,se)),Ss(He,()=>o(We),se=>p(We,se)),Ss(X,()=>o(de),se=>p(de,se)),z("click",Ve,Ye),z("click",Me,Rt),y(we,tt)},jt=we=>{var tt=eae(),$=h(f(tt),2);{var be=He=>{var re=Xre(),X=Dt(re),Ve=h(f(X)),Me=f(Ve),Ce=h(Me);{var Lt=qt=>{var Yt=kn();P(()=>B(Yt,` @${i().version??""}`)),y(qt,Yt)};T(Ce,qt=>{i().version&&qt(Lt)})}var ti=h(Ce);{var xt=qt=>{var Yt=Kre(),ni=f(Yt);P(()=>{xi(Yt,"title",`npm has ${i().latestVersion??""}`),B(ni,`update: ${i().latestVersion??""}`)}),y(qt,Yt)};T(ti,qt=>{i().updateAvailable&&qt(xt)})}var ve=h(Ve,3),it=f(ve),Mt=h(it);{var Jt=qt=>{var Yt=kn();P(ni=>B(Yt,` · since ${ni??""}`),[()=>Ke(i().connectedLc)]),y(qt,Yt)};T(Mt,qt=>{i().connectedLc&&qt(Jt)})}var ft=h(ve,3),ut=f(ft),Bt=h(ft,3),ei=f(Bt),J=h(ei);{var Re=qt=>{var Yt=kn();P(()=>B(Yt,` · pid ${i().pid??""}`)),y(qt,Yt)};T(J,qt=>{i().pid&&qt(Re)})}var ne=h(Bt,3),se=f(ne),De=h(ne,3),pe=f(De),gt=h(De,3),U=f(gt),ot=h(gt,3),W=f(ot),Q=h(ot,3),ae=f(Q),me=h(ae),Ie=f(me),st=h(Q,3),mt=f(st),Ot=h(X,2);{var Kt=qt=>{var Yt=Zre(),ni=Dt(Yt),Ai=f(ni),Pe=h(ni,2),$e=f(Pe);P(Gt=>{B(Ai,`${e.instance??""}/info`),B($e,Gt)},[()=>JSON.stringify(i().info,null,2)]),y(qt,Yt)},Wt=qt=>{var Yt=Yre(),ni=h(f(Yt)),Ai=f(ni),Pe=h(ni,2),$e=f(Pe);P(()=>{B(Ai,`${e.instance??""}/connected`),B($e,`${e.instance??""}/info`)}),y(qt,Yt)};T(Ot,qt=>{i().info?qt(Kt):qt(Wt,-1)})}P((qt,Yt,ni,Ai)=>{B(Me,i().adapter??"—"),B(it,qt),B(ut,Yt),B(ei,i().host??"—"),B(se,i().spec??"—"),B(pe,i().node??"—"),B(U,ni),B(W,i().legacy?"— (no maintenance topics)":i().maintenance?"enabled":"disabled (--no-maintenance)"),B(ae,`${i().statusTopics??""} retained under `),B(Ie,`${e.instance??""}/status/`),B(mt,Ai)},[()=>Ze(),()=>vt(),()=>Ke(i().started),()=>Ke(i().infoTs)]),y(He,re)},Le=He=>{var re=KC(),X=f(re);P(()=>B(X,`Not seen on MQTT (no retained ${e.instance??""}/connected or ${e.instance??""}/info yet).`)),y(He,re)};T($,He=>{i()?He(be):He(Le,-1)})}var at=h($,4);{var St=He=>{var re=Jre(),X=h(f(re)),Ve=f(X),Me=h(Ve);{var Ce=se=>{var De=Qre();y(se,De)};T(Me,se=>{a()&&se(Ce)})}var Lt=h(X,3),ti=f(Lt),xt=h(ti);{var ve=se=>{var De=kn();P(()=>B(De,` · hostname ${n()??""}`)),y(se,De)};T(xt,se=>{n()&&n()!==e.host&&se(ve)})}var it=h(Lt,3),Mt=f(it),Jt=h(it,3),ft=f(Jt),ut=h(Jt,3),Bt=f(ut),ei=h(ut,3),J=f(ei),Re=h(ei,3),ne=f(Re);P(()=>{B(Ve,`${o(ue)??""}.service`),B(ti,e.host),B(Mt,`${t().active??""} / ${t().sub??""} · ${t().unitFile??""}`),B(ft,t().since||"—"),B(Bt,t().restarts),B(J,a()?`/etc/default/${t().adapter}`:`/etc/${t().adapter}/${e.instance}.env`),B(ne,a()?`/var/lib/${t().adapter}/`:`/var/lib/${t().adapter}/${e.instance}/`)}),y(He,re)},ke=He=>{var re=KC(),X=f(re);P(()=>B(X,e.host===null?"Not installed on a managed host — or the host is not configured on the Adapters page, tab Hosts.":"No systemd unit for this instance on the managed host.")),y(He,re)};T(at,He=>{t()?He(St):He(ke,-1)})}y(we,tt)};T(ce,we=>{l()==="config"?we(Qe):l()==="files"&&o(d)?we(pt,1):l()==="logs"?we(At,2):we(jt,-1)})}P(()=>{var we;B(Z,o(xe)),B(Ht,e.adapter??((we=i())!=null&&we.legacy?"unmanaged":"")),B(et,` · ${e.host??n()??"not managed"??""}`),j=Xt(lt,1,"svelte-1zltuz",null,j,{active:l()==="info"})}),z("click",V,function(...we){var tt;(tt=e.onclose)==null||tt.apply(this,we)}),z("click",lt,()=>l("info")),y(r,ee),cs()}ms(["click"]);const hl=(r,e=ar)=>{var t=fae(),i=f(t);{var n=C=>{var _=sae();y(C,_)},s=C=>{var _=oae();y(C,_)},a=C=>{var _=rae();y(C,_)},l=C=>{var _=aae();y(C,_)},d=C=>{var _=lae();y(C,_)},u=C=>{var _=cae();y(C,_)},g=C=>{var _=dae();y(C,_)},x=C=>{var _=uae();y(C,_)},m=C=>{var _=hae();y(C,_)};T(i,C=>{e()==="config"?C(n):e()==="info"?C(s,1):e()==="restart"?C(a,2):e()==="start"?C(l,3):e()==="stop"?C(d,4):e()==="enable"?C(u,5):e()==="migrate"?C(g,6):e()==="wipe"?C(x,7):e()==="uninstall"&&C(m,8)})}y(r,t)};var nae=k('<button> <span class="arrow svelte-1dadwjh"> </span></button>'),sae=Wo('<line x1="2" y1="5" x2="14" y2="5"></line><circle cx="6" cy="5" r="1.8" fill="var(--bg-app)"></circle><line x1="2" y1="11" x2="14" y2="11"></line><circle cx="10.5" cy="11" r="1.8" fill="var(--bg-app)"></circle>',1),oae=Wo('<circle cx="8" cy="8" r="6.2"></circle><line x1="8" y1="7.4" x2="8" y2="11"></line><line x1="8" y1="4.9" x2="8" y2="4.9"></line>',1),rae=Wo('<path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.4 10.5,4 13.1,4"></polyline>',1),aae=Wo('<path d="M5 3.2 12.5 8 5 12.8Z" fill="currentColor"></path>'),lae=Wo('<rect x="4" y="4" width="8" height="8" rx="1" fill="currentColor"></rect>'),cae=Wo('<line x1="8" y1="2" x2="8" y2="7.5"></line><path d="M11.9 4.4a5.5 5.5 0 1 1-7.8 0"></path>',1),dae=Wo('<line x1="2" y1="8" x2="11.5" y2="8"></line><polyline points="8,4.5 11.5,8 8,11.5"></polyline><path d="M13.5 3v10"></path>',1),uae=Wo('<line x1="2.5" y1="4.2" x2="13.5" y2="4.2"></line><path d="M6 4.2V2.6h4v1.6"></path><path d="M4.2 4.2 4.9 13.4h6.2l.7-9.2"></path>',1),hae=Wo('<line x1="3" y1="3" x2="13" y2="13"></line><line x1="13" y1="3" x2="3" y2="13"></line>',1),fae=Wo('<svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="svelte-1dadwjh"><!></svg>'),pae=k('<button class="ghost sm svelte-1dadwjh" title="Clear the column filters">clear filters</button>'),gae=k('<span class="result svelte-1dadwjh"> </span>'),vae=k(' <code class="svelte-1dadwjh">sudo she --install</code>',1),xae=k("<span>host <strong> </strong> <!></span>"),mae=k('<div class="bar warn-bar svelte-1dadwjh"></div>'),_ae=k('<div class="info svelte-1dadwjh">Loading…</div>'),bae=k('<div class="info err svelte-1dadwjh"> </div>'),Cae=k(' <code class="svelte-1dadwjh">&lt;name&gt;/connected</code> topic; tick <em>show unmanaged</em>)',1),yae=k('<div class="info svelte-1dadwjh">No xyz2mqtt services seen<!>. Adapters built on <a href="https://github.com/hobbyquaker/mqtt-interfaces-core" target="_blank" rel="noopener" class="svelte-1dadwjh">mqtt-interfaces-core</a> publish a retained <code class="svelte-1dadwjh">&lt;name&gt;/info</code> and <code class="svelte-1dadwjh">&lt;name&gt;/connected</code>; anything publishing just <code class="svelte-1dadwjh">&lt;name&gt;/connected</code> — an ESPHome device, a script, a pre-core adapter — shows up as <em>unmanaged</em>. Instances installed on a managed host appear even before they connect.</div>'),wae=k('<div class="info svelte-1dadwjh">No instances match.</div>'),Eae=k('<span class="badge b-legacy svelte-1dadwjh" title="Only a &lt;name>/connected topic and no &lt;name>/info — version, uptime and stats stay unknown">no info</span>'),Sae=k('<span class="badge b-upd svelte-1dadwjh">old unit</span>'),kae=k('<span class="badge b-legacy svelte-1dadwjh">not on MQTT</span>'),Dae=k('<span class="mono svelte-1dadwjh"> </span>'),HA=k('<span class="muted svelte-1dadwjh">—</span>'),Aae=k('<span class="badge b-host svelte-1dadwjh"> </span>'),Bae=k('<span class="badge b-unmanaged svelte-1dadwjh">unmanaged</span>'),zA=k('<span class="muted svelte-1dadwjh"> </span>'),Fae=k('<span class="muted svelte-1dadwjh">· disabled</span>'),Lae=k('<select class="lvl svelte-1dadwjh"><option>set…</option><option>error</option><option>warn</option><option>info</option><option>debug</option></select>'),Iae=k('<span class="muted svelte-1dadwjh" title="--no-maintenance">disabled</span>'),Pae=k('<button class="ghost sm svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Config / Logs</span></button>'),Tae=k('<button class="ghost sm svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Info</span></button>'),WA=k('<button class="ghost sm w-run svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Restart</span></button>'),Mae=k('<button class="ghost sm w-run svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Start</span></button>'),Rae=k('<button class="ghost sm w-halt svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Stop</span></button>'),Nae=k('<button class="ghost sm svelte-1dadwjh" title="Start at boot"><!><span class="lbl svelte-1dadwjh">Enable</span></button>'),Oae=k('<button class="ghost sm svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Migrate</span></button>'),Hae=k(`<button class="ghost sm w-halt svelte-1dadwjh" title="Clear the instance's retained topics"><!><span class="lbl svelte-1dadwjh">Wipe</span></button>`),zae=k('<button class="ghost sm danger-text svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Uninstall</span></button>'),Wae=k('<tr><td class="svelte-1dadwjh"><button class="dname dname-link svelte-1dadwjh"> </button> <!> <!> <!></td><td class="svelte-1dadwjh"><!></td><td class="svelte-1dadwjh"> <!> <!></td><td class="svelte-1dadwjh"><span></span> <!> <!></td><td class="c-up svelte-1dadwjh"> </td><td class="num c-mem svelte-1dadwjh"> </td><td class="num c-cpu svelte-1dadwjh"> </td><td> </td><td class="svelte-1dadwjh"><!></td><td class="c-act svelte-1dadwjh"><span class="acts svelte-1dadwjh"><!> <!> <!> <!> <!> <!></span></td><td class="w-fill svelte-1dadwjh"></td></tr>'),jae=k('<div class="table-wrap svelte-1dadwjh"><table class="svelte-1dadwjh"><colgroup><col class="w-inst svelte-1dadwjh"/><col class="w-adapter svelte-1dadwjh"/><col class="w-host svelte-1dadwjh"/><col class="w-state svelte-1dadwjh"/><col class="w-up svelte-1dadwjh"/><col class="w-mem svelte-1dadwjh"/><col class="w-cpu svelte-1dadwjh"/><col class="w-ell svelte-1dadwjh"/><col class="w-lvl svelte-1dadwjh"/><col class="w-act svelte-1dadwjh"/><col/></colgroup><thead><tr><th class="svelte-1dadwjh"><!></th><th class="svelte-1dadwjh"><!></th><th class="svelte-1dadwjh"><!></th><th title="Sorted worst first: down, then device offline, then online" class="svelte-1dadwjh"><!></th><th class="c-up svelte-1dadwjh">Uptime</th><th class="num c-mem svelte-1dadwjh" title="resident memory — reported by the adapter (core 0.8+) or by systemd on the host">Mem</th><th class="num c-cpu svelte-1dadwjh" title="share of one core — reported by the adapter over its stats interval, or from systemd between two host listings">CPU</th><th class="num c-ell svelte-1dadwjh" title="event loop lag — the peak the adapter measured over its stats interval (core 0.8+); no systemd fallback">EL lag</th><th class="svelte-1dadwjh">Log level</th><th class="c-act svelte-1dadwjh"></th><th class="w-fill svelte-1dadwjh"></th></tr><tr class="filter-row svelte-1dadwjh"><th class="svelte-1dadwjh"><input class="col-f svelte-1dadwjh" type="search" placeholder="filter…" aria-label="Filter by instance"/></th><th class="svelte-1dadwjh"><input class="col-f svelte-1dadwjh" type="search" placeholder="filter…" aria-label="Filter by adapter"/></th><th class="svelte-1dadwjh"><!></th><th class="svelte-1dadwjh"><!></th><th colspan="7" class="svelte-1dadwjh"></th></tr></thead><tbody></tbody></table></div>'),Vae=k('<div class="drawer svelte-1dadwjh"><!></div>'),$ae=k('<div class="drawer-resize-handle svelte-1dadwjh" role="separator" aria-orientation="vertical"></div> <!>',1),qae=k('<!> <!> <div><div class="main svelte-1dadwjh"><div class="bar svelte-1dadwjh"><input class="filter-in svelte-1dadwjh" type="search" placeholder="Filter instances…"/> <button class="ghost svelte-1dadwjh" title="Reload, asking every host again"><span>↺</span></button> <span class="count svelte-1dadwjh"> <!> </span> <!> <label class="chk svelte-1dadwjh" title="Topics with only a &lt;name>/connected and no &lt;name>/info — pre-core adapters, but also ESPHome devices and the like"><input type="checkbox" class="svelte-1dadwjh"/> <span class="checkmark svelte-1dadwjh"></span> </label> <span class="bar-hint svelte-1dadwjh">To add an instance click <em class="svelte-1dadwjh">+ instance</em> on the Installations tab</span> <span class="spacer svelte-1dadwjh"></span> <!></div> <!> <!></div> <!></div>',1);function Uae(r,e){ls(e,!0);const t=(J,Re=ar,ne=ar)=>{var se=nae();let De;var pe=f(se),gt=h(pe),U=f(gt);P(()=>{De=Xt(se,1,"sort svelte-1dadwjh",null,De,{on:o(q)===Re()}),B(pe,ne()),B(U,o(q)===Re()?o(te)===1?"▲":"▼":"")}),z("click",se,()=>ye(Re())),y(J,se)};let i=$n(e,"generation",3,0),n=$n(e,"origin",3,null),s=A(null),a=A(Ci([])),l=A(Ci([])),d=A(!1),u=A(null),g=A("");const x="she-services-show-legacy";let m=A(localStorage.getItem(x)==="1");cn(()=>{localStorage.setItem(x,o(m)?"1":"0")});let C=A(Ci(new Set)),_=A(null),E=A(Ci(Date.now())),S=A(!1);async function I(J=!1){p(d,!0),p(S,o(S)||J,!0),p(u,null);try{const[Re,ne]=await Promise.all([D7(),pa(J).catch(()=>({hosts:[]}))]);p(a,Re.instances,!0),p(l,ne.hosts,!0)}catch(Re){p(u,Re instanceof Error?Re.message:String(Re),!0)}finally{p(d,!1),p(S,!1)}}let M=null;function O(){M&&clearTimeout(M),M=setTimeout(()=>{M=null,I()},400)}Os(()=>{I();const J=Xo("mqtt",ne=>{const De=(typeof ne.topic=="string"?ne.topic:"").split("/");De.length===2&&(De[1]==="info"||De[1]==="connected")&&O()}),Re=setInterval(()=>{p(E,Date.now(),!0)},1e4);return()=>{J(),clearInterval(Re),M&&clearTimeout(M)}});let R=0;cn(()=>{const J=i();J!==R&&(R=J,Ho(()=>{n()!=="instances"&&I(!0)}))});let H=ct(()=>{var Re;const J=new Map;for(const ne of o(a))J.set(ne.instance,{key:ne.instance,instance:ne.instance,adapter:ne.adapter,mqtt:ne,host:null,unit:null});for(const ne of o(l))if(ne.ok){for(const se of ne.instances??[]){const De=J.get(se.instance),pe=!((Re=De==null?void 0:De.mqtt)!=null&&Re.host)||De.mqtt.host===ne.hostname||ne.local&&!De.mqtt.host;if(De&&!De.unit&&(!De.mqtt||De.mqtt.adapter===se.adapter||De.mqtt.legacy)&&pe)De.host=ne,De.unit=se,De.adapter||(De.adapter=se.adapter);else{const gt=`${se.instance}@${ne.name}`;J.set(gt,{key:gt,instance:se.instance,adapter:se.adapter,mqtt:null,host:ne,unit:se})}}for(const se of ne.legacy??[]){const De={adapter:se.adapter,instance:mS,active:se.active,sub:se.sub,unitFile:se.unitFile,since:se.since,restarts:se.restarts},pe=[...J.values()].find(gt=>!gt.unit&&gt.mqtt&&gt.mqtt.adapter===se.adapter&&(!gt.mqtt.host||gt.mqtt.host===ne.hostname));if(pe)pe.host=ne,pe.unit=De,pe.legacy=!0;else{const gt=`${se.adapter}.service@${ne.name}`;J.set(gt,{key:gt,instance:se.adapter,adapter:se.adapter,mqtt:null,host:ne,unit:De,legacy:!0})}}}return[...J.values()].sort((ne,se)=>ne.instance.localeCompare(se.instance))}),G=ct(()=>o(H).filter(J=>{var Re;return((Re=J.mqtt)==null?void 0:Re.legacy)&&!J.unit}).length),q=A("instance"),te=A(1);function ye(J){o(q)===J?p(te,o(te)===1?-1:1,!0):(p(q,J,!0),p(te,1))}let Ne=A(""),ge=A(""),Ae=A(Ci([])),dt=A(Ci([]));const he=ct(()=>!!o(Ne)||!!o(ge)||o(Ae).length>0||o(dt).length>0),We=J=>{var Re,ne,se;return((Re=J.mqtt)==null?void 0:Re.host)??((ne=J.host)==null?void 0:ne.hostname)??((se=J.host)==null?void 0:se.name)??""},de=J=>w(J).label,je={err:0,warn:1,ok:2,none:3};let fe=ct(()=>o(m)?o(H):o(H).filter(J=>{var Re;return!((Re=J.mqtt)!=null&&Re.legacy&&!J.unit)})),Ft=ct(()=>[...new Set(o(fe).map(We).filter(Boolean))].sort((J,Re)=>J.localeCompare(Re))),Te=ct(()=>[...new Set(o(fe).map(de))].sort((J,Re)=>J.localeCompare(Re))),Be=ct(()=>{const J=o(g).trim().toLowerCase(),Re=o(Ne).trim().toLowerCase();let ne=o(fe);J&&(ne=ne.filter(pe=>{var gt,U,ot;return pe.instance.toLowerCase().includes(J)||(pe.adapter??"").toLowerCase().includes(J)||(((gt=pe.mqtt)==null?void 0:gt.host)??((U=pe.host)==null?void 0:U.hostname)??"").toLowerCase().includes(J)||(((ot=pe.mqtt)==null?void 0:ot.version)??"").toLowerCase().includes(J)}));const se=o(ge).trim().toLowerCase();Re&&(ne=ne.filter(pe=>pe.instance.toLowerCase().includes(Re))),se&&(ne=ne.filter(pe=>(pe.adapter??"").toLowerCase().includes(se))),o(Ae).length&&(ne=ne.filter(pe=>o(Ae).includes(We(pe)))),o(dt).length&&(ne=ne.filter(pe=>o(dt).includes(de(pe))));const De=(pe,gt)=>{switch(o(q)){case"adapter":return(pe.adapter??"").localeCompare(gt.adapter??"");case"host":return We(pe).localeCompare(We(gt));case"state":{const U=je[w(pe).cls]-je[w(gt).cls];return U!==0?U:de(pe).localeCompare(de(gt))}default:return 0}};return[...ne].sort((pe,gt)=>(De(pe,gt)||pe.instance.localeCompare(gt.instance))*o(te))}),Je=ct(()=>o(l).filter(J=>!J.ok&&J.code!=="UNSUPPORTED"));const It=4,ue=16;let xe=A(null),Fe=A(0);cn(()=>{o(Be);const J=o(xe);if(!J)return;let Re=0;for(const ne of J.querySelectorAll(".acts")){const se=[...ne.children];if(!se.length)continue;const De=se.reduce((pe,gt)=>pe+gt.getBoundingClientRect().width,0)+It*(se.length-1);Re=Math.max(Re,De)}Re&&p(Fe,Math.ceil(Re)+ue)}),cn(()=>{if(!e.onstatus)return;if(o(fe).length===0){e.onstatus("none","");return}const J=o(fe).filter(ne=>{var se;return ne.mqtt?ne.mqtt.connected===0||ne.mqtt.connected===null:((se=ne.unit)==null?void 0:se.active)!=="active"}).map(ne=>ne.instance),Re=o(fe).filter(ne=>{var se;return((se=ne.mqtt)==null?void 0:se.connected)===1}).map(ne=>ne.instance);J.length?e.onstatus("err",`Down: ${J.join(", ")}`):Re.length?e.onstatus("warn",`Device offline: ${Re.join(", ")}`):e.onstatus("ok",`${o(fe).length} service${o(fe).length===1?"":"s"} online`)});let Ye=A(null),nt=A("config"),yt=ct(()=>o(Ye)===null?null:o(H).find(J=>J.key===o(Ye))??null);function ci(J){p(Ye,J.key,!0)}const Rt="she-services-drawer-width";let Ke=A(Ci(Math.max(360,Math.min(1200,Number(localStorage.getItem(Rt))||560)))),vt=A(!1),Ze=0,ee=0;function ht(J){p(vt,!0),Ze=J.clientX,ee=o(Ke),J.preventDefault()}function qe(J){o(vt)&&p(Ke,Math.max(360,Math.min(Math.max(360,window.innerWidth-320),ee-(J.clientX-Ze))),!0)}function Ue(){o(vt)&&(p(vt,!1),localStorage.setItem(Rt,String(o(Ke))))}function Z(J,Re){const ne=new Set(o(C));Re?ne.add(J):ne.delete(J),p(C,ne,!0)}async function Se(J,Re,ne,se,{tellOthers:De=!1}={}){var pe;Z(J.key,!0),p(_,null);try{await ne(),p(_,se,!0),setTimeout(I,600),De&&((pe=e.onchanged)==null||pe.call(e))}catch(gt){p(_,`${Re} failed: ${gt instanceof Error?gt.message:String(gt)}`)}finally{Z(J.key,!1)}}async function Oe(J){if(await o(s).show(`Restart ${J.instance} (${J.adapter})?`,{confirm:"Restart"}))return J.host&&J.unit?Se(J,"Restart",()=>vD(J.host.name,J.unit.adapter,J.instance,"restart"),`systemctl restart ${J.unit.adapter}@${J.instance} on ${J.host.name}.`):Se(J,"Restart",()=>DK(J.instance),`Restart requested for ${J.instance} over MQTT.`)}function $t(J,Re){if(!(!J.host||!J.unit))return Se(J,Re,()=>vD(J.host.name,J.unit.adapter,J.instance,Re),`${Re}: ${J.unit.adapter}@${J.instance} on ${J.host.name}.`)}async function Ht(J,Re){return Se(J,"Log level",()=>AK(J.instance,Re),`${J.instance}: log level ${Re} (until the next restart).`)}let zt=A(null);async function Ut(J){var ne;if(!J.host||!J.unit||!J.legacy)return;const Re=await o(zt).show(`Turn ${J.unit.adapter}.service into a proper instance ${J.unit.adapter}@<name>. The adapter's own --install runs with the current settings (state such as logins or pairing keys is carried over by the adapter), then the old unit is disabled and its files are kept as .migrated. Instance name = the MQTT topic prefix:`,{initial:((ne=J.mqtt)==null?void 0:ne.instance)??"",placeholder:"instance name",confirm:"Migrate"});if(Re)return Se(J,"Migrate",()=>LK(J.host.name,J.unit.adapter,Re.trim()),`${J.unit.adapter}.service migrated to ${J.unit.adapter}@${Re.trim()} on ${J.host.name}.`,{tellOthers:!0})}async function et(J){if(!(!J.host||!J.unit||!await o(s).show(`Uninstall ${J.unit.adapter}@${J.instance} from ${J.host.name}? The unit is stopped, disabled and removed together with /etc/${J.unit.adapter}/${J.instance}.env; the state directory /var/lib/${J.unit.adapter}/${J.instance} is kept. Retained MQTT topics can be wiped afterwards.`,{confirm:"Uninstall",danger:!0})))return o(Ye)===J.key&&p(Ye,null),Se(J,"Uninstall",()=>RK(J.host.name,J.unit.adapter,J.instance),`${J.unit.adapter}@${J.instance} removed from ${J.host.name}.`,{tellOthers:!0})}async function rt(J){Z(J.key,!0),p(_,null);try{const Re=await BK(J.instance),ne=Re.own.length+Re.discovery.length;if(ne===0){p(_,`Nothing retained for ${J.instance}.`);return}if(!await o(s).show(`Clear ${ne} retained topic${ne===1?"":"s"} of ${J.instance}: ${Re.own.length} status/info/connected`+(Re.discovery.length?` and ${Re.discovery.length} Home Assistant discovery announcement${Re.discovery.length===1?"":"s"}`:"")+"? Only do this when the instance is gone for good — a running adapter would republish them anyway.",{confirm:"Clear retained topics",danger:!0}))return;const De=await FK(J.instance,!0);p(_,De.ok?`Cleared ${De.cleared} retained topics of ${J.instance}.`:`Cleared ${De.cleared}, ${De.errors.length} failed.`,!0),setTimeout(I,400)}catch(Re){p(_,Re instanceof Error?Re.message:String(Re),!0)}finally{Z(J.key,!1)}}function w(J){const Re=J.mqtt;return(Re==null?void 0:Re.connected)===2?{cls:"ok",label:"online"}:(Re==null?void 0:Re.connected)===1?{cls:"warn",label:"device offline"}:(Re==null?void 0:Re.connected)===0?{cls:"err",label:"down"}:!Re&&J.unit?J.unit.active==="active"?{cls:"warn",label:"running, not on MQTT"}:{cls:"err",label:J.unit.active}:{cls:"err",label:"unknown"}}function V(J){return!!J.mqtt&&!J.mqtt.legacy&&J.mqtt.maintenance&&!!J.mqtt.connected&&J.mqtt.connected>0}function Y(J){const Re=J.mqtt;if(!Re||Re.started===null||!(Re.connected&&Re.connected>0))return"—";const ne=Math.max(0,Math.round((o(E)-Re.started)/1e3)),se=Math.floor(ne/86400),De=Math.floor(ne%86400/3600),pe=Math.floor(ne%3600/60);return se>0?`${se}d ${De}h`:De>0?`${De}h ${pe}m`:`${pe}m`}function oe(J){if(!J)return"";const Re=Math.max(0,Math.round((o(E)-J)/1e3));return Re<60?`${Re}s ago`:Re<3600?`${Math.floor(Re/60)}m ago`:Re<86400?`${Math.floor(Re/3600)}h ago`:`${Math.floor(Re/86400)}d ago`}function Ee(J){return J<1024*1024?`${Math.round(J/1024)} kB`:J<1024*1024*1024?`${(J/1024/1024).toFixed(J<10*1024*1024?1:0)} MB`:`${(J/1024/1024/1024).toFixed(2)} GB`}function lt(J){return J?new Date(J).toLocaleString():""}var j=qae();ws("mousemove",wa,qe),ws("mouseup",wa,Ue);var Xe=Dt(j);ts(kr(Xe,{}),J=>p(s,J,!0),()=>o(s));var Ct=h(Xe,2);ts(d2(Ct,{}),J=>p(zt,J,!0),()=>o(zt));var ce=h(Ct,2);let Qe;var pt=f(ce),At=f(pt),jt=f(At),we=h(jt,2),tt=f(we);let $;var be=h(we,2),Le=f(be),at=h(Le);{var St=J=>{var Re=kn();P(()=>B(Re,` / ${o(fe).length??""}`)),y(J,Re)};T(at,J=>{(o(g)||o(he))&&J(St)})}var ke=h(at),He=h(be,2);{var re=J=>{var Re=pae();z("click",Re,()=>{p(Ne,""),p(ge,""),p(Ae,[],!0),p(dt,[],!0)}),y(J,Re)};T(He,J=>{o(he)&&J(re)})}var X=h(He,2),Ve=f(X),Me=h(Ve,3),Ce=h(X,6);{var Lt=J=>{var Re=gae(),ne=f(Re);P(()=>B(ne,o(_))),y(J,Re)};T(Ce,J=>{o(_)&&J(Lt)})}var ti=h(At,2);{var xt=J=>{var Re=mae();gi(Re,21,()=>o(Je),ne=>ne.name,(ne,se)=>{var De=xae(),pe=h(f(De)),gt=f(pe),U=h(pe),ot=h(U);{var W=Q=>{var ae=vae(),me=Dt(ae);me.nodeValue=" — run ",y(Q,ae)};T(ot,Q=>{o(se).code==="HELPER_MISSING"&&Q(W)})}P(()=>{B(gt,o(se).name),B(U,`: ${o(se).error??""}`)}),y(ne,De)}),y(J,Re)};T(ti,J=>{o(Je).length&&J(xt)})}var ve=h(ti,2);{var it=J=>{var Re=_ae();y(J,Re)},Mt=J=>{var Re=bae(),ne=f(Re);P(()=>B(ne,o(u))),y(J,Re)},Jt=J=>{var Re=yae(),ne=h(f(Re));{var se=De=>{var pe=Cae(),gt=Dt(pe);P(()=>B(gt,` — ${o(G)??""} unmanaged row${o(G)===1?"":"s"} hidden (only a `)),y(De,pe)};T(ne,De=>{o(G)>0&&De(se)})}y(J,Re)},ft=J=>{var Re=wae();y(J,Re)},ut=J=>{var Re=jae(),ne=f(Re),se=f(ne),De=h(f(se),9);let pe;var gt=h(se),U=f(gt),ot=f(U),W=f(ot);t(W,()=>"instance",()=>"Instance");var Q=h(ot),ae=f(Q);t(ae,()=>"adapter",()=>"Adapter");var me=h(Q),Ie=f(me);t(Ie,()=>"host",()=>"Host");var st=h(me),mt=f(st);t(mt,()=>"state",()=>"State");var Ot=h(U),Kt=f(Ot),Wt=f(Kt),qt=h(Kt),Yt=f(qt),ni=h(qt),Ai=f(ni);hA(Ai,{get options(){return o(Ft)},noun:"hosts",title:"Show only these hosts",get selected(){return o(Ae)},set selected(ai){p(Ae,ai,!0)}});var Pe=h(ni),$e=f(Pe);hA($e,{get options(){return o(Te)},noun:"states",title:"Show only these states",get selected(){return o(dt)},set selected(ai){p(dt,ai,!0)}});var Gt=h(gt);gi(Gt,21,()=>o(Be),ai=>ai.key,(ai,_e)=>{const Vt=ct(()=>w(o(_e))),_t=ct(()=>{var Ii;return(Ii=o(_e).mqtt)==null?void 0:Ii.stats});var bt=Wae();let Pt;var hi=f(bt),Et=f(hi),kt=f(Et),di=h(Et,2);{var ki=Ii=>{var Ei=Eae();y(Ii,Ei)};T(di,Ii=>{var Ei;(Ei=o(_e).mqtt)!=null&&Ei.legacy&&o(_e).host&&Ii(ki)})}var _i=h(di,2);{var Fi=Ii=>{var Ei=Sae();P(()=>{var gn;return xi(Ei,"title",`Runs as ${((gn=o(_e).unit)==null?void 0:gn.adapter)??""}.service (pre-core unit, env in /etc/default) — migrate it to a template instance`)}),y(Ii,Ei)};T(_i,Ii=>{o(_e).legacy&&Ii(Fi)})}var Nt=h(_i,2);{var ri=Ii=>{var Ei=kae();P(()=>{var gn;return xi(Ei,"title",`Installed on ${((gn=o(_e).host)==null?void 0:gn.name)??""} but nothing retained on MQTT yet`)}),y(Ii,Ei)};T(Nt,Ii=>{!o(_e).mqtt&&o(_e).unit&&Ii(ri)})}var bi=h(hi),Oi=f(bi);{var wi=Ii=>{var Ei=Dae(),gn=f(Ei);P(()=>B(gn,o(_e).adapter)),y(Ii,Ei)},Ji=Ii=>{var Ei=HA();y(Ii,Ei)};T(Oi,Ii=>{o(_e).adapter?Ii(wi):Ii(Ji,-1)})}var en=h(bi),Cn=f(en),tn=h(Cn);{var Mi=Ii=>{var Ei=ks(),gn=Dt(Ei);{var ds=Mo=>{var Eo=Aae(),bs=f(Eo);P(()=>{var Fo,sr,ta;xi(Eo,"title",`managed via ${o(_e).host.name??""}: systemd ${((Fo=o(_e).unit)==null?void 0:Fo.active)??""}/${((sr=o(_e).unit)==null?void 0:sr.sub)??""}, ${((ta=o(_e).unit)==null?void 0:ta.unitFile)??""}`),B(bs,o(_e).host.hostname??o(_e).host.name)}),y(Mo,Eo)};T(gn,Mo=>{var Eo;(o(_e).host.hostname??o(_e).host.name)!==(((Eo=o(_e).mqtt)==null?void 0:Eo.host)??o(_e).host.hostname)&&Mo(ds)})}y(Ii,Ei)},An=Ii=>{var Ei=Bae();P(()=>{var gn;return xi(Ei,"title",(gn=o(_e).mqtt)!=null&&gn.legacy?"Only a <name>/connected topic — she sees it come and go, nothing more (ESPHome devices and the like publish one too)":"The host this runs on is not configured on the Hosts tab — no systemd control, no logs, no config from here")}),y(Ii,Ei)};T(tn,Ii=>{o(_e).host?Ii(Mi):Ii(An,-1)})}var on=h(tn,2);{var sn=Ii=>{var Ei=zA(),gn=f(Ei);P(()=>B(gn,`· pid ${o(_e).mqtt.pid??""}`)),y(Ii,Ei)};T(on,Ii=>{var Ei;(Ei=o(_e).mqtt)!=null&&Ei.pid&&Ii(sn)})}var zn=h(en),wn=f(zn),_s=h(wn),Gs=h(_s);{var $s=Ii=>{var Ei=zA(),gn=f(Ei);P(ds=>B(gn,ds),[()=>oe(o(_e).mqtt.connectedLc)]),y(Ii,Ei)};T(Gs,Ii=>{var Ei;((Ei=o(_e).mqtt)==null?void 0:Ei.connected)===0&&o(_e).mqtt.connectedLc&&Ii($s)})}var vi=h(Gs,2);{var Bi=Ii=>{var Ei=Fae();y(Ii,Ei)};T(vi,Ii=>{o(_e).unit&&o(_e).unit.unitFile==="disabled"&&Ii(Bi)})}var Ti=h(zn),Wi=f(Ti),rn=h(Ti),mi=f(rn),Ri=h(rn),Ni=f(Ri),Zi=h(Ri);let $i;var ji=f(Zi),_n=h(Zi),un=f(_n);{var En=Ii=>{var Ei=Lae(),gn=f(Ei);gn.value=gn.__value="";var ds=h(gn);ds.value=ds.__value="error";var Mo=h(ds);Mo.value=Mo.__value="warn";var Eo=h(Mo);Eo.value=Eo.__value="info";var bs=h(Eo);bs.value=bs.__value="debug",P(Fo=>Ei.disabled=Fo,[()=>o(C).has(o(_e).key)]),z("change",Ei,Fo=>{const sr=Fo.target.value;sr&&(Ht(o(_e),sr),Fo.target.value="")}),y(Ii,Ei)},Bn=ct(()=>V(o(_e))),bn=Ii=>{var Ei=Iae();y(Ii,Ei)},dn=Ii=>{var Ei=HA();y(Ii,Ei)};T(un,Ii=>{o(Bn)?Ii(En):o(_e).mqtt&&!o(_e).mqtt.legacy&&!o(_e).mqtt.maintenance?Ii(bn,1):Ii(dn,-1)})}var hn=h(_n),Sn=f(hn),As=f(Sn);{var Wn=Ii=>{var Ei=Pae(),gn=f(Ei);hl(gn,()=>"config"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>ci(o(_e))),y(Ii,Ei)},Nn=Ii=>{var Ei=Tae(),gn=f(Ei);hl(gn,()=>"info"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>ci(o(_e))),y(Ii,Ei)};T(As,Ii=>{o(_e).host&&o(_e).unit?Ii(Wn):Ii(Nn,-1)})}var Jn=h(As,2);{var qs=Ii=>{var Ei=WA(),gn=f(Ei);hl(gn,()=>"restart"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>Oe(o(_e))),y(Ii,Ei)},Qs=Ii=>{var Ei=Mae(),gn=f(Ei);hl(gn,()=>"start"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>$t(o(_e),"start")),y(Ii,Ei)},Tn=Ii=>{var Ei=WA(),gn=f(Ei);hl(gn,()=>"restart"),P(ds=>{Ei.disabled=ds,xi(Ei,"title",`via ${o(_e).instance??""}/maintenance/set/restart`)},[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>Oe(o(_e))),y(Ii,Ei)},Bs=ct(()=>V(o(_e)));T(Jn,Ii=>{o(_e).host&&o(_e).unit&&o(_e).unit.active==="active"?Ii(qs):o(_e).host&&o(_e).unit?Ii(Qs,1):o(Bs)&&Ii(Tn,2)})}var no=h(Jn,2);{var fo=Ii=>{var Ei=Rae(),gn=f(Ei);hl(gn,()=>"stop"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>$t(o(_e),"stop")),y(Ii,Ei)};T(no,Ii=>{o(_e).host&&o(_e).unit&&o(_e).unit.active==="active"&&Ii(fo)})}var Ks=h(no,2);{var jo=Ii=>{var Ei=Nae(),gn=f(Ei);hl(gn,()=>"enable"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>$t(o(_e),"enable")),y(Ii,Ei)},Wl=Ii=>{var Ei=Oae(),gn=f(Ei);hl(gn,()=>"migrate"),P(ds=>{Ei.disabled=ds,xi(Ei,"title",`Turn the old ${o(_e).unit.adapter??""}.service into ${o(_e).unit.adapter??""}@<name>`)},[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>Ut(o(_e))),y(Ii,Ei)};T(Ks,Ii=>{o(_e).host&&o(_e).unit&&o(_e).unit.unitFile==="disabled"?Ii(jo):o(_e).legacy&&o(_e).unit&&Ii(Wl,1)})}var nl=h(Ks,2);{var Bc=Ii=>{var Ei=Hae(),gn=f(Ei);hl(gn,()=>"wipe"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>rt(o(_e))),y(Ii,Ei)};T(nl,Ii=>{o(_e).mqtt&&!o(_e).mqtt.connected&&Ii(Bc)})}var ea=h(nl,2);{var Ar=Ii=>{var Ei=zae(),gn=f(Ei);hl(gn,()=>"uninstall"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>et(o(_e))),y(Ii,Ei)};T(ea,Ii=>{o(_e).host&&o(_e).unit&&!o(_e).legacy&&Ii(Ar)})}P((Ii,Ei,gn,ds,Mo)=>{var Eo,bs,Fo,sr,ta,sl,Fc,So,Ro,Lc;Pt=Xt(bt,1,"svelte-1dadwjh",null,Pt,{down:o(Vt).cls==="err",selected:((Eo=o(yt))==null?void 0:Eo.key)===o(_e).key}),xi(Et,"title",o(_e).host&&o(_e).unit?`Config, logs and info of ${o(_e).instance}`:`Info of ${o(_e).instance}`),B(kt,o(_e).instance),B(Cn,`${((bs=o(_e).mqtt)==null?void 0:bs.host)??((Fo=o(_e).host)==null?void 0:Fo.hostname)??""??""} `),xi(zn,"title",Ii),Xt(wn,1,`dot ${o(Vt).cls??""}`,"svelte-1dadwjh"),B(_s,`${o(Vt).label??""} `),B(Wi,Ei),xi(rn,"title",gn),B(mi,ds),xi(Ri,"title",o(_t)&&o(_t).cpu!==void 0?`adapter: ${o(_t).cpu} % of one core over its stats interval`:((sr=o(_e).unit)==null?void 0:sr.cpu)!==void 0&&((ta=o(_e).unit)==null?void 0:ta.cpu)!==null?`systemd on ${((sl=o(_e).host)==null?void 0:sl.hostname)??((Fc=o(_e).host)==null?void 0:Fc.name)}: since the previous listing`:""),B(Ni,o(_t)&&o(_t).cpu!==void 0?`${o(_t).cpu} %`:((So=o(_e).unit)==null?void 0:So.cpu)!==void 0&&((Ro=o(_e).unit)==null?void 0:Ro.cpu)!==null?`${o(_e).unit.cpu} %`:"—"),$i=Xt(Zi,1,"num c-ell svelte-1dadwjh",null,$i,{hot:(((Lc=o(_t))==null?void 0:Lc.eventLoopLag)??0)>=100}),xi(Zi,"title",Mo),B(ji,o(_t)&&o(_t).eventLoopLag!==void 0?`${o(_t).eventLoopLag} ms`:"—")},[()=>{var Ii;return(Ii=o(_e).mqtt)!=null&&Ii.connectedLc?"since "+lt(o(_e).mqtt.connectedLc):""},()=>Y(o(_e)),()=>{var Ii,Ei,gn;return o(_t)?`adapter: rss ${Ee(o(_t).rss)}${o(_t).heapUsed?`, heap ${Ee(o(_t).heapUsed)}`:""}${o(_t).heapTotal?` of ${Ee(o(_t).heapTotal)}`:""} (${oe(o(_t).receivedTs)})`:(Ii=o(_e).unit)!=null&&Ii.memory?`systemd on ${((Ei=o(_e).host)==null?void 0:Ei.hostname)??((gn=o(_e).host)==null?void 0:gn.name)}: MemoryCurrent`:""},()=>{var Ii;return o(_t)?Ee(o(_t).rss):(Ii=o(_e).unit)!=null&&Ii.memory?Ee(o(_e).unit.memory):"—"},()=>o(_t)&&o(_t).eventLoopLag!==void 0?`adapter: peak event loop lag over its stats interval (${oe(o(_t).receivedTs)})`:""]),z("click",Et,()=>ci(o(_e))),y(ai,bt)}),ts(ne,ai=>p(xe,ai),()=>o(xe)),P(()=>pe=Do(De,"",pe,{width:o(Fe)?`${o(Fe)}px`:null})),ui(Wt,()=>o(Ne),ai=>p(Ne,ai)),ui(Yt,()=>o(ge),ai=>p(ge,ai)),y(J,Re)};T(ve,J=>{o(d)&&o(H).length===0?J(it):o(u)?J(Mt,1):o(fe).length===0?J(Jt,2):o(Be).length===0?J(ft,3):J(ut,-1)})}var Bt=h(pt,2);{var ei=J=>{var Re=$ae(),ne=Dt(Re),se=h(ne,2);E3(se,()=>o(yt).key,De=>{var pe=Vae();let gt;var U=f(pe);{let ot=ct(()=>{var me;return((me=o(yt).host)==null?void 0:me.name)??null}),W=ct(()=>o(yt).legacy?mS:o(yt).instance),Q=ct(()=>o(yt).legacy===!0),ae=ct(()=>{var me,Ie;return((me=o(yt).mqtt)==null?void 0:me.host)??((Ie=o(yt).host)==null?void 0:Ie.hostname)??null});iae(U,{get host(){return o(ot)},get adapter(){return o(yt).adapter},get instance(){return o(W)},get label(){return o(yt).instance},get unit(){return o(yt).unit},get mqtt(){return o(yt).mqtt},get legacy(){return o(Q)},get hostname(){return o(ae)},onclose:()=>p(Ye,null),onchanged:()=>setTimeout(I,600),get tab(){return o(nt)},set tab(me){p(nt,me,!0)}})}P(()=>gt=Do(pe,"",gt,{width:`${o(Ke)}px`})),y(De,pe)}),z("mousedown",ne,ht),y(J,Re)};T(Bt,J=>{o(yt)&&J(ei)})}P(()=>{Qe=Xt(ce,1,"svc svelte-1dadwjh",null,Qe,{"with-detail":o(yt)!==null,resizing:o(vt)}),we.disabled=o(d),$=Xt(tt,1,"svelte-1dadwjh",null,$,{spinning:o(S)}),B(Le,o(Be).length),B(ke,` instance${o(fe).length===1?"":"s"}`),B(Me,` show unmanaged (${o(G)??""})`)}),ui(jt,()=>o(g),J=>p(g,J)),z("click",we,()=>I(!0)),Ss(Ve,()=>o(m),J=>p(m,J)),y(r,j),cs()}ms(["click","change","mousedown"]);var Gae=k('<span class="spinner svelte-13vzxas"></span> Scanning…',1),Kae=Wo('<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><circle cx="7" cy="7" r="4.5"></circle><path d="M10.5 10.5 14 14"></path></svg>'),Zae=k("<!> ",1),Yae=k('<!><span class="mono svelte-13vzxas"> </span>',1),Xae=k(`fill in <!> above — the scan
276
+ `:""}return GC.dump=lt,GC}var NA;function cre(){if(NA)return rr;NA=1;const r=are(),e=lre();function t(i,n){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return rr.Type=Dr(),rr.Schema=Y7(),rr.FAILSAFE_SCHEMA=eF(),rr.JSON_SCHEMA=oF(),rr.CORE_SCHEMA=rF(),rr.DEFAULT_SCHEMA=C2(),rr.load=r.load,rr.loadAll=r.loadAll,rr.dump=e.dump,rr.YAMLException=Av(),rr.types={binary:cF(),float:sF(),map:J7(),null:tF(),pairs:uF(),set:hF(),timestamp:aF(),bool:iF(),int:nF(),merge:lF(),omap:dF(),seq:Q7(),str:X7()},rr.safeLoad=t("safeLoad","load"),rr.safeLoadAll=t("safeLoadAll","loadAll"),rr.safeDump=t("safeDump","dump"),rr}var dre=cre();const fF=ore(dre),{Type:hfe,Schema:ffe,FAILSAFE_SCHEMA:pfe,JSON_SCHEMA:gfe,CORE_SCHEMA:vfe,DEFAULT_SCHEMA:xfe,load:mfe,loadAll:_fe,dump:bfe,YAMLException:Cfe,types:yfe,safeLoad:wfe,safeLoadAll:Efe,safeDump:Sfe}=fF;var ure=k('<div class="muted pad svelte-bdu03r">Loading…</div>'),hre=k('<span class="muted svelte-bdu03r" title="Guessed from the option name — the adapter does not declare this file">guessed</span>'),fre=k('<div class="muted desc svelte-bdu03r"> </div>'),OA=k("<button> </button>"),pre=k('<div class="mono muted svelte-bdu03r"> <span class="warn svelte-bdu03r">— missing</span></div> <button class="ghost sm svelte-bdu03r"> </button>',1),gre=k('<div class="mono muted svelte-bdu03r"> <span title="binary — not edited here">(binary)</span></div>'),vre=k('<div class="mono muted svelte-bdu03r"> </div> <div class="muted warn svelte-bdu03r"> <button class="link svelte-bdu03r"> </button> and move the content over.</div>',1),xre=k('<div class="muted svelte-bdu03r">not set</div> <button class="ghost sm svelte-bdu03r"> </button>',1),mre=k('<div class="opt svelte-bdu03r"><div class="opt-head svelte-bdu03r"><span class="mono key svelte-bdu03r"> </span> <span class="badge svelte-bdu03r"> </span> <!></div> <!> <!></div>'),_re=k('<div class="group-title svelte-bdu03r">Adapter files</div> <!>',1),bre=k('<div class="muted pad svelte-bdu03r">No files.</div>'),Cre=k('<span class="mono muted svelte-bdu03r"> </span>'),yre=k('<div class="file svelte-bdu03r"><!> <span class="muted size svelte-bdu03r"> </span></div>'),wre=k('<!> <div class="group-title svelte-bdu03r" style="margin-top:8px"> </div> <!> <!>',1),Ere=k('<div class="err pad svelte-bdu03r"> </div>'),Sre=k('<span class="muted svelte-bdu03r" title="JSON schema shipped by the adapter"> </span>'),kre=k('<span class="err svelte-bdu03r"> </span>'),Dre=k('<span class="ok svelte-bdu03r"> </span>'),Are=k('<span class="muted svelte-bdu03r"> </span>'),Bre=k('<div class="edbar svelte-bdu03r"><span class="mono path svelte-bdu03r"> </span> <!> <span class="spacer svelte-bdu03r"></span> <!> <button class="svelte-bdu03r"> </button> <button title="Save and restart the instance" class="svelte-bdu03r">Save &amp; restart</button> <!></div> <div class="monaco svelte-bdu03r"><!></div>',1),Fre=k('<div class="muted pad svelte-bdu03r">Pick a file on the left.</div>'),Lre=k('<div class="files svelte-bdu03r"><div class="list svelte-bdu03r"><!> <!></div> <div class="editor svelte-bdu03r"><!></div></div>');function Ire(r,e){ls(e,!0);let t=A(Ci([])),i=A(Ci([])),n=A(Ci([])),s=A(!0),a=A(""),l=A(null),d=A(""),u=A(""),g=A(null),x=A(null),m=A(null),C=A(Ci([])),_=A(Ci([])),E=A(!1),S=A(""),I=ct(()=>o(d)!==o(u)),M=ct(()=>o(g)==="json"?"json":o(g)==="yaml"?"yaml":"plaintext"),O=ct(()=>o(_).filter(Je=>Je.severity===8).length+o(C).length);async function R(){p(s,!0),p(a,"");try{const Je=await YK(e.host,e.adapter,e.instance);p(t,Je.options,!0),p(i,Je.files,!0),p(n,Je.dirs,!0)}catch(Je){p(a,Je.message??String(Je),!0)}finally{p(s,!1)}}Os(R);function H(Je){return o(t).find(It=>It.path===Je)}async function G(Je,It){if(!(o(I)&&!confirm("Discard unsaved changes?"))){p(S,""),p(a,"");try{const ue=await XK(e.host,e.adapter,e.instance,Je);p(l,ue.path,!0),p(d,ue.content,!0),p(u,ue.content,!0),p(g,It??ue.format,!0),p(x,null),p(m,null),p(C,[],!0),p(_,[],!0);const xe=H(Je);if(xe!=null&&xe.schema&&o(g)==="json")try{const Fe=await eZ(e.host,e.adapter,xe.schema);p(x,JSON.parse(Fe.content),!0),p(m,xe.schema,!0)}catch{}}catch(ue){p(a,ue.message??String(ue),!0)}}}cn(()=>{var Je,It;if(o(g)!=="yaml"){p(C,[],!0);return}try{fF.load(o(d)),p(C,[],!0)}catch(ue){const xe=(((Je=ue==null?void 0:ue.mark)==null?void 0:Je.line)??0)+1,Fe=(((It=ue==null?void 0:ue.mark)==null?void 0:It.column)??0)+1;p(C,[{severity:8,message:(ue==null?void 0:ue.reason)??String(ue),startLineNumber:xe,startColumn:Fe,endLineNumber:xe,endColumn:Fe+1}],!0)}});async function q(Je){var It;if(o(l)){p(E,!0),p(S,""),p(a,"");try{const ue=await QK(e.host,e.adapter,e.instance,o(l),o(d),Je);p(u,o(d),!0),p(S,ue.restarted?"Saved and restarted.":"Saved.",!0),(It=e.onchanged)==null||It.call(e),R()}catch(ue){p(a,ue.message??String(ue),!0)}finally{p(E,!1)}}}async function te(Je){p(S,""),p(a,"");try{const It=await JK(e.host,e.adapter,e.instance,Je.key);p(S,`Created ${It.path} and set ${It.envName} — restart the instance to use it.`),await R();const ue=o(i).find(xe=>xe.path===It.path);await G(It.path,(ue==null?void 0:ue.format)??Je.format)}catch(It){p(a,It.message??String(It),!0)}}function ye(Je){return Je<1024?`${Je} B`:Je<1048576?`${(Je/1024).toFixed(1)} KB`:`${(Je/1048576).toFixed(1)} MB`}function Ne(Je){return Je?new Date(Je*1e3).toLocaleString():""}var ge=Lre(),Ae=f(ge),dt=f(Ae);{var he=Je=>{var It=ure();y(Je,It)},We=Je=>{var It=wre(),ue=Dt(It);{var xe=Rt=>{var Ke=_re(),vt=h(Dt(Ke),2);gi(vt,17,()=>o(t),Ze=>Ze.key,(Ze,ee)=>{var ht=mre(),qe=f(ht),Ue=f(qe),Z=f(Ue),Se=h(Ue,2),Oe=f(Se),$t=h(Se,2);{var Ht=V=>{var Y=hre();y(V,Y)};T($t,V=>{o(ee).declared||V(Ht)})}var zt=h(qe,2);{var Ut=V=>{var Y=fre(),oe=f(Y);P(()=>B(oe,o(ee).describe)),y(V,Y)};T(zt,V=>{o(ee).describe&&V(Ut)})}var et=h(zt,2);{var rt=V=>{var Y=ks(),oe=Dt(Y);{var Ee=Ct=>{var ce=OA();let Qe;var pt=f(ce);P(()=>{Qe=Xt(ce,1,"path-link mono svelte-bdu03r",null,Qe,{active:o(l)===o(ee).path}),B(pt,o(ee).path)}),z("click",ce,()=>G(o(ee).path,o(ee).format)),y(Ct,ce)},lt=Ct=>{var ce=pre(),Qe=Dt(ce),pt=f(Qe),At=h(Qe,2),jt=f(At);P(()=>{B(pt,`${o(ee).path??""} `),B(jt,`Create${o(ee).example?" from example":""}`)}),z("click",At,()=>te(o(ee))),y(Ct,ce)},j=Ct=>{var ce=gre(),Qe=f(ce);P(()=>B(Qe,`${o(ee).path??""} `)),y(Ct,ce)},Xe=Ct=>{var ce=vre(),Qe=Dt(ce),pt=f(Qe),At=h(Qe,2),jt=f(At),we=h(jt),tt=f(we);P($=>{B(pt,o(ee).path),B(jt,`outside ${$??""} — she only edits files there. `),B(tt,`Create${o(ee).example?" from example":""} in /etc/${e.adapter??""}/`)},[()=>o(n).join(" and ")]),z("click",we,()=>te(o(ee))),y(Ct,ce)};T(oe,Ct=>{o(ee).managed&&o(ee).exists&&o(ee).editable?Ct(Ee):o(ee).managed&&!o(ee).exists?Ct(lt,1):o(ee).editable?Ct(Xe,-1):Ct(j,2)})}y(V,Y)},w=V=>{var Y=xre(),oe=h(Dt(Y),2),Ee=f(oe);P(()=>B(Ee,`Create${o(ee).example?" from example":""}`)),z("click",oe,()=>te(o(ee))),y(V,Y)};T(et,V=>{o(ee).path?V(rt):V(w,-1)})}P(()=>{B(Z,`--${o(ee).key??""}`),B(Oe,o(ee).format)}),y(Ze,ht)}),y(Rt,Ke)};T(ue,Rt=>{o(t).length&&Rt(xe)})}var Fe=h(ue,2),Ye=f(Fe),nt=h(Fe,2);{var yt=Rt=>{var Ke=bre();y(Rt,Ke)};T(nt,Rt=>{o(i).length===0&&Rt(yt)})}var ci=h(nt,2);gi(ci,17,()=>o(i),Rt=>Rt.path,(Rt,Ke)=>{var vt=ks(),Ze=Dt(vt);{var ee=ht=>{var qe=yre(),Ue=f(qe);{var Z=Ht=>{var zt=OA();let Ut;var et=f(zt);P(rt=>{Ut=Xt(zt,1,"path-link mono svelte-bdu03r",null,Ut,{active:o(l)===o(Ke).path}),xi(zt,"title",rt),B(et,o(Ke).path)},[()=>Ne(o(Ke).mtime)]),z("click",zt,()=>G(o(Ke).path,o(Ke).format)),y(Ht,zt)},Se=Ht=>{var zt=Cre(),Ut=f(zt);P(et=>{xi(zt,"title",et),B(Ut,o(Ke).path)},[()=>/\.env$/.test(o(Ke).path)?"edited through the Config tab":"not a text format she edits"]),y(Ht,zt)};T(Ue,Ht=>{o(Ke).editable?Ht(Z):Ht(Se,-1)})}var Oe=h(Ue,2),$t=f(Oe);P(Ht=>B($t,Ht),[()=>ye(o(Ke).size)]),y(ht,qe)};T(Ze,ht=>{o(Ke).kind==="file"&&ht(ee)})}y(Rt,vt)}),P(Rt=>B(Ye,Rt),[()=>o(n).join(" · ")]),y(Je,It)};T(dt,Je=>{o(s)?Je(he):Je(We,-1)})}var de=h(dt,2);{var je=Je=>{var It=Ere(),ue=f(It);P(()=>B(ue,o(a))),y(Je,It)};T(de,Je=>{o(a)&&Je(je)})}var fe=h(Ae,2),Ft=f(fe);{var Te=Je=>{var It=Bre(),ue=Dt(It),xe=f(ue),Fe=f(xe),Ye=h(xe,2);{var nt=Z=>{var Se=Sre(),Oe=f(Se);P(()=>B(Oe,`schema: ${o(m)??""}`)),y(Z,Se)};T(Ye,Z=>{o(m)&&Z(nt)})}var yt=h(Ye,4);{var ci=Z=>{var Se=kre(),Oe=f(Se);P(()=>B(Oe,`${o(O)??""} problem${o(O)===1?"":"s"}`)),y(Z,Se)},Rt=Z=>{var Se=Dre(),Oe=f(Se);P(()=>B(Oe,`valid ${o(g)??""}`)),y(Z,Se)};T(yt,Z=>{o(O)>0?Z(ci):(o(g)==="json"||o(g)==="yaml")&&Z(Rt,1)})}var Ke=h(yt,2),vt=f(Ke),Ze=h(Ke,2),ee=h(Ze,2);{var ht=Z=>{var Se=Are(),Oe=f(Se);P(()=>B(Oe,o(S))),y(Z,Se)};T(ee,Z=>{o(S)&&Z(ht)})}var qe=h(ue,2),Ue=f(qe);E3(Ue,()=>o(l),Z=>{Vf(Z,{get language(){return o(M)},get jsonSchema(){return o(x)},get markers(){return o(C)},onMarkers:Se=>p(_,Se,!0),onSave:()=>q(!1),get value(){return o(d)},set value(Se){p(d,Se,!0)}})}),P(()=>{B(Fe,o(l)),Ke.disabled=o(E)||!o(I),B(vt,o(E)?"Saving…":"Save"),Ze.disabled=o(E)||!o(I)&&o(O)>0}),z("click",Ke,()=>q(!1)),z("click",Ze,()=>q(!0)),y(Je,It)},Be=Je=>{var It=Fre();y(Je,It)};T(Ft,Je=>{o(l)?Je(Te):Je(Be,-1)})}y(r,ge),cs()}ms(["click"]);var Pre=k('<span class="badge svelte-1zltuz" title="pre-core single-instance unit — migrate it from the Instances tab">old unit</span>'),Tre=k("<span> </span>"),Mre=k("<button>Files</button>"),Rre=k("<button>Config</button> <!> <button>Logs</button>",1),Nre=k('<span class="muted tabs-note svelte-1zltuz"> </span>'),KC=k('<div class="muted svelte-1zltuz"> </div>'),Ore=k('<div class="err-box svelte-1zltuz"> </div>'),Hre=k('<button class="ghost svelte-1zltuz" title="Set a new random password for the dynsec client and restart the instance">Rotate password</button>'),zre=k('<span class="muted svelte-1zltuz"> </span>'),Wre=k('<!> <!> <div class="actions svelte-1zltuz"><button class="svelte-1zltuz"> </button> <button class="svelte-1zltuz">Save &amp; restart</button> <!> <!></div>',1),jre=k('<div class="body svelte-1zltuz"><!></div>'),Vre=k("<option> </option>"),$re=k('<span class="err svelte-1zltuz"> </span>'),qre=k('<div><span class="ts svelte-1zltuz"> </span><span class="lvl svelte-1zltuz"> </span><span class="msg svelte-1zltuz"> </span></div>'),Ure=k('<div class="muted empty svelte-1zltuz">No journal entries.</div>'),Gre=k('<div class="logbar svelte-1zltuz"><select class="svelte-1zltuz"></select> <input class="filter-in svelte-1zltuz" type="search" placeholder="Filter messages…"/> <label class="check-label svelte-1zltuz" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-1zltuz"/> <span class="checkmark svelte-1zltuz"></span> Regex</label> <label class="check-label svelte-1zltuz" title="Keep receiving new journal lines"><input type="checkbox" class="svelte-1zltuz"/> <span class="checkmark svelte-1zltuz"></span> Follow</label> <label class="check-label svelte-1zltuz"><input type="checkbox" class="svelte-1zltuz"/> <span class="checkmark svelte-1zltuz"></span> Auto-scroll</label> <button class="ghost sm svelte-1zltuz" title="Reload the last 500 journal lines">↺</button> <button class="ghost sm svelte-1zltuz">Clear</button></div> <div class="logmeta svelte-1zltuz"><span class="muted mono svelte-1zltuz"> </span> <span class="muted svelte-1zltuz"> <!> lines<!></span> <!></div> <div class="log svelte-1zltuz"><!> <!></div>',1),Kre=k('<span class="badge-upd svelte-1zltuz"> </span>'),Zre=k('<div class="muted svelte-1zltuz" style="margin:6px 0 4px"> </div> <pre class="mono json svelte-1zltuz"> </pre>',1),Yre=k('<div class="muted svelte-1zltuz">Unmanaged — only <span class="mono svelte-1zltuz"> </span> is known; no <span class="mono svelte-1zltuz"> </span>, so this could be any client publishing that topic (an ESPHome device, a script, a pre-core adapter).</div>'),Xre=k('<dl class="kv svelte-1zltuz"><dt class="svelte-1zltuz">adapter</dt><dd class="mono svelte-1zltuz"> <!><!></dd> <dt class="svelte-1zltuz">connected</dt><dd class="svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">uptime</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">host</dt><dd class="svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">spec</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">node</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">started</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">maintenance</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">status topics</dt><dd class="svelte-1zltuz"> <span class="mono svelte-1zltuz"> </span></dd> <dt class="svelte-1zltuz">info updated</dt><dd class="svelte-1zltuz"> </dd></dl> <!>',1),Qre=k('<span class="muted svelte-1zltuz">(pre-core layout)</span>'),Jre=k('<dl class="kv svelte-1zltuz"><dt class="svelte-1zltuz">unit</dt><dd class="mono svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">host</dt><dd class="svelte-1zltuz"> <!></dd> <dt class="svelte-1zltuz">state</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">since</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">restarts</dt><dd class="svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">env file</dt><dd class="mono svelte-1zltuz"> </dd> <dt class="svelte-1zltuz">state dir</dt><dd class="mono svelte-1zltuz"> </dd></dl>'),eae=k('<div class="body svelte-1zltuz"><div class="info-title svelte-1zltuz">MQTT</div> <!> <div class="info-title svelte-1zltuz" style="margin-top:14px">systemd</div> <!></div>'),tae=k('<div class="detail svelte-1zltuz"><div class="head svelte-1zltuz"><div><span class="title svelte-1zltuz"> </span><!> <span class="sub mono svelte-1zltuz"> <!> </span> <!></div> <button class="ghost sm svelte-1zltuz">Close</button></div> <div class="tabs svelte-1zltuz"><!> <button>Info</button> <!></div> <!></div>');function iae(r,e){ls(e,!0);let t=$n(e,"unit",3,null),i=$n(e,"mqtt",3,null),n=$n(e,"hostname",3,null),s=$n(e,"label",3,null),a=$n(e,"legacy",3,!1),l=$n(e,"tab",15,"config"),d=ct(()=>!!e.host&&!!t()&&!!e.adapter);cn(()=>{!o(d)&&l()!=="info"&&l("info")}),cn(()=>{a()&&l()==="files"&&l("config")});const u=()=>e.host,g=()=>e.adapter;let x=A(Ci({})),m=A(Ci([])),C=A(null),_=A(null),E=A(null),S=A("own"),I=A("own"),M=A(!0),O=A(""),R=A(!1),H=A("");async function G(){p(M,!0),p(O,"");try{const we=await HK(u(),g(),e.instance);p(x,we.env,!0),p(m,we.secrets,!0),p(C,we.schema,!0),p(_,we.sheBroker,!0),p(E,we.dynsec,!0),p(S,we.brokerMode,!0),p(I,we.brokerMode,!0)}catch(we){p(O,we.message??String(we),!0)}finally{p(M,!1)}}async function q(we,tt=!1){var $;p(R,!0),p(H,""),p(O,"");try{const be=await zK(u(),g(),e.instance,o(x),we,o(S),{rotate:tt});p(H,tt?"New password set on the broker"+(be.restarted?" and instance restarted.":" — restart the instance to use it."):be.restarted?"Saved and restarted.":"Saved — takes effect on the next restart.",!0),($=e.onchanged)==null||$.call(e),await G()}catch(be){p(O,be.message??String(be),!0)}finally{p(R,!1)}}const te=["all","debug","info","warn","error"],ye={debug:0,info:1,warn:2,error:3},Ne=3e3;let ge=A(Ci([])),Ae=A(""),dt=A(!1),he=A(!1),We=A(!0),de=A(!0),je=A("all"),fe=A(""),Ft=A(!1),Te=A(void 0),Be=A(!1),Je=null,It=null,ue=ct(()=>a()?`${e.adapter}`:`${e.adapter}@${e.instance}`),xe=ct(()=>s()??e.instance),Fe=ct(()=>{let we=null;if(o(fe)&&o(Ft))try{we=new RegExp(o(fe),"i")}catch{we=null}const tt=o(fe).toLowerCase();return o(ge).filter($=>o(je)!=="all"&&ye[$.level]<ye[o(je)]?!1:o(fe)?we?we.test($.msg):$.msg.toLowerCase().includes(tt):!0)});async function Ye(){p(Ae,""),p(dt,!0);try{p(ge,(await NK(u(),g(),e.instance,500)).entries,!0),nt()}catch(we){p(Ae,we.message??String(we),!0)}finally{p(dt,!1)}}function nt(){o(de)&&requestAnimationFrame(()=>{o(Te)&&(o(Te).scrollTop=o(Te).scrollHeight)})}async function yt(){if(!o(he))try{await xD(u(),g(),e.instance),p(he,!0),Je=Xo("serviceLog",we=>{we.host!==e.host||we.unit!==o(ue)||(p(ge,[...o(ge).slice(-(Ne-1)),{ts:we.ts,level:we.level,msg:we.msg,pid:we.pid??null}],!0),nt())}),It=setInterval(()=>{xD(u(),g(),e.instance).catch(()=>{})},300*1e3)}catch(we){p(Ae,we.message??String(we),!0),p(We,!1)}}function ci(){o(he)&&(p(he,!1),Je==null||Je(),Je=null,It&&(clearInterval(It),It=null),OK(u(),g(),e.instance).catch(()=>{}))}function Rt(){p(ge,[],!0)}cn(()=>{!o(d)||l()!=="logs"||o(Be)||(p(Be,!0),Ye())}),cn(()=>{o(Be)&&(o(We)?yt():ci())}),cn(()=>{o(de)&&nt()}),Os(()=>(o(d)&&G(),()=>ci()));function Ke(we){return we?new Date(we).toLocaleString():"—"}function vt(){const we=i();if(!we||we.started===null||!(we.connected&&we.connected>0))return"—";const tt=Math.max(0,Math.round((Date.now()-we.started)/1e3)),$=Math.floor(tt/86400),be=Math.floor(tt%86400/3600),Le=Math.floor(tt%3600/60);return $>0?`${$}d ${be}h`:be>0?`${be}h ${Le}m`:`${Le}m`}function Ze(){var tt;const we=(tt=i())==null?void 0:tt.connected;return we===2?"online (2)":we===1?"device offline (1)":we===0?"down (0)":"unknown"}var ee=tae(),ht=f(ee),qe=f(ht),Ue=f(qe),Z=f(Ue),Se=h(Ue);{var Oe=we=>{var tt=Pre();y(we,tt)};T(Se,we=>{a()&&we(Oe)})}var $t=h(Se,2),Ht=f($t),zt=h(Ht);{var Ut=we=>{var tt=kn();P(()=>B(tt,` @${i().version??""}`)),y(we,tt)};T(zt,we=>{var tt;(tt=i())!=null&&tt.version&&we(Ut)})}var et=h(zt),rt=h($t,2);{var w=we=>{var tt=Tre();let $;var be=f(tt);P(()=>{$=Xt(tt,1,"badge svelte-1zltuz",null,$,{ok:t().active==="active",err:t().active==="failed"}),xi(tt,"title",`systemd: ${t().active??""}/${t().sub??""}, ${t().unitFile??""}`),B(be,`${t().active??""}${t().unitFile==="disabled"?" · disabled":""}`)}),y(we,tt)};T(rt,we=>{t()&&we(w)})}var V=h(qe,2),Y=h(ht,2),oe=f(Y);{var Ee=we=>{var tt=Rre(),$=Dt(tt);let be;var Le=h($,2);{var at=He=>{var re=Mre();let X;P(()=>X=Xt(re,1,"svelte-1zltuz",null,X,{active:l()==="files"})),z("click",re,()=>l("files")),y(He,re)};T(Le,He=>{a()||He(at)})}var St=h(Le,2);let ke;P(()=>{be=Xt($,1,"svelte-1zltuz",null,be,{active:l()==="config"}),ke=Xt(St,1,"svelte-1zltuz",null,ke,{active:l()==="logs"})}),z("click",$,()=>l("config")),z("click",St,()=>l("logs")),y(we,tt)};T(oe,we=>{o(d)&&we(Ee)})}var lt=h(oe,2);let j;var Xe=h(lt,2);{var Ct=we=>{var tt=Nre(),$=f(tt);P(()=>B($,e.host===null?"host not managed — add it on the Adapters page, tab Hosts":"not installed on a managed host")),y(we,tt)};T(Xe,we=>{o(d)||we(Ct)})}var ce=h(Y,2);{var Qe=we=>{var tt=jre(),$=f(tt);{var be=at=>{var St=KC(),ke=f(St);P(()=>B(ke,`Loading ${a()?`/etc/default/${e.adapter}`:`/etc/${e.adapter}/${e.instance}.env`}…`)),y(at,St)},Le=at=>{var St=Wre(),ke=Dt(St);{var He=it=>{var Mt=Ore(),Jt=f(Mt);P(()=>B(Jt,o(O))),y(it,Mt)};T(ke,it=>{o(O)&&it(He)})}var re=h(ke,2);Z7(re,{get schema(){return o(C)},get secrets(){return o(m)},mode:"edit",get sheBroker(){return o(_)},get dynsec(){return o(E)},get env(){return o(x)},set env(it){p(x,it,!0)},get brokerMode(){return o(S)},set brokerMode(it){p(S,it,!0)}});var X=h(re,2),Ve=f(X),Me=f(Ve),Ce=h(Ve,2),Lt=h(Ce,2);{var ti=it=>{var Mt=Hre();P(()=>Mt.disabled=o(R)),z("click",Mt,()=>q(!0,!0)),y(it,Mt)};T(Lt,it=>{o(S)==="dynsec"&&o(I)==="dynsec"&&it(ti)})}var xt=h(Lt,2);{var ve=it=>{var Mt=zre(),Jt=f(Mt);P(()=>B(Jt,o(H))),y(it,Mt)};T(xt,it=>{o(H)&&it(ve)})}P(()=>{Ve.disabled=o(R),B(Me,o(R)?"Saving…":"Save"),Ce.disabled=o(R)}),z("click",Ve,()=>q(!1)),z("click",Ce,()=>q(!0)),y(at,St)};T($,at=>{o(M)?at(be):at(Le,-1)})}y(we,tt)},pt=we=>{{let tt=ct(u),$=ct(g);Ire(we,{get host(){return o(tt)},get adapter(){return o($)},get instance(){return e.instance},get onchanged(){return e.onchanged}})}},At=we=>{var tt=Gre(),$=Dt(tt),be=f($);gi(be,20,()=>te,se=>se,(se,De)=>{var pe=Vre(),gt=f(pe),U={};P(()=>{B(gt,De),U!==(U=De)&&(pe.value=(pe.__value=De)??"")}),y(se,pe)});var Le=h(be,2),at=h(Le,2),St=f(at),ke=h(at,2),He=f(ke),re=h(ke,2),X=f(re),Ve=h(re,2),Me=h(Ve,2),Ce=h($,2),Lt=f(Ce),ti=f(Lt),xt=h(Lt,2),ve=f(xt),it=h(ve);{var Mt=se=>{var De=kn();P(()=>B(De,` / ${o(ge).length??""}`)),y(se,De)};T(it,se=>{o(Fe).length!==o(ge).length&&se(Mt)})}var Jt=h(it,2);{var ft=se=>{var De=kn();De.nodeValue=" · following",y(se,De)};T(Jt,se=>{o(he)&&se(ft)})}var ut=h(xt,2);{var Bt=se=>{var De=$re(),pe=f(De);P(()=>B(pe,o(Ae))),y(se,De)};T(ut,se=>{o(Ae)&&se(Bt)})}var ei=h(Ce,2),J=f(ei);gi(J,17,()=>o(Fe),Ki,(se,De)=>{var pe=qre(),gt=f(pe),U=f(gt),ot=h(gt),W=f(ot),Q=h(ot),ae=f(Q);P((me,Ie)=>{Xt(pe,1,`line ${o(De).level??""}`,"svelte-1zltuz"),B(U,me),B(W,Ie),B(ae,o(De).msg)},[()=>lb(o(De).ts),()=>o(De).level.toUpperCase()]),y(se,pe)});var Re=h(J,2);{var ne=se=>{var De=Ure();y(se,De)};T(Re,se=>{o(ge).length===0&&!o(Ae)&&!o(dt)&&se(ne)})}ts(ei,se=>p(Te,se),()=>o(Te)),P(()=>{Ve.disabled=o(dt),B(ti,`journalctl -u ${o(ue)??""}`),B(ve,o(Fe).length)}),to(be,()=>o(je),se=>p(je,se)),ui(Le,()=>o(fe),se=>p(fe,se)),Ss(St,()=>o(Ft),se=>p(Ft,se)),Ss(He,()=>o(We),se=>p(We,se)),Ss(X,()=>o(de),se=>p(de,se)),z("click",Ve,Ye),z("click",Me,Rt),y(we,tt)},jt=we=>{var tt=eae(),$=h(f(tt),2);{var be=He=>{var re=Xre(),X=Dt(re),Ve=h(f(X)),Me=f(Ve),Ce=h(Me);{var Lt=qt=>{var Yt=kn();P(()=>B(Yt,` @${i().version??""}`)),y(qt,Yt)};T(Ce,qt=>{i().version&&qt(Lt)})}var ti=h(Ce);{var xt=qt=>{var Yt=Kre(),ni=f(Yt);P(()=>{xi(Yt,"title",`npm has ${i().latestVersion??""}`),B(ni,`update: ${i().latestVersion??""}`)}),y(qt,Yt)};T(ti,qt=>{i().updateAvailable&&qt(xt)})}var ve=h(Ve,3),it=f(ve),Mt=h(it);{var Jt=qt=>{var Yt=kn();P(ni=>B(Yt,` · since ${ni??""}`),[()=>Ke(i().connectedLc)]),y(qt,Yt)};T(Mt,qt=>{i().connectedLc&&qt(Jt)})}var ft=h(ve,3),ut=f(ft),Bt=h(ft,3),ei=f(Bt),J=h(ei);{var Re=qt=>{var Yt=kn();P(()=>B(Yt,` · pid ${i().pid??""}`)),y(qt,Yt)};T(J,qt=>{i().pid&&qt(Re)})}var ne=h(Bt,3),se=f(ne),De=h(ne,3),pe=f(De),gt=h(De,3),U=f(gt),ot=h(gt,3),W=f(ot),Q=h(ot,3),ae=f(Q),me=h(ae),Ie=f(me),st=h(Q,3),mt=f(st),Ot=h(X,2);{var Kt=qt=>{var Yt=Zre(),ni=Dt(Yt),Ai=f(ni),Pe=h(ni,2),$e=f(Pe);P(Gt=>{B(Ai,`${e.instance??""}/info`),B($e,Gt)},[()=>JSON.stringify(i().info,null,2)]),y(qt,Yt)},Wt=qt=>{var Yt=Yre(),ni=h(f(Yt)),Ai=f(ni),Pe=h(ni,2),$e=f(Pe);P(()=>{B(Ai,`${e.instance??""}/connected`),B($e,`${e.instance??""}/info`)}),y(qt,Yt)};T(Ot,qt=>{i().info?qt(Kt):qt(Wt,-1)})}P((qt,Yt,ni,Ai)=>{B(Me,i().adapter??"—"),B(it,qt),B(ut,Yt),B(ei,i().host??"—"),B(se,i().spec??"—"),B(pe,i().node??"—"),B(U,ni),B(W,i().legacy?"— (no maintenance topics)":i().maintenance?"enabled":"disabled (--no-maintenance)"),B(ae,`${i().statusTopics??""} retained under `),B(Ie,`${e.instance??""}/status/`),B(mt,Ai)},[()=>Ze(),()=>vt(),()=>Ke(i().started),()=>Ke(i().infoTs)]),y(He,re)},Le=He=>{var re=KC(),X=f(re);P(()=>B(X,`Not seen on MQTT (no retained ${e.instance??""}/connected or ${e.instance??""}/info yet).`)),y(He,re)};T($,He=>{i()?He(be):He(Le,-1)})}var at=h($,4);{var St=He=>{var re=Jre(),X=h(f(re)),Ve=f(X),Me=h(Ve);{var Ce=se=>{var De=Qre();y(se,De)};T(Me,se=>{a()&&se(Ce)})}var Lt=h(X,3),ti=f(Lt),xt=h(ti);{var ve=se=>{var De=kn();P(()=>B(De,` · hostname ${n()??""}`)),y(se,De)};T(xt,se=>{n()&&n()!==e.host&&se(ve)})}var it=h(Lt,3),Mt=f(it),Jt=h(it,3),ft=f(Jt),ut=h(Jt,3),Bt=f(ut),ei=h(ut,3),J=f(ei),Re=h(ei,3),ne=f(Re);P(()=>{B(Ve,`${o(ue)??""}.service`),B(ti,e.host),B(Mt,`${t().active??""} / ${t().sub??""} · ${t().unitFile??""}`),B(ft,t().since||"—"),B(Bt,t().restarts),B(J,a()?`/etc/default/${t().adapter}`:`/etc/${t().adapter}/${e.instance}.env`),B(ne,a()?`/var/lib/${t().adapter}/`:`/var/lib/${t().adapter}/${e.instance}/`)}),y(He,re)},ke=He=>{var re=KC(),X=f(re);P(()=>B(X,e.host===null?"Not installed on a managed host — or the host is not configured on the Adapters page, tab Hosts.":"No systemd unit for this instance on the managed host.")),y(He,re)};T(at,He=>{t()?He(St):He(ke,-1)})}y(we,tt)};T(ce,we=>{l()==="config"?we(Qe):l()==="files"&&o(d)?we(pt,1):l()==="logs"?we(At,2):we(jt,-1)})}P(()=>{var we;B(Z,o(xe)),B(Ht,e.adapter??((we=i())!=null&&we.legacy?"unmanaged":"")),B(et,` · ${e.host??n()??"not managed"??""}`),j=Xt(lt,1,"svelte-1zltuz",null,j,{active:l()==="info"})}),z("click",V,function(...we){var tt;(tt=e.onclose)==null||tt.apply(this,we)}),z("click",lt,()=>l("info")),y(r,ee),cs()}ms(["click"]);const hl=(r,e=ar)=>{var t=fae(),i=f(t);{var n=C=>{var _=sae();y(C,_)},s=C=>{var _=oae();y(C,_)},a=C=>{var _=rae();y(C,_)},l=C=>{var _=aae();y(C,_)},d=C=>{var _=lae();y(C,_)},u=C=>{var _=cae();y(C,_)},g=C=>{var _=dae();y(C,_)},x=C=>{var _=uae();y(C,_)},m=C=>{var _=hae();y(C,_)};T(i,C=>{e()==="config"?C(n):e()==="info"?C(s,1):e()==="restart"?C(a,2):e()==="start"?C(l,3):e()==="stop"?C(d,4):e()==="enable"?C(u,5):e()==="migrate"?C(g,6):e()==="wipe"?C(x,7):e()==="uninstall"&&C(m,8)})}y(r,t)};var nae=k('<button> <span class="arrow svelte-1dadwjh"> </span></button>'),sae=Wo('<line x1="2" y1="5" x2="14" y2="5"></line><circle cx="6" cy="5" r="1.8" fill="var(--bg-app)"></circle><line x1="2" y1="11" x2="14" y2="11"></line><circle cx="10.5" cy="11" r="1.8" fill="var(--bg-app)"></circle>',1),oae=Wo('<circle cx="8" cy="8" r="6.2"></circle><line x1="8" y1="7.4" x2="8" y2="11"></line><line x1="8" y1="4.9" x2="8" y2="4.9"></line>',1),rae=Wo('<path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.4 10.5,4 13.1,4"></polyline>',1),aae=Wo('<path d="M5 3.2 12.5 8 5 12.8Z" fill="currentColor"></path>'),lae=Wo('<rect x="4" y="4" width="8" height="8" rx="1" fill="currentColor"></rect>'),cae=Wo('<line x1="8" y1="2" x2="8" y2="7.5"></line><path d="M11.9 4.4a5.5 5.5 0 1 1-7.8 0"></path>',1),dae=Wo('<line x1="2" y1="8" x2="11.5" y2="8"></line><polyline points="8,4.5 11.5,8 8,11.5"></polyline><path d="M13.5 3v10"></path>',1),uae=Wo('<line x1="2.5" y1="4.2" x2="13.5" y2="4.2"></line><path d="M6 4.2V2.6h4v1.6"></path><path d="M4.2 4.2 4.9 13.4h6.2l.7-9.2"></path>',1),hae=Wo('<line x1="3" y1="3" x2="13" y2="13"></line><line x1="13" y1="3" x2="3" y2="13"></line>',1),fae=Wo('<svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="svelte-1dadwjh"><!></svg>'),pae=k('<button class="ghost sm svelte-1dadwjh" title="Clear the column filters">clear filters</button>'),gae=k('<span class="result svelte-1dadwjh"> </span>'),vae=k(' <code class="svelte-1dadwjh">sudo she --install</code>',1),xae=k("<span>host <strong> </strong> <!></span>"),mae=k('<div class="bar warn-bar svelte-1dadwjh"></div>'),_ae=k('<div class="info svelte-1dadwjh">Loading…</div>'),bae=k('<div class="info err svelte-1dadwjh"> </div>'),Cae=k(' <code class="svelte-1dadwjh">&lt;name&gt;/connected</code> topic; tick <em>show unmanaged</em>)',1),yae=k('<div class="info svelte-1dadwjh">No xyz2mqtt services seen<!>. Adapters built on <a href="https://github.com/hobbyquaker/mqtt-interfaces-core" target="_blank" rel="noopener" class="svelte-1dadwjh">mqtt-interfaces-core</a> publish a retained <code class="svelte-1dadwjh">&lt;name&gt;/info</code> and <code class="svelte-1dadwjh">&lt;name&gt;/connected</code>; anything publishing just <code class="svelte-1dadwjh">&lt;name&gt;/connected</code> — an ESPHome device, a script, a pre-core adapter — shows up as <em>unmanaged</em>. Instances installed on a managed host appear even before they connect.</div>'),wae=k('<div class="info svelte-1dadwjh">No instances match.</div>'),Eae=k('<span class="badge b-legacy svelte-1dadwjh" title="Only a &lt;name>/connected topic and no &lt;name>/info — version, uptime and stats stay unknown">no info</span>'),Sae=k('<span class="badge b-upd svelte-1dadwjh">old unit</span>'),kae=k('<span class="badge b-legacy svelte-1dadwjh">not on MQTT</span>'),Dae=k('<span class="mono svelte-1dadwjh"> </span>'),HA=k('<span class="muted svelte-1dadwjh">—</span>'),Aae=k('<span class="badge b-host svelte-1dadwjh"> </span>'),Bae=k('<span class="badge b-unmanaged svelte-1dadwjh">unmanaged</span>'),zA=k('<span class="muted svelte-1dadwjh"> </span>'),Fae=k('<span class="muted svelte-1dadwjh">· disabled</span>'),Lae=k('<select class="lvl svelte-1dadwjh"><option>set…</option><option>error</option><option>warn</option><option>info</option><option>debug</option></select>'),Iae=k('<span class="muted svelte-1dadwjh" title="--no-maintenance">disabled</span>'),Pae=k('<button class="ghost sm svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Config / Logs</span></button>'),Tae=k('<button class="ghost sm svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Info</span></button>'),WA=k('<button class="ghost sm w-run svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Restart</span></button>'),Mae=k('<button class="ghost sm w-run svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Start</span></button>'),Rae=k('<button class="ghost sm w-halt svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Stop</span></button>'),Nae=k('<button class="ghost sm svelte-1dadwjh" title="Start at boot"><!><span class="lbl svelte-1dadwjh">Enable</span></button>'),Oae=k('<button class="ghost sm svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Migrate</span></button>'),Hae=k(`<button class="ghost sm w-halt svelte-1dadwjh" title="Clear the instance's retained topics"><!><span class="lbl svelte-1dadwjh">Wipe</span></button>`),zae=k('<button class="ghost sm danger-text svelte-1dadwjh"><!><span class="lbl svelte-1dadwjh">Uninstall</span></button>'),Wae=k('<tr><td class="svelte-1dadwjh"><button class="dname dname-link svelte-1dadwjh"> </button> <!> <!> <!></td><td class="svelte-1dadwjh"><!></td><td class="svelte-1dadwjh"> <!> <!></td><td class="svelte-1dadwjh"><span></span> <!> <!></td><td class="c-up svelte-1dadwjh"> </td><td class="num c-mem svelte-1dadwjh"> </td><td class="num c-cpu svelte-1dadwjh"> </td><td> </td><td class="svelte-1dadwjh"><!></td><td class="c-act svelte-1dadwjh"><span class="acts svelte-1dadwjh"><!> <!> <!> <!> <!> <!></span></td><td class="w-fill svelte-1dadwjh"></td></tr>'),jae=k('<div class="table-wrap svelte-1dadwjh"><table class="svelte-1dadwjh"><colgroup><col class="w-inst svelte-1dadwjh"/><col class="w-adapter svelte-1dadwjh"/><col class="w-host svelte-1dadwjh"/><col class="w-state svelte-1dadwjh"/><col class="w-up svelte-1dadwjh"/><col class="w-mem svelte-1dadwjh"/><col class="w-cpu svelte-1dadwjh"/><col class="w-ell svelte-1dadwjh"/><col class="w-lvl svelte-1dadwjh"/><col class="w-act svelte-1dadwjh"/><col/></colgroup><thead><tr><th class="svelte-1dadwjh"><!></th><th class="svelte-1dadwjh"><!></th><th class="svelte-1dadwjh"><!></th><th title="Sorted worst first: down, then device offline, then online" class="svelte-1dadwjh"><!></th><th class="c-up svelte-1dadwjh">Uptime</th><th class="num c-mem svelte-1dadwjh" title="resident memory — reported by the adapter (core 0.8+) or by systemd on the host">Mem</th><th class="num c-cpu svelte-1dadwjh" title="share of one core — reported by the adapter over its stats interval, or from systemd between two host listings">CPU</th><th class="num c-ell svelte-1dadwjh" title="event loop lag — the peak the adapter measured over its stats interval (core 0.8+); no systemd fallback">EL lag</th><th class="svelte-1dadwjh">Log level</th><th class="c-act svelte-1dadwjh"></th><th class="w-fill svelte-1dadwjh"></th></tr><tr class="filter-row svelte-1dadwjh"><th class="svelte-1dadwjh"><input class="col-f svelte-1dadwjh" type="search" placeholder="filter…" aria-label="Filter by instance"/></th><th class="svelte-1dadwjh"><input class="col-f svelte-1dadwjh" type="search" placeholder="filter…" aria-label="Filter by adapter"/></th><th class="svelte-1dadwjh"><!></th><th class="svelte-1dadwjh"><!></th><th colspan="7" class="svelte-1dadwjh"></th></tr></thead><tbody></tbody></table></div>'),Vae=k('<div class="drawer svelte-1dadwjh"><!></div>'),$ae=k('<div class="drawer-resize-handle svelte-1dadwjh" role="separator" aria-orientation="vertical"></div> <!>',1),qae=k('<!> <!> <div><div class="main svelte-1dadwjh"><div class="bar svelte-1dadwjh"><input class="filter-in svelte-1dadwjh" type="search" placeholder="Filter instances…"/> <button class="ghost svelte-1dadwjh" title="Reload, asking every host again"><span>↺</span></button> <span class="count svelte-1dadwjh"> <!> </span> <!> <label class="chk svelte-1dadwjh" title="Topics with only a &lt;name>/connected and no &lt;name>/info — pre-core adapters, but also ESPHome devices and the like"><input type="checkbox" class="svelte-1dadwjh"/> <span class="checkmark svelte-1dadwjh"></span> </label> <span class="bar-hint svelte-1dadwjh">To add an instance click <em class="svelte-1dadwjh">+ instance</em> on the Installations tab</span> <span class="spacer svelte-1dadwjh"></span> <!></div> <!> <!></div> <!></div>',1);function Uae(r,e){ls(e,!0);const t=(J,Re=ar,ne=ar)=>{var se=nae();let De;var pe=f(se),gt=h(pe),U=f(gt);P(()=>{De=Xt(se,1,"sort svelte-1dadwjh",null,De,{on:o(q)===Re()}),B(pe,ne()),B(U,o(q)===Re()?o(te)===1?"▲":"▼":"")}),z("click",se,()=>ye(Re())),y(J,se)};let i=$n(e,"generation",3,0),n=$n(e,"origin",3,null),s=A(null),a=A(Ci([])),l=A(Ci([])),d=A(!1),u=A(null),g=A("");const x="she-services-show-legacy";let m=A(localStorage.getItem(x)==="1");cn(()=>{localStorage.setItem(x,o(m)?"1":"0")});let C=A(Ci(new Set)),_=A(null),E=A(Ci(Date.now())),S=A(!1);async function I(J=!1){p(d,!0),p(S,o(S)||J,!0),p(u,null);try{const[Re,ne]=await Promise.all([D7(J),pa(J).catch(()=>({hosts:[]}))]);p(a,Re.instances,!0),p(l,ne.hosts,!0)}catch(Re){p(u,Re instanceof Error?Re.message:String(Re),!0)}finally{p(d,!1),p(S,!1)}}let M=null;function O(){M&&clearTimeout(M),M=setTimeout(()=>{M=null,I()},400)}Os(()=>{I();const J=Xo("mqtt",ne=>{const De=(typeof ne.topic=="string"?ne.topic:"").split("/");De.length===2&&(De[1]==="info"||De[1]==="connected")&&O()}),Re=setInterval(()=>{p(E,Date.now(),!0)},1e4);return()=>{J(),clearInterval(Re),M&&clearTimeout(M)}});let R=0;cn(()=>{const J=i();J!==R&&(R=J,Ho(()=>{n()!=="instances"&&I(!0)}))});let H=ct(()=>{var Re;const J=new Map;for(const ne of o(a))J.set(ne.instance,{key:ne.instance,instance:ne.instance,adapter:ne.adapter,mqtt:ne,host:null,unit:null});for(const ne of o(l))if(ne.ok){for(const se of ne.instances??[]){const De=J.get(se.instance),pe=!((Re=De==null?void 0:De.mqtt)!=null&&Re.host)||De.mqtt.host===ne.hostname||ne.local&&!De.mqtt.host;if(De&&!De.unit&&(!De.mqtt||De.mqtt.adapter===se.adapter||De.mqtt.legacy)&&pe)De.host=ne,De.unit=se,De.adapter||(De.adapter=se.adapter);else{const gt=`${se.instance}@${ne.name}`;J.set(gt,{key:gt,instance:se.instance,adapter:se.adapter,mqtt:null,host:ne,unit:se})}}for(const se of ne.legacy??[]){const De={adapter:se.adapter,instance:mS,active:se.active,sub:se.sub,unitFile:se.unitFile,since:se.since,restarts:se.restarts},pe=[...J.values()].find(gt=>!gt.unit&&gt.mqtt&&gt.mqtt.adapter===se.adapter&&(!gt.mqtt.host||gt.mqtt.host===ne.hostname));if(pe)pe.host=ne,pe.unit=De,pe.legacy=!0;else{const gt=`${se.adapter}.service@${ne.name}`;J.set(gt,{key:gt,instance:se.adapter,adapter:se.adapter,mqtt:null,host:ne,unit:De,legacy:!0})}}}return[...J.values()].sort((ne,se)=>ne.instance.localeCompare(se.instance))}),G=ct(()=>o(H).filter(J=>{var Re;return((Re=J.mqtt)==null?void 0:Re.legacy)&&!J.unit}).length),q=A("instance"),te=A(1);function ye(J){o(q)===J?p(te,o(te)===1?-1:1,!0):(p(q,J,!0),p(te,1))}let Ne=A(""),ge=A(""),Ae=A(Ci([])),dt=A(Ci([]));const he=ct(()=>!!o(Ne)||!!o(ge)||o(Ae).length>0||o(dt).length>0),We=J=>{var Re,ne,se;return((Re=J.mqtt)==null?void 0:Re.host)??((ne=J.host)==null?void 0:ne.hostname)??((se=J.host)==null?void 0:se.name)??""},de=J=>w(J).label,je={err:0,warn:1,ok:2,none:3};let fe=ct(()=>o(m)?o(H):o(H).filter(J=>{var Re;return!((Re=J.mqtt)!=null&&Re.legacy&&!J.unit)})),Ft=ct(()=>[...new Set(o(fe).map(We).filter(Boolean))].sort((J,Re)=>J.localeCompare(Re))),Te=ct(()=>[...new Set(o(fe).map(de))].sort((J,Re)=>J.localeCompare(Re))),Be=ct(()=>{const J=o(g).trim().toLowerCase(),Re=o(Ne).trim().toLowerCase();let ne=o(fe);J&&(ne=ne.filter(pe=>{var gt,U,ot;return pe.instance.toLowerCase().includes(J)||(pe.adapter??"").toLowerCase().includes(J)||(((gt=pe.mqtt)==null?void 0:gt.host)??((U=pe.host)==null?void 0:U.hostname)??"").toLowerCase().includes(J)||(((ot=pe.mqtt)==null?void 0:ot.version)??"").toLowerCase().includes(J)}));const se=o(ge).trim().toLowerCase();Re&&(ne=ne.filter(pe=>pe.instance.toLowerCase().includes(Re))),se&&(ne=ne.filter(pe=>(pe.adapter??"").toLowerCase().includes(se))),o(Ae).length&&(ne=ne.filter(pe=>o(Ae).includes(We(pe)))),o(dt).length&&(ne=ne.filter(pe=>o(dt).includes(de(pe))));const De=(pe,gt)=>{switch(o(q)){case"adapter":return(pe.adapter??"").localeCompare(gt.adapter??"");case"host":return We(pe).localeCompare(We(gt));case"state":{const U=je[w(pe).cls]-je[w(gt).cls];return U!==0?U:de(pe).localeCompare(de(gt))}default:return 0}};return[...ne].sort((pe,gt)=>(De(pe,gt)||pe.instance.localeCompare(gt.instance))*o(te))}),Je=ct(()=>o(l).filter(J=>!J.ok&&J.code!=="UNSUPPORTED"));const It=4,ue=16;let xe=A(null),Fe=A(0);cn(()=>{o(Be);const J=o(xe);if(!J)return;let Re=0;for(const ne of J.querySelectorAll(".acts")){const se=[...ne.children];if(!se.length)continue;const De=se.reduce((pe,gt)=>pe+gt.getBoundingClientRect().width,0)+It*(se.length-1);Re=Math.max(Re,De)}Re&&p(Fe,Math.ceil(Re)+ue)}),cn(()=>{if(!e.onstatus)return;if(o(fe).length===0){e.onstatus("none","");return}const J=o(fe).filter(ne=>{var se;return ne.mqtt?ne.mqtt.connected===0||ne.mqtt.connected===null:((se=ne.unit)==null?void 0:se.active)!=="active"}).map(ne=>ne.instance),Re=o(fe).filter(ne=>{var se;return((se=ne.mqtt)==null?void 0:se.connected)===1}).map(ne=>ne.instance);J.length?e.onstatus("err",`Down: ${J.join(", ")}`):Re.length?e.onstatus("warn",`Device offline: ${Re.join(", ")}`):e.onstatus("ok",`${o(fe).length} service${o(fe).length===1?"":"s"} online`)});let Ye=A(null),nt=A("config"),yt=ct(()=>o(Ye)===null?null:o(H).find(J=>J.key===o(Ye))??null);function ci(J){p(Ye,J.key,!0)}const Rt="she-services-drawer-width";let Ke=A(Ci(Math.max(360,Math.min(1200,Number(localStorage.getItem(Rt))||560)))),vt=A(!1),Ze=0,ee=0;function ht(J){p(vt,!0),Ze=J.clientX,ee=o(Ke),J.preventDefault()}function qe(J){o(vt)&&p(Ke,Math.max(360,Math.min(Math.max(360,window.innerWidth-320),ee-(J.clientX-Ze))),!0)}function Ue(){o(vt)&&(p(vt,!1),localStorage.setItem(Rt,String(o(Ke))))}function Z(J,Re){const ne=new Set(o(C));Re?ne.add(J):ne.delete(J),p(C,ne,!0)}async function Se(J,Re,ne,se,{tellOthers:De=!1}={}){var pe;Z(J.key,!0),p(_,null);try{await ne(),p(_,se,!0),setTimeout(I,600),De&&((pe=e.onchanged)==null||pe.call(e))}catch(gt){p(_,`${Re} failed: ${gt instanceof Error?gt.message:String(gt)}`)}finally{Z(J.key,!1)}}async function Oe(J){if(await o(s).show(`Restart ${J.instance} (${J.adapter})?`,{confirm:"Restart"}))return J.host&&J.unit?Se(J,"Restart",()=>vD(J.host.name,J.unit.adapter,J.instance,"restart"),`systemctl restart ${J.unit.adapter}@${J.instance} on ${J.host.name}.`):Se(J,"Restart",()=>DK(J.instance),`Restart requested for ${J.instance} over MQTT.`)}function $t(J,Re){if(!(!J.host||!J.unit))return Se(J,Re,()=>vD(J.host.name,J.unit.adapter,J.instance,Re),`${Re}: ${J.unit.adapter}@${J.instance} on ${J.host.name}.`)}async function Ht(J,Re){return Se(J,"Log level",()=>AK(J.instance,Re),`${J.instance}: log level ${Re} (until the next restart).`)}let zt=A(null);async function Ut(J){var ne;if(!J.host||!J.unit||!J.legacy)return;const Re=await o(zt).show(`Turn ${J.unit.adapter}.service into a proper instance ${J.unit.adapter}@<name>. The adapter's own --install runs with the current settings (state such as logins or pairing keys is carried over by the adapter), then the old unit is disabled and its files are kept as .migrated. Instance name = the MQTT topic prefix:`,{initial:((ne=J.mqtt)==null?void 0:ne.instance)??"",placeholder:"instance name",confirm:"Migrate"});if(Re)return Se(J,"Migrate",()=>LK(J.host.name,J.unit.adapter,Re.trim()),`${J.unit.adapter}.service migrated to ${J.unit.adapter}@${Re.trim()} on ${J.host.name}.`,{tellOthers:!0})}async function et(J){if(!(!J.host||!J.unit||!await o(s).show(`Uninstall ${J.unit.adapter}@${J.instance} from ${J.host.name}? The unit is stopped, disabled and removed together with /etc/${J.unit.adapter}/${J.instance}.env; the state directory /var/lib/${J.unit.adapter}/${J.instance} is kept. Retained MQTT topics can be wiped afterwards.`,{confirm:"Uninstall",danger:!0})))return o(Ye)===J.key&&p(Ye,null),Se(J,"Uninstall",()=>RK(J.host.name,J.unit.adapter,J.instance),`${J.unit.adapter}@${J.instance} removed from ${J.host.name}.`,{tellOthers:!0})}async function rt(J){Z(J.key,!0),p(_,null);try{const Re=await BK(J.instance),ne=Re.own.length+Re.discovery.length;if(ne===0){p(_,`Nothing retained for ${J.instance}.`);return}if(!await o(s).show(`Clear ${ne} retained topic${ne===1?"":"s"} of ${J.instance}: ${Re.own.length} status/info/connected`+(Re.discovery.length?` and ${Re.discovery.length} Home Assistant discovery announcement${Re.discovery.length===1?"":"s"}`:"")+"? Only do this when the instance is gone for good — a running adapter would republish them anyway.",{confirm:"Clear retained topics",danger:!0}))return;const De=await FK(J.instance,!0);p(_,De.ok?`Cleared ${De.cleared} retained topics of ${J.instance}.`:`Cleared ${De.cleared}, ${De.errors.length} failed.`,!0),setTimeout(I,400)}catch(Re){p(_,Re instanceof Error?Re.message:String(Re),!0)}finally{Z(J.key,!1)}}function w(J){const Re=J.mqtt;return(Re==null?void 0:Re.connected)===2?{cls:"ok",label:"online"}:(Re==null?void 0:Re.connected)===1?{cls:"warn",label:"device offline"}:(Re==null?void 0:Re.connected)===0?{cls:"err",label:"down"}:!Re&&J.unit?J.unit.active==="active"?{cls:"warn",label:"running, not on MQTT"}:{cls:"err",label:J.unit.active}:{cls:"err",label:"unknown"}}function V(J){return!!J.mqtt&&!J.mqtt.legacy&&J.mqtt.maintenance&&!!J.mqtt.connected&&J.mqtt.connected>0}function Y(J){const Re=J.mqtt;if(!Re||Re.started===null||!(Re.connected&&Re.connected>0))return"—";const ne=Math.max(0,Math.round((o(E)-Re.started)/1e3)),se=Math.floor(ne/86400),De=Math.floor(ne%86400/3600),pe=Math.floor(ne%3600/60);return se>0?`${se}d ${De}h`:De>0?`${De}h ${pe}m`:`${pe}m`}function oe(J){if(!J)return"";const Re=Math.max(0,Math.round((o(E)-J)/1e3));return Re<60?`${Re}s ago`:Re<3600?`${Math.floor(Re/60)}m ago`:Re<86400?`${Math.floor(Re/3600)}h ago`:`${Math.floor(Re/86400)}d ago`}function Ee(J){return J<1024*1024?`${Math.round(J/1024)} kB`:J<1024*1024*1024?`${(J/1024/1024).toFixed(J<10*1024*1024?1:0)} MB`:`${(J/1024/1024/1024).toFixed(2)} GB`}function lt(J){return J?new Date(J).toLocaleString():""}var j=qae();ws("mousemove",wa,qe),ws("mouseup",wa,Ue);var Xe=Dt(j);ts(kr(Xe,{}),J=>p(s,J,!0),()=>o(s));var Ct=h(Xe,2);ts(d2(Ct,{}),J=>p(zt,J,!0),()=>o(zt));var ce=h(Ct,2);let Qe;var pt=f(ce),At=f(pt),jt=f(At),we=h(jt,2),tt=f(we);let $;var be=h(we,2),Le=f(be),at=h(Le);{var St=J=>{var Re=kn();P(()=>B(Re,` / ${o(fe).length??""}`)),y(J,Re)};T(at,J=>{(o(g)||o(he))&&J(St)})}var ke=h(at),He=h(be,2);{var re=J=>{var Re=pae();z("click",Re,()=>{p(Ne,""),p(ge,""),p(Ae,[],!0),p(dt,[],!0)}),y(J,Re)};T(He,J=>{o(he)&&J(re)})}var X=h(He,2),Ve=f(X),Me=h(Ve,3),Ce=h(X,6);{var Lt=J=>{var Re=gae(),ne=f(Re);P(()=>B(ne,o(_))),y(J,Re)};T(Ce,J=>{o(_)&&J(Lt)})}var ti=h(At,2);{var xt=J=>{var Re=mae();gi(Re,21,()=>o(Je),ne=>ne.name,(ne,se)=>{var De=xae(),pe=h(f(De)),gt=f(pe),U=h(pe),ot=h(U);{var W=Q=>{var ae=vae(),me=Dt(ae);me.nodeValue=" — run ",y(Q,ae)};T(ot,Q=>{o(se).code==="HELPER_MISSING"&&Q(W)})}P(()=>{B(gt,o(se).name),B(U,`: ${o(se).error??""}`)}),y(ne,De)}),y(J,Re)};T(ti,J=>{o(Je).length&&J(xt)})}var ve=h(ti,2);{var it=J=>{var Re=_ae();y(J,Re)},Mt=J=>{var Re=bae(),ne=f(Re);P(()=>B(ne,o(u))),y(J,Re)},Jt=J=>{var Re=yae(),ne=h(f(Re));{var se=De=>{var pe=Cae(),gt=Dt(pe);P(()=>B(gt,` — ${o(G)??""} unmanaged row${o(G)===1?"":"s"} hidden (only a `)),y(De,pe)};T(ne,De=>{o(G)>0&&De(se)})}y(J,Re)},ft=J=>{var Re=wae();y(J,Re)},ut=J=>{var Re=jae(),ne=f(Re),se=f(ne),De=h(f(se),9);let pe;var gt=h(se),U=f(gt),ot=f(U),W=f(ot);t(W,()=>"instance",()=>"Instance");var Q=h(ot),ae=f(Q);t(ae,()=>"adapter",()=>"Adapter");var me=h(Q),Ie=f(me);t(Ie,()=>"host",()=>"Host");var st=h(me),mt=f(st);t(mt,()=>"state",()=>"State");var Ot=h(U),Kt=f(Ot),Wt=f(Kt),qt=h(Kt),Yt=f(qt),ni=h(qt),Ai=f(ni);hA(Ai,{get options(){return o(Ft)},noun:"hosts",title:"Show only these hosts",get selected(){return o(Ae)},set selected(ai){p(Ae,ai,!0)}});var Pe=h(ni),$e=f(Pe);hA($e,{get options(){return o(Te)},noun:"states",title:"Show only these states",get selected(){return o(dt)},set selected(ai){p(dt,ai,!0)}});var Gt=h(gt);gi(Gt,21,()=>o(Be),ai=>ai.key,(ai,_e)=>{const Vt=ct(()=>w(o(_e))),_t=ct(()=>{var Ii;return(Ii=o(_e).mqtt)==null?void 0:Ii.stats});var bt=Wae();let Pt;var hi=f(bt),Et=f(hi),kt=f(Et),di=h(Et,2);{var ki=Ii=>{var Ei=Eae();y(Ii,Ei)};T(di,Ii=>{var Ei;(Ei=o(_e).mqtt)!=null&&Ei.legacy&&o(_e).host&&Ii(ki)})}var _i=h(di,2);{var Fi=Ii=>{var Ei=Sae();P(()=>{var gn;return xi(Ei,"title",`Runs as ${((gn=o(_e).unit)==null?void 0:gn.adapter)??""}.service (pre-core unit, env in /etc/default) — migrate it to a template instance`)}),y(Ii,Ei)};T(_i,Ii=>{o(_e).legacy&&Ii(Fi)})}var Nt=h(_i,2);{var ri=Ii=>{var Ei=kae();P(()=>{var gn;return xi(Ei,"title",`Installed on ${((gn=o(_e).host)==null?void 0:gn.name)??""} but nothing retained on MQTT yet`)}),y(Ii,Ei)};T(Nt,Ii=>{!o(_e).mqtt&&o(_e).unit&&Ii(ri)})}var bi=h(hi),Oi=f(bi);{var wi=Ii=>{var Ei=Dae(),gn=f(Ei);P(()=>B(gn,o(_e).adapter)),y(Ii,Ei)},Ji=Ii=>{var Ei=HA();y(Ii,Ei)};T(Oi,Ii=>{o(_e).adapter?Ii(wi):Ii(Ji,-1)})}var en=h(bi),Cn=f(en),tn=h(Cn);{var Mi=Ii=>{var Ei=ks(),gn=Dt(Ei);{var ds=Mo=>{var Eo=Aae(),bs=f(Eo);P(()=>{var Fo,sr,ta;xi(Eo,"title",`managed via ${o(_e).host.name??""}: systemd ${((Fo=o(_e).unit)==null?void 0:Fo.active)??""}/${((sr=o(_e).unit)==null?void 0:sr.sub)??""}, ${((ta=o(_e).unit)==null?void 0:ta.unitFile)??""}`),B(bs,o(_e).host.hostname??o(_e).host.name)}),y(Mo,Eo)};T(gn,Mo=>{var Eo;(o(_e).host.hostname??o(_e).host.name)!==(((Eo=o(_e).mqtt)==null?void 0:Eo.host)??o(_e).host.hostname)&&Mo(ds)})}y(Ii,Ei)},An=Ii=>{var Ei=Bae();P(()=>{var gn;return xi(Ei,"title",(gn=o(_e).mqtt)!=null&&gn.legacy?"Only a <name>/connected topic — she sees it come and go, nothing more (ESPHome devices and the like publish one too)":"The host this runs on is not configured on the Hosts tab — no systemd control, no logs, no config from here")}),y(Ii,Ei)};T(tn,Ii=>{o(_e).host?Ii(Mi):Ii(An,-1)})}var on=h(tn,2);{var sn=Ii=>{var Ei=zA(),gn=f(Ei);P(()=>B(gn,`· pid ${o(_e).mqtt.pid??""}`)),y(Ii,Ei)};T(on,Ii=>{var Ei;(Ei=o(_e).mqtt)!=null&&Ei.pid&&Ii(sn)})}var zn=h(en),wn=f(zn),_s=h(wn),Gs=h(_s);{var $s=Ii=>{var Ei=zA(),gn=f(Ei);P(ds=>B(gn,ds),[()=>oe(o(_e).mqtt.connectedLc)]),y(Ii,Ei)};T(Gs,Ii=>{var Ei;((Ei=o(_e).mqtt)==null?void 0:Ei.connected)===0&&o(_e).mqtt.connectedLc&&Ii($s)})}var vi=h(Gs,2);{var Bi=Ii=>{var Ei=Fae();y(Ii,Ei)};T(vi,Ii=>{o(_e).unit&&o(_e).unit.unitFile==="disabled"&&Ii(Bi)})}var Ti=h(zn),Wi=f(Ti),rn=h(Ti),mi=f(rn),Ri=h(rn),Ni=f(Ri),Zi=h(Ri);let $i;var ji=f(Zi),_n=h(Zi),un=f(_n);{var En=Ii=>{var Ei=Lae(),gn=f(Ei);gn.value=gn.__value="";var ds=h(gn);ds.value=ds.__value="error";var Mo=h(ds);Mo.value=Mo.__value="warn";var Eo=h(Mo);Eo.value=Eo.__value="info";var bs=h(Eo);bs.value=bs.__value="debug",P(Fo=>Ei.disabled=Fo,[()=>o(C).has(o(_e).key)]),z("change",Ei,Fo=>{const sr=Fo.target.value;sr&&(Ht(o(_e),sr),Fo.target.value="")}),y(Ii,Ei)},Bn=ct(()=>V(o(_e))),bn=Ii=>{var Ei=Iae();y(Ii,Ei)},dn=Ii=>{var Ei=HA();y(Ii,Ei)};T(un,Ii=>{o(Bn)?Ii(En):o(_e).mqtt&&!o(_e).mqtt.legacy&&!o(_e).mqtt.maintenance?Ii(bn,1):Ii(dn,-1)})}var hn=h(_n),Sn=f(hn),As=f(Sn);{var Wn=Ii=>{var Ei=Pae(),gn=f(Ei);hl(gn,()=>"config"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>ci(o(_e))),y(Ii,Ei)},Nn=Ii=>{var Ei=Tae(),gn=f(Ei);hl(gn,()=>"info"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>ci(o(_e))),y(Ii,Ei)};T(As,Ii=>{o(_e).host&&o(_e).unit?Ii(Wn):Ii(Nn,-1)})}var Jn=h(As,2);{var qs=Ii=>{var Ei=WA(),gn=f(Ei);hl(gn,()=>"restart"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>Oe(o(_e))),y(Ii,Ei)},Qs=Ii=>{var Ei=Mae(),gn=f(Ei);hl(gn,()=>"start"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>$t(o(_e),"start")),y(Ii,Ei)},Tn=Ii=>{var Ei=WA(),gn=f(Ei);hl(gn,()=>"restart"),P(ds=>{Ei.disabled=ds,xi(Ei,"title",`via ${o(_e).instance??""}/maintenance/set/restart`)},[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>Oe(o(_e))),y(Ii,Ei)},Bs=ct(()=>V(o(_e)));T(Jn,Ii=>{o(_e).host&&o(_e).unit&&o(_e).unit.active==="active"?Ii(qs):o(_e).host&&o(_e).unit?Ii(Qs,1):o(Bs)&&Ii(Tn,2)})}var no=h(Jn,2);{var fo=Ii=>{var Ei=Rae(),gn=f(Ei);hl(gn,()=>"stop"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>$t(o(_e),"stop")),y(Ii,Ei)};T(no,Ii=>{o(_e).host&&o(_e).unit&&o(_e).unit.active==="active"&&Ii(fo)})}var Ks=h(no,2);{var jo=Ii=>{var Ei=Nae(),gn=f(Ei);hl(gn,()=>"enable"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>$t(o(_e),"enable")),y(Ii,Ei)},Wl=Ii=>{var Ei=Oae(),gn=f(Ei);hl(gn,()=>"migrate"),P(ds=>{Ei.disabled=ds,xi(Ei,"title",`Turn the old ${o(_e).unit.adapter??""}.service into ${o(_e).unit.adapter??""}@<name>`)},[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>Ut(o(_e))),y(Ii,Ei)};T(Ks,Ii=>{o(_e).host&&o(_e).unit&&o(_e).unit.unitFile==="disabled"?Ii(jo):o(_e).legacy&&o(_e).unit&&Ii(Wl,1)})}var nl=h(Ks,2);{var Bc=Ii=>{var Ei=Hae(),gn=f(Ei);hl(gn,()=>"wipe"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>rt(o(_e))),y(Ii,Ei)};T(nl,Ii=>{o(_e).mqtt&&!o(_e).mqtt.connected&&Ii(Bc)})}var ea=h(nl,2);{var Ar=Ii=>{var Ei=zae(),gn=f(Ei);hl(gn,()=>"uninstall"),P(ds=>Ei.disabled=ds,[()=>o(C).has(o(_e).key)]),z("click",Ei,()=>et(o(_e))),y(Ii,Ei)};T(ea,Ii=>{o(_e).host&&o(_e).unit&&!o(_e).legacy&&Ii(Ar)})}P((Ii,Ei,gn,ds,Mo)=>{var Eo,bs,Fo,sr,ta,sl,Fc,So,Ro,Lc;Pt=Xt(bt,1,"svelte-1dadwjh",null,Pt,{down:o(Vt).cls==="err",selected:((Eo=o(yt))==null?void 0:Eo.key)===o(_e).key}),xi(Et,"title",o(_e).host&&o(_e).unit?`Config, logs and info of ${o(_e).instance}`:`Info of ${o(_e).instance}`),B(kt,o(_e).instance),B(Cn,`${((bs=o(_e).mqtt)==null?void 0:bs.host)??((Fo=o(_e).host)==null?void 0:Fo.hostname)??""??""} `),xi(zn,"title",Ii),Xt(wn,1,`dot ${o(Vt).cls??""}`,"svelte-1dadwjh"),B(_s,`${o(Vt).label??""} `),B(Wi,Ei),xi(rn,"title",gn),B(mi,ds),xi(Ri,"title",o(_t)&&o(_t).cpu!==void 0?`adapter: ${o(_t).cpu} % of one core over its stats interval`:((sr=o(_e).unit)==null?void 0:sr.cpu)!==void 0&&((ta=o(_e).unit)==null?void 0:ta.cpu)!==null?`systemd on ${((sl=o(_e).host)==null?void 0:sl.hostname)??((Fc=o(_e).host)==null?void 0:Fc.name)}: since the previous listing`:""),B(Ni,o(_t)&&o(_t).cpu!==void 0?`${o(_t).cpu} %`:((So=o(_e).unit)==null?void 0:So.cpu)!==void 0&&((Ro=o(_e).unit)==null?void 0:Ro.cpu)!==null?`${o(_e).unit.cpu} %`:"—"),$i=Xt(Zi,1,"num c-ell svelte-1dadwjh",null,$i,{hot:(((Lc=o(_t))==null?void 0:Lc.eventLoopLag)??0)>=100}),xi(Zi,"title",Mo),B(ji,o(_t)&&o(_t).eventLoopLag!==void 0?`${o(_t).eventLoopLag} ms`:"—")},[()=>{var Ii;return(Ii=o(_e).mqtt)!=null&&Ii.connectedLc?"since "+lt(o(_e).mqtt.connectedLc):""},()=>Y(o(_e)),()=>{var Ii,Ei,gn;return o(_t)?`adapter: rss ${Ee(o(_t).rss)}${o(_t).heapUsed?`, heap ${Ee(o(_t).heapUsed)}`:""}${o(_t).heapTotal?` of ${Ee(o(_t).heapTotal)}`:""} (${oe(o(_t).receivedTs)})`:(Ii=o(_e).unit)!=null&&Ii.memory?`systemd on ${((Ei=o(_e).host)==null?void 0:Ei.hostname)??((gn=o(_e).host)==null?void 0:gn.name)}: MemoryCurrent`:""},()=>{var Ii;return o(_t)?Ee(o(_t).rss):(Ii=o(_e).unit)!=null&&Ii.memory?Ee(o(_e).unit.memory):"—"},()=>o(_t)&&o(_t).eventLoopLag!==void 0?`adapter: peak event loop lag over its stats interval (${oe(o(_t).receivedTs)})`:""]),z("click",Et,()=>ci(o(_e))),y(ai,bt)}),ts(ne,ai=>p(xe,ai),()=>o(xe)),P(()=>pe=Do(De,"",pe,{width:o(Fe)?`${o(Fe)}px`:null})),ui(Wt,()=>o(Ne),ai=>p(Ne,ai)),ui(Yt,()=>o(ge),ai=>p(ge,ai)),y(J,Re)};T(ve,J=>{o(d)&&o(H).length===0?J(it):o(u)?J(Mt,1):o(fe).length===0?J(Jt,2):o(Be).length===0?J(ft,3):J(ut,-1)})}var Bt=h(pt,2);{var ei=J=>{var Re=$ae(),ne=Dt(Re),se=h(ne,2);E3(se,()=>o(yt).key,De=>{var pe=Vae();let gt;var U=f(pe);{let ot=ct(()=>{var me;return((me=o(yt).host)==null?void 0:me.name)??null}),W=ct(()=>o(yt).legacy?mS:o(yt).instance),Q=ct(()=>o(yt).legacy===!0),ae=ct(()=>{var me,Ie;return((me=o(yt).mqtt)==null?void 0:me.host)??((Ie=o(yt).host)==null?void 0:Ie.hostname)??null});iae(U,{get host(){return o(ot)},get adapter(){return o(yt).adapter},get instance(){return o(W)},get label(){return o(yt).instance},get unit(){return o(yt).unit},get mqtt(){return o(yt).mqtt},get legacy(){return o(Q)},get hostname(){return o(ae)},onclose:()=>p(Ye,null),onchanged:()=>setTimeout(I,600),get tab(){return o(nt)},set tab(me){p(nt,me,!0)}})}P(()=>gt=Do(pe,"",gt,{width:`${o(Ke)}px`})),y(De,pe)}),z("mousedown",ne,ht),y(J,Re)};T(Bt,J=>{o(yt)&&J(ei)})}P(()=>{Qe=Xt(ce,1,"svc svelte-1dadwjh",null,Qe,{"with-detail":o(yt)!==null,resizing:o(vt)}),we.disabled=o(d),$=Xt(tt,1,"svelte-1dadwjh",null,$,{spinning:o(S)}),B(Le,o(Be).length),B(ke,` instance${o(fe).length===1?"":"s"}`),B(Me,` show unmanaged (${o(G)??""})`)}),ui(jt,()=>o(g),J=>p(g,J)),z("click",we,()=>I(!0)),Ss(Ve,()=>o(m),J=>p(m,J)),y(r,j),cs()}ms(["click","change","mousedown"]);var Gae=k('<span class="spinner svelte-13vzxas"></span> Scanning…',1),Kae=Wo('<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><circle cx="7" cy="7" r="4.5"></circle><path d="M10.5 10.5 14 14"></path></svg>'),Zae=k("<!> ",1),Yae=k('<!><span class="mono svelte-13vzxas"> </span>',1),Xae=k(`fill in <!> above — the scan
277
277
  signs in with them`,1),Qae=k(`signs in and lists your account's devices, then fills in <span class="mono svelte-13vzxas"> </span>`,1),Jae=k('asks <span class="mono svelte-13vzxas"> </span> <span class="mono svelte-13vzxas"> </span>',1),ele=k('<button class="link svelte-13vzxas"> </button>'),tle=k('<div class="adv svelte-13vzxas"><label class="svelte-13vzxas">Address or range <input type="text" spellcheck="false" placeholder="172.16.24.145 or 172.16.20.0/24" class="svelte-13vzxas"/></label> <label class="svelte-13vzxas">Timeout (s) <input type="number" min="1" max="120" class="svelte-13vzxas"/></label> <span class="muted svelte-13vzxas">Broadcast and multicast stop at the router — name the device, or a range to sweep for it.</span></div>'),ile=k('<div class="err-box svelte-13vzxas"> </div>'),nle=k('<div class="muted empty svelte-13vzxas"> <!> Filling in <span class="mono svelte-13vzxas"> </span> by hand works as before.</div>'),sle=k('<span class="badge svelte-13vzxas"> </span>'),ole=k('<span class="badge sel svelte-13vzxas">selected</span>'),rle=k('<span title="the device node the stable name points at right now"> </span>'),ZC=k("<span> </span>"),ale=k('<span class="svc svelte-13vzxas"> </span>'),lle=k('<span class="src svelte-13vzxas"> </span>'),cle=k("<button> </button>"),dle=k('<span class="warn-hint svelte-13vzxas">the short name only resolves where the search domain matches</span>'),ule=k('<div class="forms svelte-13vzxas" role="group" aria-label="what to configure"><!> <!></div>'),hle=k('<li><button><span class="head svelte-13vzxas"><span class="name svelte-13vzxas"> </span> <!> <!></span> <span class="sub mono svelte-13vzxas"> </span> <span class="meta svelte-13vzxas"><!> <!> <!> <!> <!> <!></span></button> <!></li>'),fle=k('<ul class="results svelte-13vzxas"></ul>'),ple=k('<div class="scan svelte-13vzxas"><div class="bar svelte-13vzxas"><button><!></button> <span class="muted svelte-13vzxas"><!></span> <!></div> <!> <!> <!> <!></div>');function gle(r,e){ls(e,!0);let t=$n(e,"needs",19,()=>({})),i=$n(e,"missing",19,()=>[]),n=$n(e,"selected",3,null),s=A(Ci({}));function a(Ke){return Ke.fqdn?"fqdn":"address"}function l(Ke){return o(s)[Ke.value]??a(Ke)}function d(Ke,vt=l(Ke)){return(vt==="fqdn"?Ke.fqdn:vt==="hostname"?Ke.hostname:Ke.address)??Ke.value}function u(Ke){const vt=[];return Ke.address&&vt.push({form:"address",label:"IP",title:Ke.address+" — changes when the dhcp lease does"}),Ke.hostname&&vt.push({form:"hostname",label:"host",title:Ke.hostname+" — resolves through the search list of whoever asks, so it may not work on every host"}),Ke.fqdn&&vt.push({form:"fqdn",label:"FQDN",title:Ke.fqdn+" — qualified and verified, outlives a dhcp lease"}),vt.length>1?vt:[]}function g(Ke,vt){var Ze;vt&&p(s,{...o(s),[Ke.value]:vt},!0),(Ze=e.onpick)==null||Ze.call(e,Ke,d(Ke,vt??l(Ke)))}let x=A(!1),m=A(!1),C=A(""),_=A(Ci([])),E=A(!1),S=A(""),I=A(5),M=ct(()=>e.kinds.includes("network")),O=ct(()=>e.kinds.includes("cloud")&&!o(M)),R=ct(()=>o(O)&&i().length>0);async function H(){if(!o(x)){p(x,!0),p(C,"");try{const Ke=o(S).trim(),vt=await IK(e.host,e.adapter,{...o(M)&&o(I)!==""?{timeout:Number(o(I))}:{},...Ke?{address:Ke.split(/[\s,]+/).filter(Boolean)}:{},...Object.keys(t()).length?{needs:t()}:{}});p(_,vt.devices,!0),p(m,!0),p(s,{},!0),o(_).length===1&&!n()&&!o(_)[0].usedBy&&g(o(_)[0])}catch(Ke){p(C,(Ke==null?void 0:Ke.message)??String(Ke),!0)}finally{p(x,!1)}}}function G(Ke){return Ke.name??Ke.model??Ke.type??Ke.id??Ke.value}function q(Ke){return Object.entries(Ke.services??{}).filter(([,vt])=>vt).map(([vt])=>vt)}var te={scan:H},ye=ple(),Ne=f(ye),ge=f(Ne),Ae=f(ge);{var dt=Ke=>{var vt=Gae();y(Ke,vt)},he=Ke=>{var vt=Zae(),Ze=Dt(vt);{var ee=qe=>{var Ue=Kae();y(qe,Ue)};T(Ze,qe=>{o(m)||qe(ee)})}var ht=h(Ze);P(()=>B(ht,` ${o(m)?o(O)?"Look again":"Scan again":o(M)?"Scan the network for devices":o(O)?"List my account’s devices":"Scan for devices"}`)),y(Ke,vt)};T(Ae,Ke=>{o(x)?Ke(dt):Ke(he,-1)})}var We=h(ge,2),de=f(We);{var je=Ke=>{var vt=kn();P(()=>B(vt,o(M)?`${e.adapter} --discover on ${e.host}`:o(O)?`${e.adapter} is asking the vendor`:`looking for devices on ${e.host}`)),y(Ke,vt)},fe=Ke=>{var vt=kn();P(()=>B(vt,o(_).length===0?"nothing answered":`${o(_).length} device${o(_).length===1?"":"s"} found`)),y(Ke,vt)},Ft=Ke=>{var vt=Xae(),Ze=h(Dt(vt));gi(Ze,17,i,Ki,(ee,ht,qe)=>{var Ue=Yae(),Z=Dt(Ue);{var Se=Ht=>{var zt=kn();P(()=>B(zt,qe===i().length-1?" and ":", ")),y(Ht,zt)};T(Z,Ht=>{qe>0&&Ht(Se)})}var Oe=h(Z),$t=f(Oe);P(()=>B($t,o(ht))),y(ee,Ue)}),y(Ke,vt)},Te=Ke=>{var vt=Qae(),Ze=h(Dt(vt)),ee=f(Ze);P(()=>B(ee,e.property)),y(Ke,vt)},Be=Ke=>{var vt=Jae(),Ze=h(Dt(vt)),ee=f(Ze),ht=h(Ze),qe=h(ht),Ue=f(qe);P(()=>{B(ee,`${e.adapter??""} --discover`),B(ht,` on ${e.host??""} and fills in `),B(Ue,e.property)}),y(Ke,vt)};T(de,Ke=>{o(x)?Ke(je):o(m)?Ke(fe,1):o(R)?Ke(Ft,2):o(O)?Ke(Te,3):Ke(Be,-1)})}var Je=h(We,2);{var It=Ke=>{var vt=ele(),Ze=f(vt);P(()=>B(Ze,`${o(E)?"− ":"+ "}device on another network?`)),z("click",vt,()=>p(E,!o(E))),y(Ke,vt)};T(Je,Ke=>{o(M)&&Ke(It)})}var ue=h(Ne,2);{var xe=Ke=>{var vt=tle(),Ze=f(vt),ee=h(f(Ze)),ht=h(Ze,2),qe=h(f(ht));ui(ee,()=>o(S),Ue=>p(S,Ue)),ui(qe,()=>o(I),Ue=>p(I,Ue)),y(Ke,vt)};T(ue,Ke=>{o(E)&&o(M)&&Ke(xe)})}var Fe=h(ue,2);{var Ye=Ke=>{var vt=ile(),Ze=f(vt);P(()=>B(Ze,o(C))),y(Ke,vt)};T(Fe,Ke=>{o(C)&&Ke(Ye)})}var nt=h(Fe,2);{var yt=Ke=>{var vt=nle(),Ze=f(vt),ee=h(Ze);{var ht=Oe=>{var $t=kn("Devices behind a router need their address given above.");y(Oe,$t)},qe=Oe=>{var $t=kn("Is the device bound to this account in the vendor's app? A shared device does not show up.");y(Oe,$t)},Ue=Oe=>{var $t=kn("Is the stick plugged into that host?");y(Oe,$t)};T(ee,Oe=>{o(M)?Oe(ht):o(O)?Oe(qe,1):Oe(Ue,-1)})}var Z=h(ee,2),Se=f(Z);P(()=>{B(Ze,`Nothing answered on ${e.host??""}. `),B(Se,e.property)}),y(Ke,vt)};T(nt,Ke=>{o(m)&&o(_).length===0&&!o(x)&&Ke(yt)})}var ci=h(nt,2);{var Rt=Ke=>{var vt=fle();gi(vt,21,()=>o(_),Ze=>Ze.value,(Ze,ee)=>{const ht=ct(()=>d(o(ee)));var qe=hle(),Ue=f(qe);let Z;var Se=f(Ue),Oe=f(Se),$t=f(Oe),Ht=h(Oe,2);{var zt=Le=>{var at=sle(),St=f(at);P(()=>B(St,`already configured as ${o(ee).usedBy??""}`)),y(Le,at)};T(Ht,Le=>{o(ee).usedBy&&Le(zt)})}var Ut=h(Ht,2);{var et=Le=>{var at=ole();y(Le,at)};T(Ut,Le=>{n()===o(ht)&&Le(et)})}var rt=h(Se,2),w=f(rt),V=h(rt,2),Y=f(V);{var oe=Le=>{var at=rle(),St=f(at);P(()=>B(St,o(ee).device)),y(Le,at)};T(Y,Le=>{o(ee).device&&o(ee).device!==o(ee).value&&Le(oe)})}var Ee=h(Y,2);{var lt=Le=>{var at=ZC(),St=f(at);P(()=>B(St,o(ee).model)),y(Le,at)},j=ct(()=>o(ee).model&&o(ee).model!==G(o(ee)));T(Ee,Le=>{o(j)&&Le(lt)})}var Xe=h(Ee,2);{var Ct=Le=>{var at=ZC(),St=f(at);P(()=>B(St,o(ee).type)),y(Le,at)},ce=ct(()=>o(ee).type&&o(ee).type!==G(o(ee)));T(Xe,Le=>{o(ce)&&Le(Ct)})}var Qe=h(Xe,2);{var pt=Le=>{var at=ZC(),St=f(at);P(()=>B(St,`serial ${o(ee).serial??""}`)),y(Le,at)};T(Qe,Le=>{o(ee).serial&&Le(pt)})}var At=h(Qe,2);gi(At,17,()=>q(o(ee)),Ki,(Le,at)=>{var St=ale(),ke=f(St);P(()=>B(ke,o(at))),y(Le,St)});var jt=h(At,2);{var we=Le=>{var at=lle(),St=f(at);P(ke=>B(St,`(${ke??""})`),[()=>o(ee).sources.join("+")]),y(Le,at)};T(jt,Le=>{o(ee).sources.length&&Le(we)})}var tt=h(Ue,2);{var $=Le=>{var at=ule(),St=f(at);gi(St,17,()=>u(o(ee)),X=>X.form,(X,Ve)=>{var Me=cle();let Ce;var Lt=f(Me);P(ti=>{Ce=Xt(Me,1,"form svelte-13vzxas",null,Ce,ti),xi(Me,"title",o(Ve).title),B(Lt,o(Ve).label)},[()=>({on:l(o(ee))===o(Ve).form&&n()===o(ht)})]),z("click",Me,()=>g(o(ee),o(Ve).form)),y(X,Me)});var ke=h(St,2);{var He=X=>{var Ve=dle();y(X,Ve)},re=ct(()=>l(o(ee))==="hostname"&&n()===o(ht));T(ke,X=>{o(re)&&X(He)})}y(Le,at)},be=ct(()=>u(o(ee)).length);T(tt,Le=>{o(be)&&Le($)})}P(Le=>{Z=Xt(Ue,1,"row svelte-13vzxas",null,Z,{active:n()===o(ht),used:!!o(ee).usedBy}),B($t,Le),B(w,o(ht))},[()=>G(o(ee))]),z("click",Ue,()=>g(o(ee))),y(Ze,qe)}),y(Ke,vt)};T(ci,Ke=>{o(_).length>0&&Ke(Rt)})}return P(Ke=>{Xt(ge,1,Nf(o(m)?"ghost":"go"),"svelte-13vzxas"),ge.disabled=o(x)||!e.host||!e.adapter||o(R),xi(ge,"title",Ke)},[()=>o(R)?`fill in ${i().join(" and ")} first — the scan signs in with them`:void 0]),z("click",ge,H),y(r,ye),cs(te)}ms(["click"]);var jA=k('<div class="err-box svelte-149gw3d"> </div>'),vle=k('<button class="ghost svelte-149gw3d">← Back to installations</button>'),xle=k('<button class="ghost svelte-149gw3d">Add another</button>'),mle=k('<div class="ok-box svelte-149gw3d"><strong> </strong> <code class="svelte-149gw3d"> </code>.</div> <pre class="out mono svelte-149gw3d"> </pre> <!>',1),_le=k('<div class="loading svelte-149gw3d"><span class="spinner svelte-149gw3d"></span> Asking the hosts…</div>'),ble=k('<div class="step fixed svelte-149gw3d"><span><span class="lbl svelte-149gw3d">Host</span> <span class="mono svelte-149gw3d"> </span></span> <span><span class="lbl svelte-149gw3d">Adapter</span> <span class="mono svelte-149gw3d"> <!></span></span></div>'),VA=k("<option> </option>"),Cle=k('<span class="muted svelte-149gw3d">No hosts — the she host itself needs <code class="svelte-149gw3d">sudo she --install</code> for the helper.</span>'),yle=k('<span class="muted svelte-149gw3d"> <em>Catalog</em> tab and install it there, or <code class="svelte-149gw3d">sudo npm install -g &lt;adapter&gt;</code> on the host.</span>'),wle=k('<div class="step svelte-149gw3d"><label for="add-host" class="svelte-149gw3d">Host</label> <select id="add-host" class="svelte-149gw3d"></select> <!></div> <div class="step svelte-149gw3d"><label for="add-adapter" class="svelte-149gw3d">Adapter</label> <select id="add-adapter" class="svelte-149gw3d"><option>choose…</option><!></select> <!></div>',1),Ele=k('<div class="loading svelte-149gw3d"><span class="spinner svelte-149gw3d"></span> Reading <span class="mono svelte-149gw3d"> </span> </div>'),$A=k(' <span class="mono svelte-149gw3d"> </span> is filled in for you.',1),Sle=k('<section class="discover svelte-149gw3d" aria-labelledby="add-scan-h"><div class="d-head svelte-149gw3d"><svg width="18" height="18" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" class="svelte-149gw3d"><circle cx="8" cy="8" r="1.6"></circle><path d="M4.8 11.2a4.5 4.5 0 0 1 0-6.4M11.2 4.8a4.5 4.5 0 0 1 0 6.4"></path><path d="M2.6 13.4a7.6 7.6 0 0 1 0-10.8M13.4 2.6a7.6 7.6 0 0 1 0 10.8"></path></svg> <div><strong id="add-scan-h" class="svelte-149gw3d">Find the device</strong> <div class="muted svelte-149gw3d"><!></div></div></div> <!></section>'),kle=k('<span class="err svelte-149gw3d"> </span>'),Dle=k('<span class="muted svelte-149gw3d">from the device name <em> </em></span>'),Ale=k('<span class="muted svelte-149gw3d"> </span>'),Ble=k('<!> <div class="step svelte-149gw3d"><label for="add-name" class="svelte-149gw3d">Instance name</label> <input id="add-name" type="text" spellcheck="false" placeholder="topic prefix, e.g. cul" class="svelte-149gw3d"/> <span class="muted svelte-149gw3d">systemd unit <span class="mono svelte-149gw3d"> </span>, topics <span class="mono svelte-149gw3d"> </span> <!></span> <!></div> <!> <div class="actions svelte-149gw3d"><button class="svelte-149gw3d"> </button> <!></div>',1),Fle=k("<!> <!>",1),Lle=k('<div class="add svelte-149gw3d"><div class="content svelte-149gw3d"><!> <!></div></div>');function Ile(r,e){ls(e,!0);let t=$n(e,"preset",3,null),i=A(!0),n=A(Ci([])),s=A(""),a=A(""),l=A(""),d=A(Ci({})),u=A(null),g=A(Ci([])),x=A(null),m=A(null),C=A("own"),_=A(""),E=A(!1),S=A(!1),I=A(""),M=A(""),O=A(!1),R=ct(()=>{var yt;const nt=((yt=o(u))==null?void 0:yt.properties)??{};for(const[ci,Rt]of Object.entries(nt)){const Ke=Rt["x-discover"];if(Ke===void 0)continue;const vt=(Array.isArray(Ke)?Ke:[Ke]).map(ee=>ee===!0?"network":ee).filter(ee=>ee==="network"||ee==="serial"||ee==="cloud");if(!vt.length)continue;const Ze=(Rt["x-discover-needs"]??[]).filter(ee=>ee!==ci&&nt[ee]).map(ee=>({key:ee,envName:nt[ee]["x-env"],label:nt[ee].description??ee}));return{key:ci,envName:Rt["x-env"],kinds:vt,needs:Ze}}return null}),H=ct(()=>{var yt;const nt={};for(const ci of((yt=o(R))==null?void 0:yt.needs)??[]){const Rt=(o(d)[ci.envName]??"").trim();Rt&&(nt[ci.key]=Rt)}return nt}),G=ct(()=>{var nt;return(((nt=o(R))==null?void 0:nt.needs)??[]).filter(yt=>!o(H)[yt.key]).map(yt=>yt.key)}),q=A(null),te=A(null),ye=A(!1);function Ne(nt,yt){var ci;p(q,nt,!0),p(te,yt,!0),(ci=o(R))!=null&&ci.envName&&p(d,{...o(d),[o(R).envName]:yt},!0),!o(ye)&&nt.suggestName&&p(l,nt.suggestName,!0)}let ge=ct(()=>o(n).find(nt=>nt.name===o(s))??null),Ae=ct(()=>{var nt;return(nt=o(ge))!=null&&nt.ok?o(ge).adapters??[]:[]}),dt=ct(()=>{var nt;return(((nt=o(ge))==null?void 0:nt.instances)??[]).filter(yt=>yt.adapter===o(a)).map(yt=>yt.instance)}),he=ct(()=>/^[A-Za-z0-9_.-]+$/.test(o(l))&&!o(dt).includes(o(l))),We=ct(()=>o(u)?(o(u).required??[]).filter(nt=>nt!=="name").filter(nt=>{const yt=o(u).properties[nt];return yt&&!(o(d)[yt["x-env"]]??"").trim()}):[]);Os(async()=>{try{p(n,(await pa()).hosts,!0);const nt=o(n).find(yt=>yt.ok);nt&&p(s,nt.name,!0)}catch(nt){p(M,nt.message??String(nt),!0)}finally{p(i,!1)}});let de=-1;cn(()=>{t()&&t().n!==de&&(de=t().n,je(t()))});async function je(nt){p(i,!0);try{p(n,(await pa()).hosts,!0)}catch{}finally{p(i,!1)}o(O)&&Te(),p(s,nt.host,!0),await ga(),fe(nt.adapter)}cn(()=>{o(s),p(a,""),p(u,null),p(d,{},!0),p(l,""),p(q,null),p(te,null),p(ye,!1)});async function fe(nt){var yt,ci;if(p(a,nt,!0),p(u,null),p(d,{},!0),p(_,""),p(q,null),p(te,null),p(ye,!1),!(!nt||!o(s))){p(E,!0);try{const Rt=await PK(o(s),nt);p(u,Rt.schema,!0),p(g,Rt.secrets,!0),p(x,Rt.sheBroker,!0),p(m,Rt.dynsec,!0),p(C,Rt.sheBroker?"she":"own",!0);const Ke=(ci=(yt=o(u).properties)==null?void 0:yt.name)==null?void 0:ci.default;!o(l)&&typeof Ke=="string"&&p(l,o(dt).includes(Ke)?Ke+"2":Ke,!0)}catch(Rt){p(_,Rt.message??String(Rt),!0)}finally{p(E,!1)}}}async function Ft(){var nt;if(!(!o(s)||!o(a)||!o(he)||o(We).length)){p(S,!0),p(M,""),p(I,"");try{const yt=await TK(o(s),o(a),o(l),o(d),o(C));p(I,yt.output,!0),p(O,!0),(nt=e.oninstalled)==null||nt.call(e,o(s),o(a),o(l))}catch(yt){p(M,yt.message??String(yt),!0)}finally{p(S,!1)}}}function Te(){p(O,!1),p(I,""),p(M,""),p(l,""),p(d,{},!0),p(u,null),p(a,""),p(q,null),p(te,null),p(ye,!1)}var Be=Lle(),Je=f(Be),It=f(Je);{var ue=nt=>{var yt=jA(),ci=f(yt);P(()=>B(ci,o(M))),y(nt,yt)};T(It,nt=>{o(M)&&!o(O)&&nt(ue)})}var xe=h(It,2);{var Fe=nt=>{var yt=mle(),ci=Dt(yt),Rt=f(ci),Ke=f(Rt),vt=h(Rt),Ze=h(vt),ee=f(Ze),ht=h(ci,2),qe=f(ht),Ue=h(ht,2);{var Z=Oe=>{var $t=vle();z("click",$t,function(...Ht){var zt;(zt=e.onclose)==null||zt.apply(this,Ht)}),y(Oe,$t)},Se=Oe=>{var $t=xle();z("click",$t,Te),y(Oe,$t)};T(Ue,Oe=>{e.onclose?Oe(Z):Oe(Se,-1)})}P(()=>{B(Ke,`${o(a)??""}@${o(l)??""}`),B(vt,` installed on ${o(s)??""} and started. It shows up in the Instances tab as soon as it publishes `),B(ee,`${o(l)??""}/connected`),B(qe,o(I))}),y(nt,yt)},Ye=nt=>{var yt=Fle(),ci=Dt(yt);{var Rt=ht=>{var qe=_le();y(ht,qe)},Ke=ht=>{var qe=ble(),Ue=f(qe),Z=h(f(Ue),2),Se=f(Z),Oe=h(Ue,2),$t=h(f(Oe),2),Ht=f($t),zt=h(Ht);{var Ut=rt=>{var w=kn();P(V=>B(w,V),[()=>{var V;return(V=o(Ae).find(Y=>Y.name===o(a)))==null?void 0:V.version}]),y(rt,w)},et=ct(()=>{var rt;return(rt=o(Ae).find(w=>w.name===o(a)))==null?void 0:rt.version});T(zt,rt=>{o(et)&&rt(Ut)})}P(()=>{var rt;B(Se,((rt=o(ge))==null?void 0:rt.hostname)??o(s)),B(Ht,o(a))}),y(ht,qe)},vt=ht=>{var qe=wle(),Ue=Dt(qe),Z=h(f(Ue),2);gi(Z,21,()=>o(n),V=>V.name,(V,Y)=>{var oe=VA(),Ee=f(oe),lt={};P(()=>{oe.disabled=!o(Y).ok,B(Ee,`${o(Y).hostname??o(Y).name??""}${o(Y).ok?"":" — unavailable"}`),lt!==(lt=o(Y).name)&&(oe.value=(oe.__value=o(Y).name)??"")}),y(V,oe)});var Se=h(Z,2);{var Oe=V=>{var Y=Cle();y(V,Y)};T(Se,V=>{o(n).length===0&&V(Oe)})}var $t=h(Ue,2),Ht=h(f($t),2),zt=f(Ht);zt.value=zt.__value="";var Ut=h(zt);gi(Ut,17,()=>o(Ae),V=>V.name,(V,Y)=>{var oe=VA(),Ee=f(oe),lt={};P(()=>{B(Ee,`${o(Y).name??""}${o(Y).version?` ${o(Y).version}`:""}`),lt!==(lt=o(Y).name)&&(oe.value=(oe.__value=o(Y).name)??"")}),y(V,oe)});var et;wp(Ht);var rt=h(Ht,2);{var w=V=>{var Y=yle(),oe=f(Y);P(()=>B(oe,`No adapters installed on ${o(s)??""} yet — pick one on the `)),y(V,Y)};T(rt,V=>{var Y;(Y=o(ge))!=null&&Y.ok&&o(Ae).length===0&&V(w)})}P(()=>{var V;Ht.disabled=!((V=o(ge))!=null&&V.ok),et!==(et=o(a))&&(Ht.value=(Ht.__value=o(a))??"",hh(Ht,o(a)))}),to(Z,()=>o(s),V=>p(s,V)),z("change",Ht,V=>fe(V.target.value)),y(ht,qe)};T(ci,ht=>{o(i)?ht(Rt):t()?ht(Ke,1):ht(vt,-1)})}var Ze=h(ci,2);{var ee=ht=>{var qe=ks(),Ue=Dt(qe);{var Z=$t=>{var Ht=Ele(),zt=h(f(Ht),2),Ut=f(zt),et=h(zt);P(()=>{var rt;B(Ut,`${o(a)??""} --config-schema`),B(et,` on ${((rt=o(ge))==null?void 0:rt.hostname)??o(s)??""}…`)}),y($t,Ht)},Se=$t=>{var Ht=jA(),zt=f(Ht);P(()=>B(zt,o(_))),y($t,Ht)},Oe=$t=>{var Ht=Ble(),zt=Dt(Ht);{var Ut=tt=>{var $=Sle(),be=f($),Le=h(f(be),2),at=h(f(Le),2),St=f(at);{var ke=Ve=>{var Me=$A(),Ce=Dt(Me),Lt=h(Ce),ti=f(Lt);P(()=>{B(Ce,`${o(a)??""} can ask the vendor which devices your account owns — nothing is scanned on your
278
278
  network. Pick one and `),B(ti,o(R).key)}),y(Ve,Me)},He=ct(()=>o(R).kinds.includes("cloud")),re=Ve=>{var Me=$A(),Ce=Dt(Me),Lt=h(Ce),ti=f(Lt);P(xt=>{var ve;B(Ce,`${o(a)??""} can look for its ${xt??""} from
279
279
  ${((ve=o(ge))==null?void 0:ve.hostname)??o(s)??""} — pick what answers and `),B(ti,o(R).key)},[()=>o(R).kinds.includes("network")?"device on the network":"stick"]),y(Ve,Me)};T(St,Ve=>{o(He)?Ve(ke):Ve(re,-1)})}var X=h(be,2);gle(X,{get host(){return o(s)},get adapter(){return o(a)},get kinds(){return o(R).kinds},get property(){return o(R).key},get needs(){return o(H)},get missing(){return o(G)},get selected(){return o(te)},onpick:Ne}),y(tt,$)};T(zt,tt=>{o(R)&&tt(Ut)})}var et=h(zt,2),rt=h(f(et),2),w=h(rt,2),V=h(f(w)),Y=f(V),oe=h(V,2),Ee=f(oe),lt=h(oe,2);{var j=tt=>{var $=kle(),be=f($);P(Le=>B(be,`— ${Le??""}`),[()=>o(dt).includes(o(l))?"already exists on this host":"letters, digits, _ . - only"]),y(tt,$)};T(lt,tt=>{o(l)&&!o(he)&&tt(j)})}var Xe=h(w,2);{var Ct=tt=>{var $=Dle(),be=h(f($)),Le=f(be);P(()=>B(Le,o(q).name)),y(tt,$)};T(Xe,tt=>{var $;($=o(q))!=null&&$.name&&!o(ye)&&o(l)===o(q).suggestName&&tt(Ct)})}var ce=h(et,2);{let tt=ct(()=>o(m)?{...o(m),client:"svc-"+(o(l)||"<instance>")}:null);Z7(ce,{get schema(){return o(u)},get secrets(){return o(g)},mode:"install",get sheBroker(){return o(x)},get dynsec(){return o(tt)},get env(){return o(d)},set env($){p(d,$,!0)},get brokerMode(){return o(C)},set brokerMode($){p(C,$,!0)}})}var Qe=h(ce,2),pt=f(Qe),At=f(pt),jt=h(pt,2);{var we=tt=>{var $=Ale(),be=f($);P(Le=>B(be,`required: ${Le??""}`),[()=>o(We).map(Le=>"--"+Le).join(", ")]),y(tt,$)};T(jt,tt=>{o(We).length&&tt(we)})}P(()=>{B(Y,`${o(a)??""}@${(o(l)||"…")??""}`),B(Ee,`${(o(l)||"…")??""}/#`),pt.disabled=o(S)||!o(he)||o(We).length>0,B(At,o(S)?"Installing…":`Install ${o(a)}@${o(l)||"…"}`)}),z("input",rt,()=>p(ye,!0)),ui(rt,()=>o(l),tt=>p(l,tt)),z("click",pt,Ft),y($t,Ht)};T(Ue,$t=>{o(E)?$t(Z):o(_)?$t(Se,1):o(u)&&$t(Oe,2)})}y(ht,qe)};T(Ze,ht=>{o(a)&&ht(ee)})}y(nt,yt)};T(xe,nt=>{o(O)?nt(Fe):nt(Ye,-1)})}y(r,Be),cs()}ms(["click","change","input"]);var Ple=k('<div class="sheet-head svelte-olch1e"><button class="ghost sm svelte-olch1e">← Installations</button> <strong>Add instance</strong> <span class="muted svelte-olch1e">a systemd instance of the adapter on the host, configured from its --config-schema</span></div> <!>',1),Tle=k('<button class="ghost svelte-olch1e" title="Update every adapter that has a newer version, one after another"> </button>'),Mle=k('<span class="spinner svelte-olch1e" title="Asking every host…"></span>'),YC=k('<span class="muted svelte-olch1e"> </span>'),Rle=k('<div class="loading-row svelte-olch1e"><span class="spinner svelte-olch1e"></span> Asking every host — a host over a slow link can take a moment…</div>'),Nle=k('<div class="err-box svelte-olch1e"> </div>'),Ole=k('<span class="muted svelte-olch1e" title="she ships a newer she-servicectl — update it on the Hosts tab"> </span>'),Hle=k('<div class="hint svelte-olch1e">Install the helper on this host: <code class="svelte-olch1e">sudo she --install</code> (copies <code class="svelte-olch1e">she-servicectl</code> to <code class="svelte-olch1e">/usr/local/bin</code> and allows it in <code class="svelte-olch1e">/etc/sudoers.d/she</code>).</div>'),zle=k('<div class="hint svelte-olch1e">The helper is not on this host yet — deploy it from the Hosts tab, or run the one-line setup command there on the host as root.</div>'),Wle=k('<div class="hint svelte-olch1e">Add to <code class="svelte-olch1e">/etc/sudoers.d/she</code>: <code class="svelte-olch1e">she ALL=(root) NOPASSWD: /usr/local/bin/she-servicectl</code> — <code class="svelte-olch1e">sudo she --install</code> does this.</div>'),jle=k('<div class="hint svelte-olch1e">Allow the helper for <code class="svelte-olch1e"> </code> on the host: <code class="svelte-olch1e"> </code> in <code class="svelte-olch1e">/etc/sudoers.d/she-services</code> — <em>Deploy helper</em> on the Hosts tab prints the exact commands.</div>'),Vle=k(`<div class="hint svelte-olch1e">SSH to <code class="svelte-olch1e"> </code> failed — is the services public key (Hosts tab) in that user's <code class="svelte-olch1e">~/.ssh/authorized_keys</code>, and the host reachable? The setup command in the Hosts tab does the whole host setup in one go.</div>`),$le=k('<div class="hint svelte-olch1e">The host entry has an <code class="svelte-olch1e">ssh</code> block without a <code class="svelte-olch1e">host</code> — fix it on the Hosts tab.</div>'),qle=k('<div class="err-box svelte-olch1e"> <!></div>'),Ule=k('<span class="badge b-upd svelte-olch1e"> </span>'),Gle=k('<span class="badge warn-b svelte-olch1e">manual</span>'),Kle=k('<span class="muted svelte-olch1e">npm</span>'),Zle=k('<button class="ghost sm svelte-olch1e"> </button>'),Yle=k('<tr><td class="mono svelte-olch1e"> </td><td class="svelte-olch1e"><span class="ver svelte-olch1e"> <!></span></td><td class="svelte-olch1e"><!></td><td class="svelte-olch1e"><!></td><td class="c-act svelte-olch1e"><!> <button class="ghost sm danger svelte-olch1e"> </button> <button class="ghost sm svelte-olch1e">+ instance</button></td></tr>'),Xle=k('<tr><td colspan="5" class="muted svelte-olch1e">No mqtt-interfaces adapters installed on this host (no <span class="mono svelte-olch1e">&lt;adapter&gt;@.service</span> template unit reading <span class="mono svelte-olch1e">/etc/&lt;adapter&gt;/%i.env</span>).</td></tr>'),Qle=k('<table class="adapters svelte-olch1e"><colgroup><col class="c-adapter svelte-olch1e"/><col class="c-version svelte-olch1e"/><col class="c-origin svelte-olch1e"/><col class="c-instances"/><col class="c-actions svelte-olch1e"/></colgroup><thead><tr><th class="svelte-olch1e">Adapter</th><th class="svelte-olch1e">Installed</th><th class="svelte-olch1e">Origin</th><th class="svelte-olch1e">Instances</th><th class="c-act svelte-olch1e"></th></tr></thead><tbody><!><!></tbody></table>'),Jle=k('<div class="card svelte-olch1e"><div class="card-head svelte-olch1e"><span></span> <span class="name svelte-olch1e"> </span> <span class="muted svelte-olch1e"> </span> <span class="spacer svelte-olch1e"></span> <!></div> <!></div>'),ece=k('<pre class="out mono svelte-olch1e"> </pre>'),tce=k(' <span class="mono svelte-olch1e"> </span> ',1),ice=k(`<div class="card unmanaged svelte-olch1e"><div class="card-head svelte-olch1e"><span class="dot svelte-olch1e"></span> <span class="name svelte-olch1e"> </span> <span class="muted svelte-olch1e">seen on MQTT, not managed</span></div> <div class="muted svelte-olch1e"> <!>.
@@ -292,4 +292,4 @@ ${Je.length===1?"There is an instance":"There are "+Je.length+" instances"} of i
292
292
  `)]),y(ft,ut)};T(ve,ft=>{"error"in o(Ce)&&o(Ce).error&&!("ok"in o(Ce))?ft(it):"ok"in o(Ce)&&o(Ce).ok?ft(Mt,1):"ok"in o(Ce)&&ft(Jt,2)})}P(()=>ti=Xt(Lt,1,"deploy-box in-card svelte-ns6riw",null,ti,{"deploy-ok":"ok"in o(Ce)&&o(Ce).ok})),y(Me,Lt)};T(X,Me=>{o(te)[He()]&&Me(Ve)})}y(ke,re)};let a=$n(e,"generation",3,0),l=$n(e,"origin",3,null),d=A(Ci([])),u=A(""),g=A(Ci([])),x=A(!0),m=A(!1),C=A(""),_=A(""),E=A(""),S=A(void 0),I=A("list"),M=A(null),O=A(null),R=A(Ci({})),H=A(null),G=ct(()=>o(g).filter(ke=>ke.ok&&ke.helperOutdated).length);cn(()=>{var ke;(ke=e.onupdates)==null||ke.call(e,o(G))});let q=A(null),te=A(Ci({}));async function ye(ke){var He;p(q,ke,!0);try{const re=await _D(ke);p(te,{...o(te),[ke]:re},!0),re.ok&&(p(g,(await pa(!0)).hosts,!0),(He=e.onchanged)==null||He.call(e))}catch(re){p(te,{...o(te),[ke]:{error:re.message??String(re)}},!0)}finally{p(q,null)}}let Ne=A(!1),ge=A(""),Ae=ct(()=>o(g).filter(ke=>ke.ok&&ke.helperOutdated).map(ke=>ke.name));async function dt(){var He;const ke=o(Ae);if(!(ke.length===0||o(Ne))){p(Ne,!0);try{for(const[re,X]of ke.entries()){p(ge,`${re+1} of ${ke.length}: ${X}`);try{p(te,{...o(te),[X]:await _D(X)},!0)}catch(Ve){p(te,{...o(te),[X]:{error:Ve.message??String(Ve)}},!0)}}p(g,(await pa(!0)).hosts,!0),(He=e.onchanged)==null||He.call(e)}finally{p(Ne,!1),p(ge,"")}}}let he=A(null),We=A(Ci({})),de=A(null),je=A(Ci({})),fe=A(null);const Ft=[{key:"stable",label:"stable"},{key:"lts",label:"LTS"},{key:"latest",label:"latest"}],Te=ke=>{var He,re;return(ke==="latest"?(He=o(fe))==null?void 0:He.latest:(re=o(fe))==null?void 0:re.lts)??null};function Be(ke,He){if(!ke||!He)return null;const re=Me=>Me.replace(/^v/,"").split(".").map(Ce=>Number(Ce)||0),[X,Ve]=[re(ke),re(He)];for(let Me=0;Me<Math.max(X.length,Ve.length);Me++)if((X[Me]??0)!==(Ve[Me]??0))return(X[Me]??0)<(Ve[Me]??0)?-1:1;return 0}const Je=ke=>ke&&Number(ke.replace(/^v/,"").split(".")[0])||0;let It=ct(()=>o(g).filter(ke=>{if(!ke.ok||!ke.node||!o(fe))return!1;const re=!!o(fe).latest&&Je(ke.node)===Je(o(fe).latest)?o(fe).latest:o(fe).lts;return!!re&&Be(re,ke.node)===1}).length);cn(()=>{var ke;(ke=e.onnodeupdates)==null||ke.call(e,o(It))});function ue(ke){return Ft.map(He=>{const re=Te(He.key);return{...He,target:re,current:!!re&&re===ke.node,downgrade:Be(re,ke.node)===-1}})}async function xe(ke,He){var Ve,Me,Ce;const re=((Ve=Ht(ke))==null?void 0:Ve.local)===!0;if(await((Me=o(S))==null?void 0:Me.show(`Install Node.js ${Te(He)??`"${He}"`} on ${ke} with n install ${He}? This replaces the host's node binary; running adapters keep the current version until they are restarted.`+(re?" she runs on this host too — it keeps the old binary until the daemon itself is restarted.":""),{confirm:"Update Node.js"}))){p(he,ke,!0),p(je,{...o(je),[ke]:void 0},!0);try{const Lt=await $K(ke,He);p(We,{...o(We),[ke]:Lt},!0),p(g,(await pa(!0)).hosts,!0),(Ce=e.onchanged)==null||Ce.call(e)}catch(Lt){p(We,{...o(We),[ke]:{error:Lt.message??String(Lt)}},!0)}finally{p(he,null)}}}async function Fe(ke){var He;p(de,ke,!0);try{p(je,{...o(je),[ke]:await UK(ke)},!0),(He=e.onchanged)==null||He.call(e)}catch(re){p(je,{...o(je),[ke]:{error:re.message??String(re)}},!0)}finally{p(de,null)}}let Ye=A(null),nt=A(""),yt=A(!1),ci=A(!1),Rt=A(Ci({host:"",port:"",user:"",identityFile:"",hostname:""})),Ke=A(null),vt=A(!1),Ze=A(Ci(location.origin)),ee=A(null),ht=A(null),qe=A(""),Ue=A(!1),Z=A(""),Se=A(!1),Oe=null;const $t=ct(()=>JSON.stringify({remotes:o(d)})!==o(u)),Ht=ke=>o(g).find(He=>He.name===ke)??null,zt=ct(()=>o(g).find(ke=>ke.local)??null),Ut=(ke,He)=>(ke.hostname||ke.host).localeCompare(He.hostname||He.host,void 0,{numeric:!0,sensitivity:"base"});function et(ke){const He=ke.services,re=Array.isArray(He==null?void 0:He.hosts)?He.hosts:null;p(d,(re??[]).filter(X=>X&&X.ssh).map(X=>({host:String(X.ssh.host??""),port:typeof X.ssh.port=="number"?X.ssh.port:"",user:String(X.ssh.user??""),identityFile:String(X.ssh.identityFile??""),hostname:String(X.hostname??"")})).sort(Ut),!0),p(u,JSON.stringify({remotes:o(d)}),!0)}async function rt(ke=!1){p(x,!0),p(C,"");try{const[He,re]=await Promise.all([yc(),pa(ke).catch(()=>({hosts:[]}))]);et(He),p(g,re.hosts,!0)}catch(He){p(C,He.message??String(He),!0)}finally{p(x,!1)}w()}async function w(){try{const ke=await WK();p(Ye,ke.publicKey,!0),p(nt,ke.identityFile,!0)}catch{}try{p(E,(await Gc()).user??"",!0)}catch{}}Os(()=>rt());let V=0;cn(()=>{const ke=a();ke!==V&&(V=ke,Ho(()=>{l()!=="hostsconf"&&(async()=>{if(o($t))try{p(g,(await pa(!0)).hosts,!0)}catch{}else await rt(!0)})()}))}),Os(async()=>{try{p(fe,await qK(),!0)}catch{}}),Lh(()=>pt());function Y(ke){p(_,ke,!0),setTimeout(()=>{o(_)===ke&&p(_,"")},3e3)}async function oe(){var ke;p(m,!0),p(C,"");try{const He=[{name:"local"}];for(const re of o(d)){if(!re.host.trim())continue;const X={host:re.host.trim()};re.port!==""&&Number(re.port)>0&&(X.port=Number(re.port)),re.user.trim()&&(X.user=re.user.trim()),re.identityFile.trim()&&(X.identityFile=re.identityFile.trim()),He.push({...re.hostname.trim()?{hostname:re.hostname.trim()}:{},ssh:X})}await z0("services.hosts",He),window.dispatchEvent(new CustomEvent("she:config-changed")),p(u,JSON.stringify({remotes:o(d)}),!0),p(M,null),Y("saved"),(ke=e.onchanged)==null||ke.call(e),p(g,(await pa(!0)).hosts,!0)}catch(He){p(C,He.message??String(He),!0)}finally{p(m,!1)}}function Ee(){const ke=JSON.parse(o(u));p(d,ke.remotes,!0),p(M,null)}async function lt(ke){const He=ke.host;p(H,He,!0);try{const re=await mD({host:ke.host.trim(),port:ke.port,user:ke.user.trim(),identityFile:ke.identityFile.trim()});p(R,{...o(R),[He]:re.ok?{ok:!0,msg:`helper v${re.helper??"?"}`}:{ok:!1,msg:`${re.code}: ${re.error}`}},!0)}catch(re){p(R,{...o(R),[He]:{ok:!1,msg:re.message??String(re)}},!0)}finally{p(H,null)}}async function j(){p(H,"local");try{const ke=await VK("local");p(R,{...o(R),local:ke.ok?{ok:!0,msg:`helper v${ke.helper??"?"}`}:{ok:!1,msg:`${ke.code}: ${ke.error}`}},!0)}catch(ke){p(R,{...o(R),local:{ok:!1,msg:ke.message??String(ke)}},!0)}finally{p(H,null)}}async function Xe(ke){var re;const He=o(d)[ke];await((re=o(S))==null?void 0:re.show(`Remove ${He.hostname||He.host} from the list? she stops managing it; nothing on the host is changed (use "Remove from host…" for that).`,{confirm:"Remove",danger:!0}))&&(p(d,o(d).filter((X,Ve)=>Ve!==ke),!0),o(M)===ke&&p(M,null))}function Ct(){p(Rt,{host:"",port:"",user:"",identityFile:"",hostname:""},!0),p(Ke,null),p(Z,""),p(I,"add")}async function ce(){if(!o(Rt).host.trim()){p(Ke,{ok:!1,msg:"enter a host first"},!0);return}p(vt,!0);try{const ke=await mD({host:o(Rt).host.trim(),port:o(Rt).port,user:o(Rt).user.trim(),identityFile:o(Rt).identityFile.trim()});p(Ke,ke.ok?{ok:!0,msg:`helper v${ke.helper??"?"}`}:{ok:!1,msg:`${ke.code}: ${ke.error}`},!0)}catch(ke){p(Ke,{ok:!1,msg:ke.message??String(ke)},!0)}finally{p(vt,!1)}}function Qe(){o(Rt).host.trim()&&(p(d,[...o(d),{...o(Rt),host:o(Rt).host.trim(),user:o(Rt).user.trim(),identityFile:o(Rt).identityFile.trim(),hostname:o(Rt).hostname.trim()}].sort(Ut),!0),p(I,"list"),Y("host added — Save to keep it"))}function pt(){Oe&&(clearInterval(Oe),Oe=null)}async function At(){p(Ue,!0),p(Z,""),p(ee,null),p(ht,null),p(qe,""),p(Se,!1),pt();try{p(ee,await GK(o(Ze).trim().replace(/\/+$/,"")),!0),p(ht,"pending"),w(),Oe=setInterval(async()=>{var ke;if(!o(ee))return pt();try{const He=await KK(o(ee).token);p(ht,He.status,!0),He.status==="done"?(p(qe,He.host??"",!0),pt(),et(await yc()),p(g,(await pa(!0)).hosts,!0),(ke=e.onchanged)==null||ke.call(e)):He.status==="expired"&&pt()}catch{}},3e3)}catch(ke){p(Z,ke.message??String(ke),!0)}finally{p(Ue,!1)}}async function jt(ke,He){try{await navigator.clipboard.writeText(ke),He(!0),setTimeout(()=>He(!1),2e3)}catch{}}async function we(){var ke;if(!(o(Ye)&&!await((ke=o(S))==null?void 0:ke.show("Regenerate the services SSH key? Every remote host then needs the new public key (re-run the setup command, or replace it in authorized_keys).",{confirm:"Regenerate",danger:!0})))){p(yt,!0);try{const He=await jK();p(Ye,He.publicKey,!0),p(nt,He.identityFile,!0),Y("key generated")}catch(He){p(C,He.message??String(He),!0)}finally{p(yt,!1)}}}var tt=yde(),$=Dt(tt);ts(kr($,{}),ke=>p(S,ke,!0),()=>o(S));var be=h($,2),Le=f(be);{var at=ke=>{var He=sde(),re=Dt(He),X=f(re),Ve=h(re,2),Me=f(Ve),Ce=h(f(Me),4),Lt=h(f(Ce),2),ti=h(Lt,2),xt=f(ti),ve=h(Ce,2);{var it=me=>{var Ie=Jce(),st=f(Ie);P(()=>B(st,o(Z))),y(me,Ie)};T(ve,me=>{o(Z)&&me(it)})}var Mt=h(ve,2);{var Jt=me=>{var Ie=nde(),st=Dt(Ie),mt=f(st),Ot=f(mt),Kt=h(mt),Wt=f(Kt),qt=h(st,2),Yt=f(qt),ni=h(Yt),Ai=f(ni),Pe=h(ni,2),$e=f(Pe),Gt=h(qt,2),ai=f(Gt);{var _e=Pt=>{var hi=ede();y(Pt,hi)},Vt=Pt=>{var hi=tde();y(Pt,hi)},_t=Pt=>{var hi=ide(),Et=Dt(hi),kt=f(Et),di=h(kt),ki=f(di),_i=h(Et,2);P(()=>{B(kt,`✓ ${o(qe)??""} registered as `),B(ki,o(ee).user)}),z("click",_i,()=>p(I,"list")),y(Pt,hi)},bt=Pt=>{var hi=kn("command expired — create a new one.");y(Pt,hi)};T(ai,Pt=>{o(ht)==="pending"?Pt(_e):o(ht)==="fetched"?Pt(Vt,1):o(ht)==="done"?Pt(_t,2):o(ht)==="expired"&&Pt(bt,3)})}P(Pt=>{B(Ot,o(ee).command),B(Wt,o(Se)?"Copied":"Copy"),B(Yt,`Valid until ${Pt??""}, single use. To read it first: `),B(Ai,`curl -fsSL '${o(ee).scriptUrl??""}' -o she-setup.sh`),B($e,o(ee).sha256)},[()=>new Date(o(ee).expires).toLocaleTimeString()]),z("click",Kt,()=>jt(o(ee).command,Pt=>p(Se,Pt,!0))),y(me,Ie)};T(Mt,me=>{o(ee)&&me(Jt)})}var ft=h(Me,2),ut=h(f(ft),4),Bt=f(ut),ei=h(f(Bt)),J=h(Bt,2),Re=h(f(J)),ne=h(J,2),se=h(f(ne)),De=h(ne,2),pe=h(f(De)),gt=h(ut,2),U=f(gt),ot=f(U),W=h(U,2);{var Q=me=>{var Ie=GA();let st;var mt=f(Ie);P(()=>{st=Xt(Ie,1,"test-mark svelte-ns6riw",null,st,{ok:o(Ke).ok,err:!o(Ke).ok}),B(mt,o(Ke).ok?`✓ ${o(Ke).msg}`:`✗ ${o(Ke).msg}`)}),y(me,Ie)};T(W,me=>{o(Ke)&&me(Q)})}var ae=h(W,4);P(me=>{ti.disabled=o(Ue),B(xt,o(Ue)?"Preparing…":"Create setup command"),xi(se,"placeholder",o(E)?`${o(E)} (default)`:"user she runs as"),U.disabled=o(vt),B(ot,o(vt)?"Testing…":"Test connection"),ae.disabled=me},[()=>!o(Rt).host.trim()]),z("click",X,()=>p(I,"list")),ui(Lt,()=>o(Ze),me=>p(Ze,me)),z("click",ti,At),ui(ei,()=>o(Rt).host,me=>o(Rt).host=me),ui(Re,()=>o(Rt).port,me=>o(Rt).port=me),ui(se,()=>o(Rt).user,me=>o(Rt).user=me),ui(pe,()=>o(Rt).identityFile,me=>o(Rt).identityFile=me),z("click",U,ce),z("click",ae,Qe),y(ke,He)},St=ke=>{var He=Cde(),re=Dt(He),X=f(re),Ve=f(X);let Me;var Ce=h(X,2),Lt=h(Ce,2),ti=f(Lt),xt=h(Lt,2);{var ve=_t=>{var bt=ode();y(_t,bt)};T(xt,_t=>{o(x)&&_t(ve)})}var it=h(xt,2);{var Mt=_t=>{var bt=rde(),Pt=f(bt);P(()=>{bt.disabled=o(Ne)||o(q)!==null,B(Pt,o(Ne)?`Updating ${o(ge)}…`:`Update all helpers (${o(Ae).length})`)}),z("click",bt,dt),y(_t,bt)};T(it,_t=>{o(Ae).length>1&&_t(Mt)})}var Jt=h(it,4);{var ft=_t=>{var bt=ade(),Pt=f(bt);P(()=>B(Pt,o(_))),y(_t,bt)};T(Jt,_t=>{o(_)&&_t(ft)})}var ut=h(Jt,2);{var Bt=_t=>{var bt=lde(),Pt=h(Dt(bt),2),hi=h(Pt,2),Et=f(hi);P(()=>{Pt.disabled=o(m),hi.disabled=o(m),B(Et,o(m)?"Saving…":"Save")}),z("click",Pt,Ee),z("click",hi,oe),y(_t,bt)};T(ut,_t=>{o($t)&&_t(Bt)})}var ei=h(re,2);{var J=_t=>{var bt=cde(),Pt=f(bt);P(()=>B(Pt,o(C))),y(_t,bt)};T(ei,_t=>{o(C)&&_t(J)})}var Re=h(ei,2),ne=f(Re),se=f(ne),De=f(se);let pe;var gt=h(De,2),U=f(gt),ot=h(gt,6);{var W=_t=>{i(_t,()=>"local",()=>o(zt))};T(ot,_t=>{var bt;(bt=o(zt))!=null&&bt.ok&&_t(W)})}var Q=h(ot,2),ae=h(Q);t(ae,()=>"local");var me=h(se,2);{var Ie=_t=>{n(_t,()=>"local",()=>o(zt))};T(me,_t=>{var bt;(bt=o(zt))!=null&&bt.ok&&_t(Ie)})}var st=h(me,2);s(st,()=>"local");var mt=h(st,2);{var Ot=_t=>{var bt=ude(),Pt=f(bt),hi=h(Pt);{var Et=kt=>{var di=dde(),ki=Dt(di);ki.nodeValue=" — run ",y(kt,di)};T(hi,kt=>{o(zt).code==="HELPER_MISSING"&&kt(Et)})}P(()=>B(Pt,o(zt).error)),y(_t,bt)};T(mt,_t=>{o(zt)&&!o(zt).ok&&_t(Ot)})}var Kt=h(ne,2);gi(Kt,17,()=>o(d),Ki,(_t,bt,Pt)=>{const hi=ct(()=>Ht(o(bt).host));var Et=xde(),kt=f(Et),di=f(kt);let ki;var _i=h(di,2),Fi=f(_i),Nt=h(_i,2),ri=f(Nt),bi=h(Nt,2);{var Oi=mi=>{var Ri=hde();P(()=>xi(Ri,"title",o(bt).identityFile)),y(mi,Ri)};T(bi,mi=>{o(bt).identityFile&&mi(Oi)})}var wi=h(bi,4);{var Ji=mi=>{i(mi,()=>o(bt).host,()=>o(hi))},en=mi=>{var Ri=fde(),Ni=f(Ri);P(()=>{Ri.disabled=o(q)!==null,B(Ni,o(q)===o(bt).host?"Deploying…":"Deploy helper")}),z("click",Ri,()=>ye(o(bt).host)),y(mi,Ri)};T(wi,mi=>{var Ri;(Ri=o(hi))!=null&&Ri.ok?mi(Ji):o(hi)&&!o(hi).ok&&mi(en,1)})}var Cn=h(wi,2),tn=h(Cn);t(tn,()=>o(bt).host);var Mi=h(tn,2);let An;var on=h(Mi,2);let sn;var zn=h(on,2),wn=h(kt,2);{var _s=mi=>{n(mi,()=>o(bt).host,()=>o(hi))};T(wn,mi=>{var Ri;(Ri=o(hi))!=null&&Ri.ok&&mi(_s)})}var Gs=h(wn,2);s(Gs,()=>o(bt).host);var $s=h(Gs,2);{var vi=mi=>{var Ri=pde(),Ni=f(Ri);P(()=>B(Ni,o(hi).error)),y(mi,Ri)};T($s,mi=>{o(hi)&&!o(hi).ok&&mi(vi)})}var Bi=h($s,2);{var Ti=mi=>{var Ri=gde(),Ni=f(Ri),Zi=h(f(Ni)),$i=h(Ni,2),ji=h(f($i)),_n=h($i,2),un=h(f(_n)),En=h(_n,2),Bn=h(f(En)),bn=h(En,2),dn=h(f(bn));P(()=>xi(un,"placeholder",o(E)?`${o(E)} (default)`:"user she runs as")),ui(Zi,()=>o(bt).host,hn=>o(bt).host=hn),ui(ji,()=>o(bt).port,hn=>o(bt).port=hn),ui(un,()=>o(bt).user,hn=>o(bt).user=hn),ui(Bn,()=>o(bt).identityFile,hn=>o(bt).identityFile=hn),ui(dn,()=>o(bt).hostname,hn=>o(bt).hostname=hn),y(mi,Ri)};T(Bi,mi=>{o(M)===Pt&&mi(Ti)})}var Wi=h(Bi,2);{var rn=mi=>{var Ri=vde(),Ni=f(Ri);{let Zi=ct(()=>o(bt).hostname||o(bt).host);Nce(Ni,{get host(){return o(bt).host},get label(){return o(Zi)},onclose:()=>p(O,null),ondone:()=>{var $i;p(O,null),rt(!0),($i=e.onchanged)==null||$i.call(e)}})}y(mi,Ri)};T(Wi,mi=>{o(O)===Pt&&mi(rn)})}P(mi=>{var Ri,Ni;ki=Xt(di,1,"dot svelte-ns6riw",null,ki,{ok:(Ri=o(hi))==null?void 0:Ri.ok,err:o(hi)&&!o(hi).ok}),B(Fi,o(bt).hostname||((Ni=o(hi))==null?void 0:Ni.hostname)||o(bt).host),B(ri,`${(o(bt).user||o(E)||"?")??""}@${o(bt).host??""}${o(bt).port?`:${o(bt).port}`:""}`),Cn.disabled=mi,An=Xt(Mi,1,"ghost sm svelte-ns6riw",null,An,{active:o(M)===Pt}),sn=Xt(on,1,"ghost sm svelte-ns6riw",null,sn,{active:o(O)===Pt})},[()=>o(H)!==null||!o(bt).host.trim()]),z("click",Cn,()=>lt(o(bt))),z("click",Mi,()=>p(M,o(M)===Pt?null:Pt,!0)),z("click",on,()=>p(O,o(O)===Pt?null:Pt,!0)),z("click",zn,()=>Xe(Pt)),y(_t,Et)});var Wt=h(Kt,2);{var qt=_t=>{var bt=mde();y(_t,bt)};T(Wt,_t=>{o(d).length===0&&!o(x)&&_t(qt)})}var Yt=h(Wt,2),ni=f(Yt),Ai=h(f(ni),6);{var Pe=_t=>{var bt=_de(),Pt=f(bt);P(()=>B(Pt,o(ci)?"Copied":"Copy public key")),z("click",bt,()=>jt(o(Ye),hi=>p(ci,hi,!0))),y(_t,bt)};T(Ai,_t=>{o(Ye)&&_t(Pe)})}var $e=h(Ai,2),Gt=f($e),ai=h(ni,2);{var _e=_t=>{var bt=bde(),Pt=Dt(bt),hi=f(Pt),Et=h(Pt,2),kt=f(Et);P(()=>{B(hi,o(Ye)),B(kt,o(nt))}),y(_t,bt)},Vt=_t=>{var bt=KA(),Pt=f(bt);P(()=>B(Pt,`No services key yet (${(o(nt)||"data-dir/ssh/services_id_ed25519")??""}) — the setup command creates it.`)),y(_t,bt)};T(ai,_t=>{o(Ye)?_t(_e):_t(Vt,-1)})}P(()=>{var _t,bt;X.disabled=o(x),Me=Xt(Ve,1,"svelte-ns6riw",null,Me,{spinning:o(x)}),B(ti,`${o(d).length+1} host${o(d).length===0?"":"s"}`),pe=Xt(De,1,"dot svelte-ns6riw",null,pe,{ok:(_t=o(zt))==null?void 0:_t.ok,err:o(zt)&&!o(zt).ok}),B(U,((bt=o(zt))==null?void 0:bt.hostname)??"this host"),Q.disabled=o(H)!==null,$e.disabled=o(yt),B(Gt,o(yt)?"Generating…":o(Ye)?"Regenerate":"Generate key")}),z("click",X,()=>rt(!0)),z("click",Ce,Ct),z("click",Q,j),z("click",$e,we),y(ke,He)};T(Le,ke=>{o(I)==="add"?ke(at):ke(St,-1)})}y(r,tt),cs()}ms(["click"]);var ZA=k('<span class="tab-dot svelte-ymmv06"></span>'),Ede=k('<div class="services-page svelte-ymmv06"><div class="sub-nav svelte-ymmv06"><button>Instances</button> <button>Installations <!></button> <button>Catalog</button> <button>Hosts <!></button></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></div>');function Sde(r,e){ls(e,!0);let t=$n(e,"active",3,!1),i=$n(e,"sub",3,null);const n=["instances","hosts","catalog","hostsconf"],s="she-services-tab",a=localStorage.getItem(s);let l=A(Ci(a&&n.includes(a)?a:"instances"));cn(()=>{localStorage.setItem(s,o(l))});const d={instances:"instances",hosts:"installations",catalog:"catalog",hostsconf:"hosts"},u=vt=>Object.keys(d).find(Ze=>d[Ze]===vt)??null;let g;cn(()=>{if(i()===g)return;g=i();const vt=u(i());vt&&Ho(()=>{vt!==o(l)&&p(l,vt,!0)})}),cn(()=>{var vt;t()&&((vt=e.onsub)==null||vt.call(e,d[o(l)]))});let x=A(0),m=A(null);function C(vt){p(m,vt,!0),ky(x)}let _=A(null),E=0;function S(vt,Ze){p(_,{host:vt,adapter:Ze,n:++E},!0),C("catalog"),p(l,"hosts")}let I=A(0),M=A(0),O=A(0),R=A("none"),H=A(""),G=ct(()=>[o(I)>0?`${o(I)} adapter update${o(I)===1?"":"s"} available`:"",o(M)>0?`${o(M)} host${o(M)===1?"":"s"} with an outdated helper`:"",o(O)>0?`${o(O)} host${o(O)===1?"":"s"} with a newer Node.js`:""].filter(Boolean).join(" · "));cn(()=>{var vt,Ze;o(G)?(vt=e.onstatus)==null||vt.call(e,"warn",o(G)):(Ze=e.onstatus)==null||Ze.call(e,o(R),o(H))});var q=Ede(),te=f(q),ye=f(te);let Ne;var ge=h(ye,2);let Ae;var dt=h(f(ge));{var he=vt=>{var Ze=ZA();P(()=>xi(Ze,"title",`${o(I)??""} adapter update${o(I)===1?"":"s"} available`)),y(vt,Ze)};T(dt,vt=>{o(I)>0&&vt(he)})}var We=h(ge,2);let de;var je=h(We,2);let fe;var Ft=h(f(je));{var Te=vt=>{var Ze=ZA();P(ee=>xi(Ze,"title",ee),[()=>[o(M)>0?`${o(M)} host${o(M)===1?"":"s"} running an outdated she-servicectl`:"",o(O)>0?`${o(O)} host${o(O)===1?"":"s"} with a newer Node.js available`:""].filter(Boolean).join(" · ")]),y(vt,Ze)};T(Ft,vt=>{o(M)+o(O)>0&&vt(Te)})}var Be=h(te,2);let Je;var It=f(Be);Uae(It,{onstatus:(vt,Ze)=>{p(R,vt,!0),p(H,Ze,!0)},get generation(){return o(x)},get origin(){return o(m)},onchanged:()=>C("instances")});var ue=h(Be,2);let xe;var Fe=f(ue);oce(Fe,{onchanged:()=>C("hosts"),onupdates:vt=>p(I,vt,!0),get generation(){return o(x)},get origin(){return o(m)},get addPreset(){return o(_)}});var Ye=h(ue,2);let nt;var yt=f(Ye);{let vt=ct(()=>t()&&o(l)==="catalog");Ice(yt,{get active(){return o(vt)},oninstalled:S})}var ci=h(Ye,2);let Rt;var Ke=f(ci);wde(Ke,{onchanged:()=>C("hostsconf"),onupdates:vt=>p(M,vt,!0),onnodeupdates:vt=>p(O,vt,!0),get generation(){return o(x)},get origin(){return o(m)}}),P(()=>{Ne=Xt(ye,1,"svelte-ymmv06",null,Ne,{active:o(l)==="instances"}),Ae=Xt(ge,1,"svelte-ymmv06",null,Ae,{active:o(l)==="hosts"}),de=Xt(We,1,"svelte-ymmv06",null,de,{active:o(l)==="catalog"}),fe=Xt(je,1,"svelte-ymmv06",null,fe,{active:o(l)==="hostsconf"}),Je=Xt(Be,1,"tab-wrap svelte-ymmv06",null,Je,{hidden:o(l)!=="instances"}),xe=Xt(ue,1,"tab-wrap svelte-ymmv06",null,xe,{hidden:o(l)!=="hosts"}),nt=Xt(Ye,1,"tab-wrap svelte-ymmv06",null,nt,{hidden:o(l)!=="catalog"}),Rt=Xt(ci,1,"tab-wrap svelte-ymmv06",null,Rt,{hidden:o(l)!=="hostsconf"})}),z("click",ye,()=>p(l,"instances")),z("click",ge,()=>p(l,"hosts")),z("click",We,()=>p(l,"catalog")),z("click",je,()=>p(l,"hostsconf")),y(r,q),cs()}ms(["click"]);const JC=(r,e=ar)=>{var t=Ade(),i=h(f(t));{var n=a=>{var l=kde();y(a,l)},s=a=>{var l=Dde();y(a,l)};T(i,a=>{e()?a(n):a(s,-1)})}y(r,t)};var kde=Wo('<path d="M5.5 7V5a2.5 2.5 0 0 1 5 0v2"></path>'),Dde=Wo('<path d="M5.5 7V5a2.5 2.5 0 0 1 5 0"></path>'),Ade=Wo('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="7" width="10" height="7" rx="1.5"></rect><!></svg>'),Bde=k('<span class="ok svelte-1az45ix"> </span>'),Fde=k('<span class="muted svelte-1az45ix"> </span>'),Lde=k('<div class="err-box svelte-1az45ix"> <button class="ghost sm svelte-1az45ix">×</button></div>'),Ide=k(`<div class="err-box svelte-1az45ix"><b>Secrets store locked:</b> <code class="svelte-1az45ix">SHE_SECRETS_KEY</code> in the daemon's environment or restore <code class="svelte-1az45ix"> </code>, then restart she. Starting over means deleting <code class="svelte-1az45ix"> </code>.</div>`),Pde=k('<button><span class="name svelte-1az45ix"> </span> <span class="count svelte-1az45ix"> </span></button>'),Tde=k('<div class="muted empty svelte-1az45ix">No secrets yet.</div>'),Mde=k("<!> <!>",1),Rde=k('<button type="button" class="lock is-secret svelte-1az45ix" disabled="" title="secret — write-only, never shown again"><!></button> <input placeholder="•••••• (type to replace)" autocomplete="off" spellcheck="false" class="svelte-1az45ix"/>',1),Nde=k('<textarea spellcheck="false" class="svelte-1az45ix"></textarea>'),Ode=k('<input type="text" autocomplete="off" spellcheck="false" class="svelte-1az45ix"/>'),Hde=k('<button type="button" class="lock svelte-1az45ix" title="plain — shown in clear; click to mark it secret (never shown again)"><!></button> <!>',1),zde=k('<tr><td class="mono svelte-1az45ix"> </td><td class="svelte-1az45ix"><form class="val svelte-1az45ix"><!> <button type="submit" class="sm svelte-1az45ix">Save</button></form></td><td class="muted svelte-1az45ix"> </td><td class="c-act svelte-1az45ix"><button class="ghost sm svelte-1az45ix" title="Delete">×</button></td></tr>'),Wde=k('<textarea placeholder="value" spellcheck="false" class="svelte-1az45ix"></textarea>'),jde=k('<input type="password" placeholder="value" autocomplete="off" class="svelte-1az45ix"/>'),Vde=k('<div class="fields-head svelte-1az45ix"><span class="title svelte-1az45ix"> </span> <span class="muted svelte-1az45ix"> </span> <span class="spacer svelte-1az45ix"></span> <label class="reveal check-label svelte-1az45ix"><input type="checkbox" class="svelte-1az45ix"/><span class="checkmark svelte-1az45ix"></span> show while typing</label> <button class="ghost sm danger svelte-1az45ix">Delete group</button></div> <table class="svelte-1az45ix"><colgroup><col class="c-name svelte-1az45ix"/><col class="c-value"/><col class="c-changed svelte-1az45ix"/><col class="c-act svelte-1az45ix"/></colgroup><thead><tr><th class="svelte-1az45ix">field</th><th class="svelte-1az45ix">value</th><th class="svelte-1az45ix">changed</th><th class="svelte-1az45ix"></th></tr></thead><tbody><!><tr class="new svelte-1az45ix"><td class="svelte-1az45ix"><input type="text" placeholder="new field" spellcheck="false" class="svelte-1az45ix"/></td><td class="svelte-1az45ix"><form class="val svelte-1az45ix"><button type="button"><!></button> <!> <button type="submit" class="sm svelte-1az45ix">Add</button></form></td><td class="muted svelte-1az45ix" colspan="2">the lock decides the kind: secret fields are write-only forever, plain fields (user names, hosts) stay readable here. Multi-line values: tick <i>show while typing</i> and paste.</td></tr></tbody></table> <div class="hint svelte-1az45ix"><code class="svelte-1az45ix"> </code> returns the string, <code class="svelte-1az45ix"> </code> the whole group as a frozen object, <code class="svelte-1az45ix">she.secrets.has(…)</code> checks without a warning. Scripts that read a secret at load time keep the old value until they are reloaded.</div>',1),$de=k('Create a group on the left, then add fields to it — e.g. group <code class="svelte-1az45ix">smtp</code> with <code class="svelte-1az45ix">host</code>, <code class="svelte-1az45ix">user</code>, <code class="svelte-1az45ix">password</code>.',1),qde=k('<div class="muted empty svelte-1az45ix"><!></div>'),Ude=k(`<!> <div class="sec-shell svelte-1az45ix"><div class="bar svelte-1az45ix"><span class="muted svelte-1az45ix">Values are stored encrypted and never sent back to the browser — scripts read them with <code class="svelte-1az45ix">she.secrets.get('group/field')</code>.</span> <span class="spacer svelte-1az45ix"></span> <!> <!> <button class="ghost svelte-1az45ix" title="Reload">↺</button></div> <!> <!> <div class="body svelte-1az45ix"><div class="groups svelte-1az45ix"><div class="groups-head svelte-1az45ix">Groups</div> <!> <form class="add-group svelte-1az45ix"><input type="text" placeholder="new group" spellcheck="false" class="svelte-1az45ix"/> <button type="submit" class="ghost sm svelte-1az45ix">+</button></form></div> <div class="fields svelte-1az45ix"><!></div></div></div>`,1);function Gde(r,e){ls(e,!0);let t=$n(e,"active",3,!0),i=A(null),n=A(null),s=A(""),a=A(""),l=A(!1),d=A(""),u=A(""),g=A(""),x=A(!0),m=A(Ci({})),C=A(!1),_=A(void 0),E=!1;const S=/^[A-Za-z0-9_.-]{1,64}$/,I=ct(()=>{var ee;return((ee=o(i))==null?void 0:ee.groups.find(ht=>ht.name===o(n)))??null}),M=ct(()=>{var ee,ht;return((ee=o(i))==null?void 0:ee.status)==="locked"||((ht=o(i))==null?void 0:ht.status)==="error"});async function O(){try{p(i,await dG(),!0),p(s,""),o(n)&&!o(i).groups.some(ee=>ee.name===o(n))&&p(n,null),!o(n)&&o(i).groups.length>0&&p(n,o(i).groups[0].name,!0)}catch(ee){p(s,ee.message??String(ee),!0)}}cn(()=>{t()&&!E&&(E=!0,O())});function R(ee){p(a,ee,!0),setTimeout(()=>{o(a)===ee&&p(a,"")},2500)}async function H(ee,ht,qe,Ue=!0){if(qe){p(l,!0);try{await uG(ee,ht,qe,Ue),p(m,{...o(m),[`${ee}/${ht}`]:""},!0),p(u,""),p(g,""),p(x,!0),R(`saved ${ee}/${ht}`),await O(),p(n,ee,!0)}catch(Z){p(s,Z.message??String(Z),!0)}finally{p(l,!1)}}}async function G(){var ht;const ee=o(d).trim();if(!S.test(ee)){p(s,"group name: letters, digits, _ . - (max 64)");return}(ht=o(i))!=null&&ht.groups.some(qe=>qe.name===ee)||p(i,o(i)?{...o(i),groups:[...o(i).groups,{name:ee,changed:0,fields:[]}].sort((qe,Ue)=>qe.name.localeCompare(Ue.name))}:o(i),!0),p(n,ee,!0),p(d,""),p(s,"")}async function q(ee,ht){var qe;if(await((qe=o(_))==null?void 0:qe.show(`Mark ${ee}/${ht} as secret? Its value will never be shown again — not here, not through the API. Scripts keep reading it. This cannot be undone (delete and re-create to change your mind).`,{confirm:"Mark secret",danger:!0}))){p(l,!0);try{await hG(ee,ht),p(m,{...o(m),[`${ee}/${ht}`]:""},!0),R(`${ee}/${ht} is secret now`),await O()}catch(Ue){p(s,Ue.message??String(Ue),!0)}finally{p(l,!1)}}}async function te(ee,ht){var qe;if(await((qe=o(_))==null?void 0:qe.show(`Delete secret ${ee}/${ht}? Scripts reading it get undefined from now on.`,{confirm:"Delete",danger:!0}))){p(l,!0);try{await oD(ee,ht),R(`deleted ${ee}/${ht}`),await O()}catch(Ue){p(s,Ue.message??String(Ue),!0)}finally{p(l,!1)}}}async function ye(ee){var qe,Ue,Z,Se;const ht=((qe=o(I))==null?void 0:qe.fields.length)??0;if(ht===0){p(i,o(i)?{...o(i),groups:o(i).groups.filter(Oe=>Oe.name!==ee)}:o(i),!0),p(n,((Z=(Ue=o(i))==null?void 0:Ue.groups[0])==null?void 0:Z.name)??null,!0);return}if(await((Se=o(_))==null?void 0:Se.show(`Delete the group ${ee} with its ${ht} secret${ht===1?"":"s"}?`,{confirm:"Delete group",danger:!0}))){p(l,!0);try{await oD(ee),R(`deleted ${ee}`),p(n,null),await O()}catch(Oe){p(s,Oe.message??String(Oe),!0)}finally{p(l,!1)}}}function Ne(ee){return ee?new Date(ee).toLocaleString():"—"}var ge=Ude(),Ae=Dt(ge);ts(kr(Ae,{}),ee=>p(_,ee,!0),()=>o(_));var dt=h(Ae,2),he=f(dt),We=h(f(he),4);{var de=ee=>{var ht=Bde(),qe=f(ht);P(()=>B(qe,o(a))),y(ee,ht)};T(We,ee=>{o(a)&&ee(de)})}var je=h(We,2);{var fe=ee=>{var ht=Fde(),qe=f(ht);P(()=>{xi(ht,"title",o(i).file),B(qe,`key: ${(o(i).keySource==="env"?"SHE_SECRETS_KEY":o(i).keySource==="file"?o(i).keyFile:"none yet — generated on first save")??""}`)}),y(ee,ht)};T(je,ee=>{o(i)&&ee(fe)})}var Ft=h(je,2),Te=h(he,2);{var Be=ee=>{var ht=Lde(),qe=f(ht),Ue=h(qe);P(()=>B(qe,`${o(s)??""} `)),z("click",Ue,()=>p(s,"")),y(ee,ht)};T(Te,ee=>{o(s)&&ee(Be)})}var Je=h(Te,2);{var It=ee=>{var ht=Ide(),qe=h(f(ht)),Ue=h(qe,3),Z=f(Ue),Se=h(Ue,2),Oe=f(Se);P(()=>{B(qe,` ${o(i).error??""}. Values cannot be read or changed until the key is back — set `),B(Z,o(i).keyFile),B(Oe,o(i).file)}),y(ee,ht)};T(Je,ee=>{o(M)&&o(i)&&ee(It)})}var ue=h(Je,2),xe=f(ue),Fe=h(f(xe),2);{var Ye=ee=>{var ht=Mde(),qe=Dt(ht);gi(qe,17,()=>o(i).groups,Se=>Se.name,(Se,Oe)=>{var $t=Pde();let Ht;var zt=f($t),Ut=f(zt),et=h(zt,2),rt=f(et);P(()=>{Ht=Xt($t,1,"group svelte-1az45ix",null,Ht,{active:o(n)===o(Oe).name}),B(Ut,o(Oe).name),B(rt,o(Oe).fields.length)}),z("click",$t,()=>p(n,o(Oe).name,!0)),y(Se,$t)});var Ue=h(qe,2);{var Z=Se=>{var Oe=Tde();y(Se,Oe)};T(Ue,Se=>{o(i).groups.length===0&&Se(Z)})}y(ee,ht)};T(Fe,ee=>{o(i)&&ee(Ye)})}var nt=h(Fe,2),yt=f(nt),ci=h(yt,2),Rt=h(xe,2),Ke=f(Rt);{var vt=ee=>{var ht=Vde(),qe=Dt(ht),Ue=f(qe),Z=f(Ue),Se=h(Ue,2),Oe=f(Se),$t=h(Se,4),Ht=f($t),zt=h($t,2),Ut=h(qe,2),et=h(f(Ut),2),rt=f(et);gi(rt,17,()=>o(I).fields,Le=>Le.name,(Le,at)=>{const St=ct(()=>`${o(I).name}/${o(at).name}`),ke=ct(()=>o(m)[o(St)]??(o(at).secret?"":o(at).value??"")),He=ct(()=>o(at).secret?o(ke)!=="":o(ke)!==(o(at).value??""));var re=zde(),X=f(re),Ve=f(X),Me=h(X),Ce=f(Me),Lt=f(Ce);{var ti=ut=>{var Bt=Rde(),ei=Dt(Bt),J=f(ei);JC(J,()=>!0);var Re=h(ei,2);P(()=>{xi(Re,"type",o(C)?"text":"password"),qa(Re,o(ke)),Re.disabled=o(M)}),z("input",Re,ne=>p(m,{...o(m),[o(St)]:ne.target.value},!0)),y(ut,Bt)},xt=ut=>{var Bt=Hde(),ei=Dt(Bt),J=f(ei);JC(J,()=>!1);var Re=h(ei,2);{var ne=pe=>{var gt=Nde();xi(gt,"rows",4),P(()=>{qa(gt,o(ke)),gt.disabled=o(M)}),z("input",gt,U=>p(m,{...o(m),[o(St)]:U.target.value},!0)),y(pe,gt)},se=ct(()=>o(ke).includes(`
293
293
  `)),De=pe=>{var gt=Ode();P(()=>{qa(gt,o(ke)),gt.disabled=o(M)}),z("input",gt,U=>p(m,{...o(m),[o(St)]:U.target.value},!0)),y(pe,gt)};T(Re,pe=>{o(se)?pe(ne):pe(De,-1)})}P(()=>ei.disabled=o(l)||o(M)),z("click",ei,()=>q(o(I).name,o(at).name)),y(ut,Bt)};T(Lt,ut=>{o(at).secret?ut(ti):ut(xt,-1)})}var ve=h(Lt,2),it=h(Me),Mt=f(it),Jt=h(it),ft=f(Jt);P(ut=>{xi(X,"title",`she.secrets.get('${o(St)??""}')`),B(Ve,o(at).name),ve.disabled=o(l)||o(M)||!o(He)||!o(ke),B(Mt,ut),ft.disabled=o(l)||o(M)},[()=>Ne(o(at).changed)]),ws("submit",Ce,ut=>{ut.preventDefault(),o(He)&&H(o(I).name,o(at).name,o(ke),o(at).secret)}),z("click",ft,()=>te(o(I).name,o(at).name)),y(Le,re)});var w=h(rt),V=f(w),Y=f(V),oe=h(V),Ee=f(oe),lt=f(Ee);let j;var Xe=f(lt);JC(Xe,()=>o(x));var Ct=h(lt,2);{var ce=Le=>{var at=Wde();P(St=>{xi(at,"rows",St),at.disabled=o(M)},[()=>o(g).includes(`
294
294
  `)?4:1]),ui(at,()=>o(g),St=>p(g,St)),y(Le,at)},Qe=ct(()=>o(g).includes(`
295
- `)||o(C)||!o(x)),pt=Le=>{var at=jde();P(()=>at.disabled=o(M)),ui(at,()=>o(g),St=>p(g,St)),y(Le,at)};T(Ct,Le=>{o(Qe)?Le(ce):Le(pt,-1)})}var At=h(Ct,2),jt=h(Ut,2),we=f(jt),tt=f(we),$=h(we,2),be=f($);P((Le,at)=>{B(Z,o(I).name),B(Oe,`changed ${Le??""}`),zt.disabled=o(l)||o(M),Y.disabled=o(M),j=Xt(lt,1,"lock svelte-1az45ix",null,j,{"is-secret":o(x)}),lt.disabled=o(M),xi(lt,"title",o(x)?"secret — write-only once saved (click for a plain field, e.g. a user name)":"plain — shown in clear (click for a secret)"),At.disabled=at,B(tt,`she.secrets.get('${o(I).name??""}/<field>')`),B(be,`she.secrets.get('${o(I).name??""}')`)},[()=>Ne(o(I).changed),()=>o(l)||o(M)||!o(u).trim()||!o(g)]),Ss(Ht,()=>o(C),Le=>p(C,Le)),z("click",zt,()=>ye(o(I).name)),ui(Y,()=>o(u),Le=>p(u,Le)),ws("submit",Ee,Le=>{Le.preventDefault(),S.test(o(u).trim())?H(o(I).name,o(u).trim(),o(g),o(x)):p(s,"field name: letters, digits, _ . - (max 64)")}),z("click",lt,()=>p(x,!o(x))),y(ee,ht)},Ze=ee=>{var ht=qde(),qe=f(ht);{var Ue=Se=>{var Oe=$de();y(Se,Oe)},Z=Se=>{var Oe=kn("Select a group.");y(Se,Oe)};T(qe,Se=>{o(i).groups.length===0?Se(Ue):Se(Z,-1)})}y(ee,ht)};T(Ke,ee=>{o(I)?ee(vt):o(i)&&!o(M)&&ee(Ze,1)})}P(ee=>{yt.disabled=o(M),ci.disabled=ee},[()=>o(M)||!o(d).trim()]),z("click",Ft,O),ws("submit",nt,ee=>{ee.preventDefault(),G()}),ui(yt,()=>o(d),ee=>p(d,ee)),y(r,ge),cs()}ms(["click","input"]);var Kde=k('<div class="safe-banner svelte-1n46o8q"><strong class="svelte-1n46o8q">⚠ SAFE MODE</strong> — no user script is running and the script directory is not watched. She was killed instead of stopped last time, which usually means a script blocked the event loop. Edit or delete it, then restart. <button class="safe-restart svelte-1n46o8q">Restart daemon</button></div>'),YA=k('<span class="nav-dot nav-dot--warn svelte-1n46o8q"></span>'),Zde=k('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="MQTT broker not connected"></span>'),Yde=k('<span class="nav-dot nav-dot--warn nav-dot--blink svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),Xde=k('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="MQTT connected"></span>'),Qde=k('<button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" class="svelte-1n46o8q"><path d="M8.36,5.73 A2.6,2.6 0 0,1 9.38,10.50" class="svelte-1n46o8q"></path><path d="M7.64,5.73 A2.6,2.6 0 0,0 6.62,10.50" class="svelte-1n46o8q"></path><path d="M9.16,3.95 A4.5,4.5 0 0,1 10.38,12.12" class="svelte-1n46o8q"></path><path d="M6.84,3.95 A4.5,4.5 0 0,0 5.62,12.12" class="svelte-1n46o8q"></path><path d="M10.40,2.37 A6.4,6.4 0 0,1 11.39,13.73" class="svelte-1n46o8q"></path><path d="M5.60,2.37 A6.4,6.4 0 0,0 4.61,13.73" class="svelte-1n46o8q"></path><path d="M7.15,8.3 L8,15.4 L8.85,8.3 Z" fill="currentColor" stroke="none" class="svelte-1n46o8q"></path><circle cx="8" cy="8.3" r="1.45" fill="currentColor" stroke="none" class="svelte-1n46o8q"></circle></svg> Broker</button>'),Jde=k('<span class="nav-dot nav-dot--none svelte-1n46o8q"></span>'),eue=k('<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"><rect x="2" y="2" width="12" height="4" rx="1" class="svelte-1n46o8q"></rect><rect x="2" y="10" width="12" height="4" rx="1" class="svelte-1n46o8q"></rect><circle cx="4.5" cy="4" r="0.6" fill="currentColor" class="svelte-1n46o8q"></circle><circle cx="4.5" cy="12" r="0.6" fill="currentColor" class="svelte-1n46o8q"></circle></svg> Adapters <!></button>'),tue=k('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="All Matter devices online"></span>'),iue=k('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Some Matter devices offline"></span>'),nue=k('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="No Matter devices online"></span>'),sue=k('<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>'),oue=k('<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>'),rue=k('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="Errors in recent logs"></span>'),aue=k('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Warnings in recent logs"></span>'),lue=k('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),cue=k('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),due=k('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),uue=k('<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>'),hue=k('<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>'),fue=k('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),pue=k('<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),gue=k('<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),vue=k('<dl class="svelte-1n46o8q"><!> <dt class="svelte-1n46o8q">Scripts</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT topics</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT msg/s</dt><dd class="svelte-1n46o8q"> </dd> <!> <!> <dt class="svelte-1n46o8q">Handlers</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Memory</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">CPU</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL util</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL lag mean</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL lag max</dt><dd class="svelte-1n46o8q"> </dd></dl>'),xue=k('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),mue=k('<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>'),_ue=k('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><!></div></div>'),bue=k('<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>'),Cue=k("<div><!></div>"),yue=k('<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="12" height="12" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle" class="svelte-1n46o8q"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z" class="svelte-1n46o8q"></path></svg> MQTT <!></button> <!> <!> <!> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><rect x="3" y="7" width="10" height="7" rx="1.5" class="svelte-1n46o8q"></rect><path d="M5.5 7V5a2.5 2.5 0 0 1 5 0v2" class="svelte-1n46o8q"></path><circle cx="8" cy="9.9" r="1.15" stroke-width="1.1" class="svelte-1n46o8q"></circle><path d="M8 11v1.2" stroke-width="1.1" class="svelte-1n46o8q"></path></svg> Secrets</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> <div><!></div></main></div>'),wue=k('<div class="login-error svelte-1n46o8q"> </div>'),Eue=k('<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>'),Sue=k('<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>'),kue=k('<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>'),Due=k("<!> <!> <!> <!>",1);function Aue(r,e){ls(e,!0);const t=["scripts","mqtt","matter","broker","adapters","secrets","db","logs","config","packages"],i={services:"adapters",security:"broker"};function n(){const Oe=location.hash.replace(/^#\/?/,""),[$t,Ht]=Oe.split("/"),zt=i[$t]??$t;return{page:t.includes(zt)?zt:"scripts",sub:Ht||null}}let s=A(Ci(n().page)),a=A(Ci(n().sub)),l=A(null),d=A(!1),u=A(!1),g=A(!1),x=A(!1),m=A("none"),C=A(""),_=A(!1),E=A(""),S=A(""),I=A(!1),M=A(!1);iG(()=>{p(_,!0)});async function O(){p(S,""),p(I,!0);try{await oG(o(E)),p(E,""),p(_,!1)}catch(Oe){p(S,Oe.message??"Login failed",!0)}finally{p(I,!1)}}async function R(){if(o(m)==="proxy"&&o(C)){window.location.href=o(C);return}await rG(),p(_,!0)}let H=A(null),G=A(!1),q=A(!1),te=A(!1),ye=A(!1),Ne=A(Ci([])),ge=A(0),Ae=A(!1),dt=A(!1),he=A("none"),We=A(""),de=A(Ci([]));const je=ct(()=>o(de).filter(Oe=>Oe.online).length),fe=ct(()=>o(de).length===0?"none":o(je)===o(de).length?"all":o(je)>0?"some":"offline");let Ft=A(!1),Te=A(!1);async function Be(){if(!await o(H).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;p(G,!0);let Oe;try{Oe=(await Gc()).startedAt}catch{}try{await v7()}catch{}const $t=Date.now()+6e4;for(;Date.now()<$t;){await new Promise(Ht=>setTimeout(Ht,250));try{const Ht=await Gc();if(Oe===void 0||Ht.startedAt!==Oe){location.reload();return}}catch{}}location.reload()}async function Je(){p(g,!0);try{const Oe=await pG();o(l)&&p(l,{...o(l),latestVersion:Oe.latestVersion??void 0},!0)}catch{}finally{p(g,!1)}}async function It(){var Ht,zt;if(!await o(H).show(`Update to v${(Ht=o(l))==null?void 0:Ht.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;p(u,!1),p(x,!0);const Oe=(zt=o(l))==null?void 0:zt.startedAt;try{await fG()}catch{}const $t=Date.now()+18e4;for(;Date.now()<$t;){await new Promise(Ut=>setTimeout(Ut,1e3));try{const Ut=await Gc();if(Oe===void 0||Ut.startedAt!==Oe){location.reload();return}}catch{p(x,!1),p(G,!0)}}location.reload()}let ue=A(void 0),xe=A(0);function Fe(){if(!o(ue))return;const Oe=getComputedStyle(o(ue)),$t=parseFloat(Oe.columnGap)||0,Ht=[...o(ue).children];let zt=parseFloat(Oe.paddingLeft)+parseFloat(Oe.paddingRight)+$t*Math.max(0,Ht.length-1);for(const et of Ht)et.classList.contains("nav-spacer")||(zt+=et.getBoundingClientRect().width);const Ut=Math.ceil(zt)+8;Ut>0&&Ut!==o(xe)&&p(xe,Ut)}let Ye=null;function nt(){if(!(!o(ue)||!Ye)){Ye.disconnect(),Ye.observe(o(ue));for(const Oe of o(ue).children)Ye.observe(Oe);Fe()}}Os(()=>(Ye=new ResizeObserver(()=>Fe()),nt(),()=>{Ye==null||Ye.disconnect(),Ye=null})),cn(()=>{var Oe,$t,Ht,zt;o(Ae),o(dt),(Oe=o(l))==null||Oe.matterEnabled,($t=o(l))==null||$t.dbEnabled,(Ht=o(l))==null||Ht.latestVersion,(zt=o(l))==null||zt.docker,ga().then(()=>Ho(nt))});function yt(Oe){p(s,Oe,!0),p(a,null),location.hash=ci(Oe,null)}function ci(Oe,$t){return`#/${Oe}${$t?"/"+$t:""}`}function Rt(Oe,$t){o(s)!==Oe||o(a)===$t||(p(a,$t,!0),history.replaceState(null,"",ci(Oe,$t)))}Os(async()=>{const Oe=ci(o(s),o(a));location.hash!==Oe&&history.replaceState(null,"",Oe);const $t=()=>{const oe=n();p(s,oe.page,!0),p(a,oe.sub,!0)};window.addEventListener("hashchange",$t);const Ht=()=>{document.visibilityState==="visible"&&(aZ(),Gc().then(oe=>{p(l,oe,!0)}).catch(()=>{}),requestAnimationFrame(()=>{document.body.style.display="none",document.body.offsetHeight,document.body.style.display="",window.dispatchEvent(new Event("she:visible"))}))};document.addEventListener("visibilitychange",Ht);try{const oe=await sG();p(m,oe.mode,!0),p(C,oe.proxyLogoutUrl??"",!0),o(m)==="password"&&(await fetch("/she/scripts")).status===401&&p(_,!0)}catch{}p(M,!0);async function zt(){var oe,Ee,lt,j;try{p(l,await Gc(),!0)}catch{}try{const[Xe,Ct]=await Promise.all([_7(),yc()]);p(Ne,Array.isArray(Ct.pinnedPackages)?Ct.pinnedPackages:[],!0),p(ge,Object.keys(Xe).filter(pt=>!o(Ne).includes(pt)).length,!0);const ce=o(Ae);p(Ae,((oe=Ct.broker)==null?void 0:oe.enabled)===!0),ce&&!o(Ae)&&o(s)==="broker"&&yt("scripts");const Qe=o(dt);p(dt,((Ee=Ct.services)==null?void 0:Ee.enabled)===!0),Qe&&!o(dt)&&o(s)==="adapters"&&yt("scripts")}catch{}!((lt=o(l))!=null&&lt.matterEnabled)&&o(s)==="matter"&&yt("scripts"),!((j=o(l))!=null&&j.dbEnabled)&&o(s)==="db"&&yt("scripts")}zt();const Ut=setInterval(zt,5e3),et=Xo("mqtt:status",oe=>{oe.connected===!1?(p(ye,!0),p(q,!1),p(te,!1)):(p(ye,!1),p(q,oe.ready===!1),p(te,oe.ready===!0))}),rt=Xo("matter:deviceList",oe=>{Array.isArray(oe.devices)&&p(de,oe.devices.map(Ee=>({nodeId:String(Ee.nodeId),online:!!Ee.online})),!0)}),w=Xo("matter:deviceStatus",oe=>{if(oe.nodeId===void 0)return;const Ee=String(oe.nodeId),lt=!!oe.online;p(de,o(de).map(j=>j.nodeId===Ee?{...j,online:lt}:j),!0)}),V=A7();p(Ft,V.some(oe=>oe.level==="error"),!0),p(Te,!o(Ft)&&V.some(oe=>oe.level==="warn"),!0);const Y=l2(oe=>{oe.level==="error"?(p(Ft,!0),p(Te,!1)):oe.level==="warn"&&!o(Ft)&&p(Te,!0)});return()=>{window.removeEventListener("hashchange",$t),document.removeEventListener("visibilitychange",Ht),clearInterval(Ut),et(),rt(),w(),Y()}});var Ke=Due();ws("click",i3,()=>{o(d)&&p(d,!1),o(u)&&p(u,!1)});var vt=Dt(Ke);{var Ze=Oe=>{var $t=yue(),Ht=f($t);{var zt=Et=>{var kt=Kde(),di=h(f(kt),2);z("click",di,Be),y(Et,kt)};T(Ht,Et=>{var kt;(kt=o(l))!=null&&kt.safeMode&&Et(zt)})}var Ut=h(Ht,2),et=h(f(Ut),2);let rt;var w=h(et,2);let V;var Y=h(f(w),2);{var oe=Et=>{var kt=YA();P(()=>xi(kt,"title",`${o(ge)??""} package update${o(ge)===1?"":"s"} available`)),y(Et,kt)};T(Y,Et=>{o(ge)>0&&Et(oe)})}var Ee=h(w,2);let lt;var j=h(f(Ee),2);{var Xe=Et=>{var kt=Zde();y(Et,kt)},Ct=Et=>{var kt=Yde();y(Et,kt)},ce=Et=>{var kt=Xde();y(Et,kt)};T(j,Et=>{o(ye)?Et(Xe):o(q)?Et(Ct,1):o(te)&&Et(ce,2)})}var Qe=h(Ee,2);{var pt=Et=>{var kt=Qde();let di;P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="broker"})),z("click",kt,()=>yt("broker")),y(Et,kt)};T(Qe,Et=>{o(Ae)&&Et(pt)})}var At=h(Qe,2);{var jt=Et=>{var kt=eue();let di;var ki=h(f(kt),2);{var _i=Nt=>{var ri=YA();P(()=>xi(ri,"title",o(We))),y(Nt,ri)},Fi=Nt=>{var ri=Jde();y(Nt,ri)};T(ki,Nt=>{o(he)==="warn"?Nt(_i):Nt(Fi,-1)})}P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="adapters"})),z("click",kt,()=>yt("adapters")),y(Et,kt)};T(At,Et=>{o(dt)&&Et(jt)})}var we=h(At,2);{var tt=Et=>{var kt=sue();let di;var ki=h(f(kt),2);{var _i=ri=>{var bi=tue();y(ri,bi)},Fi=ri=>{var bi=iue();y(ri,bi)},Nt=ri=>{var bi=nue();y(ri,bi)};T(ki,ri=>{o(fe)==="all"?ri(_i):o(fe)==="some"?ri(Fi,1):o(fe)==="offline"&&ri(Nt,2)})}P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="matter"})),z("click",kt,()=>yt("matter")),y(Et,kt)};T(we,Et=>{var kt;(kt=o(l))!=null&&kt.matterEnabled&&Et(tt)})}var $=h(we,2);{var be=Et=>{var kt=oue();let di;P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="db"})),z("click",kt,()=>yt("db")),y(Et,kt)};T($,Et=>{var kt;(kt=o(l))!=null&&kt.dbEnabled&&Et(be)})}var Le=h($,2);let at;var St=h(Le,2);let ke;var He=h(f(St),2);{var re=Et=>{var kt=rue();y(Et,kt)},X=Et=>{var kt=aue();y(Et,kt)};T(He,Et=>{o(Ft)?Et(re):o(Te)&&Et(X,1)})}var Ve=h(St,4),Me=h(f(Ve),2),Ce=f(Me),Lt=f(Ce);Lt.nodeValue="v1.48.1 ";var ti=h(Lt);{var xt=Et=>{var kt=lue();y(Et,kt)};T(ti,Et=>{var kt,di;(kt=o(l))!=null&&kt.latestVersion&&!((di=o(l))!=null&&di.docker)&&Et(xt)})}var ve=h(Ce,2);{var it=Et=>{var kt=hue(),di=f(kt),ki=h(f(di));ki.textContent="v1.48.1";var _i=h(ki,2);{var Fi=tn=>{var Mi=cue(),An=h(Dt(Mi)),on=f(An);P(()=>B(on,`v${o(l).latestVersion??""}`)),y(tn,Mi)},Nt=tn=>{var Mi=due();y(tn,Mi)};T(_i,tn=>{var Mi;(Mi=o(l))!=null&&Mi.latestVersion?tn(Fi):tn(Nt,-1)})}var ri=h(di,2),bi=f(ri);{var Oi=tn=>{var Mi=uue(),An=h(f(Mi));P(()=>B(An,` Update to v${o(l).latestVersion??""}`)),z("click",Mi,It),y(tn,Mi)};T(bi,tn=>{var Mi;(Mi=o(l))!=null&&Mi.latestVersion&&tn(Oi)})}var wi=h(bi,2),Ji=f(wi);let en;var Cn=h(Ji);P(()=>{wi.disabled=o(g),en=Xt(Ji,0,"svelte-1n46o8q",null,en,{spinning:o(g)}),B(Cn,` ${o(g)?"Checking…":"Check for updates"}`)}),z("click",kt,tn=>tn.stopPropagation()),z("click",wi,Je),y(Et,kt)};T(ve,Et=>{var kt;o(u)&&!((kt=o(l))!=null&&kt.docker)&&Et(it)})}var Mt=h(Me,2),Jt=f(Mt),ft=h(Jt,2);{var ut=Et=>{var kt=_ue(),di=f(kt);{var ki=bi=>{var Oi=vue(),wi=f(Oi);{var Ji=ji=>{const _n=ct(()=>Math.floor((Date.now()-o(l).startedAt)/1e3)),un=ct(()=>Math.floor(o(_n)/86400)),En=ct(()=>Math.floor(o(_n)%86400/3600)),Bn=ct(()=>Math.floor(o(_n)%3600/60));var bn=fue(),dn=h(Dt(bn)),hn=f(dn);P(()=>B(hn,`${o(un)>0?o(un)+"d ":""}${o(En)>0||o(un)>0?o(En)+"h ":""}${o(Bn)??""}m`)),y(ji,bn)};T(wi,ji=>{o(l).startedAt&&ji(Ji)})}var en=h(wi,3),Cn=f(en),tn=h(en,3),Mi=f(tn),An=h(tn,3),on=f(An),sn=h(An,2);{var zn=ji=>{var _n=pue(),un=h(Dt(_n)),En=f(un),Bn=h(un,3),bn=f(Bn);P(()=>{B(En,o(l).matterNodes??0),B(bn,o(l).matterEndpoints??0)}),y(ji,_n)};T(sn,ji=>{o(l).matterEnabled&&ji(zn)})}var wn=h(sn,2);{var _s=ji=>{var _n=gue(),un=h(Dt(_n)),En=f(un),Bn=h(un,3),bn=f(Bn);P(()=>{B(En,o(l).dbDocs??"—"),B(bn,o(l).dbViews??"—")}),y(ji,_n)};T(wn,ji=>{o(l).dbEnabled&&ji(_s)})}var Gs=h(wn,3),$s=f(Gs),vi=h(Gs,3),Bi=f(vi),Ti=h(vi,3),Wi=f(Ti),rn=h(Ti,3),mi=f(rn),Ri=h(rn,3),Ni=f(Ri),Zi=h(Ri,3),$i=f(Zi);P(()=>{B(Cn,o(l).scripts),B(Mi,o(l).topics),B(on,o(l).mqttMsgPerSec??"—"),B($s,o(l).handlers??"—"),B(Bi,o(l).memMb!=null?o(l).memMb+" MB":"—"),B(Wi,o(l).cpuPercent!=null?o(l).cpuPercent+" %":"—"),B(mi,o(l).eluPercent!=null?o(l).eluPercent+" %":"—"),B(Ni,o(l).elMeanMs!=null?o(l).elMeanMs+" ms":"—"),B($i,o(l).elMaxMs!=null?o(l).elMaxMs+" ms":"—")}),y(bi,Oi)},_i=bi=>{var Oi=xue();y(bi,Oi)};T(di,bi=>{o(l)?bi(ki):bi(_i,-1)})}var Fi=h(di,2),Nt=f(Fi);{var ri=bi=>{var Oi=mue();z("click",Oi,()=>{p(d,!1),Be()}),y(bi,Oi)};T(Nt,bi=>{var Oi;(Oi=o(l))!=null&&Oi.docker||bi(ri)})}z("click",kt,bi=>bi.stopPropagation()),y(Et,kt)};T(ft,Et=>{o(d)&&Et(ut)})}var Bt=h(Mt,2);let ei;var J=h(Bt,2);{var Re=Et=>{var kt=bue();z("click",kt,R),y(Et,kt)};T(J,Et=>{o(m)==="password"&&Et(Re)})}ts(Ut,Et=>p(ue,Et),()=>o(ue));var ne=h(Ut,2),se=f(ne);ts(kr(se,{}),Et=>p(H,Et,!0),()=>o(H));var De=h(se,2);let pe;var gt=f(De);{let Et=ct(()=>o(s)==="scripts");wQ(gt,{get active(){return o(Et)}})}var U=h(De,2);let ot;var W=f(U);Qie(W,{});var Q=h(U,2);let ae;var me=f(Q);{let Et=ct(()=>o(s)==="mqtt"),kt=ct(()=>o(s)==="mqtt"?o(a):null);Pie(me,{get active(){return o(Et)},get sub(){return o(kt)},onsub:di=>Rt("mqtt",di)})}var Ie=h(Q,2);let st;var mt=f(Ie);Dte(mt,{});var Ot=h(Ie,2);let Kt;var Wt=f(Ot);{let Et=ct(()=>o(s)==="broker"),kt=ct(()=>o(s)==="broker"?o(a):null);Foe(Wt,{get active(){return o(Et)},get sub(){return o(kt)},onsub:di=>Rt("broker",di)})}var qt=h(Ot,2);{var Yt=Et=>{var kt=Cue();let di;var ki=f(kt);{let _i=ct(()=>o(s)==="adapters"),Fi=ct(()=>o(s)==="adapters"?o(a):null);Sde(ki,{onstatus:(Nt,ri)=>{p(he,Nt,!0),p(We,ri,!0)},get active(){return o(_i)},get sub(){return o(Fi)},onsub:Nt=>Rt("adapters",Nt)})}P(()=>di=Xt(kt,1,"page-wrap svelte-1n46o8q",null,di,{hidden:o(s)!=="adapters"})),y(Et,kt)};T(qt,Et=>{o(dt)&&Et(Yt)})}var ni=h(qt,2);let Ai;var Pe=f(ni);{let Et=ct(()=>o(s)==="secrets");Gde(Pe,{get active(){return o(Et)}})}var $e=h(ni,2);let Gt;var ai=f($e);{let Et=ct(()=>o(s)==="db"),kt=ct(()=>o(s)==="db"?o(a):null);Aee(ai,{get active(){return o(Et)},get sub(){return o(kt)},onsub:di=>Rt("db",di)})}var _e=h($e,2);let Vt;var _t=f(_e);vJ(_t,{});var bt=h(_e,2);let Pt;var hi=f(bt);yJ(hi,{}),P(()=>{Do($t,o(xe)?`min-width: ${o(xe)}px`:void 0),rt=Xt(et,1,"svelte-1n46o8q",null,rt,{active:o(s)==="scripts"}),V=Xt(w,1,"svelte-1n46o8q",null,V,{active:o(s)==="packages"}),lt=Xt(Ee,1,"svelte-1n46o8q",null,lt,{active:o(s)==="mqtt"}),at=Xt(Le,1,"svelte-1n46o8q",null,at,{active:o(s)==="secrets"}),ke=Xt(St,1,"svelte-1n46o8q",null,ke,{active:o(s)==="logs"}),ei=Xt(Bt,1,"nav-settings svelte-1n46o8q",null,ei,{active:o(s)==="config"}),pe=Xt(De,1,"page-wrap svelte-1n46o8q",null,pe,{hidden:o(s)!=="scripts"}),ot=Xt(U,1,"page-wrap svelte-1n46o8q",null,ot,{hidden:o(s)!=="packages"}),ae=Xt(Q,1,"page-wrap svelte-1n46o8q",null,ae,{hidden:o(s)!=="mqtt"}),st=Xt(Ie,1,"page-wrap svelte-1n46o8q",null,st,{hidden:o(s)!=="matter"}),Kt=Xt(Ot,1,"page-wrap svelte-1n46o8q",null,Kt,{hidden:o(s)!=="broker"}),Ai=Xt(ni,1,"page-wrap svelte-1n46o8q",null,Ai,{hidden:o(s)!=="secrets"}),Gt=Xt($e,1,"page-wrap svelte-1n46o8q",null,Gt,{hidden:o(s)!=="db"}),Vt=Xt(_e,1,"page-wrap svelte-1n46o8q",null,Vt,{hidden:o(s)!=="config"}),Pt=Xt(bt,1,"page-wrap svelte-1n46o8q",null,Pt,{hidden:o(s)!=="logs"})}),z("click",et,()=>yt("scripts")),z("click",w,()=>yt("packages")),z("click",Ee,()=>yt("mqtt")),z("click",Le,()=>yt("secrets")),z("click",St,()=>{yt("logs"),p(Ft,!1),p(Te,!1)}),z("click",Ce,Et=>{Et.stopPropagation(),p(u,!o(u)),p(d,!1)}),z("click",Jt,Et=>{Et.stopPropagation(),p(d,!o(d)),p(u,!1)}),z("click",Bt,()=>yt("config")),y(Oe,$t)};T(vt,Oe=>{o(M)&&!o(_)&&Oe(Ze)})}var ee=h(vt,2);{var ht=Oe=>{var $t=Eue(),Ht=f($t),zt=h(f(Ht),4),Ut=h(f(zt),2),et=h(zt,2);{var rt=Y=>{var oe=wue(),Ee=f(oe);P(()=>B(Ee,o(S))),y(Y,oe)};T(et,Y=>{o(S)&&Y(rt)})}var w=h(et,2),V=f(w);P(()=>{Ut.disabled=o(I),w.disabled=o(I)||!o(E),B(V,o(I)?"Signing in…":"Sign in")}),ws("submit",Ht,Y=>{Y.preventDefault(),O()}),ui(Ut,()=>o(E),Y=>p(E,Y)),y(Oe,$t)};T(ee,Oe=>{o(_)&&Oe(ht)})}var qe=h(ee,2);{var Ue=Oe=>{var $t=Sue();y(Oe,$t)};T(qe,Oe=>{o(G)&&Oe(Ue)})}var Z=h(qe,2);{var Se=Oe=>{var $t=kue();y(Oe,$t)};T(Z,Oe=>{o(x)&&Oe(Se)})}y(r,Ke),cs()}ms(["click"]);_M(Aue,{target:document.getElementById("app")});export{R3 as t};
295
+ `)||o(C)||!o(x)),pt=Le=>{var at=jde();P(()=>at.disabled=o(M)),ui(at,()=>o(g),St=>p(g,St)),y(Le,at)};T(Ct,Le=>{o(Qe)?Le(ce):Le(pt,-1)})}var At=h(Ct,2),jt=h(Ut,2),we=f(jt),tt=f(we),$=h(we,2),be=f($);P((Le,at)=>{B(Z,o(I).name),B(Oe,`changed ${Le??""}`),zt.disabled=o(l)||o(M),Y.disabled=o(M),j=Xt(lt,1,"lock svelte-1az45ix",null,j,{"is-secret":o(x)}),lt.disabled=o(M),xi(lt,"title",o(x)?"secret — write-only once saved (click for a plain field, e.g. a user name)":"plain — shown in clear (click for a secret)"),At.disabled=at,B(tt,`she.secrets.get('${o(I).name??""}/<field>')`),B(be,`she.secrets.get('${o(I).name??""}')`)},[()=>Ne(o(I).changed),()=>o(l)||o(M)||!o(u).trim()||!o(g)]),Ss(Ht,()=>o(C),Le=>p(C,Le)),z("click",zt,()=>ye(o(I).name)),ui(Y,()=>o(u),Le=>p(u,Le)),ws("submit",Ee,Le=>{Le.preventDefault(),S.test(o(u).trim())?H(o(I).name,o(u).trim(),o(g),o(x)):p(s,"field name: letters, digits, _ . - (max 64)")}),z("click",lt,()=>p(x,!o(x))),y(ee,ht)},Ze=ee=>{var ht=qde(),qe=f(ht);{var Ue=Se=>{var Oe=$de();y(Se,Oe)},Z=Se=>{var Oe=kn("Select a group.");y(Se,Oe)};T(qe,Se=>{o(i).groups.length===0?Se(Ue):Se(Z,-1)})}y(ee,ht)};T(Ke,ee=>{o(I)?ee(vt):o(i)&&!o(M)&&ee(Ze,1)})}P(ee=>{yt.disabled=o(M),ci.disabled=ee},[()=>o(M)||!o(d).trim()]),z("click",Ft,O),ws("submit",nt,ee=>{ee.preventDefault(),G()}),ui(yt,()=>o(d),ee=>p(d,ee)),y(r,ge),cs()}ms(["click","input"]);var Kde=k('<div class="safe-banner svelte-1n46o8q"><strong class="svelte-1n46o8q">⚠ SAFE MODE</strong> — no user script is running and the script directory is not watched. She was killed instead of stopped last time, which usually means a script blocked the event loop. Edit or delete it, then restart. <button class="safe-restart svelte-1n46o8q">Restart daemon</button></div>'),YA=k('<span class="nav-dot nav-dot--warn svelte-1n46o8q"></span>'),Zde=k('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="MQTT broker not connected"></span>'),Yde=k('<span class="nav-dot nav-dot--warn nav-dot--blink svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),Xde=k('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="MQTT connected"></span>'),Qde=k('<button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" class="svelte-1n46o8q"><path d="M8.36,5.73 A2.6,2.6 0 0,1 9.38,10.50" class="svelte-1n46o8q"></path><path d="M7.64,5.73 A2.6,2.6 0 0,0 6.62,10.50" class="svelte-1n46o8q"></path><path d="M9.16,3.95 A4.5,4.5 0 0,1 10.38,12.12" class="svelte-1n46o8q"></path><path d="M6.84,3.95 A4.5,4.5 0 0,0 5.62,12.12" class="svelte-1n46o8q"></path><path d="M10.40,2.37 A6.4,6.4 0 0,1 11.39,13.73" class="svelte-1n46o8q"></path><path d="M5.60,2.37 A6.4,6.4 0 0,0 4.61,13.73" class="svelte-1n46o8q"></path><path d="M7.15,8.3 L8,15.4 L8.85,8.3 Z" fill="currentColor" stroke="none" class="svelte-1n46o8q"></path><circle cx="8" cy="8.3" r="1.45" fill="currentColor" stroke="none" class="svelte-1n46o8q"></circle></svg> Broker</button>'),Jde=k('<span class="nav-dot nav-dot--none svelte-1n46o8q"></span>'),eue=k('<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"><rect x="2" y="2" width="12" height="4" rx="1" class="svelte-1n46o8q"></rect><rect x="2" y="10" width="12" height="4" rx="1" class="svelte-1n46o8q"></rect><circle cx="4.5" cy="4" r="0.6" fill="currentColor" class="svelte-1n46o8q"></circle><circle cx="4.5" cy="12" r="0.6" fill="currentColor" class="svelte-1n46o8q"></circle></svg> Adapters <!></button>'),tue=k('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="All Matter devices online"></span>'),iue=k('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Some Matter devices offline"></span>'),nue=k('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="No Matter devices online"></span>'),sue=k('<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>'),oue=k('<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>'),rue=k('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="Errors in recent logs"></span>'),aue=k('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Warnings in recent logs"></span>'),lue=k('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),cue=k('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),due=k('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),uue=k('<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>'),hue=k('<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>'),fue=k('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),pue=k('<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),gue=k('<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),vue=k('<dl class="svelte-1n46o8q"><!> <dt class="svelte-1n46o8q">Scripts</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT topics</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT msg/s</dt><dd class="svelte-1n46o8q"> </dd> <!> <!> <dt class="svelte-1n46o8q">Handlers</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Memory</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">CPU</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL util</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL lag mean</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">EL lag max</dt><dd class="svelte-1n46o8q"> </dd></dl>'),xue=k('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),mue=k('<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>'),_ue=k('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><!></div></div>'),bue=k('<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>'),Cue=k("<div><!></div>"),yue=k('<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="12" height="12" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle" class="svelte-1n46o8q"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z" class="svelte-1n46o8q"></path></svg> MQTT <!></button> <!> <!> <!> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><rect x="3" y="7" width="10" height="7" rx="1.5" class="svelte-1n46o8q"></rect><path d="M5.5 7V5a2.5 2.5 0 0 1 5 0v2" class="svelte-1n46o8q"></path><circle cx="8" cy="9.9" r="1.15" stroke-width="1.1" class="svelte-1n46o8q"></circle><path d="M8 11v1.2" stroke-width="1.1" class="svelte-1n46o8q"></path></svg> Secrets</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> <div><!></div></main></div>'),wue=k('<div class="login-error svelte-1n46o8q"> </div>'),Eue=k('<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>'),Sue=k('<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>'),kue=k('<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>'),Due=k("<!> <!> <!> <!>",1);function Aue(r,e){ls(e,!0);const t=["scripts","mqtt","matter","broker","adapters","secrets","db","logs","config","packages"],i={services:"adapters",security:"broker"};function n(){const Oe=location.hash.replace(/^#\/?/,""),[$t,Ht]=Oe.split("/"),zt=i[$t]??$t;return{page:t.includes(zt)?zt:"scripts",sub:Ht||null}}let s=A(Ci(n().page)),a=A(Ci(n().sub)),l=A(null),d=A(!1),u=A(!1),g=A(!1),x=A(!1),m=A("none"),C=A(""),_=A(!1),E=A(""),S=A(""),I=A(!1),M=A(!1);iG(()=>{p(_,!0)});async function O(){p(S,""),p(I,!0);try{await oG(o(E)),p(E,""),p(_,!1)}catch(Oe){p(S,Oe.message??"Login failed",!0)}finally{p(I,!1)}}async function R(){if(o(m)==="proxy"&&o(C)){window.location.href=o(C);return}await rG(),p(_,!0)}let H=A(null),G=A(!1),q=A(!1),te=A(!1),ye=A(!1),Ne=A(Ci([])),ge=A(0),Ae=A(!1),dt=A(!1),he=A("none"),We=A(""),de=A(Ci([]));const je=ct(()=>o(de).filter(Oe=>Oe.online).length),fe=ct(()=>o(de).length===0?"none":o(je)===o(de).length?"all":o(je)>0?"some":"offline");let Ft=A(!1),Te=A(!1);async function Be(){if(!await o(H).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;p(G,!0);let Oe;try{Oe=(await Gc()).startedAt}catch{}try{await v7()}catch{}const $t=Date.now()+6e4;for(;Date.now()<$t;){await new Promise(Ht=>setTimeout(Ht,250));try{const Ht=await Gc();if(Oe===void 0||Ht.startedAt!==Oe){location.reload();return}}catch{}}location.reload()}async function Je(){p(g,!0);try{const Oe=await pG();o(l)&&p(l,{...o(l),latestVersion:Oe.latestVersion??void 0},!0)}catch{}finally{p(g,!1)}}async function It(){var Ht,zt;if(!await o(H).show(`Update to v${(Ht=o(l))==null?void 0:Ht.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;p(u,!1),p(x,!0);const Oe=(zt=o(l))==null?void 0:zt.startedAt;try{await fG()}catch{}const $t=Date.now()+18e4;for(;Date.now()<$t;){await new Promise(Ut=>setTimeout(Ut,1e3));try{const Ut=await Gc();if(Oe===void 0||Ut.startedAt!==Oe){location.reload();return}}catch{p(x,!1),p(G,!0)}}location.reload()}let ue=A(void 0),xe=A(0);function Fe(){if(!o(ue))return;const Oe=getComputedStyle(o(ue)),$t=parseFloat(Oe.columnGap)||0,Ht=[...o(ue).children];let zt=parseFloat(Oe.paddingLeft)+parseFloat(Oe.paddingRight)+$t*Math.max(0,Ht.length-1);for(const et of Ht)et.classList.contains("nav-spacer")||(zt+=et.getBoundingClientRect().width);const Ut=Math.ceil(zt)+8;Ut>0&&Ut!==o(xe)&&p(xe,Ut)}let Ye=null;function nt(){if(!(!o(ue)||!Ye)){Ye.disconnect(),Ye.observe(o(ue));for(const Oe of o(ue).children)Ye.observe(Oe);Fe()}}Os(()=>(Ye=new ResizeObserver(()=>Fe()),nt(),()=>{Ye==null||Ye.disconnect(),Ye=null})),cn(()=>{var Oe,$t,Ht,zt;o(Ae),o(dt),(Oe=o(l))==null||Oe.matterEnabled,($t=o(l))==null||$t.dbEnabled,(Ht=o(l))==null||Ht.latestVersion,(zt=o(l))==null||zt.docker,ga().then(()=>Ho(nt))});function yt(Oe){p(s,Oe,!0),p(a,null),location.hash=ci(Oe,null)}function ci(Oe,$t){return`#/${Oe}${$t?"/"+$t:""}`}function Rt(Oe,$t){o(s)!==Oe||o(a)===$t||(p(a,$t,!0),history.replaceState(null,"",ci(Oe,$t)))}Os(async()=>{const Oe=ci(o(s),o(a));location.hash!==Oe&&history.replaceState(null,"",Oe);const $t=()=>{const oe=n();p(s,oe.page,!0),p(a,oe.sub,!0)};window.addEventListener("hashchange",$t);const Ht=()=>{document.visibilityState==="visible"&&(aZ(),Gc().then(oe=>{p(l,oe,!0)}).catch(()=>{}),requestAnimationFrame(()=>{document.body.style.display="none",document.body.offsetHeight,document.body.style.display="",window.dispatchEvent(new Event("she:visible"))}))};document.addEventListener("visibilitychange",Ht);try{const oe=await sG();p(m,oe.mode,!0),p(C,oe.proxyLogoutUrl??"",!0),o(m)==="password"&&(await fetch("/she/scripts")).status===401&&p(_,!0)}catch{}p(M,!0);async function zt(){var oe,Ee,lt,j;try{p(l,await Gc(),!0)}catch{}try{const[Xe,Ct]=await Promise.all([_7(),yc()]);p(Ne,Array.isArray(Ct.pinnedPackages)?Ct.pinnedPackages:[],!0),p(ge,Object.keys(Xe).filter(pt=>!o(Ne).includes(pt)).length,!0);const ce=o(Ae);p(Ae,((oe=Ct.broker)==null?void 0:oe.enabled)===!0),ce&&!o(Ae)&&o(s)==="broker"&&yt("scripts");const Qe=o(dt);p(dt,((Ee=Ct.services)==null?void 0:Ee.enabled)===!0),Qe&&!o(dt)&&o(s)==="adapters"&&yt("scripts")}catch{}!((lt=o(l))!=null&&lt.matterEnabled)&&o(s)==="matter"&&yt("scripts"),!((j=o(l))!=null&&j.dbEnabled)&&o(s)==="db"&&yt("scripts")}zt();const Ut=setInterval(zt,5e3),et=Xo("mqtt:status",oe=>{oe.connected===!1?(p(ye,!0),p(q,!1),p(te,!1)):(p(ye,!1),p(q,oe.ready===!1),p(te,oe.ready===!0))}),rt=Xo("matter:deviceList",oe=>{Array.isArray(oe.devices)&&p(de,oe.devices.map(Ee=>({nodeId:String(Ee.nodeId),online:!!Ee.online})),!0)}),w=Xo("matter:deviceStatus",oe=>{if(oe.nodeId===void 0)return;const Ee=String(oe.nodeId),lt=!!oe.online;p(de,o(de).map(j=>j.nodeId===Ee?{...j,online:lt}:j),!0)}),V=A7();p(Ft,V.some(oe=>oe.level==="error"),!0),p(Te,!o(Ft)&&V.some(oe=>oe.level==="warn"),!0);const Y=l2(oe=>{oe.level==="error"?(p(Ft,!0),p(Te,!1)):oe.level==="warn"&&!o(Ft)&&p(Te,!0)});return()=>{window.removeEventListener("hashchange",$t),document.removeEventListener("visibilitychange",Ht),clearInterval(Ut),et(),rt(),w(),Y()}});var Ke=Due();ws("click",i3,()=>{o(d)&&p(d,!1),o(u)&&p(u,!1)});var vt=Dt(Ke);{var Ze=Oe=>{var $t=yue(),Ht=f($t);{var zt=Et=>{var kt=Kde(),di=h(f(kt),2);z("click",di,Be),y(Et,kt)};T(Ht,Et=>{var kt;(kt=o(l))!=null&&kt.safeMode&&Et(zt)})}var Ut=h(Ht,2),et=h(f(Ut),2);let rt;var w=h(et,2);let V;var Y=h(f(w),2);{var oe=Et=>{var kt=YA();P(()=>xi(kt,"title",`${o(ge)??""} package update${o(ge)===1?"":"s"} available`)),y(Et,kt)};T(Y,Et=>{o(ge)>0&&Et(oe)})}var Ee=h(w,2);let lt;var j=h(f(Ee),2);{var Xe=Et=>{var kt=Zde();y(Et,kt)},Ct=Et=>{var kt=Yde();y(Et,kt)},ce=Et=>{var kt=Xde();y(Et,kt)};T(j,Et=>{o(ye)?Et(Xe):o(q)?Et(Ct,1):o(te)&&Et(ce,2)})}var Qe=h(Ee,2);{var pt=Et=>{var kt=Qde();let di;P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="broker"})),z("click",kt,()=>yt("broker")),y(Et,kt)};T(Qe,Et=>{o(Ae)&&Et(pt)})}var At=h(Qe,2);{var jt=Et=>{var kt=eue();let di;var ki=h(f(kt),2);{var _i=Nt=>{var ri=YA();P(()=>xi(ri,"title",o(We))),y(Nt,ri)},Fi=Nt=>{var ri=Jde();y(Nt,ri)};T(ki,Nt=>{o(he)==="warn"?Nt(_i):Nt(Fi,-1)})}P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="adapters"})),z("click",kt,()=>yt("adapters")),y(Et,kt)};T(At,Et=>{o(dt)&&Et(jt)})}var we=h(At,2);{var tt=Et=>{var kt=sue();let di;var ki=h(f(kt),2);{var _i=ri=>{var bi=tue();y(ri,bi)},Fi=ri=>{var bi=iue();y(ri,bi)},Nt=ri=>{var bi=nue();y(ri,bi)};T(ki,ri=>{o(fe)==="all"?ri(_i):o(fe)==="some"?ri(Fi,1):o(fe)==="offline"&&ri(Nt,2)})}P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="matter"})),z("click",kt,()=>yt("matter")),y(Et,kt)};T(we,Et=>{var kt;(kt=o(l))!=null&&kt.matterEnabled&&Et(tt)})}var $=h(we,2);{var be=Et=>{var kt=oue();let di;P(()=>di=Xt(kt,1,"svelte-1n46o8q",null,di,{active:o(s)==="db"})),z("click",kt,()=>yt("db")),y(Et,kt)};T($,Et=>{var kt;(kt=o(l))!=null&&kt.dbEnabled&&Et(be)})}var Le=h($,2);let at;var St=h(Le,2);let ke;var He=h(f(St),2);{var re=Et=>{var kt=rue();y(Et,kt)},X=Et=>{var kt=aue();y(Et,kt)};T(He,Et=>{o(Ft)?Et(re):o(Te)&&Et(X,1)})}var Ve=h(St,4),Me=h(f(Ve),2),Ce=f(Me),Lt=f(Ce);Lt.nodeValue="v1.48.3 ";var ti=h(Lt);{var xt=Et=>{var kt=lue();y(Et,kt)};T(ti,Et=>{var kt,di;(kt=o(l))!=null&&kt.latestVersion&&!((di=o(l))!=null&&di.docker)&&Et(xt)})}var ve=h(Ce,2);{var it=Et=>{var kt=hue(),di=f(kt),ki=h(f(di));ki.textContent="v1.48.3";var _i=h(ki,2);{var Fi=tn=>{var Mi=cue(),An=h(Dt(Mi)),on=f(An);P(()=>B(on,`v${o(l).latestVersion??""}`)),y(tn,Mi)},Nt=tn=>{var Mi=due();y(tn,Mi)};T(_i,tn=>{var Mi;(Mi=o(l))!=null&&Mi.latestVersion?tn(Fi):tn(Nt,-1)})}var ri=h(di,2),bi=f(ri);{var Oi=tn=>{var Mi=uue(),An=h(f(Mi));P(()=>B(An,` Update to v${o(l).latestVersion??""}`)),z("click",Mi,It),y(tn,Mi)};T(bi,tn=>{var Mi;(Mi=o(l))!=null&&Mi.latestVersion&&tn(Oi)})}var wi=h(bi,2),Ji=f(wi);let en;var Cn=h(Ji);P(()=>{wi.disabled=o(g),en=Xt(Ji,0,"svelte-1n46o8q",null,en,{spinning:o(g)}),B(Cn,` ${o(g)?"Checking…":"Check for updates"}`)}),z("click",kt,tn=>tn.stopPropagation()),z("click",wi,Je),y(Et,kt)};T(ve,Et=>{var kt;o(u)&&!((kt=o(l))!=null&&kt.docker)&&Et(it)})}var Mt=h(Me,2),Jt=f(Mt),ft=h(Jt,2);{var ut=Et=>{var kt=_ue(),di=f(kt);{var ki=bi=>{var Oi=vue(),wi=f(Oi);{var Ji=ji=>{const _n=ct(()=>Math.floor((Date.now()-o(l).startedAt)/1e3)),un=ct(()=>Math.floor(o(_n)/86400)),En=ct(()=>Math.floor(o(_n)%86400/3600)),Bn=ct(()=>Math.floor(o(_n)%3600/60));var bn=fue(),dn=h(Dt(bn)),hn=f(dn);P(()=>B(hn,`${o(un)>0?o(un)+"d ":""}${o(En)>0||o(un)>0?o(En)+"h ":""}${o(Bn)??""}m`)),y(ji,bn)};T(wi,ji=>{o(l).startedAt&&ji(Ji)})}var en=h(wi,3),Cn=f(en),tn=h(en,3),Mi=f(tn),An=h(tn,3),on=f(An),sn=h(An,2);{var zn=ji=>{var _n=pue(),un=h(Dt(_n)),En=f(un),Bn=h(un,3),bn=f(Bn);P(()=>{B(En,o(l).matterNodes??0),B(bn,o(l).matterEndpoints??0)}),y(ji,_n)};T(sn,ji=>{o(l).matterEnabled&&ji(zn)})}var wn=h(sn,2);{var _s=ji=>{var _n=gue(),un=h(Dt(_n)),En=f(un),Bn=h(un,3),bn=f(Bn);P(()=>{B(En,o(l).dbDocs??"—"),B(bn,o(l).dbViews??"—")}),y(ji,_n)};T(wn,ji=>{o(l).dbEnabled&&ji(_s)})}var Gs=h(wn,3),$s=f(Gs),vi=h(Gs,3),Bi=f(vi),Ti=h(vi,3),Wi=f(Ti),rn=h(Ti,3),mi=f(rn),Ri=h(rn,3),Ni=f(Ri),Zi=h(Ri,3),$i=f(Zi);P(()=>{B(Cn,o(l).scripts),B(Mi,o(l).topics),B(on,o(l).mqttMsgPerSec??"—"),B($s,o(l).handlers??"—"),B(Bi,o(l).memMb!=null?o(l).memMb+" MB":"—"),B(Wi,o(l).cpuPercent!=null?o(l).cpuPercent+" %":"—"),B(mi,o(l).eluPercent!=null?o(l).eluPercent+" %":"—"),B(Ni,o(l).elMeanMs!=null?o(l).elMeanMs+" ms":"—"),B($i,o(l).elMaxMs!=null?o(l).elMaxMs+" ms":"—")}),y(bi,Oi)},_i=bi=>{var Oi=xue();y(bi,Oi)};T(di,bi=>{o(l)?bi(ki):bi(_i,-1)})}var Fi=h(di,2),Nt=f(Fi);{var ri=bi=>{var Oi=mue();z("click",Oi,()=>{p(d,!1),Be()}),y(bi,Oi)};T(Nt,bi=>{var Oi;(Oi=o(l))!=null&&Oi.docker||bi(ri)})}z("click",kt,bi=>bi.stopPropagation()),y(Et,kt)};T(ft,Et=>{o(d)&&Et(ut)})}var Bt=h(Mt,2);let ei;var J=h(Bt,2);{var Re=Et=>{var kt=bue();z("click",kt,R),y(Et,kt)};T(J,Et=>{o(m)==="password"&&Et(Re)})}ts(Ut,Et=>p(ue,Et),()=>o(ue));var ne=h(Ut,2),se=f(ne);ts(kr(se,{}),Et=>p(H,Et,!0),()=>o(H));var De=h(se,2);let pe;var gt=f(De);{let Et=ct(()=>o(s)==="scripts");wQ(gt,{get active(){return o(Et)}})}var U=h(De,2);let ot;var W=f(U);Qie(W,{});var Q=h(U,2);let ae;var me=f(Q);{let Et=ct(()=>o(s)==="mqtt"),kt=ct(()=>o(s)==="mqtt"?o(a):null);Pie(me,{get active(){return o(Et)},get sub(){return o(kt)},onsub:di=>Rt("mqtt",di)})}var Ie=h(Q,2);let st;var mt=f(Ie);Dte(mt,{});var Ot=h(Ie,2);let Kt;var Wt=f(Ot);{let Et=ct(()=>o(s)==="broker"),kt=ct(()=>o(s)==="broker"?o(a):null);Foe(Wt,{get active(){return o(Et)},get sub(){return o(kt)},onsub:di=>Rt("broker",di)})}var qt=h(Ot,2);{var Yt=Et=>{var kt=Cue();let di;var ki=f(kt);{let _i=ct(()=>o(s)==="adapters"),Fi=ct(()=>o(s)==="adapters"?o(a):null);Sde(ki,{onstatus:(Nt,ri)=>{p(he,Nt,!0),p(We,ri,!0)},get active(){return o(_i)},get sub(){return o(Fi)},onsub:Nt=>Rt("adapters",Nt)})}P(()=>di=Xt(kt,1,"page-wrap svelte-1n46o8q",null,di,{hidden:o(s)!=="adapters"})),y(Et,kt)};T(qt,Et=>{o(dt)&&Et(Yt)})}var ni=h(qt,2);let Ai;var Pe=f(ni);{let Et=ct(()=>o(s)==="secrets");Gde(Pe,{get active(){return o(Et)}})}var $e=h(ni,2);let Gt;var ai=f($e);{let Et=ct(()=>o(s)==="db"),kt=ct(()=>o(s)==="db"?o(a):null);Aee(ai,{get active(){return o(Et)},get sub(){return o(kt)},onsub:di=>Rt("db",di)})}var _e=h($e,2);let Vt;var _t=f(_e);vJ(_t,{});var bt=h(_e,2);let Pt;var hi=f(bt);yJ(hi,{}),P(()=>{Do($t,o(xe)?`min-width: ${o(xe)}px`:void 0),rt=Xt(et,1,"svelte-1n46o8q",null,rt,{active:o(s)==="scripts"}),V=Xt(w,1,"svelte-1n46o8q",null,V,{active:o(s)==="packages"}),lt=Xt(Ee,1,"svelte-1n46o8q",null,lt,{active:o(s)==="mqtt"}),at=Xt(Le,1,"svelte-1n46o8q",null,at,{active:o(s)==="secrets"}),ke=Xt(St,1,"svelte-1n46o8q",null,ke,{active:o(s)==="logs"}),ei=Xt(Bt,1,"nav-settings svelte-1n46o8q",null,ei,{active:o(s)==="config"}),pe=Xt(De,1,"page-wrap svelte-1n46o8q",null,pe,{hidden:o(s)!=="scripts"}),ot=Xt(U,1,"page-wrap svelte-1n46o8q",null,ot,{hidden:o(s)!=="packages"}),ae=Xt(Q,1,"page-wrap svelte-1n46o8q",null,ae,{hidden:o(s)!=="mqtt"}),st=Xt(Ie,1,"page-wrap svelte-1n46o8q",null,st,{hidden:o(s)!=="matter"}),Kt=Xt(Ot,1,"page-wrap svelte-1n46o8q",null,Kt,{hidden:o(s)!=="broker"}),Ai=Xt(ni,1,"page-wrap svelte-1n46o8q",null,Ai,{hidden:o(s)!=="secrets"}),Gt=Xt($e,1,"page-wrap svelte-1n46o8q",null,Gt,{hidden:o(s)!=="db"}),Vt=Xt(_e,1,"page-wrap svelte-1n46o8q",null,Vt,{hidden:o(s)!=="config"}),Pt=Xt(bt,1,"page-wrap svelte-1n46o8q",null,Pt,{hidden:o(s)!=="logs"})}),z("click",et,()=>yt("scripts")),z("click",w,()=>yt("packages")),z("click",Ee,()=>yt("mqtt")),z("click",Le,()=>yt("secrets")),z("click",St,()=>{yt("logs"),p(Ft,!1),p(Te,!1)}),z("click",Ce,Et=>{Et.stopPropagation(),p(u,!o(u)),p(d,!1)}),z("click",Jt,Et=>{Et.stopPropagation(),p(d,!o(d)),p(u,!1)}),z("click",Bt,()=>yt("config")),y(Oe,$t)};T(vt,Oe=>{o(M)&&!o(_)&&Oe(Ze)})}var ee=h(vt,2);{var ht=Oe=>{var $t=Eue(),Ht=f($t),zt=h(f(Ht),4),Ut=h(f(zt),2),et=h(zt,2);{var rt=Y=>{var oe=wue(),Ee=f(oe);P(()=>B(Ee,o(S))),y(Y,oe)};T(et,Y=>{o(S)&&Y(rt)})}var w=h(et,2),V=f(w);P(()=>{Ut.disabled=o(I),w.disabled=o(I)||!o(E),B(V,o(I)?"Signing in…":"Sign in")}),ws("submit",Ht,Y=>{Y.preventDefault(),O()}),ui(Ut,()=>o(E),Y=>p(E,Y)),y(Oe,$t)};T(ee,Oe=>{o(_)&&Oe(ht)})}var qe=h(ee,2);{var Ue=Oe=>{var $t=Sue();y(Oe,$t)};T(qe,Oe=>{o(G)&&Oe(Ue)})}var Z=h(qe,2);{var Se=Oe=>{var $t=kue();y(Oe,$t)};T(Z,Oe=>{o(x)&&Oe(Se)})}y(r,Ke),cs()}ms(["click"]);_M(Aue,{target:document.getElementById("app")});export{R3 as t};