@mndw/cli 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,94 @@
1
+ var w_=Object.defineProperty;var y_=Object.getPrototypeOf;var k_=Reflect.get;var Hf=t=>{throw TypeError(t)};var E_=(t,e,n)=>e in t?w_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var K=(t,e,n)=>E_(t,typeof e!="symbol"?e+"":e,n),Ec=(t,e,n)=>e.has(t)||Hf("Cannot "+n);var x=(t,e,n)=>(Ec(t,e,"read from private field"),n?n.call(t):e.get(t)),xe=(t,e,n)=>e.has(t)?Hf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ge=(t,e,n,r)=>(Ec(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ve=(t,e,n)=>(Ec(t,e,"access private method"),n);var Bf=(t,e,n)=>k_(y_(t),n,e);import{setMndwUiLocale as S_,deepActiveElement as T_,coercePlacement as Uf,isMobileSheet as x_,resolveSizing as $f,computePopoverCoords as P_,createFocusTrap as bu,composedContains as C_,tabbableElements as R_,column as di,defineMndwUi as A_}from"/shared/mndw-ui@0.3.1.js";import{firstValueFrom as _d,race as O_,Observable as tl,ReplaySubject as M_,map as N_,timeout as wg,tap as Sc,timer as L_,exhaustMap as I_,catchError as z_,EMPTY as D_,takeUntil as jf,Subject as H_,Subscription as B_,filter as U_,BehaviorSubject as $_}from"/shared/rxjs@7.8.2.js";import{FetchTransport as j_,SessionManager as F_,RciManager as G_}from"/shared/rci-tools-core@0.6.0.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const V_="/assets/sprite-XQfBvd_1.svg",yg=!1;var jl=Array.isArray,Z_=Array.prototype.indexOf,nl=Array.prototype.includes,Fl=Array.from,W_=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,kg=Object.getOwnPropertyDescriptors,Eg=Object.prototype,q_=Array.prototype,Gl=Object.getPrototypeOf,Ff=Object.isExtensible;const K_=()=>{};function Y_(t){for(var e=0;e<t.length;e++)t[e]()}function Sg(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function X_(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const sn=2,Ss=4,Vl=8,wd=1<<24,wr=16,lr=32,Yr=64,_u=128,or=512,Xt=1024,Wt=2048,Sr=4096,Mn=8192,ar=16384,Bs=32768,wu=1<<25,yi=65536,rl=1<<17,J_=1<<18,Us=1<<19,Q_=1<<20,Nr=1<<25,Vi=65536,il=1<<21,ls=1<<22,gi=1<<23,mi=Symbol("$state"),ew=Symbol(""),Ga=Symbol("attributes"),yu=Symbol("class"),ku=Symbol("style"),oo=Symbol("text"),aa=new class extends Error{constructor(){super(...arguments);K(this,"name","StaleReactionError");K(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var vg;const yd=!!((vg=globalThis.document)!=null&&vg.contentType)&&globalThis.document.contentType.includes("xml");function kd(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function tw(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function nw(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function rw(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function iw(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function sw(t){throw new Error("https://svelte.dev/e/effect_orphan")}function ow(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function aw(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function lw(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function cw(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function uw(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const dw=1,fw=2,Tg=4,hw=8,pw=16,gw=1,mw=2,Vt=Symbol("uninitialized"),vw="http://www.w3.org/1999/xhtml",bw="@attach";function _w(){console.warn("https://svelte.dev/e/derived_inert")}function ww(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function yw(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function xg(t){return t===this.v}function Pg(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Cg(t){return!Pg(t,this.v)}let la=!1,kw=!1;function Ew(){la=!0}const Sw=[];function ka(t,e=!1,n=!1){return Va(t,new Map,"",Sw,null,n)}function Va(t,e,n,r,i=null,s=!1){if(typeof t=="object"&&t!==null){var o=e.get(t);if(o!==void 0)return o;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(jl(t)){var a=Array(t.length);e.set(t,a),i!==null&&e.set(i,a);for(var l=0;l<t.length;l+=1){var c=t[l];l in t&&(a[l]=Va(c,e,n,r,null,s))}return a}if(Gl(t)===Eg){a={},e.set(t,a),i!==null&&e.set(i,a);for(var u of Object.keys(t))a[u]=Va(t[u],e,n,r,null,s);return a}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!s)return Va(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let gt=null;function Ts(t){gt=t}function Tw(t){return Ed().get(t)}function xw(t,e){return Ed().set(t,e),e}function Pw(t){return Ed().has(t)}function Ze(t,e=!1,n){gt={p:gt,i:!1,c:null,e:null,s:t,x:null,r:rt,l:la&&!e?{s:null,u:null,$:[]}:null}}function We(t){var e=gt,n=e.e;if(n!==null){e.e=null;for(var r of n)Kg(r)}return e.i=!0,gt=e.p,{}}function $s(){return!la||gt!==null&&gt.l===null}function Ed(t){return gt===null&&kd(),gt.c??(gt.c=new Map(Cw(gt)||void 0))}function Cw(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let Mi=[];function Rg(){var t=Mi;Mi=[],Y_(t)}function Lr(t){if(Mi.length===0&&!So){var e=Mi;queueMicrotask(()=>{e===Mi&&Rg()})}Mi.push(t)}function Rw(){for(;Mi.length>0;)Rg()}function Ag(t){var e=rt;if(e===null)return tt.f|=gi,t;if((e.f&Bs)===0&&(e.f&Ss)===0)throw t;fi(t,e)}function fi(t,e){if(!(e!==null&&(e.f&ar)!==0)){for(;e!==null;){if((e.f&_u)!==0){if((e.f&Bs)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const Aw=-7169;function $t(t,e){t.f=t.f&Aw|e}function Sd(t){(t.f&or)!==0||t.deps===null?$t(t,Xt):$t(t,Sr)}function Og(t){if(t!==null)for(const e of t)(e.f&sn)===0||(e.f&Vi)===0||(e.f^=Vi,Og(e.deps))}function Mg(t,e,n){(t.f&Wt)!==0?e.add(t):(t.f&Sr)!==0&&n.add(t),Og(t.deps),$t(t,Xt)}function Ow(t,e){if(e){const n=document.body;t.autofocus=!0,Lr(()=>{document.activeElement===n&&t.focus()})}}function ca(t){var e=tt,n=rt;$n(null),cr(null);try{return t()}finally{$n(e),cr(n)}}function Mw(t){let e=0,n=Xr(0),r;return()=>{Rd()&&(d(n),Od(()=>(e===0&&(r=ti(()=>t(()=>rn(n)))),e+=1,()=>{Lr(()=>{e-=1,e===0&&(r==null||r(),r=void 0,rn(n))})})))}}var Nw=yi|Us;function Lw(t,e,n,r){new Iw(t,e,n,r)}var rr,bd,ir,Ii,In,sr,Rn,qn,$r,zi,li,ms,Wo,qo,jr,zl,Rt,zw,Dw,Eu,Hw,Su,Za,Wa,Tu,xu;class Iw{constructor(e,n,r,i){xe(this,Rt);K(this,"parent");K(this,"is_pending",!1);K(this,"transform_error");xe(this,rr);xe(this,bd,null);xe(this,ir);xe(this,Ii);xe(this,In);xe(this,sr,null);xe(this,Rn,null);xe(this,qn,null);xe(this,$r,null);xe(this,zi,0);xe(this,li,0);xe(this,ms,!1);xe(this,Wo,new Set);xe(this,qo,new Set);xe(this,jr,null);xe(this,zl,Mw(()=>(Ge(this,jr,Xr(x(this,zi))),()=>{Ge(this,jr,null)})));var s;Ge(this,rr,e),Ge(this,ir,n),Ge(this,Ii,o=>{var a=rt;a.b=this,a.f|=_u,r(o)}),this.parent=rt.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),Ge(this,In,js(()=>{Ve(this,Rt,Su).call(this)},Nw))}defer_effect(e){Mg(e,x(this,Wo),x(this,qo))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!x(this,ir).pending}update_pending_count(e,n){Ve(this,Rt,Tu).call(this,e,n),Ge(this,zi,x(this,zi)+e),!(!x(this,jr)||x(this,ms))&&(Ge(this,ms,!0),Lr(()=>{Ge(this,ms,!1),x(this,jr)&&xs(x(this,jr),x(this,zi))}))}get_effect_pending(){return x(this,zl).call(this),d(x(this,jr))}error(e){if(!x(this,ir).onerror&&!x(this,ir).failed)throw e;Ye!=null&&Ye.is_fork?(x(this,sr)&&Ye.skip_effect(x(this,sr)),x(this,Rn)&&Ye.skip_effect(x(this,Rn)),x(this,qn)&&Ye.skip_effect(x(this,qn)),Ye.oncommit(()=>{Ve(this,Rt,xu).call(this,e)})):Ve(this,Rt,xu).call(this,e)}}rr=new WeakMap,bd=new WeakMap,ir=new WeakMap,Ii=new WeakMap,In=new WeakMap,sr=new WeakMap,Rn=new WeakMap,qn=new WeakMap,$r=new WeakMap,zi=new WeakMap,li=new WeakMap,ms=new WeakMap,Wo=new WeakMap,qo=new WeakMap,jr=new WeakMap,zl=new WeakMap,Rt=new WeakSet,zw=function(){try{Ge(this,sr,Hn(()=>x(this,Ii).call(this,x(this,rr))))}catch(e){this.error(e)}},Dw=function(e){const n=x(this,ir).failed,{reset:r,invoke_onerror:i}=Ve(this,Rt,Eu).call(this,e);Lr(i),n&&Ge(this,qn,Hn(()=>{n(x(this,rr),()=>e,()=>r)}))},Eu=function(e){var n=!1,r=!1;const i=()=>{if(n){yw();return}n=!0,r&&uw(),x(this,qn)!==null&&ji(x(this,qn),()=>{Ge(this,qn,null)}),Ve(this,Rt,Wa).call(this,()=>{Ve(this,Rt,Su).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=x(this,ir)).onerror)==null||a.call(o,e,i),r=!1}catch(l){fi(l,x(this,In)&&x(this,In).parent)}}}},Hw=function(){const e=x(this,ir).pending;e&&(this.is_pending=!0,Ge(this,Rn,Hn(()=>e(x(this,rr)))),Lr(()=>{var n=Ge(this,$r,document.createDocumentFragment()),r=qr();n.append(r),Ge(this,sr,Ve(this,Rt,Wa).call(this,()=>Hn(()=>x(this,Ii).call(this,r)))),x(this,li)===0&&(x(this,rr).before(n),Ge(this,$r,null),ji(x(this,Rn),()=>{Ge(this,Rn,null)}),Ve(this,Rt,Za).call(this,Ye))}))},Su=function(){try{if(this.is_pending=this.has_pending_snippet(),Ge(this,li,0),Ge(this,zi,0),Ge(this,sr,Hn(()=>{x(this,Ii).call(this,x(this,rr))})),x(this,li)>0){var e=Ge(this,$r,document.createDocumentFragment());Nd(x(this,sr),e);const n=x(this,ir).pending;Ge(this,Rn,Hn(()=>n(x(this,rr))))}else Ve(this,Rt,Za).call(this,Ye)}catch(n){this.error(n)}},Za=function(e){this.is_pending=!1,e.transfer_effects(x(this,Wo),x(this,qo))},Wa=function(e){var n=rt,r=tt,i=gt;cr(x(this,In)),$n(x(this,In)),Ts(x(this,In).ctx);try{return Zi.ensure(),e()}catch(s){return Ag(s),null}finally{cr(n),$n(r),Ts(i)}},Tu=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&Ve(r=this.parent,Rt,Tu).call(r,e,n);return}Ge(this,li,x(this,li)+e),x(this,li)===0&&(Ve(this,Rt,Za).call(this,n),x(this,Rn)&&ji(x(this,Rn),()=>{Ge(this,Rn,null)}),x(this,$r)&&(x(this,rr).before(x(this,$r)),Ge(this,$r,null)))},xu=function(e){x(this,sr)&&(gn(x(this,sr)),Ge(this,sr,null)),x(this,Rn)&&(gn(x(this,Rn)),Ge(this,Rn,null)),x(this,qn)&&(gn(x(this,qn)),Ge(this,qn,null));let n=x(this,ir).failed;const r=i=>{const{reset:s,invoke_onerror:o}=Ve(this,Rt,Eu).call(this,i);o(),n&&Ge(this,qn,Ve(this,Rt,Wa).call(this,()=>{try{return Hn(()=>{var a=rt;a.b=this,a.f|=_u,n(x(this,rr),()=>i,()=>s)})}catch(a){return fi(a,x(this,In).parent),null}}))};Lr(()=>{var i;try{i=this.transform_error(e)}catch(s){fi(s,x(this,In)&&x(this,In).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>fi(s,x(this,In)&&x(this,In).parent)):r(i)})};function Ng(t,e,n,r){const i=$s()?Td:Ig;var s=t.filter(p=>!p.settled),o=e.map(i);if(n.length===0&&s.length===0){r(o);return}var a=rt,l=Bw(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&ar)===0){l();try{r([...o,...p])}catch(m){fi(m,a)}sl()}}var f=Lg();if(n.length===0){c.then(()=>u([])).finally(f);return}function h(){Promise.all(n.map(p=>Uw(p))).then(u).catch(p=>fi(p,a)).finally(f)}c?c.then(()=>{l(),h(),sl()}):h()}function Bw(){var t=rt,e=tt,n=gt,r=Ye;return function(s=!0){cr(t),$n(e),Ts(n),s&&(t.f&ar)===0&&(r==null||r.activate(),r==null||r.apply())}}function sl(t=!0){cr(null),$n(null),Ts(null),t&&(Ye==null||Ye.deactivate())}function Lg(){var t=rt,e=t.b,n=Ye,r=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,n),n.increment(r,t),()=>{e==null||e.update_pending_count(-1,n),n.decrement(r,t)}}function Td(t){var e=sn|Wt;return rt!==null&&(rt.f|=Us),{ctx:gt,deps:null,effects:null,equals:xg,f:e,fn:t,reactions:null,rv:0,v:Vt,wv:0,parent:rt,ac:null}}const ao=Symbol("obsolete");function Uw(t,e,n){let r=rt;r===null&&tw();var i=void 0,s=Xr(Vt),o=!tt,a=new Set;return ny(()=>{var p,m;var l=rt,c=Sg();i=c.promise;try{Promise.resolve(t()).then(c.resolve,g=>{g!==aa&&c.reject(g)}).finally(sl)}catch(g){c.reject(g),sl()}var u=Ye;if(o){if((l.f&Bs)!==0)var f=Lg();if((p=r.b)!=null&&p.is_rendered())(m=u.async_deriveds.get(l))==null||m.reject(ao);else for(const g of a.values())g.reject(ao);a.add(c),u.async_deriveds.set(l,c)}const h=(g,b=void 0)=>{f==null||f(),a.delete(c),b!==ao&&(u.activate(),b?(s.f|=gi,xs(s,b)):((s.f&gi)!==0&&(s.f^=gi),xs(s,g)),u.deactivate())};c.promise.then(h,g=>h(null,g||"unknown"))}),Ad(()=>{for(const l of a)l.reject(ao)}),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function V(t){const e=Td(t);return tm(e),e}function Ig(t){const e=Td(t);return e.equals=Cg,e}function $w(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)gn(e[n])}}function xd(t){var e,n=rt,r=t.parent;if(!ki&&r!==null&&t.v!==Vt&&(r.f&(ar|Mn))!==0)return _w(),t.v;cr(r);try{t.f&=~Vi,$w(t),e=sm(t)}finally{cr(n)}return e}function zg(t){var e=xd(t);if(!t.equals(e)&&(t.wv=rm(),(!(Ye!=null&&Ye.is_fork)||t.deps===null)&&(Ye!==null?(Ye.capture(t,e,!0),Eo==null||Eo.capture(t,e,!0)):t.v=e,t.deps===null))){$t(t,Xt);return}ki||(hn!==null?(Rd()||Ye!=null&&Ye.is_fork)&&hn.set(t,e):Sd(t))}function jw(t){var e;if(t.effects!==null)for(const n of t.effects)(n.teardown||n.ac)&&((e=n.teardown)==null||e.call(n),n.ac!==null&&ca(()=>{n.ac.abort(aa),n.ac=null}),n.fn!==null&&(n.teardown=K_),No(n,0),Md(n))}function Dg(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&Ps(e)}let Tc=null,Ji=null,Ye=null,Eo=null,hn=null,Pu=null,So=!1,xc=!1,ss=null,qa=null;var Gf=0;let Fw=1;var vs,ci,Di,bs,_s,ws,Fr,ys,zn,Ko,Gr,gr,Cr,ks,Hi,mt,Cu,lo,Ru,Hg,Bg,rs,Gw,co;const Dl=class Dl{constructor(){xe(this,mt);K(this,"id",Fw++);xe(this,vs,!1);K(this,"linked",!0);xe(this,ci,null);xe(this,Di,null);K(this,"async_deriveds",new Map);K(this,"current",new Map);K(this,"previous",new Map);xe(this,bs,new Set);xe(this,_s,new Set);xe(this,ws,0);xe(this,Fr,new Map);xe(this,ys,null);xe(this,zn,[]);xe(this,Ko,[]);xe(this,Gr,new Set);xe(this,gr,new Set);xe(this,Cr,new Map);xe(this,ks,new Set);K(this,"is_fork",!1);xe(this,Hi,!1);Ji===null?Tc=Ji=this:(Ge(Ji,Di,this),Ge(this,ci,Ji)),Ji=this}skip_effect(e){x(this,Cr).has(e)||x(this,Cr).set(e,{d:[],m:[]}),x(this,ks).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=x(this,Cr).get(e);if(r){x(this,Cr).delete(e);for(var i of r.d)$t(i,Wt),n(i);for(i of r.m)$t(i,Sr),n(i)}x(this,ks).add(e)}capture(e,n,r=!1){e.v!==Vt&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&gi)===0&&(this.current.set(e,[n,r]),hn==null||hn.set(e,n)),this.is_fork||(e.v=n)}activate(){Ye=this}deactivate(){Ye=null,hn=null}flush(){try{xc=!0,Ye=this,Ve(this,mt,lo).call(this)}finally{Gf=0,Pu=null,ss=null,qa=null,xc=!1,Ye=null,hn=null,$i.clear()}}discard(){var e;for(const n of x(this,_s))n(this);x(this,_s).clear();for(const n of this.async_deriveds.values())n.reject(ao);Ve(this,mt,co).call(this),(e=x(this,ys))==null||e.resolve()}register_created_effect(e){x(this,Ko).push(e)}increment(e,n){if(Ge(this,ws,x(this,ws)+1),e){let r=x(this,Fr).get(n)??0;x(this,Fr).set(n,r+1)}}decrement(e,n){if(Ge(this,ws,x(this,ws)-1),e){let r=x(this,Fr).get(n)??0;r===1?x(this,Fr).delete(n):x(this,Fr).set(n,r-1)}x(this,Hi)||(Ge(this,Hi,!0),Lr(()=>{Ge(this,Hi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)x(this,Gr).add(r);for(const r of n)x(this,gr).add(r);e.clear(),n.clear()}oncommit(e){x(this,bs).add(e)}ondiscard(e){x(this,_s).add(e)}settled(){return(x(this,ys)??Ge(this,ys,Sg())).promise}static ensure(){if(Ye===null){const e=Ye=new Dl;!xc&&!So&&Lr(()=>{x(e,vs)||e.flush()})}return Ye}apply(){{hn=null;return}}schedule(e){var i;if(Pu=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Ss|Vl|wd))!==0&&(e.f&Bs)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(ss!==null&&n===rt&&(tt===null||(tt.f&sn)===0))return;if((r&(Yr|lr))!==0){if((r&Xt)===0)return;n.f^=Xt}}x(this,zn).push(n)}};vs=new WeakMap,ci=new WeakMap,Di=new WeakMap,bs=new WeakMap,_s=new WeakMap,ws=new WeakMap,Fr=new WeakMap,ys=new WeakMap,zn=new WeakMap,Ko=new WeakMap,Gr=new WeakMap,gr=new WeakMap,Cr=new WeakMap,ks=new WeakMap,Hi=new WeakMap,mt=new WeakSet,Cu=function(){if(this.is_fork)return!0;for(const r of x(this,Fr).keys()){for(var e=r,n=!1;e.parent!==null;){if(x(this,Cr).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},lo=function(){var l,c,u,f;Ge(this,vs,!0),Gf++>1e3&&(Ve(this,mt,co).call(this),Zw());for(const h of x(this,Gr))x(this,gr).delete(h),$t(h,Wt),this.schedule(h);for(const h of x(this,gr))$t(h,Sr),this.schedule(h);const e=x(this,zn);Ge(this,zn,[]),this.apply();var n=ss=[],r=[],i=qa=[];for(const h of e)try{Ve(this,mt,Ru).call(this,h,n,r)}catch(p){throw jg(h),Ve(this,mt,Cu).call(this)||this.discard(),p}if(Ye=null,i.length>0){var s=Dl.ensure();for(const h of i)s.schedule(h)}if(ss=null,qa=null,Ve(this,mt,Cu).call(this)){Ve(this,mt,rs).call(this,r),Ve(this,mt,rs).call(this,n);for(const[h,p]of x(this,Cr))$g(h,p);i.length>0&&Ve(l=Ye,mt,lo).call(l);return}const o=Ve(this,mt,Hg).call(this);if(o){Ve(this,mt,rs).call(this,r),Ve(this,mt,rs).call(this,n),Ve(c=o,mt,Bg).call(c,this);return}x(this,Gr).clear(),x(this,gr).clear();for(const h of x(this,bs))h(this);x(this,bs).clear(),Eo=this,Vf(r),Vf(n),Eo=null,(u=x(this,ys))==null||u.resolve();var a=Ye;if(x(this,ws)===0&&(x(this,zn).length===0||a!==null)&&Ve(this,mt,co).call(this),x(this,zn).length>0)if(a!==null){const h=a;x(h,zn).push(...x(this,zn).filter(p=>!x(h,zn).includes(p)))}else a=this;a!==null&&Ve(f=a,mt,lo).call(f)},Ru=function(e,n,r){e.f^=Xt;for(var i=e.first;i!==null;){var s=i.f,o=(s&(lr|Yr))!==0,a=o&&(s&Xt)!==0,l=a||(s&Mn)!==0||x(this,Cr).has(i);if(!l&&i.fn!==null){o?i.f^=Xt:(s&Ss)!==0?n.push(i):da(i)&&((s&wr)!==0&&x(this,gr).add(i),Ps(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}},Hg=function(){for(var e=x(this,ci);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=x(e,ci)}return null},Bg=function(e){var r;for(const[i,s]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,s);for(const[i,s]of e.async_deriveds){const o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}e.async_deriveds.clear(),this.transfer_effects(x(e,Gr),x(e,gr));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&sn)!==0&&(i.f&(Wt|Sr))===0))for(const l of s){var o=l.f;if((o&sn)!==0)n(l);else{var a=l;o&(ls|wr)&&!this.async_deriveds.has(a)&&(x(this,gr).delete(a),$t(a,Wt),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),Ve(r=e,mt,co).call(r),Ye=this,Ve(this,mt,lo).call(this)},rs=function(e){for(var n=0;n<e.length;n+=1)Mg(e[n],x(this,Gr),x(this,gr))},Gw=function(){var f;for(let h=Tc;h!==null;h=x(h,Di)){var e=h.id<this.id,n=[];for(const[p,[m,g]]of this.current){if(h.current.has(p)){var r=h.current.get(p)[0];if(e&&m!==r)h.current.set(p,[m,g]);else continue}n.push(p)}if(e)for(const[p,m]of this.async_deriveds){const g=h.async_deriveds.get(p);g&&m.promise.then(g.resolve).catch(g.reject)}var i=[...h.current.keys()].filter(p=>!h.current.get(p)[1]);if(!(!x(h,vs)||i.length===0)){var s=i.filter(p=>!this.current.has(p));if(s.length===0)e&&h.discard();else if(n.length>0){if(e)for(const p of x(this,ks))h.unskip_effect(p,m=>{var g;(m.f&(wr|ls))!==0?h.schedule(m):Ve(g=h,mt,rs).call(g,[m])});h.activate();var o=new Set,a=new Map;for(var l of n)Ug(l,s,o,a);a=new Map;var c=[...h.current].filter(([p,m])=>{const g=this.current.get(p);return g?g[0]!==m[0]||g[1]!==m[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of x(this,Ko))(p.f&(ar|Mn|rl))===0&&Pd(p,c,a)&&((p.f&(ls|wr))!==0?($t(p,Wt),h.schedule(p)):x(h,Gr).add(p));if(x(h,zn).length>0&&!x(h,Hi)){h.apply();for(var u of x(h,zn))Ve(f=h,mt,Ru).call(f,u,[],[]);Ge(h,zn,[])}h.deactivate()}}}},co=function(){if(this.linked){var e=x(this,ci),n=x(this,Di);e===null?Tc=n:Ge(e,Di,n),n===null?Ji=e:Ge(n,ci,e),this.linked=!1}};let Zi=Dl;function Vw(t){var e=So;So=!0;try{for(var n;;){if(Rw(),Ye===null)return n;Ye.flush()}}finally{So=e}}function Zw(){try{ow()}catch(t){fi(t,Pu)}}let pr=null;function Vf(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(ar|Mn))===0&&da(r)&&(pr=new Set,Ps(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Jg(r),(pr==null?void 0:pr.size)>0)){$i.clear();for(const i of pr){if((i.f&(ar|Mn))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)pr.has(o)&&(pr.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(ar|Mn))===0&&Ps(l)}}pr.clear()}}pr=null}}function Ug(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&sn)!==0?Ug(i,e,n,r):(s&(ls|wr))!==0&&(s&Wt)===0&&Pd(i,e,r)&&($t(i,Wt),Cd(i))}}function Pd(t,e,n){const r=n.get(t);if(r!==void 0)return r;if(t.deps!==null)for(const i of t.deps){if(nl.call(e,i))return!0;if((i.f&sn)!==0&&Pd(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Cd(t){Ye.schedule(t)}function $g(t,e){if(!((t.f&lr)!==0&&(t.f&Xt)!==0)){(t.f&Wt)!==0?e.d.push(t):(t.f&Sr)!==0&&e.m.push(t),$t(t,Xt);for(var n=t.first;n!==null;)$g(n,e),n=n.next}}function jg(t){$t(t,Xt);for(var e=t.first;e!==null;)jg(e),e=e.next}let ol=new Set;const $i=new Map;let Fg=!1;function Xr(t,e){var n={f:0,v:t,reactions:null,equals:xg,rv:0,wv:0};return n}function ie(t,e){const n=Xr(t);return tm(n),n}function Ww(t,e=!1,n=!0){var i;const r=Xr(t);return e||(r.equals=Cg),la&&n&&gt!==null&&gt.l!==null&&((i=gt.l).s??(i.s=[])).push(r),r}function k(t,e,n=!1){tt!==null&&(!yr||(tt.f&rl)!==0)&&$s()&&(tt.f&(sn|wr|ls|rl))!==0&&(zr===null||!zr.has(t))&&cw();let r=n?at(e):e;return xs(t,r,qa)}function xs(t,e,n=null){if(!t.equals(e)){$i.set(t,ki?e:t.v);var r=Zi.ensure();if(r.capture(t,e),(t.f&sn)!==0){const i=t;(t.f&Wt)!==0&&xd(i),hn===null&&Sd(i)}t.wv=rm(),Gg(t,Wt,n),$s()&&rt!==null&&(rt.f&Xt)!==0&&(rt.f&(lr|Yr))===0&&(nr===null?sy([t]):nr.push(t)),!r.is_fork&&ol.size>0&&!Fg&&qw()}return e}function qw(){Fg=!1;for(const t of ol){(t.f&Xt)!==0&&$t(t,Sr);let e;try{e=da(t)}catch{e=!0}e&&Ps(t)}ol.clear()}function rn(t){k(t,t.v+1)}function Gg(t,e,n){var r=t.reactions;if(r!==null)for(var i=$s(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===rt)){var c=(l&Wt)===0;if(c&&$t(a,e),(l&rl)!==0)ol.add(a);else if((l&sn)!==0){var u=a;hn==null||hn.delete(u),(l&Vi)===0&&(l&or&&(rt===null||(rt.f&il)===0)&&(a.f|=Vi),Gg(u,Sr,n))}else if(c){var f=a;(l&wr)!==0&&pr!==null&&pr.add(f),n!==null?n.push(f):Cd(f)}}}}function at(t){if(typeof t!="object"||t===null||mi in t)return t;const e=Gl(t);if(e!==Eg&&e!==q_)return t;var n=new Map,r=jl(t),i=ie(0),s=Tr,o=a=>{if(Tr===s)return a();var l=tt,c=Tr;$n(null),qf(s);var u=a();return $n(l),qf(c),u};return r&&n.set("length",ie(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&aw();var u=n.get(l);return u===void 0?o(()=>{var f=ie(c.value);return n.set(l,f),f}):k(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>ie(Vt));n.set(l,u),rn(i)}}else k(c,Vt),rn(i);return!0},get(a,l,c){var p;if(l===mi)return t;var u=n.get(l),f=l in a;if(u===void 0&&(!f||(p=ko(a,l))!=null&&p.writable)&&(u=o(()=>{var m=at(f?a[l]:Vt),g=ie(m);return g}),n.set(l,u)),u!==void 0){var h=d(u);return h===Vt?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=d(u))}else if(c===void 0){var f=n.get(l),h=f==null?void 0:f.v;if(f!==void 0&&h!==Vt)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===mi)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Vt||Reflect.has(a,l);if(c!==void 0||rt!==null&&(!u||(h=ko(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?at(a[l]):Vt,m=ie(p);return m}),n.set(l,c));var f=d(c);if(f===Vt)return!1}return u},set(a,l,c,u){var O;var f=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<f.v;p+=1){var m=n.get(p+"");m!==void 0?k(m,Vt):p in a&&(m=o(()=>ie(Vt)),n.set(p+"",m))}if(f===void 0)(!h||(O=ko(a,l))!=null&&O.writable)&&(f=o(()=>ie(void 0)),k(f,at(c)),n.set(l,f));else{h=f.v!==Vt;var g=o(()=>at(c));k(f,g)}var b=Reflect.getOwnPropertyDescriptor(a,l);if(b!=null&&b.set&&b.set.call(u,c),!h){if(r&&typeof l=="string"){var _=n.get("length"),y=Number(l);Number.isInteger(y)&&y>=_.v&&k(_,y+1)}rn(i)}return!0},ownKeys(a){d(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==Vt});for(var[c,u]of n)u.v!==Vt&&!(c in a)&&l.push(c);return l},setPrototypeOf(){lw()}})}function Zf(t){try{if(t!==null&&typeof t=="object"&&mi in t)return t[mi]}catch{}return t}function Kw(t,e){return Object.is(Zf(t),Zf(e))}var Mo,Vg,Zg,Wg;function Yw(){if(Mo===void 0){Mo=window,Vg=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Zg=ko(e,"firstChild").get,Wg=ko(e,"nextSibling").get,Ff(t)&&(t[yu]=void 0,t[Ga]=null,t[ku]=void 0,t.__e=void 0),Ff(n)&&(n[oo]=void 0)}}function qr(t=""){return document.createTextNode(t)}function al(t){return Zg.call(t)}function ua(t){return Wg.call(t)}function v(t,e){return al(t)}function et(t,e=!1){{var n=al(t);return n instanceof Comment&&n.data===""?ua(n):n}}function T(t,e=1,n=!1){let r=t;for(;e--;)r=ua(r);return r}function Xw(t){t.textContent=""}function qg(){return!1}function Jw(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function Qw(t){rt===null&&(tt===null&&sw(),iw()),ki&&rw()}function ey(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Hr(t,e){var n=rt;n!==null&&(n.f&Mn)!==0&&(t|=Mn);var r={ctx:gt,deps:null,nodes:null,f:t|Wt|or,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Ye==null||Ye.register_created_effect(r);var i=r;if((t&Ss)!==0)ss!==null?ss.push(r):Zi.ensure().schedule(r);else if(e!==null){try{Ps(r)}catch(o){throw gn(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&Us)===0&&(i=i.first,(t&wr)!==0&&(t&yi)!==0&&i!==null&&(i.f|=yi))}if(i!==null&&(i.parent=n,n!==null&&ey(i,n),tt!==null&&(tt.f&sn)!==0&&(t&Yr)===0)){var s=tt;(s.effects??(s.effects=[])).push(i)}return r}function Rd(){return tt!==null&&!yr}function Ad(t){const e=Hr(Vl,null);return $t(e,Xt),e.teardown=t,e}function Xn(t){Qw();var e=rt.f,n=!tt&&(e&lr)!==0&&gt!==null&&!gt.i;if(n){var r=gt;(r.e??(r.e=[])).push(t)}else return Kg(t)}function Kg(t){return Hr(Ss|Q_,t)}function ty(t){Zi.ensure();const e=Hr(Yr|Us,t);return(n={})=>new Promise(r=>{n.outro?ji(e,()=>{gn(e),r(void 0)}):(gn(e),r(void 0))})}function Zl(t){return Hr(Ss,t)}function ny(t){return Hr(ls|Us,t)}function Od(t,e=0){return Hr(Vl|e,t)}function w(t,e=[],n=[],r=[]){Ng(r,e,n,i=>{Hr(Vl,()=>{t(...i.map(d))})})}function js(t,e=0){var n=Hr(wr|e,t);return n}function Yg(t,e=0){var n=Hr(wd|e,t);return n}function Hn(t){return Hr(lr|Us,t)}function Xg(t){var e=t.teardown;if(e!==null){const n=ki,r=tt;Wf(!0),$n(null);try{e.call(null)}finally{Wf(n),$n(r)}}}function Md(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&ca(()=>{i.abort(aa)});var r=n.next;(n.f&Yr)!==0?n.parent=null:gn(n,e),n=r}}function ry(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&lr)===0&&gn(e),e=n}}function gn(t,e=!0){var n=!1;(e||(t.f&J_)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(iy(t.nodes.start,t.nodes.end),n=!0),t.f|=wu,Md(t,e&&!n),No(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();Xg(t),t.f^=wu,t.f|=ar;var i=t.parent;i!==null&&i.first!==null&&Jg(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function iy(t,e){for(;t!==null;){var n=t===e?null:ua(t);t.remove(),t=n}}function Jg(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function ji(t,e,n=!0){var r=[];Qg(t,r,!0);var i=()=>{n&&gn(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function Qg(t,e,n){if((t.f&Mn)===0){t.f^=Mn;var r=t.nodes&&t.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&e.push(a);for(var i=t.first;i!==null;){var s=i.next;if((i.f&Yr)===0){var o=(i.f&yi)!==0||(i.f&lr)!==0&&(t.f&wr)!==0;Qg(i,e,o?n:!1)}i=s}}}function ll(t){em(t,!0)}function em(t,e){if((t.f&Mn)!==0){t.f^=Mn,(t.f&Xt)===0&&($t(t,Wt),Zi.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&yi)!==0||(n.f&lr)!==0;em(n,i?e:!1),n=r}var s=t.nodes&&t.nodes.t;if(s!==null)for(const o of s)(o.is_global||e)&&o.in()}}function Nd(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:ua(n);e.append(n),n=i}}let Ka=!1,ki=!1;function Wf(t){ki=t}let tt=null,yr=!1;function $n(t){tt=t}let rt=null;function cr(t){rt=t}let zr=null;function tm(t){tt!==null&&(zr??(zr=new Set)).add(t)}let Dn=null,Wn=0,nr=null;function sy(t){nr=t}let nm=1,Ni=0,Tr=Ni;function qf(t){Tr=t}function rm(){return++nm}function da(t){var e=t.f;if((e&Wt)!==0)return!0;if(e&sn&&(t.f&=~Vi),(e&Sr)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(da(s)&&zg(s),s.wv>t.wv)return!0}(e&or)!==0&&hn===null&&$t(t,Xt)}return!1}function im(t,e,n=!0){var r=t.reactions;if(r!==null&&!(zr!==null&&zr.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&sn)!==0?im(s,e,!1):e===s&&(n?$t(s,Wt):(s.f&Xt)!==0&&$t(s,Sr),Cd(s))}}function sm(t){var g;var e=Dn,n=Wn,r=nr,i=tt,s=zr,o=gt,a=yr,l=Tr,c=t.f;Dn=null,Wn=0,nr=null,tt=(c&(lr|Yr))===0?t:null,zr=null,Ts(t.ctx),yr=!1,Tr=++Ni,t.ac!==null&&(ca(()=>{t.ac.abort(aa)}),t.ac=null);try{t.f|=il;var u=t.fn,f=u();t.f|=Bs;var h=t.deps,p=Ye==null?void 0:Ye.is_fork;if(Dn!==null){var m;if(p||No(t,Wn),h!==null&&Wn>0)for(h.length=Wn+Dn.length,m=0;m<Dn.length;m++)h[Wn+m]=Dn[m];else t.deps=h=Dn;if(Rd()&&(t.f&or)!==0)for(m=Wn;m<h.length;m++)((g=h[m]).reactions??(g.reactions=[])).push(t)}else!p&&h!==null&&Wn<h.length&&(No(t,Wn),h.length=Wn);if($s()&&nr!==null&&!yr&&h!==null&&(t.f&(sn|Sr|Wt))===0)for(m=0;m<nr.length;m++)im(nr[m],t);if(i!==null&&i!==t){if(Ni++,i.deps!==null)for(let b=0;b<n;b+=1)i.deps[b].rv=Ni;if(e!==null)for(const b of e)b.rv=Ni;nr!==null&&(r===null?r=nr:r.push(...nr))}return(t.f&gi)!==0&&(t.f^=gi),f}catch(b){return Ag(b)}finally{t.f^=il,Dn=e,Wn=n,nr=r,tt=i,zr=s,Ts(o),yr=a,Tr=l}}function oy(t,e){let n=e.reactions;if(n!==null){var r=Z_.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(e.f&sn)!==0&&(Dn===null||!nl.call(Dn,e))){var s=e;(s.f&or)!==0&&(s.f^=or,s.f&=~Vi),s.v!==Vt&&Sd(s),s.ac!==null&&ca(()=>{s.ac.abort(aa),s.ac=null,$t(s,Wt)}),jw(s),No(s,0)}}function No(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)oy(t,n[r])}function Ps(t){var e=t.f;if((e&ar)===0){$t(t,Xt);var n=rt,r=Ka;rt=t,Ka=(e&(lr|Yr))===0;try{(e&(wr|wd))!==0?ry(t):Md(t),Xg(t);var i=sm(t);t.teardown=typeof i=="function"?i:null,t.wv=nm;var s;yg&&kw&&(t.f&Wt)!==0&&t.deps}finally{Ka=r,rt=n}}}async function To(){await Promise.resolve(),Vw()}function d(t){var e=t.f,n=(e&sn)!==0;if(tt!==null&&!yr){var r=rt!==null&&(rt.f&ar)!==0;if(!r&&(zr===null||!zr.has(t))){var i=tt.deps;if((tt.f&il)!==0)t.rv<Ni&&(t.rv=Ni,Dn===null&&i!==null&&i[Wn]===t?Wn++:Dn===null?Dn=[t]:Dn.push(t));else{tt.deps??(tt.deps=[]),nl.call(tt.deps,t)||tt.deps.push(t);var s=t.reactions;s===null?t.reactions=[tt]:nl.call(s,tt)||s.push(tt)}}}if(ki&&$i.has(t))return $i.get(t);if(n){var o=t;if(ki){var a=o.v;return((o.f&Xt)===0&&o.reactions!==null||am(o))&&(a=xd(o)),$i.set(o,a),a}var l=(o.f&or)===0&&!yr&&tt!==null&&(Ka||(tt.f&or)!==0),c=(o.f&Bs)===0;da(o)&&(l&&(o.f|=or),zg(o)),l&&!c&&(Dg(o),om(o))}if(hn!=null&&hn.has(t))return hn.get(t);if((t.f&gi)!==0)throw t.v;return t.v}function om(t){if(t.f|=or,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&sn)!==0&&(e.f&or)===0&&(Dg(e),om(e))}function am(t){if(t.v===Vt)return!0;if(t.deps===null)return!1;for(const e of t.deps)if($i.has(e)||(e.f&sn)!==0&&am(e))return!0;return!1}function ti(t){var e=yr;try{return yr=!0,t()}finally{yr=e}}function ay(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(mi in t)Au(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&mi in n&&Au(n)}}}function Au(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{Au(t[r],e)}catch{}const n=Gl(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=kg(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function ly(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const cy=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function uy(t){return cy.includes(t)}const dy={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function fy(t){return t=t.toLowerCase(),dy[t]??t}const hy=["touchstart","touchmove"];function py(t){return hy.includes(t)}const Li=Symbol("events"),lm=new Set,Ou=new Set;function Ld(t,e,n,r={}){function i(s){if(r.capture||Mu.call(e,s),!s.cancelBubble)return ca(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Lr(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function Kf(t,e,n,r={}){var i=Ld(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function yt(t,e,n,r,i){var s={capture:r,passive:i},o=Ld(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Ad(()=>{e.removeEventListener(t,o,s)})}function fe(t,e,n){(e[Li]??(e[Li]={}))[t]=n}function dt(t){for(var e=0;e<t.length;e++)lm.add(t[e]);for(var n of Ou)n(t)}let Yf=null;function Mu(t){var g,b;var e=this,n=e.ownerDocument,r=t.type,i=((g=t.composedPath)==null?void 0:g.call(t))||[],s=i[0]||t.target;Yf=t;var o=0,a=Yf===t&&t[Li];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[Li]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||t.target,s!==e){W_(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=tt,f=rt;$n(null),cr(null);try{for(var h,p=[];s!==null&&s!==e;){try{var m=(b=s[Li])==null?void 0:b[r];m!=null&&(!s.disabled||t.target===s)&&m.call(s,t)}catch(_){h?p.push(_):h=_}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let _ of p)queueMicrotask(()=>{throw _});throw h}}finally{t[Li]=e,delete t.currentTarget,$n(u),cr(f)}}}var bg;const Pc=((bg=globalThis==null?void 0:globalThis.window)==null?void 0:bg.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function gy(t){return(Pc==null?void 0:Pc.createHTML(t))??t}function my(t){var e=Jw("template");return e.innerHTML=gy(t.replaceAll("<!>","<!---->")),e.content}function cl(t,e){var n=rt;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function D(t,e){var n=(e&gw)!==0,r=(e&mw)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=my(s?t:"<!>"+t),n||(i=al(i)));var o=r||Vg?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=al(o),l=o.lastChild;cl(a,l)}else cl(o,o);return o}}function Ea(t=""){{var e=qr(t+"");return cl(e,e),e}}function jn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=qr();return t.append(e,n),cl(e,n),t}function A(t,e){t!==null&&t.before(e)}function E(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[oo]??(t[oo]=t.nodeValue))&&(t[oo]=n,t.nodeValue=`${n}`)}function Wl(t,e){return vy(t,e)}const Sa=new Map;function vy(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){Yw();var l=void 0,c=ty(()=>{var u=n??e.appendChild(qr());Lw(u,{pending:()=>{}},p=>{Ze({});var m=gt;s&&(m.c=s),i&&(r.$$events=i),l=t(p,r)||{},We()},a);var f=new Set,h=p=>{for(var m=0;m<p.length;m++){var g=p[m];if(!f.has(g)){f.add(g);var b=py(g);for(const O of[e,document]){var _=Sa.get(O);_===void 0&&(_=new Map,Sa.set(O,_));var y=_.get(g);y===void 0?(O.addEventListener(g,Mu,{passive:b}),_.set(g,1)):_.set(g,y+1)}}}};return h(Fl(lm)),Ou.add(h),()=>{var b;for(var p of f)for(const _ of[e,document]){var m=Sa.get(_),g=m.get(p);--g==0?(_.removeEventListener(p,Mu),m.delete(p),m.size===0&&Sa.delete(_)):m.set(p,g)}Ou.delete(h),u!==n&&((b=u.parentNode)==null||b.removeChild(u))}});return Nu.set(l,c),l}let Nu=new WeakMap;function Id(t,e){const n=Nu.get(t);return n?(Nu.delete(t),n(e)):Promise.resolve()}var mr,Rr,Kn,Bi,Yo,Xo,Hl;class ql{constructor(e,n=!0){K(this,"anchor");xe(this,mr,new Map);xe(this,Rr,new Map);xe(this,Kn,new Map);xe(this,Bi,new Set);xe(this,Yo,!0);xe(this,Xo,e=>{if(x(this,mr).has(e)){var n=x(this,mr).get(e),r=x(this,Rr).get(n);if(r)ll(r),x(this,Bi).delete(n);else{var i=x(this,Kn).get(n);i&&(ll(i.effect),x(this,Rr).set(n,i.effect),x(this,Kn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of x(this,mr)){if(x(this,mr).delete(s),s===e)break;const a=x(this,Kn).get(o);a&&(gn(a.effect),x(this,Kn).delete(o))}for(const[s,o]of x(this,Rr)){if(s===n||x(this,Bi).has(s))continue;const a=()=>{if(Array.from(x(this,mr).values()).includes(s)){var c=document.createDocumentFragment();Nd(o,c),c.append(qr()),x(this,Kn).set(s,{effect:o,fragment:c})}else gn(o);x(this,Bi).delete(s),x(this,Rr).delete(s)};x(this,Yo)||!r?(x(this,Bi).add(s),ji(o,a,!1)):a()}}});xe(this,Hl,e=>{x(this,mr).delete(e);const n=Array.from(x(this,mr).values());for(const[r,i]of x(this,Kn))n.includes(r)||(gn(i.effect),x(this,Kn).delete(r))});this.anchor=e,Ge(this,Yo,n)}ensure(e,n){var r=Ye,i=qg();if(n&&!x(this,Rr).has(e)&&!x(this,Kn).has(e))if(i){var s=document.createDocumentFragment(),o=qr();s.append(o),x(this,Kn).set(e,{effect:Hn(()=>n(o)),fragment:s})}else x(this,Rr).set(e,Hn(()=>n(this.anchor)));if(x(this,mr).set(r,e),i){for(const[a,l]of x(this,Rr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of x(this,Kn))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(x(this,Xo)),r.ondiscard(x(this,Hl))}else x(this,Xo).call(this,r)}}mr=new WeakMap,Rr=new WeakMap,Kn=new WeakMap,Bi=new WeakMap,Yo=new WeakMap,Xo=new WeakMap,Hl=new WeakMap;function J(t,e,n=!1){var r=new ql(t),i=n?yi:0;function s(o,a){r.ensure(o,a)}js(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}const by=Symbol("NaN");function cm(t,e,n){var r=new ql(t),i=!$s();js(()=>{var s=e();s!==s&&(s=by),i&&s!==null&&typeof s=="object"&&(s={}),r.ensure(s,n)})}function _y(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let f=e[a];ji(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var h=t.outrogroups;Lu(t,Fl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null;if(l){var c=n,u=c.parentNode;Xw(u),u.append(c),t.items.clear()}Lu(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(s)}function Lu(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const o of t.pending.values())for(const a of o)r.add(t.items.get(a).e)}for(var i=0;i<e.length;i++){var s=e[i];if(r!=null&&r.has(s)){s.f|=Nr;const o=document.createDocumentFragment();Nd(s,o)}else gn(e[i],n)}}var Xf;function Ct(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&Tg)!==0;if(l){var c=t;o=c.appendChild(qr())}var u=null,f=Ig(()=>{var O=n();return jl(O)?O:O==null?[]:Fl(O)}),h,p=new Map,m=!0;function g(O){(y.effect.f&ar)===0&&(y.pending.delete(O),y.fallback=u,wy(y,h,o,e,r),u!==null&&(h.length===0?(u.f&Nr)===0?ll(u):(u.f^=Nr,uo(u,null,o)):ji(u,()=>{u=null})))}function b(O){y.pending.delete(O)}var _=js(()=>{h=d(f);for(var O=h.length,N=new Set,S=Ye,P=qg(),M=0;M<O;M+=1){var z=h[M],B=r(z,M),U=m?null:a.get(B);U?(U.v&&xs(U.v,z),U.i&&xs(U.i,M),P&&S.unskip_effect(U.e)):(U=yy(a,m?o:Xf??(Xf=qr()),z,B,M,i,e,n),m||(U.e.f|=Nr),a.set(B,U)),N.add(B)}if(O===0&&s&&!u&&(m?u=Hn(()=>s(o)):(u=Hn(()=>s(Xf??(Xf=qr()))),u.f|=Nr)),O>N.size&&nw(),!m)if(p.set(S,N),P){for(const[G,Y]of a)N.has(G)||S.skip_effect(Y.e);S.oncommit(g),S.ondiscard(b)}else g(S);d(f)}),y={effect:_,items:a,pending:p,outrogroups:null,fallback:u};m=!1}function eo(t){for(;t!==null&&(t.f&lr)===0;)t=t.next;return t}function wy(t,e,n,r,i){var U,G,Y,oe,we,he,te,ge,ye;var s=(r&hw)!==0,o=e.length,a=t.items,l=eo(t.effect.first),c,u=null,f,h=[],p=[],m,g,b,_;if(s)for(_=0;_<o;_+=1)m=e[_],g=i(m,_),b=a.get(g).e,(b.f&Nr)===0&&((G=(U=b.nodes)==null?void 0:U.a)==null||G.measure(),(f??(f=new Set)).add(b));for(_=0;_<o;_+=1){if(m=e[_],g=i(m,_),b=a.get(g).e,t.outrogroups!==null)for(const Me of t.outrogroups)Me.pending.delete(b),Me.done.delete(b);if((b.f&Mn)!==0&&(ll(b),s&&((oe=(Y=b.nodes)==null?void 0:Y.a)==null||oe.unfix(),(f??(f=new Set)).delete(b))),(b.f&Nr)!==0)if(b.f^=Nr,b===l)uo(b,null,n);else{var y=u?u.next:l;b===t.effect.last&&(t.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),oi(t,u,b),oi(t,b,y),uo(b,y,n),u=b,h=[],p=[],l=eo(u.next);continue}if(b!==l){if(c!==void 0&&c.has(b)){if(h.length<p.length){var O=p[0],N;u=O.prev;var S=h[0],P=h[h.length-1];for(N=0;N<h.length;N+=1)uo(h[N],O,n);for(N=0;N<p.length;N+=1)c.delete(p[N]);oi(t,S.prev,P.next),oi(t,u,S),oi(t,P,O),l=O,u=P,_-=1,h=[],p=[]}else c.delete(b),uo(b,l,n),oi(t,b.prev,b.next),oi(t,b,u===null?t.effect.first:u.next),oi(t,u,b),u=b;continue}for(h=[],p=[];l!==null&&l!==b;)(c??(c=new Set)).add(l),p.push(l),l=eo(l.next);if(l===null)continue}(b.f&Nr)===0&&h.push(b),u=b,l=eo(b.next)}if(t.outrogroups!==null){for(const Me of t.outrogroups)Me.pending.size===0&&(Lu(t,Fl(Me.done)),(we=t.outrogroups)==null||we.delete(Me));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var M=[];if(c!==void 0)for(b of c)(b.f&Mn)===0&&M.push(b);for(;l!==null;)(l.f&Mn)===0&&l!==t.fallback&&M.push(l),l=eo(l.next);var z=M.length;if(z>0){var B=(r&Tg)!==0&&o===0?n:null;if(s){for(_=0;_<z;_+=1)(te=(he=M[_].nodes)==null?void 0:he.a)==null||te.measure();for(_=0;_<z;_+=1)(ye=(ge=M[_].nodes)==null?void 0:ge.a)==null||ye.fix()}_y(t,M,B)}}s&&Lr(()=>{var Me,Fe;if(f!==void 0)for(b of f)(Fe=(Me=b.nodes)==null?void 0:Me.a)==null||Fe.apply()})}function yy(t,e,n,r,i,s,o,a){var l=(o&dw)!==0?(o&pw)===0?Ww(n,!1,!1):Xr(n):null,c=(o&fw)!==0?Xr(i):null;return{v:l,i:c,e:Hn(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function uo(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&Nr)===0?e.nodes.start:n;r!==null;){var o=ua(r);if(s.before(r),r===i)return;r=o}}function oi(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function ky(t,e,...n){var r=new ql(t);js(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},yi)}function Ey(t,e,n){var r=new ql(t);js(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},yi)}function Fs(t,e,n){Zl(()=>{var r=ti(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};Od(()=>{var o=n();ay(o),i&&Pg(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function Sy(t,e){var n=void 0,r;Yg(()=>{n!==(n=e())&&(r&&(gn(r),r=null),n&&(r=Hn(()=>{Zl(()=>n(t))})))})}function um(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=um(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ty(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=um(t))&&(r&&(r+=" "),r+=e);return r}function xy(t){return typeof t=="object"?Ty(t):t??""}const Jf=[...`
2
+ \r\f \v\uFEFF`];function Py(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var a=o+s;(o===0||Jf.includes(r[o-1]))&&(a===r.length||Jf.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function Qf(t,e=!1){var n=e?" !important;":";",r="";for(var i of Object.keys(t)){var s=t[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function Cc(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Cy(t,e){if(e){var n="",r,i;if(Array.isArray(e)?(r=e[0],i=e[1]):r=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,l=[];r&&l.push(...Object.keys(r).map(Cc)),i&&l.push(...Object.keys(i).map(Cc));var c=0,u=-1;const g=t.length;for(var f=0;f<g;f++){var h=t[f];if(a?h==="/"&&t[f-1]==="*"&&(a=!1):s?s===h&&(s=!1):h==="/"&&t[f+1]==="*"?a=!0:h==='"'||h==="'"?s=h:h==="("?o++:h===")"&&o--,!a&&s===!1&&o===0){if(h===":"&&u===-1)u=f;else if(h===";"||f===g-1){if(u!==-1){var p=Cc(t.substring(c,u).trim());if(!l.includes(p)){h!==";"&&f++;var m=t.substring(c,f).trim();n+=" "+m+";"}}c=f+1,u=-1}}}}return r&&(n+=Qf(r)),i&&(n+=Qf(i,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Le(t,e,n,r,i,s){var o=t[yu];if(o!==n||o===void 0){var a=Py(n,r,s);a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a),t[yu]=n}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&t.classList.toggle(l,c)}return s}function Rc(t,e={},n,r){for(var i in n){var s=n[i];e[i]!==s&&(n[i]==null?t.style.removeProperty(i):t.style.setProperty(i,s,r))}}function Lo(t,e,n,r){var i=t[ku];if(i!==e){var s=Cy(e,r);s==null?t.removeAttribute("style"):t.style.cssText=s,t[ku]=e}else r&&(Array.isArray(r)?(Rc(t,n==null?void 0:n[0],r[0]),Rc(t,n==null?void 0:n[1],r[1],"important")):Rc(t,n,r));return r}function Iu(t,e,n=!1){if(t.multiple){if(e==null)return;if(!jl(e))return ww();for(var r of t.options)r.selected=e.includes(eh(r));return}for(r of t.options){var i=eh(r);if(Kw(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function Ry(t){var e=new MutationObserver(()=>{"__value"in t&&Iu(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Ad(()=>{e.disconnect()})}function eh(t){return"__value"in t?t.__value:t.value}const Ta=Symbol("class"),to=Symbol("style"),dm=Symbol("is custom element"),fm=Symbol("is html"),Ay=yd?"input":"INPUT",Oy=yd?"option":"OPTION",My=yd?"select":"SELECT";function Ny(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Oe(t,e,n,r){var i=hm(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[ew]=n),n==null?t.removeAttribute(e):typeof n!="string"&&zd(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function C(t,e,n){var r=tt,i=rt;$n(null),cr(null);try{e!=="style"&&(zu.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?zd(t).includes(e):n&&typeof n=="object")?t[e]=n:Oe(t,e,n==null?n:String(n))}finally{$n(r),cr(i)}}function Ly(t,e,n,r,i=!1,s=!1){var o=hm(t),a=o[dm],l=!o[fm],c=e||{},u=t.nodeName===Oy;for(var f in e)f in n||(n[f]=null);n.class?n.class=xy(n.class):n.class=null,n[to]&&(n.style??(n.style=null));var h=zd(t);if(t.nodeName===Ay&&"type"in n&&("value"in n||"__value"in n)){var p=n.type;(p!==c.type||p===void 0&&t.hasAttribute("type"))&&(c.type=p,Oe(t,"type",p))}for(const N in n){let S=n[N];if(u&&N==="value"&&S==null){t.value=t.__value="",c[N]=S;continue}if(N==="class"){var m=t.namespaceURI==="http://www.w3.org/1999/xhtml";Le(t,m,S,r,e==null?void 0:e[Ta],n[Ta]),c[N]=S,c[Ta]=n[Ta];continue}if(N==="style"){Lo(t,S,e==null?void 0:e[to],n[to]),c[N]=S,c[to]=n[to];continue}var g=c[N];if(!(S===g&&!(S===void 0&&t.hasAttribute(N)))){c[N]=S;var b=N[0]+N[1];if(b!=="$$")if(b==="on"){const P={},M="$$"+N;let z=N.slice(2);var _=uy(z);if(ly(z)&&(z=z.slice(0,-7),P.capture=!0),!_&&g){if(S!=null)continue;t.removeEventListener(z,c[M],P),c[M]=null}if(_)fe(z,t,S),dt([z]);else if(S!=null){let B=function(U){c[N].call(this,U)};c[M]=Ld(z,t,B,P)}}else if(N==="style")Oe(t,N,S);else if(N==="autofocus")Ow(t,!!S);else if(!a&&(N==="__value"||N==="value"&&S!=null))t.value=t.__value=S;else if(N==="selected"&&u)Ny(t,S);else{var y=N;l||(y=fy(y));var O=y==="defaultValue"||y==="defaultChecked";if(S==null&&!a&&!O)if(o[N]=null,y==="value"||y==="checked"){let P=t;const M=e===void 0;if(y==="value"){let z=P.defaultValue;P.removeAttribute(y),P.defaultValue=z,P.value=P.__value=M?z:null}else{let z=P.defaultChecked;P.removeAttribute(y),P.defaultChecked=z,P.checked=M?z:!1}}else t.removeAttribute(N);else O||h.includes(y)&&(a||typeof S!="string")?(t[y]=S,y in o&&(o[y]=Vt)):typeof S!="function"&&Oe(t,y,S)}}}return c}function Iy(t,e,n=[],r=[],i=[],s,o=!1,a=!1){Ng(i,n,r,l=>{var c=void 0,u={},f=t.nodeName===My,h=!1;if(Yg(()=>{var m=e(...l.map(d)),g=Ly(t,c,m,s,o,a);h&&f&&"value"in m&&Iu(t,m.value);for(let _ of Object.getOwnPropertySymbols(u))m[_]||gn(u[_]);for(let _ of Object.getOwnPropertySymbols(m)){var b=m[_];_.description===bw&&(!c||b!==c[_])&&(u[_]&&gn(u[_]),u[_]=Hn(()=>Sy(t,()=>b))),g[_]=b}c=g}),f){var p=t;Zl(()=>{Iu(p,c.value,!0),Ry(p)})}h=!0})}function hm(t){return t[Ga]??(t[Ga]={[dm]:t.nodeName.includes("-"),[fm]:t.namespaceURI===vw})}var zu=new Map;function zd(t){var e=t.getAttribute("is")||t.nodeName,n=zu.get(e);if(n)return n;zu.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=kg(i);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.push(o);i=Gl(i)}return n}function Ac(t,e){return t===e||(t==null?void 0:t[mi])===e}function Ei(t={},e,n,r){var i=gt.r,s=rt;return Zl(()=>{var o,a;return Od(()=>{o=a,a=(r==null?void 0:r())||[],ti(()=>{Ac(n(...a),t)||(e(t,...a),o&&Ac(n(...o),t)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&wu;)l=l.parent;const c=()=>{a&&Ac(n(...a),t)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}function kn(t,e,n,r){var i=r,s=!0,o=()=>(s&&(s=!1,i=r),i),a;a=t[e],a===void 0&&r!==void 0&&(a=o());var l;return l=()=>{var c=t[e];return c===void 0?o():(s=!0,c)},l}function Fn(t){gt===null&&kd(),la&&gt.l!==null?zy(gt).m.push(t):Xn(()=>{const e=ti(t);if(typeof e=="function")return e})}function ni(t){gt===null&&kd(),Fn(()=>()=>ti(t))}function zy(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const Dy="5";var _g;typeof window<"u"&&((_g=window.__svelte??(window.__svelte={})).v??(_g.v=new Set)).add(Dy);const Hy="modulepreload",By=function(t){return"/"+t},th={},ul=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=By(c),c in th)return;th[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":Hy,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,m)=>{h.addEventListener("load",p),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function xo(t,e){if(e)for(const n in e)t=t.replace(`:${n}`,String(e[n]));return Tt.name==="#"?t==="/"?"/#/":dl("#",t):Tt.name?dl(Tt.name,t):t}function Uy(t,e){let n=xo(t,e==null?void 0:e.params);return e!=null&&e.search&&(n+=Bd(e.search)),e!=null&&e.hash&&!e.hash.startsWith("#")&&(n+="#"+e.hash),n}function pm(t){return Promise.all(t.map(e=>$y(e)))}function $y(t){return new Promise(e=>{jy(t)?Promise.resolve(t()).then(n=>{e(n.default)}):e(t)})}function jy(t){return typeof t=="function"&&!!/\(\)\s?=>\s?(import|__vite_ssr_dynamic_import__)\(.*\)/.test(String(t))}function dl(...t){let e="";for(let n of t)n.startsWith("/")||(e+="/"),n.endsWith("/")&&(n=n.slice(0,-1)),e+=n;return e}function Dd(t){return Tt.name&&t.startsWith(Tt.name)&&(t=t.slice(Tt.name.length)||"/"),t}function Hd(){const t=Tt.name==="#"?globalThis.location.hash.slice(1):globalThis.location.pathname,e=Tt.name==="#"?"":globalThis.location.hash;return{pathname:t,search:globalThis.location.search,state:history.state,hash:e}}function Bd(t){if(!t)return;if(typeof t=="string")return t.startsWith("?")||(t="?"+t),t;const e=Object.fromEntries(Object.entries(t).map(([r,i])=>[r,String(i)]));return Object.keys(e).length===0?void 0:"?"+new URLSearchParams(e).toString()}function Ud(t){if(!t)return{};if(typeof t=="string"){const e=new URLSearchParams(t);return Object.fromEntries([...e.entries()].map(([n,r])=>[n,Fy(r)]))}return t}function Fy(t){if(t==="")return"";if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return Number.isNaN(e)?t:e}function Du(t,e){return gm((n,r)=>n===r,t,e)}Du.startsWith=(t,e)=>gm((n,r)=>n.startsWith(r),t,e);function gm(t,e,n){if(!e.includes(":")){const s=Tt.name&&Tt.name!=="#"?xo(e):e;return t(Bn.pathname,s)}if(n)return Tt.name==="#"?t(Bn.pathname,xo(e,n).replace("/#","")):t(Bn.pathname,xo(e,n));const r=e.split("/").slice(1);let i=Bn.pathname.split("/").slice(1);if(r.length>i.length)return!1;for(const[s,o]of r.entries()){const a=i[s];if(!o.startsWith(":")&&o!==a)return!1}return!0}function $d(t,e){t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/").slice(1),r=Gy(Object.keys(e));let i,s=[],o=[],a={},l={};const c=e["/"];c&&typeof c=="object"&&"meta"in c&&c.meta&&(l={...l,...c.meta});let u=!1;e:for(const f of r){const h=f.split("/");h[0]===""&&h.shift();for(let[p,m]of h.entries()){u=m.startsWith("(")&&m.endsWith(")"),u&&(m=m.slice(1,-1));const g=n[p],b=m===""&&typeof e["/"]!="function";if(m.startsWith(":"))a[m.slice(1)]=decodeURIComponent(g);else if(m.startsWith("*")){const N=m.slice(1);N&&(a[N]=n.slice(p).map(decodeURIComponent).join("/")),u?s=[]:"layout"in e&&e.layout&&s.push(e.layout);const S=(p?"/":"")+h.join("/");i=e[S];break e}else if(m.toLowerCase()!==(g==null?void 0:g.toLowerCase())&&!b)break;if(p!==h.length-1)continue;const _=e["/"+h.join("/")];if(typeof _=="function"&&h.length!==n.length)continue;if(!u&&"layout"in e&&e.layout&&s.push(e.layout),"hooks"in e&&e.hooks&&o.push(e.hooks),"meta"in e&&e.meta&&(l={...l,...e.meta}),typeof _=="function"){if(h.length===n.length){i=_;break e}continue}const y=b?t:"/"+n.slice(p+1).join("/"),O=$d(y,_);if(O.match)i=O.match,a={...a,...O.params},o.push(...O.hooks),l={...l,...O.meta},O.breakFromLayouts?(s=[],u=!0):s.push(...O.layouts);else continue;break e}}return{match:i,layouts:s,hooks:o,params:a,meta:l,breakFromLayouts:u}}function Gy(t){return t.toSorted((e,n)=>nh(e)-nh(n))}function nh(t){return t===""||t==="/"?1:t.includes("*")?4:t.includes(":")?3:2}const Vy=200,Zy=Math.PI/6,Wy=50;async function mm(t,e,n){const{match:r,layouts:i,hooks:s,meta:o}=$d(e,t);for(const{onPreload:a}of s)a==null||a({pathname:e,meta:o,...n,search:Ud(n==null?void 0:n.search)});await pm(r?[...i,r]:i)}const rh=new Set,Qi=new Set;function qy(t){function e(o){if(!o.getAttribute("href"))return;const l=new URL(o.href),c=Dd(l.pathname),{replace:u,state:f}=o.dataset;mm(t,c,{replace:u===""||u==="true",search:l.search,state:f,hash:l.hash})}let n=null;function r(o){if(!o.getPredictedEvents||n)return;if(n=setTimeout(()=>{n=null},Wy),Qi.size===0){document.removeEventListener("pointermove",r);return}const l=o.getPredictedEvents().at(-1);if(!l)return;const c=o.clientX,u=o.clientY,f=l.clientX-c,h=l.clientY-u,p=Math.hypot(f,h);if(p<2)return;const m=f/p,g=h/p;e:for(const b of Qi){b.isConnected||Qi.delete(b);const _=b.getBoundingClientRect(),y=[{x:_.left,y:_.top},{x:_.right,y:_.top},{x:_.left,y:_.bottom},{x:_.right,y:_.bottom},{x:_.left+_.width/2,y:_.top+_.height/2}];for(const O of y){const N=O.x-c,S=O.y-u,P=Math.hypot(N,S);if(P>Vy||P<.001)continue;const M=N/P,z=S/P,B=m*M+g*z;if(Math.acos(Math.max(-1,Math.min(1,B)))<=Zy){e(b),Qi.delete(b);continue e}}}}const i=new IntersectionObserver(o=>{for(const a of o)a.isIntersecting&&(i.unobserve(a.target),e(a.target))});new MutationObserver(()=>{const o=document.querySelectorAll("a[data-preload]");for(const a of o)if(!rh.has(a)){switch(rh.add(a),a.dataset.preload){case"":case"true":case"hover":{a.addEventListener("mouseenter",function l(){a.removeEventListener("mouseenter",l),e(a)});break}case"predict":{Qi.size===0&&document.addEventListener("pointermove",r),Qi.add(a);break}case"viewport":{i.observe(a);break}default:{console.warn(`Unknown preload strategy \`${a.dataset.preload}\` on`,a,`
3
+ Available strategies are: hover, viewport, predict`);break}}a.addEventListener("focus",function l(){a.removeEventListener("focus",l),e(a)})}}).observe(document.body,{subtree:!0,childList:!0})}class ih extends Error{constructor(e){super(`Navigating to: ${e}`),this.name="Redirect"}}var Ky=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],Yy=["difference","intersection","symmetricDifference","union"],sh=!1,Es,vr,ui,Bl,Hs,vm,bm;const Ul=class Ul extends Set{constructor(n){super();xe(this,Hs);xe(this,Es,new Map);xe(this,vr,ie(0));xe(this,ui,ie(0));xe(this,Bl,Tr||-1);if(n){for(var r of n)super.add(r);x(this,ui).v=super.size}sh||Ve(this,Hs,bm).call(this)}has(n){var r=super.has(n),i=x(this,Es),s=i.get(n);if(s===void 0){if(!r)return d(x(this,vr)),!1;s=Ve(this,Hs,vm).call(this,!0),i.set(n,s)}return d(s),r}add(n){return super.has(n)||(super.add(n),k(x(this,ui),super.size),rn(x(this,vr))),this}delete(n){var r=super.delete(n),i=x(this,Es),s=i.get(n);return s!==void 0&&(i.delete(n),k(s,!1)),r&&(k(x(this,ui),super.size),rn(x(this,vr))),r}clear(){if(super.size!==0){super.clear();var n=x(this,Es);for(var r of n.values())k(r,!1);n.clear(),k(x(this,ui),0),rn(x(this,vr))}}keys(){return this.values()}values(){return d(x(this,vr)),super.values()}entries(){return d(x(this,vr)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return d(x(this,ui))}};Es=new WeakMap,vr=new WeakMap,ui=new WeakMap,Bl=new WeakMap,Hs=new WeakSet,vm=function(n){return Tr===x(this,Bl)?ie(n):Xr(n)},bm=function(){sh=!0;var n=Ul.prototype,r=Set.prototype;for(const i of Ky)n[i]=function(...s){return d(x(this,vr)),r[i].apply(this,s)};for(const i of Yy)n[i]=function(...s){d(x(this,vr));var o=r[i].apply(this,s);return new Ul(o)}};let Cs=Ul;var Ar,Or,Vr,$l,Er,fo,Ya;const Df=class Df extends Map{constructor(n){super();xe(this,Er);xe(this,Ar,new Map);xe(this,Or,ie(0));xe(this,Vr,ie(0));xe(this,$l,Tr||-1);if(n){for(var[r,i]of n)super.set(r,i);x(this,Vr).v=super.size}}has(n){var r=x(this,Ar),i=r.get(n);if(i===void 0)if(super.has(n))i=Ve(this,Er,fo).call(this,0),r.set(n,i);else return d(x(this,Or)),!1;return d(i),!0}forEach(n,r){Ve(this,Er,Ya).call(this),super.forEach(n,r)}get(n){var r=x(this,Ar),i=r.get(n);if(i===void 0)if(super.has(n))i=Ve(this,Er,fo).call(this,0),r.set(n,i);else{d(x(this,Or));return}return d(i),super.get(n)}set(n,r){var f;var i=x(this,Ar),s=i.get(n),o=super.get(n),a=super.set(n,r),l=x(this,Or);if(s===void 0)s=Ve(this,Er,fo).call(this,0),i.set(n,s),k(x(this,Vr),super.size),rn(l);else if(o!==r){rn(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((f=s.reactions)!=null&&f.every(h=>c.has(h)));u&&rn(l)}return a}delete(n){var r=x(this,Ar),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),k(i,-1)),s&&(k(x(this,Vr),super.size),rn(x(this,Or))),s}clear(){if(super.size!==0){super.clear();var n=x(this,Ar);k(x(this,Vr),0);for(var r of n.values())k(r,-1);rn(x(this,Or)),n.clear()}}keys(){return d(x(this,Or)),super.keys()}values(){return Ve(this,Er,Ya).call(this),super.values()}entries(){return Ve(this,Er,Ya).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(x(this,Vr)),super.size}};Ar=new WeakMap,Or=new WeakMap,Vr=new WeakMap,$l=new WeakMap,Er=new WeakSet,fo=function(n){return Tr===x(this,$l)?ie(n):Xr(n)},Ya=function(){d(x(this,Or));var n=x(this,Ar);if(x(this,Vr).v!==n.size){for(var r of Bf(Df.prototype,this,"keys").call(this))if(!n.has(r)){var i=Ve(this,Er,fo).call(this,0);n.set(r,i)}}for([,i]of x(this,Ar))d(i)};let Si=Df;const Xy=Symbol("replace");var un,Jo,Zr,Ui,ho;class Jy extends URLSearchParams{constructor(){super(...arguments);xe(this,Ui);xe(this,un,ie(0));xe(this,Jo,e0());xe(this,Zr,!1)}[Xy](n){if(!x(this,Zr)&&n.toString()!==super.toString()){Ge(this,Zr,!0);for(const r of[...super.keys()])super.delete(r);for(const[r,i]of n)super.append(r,i);rn(x(this,un)),Ge(this,Zr,!1)}}append(n,r){super.append(n,r),Ve(this,Ui,ho).call(this),rn(x(this,un))}delete(n,r){var i=super.has(n,r);super.delete(n,r),i&&(Ve(this,Ui,ho).call(this),rn(x(this,un)))}get(n){return d(x(this,un)),super.get(n)}getAll(n){return d(x(this,un)),super.getAll(n)}has(n,r){return d(x(this,un)),super.has(n,r)}keys(){return d(x(this,un)),super.keys()}forEach(n,r){d(x(this,un)),super.forEach(n,r)}set(n,r){var i=super.getAll(n);super.set(n,r);var s=super.getAll(n);(i.length!==s.length||i.some((o,a)=>o!==s[a]))&&(Ve(this,Ui,ho).call(this),rn(x(this,un)))}sort(){super.sort(),Ve(this,Ui,ho).call(this),rn(x(this,un))}toString(){return d(x(this,un)),super.toString()}values(){return d(x(this,un)),super.values()}entries(){return d(x(this,un)),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(x(this,un)),super.size}}un=new WeakMap,Jo=new WeakMap,Zr=new WeakMap,Ui=new WeakSet,ho=function(){if(!x(this,Jo)||x(this,Zr))return;Ge(this,Zr,!0);const n=this.toString();x(this,Jo).search=n&&`?${n}`,Ge(this,Zr,!1)};let Qy=null;function e0(){return Qy}let xa=new Jy(globalThis.location.search);function oh(t){if(xa.toString()===t)return;const e=new URLSearchParams(t);for(const[n,r]of e)xa.set(n,r);for(const n of xa.keys())e.has(n)||xa.delete(n)}let Po;const Tt={name:void 0};let Hu=at({value:[]}),Bn=at({pathname:"/",search:"",state:null,hash:""});queueMicrotask(()=>{const t=Hd();Bn.pathname=t.pathname,Bn.search=t.search,Bn.state=t.state,Bn.hash=t.hash});let Bu=at({value:{}}),_m=at({value:{}}),Oi=null,Pa=null,Xa=null;function t0(t){if(t){const e=new URL(globalThis.location.toString());t==="#"?(Tt.name="#",globalThis.location.href.includes("#")||(e.hash="/",history.replaceState(history.state||{},"",e.toString()))):(Tt.name=(t.startsWith("/")?"":"/")+t,e.pathname.startsWith(Tt.name)||(e.pathname=dl(Tt.name,e.pathname),history.replaceState(history.state||{},"",e.toString())))}Object.assign(Bn,Hd())}function n0(t){return Po=t,qy(Po),{p:Uy,navigate:r0,isActive:Du,async preload(e){await mm(Po,e)},route:{get params(){return Bu.value},getParams(e){if(!Du(e))throw new Error(`\`${e}\` does not match the current route`);return Bu.value},get pathname(){return Dd(Bn.pathname)},get search(){return Ud(Bn.search)},get state(){return Bn.state},get hash(){return Bn.hash},get meta(){return _m.value}}}}async function r0(t,e={}){if(typeof t=="number")return globalThis.history.go(t),new ih(`History entry: ${t}`);t=xo(t,e.params),Tt.name==="#"?t=t.replace("/#",""):e.hash&&!e.hash.startsWith("#")&&(e.hash="#"+e.hash);const n=fl(t,e);return Xa=n,await n,new ih(`${t}${Bd((e==null?void 0:e.search)??"")}${(e==null?void 0:e.hash)??""}`)}async function fl(t,e={}){if(!Po)throw new Error("Router not initialized: `createRouter` was not called.");if(Pa&&Pa!==Oi)return;Oi==null||Oi.abort(),Oi=new AbortController;const{signal:n}=Oi,r=i0(t),{match:i,layouts:s,hooks:o,meta:a,params:l}=$d(r,Po),c=Ud(e.search),u={pathname:r,meta:a,...e,search:c};let f=[];for(const p of o){if(n.aborted)return Xa;try{const{beforeLoad:m}=p;f.push(p),Pa=Oi,await(m==null?void 0:m(u))}catch(m){if(n.aborted)return Xa;for(const{onError:g}of f)g==null||g(m,u);return}finally{Pa=null}}let h;try{h=await pm(i?[...s,i]:s)}catch(p){for(const{onError:m}of o)m==null||m(p,u);throw p}if(n.aborted)return Xa;if(t){const p=Bd(e.search),m=new URL(globalThis.location.toString());m.search=p||"",m.hash=e.hash||"",Tt.name==="#"?m.hash=t:Tt.name&&!t.startsWith(Tt.name)?m.pathname=dl(Tt.name,t):m.pathname=t;const g=e.replace?"replaceState":"pushState";globalThis.history[g](e.state||{},"",m.toString()),oh(p)}else oh(globalThis.location.search);e.viewTransition&&document.startViewTransition!==void 0?document.startViewTransition(()=>{Hu.value=h}):Hu.value=h,Bu.value=l,_m.value=a,Object.assign(Bn,Hd()),e.scrollToTop!==!1&&window.scrollTo({top:0,left:0,behavior:e.scrollToTop});for(const{afterLoad:p}of o)p==null||p(u)}function i0(t){let e;return t?e=t:Tt.name==="#"?e=globalThis.location.hash.slice(1):e=globalThis.location.pathname,Tt.name&&e.startsWith(Tt.name)&&(e=e.slice(Tt.name.length)||"/"),Dd(e)}function s0(t){var f;const e=t.target.closest("a");if(!e||e.hasAttribute("target")||e.hasAttribute("download")||!e.hasAttribute("href")||(f=e.getAttribute("href"))!=null&&f.startsWith("#"))return;const n=new URL(e.href),r=globalThis.location.origin;if(n.origin!==r)return;const i=Tt.name==="#"?n.hash:n.pathname,s=Tt.name==="#"?void 0:n.hash;t.preventDefault();const{replace:o,state:a,scrollToTop:l,viewTransition:c}=e.dataset;let u;if(a)try{u=JSON.parse(a)}catch{u=a}fl(i,{replace:o===""||o==="true",search:n.search,state:u,hash:s,scrollToTop:l==="false"?!1:l,viewTransition:c===""||c==="true"})}function wm(t,e){Ze(e,!0);const n=V(()=>e.tree[0]),r=V(()=>e.tree.slice(1));var i=jn(),s=et(i);Ey(s,()=>d(n),(o,a)=>{a(o,{children:(l,c)=>{var u=jn(),f=et(u);{var h=p=>{wm(p,{get tree(){return d(r)}})};J(f,p=>{d(r).length>0&&p(h)})}A(l,u)},$$slots:{default:!0}})}),A(t,i),We()}function o0(t,e){Ze(e,!0),t0(e.base),fl(),Xn(()=>{const n=Kf(globalThis,"popstate",()=>fl()),r=Kf(globalThis,"click",s0);return()=>{n(),r()}}),wm(t,{get tree(){return Hu.value}}),We()}const a0=720;function fa(){return window.matchMedia("(max-width: "+a0+"px)")}const jd="mndw",Rs=`${jd}:plugin`,ym=["en","ru"],km=5e3,l0=300,c0=1e4,u0=6e4,d0=24e4,ah=15e3,Em=10*1024*1024,Fd=Object.freeze({theme:"dark",locale:"en"}),Gd=Object.freeze({deviceName:"Unknown",vendor:"Unknown",manufacturer:"Unknown",model:"Unknown",series:"Unknown",region:"Unknown",hwId:"Unknown",hwVersion:"Unknown",firmwareVersion:"Unknown",firmwareRelease:"Unknown",features:Object.freeze([]),components:Object.freeze([]),switchports:Object.freeze({list:Object.freeze([]),layout:Object.freeze([]),hasPortStats:!1}),usb:Object.freeze({ports:Object.freeze([])})}),Sm="/api/mgmt/list",f0="/api/mgmt/capability",h0="/api/mgmt/upload",lh="/api/mgmt/approve",p0="/api/mgmt/deny",g0="/api/mgmt/enable",m0="/api/mgmt/disable",v0="/api/mgmt/delete",b0="/api/mgmt/restart",_0="/api/mgmt/runtime",Oc="/api/mgmt/palette",w0="/api/mgmt/device-hardware",ch="/api/mgmt/telemetry",y0="/api/mgmt/opkg/list",k0="/api/mgmt/opkg/install",E0="/api/mgmt/opkg/remove",S0="/api/mgmt/opkg/update",T0="/api/mgmt/opkg/upgrade",x0="/api/mgmt/opkg/info",P0="/api/mgmt/self-update/status",C0="/api/mgmt/self-update/check",R0="/api/mgmt/self-update/apply",A0="/api/mgmt/self-update/revert",O0="/api/mgmt/service/list",M0="/api/mgmt/service/status",N0="/api/mgmt/service/start",L0="/api/mgmt/service/stop",I0="/api/mgmt/service/restart",z0="/api/mgmt/service/set-enabled",uh={builtin:"/plugins/",user:"/user-plugins/"};function dh(t){return t.split(",").map(e=>e.trim()).filter(e=>e!=="")}var fh;function W(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let f=0;f<u.length;f++){const h=u[f];h in a||(a[h]=c[h].bind(a))}}const i=(n==null?void 0:n.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class cs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Tm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(fh=globalThis).__zod_globalConfig??(fh.__zod_globalConfig={});const Vd=globalThis.__zod_globalConfig;function Jr(t){return Vd}function xm(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Uu(t,e){return typeof e=="bigint"?e.toString():e}function Kl(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Zd(t){return t==null}function Wd(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function D0(t,e){const n=t/e,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const hh=Symbol("evaluating");function vt(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==hh)return r===void 0&&(r=hh,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function qi(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ci(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function ph(t){return JSON.stringify(t)}function H0(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Pm="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Io(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const B0=Kl(()=>{var t;if(Vd.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function As(t){if(Io(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Io(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Cm(t){return As(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const U0=new Set(["string","number","symbol"]);function Os(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ri(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function Ce(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function $0(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const j0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function F0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Ci(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return qi(this,"shape",o),o},checks:[]});return Ri(t,s)}function G0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Ci(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return qi(this,"shape",o),o},checks:[]});return Ri(t,s)}function V0(t,e){if(!As(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=t._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Ci(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return qi(this,"shape",s),s}});return Ri(t,i)}function Z0(t,e){if(!As(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ci(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return qi(this,"shape",r),r}});return Ri(t,n)}function W0(t,e){var r;if((r=t._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Ci(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return qi(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ri(t,n)}function q0(t,e,n){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Ci(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return qi(this,"shape",l),l},checks:[]});return Ri(e,o)}function K0(t,e,n){const r=Ci(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(n)for(const o in n){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(s[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new t({type:"nonoptional",innerType:i[o]});return qi(this,"shape",s),s}});return Ri(e,r)}function os(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Y0(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function as(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Ca(t){return typeof t=="string"?t:t==null?void 0:t.message}function Qr(t,e,n){var l,c,u,f,h,p;const r=t.message?t.message:Ca((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??Ca((f=e==null?void 0:e.error)==null?void 0:f.call(e,t))??Ca((h=n.customError)==null?void 0:h.call(n,t))??Ca((p=n.localeError)==null?void 0:p.call(n,t))??"Invalid input",{inst:i,continue:s,input:o,...a}=t;return a.path??(a.path=[]),a.message=r,e!=null&&e.reportInput&&(a.input=o),a}function qd(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function zo(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Rm=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Uu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Am=W("$ZodError",Rm),Om=W("$ZodError",Rm,{Parent:Error});function X0(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}function J0(t,e=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const a=[...s,...o.path];if(a.length===0)n._errors.push(e(o));else{let l=n,c=0;for(;c<a.length;){const u=a[c];c===a.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(e(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}}};return r(t),n}const Kd=t=>(e,n,r,i)=>{const s=r?{...r,async:!1}:{async:!1},o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new cs;if(o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Qr(l,s,Jr())));throw Pm(a,i==null?void 0:i.callee),a}return o.value},Yd=t=>async(e,n,r,i)=>{const s=r?{...r,async:!0}:{async:!0};let o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Qr(l,s,Jr())));throw Pm(a,i==null?void 0:i.callee),a}return o.value},Yl=t=>(e,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new cs;return s.issues.length?{success:!1,error:new(t??Am)(s.issues.map(o=>Qr(o,i,Jr())))}:{success:!0,data:s.value}},Q0=Yl(Om),Xl=t=>async(e,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=e._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>Qr(o,i,Jr())))}:{success:!0,data:s.value}},e1=Xl(Om),t1=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Kd(t)(e,n,i)},n1=t=>(e,n,r)=>Kd(t)(e,n,r),r1=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Yd(t)(e,n,i)},i1=t=>async(e,n,r)=>Yd(t)(e,n,r),s1=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Yl(t)(e,n,i)},o1=t=>(e,n,r)=>Yl(t)(e,n,r),a1=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Xl(t)(e,n,i)},l1=t=>async(e,n,r)=>Xl(t)(e,n,r),c1=/^[cC][0-9a-z]{6,}$/,u1=/^[0-9a-z]+$/,d1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,f1=/^[0-9a-vA-V]{20}$/,h1=/^[A-Za-z0-9]{27}$/,p1=/^[a-zA-Z0-9_-]{21}$/,g1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,m1=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gh=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,v1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,b1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _1(){return new RegExp(b1,"u")}const w1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,y1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,k1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,E1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,S1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mm=/^[A-Za-z0-9_-]*$/,T1=/^https?$/,x1=/^\+[1-9]\d{6,14}$/,Nm="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",P1=new RegExp(`^${Nm}$`);function Lm(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function C1(t){return new RegExp(`^${Lm(t)}$`)}function R1(t){const e=Lm({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${Nm}T(?:${r})$`)}const A1=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},O1=/^-?\d+$/,Im=/^-?\d+(?:\.\d+)?$/,M1=/^(?:true|false)$/i,N1=/^[^A-Z]*$/,L1=/^[^a-z]*$/,Gn=W("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),zm={number:"number",bigint:"bigint",object:"date"},Dm=W("$ZodCheckLessThan",(t,e)=>{Gn.init(t,e);const n=zm[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Hm=W("$ZodCheckGreaterThan",(t,e)=>{Gn.init(t,e);const n=zm[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),I1=W("$ZodCheckMultipleOf",(t,e)=>{Gn.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):D0(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),z1=W("$ZodCheckNumberFormat",(t,e)=>{var o;Gn.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[i,s]=j0[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=i,l.maximum=s,n&&(l.pattern=O1)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),D1=W("$ZodCheckMaxLength",(t,e)=>{var n;Gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Zd(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=qd(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),H1=W("$ZodCheckMinLength",(t,e)=>{var n;Gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Zd(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=qd(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),B1=W("$ZodCheckLengthEquals",(t,e)=>{var n;Gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Zd(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=qd(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),Jl=W("$ZodCheckStringFormat",(t,e)=>{var n,r;Gn.init(t,e),t._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),U1=W("$ZodCheckRegex",(t,e)=>{Jl.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),$1=W("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=N1),Jl.init(t,e)}),j1=W("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=L1),Jl.init(t,e)}),F1=W("$ZodCheckIncludes",(t,e)=>{Gn.init(t,e);const n=Os(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),G1=W("$ZodCheckStartsWith",(t,e)=>{Gn.init(t,e);const n=new RegExp(`^${Os(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),V1=W("$ZodCheckEndsWith",(t,e)=>{Gn.init(t,e);const n=new RegExp(`.*${Os(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),Z1=W("$ZodCheckOverwrite",(t,e)=>{Gn.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class W1{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
4
+ `).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,n=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...n,i.join(`
5
+ `))}}const q1={major:4,minor:4,patch:3},Dt=W("$ZodType",(t,e)=>{var i;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=q1;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const s of r)for(const o of s._zod.onattach)o(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,l,c)=>{let u=os(a),f;for(const h of l){if(h._zod.def.when){if(Y0(a)||!h._zod.def.when(a))continue}else if(u)continue;const p=a.issues.length,m=h._zod.check(a);if(m instanceof Promise&&(c==null?void 0:c.async)===!1)throw new cs;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(u||(u=os(a,p)))});else{if(a.issues.length===p)continue;u||(u=os(a,p))}}return f?f.then(()=>a):a},o=(a,l,c)=>{if(os(a))return a.aborted=!0,a;const u=s(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new cs;return u.then(f=>t._zod.parse(f,c))}return t._zod.parse(u,c)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(f=>o(f,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new cs;return c.then(u=>s(u,r,l))}return s(c,r,l)}}vt(t,"~standard",()=>({validate:s=>{var o;try{const a=Q0(t,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return e1(t,s).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Xd=W("$ZodString",(t,e)=>{var n;Dt.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??A1(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Mt=W("$ZodStringFormat",(t,e)=>{Jl.init(t,e),Xd.init(t,e)}),K1=W("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=m1),Mt.init(t,e)}),Y1=W("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=gh(r))}else e.pattern??(e.pattern=gh());Mt.init(t,e)}),X1=W("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=v1),Mt.init(t,e)}),J1=W("$ZodURL",(t,e)=>{Mt.init(t,e),t._zod.check=n=>{var r;try{const i=n.value.trim();if(!e.normalize&&((r=e.protocol)==null?void 0:r.source)===T1.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}const s=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=s.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),Q1=W("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=_1()),Mt.init(t,e)}),ek=W("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=p1),Mt.init(t,e)}),tk=W("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=c1),Mt.init(t,e)}),nk=W("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=u1),Mt.init(t,e)}),rk=W("$ZodULID",(t,e)=>{e.pattern??(e.pattern=d1),Mt.init(t,e)}),ik=W("$ZodXID",(t,e)=>{e.pattern??(e.pattern=f1),Mt.init(t,e)}),sk=W("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=h1),Mt.init(t,e)}),ok=W("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=R1(e)),Mt.init(t,e)}),ak=W("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=P1),Mt.init(t,e)}),lk=W("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=C1(e)),Mt.init(t,e)}),ck=W("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=g1),Mt.init(t,e)}),uk=W("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=w1),Mt.init(t,e),t._zod.bag.format="ipv4"}),dk=W("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=y1),Mt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),fk=W("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=k1),Mt.init(t,e)}),hk=W("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=E1),Mt.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Bm(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const pk=W("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=S1),Mt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Bm(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function gk(t){if(!Mm.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Bm(n)}const mk=W("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Mm),Mt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{gk(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),vk=W("$ZodE164",(t,e)=>{e.pattern??(e.pattern=x1),Mt.init(t,e)});function bk(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const _k=W("$ZodJWT",(t,e)=>{Mt.init(t,e),t._zod.check=n=>{bk(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Um=W("$ZodNumber",(t,e)=>{Dt.init(t,e),t._zod.pattern=t._zod.bag.pattern??Im,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),n}}),wk=W("$ZodNumberFormat",(t,e)=>{z1.init(t,e),Um.init(t,e)}),yk=W("$ZodBoolean",(t,e)=>{Dt.init(t,e),t._zod.pattern=M1,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),kk=W("$ZodUnknown",(t,e)=>{Dt.init(t,e),t._zod.parse=n=>n}),Ek=W("$ZodNever",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function mh(t,e,n){t.issues.length&&e.issues.push(...as(n,t.issues)),e.value[n]=t.value}const Sk=W("$ZodArray",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(c=>mh(c,n,o))):mh(l,n,o)}return s.length?Promise.all(s).then(()=>n):n}});function hl(t,e,n,r,i,s){const o=n in r;if(t.issues.length){if(i&&s&&!o)return;e.issues.push(...as(n,t.issues))}if(!o&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?o&&(e.value[n]=void 0):e.value[n]=t.value}function $m(t){var r,i,s,o;const e=Object.keys(t.shape);for(const a of e)if(!((o=(s=(i=(r=t.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=$0(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function jm(t,e,n,r,i,s){const o=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u=l.optin==="optional",f=l.optout==="optional";for(const h in e){if(h==="__proto__"||a.has(h))continue;if(c==="never"){o.push(h);continue}const p=l.run({value:e[h],issues:[]},r);p instanceof Promise?t.push(p.then(m=>hl(m,n,h,e,u,f))):hl(p,n,h,e,u,f)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const Tk=W("$ZodObject",(t,e)=>{Dt.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=Kl(()=>$m(e));vt(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const f of u.values)l[c].add(f)}}return l});const i=Io,s=e.catchall;let o;t._zod.parse=(a,l)=>{o??(o=r.value);const c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],f=o.shape;for(const h of o.keys){const p=f[h],m=p._zod.optin==="optional",g=p._zod.optout==="optional",b=p._zod.run({value:c[h],issues:[]},l);b instanceof Promise?u.push(b.then(_=>hl(_,a,h,c,m,g))):hl(b,a,h,c,m,g)}return s?jm(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),xk=W("$ZodObjectJIT",(t,e)=>{Tk.init(t,e);const n=t._zod.parse,r=Kl(()=>$m(e)),i=h=>{var O,N;const p=new W1(["shape","payload","ctx"]),m=r.value,g=S=>{const P=ph(S);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};p.write("const input = payload.value;");const b=Object.create(null);let _=0;for(const S of m.keys)b[S]=`key_${_++}`;p.write("const newResult = {};");for(const S of m.keys){const P=b[S],M=ph(S),z=h[S],B=((O=z==null?void 0:z._zod)==null?void 0:O.optin)==="optional",U=((N=z==null?void 0:z._zod)==null?void 0:N.optout)==="optional";p.write(`const ${P} = ${g(S)};`),B&&U?p.write(`
6
+ if (${P}.issues.length) {
7
+ if (${M} in input) {
8
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
9
+ ...iss,
10
+ path: iss.path ? [${M}, ...iss.path] : [${M}]
11
+ })));
12
+ }
13
+ }
14
+
15
+ if (${P}.value === undefined) {
16
+ if (${M} in input) {
17
+ newResult[${M}] = undefined;
18
+ }
19
+ } else {
20
+ newResult[${M}] = ${P}.value;
21
+ }
22
+
23
+ `):B?p.write(`
24
+ if (${P}.issues.length) {
25
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
26
+ ...iss,
27
+ path: iss.path ? [${M}, ...iss.path] : [${M}]
28
+ })));
29
+ }
30
+
31
+ if (${P}.value === undefined) {
32
+ if (${M} in input) {
33
+ newResult[${M}] = undefined;
34
+ }
35
+ } else {
36
+ newResult[${M}] = ${P}.value;
37
+ }
38
+
39
+ `):p.write(`
40
+ const ${P}_present = ${M} in input;
41
+ if (${P}.issues.length) {
42
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
43
+ ...iss,
44
+ path: iss.path ? [${M}, ...iss.path] : [${M}]
45
+ })));
46
+ }
47
+ if (!${P}_present && !${P}.issues.length) {
48
+ payload.issues.push({
49
+ code: "invalid_type",
50
+ expected: "nonoptional",
51
+ input: undefined,
52
+ path: [${M}]
53
+ });
54
+ }
55
+
56
+ if (${P}_present) {
57
+ if (${P}.value === undefined) {
58
+ newResult[${M}] = undefined;
59
+ } else {
60
+ newResult[${M}] = ${P}.value;
61
+ }
62
+ }
63
+
64
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");const y=p.compile();return(S,P)=>y(h,S,P)};let s;const o=Io,a=!Vd.jitless,c=a&&B0.value,u=e.catchall;let f;t._zod.parse=(h,p)=>{f??(f=r.value);const m=h.value;return o(m)?a&&c&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(s||(s=i(e.shape)),h=s(h,p),u?jm([],m,h,p,f,t):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),h)}});function vh(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const i=t.filter(s=>!os(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(o=>Qr(o,r,Jr())))}),e)}const Fm=W("$ZodUnion",(t,e)=>{Dt.init(t,e),vt(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),vt(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),vt(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),vt(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Wd(i.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const a of e.options){const l=a._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)o.push(l),s=!0;else{if(l.issues.length===0)return l;o.push(l)}}return s?Promise.all(o).then(a=>vh(a,r,t,i)):vh(o,r,t,i)}}),Pk=W("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Fm.init(t,e);const n=t._zod.parse;vt(t._zod,"propValues",()=>{const i={};for(const s of e.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[a,l]of Object.entries(o)){i[a]||(i[a]=new Set);for(const c of l)i[a].add(c)}}return i});const r=Kl(()=>{var o;const i=e.options,s=new Map;for(const a of i){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});t._zod.parse=(i,s)=>{const o=i.value;if(!Io(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(i,s):e.unionFallback||s.direction==="backward"?n(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:o,path:[e.discriminator],inst:t}),i)}}),Ck=W("$ZodIntersection",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,c])=>bh(n,l,c)):bh(n,s,o)}});function $u(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(As(t)&&As(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),i={...t,...e};for(const s of r){const o=$u(t[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=e[r],o=$u(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function bh(t,e,n){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&t.issues.push({...i,keys:s}),os(t))return t;const o=$u(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const Rk=W("$ZodRecord",(t,e)=>{Dt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!As(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const s=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(p=>Qr(p,r,Jr())),input:c,path:[c],inst:t});continue}const f=u.value,h=e.valueType._zod.run({value:i[c],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&n.issues.push(...as(c,p.issues)),n.value[f]=p.value})):(h.issues.length&&n.issues.push(...as(c,h.issues)),n.value[f]=h.value)}let l;for(const c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Im.test(a)&&l.issues.length){const f=e.keyType._zod.run({value:Number(a),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){e.mode==="loose"?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Qr(f,r,Jr())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:i[a],issues:[]},r);u instanceof Promise?s.push(u.then(f=>{f.issues.length&&n.issues.push(...as(a,f.issues)),n.value[l.value]=f.value})):(u.issues.length&&n.issues.push(...as(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Ak=W("$ZodEnum",(t,e)=>{Dt.init(t,e);const n=xm(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>U0.has(typeof i)).map(i=>typeof i=="string"?Os(i):i.toString()).join("|")})$`),t._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),Ok=W("$ZodLiteral",(t,e)=>{if(Dt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Os(r):r?Os(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),Mk=W("$ZodTransform",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Tm(t.constructor.name);const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n.fallback=!0,n));if(i instanceof Promise)throw new cs;return n.value=i,n.fallback=!0,n}});function _h(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const Gm=W("$ZodOptional",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",vt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),vt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Wd(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const i=n.value,s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>_h(o,i)):_h(s,i)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Nk=W("$ZodExactOptional",(t,e)=>{Gm.init(t,e),vt(t._zod,"values",()=>e.innerType._zod.values),vt(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Lk=W("$ZodNullable",(t,e)=>{Dt.init(t,e),vt(t._zod,"optin",()=>e.innerType._zod.optin),vt(t._zod,"optout",()=>e.innerType._zod.optout),vt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Wd(n.source)}|null)$`):void 0}),vt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Ik=W("$ZodDefault",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",vt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>wh(s,e)):wh(i,e)}});function wh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const zk=W("$ZodPrefault",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",vt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),Dk=W("$ZodNonOptional",(t,e)=>{Dt.init(t,e),vt(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>yh(s,t)):yh(i,t)}});function yh(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Hk=W("$ZodCatch",(t,e)=>{Dt.init(t,e),t._zod.optin="optional",vt(t._zod,"optout",()=>e.innerType._zod.optout),vt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(o=>Qr(o,r,Jr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(s=>Qr(s,r,Jr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Vm=W("$ZodPipe",(t,e)=>{Dt.init(t,e),vt(t._zod,"values",()=>e.in._zod.values),vt(t._zod,"optin",()=>e.in._zod.optin),vt(t._zod,"optout",()=>e.out._zod.optout),vt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(o=>Ra(o,e.in,r)):Ra(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Ra(s,e.out,r)):Ra(i,e.out,r)}});function Ra(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const Bk=W("$ZodPreprocess",(t,e)=>{Vm.init(t,e)}),Uk=W("$ZodReadonly",(t,e)=>{Dt.init(t,e),vt(t._zod,"propValues",()=>e.innerType._zod.propValues),vt(t._zod,"values",()=>e.innerType._zod.values),vt(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),vt(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(kh):kh(i)}});function kh(t){return t.value=Object.freeze(t.value),t}const $k=W("$ZodCustom",(t,e)=>{Gn.init(t,e),Dt.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Eh(s,n,r,t));Eh(i,n,r,t)}});function Eh(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(zo(i))}}var Sh;class jk{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Fk(){return new jk}(Sh=globalThis).__zod_globalRegistry??(Sh.__zod_globalRegistry=Fk());const po=globalThis.__zod_globalRegistry;function Gk(t,e){return new t({type:"string",...Ce(e)})}function Vk(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Ce(e)})}function Th(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Ce(e)})}function Zk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Ce(e)})}function Wk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ce(e)})}function qk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ce(e)})}function Kk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ce(e)})}function Yk(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ce(e)})}function Xk(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Ce(e)})}function Jk(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ce(e)})}function Qk(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Ce(e)})}function eE(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ce(e)})}function tE(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Ce(e)})}function nE(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Ce(e)})}function rE(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ce(e)})}function iE(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ce(e)})}function sE(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ce(e)})}function oE(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ce(e)})}function aE(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ce(e)})}function lE(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Ce(e)})}function cE(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Ce(e)})}function uE(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Ce(e)})}function dE(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Ce(e)})}function fE(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ce(e)})}function hE(t,e){return new t({type:"string",format:"date",check:"string_format",...Ce(e)})}function pE(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Ce(e)})}function gE(t,e){return new t({type:"string",format:"duration",check:"string_format",...Ce(e)})}function mE(t,e){return new t({type:"number",checks:[],...Ce(e)})}function vE(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Ce(e)})}function bE(t,e){return new t({type:"boolean",...Ce(e)})}function _E(t){return new t({type:"unknown"})}function wE(t,e){return new t({type:"never",...Ce(e)})}function xh(t,e){return new Dm({check:"less_than",...Ce(e),value:t,inclusive:!1})}function Mc(t,e){return new Dm({check:"less_than",...Ce(e),value:t,inclusive:!0})}function Ph(t,e){return new Hm({check:"greater_than",...Ce(e),value:t,inclusive:!1})}function Nc(t,e){return new Hm({check:"greater_than",...Ce(e),value:t,inclusive:!0})}function Ch(t,e){return new I1({check:"multiple_of",...Ce(e),value:t})}function Zm(t,e){return new D1({check:"max_length",...Ce(e),maximum:t})}function pl(t,e){return new H1({check:"min_length",...Ce(e),minimum:t})}function Wm(t,e){return new B1({check:"length_equals",...Ce(e),length:t})}function yE(t,e){return new U1({check:"string_format",format:"regex",...Ce(e),pattern:t})}function kE(t){return new $1({check:"string_format",format:"lowercase",...Ce(t)})}function EE(t){return new j1({check:"string_format",format:"uppercase",...Ce(t)})}function SE(t,e){return new F1({check:"string_format",format:"includes",...Ce(e),includes:t})}function TE(t,e){return new G1({check:"string_format",format:"starts_with",...Ce(e),prefix:t})}function xE(t,e){return new V1({check:"string_format",format:"ends_with",...Ce(e),suffix:t})}function Gs(t){return new Z1({check:"overwrite",tx:t})}function PE(t){return Gs(e=>e.normalize(t))}function CE(){return Gs(t=>t.trim())}function RE(){return Gs(t=>t.toLowerCase())}function AE(){return Gs(t=>t.toUpperCase())}function OE(){return Gs(t=>H0(t))}function ME(t,e,n){return new t({type:"array",element:e,...Ce(n)})}function NE(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Ce(n)})}function LE(t,e){const n=IE(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(zo(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(zo(s))}},t(r.value,r)),e);return n}function IE(t,e){const n=new Gn({check:"custom",...Ce(e)});return n._zod.check=t,n}function qm(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??po,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function qt(t,e,n={path:[],schemaPath:[]}){var u,f;var r;const i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(f=(u=t._zod).toJSONSchema)==null?void 0:f.call(u);if(a)o.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,h);else{const m=o.schema,g=e.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(t,e,m,h)}const p=t._zod.parent;p&&(o.ref||(o.ref=p),qt(p,e,h),e.seen.get(p).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&Cn(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Km(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const f=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(f){const h=r.get(f);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,u[0])}}const i=u=>{var g;const f=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const b=(g=t.external.registry.get(u[0]))==null?void 0:g.id,_=t.external.uri??(O=>O);if(b)return{ref:_(b)};const y=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=y,{defId:y,ref:`${_("__shared")}#/${f}/${y}`}}if(u[1]===n)return{ref:"#"};const p=`#/${f}/`,m=u[1].schema.id??`__schema${t.counter++}`;return{defId:m,ref:p+m}},s=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:h,defId:p}=i(u);f.def={...f.schema},p&&(f.defId=p);const m=f.schema;for(const g in m)delete m[g];m.$ref=h};if(t.cycles==="throw")for(const u of t.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${(a=f.cycle)==null?void 0:a.join("/")}/<root>
65
+
66
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const f=u[1];if(e===u[0]){s(u);continue}if(t.external){const p=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&p){s(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){s(u);continue}if(f.cycle){s(u);continue}if(f.count>1&&t.reused==="ref"){s(u);continue}}}function Ym(t,e){var a,l,c,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=f=>{const h=t.seen.get(f);if(h.ref===null)return;const p=h.def??h.schema,m={...p},g=h.ref;if(h.ref=null,g){r(g);const _=t.seen.get(g),y=_.schema;if(y.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(y)):Object.assign(p,y),Object.assign(p,m),f._zod.parent===g)for(const N in p)N==="$ref"||N==="allOf"||N in m||delete p[N];if(y.$ref&&_.def)for(const N in p)N==="$ref"||N==="allOf"||N in _.def&&JSON.stringify(p[N])===JSON.stringify(_.def[N])&&delete p[N]}const b=f._zod.parent;if(b&&b!==g){r(b);const _=t.seen.get(b);if(_!=null&&_.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const y in p)y==="$ref"||y==="allOf"||y in _.def&&JSON.stringify(p[y])===JSON.stringify(_.def[y])&&delete p[y]}t.override({zodSchema:f,jsonSchema:p,path:h.path??[]})};for(const f of[...t.seen.entries()].reverse())r(f[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const f=(l=t.external.registry.get(e))==null?void 0:l.id;if(!f)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(f)}Object.assign(i,n.def??n.schema);const s=(c=t.metadataRegistry.get(e))==null?void 0:c.id;s!==void 0&&i.id===s&&delete i.id;const o=((u=t.external)==null?void 0:u.defs)??{};for(const f of t.seen.entries()){const h=f[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,o[h.defId]=h.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const f=JSON.parse(JSON.stringify(i));return Object.defineProperty(f,"~standard",{value:{...e["~standard"],jsonSchema:{input:gl(e,"input",t.processors),output:gl(e,"output",t.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function Cn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Cn(r.element,n);if(r.type==="set")return Cn(r.valueType,n);if(r.type==="lazy")return Cn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Cn(r.innerType,n);if(r.type==="intersection")return Cn(r.left,n)||Cn(r.right,n);if(r.type==="record"||r.type==="map")return Cn(r.keyType,n)||Cn(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Cn(r.in,n)||Cn(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Cn(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Cn(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Cn(i,n))return!0;return!!(r.rest&&Cn(r.rest,n))}return!1}const zE=(t,e={})=>n=>{const r=qm({...n,processors:e});return qt(t,r),Km(r,t),Ym(r,t)},gl=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=qm({...i??{},target:s,io:e,processors:n});return qt(t,o),Km(o,t),Ym(o,t)},DE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},HE=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=DE[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},BE=(t,e,n,r)=>{const i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const f=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),h=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";f?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),h?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o=="number"&&(i.maximum=o),typeof l=="number"&&(i.multipleOf=l)},UE=(t,e,n,r)=>{n.type="boolean"},$E=(t,e,n,r)=>{n.not={}},jE=(t,e,n,r)=>{},FE=(t,e,n,r)=>{const i=t._zod.def,s=xm(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},GE=(t,e,n,r)=>{const i=t._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},VE=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ZE=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},WE=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=qt(s.element,e,{...r,path:[...r.path,"items"]})},qE=(t,e,n,r)=>{var c;const i=n,s=t._zod.def;i.type="object",i.properties={};const o=s.shape;for(const u in o)i.properties[u]=qt(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const f=s.shape[u]._zod;return e.io==="input"?f.optin===void 0:f.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=qt(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},KE=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>qt(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},YE=(t,e,n,r)=>{const i=t._zod.def,s=qt(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=qt(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},XE=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=qt(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const f of l)i.patternProperties[f.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=qt(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=qt(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(f=>typeof f=="string"||typeof f=="number");u.length>0&&(i.required=u)}},JE=(t,e,n,r)=>{const i=t._zod.def,s=qt(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},QE=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},eS=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},tS=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},nS=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},rS=(t,e,n,r)=>{const i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?i.out:i.in:i.out;qt(o,e,r);const a=e.seen.get(t);a.ref=o},iS=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},Xm=(t,e,n,r)=>{const i=t._zod.def;qt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},sS=W("ZodISODateTime",(t,e)=>{ok.init(t,e),Bt.init(t,e)});function oS(t){return fE(sS,t)}const aS=W("ZodISODate",(t,e)=>{ak.init(t,e),Bt.init(t,e)});function lS(t){return hE(aS,t)}const cS=W("ZodISOTime",(t,e)=>{lk.init(t,e),Bt.init(t,e)});function uS(t){return pE(cS,t)}const dS=W("ZodISODuration",(t,e)=>{ck.init(t,e),Bt.init(t,e)});function fS(t){return gE(dS,t)}const hS=(t,e)=>{Am.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>J0(t,n)},flatten:{value:n=>X0(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Uu,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Uu,2)}},isEmpty:{get(){return t.issues.length===0}}})},ur=W("ZodError",hS,{Parent:Error}),pS=Kd(ur),gS=Yd(ur),mS=Yl(ur),vS=Xl(ur),bS=t1(ur),_S=n1(ur),wS=r1(ur),yS=i1(ur),kS=s1(ur),ES=o1(ur),SS=a1(ur),TS=l1(ur),Rh=new WeakMap;function ha(t,e,n){const r=Object.getPrototypeOf(t);let i=Rh.get(r);if(i||(i=new Set,Rh.set(r,i)),!i.has(e)){i.add(e);for(const s in n){const o=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const Ht=W("ZodType",(t,e)=>(Dt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:gl(t,"input"),output:gl(t,"output")}}),t.toJSONSchema=zE(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>pS(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>mS(t,n,r),t.parseAsync=async(n,r)=>gS(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>vS(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>bS(t,n,r),t.decode=(n,r)=>_S(t,n,r),t.encodeAsync=async(n,r)=>wS(t,n,r),t.decodeAsync=async(n,r)=>yS(t,n,r),t.safeEncode=(n,r)=>kS(t,n,r),t.safeDecode=(n,r)=>ES(t,n,r),t.safeEncodeAsync=async(n,r)=>SS(t,n,r),t.safeDecodeAsync=async(n,r)=>TS(t,n,r),ha(t,"ZodType",{check(...n){const r=this.def;return this.clone(Ci(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Ri(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(mT(n,r))},superRefine(n,r){return this.check(vT(n,r))},overwrite(n){return this.check(Gs(n))},optional(){return Nh(this)},exactOptional(){return rT(this)},nullable(){return Lh(this)},nullish(){return Nh(Lh(this))},nonoptional(n){return cT(this,n)},array(){return zt(this)},or(n){return hi([this,n])},and(n){return QS(this,n)},transform(n){return Ih(this,tv(n))},default(n){return oT(this,n)},prefault(n){return lT(this,n)},catch(n){return dT(this,n)},pipe(n){return Ih(this,n)},readonly(){return pT(this)},describe(n){const r=this.clone();return po.add(r,{description:n}),r},meta(...n){if(n.length===0)return po.get(this);const r=this.clone();return po.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){var n;return(n=po.get(t))==null?void 0:n.description},configurable:!0}),t)),Jm=W("_ZodString",(t,e)=>{Xd.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(r,i,s)=>HE(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,ha(t,"_ZodString",{regex(...r){return this.check(yE(...r))},includes(...r){return this.check(SE(...r))},startsWith(...r){return this.check(TE(...r))},endsWith(...r){return this.check(xE(...r))},min(...r){return this.check(pl(...r))},max(...r){return this.check(Zm(...r))},length(...r){return this.check(Wm(...r))},nonempty(...r){return this.check(pl(1,...r))},lowercase(r){return this.check(kE(r))},uppercase(r){return this.check(EE(r))},trim(){return this.check(CE())},normalize(...r){return this.check(PE(...r))},toLowerCase(){return this.check(RE())},toUpperCase(){return this.check(AE())},slugify(){return this.check(OE())}})}),xS=W("ZodString",(t,e)=>{Xd.init(t,e),Jm.init(t,e),t.email=n=>t.check(Vk(PS,n)),t.url=n=>t.check(Yk(CS,n)),t.jwt=n=>t.check(dE(FS,n)),t.emoji=n=>t.check(Xk(RS,n)),t.guid=n=>t.check(Th(Ah,n)),t.uuid=n=>t.check(Zk(Aa,n)),t.uuidv4=n=>t.check(Wk(Aa,n)),t.uuidv6=n=>t.check(qk(Aa,n)),t.uuidv7=n=>t.check(Kk(Aa,n)),t.nanoid=n=>t.check(Jk(AS,n)),t.guid=n=>t.check(Th(Ah,n)),t.cuid=n=>t.check(Qk(OS,n)),t.cuid2=n=>t.check(eE(MS,n)),t.ulid=n=>t.check(tE(NS,n)),t.base64=n=>t.check(lE(US,n)),t.base64url=n=>t.check(cE($S,n)),t.xid=n=>t.check(nE(LS,n)),t.ksuid=n=>t.check(rE(IS,n)),t.ipv4=n=>t.check(iE(zS,n)),t.ipv6=n=>t.check(sE(DS,n)),t.cidrv4=n=>t.check(oE(HS,n)),t.cidrv6=n=>t.check(aE(BS,n)),t.e164=n=>t.check(uE(jS,n)),t.datetime=n=>t.check(oS(n)),t.date=n=>t.check(lS(n)),t.time=n=>t.check(uS(n)),t.duration=n=>t.check(fS(n))});function pe(t){return Gk(xS,t)}const Bt=W("ZodStringFormat",(t,e)=>{Mt.init(t,e),Jm.init(t,e)}),PS=W("ZodEmail",(t,e)=>{X1.init(t,e),Bt.init(t,e)}),Ah=W("ZodGUID",(t,e)=>{K1.init(t,e),Bt.init(t,e)}),Aa=W("ZodUUID",(t,e)=>{Y1.init(t,e),Bt.init(t,e)}),CS=W("ZodURL",(t,e)=>{J1.init(t,e),Bt.init(t,e)}),RS=W("ZodEmoji",(t,e)=>{Q1.init(t,e),Bt.init(t,e)}),AS=W("ZodNanoID",(t,e)=>{ek.init(t,e),Bt.init(t,e)}),OS=W("ZodCUID",(t,e)=>{tk.init(t,e),Bt.init(t,e)}),MS=W("ZodCUID2",(t,e)=>{nk.init(t,e),Bt.init(t,e)}),NS=W("ZodULID",(t,e)=>{rk.init(t,e),Bt.init(t,e)}),LS=W("ZodXID",(t,e)=>{ik.init(t,e),Bt.init(t,e)}),IS=W("ZodKSUID",(t,e)=>{sk.init(t,e),Bt.init(t,e)}),zS=W("ZodIPv4",(t,e)=>{uk.init(t,e),Bt.init(t,e)}),DS=W("ZodIPv6",(t,e)=>{dk.init(t,e),Bt.init(t,e)}),HS=W("ZodCIDRv4",(t,e)=>{fk.init(t,e),Bt.init(t,e)}),BS=W("ZodCIDRv6",(t,e)=>{hk.init(t,e),Bt.init(t,e)}),US=W("ZodBase64",(t,e)=>{pk.init(t,e),Bt.init(t,e)}),$S=W("ZodBase64URL",(t,e)=>{mk.init(t,e),Bt.init(t,e)}),jS=W("ZodE164",(t,e)=>{vk.init(t,e),Bt.init(t,e)}),FS=W("ZodJWT",(t,e)=>{_k.init(t,e),Bt.init(t,e)}),Qm=W("ZodNumber",(t,e)=>{Um.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(r,i,s)=>BE(t,r,i),ha(t,"ZodNumber",{gt(r,i){return this.check(Ph(r,i))},gte(r,i){return this.check(Nc(r,i))},min(r,i){return this.check(Nc(r,i))},lt(r,i){return this.check(xh(r,i))},lte(r,i){return this.check(Mc(r,i))},max(r,i){return this.check(Mc(r,i))},int(r){return this.check(Oh(r))},safe(r){return this.check(Oh(r))},positive(r){return this.check(Ph(0,r))},nonnegative(r){return this.check(Nc(0,r))},negative(r){return this.check(xh(0,r))},nonpositive(r){return this.check(Mc(0,r))},multipleOf(r,i){return this.check(Ch(r,i))},step(r,i){return this.check(Ch(r,i))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function pn(t){return mE(Qm,t)}const GS=W("ZodNumberFormat",(t,e)=>{wk.init(t,e),Qm.init(t,e)});function Oh(t){return vE(GS,t)}const VS=W("ZodBoolean",(t,e)=>{yk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>UE(t,n,r)});function vi(t){return bE(VS,t)}const ZS=W("ZodUnknown",(t,e)=>{kk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>jE()});function ju(){return _E(ZS)}const WS=W("ZodNever",(t,e)=>{Ek.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>$E(t,n,r)});function qS(t){return wE(WS,t)}const KS=W("ZodArray",(t,e)=>{Sk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>WE(t,n,r,i),t.element=e.element,ha(t,"ZodArray",{min(n,r){return this.check(pl(n,r))},nonempty(n){return this.check(pl(1,n))},max(n,r){return this.check(Zm(n,r))},length(n,r){return this.check(Wm(n,r))},unwrap(){return this.element}})});function zt(t,e){return ME(KS,t,e)}const YS=W("ZodObject",(t,e)=>{xk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>qE(t,n,r,i),vt(t,"shape",()=>e.shape),ha(t,"ZodObject",{keyof(){return Sn(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:ju()})},loose(){return this.clone({...this._zod.def,catchall:ju()})},strict(){return this.clone({...this._zod.def,catchall:qS()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return V0(this,n)},safeExtend(n){return Z0(this,n)},merge(n){return W0(this,n)},pick(n){return F0(this,n)},omit(n){return G0(this,n)},partial(...n){return q0(nv,this,n[0])},required(...n){return K0(rv,this,n[0])}})});function Xe(t,e){const n={type:"object",shape:t??{},...Ce(e)};return new YS(n)}const ev=W("ZodUnion",(t,e)=>{Fm.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>KE(t,n,r,i),t.options=e.options});function hi(t,e){return new ev({type:"union",options:t,...Ce(e)})}const XS=W("ZodDiscriminatedUnion",(t,e)=>{ev.init(t,e),Pk.init(t,e)});function Jd(t,e,n){return new XS({type:"union",options:e,discriminator:t,...Ce(n)})}const JS=W("ZodIntersection",(t,e)=>{Ck.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>YE(t,n,r,i)});function QS(t,e){return new JS({type:"intersection",left:t,right:e})}const Mh=W("ZodRecord",(t,e)=>{Rk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>XE(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function Vs(t,e,n){return!e||!e._zod?new Mh({type:"record",keyType:pe(),valueType:t,...Ce(e)}):new Mh({type:"record",keyType:t,valueType:e,...Ce(n)})}const Fu=W("ZodEnum",(t,e)=>{Ak.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(r,i,s)=>FE(t,r,i),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Fu({...e,checks:[],...Ce(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Fu({...e,checks:[],...Ce(i),entries:s})}});function Sn(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Fu({type:"enum",entries:n,...Ce(e)})}const eT=W("ZodLiteral",(t,e)=>{Ok.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>GE(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Zt(t,e){return new eT({type:"literal",values:Array.isArray(t)?t:[t],...Ce(e)})}const tT=W("ZodTransform",(t,e)=>{Mk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>ZE(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Tm(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(zo(s,n.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(zo(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function tv(t){return new tT({type:"transform",transform:t})}const nv=W("ZodOptional",(t,e)=>{Gm.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Xm(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Nh(t){return new nv({type:"optional",innerType:t})}const nT=W("ZodExactOptional",(t,e)=>{Nk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Xm(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function rT(t){return new nT({type:"optional",innerType:t})}const iT=W("ZodNullable",(t,e)=>{Lk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>JE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Lh(t){return new iT({type:"nullable",innerType:t})}const sT=W("ZodDefault",(t,e)=>{Ik.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>eS(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function oT(t,e){return new sT({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Cm(e)}})}const aT=W("ZodPrefault",(t,e)=>{zk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>tS(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function lT(t,e){return new aT({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Cm(e)}})}const rv=W("ZodNonOptional",(t,e)=>{Dk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>QE(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function cT(t,e){return new rv({type:"nonoptional",innerType:t,...Ce(e)})}const uT=W("ZodCatch",(t,e)=>{Hk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>nS(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function dT(t,e){return new uT({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const iv=W("ZodPipe",(t,e)=>{Vm.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>rS(t,n,r,i),t.in=e.in,t.out=e.out});function Ih(t,e){return new iv({type:"pipe",in:t,out:e})}const fT=W("ZodPreprocess",(t,e)=>{iv.init(t,e),Bk.init(t,e)}),hT=W("ZodReadonly",(t,e)=>{Uk.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>iS(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function pT(t){return new hT({type:"readonly",innerType:t})}const gT=W("ZodCustom",(t,e)=>{$k.init(t,e),Ht.init(t,e),t._zod.processJSONSchema=(n,r,i)=>VE(t,n)});function mT(t,e={}){return NE(gT,t,e)}function vT(t,e){return LE(t,e)}function bT(t,e){return new fT({type:"pipe",in:tv(t),out:e})}const _T=["/","/login","/packages","/packages/services","/settings"],wT=new Set(_T);function sv(t){return wT.has(t)}function ov(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function av(t,e,n,r){for(const[i,s]of Object.entries(t)){const o=n===""?i:`${n}.${i}`;if(typeof s=="string"){if(Object.hasOwn(r,o))throw new Error(`Plugin catalog ${e} contains duplicate key "${o}"`);r[o]=s}else if(ov(s))av(s,e,o,r);else throw new Error(`Plugin catalog ${e} key "${o}" must be a string or object`)}}function yT(t,e){if(!ov(t))throw new Error(`Plugin catalog ${e} must be a JSON object`);const n={};return av(t,e,"",n),Object.freeze(n)}const kT=pe().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/),De=pe().min(1),Qd=pn().int(),Oa=Qd.nonnegative(),zh=4*1024;Sn(["hook","log","internal"]);const ET=/^events:(\*|[a-z][a-z0-9]*(?:,[a-z][a-z0-9]*)*)$/,ST=pe().regex(ET),wt=(t,e,n)=>{const r=typeof e=="string"?Zt(e):e;return Xe({id:kT,ts:Qd,topic:Zt(t),source:r,payload:n}).strict()},tn=t=>Xe(t).strict(),Dh=hi([wt("wan.connected",hi([Zt("hook"),Zt("log")]),tn({interface:De,address:De,mask:De,gateway:De})),wt("wan.disconnected",hi([Zt("hook"),Zt("log")]),tn({interface:De})),wt("net.ip_changed",hi([Zt("hook"),Zt("log")]),Xe({address:De,mask:De,link:De,connected:vi()}).strict()),wt("net.dhcp_lease","log",tn({mac:De,ip:De,hostname:De,action:De})),wt("net.dns_changed","log",Xe({resolvers:zt(De)}).strict()),wt("wifi.client_join","log",tn({mac:De,band:De,ssid:De,iface:De})),wt("wifi.client_leave","log",tn({mac:De,band:De,ssid:De,iface:De})),wt("firewall.rebuilt","hook",tn({table_type:De,table:De})),wt("usb.attached","hook",tn({device:De,model:De,vendor:De,port:De})),wt("usb.detached","hook",tn({device:De,port:De})),wt("fs.mounted","hook",tn({fs_type:De,label:De,directory:De})),wt("fs.unmounted","hook",tn({label:De,directory:De})),wt("clock.synced","hook",Xe({offset_ms:Qd.optional()}).strict()),wt("schedule.fired","hook",Xe({name:De,action:De,elapsed:Oa}).strict()),wt("button.pressed","hook",tn({button:De,gesture:De})),wt("auth.login","log",Xe({user:De,ip:De,success:vi()}).strict()),wt("firmware.available","log",tn({version:De})),wt("plugin.installed","internal",tn({name:De,version:De})),wt("plugin.removed","internal",tn({name:De})),wt("plugin.approved","internal",tn({name:De,version:De})),wt("plugin.started","internal",tn({name:De})),wt("plugin.stopped","internal",Xe({name:De,reason:De}).strict()),wt("daemon.started","internal",Xe({version:De,uptime_ms:Oa}).strict()),wt("daemon.stopping","internal",tn({reason:De})),wt("daemon.updated","internal",tn({version:De})),wt("storage.low","internal",Xe({path:Zt("/opt"),available_bytes:Oa,threshold_bytes:Oa}).strict()),wt("telemetry.gathering_changed","internal",Xe({enabled:vi()}).strict())]).superRefine((t,e)=>{new TextEncoder().encode(JSON.stringify(t.payload)).length>zh&&e.addIssue({code:"custom",message:`payload exceeds ${zh} bytes`})});function Lc(t,e){const n=e&&e.cache?e.cache:OT,r=e&&e.serializer?e.serializer:RT;return(e&&e.strategy?e.strategy:PT)(t,{cache:n,serializer:r})}function TT(t){return t==null||typeof t=="number"||typeof t=="boolean"}function xT(t,e,n,r){const i=TT(r)?r:n(r);let s=e.get(i);return typeof s>"u"&&(s=t.call(this,r),e.set(i,s)),s}function lv(t,e,n){const r=Array.prototype.slice.call(arguments,3),i=n(r);let s=e.get(i);return typeof s>"u"&&(s=t.apply(this,r),e.set(i,s)),s}function cv(t,e,n,r,i){return n.bind(e,t,r,i)}function PT(t,e){const n=t.length===1?xT:lv;return cv(t,this,n,e.cache.create(),e.serializer)}function CT(t,e){return cv(t,this,lv,e.cache.create(),e.serializer)}const RT=function(){return JSON.stringify(arguments)};var AT=class{constructor(){this.cache=Object.create(null)}get(t){return this.cache[t]}set(t,e){this.cache[t]=e}};const OT={create:function(){return new AT}},Ic={variadic:CT},MT=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function NT(t){const e={};return t.replace(MT,n=>{const r=n.length;switch(n[0]){case"G":e.era=r===4?"long":r===5?"narrow":"short";break;case"y":e.year=r===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":e.month=["numeric","2-digit","short","long","narrow"][r-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":e.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":e.weekday=r===4?"long":r===5?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");e.weekday=["short","long","narrow","short"][r-3];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");e.weekday=["short","long","narrow","short"][r-3];break;case"a":e.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":e.hourCycle="h12",e.hour=["numeric","2-digit"][r-1];break;case"H":e.hourCycle="h23",e.hour=["numeric","2-digit"][r-1];break;case"K":e.hourCycle="h11",e.hour=["numeric","2-digit"][r-1];break;case"k":e.hourCycle="h24",e.hour=["numeric","2-digit"][r-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":e.minute=["numeric","2-digit"][r-1];break;case"s":e.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":e.timeZoneName=r<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),e}const LT=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function IT(t){if(t.length===0)throw new Error("Number skeleton cannot be empty");const e=t.split(LT).filter(r=>r.length>0),n=[];for(const r of e){let i=r.split("/");if(i.length===0)throw new Error("Invalid number skeleton");const[s,...o]=i;for(const a of o)if(a.length===0)throw new Error("Invalid number skeleton");n.push({stem:s,options:o})}return n}function zT(t){return t.replace(/^(.*?)-/,"")}const Hh=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,uv=/^(@+)?(\+|#+)?[rs]?$/g,DT=/(\*)(0+)|(#+)(0+)|(0+)/g,dv=/^(0+)$/;function Bh(t){const e={};return t[t.length-1]==="r"?e.roundingPriority="morePrecision":t[t.length-1]==="s"&&(e.roundingPriority="lessPrecision"),t.replace(uv,function(n,r,i){return typeof i!="string"?(e.minimumSignificantDigits=r.length,e.maximumSignificantDigits=r.length):i==="+"?e.minimumSignificantDigits=r.length:r[0]==="#"?e.maximumSignificantDigits=r.length:(e.minimumSignificantDigits=r.length,e.maximumSignificantDigits=r.length+(typeof i=="string"?i.length:0)),""}),e}function fv(t){switch(t){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function HT(t){let e;if(t[0]==="E"&&t[1]==="E"?(e={notation:"engineering"},t=t.slice(2)):t[0]==="E"&&(e={notation:"scientific"},t=t.slice(1)),e){const n=t.slice(0,2);if(n==="+!"?(e.signDisplay="always",t=t.slice(2)):n==="+?"&&(e.signDisplay="exceptZero",t=t.slice(2)),!dv.test(t))throw new Error("Malformed concise eng/scientific notation");e.minimumIntegerDigits=t.length}return e}function Uh(t){const e={},n=fv(t);return n||e}function BT(t){let e={};for(const n of t){switch(n.stem){case"percent":case"%":e.style="percent";continue;case"%x100":e.style="percent",e.scale=100;continue;case"currency":e.style="currency",e.currency=n.options[0];continue;case"group-off":case",_":e.useGrouping=!1;continue;case"precision-integer":case".":e.maximumFractionDigits=0;continue;case"measure-unit":case"unit":e.style="unit",e.unit=zT(n.options[0]);continue;case"compact-short":case"K":e.notation="compact",e.compactDisplay="short";continue;case"compact-long":case"KK":e.notation="compact",e.compactDisplay="long";continue;case"scientific":e={...e,notation:"scientific",...n.options.reduce((s,o)=>({...s,...Uh(o)}),{})};continue;case"engineering":e={...e,notation:"engineering",...n.options.reduce((s,o)=>({...s,...Uh(o)}),{})};continue;case"notation-simple":e.notation="standard";continue;case"unit-width-narrow":e.currencyDisplay="narrowSymbol",e.unitDisplay="narrow";continue;case"unit-width-short":e.currencyDisplay="code",e.unitDisplay="short";continue;case"unit-width-full-name":e.currencyDisplay="name",e.unitDisplay="long";continue;case"unit-width-iso-code":e.currencyDisplay="symbol";continue;case"scale":e.scale=parseFloat(n.options[0]);continue;case"rounding-mode-floor":e.roundingMode="floor";continue;case"rounding-mode-ceiling":e.roundingMode="ceil";continue;case"rounding-mode-down":e.roundingMode="trunc";continue;case"rounding-mode-up":e.roundingMode="expand";continue;case"rounding-mode-half-even":e.roundingMode="halfEven";continue;case"rounding-mode-half-down":e.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":e.roundingMode="halfExpand";continue;case"integer-width":if(n.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");n.options[0].replace(DT,function(s,o,a,l,c,u){if(o)e.minimumIntegerDigits=a.length;else{if(l&&c)throw new Error("We currently do not support maximum integer digits");if(u)throw new Error("We currently do not support exact integer digits")}return""});continue}if(dv.test(n.stem)){e.minimumIntegerDigits=n.stem.length;continue}if(Hh.test(n.stem)){if(n.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");n.stem.replace(Hh,function(o,a,l,c,u,f){return l==="*"?e.minimumFractionDigits=a.length:c&&c[0]==="#"?e.maximumFractionDigits=c.length:u&&f?(e.minimumFractionDigits=u.length,e.maximumFractionDigits=u.length+f.length):(e.minimumFractionDigits=a.length,e.maximumFractionDigits=a.length),""});const s=n.options[0];s==="w"?e={...e,trailingZeroDisplay:"stripIfInteger"}:s&&(e={...e,...Bh(s)});continue}if(uv.test(n.stem)){e={...e,...Bh(n.stem)};continue}const r=fv(n.stem);r&&(e={...e,...r});const i=HT(n.stem);i&&(e={...e,...i})}return e}let UT=(function(t){return t[t.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",t[t.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",t[t.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",t[t.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",t[t.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",t[t.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",t[t.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",t[t.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",t[t.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",t[t.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",t[t.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",t[t.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",t[t.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",t[t.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",t[t.INVALID_TAG=23]="INVALID_TAG",t[t.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",t[t.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",t[t.UNCLOSED_TAG=27]="UNCLOSED_TAG",t})({});function $h(t){return t.type===0}function $T(t){return t.type===1}function hv(t){return t.type===2}function pv(t){return t.type===3}function gv(t){return t.type===4}function mv(t){return t.type===5}function vv(t){return t.type===6}function jT(t){return t.type===7}function bv(t){return t.type===8}function _v(t){return!!(t&&typeof t=="object"&&t.type===0)}function Gu(t){return!!(t&&typeof t=="object"&&t.type===1)}const wv=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Ma={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GS:["H","h","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ku-SY":["H","hB"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function FT(t,e){let n="";for(let r=0;r<t.length;r++){const i=t.charAt(r);if(i==="j"){let s=0;for(;r+1<t.length&&t.charAt(r+1)===i;)s++,r++;let o=1+(s&1),a=s<2?1:3+(s>>1),l="a",c=GT(e);for((c=="H"||c=="k")&&(a=0);a-- >0;)n+=l;for(;o-- >0;)n=c+n}else i==="J"?n+="H":n+=i}return n}function GT(t){let e=t.hourCycle;if(e===void 0&&t.hourCycles&&t.hourCycles.length&&(e=t.hourCycles[0]),e)switch(e){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}const n=t.language;let r;return n!=="root"&&(r=t.maximize().region),(Ma[r||""]||Ma[n||""]||Ma[`${n}-001`]||Ma["001"])[0]}const VT=new RegExp(`^${wv.source}*`),ZT=new RegExp(`${wv.source}*$`);function ot(t,e){return{start:t,end:e}}const WT=!!Object.fromEntries,qT=!!String.prototype.trimStart,KT=!!String.prototype.trimEnd,jh=WT?Object.fromEntries:function(e){const n={};for(const[r,i]of e)n[r]=i;return n},YT=qT?function(e){return e.trimStart()}:function(e){return e.replace(VT,"")},XT=KT?function(e){return e.trimEnd()}:function(e){return e.replace(ZT,"")},Fh=new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");function JT(t,e){return Fh.lastIndex=e,Fh.exec(t)[1]??""}function QT(t){if(t.length===0)return null;let e=1,n=1;for(let r=0;r<t.length;){const i=t.charCodeAt(r);switch(i){case 35:case 39:case 60:case 123:case 125:return null}if(i===10)e++,n=1,r++;else if(n++,i>=55296&&i<=56319&&r+1<t.length){const s=t.charCodeAt(r+1);r+=s>=56320&&s<=57343?2:1}else r++}return{offset:t.length,line:e,column:n}}var ex=class{constructor(t,e={}){this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!e.ignoreTag,this.locale=e.locale,this.requiresOtherClause=!!e.requiresOtherClause,this.shouldParseSkeletons=!!e.shouldParseSkeletons}parse(){if(this.offset()!==0)throw Error("parser can only be used once");if(this.message.length>0){const t=this.message.charCodeAt(0);if(t!==35&&t!==39&&t!==60&&t!==123&&t!==125){const e=QT(this.message);if(e){const n=this.clonePosition();return this.position=e,{val:[{type:0,value:this.message,location:ot(n,this.clonePosition())}],err:null}}}}return this.parseMessage(0,"",!1)}parseMessage(t,e,n){let r=[];for(;!this.isEOF();){const i=this.char();if(i===123){const s=this.parseArgument(t,n);if(s.err)return s;r.push(s.val)}else{if(i===125&&t>0)break;if(i===35&&(e==="plural"||e==="selectordinal")){const s=this.clonePosition();this.bump(),r.push({type:7,location:ot(s,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,ot(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&Vu(this.peek()||0)){const s=this.parseTag(t,e);if(s.err)return s;r.push(s.val)}else{const s=this.parseLiteral(t,e);if(s.err)return s;r.push(s.val)}}}return{val:r,err:null}}parseTag(t,e){const n=this.clonePosition();this.bump();const r=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:0,value:`<${r}/>`,location:ot(n,this.clonePosition())},err:null};if(this.bumpIf(">")){const i=this.parseMessage(t+1,e,!0);if(i.err)return i;const s=i.val,o=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!Vu(this.char()))return this.error(23,ot(o,this.clonePosition()));const a=this.clonePosition();return r!==this.parseTagName()?this.error(26,ot(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:8,value:r,children:s,location:ot(n,this.clonePosition())},err:null}:this.error(23,ot(o,this.clonePosition())))}else return this.error(27,ot(n,this.clonePosition()))}else return this.error(23,ot(n,this.clonePosition()))}parseTagName(){const t=this.offset();for(this.bump();!this.isEOF()&&nx(this.char());)this.bump();return this.message.slice(t,this.offset())}parseLiteral(t,e){const n=this.clonePosition();let r="";for(;;){const s=this.tryParseQuote(e);if(s){r+=s;continue}const o=this.tryParseUnquoted(t,e);if(o){r+=o;continue}const a=this.tryParseLeftAngleBracket();if(a){r+=a;continue}break}const i=ot(n,this.clonePosition());return{val:{type:0,value:r,location:i},err:null}}tryParseLeftAngleBracket(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!tx(this.peek()||0))?(this.bump(),"<"):null}tryParseQuote(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();const e=[this.char()];for(this.bump();!this.isEOF();){const n=this.char();if(n===39)if(this.peek()===39)e.push(39),this.bump();else{this.bump();break}else e.push(n);this.bump()}return String.fromCodePoint(...e)}tryParseUnquoted(t,e){if(this.isEOF())return null;const n=this.char();return n===60||n===123||n===35&&(e==="plural"||e==="selectordinal")||n===125&&t>0?null:(this.bump(),String.fromCodePoint(n))}parseArgument(t,e){const n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(1,ot(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,ot(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,ot(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,ot(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:ot(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,ot(n,this.clonePosition())):this.parseArgumentOptions(t,e,r,n);default:return this.error(3,ot(n,this.clonePosition()))}}parseIdentifierIfPossible(){const t=this.clonePosition(),e=this.offset(),n=JT(this.message,e),r=e+n.length;return this.bumpTo(r),{value:n,location:ot(t,this.clonePosition())}}parseArgumentOptions(t,e,n,r){let i=this.clonePosition(),s=this.parseIdentifierIfPossible().value,o=this.clonePosition();switch(s){case"":return this.error(4,ot(i,o));case"number":case"date":case"time":{this.bumpSpace();let a=null;if(this.bumpIf(",")){this.bumpSpace();const u=this.clonePosition(),f=this.parseSimpleArgStyleIfPossible();if(f.err)return f;const h=XT(f.val);if(h.length===0)return this.error(6,ot(this.clonePosition(),this.clonePosition()));a={style:h,styleLocation:ot(u,this.clonePosition())}}const l=this.tryParseArgumentClose(r);if(l.err)return l;const c=ot(r,this.clonePosition());if(a&&a.style.startsWith("::")){let u=YT(a.style.slice(2));if(s==="number"){const f=this.parseNumberSkeletonFromString(u,a.styleLocation);return f.err?f:{val:{type:2,value:n,location:c,style:f.val},err:null}}else{if(u.length===0)return this.error(10,c);let f=u;this.locale&&(f=FT(u,this.locale));const h={type:1,pattern:f,location:a.styleLocation,parsedOptions:this.shouldParseSkeletons?NT(f):{}};return{val:{type:s==="date"?3:4,value:n,location:c,style:h},err:null}}}return{val:{type:s==="number"?2:s==="date"?3:4,value:n,location:c,style:(a==null?void 0:a.style)??null},err:null}}case"plural":case"selectordinal":case"select":{const a=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(12,ot(a,{...a}));this.bumpSpace();let l=this.parseIdentifierIfPossible(),c=0;if(s!=="select"&&l.value==="offset"){if(!this.bumpIf(":"))return this.error(13,ot(this.clonePosition(),this.clonePosition()));this.bumpSpace();const p=this.tryParseDecimalInteger(13,14);if(p.err)return p;this.bumpSpace(),l=this.parseIdentifierIfPossible(),c=p.val}const u=this.tryParsePluralOrSelectOptions(t,s,e,l);if(u.err)return u;const f=this.tryParseArgumentClose(r);if(f.err)return f;const h=ot(r,this.clonePosition());return s==="select"?{val:{type:5,value:n,options:jh(u.val),location:h},err:null}:{val:{type:6,value:n,options:jh(u.val),offset:c,pluralType:s==="plural"?"cardinal":"ordinal",location:h},err:null}}default:return this.error(5,ot(i,o))}}tryParseArgumentClose(t){return this.isEOF()||this.char()!==125?this.error(1,ot(t,this.clonePosition())):(this.bump(),{val:!0,err:null})}parseSimpleArgStyleIfPossible(){let t=0;const e=this.clonePosition();for(;!this.isEOF();)switch(this.char()){case 39:{this.bump();let n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(11,ot(n,this.clonePosition()));this.bump();break}case 123:t+=1,this.bump();break;case 125:if(t>0)t-=1;else return{val:this.message.slice(e.offset,this.offset()),err:null};break;default:this.bump();break}return{val:this.message.slice(e.offset,this.offset()),err:null}}parseNumberSkeletonFromString(t,e){let n=[];try{n=IT(t)}catch{return this.error(7,e)}return{val:{type:0,tokens:n,location:e,parsedOptions:this.shouldParseSkeletons?BT(n):{}},err:null}}tryParsePluralOrSelectOptions(t,e,n,r){let i=!1;const s=[],o=new Set;let{value:a,location:l}=r;for(;;){if(a.length===0){const h=this.clonePosition();if(e!=="select"&&this.bumpIf("=")){const p=this.tryParseDecimalInteger(16,19);if(p.err)return p;l=ot(h,this.clonePosition()),a=this.message.slice(h.offset,this.offset())}else break}if(o.has(a))return this.error(e==="select"?21:20,l);a==="other"&&(i=!0),this.bumpSpace();const c=this.clonePosition();if(!this.bumpIf("{"))return this.error(e==="select"?17:18,ot(this.clonePosition(),this.clonePosition()));const u=this.parseMessage(t+1,e,n);if(u.err)return u;const f=this.tryParseArgumentClose(c);if(f.err)return f;s.push([a,{value:u.val,location:ot(c,this.clonePosition())}]),o.add(a),this.bumpSpace(),{value:a,location:l}=this.parseIdentifierIfPossible()}return s.length===0?this.error(e==="select"?15:16,ot(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,ot(this.clonePosition(),this.clonePosition())):{val:s,err:null}}tryParseDecimalInteger(t,e){let n=1;const r=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);let i=!1,s=0;for(;!this.isEOF();){const a=this.char();if(a>=48&&a<=57)i=!0,s=s*10+(a-48),this.bump();else break}const o=ot(r,this.clonePosition());return i?(s*=n,Number.isSafeInteger(s)?{val:s,err:null}:this.error(e,o)):this.error(t,o)}offset(){return this.position.offset}isEOF(){return this.offset()===this.message.length}clonePosition(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}}char(){const t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");const e=this.message.codePointAt(t);if(e===void 0)throw Error(`Offset ${t} is at invalid UTF-16 code unit boundary`);return e}error(t,e){return{val:null,err:{kind:t,message:this.message,location:e}}}bump(){if(this.isEOF())return;const t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}bumpIf(t){if(this.message.startsWith(t,this.offset())){for(let e=0;e<t.length;e++)this.bump();return!0}return!1}bumpUntil(t){const e=this.offset(),n=this.message.indexOf(t,e);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)}bumpTo(t){if(this.offset()>t)throw Error(`targetOffset ${t} must be greater than or equal to the current offset ${this.offset()}`);for(t=Math.min(t,this.message.length);;){const e=this.offset();if(e===t)break;if(e>t)throw Error(`targetOffset ${t} is at invalid UTF-16 code unit boundary`);if(this.bump(),this.isEOF())break}}bumpSpace(){for(;!this.isEOF()&&rx(this.char());)this.bump()}peek(){if(this.isEOF())return null;const t=this.char(),e=this.offset();return this.message.charCodeAt(e+(t>=65536?2:1))??null}};function Vu(t){return t>=97&&t<=122||t>=65&&t<=90}function tx(t){return Vu(t)||t===47}function nx(t){return t===45||t===46||t>=48&&t<=57||t===95||t>=97&&t<=122||t>=65&&t<=90||t==183||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8255&&t<=8256||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}function rx(t){return t>=9&&t<=13||t===32||t===133||t>=8206&&t<=8207||t===8232||t===8233}function Zu(t){t.forEach(e=>{if(delete e.location,mv(e)||vv(e))for(const n in e.options)delete e.options[n].location,Zu(e.options[n].value);else hv(e)&&_v(e.style)||(pv(e)||gv(e))&&Gu(e.style)?delete e.style.location:bv(e)&&Zu(e.children)})}function ix(t,e={}){e={shouldParseSkeletons:!0,requiresOtherClause:!0,...e};const n=new ex(t,e).parse();if(n.err){const r=SyntaxError(UT[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return e!=null&&e.captureLocation||Zu(n.val),n.val}var Ql=class extends Error{constructor(t,e,n){super(t),this.code=e,this.originalMessage=n}toString(){return`[formatjs Error: ${this.code}] ${this.message}`}},Gh=class extends Ql{constructor(t,e,n,r){super(`Invalid values for "${t}": "${e}". Options are "${Object.keys(n).join('", "')}"`,"INVALID_VALUE",r)}},sx=class extends Ql{constructor(t,e,n){super(`Value for "${t}" must be of type ${e}`,"INVALID_VALUE",n)}},ox=class extends Ql{constructor(t,e){super(`The intl string context variable "${t}" was not provided to the string "${e}"`,"MISSING_VALUE",e)}};function ax(t){return t.length<2?t:t.reduce((e,n)=>{const r=e[e.length-1];return!r||r.type!==0||n.type!==0?e.push(n):r.value+=n.value,e},[])}function lx(t){return typeof t=="function"}function Ja(t,e,n,r,i,s,o){if(t.length===1&&$h(t[0]))return[{type:0,value:t[0].value}];const a=[];for(const l of t){if($h(l)){a.push({type:0,value:l.value});continue}if(jT(l)){typeof s=="number"&&a.push({type:0,value:n.getNumberFormat(e).format(s)});continue}const{value:c}=l;if(!(i&&c in i))throw new ox(c,o);let u=i[c];if($T(l)){(!u||typeof u=="string"||typeof u=="number"||typeof u=="bigint")&&(u=typeof u=="string"||typeof u=="number"||typeof u=="bigint"?String(u):""),a.push({type:typeof u=="string"?0:1,value:u});continue}if(pv(l)){const f=typeof l.style=="string"?r.date[l.style]:Gu(l.style)?l.style.parsedOptions:void 0;a.push({type:0,value:n.getDateTimeFormat(e,f).format(u)});continue}if(gv(l)){const f=typeof l.style=="string"?r.time[l.style]:Gu(l.style)?l.style.parsedOptions:r.time.medium;a.push({type:0,value:n.getDateTimeFormat(e,f).format(u)});continue}if(hv(l)){const f=typeof l.style=="string"?r.number[l.style]:_v(l.style)?l.style.parsedOptions:void 0;if(f&&f.scale){const h=f.scale||1;if(typeof u=="bigint"){if(!Number.isInteger(h))throw new TypeError(`Cannot apply fractional scale ${h} to bigint value. Scale must be an integer when formatting bigint.`);u=u*BigInt(h)}else u=u*h}a.push({type:0,value:n.getNumberFormat(e,f).format(u)});continue}if(bv(l)){const{children:f,value:h}=l,p=i[h];if(!lx(p))throw new sx(h,"function",o);let m=p(Ja(f,e,n,r,i,s).map(g=>g.value));Array.isArray(m)||(m=[m]),a.push(...m.map(g=>({type:typeof g=="string"?0:1,value:g})))}if(mv(l)){const f=u,h=(Object.prototype.hasOwnProperty.call(l.options,f)?l.options[f]:void 0)||l.options.other;if(!h)throw new Gh(l.value,u,Object.keys(l.options),o);a.push(...Ja(h.value,e,n,r,i));continue}if(vv(l)){const f=`=${u}`;let h=Object.prototype.hasOwnProperty.call(l.options,f)?l.options[f]:void 0;if(!h){if(!Intl.PluralRules)throw new Ql(`Intl.PluralRules is not available in this environment.
67
+ Try polyfilling it using "@formatjs/intl-pluralrules"
68
+ `,"MISSING_INTL_API",o);const m=typeof u=="bigint"?Number(u):u,g=n.getPluralRules(e,{type:l.pluralType}).select(m-(l.offset||0));h=(Object.prototype.hasOwnProperty.call(l.options,g)?l.options[g]:void 0)||l.options.other}if(!h)throw new Gh(l.value,u,Object.keys(l.options),o);const p=typeof u=="bigint"?Number(u):u;a.push(...Ja(h.value,e,n,r,i,p-(l.offset||0)));continue}}return ax(a)}function cx(t,e){return e?{...t,...e,...Object.keys(t).reduce((n,r)=>(n[r]={...t[r],...e[r]},n),{})}:t}function ux(t,e){return e?Object.keys(t).reduce((n,r)=>(n[r]=cx(t[r],e[r]),n),{...t}):t}function zc(t){return{create(){return{get(e){return t[e]},set(e,n){t[e]=n}}}}}function dx(t={number:{},dateTime:{},pluralRules:{}}){return{getNumberFormat:Lc((...e)=>new Intl.NumberFormat(...e),{cache:zc(t.number),strategy:Ic.variadic}),getDateTimeFormat:Lc((...e)=>new Intl.DateTimeFormat(...e),{cache:zc(t.dateTime),strategy:Ic.variadic}),getPluralRules:Lc((...e)=>new Intl.PluralRules(...e),{cache:zc(t.pluralRules),strategy:Ic.variadic})}}var dn,fx=(dn=class{constructor(e,n=dn.defaultLocale,r,i){if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=s=>{const o=this.formatToParts(s);if(o.length===1)return o[0].value;const a=o.reduce((l,c)=>(!l.length||c.type!==0||typeof l[l.length-1]!="string"?l.push(c.value):l[l.length-1]+=c.value,l),[]);return a.length<=1?a[0]||"":a},this.formatToParts=s=>Ja(this.ast,this.locales,this.formatters,this.formats,s,void 0,this.message),this.resolvedOptions=()=>{var s;return{locale:((s=this.resolvedLocale)==null?void 0:s.toString())||Intl.NumberFormat.supportedLocalesOf(this.locales)[0]}},this.getAst=()=>this.ast,this.locales=n,this.resolvedLocale=dn.resolveLocale(n),typeof e=="string"){if(this.message=e,!dn.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");const{...s}=i||{};this.ast=dn.__parse(e,{...s,locale:this.resolvedLocale})}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=ux(dn.formats,r),this.formatters=i&&i.formatters||dx(this.formatterCache)}static get defaultLocale(){return dn.memoizedDefaultLocale||(dn.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),dn.memoizedDefaultLocale}},dn.memoizedDefaultLocale=null,dn.resolveLocale=e=>{if(typeof Intl.Locale>"u")return;const n=Intl.NumberFormat.supportedLocalesOf(e);return n.length>0?new Intl.Locale(n[0]):new Intl.Locale(typeof e=="string"?e:e[0])},dn.__parse=ix,dn.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},dn),hx=fx;function Do(t){return t==="en-XA"?"en":t}function ef(t,e,n){if(e===void 0)return t;try{const r=new hx(t,Do(n)).format(e);return typeof r=="string"?r:String(r)}catch{return t}}const tf=["persistent-rci-session:read","persistent-rci-session:write"],yv=Sn(tf),kv=hi([yv,ST]),px=t=>tf.includes(t);function gx(t){const e=t.replace("#",""),n=e.length===3?e.split("").map(r=>r+r).join(""):e;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}function Dc(t){const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Vh(t){const[e,n,r]=gx(t);return .2126*Dc(e)+.7152*Dc(n)+.0722*Dc(r)}function Co(t,e){const n=Vh(t),r=Vh(e),i=Math.max(n,r),s=Math.min(n,r);return(i+.05)/(s+.05)}const nf=[{token:"bg",cssVar:"--mndw-bg"},{token:"surface",cssVar:"--mndw-surface"},{token:"surfaceRaised",cssVar:"--mndw-surface-raised"},{token:"border",cssVar:"--mndw-border"},{token:"textSubtle",cssVar:"--mndw-text-subtle"},{token:"textMuted",cssVar:"--mndw-text-muted"},{token:"text",cssVar:"--mndw-text"},{token:"accent",cssVar:"--mndw-accent"},{token:"accentHover",cssVar:"--mndw-accent-hover"},{token:"accentContrast",cssVar:"--mndw-accent-contrast"},{token:"danger",cssVar:"--mndw-danger"},{token:"dangerBg",cssVar:"--mndw-danger-bg"},{token:"success",cssVar:"--mndw-success"},{token:"successBg",cssVar:"--mndw-success-bg"},{token:"warning",cssVar:"--mndw-warning"},{token:"warningBg",cssVar:"--mndw-warning-bg"},{token:"info",cssVar:"--mndw-info"},{token:"infoBg",cssVar:"--mndw-info-bg"},{token:"focusRing",cssVar:"--mndw-focus-ring"},{token:"surfaceHover",cssVar:"--mndw-surface-hover"},{token:"controlHover",cssVar:"--mndw-control-hover"},{token:"shadowColor",cssVar:"--mndw-shadow-color"}],mx=[{fg:"text",bg:"surface",min:4.5},{fg:"text",bg:"bg",min:4.5},{fg:"textMuted",bg:"surface",min:4.5},{fg:"textSubtle",bg:"surface",min:4.5},{fg:"border",bg:"surface",min:3},{fg:"accentContrast",bg:"accent",min:4.5},{fg:"danger",bg:"dangerBg",min:4.5},{fg:"text",bg:"surfaceRaised",min:4.5},{fg:"text",bg:"surfaceHover",min:4.5},{fg:"text",bg:"controlHover",min:4.5},{fg:"textSubtle",bg:"surfaceRaised",min:4.5},{fg:"textMuted",bg:"surfaceRaised",min:4.5},{fg:"border",bg:"surfaceRaised",min:3},{fg:"focusRing",bg:"surfaceRaised",min:3},{fg:"success",bg:"successBg",min:4.5},{fg:"warning",bg:"warningBg",min:4.5},{fg:"info",bg:"infoBg",min:4.5}];function vx(t,e={}){const n=e.selector??":root",r=i=>nf.map(s=>` ${s.cssVar}: ${t[i][s.token]};`).join(`
69
+ `);return`${n},
70
+ ${n}[data-theme='dark'] {
71
+ ${r("dark")}
72
+ }
73
+
74
+ ${n}[data-theme='light'] {
75
+ ${r("light")}
76
+ }
77
+ `}const Ev=(t,e)=>{if(typeof t=="number"){if(e===3)return{mode:"rgb",r:(t>>8&15|t>>4&240)/255,g:(t>>4&15|t&240)/255,b:(t&15|t<<4&240)/255};if(e===4)return{mode:"rgb",r:(t>>12&15|t>>8&240)/255,g:(t>>8&15|t>>4&240)/255,b:(t>>4&15|t&240)/255,alpha:(t&15|t<<4&240)/255};if(e===6)return{mode:"rgb",r:(t>>16&255)/255,g:(t>>8&255)/255,b:(t&255)/255};if(e===8)return{mode:"rgb",r:(t>>24&255)/255,g:(t>>16&255)/255,b:(t>>8&255)/255,alpha:(t&255)/255}}},bx={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_x=t=>Ev(bx[t.toLowerCase()],6),wx=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,yx=t=>{let e;return(e=t.match(wx))?Ev(parseInt(e[1],16),e[1].length):void 0},bi="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Ro=`${bi}%`,rf=`(?:${bi}%|${bi})`,kx=`(?:${bi}(deg|grad|rad|turn)|${bi})`,Ms="\\s*,\\s*",Ex=new RegExp(`^rgba?\\(\\s*${bi}${Ms}${bi}${Ms}${bi}\\s*(?:,\\s*${rf}\\s*)?\\)$`),Sx=new RegExp(`^rgba?\\(\\s*${Ro}${Ms}${Ro}${Ms}${Ro}\\s*(?:,\\s*${rf}\\s*)?\\)$`),Tx=t=>{let e={mode:"rgb"},n;if(n=t.match(Ex))n[1]!==void 0&&(e.r=n[1]/255),n[2]!==void 0&&(e.g=n[2]/255),n[3]!==void 0&&(e.b=n[3]/255);else if(n=t.match(Sx))n[1]!==void 0&&(e.r=n[1]/100),n[2]!==void 0&&(e.g=n[2]/100),n[3]!==void 0&&(e.b=n[3]/100);else return;return n[4]!==void 0?e.alpha=Math.max(0,Math.min(1,n[4]/100)):n[5]!==void 0&&(e.alpha=Math.max(0,Math.min(1,+n[5]))),e},ml=(t,e)=>t===void 0?void 0:typeof t!="object"?Lx(t):t.mode!==void 0?t:e?{...t,mode:e}:void 0,Ti=(t="rgb")=>e=>(e=ml(e,t))!==void 0?e.mode===t?e:Mr[e.mode][t]?Mr[e.mode][t](e):t==="rgb"?Mr[e.mode].rgb(e):Mr.rgb[t](Mr[e.mode].rgb(e)):void 0,Mr={},Sv={},vl=[],Tv={},xx=t=>t,ht=t=>(Mr[t.mode]={...Mr[t.mode],...t.toMode},Object.keys(t.fromMode||{}).forEach(e=>{Mr[e]||(Mr[e]={}),Mr[e][t.mode]=t.fromMode[e]}),t.ranges||(t.ranges={}),t.difference||(t.difference={}),t.channels.forEach(e=>{if(t.ranges[e]===void 0&&(t.ranges[e]=[0,1]),!t.interpolate[e])throw new Error(`Missing interpolator for: ${e}`);typeof t.interpolate[e]=="function"&&(t.interpolate[e]={use:t.interpolate[e]}),t.interpolate[e].fixup||(t.interpolate[e].fixup=xx)}),Sv[t.mode]=t,(t.parse||[]).forEach(e=>{Px(e,t.mode)}),Ti(t.mode)),ec=t=>Sv[t],Px=(t,e)=>{if(typeof t=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");Tv[t]=e}else typeof t=="function"&&vl.indexOf(t)<0&&vl.push(t)},Wu=/[^\x00-\x7F]|[a-zA-Z_]/,Cx=/[^\x00-\x7F]|[-\w]/,ce={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let $e=0;function Na(t){let e=t[$e],n=t[$e+1];return e==="-"||e==="+"?/\d/.test(n)||n==="."&&/\d/.test(t[$e+2]):e==="."?/\d/.test(n):/\d/.test(e)}function qu(t){if($e>=t.length)return!1;let e=t[$e];if(Wu.test(e))return!0;if(e==="-"){if(t.length-$e<2)return!1;let n=t[$e+1];return!!(n==="-"||Wu.test(n))}return!1}const Rx={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function no(t){let e="";if((t[$e]==="-"||t[$e]==="+")&&(e+=t[$e++]),e+=La(t),t[$e]==="."&&/\d/.test(t[$e+1])&&(e+=t[$e++]+La(t)),(t[$e]==="e"||t[$e]==="E")&&((t[$e+1]==="-"||t[$e+1]==="+")&&/\d/.test(t[$e+2])?e+=t[$e++]+t[$e++]+La(t):/\d/.test(t[$e+1])&&(e+=t[$e++]+La(t))),qu(t)){let n=bl(t);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:ce.Hue,value:e*Rx[n]}:void 0}return t[$e]==="%"?($e++,{type:ce.Percentage,value:+e}):{type:ce.Number,value:+e}}function La(t){let e="";for(;/\d/.test(t[$e]);)e+=t[$e++];return e}function bl(t){let e="";for(;$e<t.length&&Cx.test(t[$e]);)e+=t[$e++];return e}function Ax(t){let e=bl(t);return t[$e]==="("?($e++,{type:ce.Function,value:e}):e==="none"?{type:ce.None,value:void 0}:{type:ce.Ident,value:e}}function Ox(t=""){let e=t.trim(),n=[],r;for($e=0;$e<e.length;){if(r=e[$e++],r===`
78
+ `||r===" "||r===" "){for(;$e<e.length&&(e[$e]===`
79
+ `||e[$e]===" "||e[$e]===" ");)$e++;continue}if(r===",")return;if(r===")"){n.push({type:ce.ParenClose});continue}if(r==="+"){if($e--,Na(e)){n.push(no(e));continue}return}if(r==="-"){if($e--,Na(e)){n.push(no(e));continue}if(qu(e)){n.push({type:ce.Ident,value:bl(e)});continue}return}if(r==="."){if($e--,Na(e)){n.push(no(e));continue}return}if(r==="/"){for(;$e<e.length&&(e[$e]===`
80
+ `||e[$e]===" "||e[$e]===" ");)$e++;let i;if(Na(e)&&(i=no(e),i.type!==ce.Hue)){n.push({type:ce.Alpha,value:i});continue}if(qu(e)&&bl(e)==="none"){n.push({type:ce.Alpha,value:{type:ce.None,value:void 0}});continue}return}if(/\d/.test(r)){$e--,n.push(no(e));continue}if(Wu.test(r)){$e--,n.push(Ax(e));continue}return}return n}function Mx(t){t._i=0;let e=t[t._i++];if(!e||e.type!==ce.Function||e.value!=="color"||(e=t[t._i++],e.type!==ce.Ident))return;const n=Tv[e.value];if(!n)return;const r={mode:n},i=xv(t,!1);if(!i)return;const s=ec(n).channels;for(let o=0,a,l;o<s.length;o++)a=i[o],l=s[o],a.type!==ce.None&&(r[l]=a.type===ce.Number?a.value:a.value/100,l==="alpha"&&(r[l]=Math.max(0,Math.min(1,r[l]))));return r}function xv(t,e){const n=[];let r;for(;t._i<t.length;){if(r=t[t._i++],r.type===ce.None||r.type===ce.Number||r.type===ce.Alpha||r.type===ce.Percentage||e&&r.type===ce.Hue){n.push(r);continue}if(r.type===ce.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==ce.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:ce.None,value:void 0}),n.every(i=>i.type!==ce.Alpha)?n:void 0}}function Nx(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==ce.Function)return;let r=xv(t,e);if(r)return r.unshift(n.value),r}const Lx=t=>{if(typeof t!="string")return;const e=Ox(t),n=e?Nx(e,!0):void 0;let r,i=0,s=vl.length;for(;i<s;)if((r=vl[i++](t,n))!==void 0)return r;return e?Mx(e):void 0};function Ix(t,e){if(!e||e[0]!=="rgb"&&e[0]!=="rgba")return;const n={mode:"rgb"},[,r,i,s,o]=e;if(!(r.type===ce.Hue||i.type===ce.Hue||s.type===ce.Hue))return r.type!==ce.None&&(n.r=r.type===ce.Number?r.value/255:r.value/100),i.type!==ce.None&&(n.g=i.type===ce.Number?i.value/255:i.value/100),s.type!==ce.None&&(n.b=s.type===ce.Number?s.value/255:s.value/100),o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const zx=t=>t==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,Dx=(t,e,n)=>t+n*(e-t),Hx=t=>{let e=[];for(let n=0;n<t.length-1;n++){let r=t[n],i=t[n+1];r===void 0&&i===void 0?e.push(void 0):r!==void 0&&i!==void 0?e.push([r,i]):e.push(r!==void 0?[r,r]:[i,i])}return e},Bx=t=>e=>{let n=Hx(e);return r=>{let i=r*n.length,s=r>=1?n.length-1:Math.max(Math.floor(i),0),o=n[s];return o===void 0?void 0:t(o[0],o[1],i-s)}},ve=Bx(Dx),Jt=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},Zs={mode:"rgb",channels:["r","g","b","alpha"],parse:[Ix,yx,Tx,_x,zx,"srgb"],serialize:"srgb",interpolate:{r:ve,g:ve,b:ve,alpha:{use:ve,fixup:Jt}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Hc=(t=0)=>Math.pow(Math.abs(t),563/256)*Math.sign(t),Zh=t=>{let e=Hc(t.r),n=Hc(t.g),r=Hc(t.b),i={mode:"xyz65",x:.5766690429101305*e+.1855582379065463*n+.1882286462349947*r,y:.297344975250536*e+.6273635662554661*n+.0752914584939979*r,z:.0270313613864123*e+.0706888525358272*n+.9913375368376386*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},Bc=t=>Math.pow(Math.abs(t),256/563)*Math.sign(t),Wh=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"a98",r:Bc(t*2.0415879038107465-e*.5650069742788597-.3447313507783297*n),g:Bc(t*-.9692436362808798+e*1.8759675015077206+.0415550574071756*n),b:Bc(t*.0134442806320312-e*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(i.alpha=r),i},Uc=(t=0)=>{const e=Math.abs(t);return e<=.04045?t/12.92:(Math.sign(t)||1)*Math.pow((e+.055)/1.055,2.4)},Ws=({r:t,g:e,b:n,alpha:r})=>{let i={mode:"lrgb",r:Uc(t),g:Uc(e),b:Uc(n)};return r!==void 0&&(i.alpha=r),i},Ki=t=>{let{r:e,g:n,b:r,alpha:i}=Ws(t),s={mode:"xyz65",x:.4123907992659593*e+.357584339383878*n+.1804807884018343*r,y:.2126390058715102*e+.715168678767756*n+.0721923153607337*r,z:.0193308187155918*e+.119194779794626*n+.9505321522496607*r};return i!==void 0&&(s.alpha=i),s},$c=(t=0)=>{const e=Math.abs(t);return e>.0031308?(Math.sign(t)||1)*(1.055*Math.pow(e,1/2.4)-.055):t*12.92},qs=({r:t,g:e,b:n,alpha:r},i="rgb")=>{let s={mode:i,r:$c(t),g:$c(e),b:$c(n)};return r!==void 0&&(s.alpha=r),s},Yi=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=qs({r:t*3.2409699419045226-e*1.537383177570094-.4986107602930034*n,g:t*-.9692436362808796+e*1.8759675015077204+.0415550574071756*n,b:t*.0556300796969936-e*.2039769588889765+1.0569715142428784*n});return r!==void 0&&(i.alpha=r),i},Ux={...Zs,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Wh(Ki(t)),xyz65:Wh},toMode:{rgb:t=>Yi(Zh(t)),xyz65:Zh}},mn=t=>(t=t%360)<0?t+360:t,$x=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=mn(n);return r===0||t[r-1]===void 0?s:e(s-mn(i[r-1]))}).reduce((n,r)=>!n.length||r===void 0||n[n.length-1]===void 0?(n.push(r),n):(n.push(r+n[n.length-1]),n),[]),ri=t=>$x(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),nn=[-.14861,1.78277,-.29227,-.90649,1.97294,0],jx=Math.PI/180,Fx=180/Math.PI;let qh=nn[3]*nn[4],Kh=nn[1]*nn[4],Yh=nn[1]*nn[2]-nn[0]*nn[3];const Gx=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(Yh*n+t*qh-e*Kh)/(Yh+qh-Kh),s=n-i,o=(nn[4]*(e-i)-nn[2]*s)/nn[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(nn[4]*i*(1-i))};return a.s&&(a.h=Math.atan2(o,s)*Fx-120),r!==void 0&&(a.alpha=r),a},Vx=({h:t,s:e,l:n,alpha:r})=>{let i={mode:"rgb"};t=(t===void 0?0:t+120)*jx,n===void 0&&(n=0);let s=e===void 0?0:e*n*(1-n),o=Math.cos(t),a=Math.sin(t);return i.r=n+s*(nn[0]*o+nn[1]*a),i.g=n+s*(nn[2]*o+nn[3]*a),i.b=n+s*(nn[4]*o+nn[5]*a),r!==void 0&&(i.alpha=r),i},tc=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.s||!e.s)return 0;let n=mn(t.h),r=mn(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.s*e.s)*i},Zx=(t,e)=>{if(t.h===void 0||e.h===void 0)return 0;let n=mn(t.h),r=mn(e.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},nc=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.c||!e.c)return 0;let n=mn(t.h),r=mn(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},ii=t=>{let e=t.reduce((r,i)=>{if(i!==void 0){let s=i*Math.PI/180;r.sin+=Math.sin(s),r.cos+=Math.cos(s)}return r},{sin:0,cos:0}),n=Math.atan2(e.sin,e.cos)*180/Math.PI;return n<0?360+n:n},Wx={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Gx},toMode:{rgb:Vx},interpolate:{h:{use:ve,fixup:ri},s:ve,l:ve,alpha:{use:ve,fixup:Jt}},difference:{h:tc},average:{h:ii}},xi=({l:t,a:e,b:n,alpha:r},i="lch")=>{e===void 0&&(e=0),n===void 0&&(n=0);let s=Math.sqrt(e*e+n*n),o={mode:i,l:t,c:s};return s&&(o.h=mn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},Pi=({l:t,c:e,h:n,alpha:r},i="lab")=>{n===void 0&&(n=0);let s={mode:i,l:t,a:e?e*Math.cos(n/180*Math.PI):0,b:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(s.alpha=r),s},Pv=Math.pow(29,3)/Math.pow(3,3),Cv=Math.pow(6,3)/Math.pow(29,3),Kt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},us={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let jc=t=>Math.pow(t,3)>Cv?Math.pow(t,3):(116*t-16)/Pv;const Rv=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+16)/116,s=e/500+i,o=i-n/200,a={mode:"xyz65",x:jc(s)*us.X,y:jc(i)*us.Y,z:jc(o)*us.Z};return r!==void 0&&(a.alpha=r),a},rc=t=>Yi(Rv(t)),Fc=t=>t>Cv?Math.cbrt(t):(Pv*t+16)/116,Av=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Fc(t/us.X),s=Fc(e/us.Y),o=Fc(n/us.Z),a={mode:"lab65",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},ic=t=>{let e=Av(Ki(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},_l=1,Ov=1,Ho=26/180*Math.PI,wl=Math.cos(Ho),yl=Math.sin(Ho),Mv=100/Math.log(139/100),Ku=({l:t,c:e,h:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"lab65",l:(Math.exp(t*_l/Mv)-1)/.0039},s=(Math.exp(.0435*e*Ov*_l)-1)/.075,o=s*Math.cos(n/180*Math.PI-Ho),a=s*Math.sin(n/180*Math.PI-Ho);return i.a=o*wl-a/.83*yl,i.b=o*yl+a/.83*wl,r!==void 0&&(i.alpha=r),i},Yu=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=e*wl+n*yl,s=.83*(n*wl-e*yl),o=Math.sqrt(i*i+s*s),a={mode:"dlch",l:Mv/_l*Math.log(1+.0039*t),c:Math.log(1+.075*o)/(.0435*Ov*_l)};return a.c&&(a.h=mn((Math.atan2(s,i)+Ho)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},Xh=t=>Ku(xi(t,"dlch")),Jh=t=>Pi(Yu(t),"dlab"),qx={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Xh,rgb:t=>rc(Xh(t))},fromMode:{lab65:Jh,rgb:t=>Jh(ic(t))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:ve,a:ve,b:ve,alpha:{use:ve,fixup:Jt}}},Kx={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:Ku,dlab:t=>Pi(t,"dlab"),rgb:t=>rc(Ku(t))},fromMode:{lab65:Yu,dlab:t=>xi(t,"dlch"),rgb:t=>Yu(ic(t))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:ve,c:ve,h:{use:ve,fixup:ri},alpha:{use:ve,fixup:Jt}},difference:{h:nc},average:{h:ii}};function Yx({h:t,s:e,i:n,alpha:r}){t=mn(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1-e)};break;case 1:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1+e*(3/(2-i)-1)),b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n*(1+e*(3/(2-i)-1)),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;case 3:s={r:n*(1-e),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1+e*(3/(2-i)-1))};break;case 4:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3/(2-i)-1))};break;case 5:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Xx({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsi",s:t+e+n===0?0:1-3*s/(t+e+n),i:(t+e+n)/3};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const Jx={mode:"hsi",toMode:{rgb:Yx},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:Xx},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:ve,fixup:ri},s:ve,i:ve,alpha:{use:ve,fixup:Jt}},difference:{h:tc},average:{h:ii}};function Qx({h:t,s:e,l:n,alpha:r}){t=mn(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=n+e*(n<.5?n:1-n),s=i-(i-n)*2*Math.abs(t/60%2-1),o;switch(Math.floor(t/60)){case 0:o={r:i,g:s,b:2*n-i};break;case 1:o={r:s,g:i,b:2*n-i};break;case 2:o={r:2*n-i,g:i,b:s};break;case 3:o={r:2*n-i,g:s,b:i};break;case 4:o={r:s,g:2*n-i,b:i};break;case 5:o={r:i,g:2*n-i,b:s};break;default:o={r:2*n-i,g:2*n-i,b:2*n-i}}return o.mode="rgb",r!==void 0&&(o.alpha=r),o}function e2({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsl",s:i===s?0:(i-s)/(1-Math.abs(i+s-1)),l:.5*(i+s)};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const t2=(t,e)=>{switch(e){case"deg":return+t;case"rad":return t/Math.PI*180;case"grad":return t/10*9;case"turn":return t*360}},n2=new RegExp(`^hsla?\\(\\s*${kx}${Ms}${Ro}${Ms}${Ro}\\s*(?:,\\s*${rf}\\s*)?\\)$`),r2=t=>{let e=t.match(n2);if(!e)return;let n={mode:"hsl"};return e[3]!==void 0?n.h=+e[3]:e[1]!==void 0&&e[2]!==void 0&&(n.h=t2(e[1],e[2])),e[4]!==void 0&&(n.s=Math.min(Math.max(0,e[4]/100),1)),e[5]!==void 0&&(n.l=Math.min(Math.max(0,e[5]/100),1)),e[6]!==void 0?n.alpha=Math.max(0,Math.min(1,e[6]/100)):e[7]!==void 0&&(n.alpha=Math.max(0,Math.min(1,+e[7]))),n};function i2(t,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const n={mode:"hsl"},[,r,i,s,o]=e;if(r.type!==ce.None){if(r.type===ce.Percentage)return;n.h=r.value}if(i.type!==ce.None){if(i.type===ce.Hue)return;n.s=i.value/100}if(s.type!==ce.None){if(s.type===ce.Hue)return;n.l=s.value/100}return o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const Nv={mode:"hsl",toMode:{rgb:Qx},fromMode:{rgb:e2},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[i2,r2],serialize:t=>`hsl(${t.h!==void 0?t.h:"none"} ${t.s!==void 0?t.s*100+"%":"none"} ${t.l!==void 0?t.l*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:ve,fixup:ri},s:ve,l:ve,alpha:{use:ve,fixup:Jt}},difference:{h:tc},average:{h:ii}};function Lv({h:t,s:e,v:n,alpha:r}){t=mn(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n,g:n*(1-e*i),b:n*(1-e)};break;case 1:s={r:n*(1-e*i),g:n,b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n,b:n*(1-e*i)};break;case 3:s={r:n*(1-e),g:n*(1-e*i),b:n};break;case 4:s={r:n*(1-e*i),g:n*(1-e),b:n};break;case 5:s={r:n,g:n*(1-e),b:n*(1-e*i)};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Iv({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsv",s:i===0?0:1-s/i,v:i};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const zv={mode:"hsv",toMode:{rgb:Lv},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Iv},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:ve,fixup:ri},s:ve,v:ve,alpha:{use:ve,fixup:Jt}},difference:{h:tc},average:{h:ii}};function s2({h:t,w:e,b:n,alpha:r}){if(e===void 0&&(e=0),n===void 0&&(n=0),e+n>1){let i=e+n;e/=i,n/=i}return Lv({h:t,s:n===1?1:1-e/(1-n),v:1-n,alpha:r})}function o2(t){let e=Iv(t);if(e===void 0)return;let n=e.s!==void 0?e.s:0,r=e.v!==void 0?e.v:0,i={mode:"hwb",w:(1-n)*r,b:1-r};return e.h!==void 0&&(i.h=e.h),e.alpha!==void 0&&(i.alpha=e.alpha),i}function a2(t,e){if(!e||e[0]!=="hwb")return;const n={mode:"hwb"},[,r,i,s,o]=e;if(r.type!==ce.None){if(r.type===ce.Percentage)return;n.h=r.value}if(i.type!==ce.None){if(i.type===ce.Hue)return;n.w=i.value/100}if(s.type!==ce.None){if(s.type===ce.Hue)return;n.b=s.value/100}return o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const l2={mode:"hwb",toMode:{rgb:s2},fromMode:{rgb:o2},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[a2],serialize:t=>`hwb(${t.h!==void 0?t.h:"none"} ${t.w!==void 0?t.w*100+"%":"none"} ${t.b!==void 0?t.b*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:ve,fixup:ri},w:ve,b:ve,alpha:{use:ve,fixup:Jt}},difference:{h:Zx},average:{h:ii}},Dv=203,sc=.1593017578125,Hv=78.84375,oc=.8359375,ac=18.8515625,lc=18.6875;function Gc(t){if(t<0)return 0;const e=Math.pow(t,1/Hv);return 1e4*Math.pow(Math.max(0,e-oc)/(ac-lc*e),1/sc)}function Vc(t){if(t<0)return 0;const e=Math.pow(t/1e4,sc);return Math.pow((oc+ac*e)/(1+lc*e),Hv)}const Zc=t=>Math.max(t/Dv,0),Qh=({i:t,t:e,p:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i=Gc(t+.008609037037932761*e+.11102962500302593*n),s=Gc(t-.00860903703793275*e-.11102962500302599*n),o=Gc(t+.5600313357106791*e-.32062717498731885*n),a={mode:"xyz65",x:Zc(2.070152218389422*i-1.3263473389671556*s+.2066510476294051*o),y:Zc(.3647385209748074*i+.680566024947227*s-.0453045459220346*o),z:Zc(-.049747207535812*i-.0492609666966138*s+1.1880659249923042*o)};return r!==void 0&&(a.alpha=r),a},Wc=(t=0)=>Math.max(t*Dv,0),ep=({x:t,y:e,z:n,alpha:r})=>{const i=Wc(t),s=Wc(e),o=Wc(n),a=Vc(.3592832590121217*i+.6976051147779502*s-.0358915932320289*o),l=Vc(-.1920808463704995*i+1.1004767970374323*s+.0753748658519118*o),c=Vc(.0070797844607477*i+.0748396662186366*s+.8433265453898765*o),u=.5*a+.5*l,f=1.61376953125*a-3.323486328125*l+1.709716796875*c,h=4.378173828125*a-4.24560546875*l-.132568359375*c,p={mode:"itp",i:u,t:f,p:h};return r!==void 0&&(p.alpha=r),p},c2={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Qh,rgb:t=>Yi(Qh(t))},fromMode:{xyz65:ep,rgb:t=>ep(Ki(t))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:ve,t:ve,p:ve,alpha:{use:ve,fixup:Jt}}},u2=134.03437499999998,d2=16295499532821565e-27,qc=t=>{if(t<0)return 0;let e=Math.pow(t/1e4,sc);return Math.pow((oc+ac*e)/(1+lc*e),u2)},Kc=(t=0)=>Math.max(t*203,0),Bv=({x:t,y:e,z:n,alpha:r})=>{t=Kc(t),e=Kc(e),n=Kc(n);let i=1.15*t-.15*n,s=.66*e+.34*t,o=qc(.41478972*i+.579999*s+.014648*n),a=qc(-.20151*i+1.120649*s+.0531008*n),l=qc(-.0166008*i+.2648*s+.6684799*n),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-d2,a:3.524*o-4.066708*a+.542708*l,b:.199076*o+1.096799*a-1.295875*l};return r!==void 0&&(u.alpha=r),u},f2=134.03437499999998,tp=16295499532821565e-27,Yc=t=>{if(t<0)return 0;let e=Math.pow(t,1/f2);return 1e4*Math.pow((oc-e)/(lc*e-ac),1/sc)},Xc=t=>t/203,Uv=({j:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+tp)/(.44+.56*(t+tp)),s=Yc(i+.13860504*e+.058047316*n),o=Yc(i-.13860504*e-.058047316*n),a=Yc(i-.096019242*e-.8118919*n),l={mode:"xyz65",x:Xc(1.661373024652174*s-.914523081304348*o+.23136208173913045*a),y:Xc(-.3250758611844533*s+1.571847026732543*o-.21825383453227928*a),z:Xc(-.090982811*s-.31272829*o+1.5227666*a)};return r!==void 0&&(l.alpha=r),l},$v=t=>{let e=Bv(Ki(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},jv=t=>Yi(Uv(t)),h2={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:$v,xyz65:Bv},toMode:{rgb:jv,xyz65:Uv},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:ve,a:ve,b:ve,alpha:{use:ve,fixup:Jt}}},np=({j:t,a:e,b:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"jch",j:t,c:i};return i&&(s.h=mn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},rp=({j:t,c:e,h:n,alpha:r})=>{n===void 0&&(n=0);let i={mode:"jab",j:t,a:e?e*Math.cos(n/180*Math.PI):0,b:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},p2={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:rp,rgb:t=>jv(rp(t))},fromMode:{rgb:t=>np($v(t)),jab:np},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:ve,fixup:ri},c:ve,j:ve,alpha:{use:ve,fixup:Jt}},difference:{h:nc},average:{h:ii}},cc=Math.pow(29,3)/Math.pow(3,3),sf=Math.pow(6,3)/Math.pow(29,3);let Jc=t=>Math.pow(t,3)>sf?Math.pow(t,3):(116*t-16)/cc;const of=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+16)/116,s=e/500+i,o=i-n/200,a={mode:"xyz50",x:Jc(s)*Kt.X,y:Jc(i)*Kt.Y,z:Jc(o)*Kt.Z};return r!==void 0&&(a.alpha=r),a},pa=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=qs({r:t*3.1341359569958707-e*1.6173863321612538-.4906619460083532*n,g:t*-.978795502912089+e*1.916254567259524+.03344273116131949*n,b:t*.07195537988411677-e*.2289768264158322+1.405386058324125*n});return r!==void 0&&(i.alpha=r),i},Fv=t=>pa(of(t)),ga=t=>{let{r:e,g:n,b:r,alpha:i}=Ws(t),s={mode:"xyz50",x:.436065742824811*e+.3851514688337912*n+.14307845442264197*r,y:.22249319175623702*e+.7168870538238823*n+.06061979053616537*r,z:.013923904500943465*e+.09708128566574634*n+.7140993584005155*r};return i!==void 0&&(s.alpha=i),s},Qc=t=>t>sf?Math.cbrt(t):(cc*t+16)/116,af=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Qc(t/Kt.X),s=Qc(e/Kt.Y),o=Qc(n/Kt.Z),a={mode:"lab",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},Gv=t=>{let e=af(ga(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e};function g2(t,e){if(!e||e[0]!=="lab")return;const n={mode:"lab"},[,r,i,s,o]=e;if(!(r.type===ce.Hue||i.type===ce.Hue||s.type===ce.Hue))return r.type!==ce.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==ce.None&&(n.a=i.type===ce.Number?i.value:i.value*125/100),s.type!==ce.None&&(n.b=s.type===ce.Number?s.value:s.value*125/100),o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const lf={mode:"lab",toMode:{xyz50:of,rgb:Fv},fromMode:{xyz50:af,rgb:Gv},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[g2],serialize:t=>`lab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{l:ve,a:ve,b:ve,alpha:{use:ve,fixup:Jt}}},m2={...lf,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Rv,rgb:rc},fromMode:{xyz65:Av,rgb:ic},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function v2(t,e){if(!e||e[0]!=="lch")return;const n={mode:"lch"},[,r,i,s,o]=e;if(r.type!==ce.None){if(r.type===ce.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==ce.None&&(n.c=Math.max(0,i.type===ce.Number?i.value:i.value*150/100)),s.type!==ce.None){if(s.type===ce.Percentage)return;n.h=s.value}return o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const cf={mode:"lch",toMode:{lab:Pi,rgb:t=>Fv(Pi(t))},fromMode:{rgb:t=>xi(Gv(t)),lab:xi},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[v2],serialize:t=>`lch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:ve,fixup:ri},c:ve,l:ve,alpha:{use:ve,fixup:Jt}},difference:{h:nc},average:{h:ii}},b2={...cf,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>Pi(t,"lab65"),rgb:t=>rc(Pi(t,"lab65"))},fromMode:{rgb:t=>xi(ic(t),"lch65"),lab65:t=>xi(t,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Vv=({l:t,u:e,v:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"lchuv",l:t,c:i};return i&&(s.h=mn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Zv=({l:t,c:e,h:n,alpha:r})=>{n===void 0&&(n=0);let i={mode:"luv",l:t,u:e?e*Math.cos(n/180*Math.PI):0,v:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},Wv=(t,e,n)=>4*t/(t+15*e+3*n),qv=(t,e,n)=>9*e/(t+15*e+3*n),_2=Wv(Kt.X,Kt.Y,Kt.Z),w2=qv(Kt.X,Kt.Y,Kt.Z),y2=t=>t<=sf?cc*t:116*Math.cbrt(t)-16,Xu=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=y2(e/Kt.Y),s=Wv(t,e,n),o=qv(t,e,n);!isFinite(s)||!isFinite(o)?i=s=o=0:(s=13*i*(s-_2),o=13*i*(o-w2));let a={mode:"luv",l:i,u:s,v:o};return r!==void 0&&(a.alpha=r),a},k2=(t,e,n)=>4*t/(t+15*e+3*n),E2=(t,e,n)=>9*e/(t+15*e+3*n),S2=k2(Kt.X,Kt.Y,Kt.Z),T2=E2(Kt.X,Kt.Y,Kt.Z),Ju=({l:t,u:e,v:n,alpha:r})=>{if(t===void 0&&(t=0),t===0)return{mode:"xyz50",x:0,y:0,z:0};e===void 0&&(e=0),n===void 0&&(n=0);let i=e/(13*t)+S2,s=n/(13*t)+T2,o=Kt.Y*(t<=8?t/cc:Math.pow((t+16)/116,3)),a=o*(9*i)/(4*s),l=o*(12-3*i-20*s)/(4*s),c={mode:"xyz50",x:a,y:o,z:l};return r!==void 0&&(c.alpha=r),c},x2=t=>Vv(Xu(ga(t))),P2=t=>pa(Ju(Zv(t))),C2={mode:"lchuv",toMode:{luv:Zv,rgb:P2},fromMode:{rgb:x2,luv:Vv},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:ve,fixup:ri},c:ve,l:ve,alpha:{use:ve,fixup:Jt}},difference:{h:nc},average:{h:ii}},R2={...Zs,mode:"lrgb",toMode:{rgb:qs},fromMode:{rgb:Ws},parse:["srgb-linear"],serialize:"srgb-linear"},A2={mode:"luv",toMode:{xyz50:Ju,rgb:t=>pa(Ju(t))},fromMode:{xyz50:Xu,rgb:t=>Xu(ga(t))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:ve,u:ve,v:ve,alpha:{use:ve,fixup:Jt}}},Kv=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.cbrt(.412221469470763*t+.5363325372617348*e+.0514459932675022*n),s=Math.cbrt(.2119034958178252*t+.6806995506452344*e+.1073969535369406*n),o=Math.cbrt(.0883024591900564*t+.2817188391361215*e+.6299787016738222*n),a={mode:"oklab",l:.210454268309314*i+.7936177747023054*s-.0040720430116193*o,a:1.9779985324311684*i-2.42859224204858*s+.450593709617411*o,b:.0259040424655478*i+.7827717124575296*s-.8086757549230774*o};return r!==void 0&&(a.alpha=r),a},uc=t=>{let e=Kv(Ws(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},ma=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.pow(t+.3963377773761749*e+.2158037573099136*n,3),s=Math.pow(t-.1055613458156586*e-.0638541728258133*n,3),o=Math.pow(t-.0894841775298119*e-1.2914855480194092*n,3),a={mode:"lrgb",r:4.076741636075957*i-3.3077115392580616*s+.2309699031821044*o,g:-1.2684379732850317*i+2.6097573492876887*s-.3413193760026573*o,b:-.0041960761386756*i-.7034186179359362*s+1.7076146940746117*o};return r!==void 0&&(a.alpha=r),a},dc=t=>qs(ma(t));function Qu(t){const r=1.170873786407767;return .5*(r*t-.206+Math.sqrt((r*t-.206)*(r*t-.206)+4*.03*r*t))}function kl(t){return(t*t+.206*t)/(1.170873786407767*(t+.03))}function O2(t,e){let n,r,i,s,o,a,l,c;-1.88170328*t-.80936493*e>1?(n=1.19086277,r=1.76576728,i=.59662641,s=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*t-1.19445276*e>1?(n=.73956515,r=-.45954404,i=.08285427,s=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(n=1.35733652,r=-.00915799,i=-1.1513021,s=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=n+r*t+i*e+s*t*t+o*t*e,f=.3963377774*t+.2158037573*e,h=-.1055613458*t-.0638541728*e,p=-.0894841775*t-1.291485548*e;{let m=1+u*f,g=1+u*h,b=1+u*p,_=m*m*m,y=g*g*g,O=b*b*b,N=3*f*m*m,S=3*h*g*g,P=3*p*b*b,M=6*f*f*m,z=6*h*h*g,B=6*p*p*b,U=a*_+l*y+c*O,G=a*N+l*S+c*P,Y=a*M+l*z+c*B;u=u-U*G/(G*G-.5*U*Y)}return u}function uf(t,e){let n=O2(t,e),r=ma({l:1,a:n*t,b:n*e}),i=Math.cbrt(1/Math.max(r.r,r.g,r.b)),s=i*n;return[i,s]}function M2(t,e,n,r,i,s=null){s||(s=uf(t,e));let o;if((n-i)*s[1]-(s[0]-i)*r<=0)o=s[1]*i/(r*s[0]+s[1]*(i-n));else{o=s[1]*(i-1)/(r*(s[0]-1)+s[1]*(i-n));{let a=n-i,l=r,c=.3963377774*t+.2158037573*e,u=-.1055613458*t-.0638541728*e,f=-.0894841775*t-1.291485548*e,h=a+l*c,p=a+l*u,m=a+l*f;{let g=i*(1-o)+o*n,b=o*r,_=g+b*c,y=g+b*u,O=g+b*f,N=_*_*_,S=y*y*y,P=O*O*O,M=3*h*_*_,z=3*p*y*y,B=3*m*O*O,U=6*h*h*_,G=6*p*p*y,Y=6*m*m*O,oe=4.0767416621*N-3.3077115913*S+.2309699292*P-1,we=4.0767416621*M-3.3077115913*z+.2309699292*B,he=4.0767416621*U-3.3077115913*G+.2309699292*Y,te=we/(we*we-.5*oe*he),ge=-oe*te,ye=-1.2684380046*N+2.6097574011*S-.3413193965*P-1,Me=-1.2684380046*M+2.6097574011*z-.3413193965*B,Fe=-1.2684380046*U+2.6097574011*G-.3413193965*Y,me=Me/(Me*Me-.5*ye*Fe),Ne=-ye*me,qe=-.0041960863*N-.7034186147*S+1.707614701*P-1,se=-.0041960863*M-.7034186147*z+1.707614701*B,ke=-.0041960863*U-.7034186147*G+1.707614701*Y,Ee=se/(se*se-.5*qe*ke),H=-qe*Ee;ge=te>=0?ge:1e6,Ne=me>=0?Ne:1e6,H=Ee>=0?H:1e6,o+=Math.min(ge,Math.min(Ne,H))}}}return o}function df(t,e,n=null){n||(n=uf(t,e));let r=n[0],i=n[1];return[i/r,i/(1-r)]}function Yv(t,e,n){let r=uf(e,n),i=M2(e,n,t,1,t,r),s=df(e,n,r),o=.11516993+1/(7.4477897+4.1590124*n+e*(-2.19557347+1.75198401*n+e*(-2.13704948-10.02301043*n+e*(-4.24894561+5.38770819*n+4.69891013*e)))),a=.11239642+1/(1.6132032-.68124379*n+e*(.40370612+.90148123*n+e*(-.27087943+.6122399*n+e*(.00299215-.45399568*n-.14661872*e)))),l=i/Math.min(t*s[0],(1-t)*s[1]),c=t*o,u=(1-t)*a,f=.9*l*Math.sqrt(Math.sqrt(1/(1/(c*c*c*c)+1/(u*u*u*u))));return c=t*.4,u=(1-t)*.8,[Math.sqrt(1/(1/(c*c)+1/(u*u))),f,i]}function ip(t){const e=t.l!==void 0?t.l:0,n=t.a!==void 0?t.a:0,r=t.b!==void 0?t.b:0,i={mode:"okhsl",l:Qu(e)};t.alpha!==void 0&&(i.alpha=t.alpha);let s=Math.sqrt(n*n+r*r);if(!s)return i.s=0,i;let[o,a,l]=Yv(e,n/s,r/s),c;if(s<a){let u=0,f=.8*o,h=1-f/a;c=(s-u)/(f+h*(s-u))*.8}else{let u=a,f=.2*a*a*1.25*1.25/o,h=1-f/(l-a);c=.8+.2*((s-u)/(f+h*(s-u)))}return c&&(i.s=c,i.h=mn(Math.atan2(r,n)*180/Math.PI)),i}function sp(t){let e=t.h!==void 0?t.h:0,n=t.s!==void 0?t.s:0,r=t.l!==void 0?t.l:0;const i={mode:"oklab",l:kl(r)};if(t.alpha!==void 0&&(i.alpha=t.alpha),!n||r===1)return i.a=i.b=0,i;let s=Math.cos(e/180*Math.PI),o=Math.sin(e/180*Math.PI),[a,l,c]=Yv(i.l,s,o),u,f,h,p;n<.8?(u=1.25*n,f=0,h=.8*a,p=1-h/l):(u=5*(n-.8),f=l,h=.2*l*l*1.25*1.25/a,p=1-h/(c-l));let m=f+u*h/(1-p*u);return i.a=m*s,i.b=m*o,i}const N2={...Nv,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:ip,rgb:t=>ip(uc(t))},toMode:{oklab:sp,rgb:t=>dc(sp(t))}};function op(t){let e=t.l!==void 0?t.l:0,n=t.a!==void 0?t.a:0,r=t.b!==void 0?t.b:0,i=Math.sqrt(n*n+r*r),s=i?n/i:1,o=i?r/i:1,[a,l]=df(s,o),c=.5,u=1-c/a,f=l/(i+e*l),h=f*e,p=f*i,m=kl(h),g=p*m/h,b=ma({l:m,a:s*g,b:o*g}),_=Math.cbrt(1/Math.max(b.r,b.g,b.b,0));e=e/_,i=i/_*Qu(e)/e,e=Qu(e);const y={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return y.s&&(y.h=mn(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(y.alpha=t.alpha),y}function ap(t){const e={mode:"oklab"};t.alpha!==void 0&&(e.alpha=t.alpha);const n=t.h!==void 0?t.h:0,r=t.s!==void 0?t.s:0,i=t.v!==void 0?t.v:0,s=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[a,l]=df(s,o),c=.5,u=1-c/a,f=1-r*c/(c+l-l*u*r),h=r*l*c/(c+l-l*u*r),p=kl(f),m=h*p/f,g=ma({l:p,a:s*m,b:o*m}),b=Math.cbrt(1/Math.max(g.r,g.g,g.b,0)),_=kl(i*f),y=h*_/f;return e.l=_*b,e.a=y*s*b,e.b=y*o*b,e}const L2={...zv,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:op,rgb:t=>op(uc(t))},toMode:{oklab:ap,rgb:t=>dc(ap(t))}};function I2(t,e){if(!e||e[0]!=="oklab")return;const n={mode:"oklab"},[,r,i,s,o]=e;if(!(r.type===ce.Hue||i.type===ce.Hue||s.type===ce.Hue))return r.type!==ce.None&&(n.l=Math.min(Math.max(0,r.type===ce.Number?r.value:r.value/100),1)),i.type!==ce.None&&(n.a=i.type===ce.Number?i.value:i.value*.4/100),s.type!==ce.None&&(n.b=s.type===ce.Number?s.value:s.value*.4/100),o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const z2={...lf,mode:"oklab",toMode:{lrgb:ma,rgb:dc},fromMode:{lrgb:Kv,rgb:uc},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[I2],serialize:t=>`oklab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`};function D2(t,e){if(!e||e[0]!=="oklch")return;const n={mode:"oklch"},[,r,i,s,o]=e;if(r.type!==ce.None){if(r.type===ce.Hue)return;n.l=Math.min(Math.max(0,r.type===ce.Number?r.value:r.value/100),1)}if(i.type!==ce.None&&(n.c=Math.max(0,i.type===ce.Number?i.value:i.value*.4/100)),s.type!==ce.None){if(s.type===ce.Percentage)return;n.h=s.value}return o.type!==ce.None&&(n.alpha=Math.min(1,Math.max(0,o.type===ce.Number?o.value:o.value/100))),n}const H2={...cf,mode:"oklch",toMode:{oklab:t=>Pi(t,"oklab"),rgb:t=>dc(Pi(t,"oklab"))},fromMode:{rgb:t=>xi(uc(t),"oklch"),oklab:t=>xi(t,"oklch")},parse:[D2],serialize:t=>`oklch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},lp=t=>{let{r:e,g:n,b:r,alpha:i}=Ws(t),s={mode:"xyz65",x:.486570948648216*e+.265667693169093*n+.1982172852343625*r,y:.2289745640697487*e+.6917385218365062*n+.079286914093745*r,z:0*e+.0451133818589026*n+1.043944368900976*r};return i!==void 0&&(s.alpha=i),s},cp=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=qs({r:t*2.4934969119414263-e*.9313836179191242-.402710784450717*n,g:t*-.8294889695615749+e*1.7626640603183465+.0236246858419436*n,b:t*.0358458302437845-e*.0761723892680418+.9568845240076871*n},"p3");return r!==void 0&&(i.alpha=r),i},B2={...Zs,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:t=>cp(Ki(t)),xyz65:cp},toMode:{rgb:t=>Yi(lp(t)),xyz65:lp}},eu=t=>{let e=Math.abs(t);return e>=1/512?Math.sign(t)*Math.pow(e,1/1.8):16*t},up=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"prophoto",r:eu(t*1.3457868816471585-e*.2555720873797946-.0511018649755453*n),g:eu(t*-.5446307051249019+e*1.5082477428451466+.0205274474364214*n),b:eu(t*0+e*0+1.2119675456389452*n)};return r!==void 0&&(i.alpha=r),i},tu=(t=0)=>{let e=Math.abs(t);return e>=16/512?Math.sign(t)*Math.pow(e,1.8):t/16},dp=t=>{let e=tu(t.r),n=tu(t.g),r=tu(t.b),i={mode:"xyz50",x:.7977666449006423*e+.1351812974005331*n+.0313477341283922*r,y:.2880748288194013*e+.7118352342418731*n+899369387256e-16*r,z:0*e+0*n+.8251046025104602*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},U2={...Zs,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:up,rgb:t=>up(ga(t))},toMode:{xyz50:dp,rgb:t=>pa(dp(t))}},fp=1.09929682680944,$2=.018053968510807,nu=t=>{const e=Math.abs(t);return e>$2?(Math.sign(t)||1)*(fp*Math.pow(e,.45)-(fp-1)):4.5*t},hp=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"rec2020",r:nu(t*1.7166511879712683-e*.3556707837763925-.2533662813736599*n),g:nu(t*-.6666843518324893+e*1.6164812366349395+.0157685458139111*n),b:nu(t*.0176398574453108-e*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(i.alpha=r),i},pp=1.09929682680944,j2=.018053968510807,ru=(t=0)=>{let e=Math.abs(t);return e<j2*4.5?t/4.5:(Math.sign(t)||1)*Math.pow((e+pp-1)/pp,1/.45)},gp=t=>{let e=ru(t.r),n=ru(t.g),r=ru(t.b),i={mode:"xyz65",x:.6369580483012911*e+.1446169035862083*n+.1688809751641721*r,y:.262700212011267*e+.6779980715188708*n+.059301716469862*r,z:0*e+.0280726930490874*n+1.0609850577107909*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},F2={...Zs,mode:"rec2020",fromMode:{xyz65:hp,rgb:t=>hp(Ki(t))},toMode:{xyz65:gp,rgb:t=>Yi(gp(t))},parse:["rec2020"],serialize:"rec2020"},Fi=.0037930732552754493,Xv=Math.cbrt(Fi),iu=t=>Math.cbrt(t)-Xv,G2=t=>{const{r:e,g:n,b:r,alpha:i}=Ws(t),s=iu(.3*e+.622*n+.078*r+Fi),o=iu(.23*e+.692*n+.078*r+Fi),a=iu(.2434226892454782*e+.2047674442449682*n+.5518098665095535*r+Fi),l={mode:"xyb",x:(s-o)/2,y:(s+o)/2,b:a-(s+o)/2};return i!==void 0&&(l.alpha=i),l},su=t=>Math.pow(t+Xv,3),V2=({x:t,y:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i=su(t+e)-Fi,s=su(e-t)-Fi,o=su(n+e)-Fi,a=qs({r:11.031566904639861*i-9.866943908131562*s-.16462299650829934*o,g:-3.2541473810744237*i+4.418770377582723*s-.16462299650829934*o,b:-3.6588512867136815*i+2.7129230459360922*s+1.9459282407775895*o});return r!==void 0&&(a.alpha=r),a},Z2={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:V2},fromMode:{rgb:G2},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:ve,y:ve,b:ve,alpha:{use:ve,fixup:Jt}}},W2={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:pa,lab:af},fromMode:{rgb:ga,lab:of},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:ve,y:ve,z:ve,alpha:{use:ve,fixup:Jt}}},q2=t=>{let{x:e,y:n,z:r,alpha:i}=t;e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=0);let s={mode:"xyz50",x:1.0479298208405488*e+.0229467933410191*n-.0501922295431356*r,y:.0296278156881593*e+.990434484573249*n-.0170738250293851*r,z:-.0092430581525912*e+.0150551448965779*n+.7518742899580008*r};return i!==void 0&&(s.alpha=i),s},K2=t=>{let{x:e,y:n,z:r,alpha:i}=t;e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=0);let s={mode:"xyz65",x:.9554734527042182*e-.0230985368742614*n+.0632593086610217*r,y:-.0283697069632081*e+1.0099954580058226*n+.021041398966943*r,z:.0123140016883199*e-.0205076964334779*n+1.3303659366080753*r};return i!==void 0&&(s.alpha=i),s},Y2={mode:"xyz65",toMode:{rgb:Yi,xyz50:q2},fromMode:{rgb:Ki,xyz50:K2},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:ve,y:ve,z:ve,alpha:{use:ve,fixup:Jt}}},X2=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i={mode:"yiq",y:.29889531*t+.58662247*e+.11448223*n,i:.59597799*t-.2741761*e-.32180189*n,q:.21147017*t-.52261711*e+.31114694*n};return r!==void 0&&(i.alpha=r),i},J2=({y:t,i:e,q:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i={mode:"rgb",r:t+.95608445*e+.6208885*n,g:t-.27137664*e-.6486059*n,b:t-1.10561724*e+1.70250126*n};return r!==void 0&&(i.alpha=r),i},Q2={mode:"yiq",toMode:{rgb:J2},fromMode:{rgb:X2},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:ve,i:ve,q:ve,alpha:{use:ve,fixup:Jt}}},eP=t=>Math.max(0,Math.min(1,t||0)),ou=t=>Math.round(eP(t)*255),tP=Ti("rgb"),nP=t=>{if(t===void 0)return;let e=ou(t.r),n=ou(t.g),r=ou(t.b);return"#"+(1<<24|e<<16|n<<8|r).toString(16).slice(1)},rP=t=>nP(tP(t)),Jv=Ti("rgb"),Qv=t=>{const e={mode:t.mode,r:Math.max(0,Math.min(t.r!==void 0?t.r:0,1)),g:Math.max(0,Math.min(t.g!==void 0?t.g:0,1)),b:Math.max(0,Math.min(t.b!==void 0?t.b:0,1))};return t.alpha!==void 0&&(e.alpha=t.alpha),e},iP=t=>Qv(Jv(t)),eb=t=>t!==void 0&&(t.r===void 0||t.r>=0&&t.r<=1)&&(t.g===void 0||t.g>=0&&t.g<=1)&&(t.b===void 0||t.b>=0&&t.b<=1);function sP(t){return eb(Jv(t))}function tb(t="rgb"){const{gamut:e}=ec(t);if(!e)return r=>!0;const n=Ti(typeof e=="string"?e:t);return r=>eb(n(r))}function oP(t="rgb"){const{gamut:e}=ec(t);if(!e)return s=>ml(s);const n=typeof e=="string"?e:t,r=Ti(n),i=tb(n);return s=>{const o=ml(s);if(!o)return;const a=r(o);if(i(a))return o;const l=Qv(a);return o.mode===l.mode?l:Ti(o.mode)(l)}}function aP(t,e="lch",n="rgb"){t=ml(t);let r=n==="rgb"?sP:tb(n),i=n==="rgb"?iP:oP(n);if(t===void 0||r(t))return t;let s=Ti(t.mode);t=Ti(e)(t);let o={...t,c:0};if(!r(o))return s(i(o));let a=0,l=t.c!==void 0?t.c:0,c=ec(e).ranges.c,u=(c[1]-c[0])/Math.pow(2,13),f=o.c;for(;l-a>u;)o.c=a+(l-a)*.5,r(o)?(f=o.c,a=o.c):l=o.c;return s(r(o)?o:{...o,c:f})}ht(Ux);ht(Wx);ht(qx);ht(Kx);ht(Jx);ht(Nv);ht(zv);ht(l2);ht(c2);ht(h2);ht(p2);ht(lf);ht(m2);ht(cf);ht(b2);ht(C2);ht(R2);ht(A2);ht(N2);ht(L2);ht(z2);const lP=ht(H2);ht(B2);ht(U2);ht(F2);ht(Zs);ht(Z2);ht(W2);ht(Y2);ht(Q2);function go(t,e,n){const r=aP({mode:"oklch",l:t,c:e,h:n},"oklch");return rP(r??{mode:"oklch",l:t,c:0,h:n})}function nb(t){const e=lP(t);return e?{l:e.l,c:e.c,h:e.h??0}:{l:0,c:0,h:0}}function cP(t,e){const{l:n,c:r,h:i}=nb(t);return go(Math.min(1,Math.max(0,n+e)),r,i)}function uP(t){const{hue:e,chroma:n,bgHex:r,target:i}=t,s=.01;let o=t.l;const a=Co(go(1,0,e),r),l=Co(go(0,0,e),r),c=a>=l?s:-s;let u=go(o,n,e);for(;Co(u,r)<i&&o>0&&o<1;)o=Math.min(1,Math.max(0,o+c)),u=go(o,n,e);return u}function dP(t,e,n){const{l:r,c:i,h:s}=nb(t);return uP({hue:s,chroma:i,l:r,bgHex:e,target:n})}const fP={dark:.12,light:-.12};function hP(t,e,n){const r=cP(t,fP[n]);return Co(r,e)>=4.5?r:dP(r,e,4.5)}const Qa=["dark","light"],ed=nf.map(t=>t.token),pP=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function rb(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function gP(t,e,n){if(!rb(t))return n.push(`"${e}" must be an object of palette colour tokens.`),!1;let r=!0;for(const i of ed){const s=t[i];if(s===void 0){if(i==="controlHover")continue;n.push(`"${e}" is missing the token "${i}".`),r=!1;continue}if(typeof s!="string"){n.push(`"${e}.${i}" must be a string, got ${typeof s}.`),r=!1;continue}pP.test(s)||(n.push(`"${e}.${i}" must be a hex colour like #1a2b3c, got "${s}".`),r=!1)}for(const i of Object.keys(t))ed.includes(i)||(n.push(`"${e}" has an unknown token "${i}".`),r=!1);return r}function mP(t){const e=[];for(const n of Qa)for(const r of mx){const i=Co(t[n][r.fg],t[n][r.bg]);i<r.min&&e.push({theme:n,pair:`${r.fg} on ${r.bg}`,ratio:Number(i.toFixed(2)),min:r.min})}return e}function ib(t){const e=[];if(!rb(t))return{palette:null,structuralErrors:['The file must contain a JSON object with "dark" and "light" keys.'],contrastWarnings:[]};let n=!0;for(const i of Qa){if(!(i in t)){e.push(`Missing the "${i}" theme.`),n=!1;continue}gP(t[i],i,e)||(n=!1)}for(const i of Object.keys(t))Qa.includes(i)||(e.push(`Unknown top-level key "${i}"; expected only "dark" and "light".`),n=!1);if(!n)return{palette:null,structuralErrors:e,contrastWarnings:[]};const r={dark:{},light:{}};for(const i of Qa){const s=t[i];for(const o of ed)o==="controlHover"&&s[o]===void 0?r[i].controlHover=hP(s.surface,s.text,i):r[i][o]=s[o]}return{palette:r,structuralErrors:[],contrastWarnings:mP(r)}}const sb=["execute","queue","initBackgroundProcess","queueBackgroundProcess"];function ob(t){return t.reason===void 0?new DOMException("The operation was aborted.","AbortError"):t.reason}function vP(t){return new tl(e=>{const n=()=>{e.error(ob(t))};if(t.aborted){n();return}return t.addEventListener("abort",n,{once:!0}),()=>t.removeEventListener("abort",n)})}function bP(t){const e=(r,i)=>{const{signal:s,...o}=i??{},a=i===void 0?void 0:o;if((s==null?void 0:s.aborted)===!0)return Promise.resolve().then(()=>{throw ob(s)});const l=t.queue(r,a);return _d(s===void 0?l:O_(l,vP(s)))},n=Object.create(null);for(const r of sb)n[r]=t[r].bind(t);return n.query=e,Object.freeze(n)}const El=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),ab=Xe({capability:yv,reason:pe().min(1),prerequisite:pe().min(1).optional()}),ff=pn().int().nonnegative().nullable(),_P=Xe({kind:Sn(["exec","service"]),state:Zt("blocked"),retryAfterSeconds:ff,blockers:zt(ab).min(1)}),wP=Xe({kind:Sn(["exec","service"]),state:Zt("incompatible"),retryAfterSeconds:ff,requiredProtocol:pn().int(),supportedProtocols:zt(pn().int())}),yP=Xe({kind:Sn(["exec","service"]),state:Sn(["ready","starting","unavailable","maintenance","disabled","not-approved"]),retryAfterSeconds:ff}),kP=t=>{if(!El(t))return t;if(({blocked:["requiredProtocol","supportedProtocols"],incompatible:["blockers"]}[String(t.state)]??["blockers","requiredProtocol","supportedProtocols"]).some(r=>Object.prototype.hasOwnProperty.call(t,r)))throw new Error("backend status contains fields for a different variant");return t},EP=bT(kP,Jd("state",[_P,wP,yP])),mp=Object.freeze({notApproved:4001,disabled:4002}),SP=new Set(["BACKEND_BUSY","BACKEND_STARTING","BACKEND_UNAVAILABLE","BACKEND_MAINTENANCE","BAD_GATEWAY","SERVER_BUSY","REQUEST_TIMEOUT","SCRIPT_TIMEOUT","STATUS_QUERY_FAILED"]),TP=(t,e)=>t==="HTTP_ERROR"?e===408||e===425||e===429||e!==void 0&&e>=500:SP.has(t);class En extends Error{constructor(n,r,i,s={}){super(n);K(this,"id");K(this,"code");K(this,"status");K(this,"retryable");K(this,"details");this.name="BackendError",this.code=r,this.id=i,this.status=s.status,this.retryable=s.retryable??TP(r,s.status),this.details=s.details}}class td extends En{constructor(n,r={}){const i=r.code??"UNKNOWN_ID";super(`Unknown backend binding id: "${n}"`,i,n,r);K(this,"code");this.code=i,this.name="BackendUnknownId"}}class lb extends En{constructor(n,r={}){super(`Backend "${n}" is not approved`,"NOT_APPROVED",n,r);K(this,"code","NOT_APPROVED");this.name="BackendNotApproved"}}class hf extends En{constructor(n,r={}){super(`Backend "${n}" is disabled`,"DISABLED",n,r);K(this,"code","DISABLED");this.name="BackendDisabled"}}class vp extends En{constructor(n,r,i={}){super(`Backend route "${n}" is not an ${r} route`,"TRANSPORT_MISMATCH",n,i);K(this,"code","TRANSPORT_MISMATCH");this.expected=r,this.name="BackendTransportMismatch"}}class xP extends En{constructor(n,r,i={}){super(`Backend "${n}" is starting`,"BACKEND_STARTING",n,i);K(this,"code","BACKEND_STARTING");this.retryAfterSeconds=r,this.name="BackendStarting"}}class PP extends En{constructor(n,r={}){super(`Backend "${n}" is unavailable`,"BACKEND_UNAVAILABLE",n,r);K(this,"code","BACKEND_UNAVAILABLE");this.name="BackendUnavailable"}}class CP extends En{constructor(n,r={}){super(`Backend "${n}" is incompatible`,"BACKEND_INCOMPATIBLE",n,r);K(this,"code","BACKEND_INCOMPATIBLE");this.name="BackendIncompatible"}}class RP extends En{constructor(n,r,i={}){super(`Backend "${n}" is under maintenance`,"BACKEND_MAINTENANCE",n,i);K(this,"code","BACKEND_MAINTENANCE");this.retryAfterSeconds=r,this.name="BackendMaintenance"}}class AP extends En{constructor(n,r,i,s={}){super(`Backend "${n}" is blocked on an unmet activation prerequisite`,"BACKEND_BLOCKED",n,s);K(this,"code","BACKEND_BLOCKED");this.blockers=r,this.retryAfterSeconds=i,this.name="BackendBlocked"}}class OP extends En{constructor(n,r={}){super(`Backend "${n}" returned a bad gateway response`,"BAD_GATEWAY",n,r);K(this,"code","BAD_GATEWAY");this.name="BackendBadGateway"}}class au extends En{constructor(n,r){super(r,"STATUS_QUERY_FAILED",void 0,{status:n??void 0});K(this,"code","STATUS_QUERY_FAILED");this.httpStatus=n,this.name="BackendStatusQueryError"}}const lu=t=>{const e=t.headers.get("Retry-After");if(e===null||!/^\d+$/.test(e))return null;const n=Number(e);return Number.isSafeInteger(n)?n:null},MP=t=>{const e=zt(ab).safeParse(t);return e.success?e.data:[]},hr=(t,e)=>(n,r,i,s)=>new En(i.message??e,t,n,{...s,status:r.status}),cb={DISABLED:(t,e,n,r)=>new hf(t,r),NOT_APPROVED:(t,e,n,r)=>new lb(t,r),ROUTE_NOT_FOUND:(t,e,n,r)=>new td(t,{...r,code:"ROUTE_NOT_FOUND"}),BACKEND_STARTING:(t,e,n,r)=>new xP(t,lu(e),r),BACKEND_UNAVAILABLE:(t,e,n,r)=>new PP(t,r),BACKEND_INCOMPATIBLE:(t,e,n,r)=>new CP(t,r),BACKEND_MAINTENANCE:(t,e,n,r)=>new RP(t,lu(e),r),BACKEND_BLOCKED:(t,e,n,r)=>new AP(t,MP(n.detail),lu(e),r),BAD_GATEWAY:(t,e,n,r)=>new OP(t,r),BAD_REQUEST:hr("BAD_REQUEST","Backend request was rejected"),INTERNAL:hr("INTERNAL","Backend request failed"),SERVER_BUSY:hr("SERVER_BUSY","Backend request intake is busy"),REQUEST_TIMEOUT:hr("REQUEST_TIMEOUT","Backend request timed out"),SCRIPT_FAILED:hr("SCRIPT_FAILED","Backend script failed"),SCRIPT_TIMEOUT:hr("SCRIPT_TIMEOUT","Backend script timed out"),BACKEND_BUSY:hr("BACKEND_BUSY","Backend is busy"),BACKEND_BODY_TOO_LARGE:hr("BACKEND_BODY_TOO_LARGE","Backend request body is too large"),BACKEND_OUTPUT_TOO_LARGE:hr("BACKEND_OUTPUT_TOO_LARGE","Backend output is too large"),CSRF_REQUIRED:hr("CSRF_REQUIRED","Backend request requires CSRF protection"),UNAUTHORIZED:hr("UNAUTHORIZED","Backend request is unauthorized")},NP="X-Mndw-Error",LP="INTERNAL",IP="Backend platform request failed",zP=t=>Object.prototype.hasOwnProperty.call(cb,t)?t:void 0,DP=t=>{if(!t)return"";const e=new URLSearchParams;for(const[r,i]of Object.entries(t))e.set(r,String(i));const n=e.toString();return n?`?${n}`:""},HP=t=>t===null||typeof t!="object"?!1:!(t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||t instanceof URLSearchParams||t instanceof ReadableStream),BP=t=>t.startsWith("https:")?"wss:":"ws:",bp=(t,e)=>t.enabled?t.approval!=="approved"?new lb(e):null:new hf(e),UP=async(t,e)=>{if(e.ok||e.redirected!==!1||!e.headers.has(NP))return e;let n;try{n=await e.clone().json()}catch{n=void 0}const r=El(n)&&El(n.error)?n.error:void 0,i={code:typeof(r==null?void 0:r.code)=="string"?r.code:void 0,message:typeof(r==null?void 0:r.message)=="string"?r.message:void 0,detail:r==null?void 0:r.detail},s=i.code?zP(i.code):void 0,o={status:e.status,details:i.detail};throw s?cb[s](t,e,i,o):new En(i.message??IP,LP,t,o)},$P=t=>El(t)&&t.name==="AbortError",jP=async(t,e,n,r)=>{const i=`${t.origin}/api/plugins/${t.pluginName}/${e.path}${DP(r.query)}`,s=new Headers(r.headers);e.method!=="GET"&&e.method!=="HEAD"&&s.set("X-Mndw-Csrf","1");let o;r.body!==void 0&&r.body!==null&&(HP(r.body)?(o=JSON.stringify(r.body),s.has("content-type")||s.set("content-type","application/json")):o=r.body);const a=await t.fetchImpl(i,{method:e.method,headers:s,body:o,signal:r.signal});return UP(n,a)},FP=(t,e)=>{const n=new EventTarget,r=Object.assign(n,{binaryType:"blob",bufferedAmount:0,extensions:"",onclose:null,onerror:null,onmessage:null,onopen:null,protocol:"",readyState:3,url:"",close:()=>{},send:i=>{throw new DOMException("WebSocket is already in CLOSING or CLOSED state","InvalidStateError")}});return queueMicrotask(()=>{var s;const i=new Event("close");Object.defineProperties(i,{code:{value:t,enumerable:!0},reason:{value:e,enumerable:!0},wasClean:{value:!0,enumerable:!0}}),r.dispatchEvent(i),(s=r.onclose)==null||s.call(r,i)}),r};function _p(t,e,n={}){const r={pluginName:t,descriptor:e,fetchImpl:n.fetch??globalThis.fetch.bind(globalThis),WebSocketCtor:n.WebSocketCtor??globalThis.WebSocket,origin:n.origin??(typeof location<"u"?location.origin:"http://localhost")},i=()=>new En(`Plugin "${t}" has no backend declared; declare the manifest backend field.`,"BACKEND_NOT_DECLARED"),s=async(a,l={})=>{if(e===void 0)throw i();const c=e.routes[a];if(!c)throw new td(a);if(c.transport!=="http"||!c.method)throw new vp(a,"http");const u=bp(e,a);return u?Promise.reject(u):jP(r,c,a,l)};function o(a,l={}){return s(a,l).then(async c=>{var p,m;if(!c.ok){const g=await c.text();throw new En(`Backend route "${a}" returned HTTP ${c.status}`,"HTTP_ERROR",a,{status:c.status,details:g})}const u=((m=(p=c.headers.get("content-type"))==null?void 0:p.split(";",1)[0])==null?void 0:m.trim().toLowerCase())??"",f=l.as??(u==="application/json"||u.endsWith("+json")?"json":u.startsWith("text/")?"text":"blob");if(f==="text")return c.text();if(f==="blob")return c.blob();const h=await c.text();try{return JSON.parse(h)}catch(g){throw $P(g)?g:new En(`Backend route "${a}" returned invalid JSON`,"INVALID_RESPONSE",a,{status:c.status,details:h})}})}return{fetch(a,l={}){return s(a,l)},call:o,socket(a,l={}){if(e===void 0)throw i();const c=e.routes[a];if(!c)throw new td(a);if(c.transport!=="websocket")throw new vp(a,"websocket");const u=bp(e,a);if(u)return FP(u instanceof hf?mp.disabled:mp.notApproved,u.message);const f=`${BP(r.origin)}//${r.origin.replace(/^[a-z]+:\/\//,"")}/ws/plugins/${r.pluginName}/${c.path}`,h=l.protocols??c.protocols;return new r.WebSocketCtor(f,h)},async status(a={}){if(e===void 0)throw i();const l=`${r.origin}/api/plugins/${r.pluginName}/_mndw/status`;return r.fetchImpl(l,{method:"GET",signal:a.signal}).then(async c=>{if(!c.ok)throw new au(c.status,`Backend status query failed with HTTP ${c.status}`);try{return EP.parse(await c.json())}catch(u){throw u instanceof au?u:new au(c.status,"Backend status response is invalid")}})}}}class wp extends Error{constructor(n,r){super(r);K(this,"status");this.name="TelemetryError",this.status=n}}const _i=t=>typeof t=="number"&&Number.isFinite(t),GP=["unanchored","anchored","suspect"],VP=t=>{if(t===void 0)return;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("telemetry clock is invalid");const e=t,{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}=e;if(typeof n!="string"||!GP.includes(n))throw new Error("telemetry clock state is invalid");if(r!==null&&(!_i(r)||!Number.isInteger(r)||r<0))throw new Error("telemetry clock historyEndMs must be a non-negative integer or null");if(typeof i!="boolean"||typeof s!="boolean")throw new Error("telemetry clock flags must be booleans");if(r===null&&i)throw new Error("telemetry clock cannot be current without history");return{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}},ZP=new Set(["accent","success","warning","muted"]),WP=t=>{if(typeof t!="string"||!ZP.has(t))throw new Error(`invalid projected chart color: ${String(t)}`);return t},yp=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected point in ${e} is invalid`);const n=t;if(!_i(n.time))throw new Error(`projected point time in ${e} is invalid`);if(n.value!==null&&!_i(n.value))throw new Error(`projected point value in ${e} must be finite or null`);return{time:n.time,value:n.value===null?Number.NaN:n.value}},qP=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected band point in ${e} is invalid`);const n=t;if(!_i(n.time)||!_i(n.min)||!_i(n.max))throw new Error(`projected band point in ${e} is invalid`);return{time:n.time,min:n.min,max:n.max}},KP=(t,e)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`projected series ${t} is invalid`);const n=e;if(typeof n.supported!="boolean")throw new Error(`projected series ${t} supported is invalid`);if(typeof n.unit!="string"||n.unit.length===0)throw new Error(`projected series ${t} has invalid unit`);if(n.label!==void 0&&n.label!==null&&typeof n.label!="string")throw new Error(`projected series ${t} label is invalid`);if(!Array.isArray(n.points)||!Array.isArray(n.segments)||!Array.isArray(n.bands))throw new Error(`projected series ${t} arrays are invalid`);const r=n.points.map(a=>yp(a,t)),i=n.segments.map(a=>{if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`projected segment in ${t} is invalid`);const l=a;if(!Array.isArray(l.data))throw new Error(`projected segment data in ${t} is invalid`);return{data:l.data.map(c=>yp(c,t))}}),s=n.bands.map(a=>{if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`projected band in ${t} is invalid`);const l=a;if(typeof l.id!="string"||!Array.isArray(l.data))throw new Error(`projected band in ${t} is invalid`);return{id:l.id,data:l.data.map(c=>qP(c,t)),color:WP(l.color)}});let o;if(n.valueDomain!==void 0&&n.valueDomain!==null){if(typeof n.valueDomain!="object"||Array.isArray(n.valueDomain))throw new Error(`projected series ${t} valueDomain is invalid`);const a=n.valueDomain;if(!_i(a.min)||!_i(a.max))throw new Error(`projected series ${t} valueDomain is invalid`);o={min:a.min,max:a.max}}return{label:typeof n.label=="string"?n.label:void 0,supported:n.supported,unit:n.unit,points:r,segments:i,bands:s,valueDomain:o}},YP=t=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("projected telemetry response must be an object");const e=t,n=e.gathering;if(n===null||typeof n!="object"||Array.isArray(n)||typeof n.enabled!="boolean")throw new Error("projected telemetry gathering is invalid");const r=e.keys;if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("projected telemetry keys are invalid");const i={};for(const[s,o]of Object.entries(r))i[s]=KP(s,o);return{keys:i,gathering:{enabled:n.enabled},clock:VP(e.clock),sessionConfigured:typeof e.sessionConfigured=="boolean"?e.sessionConfigured:!1}},XP=t=>t!==null&&typeof t=="object"&&"name"in t&&t.name==="AbortError";function JP(t=globalThis.fetch){const e=async(n,r,i)=>{const s=await t(n,{method:"GET",cache:"no-store",signal:i.signal});if(!s.ok)throw new wp(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw XP(o)?o:new wp(s.status,o instanceof Error?o.message:i.invalidResponseMessage)}};return{async fetchProjected(n,r={}){return e(`/api/mndw/telemetry?project=${n}`,YP,{signal:r.signal,unavailableMessage:"Projected telemetry is unavailable.",invalidResponseMessage:"Invalid projected telemetry response."})}}}const pf=t=>e=>{if(e.code!=="unrecognized_keys")return;const n=[...e.keys].sort()[0]??"<unknown>";return`${t} contains unknown field "${n}"`},QP=pe().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"name must be lowercase alphanumeric with hyphens (e.g. my-widget)"}),eC=t=>!t.startsWith("/")&&!t.includes("..")&&!t.includes("\\")&&!t.split("/").some(e=>e==="."||e===".."),ub=t=>{const e=t.split("/").filter(Boolean);return!!e[e.length-1]},gf=pe().min(1).refine(eC,{message:"must be a safe relative path"}),tC=gf.refine(ub,{message:"entry must include a file name"}),nd=t=>{try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}},nC=pe().min(1).superRefine((t,e)=>{const n=nd(t);n===void 0?e.addIssue({code:"custom",message:"must be a valid BCP-47 locale tag"}):n!==t&&e.addIssue({code:"custom",message:`must use canonical BCP-47 spelling (${n})`})}),rC=gf.refine(t=>t.endsWith(".json"),{message:"catalog path must end with .json"}),iC=Xe({defaultLocale:nC,locales:Vs(pe(),rC)}).strict().superRefine((t,e)=>{const n=Object.keys(t.locales);n.length===0&&e.addIssue({code:"custom",path:["locales"],message:"locales must contain at least one locale"});const r=new Map;for(const s of n){const o=nd(s);if(o===void 0){e.addIssue({code:"custom",path:["locales",s],message:"must be a valid BCP-47 locale tag"});continue}o!==s&&e.addIssue({code:"custom",path:["locales",s],message:`must use canonical BCP-47 spelling (${o})`});const a=r.get(o);a!==void 0&&a!==s?e.addIssue({code:"custom",path:["locales",s],message:`canonical locale collides with ${a}`}):r.set(o,s)}const i=nd(t.defaultLocale);i!==void 0&&!r.has(i)&&e.addIssue({code:"custom",path:["defaultLocale"],message:"defaultLocale must be present in locales"})}),db=pe().regex(/^[a-z0-9][a-z0-9+_.-]*$/),fb=Sn(["session","public"]).default("session"),sC=pe().transform(t=>t.toUpperCase()).pipe(Sn(["GET","HEAD","POST","PUT","PATCH","DELETE"])),hb=t=>{if(t.length===0||t.startsWith("/")||t.includes("\\")||t.includes("?")||t.includes("#"))return!1;let e;try{e=decodeURIComponent(t)}catch{return!1}if(e!==t||e.includes("%")||e.startsWith("/")||e.includes("\\"))return!1;const n=e.split("/");return n.every(r=>r.length>0&&r!=="."&&r!=="..")&&n[0]!=="_mndw"},pb=gf.regex(/^backend\//,{message:"command must start with backend/"}).refine(ub,{message:"command must include a file name"}).refine(t=>!t.split("/").some(e=>e==="."||e===".."),{message:"command must not contain dot segments"}),oC=pe().min(1).refine(t=>[...t].every(e=>{const n=e.codePointAt(0)??0;return n>31&&n!==127}),{message:"args must not contain control characters"}),gb=Xe({id:pe().min(1),transport:Zt("http"),method:sC,path:pe().refine(hb,{message:"path must be canonical and safe"}),access:fb}),aC=Xe({id:pe().min(1),transport:Zt("websocket"),path:pe().refine(hb,{message:"path must be canonical and safe"}),access:fb,protocols:zt(pe().min(1)).optional()}),lC=gb.extend({command:pb}),mb=(t,e)=>{const n=t.map(i=>i.id);new Set(n).size!==n.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate id"});const r=t.map(i=>i.transport==="http"?`${i.transport}:${i.method}:${i.path}`:`${i.transport}:${i.path}`);new Set(r).size!==r.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate route tuple"});for(const i of t)i.transport==="http"&&i.access==="public"&&!["GET","HEAD"].includes(i.method??"")&&e.addIssue({code:"custom",message:"public HTTP routes may only use GET or HEAD"})},cC=Xe({kind:Zt("exec"),packages:zt(db).optional(),routes:zt(lC).min(1,{message:"backend.routes must contain at least one route"})}).strict().superRefine((t,e)=>{mb(t.routes,e)}),uC=Xe({kind:Zt("service"),protocolVersion:pn().int().positive(),command:pb,args:zt(oC).optional(),packages:zt(db).optional(),routes:zt(hi([gb,aC])).min(1,{message:"backend.routes must contain at least one route"})}).strict().superRefine((t,e)=>{mb(t.routes,e)}),dC=hi([cC,uC]),kp=pn().int({message:"gridColumns must be an integer"}).min(1,{message:"gridColumns must be at least 1"}).max(12,{message:"gridColumns must be at most 12"}),Ep=pn().int().positive(),fC=Zt(1).describe("Manifest format version. Must be 1."),hC=QP.describe("Unique plugin id used as the on-disk folder and URL segment."),pC=pe().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,{message:"version must be valid SemVer (for example, 1.2.3)"}).describe("Semantic version of this plugin."),gC=pe().min(1).describe("Human-readable name shown in the dashboard or navigation."),mC=pe().refine(t=>{const e=Array.from(t).length;return e>=1&&e<=160},{message:"Description must contain between 1 and 160 Unicode code points."}).meta({minLength:1,maxLength:160}).describe("Optional plain-text description in the plugin default language."),vC=tC.describe("Relative path to the bundled entry module."),bC=kv,_C=zt(bC).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"capabilities contains duplicate capability"})}),wC=Xe({w:kp,h:Ep,minW:kp.optional(),minH:Ep.optional()},{error:pf("size")}).strict().refine(t=>t.minW===void 0||t.minW<=t.w,{message:"size.minW must be less than or equal to size.w",path:["minW"]}).refine(t=>t.minH===void 0||t.minH<=t.h,{message:"size.minH must be less than or equal to size.h",path:["minH"]}),yC=pe().regex(/^\/[^/?#*]+$/).refine(t=>!sv(t),{message:"route is reserved by the host"}),vb={$schema:pe({error:"$schema must be a string"}).optional().describe("JSON Schema editor hint for this manifest."),manifestVersion:fC,name:hC,version:pC,label:gC,description:mC.optional(),entry:vC,capabilities:_C.optional(),i18n:iC.optional(),backend:dC.optional()},kC=Xe({...vb,type:Zt("widget"),size:wC},{error:pf("manifest")}).strict(),EC=Xe({...vb,type:Zt("page"),route:yC},{error:pf("manifest")}).strict(),SC=Jd("type",[kC,EC]),TC={permissions:"permissions was renamed to capabilities in 0.3",icon:"icon was removed in 0.3",fixedHeight:"fixedHeight was removed in 0.3"};class Sp extends Error{constructor(n,r){const i=r.map(o=>{const a=o.code==="unrecognized_keys"?[...o.path,[...o.keys].sort()[0]??"<unknown>"]:o.path;return{path:a.length===0?"<root>":a.join("."),message:o.message}}),s=i.map(o=>`${o.path}: ${o.message}`).join("; ");super(`Invalid manifest for "${n}": ${s}`);K(this,"issues");this.issues=i}}function bb(t){let e=t;if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const r=t,i=typeof r.name=="string"?r.name:"unknown";for(const[o,a]of Object.entries(TC))if(Object.prototype.hasOwnProperty.call(r,o))throw new Sp(i,[{code:"custom",path:[o],message:a}]);const s={...r};(r.type==="page"||r.type==="widget")&&delete s[r.type==="page"?"size":"route"],e=s}const n=SC.safeParse(e);if(!n.success){const r=typeof t=="object"&&t!==null&&typeof t.name=="string"?t.name:"unknown";throw new Sp(r,n.error.issues)}return delete n.data.$schema,n.data}Xe({cid:pe().optional(),mac:pe().optional(),ip:pe().optional(),fqdn:pe().optional(),"fqdn-certificate-valid":vi().optional(),capabilities:Vs(pe(),ju()).optional()}).passthrough();const xC=[{specifiers:["@rci-tools/core"],bundle:"rci-tools-core",version:"0.6.0",entryPoint:"@rci-tools/core",external:["rxjs","hash-wasm"],framework:"base"},{specifiers:["rxjs"],bundle:"rxjs",version:"7.8.2",entryPoint:"rxjs",framework:"base"},{specifiers:["rxjs/operators"],bundle:"rxjs-operators",version:"7.8.2",entryPoint:"rxjs/operators",framework:"base"},{specifiers:["hash-wasm"],bundle:"hash-wasm",version:"4.12.0",entryPoint:"hash-wasm",framework:"base"},{specifiers:["d3"],bundle:"d3",version:"7.9.0",entryPoint:"d3",framework:"base"},{specifiers:["@mndw/ui"],bundle:"mndw-ui",version:"0.3.1",entryPoint:"@mndw/ui",external:["d3"],framework:"base"},{specifiers:["vue"],bundle:"vue",version:"3.5.39",entryPoint:"vue",banner:"var __VUE_OPTIONS_API__=true,__VUE_PROD_DEVTOOLS__=false,__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=false;",framework:"vue"},{specifiers:["zone.js"],bundle:"zone",version:"0.15.1",entryPoint:"zone.js",framework:"angular"},{specifiers:["@angular/core","@angular/core/rxjs-interop"],bundle:"angular-core",version:"21.2.18",stdin:"export * from '@angular/core'; export * from '@angular/core/rxjs-interop';",external:["rxjs","rxjs/operators","@angular/compiler"],framework:"angular"},{specifiers:["@angular/common"],bundle:"angular-common",version:"21.2.18",entryPoint:"@angular/common",external:["rxjs","@angular/compiler","@angular/core"],framework:"angular"},{specifiers:["@angular/platform-browser"],bundle:"angular-platform-browser",version:"21.2.18",entryPoint:"@angular/platform-browser",external:["rxjs","@angular/compiler","@angular/core"],framework:"angular"},{specifiers:["@angular/compiler"],bundle:"angular-compiler",version:"21.2.18",entryPoint:"@angular/compiler",external:["rxjs"],framework:"angular"}],mf=()=>Object.fromEntries(xC.flatMap(t=>t.specifiers.map(e=>[e,t.version]))),PC=Sn(["builtin","registry","upload"]),CC=Sn(["pending","approved"]),RC=Sn(["ready","installing","failed"]),AC=Sn(["stopped","capacity_blocked","starting","ready","backoff","failed"]),OC=Xe({kind:Sn(["exec","service"]),packages:zt(pe()).optional(),args:zt(pe()).optional(),publicRoutes:zt(pe()).optional()}),MC=Vs(pe(),vi()).superRefine((t,e)=>{for(const n of Object.keys(t))px(n)||e.addIssue({code:"custom",path:[n],message:"only persistent RCI capabilities may be granted"})}),NC=Xe({transport:Sn(["http","websocket"]),path:pe(),method:Sn(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:zt(pe()).optional()}),LC=Xe({routes:Vs(pe(),NC)}),IC=Xe({w:pn(),h:pn(),minW:pn().optional(),minH:pn().optional()}),zC=Xe({defaultLocale:pe(),locales:Vs(pe(),pe())}),DC=Xe({state:AC,restartCount:pn(),consecutiveFailures:pn(),startedAt:pe().optional(),nextAttemptAt:pe().optional(),lastExit:pe().optional(),lastError:pe().optional(),recentStderr:zt(pe()).optional(),requiredProtocol:pn().optional(),compatible:vi().optional(),supportedProtocols:zt(pn()).optional()}),HC=Xe({sdkVersion:pe(),sharedDependencies:Vs(pe(),pe())}),_b={name:pe(),version:pe(),label:pe(),description:pe().optional(),entry:pe(),source:PC,approval:CC,enabled:vi(),capabilities:zt(kv).optional(),capabilityGrants:MC.optional(),depsStatus:RC,backend:LC,review:OC.optional(),i18n:zC.optional(),catalogBaseUrl:pe().optional(),runtime:DC.optional(),lock:HC.optional()},BC=Xe({..._b,type:Zt("widget"),size:IC}),UC=Xe({..._b,type:Zt("page"),route:pe()}),wb=Jd("type",[BC,UC]),$C=Xe({plugins:zt(wb)}),yb=t=>$C.parse(t).plugins,cu=t=>wb.parse(t),Sl=new Si;function fc(t){return Sl.get(t)??"ready"}function Ns(t){Sl.clear();for(const e of t)Sl.set(e.name,e.depsStatus)}let jC=0,Ia=null,Tp;function FC(){clearTimeout(Tp),Tp=void 0,Ia==null||Ia.abort(),Ia=null,jC+=1}let Bo=0,Uo=new AbortController;function GC(t=!1){return Uo.abort(),Uo=new AbortController,Bo+=1,t||(Z.pluginLoadError=null),Z.authInitInFlight=!0,Bo}function Dr(){return Bo}function VC(){return Uo.signal}function ZC(t){t===Bo&&(Z.authInitInFlight=!1)}const Z=at({authenticated:!1,ready:!1,authInitInFlight:!1,pluginLoadRevision:0,pluginLoadFailureSeq:0,hostInfo:null,deviceInfo:null,pluginLoadError:null,loginError:null,loginUsername:"",mobileSidebarOpen:!1,desktopSidebarCollapsed:!1,theme:"dark",locale:"en",localeSwitchPending:!1});function uu(){fa().matches?Z.mobileSidebarOpen=!Z.mobileSidebarOpen:Z.desktopSidebarCollapsed=!Z.desktopSidebarCollapsed}function hc(){Bo+=1,Uo.abort(),Uo=new AbortController,FC(),Z.authenticated=!1,Z.ready=!1,Z.authInitInFlight=!1,Z.pluginLoadError=null,Z.loginError=null,Z.loginUsername="",Z.pluginLoadFailureSeq=0,Z.hostInfo=null,Z.deviceInfo=null}const WC={loading:"Loading…",error:"Something went wrong.","plugin-load-error":"Couldn't load plugins."},qC={"toggle-menu":"Toggle menu",close:"Close navigation",dashboard:"Dashboard","package-manager":"Entware","page-load-failed":"Page failed to load",settings:"Settings","light-theme":"Switch to light theme","dark-theme":"Switch to dark theme","color-theme":"Toggle color theme",language:"Language","language-english":"Switch to English","language-russian":"Switch to Russian",logout:"Log out"},KC={"add-widget":"Add widget","arrange-widgets":"Arrange widgets","no-widgets":"No widgets available",preparing:"preparing…",unavailable:"unavailable","move-up":"Move {label} up","move-down":"Move {label} down","remove-widget":"Remove {label}","preparing-dependencies":"Preparing… installing dependencies","dependency-install-failed":"Dependency install failed","plugin-load-failed":"Plugin “{label}” failed to load","retry-plugin-load":"Retry","remove-failed-plugin":"Remove","widget-error":"Error loading widget","empty-error-title":"Widgets unavailable","empty-error-text":"Plugins could not be loaded — see the message above.","empty-no-plugins":"No enabled plugins provide widgets.","empty-install-plugins":"Manage plugins","empty-title":"Dashboard is empty","empty-add-widget":"Add a widget to get started.","widget-removed":"Widget “{label}” removed","layout-save-failed":"Dashboard changes were not saved. Browser storage may be unavailable or full."},YC=JSON.parse(`{"title":"Settings","general-tab":"General","diagnostics-tab":"Diagnostics","plugins-tab":"Plugins","self-update-tab":"Update mndw","self-update-description":"Check for and safely install a new mndw package, or restore the previous package.","self-update-current":"Running version: {version}","self-update-rollback":"Rollback version: {version}","self-update-available":"Update available: {version}","self-update-check":"Check for updates","self-update-apply":"Apply update","self-update-revert":"Revert","self-update-confirm-update-title":"Confirm update","self-update-confirm-revert-title":"Confirm revert","self-update-confirm-update":"Install update to {version}? mndw will restart.","self-update-confirm-revert":"Revert to {version}? mndw will restart.","self-update-progress-title":"mndw update","self-update-checking":"Checking…","self-update-preparing":"Preparing update…","self-update-updating":"Updating to {version}…","self-update-reverting":"Reverting to {version}…","self-update-success":"Update complete. Running version: {version}","self-update-busy":"Entware is busy installing or updating packages. Try again shortly.","self-update-no-update":"No update is available. Check again later.","self-update-rollback-unavailable":"No rollback is available.","self-update-unconfirmed":"Update started, but its final state could not be confirmed. Check again.","self-update-unconfirmed-modal":"Unable to confirm self-update completion. Check status again after closing this dialog.","self-update-failure-generic":"Self-update failed. Check again or retry later.","self-update-failure-update-missing":"Update package was not found.","self-update-failure-opkg-install-failed":"Update package installation failed.","self-update-failure-opkg-revert-failed":"Rollback package installation failed.","self-update-failure-rollback-missing":"Rollback package was not found.","self-update-failure-helper-exited":"Update helper stopped before completion.","self-update-failure-unexpected-version":"Device version changed unexpectedly during update.","self-update-failure-state-corrupt":"Self-update state is corrupted. Check again.","general":"General","language":{"label":"Language","english":"English","russian":"Русский","pending":"Applying language…"},"appearance":"Interface","dark-theme":"Dark theme","device":"Device","telemetry-label":"Background telemetry","telemetry-toggle":"Enable telemetry","telemetry-description":"Store CPU, memory, and temperature history for 30 days.","telemetry-session-note":"A background router access session is needed for telemetry.","telemetry-session-link":"Configure background router access","telemetry-wear-note":"Telemetry collection will increase the load on the storage device where Entware is installed and may accelerate its wear.","telemetry-error":"Could not update background telemetry.","name":"Name:","vendor":"Vendor:","firmware":"Firmware:","device-unavailable":"Device info unavailable.","persistent-rci-title":"Background router access","persistent-rci-description":"mndw keeps its own RCI sign-in to this router so telemetry history and plugins work without an open browser tab. Tokens stay inside mndw.","persistent-loading":"Loading background router access…","configure-persistent":"Configure background router access","persistent-tokenless-toggle":"Controller and extender access","persistent-tokenless-description":"No controller token is needed on this firmware.","persistent-needs-token":"Firmware now requires a controller token for background router access.","persistent-storage-disabled":"Background router access storage is disabled.","persistent-storage-decrypt-failed":"Background router access storage could not be decrypted.","controller-token":"Controller token","controller-token-hint":"Create a token in the router's web interface on the Users & Access page, or in the router's command line.","controller-token-set-placeholder":"Token is set","test":"Test","save":"Save","clear-controller-session":"Clear controller access","clear-controller-session-title":"Clear controller access?","clear-controller-session-confirm":"Persistent RCI sessions will stop until you save a controller token again.","update-firmware-persistent":"Update device firmware to enable background router access.","controller-token-valid":"Controller token is valid","persistent-extenders-title":"Extenders","persistent-extenders-summary":"Extenders ({count})","persistent-extenders-summary-problems":"Extenders ({count}) · {problems} without access","persistent-enumeration-stale":"Extender membership is temporarily stale; live connections are still monitored.","extender-reason-certificate-invalid":"certificate is invalid","extender-reason-no-auth-token":"auth-token capability unavailable","extender-reason-missing-fqdn":"secure relay name unavailable","extender-state-offline":"offline","extender-state-establishing":"coming online","extender-state-live":"connected","extender-state-dead":"reconnecting","persistent-state-unavailable":"Background router access state unavailable","persistent-request-failed":"Background router access request failed","controller-token-rejected":"Controller token rejected","firmware-unsupported":"Device firmware does not support background router access","device-unreachable":"Device unreachable","palette-import-aria-label":"Import palette JSON","palette":{"title":"Palette","loading":"Loading palette…","reading":"Reading palette…","saved":"Saved.","drop":"Drop a palette JSON file here or choose one.","read-failed":"Could not read palette file.","invalid-json":"Invalid JSON file.","invalid-structure":"The palette file is invalid.","load-failed":"Could not load the palette.","operation-failed":"Could not update the palette.","preview-note":"Previewing the imported palette. Nothing is saved to the device until you confirm.","contrast-warnings":"Contrast warnings ({theme})","warning-item":"{pair}: {ratio} (needs {min})","theme-dark":"Dark theme","theme-light":"Light theme","confirm":"Confirm","discard":"Discard","reset-confirmation":"Discard the imported palette and return to the built-in colours?","reset-confirm":"Yes, reset","reset":"Reset to default","export":"Export palette"},"backend-capacity":"Backend capacity","backend-approval-title":"Approve backend for {label}","backend-approval-declaration":"declares a backend. Review its capabilities before approving.","backend-approval-deny":"Deny","backend-approval-approve":"Approve","plugin-risk-warning-intro":"Plugins run with full access.","plugin-risk-warning-page":"A plugin page runs in this dashboard and can call the router API; if it has a backend, that backend runs on the router as root.","plugin-risk-warning-trust":"Manifest capabilities describe what the plugin asks for; they are not a sandbox. Install plugins only from authors you trust.","upload-plugin-zip":"Upload plugin ZIP","diagnostics-description":"Download recent daemon and plugin runtime state for troubleshooting.","download-diagnostics":"Download diagnostics","downloading":"Downloading…","diagnostics-failed":"Diagnostics download failed","plugin-manager":{"title":"Plugin manager","plugin-updated-notice":"A newer plugin version is installed. Reload to use it.","reload-now":"Reload now","later":"Later","loading":"Loading plugins…","retry":"Retry","dismiss":"Dismiss","keep-notice":"Keep","diagnostics":"Diagnostics","last-error":"Last error","exec":"Exec","services":"Services","per-plugin-exec-limit":"Per-plugin exec limit","service-protocols":"Service protocols","runtime-status-unavailable":"Runtime status unavailable: {error}","maintenance-busy":"Plugin is busy with another maintenance operation. Try again shortly.","confirming-state":"Confirming plugin state…","operation-finishing":"Plugin operation is still finishing. Refresh to check again.","outcome-unknown":"Could not confirm restart outcome. Refresh to check plugin status.","installed-title":"Installed plugins","no-installed":"No plugins installed.","no-installed-next":"Upload a plugin to add it to this router.","version":"Version","type-widget":"Widget","type-page":"Page","builtin":"Built-in","uploaded":"Uploaded","installing-dependencies":"Installing dependencies…","dependency-install-failed":"Dependency install failed","plugin-load-failed":"Failed to load","plugin-load-timeout":"Did not load within {seconds} seconds","plugin-load-error":"The plugin file did not load or contains an error","version-mismatch":"Version mismatch","sdk-major-badge":"Built for another SDK version","load-version-warning":"Built against {versions}. Plugin still loads, but may misbehave with this host.","version-warning":{"title":"Version compatibility","sdk-major":"Built for @mndw/sdk {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","sdk-newer-minor":"Built for a newer @mndw/sdk ({pluginVersion}) than this dashboard provides ({hostVersion}). Some features may not work.","shared-major":"Built for {name} {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","install-anyway":"You can still install it."},"endpoint":"{count, plural, one {# endpoint} other {# endpoints}}","websocket":"{count, plural, one {# websocket} other {# websockets}}","persistent-rci-read":"Persistent RCI read","persistent-rci-write":"Persistent RCI write","refresh":"Refresh","enable":"Enable","disable":"Disable","restart-backend":"Restart backend","delete-confirmation":"Delete {label}? This cannot be undone.","cancel":"Cancel","delete-plugin":"Delete plugin","delete":"Delete","backend":"Backend","protocol":"Protocol","incompatible":"incompatible","supported-service-protocols":"Supported service protocols","runtime-state-stopped":"Stopped","runtime-state-capacity-blocked":"Waiting for a free slot","runtime-state-starting":"Starting","runtime-state-ready":"Running","runtime-state-backoff":"Restarting after a failure","runtime-state-failed":"Failed","pending-title":"Pending approvals","deny-confirmation":"Deny {label}? This cannot be undone.","deny-plugin":"Deny plugin","deny":"Deny","approve":"Approve","routes":"Routes","backend-kind-service":"Background process","backend-kind-exec":"Runs a command per request","packages":"Installs packages","service-args":"Service arguments","public-routes":"Public routes (reachable from the LAN without sign-in)","capabilities":"Capabilities","upload-drop":"Drop a plugin ZIP here or choose a file.","uploading":"Uploading plugin…","waiting-approval":"Waiting for approval…","installed-success":"Installed “{label}”.","approved-success":"Approved “{label}”.","choose-zip":"Choose a ZIP file.","empty-zip":"The ZIP file is empty.","zip-too-large":"The ZIP file exceeds the {limit} upload limit.","upload-limit-unit":"MiB","upload-target-mismatch":"{filename} targets {archiveTarget}, but this device reports {deviceTarget}. Choose the matching archive."}}`),XC={cancel:"Cancel",close:"Close",save:"Save",retry:"Retry",undo:"Undo"},JC={username:"Username",password:"Password",hint:"Use the router's administrator username and password.",submit:"Log in","logging-in":"Logging in…","invalid-credentials":"Invalid credentials","connection-failed":"Connection failed"},QC={region:"Notifications",dismiss:"Dismiss"},eR={tab:"Packages",title:"Entware packages",refresh:"Check for updates",reload:"Reload",search:"Search packages…","search-label":"Search packages",all:"All",installed:"Installed",updates:"Updates ({count})",selected:"({count} selected)","with-selected":"With selected:",install:"Install",remove:"Remove",update:"Update",installing:"Installing…",removing:"Removing…",updating:"Updating…","action-failed":"{action} failed","update-available":"Update available",available:"Available","select-package":"Select {name}","select-all":"Select all filtered packages",loading:"Loading…","load-failed":"Failed to load packages",empty:"No packages found","empty-next":"Refresh the package list to check again.","no-match":"No packages match your filter","no-match-next":"Try a different search or package filter.","show-all":"Show all packages",package:"Package",version:"Version",status:"Status",description:"Description",expand:"Expand {name}",collapse:"Collapse {name}",loaded:"{count} packages loaded","never-refreshed":"Metadata never refreshed","just-now":"Metadata refreshed just now","refreshed-ago":"Metadata refreshed {age}","detail-failed":"Failed to load package details",size:"Feed size","installed-size":"Installed size","installed-time":"Installed time",dependencies:"Dependencies","confirm-remove-title":"Confirm package removal","confirm-remove":"Remove {names}?",protected:"Protected package","dependency-conflict":"Can't remove {package}: it is required by {dependents}.","dependency-conflict-generic":"Can't remove {package}: it is required by other installed packages."},tR={tab:"Services",title:"Services",description:"Inspect and control device init services.",refresh:"Refresh states",service:"Service",state:"State",autostart:"Autostart",actions:"Actions",start:"Start",stop:"Stop",restart:"Restart",enabled:"Enabled",disabled:"Disabled","enable-at-boot":"Enable at boot","disable-at-boot":"Disable at boot",pid:"PID {pid}","autostart-pinned":"Autostart is fixed by ENABLED= in the script","probe-failed":"Unknown",empty:"No services found","empty-next":"Refresh to check the service list again.","load-failed":"Failed to load services",unavailable:"No service manager available","unavailable-description":"This device does not expose an init service directory.",protected:"Protected service","confirm-title":"Confirm service action",confirm:"{action} service {name}?","confirm-enable-boot":"Enable {name} at boot? The running service is unchanged until reboot.","confirm-disable-boot":"Disable {name} at boot? The running service is unchanged until reboot."},nR={"device-timeout":"The device did not respond.","invalid-manifest":"The plugin manifest is invalid.","invalid-zip":"The file is not a valid ZIP archive.","manifest-missing":"The archive has no manifest.json at its root.","unsupported-manifest-version":"This plugin manifest version is no longer supported.",conflict:"A plugin with that name already exists.","upload-too-large":"The plugin exceeds the {limit} upload limit.","opkg-failed":"Installing the plugin's system packages failed.","daemon-failed":"Starting the plugin's backend failed.",unauthorized:"Your session has expired. Please log in again.","service-capacity":"No service capacity is available. Stop another backend and try again.","backend-busy":"The backend is busy. Try again shortly.","backend-unavailable":"The backend is unavailable.","backend-incompatible":"This backend requires an unsupported protocol version.","backend-maintenance":"The backend is being updated. Try again shortly.","controller-session-unavailable":"Controller token session is unavailable.","rci-socket-start-failed":"Background router access could not start. Try again."},kb={app:WC,nav:qC,dashboard:KC,settings:YC,"page-plugin":{opening:"Opening {title}…","open-error":"Could not open the page of plugin {title}.","load-failed":"Page “{title}” failed to load",slow:"The plugin is taking too long to respond."},"plugin-load":{failed:"Plugins failed to load: {names}",loaded:"Plugins loaded"},common:XC,login:JC,toast:QC,packages:eR,services:tR,errors:nR},rR={loading:"Загрузка…",error:"Произошла ошибка.","plugin-load-error":"Не удалось загрузить плагины."},iR={"toggle-menu":"Переключить меню",close:"Закрыть навигацию",dashboard:"Дашборд","package-manager":"Entware","page-load-failed":"Не удалось загрузить страницу",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},sR={"add-widget":"Добавить виджет","arrange-widgets":"Упорядочить виджеты","no-widgets":"Нет доступных виджетов",preparing:"подготовка…",unavailable:"недоступен","move-up":"Переместить {label} выше","move-down":"Переместить {label} ниже","remove-widget":"Удалить {label}","preparing-dependencies":"Подготовка… установка зависимостей","dependency-install-failed":"Не удалось установить зависимости","plugin-load-failed":"Не удалось загрузить плагин «{label}»","retry-plugin-load":"Повторить","remove-failed-plugin":"Удалить","widget-error":"Не удалось загрузить виджет","empty-error-title":"Виджеты недоступны","empty-error-text":"Не удалось загрузить плагины — см. сообщение выше.","empty-no-plugins":"Ни один включённый плагин не предоставляет виджетов.","empty-install-plugins":"Управление плагинами","empty-title":"Дашборд пуст","empty-add-widget":"Добавьте виджет, чтобы начать.","widget-removed":"Виджет «{label}» удалён","layout-save-failed":"Изменения дашборда не сохранены. Хранилище браузера может быть недоступно или заполнено."},oR=JSON.parse('{"title":"Настройки","general-tab":"Общие","diagnostics-tab":"Диагностика","plugins-tab":"Плагины","self-update-tab":"Обновление mndw","self-update-description":"Проверяйте и безопасно устанавливайте новую версию mndw или восстанавливайте предыдущую.","self-update-current":"Текущая версия: {version}","self-update-rollback":"Версия для отката: {version}","self-update-available":"Доступно обновление: {version}","self-update-check":"Проверить обновления","self-update-apply":"Установить обновление","self-update-revert":"Откатить","self-update-confirm-update-title":"Подтвердите обновление","self-update-confirm-revert-title":"Подтвердите откат","self-update-confirm-update":"Установить обновление до версии {version}? mndw будет перезапущен.","self-update-confirm-revert":"Откатить до версии {version}? mndw будет перезапущен.","self-update-progress-title":"Обновление mndw","self-update-checking":"Проверка…","self-update-preparing":"Подготовка обновления…","self-update-updating":"Обновление до {version}…","self-update-reverting":"Откат до {version}…","self-update-success":"Обновление завершено. Текущая версия: {version}","self-update-busy":"Entware занят установкой или обновлением пакетов. Повторите попытку позже.","self-update-no-update":"Обновление недоступно. Повторите проверку позже.","self-update-rollback-unavailable":"Откат недоступен.","self-update-unconfirmed":"Обновление запущено, но результат не подтверждён. Проверьте состояние ещё раз.","self-update-unconfirmed-modal":"Не удалось подтвердить завершение обновления. Закройте диалог и проверьте состояние ещё раз.","self-update-failure-generic":"Не удалось обновить систему. Повторите попытку позже.","self-update-failure-update-missing":"Пакет обновления не найден.","self-update-failure-opkg-install-failed":"Не удалось установить пакет обновления.","self-update-failure-opkg-revert-failed":"Не удалось установить пакет отката.","self-update-failure-rollback-missing":"Пакет отката не найден.","self-update-failure-helper-exited":"Помощник обновления завершился раньше времени.","self-update-failure-unexpected-version":"Версия устройства неожиданно изменилась во время обновления.","self-update-failure-state-corrupt":"Состояние обновления повреждено. Выполните проверку снова.","general":"Общие","language":{"label":"Язык","english":"English","russian":"Русский","pending":"Применение языка…"},"appearance":"Интерфейс","dark-theme":"Тёмная тема","device":"Устройство","telemetry-label":"Фоновая телеметрия","telemetry-toggle":"Включить телеметрию","telemetry-description":"Хранить историю CPU, памяти и температуры в течение 30 дней.","telemetry-session-note":"Для телеметрии нужна сессия фонового доступа к роутеру.","telemetry-session-link":"Настроить фоновый доступ к роутеру","telemetry-wear-note":"Сбор телеметрии увеличит нагрузку на накопитель, на котором установлен Entware, и может ускорить его износ.","telemetry-error":"Не удалось обновить фоновую телеметрию.","name":"Имя:","vendor":"Производитель:","firmware":"Прошивка:","device-unavailable":"Информация об устройстве недоступна.","persistent-rci-title":"Фоновый доступ к роутеру","persistent-rci-description":"mndw хранит собственную сессию входа на роутер, чтобы история телеметрии и плагины работали без открытой вкладки браузера. Токены остаются внутри mndw.","persistent-loading":"Загрузка фонового доступа к роутеру…","configure-persistent":"Настроить фоновый доступ к роутеру","persistent-tokenless-toggle":"Доступ к контроллеру и ретрансляторам","persistent-tokenless-description":"Для этой прошивки токен контроллера не нужен.","persistent-needs-token":"Для фонового доступа к роутеру прошивка требует токен контроллера.","persistent-storage-disabled":"Хранилище фонового доступа к роутеру отключено.","persistent-storage-decrypt-failed":"Не удалось расшифровать хранилище фонового доступа к роутеру.","controller-token":"Токен контроллера","controller-token-hint":"Токен создаётся в веб-интерфейсе роутера на странице «Пользователи и доступ» или в командной строке роутера.","controller-token-set-placeholder":"Токен задан","test":"Проверить","save":"Сохранить","clear-controller-session":"Удалить доступ к контроллеру","clear-controller-session-title":"Удалить доступ к контроллеру?","clear-controller-session-confirm":"Постоянные сессии RCI будут остановлены, пока вы снова не сохраните токен контроллера.","update-firmware-persistent":"Обновите прошивку устройства, чтобы включить фоновый доступ к роутеру.","controller-token-valid":"Токен контроллера действителен","persistent-extenders-title":"Ретрансляторы","persistent-extenders-summary":"Ретрансляторы ({count})","persistent-extenders-summary-problems":"Ретрансляторы ({count}) · без доступа: {problems}","persistent-enumeration-stale":"Список ретрансляторов временно устарел; активные подключения всё ещё проверяются.","extender-reason-certificate-invalid":"сертификат недействителен","extender-reason-no-auth-token":"возможность auth-token недоступна","extender-reason-missing-fqdn":"имя защищённого ретранслятора недоступно","extender-state-offline":"не в сети","extender-state-establishing":"подключается","extender-state-live":"подключён","extender-state-dead":"переподключается","persistent-state-unavailable":"Состояние фонового доступа к роутеру недоступно","persistent-request-failed":"Не удалось запросить состояние фонового доступа к роутеру","controller-token-rejected":"Токен контроллера отклонён","firmware-unsupported":"Прошивка устройства не поддерживает фоновый доступ к роутеру","device-unreachable":"Устройство недоступно","palette-import-aria-label":"Импорт JSON-палитры","palette":{"title":"Палитра","loading":"Загрузка палитры…","reading":"Чтение палитры…","saved":"Сохранено.","drop":"Перетащите JSON-файл палитры сюда или выберите файл.","read-failed":"Не удалось прочитать файл палитры.","invalid-json":"Файл содержит неверный JSON.","invalid-structure":"Файл палитры недействителен.","load-failed":"Не удалось загрузить палитру.","operation-failed":"Не удалось обновить палитру.","preview-note":"Предпросмотр импортированной палитры. На устройство ничего не сохранится, пока вы не подтвердите.","contrast-warnings":"Предупреждения о контрасте ({theme})","warning-item":"{pair}: {ratio} (минимум {min})","theme-dark":"Тёмная тема","theme-light":"Светлая тема","confirm":"Подтвердить","discard":"Не применять","reset-confirmation":"Сбросить импортированную палитру и вернуться к встроенным цветам?","reset-confirm":"Да, сбросить","reset":"Сбросить к встроенным цветам","export":"Экспорт палитры"},"backend-capacity":"Ёмкость серверной части","backend-approval-title":"Подтвердить серверную часть для {label}","backend-approval-declaration":"объявляет серверную часть. Проверьте её возможности перед подтверждением.","backend-approval-deny":"Отклонить","backend-approval-approve":"Подтвердить","plugin-risk-warning-intro":"Плагины работают с полным доступом.","plugin-risk-warning-page":"Страница плагина работает внутри mndw и может вызывать API роутера; если у плагина есть серверная часть, она запускается на роутере с правами root.","plugin-risk-warning-trust":"Доступы в манифесте описывают запросы плагина, но не изолируют его. Устанавливайте плагины только от авторов, которым доверяете.","upload-plugin-zip":"Загрузить ZIP плагина","diagnostics-description":"Скачать состояние демона и плагинов для диагностики.","download-diagnostics":"Скачать диагностику","downloading":"Скачивание…","diagnostics-failed":"Не удалось скачать диагностику","plugin-manager":{"title":"Менеджер плагинов","plugin-updated-notice":"Установлена новая версия плагина. Перезагрузите страницу, чтобы использовать её.","reload-now":"Перезагрузить сейчас","later":"Позже","loading":"Загрузка плагинов…","retry":"Повторить","dismiss":"Скрыть","keep-notice":"Оставить","diagnostics":"Диагностика","last-error":"Последняя ошибка","exec":"Exec","services":"Сервисы","per-plugin-exec-limit":"Лимит Exec для плагина","service-protocols":"Протоколы сервисов","runtime-status-unavailable":"Состояние серверной части недоступно: {error}","maintenance-busy":"Плагин занят другой операцией обслуживания. Повторите попытку позже.","confirming-state":"Проверка состояния плагина…","operation-finishing":"Операция с плагином ещё выполняется. Обновите страницу, чтобы проверить результат.","outcome-unknown":"Не удалось подтвердить результат перезапуска. Обновите страницу, чтобы проверить состояние плагина.","installed-title":"Установленные плагины","no-installed":"Плагины не установлены.","no-installed-next":"Загрузите плагин, чтобы добавить его на этот роутер.","version":"Версия","type-widget":"Виджет","type-page":"Страница","builtin":"Встроенный","uploaded":"Загруженный","installing-dependencies":"Установка зависимостей…","dependency-install-failed":"Не удалось установить зависимости","plugin-load-failed":"Не удалось загрузить","plugin-load-timeout":"Загрузка не завершилась за {seconds} с","plugin-load-error":"Файл плагина не загрузился или содержит ошибку","version-mismatch":"Несоответствие версии","sdk-major-badge":"Собран для другой версии SDK","load-version-warning":"Собрано для версий {versions}. Плагин всё ещё загружается, но может работать неправильно с этим хостом.","version-warning":{"title":"Совместимость версий","sdk-major":"Собрано для @mndw/sdk {pluginVersion}; эта версия mndw предоставляет {hostVersion}. Плагин может не работать.","sdk-newer-minor":"Собрано для более новой версии @mndw/sdk ({pluginVersion}), чем предоставляет эта версия mndw ({hostVersion}). Некоторые функции могут не работать.","shared-major":"Собрано для {name} {pluginVersion}; эта версия mndw предоставляет {hostVersion}. Плагин может не работать.","install-anyway":"Плагин всё равно можно установить."},"endpoint":"{count, plural, one {# конечная точка} few {# конечные точки} many {# конечных точек} other {# конечной точки}}","websocket":"{count, plural, one {# веб-сокет} few {# веб-сокета} many {# веб-сокетов} other {# веб-сокета}}","persistent-rci-read":"Чтение через постоянный RCI","persistent-rci-write":"Запись через постоянный RCI","refresh":"Обновить","enable":"Включить","disable":"Отключить","restart-backend":"Перезапустить серверную часть","delete-confirmation":"Удалить {label}? Это действие нельзя отменить.","cancel":"Отмена","delete-plugin":"Удалить плагин","delete":"Удалить","backend":"Серверная часть","protocol":"Протокол","incompatible":"несовместима","supported-service-protocols":"Поддерживаемые протоколы сервисов","runtime-state-stopped":"Остановлена","runtime-state-capacity-blocked":"Ожидает свободный слот","runtime-state-starting":"Запускается","runtime-state-ready":"Работает","runtime-state-backoff":"Перезапускается после сбоя","runtime-state-failed":"Ошибка","pending-title":"Ожидающие подтверждения","deny-confirmation":"Отклонить {label}? Это действие нельзя отменить.","deny-plugin":"Отклонить плагин","deny":"Отклонить","approve":"Подтвердить","routes":"Маршруты","backend-kind-service":"Фоновый процесс","backend-kind-exec":"Команда на каждый запрос","packages":"Устанавливает пакеты","service-args":"Аргументы сервиса","public-routes":"Публичные маршруты (доступны из локальной сети без входа)","capabilities":"Доступы","upload-drop":"Перетащите ZIP плагина сюда или выберите файл.","uploading":"Загрузка плагина…","waiting-approval":"Ожидание подтверждения…","installed-success":"Плагин «{label}» установлен.","approved-success":"Плагин «{label}» подтверждён.","choose-zip":"Выберите ZIP-файл.","empty-zip":"ZIP-файл пуст.","zip-too-large":"Размер ZIP-файла превышает лимит загрузки {limit}.","upload-limit-unit":"МБ","upload-target-mismatch":"Файл {filename} предназначен для {archiveTarget}, но устройство сообщает {deviceTarget}. Выберите подходящий архив."}}'),aR={cancel:"Отмена",close:"Закрыть",save:"Сохранить",retry:"Повторить",undo:"Отменить"},lR={username:"Имя пользователя",password:"Пароль",hint:"Используйте логин и пароль администратора роутера.",submit:"Войти","logging-in":"Выполняется вход…","invalid-credentials":"Неверные учётные данные","connection-failed":"Ошибка соединения"},cR={region:"Уведомления",dismiss:"Закрыть"},uR={tab:"Пакеты",title:"Пакеты Entware",refresh:"Проверить обновления",reload:"Перезагрузить",search:"Поиск пакетов…","search-label":"Поиск пакетов",all:"Все",installed:"Установленные",updates:"Обновления ({count})",selected:"(выбрано: {count})","with-selected":"С выбранными:",install:"Установить",remove:"Удалить",update:"Обновить",installing:"Установка…",removing:"Удаление…",updating:"Обновление…","action-failed":"Не удалось выполнить: {action}","update-available":"Доступно обновление",available:"Доступен","select-package":"Выбрать {name}","select-all":"Выбрать все отфильтрованные пакеты",loading:"Загрузка…","load-failed":"Не удалось загрузить пакеты",empty:"Пакеты не найдены","empty-next":"Обновите список пакетов, чтобы проверить ещё раз.","no-match":"Нет пакетов, соответствующих фильтру","no-match-next":"Измените поисковый запрос или фильтр пакетов.","show-all":"Показать все пакеты",package:"Пакет",version:"Версия",status:"Состояние",description:"Описание",expand:"Развернуть {name}",collapse:"Свернуть {name}",loaded:"Загружено пакетов: {count}","never-refreshed":"Метаданные ещё не обновлялись","just-now":"Метаданные обновлены только что","refreshed-ago":"Метаданные обновлены {age}","detail-failed":"Не удалось загрузить сведения о пакете",size:"Размер в репозитории","installed-size":"Установленный размер","installed-time":"Время установки",dependencies:"Зависимости","confirm-remove-title":"Подтвердите удаление пакета","confirm-remove":"Удалить {names}?",protected:"Защищённый пакет","dependency-conflict":"Невозможно удалить {package}: от него зависит {dependents}.","dependency-conflict-generic":"Невозможно удалить {package}: от него зависят другие установленные пакеты."},dR={tab:"Сервисы",title:"Сервисы",description:"Просмотр и управление сервисами устройства.",refresh:"Обновить состояния",service:"Сервис",state:"Состояние",autostart:"Автозапуск",actions:"Действия",start:"Запустить",stop:"Остановить",restart:"Перезапустить",enabled:"Включён",disabled:"Выключен","enable-at-boot":"Включать при загрузке","disable-at-boot":"Не включать при загрузке",pid:"PID {pid}","autostart-pinned":"Автозапуск задан строкой ENABLED= в скрипте","probe-failed":"Неизвестно",empty:"Сервисы не найдены","empty-next":"Обновите список, чтобы проверить сервисы ещё раз.","load-failed":"Не удалось загрузить сервисы",unavailable:"Менеджер сервисов недоступен","unavailable-description":"На устройстве нет доступного каталога init-сервисов.",protected:"Защищённый сервис","confirm-title":"Подтвердите действие с сервисом",confirm:"{action} сервис {name}?","confirm-enable-boot":"Включать {name} при загрузке? Работающий сервис не изменится до перезагрузки.","confirm-disable-boot":"Не включать {name} при загрузке? Работающий сервис не изменится до перезагрузки."},fR={"device-timeout":"Устройство не отвечает.","invalid-manifest":"Манифест плагина недействителен.","invalid-zip":"Файл не является ZIP-архивом.","manifest-missing":"В архиве нет manifest.json в корне.","unsupported-manifest-version":"Версия манифеста плагина больше не поддерживается.",conflict:"Плагин с таким именем уже существует.","upload-too-large":"Плагин превышает лимит загрузки {limit}.","opkg-failed":"Не удалось установить системные пакеты плагина.","daemon-failed":"Не удалось запустить серверную часть плагина.",unauthorized:"Сессия истекла. Войдите снова.","service-capacity":"Нет свободных сервисных ресурсов.","backend-busy":"Серверная часть занята. Повторите позже.","backend-unavailable":"Серверная часть недоступна.","backend-incompatible":"Протокол серверной части не поддерживается.","backend-maintenance":"Серверная часть обновляется. Повторите позже.","controller-session-unavailable":"Сессия токена контроллера недоступна.","rci-socket-start-failed":"Не удалось запустить фоновый доступ к роутеру. Повторите попытку."},hR={app:rR,nav:iR,dashboard:sR,settings:oR,"page-plugin":{opening:"Открываем {title}…","open-error":"Не удалось открыть страницу плагина {title}.","load-failed":"Не удалось загрузить страницу «{title}»",slow:"Плагин долго не отвечает."},"plugin-load":{failed:"Не удалось загрузить плагины: {names}",loaded:"Плагины загружены"},common:aR,login:lR,toast:cR,packages:uR,services:dR,errors:fR},pR={A:"Ȧ",B:"Ḃ",C:"Ç",D:"Ḋ",E:"Ḗ",F:"Ḟ",G:"Ġ",H:"Ḧ",I:"Ī",J:"Ĵ",K:"Ḱ",L:"Ŀ",M:"Ṁ",N:"Ṅ",O:"Ö",P:"Ṕ",Q:"Q",R:"Ŕ",S:"Ṡ",T:"Ṫ",U:"Ū",V:"Ṽ",W:"Ẇ",X:"Ẋ",Y:"Ẏ",Z:"Ż",a:"ȧ",b:"ḃ",c:"ç",d:"ḋ",e:"ḗ",f:"ḟ",g:"ġ",h:"ḧ",i:"ī",j:"ĵ",k:"ḱ",l:"ŀ",m:"ṁ",n:"ṅ",o:"ö",p:"ṕ",q:"q",r:"ŕ",s:"ṡ",t:"ṫ",u:"ū",v:"ṽ",w:"ẇ",x:"ẋ",y:"ẏ",z:"ż"};function gR(t){return[...t].map(e=>pR[e]??e).join("")}function mR(t){const e=t.replace(/\b\w+\b/g,n=>{const r="~".repeat(Math.max(1,Math.ceil(n.length*.35)));return`${n}${r}`});return`[${gR(e)}]`}function Eb(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,typeof n=="string"?mR(n):Eb(n)]))}const Sb=`${jd}:locale`,du={en:kb,ru:hR},vR=Eb(kb);function Tb(t){try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}}function xb(){return!1}function vf(){return ym}function Pb(t){const e=Tb(t);return vf().find(n=>n===e)}function xp(t){const e=Tb(t);if(e!==void 0)return Pb(e)??vf().find(n=>n===e.split("-")[0])}function bR(t){try{return(t==null?void 0:t.getItem(Sb))??void 0}catch{return}}function _R(){const t=[...navigator.languages];return navigator.language!==""&&t.push(navigator.language),t}function wR(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??S_;let s=ie(at(ym[0])),o=!1;const a=new Cs,l=new Cs,c=g=>{r.documentElement.lang=g,r.documentElement.dir="ltr"},u=g=>{k(s,g,!0),i(g),c(g);for(const b of a)b(g)};return Object.freeze({initLocale:()=>{const g=bR(n),_=(g===void 0?void 0:Pb(g))??_R().map(xp).find(y=>y!==void 0)??"en";return u(_),_},getLocale:()=>d(s),setLocale:async g=>{const b=xp(g)??"en";if(b===d(s))return;o=!0;for(const y of l)y(!0);const _=e.preparePluginCatalogGeneration(b);await _.promise,e.commitPluginCatalogGeneration(_,()=>{u(b);try{n==null||n.setItem(Sb,b)}catch{}}),o=!1;for(const y of l)y(!1)},subscribeLocale:g=>(a.add(g),()=>{a.delete(g)}),isLocaleSwitchPending:()=>o,subscribeLocalePending:g=>(l.add(g),()=>{l.delete(g)}),hostT:(g,b,_)=>Cb(g,b,_??d(s)),hostFormatNumber:(g,b)=>new Intl.NumberFormat(Do(d(s)),b).format(g),hostFormatDate:(g,b)=>new Intl.DateTimeFormat(Do(d(s)),b).format(g),getAvailableLocales:vf,isPseudoLocaleEnabled:xb})}function Cb(t,e,n){const r=n==="en-XA"&&xb()?vR:du[n]??du.en,i=Pp(r,t)??Pp(du.en,t)??t;return e===void 0?i:ef(i,e,n)}function Pp(t,e){let n=t;for(const r of e.split(".")){if(typeof n=="string")return;n=n[r]}return typeof n=="string"?n:void 0}function L(t,e){return Cb(t,e,Z.locale)}var yR=D('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),kR=D('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">&times;</button>'),ER=D('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),SR=D('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),TR=D('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function xR(t,e){Ze(e,!0);const n=Math.random().toString(36).slice(2),r=`mndw-overlay-title-${n}`,i=`mndw-overlay-desc-${n}`;function s(p,m){return p.appendChild(m),{destroy(){m.parentNode===p&&p.removeChild(m)}}}const o=V(()=>e.layer.mobileSheet?"width:100%;height:auto;max-height:100dvh":[e.layer.sizing.width?`width:${e.layer.sizing.width}`:"",e.layer.sizing.height?`height:${e.layer.sizing.height}`:"",e.layer.sizing.maxWidth?`max-width:${e.layer.sizing.maxWidth}`:"",e.layer.sizing.maxHeight?`max-height:${e.layer.sizing.maxHeight}`:""].filter(Boolean).join(";"));var a=TR(),l=v(a);{var c=p=>{var m=ER(),g=v(m);{var b=O=>{var N=yR(),S=v(N);w(()=>{Oe(N,"id",r),E(S,e.layer.shell.title)}),A(O,N)};J(g,O=>{var N;(N=e.layer.shell)!=null&&N.title&&O(b)})}var _=T(g,2);{var y=O=>{var N=kR();w(S=>Oe(N,"aria-label",S),[()=>L("common.close")]),fe("click",N,()=>e.layer.close(void 0,"action")),A(O,N)};J(_,O=>{var N;(N=e.layer.shell)!=null&&N.showCloseButton&&O(y)})}A(p,m)};J(l,p=>{var m,g;((m=e.layer.shell)!=null&&m.title||(g=e.layer.shell)!=null&&g.showCloseButton)&&p(c)})}var u=T(l,2);{var f=p=>{var m=SR(),g=v(m);w(()=>{Oe(m,"id",i),E(g,e.layer.shell.description)}),A(p,m)};J(u,p=>{var m;(m=e.layer.shell)!=null&&m.description&&p(f)})}var h=T(u,2);Fs(h,(p,m)=>s==null?void 0:s(p,m),()=>e.layer.contentElement),w(()=>{var p,m;Le(a,1,`mndw-overlay-dialog mndw-overlay-dialog--${e.layer.kind??""} mndw-overlay-dialog--${e.layer.placement??""} ${e.layer.mobileSheet?"mndw-overlay-dialog--sheet":""} ${e.layer.className??""??""}`,"svelte-1ervcvh"),Oe(a,"data-locale",Z.locale),Oe(a,"aria-modal",e.layer.kind==="modal"||e.layer.kind==="drawer"?"true":void 0),Oe(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Oe(a,"aria-describedby",(m=e.layer.shell)!=null&&m.description?i:void 0),Lo(a,d(o))}),A(t,a),We()}dt(["click"]);var PR=D('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),CR=D("<div><!> <div></div></div>");function RR(t,e){Ze(e,!0);const n=1e3,r=V(()=>e.runtime.store.layers);function i(h){return n+h}function s(h){return h.kind==="modal"||h.kind==="drawer"}function o(h){return h.kind==="popover"?h.position?`position:absolute;top:${h.position.top}px;left:${h.position.left}px`:"position:absolute;opacity:0;pointer-events:none":""}function a(h,p){h.appendChild(p.hostElement),p.kind==="drawer"&&p.placement==="bottom"&&(p.hostElement.style.display="flex",p.hostElement.style.flexDirection="column",p.hostElement.style.justifyContent="flex-end",p.hostElement.style.width="100%",p.hostElement.style.height="100%",p.hostElement.style.minHeight="0");let m;return p.shell&&(m=Wl(xR,{target:p.hostElement,props:{layer:p}})),requestAnimationFrame(()=>{p.state!=="closed"&&p.reposition()}),{destroy(){m&&Id(m),p.hostElement.remove()}}}function l(h){if(h.key==="Escape"){for(let p=d(r).length-1;p>=0;p--)if(d(r)[p].closeOnEscape){d(r)[p].closeWithReason("escape"),h.stopPropagation();return}}}function c(h){const p=h.composedPath();for(let m=d(r).length-1;m>=0;m--){const g=d(r)[m];if(p.includes(g.hostElement)||g.anchorElement&&p.includes(g.anchorElement))return;if(g.closeOnOutsideClick){g.closeWithReason("outside-click");return}if(s(g))return}}Xn(()=>{const h=d(r).some(m=>m.lockScroll),p=document.body.style.overflow;return h&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=p}});var u=jn();yt("keydown",Mo,l),yt("pointerdown",Mo,c);var f=et(u);Ct(f,19,()=>d(r),h=>h.id,(h,p,m)=>{var g=CR();let b;var _=v(g);{var y=S=>{var P=PR();A(S,P)},O=V(()=>s(d(p))&&d(p).backdrop);J(_,S=>{d(O)&&S(y)})}var N=T(_,2);Fs(N,(S,P)=>a==null?void 0:a(S,P),()=>d(p)),w((S,P)=>{Le(g,1,`mndw-overlay-layer mndw-overlay-layer--${d(p).kind??""}`,"svelte-11o3k6p"),b=Lo(g,"",b,S),Le(N,1,`mndw-overlay-positioner mndw-overlay-positioner--${d(p).kind??""} mndw-overlay-positioner--${d(p).placement??""} ${d(p).mobileSheet?"mndw-overlay-positioner--sheet":""} ${d(p).kind==="popover"&&!d(p).position?"mndw-overlay-positioner--unpositioned":""}`,"svelte-11o3k6p"),Lo(N,P)},[()=>({"z-index":i(d(m))}),()=>o(d(p))]),A(h,g)}),A(t,u),We()}const AR={success:4e3,info:4e3,warning:0,error:0},OR=4,MR=.35,NR=.5;function LR(t){return{get label(){var e;return((e=t.getLabel)==null?void 0:e.call(t))??t.label},onAction:t.onAction,...t.busy===void 0?{}:{busy:t.busy}}}function Cp(t,e,n,r){return{id:t,get message(){var i;return((i=e.getMessage)==null?void 0:i.call(e))??e.message},variant:n,duration:r,...e.key===void 0?{}:{key:e.key},...e.action===void 0?{}:{action:LR(e.action)}}}function IR(t,e,n){return e<=0?!1:Math.abs(t)>=e*MR||Math.abs(n)>=NR}var Qo;class zR{constructor(){xe(this,Qo,ie(at([])));K(this,"nextId",1);K(this,"maxToasts",OR);K(this,"timers",new Si)}get toasts(){return d(x(this,Qo))}set toasts(e){k(x(this,Qo),e,!0)}show(e){const n=e.variant??"info",r=e.duration??AR[n],i=e.key===void 0?-1:this.toasts.findIndex(s=>s.key===e.key);if(i!==-1){const s=this.toasts[i];return s===void 0?this.add(e,n,r):(this.clearTimer(s.id),this.toasts[i]=Cp(s.id,e,n,r),this.startTimer(s.id,r),s.id)}return this.add(e,n,r)}add(e,n,r){const i=this.nextId++;return this.toasts.push(Cp(i,e,n,r)),this.enforceCap(),this.startTimer(i,r),i}startTimer(e,n){n>0&&this.timers.set(e,setTimeout(()=>this.dismiss(e),n))}success(e,n){return this.show({...n,message:e,variant:"success"})}info(e,n){return this.show({...n,message:e,variant:"info"})}error(e,n){return this.show({...n,message:e,variant:"error"})}dismiss(e){this.clearTimer(e);const n=this.toasts.findIndex(r=>r.id===e);n!==-1&&this.toasts.splice(n,1)}dismissKey(e){const n=this.toasts.find(r=>r.key===e);n!==void 0&&this.dismiss(n.id)}setMaxToasts(e){this.maxToasts=Math.max(1,Math.trunc(e)),this.enforceCap()}clear(){for(const e of this.timers.keys())this.clearTimer(e);this.toasts=[]}enforceCap(){for(;this.toasts.length>this.maxToasts;){const e=this.toasts.shift();e!==void 0&&this.clearTimer(e.id)}}clearTimer(e){const n=this.timers.get(e);n!==void 0&&(clearTimeout(n),this.timers.delete(e))}}Qo=new WeakMap;const je=new zR;var DR=D('<button type="button" class="mndw-toast__action svelte-1g105wt"> </button>'),HR=D('<div><span class="mndw-toast__body svelte-1g105wt"> </span> <!> <button type="button" class="mndw-toast__dismiss svelte-1g105wt"><mndw-icon></mndw-icon></button></div>',2),BR=D('<div role="region"></div>');function UR(t,e){Ze(e,!0);let n=kn(e,"store",3,je);const r=fa();let i=ie(at(r.matches));const s=h=>{k(i,h.matches,!0),n().setMaxToasts(h.matches?3:4)};function o(h){return h==="error"?"danger":h}function a(h){try{const p=h.onAction();p!==void 0&&p.catch(m=>{console.error("[mndw] Toast action failed:",m)})}catch(p){console.error("[mndw] Toast action failed:",p)}}function l(h,p){let m=p,g=null,b=0,_=0,y=!1;const O=M=>{h.style.transition="transform 0.15s ease, opacity 0.15s ease",h.style.transform="",h.style.opacity=""},N=M=>{!m.enabled||M.pointerType==="mouse"||g!==null||(g=M.pointerId,b=M.clientX,_=M.timeStamp,y=!0,h.style.transition="",h.setPointerCapture(M.pointerId))},S=M=>{if(!y||M.pointerId!==g)return;const z=M.clientX-b;h.style.transform=`translateX(${z}px)`,h.style.opacity=String(Math.max(.3,1-Math.abs(z)/h.offsetWidth))},P=M=>{if(!y||M.pointerId!==g)return;const z=M.clientX-b,B=Math.max(1,M.timeStamp-_),U=z/B;y=!1,g=null,IR(z,h.offsetWidth,U)?m.onDismiss():O()};return h.style.touchAction="pan-y",h.addEventListener("pointerdown",N),h.addEventListener("pointermove",S),h.addEventListener("pointerup",P),h.addEventListener("pointercancel",P),{update(M){m=M},destroy(){h.removeEventListener("pointerdown",N),h.removeEventListener("pointermove",S),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P)}}}Fn(()=>(n().setMaxToasts(d(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var c=jn(),u=et(c);{var f=h=>{var p=BR();let m;Ct(p,21,()=>n().toasts,g=>g.id,(g,b)=>{var _=HR(),y=v(_),O=v(y),N=T(y,2);{var S=z=>{var B=DR(),U=v(B);w(()=>{B.disabled=d(b).action.busy===!0,Oe(B,"aria-busy",d(b).action.busy===!0?"true":void 0),E(U,d(b).action.label)}),fe("click",B,()=>{d(b).action!==void 0&&a(d(b).action)}),A(z,B)};J(N,z=>{d(b).action!==void 0&&z(S)})}var P=T(N,2),M=v(P);C(M,"name","x"),Fs(_,(z,B)=>l==null?void 0:l(z,B),()=>({enabled:d(i),onDismiss:()=>n().dismiss(d(b).id)})),w((z,B)=>{Le(_,1,`mndw-toast mndw-alert mndw-alert--${z??""}`,"svelte-1g105wt"),Oe(_,"role",d(b).variant==="error"?"alert":"status"),Oe(_,"aria-live",d(b).variant==="error"?"assertive":"polite"),E(O,d(b).message),Oe(P,"aria-label",B)},[()=>o(d(b).variant),()=>L("toast.dismiss")]),fe("click",P,()=>n().dismiss(d(b).id)),A(g,_)}),w(g=>{m=Le(p,1,"mndw-toast-host svelte-1g105wt",null,m,{"mndw-toast-host--mobile":d(i)}),Oe(p,"aria-label",g)},[()=>L("toast.region")]),A(h,p)};J(u,h=>{n().toasts.length>0&&h(f)})}A(t,c),We()}dt(["click"]);const Rb=globalThis.fetch.bind(globalThis);async function mo(t,e={},n=2e4){const r=new AbortController,i=e.signal,s=()=>r.abort(i==null?void 0:i.reason);i!=null&&(i.aborted?s():i.addEventListener("abort",s,{once:!0}));const o=globalThis.setTimeout(()=>r.abort(),n);try{return await Rb(t,{...e,signal:r.signal})}finally{globalThis.clearTimeout(o),i==null||i.removeEventListener("abort",s)}}function Ab(){const t=new M_(1);let e=!1;const n={ended$:t.asObservable(),get ended(){return e},end:()=>{e||(e=!0,t.next(),t.complete())}};return Object.freeze(n)}function el(t,e,n){return new tl(r=>{if(n.ended){r.complete();return}let i;const s=()=>{const a=i;i=void 0,a==null||a()},o=n.ended$.subscribe(()=>{s(),r.complete()});return r.next(t()),!r.closed&&!n.ended&&(i=e(a=>r.next(a)),n.ended&&s()),()=>{o.unsubscribe(),s()}})}const rd=3e3;function $R(t={}){return{catalogSuccessCache:new Map,catalogCells:new Set,activeGeneration:void 0,nextGenerationToken:0,fetchCatalog:t.fetchCatalog??GR,now:t.now??Date.now,setTimeout:t.setTimeout??globalThis.setTimeout.bind(globalThis),queueMicrotask:t.queueMicrotask??globalThis.queueMicrotask.bind(globalThis)}}function fu(t,e){return`${t.name}/${t.version}/${e}`}function jR(t,e){const n=t.locales[e];if(n!==void 0)return`${t.baseUrl.replace(/\/$/,"")}/${n}?v=${encodeURIComponent(t.version)}`}function FR(t){return t.split("-")[0]}function Ob(t,e){if(t.locales[e]!==void 0)return e;const n=FR(e);return n!==void 0&&t.locales[n]!==void 0?n:t.defaultLocale}async function GR(t){const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return yT(await e.json(),t)}async function Rp(t,e,n,r){const i=t.catalogSuccessCache.get(fu(e,n));if(i!==void 0)return i;const s=jR(e,n);if(s===void 0)throw new Error(`Plugin "${e.name}" does not declare a catalog for ${n}`);try{const o=await t.fetchCatalog(s);if(r!==void 0&&t.now()>r)throw new Error("catalog request completed after deadline");return t.catalogSuccessCache.set(fu(e,n),o),o}catch(o){throw t.catalogSuccessCache.delete(fu(e,n)),o}}function VR(t,e){const n=Math.max(0,e-t.now());return new Promise((r,i)=>{t.setTimeout(()=>i(new Error("catalog deadline exceeded")),n)})}async function Mb(t,e,n,r){var f,h;const i=Ob(e,n),s=e.defaultLocale,o=Rp(t,e,i,r),a=i===s?o:Rp(t,e,s,r),l=await Promise.race([Promise.allSettled([o,a]),VR(t,r)]).catch(()=>{}),c=Array.isArray(l)&&((f=l[0])==null?void 0:f.status)==="fulfilled"?l[0].value:void 0,u=Array.isArray(l)&&((h=l[1])==null?void 0:h.status)==="fulfilled"?l[1].value:void 0;return{hostLocale:n,resolvedCatalogLocale:i,...c===void 0?{}:{primaryCatalog:c},...u===void 0?{}:{defaultCatalog:u},fallbackStatus:c!==void 0?"primary":u!==void 0?"default":"key"}}function Nb(t,e){return{hostLocale:e,resolvedCatalogLocale:Ob(t,e),fallbackStatus:"key"}}class ZR{constructor(e,n){K(this,"source");K(this,"state");K(this,"listeners",new Set);this.source=Object.freeze({...e,locales:Object.freeze({...e.locales})}),this.state=new Si([["current",Nb(this.source,n)]])}readCurrentState(){const e=this.state.get("current");if(e===void 0)throw new Error(`Catalog state is missing for plugin "${this.source.name}"`);return e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commit(e,n=!0){if(this.state.set("current",Object.freeze(e)),n)for(const r of this.listeners)r()}}function WR(t,e,n){const r=new ZR(e,n);return t.catalogCells.add(r),t.activeGeneration!==void 0&&t.activeGeneration.add(r),r}function qR(t,e){t.catalogCells.add(e)}function KR(t,e){t.catalogCells.delete(e)}function YR(t){var e;(e=t.activeGeneration)==null||e.discard(),t.catalogCells.clear(),t.activeGeneration=void 0}function Lb(t,e,n,r){if(r!==void 0)return{name:t,version:e,baseUrl:n,defaultLocale:r.defaultLocale,locales:r.locales}}async function XR(t,e,n,r=rd){e.commit(await Mb(t,e.source,n,t.now()+r))}class JR{constructor(e,n){K(this,"runtime");K(this,"token");K(this,"targetLocale");K(this,"deadline");K(this,"promise");K(this,"pending",0);K(this,"initialEnrollmentDone",!1);K(this,"settled",!1);K(this,"cells",new Map);K(this,"resolvedStates",new Map);K(this,"resolvePromise");this.runtime=e,this.token=++e.nextGenerationToken,this.targetLocale=n,this.deadline=e.now()+rd,this.promise=new Promise(r=>{this.resolvePromise=r}),e.setTimeout(()=>this.settle(),rd)}add(e){if(this.settled||this.runtime.now()>=this.deadline||this.cells.has(e))return;this.pending+=1;const n=Mb(this.runtime,e.source,this.targetLocale,this.deadline).catch(()=>Nb(e.source,this.targetLocale));this.cells.set(e,n),n.then(r=>{this.resolvedStates.set(e,r)}).finally(()=>{this.pending-=1,this.settle()})}closeEnrollment(){this.initialEnrollmentDone=!0,this.settle()}discard(){this.settled||(this.settled=!0,this.resolvePromise())}settle(){this.settled||!this.initialEnrollmentDone||this.pending>0||this.runtime.queueMicrotask(()=>{this.settled||!this.initialEnrollmentDone||this.pending>0||(this.settled=!0,this.resolvePromise())})}commit(e){if(this.runtime.activeGeneration===this){for(const[n,r]of this.resolvedStates)n.commit(r,!1);e();for(const n of this.resolvedStates.keys()){const r=this.resolvedStates.get(n);this.runtime.activeGeneration===this&&r!==void 0&&n.commit(r)}this.runtime.activeGeneration=void 0}}}function QR(t,e){if(t.activeGeneration!==void 0)throw new Error("A plugin catalog generation is already pending");const n=new JR(t,e);t.activeGeneration=n;for(const r of t.catalogCells)n.add(r);return n.closeEnrollment(),n}function eA(t,e){t.commit(e)}function tA(t,e){e.discard(),t.activeGeneration===e&&(t.activeGeneration=void 0)}function nA(t){return t.activeGeneration}function rA(t,e,n,r){var o,a;const i=t==null?void 0:t.readCurrentState(),s=((o=i==null?void 0:i.primaryCatalog)==null?void 0:o[e])??((a=i==null?void 0:i.defaultCatalog)==null?void 0:a[e])??e;return ef(s,n,r)}function Ap(t,e,n,r){var o,a;const i=t==null?void 0:t.readCurrentState(),s=((o=i==null?void 0:i.primaryCatalog)==null?void 0:o[e])??((a=i==null?void 0:i.defaultCatalog)==null?void 0:a[e]);return s===void 0?n??"":ef(s,void 0,r)}function Nn(t,e,n){const r=Ap(e,"manifest.label",t.label,n),i=Ap(e,"manifest.description",t.description,n);return{label:r,...i===""?{}:{description:i}}}function iA(t,e,n,r){const s={get locale(){return e()},direction:"ltr",t:(o,a)=>rA(t,o,a,e()),formatNumber:(o,a)=>new Intl.NumberFormat(Do(e()),a).format(o),formatDate:(o,a)=>new Intl.DateTimeFormat(Do(e()),a).format(o),locale$:el(e,t===void 0?n:o=>t.subscribe(()=>o(e())),r)};return Object.freeze(s)}function sA(t={}){const e=$R(t);return{createPluginCatalogCell:(n,r)=>WR(e,n,r),registerPluginCatalogCell:n=>qR(e,n),unregisterPluginCatalogCell:n=>KR(e,n),clearPluginCatalogCells:()=>YR(e),loadInitialPluginCatalog:(n,r,i)=>XR(e,n,r,i),preparePluginCatalogGeneration:n=>QR(e,n),commitPluginCatalogGeneration:(n,r)=>eA(n,r),discardPluginCatalogGeneration:n=>tA(e,n),getActivePluginCatalogGeneration:()=>nA(e)}}class id extends Error{constructor(n,r,i){super(r,i);K(this,"code");this.name="PageRouteError",this.code=n}}const oA={light:{bg:"#f7fcfd",surface:"#edf2f3",surfaceRaised:"#f2f7f8",border:"#80878a",textSubtle:"#2f353a",textMuted:"#1d2328",text:"#0c1217",accent:"#016ca5",accentHover:"#005583",accentContrast:"#ffffff",danger:"#c5001b",dangerBg:"#ffe9e6",success:"#137738",successBg:"#d7f9dc",warning:"#916100",warningBg:"#ffebd1",info:"#016ca5",infoBg:"#e0f1ff",focusRing:"#004f7a",surfaceHover:"#e8edee",controlHover:"#c6cbcc",shadowColor:"#4145462e"},dark:{bg:"#030405",surface:"#0d0f10",surfaceRaised:"#151719",border:"#606569",textSubtle:"#b9c0c7",textMuted:"#d1d9e1",text:"#eaf3fb",accent:"#016ca5",accentHover:"#2b84bf",accentContrast:"#ffffff",danger:"#ed3f3f",dangerBg:"#390204",success:"#5cb572",successBg:"#05210d",warning:"#efa831",warningBg:"#271700",info:"#338ac5",infoBg:"#021d2f",focusRing:"#338ac5",surfaceHover:"#1e2022",controlHover:"#292b2c",shadowColor:"#0102038c"}},bf="0.3.1",aA=1;function lA(t){return typeof t!="object"||t===null||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string")}async function cA(t,e=fetch){try{const n=await e(`${t}/mndw.lock.json`);if(!n.ok)return null;const r=await n.json();if(typeof r!="object"||r===null)return null;const i=r;if(i.lockVersion!==aA)return null;const s=i.sdkVersion,o=i.sharedDependencies;return typeof s!="string"||!lA(o)?null:{sdkVersion:s,sharedDependencies:o}}catch{return null}}function vo(t){if(typeof t!="string")return null;const e=/^(\d+)(?:\.(\d+))?(?:[.+-]|$)/.exec(t.trim());return e===null?null:{major:Number(e[1]),minor:e[2]===void 0?null:Number(e[2])}}function pi(t){const e=vo(t);return e===null?null:e.major>0?String(e.major):e.minor===null?"0":`0.${e.minor}`}function Ib(t,e=mf(),n=bf){const r=[],i=vo(t.sdkVersion),s=vo(n),o=pi(t.sdkVersion),a=pi(n);i!==null&&s!==null&&o!==null&&a!==null&&(o!==a?r.push({kind:"sdk-major",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}):i.major>0&&i.minor!==null&&s.minor!==null&&i.minor>s.minor&&r.push({kind:"sdk-newer-minor",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}));for(const[l,c]of Object.entries(t.sharedDependencies)){const u=e[l];if(u===void 0)continue;const f=vo(c),h=vo(u),p=pi(c),m=pi(u);f!==null&&h!==null&&p!==null&&m!==null&&p!==m&&r.push({kind:"shared-major",name:l,pluginVersion:c,hostVersion:u})}return r}function uA(t,e=mf(),n=bf){const r=[];for(const[o,a]of Object.entries(t.sharedDependencies)){const l=e[o];if(l===void 0)continue;const c=pi(a),u=pi(l);c===null||u===null||c!==u&&r.push(`${o} @${c} (host provides @${u})`)}const i=pi(t.sdkVersion),s=pi(n);return i!==null&&s!==null&&i!==s&&r.push(`@mndw/sdk @${i} (host provides @${s})`),r}function dA(t,e,n=mf(),r=bf){const i=uA(e,n,r);return i.length>0&&console.warn(`[mndw] plugin "${t}" was built against ${i.join(", ")}; it may misbehave with the versions this host provides`),i}const $o=at({});function fA(){for(const t of Object.keys($o))delete $o[t]}function zb(t,e){if(e.length===0){delete $o[t];return}$o[t]=[...e]}function hA(t){return $o[t]??[]}const Ir=at({});let Db=ie("pending"),sd=ie(0);function Op(){return d(sd)}function tr(){return d(Db)}function wi(t){k(Db,t,!0)}function _f(t,e=!1){var r;const n={...Ir};for(const i of Object.keys(Ir))delete Ir[i];for(const i of t){const s=i.enabled&&i.approval==="approved";Ir[i.name]={runnable:s,status:s?"loading":"not-runnable",type:i.type,version:i.version,label:i.label,...i.description===void 0?{}:{description:i.description},...e&&((r=n[i.name])==null?void 0:r.version)===i.version&&n[i.name].catalog!==void 0?{catalog:n[i.name].catalog}:{},...i.type==="widget"?{size:i.size}:{},...i.type==="page"?{route:i.route}:{}}}}function pc(t,e=!1){_f(t,e),k(sd,d(sd)+1)}function Un(t,e,n){const r=Ir[t];if(r!==void 0){const{failureKind:i,...s}=r;Ir[t]={...s,...e==="not-runnable"?{runnable:!1}:{},status:e,...e==="failed"&&n!==void 0?{failureKind:n}:{}}}}function wf(t,e){const n=Ir[t];if(n!==void 0){const{catalog:r,...i}=n;Ir[t]={...i,...e===void 0?{}:{catalog:e}}}}function fn(t){return Ir[t]}function va(){return Ir}const ds="plugin-load";let od=0,Ls=0,fs=!1,Is=!1;function Hb(){return fs||Ls>0}function Bb(){return Object.entries(va()).filter(([,t])=>t.runnable&&t.status==="failed").map(([t,e])=>({name:t,label:Nn(e,e.catalog,Z.locale).label})).sort((t,e)=>t.label.localeCompare(e.label)||t.name.localeCompare(e.name))}function pA(t){const e=va(),r=t.map(i=>{const s=e[i];return{name:i,label:s===void 0?i:Nn(s,s.catalog,Z.locale).label}}).sort((i,s)=>i.label.localeCompare(s.label)||i.name.localeCompare(s.name)).map(({label:i})=>i).join(", ");return L("plugin-load.failed",{names:r})}function Mp(t,e,n){je.error(t(),{key:ds,getMessage:t,action:{label:L("common.retry"),getLabel:()=>L("common.retry"),busy:Hb(),onAction:()=>gA(e,n)}})}async function gA(t,e){if(!e()||fs)return;fs=!0,Is=!0,zs(t,e);const n=Bb().map(({name:r})=>r);await Promise.all(n.map(async r=>{try{await t(r)}catch(i){console.error(`[mndw] Plugin retry failed for "${r}":`,i)}})),e()&&(fs=!1,zs(t,e))}function zs(t,e){if(!e())return;const n=Bb();if(n.length>0){const r=n.map(({name:i})=>i);Mp(()=>pA(r),t,e);return}if(Hb()){const r=je.toasts.find(({key:i})=>i===ds);r!==void 0&&Mp(()=>r.message,t,e);return}if(Is){je.success(L("plugin-load.loaded"),{key:ds,duration:4e3}),Is=!1;return}je.dismissKey(ds)}function mA(t,e){Ls+=1,Is=!0,zs(t,e)}function vA(t,e){Ls=Math.max(0,Ls-1),zs(t,e)}function bA(){return od+=1,Ls=0,fs=!1,Is=!1,je.dismissKey(ds),od}function _A(t){t===od&&(Ls=0,fs=!1,Is=!1,je.dismissKey(ds))}let ad=0,es,Ur;const Ub=15e3;function wA(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}function yA(t,e){const n=t;if(typeof n.createInstance!="function")throw new Error(`Plugin "${e}" does not export { createInstance }`);return n}async function kA(t){const e=await Rb(Sm,{signal:t});if(!e.ok)throw new Error(`HTTP ${e.status}`);return yb(await e.json())}async function EA(t,e){const n=await cA(e);return n?dA(t.name,n):[]}function $b(t){const e=new Set,n=new Set,r=new Set,i=new Set,s=t.filter(o=>{if(e.has(o.name))return console.error(`[mndw] Skipping duplicate plugin "${o.name}"`),i.add(o.name),!1;if(e.add(o.name),o.type==="page"){if(n.has(o.route))return console.error(`[mndw] Skipping duplicate page route "${o.route}"`),i.add(o.name),!1;n.add(o.route)}return r.add(o.name),!0});for(const o of i)r.has(o)||Un(o,"not-runnable");return s}let Ao;const bo=new Map;async function SA(t,e,n,r){const s=`${t.source==="builtin"?uh.builtin:uh.user}${t.name}`,o=u=>wA(s,u,t.version);let a,l=!1,c;try{const u=Lb(t.name,t.version,t.catalogBaseUrl??s,t.i18n),f=u===void 0?void 0:e.catalogService.createPluginCatalogCell(u,e.getLocale());if(wf(t.name,f),f!==void 0&&await e.catalogService.loadInitialPluginCatalog(f,e.getLocale()),!r()||n.aborted)return{loaded:!1};if(a=e.acquireStylesheet(o("index.css"),t.name,t.version),c=()=>a==null?void 0:a.release(),n.addEventListener("abort",c,{once:!0}),n.aborted&&c(),await a.loaded,!r()||n.aborted)return{loaded:!1};const h=await e.importModule(o(t.entry)),p=yA(h,t.name);return n.aborted||!r()?{loaded:!1}:(e.registry.register({entry:t,module:p,...f===void 0?{}:{catalog:f},stylesheetLease:a}),l=!0,console.log(`[mndw] Loaded plugin: ${t.name} (${t.source})`),Promise.resolve().then(()=>e.checkVersions(t,s)).then(m=>{r()&&zb(t.name,m)}).catch(m=>{console.error(`[mndw] Version check failed for "${t.name}":`,m)}),{loaded:!0})}catch(u){return console.error(`[mndw] Failed to load plugin "${t.name}":`,u),{loaded:!1,failureKind:"error"}}finally{c!==void 0&&n.removeEventListener("abort",c),l||a==null||a.release()}}async function TA(t,e,n){const r=new AbortController,i=new Promise(o=>{r.signal.addEventListener("abort",()=>{console.error(`[mndw] Plugin "${t.name}" did not load within ${e.loadTimeoutMs} ms; skipping it`),o({loaded:!1,failureKind:"timeout"})},{once:!0})}),s=setTimeout(()=>r.abort(),e.loadTimeoutMs);try{return await Promise.race([SA(t,e,r.signal,n),i])}finally{clearTimeout(s)}}function hs(t){return t.generation===ad&&t.authGeneration===Dr()&&!t.authSignal.aborted}async function yf(t,e,n=e.pluginTokens.get(t.name)??0){Un(t.name,"loading");const r=()=>hs(e)&&e.pluginTokens.get(t.name)===n,i=await TA(t,e.deps,r);return r()&&Un(t.name,i.loaded?"loaded":"failed",i.failureKind),i.loaded}async function Wi(t){const e=Ao,n=e==null?void 0:e.entries.get(t),r=fn(t);if(e===void 0||n===void 0||(r==null?void 0:r.runnable)!==!0||!hs(e))return!1;const i=bo.get(t);if(i!==void 0)return i;const s=()=>hs(e);mA(Wi,s);const o=yf(n,e).finally(()=>{bo.get(t)===o&&bo.delete(t),s()&&vA(Wi,s)});return bo.set(t,o),o}async function xA(t){const e=Ao;if(e===void 0||!hs(e))return!1;const n={...va()},r=$b(t.filter(a=>a.enabled&&a.approval==="approved")),i=new Map(r.map(a=>[a.name,a]));let s=!1;Ns(t),pc(t,!0),wi("ok");for(const a of e.entries.keys())i.has(a)||(e.pluginTokens.set(a,(e.pluginTokens.get(a)??0)+1),e.entries.delete(a),e.deps.registry.remove(a),zb(a,[]));const o=[];for(const a of r){const l=a.name,c=e.entries.get(l),u=n[l],f=e.deps.registry.get(l),h=c!==void 0&&c.version!==a.version;if(e.entries.set(l,a),f!==void 0){wf(l,f.catalog),f.entry.version!==a.version&&(s=!0),Un(l,"loaded");continue}if(c===void 0||h){const p=(e.pluginTokens.get(l)??0)+1;e.pluginTokens.set(l,p),o.push(yf(a,e,p));continue}(u==null?void 0:u.status)==="failed"?Un(l,"failed",u.failureKind):(u==null?void 0:u.status)==="loading"?Un(l,"loading"):Un(l,"failed","error")}return await Promise.all(o),hs(e)&&(Z.pluginLoadError=null,zs(Wi,()=>hs(e))),s}async function PA(t){es==null||es.abort();const e=++ad,n=Dr(),r=VC(),i=new AbortController;es=i;const s=()=>i.abort(r.reason);r.aborted?s():r.addEventListener("abort",s,{once:!0});const o=()=>e===ad&&n===Dr(),a=t.fetchList??kA,l=t.catalogService,c=t.registry,u={importModule:t.importModule??(b=>import(b)),acquireStylesheet:t.acquireStylesheet??((b,_,y)=>t.pluginStylesheets.acquire(_,y,b)),checkVersions:t.checkVersions??EA,catalogService:l,registry:c,retryPlugin:Wi,getLocale:t.getLocale??(()=>"en"),loadTimeoutMs:t.loadTimeoutMs??Ub};Ao=void 0,bo.clear(),Ur!==void 0&&(Ur.signal.removeEventListener("abort",Ur.handler),Ur=void 0);const f=bA(),h=()=>{(Ur==null?void 0:Ur.handler)===h&&(Ur=void 0),_A(f)};r.aborted?h():(Ur={signal:r,handler:h},r.addEventListener("abort",h,{once:!0})),wi("pending"),_f([]),u.registry.clear(),Ns([]),fA();let p;try{let b,_=()=>{};const y=new Promise((S,P)=>{_=P}),O=()=>{_(i.signal.reason??new DOMException("Plugin list request aborted","AbortError"))};i.signal.addEventListener("abort",O,{once:!0}),i.signal.aborted&&O();const N=new Promise((S,P)=>{b=setTimeout(()=>{P(new Error(`Plugin list fetch timed out after ${ah} ms`)),i.abort()},ah)});try{p=await Promise.race([a(i.signal),N,y])}finally{clearTimeout(b),i.signal.removeEventListener("abort",O),r.removeEventListener("abort",s),es===i&&(es=void 0)}}catch(b){o()&&(r.aborted||(Ao={generation:e,authGeneration:n,authSignal:r,deps:u,entries:new Map,pluginTokens:new Map}),console.error("[mndw] Failed to load plugin list:",b),Z.pluginLoadError="list",wi("failed"));return}if(!o())return;Ns(p),pc(p),wi("ok");const m=$b(p.filter(b=>b.enabled&&b.approval==="approved")),g={generation:e,authGeneration:n,authSignal:r,deps:u,entries:new Map(m.map(b=>[b.name,b])),pluginTokens:new Map(m.map(b=>[b.name,0]))};Ao=g,await Promise.all(m.map(b=>yf(b,g,0))),o()&&(Z.pluginLoadError=null,zs(Wi,o))}const ld="mndw:sandbox-reloaded";function CA(t){const e=t;if(typeof e.createInstance!="function")throw new Error("Sandbox plugin does not export { createInstance }");return e}function RA(t){const e={};if(t===void 0)return{routes:e};for(const n of t.routes)e[n.id]=n.transport==="http"?{transport:"http",method:n.method,path:n.path}:{transport:"websocket",path:n.path,...n.protocols===void 0?{}:{protocols:n.protocols}};return{routes:e}}function jb(t,e){const n={name:t.name,version:t.version,label:t.label,...t.description===void 0?{}:{description:t.description},entry:t.entry,...t.i18n===void 0?{}:{i18n:t.i18n},...e===void 0?{}:{catalogBaseUrl:e},source:"builtin",approval:"approved",enabled:!0,depsStatus:"ready",backend:RA(t.backend)};return t.type==="widget"?{...n,type:"widget",size:t.size}:{...n,type:"page",route:t.route}}async function kf(t,e,n=()=>!0){let r=e;if(r===void 0){const c=await t.importManifestModule();if(c.default===void 0||c.default===null)throw new Error("Sandbox manifest module has no default export");const u=bb(c.default),f=t.catalogBaseUrl??c.__catalogBaseUrl;r=jb(u,f)}const i=t.catalogService,s=t.getLocale,o=Lb(r.name,r.version,r.catalogBaseUrl??`/plugins/${r.name}`,r.i18n),a=o===void 0?void 0:i.createPluginCatalogCell(o,s());a!==void 0&&await i.loadInitialPluginCatalog(a,s()),n()&&wf(r.name,a);const l=CA(await t.importPluginModule());return{entry:r,module:l,...a===void 0?{}:{catalog:a}}}let br,cd=0;const _o=new Map;function Tl(){return cd+=1,cd}function xl(t,e){return t===cd&&e()}async function AA(t){const e=t.registry,n=()=>t.isCurrent===void 0||t.isCurrent();if(!n())return;const r=Tl(),i=()=>xl(r,n);if(!i())return;br=void 0,_o.clear(),wi("pending"),_f([]),Ns([]),e.clear();let s;try{const o=await t.importManifestModule();if(o.default===void 0||o.default===null)throw new Error("Sandbox manifest module has no default export");const a=bb(o.default);if(s=jb(a,t.catalogBaseUrl??o.__catalogBaseUrl),!i())return;Ns([s]),pc([s]),wi("ok"),Z.pluginLoadError=null,br={deps:{...t,isCurrent:n},entry:s,isCurrent:n};const c=await kf(t,s,i);if(!i())return;e.register(c),Un(s.name,"loaded"),console.log(`[mndw] Sandbox plugin loaded: ${c.entry.name}`)}catch(o){if(!i())return;s===void 0?(Z.pluginLoadError="list",wi("failed")):Un(s.name,"failed","error"),console.error("[mndw] Failed to load sandbox plugin:",o)}}async function OA(t){const e=br,n=fn(t);if((e==null?void 0:e.entry.name)!==t||(n==null?void 0:n.runnable)!==!0||n.status!=="failed"||!e.isCurrent())return!1;const r=_o.get(t);if(r!==void 0)return r;const i=Tl(),s=()=>br===e&&xl(i,e.isCurrent);if(!s())return!1;Un(t,"loading");const o=(async()=>{try{const a=await kf(e.deps,e.entry,s);return s()?(e.deps.registry.get(t)===void 0&&e.deps.registry.register(a),Un(t,"loaded"),!0):!1}catch(a){return s()&&(Un(t,"failed","error"),console.error("[mndw] Failed to retry sandbox plugin:",a)),!1}})().finally(()=>{_o.get(t)===o&&_o.delete(t)});return _o.set(t,o),o}async function MA(t){const e=t.registry,n=t.remountWidgets??NA,r=t.reloadPage??LA,i=t.pluginContextServices,s=t.isCurrent??(br==null?void 0:br.isCurrent)??(()=>!0),o=t.isCurrent===void 0?{...t,isCurrent:s}:t;if(!s())return"failed";let a;try{a=await kf(o,void 0,s)}catch(b){return s()&&console.error("[mndw] Sandbox reload rejected (invalid update kept previous plugin):",b),"failed"}if(!s())return"failed";const l=a.entry.name,c=e.get(l);if(c===void 0){const b=Tl();return xl(b,s)?(e.register(a),Ns([a.entry]),pc([a.entry]),wi("ok"),Un(l,"loaded"),Z.pluginLoadError=null,br={deps:o,entry:a.entry,isCurrent:s},"reloaded"):"failed"}const u=Tl(),f=()=>xl(u,s);if(!f())return"failed";const h=br;let p;const m=t.pluginStylesheets,g=m.retain(l,c.entry.version);try{p=e.replace(a)}catch(b){return g.release(),console.error(`[mndw] Sandbox reload needs a restart of \`mndw dev\`: ${b.message}`),"restart-required"}br={deps:o,entry:a.entry,isCurrent:s};try{const b=await n(l,a,c,e,i,t.pluginStylesheets);if(!f())return"failed";const _=await r(l,a,c);if(!f())return"failed";if(!b||!_)throw new Error("a widget or page remount reported failure");return Un(l,"loaded"),console.log(`[mndw] Sandbox plugin reloaded: ${l}`),"reloaded"}catch(b){if(!f())return"failed";const _={...p,stylesheetLease:m.retain(l,p.entry.version)};return e.replace(_),br=h,console.error(`[mndw] Sandbox reload failed, kept previous plugin "${l}":`,b),"failed"}finally{g.release()}}async function NA(t,e,n,r,i,s){const{remountWidgetTiles:o}=await ul(async()=>{const{remountWidgetTiles:a}=await Promise.resolve().then(()=>tN);return{remountWidgetTiles:a}},[]);return o(i,r,t,e,n,s)}async function LA(t,e,n){const r=[],i={pluginName:t,next:e,prior:n,register:o=>r.push(o)};return window.dispatchEvent(new CustomEvent(ld,{detail:i})),(await Promise.all(r)).every(Boolean)}const Fb={importPluginModule:()=>ul(()=>import("./_virtual_sandbox-plugin-Cg-1CvkF.js"),[]),importManifestModule:()=>ul(()=>import("./_virtual_sandbox-manifest-DbTeSIus.js"),[])};function za(){return{received:!1,value:void 0}}function IA(t,e,n=()=>!0){let r=za(),i=za(),s=!1,o=Promise.resolve();const a=()=>{s||(s=!0,queueMicrotask(()=>{s=!1;const l=r,c=i;r=za(),i=za();const u={importPluginModule:l.received?()=>Promise.resolve(l.value):e.importPluginModule,importManifestModule:c.received?()=>Promise.resolve(c.value):e.importManifestModule};o=o.then(()=>MA({...u,registry:t.registry,catalogService:t.catalog,pluginStylesheets:t.pluginStylesheets,getLocale:()=>t.locale.getLocale(),isCurrent:n,pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,telemetryGathering:t.telemetryGathering,eventStream:t.eventStream,rci:t.rci,theme:t.theme,tickerPool:t.tickerPool,overlayRuntime:t.overlayRuntime,navigation:()=>t.router.navigation()}})).then(()=>{}).catch(f=>{console.error("[mndw] Sandbox HMR transaction failed:",f)})}))};return{plugin:l=>{r={received:!0,value:l},a()},manifest:l=>{i={received:!0,value:l},a()}}}function zA(t,e=void 0,n=Fb,r=()=>!0){if(e===void 0)return;const i=IA(t,n,r);e.accept("virtual:sandbox-plugin",s=>{i.plugin(s)}),e.accept("virtual:sandbox-manifest",s=>{i.manifest(s)})}const DA=Xe({id:pe(),label:pe(),index:pn().finite().int().nonnegative(),type:pe(),group:pe(),color:pe(),interfaceId:pe()}),HA=Xe({list:zt(DA),layout:zt(zt(pe())),hasPortStats:vi()}),BA=Xe({switchports:HA,usbPortCount:pn().finite().int().nonnegative()});function Gb(){return{list:[],layout:[],hasPortStats:!1}}function UA(t){return BA.parse(t)}function $A(t,e){const n=e("single_usb_port")?1:Math.max(0,Math.trunc(t));if(n===0)return{ports:[]};if(!(e("usb_3")||e("usb_3_conf")))return{ports:Array.from({length:n},()=>"usb2")};const i=e("usb_3_first")?0:n-1;return{ports:Array.from({length:n},(o,a)=>a===i?"usb3":"usb2")}}const Np=Xe({exact:pe(),cdate:pe()}),Lp=Xe({version:pe()}),jA=Xe({release:pe(),sandbox:pe().optional(),title:pe().optional(),arch:pe(),ndm:Np,bsp:Np,ndw:Xe({version:pe().optional(),features:pe(),components:pe()}),ndw3:Lp.optional(),ndw4:Lp.optional(),manufacturer:pe(),vendor:pe(),series:pe(),model:pe(),hw_version:pe(),hw_type:pe().optional(),hw_id:pe(),device:pe(),region:pe(),description:pe()}),FA=t=>{const e={path:"show.version"};return t.driver.queue(e).pipe(N_(n=>jA.parse(n)))};function GA(t,e){return Promise.resolve({theme:t.getTheme(),locale:e.getLocale()})}function VA(){return{deviceName:"Unknown",vendor:"Unknown",manufacturer:"Unknown",model:"Unknown",series:"Unknown",region:"Unknown",hwId:"Unknown",hwVersion:"Unknown",firmwareVersion:"Unknown",firmwareRelease:"Unknown",features:[],components:[]}}async function ZA(t){try{const e=await _d(FA(t).pipe(wg(km)));return{deviceName:e.device??"Unknown",vendor:e.vendor??"Unknown",manufacturer:e.manufacturer??"Unknown",model:e.model??"Unknown",series:e.series??"Unknown",region:e.region??"Unknown",hwId:e.hw_id??"Unknown",hwVersion:e.hw_version??"Unknown",hwType:e.hw_type,firmwareVersion:e.title??"Unknown",firmwareRelease:e.release??"Unknown",architecture:e.arch,features:dh(e.ndw.features),components:dh(e.ndw.components)}}catch{return VA()}}async function WA(t,e){const n=ZA(e),r=Promise.resolve().then(()=>t.getDeviceHardware()).catch(()=>({switchports:Gb(),usbPortCount:0})),[i,s]=await Promise.all([n,r]),o=new Set(i.features.map(l=>l.toLowerCase())),a=$A(s.usbPortCount,l=>o.has(l.toLowerCase()));return{...i,switchports:s.switchports,usb:a}}function qA(){return!0}async function Ef(t,e={}){const n=GC(e.preservePluginLoadError),r=()=>n===Dr(),i=e.loadPlugins??PA,s=e.loadSandboxPlugin??AA,o=e.createRouter??(a=>t.router.create(a));try{try{const a=await GA(t.theme,t.locale);r()&&(Z.hostInfo=a)}catch(a){r()&&console.error("[mndw] Failed to fetch host info:",a)}if(!r())return;try{const a=await WA(t.mgmtClient,t.rci);r()&&(Z.deviceInfo=a)}catch(a){r()&&console.error("[mndw] Failed to fetch device info:",a)}if(!r())return;if(qA()){let a=Fb,l=e.setupHmr??((c,u)=>zA(c,void 0,void 0,u));{const c=await ul(()=>import("./sandbox-url-Cn4lLhV3.js"),[]);if(!r())return;a=c.sandboxUrlImports(),l=e.setupHmr??((u,f)=>c.setupSandboxUrlHmr(u,void 0,f))}if(await s({...a,registry:t.registry,catalogService:t.catalog,pluginStylesheets:t.pluginStylesheets,getLocale:()=>t.locale.getLocale(),isCurrent:r,pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,telemetryGathering:t.telemetryGathering,eventStream:t.eventStream,rci:t.rci,theme:t.theme,tickerPool:t.tickerPool,overlayRuntime:t.overlayRuntime,navigation:()=>t.router.navigation()}}),!r())return;l(t,r)}if(!r()||(o(t.registry),!r()))return;Z.ready=!0}finally{ZC(n)}return n}const Pl=Symbol("mndw.host-services");function KA(t){xw(Pl,t)}function vn(){if(!Pw(Pl))throw new Error("Host services context was not set");return Tw(Pl)}function YA(t){return new Map([[Pl,t]])}var XA=D('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),JA=D('<div class="mndw-login"><form class="mndw-login__form"><mndw-select><mndw-option>EN</mndw-option> <mndw-option>RU</mndw-option></mndw-select> <h1 class="mndw-login__title">mndw</h1> <mndw-field><mndw-input></mndw-input></mndw-field> <mndw-field><mndw-input></mndw-input></mndw-field> <p class="mndw-login__hint"> </p> <!> <mndw-button> </mndw-button></form></div>',2);function QA(t,e){Ze(e,!0);const n=vn();let r=ie(at(Z.loginUsername)),i=ie(""),s=ie(at(Z.loginError??"")),o=ie(!1),a=ie(!1);Z.loginUsername="",Z.loginError=null;let l;Fn(()=>{let he=!0;return(async()=>{await customElements.whenDefined("mndw-input");const ge=l;if(!he||!ge||(await ge.updateComplete,!he))return;const ye=T_();(ye===null||ye===document.body)&&ge.focus()})(),()=>{he=!1}});function c(){return d(r).trim()!==""&&d(i)!==""}function u(){return c()&&!d(o)&&!d(a)}function f(he){Z.localeSwitchPending||n.locale.setLocale(he.detail.value).catch(()=>{})}function h(he){k(r,he.detail.value,!0),k(a,!1)}function p(he){k(i,he.detail.value,!0),k(a,!1)}function m(he){const te=he.target,ge=he.composedPath()[0];he.key!=="Enter"||!(te instanceof HTMLElement)||te.localName!=="mndw-input"||ge instanceof HTMLButtonElement||(he.preventDefault(),u()&&g(he))}function g(he){he.preventDefault(),u()&&(k(o,!0),k(s,""),n.rci.login(d(r),d(i)).subscribe({next(te){if(te){const ge=d(r);Z.authenticated=!0;const ye=Ef(n),Me=Dr();ye.catch(()=>{Me===Dr()&&(hc(),Z.loginError=L("login.connection-failed"),Z.loginUsername=ge)})}else k(s,L("login.invalid-credentials"),!0),k(o,!1),k(a,!0)},error(){k(s,L("login.connection-failed"),!0),k(o,!1),k(a,!1)}}))}var b=JA(),_=v(b),y=v(_);Le(y,1,"mndw-login__locale-select"),w(()=>C(y,"label",L("nav.language"))),w(()=>C(y,"value",Z.locale)),w(()=>C(y,"aria-busy",String(Z.localeSwitchPending)));var O=v(y);C(O,"value","en");var N=T(O,2);C(N,"value","ru");var S=T(y,4);w(()=>C(S,"label",L("login.username")));var P=v(S);C(P,"name","username"),C(P,"autocomplete","username"),w(()=>C(P,"value",d(r))),w(()=>C(P,"disabled",d(o))),Ei(P,he=>l=he,()=>l);var M=T(S,2);w(()=>C(M,"label",L("login.password")));var z=v(M);C(z,"type","password"),C(z,"name","password"),C(z,"autocomplete","current-password"),w(()=>C(z,"value",d(i))),w(()=>C(z,"disabled",d(o)));var B=T(M,2),U=v(B),G=T(B,2);{var Y=he=>{var te=XA(),ge=v(te);w(()=>E(ge,d(s))),A(he,te)};J(G,he=>{d(s)&&he(Y)})}var oe=T(G,2);Le(oe,1,"mndw-login__submit"),C(oe,"variant","primary"),C(oe,"type","submit"),w(()=>C(oe,"disabled",!u()));var we=v(oe);w((he,te)=>{Oe(b,"data-locale",Z.locale),E(U,he),E(we,te)},[()=>L("login.hint"),()=>d(o)?L("login.logging-in"):L("login.submit")]),yt("submit",_,g),yt("mndwchange",y,f),yt("mndwinput",P,h),fe("keydown",P,m),yt("mndwinput",z,p),fe("keydown",z,m),A(t,b),We()}dt(["keydown"]);var eO=D('<div class="mndw-loading" role="status" aria-busy="true"> </div>'),tO=D("<!> <!> <!>",1);function nO(t,e){Ze(e,!0);const n=ti(()=>e.services);KA(n),Z.theme=n.theme.getTheme(),Z.locale=n.locale.getLocale(),Z.localeSwitchPending=n.locale.isLocaleSwitchPending();const r=n.theme.subscribeTheme(p=>{Z.theme=p}),i=n.locale.subscribeLocale(p=>{Z.locale=p}),s=n.locale.subscribeLocalePending(p=>{Z.localeSwitchPending=p});ni(()=>{r(),i(),s()});var o=tO(),a=et(o);RR(a,{get runtime(){return n.overlayRuntime}});var l=T(a,2);UR(l,{});var c=T(l,2);{var u=p=>{QA(p,{})},f=p=>{var m=jn(),g=et(m);cm(g,()=>Z.pluginLoadRevision,b=>{o0(b,{})}),A(p,m)},h=p=>{var m=eO(),g=v(m);w(b=>{Oe(m,"data-locale",Z.locale),E(g,b)},[()=>L("app.loading")]),A(p,m)};J(c,p=>{Z.authenticated?Z.ready?p(f,1):p(h,-1):p(u)})}A(t,o),We()}async function rO(t){const e=t.initLocale();t.defineUi(e),t.initTheme();try{await t.initPalette()}catch(i){console.warn("[mndw] Palette startup load failed; continuing to login.",i)}let n=!1;try{n=await t.checkAuthenticated()}catch{n=!1}t.setAuthenticated(n);let r=!1;if(t.subscribeAuthErrors(()=>{r=!0,t.resetToLogin()}),t.mountApp(),n&&!r){let i;try{const s=t.initAuthenticated();i=t.getAuthRunGeneration(),await s}catch{(i===void 0||i===t.getAuthRunGeneration())&&t.resetToLogin()}}}const Tn=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Kr=t=>typeof t=="string"&&t.length>0,wo=Object.freeze({"X-Mndw-Csrf":"1"}),iO=async t=>{try{return await t.json()}catch{return}};function sO(t,e){const n=Tn(t)?t:void 0,r=n==null?void 0:n.error,i=Tn(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:Kr(s)?s:"UNKNOWN",message:Kr(o)?o:e,detail:i==null?void 0:i.detail}}class ba extends Error{constructor(n,r,i,s){super(n);K(this,"code");K(this,"detail");K(this,"status");this.name="HostApiError",this.code=r,this.detail=i,this.status=s}}function oO(t){const e={};if(t instanceof Headers)return t.forEach((n,r)=>{e[r]=n}),e;if(Array.isArray(t)){for(const[n,r]of t)e[n]=r;return e}return t!==void 0&&Object.assign(e,t),e}function Ip(t,e,n){const r=Object.keys(t).find(i=>i.toLowerCase()===e.toLowerCase());t[r??e]=n}function ut(t){return t("Malformed response","UNKNOWN")}function _a(t,e){const n=()=>ut(e);async function r(o){try{return await o.json()}catch{throw n()}}async function i(o){const a=sO(await iO(o),o.statusText);return e(a.message,a.code,a.detail,o.status)}return{request:(async(o,a={})=>{var _;const{csrf:l,json:c,response:u,...f}=a,h=((_=f.method)==null?void 0:_.toUpperCase())??"GET",p=h!=="GET"&&h!=="HEAD"||l===!0,m=Object.prototype.hasOwnProperty.call(a,"json"),g={...f};if(m&&(g.body=JSON.stringify(c)),p||m){const y=oO(f.headers);if(m&&Ip(y,"Content-Type","application/json"),p)for(const[O,N]of Object.entries(wo))Ip(y,O,N);g.headers=y}const b=await t(o,g);if(!b.ok)throw await i(b);return u==="raw"?b:await r(b)}),parseJson:r,malformed:n,errorFromResponse:i}}class ps extends ba{constructor(e,n,r,i){super(e,n,r,i),this.name="MgmtError"}}const Vb=(t,e,n,r)=>new ps(t,e,n,r);function aO(t){switch(t){case"read":return km;case"mutation":return u0;case"install":return d0}}function ts(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function lO(t){if(!Tn(t)||!ts(t.maxConcurrentExecTotal)||!ts(t.maxConcurrentExecPerPlugin)||!ts(t.maxSupervisedServices)||!ts(t.currentExec)||!ts(t.reservedServices)||!Array.isArray(t.supportedServiceProtocols)||!t.supportedServiceProtocols.every(ts))throw ut(Vb);return{maxConcurrentExecTotal:t.maxConcurrentExecTotal,maxConcurrentExecPerPlugin:t.maxConcurrentExecPerPlugin,maxSupervisedServices:t.maxSupervisedServices,currentExec:t.currentExec,reservedServices:t.reservedServices,supportedServiceProtocols:t.supportedServiceProtocols}}function cO(t){return t instanceof DOMException&&t.name==="TimeoutError"||t instanceof TypeError?"ambiguous":t instanceof ps&&t.code==="BACKEND_MAINTENANCE"?"rejected-maintenance":"error"}function uO(t=globalThis.fetch,e=n=>AbortSignal.timeout(aO(n))){const n=_a(t,Vb);function r(a){return e(a)}async function i(a){if(a.status!==204)throw a.ok?new ps("The device returned an unexpected response.","UNKNOWN"):await n.errorFromResponse(a)}async function s(a,l,c){return await n.request(a,{method:"POST",json:{name:l},signal:r(c),response:"raw"})}async function o(a,l){const c=await s(a,l,a===lh?"install":"mutation");return cu(await n.parseJson(c))}return{async listPlugins(){return yb(await n.request(Sm,{method:"GET",signal:r("read")}))},async uploadPlugin(a){const l=await n.request(h0,{method:"POST",headers:{"Content-Type":"application/zip"},body:a,response:"raw"});if(l.status===201||l.status===202){const c=cu(await n.parseJson(l));return{status:l.status===201?"installed":"pending",entry:c}}throw await n.errorFromResponse(l)},approvePlugin:a=>o(lh,a),enablePlugin:a=>o(g0,a),disablePlugin:a=>o(m0,a),async setPluginCapability(a,l,c){const u=await n.request(f0,{method:"POST",json:{name:a,capability:l,enabled:c},signal:r("mutation")});return cu(u)},async denyPlugin(a){await s(p0,a,"mutation")},async deletePlugin(a){await s(v0,a,"mutation")},async restartPlugin(a){await s(b0,a,"mutation")},async getRuntime(){const a=await n.request(_0,{method:"GET",signal:r("read")});return lO(a)},async getDeviceHardware(){try{const a=await n.request(w0,{method:"GET",signal:r("read")});return UA(a)}catch{return{switchports:Gb(),usbPortCount:0}}},async getPalette(){const a=await n.request(Oc,{method:"GET",cache:"no-store",signal:r("read")});if(a===null||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,"palette"))throw new ps("The device returned an unexpected palette response.","UNKNOWN");return a.palette??null},async putPalette(a){const l=await n.request(Oc,{method:"PUT",json:a,signal:r("mutation"),response:"raw"});await i(l)},async deletePalette(){const a=await n.request(Oc,{method:"DELETE",signal:r("mutation"),response:"raw"});await i(a)},async getTelemetry(){const a=await n.request(ch,{method:"GET",signal:r("read")});if(a===null||typeof a!="object"||typeof a.enabled!="boolean")throw new ps("The device returned an unexpected telemetry response.","UNKNOWN");return{enabled:a.enabled}},async setTelemetry(a){const l=await n.request(ch,{method:"PUT",json:{enabled:a},signal:r("mutation"),response:"raw"});await i(l)}}}const zp={INVALID_ZIP:"errors.invalid-zip",MANIFEST_MISSING:"errors.manifest-missing",UNSUPPORTED_MANIFEST_VERSION:"errors.unsupported-manifest-version",CONFLICT:"errors.conflict",UPLOAD_TOO_LARGE:"errors.upload-too-large",OPKG_FAILED:"errors.opkg-failed",DAEMON_FAILED:"errors.daemon-failed",UNAUTHORIZED:"errors.unauthorized",SERVICE_CAPACITY_EXCEEDED:"errors.service-capacity",BACKEND_BUSY:"errors.backend-busy",BACKEND_UNAVAILABLE:"errors.backend-unavailable",BACKEND_INCOMPATIBLE:"errors.backend-incompatible",BACKEND_MAINTENANCE:"errors.backend-maintenance",CONTROLLER_SESSION_UNAVAILABLE:"errors.controller-session-unavailable",RCI_SOCKET_START_FAILED:"errors.rci-socket-start-failed"};function Sf(t,e,n){return t instanceof DOMException&&t.name==="TimeoutError"?e("errors.device-timeout"):t instanceof ps?t.code==="MANIFEST_INVALID"?Kr(t.detail)?`${e("errors.invalid-manifest")}: ${t.detail}`:e("errors.invalid-manifest"):(zp[t.code]===void 0?t.message:e(zp[t.code],t.code==="UPLOAD_TOO_LARGE"?{limit:n()}:void 0))||e("app.error"):t instanceof Error?t.message:e("app.error")}const ud="mndw-palette-override",dO=":root:root";function fO(t){const e=t.getElementById(ud);if(e instanceof HTMLStyleElement)return e;const n=t.createElement("style");return n.id=ud,t.head.appendChild(n),n}function ro(t,e){var n;if(e===null){(n=t.getElementById(ud))==null||n.remove();return}fO(t).textContent=vx(e,{selector:dO})}function ns(t){return Object.freeze({dark:{...t.dark},light:{...t.light}})}function hO(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function pO(t){const e=t.document??globalThis.document;let n=null;const r=new Set,i=()=>ns(n??oA),s=()=>{const a=i();for(const l of r)l(ns(a))},o=async a=>{const l=await t.mgmtClient.getPalette();let c=null;if(l!==null){const f=ib(l);if(f.palette===null)throw new Error("The device returned an invalid palette.");c=f.palette}const u=hO(n,c);n=c,ro(e,c),a&&u&&s()};return{getApplied:()=>n===null?null:ns(n),getExportable:i,getTokens:i,refreshPalette:async()=>{await o(!0)},initPalette:async()=>{try{await o(!1)}catch(a){console.warn("[mndw] Could not load the device palette; using defaults.",a)}},previewOverride:a=>{const l=ns(a);ro(e,l);for(const c of r)c(ns(l))},discardPreview:()=>{ro(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=ns(a),ro(e,n),s()},resetToDefault:async()=>{await t.mgmtClient.deletePalette(),n=null,ro(e,null),s()},subscribePalette:a=>(r.add(a),()=>{r.delete(a)})}}class yo extends ba{constructor(e,n,r,i){super(e,n,r,i),this.name="OpkgError"}}const On=(t,e,n,r)=>new yo(t,e,n,r);function gO(t){if(t.code!=="DEPENDENCY_CONFLICT"||!Tn(t.detail))return;const e=t.detail.package,n=t.detail.dependents;if(typeof e!="string"||e.length===0)return;const r=Array.isArray(n)&&n.every(i=>typeof i=="string");return{package:e,dependents:r?n:[]}}function mO(t){if(!Tn(t))throw ut(On);const e=t.name,n=t.version,r=t.description,i=t.status,s=t.newVersion,o=i==="installed"||i==="update_available"||i==="available";if(typeof e!="string"||e.length===0||typeof n!="string"||typeof r!="string"||!o||(i==="available"||i==="update_available")&&n.length===0)throw ut(On);if(i==="update_available"){if(typeof s!="string"||s.length===0)throw ut(On)}else if(s!==void 0)throw ut(On);return{name:e,version:n,description:r,status:i,...s===void 0?{}:{newVersion:s}}}function vO(t){if(!Tn(t)||!Array.isArray(t.packages))throw ut(On);const e=t.metadataUpdatedAt;if(e!==null&&typeof e!="string"||typeof e=="string"&&Number.isNaN(Date.parse(e)))throw ut(On);return{packages:t.packages.map(n=>mO(n)),metadataUpdatedAt:e}}function bO(t){if(!Tn(t))throw ut(On);const e=t.status;if(typeof t.name!="string"||t.name.length===0||typeof t.version!="string"||typeof t.description!="string"||!Array.isArray(t.dependencies)||!t.dependencies.every(o=>typeof o=="string")||e!=="installed"&&e!=="update_available"&&e!=="available")throw ut(On);const n=["size","installedSize","installedTime"];for(const o of n)if(t[o]!==void 0&&typeof t[o]!="string")throw ut(On);const r=typeof t.size=="string"?t.size:void 0,i=typeof t.installedSize=="string"?t.installedSize:void 0,s=typeof t.installedTime=="string"?t.installedTime:void 0;return{name:t.name,version:t.version,description:t.description,dependencies:t.dependencies,status:e,...r===void 0?{}:{size:r},...i===void 0?{}:{installedSize:i},...s===void 0?{}:{installedTime:s}}}function _O(t){if(!Tn(t)||t.ok!==!0||typeof t.message!="string"||!Array.isArray(t.packages)||!t.packages.every(e=>typeof e=="string"))throw ut(On);return{message:t.message,packages:t.packages}}function wO(t){if(!Tn(t)||t.ok!==!0||typeof t.message!="string")throw ut(On);return{message:t.message}}function yO(t=globalThis.fetch){const e=_a(t,On);async function n(r,i){const s=await e.request(r,{method:"POST",json:{packages:i}});return _O(s)}return{async list(){const r=await e.request(y0,{method:"GET"});return vO(r)},async info(r){const i=new URLSearchParams({name:r}),s=await e.request(`${x0}?${i.toString()}`,{method:"GET"});return bO(s)},install:r=>n(k0,r),remove:r=>n(E0,r),upgrade:r=>n(T0,r),async update(){const r=await e.request(S0,{method:"POST",json:{}});return wO(r)}}}class dd extends ba{constructor(e,n,r,i){super(e,n,i,r),this.name="ServiceError"}}const Ds=(t,e,n,r)=>new dd(t,e,r,n);function Tf(t){if(!Tn(t)||typeof t.name!="string"||typeof t.label!="string"||t.state!=="running"&&t.state!=="stopped"&&t.state!=="unknown"||typeof t.enabledAtBoot!="boolean"||t.pid!==void 0&&typeof t.pid!="number"||typeof t.autostartPinned!="boolean"||typeof t.protected!="boolean")throw ut(Ds);return{name:t.name,label:t.label,state:t.state,enabledAtBoot:t.enabledAtBoot,...t.pid===void 0?{}:{pid:t.pid},autostartPinned:t.autostartPinned,protected:t.protected}}function kO(t){if(!Tn(t)||!Array.isArray(t.services))throw ut(Ds);return t.services.map(e=>Tf(e))}function Dp(t){if(!Tn(t)||t.ok!==!0||t.service===void 0)throw ut(Ds);return{ok:!0,service:Tf(t.service)}}function EO(t=globalThis.fetch){const e=_a(t,Ds);async function n(r,i){const s=await e.request(r,{method:"POST",json:{name:i}});return Dp(s)}return{async list(){return kO(await e.request(O0,{method:"GET"}))},async status(r,i){const s=new URLSearchParams({name:r}),o=await e.request(`${M0}?${s.toString()}`,{method:"GET",signal:i});if(!Tn(o)||o.service===void 0)throw ut(Ds);return Tf(o.service)},start:r=>n(N0,r),stop:r=>n(L0,r),restart:r=>n(I0,r),async setEnabled(r,i){const s=await e.request(z0,{method:"POST",json:{name:r,enabled:i}});return Dp(s)}}}class Zb extends ba{constructor(e,n,r,i){super(e,n,i,r),this.name="SelfUpdateError"}}const _r=(t,e,n,r)=>new Zb(t,e,r,n),Wb=t=>t==="update"||t==="revert";function SO(t){if(!Tn(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!Kr(t.version)||t.operation!==void 0&&!Wb(t.operation))throw ut(_r);for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!Kr(t[i]))throw ut(_r);const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.failureCode===void 0?void 0:t.failureCode,r=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{state:t.state,version:t.version,...t.operation===void 0?{}:{operation:t.operation},...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{failureCode:n},...r===void 0?{}:{rollbackVersion:r}}}function TO(t){if(!Tn(t)||!Kr(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!Kr(t.targetVersion)||t.rollbackVersion!==void 0&&!Kr(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw ut(_r);const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{currentVersion:t.currentVersion,updateAvailable:t.updateAvailable,rollbackAvailable:t.rollbackAvailable,...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{rollbackVersion:n}}}function Hp(t){if(!Tn(t)||!Wb(t.operation)||!Kr(t.targetVersion))throw ut(_r);return{operation:t.operation,targetVersion:t.targetVersion}}function xO(t=globalThis.fetch){const e=_a(t,_r);async function n(r){return e.request(r,{method:"POST",json:{}})}return{async status(){return SO(await e.request(P0,{method:"GET"}))},async check(){return TO(await n(C0))},async apply(){return Hp(await n(R0))},async revert(){return Hp(await n(A0))}}}class PO{constructor(e){K(this,"plugins",new Si);K(this,"catalog");this.catalog=e.catalog}register(e){if(this.plugins.has(e.entry.name))throw new Error(`Duplicate plugin name "${e.entry.name}"`);this.plugins.set(e.entry.name,e),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog)}replace(e){var r,i;const n=this.plugins.get(e.entry.name);if(n===void 0)throw new Error(`Cannot replace unknown plugin "${e.entry.name}"`);if(n.entry.type!==e.entry.type)throw new Error(`Cannot change plugin "${e.entry.name}" type from ${n.entry.type} to ${e.entry.type}`);if(n.entry.type==="page"&&e.entry.type==="page"&&n.entry.route!==e.entry.route)throw new Error(`Cannot change page "${e.entry.name}" route from ${n.entry.route} to ${e.entry.route}`);return n.entry.version===e.entry.version?e.stylesheetLease===void 0&&n.stylesheetLease!==void 0?e.stylesheetLease=n.stylesheetLease:e.stylesheetLease!==n.stylesheetLease&&((r=n.stylesheetLease)==null||r.release()):(i=n.stylesheetLease)==null||i.release(),this.plugins.set(e.entry.name,e),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog),n}get(e){return this.plugins.get(e)}remove(e){var r;const n=this.plugins.get(e);if(n!==void 0)return this.plugins.delete(e),(r=n.stylesheetLease)==null||r.release(),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),n}getWidgets(){return[...this.plugins.values()].filter(e=>e.entry.type==="widget")}getPages(){return[...this.plugins.values()].filter(e=>e.entry.type==="page")}getAll(){return[...this.plugins.values()]}clear(){var e;for(const n of this.plugins.values())(e=n.stylesheetLease)==null||e.release(),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog);this.plugins.clear(),this.catalog.clearPluginCatalogCells()}}function CO(t){return new PO(t)}const RO=["transient","unauthorized","validation","redemption-failed","controller-unavailable","malformed-response"];class Pr extends Error{constructor(n,r){super(n);K(this,"code");K(this,"status");this.name="PersistentRciSessionError",this.code=n,this.status=r}}const Da="/api/mndw/rci-session",AO=["offline","establishing","live","dead"],OO=["certificate-invalid","no-auth-token","missing-fqdn"],MO=["token","none","unknown"],NO=["supported","invalid","unsupported","unknown","needs-token"],LO=["ok","empty","disabled","decrypt-failed"];class IO{async getCapability(){const e=await this.read(await mo(`${Da}/capability`,{headers:{...wo}}));return this.parseCapability(e)}async testController(e){return await this.read(await this.post("/controller/test",{token:e}))}async saveController(e){return await this.read(await this.post("/controller",{token:e}))}async clearController(){await this.read(await mo(`${Da}/controller`,{method:"DELETE",headers:{...wo}}))}async setEnabled(e){await this.read(await mo(`${Da}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...wo},body:JSON.stringify({enabled:e})}))}async post(e,n){return await mo(`${Da}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...wo},body:JSON.stringify(n)})}async read(e){const n=await e.text();let r;try{r=n===""?void 0:JSON.parse(n)}catch{throw new Pr("MALFORMED_RESPONSE",e.status)}if(!e.ok){const i=this.errorCode(r)??`HTTP_${e.status}`;throw new Pr(i,e.status)}return r}parseCapability(e){if(!this.isRecord(e)||!this.isRecord(e.store)||!this.isRecord(e.controller)||!Array.isArray(e.extenders)||typeof e.stale!="boolean"||!this.isStoreState(e.store.state)||!this.isSupport(e.controller.support)||!this.isAuthMode(e.controller.auth)||typeof e.controller.enabled!="boolean")throw new Pr("MALFORMED_RESPONSE",200);const n={support:e.controller.support,auth:e.controller.auth,enabled:e.controller.enabled};if(e.controller.lastCheckedAt!==void 0){if(typeof e.controller.lastCheckedAt!="string")throw new Pr("MALFORMED_RESPONSE",200);n.lastCheckedAt=e.controller.lastCheckedAt}const r=e.extenders.map(s=>this.parseExtender(s)),i={store:{state:e.store.state},controller:n,extenders:r,stale:e.stale};if(e.lastEnumerationError!==void 0){if(!this.isFailureCategory(e.lastEnumerationError))throw new Pr("MALFORMED_RESPONSE",200);i.lastEnumerationError=e.lastEnumerationError}if(e.lastEnumerationErrorAt!==void 0){if(typeof e.lastEnumerationErrorAt!="string")throw new Pr("MALFORMED_RESPONSE",200);i.lastEnumerationErrorAt=e.lastEnumerationErrorAt}return i}parseExtender(e){if(!this.isRecord(e)||typeof e.identity!="string"||typeof e.name!="string"||typeof e.eligible!="boolean")throw new Pr("MALFORMED_RESPONSE",200);if(!e.eligible){if(!this.isEligibilityReason(e.reason)||e.state!==void 0||e.lastError!==void 0||e.lastHeartbeatAt!==void 0)throw new Pr("MALFORMED_RESPONSE",200);return{identity:e.identity,name:e.name,eligible:!1,reason:e.reason}}if(e.reason!==void 0||e.state!==void 0&&!this.isSessionState(e.state)||e.lastError!==void 0&&!this.isFailureCategory(e.lastError)||e.lastHeartbeatAt!==void 0&&typeof e.lastHeartbeatAt!="string")throw new Pr("MALFORMED_RESPONSE",200);const n={identity:e.identity,name:e.name,eligible:!0};return e.state!==void 0&&(n.state=e.state),e.lastError!==void 0&&(n.lastError=e.lastError),e.lastHeartbeatAt!==void 0&&(n.lastHeartbeatAt=e.lastHeartbeatAt),n}errorCode(e){if(this.isRecord(e)&&this.isRecord(e.error)&&typeof e.error.code=="string")return e.error.code}isRecord(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}isStoreState(e){return typeof e=="string"&&LO.includes(e)}isSupport(e){return typeof e=="string"&&NO.includes(e)}isAuthMode(e){return typeof e=="string"&&MO.includes(e)}isSessionState(e){return typeof e=="string"&&AO.includes(e)}isEligibilityReason(e){return typeof e=="string"&&OO.includes(e)}isFailureCategory(e){return typeof e=="string"&&RO.includes(e)}}function zO(){return new IO}const DO=3e4,HO={path:"show.system"};class BO{constructor(){K(this,"transport");K(this,"heartbeatSubscription",null);K(this,"driver");K(this,"auth");const e=window.location.origin;this.transport=new j_,this.auth=new F_(e,this.transport),this.driver=new G_(e,this.transport)}login(e,n){return this.auth.login(e,n).pipe(Sc(r=>{r?this.startHeartbeat():this.stopHeartbeat()}))}logout(){return this.stopHeartbeat(),this.auth.logout()}isAuthenticated(){return this.auth.isAuthenticated().pipe(Sc(e=>{e?this.startHeartbeat():this.stopHeartbeat()}))}get authError$(){return this.transport.authError$.pipe(Sc(()=>this.stopHeartbeat()))}startHeartbeat(){this.heartbeatSubscription===null&&(this.heartbeatSubscription=L_(0,DO).pipe(I_(()=>this.heartbeatRequest())).subscribe())}stopHeartbeat(){var e;(e=this.heartbeatSubscription)==null||e.unsubscribe(),this.heartbeatSubscription=null}heartbeatRequest(){return this.driver.queue(HO).pipe(z_(()=>D_))}}function UO(){return new BO}function $O(t=globalThis.fetch){return JP(t)}const jO=500,FO=5e3,Bp=.2,GO=100,VO=1024,ZO=2048,WO=t=>(typeof t=="string"?[t]:[...t]).flatMap(n=>n.split(",")).filter(n=>n.length>0),qO=(t,e)=>t==="*"||e===t||e.startsWith(`${t}.`),KO=(t,e)=>{if(t==="*")return e;if(e==="*"||t===e||t.startsWith(`${e}.`))return t;if(e.startsWith(`${t}.`))return e},YO=(t,e)=>{const n=new Set;for(const r of t)for(const i of e){const s=KO(r,i);s!==void 0&&n.add(s)}return[...n]},XO=t=>{const e=t.split(".",1)[0]??t;return new Error(`Event topic "${t}" is not granted; add manifest capability "events:${e}".`)},JO=(t,e)=>e.some(n=>n==="*"||t===n||t.startsWith(`${n}.`)),QO=t=>{const e=new Set;for(const n of t){if(!n.startsWith("events:"))continue;const r=n.slice(7);for(const i of r.split(","))(i==="*"||/^[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)*$/.test(i))&&e.add(i)}return[...e]},eM=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0,fd=t=>{if(Array.isArray(t)){for(const n of t)fd(n);Object.freeze(t);return}if(t===null||typeof t!="object")return;const e=Object.getPrototypeOf(t);if(!(e!==Object.prototype&&e!==null)){for(const n of Object.values(t))fd(n);Object.freeze(t)}};class tM{constructor(e={}){K(this,"socketFactory");K(this,"schedule");K(this,"cancelSchedule");K(this,"random");K(this,"diagnostic");K(this,"registrations",new Map);K(this,"deliveredIds",new Set);K(this,"deliveredOrder",[]);K(this,"liveBuffer",[]);K(this,"socket");K(this,"lastSentWireFilters");K(this,"reconnectTimer");K(this,"reconnectAttempt",0);K(this,"nextHandlerId",1);K(this,"lastSeenId","");K(this,"replayCursor","");K(this,"catchingUp",!1);K(this,"replaying",!1);K(this,"closing",!1);this.socketFactory=e.WebSocket??(typeof WebSocket>"u"?void 0:WebSocket),this.schedule=e.setTimeout??globalThis.setTimeout,this.cancelSchedule=e.clearTimeout??globalThis.clearTimeout,this.random=e.random??Math.random,this.diagnostic=e.diagnostic??((n,r)=>console.warn(`[mndw] ${n}`,r))}createFacade(e,n,r,i){const s=QO(r);return this.disposeFacade(e),this.registrations.set(e,{id:e,pluginName:n,grants:s,subscriptions:new Map,resyncHandlers:new Map}),{select$:o=>this.selectEvents(e,o,i),resync$:new tl(o=>{const a=this.registrations.get(e);if(a===void 0){o.complete();return}if(a.grants.length===0){o.complete();return}const l=this.nextHandlerId++;return a.resyncHandlers.set(l,()=>o.next()),()=>{a.resyncHandlers.delete(l)}}).pipe(jf(i.ended$))}}selectEvents(e,n,r){return new tl(i=>{const s=this.registrations.get(e);if(s===void 0){i.complete();return}const o=WO(n),a=o.find(u=>u!=="*"&&!JO(u,s.grants));if(a!==void 0){i.error(XO(a));return}const l=YO(o,s.grants);if(l.length===0){i.complete();return}const c=this.nextHandlerId++;return s.subscriptions.set(c,{filters:l,handler:u=>i.next(u)}),this.updateWireSubscription(),()=>{s.subscriptions.delete(c)&&this.updateWireSubscription()}}).pipe(jf(r.ended$))}disposeFacade(e){this.registrations.delete(e)&&(this.updateWireSubscription(),this.registrations.size===0&&this.closeSocket())}effectiveWireFilters(){const e=new Set;for(const n of this.registrations.values())for(const r of n.subscriptions.values())for(const i of r.filters)e.add(i);return[...e].sort()}ensureSocket(){if(this.socket!==void 0||this.reconnectTimer!==void 0||this.closing||this.effectiveWireFilters().length===0)return;if(this.socketFactory===void 0){this.diagnostic("event stream WebSocket is unavailable");return}const e=new this.socketFactory("/ws/events");this.socket=e,e.addEventListener("open",()=>this.handleOpen(e)),e.addEventListener("message",n=>this.handleMessage(e,n.data)),e.addEventListener("close",()=>this.handleClose(e)),e.addEventListener("error",n=>this.diagnostic("event stream socket error",n))}handleOpen(e){this.socket===e&&(this.reconnectAttempt=0,this.lastSentWireFilters=void 0,this.sendSubscribe(),this.catchingUp=!0,this.replaying=!1,this.replayCursor=this.lastSeenId,this.requestReplay(this.lastSeenId))}handleClose(e){this.socket===e&&(this.socket=void 0,this.lastSentWireFilters=void 0,this.registrations.size>0&&!this.closing&&this.scheduleReconnect())}handleMessage(e,n){if(this.socket!==e||typeof n!="string")return;let r;try{r=JSON.parse(n)}catch(s){this.diagnostic("event stream returned invalid JSON",s);return}const i=eM(r);(i==null?void 0:i.type)==="event"?this.handleIncomingEvent(i.event):(i==null?void 0:i.type)==="replay"?this.handleReplay(i):(i==null?void 0:i.type)==="error"&&this.handleServerError(i)}handleIncomingEvent(e){const n=Dh.safeParse(e);if(!n.success){this.diagnostic("event stream returned invalid event",n.error);return}if(this.catchingUp){if(this.liveBuffer.length>=VO){this.liveBuffer.length=0,this.closeActiveSocket();return}this.liveBuffer.push(n.data);return}this.deliver(n.data)}handleReplay(e){if(!this.catchingUp||!Array.isArray(e.events)||typeof e.hasMore!="boolean")return;const n=e.events.map(i=>Dh.safeParse(i)).filter(i=>i.success);for(const i of n)i.success&&(this.replayCursor=i.data.id,this.deliver(i.data));if(this.replaying=!1,e.hasMore&&this.replayCursor!==""){this.requestReplay(this.replayCursor);return}this.catchingUp=!1,this.replaying=!1;const r=this.liveBuffer.splice(0);for(const i of r)this.deliver(i);for(const i of this.registrations.values())for(const s of i.resyncHandlers.values())try{s()}catch(o){this.diagnostic(`event resync handler failed for ${i.pluginName}`,o)}}handleServerError(e){if(e.code==="CURSOR_EXPIRED"){this.catchingUp=!1,this.replaying=!1;const r=this.liveBuffer.splice(0);for(const i of r)this.deliver(i);this.diagnostic("event stream replay cursor expired");for(const i of this.registrations.values())for(const s of i.resyncHandlers.values())try{s()}catch(o){this.diagnostic(`event resync handler failed for ${i.pluginName}`,o)}return}const n=typeof e.message=="string"?e.message:typeof e.code=="string"?e.code:"unknown";this.diagnostic(`event stream server error: ${n}`)}deliver(e){if(this.lastSeenId=e.id,!this.deliveredIds.has(e.id)){for(this.deliveredIds.add(e.id),this.deliveredOrder.push(e.id);this.deliveredOrder.length>ZO;){const n=this.deliveredOrder.shift();n!==void 0&&this.deliveredIds.delete(n)}fd(e);for(const n of this.registrations.values())for(const r of n.subscriptions.values())if(r.filters.some(i=>qO(i,e.topic)))try{r.handler(e)}catch(i){this.diagnostic(`event handler failed for ${n.pluginName}`,i)}}}sendSubscribe(e=this.effectiveWireFilters()){const n=this.lastSentWireFilters;(n==null?void 0:n.length)===e.length&&n.every((r,i)=>r===e[i])||(this.send({type:"subscribe",topics:[...e]}),this.lastSentWireFilters=[...e])}updateWireSubscription(){const e=this.effectiveWireFilters();if(e.length===0){this.closeSocket();return}const n=this.socket;(n==null?void 0:n.readyState)===1&&this.sendSubscribe(e),this.ensureSocket()}requestReplay(e){this.replaying||(this.replaying=!0,this.send({type:"replay",after:e,limit:GO}))}send(e){const n=this.socket;(n==null?void 0:n.readyState)===1&&n.send(JSON.stringify(e))}scheduleReconnect(){if(this.reconnectTimer!==void 0||this.effectiveWireFilters().length===0)return;const e=Math.min(FO,jO*2**this.reconnectAttempt++),n=1-Bp+this.random()*2*Bp;this.reconnectTimer=this.schedule(()=>{this.reconnectTimer=void 0,this.ensureSocket()},Math.round(e*n))}closeActiveSocket(){const e=this.socket;e!==void 0&&(this.catchingUp=!1,this.replaying=!1,e.close(1008,"event stream catch-up overflow"))}closeSocket(){this.reconnectTimer!==void 0&&(this.cancelSchedule(this.reconnectTimer),this.reconnectTimer=void 0),this.catchingUp=!1,this.replaying=!1,this.liveBuffer.length=0,this.lastSentWireFilters=void 0;const e=this.socket;this.socket=void 0,e!==void 0&&e.close(1e3,"no event subscribers")}}function nM(t={}){return new tM(t)}let rM=0;function iM(t){const e=new Map,n=`host-telemetry-gathering:${++rM}`;let r=1,i=null,s=0,o,a=!1;const l=()=>{for(const p of[...e.values()])p()},c=p=>{(i==null?void 0:i.enabled)!==p&&(i=Object.freeze({enabled:p}),l())},u=()=>{const p=++s;t.getTelemetry().then(({enabled:m})=>{p===s&&c(m)}).catch(()=>{})},f=()=>{if(o===void 0)return;const p=o;o=void 0,p.end(),a&&(a=!1,t.eventStream.disposeFacade(n))},h=()=>{o=Ab();const p=t.eventStream.createFacade(n,"host",["events:telemetry"],o);p!==void 0&&(a=!0,p.select$("telemetry.gathering_changed").subscribe(m=>{m.topic==="telemetry.gathering_changed"&&(s+=1,c(m.payload.enabled))}),p.resync$.subscribe(u)),u()};return{get:()=>i,subscribe:p=>{const m=r++;return e.set(m,p),e.size===1&&h(),()=>{e.delete(m)&&e.size===0&&f()}},report:p=>{s+=1,c(p)}}}const Up=`${jd}:theme`,hu="dark";function sM(t={}){const e=t.document??globalThis.document;let n=hu;const r=new Set;function i(){try{const h=(t.storage??globalThis.localStorage).getItem(Up);return h==="light"||h==="dark"?h:hu}catch{return hu}}function s(h){e.documentElement.dataset.theme=h}function o(h){for(const p of r)p(h)}function a(){return n=i(),s(n),o(n),n}function l(){return n}function c(h){if(h!==n){n=h,s(h);try{(t.storage??globalThis.localStorage).setItem(Up,h)}catch{}o(h)}}function u(){c(n==="dark"?"light":"dark")}function f(h){return r.add(h),()=>{r.delete(h)}}return Object.freeze({initTheme:a,getTheme:l,setTheme:c,toggleTheme:u,subscribeTheme:f})}const oM=()=>new Worker(new URL("/assets/ticker-pool.worker-DJA1ERT2.js",import.meta.url),{type:"module"});function aM(t=oM){const e=new Map;let n=1,r;const i=()=>{let l=0;for(const c of e.values())c.running&&!c.destroyed&&(l+=1);return l},s=()=>{if(i()!==0||r===void 0)return;const l=r;r=void 0,l.onmessage=null,l.terminate()},o=()=>{if(r!==void 0)return r;const l=t();return l.onmessage=c=>{const u=e.get(c.data.id);u!==void 0&&u.running&&!u.destroyed&&u.subject.next({timestamp:c.data.timestamp,drift:c.data.drift})},r=l,l};return Object.freeze({create:l=>{const c={id:n++,subject:new H_,running:!1,destroyed:!1,interval:1e3};e.set(c.id,c);const u=new B_,f=()=>{c.destroyed||(c.running&&(c.running=!1,r==null||r.postMessage({command:"stop",id:c.id})),c.destroyed=!0,e.delete(c.id),u.unsubscribe(),c.subject.complete(),s())};return u.add(l.ended$.subscribe(f)),{start:h=>{c.destroyed||(c.interval=h,c.running=!0,o().postMessage({command:"start",id:c.id,interval:h}))},setInterval:h=>{c.destroyed||(c.interval=h,r!==void 0&&r.postMessage({command:"setInterval",id:c.id,interval:h}))},stop:()=>{c.destroyed||!c.running||(c.running=!1,r==null||r.postMessage({command:"stop",id:c.id}),s())},tick$:c.subject.asObservable(),destroy:f}}})}class lM{constructor(){K(this,"stylesheets",new Map)}acquire(e,n,r){let i=this.stylesheets.get(e);i===void 0&&(i=new Map,this.stylesheets.set(e,i));const s=i.get(n);if(s!==void 0)return s.leases+=1,this.createLease(e,i,s);const o=document.createElement("link");let a=()=>{};const l=new Promise(u=>{a=u}),c={version:n,link:o,loaded:l,resolveLoaded:a,leases:1};return o.rel="stylesheet",o.href=r,o.dataset.pluginStyle=e,o.onload=()=>c.resolveLoaded(),o.onerror=()=>{console.warn(`[mndw] No stylesheet for plugin "${e}" at ${r}`),c.resolveLoaded()},i.set(n,c),document.head.appendChild(o),this.createLease(e,i,c)}retain(e,n){const r=this.stylesheets.get(e),i=r==null?void 0:r.get(n);return r===void 0||i===void 0?{loaded:Promise.resolve(),release:()=>{}}:(i.leases+=1,this.createLease(e,r,i))}createLease(e,n,r){let i=!1;return{loaded:r.loaded,release:()=>{i||(i=!0,r.leases-=1,!(r.leases!==0||n.get(r.version)!==r)&&(n.delete(r.version),n.size===0&&this.stylesheets.get(e)===n&&this.stylesheets.delete(e),r.link.remove(),r.resolveLoaded()))}}}}const cM=1e4;function uM(t){switch(t){case"modal":return{placement:"center",closeOnEscape:!0,closeOnOutsideClick:!1,trapFocus:!0,restoreFocus:!0,lockScroll:!0,backdrop:!0};case"drawer":return{placement:"right",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!0,restoreFocus:!0,lockScroll:!0,backdrop:!0};case"popover":return{placement:"bottom-start",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!1,restoreFocus:!1,lockScroll:!1,backdrop:!1};case"custom":return{placement:"center",closeOnEscape:!1,closeOnOutsideClick:!1,trapFocus:!1,restoreFocus:!1,lockScroll:!1,backdrop:!1}}}var ea,ta,na,ra,ia,sa;class $p{constructor(e,n,r,i,s){K(this,"id");K(this,"pluginName");K(this,"instanceId");K(this,"kind");K(this,"hostElement");K(this,"contentElement");xe(this,ea,ie("opening"));xe(this,ta,ie(null));xe(this,na,ie("center"));K(this,"mobileSheet");xe(this,ra,ie(void 0));xe(this,ia,ie(at({})));xe(this,sa,ie(null));K(this,"behavior");K(this,"closeOnEscape");K(this,"closeOnOutsideClick");K(this,"trapFocus");K(this,"restoreFocus");K(this,"lockScroll");K(this,"backdrop");K(this,"closed");K(this,"abortController",new AbortController);K(this,"anchorElement");K(this,"cleanup",null);K(this,"onCloseListeners",new Set);K(this,"previousFocus");K(this,"closedResolve");K(this,"openTimeout");K(this,"focusTrap",null);K(this,"repositionHandler",null);K(this,"anchorObserver",null);K(this,"runtime");var a;this.runtime=e,this.id=e.allocateLayerId(),this.pluginName=n,this.instanceId=r,this.kind=i.kind;const o=uM(i.kind);this.behavior=o,this.closeOnEscape=i.closeOnEscape??o.closeOnEscape,this.closeOnOutsideClick=i.closeOnOutsideClick??o.closeOnOutsideClick,this.trapFocus=i.trapFocus??o.trapFocus,this.restoreFocus=i.restoreFocus??o.restoreFocus,this.lockScroll=i.lockScroll??o.lockScroll,this.backdrop=o.backdrop,this.shell=s,this.placement=Uf(i.kind,i.placement),this.mobileSheet=x_(i.kind),this.className=i.className,this.sizing=$f(i.kind,i,this.mobileSheet),this.anchorElement=((a=i.anchor)==null?void 0:a.element)??null,this.hostElement=document.createElement("div"),this.hostElement.className="mndw-overlay-layer",this.contentElement=document.createElement("div"),this.contentElement.className="mndw-overlay-content",s||this.hostElement.appendChild(this.contentElement),this.previousFocus=this.restoreFocus&&document.activeElement instanceof HTMLElement?document.activeElement:null,this.closed=new Promise(l=>{this.closedResolve=l}),this.openTimeout=setTimeout(()=>{this.state==="opening"&&this.closeInternal("mount-failed")},cM),this.attachAnchorObservers()}get state(){return d(x(this,ea))}set state(e){k(x(this,ea),e,!0)}get shell(){return d(x(this,ta))}set shell(e){k(x(this,ta),e,!0)}get placement(){return d(x(this,na))}set placement(e){k(x(this,na),e,!0)}get className(){return d(x(this,ra))}set className(e){k(x(this,ra),e,!0)}get sizing(){return d(x(this,ia))}set sizing(e){k(x(this,ia),e,!0)}get position(){return d(x(this,sa))}set position(e){k(x(this,sa),e,!0)}get isOpen(){return this.state==="opening"||this.state==="open"}get signal(){return this.abortController.signal}close(e,n="api"){this.closeInternal(n,e)}closeWithReason(e,n){this.closeInternal(e,n)}setCleanup(e){this.state!=="closed"&&(this.cleanup=e)}markReady(){this.state==="opening"&&(this.clearOpenTimeout(),this.state="open",this.trapFocus&&requestAnimationFrame(()=>this.activateFocusTrap()))}update(e){if(this.isOpen){if(e.className!==void 0&&(this.className=e.className),e.placement!==void 0&&(this.placement=Uf(this.kind,e.placement)),e.anchor!==void 0&&!this.shell&&(this.anchorElement=e.anchor.element,this.attachAnchorObservers()),this.shell){const n={...this.shell??{showCloseButton:!0}};e.title!==void 0&&(n.title=e.title),e.description!==void 0&&(n.description=e.description),e.showCloseButton!==void 0&&(n.showCloseButton=e.showCloseButton),this.shell=n}(e.width!==void 0||e.height!==void 0||e.maxWidth!==void 0||e.maxHeight!==void 0)&&(this.sizing=$f(this.kind,{kind:this.kind,width:e.width,height:e.height,maxWidth:e.maxWidth,maxHeight:e.maxHeight},this.mobileSheet)),this.reposition()}}onClose(e){return this.onCloseListeners.add(e),()=>{this.onCloseListeners.delete(e)}}reposition(){if(this.kind!=="popover"||!this.anchorElement)return;const e=this.contentElement.getBoundingClientRect();if(e.width<=0||e.height<=0)return;const n=P_({element:this.anchorElement},{width:e.width,height:e.height},this.placement);this.placement=n.placement,this.position={top:n.top,left:n.left}}attachAnchorObservers(){if(this.detachAnchorObservers(),this.kind!=="popover"||!this.anchorElement)return;const e=this.anchorElement;this.repositionHandler=()=>{requestAnimationFrame(()=>this.reposition())},window.addEventListener("scroll",this.repositionHandler,!0),window.addEventListener("resize",this.repositionHandler),this.anchorObserver=new MutationObserver(()=>{e.isConnected||this.closeInternal("anchor-lost")}),this.anchorObserver.observe(document.body,{childList:!0,subtree:!0})}detachAnchorObservers(){var e;this.repositionHandler&&(window.removeEventListener("scroll",this.repositionHandler,!0),window.removeEventListener("resize",this.repositionHandler),this.repositionHandler=null),(e=this.anchorObserver)==null||e.disconnect(),this.anchorObserver=null}clearOpenTimeout(){this.openTimeout!==void 0&&(clearTimeout(this.openTimeout),this.openTimeout=void 0)}async closeInternal(e,n){var s;if(this.state==="closing"||this.state==="closed")return;this.state="closing",(s=this.focusTrap)==null||s.deactivate(),this.focusTrap=null,this.clearOpenTimeout(),this.abortController.abort(),this.detachAnchorObservers();const r=this.cleanup;if(r)try{await(r instanceof Promise?await r:r)()}catch(o){console.error(`[mndw] Overlay cleanup for "${this.pluginName}" failed:`,o)}this.restoreFocusOnClose(),this.runtime.removeLayer(this),this.state="closed";const i={reason:e,result:n};this.closedResolve(i);for(const o of this.onCloseListeners)try{o(i)}catch(a){console.error(`[mndw] Overlay onClose listener for "${this.pluginName}" failed:`,a)}}restoreFocusOnClose(){var n,r;const e=document.activeElement;if(this.kind==="popover"&&((n=this.anchorElement)!=null&&n.isConnected)){const i=this.contentElement.contains(e),s=!e||e===document.body;(i||s)&&this.anchorElement.focus();return}this.restoreFocus&&((r=this.previousFocus)!=null&&r.isConnected)&&this.previousFocus.focus()}activateFocusTrap(){this.state!=="open"||this.focusTrap||!this.hostElement.isConnected||(this.focusTrap=bu(this.hostElement,{initialFocus:()=>R_(this.contentElement)[0]??null,restoreFocus:!1,allowFocus:e=>this.runtime.store.layers.some(n=>n.id>this.id&&C_(n.hostElement,e))}))}}ea=new WeakMap,ta=new WeakMap,na=new WeakMap,ra=new WeakMap,ia=new WeakMap,sa=new WeakMap;var oa;class dM{constructor(){xe(this,oa,ie(at([])))}get layers(){return d(x(this,oa))}set layers(e){k(x(this,oa),e,!0)}}oa=new WeakMap;function fM(){const t=new dM;let e=1;return{store:t,allocateLayerId:()=>e++,removeLayer:n=>{const r=t.layers.indexOf(n);r!==-1&&t.layers.splice(r,1)},addLayer:n=>{if(n.kind==="modal")for(const r of[...t.layers])r.instanceId===n.instanceId&&r.kind==="popover"&&r.closeWithReason("replaced");t.layers.push(n)}}}function xf(t,e,n){let r=!1;function i(){if(r)throw new Error(`[mndw] Overlay service for "${t}" (${e}) is disposed; the plugin instance was unmounted.`)}function s(){return n.store.layers.filter(l=>l.instanceId===e)}const o={createLayer(l){i();const c=new $p(n,t,e,l,null);return n.addLayer(c),c},open(l){i();const{title:c,description:u,showCloseButton:f,mount:h,kind:p,...m}=l,g=new $p(n,t,e,{kind:p,...m},{title:c,description:u,showCloseButton:f??!0});n.addLayer(g);try{const b=h(g.contentElement,g,g.signal);b instanceof Promise?b.then(()=>g.markReady()).catch(_=>{console.error(`[mndw] Overlay mount for "${t}" failed:`,_),g.closeWithReason("mount-failed")}):g.markReady()}catch(b){console.error(`[mndw] Overlay mount for "${t}" failed:`,b),g.closeWithReason("mount-failed")}return g},closeAll(){for(const l of s())l.close(void 0,"api")}};function a(l="plugin-unmount"){if(!r){r=!0;for(const c of s())c.closeWithReason(l)}}return{service:o,dispose:a}}function hM(t){return xf("@mndw/ui","@mndw/ui",t).service}var pM=D('<a class="mndw-empty-state__link"> </a>'),gM=D("<mndw-button> </mndw-button>",2),mM=D('<section><h2 class="mndw-empty-state__title"> </h2> <p class="mndw-empty-state__text"> </p> <!></section>');function Gi(t,e){Ze(e,!0);let n=kn(e,"mode",3,"dashboard");var r=mM();let i;var s=v(r),o=v(s),a=T(s,2),l=v(a),c=T(a,2);{var u=h=>{var p=pM(),m=v(p);w(()=>{Oe(p,"href",e.action.href),E(m,e.action.label)}),A(h,p)},f=h=>{var p=gM();w(()=>C(p,"variant",e.action.variant??"primary"));var m=v(p);w(()=>E(m,e.action.label)),fe("click",p,function(...g){var b;(b=e.action.onActivate)==null||b.apply(this,g)}),A(h,p)};J(c,h=>{var p,m;((p=e.action)==null?void 0:p.href)!==void 0?h(u):((m=e.action)==null?void 0:m.onActivate)!==void 0&&h(f,1)})}w(()=>{i=Le(r,1,"mndw-empty-state",null,i,{"mndw-empty-state--compact":n()==="compact"}),E(o,e.title),E(l,e.text)}),A(t,r),We()}dt(["click"]);class ${static getElements(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(r&&!isNaN(+e[0])){const s=r.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(!e.length)return null;if(r&&e[0]==="#")return r.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(r&&!isNaN(+e[0]))return r.getElementById(e);let i=n.querySelector(e);return r&&!i&&(i=r.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){var n,r;return e.lazyLoad||((r=(n=e.grid)==null?void 0:n.opts)==null?void 0:r.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,n){const r=document.createElement("div");return e.forEach(i=>{i&&r.classList.add(i)}),n==null||n.appendChild(r),r}static shouldSizeToContent(e,n=!1){return(e==null?void 0:e.grid)&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return $.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const r=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=r)return 0;const s=e.y>n.y?e.y:n.y,o=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return o<=s?0:(i-r)*(o-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const o=n*((i.y??1e4)-(s.y??1e4));return o===0?n*((i.x??1e4)-(s.x??1e4)):o})}static find(e,n){return n?e.find(r=>r.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,r="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);r=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:r}}static defaults(e,...n){return n.forEach(r=>{for(const i in r){if(!r.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=r[i]:typeof r[i]=="object"&&typeof e[i]=="object"&&$.defaults(e[i],r[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static copyPos(e,n,r=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),r&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let r in e){const i=e[r],s=n[r];r[0]==="_"||i===s?delete e[r]:i&&typeof i=="object"&&s!==void 0&&($.removeInternalAndSame(i,s),Object.keys(i).length||delete e[r])}}static removeInternalForSave(e,n=!0){for(let r in e)(r[0]==="_"||e[r]===null||e[r]===void 0)&&delete e[r];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let r=!1;return(...i)=>{r||(r=!0,setTimeout(()=>{e(...i),r=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e).overflowY;return(n==="auto"||n==="scroll")&&e.scrollHeight>e.clientHeight?e:$.getScrollElement(e.parentElement)}static updateScrollResize(e,n,r){const i=$.getScrollElement(n),s=i.clientHeight,o=i===$.getScrollElement()?0:i.getBoundingClientRect().top,a=e.clientY-o,l=a<r,c=a>s-r;l?i.scrollBy({behavior:"smooth",top:a-r}):c&&i.scrollBy({behavior:"smooth",top:r-(s-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],r=$.clone(e);for(const i in r)r.hasOwnProperty(i)&&typeof r[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(r[i]=$.cloneDeep(e[i]));return r}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let r;typeof n=="string"?r=$.getElement(n):r=n,r&&r.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const r in n)n.hasOwnProperty(r)&&(Array.isArray(n[r])?n[r].forEach(i=>{e.style[r]=i}):e.style[r]=n[r])}static initEvent(e,n){const r={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>r[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>r[s]=e[s]),{...r,...i}}static simulateMouseEvent(e,n,r){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(r||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");$.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const r=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/r.width,yScale:1/r.height,xOffset:r.left,yOffset:r.top}}static swap(e,n,r){if(!e)return;const i=e[n];e[n]=e[r],e[r]=i}static canBeRotated(e){var n;return!(!e||e.w===e.h||e.locked||e.noResize||(n=e.grid)!=null&&n.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Wr{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,r,i={}){if(this.sortNodes(-1),r=r||this.collide(e,n),!r)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,r))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},r=this.collide(e,s,i.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;r=r||this.collide(e,s,i.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(r.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(r,{...r,y:e.y},e)||!this.collide(r,{...r,y:n.y-r.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:r.y+r.h,...a};c=this._loading&&$.samePos(e,u)?!0:this.moveNode(e,u),(r.locked||this._loading)&&c?$.copyPos(n,e):!r.locked&&c&&i.pack&&(this._packNodes(),n.y=r.y+r.h,$.copyPos(e,n)),o=o||c}else c=this.moveNode(r,{...r,y:n.y+n.h,skip:e,...a});if(!c)return o;r=void 0}return o}collide(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.find(o=>o._id!==i&&o._id!==s&&$.isIntercepted(o,n))}collideAll(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.filter(o=>o._id!==i&&o._id!==s&&$.isIntercepted(o,n))}directionCollideCoverage(e,n,r){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let o,a=.5;for(let l of r){if(l.locked||!l._rect)break;const c=l._rect;let u=Number.MAX_VALUE,f=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?f=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(f=(c.x+c.w-s.x)/c.w);const h=Math.min(f,u);h>a&&(a=h,o=l)}return n.collide=o,o}cacheRects(e,n,r,i,s,o){return this.nodes.forEach(a=>a._rect={y:a.y*n+r,x:a.x*e+o,w:a.w*e-o-i,h:a.h*n-r-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function r(){const s=n.x,o=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=o):(e.x=s,e.y=o),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=$.isTouching(e,n)))return r();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=$.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return r()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=$.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return r()}return!1}}}isAreaEmpty(e,n,r,i){const s={x:e||0,y:n||0,w:r||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const r=this.batchMode;r||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((o,a,l)=>{let c;o.locked||(o.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(o,!1,c)}),i||delete this._inColumnResize,r||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=$.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const r=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:r,w:e.w,h:e.h})))break;e._dirty=e.y!==r,e.y=r}}),this)}prepareNode(e,n){e._id=e._id??Wr._idSeq++;const r=e.id;if(r){let s=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=r+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return $.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,$.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const r=e._orig||$.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const s={...e};s.autoPosition||s.x===void 0?(delete s.x,delete s.y):s.x=Math.min(this.defaultColumn-1,s.x),s.w=Math.min(this.defaultColumn,s.w||1),this.cacheOneLayout(s,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),$.samePos(e,r)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!$.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=$.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||$.samePos(e,e._orig)||($.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,r=this.column,i){const s=i?i.y*r+(i.x+i.w):0;let o=!1;for(let a=s;!o;++a){const l=a%r,c=Math.floor(a/r);if(l+e.w>r)continue;const u={x:l,y:c,w:e.w,h:e.h};n.find(f=>$.isIntercepted(u,f))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,o=!0)}return o}addNode(e,n=!1,r){const i=this.nodes.find(o=>o._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,r)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,r=!1){return this.nodes.find(i=>i._id===e._id)?(r&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const r=this.nodes;return this.removedNodes=n?r:[],this.nodes=[],this._notify(r)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let r;const i=new Wr({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(r={...o},r):{...o})});if(!r)return!1;const s=i.moveNode(r,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const o=n.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return s?(i.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&($.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new Wr({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),r={...e};return this.cleanupNode(r),delete r.el,delete r._id,delete r.content,delete r.grid,n.addNode(r),n.getRow()<=this.maxRow?(e._willFitPos=$.copyPos({},r),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){var c,u;if(!e||!n)return!1;let r;n.pack===void 0&&!this.batchMode&&(r=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=$.copyPos({},e,!0);if($.copyPos(s,n),this.nodeBoundFix(s,i),$.copyPos(n,s),!n.forceCollide&&$.samePos(e,n))return!1;const o=$.copyPos({},e),a=this.collideAll(e,s,n.skip);let l=!0;if(a.length){const f=e._moving&&!n.nested;let h=f?this.directionCollideCoverage(e,n,a):a[0];if(f&&h&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){const p=$.areaIntercept(n.rect,h._rect),m=$.area(n.rect),g=$.area(h._rect);p/(m<g?m:g)>.8&&(h.grid.makeSubGrid(h.el,void 0,e),h=void 0)}h?l=!this._fixCollisions(e,s,h,n):(l=!1,r&&delete n.pack)}return l&&!$.samePos(e,s)&&(e._dirty=!0,$.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!$.samePos(e,o)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,r){var a;const i=((a=this._layouts)==null?void 0:a.length)||0;let s;i&&(r?r!==this.column&&(s=this._layouts[r]):this.column!==i-1&&(s=this._layouts[i-1]));const o=[];return this.sortNodes(),this.nodes.forEach(l=>{const c=s==null?void 0:s.find(f=>f._id===l._id),u={...l,...c||{}};$.removeInternalForSave(u,!e),n&&n(l,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,r)=>{if(!n||r===this.column)return this;if(r<this.column)this._layouts[r]=void 0;else{const i=r/this.column;e.forEach(s=>{if(!s._orig)return;const o=n.find(a=>a._id===s._id);o&&(o.y>=0&&s.y!==s._orig.y&&(o.y+=s.y-s._orig.y,o.y<0&&(o.y=0)),s.x!==s._orig.x&&(o.x=Math.round(s.x*i),o.x<0&&(o.x=0)),s.w!==s._orig.w&&(o.w=Math.round(s.w*i),o.w<1&&(o.w=1)))})}}),this)}columnChanged(e,n,r="moveScale"){var a;if(!this.nodes.length||!n||e===n)return this;const i=r==="compact"||r==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],o=i?this.nodes:$.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(u=>{const f=o.find(h=>h._id===u._id);f&&(!i&&!u.autoPosition&&(f.x=u.x??f.x,f.y=u.y??f.y),f.w=u.w??f.w,(u.x==null||u.y===void 0)&&(f.autoPosition=!0))})),l.forEach(u=>{const f=o.findIndex(h=>h._id===u._id);if(f!==-1){const h=o[f];if(i){h.w=u.w;return}(u.autoPosition||isNaN(u.x)||isNaN(u.y))&&this.findEmptyPosition(u,s),u.autoPosition||(h.x=u.x??h.x,h.y=u.y??h.y,h.w=u.w??h.w,s.push(h)),o.splice(f,1)}})}if(i)this.compact(r,!1);else{if(o.length)if(typeof r=="function")r(n,e,s,o);else{const l=i||r==="none"?1:n/e,c=r==="move"||r==="moveScale",u=r==="scale"||r==="moveScale";o.forEach(f=>{f.x=n===1?0:c?Math.round(f.x*l):Math.min(f.x,n-1),f.w=n===1||e===1?1:u?Math.round(f.w*l)||1:Math.min(f.w,n),s.push(f)}),o=[]}s=$.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,r=!1){const i=[];return e.forEach((s,o)=>{if(s._id===void 0){const a=s.id?this.nodes.find(l=>l.id===s.id):void 0;s._id=(a==null?void 0:a._id)??Wr._idSeq++}i[o]={x:s.x,y:s.y,w:s.w,_id:s._id}}),this._layouts=r?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??Wr._idSeq++;const r={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete r.x,delete r.y,e.autoPosition&&(r.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(r):this._layouts[n][i]=r,this}findCacheLayout(e,n){var r,i;return((i=(r=this._layouts)==null?void 0:r[n])==null?void 0:i.findIndex(s=>s._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const r=this.findCacheLayout(e,n);r!==-1&&this._layouts[n].splice(r,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}}Wr._idSeq=0;const Zn={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class He{}const kr=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class Yn{}function Cl(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),$.simulateMouseEvent(t.changedTouches[0],e))}function qb(t,e){t.cancelable&&t.preventDefault(),$.simulateMouseEvent(t,e)}function Rl(t){Yn.touchHandled||(Yn.touchHandled=!0,Cl(t,"mousedown"))}function Al(t){Yn.touchHandled&&Cl(t,"mousemove")}function Ol(t){if(!Yn.touchHandled)return;Yn.pointerLeaveTimeout&&(window.clearTimeout(Yn.pointerLeaveTimeout),delete Yn.pointerLeaveTimeout);const e=!!He.dragElement;Cl(t,"mouseup"),e||Cl(t,"click"),Yn.touchHandled=!1}function Ml(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function jp(t){He.dragElement&&t.pointerType!=="mouse"&&qb(t,"mouseenter")}function Fp(t){He.dragElement&&t.pointerType!=="mouse"&&(Yn.pointerLeaveTimeout=window.setTimeout(()=>{delete Yn.pointerLeaveTimeout,qb(t,"mouseleave")},10))}class gc{constructor(e,n,r){this.host=e,this.dir=n,this.option=r,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${gc.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),kr&&(this.el.addEventListener("touchstart",Rl),this.el.addEventListener("pointerdown",Ml)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),kr&&(this.el.removeEventListener("touchstart",Rl),this.el.removeEventListener("pointerdown",Ml)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),kr&&(this.el.addEventListener("touchmove",Al),this.el.addEventListener("touchend",Ol)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),kr&&(this.el.removeEventListener("touchmove",Al),this.el.removeEventListener("touchend",Ol)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var n,r;e.key==="Escape"&&((r=(n=this.host.gridstackNode)==null?void 0:n.grid)==null||r.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}}gc.prefix="ui-resizable-";class Pf{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,n){this._eventRegister[e]=n}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,n){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](n)}}class jo extends Pf{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},o=this.temporalRect||s;return{position:{left:this.option.rtl?(i.right-o.right)*this.rectScale.x:(o.left-i.left)*this.rectScale.x,top:(o.top-i.top)*this.rectScale.y},size:{width:o.width*this.rectScale.x,height:o.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,r=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),r&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),He.overResizeElement===this&&delete He.overResizeElement),this}_mouseOver(e){He.overResizeElement||He.dragElement||(He.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){He.overResizeElement===this&&(delete He.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new gc(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=$.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=$.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=$.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const r=$.initEvent(e,{type:"resize",target:this.el});return r.resizeDir=n,r.hasMovedX=this.option.rtl?n.includes("e"):n.includes("w"),r.hasMovedY=n.includes("n"),this.option.resize&&this.option.resize(r,this._ui()),this.triggerEvent("resize",r),this}_resizeStop(e){const n=$.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=jo._originStyleProp.map(r=>this.el.style[r]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=$.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return jo._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const r=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},s=e.clientX-r.clientX,o=this.sizeToContent?0:e.clientY-r.clientY;let a,l;const c=this.option.rtl;!c&&n.indexOf("e")>-1?i.width+=s:c&&n.indexOf("w")>-1?i.width-=s:!c&&n.indexOf("w")>-1?(i.width-=s,i.left+=s,a=!0):c&&n.indexOf("e")>-1&&(i.width+=s,i.right+=s,a=!0),n.indexOf("s")>-1?i.height+=o:n.indexOf("n")>-1&&(i.height-=o,i.top+=o,l=!0);const u=this._constrainSize(i.width,i.height,a,l);return Math.round(i.width)!==Math.round(u.width)&&(!c&&n.indexOf("w")>-1?i.left+=i.width-u.width:c&&n.indexOf("e")>-1&&(i.right-=i.width-u.width),i.width=u.width),Math.round(i.height)!==Math.round(u.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-u.height),i.height=u.height),i}_constrainSize(e,n,r,i){const s=this.option,o=(r?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,a=s.minWidth/this.rectScale.x||e,l=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n,u=Math.min(o,Math.max(a,e)),f=Math.min(l,Math.max(c,n));return{width:u,height:f}}_applyChange(){let e={left:0,right:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:r,right:i,top:s}=n.getBoundingClientRect();e={left:r,right:i,top:s,width:0,height:0}}return this.temporalRect?(Object.entries(this.temporalRect).forEach(([n,r])=>{if(this.option.rtl?n==="left":n==="right")return;const i=n==="width"||n==="left"||n==="right"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;let s;n==="right"?s=(e.right-r)*this.rectScale.x+"px":s=(r-e[n])*i+"px",this.el.style[n]=s}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}jo._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"];const vM='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Fo extends Pf{constructor(e,n={}){var s;super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},this._autoScrollTick=()=>{const o=this.helper,a=this._autoScrollContainer;if(!o||!a){this._stopScrolling();return}const l=this._getClipping(o,a);if(l===0){this._stopScrolling();return}if(!this._autoScrollMaxSpeed){const p=window.innerHeight||document.documentElement.clientHeight;this._autoScrollMaxSpeed=Math.max(p/150,4)}const c=Math.abs(l),u=Math.min(c*.5,this._autoScrollMaxSpeed),f=l>0?u:-u,h=a.scrollTop;if(a.scrollTop+=f,a.scrollTop===h){this._stopScrolling();return}this.dragging&&this.lastDrag&&(this._dragFollow(this.lastDrag),this._callDrag(this.lastDrag)),this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick)};const r=(s=n==null?void 0:n.handle)==null?void 0:s.substring(1),i=e.gridstackNode;this.dragEls=!r||e.classList.contains(r)?[e]:i!=null&&i.subGrid?[e.querySelector(n.handle)||e]:this.getAllHandles(),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}getAllHandles(){return Array.from(this.el.querySelectorAll(this.option.handle)).filter(e=>{if(!(e instanceof HTMLElement))return!1;const n=e.closest(".grid-stack-item");return n===this.el||!n})}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),kr&&(e.addEventListener("touchstart",Rl),e.addEventListener("pointerdown",Ml))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),kr&&(n.removeEventListener("touchstart",Rl),n.removeEventListener("pointerdown",Ml))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(Yn.touchHandled&&e.isTrusted&&(Yn.touchHandled=!1),!He.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(vM)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete He.dragElement,delete He.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),kr&&(e.currentTarget.addEventListener("touchmove",Al),e.currentTarget.addEventListener("touchend",Ol)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),He.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=$.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){var r;const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),He.pauseDrag){const i=Number.isInteger(He.pauseDrag)?He.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,He.dragElement=this;const i=(r=this.el.gridstackNode)==null?void 0:r.grid;i?He.dropElement=i.el.ddElement.ddDroppable:delete He.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=$.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=$.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var n,r;if(this._stopScrolling(),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),kr&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Al,!0),e.currentTarget.removeEventListener("touchend",Ol,!0)),this.dragging){delete this.dragging,(n=this.el.gridstackNode)==null||delete n._origRotate,document.removeEventListener("keydown",this._keyEvent),((r=He.dropElement)==null?void 0:r.el)===this.el.parentElement&&delete He.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const i=$.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(i),this.triggerEvent("dragstop",i),He.dropElement&&He.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete He.dragElement,delete He.dropElement,delete He.mouseHandled,e.preventDefault()}_keyEvent(e){var i,s;const n=this.el.gridstackNode,r=(n==null?void 0:n.grid)||((s=(i=He.dropElement)==null?void 0:i.el)==null?void 0:s.gridstack);if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),r==null||r.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&r&&(e.key==="r"||e.key==="R")){if(!$.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,r.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetX}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",$.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=$.cloneNode(this.el)),e.parentElement||$.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Fo.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){var r,i;this.helper.classList.add("ui-draggable-dragging"),(i=(r=this.el.gridstackNode)==null?void 0:r.grid)==null||i.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, right, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){var n,r,i;this.helper.classList.remove("ui-draggable-dragging"),(r=(n=this.el.gridstackNode)==null?void 0:n.grid)==null||r.el.classList.remove("grid-stack-dragging");const e=(i=this.helper)==null?void 0:i.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const s=this.helper,o=this.dragElementOriginStyle.transition||null;s.style.transition=this.dragElementOriginStyle.transition="none",Fo.originStyleProp.forEach(a=>s.style[a]=this.dragElementOriginStyle[a]||null),setTimeout(()=>s.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n=this.helper.style,r=this.dragOffset;this.option.rtl?(n.right=(window.innerWidth-e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.left&&(n.left="")):(n.left=(e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.right&&(n.right="")),n.top=(e.clientY+r.offsetTop)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,r){let i=0,s=0;r&&(i=this.dragTransform.xOffset,s=this.dragTransform.yOffset);const o=n.getBoundingClientRect();let a=this.option.rtl?o.right:o.left,l=this.option.rtl?e.clientX-o.right+i:-e.clientX+o.left-i;return{x:a,top:o.top,offsetX:l,offsetTop:-e.clientY+o.top-s,width:o.width*this.dragTransform.xScale,height:o.height*this.dragTransform.yScale}}updateScrollPosition(e){this._autoScrollContainer=$.getScrollElement(e),this._getClipping(this.helper,this._autoScrollContainer)===0?this._stopScrolling():this._autoScrollAnimId||(this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick))}_getClipping(e,n){const r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight;if(r.bottom<i.top||r.top>i.bottom)return 0;const o=r.bottom-Math.min(i.bottom,s),a=r.top-Math.max(i.top,0);return a<0?a:o>0?o:0}_stopScrolling(){this._autoScrollAnimId&&(cancelAnimationFrame(this._autoScrollAnimId),delete this._autoScrollAnimId)}ui(){const n=this.el.parentElement.getBoundingClientRect(),r=this.helper.getBoundingClientRect(),i=this.option.rtl?(n.right-r.right)*this.dragTransform.xScale:(r.left-n.left)*this.dragTransform.xScale;return{position:{top:(r.top-n.top)*this.dragTransform.yScale,left:i}}}}Fo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"];class bM extends Pf{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),kr&&(this.el.addEventListener("pointerenter",jp),this.el.addEventListener("pointerleave",Fp)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),kr&&(this.el.removeEventListener("pointerenter",jp),this.el.removeEventListener("pointerleave",Fp)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!He.dragElement||Yn.touchHandled&&e.isTrusted||!this._canDrop(He.dragElement.el))return;e.preventDefault(),e.stopPropagation(),He.dragElement._stopScrolling(),He.dropElement&&He.dropElement!==this&&He.dropElement._mouseLeave(e,!0),He.dropElement=this;const n=$.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(He.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){var i;if(!He.dragElement||He.dropElement!==this)return;e.preventDefault(),e.stopPropagation(),n&&He.dragElement._stopScrolling();const r=$.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(r,this._ui(He.dragElement)),this.triggerEvent("dropout",r),He.dropElement===this&&(delete He.dropElement,!n)){let s,o=this.el.parentElement;for(;!s&&o;)s=(i=o.ddElement)==null?void 0:i.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const n=$.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(He.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Cf{static init(e){return e.ddElement||(e.ddElement=new Cf(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Fo(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new jo(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new bM(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class _M{resizable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddResizable&&s.ddResizable[n]();else if(n==="destroy")s.ddResizable&&s.cleanResizable();else if(n==="option")s.setupResizable({[r]:i});else{const a=s.el.gridstackNode.grid;let l=s.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const c=!a.opts.alwaysShowResizeHandle;s.setupResizable({...a.opts.resizable,handles:l,autoHide:c,start:n.start,stop:n.stop,resize:n.resize,rtl:n.rtl})}}),this}draggable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddDraggable&&s.ddDraggable[n]();else if(n==="destroy")s.ddDraggable&&s.cleanDraggable();else if(n==="option")s.setupDraggable({[r]:i});else{const o=s.el.gridstackNode.grid;s.setupDraggable({...o.opts.draggable,start:n.start,stop:n.stop,drag:n.drag,rtl:n.rtl})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(r=>r.setupDraggable(n)),this}droppable(e,n,r,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=s=>n._accept(s)),this._getDDElements(e,n).forEach(s=>{n==="disable"||n==="enable"?s.ddDroppable&&s.ddDroppable[n]():n==="destroy"?s.ddDroppable&&s.cleanDroppable():n==="option"?s.setupDroppable({[r]:i}):s.setupDroppable(n)}),this}isDroppable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,r){return this._getDDElements(e).forEach(i=>i.on(n,s=>{r(s,He.dragElement?He.dragElement.el:s.target,He.dragElement?He.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(r=>r.off(n)),this}_getDDElements(e,n){const r=e.gridstack||n!=="destroy"&&n!=="disable",i=$.getElements(e);return i.length?i.map(o=>o.ddElement||(r?Cf.init(o):null)).filter(o=>o):[]}}/*!
81
+ * GridStack 12.6.0
82
+ * https://gridstackjs.com/
83
+ *
84
+ * Copyright (c) 2021-2025 Alain Dumesny
85
+ * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
86
+ */const Pn=new _M;class Ae{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const r=Ae.getGridElement(n);return r?(r.gridstack||(r.gridstack=new Ae(r,$.cloneDeep(e))),r.gridstack):(console.error(typeof n=="string"?'GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
87
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},n=".grid-stack"){const r=[];return typeof document>"u"||(Ae.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new Ae(i,$.cloneDeep(e))),r.push(i.gridstack)}),r.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
88
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),r}static addGrid(e,n={}){if(!e)return null;let r=e;if(r.gridstack){const o=r.gridstack;return n&&(o.opts={...o.opts,...n}),n.children!==void 0&&o.load(n.children),o}return(!e.classList.contains("grid-stack")||Ae.addRemoveCB)&&(Ae.addRemoveCB?r=Ae.addRemoveCB(e,n,!0,!0):r=$.createDiv(["grid-stack",n.class],e)),Ae.init(n,r)}static registerEngine(e){Ae.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=$.createDiv([this.opts.placeholderClass,Zn.itemClass,this.opts.itemClass]);const e=$.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,n={}){var c;this.el=e,this.opts=n,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=n=n||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),n.row&&(n.minRow=n.maxRow=n.row,delete n.row);const r=$.toNumber(e.getAttribute("gs-row"));n.column==="auto"&&delete n.column,n.alwaysShowResizeHandle!==void 0&&(n._alwaysShowResizeHandle=n.alwaysShowResizeHandle);const i=n.columnOpts;if(i){const u=i.breakpoints;!i.columnWidth&&!(u!=null&&u.length)?delete n.columnOpts:(i.columnMax=i.columnMax||12,(u==null?void 0:u.length)>1&&u.sort((f,h)=>(h.w||0)-(f.w||0)))}const s={...$.cloneDeep(Zn),column:$.toNumber(e.getAttribute("gs-column"))||Zn.column,minRow:r||$.toNumber(e.getAttribute("gs-min-row"))||Zn.minRow,maxRow:r||$.toNumber(e.getAttribute("gs-max-row"))||Zn.maxRow,staticGrid:$.toBool(e.getAttribute("gs-static"))||Zn.staticGrid,sizeToContent:$.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||Zn.draggable.handle},removableOptions:{accept:n.itemClass||Zn.removableOptions.accept,decline:Zn.removableOptions.decline}};e.getAttribute("gs-animate")&&(s.animate=$.toBool(e.getAttribute("gs-animate"))),n=$.defaults(n,s),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(n),n.rtl==="auto"&&(n.rtl=e.style.direction==="rtl"),n.rtl&&this.el.classList.add("grid-stack-rtl");const o=this.el.closest("."+Zn.itemClass),a=o==null?void 0:o.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=n.cellHeight==="auto",this._isAutoCellHeight||n.cellHeight==="initial")this.cellHeight(void 0);else{typeof n.cellHeight=="number"&&n.cellHeightUnit&&n.cellHeightUnit!==Zn.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const u=n.cellHeight;delete n.cellHeight,this.cellHeight(u)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=kr),this._setStaticClass();const l=n.engineClass||Ae.engineClass||Wr;if(this.engine=new l({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:u=>{u.forEach(f=>{const h=f.el;h&&(f._removeDOM?(h&&h.remove(),delete f._removeDOM):this._writePosAttr(h,f))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(u=>this._prepareElement(u)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const u=n.children;delete n.children,u.length&&this.load(u)}this.setAnimation(),n.subGridDynamic&&!He.pauseDrag&&(He.pauseDrag=!0),((c=n.draggable)==null?void 0:c.pause)!==void 0&&(He.pauseDrag=n.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let n,r=e;if(r.grid=this,r.el?n=r.el:Ae.addRemoveCB?n=Ae.addRemoveCB(this.el,e,!0,!1):n=this.createWidgetDivs(r),!n)return;if(r=n.gridstackNode,r&&n.parentElement===this.el&&this.engine.nodes.find(s=>s._id===r._id))return n;const i=this._readAttr(n);return $.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=$.createDiv(["grid-stack-item",this.opts.itemClass]),r=$.createDiv(["grid-stack-item-content"],n);return $.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{var s,o;i.isIntersecting&&((s=e.visibleObservable)==null||s.disconnect(),delete e.visibleObservable,Ae.renderCB(r,e),(o=e.grid)==null||o.prepareDragDrop(e.el))}),window.setTimeout(()=>{var i;return(i=e.visibleObservable)==null?void 0:i.observe(n)})):Ae.renderCB(r,e),n}makeSubGrid(e,n,r,i=!0){var p,m,g;let s=e.gridstackNode;if(s||(s=this.makeWidget(e).gridstackNode),(p=s.subGrid)!=null&&p.el)return s.subGrid;let o,a=this;for(;a&&!o;)o=(m=a.opts)==null?void 0:m.subGridOpts,a=(g=a.parentGridNode)==null?void 0:g.grid;n=$.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...o||{},...n||s.subGridOpts||{}}),s.subGridOpts=n;let l;n.column==="auto"&&(l=!0,n.column=Math.max(s.w||1,(r==null?void 0:r.w)||1),delete n.columnOpts);let c=s.el.querySelector(".grid-stack-item-content"),u,f;if(i&&(this._removeDD(s.el),f={...s,x:0,y:0},$.removeInternalForSave(f),delete f.subGridOpts,s.content&&(f.content=s.content,delete s.content),Ae.addRemoveCB?u=Ae.addRemoveCB(this.el,f,!0,!1):(u=$.createDiv(["grid-stack-item"]),u.appendChild(c),c=$.createDiv(["grid-stack-item-content"],s.el)),this.prepareDragDrop(s.el)),r){const b=l?n.column:s.w,_=s.h+r.h,y=s.el.style;y.transition="none",this.update(s.el,{w:b,h:_}),setTimeout(()=>y.transition=null)}const h=s.subGrid=Ae.addGrid(c,n);return r!=null&&r._moving&&(h._isTemp=!0),l&&(h._autoColumn=!0),i&&h.makeWidget(u,f),r&&(r._moving?window.setTimeout(()=>$.simulateMouseEvent(r._event,"mouseenter",h.el),0):h.makeWidget(s.el,s)),this.resizeToContentCheck(!1,s),h}removeAsSubGrid(e){var r;const n=(r=this.parentGridNode)==null?void 0:r.grid;n&&(n.batchUpdate(),n.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,n.makeWidget(i.el,i)}),n.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>$.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,r=Ae.saveCB,i){const s=this.engine.save(e,r,i);if(s.forEach(o=>{var a;if(e&&o.el&&!o.subGrid&&!r){const l=o.el.querySelector(".grid-stack-item-content");o.content=l==null?void 0:l.innerHTML,o.content||delete o.content}else if(!e&&!r&&delete o.content,(a=o.subGrid)!=null&&a.el){const l=o.w||o.subGrid.getColumn(),c=o.subGrid.save(e,n,r,l);o.subGridOpts=n?c:{children:c},delete o.subGrid}delete o.el}),n){const o=$.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const a=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,a!==void 0?o.alwaysShowResizeHandle=a:delete o.alwaysShowResizeHandle,$.removeInternalAndSame(o,Zn),o.children=s,o}return s}load(e,n=Ae.addRemoveCB||!0){e.forEach(u=>{u.w=u.w||u.minW||1,u.h=u.h||u.minH||1}),e=$.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(u=>{r=Math.max(r,(u.x||0)+u.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r);const i=this.getColumn();r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const s=Ae.addRemoveCB;typeof n=="function"&&(Ae.addRemoveCB=n);const o=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&n&&[...this.engine.nodes].forEach(f=>{if(!f.id)return;$.find(e,f.id)||(Ae.addRemoveCB&&Ae.addRemoveCB(this.el,f,!1,!1),o.push(f),this.removeWidget(f.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(u=>$.find(e,u.id)?(c.push(u),!1):!0),e.forEach(u=>{var h;const f=$.find(c,u.id);if(f){if($.shouldSizeToContent(f)&&(u.h=f.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||f.w,u.h=u.h||f.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(f),$.samePos(f,u)&&this.engine.nodes.length>1&&(this.moveNode(f,{...u,forceCollide:!0}),$.copyPos(u,f)),this.update(f.el,u),(h=u.subGridOpts)!=null&&h.children){const p=f.el.querySelector(".grid-stack");p&&p.gridstack&&p.gridstack.load(u.subGridOpts.children)}}else n&&this.addWidget(u)}),delete this.engine._loading,this.engine.removedNodes=o,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,s?Ae.addRemoveCB=s:delete Ae.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const n=this.el.querySelector("."+this.opts.itemClass);if(n){const i=$.toNumber(n.getAttribute("gs-h"))||1;return Math.round(n.offsetHeight/i)}const r=parseInt(this.el.getAttribute("gs-current-row"));return r?Math.round(this.el.getBoundingClientRect().height/r):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const r=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+r}const n=$.parseHeight(e);return this.opts.cellHeightUnit===n.unit&&this.opts.cellHeight===n.h?this:(this.opts.cellHeightUnit=n.unit,this.opts.cellHeight=n.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var n;return e&&((n=this.opts.columnOpts)!=null&&n.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var s,o;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((s=e.breakpoints)!=null&&s.length))return!1;const n=this.getColumn();let r=n;const i=this._widthOrContainer(!0);if(e.columnWidth)r=Math.min(Math.round(i/e.columnWidth)||1,e.columnMax);else{r=e.columnMax;let a=0;for(;a<e.breakpoints.length&&i<=e.breakpoints[a].w;)r=e.breakpoints[a++].c||n}if(r!==n){const a=(o=e.breakpoints)==null?void 0:o.find(l=>l.c===r);return this.column(r,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",n=!0){return this.engine.compact(e,n),this._triggerChangeEvent(),this}column(e,n="moveScale"){if(!e||e<1||this.opts.column===e)return this;const r=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+r),this._updateColumnVar(),this.engine.columnChanged(r,e,n),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=n,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var n;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(n=this._placeholder)==null||delete n.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,n=!1){const r=this.el.getBoundingClientRect();let i;n?i={top:r.top+document.documentElement.scrollTop,left:r.left}:i={top:this.el.offsetTop,left:this.el.offsetLeft};const s=e.left-i.left,o=e.top-i.top,a=r.width/this.getColumn(),l=r.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(s/a),y:Math.floor(o/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,n,r,i){return this.engine.isAreaEmpty(e,n,r,i)}makeWidget(e,n){const r=Ae.getElement(e);if(!r||r.gridstackNode)return r;r.parentElement||this.el.appendChild(r),this._prepareElement(r,!0,n);const i=r.gridstackNode;this._updateContainerHeight(),i.subGridOpts&&this.makeSubGrid(r,i.subGridOpts,void 0,!1);let s;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(s=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),s&&delete this._ignoreLayoutsNodeChange,r}on(e,n){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.on(i,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=i=>n(i):this._gsEventHandler[e]=i=>{i.detail&&n(i,i.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=n:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.off(r)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,n=!0,r=!0){return e?(Ae.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let s=i.gridstackNode;s||(s=this.engine.nodes.find(o=>i===o.el)),s&&(n&&Ae.addRemoveCB&&Ae.addRemoveCB(this.el,s,!1,!1),delete i.gridstackNode,this._removeDD(i),this.engine.removeNode(s,n,r),n&&i.parentElement&&i.remove())}),r&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,n=!0){return this.engine.nodes.forEach(r=>{e&&Ae.addRemoveCB&&Ae.addRemoveCB(this.el,r,!1,!1),delete r.el.gridstackNode,this.opts.staticGrid||this._removeDD(r.el)}),this.engine.removeAll(e,n),n&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,n){return n?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,n=!0,r=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.setStatic(e,n,r)}),n&&this._setStaticClass(),this)}updateOptions(e){var r;const n=this.opts;if(e===n)return this;if(e.acceptWidgets!==void 0&&(n.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==n.class&&(n.class&&this.el.classList.remove(n.class),e.class&&this.el.classList.add(e.class)),e.columnOpts){const i=!!this.opts.columnOpts;this.opts.columnOpts=e.columnOpts,i!==!!this.opts.columnOpts&&this._updateResizeEvent(),this.checkDynamicColumn()}else e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column);return e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(n.minRow=n.maxRow=n.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(n.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(n.maxRow=this.engine.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(n.lazyLoad=e.lazyLoad),(r=e.children)!=null&&r.length&&this.load(e.children),this}update(e,n){return Ae.getElements(e).forEach(r=>{var u;const i=r==null?void 0:r.gridstackNode;if(!i)return;const s={...$.copyPos({},i),...$.cloneDeep(n)};this.engine.nodeBoundFix(s),delete s.autoPosition;const o=["x","y","w","h"];let a;if(o.some(f=>s[f]!==void 0&&s[f]!==i[f])&&(a={},o.forEach(f=>{a[f]=s[f]!==void 0?s[f]:i[f],delete s[f]})),!a&&(s.minW||s.minH||s.maxW||s.maxH)&&(a={}),s.content!==void 0){const f=r.querySelector(".grid-stack-item-content");f&&f.textContent!==s.content&&(i.content=s.content,Ae.renderCB(f,s),(u=i.subGrid)!=null&&u.el&&(f.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete s.content}let l=!1,c=!1;for(const f in s)f[0]!=="_"&&i[f]!==s[f]&&(i[f]=s[f],l=!0,c=c||!this.opts.staticGrid&&(f==="noResize"||f==="noMove"||f==="locked"));if($.sanitizeMinMax(i),a){const f=a.w!==void 0&&a.w!==i.w;this.moveNode(i,a),f&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(f,i),delete i._orig}(a||l)&&this._writeAttr(r,i),c&&this.prepareDragDrop(i.el),Ae.updateCB&&Ae.updateCB(i)}),this}moveNode(e,n){const r=e._updating;r||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,n),this._updateContainerHeight(),r||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var h,p;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const n=e.gridstackNode;if(!n)return;const r=n.grid;if(!r||e.parentElement!==r.el)return;const i=r.getCellHeight(!0);if(!i)return;let s=n.h?n.h*i:e.clientHeight,o;if(n.resizeToContentParent&&(o=e.querySelector(n.resizeToContentParent)),o||(o=e.querySelector(Ae.resizeToContentParent)),!o)return;const a=e.clientHeight-o.clientHeight,l=n.h?n.h*i-a:o.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const m=n.subGrid.el.getBoundingClientRect(),g=e.getBoundingClientRect();c+=m.top-g.top}else{if((p=(h=n.subGridOpts)==null?void 0:h.children)!=null&&p.length)return;{const m=o.firstElementChild;if(!m){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${Ae.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=m.getBoundingClientRect().height||l}}if(l===c)return;s+=c-l;let u=Math.ceil(s/i);const f=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;f&&u>f&&(u=f,e.classList.add("size-to-content-max")),n.minH&&u<n.minH?u=n.minH:n.maxH&&u>n.maxH&&(u=n.maxH),u!==n.h&&(r._ignoreLayoutsNodeChange=!0,r.moveNode(n,{h:u}),delete r._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){Ae.resizeToContentCB?Ae.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return Ae.getElements(e).forEach(r=>{const i=r.gridstackNode;if(!$.canBeRotated(i))return;const s={w:i.h,h:i.w,minH:i.minW,minW:i.minH,maxH:i.maxW,maxW:i.maxH};if(n){const a=n.left>0?Math.floor(n.left/this.cellWidth()):0,l=n.top>0?Math.floor(n.top/this.opts.cellHeight):0;s.x=i.x+a-(i.h-(l+1)),s.y=i.y+l-a}Object.keys(s).forEach(a=>{s[a]===void 0&&delete s[a]});const o=i._orig;this.update(r,s),i._orig=o}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const r=$.parseHeight(e);if(this.opts.marginUnit===r.unit&&this.opts.margin===r.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(r=>{delete r._dirty});const n=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",n)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const n=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",n)}return this}_triggerEvent(e,n){const r=n?new CustomEvent(e,{bubbles:!1,detail:n}):new Event(e);let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;return i.el.dispatchEvent(r),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let n=this.getRow()+this._extraDragRow;const r=this.opts.cellHeight,i=this.opts.cellHeightUnit;if(!r)return this;if(!e&&!this.opts.minRow){const s=$.parseHeight(getComputedStyle(this.el).minHeight);if(s.h>0&&s.unit===i){const o=Math.floor(s.h/r);n<o&&(n=o)}}return this.el.setAttribute("gs-current-row",String(n)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),n&&(this.el.style[e?"minHeight":"height"]=n*r+i),e&&$.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,n=!1,r){r=r||this._readAttr(e),e.gridstackNode=r,r.el=e,r.grid=this,r=this.engine.addNode(r,n),this._writeAttr(e,r),e.classList.add(Zn.itemClass,this.opts.itemClass);const i=$.shouldSizeToContent(r);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,r),$.lazyLoad(r)||this.prepareDragDrop(r.el),this}_writePosAttr(e,n){if(!n._moving&&!n._resizing||this._placeholder===e){const r=this.opts.rtl?"right":"left";e.style.top=n.y?n.y===1?"var(--gs-cell-height)":`calc(${n.y} * var(--gs-cell-height))`:null,e.style[r]=n.x?n.x===1?"var(--gs-column-width)":`calc(${n.x} * var(--gs-column-width))`:null,e.style.width=n.w>1?`calc(${n.w} * var(--gs-column-width))`:null,e.style.height=n.h>1?`calc(${n.h} * var(--gs-cell-height))`:null}return e.setAttribute("gs-x",String(n.x)),e.setAttribute("gs-y",String(n.y)),n.w>1?e.setAttribute("gs-w",String(n.w)):e.removeAttribute("gs-w"),n.h>1?e.setAttribute("gs-h",String(n.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,n){if(!n)return this;this._writePosAttr(e,n);const r={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const i in r)n[i]?e.setAttribute(r[i],String(n[i])):e.removeAttribute(r[i]);return this}_readAttr(e,n=!0){const r={};r.x=$.toNumber(e.getAttribute("gs-x")),r.y=$.toNumber(e.getAttribute("gs-y")),r.w=$.toNumber(e.getAttribute("gs-w")),r.h=$.toNumber(e.getAttribute("gs-h")),r.autoPosition=$.toBool(e.getAttribute("gs-auto-position")),r.noResize=$.toBool(e.getAttribute("gs-no-resize")),r.noMove=$.toBool(e.getAttribute("gs-no-move")),r.locked=$.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?r.sizeToContent=$.toBool(i):r.sizeToContent=parseInt(i,10)),r.id=e.getAttribute("gs-id"),r.maxW=$.toNumber(e.getAttribute("gs-max-w")),r.minW=$.toNumber(e.getAttribute("gs-min-w")),r.maxH=$.toNumber(e.getAttribute("gs-max-h")),r.minH=$.toNumber(e.getAttribute("gs-min-h")),n&&(r.w===1&&e.removeAttribute("gs-w"),r.h===1&&e.removeAttribute("gs-h"),r.maxW&&e.removeAttribute("gs-max-w"),r.minW&&e.removeAttribute("gs-min-w"),r.maxH&&e.removeAttribute("gs-max-h"),r.minH&&e.removeAttribute("gs-min-h"));for(const s in r){if(!r.hasOwnProperty(s))return;!r[s]&&r[s]!==0&&s!=="sizeToContent"&&delete r[s]}return r}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(n=>(n=this.el)==null?void 0:n.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let r=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),r=!0):r=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(r),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,n=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,n),this.animationDelay);if(n)$.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(r=>$.shouldSizeToContent(r))){const r=[...this.engine.nodes];this.batchUpdate(),r.forEach(i=>{$.shouldSizeToContent(i)&&this.resizeToContentCBCheck(i.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,n?[n]:this.engine.nodes)}}_updateResizeEvent(e=!1){const n=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(r=>r.sizeToContent));return!e&&n&&!this.resizeObserver?(this._sizeThrottle=$.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!n)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return $.getElement(e)}static getElements(e=".grid-stack-item"){return $.getElements(e)}static getGridElement(e){return Ae.getElement(e)}static getGridElements(e){return $.getElements(e)}_initMargin(){let e,n=0,r=[];typeof this.opts.margin=="string"&&(r=this.opts.margin.split(" ")),r.length===2?(this.opts.marginTop=this.opts.marginBottom=r[0],this.opts.marginLeft=this.opts.marginRight=r[1]):r.length===4?(this.opts.marginTop=r[0],this.opts.marginRight=r[1],this.opts.marginBottom=r[2],this.opts.marginLeft=r[3]):(e=$.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(o=>{this.opts[o]===void 0?this.opts[o]=n:(e=$.parseHeight(this.opts[o]),this.opts[o]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const s=this.el.style;return s.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Pn}static setupDragIn(e,n,r,i=document){(n==null?void 0:n.pause)!==void 0&&(He.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?$.getElements(e,i):e).forEach((o,a)=>{Pn.isDraggable(o)||Pn.dragIn(o,n),r!=null&&r[a]&&(o.gridstackNode=r[a])})}movable(e,n){return this.opts.staticGrid?this:(Ae.getElements(e).forEach(r=>{const i=r.gridstackNode;i&&(n?delete i.noMove:i.noMove=!0,this.prepareDragDrop(i.el))}),this)}resizable(e,n){return this.opts.staticGrid?this:(Ae.getElements(e).forEach(r=>{const i=r.gridstackNode;i&&(n?delete i.noResize:i.noResize=!0,this.prepareDragDrop(i.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&n&&r.subGrid.enableMove(e,n)}),this)}enableResize(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&n&&r.subGrid.enableResize(e,n)}),this)}cancelDrag(){var n;const e=(n=this._placeholder)==null?void 0:n.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&Ae._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Pn.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Pn.droppable(this.el,"destroy"),this;let e,n;const r=(i,s,o)=>{var h;o=o||s;const a=o.gridstackNode;if(!a)return;if(!((h=a.grid)!=null&&h.el)){o.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const p=o.getBoundingClientRect();o.style.left=p.x+(this.dragTransform.xScale-1)*(i.clientX-p.x)/this.dragTransform.xScale+"px",o.style.top=p.y+(this.dragTransform.yScale-1)*(i.clientY-p.y)/this.dragTransform.yScale+"px",o.style.transformOrigin="0px 0px"}let{top:l,left:c}=o.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,l-=u.top;const f={position:{top:l*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(c/n)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){Pn.off(s,"drag");return}a._willFitPos&&($.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(o,i,f,a,n,e)}else this._dragOrResize(o,i,f,a,n,e)};return Pn.droppable(this.el,{accept:i=>{const s=i.gridstackNode||this._readAttr(i,!1);if((s==null?void 0:s.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let o=!0;if(typeof this.opts.acceptWidgets=="function")o=this.opts.acceptWidgets(i);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;o=i.matches(a)}if(o&&s&&this.opts.maxRow){const a={w:s.w,h:s.h,minW:s.minW,minH:s.minH};o=this.engine.willItFit(a)}return o}}).on(this.el,"dropover",(i,s,o)=>{let a=(o==null?void 0:o.gridstackNode)||s.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(s,o),o=o||s,n=this.cellWidth(),e=this.getCellHeight(!0),!a){const u=o.getAttribute("data-gs-widget")||o.getAttribute("gridstacknode");if(u){try{a=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}o.removeAttribute("data-gs-widget"),o.removeAttribute("gridstacknode")}a||(a=this._readAttr(o)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,o.gridstackNode=a);const l=a.w||Math.round(o.offsetWidth/n)||1,c=a.h||Math.round(o.offsetHeight/e)||1;return a.grid&&a.grid!==this?(s._gridstackNodeOrig||(s._gridstackNodeOrig=a),s.gridstackNode=a={...a,w:l,h:c,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=c,a._temporaryRemoved=!0),Ae._itemRemoving(a.el,!1),Pn.on(s,"drag",r),r(i,s,o),!1}).on(this.el,"dropout",(i,s,o)=>{const a=(o==null?void 0:o.gridstackNode)||s.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(s,o),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(i,s,o)=>{var h,p,m;const a=(o==null?void 0:o.gridstackNode)||s.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,c=s!==o;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const u=s._gridstackNodeOrig;if(delete s._gridstackNodeOrig,l&&(u!=null&&u.grid)&&u.grid!==this){const g=u.grid;g.engine.removeNodeFromLayoutCache(u),g.engine.removedNodes.push(u),g._triggerRemoveEvent()._triggerChangeEvent(),g.parentGridNode&&!g.engine.nodes.length&&g.opts.subGridDynamic&&g.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(h=a.grid)==null||delete h._isTemp,Pn.off(s,"drag"),o!==s?(o.remove(),s=o):s.remove(),this._removeDD(s),!l))return!1;const f=(m=(p=a.subGrid)==null?void 0:p.el)==null?void 0:m.gridstack;return $.copyPos(a,this._readAttr(this.placeholder)),$.removePositioningStyles(s),c&&(a.content||a.subGridOpts||Ae.addRemoveCB)?(delete a.el,s=this.addWidget(a)):(this._prepareElement(s,!0,a),this.el.appendChild(s),this.resizeToContentCheck(!1,a),f&&(f.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},u&&u.grid?u:void 0,a),!1}),this}static _itemRemoving(e,n){if(!e)return;const r=e?e.gridstackNode:void 0;!(r!=null&&r.grid)||e.classList.contains(r.grid.opts.removableOptions.decline)||(n?r._isAboutToRemove=!0:delete r._isAboutToRemove,n?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Pn.isDroppable(e)&&Pn.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,r)=>Ae._itemRemoving(r,!0)).on(e,"dropout",(n,r)=>Ae._itemRemoving(r,!1)),this):this}prepareDragDrop(e,n=!1){const r=e==null?void 0:e.gridstackNode;if(!r)return;const i=r.noMove||this.opts.disableDrag,s=r.noResize||this.opts.disableResize,o=this.opts.staticGrid||i&&s;if((n||o)&&(r._initDD&&(this._removeDD(e),delete r._initDD),o))return e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!r._initDD){let a,l;const c=(h,p)=>{this.triggerEvent(h,h.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,h,p,r,a,l)},u=(h,p)=>{this._dragOrResize(e,h,p,r,a,l)},f=h=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete r._moving,delete r._resizing,delete r._event,delete r._lastTried;const p=r.w!==r._orig.w,m=h.target;if(!(!m.gridstackNode||m.gridstackNode.grid!==this)){if(r.el=m,r._isAboutToRemove){const g=e.gridstackNode.grid;g._gsEventHandler[h.type]&&g._gsEventHandler[h.type](h,m),g.engine.nodes.push(r),g.removeWidget(e,!0,!0)}else $.removePositioningStyles(m),r._temporaryRemoved?(this._writePosAttr(m,r),this.engine.addNode(r)):this._writePosAttr(m,r),this.triggerEvent(h,m);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(r.sizeToContent)&&(r.sizeToContent=r.h),this.resizeToContentCheck(p,r))}};Pn.draggable(e,{start:c,stop:f,drag:u,rtl:this.opts.rtl}).resizable(e,{start:c,stop:f,resize:u,rtl:this.opts.rtl}),r._initDD=!0}return Pn.draggable(e,i?"disable":"enable").resizable(e,s?"disable":"enable"),this}_onStartMoving(e,n,r,i,s,o){var a;if(this.engine.cleanNodes().beginUpdate(i),this._writePosAttr(this.placeholder,i),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=i,(a=i.grid)!=null&&a.el)this.dragTransform=$.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=$.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(i.el=this.placeholder,i._lastUiPosition=r.position,i._prevYPix=r.position.top,i._moving=n.type==="dragstart",i._resizing=n.type==="resizestart",delete i._lastTried,n.type==="dropover"&&i._temporaryRemoved&&(this.engine.addNode(i),i._moving=!0),this.engine.cacheRects(s,o,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const l=this.getColumn()-i.x,c=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;Pn.resizable(e,"option","minWidth",s*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",o*Math.min(i.minH||1,c)).resizable(e,"option","maxWidth",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",o*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxHeightMoveUp",o*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,r,i,s,o){var b;const a={...i._orig};let l,c=this.opts.marginLeft,u=this.opts.marginRight,f=this.opts.marginTop,h=this.opts.marginBottom;const p=Math.round(o*.1),m=Math.round(s*.1);if(c=Math.min(c,m),u=Math.min(u,m),f=Math.min(f,p),h=Math.min(h,p),n.type==="drag"){if(i._temporaryRemoved)return;i._prevYPix=r.position.top,this.opts.draggable.scroll!==!1&&((b=He.dragElement)==null||b.updateScrollPosition(this.el));const _=r.position.left+(r.position.left>i._lastUiPosition.left?-u:c),y=r.position.top+(r.position.top>i._lastUiPosition.top?-h:f);a.x=Math.round(_/s),a.y=Math.round(y/o);const O=this._extraDragRow;if(this.engine.collide(i,a)){const N=this.getRow();let S=Math.max(0,a.y+i.h-N);this.opts.maxRow&&N+S>this.opts.maxRow&&(S=Math.max(0,this.opts.maxRow-N)),this._extraDragRow=S}else this._extraDragRow=0;if(this._extraDragRow!==O&&this._updateContainerHeight(),i.x===a.x&&i.y===a.y)return}else if(n.type==="resize"){if(a.x<0||($.updateScrollResize(n,e,o),a.w=Math.round((r.size.width-c)/s),a.h=Math.round((r.size.height-f)/o),i.w===a.w&&i.h===a.h)||i._lastTried&&i._lastTried.w===a.w&&i._lastTried.h===a.h)return;if(n.hasMovedX){const _=r.position.left+c;a.x=Math.round(_/s)}if(n.hasMovedY){const _=r.position.top+f;a.y=Math.round(_/o)}l=!0}i._event=n,i._lastTried=a;const g={x:r.position.left+c,y:r.position.top+f,w:(r.size?r.size.width:i.w*s)-c-u,h:(r.size?r.size.height:i.h*o)-f-h};if(this.engine.moveNodeCheck(i,{...a,cellWidth:s,cellHeight:o,rect:g,resizing:l})){i._lastUiPosition=r.position,this.engine.cacheRects(s,o,f,u,h,c),delete i._skipDown,l&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const _=n.target;i._sidebarOrig||this._writePosAttr(_,i),this.triggerEvent(n,_)}}triggerEvent(e,n){let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;r._gsEventHandler[e.type]&&r._gsEventHandler[e.type](e,n)}_leave(e,n){n=n||e;const r=n.gridstackNode;if(!r||(n.style.transform=n.style.transformOrigin=null,Pn.off(e,"drag"),r._temporaryRemoved))return;r._temporaryRemoved=!0,this.engine.removeNode(r),r.el=r._isExternal&&n?n:e;const i=r._sidebarOrig;r._isExternal&&this.engine.cleanupNode(r),r._sidebarOrig=i,this.opts.removable===!0&&Ae._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):r._isExternal&&this.engine.restoreInitial()}}Ae.renderCB=(t,e)=>{t&&(e!=null&&e.content)&&(t.textContent=e.content)};Ae.resizeToContentParent=".grid-stack-item-content";Ae.Utils=$;Ae.Engine=Wr;Ae.GDRev="12.6.0";function hd(t){return{...t,w:Math.max(t.w,t.minW??t.w),h:Math.max(t.h,t.minH??t.h)}}const Rf="mndw:dashboard:grid-layout",wM=/^widget-(.+):([1-9]\d*)$/;function An(t){const e=wM.exec(t);if(e===null)return null;const n=Number(e[2]);return!Number.isSafeInteger(n)||n<1?null:{pluginName:e[1],counter:n}}function Af(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.id=="string"&&Number.isInteger(e.x)&&e.x>=0&&Number.isInteger(e.y)&&e.y>=0&&Number.isInteger(e.w)&&e.w>0&&Number.isInteger(e.h)&&e.h>0}function Gp(t){return Af(t)?{id:t.id,x:t.x,y:t.y,w:t.w,h:t.h}:null}function Vp(){try{localStorage.removeItem(Rf)}catch(t){console.error("[mndw] Failed to clear dashboard layout:",t)}}function yM(t,e){const n=An(t),r=An(e);return n===null||r===null?t.localeCompare(e):n.pluginName.localeCompare(r.pluginName)||n.counter-r.counter}function kM(t){return[...t].sort((e,n)=>e.y-n.y||e.x-n.x||yM(e.id,n.id)).map(e=>e.id)}function EM(t,e){const n=new Set(e.map(s=>s.id)),r=new Set,i=[];if(Array.isArray(t))for(const s of t)typeof s=="string"&&n.has(s)&&!r.has(s)&&(r.add(s),i.push(s));for(const s of kM(e))r.has(s)||(r.add(s),i.push(s));return i}function SM(t,e){const n=hd(e);return{x:0,y:t.reduce((i,s)=>Math.max(i,s.y+s.h),0),w:Math.min(n.w,12),h:n.h}}function TM(t,e,n){const r=new Set,i=[];for(const s of t){if(!Af(s)||r.has(s.id))continue;const o=An(s.id);if(o===null)continue;const a=n==null?void 0:n(o.pluginName);if(n!==void 0&&(a==null?void 0:a.type)!=="widget")continue;if(a!==void 0&&(!a.runnable||a.status!=="loaded")){r.add(s.id),i.push({id:s.id,x:s.x,y:s.y,w:s.w,h:s.h});continue}const l=(a==null?void 0:a.size)??e(o.pluginName);if(l===void 0)continue;const c=Math.min(Math.max(s.w,l.minW??1),12),u=Math.max(s.h,l.minH??1);r.add(s.id),i.push({id:s.id,x:Math.min(s.x,12-c),y:s.y,w:c,h:u})}return i}function xM(t){const e=new Set,n=[];for(const r of t)!Af(r)||e.has(r.id)||An(r.id)===null||(e.add(r.id),n.push({id:r.id,x:r.x,y:r.y,w:r.w,h:r.h}));return n}function PM(t){return typeof t=="object"&&t!==null&&!("version"in t)&&Array.isArray(t.tiles)}function CM(t){const e={tiles:t.tiles.map(({id:n,x:r,y:i,w:s,h:o})=>({id:n,x:r,y:i,w:s,h:o})),mobileOrder:[...t.mobileOrder]};try{return localStorage.setItem(Rf,JSON.stringify(e)),!0}catch(n){return console.error("[mndw] Failed to save dashboard layout:",n),!1}}function RM(t,e){let n;try{n=localStorage.getItem(Rf)}catch(o){return console.error("[mndw] Failed to load dashboard layout:",o),null}if(n===null)return null;let r;try{r=JSON.parse(n)}catch(o){return console.warn("[mndw] Failed to parse dashboard layout, discarding:",o),Vp(),null}if(!PM(r))return console.warn("[mndw] Malformed dashboard layout, discarding"),Vp(),null;const s=(e==null?void 0:e.listOutcome)==="failed"||(e==null?void 0:e.listOutcome)==="pending"?xM(r.tiles):TM(r.tiles,t,e===void 0?void 0:e.getPlugin);return{tiles:s,mobileOrder:EM(r.mobileOrder,s)}}var AM=D('<div class="mndw-grid-scroll mndw-scrollbar"><div class="grid-stack"></div></div>');function OM(t,e){Ze(e,!0);let n;const r=12,i="mndw-grid-resize-indicator",s=`.${i}`;function o(f){const h=f.gridstackNode;return h===void 0||!Number.isInteger(h.w)||!Number.isInteger(h.h)?null:{w:h.w,h:h.h}}function a(f){var h;(h=f.querySelector(s))==null||h.remove()}function l(f){const h=o(f);if(h===null){a(f);return}let p=f.querySelector(s);p===null&&(p=document.createElement("div"),p.className=i,p.setAttribute("aria-hidden","true"),f.appendChild(p)),p.textContent=`${h.w} × ${h.h}`}Fn(()=>{const f=Ae.init({column:r,animate:!0,float:!1,cellHeight:60,margin:10,draggable:{handle:".mndw-grid-tile__title"},resizable:{handles:"se"}},n);f.on("removed",(p,m)=>{for(const g of m)typeof g.id=="string"&&e.onWidgetRemoved(g.id,Gp(g)??void 0)});const h=()=>{const p=f.save(!1,!1,(g,b)=>{b.x??(b.x=g.x),b.y??(b.y=g.y),b.w??(b.w=g.w),b.h??(b.h=g.h)}),m=Array.isArray(p)?p.map(Gp).filter(g=>g!==null):[];e.onLayoutChanged(m)};return f.on("added",h),f.on("change",h),f.on("resizestart",(p,m)=>{l(m)}),f.on("resize",(p,m)=>{l(m)}),f.on("resizestop",(p,m)=>{a(m);const g=m.gridstackNode;g!==void 0&&typeof g.id=="string"&&Number.isInteger(g.w)&&Number.isInteger(g.h)&&e.onWidgetResized(g.id,{w:g.w,h:g.h})}),e.onGridReady(f),()=>{f.off("removed"),f.off("added"),f.off("change"),f.off("resizestart"),f.off("resize"),f.off("resizestop"),n.querySelectorAll(s).forEach(p=>{p.remove()}),f.destroy(!1),e.onGridDestroyed()}});var c=AM(),u=v(c);Ei(u,f=>n=f,()=>n),A(t,c),We()}var MM=D("<br/> <span> </span>",1),NM=D('<span class="mndw-floating-panel__description"> </span>'),LM=D('<mndw-button><span class="mndw-floating-panel__label"> <!></span> <!></mndw-button>',2),IM=D('<div class="mndw-floating-panel"><!></div>');function zM(t,e){Ze(e,!0);const n=vn().registry;let r=V(()=>{const u=Z.locale;return n.getWidgets().map(f=>({widget:f,...Nn(f.entry,f.catalog,u)})).sort((f,h)=>f.label.localeCompare(h.label)||f.widget.entry.name.localeCompare(h.widget.entry.name))});function i(u){e.onAddWidget(u),e.close(void 0)}function s(u,f,h){return[u,f,h].filter(p=>p!==void 0&&p!=="").join(" ")}var o=IM(),a=v(o);{var l=u=>{{let f=V(()=>L("dashboard.no-widgets")),h=V(()=>L("dashboard.empty-no-plugins"));Gi(u,{mode:"compact",get title(){return d(f)},get text(){return d(h)}})}},c=u=>{var f=jn(),h=et(f);Ct(h,17,()=>d(r),p=>p.widget.entry.name,(p,m)=>{const g=V(()=>d(m).widget),b=V(()=>fc(d(g).entry.name)),_=V(()=>d(b)==="installing"?L("dashboard.preparing"):d(b)==="failed"?L("dashboard.unavailable"):"");var y=LM();C(y,"variant","secondary"),w(()=>C(y,"aria-label",s(d(m).label,d(m).description,d(_))));var O=v(y),N=v(O),S=T(N);{var P=B=>{var U=MM(),G=T(et(U),2),Y=v(G);w(()=>{Le(G,1,`mndw-floating-panel__deps ${d(b)==="failed"?"mndw-floating-panel__deps--failed":""}`),E(Y,d(_))}),A(B,U)};J(S,B=>{d(_)!==""&&B(P)})}var M=T(O,2);{var z=B=>{var U=NM(),G=v(U);w(()=>E(G,d(m).description)),A(B,U)};J(M,B=>{d(m).description&&B(z)})}w(()=>E(N,`${d(m).label??""} `)),fe("click",y,()=>i(d(g).entry.name)),A(p,y)}),A(u,f)};J(a,u=>{d(r).length===0?u(l):u(c,-1)})}A(t,o),We()}dt(["click"]);function DM(t,e,n){let r=t.aborted;const i=new Set,s=c=>{i.has(c)||i.add(c)},o=c=>{i.delete(c)},a=()=>{if(!r){r=!0;for(const c of[...i])c()}};t.addEventListener("abort",a,{once:!0});const l=Object.assign(Object.create(null),{createTicker:e,createRefreshLoop(c){let u=!1,f=!1,h=c.intervalMs,p=null,m=0,g,b=r;const _=()=>{p!==null&&(clearInterval(p),p=null)},y=()=>{u&&(u=!1,m+=1,f=!1,_(),g==null||g.abort(),g=void 0),o(y)},O=P=>{if(!u||b||f)return;f=!0;const M=m,z=new AbortController;g=z;let B;try{B=c.load(z.signal)}catch(U){f=!1,g=void 0,z.abort(),u&&!b&&m===M&&c.onError(U,P);return}B.then(U=>{u&&!b&&m===M&&c.onSuccess(U)},U=>{u&&!b&&m===M&&c.onError(U,P)}).finally(()=>{m===M&&(f=!1,g===z&&(g=void 0))})},N=()=>{_(),p=setInterval(()=>O(!1),h)};return{start(P={}){u||b||r||(u=!0,m+=1,s(y),N(),P.immediate!==!1&&O(!0))},stop:y,setIntervalMs(P){h=P,u&&N()},dispose(){b=!0,y()}}}});return Object.freeze(l)}const Of=new Map;function HM(t){return t.includes(":instance:")}function Mf(t){return Of.get(t)}function BM(t){const e=Symbol();return Of.set(t,e),e}function Kb(t){const e=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r!=null&&r.startsWith(t)&&e.push(r)}for(const n of e)localStorage.removeItem(n)}class Zp{constructor(e){K(this,"prefix");K(this,"instanceRevision");this.prefix=e,this.instanceRevision=HM(e)?BM(e):null}async get(e){return Promise.resolve(localStorage.getItem(this.prefix+e))}async set(e,n){return this.canWrite()&&localStorage.setItem(this.prefix+e,n),Promise.resolve()}async delete(e){return this.canWrite()&&localStorage.removeItem(this.prefix+e),Promise.resolve()}async keys(){const e=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r!=null&&r.startsWith(this.prefix)&&e.push(r.slice(this.prefix.length))}return Promise.resolve(e)}canWrite(){return this.instanceRevision===null||Mf(this.prefix)===this.instanceRevision}}function Go(t,e){const n=`${Rs}:${t}:instance:${e}:`;Kb(n)}function UM(t,e){return Mf(`${Rs}:${t}:instance:${e}:`)}function Wp(t,e,n){const r=`${Rs}:${t}:instance:${e}:`;Mf(r)===n&&(Kb(r),Of.delete(r))}function $M(t,e){const n=Object.create(null);for(const r of e){const i=t[r];typeof i=="function"&&(n[r]=i.bind(t))}return Object.freeze(n)}function Yb(t){if(t===null||typeof t!="object"&&typeof t!="function"||Object.isFrozen(t))return t;for(const e of Object.values(t))Yb(e);return Object.freeze(t)}function jM(t){const e={list:t.switchports.list.map(l=>({...l})),layout:t.switchports.layout.map(l=>[...l]),hasPortStats:t.switchports.hasPortStats},n={ports:[...t.usb.ports]},r=[...t.features],i=[...t.components],s=new Set(r.map(l=>l.toLowerCase())),o=new Set(i.map(l=>l.toLowerCase())),a={...t,features:r,components:i,switchports:e,usb:n,hasFeature:l=>s.has(l.toLowerCase()),hasComponent:l=>o.has(l.toLowerCase())};return Yb(a)}const lt={dashboard:"/",login:"/login",packages:"/packages",packageServices:"/packages/services",settings:"/settings",settingsTab:{general:"/settings/general",diagnostics:"/settings/diagnostics",plugins:"/settings/plugins","self-update":"/settings/self-update"}},qp=lt.settingsTab,FM=/^[a-z][a-z\d+.-]*:/i;function GM(t){if(t==="")return"";if(t.startsWith("/")||t.includes("\\")||t.includes("?")||t.includes("#")||FM.test(t))return;const e=t.endsWith("/")?t.slice(0,-1):t;if(e==="")return;const n=e.split("/");for(const r of n){if(r==="")return;let i;try{i=decodeURIComponent(r)}catch{return}if(i==="."||i===".."||i.includes("/")||i.includes("\\"))return}return e}function VM(t,e){try{if(typeof t!="object"||t===null)return;const n=t;switch(n.kind){case"dashboard":return lt.dashboard;case"packages":return lt.packages;case"settings":{const r=n.tab;return r===void 0?lt.settings:typeof r!="string"||!Object.hasOwn(qp,r)?void 0:qp[r]}case"plugin-page":{if(typeof n.plugin!="string")return;const r=e.pageTable.baseRouteOf(n.plugin);if(r===void 0)return;const i=n.path;if(i!==void 0&&typeof i!="string")return;const s=GM(i??"");return s===void 0?void 0:s===""?r:`${r}/${s}`}default:return}}catch{return}}function Kp(t,e){try{const n=e.getRouter();if(n===void 0)return;const r=VM(t,n);return r===void 0?void 0:{router:n,path:r}}catch{return}}function ZM(t){return Object.freeze({href:e=>{var n;return(n=Kp(e,t))==null?void 0:n.path},navigate:e=>{try{if(t.isDisposed())return!1;const n=Kp(e,t);return n===void 0?!1:(n.router.navigate(n.path),!0)}catch{return!1}}})}let WM=0;const qM=()=>{const t=globalThis.crypto;return(t==null?void 0:t.randomUUID)!==void 0?t.randomUUID():`event-context-${++WM}`};function KM(t){const{routes:e}=t.backend;if(Object.keys(e??{}).length===0)return _p(t.name,void 0);const n={routes:e??{},approval:t.approval,enabled:t.enabled};return _p(t.name,n)}function Nf(t){const{entry:e,instanceId:n,deviceInfo:r,setTileTitle:i,pageRoute:s,catalogCell:o,services:a}=t,l=()=>a.locale.getLocale(),c=Y=>a.locale.subscribeLocale(Y),u=()=>a.palette.getTokens(),f=a.eventStream;if(e.type==="page"&&s===void 0)throw new Error(`Page plugin "${e.name}" requires a page route`);const h=Ab(),p=new AbortController,m=el(()=>a.theme.getTheme(),Y=>a.theme.subscribeTheme(Y),h),g=el(u,Y=>a.palette.subscribePalette(Y),h),b=el(()=>a.telemetryGathering.get(),Y=>a.telemetryGathering.subscribe(()=>Y(a.telemetryGathering.get())),h).pipe(U_(Y=>Y!==null)),_={fetchProjected:(...Y)=>a.telemetry.fetchProjected(...Y),gathering$:b},y=Object.create(null);Object.defineProperties(y,{theme:{enumerable:!0,get:()=>a.theme.getTheme()},theme$:{enumerable:!0,value:m},palette:{enumerable:!0,get:()=>u()},palette$:{enumerable:!0,value:g}}),Object.freeze(y);const{service:O,dispose:N}=xf(e.name,n,a.overlayRuntime),S=qM(),P=f.createFacade(S,e.name,e.capabilities??[],h);let M=!1;const z=ZM({getRouter:()=>a.navigation(),isDisposed:()=>M}),B=Y=>{M||(M=!0,p.abort(),h.end(),f.disposeFacade(S),N(Y))},U=e.type==="page"?(()=>{if(s===void 0)throw new Error(`Page plugin "${e.name}" requires a page route`);return{kind:"page",pageRoute:s}})():{kind:"widget",setTileTitle:i??(()=>{})},G={signal:p.signal,navigation:z,telemetry:_,events:P,storage:Object.freeze(Object.assign(Object.create(null),{instance:new Zp(`${Rs}:${e.name}:instance:${n}:`),shared:new Zp(`${Rs}:${e.name}:shared:`)})),device:Object.freeze(Object.assign(Object.create(null),{info:jM(r),rci:bP($M(a.rci.driver,sb))})),i18n:iA(o,l,c,h),instanceId:n,timers:DM(p.signal,()=>a.tickerPool.create(h)),backend:KM(e),overlay:O,...U,appearance:y};return Object.setPrototypeOf(G,null),{context:Object.freeze(G),dispose:B}}function YM(t,e,n,r,i,s){Z.hostInfo;const o=Z.deviceInfo??Gd,a=e.get(n);if(!a)throw new Error(`No loaded plugin "${n}"`);return Nf({entry:a.entry,instanceId:r,deviceInfo:o,setTileTitle:s,catalogCell:a.catalog,services:t})}function Xb(t){return t===null||typeof t!="object"&&typeof t!="function"?!1:typeof t.then=="function"}function XM(t,e,n,r,i){var a;const s=e.entry.name,o=(a=i==null?void 0:i.pluginStylesheets)==null?void 0:a.retain(s,e.entry.version);try{const l=e.module.createInstance(t,n);return Xb(l)?Promise.resolve(l).then(c=>({pluginName:s,instanceId:n.instanceId,instance:c,stylesheetLease:o,disposeOverlayService:r})).catch(c=>(console.error(`[mndw] Plugin "${s}" createInstance failed:`,c),o==null||o.release(),r("plugin-unmount"),i!=null&&i.errorText&&(t.textContent=i.errorText),null)):{pluginName:s,instanceId:n.instanceId,instance:l,stylesheetLease:o,disposeOverlayService:r}}catch(l){return console.error(`[mndw] Plugin "${s}" createInstance failed:`,l),o==null||o.release(),r("plugin-unmount"),i!=null&&i.errorText&&(t.textContent=i.errorText),null}}function Yp(t,e,n,r){var s,o,a;if(r)try{(s=t.disposeOverlayService)==null||s.call(t,(n==null?void 0:n.closeReason)??"plugin-unmount")}catch(l){console.error(`[mndw] Plugin "${t.pluginName}" overlay teardown failed:`,l)}let i;try{i=t.instance.unmount()}catch(l){console.error(`[mndw] Plugin "${t.pluginName}" unmount failed:`,l),(o=t.stylesheetLease)==null||o.release(),i=void 0}Xb(i)?Promise.resolve(i).catch(l=>{console.error(`[mndw] Plugin "${t.pluginName}" unmount failed:`,l)}).finally(()=>{var l;return(l=t.stylesheetLease)==null?void 0:l.release()}):(a=t.stylesheetLease)==null||a.release(),(n==null?void 0:n.clearStorage)!==!1&&Go(t.pluginName,t.instanceId),e.innerHTML=""}function Jb(t,e,n,r){let i=null,s=!1,o=!1,a,l=!1;const c=h=>{l||(l=!0,n.dispose(h))},u=XM(t,e,n.context,c,r);let f;return u instanceof Promise?f=u.then(h=>(s=!0,i=h,o&&(h!==null?Yp(h,t,a,!1):((a==null?void 0:a.clearStorage)===!0&&Go(e.entry.name,n.context.instanceId),t.innerHTML=""),i=null),h!==null)):(s=!0,i=u,f=Promise.resolve(u!==null)),{getMounted:()=>i,whenReady:()=>f,dispose(h){if(!o){if(o=!0,a=h,i!==null){Yp(i,t,h,!0),i=null;return}if(!s){try{c((h==null?void 0:h.closeReason)??"plugin-unmount")}catch(p){console.error(`[mndw] Plugin "${e.entry.name}" context teardown failed:`,p)}t.innerHTML="";return}(h==null?void 0:h.clearStorage)===!0&&Go(e.entry.name,n.context.instanceId)}}}}function Qb(t,e,n,r){return Jb(t,e,n,r)}const Jn=new Map;function pd(){return{getMounted:()=>null,whenReady:()=>Promise.resolve(!1),dispose:()=>{}}}function Xp(t,e,n){t.textContent="";const r=document.createElement("div");r.className=`mndw-grid-tile__notice mndw-grid-tile__notice--${e}`,r.setAttribute("role",e==="installing"?"status":"alert"),r.textContent=n(e==="installing"?"dashboard.preparing-dependencies":"dashboard.dependency-install-failed"),t.appendChild(r)}function Lf(t,e,n,r){var h;const i=fn(t.pluginName),s=(i==null?void 0:i.status)==="loading",o=i===void 0?t.pluginName:Nn(i,i.catalog,Z.locale).label,a=t.body.querySelector(".mndw-grid-tile__notice--plugin-load-failed");if((a==null?void 0:a.getAttribute("aria-busy"))===String(s)&&((h=a.querySelector("h3"))==null?void 0:h.textContent)===r("dashboard.plugin-load-failed",{label:o}))return;const l=document.createElement("section");l.className="mndw-grid-tile__notice mndw-grid-tile__notice--plugin-load-failed",l.setAttribute("role","alert"),l.setAttribute("aria-busy",String(s));const c=document.createElement("h3");c.textContent=r("dashboard.plugin-load-failed",{label:o});const u=document.createElement("button");u.type="button",u.className="mndw-grid-tile__retry",u.textContent=r("dashboard.retry-plugin-load"),u.disabled=s,u.setAttribute("aria-busy",String(s)),u.onclick=()=>{u.disabled||(u.disabled=!0,u.setAttribute("aria-busy","true"),l.setAttribute("aria-busy","true"),n())};const f=document.createElement("button");f.type="button",f.className="mndw-grid-tile__remove-failed",f.textContent=r("dashboard.remove-failed-plugin"),f.onclick=()=>e(t.id),l.append(c,u,f),t.body.replaceChildren(l),t.retrying=s}async function e_(t){if(!t.retrying){t.retrying=!0;try{await OA(t.pluginName)}finally{t.retrying=!1}}}function JM(t,e,n){const r=document.createElement("div");r.className="mndw-grid-tile",r.dataset.widgetId="";const i=document.createElement("div");i.className="mndw-grid-tile__title",i.textContent=t;const s=document.createElement("button");s.type="button",s.className="mndw-grid-tile__close";const o=document.createElement("mndw-icon");o.setAttribute("name","x"),s.append(o),s.setAttribute("aria-label",n("dashboard.remove-widget",{label:t})),s.onclick=p=>{p.stopPropagation(),e()};const a=document.createElement("div");a.className="mndw-grid-tile__body";let l=t,c=t;const u=p=>{const m=c===l;l=p,i.setAttribute("data-manifest-label",p),s.setAttribute("aria-label",n("dashboard.remove-widget",{label:p})),m&&(c=p,i.textContent=p)};i.setAttribute("data-manifest-label",l);const f=p=>{const m=l,g=p||m;c=g,i.textContent=g,s.setAttribute("aria-label",n("dashboard.remove-widget",{label:m}))},h=()=>c;return r.append(i,s,a),{frame:r,body:a,setTileTitle:f,getTileTitle:h,setManifestLabel:u}}function t_(t,e,n){t.catalogUnsubscribe(),t.setManifestLabel(Nn(e.entry,n,Z.locale).label),t.catalogUnsubscribe=(n==null?void 0:n.subscribe(()=>{t.setManifestLabel(Nn(e.entry,n,Z.locale).label)}))??(()=>{})}function mc(t,e,n,r){const i=fc(t.pluginName);if(t.pluginLoadPlaceholder=!1,t.retrying=!1,i==="installing"){Xp(t.body,"installing",n.locale.hostT),t.handle=pd(),t.pending=!0;return}if(i==="failed"){Xp(t.body,"failed",n.locale.hostT),t.handle=pd(),t.pending=!1;return}t.body.textContent="";const s=Qb(t.body,e,YM(n,r,t.pluginName,t.instanceId,void 0,t.setTileTitle),{errorText:n.locale.hostT("dashboard.widget-error"),pluginStylesheets:t.pluginStylesheets});t.handle=s,t.pending=!1,s.whenReady().then(o=>{o||Jn.get(t.id)!==t||t.handle!==s||Lf(t,t.onRemoveRequest,()=>{Jn.get(t.id)!==t||t.handle!==s||(s.dispose(),mc(t,e,n,r))},n.locale.hostT)})}function vc(t,e,n,r,i,s){const o=`widget-${r}`,a=Jn.get(o);if(a!==void 0)return a;const l=e.get(n),c=(l==null?void 0:l.entry.type)==="widget"?l:void 0,u=fn(n);if(c===void 0&&!((u==null?void 0:u.runnable)===!0&&u.type==="widget"&&(u.status==="failed"||u.status==="loading")))return null;const f=c===void 0?u===void 0?n:Nn(u,u.catalog,Z.locale).label:Nn(c.entry,c.catalog,Z.locale).label,{frame:h,body:p,setTileTitle:m,getTileTitle:g,setManifestLabel:b}=JM(f,()=>i(o),t.locale.hostT);h.dataset.widgetId=o,p.dataset.theme=t.theme.getTheme();const _=t.theme.subscribeTheme(O=>{p.dataset.theme=O}),y={id:o,pluginName:n,instanceId:r,frame:h,body:p,themeUnsubscribe:_,catalogUnsubscribe:()=>{},handle:pd(),setTileTitle:m,getTileTitle:g,setManifestLabel:b,pending:!1,pluginLoadPlaceholder:c===void 0,retrying:(u==null?void 0:u.status)==="loading",onRemoveRequest:i,hostT:t.locale.hostT,pluginStylesheets:s};return Jn.set(o,y),c!==void 0&&t_(y,c,c.catalog),y.pluginLoadPlaceholder?Lf(y,i,()=>{e_(y)},y.hostT):c!==void 0&&mc(y,c,t,e),y}function QM(t,e,n,r){if(Jn.get(t.id)!==t||!t.pluginLoadPlaceholder)return;const i=fn(t.pluginName);if((i==null?void 0:i.status)==="loaded"){const s=n.get(t.pluginName);(s==null?void 0:s.entry.type)==="widget"&&mc(t,s,r,n);return}((i==null?void 0:i.status)==="failed"||(i==null?void 0:i.status)==="loading")&&Lf(t,e,()=>{e_(t)},r.locale.hostT)}function n_(t,e){for(const n of Jn.values())n.pluginLoadPlaceholder&&QM(n,n.onRemoveRequest,e,t)}function Nl(t){return Jn.get(t)}function r_(t,e){for(const n of Jn.values()){if(!n.pending)continue;const r=e.get(n.pluginName);if((r==null?void 0:r.entry.type)!=="widget"){n.pending=!1;continue}mc(n,r,t,e)}}function is(t,e={}){const n=Jn.get(t);n!==void 0&&(Jn.delete(t),n.themeUnsubscribe(),n.catalogUnsubscribe(),n.frame.remove(),n.handle.dispose({clearStorage:e.clearStorage??!0,closeReason:"plugin-unmount"}))}async function eN(t,e,n,r,i,s){const o=[...Jn.values()].filter(f=>f.pluginName===n&&!f.pending);if(o.length===0)return!0;for(const f of o)f.handle.dispose({clearStorage:!1,closeReason:"host-navigation"});const a=f=>o.map(h=>{t_(h,f,f.catalog),h.setTileTitle(""),Z.hostInfo;const p=Z.deviceInfo??Gd;return h.handle=Qb(h.body,f,Nf({entry:f.entry,instanceId:h.instanceId,deviceInfo:p,setTileTitle:h.setTileTitle,catalogCell:f.catalog,services:t}),{errorText:t.locale.hostT("dashboard.widget-error"),pluginStylesheets:s??h.pluginStylesheets}),h.handle}),l=a(r);if((await Promise.all(l.map(f=>f.whenReady()))).every(Boolean))return!0;for(const f of l)f.dispose({clearStorage:!1,closeReason:"host-navigation"});const u=a(i);return await Promise.all(u.map(f=>f.whenReady())),!1}function i_(t="plugin-unmount"){for(const[e,n]of Jn)try{n.handle.dispose({clearStorage:!1,closeReason:t})}catch(r){console.error(`[mndw] Failed to unmount tile ${e}:`,r)}finally{n.themeUnsubscribe(),n.catalogUnsubscribe()}Jn.clear()}const tN=Object.freeze(Object.defineProperty({__proto__:null,destroyAllTiles:i_,ensureTileController:vc,getTileController:Nl,hydratePendingTiles:r_,refreshPluginLoadPlaceholders:n_,remountWidgetTiles:eN,removeTileController:is},Symbol.toStringTag,{value:"Module"}));var nN=D('<div class="mndw-mobile-tile"></div>'),rN=D('<div class="mndw-mobile-dashboard mndw-scrollbar"></div>');function iN(t,e){Ze(e,!0);const n=vn(),r=n.registry,i={locale:n.locale,palette:n.palette,telemetry:n.telemetry,telemetryGathering:n.telemetryGathering,eventStream:n.eventStream,rci:n.rci,theme:n.theme,tickerPool:n.tickerPool,overlayRuntime:n.overlayRuntime,navigation:n.router.navigation};function s(a,l){const c=An(l);if(c===null){a.remove();return}const u=vc(i,r,c.pluginName,`${c.pluginName}:${c.counter}`,e.onRemoveRequest,n.pluginStylesheets);if(u===null){a.remove();return}a.appendChild(u.frame)}var o=rN();Ct(o,20,()=>e.order,a=>a,(a,l)=>{var c=nN();Fs(c,(u,f)=>s==null?void 0:s(u,f),()=>l),A(a,c)}),A(t,o),We()}var sN=D('<li><span class="mndw-order-card__handle" aria-hidden="true"><mndw-icon></mndw-icon></span> <span class="mndw-order-card__label"> </span> <span class="mndw-order-card__moves"><mndw-button><mndw-icon></mndw-icon></mndw-button> <mndw-button><mndw-icon></mndw-icon></mndw-button></span></li>',2),oN=D('<div class="mndw-order-overlay"><ul class="mndw-order-overlay__list"></ul> <div class="mndw-order-overlay__actions"><mndw-button> </mndw-button></div></div>',2);function aN(t,e){Ze(e,!0);let n=ie(at(ti(()=>e.cards.map(g=>({...g}))))),r=ie(null),i=at([]);function s(){e.onCommit(d(n).map(g=>g.id)),e.close(void 0)}function o(g,b){const _=g+b;if(_<0||_>=d(n).length)return;const y=[...d(n)],[O]=y.splice(g,1);O!==void 0&&(y.splice(_,0,O),k(n,y,!0))}function a(g,b){var _,y;k(r,b,!0),(y=(_=g.currentTarget).setPointerCapture)==null||y.call(_,g.pointerId)}function l(g){var _;const b=d(r);if(b!==null)for(let y=0;y<d(n).length;y+=1){if(y===b)continue;const O=(_=i[y])==null?void 0:_.getBoundingClientRect();if(O!==void 0&&g.clientY>=O.top&&g.clientY<=O.bottom){o(b,y-b),k(r,y,!0);return}}}function c(){k(r,null)}var u=oN(),f=v(u);Ct(f,23,()=>d(n),g=>g.id,(g,b,_)=>{var y=sN();let O;var N=v(y),S=v(N);C(S,"name","menu");var P=T(N,2),M=v(P),z=T(P,2),B=v(z);C(B,"variant","ghost"),w(()=>C(B,"disabled",d(_)===0)),w(()=>C(B,"aria-label",L("dashboard.move-up",{label:d(b).label})));var U=v(B);C(U,"name","arrow-up");var G=T(B,2);C(G,"variant","ghost"),w(()=>C(G,"disabled",d(_)===d(n).length-1)),w(()=>C(G,"aria-label",L("dashboard.move-down",{label:d(b).label})));var Y=v(G);C(Y,"name","arrow-down"),Ei(y,(oe,we)=>i[we]=oe,oe=>i==null?void 0:i[oe],()=>[d(_)]),w(()=>{O=Le(y,1,"mndw-order-card",null,O,{"mndw-order-card--dragging":d(r)===d(_)}),E(M,d(b).label)}),fe("pointerdown",N,oe=>a(oe,d(_))),fe("pointermove",N,l),fe("pointerup",N,c),fe("click",B,()=>o(d(_),-1)),fe("click",G,()=>o(d(_),1)),A(g,y)});var h=T(f,2),p=v(h);C(p,"variant","primary");var m=v(p);w(g=>E(m,g),[()=>L("common.save")]),fe("click",p,s),A(t,u),We()}dt(["pointerdown","pointermove","pointerup","click"]);const Vo=new Map;function s_(t){return`${Rs}:${t}:counter`}function o_(t){return Number.isSafeInteger(t)&&t>=0}function lN(t){try{const e=localStorage.getItem(s_(t));if(e===null||e.trim()==="")return 0;const n=Number(e);return o_(n)?(Vo.set(t,Math.max(Vo.get(t)??0,n)),n):0}catch(e){return console.error(`[mndw] Failed to read widget counter for "${t}":`,e),0}}function a_(t){return Math.max(lN(t),Vo.get(t)??0)}function l_(t,e){try{localStorage.setItem(s_(t),String(e))}catch(n){console.error(`[mndw] Failed to write widget counter for "${t}":`,n)}}function c_(t){const e=a_(t);if(e===Number.MAX_SAFE_INTEGER)throw new RangeError(`Widget instance counter exhausted for "${t}"`);const n=e+1;return Vo.set(t,n),l_(t,n),`${t}:${n}`}function cN(t,e){if(!o_(e)){console.error(`[mndw] Ignoring invalid restored widget counter for "${t}":`,e);return}e>a_(t)&&(Vo.set(t,e),l_(t,e))}function uN(t){return(t==null?void 0:t.entry.type)==="widget"}function pu(t,e,n,r,i,s,o){const a=n.get(i),l=uN(a)?a:void 0,c=fn(i),u=(c==null?void 0:c.runnable)===!0&&c.type==="widget"&&(c.status==="failed"||c.status==="loading");if(l===void 0&&!u)return null;const f=(o==null?void 0:o.instanceId)??c_(i),h=vc(t,n,i,f,s,e);if(h===null)return null;const p=l!==void 0?hd(l.entry.size):o===void 0?hd((c==null?void 0:c.size)??{w:4,h:3}):{w:o.w,h:o.h},m=r.addWidget({id:h.id,x:o==null?void 0:o.x,y:o==null?void 0:o.y,w:(o==null?void 0:o.w)??p.w,h:(o==null?void 0:o.h)??p.h,...l===void 0?{}:{minW:p.minW,minH:p.minH}}),g=m.querySelector(".grid-stack-item-content");return g===null?(r.removeWidget(m,!0),null):(g.appendChild(h.frame),r.prepareDragDrop(m,!0),h.id)}function dN(t,e){var i;const n=Nl(t),r=(i=n==null?void 0:n.handle.getMounted())==null?void 0:i.instance;if((r==null?void 0:r.onResize)!==void 0)try{r.onResize(e)}catch(s){console.error(`[mndw] Widget "${n==null?void 0:n.pluginName}" onResize failed:`,s)}}function ei(t,e,n){return t.open({kind:"modal",title:n.title,showCloseButton:n.showCloseButton??!0,closeOnEscape:n.closeOnEscape??!0,closeOnOutsideClick:n.closeOnOutsideClick??!1,mount(r,i){let s,o=()=>{};const a=new Promise(c=>{o=c}),l={...n.props,close(c){i.close(c)}};i.setCleanup(async()=>{await a,s&&await Id(s)});try{s=Wl(e,{target:r,props:l,...n.context===void 0?{}:{context:n.context}})}finally{o()}}})}var fN=D("<mndw-button> </mndw-button>",2),hN=D("<mndw-button><mndw-icon></mndw-icon> </mndw-button> <!>",3),pN=D('<div class="mndw-dashboard__grid-wrapper"><!></div>'),gN=D('<div class="mndw-dashboard-page"><div class="mndw-dashboard__toolbar"><!></div> <!> <!></div>');function gu(t,e){Ze(e,!0);const n=500,r="dashboard-layout-save",i="dashboard-widget-removal",s=8e3,o=vn(),a=YA(o),l=o.registry,c={locale:o.locale,palette:o.palette,telemetry:o.telemetry,telemetryGathering:o.telemetryGathering,eventStream:o.eventStream,rci:o.rci,theme:o.theme,tickerPool:o.tickerPool,overlayRuntime:o.overlayRuntime,navigation:o.router.navigation};function u(j){const re=l.get(j);return(re==null?void 0:re.entry.type)==="widget"?re.entry.size:void 0}const f=fa();let h,p=ie(null),m=ie(!1),g=null,b=null,_=ie(at(f.matches)),y=ie(at([])),O=ie(at([])),N=V(()=>d(y).filter(j=>Y(j.id))),S=V(()=>{const j=new Set(d(N).map(re=>re.id));return d(O).filter(re=>j.has(re))}),P=!1,M,z,B,U=ie(null),G=null;{const j=RM(u,{listOutcome:tr(),getPlugin:fn});if(j!==null){k(y,j.tiles,!0),k(O,j.mobileOrder,!0);const re=new Map;for(const ne of j.tiles){const X=An(ne.id);X!==null&&re.set(X.pluginName,Math.max(re.get(X.pluginName)??0,X.counter))}for(const[ne,X]of re)cN(ne,X)}}function Y(j){var X;const re=An(j);if(re===null)return!1;const ne=fn(re.pluginName);return ne!==void 0?ne.runnable&&ne.type==="widget"&&ne.status!=="not-runnable":((X=l.get(re.pluginName))==null?void 0:X.entry.type)==="widget"}function oe(j){const re=An(j.id);if(re===null)return!1;const ne=fn(re.pluginName);return ne!==void 0&&ne.type==="widget"&&!ne.runnable}function we(j){const re=new Set(j.map(X=>X.id)),ne=d(y).filter(X=>oe(X)&&!re.has(X.id));return[...j,...ne]}function he(j){const re=new Set(d(S));let ne=0;const X=d(O).map(Ue=>{if(!re.has(Ue))return Ue;const Ke=j[ne];return ne+=1,Ke??Ue});for(const Ue of j.slice(ne))X.includes(Ue)||X.push(Ue);return X}function te(j={tiles:ka(d(y)),mobileOrder:ka(d(O))}){if(tr()!=="ok"){clearTimeout(M),G=null;return}clearTimeout(M),G=null,CM(j)?je.dismissKey(r):je.show({key:r,message:L("dashboard.layout-save-failed"),variant:"warning"})}function ge(){tr()==="ok"&&(clearTimeout(M),G={tiles:ka(d(y)),mobileOrder:ka(d(O))},M=setTimeout(()=>{G!==null&&te(G)},n))}function ye(){const j=d(U);j!==null&&(k(U,null),Go(j.pluginName,j.instanceId),j.mountSettlement!==null&&j.mountSettlement.then(()=>Wp(j.pluginName,j.instanceId,j.storageRevision),()=>Wp(j.pluginName,j.instanceId,j.storageRevision)))}function Me(){const j=d(U);j!==null&&(k(U,null),k(y,[...d(y)],!0),d(y).splice(Math.min(j.tileIndex,d(y).length),0,j.tile),k(O,[...d(O)],!0),d(O).splice(Math.min(j.mobileIndex,d(O).length),0,j.tile.id),!d(_)&&d(p)!==null&&qe(),te(),je.dismiss(j.toastId))}function Fe(j,re){var Qn;if(P||tr()!=="ok")return;const ne=An(j),X=d(y).findIndex(dr=>dr.id===j),Ue=re??d(y)[X]??{id:j,x:0,y:0,w:1,h:1};if(ne===null||X===-1){is(j,{clearStorage:!0});return}ye();const Ke=Nl(j),It=((Qn=Ke==null?void 0:Ke.handle)==null?void 0:Qn.whenReady())??null,F=`${ne.pluginName}:${ne.counter}`,ae=l.get(ne.pluginName),Be=(Ke==null?void 0:Ke.getTileTitle())||(ae===void 0?void 0:Nn(ae.entry,ae.catalog,Z.locale).label)||ne.pluginName,Je=d(O).indexOf(j);is(j,{clearStorage:!1}),k(y,d(y).filter(dr=>dr.id!==j),!0),k(O,d(O).filter(dr=>dr!==j),!0),te();const Vn=je.info(L("dashboard.widget-removed",{label:Be}),{key:i,duration:s,action:{label:L("common.undo"),onAction:Me}});k(U,{tile:Ue,tileIndex:X,mobileIndex:Je===-1?d(O).length:Je,pluginName:ne.pluginName,instanceId:F,storageRevision:UM(ne.pluginName,F),mountSettlement:It,toastId:Vn},!0)}function me(j){if(tr()!=="ok")return;const re=d(p);if(!d(_)&&re!==null){const ne=re.getGridItems().find(X=>{var Ue;return((Ue=X.gridstackNode)==null?void 0:Ue.id)===j});if(ne!==void 0){re.removeWidget(ne,!0);return}}Fe(j)}function Ne(j){k(p,j,!0),P=!0;try{for(const re of d(N)){const ne=An(re.id);ne!==null&&pu(c,o.pluginStylesheets,l,j,ne.pluginName,me,{x:re.x,y:re.y,w:re.w,h:re.h,instanceId:`${ne.pluginName}:${ne.counter}`})}}finally{P=!1}}function qe(){var ne;if(d(_)||d(p)===null)return;const j=new Map(d(y).filter(X=>Y(X.id)).map(X=>[X.id,X])),re=[];P=!0;try{for(const X of d(p).getGridItems()){const Ue=(ne=X.gridstackNode)==null?void 0:ne.id;if(typeof Ue!="string"){d(p).removeWidget(X,!0,!1);continue}const Ke=j.get(Ue);if(Ke===void 0){d(p).removeWidget(X,!0,!1);const It=An(Ue),F=It===null?void 0:fn(It.pluginName),ae=(F==null?void 0:F.type)==="widget"&&!F.runnable;is(Ue,{clearStorage:!ae});continue}re.push(Ue),d(p).update(X,{x:Ke.x,y:Ke.y,w:Ke.w,h:Ke.h})}for(const X of j.values()){if(re.includes(X.id))continue;const Ue=An(X.id);Ue!==null&&pu(c,o.pluginStylesheets,l,d(p),Ue.pluginName,me,{x:X.x,y:X.y,w:X.w,h:X.h,instanceId:`${Ue.pluginName}:${Ue.counter}`})}}finally{P=!1}}function se(){k(p,null)}function ke(j){P||tr()!=="ok"||(k(y,we(j),!0),ge())}function Ee(j,re){dN(j,re)}function H(j){if(tr()!=="ok")return null;const re=u(j);if(re===void 0)return null;const ne=c_(j),X=vc(c,l,j,ne,me,o.pluginStylesheets);return X===null?null:(k(y,[...d(y),{id:X.id,...SM(d(y),re)}],!0),k(O,[...d(O),X.id],!0),te(),X.id)}function q(j){if(tr()!=="ok")return null;if(d(_))return H(j);const re=d(p);if(re===null)return null;const ne=pu(c,o.pluginStylesheets,l,re,j,me);return ne!==null?(k(O,[...d(O),ne],!0),te(),ne):null}async function be(j){await To();const re=[...(h==null?void 0:h.querySelectorAll(".mndw-grid-tile"))??[]].find(X=>X.dataset.widgetId===j);if(re===void 0)return;const ne=window.matchMedia("(prefers-reduced-motion: reduce)").matches;typeof re.scrollIntoView=="function"&&re.scrollIntoView({behavior:ne?"auto":"smooth",block:"center"}),B==null||B.classList.remove("mndw-grid-tile--newly-added"),z!==void 0&&clearTimeout(z),B=re,re.classList.add("mndw-grid-tile--newly-added"),z=setTimeout(()=>{re.classList.remove("mndw-grid-tile--newly-added"),B===re&&(B=void 0),z=void 0},1600)}function Ie(){if(g!==null)return;const j=document.activeElement;let re=null;const ne=ei(o.hostOverlay,zM,{title:L("dashboard.add-widget"),props:{onAddWidget:X=>(re=q(X),re)},closeOnOutsideClick:!0,context:a});g=ne,ne.closed.then(async()=>{if(g===ne&&(g=null),re!==null){if(j instanceof HTMLElement&&!j.isConnected){const X=(h==null?void 0:h.querySelector(".mndw-dashboard__toolbar mndw-button"))??(h==null?void 0:h.querySelector(".mndw-grid-tile__close"));X==null||X.focus({preventScroll:!0})}await be(re)}})}function Se(){if(b!==null)return;k(m,!0);const j=ei(o.hostOverlay,aN,{title:L("dashboard.arrange-widgets"),props:{cards:d(le),onCommit:de},closeOnOutsideClick:!0});b=j,j.closed.then(()=>{b===j&&(b=null,k(m,!1))})}const Q=j=>{k(_,j.matches,!0),j.matches||(b==null||b.close(),b=null,k(m,!1))},le=V(()=>d(m)?d(S).flatMap(j=>{var Ke;const re=An(j);if(re===null)return[];const ne=l.get(re.pluginName),X=ne===void 0?re.pluginName:Nn(ne.entry,ne.catalog,Z.locale).label,Ue=((Ke=Nl(j))==null?void 0:Ke.getTileTitle())??"";return[{id:j,label:Ue||X}]}):[]);function de(j){tr()==="ok"&&(k(O,he(j),!0),te())}let Re=tr(),it=Op(),_t=!1;function bt(){var It;const j=d(U);j!==null&&((It=fn(j.pluginName))==null?void 0:It.type)!=="widget"&&(ye(),je.dismiss(j.toastId));const re=d(y).filter(F=>{var Be;const ae=An(F.id);return ae!==null&&((Be=fn(ae.pluginName))==null?void 0:Be.type)==="widget"}),ne=new Set(re.map(F=>F.id)),X=d(O).filter(F=>ne.has(F)),Ue=re.length!==d(y).length,Ke=X.length!==d(O).length;for(const F of d(y)){const ae=An(F.id);if(ae===null||!ne.has(F.id)){is(F.id,{clearStorage:!0}),ae!==null&&Go(ae.pluginName,`${ae.pluginName}:${ae.counter}`);continue}const Be=fn(ae.pluginName);(Be==null?void 0:Be.type)==="widget"&&!Be.runnable&&is(F.id,{clearStorage:!1})}return!Ue&&!Ke?!1:(k(y,re,!0),k(O,X,!0),!0)}Xn(()=>{[...Sl.entries()],Object.values(va()).map(ne=>`${ne.status}:${ne.runnable}`);const j=tr(),re=Op();if(r_(c,l),n_(c,l),j==="ok"){if(!_t||Re!=="ok"||it!==re){const ne=Re!=="ok",X=bt();_t=!0,qe(),(ne||X)&&te()}}else _t=!1;Re=j,it=re}),Xn(()=>{const j=d(U);j!==null&&!je.toasts.some(re=>re.id===j.toastId)&&ye()}),Fn(()=>(f.addEventListener("change",Q),window.addEventListener("pagehide",Nt),()=>{f.removeEventListener("change",Q),window.removeEventListener("pagehide",Nt)}));function Nt(){ye(),je.dismissKey(i)}ni(()=>{z!==void 0&&clearTimeout(z),B==null||B.classList.remove("mndw-grid-tile--newly-added"),B=void 0,G!==null&&tr()==="ok"&&te(G),ye(),je.dismissKey(i),g==null||g.close(),b==null||b.close(),i_("host-navigation")});var At=gN(),ze=v(At),st=v(ze);{var pt=j=>{var re=hN(),ne=et(re);C(ne,"variant","secondary");var X=v(ne);C(X,"name","plus"),C(X,"aria-hidden","true");var Ue=T(X),Ke=T(ne,2);{var It=F=>{var ae=fN();C(ae,"variant","secondary");var Be=v(ae);w(Je=>E(Be,Je),[()=>L("dashboard.arrange-widgets")]),fe("click",ae,Se),A(F,ae)};J(Ke,F=>{d(_)&&d(S).length>1&&F(It)})}w(F=>E(Ue,` ${F??""}`),[()=>L("dashboard.add-widget")]),fe("click",ne,Ie),A(j,re)},Ut=V(()=>l.getWidgets().length>0&&d(N).length>0);J(st,j=>{d(Ut)&&j(pt)})}var Lt=T(ze,2);{var on=j=>{{let re=V(()=>L("dashboard.empty-error-title")),ne=V(()=>L("dashboard.empty-error-text"));Gi(j,{get title(){return d(re)},get text(){return d(ne)}})}},jt=j=>{{let re=V(()=>L("dashboard.no-widgets")),ne=V(()=>L("dashboard.empty-no-plugins")),X=V(()=>({label:L("dashboard.empty-install-plugins"),href:lt.settingsTab.plugins}));Gi(j,{get title(){return d(re)},get text(){return d(ne)},get action(){return d(X)}})}},bn=V(()=>l.getWidgets().length===0&&d(N).length===0),Qt=j=>{{let re=V(()=>L("dashboard.empty-title")),ne=V(()=>L("dashboard.empty-add-widget")),X=V(()=>({label:L("dashboard.add-widget"),onActivate:Ie}));Gi(j,{get title(){return d(re)},get text(){return d(ne)},get action(){return d(X)}})}};J(Lt,j=>{Z.pluginLoadError!==null?j(on):d(bn)?j(jt,1):d(N).length===0&&j(Qt,2)})}var an=T(Lt,2);{var xn=j=>{iN(j,{get order(){return d(S)},onRemoveRequest:me})},_n=j=>{var re=pN(),ne=v(re);OM(ne,{onGridReady:Ne,onGridDestroyed:se,onWidgetRemoved:Fe,onLayoutChanged:ke,onWidgetResized:Ee}),A(j,re)};J(an,j=>{d(_)?j(xn):j(_n,-1)})}Ei(At,j=>h=j,()=>h),w(()=>Oe(At,"data-locale",Z.locale)),A(t,At),We()}dt(["click"]);const u_="mndw-sidebar",d_="mndw-sidebar-toggle";var mN=D('<span class="mndw-header__device"> </span>'),vN=D('<header class="mndw-header"><div class="mndw-header__left"><mndw-button><mndw-icon></mndw-icon></mndw-button> <span class="mndw-header__brand">mndw</span> <!></div> <div class="mndw-header__right"><mndw-select><mndw-option>EN</mndw-option> <mndw-option>RU</mndw-option></mndw-select> <mndw-button><mndw-icon></mndw-icon></mndw-button> <mndw-button><mndw-icon></mndw-icon> </mndw-button></div></header>',2);function bN(t,e){Ze(e,!0);const n=vn(),r=fa();let i=ie(at(r.matches));Fn(()=>{const P=M=>{k(i,M.matches,!0)};return r.addEventListener("change",P),()=>{r.removeEventListener("change",P)}});function s(P){Z.localeSwitchPending||n.locale.setLocale(P.detail.value).catch(()=>{})}async function o(){try{await new Promise(P=>{n.rci.logout().subscribe({next:()=>P(),error:()=>P()})})}finally{hc()}}var a=vN(),l=v(a),c=v(l);w(()=>C(c,"id",d_)),C(c,"variant","ghost"),Le(c,1,"mndw-header__menu-toggle"),w(()=>C(c,"aria-label",L("nav.toggle-menu"))),w(()=>C(c,"aria-expanded",d(i)?Z.mobileSidebarOpen:!Z.desktopSidebarCollapsed)),w(()=>C(c,"aria-controls",u_));var u=v(c);C(u,"name","menu");var f=T(c,4);{var h=P=>{var M=mN(),z=v(M);w(()=>E(z,Z.deviceInfo.deviceName)),A(P,M)};J(f,P=>{Z.deviceInfo&&P(h)})}var p=T(l,2),m=v(p);Le(m,1,"mndw-header__locale-select"),w(()=>C(m,"label",L("nav.language"))),w(()=>C(m,"value",Z.locale)),w(()=>C(m,"aria-busy",String(Z.localeSwitchPending)));var g=v(m);C(g,"value","en");var b=T(g,2);C(b,"value","ru");var _=T(m,2);C(_,"variant","ghost"),Le(_,1,"mndw-header__theme-toggle"),w(()=>C(_,"title",Z.theme==="dark"?L("nav.light-theme"):L("nav.dark-theme"))),w(()=>C(_,"aria-label",L("nav.color-theme")));var y=v(_);w(()=>C(y,"name",Z.theme==="dark"?"sun":"moon"));var O=T(_,2);C(O,"variant","ghost"),Le(O,1,"mndw-header__logout");var N=v(O);C(N,"name","log-out");var S=T(N);w(P=>{Oe(a,"data-locale",Z.locale),E(S,` ${P??""}`)},[()=>L("nav.logout")]),fe("click",c,function(...P){uu==null||uu.apply(this,P)}),yt("mndwchange",m,s),fe("click",_,function(...P){var M;(M=n.theme.toggleTheme)==null||M.apply(this,P)}),fe("click",O,o),A(t,a),We()}dt(["click"]);const mu=(t,e)=>{let n=null,r=!1,i=!1,s=e;const o=a=>{s=a,r=(a==null?void 0:a.enabled)??!0,r&&!n?t.hasAttribute("inert")?queueMicrotask(()=>{r&&!i&&!n&&!t.hasAttribute("inert")&&(n=bu(t,s))}):n=bu(t,s):!r&&n&&(n.deactivate(),n=null)};return o(e),{update:o,destroy(){i=!0,n==null||n.deactivate(),n=null}}};function If(t){const e=t.getPages().map(i=>{const s=fn(i.entry.name);return{name:i.entry.name,label:Nn(i.entry,i.catalog??(s==null?void 0:s.catalog),Z.locale).label,route:i.entry.route,status:"loaded"}}),n=new Set(e.map(({name:i})=>i)),r=Object.entries(va()).flatMap(([i,s])=>{if(!s.runnable||s.status!=="failed"&&s.status!=="loading"||s.type!=="page"||s.route===void 0||n.has(i))return[];const{label:o}=Nn(s,s.catalog,Z.locale);return[{name:i,label:o,route:s.route,status:s.status}]});return[...e,...r].sort((i,s)=>i.label.localeCompare(s.label)||i.name.localeCompare(s.name))}var _N=D('<div class="mndw-sidebar-backdrop" role="presentation"></div>'),wN=D('<mndw-icon></mndw-icon> <span class="mndw-visually-hidden svelte-mfxfye"> </span>',3),yN=D("<a> <!></a>"),kN=D('<hr class="mndw-sidebar__separator"/> <!>',1),EN=D('<!> <nav><a> </a> <a> </a> <!> <div class="mndw-sidebar__spacer"></div> <a> </a></nav>',1);function SN(t,e){Ze(e,!0);const n=vn(),r=n.registry,i=fa();let s=ie(at(i.matches)),o;const a=V(()=>d(s)?!Z.mobileSidebarOpen:Z.desktopSidebarCollapsed);let l=ti(()=>d(s)?!Z.mobileSidebarOpen:Z.desktopSidebarCollapsed);const c=te=>{k(s,te.matches,!0)},u=V(()=>(Z.locale,If(r).map(te=>({...te,failed:te.status!=="loaded"})))),f=V(()=>{var te;return((te=n.router.current)==null?void 0:te.route.pathname)??globalThis.location.pathname});function h(te){return(te.length>1&&te.endsWith("/")?te.slice(0,-1):te).toLowerCase()}function p(te){const ge=h(d(f)),ye=h(te);return ye==="/"?ge==="/":ge===ye||ge.startsWith(`${ye}/`)}function m(){d(s)&&(Z.mobileSidebarOpen=!1)}function g(te){te.key==="Escape"&&d(s)&&Z.mobileSidebarOpen&&(Z.mobileSidebarOpen=!1)}Fn(()=>(i.addEventListener("change",c),()=>{i.removeEventListener("change",c)})),Xn(()=>{var ye;const te=d(a),ge=l;l=te,!ge&&te&&(o!=null&&o.contains(document.activeElement))&&((ye=document.getElementById(d_))==null||ye.focus())});var b=EN();yt("keydown",Mo,g);var _=et(b);{var y=te=>{var ge=_N();fe("click",ge,m),A(te,ge)};J(_,te=>{d(s)&&Z.mobileSidebarOpen&&te(y)})}var O=T(_,2);let N;var S=v(O);let P;var M=v(S),z=T(S,2);let B;var U=v(z),G=T(z,2);{var Y=te=>{var ge=kN(),ye=T(et(ge),2);Ct(ye,17,()=>d(u),Me=>Me.name,(Me,Fe)=>{var me=yN();let Ne;var qe=v(me),se=T(qe);{var ke=Ee=>{var H=wN(),q=et(H);Le(q,1,"mndw-sidebar__warning svelte-mfxfye"),C(q,"name","circle-alert"),w(()=>C(q,"title",L("nav.page-load-failed"))),C(q,"aria-hidden","true");var be=T(q,2),Ie=v(be);w(Se=>E(Ie,Se),[()=>L("nav.page-load-failed")]),A(Ee,H)};J(se,Ee=>{d(Fe).failed&&Ee(ke)})}w((Ee,H)=>{Oe(me,"href",d(Fe).route),Ne=Le(me,1,"mndw-sidebar__link",null,Ne,Ee),Oe(me,"aria-current",H),E(qe,`${d(Fe).label??""} `)},[()=>({active:p(d(Fe).route)}),()=>p(d(Fe).route)?"page":void 0]),fe("click",me,m),A(Me,me)}),A(te,ge)};J(G,te=>{d(u).length>0&&te(Y)})}var oe=T(G,4);let we;var he=v(oe);Ei(O,te=>o=te,()=>o),Fs(O,(te,ge)=>mu==null?void 0:mu(te,ge),()=>({enabled:d(s)&&Z.mobileSidebarOpen})),w((te,ge,ye,Me,Fe,me,Ne,qe,se)=>{Oe(O,"id",u_),N=Le(O,1,"mndw-sidebar",null,N,{collapsed:!d(s)&&Z.desktopSidebarCollapsed,"mobile-collapsed":d(s)&&!Z.mobileSidebarOpen}),Oe(O,"data-locale",Z.locale),O.inert=d(a),Oe(S,"href",lt.dashboard),P=Le(S,1,"mndw-sidebar__link",null,P,te),Oe(S,"aria-current",ge),E(M,ye),Oe(z,"href",lt.packages),B=Le(z,1,"mndw-sidebar__link",null,B,Me),Oe(z,"aria-current",Fe),E(U,me),Oe(oe,"href",lt.settings),we=Le(oe,1,"mndw-sidebar__link",null,we,Ne),Oe(oe,"aria-current",qe),E(he,se)},[()=>({active:p(lt.dashboard)}),()=>p(lt.dashboard)?"page":void 0,()=>L("nav.dashboard"),()=>({active:p(lt.packages)}),()=>p(lt.packages)?"page":void 0,()=>L("nav.package-manager"),()=>({active:p(lt.settings)}),()=>p(lt.settings)?"page":void 0,()=>L("nav.settings")]),fe("click",S,m),fe("click",z,m),fe("click",oe,m),A(t,b),We()}dt(["click"]);var TN=D('<div class="mndw-alert mndw-alert--danger mndw-plugin-load-alert svelte-1bwqjg3" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),xN=D('<div class="mndw-app-shell"><!> <!> <div class="mndw-app-shell__body"><!> <main class="mndw-app-shell__content"><!></main></div></div>');function PN(t,e){Ze(e,!0);const n=vn();let r=ie(void 0);function i(){var _;const m=document.activeElement;if(m===null)return!1;const g=m.getRootNode(),b=g instanceof ShadowRoot?g.host:m;return((_=d(r))==null?void 0:_.contains(b))??!1}async function s(){var _,y,O;if(Z.authInitInFlight)return;const m=i();let g,b;try{const N=Ef(n,{preservePluginLoadError:!0});b=Dr(),g=await N}catch{(b===void 0||b===Dr())&&hc();return}if(!(g===void 0||g!==Dr())){if(Z.ready&&Z.pluginLoadError===null)Z.pluginLoadRevision+=1;else if(Z.pluginLoadError!==null&&(Z.pluginLoadFailureSeq+=1,m)){await To();const N=(_=d(r))==null?void 0:_.querySelector("mndw-button");(O=(y=N==null?void 0:N.shadowRoot)==null?void 0:y.querySelector("button"))==null||O.focus()}}}var o=xN(),a=v(o);bN(a,{});var l=T(a,2);{var c=m=>{var g=jn(),b=et(g);cm(b,()=>Z.pluginLoadFailureSeq,_=>{var y=TN(),O=v(y),N=v(O),S=T(O,2);C(S,"variant","secondary"),w(()=>C(S,"disabled",Z.authInitInFlight)),w(()=>C(S,"aria-busy",Z.authInitInFlight));var P=v(S);Ei(y,M=>k(r,M),()=>d(r)),w((M,z)=>{E(N,M),E(P,z)},[()=>L("app.plugin-load-error"),()=>L("common.retry")]),fe("click",S,s),A(_,y)}),A(m,g)};J(l,m=>{Z.authenticated&&Z.pluginLoadError==="list"&&m(c)})}var u=T(l,2),f=v(u);SN(f,{});var h=T(f,2),p=v(h);ky(p,()=>e.children),A(t,o),We()}dt(["click"]);function gd(t){return t==="/"?"":t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Ha(t,e){return new id("INVALID_PATH",`Invalid page child path "${t}"`,{cause:e})}function CN(t){if(t===""||t==="/")return"";if(!t.startsWith("/")||t.startsWith("//")||t.includes("?")||t.includes("#"))throw Ha(t);const e=gd(t);if(e==="")return"";const n=e.slice(1).split("/"),r=n.length-1;for(const[i,s]of n.entries()){if(s===""){if(i!==r)throw Ha(t);continue}let o;try{o=decodeURIComponent(s)}catch(a){throw Ha(t,a)}if(o==="."||o===".."||o.includes("/")||o.includes("\\"))throw Ha(t)}return e}class RN{constructor(e,n,r){K(this,"baseRoute");K(this,"deps");K(this,"childPathSubject");K(this,"currentChildPath");K(this,"completed",!1);K(this,"navigationSerial",0);K(this,"pageRoute");this.baseRoute=e,this.deps=r,this.currentChildPath=gd(n),this.childPathSubject=new $_(this.currentChildPath),this.pageRoute=Object.freeze({childPath$:this.childPathSubject.asObservable(),navigate:(i,s)=>this.navigate(i,s)})}setPath(e){if(this.completed)return;const n=gd(e);n!==this.currentChildPath&&(this.currentChildPath=n,this.childPathSubject.next(n))}complete(){this.completed||(this.completed=!0,this.childPathSubject.complete())}async navigate(e,n){if(this.completed)throw new id("COMPLETED","Page route is no longer active");const r=CN(e);if(r===this.currentChildPath)return;const i=++this.navigationSerial,s=this.deps.getLocation();try{await this.deps.navigate(`${this.baseRoute}${r}`,{replace:(n==null?void 0:n.replace)??!1,search:s.search,hash:s.hash,scrollToTop:(n==null?void 0:n.scrollToTop)===!1?!1:"auto"})}catch(o){throw new id("NAVIGATION_FAILED",`Navigation to "${r}" failed`,{cause:o})}!this.completed&&i===this.navigationSerial&&this.setPath(r)}}var AN=D('<div class="mndw-page-plugin__notice"> </div>'),ON=D('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4"><span> </span> <mndw-button> </mndw-button></div>',2),MN=D('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="status"> </div>'),NN=D('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="status"><span> </span> <mndw-button> </mndw-button></div>',2),LN=D('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),IN=D('<div class="mndw-page-plugin-wrap"><!> <div class="mndw-page-plugin"></div></div>');function Jp(t,e){Ze(e,!0);const n={clearStorage:!1,closeReason:"host-navigation"};let r,i=null,s=0,o=null,a=ie("none"),l=ie(null),c,u;const f=vn(),h=f.registry,p={locale:f.locale,palette:f.palette,telemetry:f.telemetry,telemetryGathering:f.telemetryGathering,eventStream:f.eventStream,rci:f.rci,theme:f.theme,tickerPool:f.tickerPool,overlayRuntime:f.overlayRuntime,navigation:f.router.navigation};function m(H){return r=H,{destroy(){r=void 0}}}const g=V(()=>{const H=f.router.current;return H===void 0?null:zf(H.route.pathname,f.router.pageRouteDefinitions(h))}),b=V(()=>{var H;return((H=d(g))==null?void 0:H.name)??null}),_=V(()=>d(b)===null?"ready":fc(d(b))),y=V(()=>d(b)===null?void 0:fn(d(b))),O=V(()=>{var H;return((H=d(y))==null?void 0:H.status)==="loading"}),N=V(()=>{var H;return((H=d(y))==null?void 0:H.status)==="failed"}),S=V(()=>d(_)==="ready"&&!d(O)&&!d(N)?d(b):null),P=V(()=>{var be;if(d(b)===null)return"";const H=h.get(d(b)),q=(H==null?void 0:H.entry)??d(y);return q===void 0?"":Nn(q,(H==null?void 0:H.catalog)??((be=d(y))==null?void 0:be.catalog),Z.locale).label}),M=V(()=>d(l)===null?"":Nn(d(l).entry,d(l).catalog,Z.locale).label),z=V(()=>d(O)||d(a)==="pending"||d(a)==="loading"||d(a)==="slow");async function B(){var H;d(b)!==null&&((H=d(y))==null?void 0:H.runnable)===!0&&!d(O)&&await Wi(d(b))}function U(){c!==void 0&&(clearTimeout(c),c=void 0),u!==void 0&&(clearTimeout(u),u=void 0)}function G(){U(),k(a,"none"),k(l,null)}function Y(H,q){U(),k(a,"pending"),k(l,q),c=setTimeout(()=>{H===s&&d(a)==="pending"&&k(a,"loading")},l0),u=setTimeout(()=>{H===s&&(d(a)==="pending"||d(a)==="loading")&&k(a,"slow")},c0)}function oe(){var H;s+=1,G(),o!==null&&(o.controller.complete(),(H=o.mount)==null||H.dispose(n),o.unsubscribeTheme(),o.child.remove(),o=null)}function we(H){var be;if(i=H,H===null)return;const q=h.get(H);r===void 0||q===void 0||q.entry.type!=="page"||he(q,((be=d(g))==null?void 0:be.name)===H?d(g).childPath:"")}function he(H,q,be="full"){if(r===void 0)return Promise.resolve(!1);s+=1;const Ie=s,Se=document.createElement("div");Se.className="mndw-page-plugin__mount",Se.dataset.theme=f.theme.getTheme();const Q=f.theme.subscribeTheme(At=>{Se.dataset.theme=At});r.appendChild(Se);const le=f.router.pageRouteDefinitions(f.registry).find(At=>At.name===H.entry.name);if(le===void 0)return Q(),Se.remove(),Promise.resolve(!1);Y(Ie,H);const de=f.router.current,Re=new RN(le.route,q,{navigate:(At,ze)=>de===void 0?Promise.reject(new Error("Host router is unavailable")):de.navigate(At,ze),getLocation:()=>({search:globalThis.location.search,hash:globalThis.location.hash})}),it={generation:Ie,pluginName:H.entry.name,child:Se,controller:Re,mount:null,unsubscribeTheme:Q};o=it,Z.hostInfo;const _t=Z.deviceInfo??Gd,bt=Nf({entry:H.entry,instanceId:`${H.entry.name}:1`,deviceInfo:_t,pageRoute:Re.pageRoute,catalogCell:H.catalog,services:p}),Nt=Jb(Se,H,bt,{pluginStylesheets:f.pluginStylesheets});return it.mount=Nt,Nt.whenReady().then(At=>(Ie!==s?Se.remove():(U(),At?(k(a,"none"),k(l,null)):be==="full"?(Se.replaceChildren(),k(a,"error")):(k(a,"none"),k(l,null))),At))}async function te(H,q){var be,Ie;return oe(),await he(H,((be=d(g))==null?void 0:be.childPath)??"","loading-only")?!0:(oe(),await he(q,((Ie=d(g))==null?void 0:Ie.childPath)??"","full"),!1)}function ge(){oe(),we(d(S))}function ye(H){const{detail:q}=H;o===null||q.pluginName!==i||q.register(te(q.next,q.prior))}Xn(()=>{d(S)!==i&&(oe(),we(d(S)))}),Xn(()=>{const H=d(g);H!==null&&(o==null?void 0:o.pluginName)===H.name&&o.controller.setPath(H.childPath)}),Xn(()=>(window.addEventListener(ld,ye),()=>window.removeEventListener(ld,ye))),ni(oe);var Me=IN(),Fe=v(Me);{var me=H=>{var q=AN(),be=v(q);w(Ie=>{Oe(q,"role",d(_)==="failed"?"alert":"status"),E(be,Ie)},[()=>d(_)==="installing"?L("dashboard.preparing-dependencies"):L("dashboard.dependency-install-failed")]),A(H,q)},Ne=H=>{var q=ON(),be=v(q),Ie=v(be),Se=T(be,2);C(Se,"variant","secondary"),w(()=>C(Se,"disabled",d(O))),w(()=>C(Se,"aria-busy",d(O)?"true":void 0));var Q=v(Se);w((le,de)=>{Oe(q,"role",d(O)?"status":"alert"),E(Ie,le),E(Q,de)},[()=>L("page-plugin.load-failed",{title:d(P)}),()=>L("common.retry")]),fe("click",Se,B),A(H,q)},qe=H=>{var q=MN(),be=v(q);w(Ie=>E(be,Ie),[()=>L("page-plugin.opening",{title:d(M)})]),A(H,q)},se=H=>{var q=NN(),be=v(q),Ie=v(be),Se=T(be,2);C(Se,"variant","secondary");var Q=v(Se);w((le,de)=>{E(Ie,le),E(Q,de)},[()=>L("page-plugin.slow"),()=>L("common.retry")]),fe("click",Se,ge),A(H,q)},ke=H=>{var q=LN(),be=v(q),Ie=v(be),Se=T(be,2);C(Se,"variant","secondary");var Q=v(Se);w((le,de)=>{E(Ie,le),E(Q,de)},[()=>L("page-plugin.open-error",{title:d(M)}),()=>L("common.retry")]),fe("click",Se,ge),A(H,q)};J(Fe,H=>{d(b)!==null&&d(_)!=="ready"?H(me):d(N)||d(O)?H(Ne,1):d(a)==="loading"?H(qe,2):d(a)==="slow"?H(se,3):d(a)==="error"&&H(ke,4)})}var Ee=T(Fe,2);Fs(Ee,H=>m==null?void 0:m(H)),w(()=>Oe(Ee,"aria-busy",d(z)?"true":void 0)),A(t,Me),We()}dt(["click"]);Ew();function wa(t,e){return()=>{let n,r,i;const s=o=>{if(n!==void 0){if(i===void 0){const a=at({row:o.row,value:o.value,colId:o.colId}),l=Object.assign(a,e(a));i=l,r=Wl(t,{target:n,props:l});return}i.row=o.row,i.value=o.value,i.colId=o.colId}};return{mount(o){n=o.node,s(o)},update(o){s(o)},destroy(){r!==void 0&&(Id(r),r=void 0),n=void 0,i=void 0}}}}function Oo(){return t=>wa(t,()=>({}))}var zN=D('<span class="package-name svelte-84q0nr"> </span>');function DN(t,e){var n=zN(),r=v(n);w(()=>{Oe(n,"title",e.value),E(r,e.value)}),A(t,n)}var HN=D('<span class="new-version svelte-sgt4ns"> </span>'),BN=D('<span class="ver-value svelte-sgt4ns"> </span><!>',1);function UN(t,e){Ze(e,!0);var n=BN(),r=et(n),i=v(r),s=T(r);{var o=a=>{var l=HN(),c=v(l);w(()=>E(c,`→ ${e.row.newVersion??""}`)),A(a,l)};J(s,a=>{e.row.newVersion&&a(o)})}w(()=>{Oe(r,"data-col",e.colId),Oe(r,"title",e.value),E(i,e.value)}),A(t,n),We()}var $N=D("<span> </span>");function jN(t,e){Ze(e,!0);const n=V(()=>e.value==="update_available"?L("packages.update-available"):e.value==="available"?L("packages.available"):e.value);var r=$N(),i=v(r);w(()=>{Le(r,1,`badge badge-${e.value??""}`,"svelte-tq54e2"),Oe(r,"data-col",e.colId),E(i,d(n))}),A(t,r),We()}var FN=D("<mndw-button> </mndw-button>",2);function GN(t,e){Ze(e,!0);const n=V(()=>e.row.name==="mndw"||e.row.name==="lighttpd"),r=V(()=>e.row.status==="available"?"install":e.row.status==="update_available"?"upgrade":"remove"),i=V(()=>d(r)==="install"?L("packages.install"):d(r)==="upgrade"?L("packages.update"):L("packages.remove"));var s=FN();w(()=>C(s,"variant",d(r)==="remove"?"secondary":"primary")),w(()=>C(s,"data-package",e.row.name)),C(s,"data-package-action","primary"),C(s,"data-no-expand",!0),w(()=>C(s,"disabled",d(r)==="remove"&&d(n))),w(()=>C(s,"title",d(n)?L("packages.protected"):void 0));var o=v(s);w(()=>E(o,d(i))),fe("click",s,()=>e.onAction(d(r))),A(t,s),We()}dt(["click"]);function VN(t){return wa(GN,e=>({onAction:n=>t(n,e.row.name)}))}var ZN=D("<p> </p>"),WN=D('<p role="alert"> </p> <mndw-button> </mndw-button>',3),Ba=D('<dt class="svelte-uhnzp9"> </dt><dd class="svelte-uhnzp9"> </dd>',1),qN=D('<dl class="svelte-uhnzp9"><dt class="svelte-uhnzp9"> </dt> <dd class="svelte-uhnzp9"> </dd> <!> <!> <!> <!></dl>'),KN=D("<mndw-button> </mndw-button>",2),YN=D('<div class="detail svelte-uhnzp9"><!> <!></div>');function XN(t,e){Ze(e,!0);let n=V(()=>e.value.name);const r=V(()=>e.row.name==="mndw"||e.row.name==="lighttpd");let i=V(()=>e.cache.get(d(n)));Xn(()=>{e.load(d(n))});var s=YN(),o=v(s);{var a=h=>{var p=ZN(),m=v(p);w(g=>E(m,g),[()=>L("packages.loading")]),A(h,p)},l=h=>{var p=WN(),m=et(p),g=v(m),b=T(m,2);C(b,"variant","secondary");var _=v(b);w(y=>{E(g,d(i).message),E(_,y)},[()=>L("common.retry")]),fe("click",b,()=>e.retry(d(n))),A(h,p)},c=h=>{var p=qN(),m=v(p),g=v(m),b=T(m,2),_=v(b),y=T(b,2);{var O=U=>{var G=Ba(),Y=et(G),oe=v(Y),we=T(Y),he=v(we);w(te=>{E(oe,te),E(he,d(i).info.size)},[()=>L("packages.size")]),A(U,G)};J(y,U=>{d(i).info.size&&U(O)})}var N=T(y,2);{var S=U=>{var G=Ba(),Y=et(G),oe=v(Y),we=T(Y),he=v(we);w(te=>{E(oe,te),E(he,d(i).info.installedSize)},[()=>L("packages.installed-size")]),A(U,G)};J(N,U=>{d(i).info.installedSize&&U(S)})}var P=T(N,2);{var M=U=>{var G=Ba(),Y=et(G),oe=v(Y),we=T(Y),he=v(we);w(te=>{E(oe,te),E(he,d(i).info.installedTime)},[()=>L("packages.installed-time")]),A(U,G)};J(P,U=>{d(i).info.installedTime&&U(M)})}var z=T(P,2);{var B=U=>{var G=Ba(),Y=et(G),oe=v(Y),we=T(Y),he=v(we);w((te,ge)=>{E(oe,te),E(he,ge)},[()=>L("packages.dependencies"),()=>d(i).info.dependencies.join(", ")]),A(U,G)};J(z,U=>{d(i).info.dependencies.length>0&&U(B)})}w(U=>{E(g,U),E(_,d(i).info.description)},[()=>L("packages.description")]),A(h,p)};J(o,h=>{var p;((p=d(i))==null?void 0:p.status)==="pending"||d(i)===void 0?h(a):d(i).status==="failure"?h(l,1):d(i).status==="success"&&h(c,2)})}var u=T(o,2);{var f=h=>{var p=KN();C(p,"variant","secondary"),w(()=>C(p,"data-package",d(n))),C(p,"data-package-action","detail"),C(p,"data-no-expand",!0);var m=v(p);w(g=>E(m,g),[()=>L("packages.remove")]),fe("click",p,()=>e.onRemove()),A(h,p)};J(u,h=>{e.row.status==="update_available"&&!d(r)&&h(f)})}w(()=>{Oe(s,"data-col",e.colId),Oe(s,"data-package",d(n))}),A(t,s),We()}dt(["click"]);function JN(t){return wa(XN,e=>({cache:t.cache,load:t.load,retry:t.retry,onRemove:()=>t.onRemove(e.row.name)}))}const Qp=/[.\-+]/,eg=t=>t.length>0&&/^[0-9]+$/.test(t);function QN(t,e){const n=t.split(Qp),r=e.split(Qp),i=Math.min(n.length,r.length);for(let s=0;s<i;s+=1){const o=n[s],a=r[s];if(o!==a)if(eg(o)&&eg(a)){const l=Number(o)-Number(a);if(l!==0)return l<0?-1:1}else{const l=o.localeCompare(a);if(l!==0)return l<0?-1:1}}return n.length-r.length}var eL=D('<div class="confirm-modal svelte-erapy5"><p class="svelte-erapy5"> </p> <div class="actions svelte-erapy5"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function Zo(t,e){Ze(e,!0);var n=eL(),r=v(n),i=v(r),s=T(r,2),o=v(s);C(o,"variant","secondary");var a=v(o),l=T(o,2);C(l,"variant","danger");var c=v(l);w(u=>{E(i,e.message),E(a,u),E(c,e.confirmLabel)},[()=>L("common.cancel")]),fe("click",o,()=>e.close(!1)),fe("click",l,()=>e.close(!0)),A(t,n),We()}dt(["click"]);var tL=D('<span class="selected-count svelte-m3c4ux"> </span>'),nL=D('<div class="bulk-bar mndw-table-controls svelte-m3c4ux"><span class="bulk-label svelte-m3c4ux"> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button> <mndw-button> </mndw-button> <!></div>',2),rL=D('<div class="msg-cell svelte-m3c4ux" role="status"> </div>'),iL=D('<div class="mndw-alert mndw-alert--danger package-load-error svelte-m3c4ux" role="alert"><p class="svelte-m3c4ux"> </p> <mndw-button> </mndw-button></div>',2),sL=D("<mndw-table></mndw-table>",2),oL=D('<section class="packages-panel svelte-m3c4ux"><div class="header-row mndw-table-controls svelte-m3c4ux"><div><h1 class="svelte-m3c4ux"> </h1> <span> </span></div> <div class="header-actions svelte-m3c4ux"><mndw-button> </mndw-button></div></div> <div class="filter-row mndw-table-controls svelte-m3c4ux"><mndw-field><mndw-input></mndw-input></mndw-field> <mndw-tabs><mndw-tab> </mndw-tab> <mndw-tab> </mndw-tab> <mndw-tab> </mndw-tab></mndw-tabs></div> <!> <div class="table-wrap svelte-m3c4ux"><!></div></section>',2);function aL(t,e){Ze(e,!0);const n="packages.list",r="packages.refresh";function i(R){return`packages.${R}`}let s=kn(e,"now",3,()=>new Date);const o=vn(),a=o.locale.hostT,l=o.opkgClient;let c=ie(at([])),u=ie(null),f=ie(null),h=new Cs,p=ie(""),m=ie("installed"),g=ie(!1),b=ie(!1),_=ie(""),y=ie(null),O,N=0,S=!1;ni(()=>{S=!0});const P=new Si;let M=0;const z=V(()=>d(c).filter(R=>d(m)==="installed"&&R.status==="available"||d(m)==="updates"&&R.status!=="update_available"?!1:R.name.toLowerCase().includes(d(p).toLowerCase()))),B=V(()=>h.size),U=V(()=>d(c).filter(R=>R.status==="update_available").length),G=V(()=>[...h]),Y=V(()=>d(z).some(R=>h.has(R.name)&&R.status==="available")),oe=V(()=>d(z).some(R=>h.has(R.name)&&R.status!=="available"&&!ye(R.name))),we=V(()=>d(z).some(R=>h.has(R.name)&&R.status==="update_available")),he=V(()=>{if(d(u)===null)return a("packages.never-refreshed");if(d(f)===null)return"";const R=Math.max(0,d(f).getTime()-Date.parse(d(u)));if(R<6e4)return a("packages.just-now");const I=new Intl.RelativeTimeFormat(Z.locale,{numeric:"auto"}),ee=Math.floor(R/6e4);if(ee<60)return a("packages.refreshed-ago",{age:I.format(-ee,"minute")});const _e=Math.floor(R/36e5);if(_e<24)return a("packages.refreshed-ago",{age:I.format(-_e,"hour")});const Te=Math.floor(R/864e5);return a("packages.refreshed-ago",{age:I.format(-Te,"day")})}),te=V(()=>d(u)===null||d(f)===null?!1:d(f).getTime()-Date.parse(d(u))>3600*1e3);async function ge(){k(p,""),k(m,"all"),await To(),O==null||O.focus()}function ye(R){return R==="mndw"||R==="lighttpd"}function Me(){M+=1,P.clear()}function Fe(R){if(P.has(R))return;const I=M,ee=l.info(R);P.set(R,{status:"pending",promise:ee}),ee.then(_e=>{var Te;I===M&&((Te=P.get(R))==null?void 0:Te.status)==="pending"&&P.set(R,{status:"success",info:_e})}).catch(_e=>{var Te;I===M&&((Te=P.get(R))==null?void 0:Te.status)==="pending"&&P.set(R,{status:"failure",message:_e instanceof yo?_e.message:a("packages.detail-failed")})})}function me(R){var I;((I=P.get(R))==null?void 0:I.status)==="failure"&&(P.delete(R),Fe(R))}async function Ne(R=!1){k(g,!0);try{const I=await l.list();if(S)return;k(c,I.packages,!0),k(u,I.metadataUpdatedAt,!0),k(f,s()(),!0),Me(),k(b,!1),k(_,""),h.clear(),je.dismissKey(n),R||je.info(a("packages.loaded",{count:d(c).length}),{key:n})}catch(I){if(S)return;k(c,[],!0),h.clear(),k(b,!0),k(_,I instanceof yo?I.message:a("packages.load-failed"),!0)}finally{S||k(g,!1)}}async function qe(R,I){const ee=Array.from(h).filter(_e=>{const Te=d(c).find(nt=>nt.name===_e);return Te!==void 0&&I(Te)});if(ee.length!==0){if(R==="remove"){const Te=await ei(o.hostOverlay,Zo,{title:a("packages.confirm-remove-title"),props:{message:a("packages.confirm-remove",{names:ee.join(", ")}),confirmLabel:a("packages.remove")}}).closed;if(S)return;Te.result&&await se("remove",ee);return}await se(R,ee)}}async function se(R,I,ee){k(g,!0);const _e=R==="install"?"packages.installing":R==="remove"?"packages.removing":"packages.updating",Te=i(R);try{const nt=R==="install"?await l.install(I):R==="remove"?await l.remove(I):await l.upgrade(I);if(S||(await Ne(!0),S))return;je.success(nt.message,{key:Te})}catch(nt){if(S)return;je.error(Ee(nt,_e),{key:Te})}finally{S||k(g,!1),!S&&ee!==void 0&&await ke(ee)}}async function ke(R){if(await To(),S)return;const I=d(y);I!==null&&await I.updateComplete,await To();const ee=[...document.querySelectorAll("mndw-button[data-package][data-package-action]")].filter(nt=>nt.dataset.package===R.packageName&&!nt.disabled),Te=ee.find(nt=>nt.dataset.packageAction===R.source)??ee[0]??document.querySelector(".packages-panel .header-actions mndw-button");Te==null||Te.focus()}function Ee(R,I){if(!(R instanceof yo))return a("packages.action-failed",{action:a(I)});const ee=gO(R);return ee===void 0?R.message:ee.dependents.length>0?a("packages.dependency-conflict",{package:ee.package,dependents:ee.dependents.join(", ")}):a("packages.dependency-conflict-generic",{package:ee.package})}async function H(){k(g,!0);try{const R=await l.update();if(S||(await Ne(!0),S))return;je.success(R.message,{key:r})}catch(R){if(S)return;je.error(R instanceof yo?R.message:a("app.error"),{key:r})}finally{S||k(g,!1)}}function q(R){const I=R.detail.value;(I==="all"||I==="installed"||I==="updates")&&k(m,I,!0)}function be(R){k(p,R.detail.value,!0)}async function Ie(R,I="primary"){const _e=await ei(o.hostOverlay,Zo,{title:a("packages.confirm-remove-title"),props:{message:a("packages.confirm-remove",{names:R}),confirmLabel:a("packages.remove")}}).closed;S||_e.result&&await se("remove",[R],{packageName:R,source:I})}const Se={installed:0,update_available:1,available:2},Q=Oo()(DN),le=Oo()(UN),de=Oo()(jN),Re=JN({cache:P,load:Fe,retry:me,onRemove:R=>Ie(R,"detail")}),it=VN((R,I)=>{if(R==="remove"){Ie(I);return}se(R,[I],{packageName:I,source:"primary"})}),_t=V(()=>[di()({id:"name",label:a("packages.package"),accessor:R=>R.name,sortable:!0,width:"11.25rem",renderer:Q}),di()({id:"version",label:a("packages.version"),accessor:R=>R.version,sortable:!0,comparator:QN,renderer:le}),di()({id:"status",label:a("packages.status"),accessor:R=>R.status,sortable:!0,comparator:(R,I)=>Se[R]-Se[I],renderer:de}),di()({id:"actions",label:"",renderer:it})]);let bt=new Cs,Nt=ie(null);const At=V(()=>({expandRow:R=>a("packages.expand",{name:R}),collapseRow:R=>a("packages.collapse",{name:R})}));function ze(R){h.clear();for(const I of R.detail.selected)h.add(I)}function st(R){k(Nt,R.detail.sort,!0)}function pt(R){bt.clear();for(const I of R.detail.expanded)bt.add(I)}Xn(()=>{const R=new Set(d(z).map(I=>I.name));ti(()=>{const I=[...bt].filter(ee=>!R.has(ee));for(const ee of I)bt.delete(ee)})}),Xn(()=>{var _e;const R=(_e=d(z)[0])==null?void 0:_e.name,I=d(y),ee=++N;R===void 0||I===null||(async()=>{var Te;await I.updateComplete,!(ee!==N||((Te=d(z)[0])==null?void 0:Te.name)!==R)&&I.scrollToRow(R,{align:"start"})})()}),Fn(()=>{Ne()});var Ut=oL(),Lt=v(Ut),on=v(Lt),jt=v(on),bn=v(jt),Qt=T(jt,2);let an;var xn=v(Qt),_n=T(on,2),j=v(_n);C(j,"variant","secondary"),w(()=>C(j,"disabled",d(g)));var re=v(j),ne=T(Lt,2),X=v(ne);Le(X,1,"search-field svelte-m3c4ux"),w(()=>C(X,"label",a("packages.search-label")));var Ue=v(X);C(Ue,"type","search"),w(()=>C(Ue,"value",d(p))),w(()=>C(Ue,"placeholder",a("packages.search"))),Ei(Ue,R=>O=R,()=>O);var Ke=T(X,2);w(()=>C(Ke,"value",d(m)));var It=v(Ke);C(It,"id","all");var F=v(It),ae=T(It,2);C(ae,"id","installed");var Be=v(ae),Je=T(ae,2);C(Je,"id","updates");var Vn=v(Je),Qn=T(ne,2);{var dr=R=>{var I=nL(),ee=v(I),_e=v(ee),Te=T(ee,2);C(Te,"variant","primary"),w(()=>C(Te,"disabled",d(g)||!d(Y)));var nt=v(Te),kt=T(Te,2);C(kt,"variant","secondary"),w(()=>C(kt,"disabled",d(g)||!d(oe)));var Yt=v(kt),xt=T(kt,2);C(xt,"variant","primary"),w(()=>C(xt,"disabled",d(g)||!d(we)));var Ot=v(xt),Et=T(xt,2);{var Ft=Pt=>{var Ln=tL(),en=v(Ln);w(er=>E(en,er),[()=>a("packages.selected",{count:d(B)})]),A(Pt,Ln)};J(Et,Pt=>{d(B)>0&&Pt(Ft)})}w((Pt,Ln,en,er)=>{E(_e,Pt),E(nt,Ln),E(Yt,en),E(Ot,er)},[()=>a("packages.with-selected"),()=>a("packages.install"),()=>a("packages.remove"),()=>a("packages.update")]),fe("click",Te,()=>void qe("install",Pt=>Pt.status==="available")),fe("click",kt,()=>void qe("remove",Pt=>Pt.status!=="available"&&!ye(Pt.name))),fe("click",xt,()=>void qe("upgrade",Pt=>Pt.status==="update_available")),A(R,I)};J(Qn,R=>{d(B)>0&&R(dr)})}var ue=T(Qn,2),Pe=v(ue);{var Qe=R=>{var I=rL(),ee=v(I);w(_e=>E(ee,_e),[()=>a("packages.loading")]),A(R,I)},ct=R=>{var I=iL(),ee=v(I),_e=v(ee),Te=T(ee,2);C(Te,"variant","secondary");var nt=v(Te);w(kt=>{E(_e,d(_)),E(nt,kt)},[()=>a("common.retry")]),fe("click",Te,()=>void Ne()),A(R,I)},ln=R=>{{let I=V(()=>a(d(c).length===0?"packages.empty":"packages.no-match")),ee=V(()=>a(d(c).length===0?"packages.empty-next":"packages.no-match-next")),_e=V(()=>d(c).length===0?{label:a("packages.refresh"),onActivate:()=>void Ne(),variant:"secondary"}:{label:a("packages.show-all"),onActivate:ge,variant:"secondary"});Gi(R,{mode:"compact",get title(){return d(I)},get text(){return d(ee)},get action(){return d(_e)}})}},cn=R=>{var I=sL();w(()=>C(I,"columns",d(_t))),w(()=>C(I,"rows",d(z))),C(I,"rowKey","name"),C(I,"virtual",!0),C(I,"rowLabel",ee=>ee.name),C(I,"selectable",!0),w(()=>C(I,"selected",d(G))),C(I,"expandable",!0),C(I,"toggleAfterColumn","name"),C(I,"expandOn","row"),w(()=>C(I,"expanded",[...bt])),w(()=>C(I,"expandedRenderer",Re)),C(I,"columnMenu",!1),C(I,"sortMode","client"),w(()=>C(I,"sort",d(Nt))),w(()=>C(I,"labels",d(At))),Le(I,1,"svelte-m3c4ux"),Ei(I,ee=>k(y,ee),()=>d(y)),yt("mndwselectionchange",I,ze),yt("mndwsortchange",I,st),yt("mndwrowexpand",I,pt),A(R,I)};J(Pe,R=>{d(g)?R(Qe):d(b)?R(ct,1):d(z).length===0?R(ln,2):R(cn,-1)})}w((R,I,ee,_e,Te)=>{Oe(Ut,"data-locale",Z.locale),E(bn,R),an=Le(Qt,1,"freshness svelte-m3c4ux",null,an,{stale:d(te)}),E(xn,d(he)),E(re,I),E(F,ee),E(Be,_e),E(Vn,Te)},[()=>a("packages.title"),()=>a("packages.refresh"),()=>a("packages.all"),()=>a("packages.installed"),()=>a("packages.updates",{count:d(U)})]),fe("click",j,()=>void H()),yt("mndwinput",Ue,be),yt("mndwchange",Ke,q),A(t,Ut),We()}dt(["click"]);var lL=D('<strong> </strong><small class="svelte-gqtyao"> </small>',1);function cL(t,e){Ze(e,!0);var n=lL(),r=et(n),i=v(r),s=T(r),o=v(s);w(()=>{E(i,e.row.service.label),E(o,e.row.service.name)}),A(t,n),We()}var uL=D('<small class="pid svelte-1ugk9ic"> </small>'),dL=D("<span> </span> <!>",1);function fL(t,e){Ze(e,!0);const n={running:"badge-running",stopped:"badge-stopped",unknown:"badge-unknown"},r=V(()=>n[e.row.service.state]??"badge-unknown"),i=V(()=>e.row.rowError?L("services.probe-failed"):e.row.service.state);var s=dL(),o=et(s),a=v(o),l=T(o,2);{var c=u=>{var f=uL(),h=v(f);w(p=>E(h,p),[()=>L("services.pid",{pid:e.row.service.pid})]),A(u,f)};J(l,u=>{e.row.service.pid!==void 0&&u(c)})}w(()=>{Le(o,1,`badge ${d(r)??""}`,"svelte-1ugk9ic"),E(a,d(i))}),A(t,s),We()}var hL=D("<mndw-button> </mndw-button>",2),pL=D('<div class="actions svelte-2q4dea"></div>');function gL(t,e){Ze(e,!0);const n=[{action:"start",label:"services.start",guardProtected:!1},{action:"stop",label:"services.stop",guardProtected:!0},{action:"restart",label:"services.restart",guardProtected:!0}];var r=pL();Ct(r,21,()=>n,({action:i,label:s,guardProtected:o})=>i,(i,s)=>{let o=()=>d(s).action,a=()=>d(s).label,l=()=>d(s).guardProtected;var c=hL(),u=()=>e.onRun(o());Iy(c,h=>({variant:"secondary",disabled:e.row.busy||l()&&e.row.service.protected,...h,onclick:u}),[()=>l()&&e.row.service.protected?{title:L("services.protected")}:{}],void 0,void 0,"svelte-2q4dea");var f=v(c);w(h=>E(f,h),[()=>L(a())]),A(i,c)}),A(t,r),We()}function mL(t){return wa(gL,e=>({onRun:n=>t(n,e.row.service.name)}))}var vL=D("<mndw-switch></mndw-switch>",2);function bL(t,e){Ze(e,!0);const n=V(()=>e.row.busy||e.row.service.protected||e.row.service.autostartPinned),r=V(()=>e.row.service.enabledAtBoot?L("services.disable-at-boot"):L("services.enable-at-boot")),i=V(()=>e.row.service.protected?L("services.protected"):e.row.service.autostartPinned?L("services.autostart-pinned"):d(r)),s=a=>{const l=a.currentTarget;l.checked=e.row.service.enabledAtBoot,e.onToggle(!e.row.service.enabledAtBoot)};var o=vL();w(()=>C(o,"checked",e.row.service.enabledAtBoot)),w(()=>C(o,"disabled",d(n))),w(()=>C(o,"aria-label",d(r))),w(()=>C(o,"title",d(i))),yt("mndwchange",o,s),A(t,o),We()}function _L(t){return wa(bL,e=>({onToggle:n=>t(e.row.service,n)}))}var wL=D('<div class="capability svelte-3v3gj2" role="status"><strong class="svelte-3v3gj2"> </strong><span> </span></div>'),yL=D('<div class="mndw-alert mndw-alert--danger services-load-error svelte-3v3gj2" role="alert"><p class="svelte-3v3gj2"> </p> <mndw-button> </mndw-button></div>',2),kL=D('<p role="status"> </p>'),EL=D('<div class="table-wrap svelte-3v3gj2"><mndw-table></mndw-table></div>',2),SL=D('<section class="services-panel svelte-3v3gj2"><div class="header-row mndw-table-controls svelte-3v3gj2"><div><h1 class="svelte-3v3gj2"> </h1> <p class="svelte-3v3gj2"> </p></div> <mndw-button> </mndw-button></div> <!></section>',2);function TL(t,e){Ze(e,!0);let n=ie(at([]));const r=vn(),i=r.locale.hostT,s=r.serviceClient;let o=ie(at({})),a=ie(!1),l=ie(!1),c=ie(!1),u=ie(!1),f=ie(at({})),h=0,p;const m=3,g=V(()=>d(n).map(Q=>({service:Q,busy:d(u),rowError:d(o)[Q.name]??!1}))),b=Oo()(cL),_=Oo()(fL),y=_L((Q,le)=>void te(Q,le)),O=mL((Q,le)=>void he(Q,le)),N=V(()=>[di()({id:"service",label:i("services.service"),width:"10rem",renderer:b}),di()({id:"state",label:i("services.state"),width:"7.1rem",renderer:_}),di()({id:"autostart",label:i("services.autostart"),width:"6.7rem",align:"center",renderer:y}),di()({id:"actions",label:i("services.actions"),width:"18rem",renderer:O})]);function S(Q,le){k(n,d(n).map(de=>de.name===Q?le:de),!0)}function P(Q){S(Q.name,Q)}async function M(Q,le,de){let Re=0;const it=async()=>{for(;Re<Q.length;){const _t=Q[Re++];_t!==void 0&&await de(_t)}};await Promise.all(Array.from({length:Math.min(le,Q.length)},()=>it()))}function z(Q,le,de,Re){return h===le&&(d(f)[Q]??0)===de&&!Re.aborted}async function B(Q,le,de){const Re=d(f)[Q.name]??0;try{const it=await s.status(Q.name,de);z(Q.name,le,Re,de)&&P(it)}catch{z(Q.name,le,Re,de)&&k(o,{...d(o),[Q.name]:!0},!0)}}async function U(Q,le,de){await M(Q,m,Re=>B(Re,le,de))}async function G(){p==null||p.abort(),p=new AbortController;const Q=++h;k(a,!0),k(l,!1),k(c,!1),k(o,{},!0),k(f,{},!0);try{const le=await s.list();if(h!==Q)return;k(n,le,!0),k(a,!1),await U(le,Q,p.signal)}catch(le){if(h!==Q||p.signal.aborted)return;k(n,[],!0),k(l,le instanceof dd&&le.code==="SERVICE_UNAVAILABLE",!0),k(c,!d(l)),k(a,!1)}finally{h===Q&&k(a,!1)}}async function Y(Q,le){return(await ei(r.hostOverlay,Zo,{title:i("services.confirm-title"),props:{message:Q,confirmLabel:le}}).closed).result===!0}async function oe(Q,le){return Y(i("services.confirm",{action:Q,name:le}),i(`services.${Q}`))}async function we(Q,le){return Y(i(le?"services.confirm-enable-boot":"services.confirm-disable-boot",{name:Q}),i(le?"services.enable-at-boot":"services.disable-at-boot"))}async function he(Q,le){if(!d(u)&&!((Q==="stop"||Q==="restart")&&!await oe(Q,le))){k(f,{...d(f),[le]:(d(f)[le]??0)+1},!0),k(u,!0);try{const de=await s[Q](le);P(de.service),k(o,{...d(o),[le]:!1},!0)}catch{k(o,{...d(o),[le]:!0},!0)}finally{k(u,!1)}}}async function te(Q,le){if(d(u)||Q.protected||Q.autostartPinned)return;const de=Q.name;if(await we(de,le)){k(f,{...d(f),[de]:(d(f)[de]??0)+1},!0),k(u,!0);try{const Re=await s.setEnabled(de,le);S(de,Re.service),k(o,{...d(o),[de]:!1},!0)}catch(Re){Re instanceof dd&&Re.code==="CONFLICT"?(S(de,{...Q,autostartPinned:!0}),k(o,{...d(o),[de]:!1},!0)):k(o,{...d(o),[de]:!0},!0)}finally{k(u,!1)}}}Fn(()=>(G(),()=>p==null?void 0:p.abort()));var ge=SL(),ye=v(ge),Me=v(ye),Fe=v(Me),me=v(Fe),Ne=T(Fe,2),qe=v(Ne),se=T(Me,2);C(se,"variant","secondary"),w(()=>C(se,"disabled",d(a)||d(u)));var ke=v(se),Ee=T(ye,2);{var H=Q=>{var le=wL(),de=v(le),Re=v(de),it=T(de),_t=v(it);w((bt,Nt)=>{E(Re,bt),E(_t,Nt)},[()=>i("services.unavailable"),()=>i("services.unavailable-description")]),A(Q,le)},q=Q=>{var le=yL(),de=v(le),Re=v(de),it=T(de,2);C(it,"variant","secondary");var _t=v(it);w((bt,Nt)=>{E(Re,bt),E(_t,Nt)},[()=>i("services.load-failed"),()=>i("common.retry")]),fe("click",it,()=>void G()),A(Q,le)},be=Q=>{var le=kL(),de=v(le);w(Re=>E(de,Re),[()=>i("packages.loading")]),A(Q,le)},Ie=Q=>{{let le=V(()=>i("services.empty")),de=V(()=>i("services.empty-next")),Re=V(()=>({label:i("services.refresh"),onActivate:()=>void G(),variant:"secondary"}));Gi(Q,{mode:"compact",get title(){return d(le)},get text(){return d(de)},get action(){return d(Re)}})}},Se=Q=>{var le=EL(),de=v(le);w(()=>C(de,"columns",d(N))),w(()=>C(de,"rows",d(g))),C(de,"rowKey",Re=>Re.service.name),C(de,"min-width","42rem"),C(de,"columnMenu",!1),C(de,"rowLabel",Re=>Re.service.label),w(()=>C(de,"emptyLabel",i("services.empty"))),Le(de,1,"svelte-3v3gj2"),A(Q,le)};J(Ee,Q=>{d(l)?Q(H):d(c)?Q(q,1):d(a)&&d(n).length===0?Q(be,2):!d(a)&&d(n).length===0?Q(Ie,3):Q(Se,-1)})}w((Q,le,de)=>{Oe(ge,"data-locale",Z.locale),E(me,Q),E(qe,le),E(ke,de)},[()=>i("services.title"),()=>i("services.description"),()=>i("services.refresh")]),fe("click",se,()=>void G()),A(t,ge),We()}dt(["click"]);function md(t){return t==="services"?lt.packageServices:lt.packages}function xL(t){const e=t.replace(/\/+$/,"")||"/";return e===lt.packages?"packages":e===lt.packageServices?"services":null}const tg=[{id:"packages",path:md("packages"),labelKey:"packages.tab"},{id:"services",path:md("services"),labelKey:"services.tab"}];var PL=D("<mndw-tab> </mndw-tab>",2),CL=D('<div class="package-manager svelte-1qomr7d"><mndw-tabs><!> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel></mndw-tabs></div>',2);function RL(t,e){Ze(e,!0);const n=vn(),r=n.locale.hostT,i=V(()=>{var b;const g=((b=n.router.current)==null?void 0:b.route.pathname)??globalThis.location.pathname;return xL(g)??"packages"});function s(g){const b=tg.find(y=>y.id===g.detail.value),_=n.router.current;b!==void 0&&_!==void 0&&_.navigate(md(b.id))}var o=CL(),a=v(o);Le(a,1,"mndw-table-controls"),w(()=>C(a,"value",d(i)));var l=v(a);Ct(l,17,()=>tg,g=>g.id,(g,b)=>{var _=PL();w(()=>C(_,"id",d(b).id));var y=v(_);w(O=>E(y,O),[()=>r(d(b).labelKey)]),A(g,_)});var c=T(l,2);C(c,"for","packages");var u=v(c);{var f=g=>{aL(g,{})};J(u,g=>{d(i)==="packages"&&g(f)})}var h=T(c,2);C(h,"for","services");var p=v(h);{var m=g=>{TL(g,{})};J(p,g=>{d(i)==="services"&&g(m)})}w(()=>Oe(o,"data-locale",Z.locale)),yt("mndwchange",a,s),A(t,o),We()}function ng(t){RL(t,{})}const rg=4096,ig=[{title:"mndwd diagnostics",path:"/api/mndw/diagnostics/export",method:"POST"},{title:"persistent rci-session capability",path:"/api/mndw/rci-session/capability"}],AL=[/(["']?(?:password|passwd|token|secret|authorization|cookie|x-ndma-tkn)["']?\s*:\s*)("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^,\s}\]]+)/gi,/(\b(?:password|passwd|token|secret|authorization|cookie|x-ndma-tkn)\s*[=:]\s*)("[^"\r\n]*"|'[^'\r\n]*'|[^\s,;&]+)/gi],OL={createObjectURL:t=>globalThis.URL.createObjectURL(t),revokeObjectURL:t=>{globalThis.URL.revokeObjectURL(t)},createAnchor:()=>document.createElement("a"),appendAnchor:t=>{document.body.appendChild(t)},removeAnchor:t=>{t.remove()}},ML={request:mo,now:()=>new Date,browser:OL};async function NL(t=ML){const n=(await Promise.allSettled(ig.map(async c=>{const u={};return"method"in c?u.method=c.method:u.csrf=!0,await _a(t.request,(h,p,m,g)=>new ba(h,p,m,g)).request(c.path,u)}))).map((c,u)=>{const f=ig[u];return c.status==="fulfilled"?{title:f.title,value:c.value}:{title:f.title,error:IL(c.reason)}}),r=t.now(),i=LL(n,r),s=new Blob([i],{type:"text/plain;charset=utf-8"}),o=t.browser.createObjectURL(s);let a,l=!1;try{a=t.browser.createAnchor(),a.href=o,a.download=`mndw-diagnostics-${DL(r)}.txt`,a.hidden=!0,t.browser.appendAnchor(a),l=!0,a.click()}finally{a!==void 0&&l&&t.browser.removeAnchor(a),t.browser.revokeObjectURL(o)}}function LL(t,e){const n=["MNDW diagnostics",`Generated at: ${e.toISOString()}`,""];for(const r of t){if(n.push(`## ${r.title}`),r.error!==void 0)n.push(`request failed: ${vd(r.error)}`);else{const i=JSON.stringify(r.value,null,2);n.push(i===void 0?"undefined":i)}n.push("")}return zL(n.join(`
89
+ `))}function IL(t){return t instanceof Error?vd(t.message):vd(String(t))}function vd(t){return t.length>rg?`${t.slice(0,rg)}…`:t}function zL(t){let e=t;for(const n of AL)e=e.replace(n,"$1[REDACTED]");return e}function DL(t){const e=n=>String(n).padStart(2,"0");return`${t.getUTCFullYear()}${e(t.getUTCMonth()+1)}${e(t.getUTCDate())}-${e(t.getUTCHours())}${e(t.getUTCMinutes())}${e(t.getUTCSeconds())}`}var HL=D('<section class="mndw-diagnostics-settings svelte-np0xnl"><h3 class="svelte-np0xnl"> </h3> <p class="svelte-np0xnl"> </p> <mndw-button> </mndw-button></section>',2);function BL(t,e){Ze(e,!0);const n="settings.diagnostics.download";let r=ie(!1),i=!1;ni(()=>{i=!0});async function s(){k(r,!0);try{if(await NL(),i)return;je.dismissKey(n)}catch{if(i)return;je.error(L("settings.diagnostics-failed"),{key:n})}finally{i||k(r,!1)}}var o=HL(),a=v(o),l=v(a),c=T(a,2),u=v(c),f=T(c,2);C(f,"variant","secondary"),w(()=>C(f,"disabled",d(r)));var h=v(f);w((p,m,g,b)=>{Oe(o,"data-locale",Z.locale),Oe(o,"aria-label",p),E(l,m),E(u,g),E(h,b)},[()=>L("settings.diagnostics-tab"),()=>L("settings.diagnostics-tab"),()=>L("settings.diagnostics-description"),()=>d(r)?L("settings.downloading"):L("settings.download-diagnostics")]),fe("click",f,()=>void s()),A(t,o),We()}dt(["click"]);var UL=D("<mndw-button> </mndw-button>",2);function $L(t,e){Ze(e,!0);function n(){const s=new Blob([JSON.stringify(e.read(),null,2)],{type:"application/json"}),o=URL.createObjectURL(s),a=document.createElement("a");a.href=o,a.download="mndw-palette.json",a.click(),URL.revokeObjectURL(o)}var r=UL();C(r,"variant","secondary"),w(()=>C(r,"disabled",e.disabled));var i=v(r);w(s=>E(i,s),[()=>L("settings.palette.export")]),fe("click",r,n),A(t,r),We()}dt(["click"]);var jL=D('<label class="mndw-palette-import svelte-q9ugi0"><input accept=".json,application/json" type="file" class="svelte-q9ugi0"/> <span> </span></label>');function FL(t,e){Ze(e,!0);async function n(u){let f;try{f=await u.text()}catch(m){console.error("[mndw] Could not read palette file:",m),e.onErrors([L("settings.palette.read-failed")]);return}let h;try{h=JSON.parse(f)}catch(m){console.error("[mndw] Could not parse palette JSON:",m),e.onErrors([L("settings.palette.invalid-json")]);return}const p=ib(h);if(p.palette===null){console.error("[mndw] Imported palette is invalid:",p.structuralErrors),e.onErrors([L("settings.palette.invalid-structure")]);return}e.onPreview(p.palette,p.contrastWarnings)}function r(u){e.disabled||(e.onImportStart(),n(u))}function i(u){var p;const f=u.currentTarget,h=(p=f.files)==null?void 0:p[0];h&&r(h),f.value=""}function s(u){var h;u.preventDefault();const f=(h=u.dataTransfer)==null?void 0:h.files[0];f&&r(f)}var o=jL(),a=v(o),l=T(a,2),c=v(l);w((u,f)=>{Oe(a,"aria-label",u),a.disabled=e.disabled,E(c,f)},[()=>L("settings.palette-import-aria-label"),()=>L("settings.palette.drop")]),yt("dragover",o,u=>u.preventDefault()),yt("drop",o,s),fe("change",a,i),A(t,o),We()}dt(["change"]);var GL=D('<li class="svelte-1cguif5"><span class="mndw-palette-preview__chip svelte-1cguif5"></span> </li>'),VL=D('<div><h4> </h4> <ul class="mndw-palette-preview__swatches svelte-1cguif5"></ul></div>'),ZL=D("<li> </li>"),WL=D('<div class="mndw-palette-preview__warnings svelte-1cguif5"><h4> </h4> <ul></ul></div>'),qL=D('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),KL=D('<div class="mndw-palette-preview svelte-1cguif5"><p> </p> <!> <!> <!> <div class="mndw-palette-preview__actions svelte-1cguif5"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function YL(t,e){Ze(e,!0);const n=["dark","light"];let r=V(()=>n.map(_=>({theme:_,entries:e.warnings.filter(y=>y.theme===_)})));function i(_){return L(_==="dark"?"settings.palette.theme-dark":"settings.palette.theme-light")}var s=KL(),o=v(s),a=v(o),l=T(o,2);Ct(l,16,()=>n,_=>_,(_,y)=>{var O=VL(),N=v(O),S=v(N),P=T(N,2);Ct(P,21,()=>nf,M=>M.token,(M,z)=>{var B=GL(),U=v(B),G=T(U);w(()=>{Lo(U,`background: ${e.palette[y][d(z).token]??""}`),E(G,` ${d(z).token??""}`)}),A(M,B)}),w(M=>E(S,M),[()=>i(y)]),A(_,O)});var c=T(l,2);Ct(c,17,()=>d(r),_=>_.theme,(_,y)=>{var O=jn(),N=et(O);{var S=P=>{var M=WL(),z=v(M),B=v(z),U=T(z,2);Ct(U,21,()=>d(y).entries,G=>G.pair,(G,Y)=>{var oe=ZL(),we=v(oe);w(he=>E(we,he),[()=>L("settings.palette.warning-item",{pair:d(Y).pair,ratio:d(Y).ratio,min:d(Y).min})]),A(G,oe)}),w(G=>E(B,G),[()=>L("settings.palette.contrast-warnings",{theme:i(d(y).theme)})]),A(P,M)};J(N,P=>{d(y).entries.length>0&&P(S)})}A(_,O)});var u=T(c,2);{var f=_=>{var y=qL(),O=v(y);w(()=>E(O,e.error)),A(_,y)};J(u,_=>{e.error&&_(f)})}var h=T(u,2),p=v(h);C(p,"variant","primary"),w(()=>C(p,"disabled",e.busy));var m=v(p),g=T(p,2);C(g,"variant","ghost"),w(()=>C(g,"disabled",e.busy));var b=v(g);w((_,y,O)=>{E(a,_),E(m,y),E(b,O)},[()=>L("settings.palette.preview-note"),()=>L("settings.palette.confirm"),()=>L("settings.palette.discard")]),fe("click",p,function(..._){var y;(y=e.onConfirm)==null||y.apply(this,_)}),fe("click",g,function(..._){var y;(y=e.onDiscard)==null||y.apply(this,_)}),A(t,s),We()}dt(["click"]);var XL=D("<p> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),JL=D("<mndw-button> </mndw-button>",2),QL=D('<div class="mndw-palette-reset svelte-16mndpw"><!></div>');function eI(t,e){Ze(e,!0);let n=ie(!1);function r(){e.busy||e.disabled||k(n,!0)}function i(){k(n,!1),e.onReset()}var s=QL(),o=v(s);{var a=c=>{var u=XL(),f=et(u),h=v(f),p=T(f,2);C(p,"variant","danger"),w(()=>C(p,"disabled",e.busy||e.disabled));var m=v(p),g=T(p,2);C(g,"variant","secondary"),w(()=>C(g,"disabled",e.busy||e.disabled));var b=v(g);w((_,y,O)=>{E(h,_),E(m,y),E(b,O)},[()=>L("settings.palette.reset-confirmation"),()=>L("settings.palette.reset-confirm"),()=>L("common.cancel")]),fe("click",p,i),fe("click",g,()=>k(n,!1)),A(c,u)},l=c=>{var u=JL();C(u,"variant","danger"),w(()=>C(u,"disabled",e.busy||e.disabled));var f=v(u);w(h=>E(f,`${h??""}${e.busy?"…":""}`),[()=>L("settings.palette.reset")]),fe("click",u,r),A(c,u)};J(o,c=>{d(n)?c(a):c(l,-1)})}A(t,s),We()}dt(["click"]);function Ll(t){return`${Em/1048576} ${t("settings.plugin-manager.upload-limit-unit")}`}var tI=D('<div class="mndw-alert mndw-alert--danger" role="alert"> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),sg=D('<p role="status"> </p>'),nI=D("<li> </li>"),rI=D('<div class="mndw-alert mndw-alert--danger" role="alert"><ul></ul> <mndw-button> </mndw-button></div>',2),iI=D('<!> <!> <!> <div class="mndw-palette-manager__actions svelte-1adkxr0"><!> <!></div>',1),sI=D('<section class="mndw-palette-manager svelte-1adkxr0"><h3> </h3> <!> <!> <!></section>');function oI(t,e){Ze(e,!0);const n="settings.palette.commit",r="settings.palette.reset";let i=ie("loading");const s=vn(),o=s.palette,a=s.locale.hostT;let l=ie(""),c=ie(at([])),u=ie(""),f=ie(null),h=ie(at([])),p=!1;ni(()=>{p=!0});let m=V(()=>d(i)==="loading"||d(i)==="importing"||d(i)==="previewing"||d(i)==="committing"||d(i)==="resetting"),g=V(()=>d(i)!=="idle"),b=V(()=>d(i)!=="idle");function _(me,Ne){const qe=Sf(me,a,()=>Ll(a));return me instanceof Error&&qe===me.message?(console.error("[mndw] Palette operation failed:",me),a(Ne)):qe}async function y(){if(!(d(i)!=="loading"&&d(i)!=="idle")){k(i,"loading");try{if(await o.refreshPalette(),p)return;k(l,"")}catch(me){if(p)return;k(l,_(me,"settings.palette.load-failed"),!0)}finally{p||k(i,"idle")}}}function O(){k(l,"")}Fn(()=>{y()});function N(){k(c,[],!0),k(u,""),k(i,"importing")}function S(me,Ne){k(c,[],!0),k(u,""),k(f,me,!0),k(h,Ne,!0),o.previewOverride(me),k(i,"previewing")}function P(me){k(c,me,!0),k(i,"importError")}function M(){k(c,[],!0),k(i,"idle")}async function z(){if(d(f)!==null){k(i,"committing"),k(u,"");try{if(await o.commitOverride(d(f)),p)return;k(f,null),k(h,[],!0),je.success(a("settings.palette.saved"),{key:n}),k(i,"idle")}catch(me){if(p)return;k(u,_(me,"settings.palette.operation-failed"),!0),k(i,"previewing")}}}function B(){o.discardPreview(),k(f,null),k(h,[],!0),k(u,""),k(i,"idle")}async function U(){k(i,"resetting");try{if(await o.resetToDefault(),p)return;je.dismissKey(r)}catch(me){if(p)return;je.error(_(me,"settings.palette.operation-failed"),{key:r})}finally{p||k(i,"idle")}}var G=sI(),Y=v(G),oe=v(Y),we=T(Y,2);{var he=me=>{var Ne=tI(),qe=v(Ne),se=T(qe);C(se,"variant","secondary"),w(()=>C(se,"disabled",d(i)!=="idle"));var ke=v(se),Ee=T(se,2);C(Ee,"variant","ghost");var H=v(Ee);w((q,be)=>{E(qe,`${d(l)??""} `),E(ke,q),E(H,be)},[()=>a("common.retry"),()=>a("settings.plugin-manager.dismiss")]),fe("click",se,()=>void y()),fe("click",Ee,O),A(me,Ne)};J(we,me=>{d(l)&&me(he)})}var te=T(we,2);{var ge=me=>{var Ne=sg(),qe=v(Ne);w(se=>E(qe,se),[()=>a("settings.palette.loading")]),A(me,Ne)};J(te,me=>{d(i)==="loading"&&me(ge)})}var ye=T(te,2);{var Me=me=>{var Ne=jn(),qe=et(Ne);{var se=ke=>{{let Ee=V(()=>d(i)==="committing");YL(ke,{get busy(){return d(Ee)},get error(){return d(u)},onConfirm:()=>void z(),onDiscard:B,get palette(){return d(f)},get warnings(){return d(h)}})}};J(qe,ke=>{d(f)&&ke(se)})}A(me,Ne)},Fe=me=>{var Ne=iI(),qe=et(Ne);{var se=Se=>{var Q=sg(),le=v(Q);w(de=>E(le,de),[()=>a("settings.palette.reading")]),A(Se,Q)};J(qe,Se=>{d(i)==="importing"&&Se(se)})}var ke=T(qe,2);FL(ke,{get disabled(){return d(m)},onErrors:P,onImportStart:N,onPreview:S});var Ee=T(ke,2);{var H=Se=>{var Q=rI(),le=v(Q);Ct(le,20,()=>d(c),it=>it,(it,_t)=>{var bt=nI(),Nt=v(bt);w(()=>E(Nt,_t)),A(it,bt)});var de=T(le,2);C(de,"variant","ghost");var Re=v(de);w(it=>E(Re,it),[()=>a("settings.plugin-manager.dismiss")]),fe("click",de,M),A(Se,Q)};J(Ee,Se=>{d(i)==="importError"&&Se(H)})}var q=T(Ee,2),be=v(q);$L(be,{get disabled(){return d(g)},get read(){return o.getExportable}});var Ie=T(be,2);{let Se=V(()=>d(i)==="resetting");eI(Ie,{get busy(){return d(Se)},get disabled(){return d(b)},onReset:()=>void U()})}A(me,Ne)};J(ye,me=>{d(i)==="previewing"||d(i)==="committing"?me(Me):me(Fe,-1)})}w(me=>E(oe,me),[()=>a("settings.palette.title")]),A(t,G),We()}dt(["click"]);var aI=D("<mndw-option>Pseudo (en-XA)</mndw-option>",2),lI=D('<span role="status"> </span>'),cI=D("<ul><li><strong> </strong> </li> <li><strong> </strong> </li> <li><strong> </strong> </li></ul>"),uI=D("<p> </p>"),Ua=D('<p role="status"> </p>'),og=D('<div class="mndw-alert mndw-alert--danger" role="alert"><p> </p> <mndw-button> </mndw-button></div>',2),dI=D("<mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p>",3),fI=D('<p role="alert"> </p>'),hI=D("<mndw-button> </mndw-button>",2),pI=D('<p class="unsupported-banner svelte-1vnn4f1" role="alert"> </p>'),gI=D('<mndw-field><mndw-input></mndw-input></mndw-field> <p id="mndw-controller-token-hint" class="persistent-rci-hint svelte-1vnn4f1"> </p> <div class="persistent-rci-actions svelte-1vnn4f1"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <!></div> <!>',3),mI=D("<mndw-field><mndw-switch></mndw-switch></mndw-field> <!> <!> <!>",3),vI=D("<span> </span>"),bI=D("<li> <!></li>"),_I=D("<ul></ul>"),wI=D('<details class="persistent-rci-extenders svelte-1vnn4f1"><summary class="svelte-1vnn4f1"><!> <!></summary> <!></details>'),yI=D("<!> <!>",1),kI=D('<p> <a href="#mndw-background-router-access"> </a></p>'),EI=D('<div class="mndw-general-settings svelte-1vnn4f1"><section><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field> <mndw-field><mndw-select><mndw-option> </mndw-option> <mndw-option> </mndw-option> <!></mndw-select> <!></mndw-field></section> <!> <section><h3> </h3> <!></section> <section id="mndw-background-router-access" tabindex="-1"><h3> </h3> <p> </p> <!></section> <section id="mndw-telemetry"><h3> </h3> <mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p> <!> <p> </p> <!></section></div>',2);function SI(t,e){Ze(e,!0);const n="settings.telemetry.save",r="settings.router-access.toggle",i="settings.controller.test",s="settings.controller.save",o="settings.controller.clear",a=vn(),l=a.locale,c=a.persistentRci,u=l.hostT;let f=ie(null),h=V(()=>{var R;return((R=d(f))==null?void 0:R.controller.auth)??"unknown"}),p=V(()=>{var I;const R=(I=d(f))==null?void 0:I.controller.support;return R==="supported"||R==="invalid"}),m=V(()=>d(p)?u("settings.controller-token-set-placeholder"):""),g=ie(!1),b=ie(!0),_=ie(!1),y=ie(""),O=ie(null),N=null,S=!1,P=ie(!1),M=ie(!0),z=ie(""),B=V(()=>{var I,ee;const R=(I=d(f))==null?void 0:I.controller.support;return((ee=d(f))==null?void 0:ee.controller.enabled)===!0&&(R==="supported"||R==="invalid")}),U=V(()=>{var R;return((R=d(f))==null?void 0:R.controller.support)==="supported"?d(f).extenders:[]}),G=V(()=>d(U).filter(R=>!R.eligible||R.state!=="live").length);Xn(()=>{var R;e.onCapabilityStateChange({visible:d(h)!=="unknown",available:((R=d(f))==null?void 0:R.controller.support)==="supported"})}),Fn(()=>{Y(),oe()}),ni(()=>{S=!0,k(y,""),N==null||N.abort(),N=null});async function Y(){k(b,!0);try{const R=await c.getCapability();if(S)return;k(f,R,!0),k(g,d(f).controller.enabled||d(f).controller.support==="needs-token",!0),ke()}catch{if(S)return;k(f,null),k(g,!1)}finally{S||k(b,!1)}}async function oe(){k(M,!0),k(z,"");try{const R=await a.mgmtClient.getTelemetry();if(S)return;k(P,R.enabled,!0)}catch{if(S)return;k(z,u("settings.telemetry-error"),!0)}finally{S||k(M,!1)}}function we(R){const I=R.detail.checked??R.detail.value??!1,ee=d(P);k(P,I,!0),k(z,""),k(M,!0),a.mgmtClient.setTelemetry(I).then(()=>{S||(a.telemetryGathering.report(I),je.dismissKey(n))}).catch(()=>{S||(k(P,ee,!0),je.error(u("settings.telemetry-error"),{key:n}))}).finally(()=>{S||k(M,!1)})}function he(R){k(g,R.detail.checked??R.detail.value??!1,!0),k(O,null),d(g)||(k(y,""),N==null||N.abort(),N=null)}async function te(R){var _e;const I=R.detail.checked??R.detail.value??!1,ee=((_e=d(f))==null?void 0:_e.controller.enabled)??!1;k(_,!0),d(f)&&k(f,{...d(f),controller:{...d(f).controller,enabled:I}},!0);try{if(await c.setEnabled(I),S||(await Y(),S))return;je.dismissKey(r)}catch(Te){if(S||(d(f)&&k(f,{...d(f),controller:{...d(f).controller,enabled:ee}},!0),await Y(),S))return;je.error(ye(Te),{key:r})}finally{S||k(_,!1)}}function ge(R){k(y,R.detail.value,!0)}function ye(R){if(R instanceof Pr){if(R.code==="RCI_TOKEN_INVALID")return u("settings.controller-token-rejected");if(R.code==="RCI_FIRMWARE_UNSUPPORTED")return u("settings.firmware-unsupported");if(R.code==="RCI_DEVICE_UNREACHABLE")return u("settings.device-unreachable")}return u("settings.persistent-request-failed")}async function Me(){k(_,!0),k(O,null);try{const R=await c.testController(d(y));if(S)return;Ne(R,i)}catch(R){S||je.error(ye(R),{key:i})}finally{S||k(_,!1)}}async function Fe(){k(_,!0),k(O,null);try{const R=await c.saveController(d(y));if(S)return;Ne(R,s),k(y,""),await Y()}catch(R){S||je.error(ye(R),{key:s})}finally{S||(k(y,""),k(_,!1))}}async function me(){const I=await ei(a.hostOverlay,Zo,{title:u("settings.clear-controller-session-title"),props:{message:u("settings.clear-controller-session-confirm"),confirmLabel:u("settings.clear-controller-session")}}).closed;if(!(S||I.result!==!0)){k(_,!0);try{if(await c.clearController(),S||(k(g,!1),k(y,""),k(O,null),await Y(),S))return;je.dismissKey(o)}catch(ee){S||je.error(ye(ee),{key:o})}finally{S||k(_,!1)}}}function Ne(R,I){k(O,R,!0),R.result==="valid"?je.success(u("settings.controller-token-valid"),{key:I}):R.result==="unreachable"?je.error(u("settings.device-unreachable"),{key:I}):je.dismissKey(I)}function qe(R){Z.localeSwitchPending||l.setLocale(R.detail.value).catch(()=>{})}function se(R){R.preventDefault();const I=document.getElementById("mndw-background-router-access");I&&(I.scrollIntoView({behavior:"smooth",block:"start"}),I.focus({preventScroll:!0}))}function ke(){if(N==null||N.abort(),!d(f)||!Ee(d(f))){N=null;return}const R=new AbortController;N=R,H(R.signal)}function Ee(R){return R.controller.support==="invalid"||R.extenders.some(I=>I.state==="establishing"||I.state==="dead")}async function H(R){let I=null;for(;!R.aborted&&d(f)&&Ee(d(f));){if(d(f).extenders.some(ee=>ee.state==="establishing"))I=null;else if(I===null)I=Date.now();else if(Date.now()-I>=6e4)return;if(await new Promise(ee=>{const _e=window.setTimeout(ee,2e3);R.addEventListener("abort",()=>{window.clearTimeout(_e),ee()},{once:!0})}),R.aborted)return;try{k(f,await c.getCapability(),!0)}catch{}}}var q=EI(),be=v(q),Ie=v(be),Se=v(Ie),Q=T(Ie,2);w(()=>C(Q,"label",u("settings.dark-theme"))),Le(Q,1,"svelte-1vnn4f1");var le=v(Q);C(le,"id","mndw-theme-switch"),w(()=>C(le,"checked",Z.theme==="dark"));var de=T(Q,2);w(()=>C(de,"label",u("settings.language.label"))),Le(de,1,"svelte-1vnn4f1");var Re=v(de);w(()=>C(Re,"value",Z.locale)),w(()=>C(Re,"aria-busy",String(Z.localeSwitchPending)));var it=v(Re);C(it,"value","en");var _t=v(it),bt=T(it,2);C(bt,"value","ru");var Nt=v(bt),At=T(bt,2);{var ze=R=>{var I=aI();C(I,"value","en-XA"),A(R,I)},st=V(()=>l.getAvailableLocales().includes("en-XA"));J(At,R=>{d(st)&&R(ze)})}var pt=T(Re,2);{var Ut=R=>{var I=lI(),ee=v(I);w(_e=>E(ee,_e),[()=>u("settings.language.pending")]),A(R,I)};J(pt,R=>{Z.localeSwitchPending&&R(Ut)})}var Lt=T(be,2);oI(Lt,{});var on=T(Lt,2),jt=v(on),bn=v(jt),Qt=T(jt,2);{var an=R=>{var I=cI(),ee=v(I),_e=v(ee),Te=v(_e),nt=T(_e),kt=T(ee,2),Yt=v(kt),xt=v(Yt),Ot=T(Yt),Et=T(kt,2),Ft=v(Et),Pt=v(Ft),Ln=T(Ft);w((en,er,Ks)=>{E(Te,en),E(nt,` ${Z.deviceInfo.deviceName??""}`),E(xt,er),E(Ot,` ${Z.deviceInfo.vendor??""}`),E(Pt,Ks),E(Ln,` ${Z.deviceInfo.firmwareVersion??""}`)},[()=>u("settings.name"),()=>u("settings.vendor"),()=>u("settings.firmware")]),A(R,I)},xn=R=>{var I=uI(),ee=v(I);w(_e=>E(ee,_e),[()=>u("settings.device-unavailable")]),A(R,I)};J(Qt,R=>{Z.deviceInfo?R(an):R(xn,-1)})}var _n=T(on,2),j=v(_n),re=v(j),ne=T(j,2),X=v(ne),Ue=T(ne,2);{var Ke=R=>{var I=Ua(),ee=v(I);w(_e=>E(ee,_e),[()=>u("settings.persistent-loading")]),A(R,I)},It=R=>{var I=yI(),ee=et(I);{var _e=xt=>{var Ot=og(),Et=v(Ot),Ft=v(Et),Pt=T(Et,2);C(Pt,"variant","secondary");var Ln=v(Pt);w((en,er)=>{E(Ft,en),E(Ln,er)},[()=>u("settings.persistent-state-unavailable"),()=>u("common.retry")]),fe("click",Pt,()=>void Y()),A(xt,Ot)},Te=xt=>{var Ot=dI(),Et=et(Ot);w(()=>C(Et,"label",u("settings.persistent-tokenless-toggle"))),Le(Et,1,"svelte-1vnn4f1");var Ft=v(Et);C(Ft,"id","mndw-persistent-rci-enabled"),w(()=>{var en;return C(Ft,"checked",((en=d(f))==null?void 0:en.controller.enabled)??!1)}),w(()=>C(Ft,"disabled",d(_)));var Pt=T(Et,2),Ln=v(Pt);w(en=>E(Ln,en),[()=>u("settings.persistent-tokenless-description")]),yt("mndwchange",Ft,en=>void te(en)),A(xt,Ot)},nt=xt=>{var Ot=mI(),Et=et(Ot);w(()=>C(Et,"label",u("settings.configure-persistent"))),Le(Et,1,"svelte-1vnn4f1");var Ft=v(Et);C(Ft,"id","mndw-persistent-rci-enabled"),w(()=>C(Ft,"checked",d(g))),w(()=>C(Ft,"disabled",d(b)||d(_)));var Pt=T(Et,2);{var Ln=St=>{var ft=Ua(),Gt=v(ft);w(yn=>E(Gt,yn),[()=>u("settings.persistent-storage-disabled")]),A(St,ft)},en=St=>{var ft=fI(),Gt=v(ft);w(yn=>E(Gt,yn),[()=>u("settings.persistent-storage-decrypt-failed")]),A(St,ft)};J(Pt,St=>{var ft,Gt;((ft=d(f))==null?void 0:ft.store.state)==="disabled"?St(Ln):((Gt=d(f))==null?void 0:Gt.store.state)==="decrypt-failed"&&St(en,1)})}var er=T(Pt,2);{var Ks=St=>{var ft=Ua(),Gt=v(ft);w(yn=>E(Gt,yn),[()=>u("settings.persistent-needs-token")]),A(St,ft)};J(er,St=>{var ft;((ft=d(f))==null?void 0:ft.controller.support)==="needs-token"&&St(Ks)})}var bc=T(er,2);{var wn=St=>{var ft=gI(),Gt=et(ft);w(()=>C(Gt,"label",u("settings.controller-token"))),Le(Gt,1,"svelte-1vnn4f1");var yn=v(Gt);C(yn,"type","password"),C(yn,"autocomplete","off"),C(yn,"aria-describedby","mndw-controller-token-hint"),w(()=>C(yn,"placeholder",d(m))),w(()=>C(yn,"value",d(y))),w(()=>C(yn,"disabled",d(_)));var Ys=T(Gt,2),_c=v(Ys),ya=T(Ys,2),Ai=v(ya);C(Ai,"variant","secondary"),w(()=>C(Ai,"disabled",d(_)||d(y)===""));var si=v(Ai),fr=T(Ai,2);C(fr,"variant","primary"),w(()=>C(fr,"disabled",d(_)||d(y)===""));var Xs=v(fr),g_=T(fr,2);{var m_=Br=>{var xr=hI();C(xr,"variant","danger"),w(()=>C(xr,"disabled",d(_)));var Js=v(xr);w(wc=>E(Js,wc),[()=>u("settings.clear-controller-session")]),fe("click",xr,()=>void me()),A(Br,xr)};J(g_,Br=>{d(p)&&Br(m_)})}var v_=T(ya,2);{var b_=Br=>{var xr=jn(),Js=et(xr);{var wc=Xi=>{var Qs=Ua(),yc=v(Qs);w(kc=>E(yc,kc),[()=>u("settings.update-firmware-persistent")]),A(Xi,Qs)},__=Xi=>{var Qs=pI(),yc=v(Qs);w(kc=>E(yc,kc),[()=>u("settings.controller-token-rejected")]),A(Xi,Qs)};J(Js,Xi=>{d(O).result==="unsupported-firmware"?Xi(wc):d(O).result==="invalid-token"&&Xi(__,1)})}A(Br,xr)};J(v_,Br=>{d(O)&&Br(b_)})}w((Br,xr,Js)=>{E(_c,Br),E(si,xr),E(Xs,Js)},[()=>u("settings.controller-token-hint"),()=>u("settings.test"),()=>u("settings.save")]),yt("mndwinput",yn,ge),fe("click",Ai,()=>void Me()),fe("click",fr,()=>void Fe()),A(St,ft)};J(bc,St=>{var ft;(d(g)||((ft=d(f))==null?void 0:ft.controller.support)==="needs-token")&&St(wn)})}yt("mndwchange",Ft,he),A(xt,Ot)};J(ee,xt=>{d(h)==="unknown"?xt(_e):d(h)==="none"?xt(Te,1):xt(nt,-1)})}var kt=T(ee,2);{var Yt=xt=>{var Ot=wI(),Et=v(Ot),Ft=v(Et);{var Pt=wn=>{var St=Ea();w(ft=>E(St,ft),[()=>u("settings.persistent-extenders-summary-problems",{count:d(U).length,problems:d(G)})]),A(wn,St)},Ln=wn=>{var St=Ea();w(ft=>E(St,ft),[()=>u("settings.persistent-extenders-summary",{count:d(U).length})]),A(wn,St)};J(Ft,wn=>{d(G)>0?wn(Pt):wn(Ln,-1)})}var en=T(Ft,2);{var er=wn=>{var St=vI(),ft=v(St);w(Gt=>E(ft,`— ${Gt??""}`),[()=>u("settings.persistent-enumeration-stale")]),A(wn,St)};J(en,wn=>{d(f).stale&&wn(er)})}var Ks=T(Et,2);{var bc=wn=>{var St=_I();Ct(St,21,()=>d(U),ft=>ft.identity,(ft,Gt)=>{var yn=bI(),Ys=v(yn),_c=T(Ys);{var ya=si=>{var fr=Ea();w(Xs=>E(fr,Xs),[()=>u(`settings.extender-reason-${d(Gt).reason}`)]),A(si,fr)},Ai=si=>{var fr=Ea();w(Xs=>E(fr,Xs),[()=>u(`settings.extender-state-${d(Gt).state??"establishing"}`)]),A(si,fr)};J(_c,si=>{d(Gt).eligible?si(Ai,-1):si(ya)})}w(()=>E(Ys,`${(d(Gt).name||d(Gt).identity)??""}: `)),A(ft,yn)}),A(wn,St)};J(Ks,wn=>{d(U).length>0&&wn(bc)})}A(xt,Ot)};J(kt,xt=>{var Ot;((Ot=d(f))==null?void 0:Ot.controller.support)==="supported"&&xt(Yt)})}A(R,I)};J(Ue,R=>{d(b)?R(Ke):R(It,-1)})}var F=T(_n,2),ae=v(F),Be=v(ae),Je=T(ae,2);w(()=>C(Je,"label",u("settings.telemetry-toggle"))),Le(Je,1,"svelte-1vnn4f1");var Vn=v(Je);C(Vn,"id","mndw-telemetry-enabled"),w(()=>C(Vn,"checked",d(P))),w(()=>C(Vn,"disabled",d(M)||!d(B)));var Qn=T(Je,2),dr=v(Qn),ue=T(Qn,2);{var Pe=R=>{var I=kI(),ee=v(I),_e=T(ee),Te=v(_e);w((nt,kt)=>{E(ee,`${nt??""} `),E(Te,kt)},[()=>u("settings.telemetry-session-note"),()=>u("settings.telemetry-session-link")]),fe("click",_e,se),A(R,I)};J(ue,R=>{d(B)||R(Pe)})}var Qe=T(ue,2),ct=v(Qe),ln=T(Qe,2);{var cn=R=>{var I=og(),ee=v(I),_e=v(ee),Te=T(ee,2);C(Te,"variant","secondary");var nt=v(Te);w(kt=>{E(_e,d(z)),E(nt,kt)},[()=>u("common.retry")]),fe("click",Te,()=>void oe()),A(R,I)};J(ln,R=>{d(z)&&R(cn)})}w((R,I,ee,_e,Te,nt,kt,Yt,xt,Ot,Et)=>{Oe(q,"data-locale",Z.locale),E(Se,R),E(_t,I),E(Nt,ee),E(bn,_e),Oe(_n,"aria-label",Te),E(re,nt),E(X,kt),Oe(F,"aria-label",Yt),E(Be,xt),E(dr,Ot),E(ct,Et)},[()=>u("settings.appearance"),()=>u("settings.language.english"),()=>u("settings.language.russian"),()=>u("settings.device"),()=>u("settings.persistent-rci-title"),()=>u("settings.persistent-rci-title"),()=>u("settings.persistent-rci-description"),()=>u("settings.telemetry-label"),()=>u("settings.telemetry-label"),()=>u("settings.telemetry-description"),()=>u("settings.telemetry-wear-note")]),yt("mndwchange",le,function(...R){var I;(I=a.theme.toggleTheme)==null||I.apply(this,R)}),yt("mndwchange",Re,qe),yt("mndwchange",Vn,we),A(t,q),We()}dt(["click"]);var TI=D('<span class="mndw-installed__description svelte-egoe9l"> </span>'),xI=D('<span class="mndw-installed__builtin svelte-egoe9l"> </span>'),PI=D('<span class="mndw-installed__deps-badge svelte-egoe9l"> </span>'),CI=D('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed svelte-egoe9l"> </span>'),RI=D('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed mndw-installed__load-failed-badge svelte-egoe9l"> </span>'),ag=D('<span class="mndw-installed__version-badge svelte-egoe9l"> </span>'),AI=D('<p class="mndw-installed__load-failed-reason svelte-egoe9l"> </p>'),OI=D('<!> <div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button></div>',3),lg=D('<p class="mndw-installed__version-warning svelte-egoe9l"> </p>'),MI=D('<p class="mndw-installed__backend svelte-egoe9l"> </p>'),NI=D("<mndw-field><mndw-switch></mndw-switch></mndw-field>",2),LI=D("<mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),II=D('<div><span class="svelte-egoe9l"> </span> <!></div>'),cg=D("<mndw-button> </mndw-button>",2),zI=D('<div class="mndw-installed__confirmation svelte-egoe9l"><p class="svelte-egoe9l"> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),DI=D("<!> <!>",1),HI=D('<p class="mndw-installed__runtime svelte-egoe9l"> </p>'),BI=D('<li class="mndw-installed__item svelte-egoe9l"><div class="mndw-installed__identity svelte-egoe9l"><strong class="svelte-egoe9l"> </strong> <!></div> <div class="mndw-installed__metadata svelte-egoe9l"><span> </span> <span> </span> <!> <!> <!> <!> <!></div> <!> <!> <!> <!> <!> <!> <div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button> <!></div> <!></li>',2),UI=D('<ul class="mndw-installed__list svelte-egoe9l"></ul>'),$I=D('<section class="mndw-installed svelte-egoe9l" aria-labelledby="mndw-installed-title"><h3 id="mndw-installed-title" class="svelte-egoe9l"> </h3> <!></section>');function jI(t,e){Ze(e,!0);function n(P){const M=[],z=Object.values(P.routes??{}),B=z.filter(G=>G.transport==="http").length,U=z.filter(G=>G.transport==="websocket").length;return B>0&&M.push(L("settings.plugin-manager.endpoint",{count:B})),U>0&&M.push(L("settings.plugin-manager.websocket",{count:U})),M}function r(P){switch(P){case"timeout":return L("settings.plugin-manager.plugin-load-timeout",{seconds:Ub/1e3});case"error":return L("settings.plugin-manager.plugin-load-error")}}function i(P,M){var z;return((z=P.capabilityGrants)==null?void 0:z[M])??!1}function s(P){return P.endsWith(":write")?L("settings.plugin-manager.persistent-rci-write"):L("settings.plugin-manager.persistent-rci-read")}function o(P){if(P===void 0)return;const M=Ib(P).find(z=>z.kind==="sdk-major");if(M!==void 0)return L("settings.plugin-manager.version-warning.sdk-major",{pluginVersion:M.pluginVersion,hostVersion:M.hostVersion})}function a(P){switch(P){case"stopped":return L("settings.plugin-manager.runtime-state-stopped");case"capacity_blocked":return L("settings.plugin-manager.runtime-state-capacity-blocked");case"starting":return L("settings.plugin-manager.runtime-state-starting");case"ready":return L("settings.plugin-manager.runtime-state-ready");case"backoff":return L("settings.plugin-manager.runtime-state-backoff");case"failed":return L("settings.plugin-manager.runtime-state-failed")}}let l=kn(e,"rowStateFor",3,()=>{}),c=kn(e,"capabilityVisible",3,!1),u=kn(e,"capabilityAvailable",3,!1),f=kn(e,"onRestart",3,()=>{}),h=kn(e,"onRefresh",3,()=>{}),p=kn(e,"onKeepNotice",3,()=>{}),m=at({});function g(P){var z;const M=(z=fn(P))==null?void 0:z.failureKind;M===void 0||m[P]!==void 0||(m[P]=M,Wi(P).catch(()=>!1).finally(()=>{delete m[P]}))}var b=$I(),_=v(b),y=v(_),O=T(_,2);{var N=P=>{{let M=V(()=>L("settings.plugin-manager.no-installed")),z=V(()=>L("settings.plugin-manager.no-installed-next")),B=V(()=>({label:L("settings.upload-plugin-zip"),href:"#mndw-plugin-upload"}));Gi(P,{mode:"compact",get title(){return d(M)},get text(){return d(z)},get action(){return d(B)}})}},S=P=>{var M=UI();Ct(M,21,()=>e.items,z=>z.name,(z,B)=>{const U=V(()=>n(d(B).backend)),G=V(()=>hA(d(B).name)),Y=V(()=>o(d(B).lock)),oe=V(()=>fc(d(B).name)),we=V(()=>l()(d(B).name)),he=V(()=>{var ue,Pe;return((ue=d(we))==null?void 0:ue.state)==="error"?"danger":((Pe=d(we))==null?void 0:Pe.state)==="notice-rejected"?"warning":"info"}),te=V(()=>{var ue;return((ue=d(we))==null?void 0:ue.state)==="error"?"alert":"status"}),ge=V(()=>{var ue,Pe;return((ue=d(we))==null?void 0:ue.state)==="working"||((Pe=d(we))==null?void 0:Pe.state)==="reconciling"}),ye=V(()=>fn(d(B).name)),Me=V(()=>{var ue;return Nn(d(B),(ue=d(ye))==null?void 0:ue.catalog,Z.locale)}),Fe=V(()=>{var ue;return d(B).enabled&&d(B).approval==="approved"&&((ue=d(ye))==null?void 0:ue.runnable)===!0}),me=V(()=>{var ue;return d(Fe)&&((ue=d(ye))==null?void 0:ue.status)==="failed"}),Ne=V(()=>m[d(B).name]!==void 0),qe=V(()=>d(Fe)&&(d(me)||d(Ne))),se=V(()=>{var ue;return d(me)?(ue=d(ye))==null?void 0:ue.failureKind:m[d(B).name]}),ke=V(()=>d(se)===void 0?void 0:r(d(se)));var Ee=BI(),H=v(Ee),q=v(H),be=v(q),Ie=T(q,2);{var Se=ue=>{var Pe=TI(),Qe=v(Pe);w(()=>E(Qe,d(Me).description)),A(ue,Pe)};J(Ie,ue=>{d(Me).description!==void 0&&ue(Se)})}var Q=T(H,2),le=v(Q),de=v(le),Re=T(le,2),it=v(Re),_t=T(Re,2);{var bt=ue=>{var Pe=xI(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L(d(B).source==="builtin"?"settings.plugin-manager.builtin":"settings.plugin-manager.uploaded")]),A(ue,Pe)};J(_t,ue=>{(d(B).source==="builtin"||d(B).source==="upload")&&ue(bt)})}var Nt=T(_t,2);{var At=ue=>{var Pe=PI(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L("settings.plugin-manager.installing-dependencies")]),A(ue,Pe)},ze=ue=>{var Pe=CI(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L("settings.plugin-manager.dependency-install-failed")]),A(ue,Pe)};J(Nt,ue=>{d(oe)==="installing"?ue(At):d(oe)==="failed"&&ue(ze,1)})}var st=T(Nt,2);{var pt=ue=>{var Pe=RI(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L("settings.plugin-manager.plugin-load-failed")]),A(ue,Pe)};J(st,ue=>{d(qe)&&ue(pt)})}var Ut=T(st,2);{var Lt=ue=>{var Pe=ag(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L("settings.plugin-manager.version-mismatch")]),A(ue,Pe)};J(Ut,ue=>{d(G).length>0&&ue(Lt)})}var on=T(Ut,2);{var jt=ue=>{var Pe=ag(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L("settings.plugin-manager.sdk-major-badge")]),A(ue,Pe)};J(on,ue=>{d(Y)!==void 0&&ue(jt)})}var bn=T(Q,2);{var Qt=ue=>{var Pe=OI(),Qe=et(Pe);{var ct=I=>{var ee=AI(),_e=v(ee);w(()=>E(_e,d(ke))),A(I,ee)};J(Qe,I=>{d(ke)!==void 0&&I(ct)})}var ln=T(Qe,2),cn=v(ln);Le(cn,1,"mndw-installed__load-retry"),C(cn,"variant","secondary"),w(()=>C(cn,"disabled",d(Ne))),w(()=>C(cn,"aria-busy",d(Ne)));var R=v(cn);w(I=>E(R,I),[()=>L("settings.plugin-manager.retry")]),fe("click",cn,()=>g(d(B).name)),A(ue,Pe)};J(bn,ue=>{d(qe)&&ue(Qt)})}var an=T(bn,2);{var xn=ue=>{var Pe=lg(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>L("settings.plugin-manager.load-version-warning",{versions:d(G).join(", ")})]),A(ue,Pe)};J(an,ue=>{d(G).length>0&&ue(xn)})}var _n=T(an,2);{var j=ue=>{var Pe=lg(),Qe=v(Pe);w(()=>E(Qe,d(Y))),A(ue,Pe)};J(_n,ue=>{d(Y)!==void 0&&ue(j)})}var re=T(_n,2);{var ne=ue=>{var Pe=MI(),Qe=v(Pe);w(ct=>E(Qe,ct),[()=>d(U).join(", ")]),A(ue,Pe)};J(re,ue=>{d(U).length>0&&ue(ne)})}var X=T(re,2);{var Ue=ue=>{var Pe=jn(),Qe=et(Pe);Ct(Qe,16,()=>tf,ct=>ct,(ct,ln)=>{var cn=jn(),R=et(cn);{var I=_e=>{var Te=NI();Le(Te,1,"mndw-installed__capability-switch"),w(()=>C(Te,"label",s(ln)));var nt=v(Te);w(()=>C(nt,"checked",i(d(B),ln))),w(()=>C(nt,"disabled",d(ge)||!i(d(B),ln)&&!u())),yt("mndwchange",nt,kt=>e.onCapabilityChange(d(B).name,ln,kt.detail.checked)),A(_e,Te)},ee=V(()=>{var _e;return(_e=d(B).capabilities)==null?void 0:_e.includes(ln)});J(R,_e=>{d(ee)&&_e(I)})}A(ct,cn)}),A(ue,Pe)};J(X,ue=>{c()&&ue(Ue)})}var Ke=T(X,2);{var It=ue=>{var Pe=II(),Qe=v(Pe),ct=v(Qe),ln=T(Qe,2);{var cn=R=>{var I=LI(),ee=et(I);Le(ee,1,"mndw-installed__refresh"),C(ee,"variant","ghost");var _e=v(ee),Te=T(ee,2);Le(Te,1,"mndw-installed__keep"),C(Te,"variant","ghost");var nt=v(Te);w((kt,Yt)=>{E(_e,kt),E(nt,Yt)},[()=>L("settings.plugin-manager.refresh"),()=>L("settings.plugin-manager.keep-notice")]),fe("click",ee,function(...kt){var Yt;(Yt=h())==null||Yt.apply(this,kt)}),fe("click",Te,()=>p()(d(B).name)),A(R,I)};J(ln,R=>{(d(we).state==="notice-finishing"||d(we).state==="outcome-unknown")&&R(cn)})}w(()=>{Le(Pe,1,`mndw-alert mndw-alert--${d(he)??""}`,"svelte-egoe9l"),Oe(Pe,"role",d(te)),E(ct,d(we).message)}),A(ue,Pe)};J(Ke,ue=>{var Pe;d(we)!==void 0&&((Pe=d(we))==null?void 0:Pe.message)!==""&&ue(It)})}var F=T(Ke,2),ae=v(F);Le(ae,1,"mndw-installed__toggle"),w(()=>C(ae,"variant",d(B).enabled?"secondary":"primary")),w(()=>C(ae,"disabled",d(ge)));var Be=v(ae),Je=T(ae,2);{var Vn=ue=>{var Pe=DI(),Qe=et(Pe);{var ct=I=>{var ee=cg();Le(ee,1,"mndw-installed__restart"),C(ee,"variant","secondary"),w(()=>C(ee,"disabled",d(ge)));var _e=v(ee);w(Te=>E(_e,Te),[()=>L("settings.plugin-manager.restart-backend")]),fe("click",ee,()=>f()(d(B).name)),A(I,ee)};J(Qe,I=>{d(B).runtime&&d(B).runtime.state!=="stopped"&&I(ct)})}var ln=T(Qe,2);{var cn=I=>{var ee=zI(),_e=v(ee),Te=v(_e),nt=T(_e,2);Le(nt,1,"mndw-installed__cancel"),C(nt,"variant","ghost"),w(()=>C(nt,"disabled",d(ge)));var kt=v(nt),Yt=T(nt,2);Le(Yt,1,"mndw-installed__confirm"),C(Yt,"variant","danger"),w(()=>C(Yt,"disabled",d(ge)));var xt=v(Yt);w((Ot,Et,Ft)=>{E(Te,Ot),E(kt,Et),E(xt,Ft)},[()=>L("settings.plugin-manager.delete-confirmation",{label:d(Me).label}),()=>L("settings.plugin-manager.cancel"),()=>L("settings.plugin-manager.delete-plugin")]),fe("click",nt,function(...Ot){var Et;(Et=e.onCancelConfirm)==null||Et.apply(this,Ot)}),fe("click",Yt,()=>e.onDelete(d(B).name)),A(I,ee)},R=I=>{var ee=cg();Le(ee,1,"mndw-installed__delete"),C(ee,"variant","danger"),w(()=>C(ee,"disabled",d(ge)));var _e=v(ee);w(Te=>E(_e,Te),[()=>L("settings.plugin-manager.delete")]),fe("click",ee,()=>e.onRequestConfirm(d(B).name)),A(I,ee)};J(ln,I=>{e.confirmingName===d(B).name?I(cn):I(R,-1)})}A(ue,Pe)};J(Je,ue=>{d(B).source!=="builtin"&&ue(Vn)})}var Qn=T(F,2);{var dr=ue=>{var Pe=HI(),Qe=v(Pe);w((ct,ln)=>E(Qe,`${ct??""}: ${ln??""}`),[()=>L("settings.plugin-manager.backend"),()=>a(d(B).runtime.state)]),A(ue,Pe)};J(Qn,ue=>{d(B).runtime&&ue(dr)})}w((ue,Pe,Qe)=>{E(be,d(Me).label),E(de,`${ue??""}: ${d(B).version??""}`),E(it,Pe),E(Be,Qe)},[()=>L("settings.plugin-manager.version"),()=>L(d(B).type==="widget"?"settings.plugin-manager.type-widget":"settings.plugin-manager.type-page"),()=>d(B).enabled?L("settings.plugin-manager.disable"):L("settings.plugin-manager.enable")]),fe("click",ae,()=>d(B).enabled?e.onDisable(d(B).name):e.onEnable(d(B).name)),A(z,Ee)}),A(P,M)};J(O,P=>{e.items.length===0?P(N):P(S,-1)})}w(P=>E(y,P),[()=>L("settings.plugin-manager.installed-title")]),A(t,b),We()}dt(["click"]);var FI=D("<li> </li>"),GI=D('<section class="mndw-version-warning svelte-fld8qa" role="note"><h4 class="svelte-fld8qa"> </h4> <ul class="svelte-fld8qa"></ul> <p class="svelte-fld8qa"> </p></section>');function f_(t,e){Ze(e,!0);let n=V(()=>e.lock===void 0?[]:Ib(e.lock));function r(a){return a.kind==="sdk-major"?L("settings.plugin-manager.version-warning.sdk-major",{pluginVersion:a.pluginVersion,hostVersion:a.hostVersion}):a.kind==="sdk-newer-minor"?L("settings.plugin-manager.version-warning.sdk-newer-minor",{pluginVersion:a.pluginVersion,hostVersion:a.hostVersion}):L("settings.plugin-manager.version-warning.shared-major",{name:a.name,pluginVersion:a.pluginVersion,hostVersion:a.hostVersion})}var i=jn(),s=et(i);{var o=a=>{var l=GI(),c=v(l),u=v(c),f=T(c,2);Ct(f,21,()=>d(n),m=>`${m.kind}:${m.name}`,(m,g)=>{var b=FI(),_=v(b);w(y=>E(_,y),[()=>r(d(g))]),A(m,b)});var h=T(f,2),p=v(h);w((m,g)=>{E(u,m),E(p,g)},[()=>L("settings.plugin-manager.version-warning.title"),()=>L("settings.plugin-manager.version-warning.install-anyway")]),A(a,l)};J(s,a=>{d(n).length>0&&a(o)})}A(t,i),We()}var VI=D('<p class="mndw-cap__kind svelte-14iyjl4"> </p>'),io=D("<li> </li>"),so=D('<section class="mndw-cap__section svelte-14iyjl4"><h4 class="svelte-14iyjl4"> </h4> <ul class="svelte-14iyjl4"></ul></section>'),ZI=D('<div class="mndw-cap svelte-14iyjl4"><!> <!> <!> <!> <!> <!> <!></div>');function h_(t,e){Ze(e,!0);let n=V(()=>Object.entries(e.entry.backend.routes??{})),r=V(()=>{var S;return((S=e.entry.review)==null?void 0:S.packages)??[]}),i=V(()=>{var S;return((S=e.entry.review)==null?void 0:S.args)??[]}),s=V(()=>{var S;return((S=e.entry.review)==null?void 0:S.publicRoutes)??[]}),o=V(()=>e.entry.capabilities??[]);var a=ZI(),l=v(a);f_(l,{get lock(){return e.entry.lock}});var c=T(l,2);{var u=S=>{var P=VI(),M=v(P);w(z=>E(M,z),[()=>L(e.entry.review.kind==="service"?"settings.plugin-manager.backend-kind-service":"settings.plugin-manager.backend-kind-exec")]),A(S,P)};J(c,S=>{e.entry.review!==void 0&&S(u)})}var f=T(c,2);{var h=S=>{var P=so(),M=v(P),z=v(M),B=T(M,2);Ct(B,20,()=>d(r),U=>U,(U,G)=>{var Y=io(),oe=v(Y);w(()=>E(oe,G)),A(U,Y)}),w(U=>E(z,U),[()=>L("settings.plugin-manager.packages")]),A(S,P)};J(f,S=>{d(r).length>0&&S(h)})}var p=T(f,2);{var m=S=>{var P=so(),M=v(P),z=v(M),B=T(M,2);Ct(B,23,()=>d(i),(U,G)=>`${G}:${U}`,(U,G)=>{var Y=io(),oe=v(Y);w(()=>E(oe,d(G))),A(U,Y)}),w(U=>E(z,U),[()=>L("settings.plugin-manager.service-args")]),A(S,P)};J(p,S=>{d(i).length>0&&S(m)})}var g=T(p,2);{var b=S=>{var P=so(),M=v(P),z=v(M),B=T(M,2);Ct(B,21,()=>d(n),([U,G])=>U,(U,G)=>{var Y=V(()=>X_(d(G),2));let oe=()=>d(Y)[0],we=()=>d(Y)[1];var he=io(),te=v(he);w(ge=>E(te,`${oe()??""}: ${we().transport==="http"?`${we().method??"GET"} `:""}${we().path??""}${ge??""}`),[()=>{var ge;return(ge=we().protocols)!=null&&ge.length?` (${we().protocols.join(", ")})`:""}]),A(U,he)}),w(U=>E(z,U),[()=>L("settings.plugin-manager.routes")]),A(S,P)};J(g,S=>{d(n).length>0&&S(b)})}var _=T(g,2);{var y=S=>{var P=so(),M=v(P),z=v(M),B=T(M,2);Ct(B,20,()=>d(s),U=>U,(U,G)=>{var Y=io(),oe=v(Y);w(()=>E(oe,G)),A(U,Y)}),w(U=>E(z,U),[()=>L("settings.plugin-manager.public-routes")]),A(S,P)};J(_,S=>{d(s).length>0&&S(y)})}var O=T(_,2);{var N=S=>{var P=so(),M=v(P),z=v(M),B=T(M,2);Ct(B,20,()=>d(o),U=>U,(U,G)=>{var Y=io(),oe=v(Y);w(()=>E(oe,G)),A(U,Y)}),w(U=>E(z,U),[()=>L("settings.plugin-manager.capabilities")]),A(S,P)};J(O,S=>{d(o).length>0&&S(N)})}A(t,a),We()}var WI=D("<mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),qI=D('<div><span class="svelte-1mbpuk3"> </span> <!></div>'),KI=D('<div class="mndw-pending__confirmation svelte-1mbpuk3"><p class="svelte-1mbpuk3"> </p> <div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2),YI=D('<div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),XI=D('<li class="mndw-pending__item svelte-1mbpuk3"><div class="mndw-pending__identity svelte-1mbpuk3"><strong class="svelte-1mbpuk3"> </strong> <span class="svelte-1mbpuk3"> </span></div> <!> <!> <!></li>'),JI=D('<section class="mndw-pending svelte-1mbpuk3" aria-labelledby="mndw-pending-title"><h3 id="mndw-pending-title" class="svelte-1mbpuk3"> </h3> <ul class="mndw-pending__list svelte-1mbpuk3"></ul></section>');function QI(t,e){Ze(e,!0);let n=kn(e,"rowStateFor",3,()=>{}),r=kn(e,"onRefresh",3,()=>{}),i=kn(e,"onKeepNotice",3,()=>{});var s=JI(),o=v(s),a=v(o),l=T(o,2);Ct(l,21,()=>e.items,c=>c.name,(c,u)=>{const f=V(()=>n()(d(u).name)),h=V(()=>{var G,Y;return((G=d(f))==null?void 0:G.state)==="error"?"danger":((Y=d(f))==null?void 0:Y.state)==="notice-rejected"?"warning":"info"}),p=V(()=>{var G;return((G=d(f))==null?void 0:G.state)==="error"?"alert":"status"}),m=V(()=>{var G,Y;return((G=d(f))==null?void 0:G.state)==="working"||((Y=d(f))==null?void 0:Y.state)==="reconciling"});var g=XI(),b=v(g),_=v(b),y=v(_),O=T(_,2),N=v(O),S=T(b,2);h_(S,{get entry(){return d(u)}});var P=T(S,2);{var M=G=>{var Y=qI(),oe=v(Y),we=v(oe),he=T(oe,2);{var te=ge=>{var ye=WI(),Me=et(ye);Le(Me,1,"mndw-pending__refresh"),C(Me,"variant","ghost");var Fe=v(Me),me=T(Me,2);Le(me,1,"mndw-pending__keep"),C(me,"variant","ghost");var Ne=v(me);w((qe,se)=>{E(Fe,qe),E(Ne,se)},[()=>L("settings.plugin-manager.refresh"),()=>L("settings.plugin-manager.keep-notice")]),fe("click",Me,function(...qe){var se;(se=r())==null||se.apply(this,qe)}),fe("click",me,()=>i()(d(u).name)),A(ge,ye)};J(he,ge=>{(d(f).state==="notice-finishing"||d(f).state==="outcome-unknown")&&ge(te)})}w(()=>{Le(Y,1,`mndw-alert mndw-alert--${d(h)??""}`,"svelte-1mbpuk3"),Oe(Y,"role",d(p)),E(we,d(f).message)}),A(G,Y)};J(P,G=>{d(f)!==void 0&&d(f).message!==""&&G(M)})}var z=T(P,2);{var B=G=>{var Y=KI(),oe=v(Y),we=v(oe),he=T(oe,2),te=v(he);Le(te,1,"mndw-pending__cancel"),C(te,"variant","ghost");var ge=v(te),ye=T(te,2);Le(ye,1,"mndw-pending__confirm"),C(ye,"variant","danger"),w(()=>C(ye,"disabled",d(m)));var Me=v(ye);w((Fe,me,Ne)=>{E(we,Fe),E(ge,me),E(Me,Ne)},[()=>L("settings.plugin-manager.deny-confirmation",{label:d(u).label}),()=>L("settings.plugin-manager.cancel"),()=>L("settings.plugin-manager.deny-plugin")]),fe("click",te,function(...Fe){var me;(me=e.onCancelConfirm)==null||me.apply(this,Fe)}),fe("click",ye,()=>e.onDeny(d(u).name)),A(G,Y)},U=G=>{var Y=YI(),oe=v(Y);Le(oe,1,"mndw-pending__deny"),C(oe,"variant","danger"),w(()=>C(oe,"disabled",d(m)));var we=v(oe),he=T(oe,2);Le(he,1,"mndw-pending__approve"),C(he,"variant","primary"),w(()=>C(he,"disabled",d(m)));var te=v(he);w((ge,ye)=>{E(we,ge),E(te,ye)},[()=>L("settings.plugin-manager.deny"),()=>L("settings.plugin-manager.approve")]),fe("click",oe,()=>e.onRequestConfirm(d(u).name)),fe("click",he,()=>e.onApprove(d(u).name)),A(G,Y)};J(z,G=>{e.confirmingName===d(u).name?G(B):G(U,-1)})}w(()=>{E(y,d(u).label),E(N,d(u).name)}),A(c,g)}),w(c=>E(a,c),[()=>L("settings.plugin-manager.pending-title")]),A(t,s),We()}dt(["click"]);var e3=D('<div class="mndw-approval svelte-s4a91i"><p class="mndw-approval__declaration svelte-s4a91i"><strong> </strong> </p> <div class="mndw-alert mndw-alert--warning mndw-plugin-risk-warning svelte-s4a91i" role="note"><p class="svelte-s4a91i"> </p> <p class="svelte-s4a91i"> </p> <p class="svelte-s4a91i"> </p></div> <!> <div class="mndw-approval__actions svelte-s4a91i"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function t3(t,e){Ze(e,!0);var n=e3(),r=v(n),i=v(r),s=v(i),o=T(i),a=T(r,2),l=v(a),c=v(l),u=T(l,2),f=v(u),h=T(u,2),p=v(h),m=T(a,2);h_(m,{get entry(){return e.entry}});var g=T(m,2),b=v(g);Le(b,1,"mndw-approval__deny"),C(b,"variant","danger");var _=v(b),y=T(b,2);Le(y,1,"mndw-approval__approve"),C(y,"variant","primary");var O=v(y);w((N,S,P,M,z,B)=>{E(s,e.entry.label),E(o,` (${e.entry.name??""}) ${N??""}`),E(c,S),E(f,P),E(p,M),E(_,z),E(O,B)},[()=>L("settings.backend-approval-declaration"),()=>L("settings.plugin-risk-warning-intro"),()=>L("settings.plugin-risk-warning-page"),()=>L("settings.plugin-risk-warning-trust"),()=>L("settings.backend-approval-deny"),()=>L("settings.backend-approval-approve")]),fe("click",b,()=>e.close("deny")),fe("click",y,()=>e.close("approve")),A(t,n),We()}dt(["click"]);async function n3(t,e,n){if(n!=null&&n.aborted)return;const r=ei(t.hostOverlay,t3,{title:t.locale.hostT("settings.backend-approval-title",{label:e.label}),props:{entry:e}}),i=()=>r.close(void 0);n==null||n.addEventListener("abort",i,{once:!0});try{return(await r.closed).result}finally{n==null||n.removeEventListener("abort",i)}}const r3={"ping-widget-aarch64.zip":"aarch64","ping-widget-mips.zip":"mips","ping-widget-mipsel.zip":"mipsel"};function i3(t){switch(t){case"aarch64":return"aarch64";case"mips":return"mips";case"mipsel":return"mipsel";default:return}}function s3(t,e){const n=i3(e),r=r3[t];if(!(n===void 0||r===void 0||n===r))return{filename:t,archiveTarget:r,deviceTarget:n}}var ug=D('<p class="mndw-upload__status svelte-1mqre4o" role="status"> </p>'),o3=D('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),a3=D('<div class="mndw-upload svelte-1mqre4o"><div class="mndw-alert mndw-alert--warning mndw-plugin-risk-warning svelte-1mqre4o" role="note"><p class="svelte-1mqre4o"> </p> <p class="svelte-1mqre4o"> </p> <p class="svelte-1mqre4o"> </p></div> <label id="mndw-plugin-upload" class="mndw-upload__zone svelte-1mqre4o"><input accept=".zip" type="file" class="svelte-1mqre4o"/> <span> </span></label> <!></div>');function l3(t,e){Ze(e,!0);const n="settings.plugin-manager.install",r="settings.plugin-manager.approval",i=vn(),s=i.locale.hostT;function o(se,ke){return e.openApproval?e.openApproval(se,ke):n3(i,se,ke)}function a(se){return Sf(se,s,()=>Ll(s))}let l=ie("idle"),c=ie(""),u=ie(null),f,h=!1;ni(()=>{h=!0,f==null||f.abort()});function p(se){if(!se.name.toLowerCase().endsWith(".zip"))return s("settings.plugin-manager.choose-zip");if(se.size===0)return s("settings.plugin-manager.empty-zip");if(se.size>Em)return s("settings.plugin-manager.zip-too-large",{limit:Ll(s)})}function m(se){return s("settings.plugin-manager.upload-target-mismatch",{filename:se.filename,archiveTarget:se.archiveTarget,deviceTarget:se.deviceTarget})}function g(se){const ke=p(se);if(ke)return ke;const Ee=s3(se.name,e.architecture);if(Ee!==void 0)return m(Ee)}function b(se){k(c,se,!0),k(l,"error")}function _(se){k(u,se,!0),je.success(s("settings.plugin-manager.installed-success",{label:se.label}),{key:n}),k(l,"success"),e.onInstalled()}async function y(se){const ke=new AbortController;f=ke;try{return{decision:await o(se,ke.signal),aborted:ke.signal.aborted}}finally{f===ke&&(f=void 0)}}async function O(se,ke){if(!h)if(ke==="approve"){const Ee=await e.onApprove(se.name);if(h)return;if(!Ee){k(l,"idle");return}je.success(s("settings.plugin-manager.approved-success",{label:se.label}),{key:r}),k(l,"success")}else if(ke==="deny"){if(await e.onDeny(se.name),h)return;k(l,"idle")}else{if(h)return;e.onDismiss(),k(l,"idle")}}async function N(se){if(d(l)==="uploading"||d(l)==="busy")return;const ke=g(se);if(ke){b(ke);return}k(c,""),k(l,"uploading");let Ee;try{Ee=await e.uploadFile(se)}catch(q){if(h)return;b(a(q));return}if(h)return;if(Ee.status==="installed"){_(Ee.entry);return}k(l,"busy");let H;try{H=await y(Ee.entry)}catch(q){if(h)return;b(a(q));return}h||H.aborted||await O(Ee.entry,H.decision)}function S(se){var H;const ke=se.currentTarget,Ee=(H=ke.files)==null?void 0:H[0];ke.value="",Ee&&N(Ee)}function P(se){var Ee;se.preventDefault();const ke=(Ee=se.dataTransfer)==null?void 0:Ee.files[0];ke&&N(ke)}var M=a3(),z=v(M),B=v(z),U=v(B),G=T(B,2),Y=v(G),oe=T(G,2),we=v(oe),he=T(z,2),te=v(he),ge=T(te,2),ye=v(ge),Me=T(he,2);{var Fe=se=>{var ke=ug(),Ee=v(ke);w(H=>E(Ee,H),[()=>s("settings.plugin-manager.uploading")]),A(se,ke)},me=se=>{var ke=ug(),Ee=v(ke);w(H=>E(Ee,H),[()=>s("settings.plugin-manager.waiting-approval")]),A(se,ke)},Ne=se=>{var ke=jn(),Ee=et(ke);{var H=q=>{f_(q,{get lock(){return d(u).lock}})};J(Ee,q=>{d(u)&&q(H)})}A(se,ke)},qe=se=>{var ke=o3(),Ee=v(ke);w(()=>E(Ee,d(c))),A(se,ke)};J(Me,se=>{d(l)==="uploading"?se(Fe):d(l)==="busy"?se(me,1):d(l)==="success"?se(Ne,2):d(l)==="error"&&se(qe,3)})}w((se,ke,Ee,H,q)=>{E(U,se),E(Y,ke),E(we,Ee),Oe(te,"aria-label",H),te.disabled=d(l)==="uploading"||d(l)==="busy",E(ye,q)},[()=>s("settings.plugin-risk-warning-intro"),()=>s("settings.plugin-risk-warning-page"),()=>s("settings.plugin-risk-warning-trust"),()=>s("settings.upload-plugin-zip"),()=>s("settings.plugin-manager.upload-drop")]),yt("dragover",he,se=>se.preventDefault()),yt("drop",he,P),fe("change",te,S),A(t,M),We()}dt(["change"]);function p_(t,e,n){var i;const r=n.find(s=>s.name===e);switch(t.kind){case"delete":case"deny":return r===void 0;case"enable":return(r==null?void 0:r.enabled)===!0;case"disable":return(r==null?void 0:r.enabled)===!1;case"approve":return(r==null?void 0:r.approval)==="approved";case"restart":return!1;case"capability":return((i=r==null?void 0:r.capabilityGrants)==null?void 0:i[t.capability])===t.enabled}}async function c3(t,e,n,r){if(t.kind==="restart")return"outcome-unknown";for(let i=0;i<r.polls;i+=1){const s=await n();if(p_(t,e,s))return"ok";i+1<r.polls&&r.intervalMs>0&&await new Promise(o=>window.setTimeout(o,r.intervalMs))}return"notice-finishing"}var u3=D('<div class="mndw-reload svelte-1hlmyjs" role="status"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),d3=D('<p class="mndw-plugin-manager__loading svelte-1hlmyjs" role="status"> </p>'),f3=D('<div class="mndw-alert mndw-alert--danger mndw-plugin-manager__notice svelte-1hlmyjs" role="alert"><p class="svelte-1hlmyjs"> </p> <mndw-button> </mndw-button></div>',2),h3=D('<div class="mndw-alert mndw-alert--danger mndw-plugin-manager__notice svelte-1hlmyjs" role="alert"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),p3=D('<section class="svelte-1hlmyjs"><strong> </strong> <span> </span> <span> </span> <span> </span> <span> </span></section>'),g3=D('<p class="svelte-1hlmyjs"> </p>'),$a=D("<span> </span>"),m3=D('<section class="mndw-plugin-diagnostics__item svelte-1hlmyjs"><strong> </strong> <!> <!> <!> <!></section>'),v3=D('<!> <details class="mndw-plugin-diagnostics svelte-1hlmyjs"><summary class="svelte-1hlmyjs"> </summary> <!> <!></details> <!> <!>',1),b3=D('<section class="mndw-plugin-manager svelte-1hlmyjs"><h3 class="svelte-1hlmyjs"> </h3> <!> <!> <!></section>');function _3(t,e){Ze(e,!0);let n=kn(e,"capabilityVisible",3,!1),r=kn(e,"capabilityAvailable",3,!1);const i=vn(),s=V(()=>e.client??i.mgmtClient),o=i.registry,a=i.locale.hostT;function l(H){return Sf(H,a,()=>Ll(a))}let c=ie(at([])),u=ie(null),f=ie(""),h=ie(!0),p=ie(""),m=ie(""),g=ie(null),b=ie(!1),_=0;const y=new Si,O={polls:3,intervalMs:1e3};let N=V(()=>d(c).filter(H=>H.approval==="approved")),S=V(()=>d(c).filter(H=>H.approval==="pending"));function P(H){return y.get(H)}function M(H){return H.some(q=>{if(!q.enabled||q.approval!=="approved")return!1;const be=o.get(q.name);return be!==void 0&&be.entry.version!==q.version})}function z(H){for(const[q,be]of y)be.state==="notice-finishing"&&be.operation!==void 0&&p_(be.operation,q,H)&&y.delete(q)}async function B(){const H=++_;k(h,!0),k(p,"");try{const q=await d(s).listPlugins();H===_&&(k(c,q,!0),k(b,d(b)||M(q),!0),k(m,""),z(q))}catch(q){H===_&&k(p,l(q),!0)}finally{H===_&&k(h,!1)}}async function U(){const H=++_;let q=!1;try{const be=await d(s).listPlugins();if(H===_){k(c,be,!0),k(p,""),k(m,""),k(h,!1),z(be);const Ie=xA(be);i.router.refresh(i.registry),q=await Ie,k(b,d(b)||q||M(be),!0),i.router.refresh(i.registry)}}catch(be){H===_&&(k(m,l(be),!0),k(h,!1))}return Y(),q}async function G(){await U()&&k(b,!0)}async function Y(){try{k(u,await d(s).getRuntime(),!0),k(f,"")}catch(H){k(f,l(H),!0)}}async function oe(H,q,be){const Ie=y.get(H);if((Ie==null?void 0:Ie.state)==="working"||(Ie==null?void 0:Ie.state)==="reconciling")return!1;y.set(H,{state:"working",message:"",operation:q});let Se=!1;try{await be(),Se=!0,y.delete(H),await G()}catch(Q){const le=cO(Q);if(le==="rejected-maintenance")y.set(H,{state:"notice-rejected",message:a("settings.plugin-manager.maintenance-busy"),operation:q});else if(le==="ambiguous"){y.set(H,{state:"reconciling",message:a("settings.plugin-manager.confirming-state"),operation:q});try{const de=await c3(q,H,()=>d(s).listPlugins(),O);de==="ok"?(y.delete(H),Se=!0,await G()):de==="notice-finishing"?y.set(H,{state:"notice-finishing",message:a("settings.plugin-manager.operation-finishing"),operation:q}):y.set(H,{state:"outcome-unknown",message:a("settings.plugin-manager.outcome-unknown"),operation:q})}catch(de){y.set(H,{state:"outcome-unknown",message:l(de),operation:q})}}else y.set(H,{state:"error",message:l(Q),operation:q}),await U()}finally{k(g,null)}return Se}function we(){G()}function he(){G()}function te(H){y.delete(H)}Fn(()=>{B(),Y()});var ge=b3(),ye=v(ge),Me=v(ye),Fe=T(ye,2);{var me=H=>{var q=u3(),be=v(q),Ie=v(be),Se=T(be,2);C(Se,"variant","primary");var Q=v(Se),le=T(Se,2);C(le,"variant","ghost");var de=v(le);w((Re,it,_t)=>{E(Ie,Re),E(Q,it),E(de,_t)},[()=>a("settings.plugin-manager.plugin-updated-notice"),()=>a("settings.plugin-manager.reload-now"),()=>a("settings.plugin-manager.later")]),fe("click",Se,()=>window.location.reload()),fe("click",le,()=>k(b,!1)),A(H,q)};J(Fe,H=>{d(b)&&H(me)})}var Ne=T(Fe,2);{let H=V(()=>{var q;return(q=Z.deviceInfo)==null?void 0:q.architecture});l3(Ne,{get architecture(){return d(H)},uploadFile:q=>d(s).uploadPlugin(q),onInstalled:we,onApprove:q=>oe(q,{kind:"approve"},()=>d(s).approvePlugin(q)),onDeny:q=>oe(q,{kind:"deny"},()=>d(s).denyPlugin(q)),onDismiss:he})}var qe=T(Ne,2);{var se=H=>{var q=d3(),be=v(q);w(Ie=>E(be,Ie),[()=>a("settings.plugin-manager.loading")]),A(H,q)},ke=H=>{var q=f3(),be=v(q),Ie=v(be),Se=T(be,2);C(Se,"variant","secondary");var Q=v(Se);w(le=>{E(Ie,d(p)),E(Q,le)},[()=>a("settings.plugin-manager.retry")]),fe("click",Se,()=>void B()),A(H,q)},Ee=H=>{var q=v3(),be=et(q);{var Ie=ze=>{var st=h3(),pt=v(st),Ut=v(pt),Lt=T(pt,2);C(Lt,"variant","secondary");var on=v(Lt),jt=T(Lt,2);C(jt,"variant","ghost");var bn=v(jt);w((Qt,an)=>{E(Ut,d(m)),E(on,Qt),E(bn,an)},[()=>a("settings.plugin-manager.retry"),()=>a("settings.plugin-manager.dismiss")]),fe("click",Lt,()=>void U()),fe("click",jt,()=>k(m,"")),A(ze,st)};J(be,ze=>{d(m)&&ze(Ie)})}var Se=T(be,2),Q=v(Se),le=v(Q),de=T(Q,2);{var Re=ze=>{var st=p3(),pt=v(st),Ut=v(pt),Lt=T(pt,2),on=v(Lt),jt=T(Lt,2),bn=v(jt),Qt=T(jt,2),an=v(Qt),xn=T(Qt,2),_n=v(xn);w((j,re,ne,X,Ue,Ke,It)=>{Oe(st,"aria-label",j),E(Ut,re),E(on,`${ne??""}:
90
+ ${d(u).currentExec??""}/${d(u).maxConcurrentExecTotal??""}`),E(bn,`${X??""}:
91
+ ${d(u).reservedServices??""}/${d(u).maxSupervisedServices??""}`),E(an,`${Ue??""}:
92
+ ${d(u).maxConcurrentExecPerPlugin??""}`),E(_n,`${Ke??""}:
93
+ ${It??""}`)},[()=>a("settings.backend-capacity"),()=>a("settings.backend-capacity"),()=>a("settings.plugin-manager.exec"),()=>a("settings.plugin-manager.services"),()=>a("settings.plugin-manager.per-plugin-exec-limit"),()=>a("settings.plugin-manager.service-protocols"),()=>d(u).supportedServiceProtocols.join(", ")]),A(ze,st)},it=ze=>{var st=g3(),pt=v(st);w(Ut=>E(pt,Ut),[()=>a("settings.plugin-manager.runtime-status-unavailable",{error:d(f)})]),A(ze,st)};J(de,ze=>{d(u)?ze(Re):d(f)&&ze(it,1)})}var _t=T(de,2);Ct(_t,17,()=>d(N).filter(ze=>ze.runtime!==void 0),ze=>ze.name,(ze,st)=>{const pt=V(()=>d(st).runtime);var Ut=m3(),Lt=v(Ut),on=v(Lt),jt=T(Lt,2);{var bn=ne=>{var X=$a(),Ue=v(X);w(Ke=>E(Ue,`${Ke??""}: ${d(pt).requiredProtocol??""}`),[()=>a("settings.plugin-manager.protocol")]),A(ne,X)};J(jt,ne=>{var X;((X=d(pt))==null?void 0:X.requiredProtocol)!==void 0&&ne(bn)})}var Qt=T(jt,2);{var an=ne=>{var X=$a(),Ue=v(X);w(Ke=>E(Ue,Ke),[()=>a("settings.plugin-manager.incompatible")]),A(ne,X)};J(Qt,ne=>{var X;((X=d(pt))==null?void 0:X.compatible)===!1&&ne(an)})}var xn=T(Qt,2);{var _n=ne=>{var X=$a(),Ue=v(X);w(Ke=>E(Ue,`${Ke??""}: ${d(pt).lastError??""}`),[()=>a("settings.plugin-manager.last-error")]),A(ne,X)};J(xn,ne=>{var X;(X=d(pt))!=null&&X.lastError&&ne(_n)})}var j=T(xn,2);{var re=ne=>{var X=$a(),Ue=v(X);w((Ke,It)=>E(Ue,`${Ke??""}:
94
+ ${It??""}`),[()=>a("settings.plugin-manager.supported-service-protocols"),()=>d(pt).supportedProtocols.join(", ")]),A(ne,X)};J(j,ne=>{var X;((X=d(pt))==null?void 0:X.compatible)===!1&&d(pt).supportedProtocols&&ne(re)})}w(()=>E(on,d(st).name)),A(ze,Ut)});var bt=T(Se,2);{var Nt=ze=>{QI(ze,{get items(){return d(S)},get confirmingName(){return d(g)},rowStateFor:P,onApprove:st=>oe(st,{kind:"approve"},()=>d(s).approvePlugin(st)),onDeny:st=>oe(st,{kind:"deny"},()=>d(s).denyPlugin(st)),onRequestConfirm:st=>k(g,st,!0),onCancelConfirm:()=>k(g,null),onRefresh:()=>void U(),onKeepNotice:te})};J(bt,ze=>{d(S).length>0&&ze(Nt)})}var At=T(bt,2);jI(At,{get items(){return d(N)},get confirmingName(){return d(g)},rowStateFor:P,get capabilityVisible(){return n()},get capabilityAvailable(){return r()},onEnable:ze=>oe(ze,{kind:"enable"},()=>d(s).enablePlugin(ze)),onDisable:ze=>oe(ze,{kind:"disable"},()=>d(s).disablePlugin(ze)),onCapabilityChange:(ze,st,pt)=>oe(ze,{kind:"capability",capability:st,enabled:pt},()=>d(s).setPluginCapability(ze,st,pt)),onRestart:ze=>oe(ze,{kind:"restart"},()=>d(s).restartPlugin(ze)),onDelete:ze=>oe(ze,{kind:"delete"},()=>d(s).deletePlugin(ze)),onRequestConfirm:ze=>k(g,ze,!0),onCancelConfirm:()=>k(g,null),onRefresh:()=>void U(),onKeepNotice:te}),w(ze=>E(le,ze),[()=>a("settings.plugin-manager.diagnostics")]),A(H,q)};J(qe,H=>{d(h)?H(se):d(p)?H(ke,1):H(Ee,-1)})}w(H=>E(Me,H),[()=>a("settings.plugin-manager.title")]),A(t,ge),We()}dt(["click"]);var w3=D('<section class="mndw-plugin-settings"><!></section>');function y3(t,e){var n=w3(),r=v(n);_3(r,{get capabilityVisible(){return e.capabilityVisible},get capabilityAvailable(){return e.capabilityAvailable}}),A(t,n)}var k3=D("<mndw-button> </mndw-button>",2),E3=D('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p role="status" class="svelte-1khkewm"> </p> <!></div>');function S3(t,e){Ze(e,!0);const n=V(()=>e.progress.phase==="preparing"?L("settings.self-update-preparing"):e.progress.phase==="unconfirmed"?L("settings.self-update-unconfirmed-modal"):e.progress.operation==="revert"?L("settings.self-update-reverting",{version:e.progress.targetVersion}):L("settings.self-update-updating",{version:e.progress.targetVersion}));var r=E3(),i=v(r),s=v(i),o=T(i,2);{var a=l=>{var c=k3();C(c,"variant","secondary"),Le(c,1,"svelte-1khkewm");var u=v(c);w(f=>E(u,f),[()=>L("common.close")]),fe("click",c,()=>e.close("close")),A(l,c)};J(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}w(()=>E(s,d(n))),A(t,r),We()}dt(["click"]);var vu=D('<p class="svelte-1ffuaq9"> </p>'),ja=D('<p role="status" class="svelte-1ffuaq9"> </p>'),dg=D('<p role="alert" class="svelte-1ffuaq9"> </p>'),T3=D('<section class="mndw-self-update-settings svelte-1ffuaq9"><h3 class="svelte-1ffuaq9"> </h3> <p class="svelte-1ffuaq9"> </p> <!> <!> <!> <!> <div class="mndw-self-update-actions svelte-1ffuaq9"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div></section>',2);function x3(t,e){Ze(e,!0);let n=kn(e,"pollIntervalMs",3,2e3),r=kn(e,"pollAttempts",3,90);const i="settings.self-update.check",s="settings.self-update.apply",o="settings.self-update.revert",a="settings.self-update.status",l=vn(),c=l.locale.hostT;let u=V(()=>e.client??l.selfUpdateClient),f=ie(null),h=ie(null),p=ie(""),m=ie(""),g=ie("idle"),b=ie(""),_=ie(!1),y=null,O=0,N=0,S=!1,P=!1,M=ie(null),z=null;Fn(()=>{G()}),ni(()=>{S=!0,B(),Fe()});function B(){O+=1,y!==null&&(window.clearTimeout(y),y=null)}function U(F){k(f,F,!0),F.state==="failed"?(k(b,F.failureCode??"unknown",!0),k(g,"failure"),P=!1,Fe()):F.state==="idle"&&P?(P=!1,k(g,"idle"),je.success(c("settings.self-update-success",{version:F.version}),{key:ge(d(m))}),Fe()):F.state==="in-progress"&&(k(g,"idle"),d(M)!==null&&(d(M).phase="running",d(M).targetVersion=F.targetVersion??d(M).targetVersion,F.operation!==void 0&&(d(M).operation=F.operation)))}async function G(){k(_,!0);try{const F=await d(u).status();if(S)return;U(F),F.state==="in-progress"&&(P=!0,Y())}catch{k(g,"error")}finally{k(_,!1)}}function Y(){if(B(),N=Math.max(0,r()),N===0){we();return}oe(O)}function oe(F){S||F!==O||N<=0||(y=window.setTimeout(()=>{y=null,he(F)},n()))}function we(){B(),k(g,"unconfirmed"),d(M)!==null&&(d(M).phase="unconfirmed")}async function he(F){if(!(S||F!==O)){N-=1;try{const ae=await d(u).status();if(S||F!==O)return;U(ae),ae.state==="in-progress"?N<=0?we():oe(F):B()}catch{if(N<=0){we();return}oe(F)}}}function te(F){return F instanceof Zb?F.code:"UNKNOWN"}function ge(F){return F==="update"?s:F==="revert"?o:a}async function ye(F,ae){const Be=F==="update";return(await ei(l.hostOverlay,Zo,{title:c(Be?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:c(Be?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:ae}),confirmLabel:c(Be?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function Me(F){k(M,{operation:F,phase:"preparing",targetVersion:""},!0);const Be=d(M);if(Be===null)return;const Je=ei(l.hostOverlay,S3,{title:c("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:Be}});z=Je,Je.closed.then(()=>{z===Je&&(z=null,k(M,null))})}function Fe(){z==null||z.close(void 0,"api")}async function me(F){try{const ae=await d(u).status();if(S)return;U(ae),ae.state==="in-progress"?(P=!0,Y()):(k(g,"idle"),je.info(c("settings.self-update-busy"),{key:F}))}catch{if(S)return;k(g,"idle"),je.info(c("settings.self-update-busy"),{key:F})}}async function Ne(){B(),P=!1,k(_,!0),k(g,"checking"),k(b,"");try{const F=await d(u).check();if(S)return;k(h,F,!0),k(g,"idle"),F.updateAvailable?je.dismissKey(i):je.info(c("settings.self-update-no-update"),{key:i})}catch(F){if(S)return;k(h,null),te(F)==="OPKG_BUSY"?await me(i):(k(g,"idle"),je.error(c("settings.self-update-failure-generic"),{key:i}))}finally{S||k(_,!1)}}async function qe(){const F=d(h);F===null||!F.updateAvailable||F.targetVersion===void 0||await ye("update",F.targetVersion)&&(S||await q("update",()=>d(u).apply()))}async function se(){d(Q)!==""&&await ye("revert",d(Q))&&(S||await q("revert",()=>d(u).revert()))}function ke(F){B(),k(h,null),k(p,""),k(m,F,!0),k(b,""),k(_,!0),k(g,"preparing"),P=!1}async function Ee(F){const ae=await F();S||(k(p,ae.targetVersion,!0),k(m,ae.operation,!0),d(M)!==null&&(d(M).phase="running",d(M).targetVersion=ae.targetVersion),k(g,"idle"),P=!0,Y())}async function H(F,ae){if(S)return;const Be=ge(ae);switch(Fe(),te(F)){case"OPKG_BUSY":await me(Be);return;case"SELF_UPDATE_NOT_AVAILABLE":je.info(c("settings.self-update-no-update"),{key:Be});break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":je.info(c("settings.self-update-rollback-unavailable"),{key:Be});break;default:je.error(c("settings.self-update-failure-generic"),{key:Be})}k(b,""),k(g,"idle")}async function q(F,ae){ke(F),Me(F);try{await Ee(ae)}catch(Be){await H(Be,F)}finally{S||k(_,!1)}}function be(F){return c({"update-missing":"settings.self-update-failure-update-missing","opkg-install-failed":"settings.self-update-failure-opkg-install-failed","opkg-revert-failed":"settings.self-update-failure-opkg-revert-failed","rollback-missing":"settings.self-update-failure-rollback-missing","helper-exited":"settings.self-update-failure-helper-exited","unexpected-version":"settings.self-update-failure-unexpected-version","state-corrupt":"settings.self-update-failure-state-corrupt"}[F]??"settings.self-update-failure-generic")}const Ie=V(()=>{var F;return((F=d(f))==null?void 0:F.version)??""}),Se=V(()=>{var F,ae;return((F=d(f))==null?void 0:F.state)==="in-progress"?d(p)||d(f).targetVersion||"":((ae=d(h))==null?void 0:ae.targetVersion)||""}),Q=V(()=>{var F,ae;return((F=d(h))==null?void 0:F.rollbackVersion)||((ae=d(f))==null?void 0:ae.rollbackVersion)||""}),le=V(()=>{var F;return((F=d(h))==null?void 0:F.updateAvailable)===!0&&!d(_)}),de=V(()=>{var F,ae;return(((F=d(h))==null?void 0:F.rollbackAvailable)===!0||!!((ae=d(f))!=null&&ae.rollbackVersion))&&!d(_)});var Re=T3(),it=v(Re),_t=v(it),bt=T(it,2),Nt=v(bt),At=T(bt,2);{var ze=F=>{var ae=vu(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-current",{version:d(Ie)})]),A(F,ae)};J(At,F=>{d(Ie)&&F(ze)})}var st=T(At,2);{var pt=F=>{var ae=vu(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-rollback",{version:d(Q)})]),A(F,ae)};J(st,F=>{d(Q)&&F(pt)})}var Ut=T(st,2);{var Lt=F=>{var ae=ja(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-checking")]),A(F,ae)},on=F=>{var ae=ja(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-preparing")]),A(F,ae)},jt=F=>{var ae=ja(),Be=v(ae);w(Je=>E(Be,Je),[()=>c(d(m)==="revert"||d(f).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:d(Se)})]),A(F,ae)},bn=F=>{var ae=dg(),Be=v(ae);w(Je=>E(Be,Je),[()=>be(d(b))]),A(F,ae)},Qt=F=>{var ae=ja(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-unconfirmed")]),A(F,ae)},an=F=>{var ae=dg(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-failure-generic")]),A(F,ae)};J(Ut,F=>{var ae;d(g)==="checking"?F(Lt):d(g)==="preparing"?F(on,1):((ae=d(f))==null?void 0:ae.state)==="in-progress"&&d(g)!=="unconfirmed"?F(jt,2):d(g)==="failure"?F(bn,3):d(g)==="unconfirmed"&&d(M)===null?F(Qt,4):d(g)==="error"&&F(an,5)})}var xn=T(Ut,2);{var _n=F=>{var ae=vu(),Be=v(ae);w(Je=>E(Be,Je),[()=>c("settings.self-update-available",{version:d(h).targetVersion})]),A(F,ae)};J(xn,F=>{d(h)!==null&&d(h).updateAvailable&&d(h).targetVersion!==void 0&&F(_n)})}var j=T(xn,2),re=v(j);C(re,"variant","secondary"),w(()=>C(re,"disabled",d(_)));var ne=v(re),X=T(re,2);C(X,"variant","primary"),w(()=>C(X,"disabled",!d(le)));var Ue=v(X),Ke=T(X,2);C(Ke,"variant","secondary"),w(()=>C(Ke,"disabled",!d(de)));var It=v(Ke);w((F,ae,Be,Je,Vn,Qn)=>{Oe(Re,"data-locale",Z.locale),Oe(Re,"aria-label",F),E(_t,ae),E(Nt,Be),E(ne,Je),E(Ue,Vn),E(It,Qn)},[()=>c("settings.self-update-tab"),()=>c("settings.self-update-tab"),()=>c("settings.self-update-description"),()=>d(g)==="checking"?c("settings.self-update-checking"):c("settings.self-update-check"),()=>c("settings.self-update-apply"),()=>c("settings.self-update-revert")]),fe("click",re,()=>void Ne()),fe("click",X,()=>void qe()),fe("click",Ke,()=>void se()),A(t,Re),We()}dt(["click"]);const Il=[{id:"general",route:lt.settingsTab.general,labelKey:"settings.general-tab",icon:"settings"},{id:"diagnostics",route:lt.settingsTab.diagnostics,labelKey:"settings.diagnostics-tab",icon:"diagnostics"},{id:"plugins",route:lt.settingsTab.plugins,labelKey:"settings.plugins-tab",icon:"plugins"},{id:"self-update",route:lt.settingsTab["self-update"],labelKey:"settings.self-update-tab",icon:"refresh"}],fg="general";function hg(t){var e;return((e=Il.find(n=>n.id===t))==null?void 0:e.route)??lt.settingsTab[t]}function P3(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;for(const n of Il)if(e===n.route)return n.id;return null}var C3=D("<mndw-tab> </mndw-tab>",2),R3=D('<div class="mndw-settings"><h2> </h2> <mndw-tabs><!> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel></mndw-tabs></div>',2);function pg(t,e){Ze(e,!0);let n=ie(!1),r=ie(!1);const i=vn().router,s=V(()=>{var P;const S=((P=i.current)==null?void 0:P.route.pathname)??globalThis.location.pathname;return P3(S)??fg});Fn(()=>{const S=i.current;(S==null?void 0:S.route.pathname)===lt.settings&&S.navigate(hg(fg),{replace:!0})});function o(S){const P=Il.find(z=>z.id===S.detail.value),M=i.current;P===void 0||M===void 0||M.navigate(hg(P.id))}function a(S){k(n,S.visible,!0),k(r,S.available,!0)}var l=R3(),c=v(l),u=v(c),f=T(c,2);w(()=>C(f,"value",d(s)));var h=v(f);Ct(h,17,()=>Il,S=>S.id,(S,P)=>{var M=C3();w(()=>C(M,"id",d(P).id)),w(()=>C(M,"data-icon",d(P).icon));var z=v(M);w(B=>E(z,B),[()=>L(d(P).labelKey)]),A(S,M)});var p=T(h,2);C(p,"for","general");var m=v(p);SI(m,{onCapabilityStateChange:a});var g=T(p,2);C(g,"for","diagnostics");var b=v(g);BL(b,{});var _=T(g,2);C(_,"for","plugins");var y=v(_);y3(y,{get capabilityVisible(){return d(n)},get capabilityAvailable(){return d(r)}});var O=T(_,2);C(O,"for","self-update");var N=v(O);x3(N,{}),w(S=>{Oe(l,"data-locale",Z.locale),E(u,S)},[()=>L("settings.title")]),yt("mndwchange",f,o),A(t,l),We()}function gs(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function A3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||gs(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function O3(t,e){if(sv(t))throw new Error(`Page plugin "${e}" route "${t}" conflicts with a reserved static route`)}function gg(t){const e=If(t),n={},r=new Map;for(const o of e){const{name:a,route:l}=o;A3(l,a),O3(gs(l),a);const c=gs(l),u=`${c}/*child`,f=r.get(c);if(f!==void 0)throw new Error(`Page route collision: plugin "${a}" route "${l}" conflicts with plugin "${f}" route "${c}"`);n[c]=Jp,n[u]=Jp,r.set(c,a)}const i=new Map;for(const[o,a]of r)i.set(a,o);return{routes:n,pageTable:{baseRouteOf(o){return i.get(o)},pluginNameOf(o){return r.get(gs(o))}}}}function M3(t,e){return If(t).flatMap(n=>{const r=e.baseRouteOf(n.name);return r===void 0?[]:[{route:r,name:n.name}]})}function mg(t){return{[lt.dashboard]:gu,[lt.login]:gu,[lt.packages]:ng,[lt.packageServices]:ng,[lt.settings]:pg,...Object.fromEntries(Object.values(lt.settingsTab).map(e=>[e,pg])),...t,"*":gu}}function N3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function zf(t,e){var a;const n=N3(t),r=n.indexOf("/",1),i=r===-1?n:n.slice(0,r);let s;if("pluginNameOf"in e?s=e.pluginNameOf(i):s=(a=e.find(l=>gs(l.route)===gs(i)))==null?void 0:a.name,s===void 0)return null;const o=n.slice(i.length);return{name:s,childPath:o==="/"?"":o}}function L3(t){const e=globalThis.location.pathname,n=zf(e,t.pluginPages);if(n!==null)try{decodeURIComponent(e)}catch{const i=t.pluginPages.baseRouteOf(n.name);if(i===void 0)return;globalThis.history.replaceState(globalThis.history.state,"",`${i}${globalThis.location.search}${globalThis.location.hash}`)}}function I3(){let t,e,n;return{get current(){return t},create:s=>{const{routes:o,pageTable:a}=gg(s),l=mg(o),c={layout:PN,...l},u={[lt.dashboard]:c},f=n0(u);return e=a,n=c,t=Object.defineProperty(f,"pluginPages",{configurable:!0,enumerable:!0,get:()=>{if(e===void 0)throw new Error("Plugin page table is unavailable before router creation");return e}}),L3(t),t},refresh:s=>{if(n===void 0||t===void 0||e===void 0)return;const o=e,a=zf(t.route.pathname,o),{routes:l,pageTable:c}=gg(s),u=mg(l);for(const f of Object.keys(n))f!=="layout"&&delete n[f];Object.assign(n,u),e=c,a!==null&&c.baseRouteOf(a.name)===void 0&&t.navigate(lt.dashboard)},navigation:()=>{const s=t;if(s!==void 0)return{pageTable:s.pluginPages,navigate:o=>s.navigate(o)}},pageRouteDefinitions:s=>{const o=e;return o===void 0?[]:M3(s,o)}}}function z3(t={}){const e=t.fetch??globalThis.fetch,n=uO(e),r=sA({now:t.now}),i=pO({mgmtClient:n,document:t.document}),s=wR({catalog:r,storage:t.storage,document:t.document,setUiLocale:t.setUiLocale}),o=CO({catalog:r}),a=nM(),l=fM(),c=hM(l),u=xf("@host","@host",l).service;return Object.freeze({mgmtClient:n,palette:i,catalog:r,locale:s,registry:o,router:I3(),opkgClient:yO(e),serviceClient:EO(e),selfUpdateClient:xO(e),persistentRci:zO(),rci:UO(),telemetry:$O(e),telemetryGathering:iM({getTelemetry:()=>n.getTelemetry(),eventStream:a}),eventStream:a,theme:sM({storage:t.storage,document:t.document}),tickerPool:aM(),pluginStylesheets:new lM,overlayRuntime:l,overlay:c,hostOverlay:u})}const ai=z3();function Fa(t){return t?t.includes("/plugins/")||t.includes("/user-plugins/"):!1}function D3(){window.addEventListener("error",t=>{const e=typeof t.message=="string"?t.message:"",n=typeof t.filename=="string"?t.filename:"",r=t.error instanceof Error?t.error.stack:"";(Fa(n)||Fa(r)||Fa(e))&&(console.error("[mndw] Plugin runtime error:",t.error||t.message),t.preventDefault())}),window.addEventListener("unhandledrejection",t=>{const e=t.reason,n=e instanceof Error?e.stack:String(e);Fa(n)&&(console.error("[mndw] Plugin unhandled rejection:",e),t.preventDefault())})}function H3(){const t=document.getElementById("app");if(t===null)throw new Error("Missing #app mount target");Wl(nO,{target:t,props:{services:ai}})}async function B3(){const t=ai.rci.isAuthenticated().pipe(wg(5e3));return _d(t)}function U3(t){ai.rci.authError$.subscribe(t)}async function $3(){D3(),await rO({initLocale:()=>ai.locale.initLocale(),defineUi:t=>A_({overlay:ai.overlay,initialLocale:t,iconSpriteUrl:V_}),initTheme:()=>ai.theme.initTheme(),initPalette:()=>ai.palette.initPalette(),checkAuthenticated:B3,setAuthenticated:t=>{Z.authenticated=t},initAuthenticated:()=>Ef(ai),getAuthRunGeneration:Dr,subscribeAuthErrors:U3,resetToLogin:hc,mountApp:H3})}$3();export{IA as s};