@mndw/cli 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,94 +0,0 @@
1
- var y_=Object.defineProperty;var w_=Object.getPrototypeOf;var k_=Reflect.get;var Hf=t=>{throw TypeError(t)};var E_=(t,e,n)=>e in t?y_(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),Fe=(t,e,n,r)=>(Ec(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ge=(t,e,n)=>(Ec(t,e,"access private method"),n);var Bf=(t,e,n)=>k_(w_(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 ci,defineMndwUi as A_}from"/shared/mndw-ui@0.3.0.js";import{firstValueFrom as _d,race as O_,Observable as tl,ReplaySubject as M_,map as N_,timeout as yg,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",wg=!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 on=2,Es=4,Vl=8,yd=1<<24,br=16,or=32,qr=64,_u=128,ir=512,Xt=1024,qt=2048,kr=4096,On=8192,sr=16384,Hs=32768,yu=1<<25,_i=65536,rl=1<<17,J_=1<<18,Bs=1<<19,Q_=1<<20,Or=1<<25,Fi=65536,il=1<<21,as=1<<22,hi=1<<23,pi=Symbol("$state"),ey=Symbol(""),Ga=Symbol("attributes"),wu=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 wd=!!((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 ty(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ny(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function ry(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function iy(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function sy(t){throw new Error("https://svelte.dev/e/effect_orphan")}function oy(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ay(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ly(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function cy(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function uy(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const dy=1,fy=2,Tg=4,hy=8,py=16,gy=1,my=2,Zt=Symbol("uninitialized"),vy="http://www.w3.org/1999/xhtml",by="@attach";function _y(){console.warn("https://svelte.dev/e/derived_inert")}function yy(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function wy(){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,ky=!1;function Ey(){la=!0}const Sy=[];function ka(t,e=!1,n=!1){return Va(t,new Map,"",Sy,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 _t=null;function Ss(t){_t=t}function Ty(t){return Ed().get(t)}function xy(t,e){return Ed().set(t,e),e}function Py(t){return Ed().has(t)}function Ve(t,e=!1,n){_t={p:_t,i:!1,c:null,e:null,s:t,x:null,r:tt,l:la&&!e?{s:null,u:null,$:[]}:null}}function Ze(t){var e=_t,n=e.e;if(n!==null){e.e=null;for(var r of n)Kg(r)}return e.i=!0,_t=e.p,{}}function Us(){return!la||_t!==null&&_t.l===null}function Ed(t){return _t===null&&kd(),_t.c??(_t.c=new Map(Cy(_t)||void 0))}function Cy(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let Ai=[];function Rg(){var t=Ai;Ai=[],Y_(t)}function Mr(t){if(Ai.length===0&&!So){var e=Ai;queueMicrotask(()=>{e===Ai&&Rg()})}Ai.push(t)}function Ry(){for(;Ai.length>0;)Rg()}function Ag(t){var e=tt;if(e===null)return Qe.f|=hi,t;if((e.f&Hs)===0&&(e.f&Es)===0)throw t;ui(t,e)}function ui(t,e){if(!(e!==null&&(e.f&sr)!==0)){for(;e!==null;){if((e.f&_u)!==0){if((e.f&Hs)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const Ay=-7169;function jt(t,e){t.f=t.f&Ay|e}function Sd(t){(t.f&ir)!==0||t.deps===null?jt(t,Xt):jt(t,kr)}function Og(t){if(t!==null)for(const e of t)(e.f&on)===0||(e.f&Fi)===0||(e.f^=Fi,Og(e.deps))}function Mg(t,e,n){(t.f&qt)!==0?e.add(t):(t.f&kr)!==0&&n.add(t),Og(t.deps),jt(t,Xt)}function Oy(t,e){if(e){const n=document.body;t.autofocus=!0,Mr(()=>{document.activeElement===n&&t.focus()})}}function ca(t){var e=Qe,n=tt;Bn(null),ar(null);try{return t()}finally{Bn(e),ar(n)}}function My(t){let e=0,n=Kr(0),r;return()=>{Rd()&&(d(n),Od(()=>(e===0&&(r=Qr(()=>t(()=>sn(n)))),e+=1,()=>{Mr(()=>{e-=1,e===0&&(r==null||r(),r=void 0,sn(n))})})))}}var Ny=_i|Bs;function Ly(t,e,n,r){new Iy(t,e,n,r)}var tr,bd,nr,Ni,Nn,rr,Cn,Zn,Br,Li,oi,gs,Wo,qo,Ur,zl,Rt,zy,Dy,Eu,Hy,Su,Za,Wa,Tu,xu;class Iy{constructor(e,n,r,i){xe(this,Rt);K(this,"parent");K(this,"is_pending",!1);K(this,"transform_error");xe(this,tr);xe(this,bd,null);xe(this,nr);xe(this,Ni);xe(this,Nn);xe(this,rr,null);xe(this,Cn,null);xe(this,Zn,null);xe(this,Br,null);xe(this,Li,0);xe(this,oi,0);xe(this,gs,!1);xe(this,Wo,new Set);xe(this,qo,new Set);xe(this,Ur,null);xe(this,zl,My(()=>(Fe(this,Ur,Kr(x(this,Li))),()=>{Fe(this,Ur,null)})));var s;Fe(this,tr,e),Fe(this,nr,n),Fe(this,Ni,o=>{var a=tt;a.b=this,a.f|=_u,r(o)}),this.parent=tt.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),Fe(this,Nn,$s(()=>{Ge(this,Rt,Su).call(this)},Ny))}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,nr).pending}update_pending_count(e,n){Ge(this,Rt,Tu).call(this,e,n),Fe(this,Li,x(this,Li)+e),!(!x(this,Ur)||x(this,gs))&&(Fe(this,gs,!0),Mr(()=>{Fe(this,gs,!1),x(this,Ur)&&Ts(x(this,Ur),x(this,Li))}))}get_effect_pending(){return x(this,zl).call(this),d(x(this,Ur))}error(e){if(!x(this,nr).onerror&&!x(this,nr).failed)throw e;qe!=null&&qe.is_fork?(x(this,rr)&&qe.skip_effect(x(this,rr)),x(this,Cn)&&qe.skip_effect(x(this,Cn)),x(this,Zn)&&qe.skip_effect(x(this,Zn)),qe.oncommit(()=>{Ge(this,Rt,xu).call(this,e)})):Ge(this,Rt,xu).call(this,e)}}tr=new WeakMap,bd=new WeakMap,nr=new WeakMap,Ni=new WeakMap,Nn=new WeakMap,rr=new WeakMap,Cn=new WeakMap,Zn=new WeakMap,Br=new WeakMap,Li=new WeakMap,oi=new WeakMap,gs=new WeakMap,Wo=new WeakMap,qo=new WeakMap,Ur=new WeakMap,zl=new WeakMap,Rt=new WeakSet,zy=function(){try{Fe(this,rr,zn(()=>x(this,Ni).call(this,x(this,tr))))}catch(e){this.error(e)}},Dy=function(e){const n=x(this,nr).failed,{reset:r,invoke_onerror:i}=Ge(this,Rt,Eu).call(this,e);Mr(i),n&&Fe(this,Zn,zn(()=>{n(x(this,tr),()=>e,()=>r)}))},Eu=function(e){var n=!1,r=!1;const i=()=>{if(n){wy();return}n=!0,r&&uy(),x(this,Zn)!==null&&Ui(x(this,Zn),()=>{Fe(this,Zn,null)}),Ge(this,Rt,Wa).call(this,()=>{Ge(this,Rt,Su).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=x(this,nr)).onerror)==null||a.call(o,e,i),r=!1}catch(l){ui(l,x(this,Nn)&&x(this,Nn).parent)}}}},Hy=function(){const e=x(this,nr).pending;e&&(this.is_pending=!0,Fe(this,Cn,zn(()=>e(x(this,tr)))),Mr(()=>{var n=Fe(this,Br,document.createDocumentFragment()),r=Zr();n.append(r),Fe(this,rr,Ge(this,Rt,Wa).call(this,()=>zn(()=>x(this,Ni).call(this,r)))),x(this,oi)===0&&(x(this,tr).before(n),Fe(this,Br,null),Ui(x(this,Cn),()=>{Fe(this,Cn,null)}),Ge(this,Rt,Za).call(this,qe))}))},Su=function(){try{if(this.is_pending=this.has_pending_snippet(),Fe(this,oi,0),Fe(this,Li,0),Fe(this,rr,zn(()=>{x(this,Ni).call(this,x(this,tr))})),x(this,oi)>0){var e=Fe(this,Br,document.createDocumentFragment());Nd(x(this,rr),e);const n=x(this,nr).pending;Fe(this,Cn,zn(()=>n(x(this,tr))))}else Ge(this,Rt,Za).call(this,qe)}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=tt,r=Qe,i=_t;ar(x(this,Nn)),Bn(x(this,Nn)),Ss(x(this,Nn).ctx);try{return Gi.ensure(),e()}catch(s){return Ag(s),null}finally{ar(n),Bn(r),Ss(i)}},Tu=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&Ge(r=this.parent,Rt,Tu).call(r,e,n);return}Fe(this,oi,x(this,oi)+e),x(this,oi)===0&&(Ge(this,Rt,Za).call(this,n),x(this,Cn)&&Ui(x(this,Cn),()=>{Fe(this,Cn,null)}),x(this,Br)&&(x(this,tr).before(x(this,Br)),Fe(this,Br,null)))},xu=function(e){x(this,rr)&&(hn(x(this,rr)),Fe(this,rr,null)),x(this,Cn)&&(hn(x(this,Cn)),Fe(this,Cn,null)),x(this,Zn)&&(hn(x(this,Zn)),Fe(this,Zn,null));let n=x(this,nr).failed;const r=i=>{const{reset:s,invoke_onerror:o}=Ge(this,Rt,Eu).call(this,i);o(),n&&Fe(this,Zn,Ge(this,Rt,Wa).call(this,()=>{try{return zn(()=>{var a=tt;a.b=this,a.f|=_u,n(x(this,tr),()=>i,()=>s)})}catch(a){return ui(a,x(this,Nn).parent),null}}))};Mr(()=>{var i;try{i=this.transform_error(e)}catch(s){ui(s,x(this,Nn)&&x(this,Nn).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>ui(s,x(this,Nn)&&x(this,Nn).parent)):r(i)})};function Ng(t,e,n,r){const i=Us()?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=tt,l=By(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&sr)===0){l();try{r([...o,...p])}catch(m){ui(m,a)}sl()}}var f=Lg();if(n.length===0){c.then(()=>u([])).finally(f);return}function h(){Promise.all(n.map(p=>Uy(p))).then(u).catch(p=>ui(p,a)).finally(f)}c?c.then(()=>{l(),h(),sl()}):h()}function By(){var t=tt,e=Qe,n=_t,r=qe;return function(s=!0){ar(t),Bn(e),Ss(n),s&&(t.f&sr)===0&&(r==null||r.activate(),r==null||r.apply())}}function sl(t=!0){ar(null),Bn(null),Ss(null),t&&(qe==null||qe.deactivate())}function Lg(){var t=tt,e=t.b,n=qe,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=on|qt;return tt!==null&&(tt.f|=Bs),{ctx:_t,deps:null,effects:null,equals:xg,f:e,fn:t,reactions:null,rv:0,v:Zt,wv:0,parent:tt,ac:null}}const ao=Symbol("obsolete");function Uy(t,e,n){let r=tt;r===null&&ty();var i=void 0,s=Kr(Zt),o=!Qe,a=new Set;return nw(()=>{var p,m;var l=tt,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=qe;if(o){if((l.f&Hs)!==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|=hi,Ts(s,b)):((s.f&hi)!==0&&(s.f^=hi),Ts(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 $y(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)hn(e[n])}}function xd(t){var e,n=tt,r=t.parent;if(!yi&&r!==null&&t.v!==Zt&&(r.f&(sr|On))!==0)return _y(),t.v;ar(r);try{t.f&=~Fi,$y(t),e=sm(t)}finally{ar(n)}return e}function zg(t){var e=xd(t);if(!t.equals(e)&&(t.wv=rm(),(!(qe!=null&&qe.is_fork)||t.deps===null)&&(qe!==null?(qe.capture(t,e,!0),Eo==null||Eo.capture(t,e,!0)):t.v=e,t.deps===null))){jt(t,Xt);return}yi||(dn!==null?(Rd()||qe!=null&&qe.is_fork)&&dn.set(t,e):Sd(t))}function jy(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&&xs(e)}let Tc=null,Xi=null,qe=null,Eo=null,dn=null,Pu=null,So=!1,xc=!1,is=null,qa=null;var Gf=0;let Fy=1;var ms,ai,Ii,vs,bs,_s,$r,ys,Ln,Ko,jr,hr,xr,ws,zi,yt,Cu,lo,Ru,Hg,Bg,ns,Gy,co;const Dl=class Dl{constructor(){xe(this,yt);K(this,"id",Fy++);xe(this,ms,!1);K(this,"linked",!0);xe(this,ai,null);xe(this,Ii,null);K(this,"async_deriveds",new Map);K(this,"current",new Map);K(this,"previous",new Map);xe(this,vs,new Set);xe(this,bs,new Set);xe(this,_s,0);xe(this,$r,new Map);xe(this,ys,null);xe(this,Ln,[]);xe(this,Ko,[]);xe(this,jr,new Set);xe(this,hr,new Set);xe(this,xr,new Map);xe(this,ws,new Set);K(this,"is_fork",!1);xe(this,zi,!1);Xi===null?Tc=Xi=this:(Fe(Xi,Ii,this),Fe(this,ai,Xi)),Xi=this}skip_effect(e){x(this,xr).has(e)||x(this,xr).set(e,{d:[],m:[]}),x(this,ws).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=x(this,xr).get(e);if(r){x(this,xr).delete(e);for(var i of r.d)jt(i,qt),n(i);for(i of r.m)jt(i,kr),n(i)}x(this,ws).add(e)}capture(e,n,r=!1){e.v!==Zt&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&hi)===0&&(this.current.set(e,[n,r]),dn==null||dn.set(e,n)),this.is_fork||(e.v=n)}activate(){qe=this}deactivate(){qe=null,dn=null}flush(){try{xc=!0,qe=this,Ge(this,yt,lo).call(this)}finally{Gf=0,Pu=null,is=null,qa=null,xc=!1,qe=null,dn=null,Bi.clear()}}discard(){var e;for(const n of x(this,bs))n(this);x(this,bs).clear();for(const n of this.async_deriveds.values())n.reject(ao);Ge(this,yt,co).call(this),(e=x(this,ys))==null||e.resolve()}register_created_effect(e){x(this,Ko).push(e)}increment(e,n){if(Fe(this,_s,x(this,_s)+1),e){let r=x(this,$r).get(n)??0;x(this,$r).set(n,r+1)}}decrement(e,n){if(Fe(this,_s,x(this,_s)-1),e){let r=x(this,$r).get(n)??0;r===1?x(this,$r).delete(n):x(this,$r).set(n,r-1)}x(this,zi)||(Fe(this,zi,!0),Mr(()=>{Fe(this,zi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)x(this,jr).add(r);for(const r of n)x(this,hr).add(r);e.clear(),n.clear()}oncommit(e){x(this,vs).add(e)}ondiscard(e){x(this,bs).add(e)}settled(){return(x(this,ys)??Fe(this,ys,Sg())).promise}static ensure(){if(qe===null){const e=qe=new Dl;!xc&&!So&&Mr(()=>{x(e,ms)||e.flush()})}return qe}apply(){{dn=null;return}}schedule(e){var i;if(Pu=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Es|Vl|yd))!==0&&(e.f&Hs)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(is!==null&&n===tt&&(Qe===null||(Qe.f&on)===0))return;if((r&(qr|or))!==0){if((r&Xt)===0)return;n.f^=Xt}}x(this,Ln).push(n)}};ms=new WeakMap,ai=new WeakMap,Ii=new WeakMap,vs=new WeakMap,bs=new WeakMap,_s=new WeakMap,$r=new WeakMap,ys=new WeakMap,Ln=new WeakMap,Ko=new WeakMap,jr=new WeakMap,hr=new WeakMap,xr=new WeakMap,ws=new WeakMap,zi=new WeakMap,yt=new WeakSet,Cu=function(){if(this.is_fork)return!0;for(const r of x(this,$r).keys()){for(var e=r,n=!1;e.parent!==null;){if(x(this,xr).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},lo=function(){var l,c,u,f;Fe(this,ms,!0),Gf++>1e3&&(Ge(this,yt,co).call(this),Zy());for(const h of x(this,jr))x(this,hr).delete(h),jt(h,qt),this.schedule(h);for(const h of x(this,hr))jt(h,kr),this.schedule(h);const e=x(this,Ln);Fe(this,Ln,[]),this.apply();var n=is=[],r=[],i=qa=[];for(const h of e)try{Ge(this,yt,Ru).call(this,h,n,r)}catch(p){throw jg(h),Ge(this,yt,Cu).call(this)||this.discard(),p}if(qe=null,i.length>0){var s=Dl.ensure();for(const h of i)s.schedule(h)}if(is=null,qa=null,Ge(this,yt,Cu).call(this)){Ge(this,yt,ns).call(this,r),Ge(this,yt,ns).call(this,n);for(const[h,p]of x(this,xr))$g(h,p);i.length>0&&Ge(l=qe,yt,lo).call(l);return}const o=Ge(this,yt,Hg).call(this);if(o){Ge(this,yt,ns).call(this,r),Ge(this,yt,ns).call(this,n),Ge(c=o,yt,Bg).call(c,this);return}x(this,jr).clear(),x(this,hr).clear();for(const h of x(this,vs))h(this);x(this,vs).clear(),Eo=this,Vf(r),Vf(n),Eo=null,(u=x(this,ys))==null||u.resolve();var a=qe;if(x(this,_s)===0&&(x(this,Ln).length===0||a!==null)&&Ge(this,yt,co).call(this),x(this,Ln).length>0)if(a!==null){const h=a;x(h,Ln).push(...x(this,Ln).filter(p=>!x(h,Ln).includes(p)))}else a=this;a!==null&&Ge(f=a,yt,lo).call(f)},Ru=function(e,n,r){e.f^=Xt;for(var i=e.first;i!==null;){var s=i.f,o=(s&(or|qr))!==0,a=o&&(s&Xt)!==0,l=a||(s&On)!==0||x(this,xr).has(i);if(!l&&i.fn!==null){o?i.f^=Xt:(s&Es)!==0?n.push(i):da(i)&&((s&br)!==0&&x(this,hr).add(i),xs(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,ai);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=x(e,ai)}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,jr),x(e,hr));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&on)!==0&&(i.f&(qt|kr))===0))for(const l of s){var o=l.f;if((o&on)!==0)n(l);else{var a=l;o&(as|br)&&!this.async_deriveds.has(a)&&(x(this,hr).delete(a),jt(a,qt),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),Ge(r=e,yt,co).call(r),qe=this,Ge(this,yt,lo).call(this)},ns=function(e){for(var n=0;n<e.length;n+=1)Mg(e[n],x(this,jr),x(this,hr))},Gy=function(){var f;for(let h=Tc;h!==null;h=x(h,Ii)){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,ms)||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,ws))h.unskip_effect(p,m=>{var g;(m.f&(br|as))!==0?h.schedule(m):Ge(g=h,yt,ns).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&(sr|On|rl))===0&&Pd(p,c,a)&&((p.f&(as|br))!==0?(jt(p,qt),h.schedule(p)):x(h,jr).add(p));if(x(h,Ln).length>0&&!x(h,zi)){h.apply();for(var u of x(h,Ln))Ge(f=h,yt,Ru).call(f,u,[],[]);Fe(h,Ln,[])}h.deactivate()}}}},co=function(){if(this.linked){var e=x(this,ai),n=x(this,Ii);e===null?Tc=n:Fe(e,Ii,n),n===null?Xi=e:Fe(n,ai,e),this.linked=!1}};let Gi=Dl;function Vy(t){var e=So;So=!0;try{for(var n;;){if(Ry(),qe===null)return n;qe.flush()}}finally{So=e}}function Zy(){try{oy()}catch(t){ui(t,Pu)}}let fr=null;function Vf(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(sr|On))===0&&da(r)&&(fr=new Set,xs(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Jg(r),(fr==null?void 0:fr.size)>0)){Bi.clear();for(const i of fr){if((i.f&(sr|On))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)fr.has(o)&&(fr.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(sr|On))===0&&xs(l)}}fr.clear()}}fr=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&on)!==0?Ug(i,e,n,r):(s&(as|br))!==0&&(s&qt)===0&&Pd(i,e,r)&&(jt(i,qt),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&on)!==0&&Pd(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Cd(t){qe.schedule(t)}function $g(t,e){if(!((t.f&or)!==0&&(t.f&Xt)!==0)){(t.f&qt)!==0?e.d.push(t):(t.f&kr)!==0&&e.m.push(t),jt(t,Xt);for(var n=t.first;n!==null;)$g(n,e),n=n.next}}function jg(t){jt(t,Xt);for(var e=t.first;e!==null;)jg(e),e=e.next}let ol=new Set;const Bi=new Map;let Fg=!1;function Kr(t,e){var n={f:0,v:t,reactions:null,equals:xg,rv:0,wv:0};return n}function se(t,e){const n=Kr(t);return tm(n),n}function Wy(t,e=!1,n=!0){var i;const r=Kr(t);return e||(r.equals=Cg),la&&n&&_t!==null&&_t.l!==null&&((i=_t.l).s??(i.s=[])).push(r),r}function k(t,e,n=!1){Qe!==null&&(!_r||(Qe.f&rl)!==0)&&Us()&&(Qe.f&(on|br|as|rl))!==0&&(Lr===null||!Lr.has(t))&&cy();let r=n?it(e):e;return Ts(t,r,qa)}function Ts(t,e,n=null){if(!t.equals(e)){Bi.set(t,yi?e:t.v);var r=Gi.ensure();if(r.capture(t,e),(t.f&on)!==0){const i=t;(t.f&qt)!==0&&xd(i),dn===null&&Sd(i)}t.wv=rm(),Gg(t,qt,n),Us()&&tt!==null&&(tt.f&Xt)!==0&&(tt.f&(or|qr))===0&&(er===null?sw([t]):er.push(t)),!r.is_fork&&ol.size>0&&!Fg&&qy()}return e}function qy(){Fg=!1;for(const t of ol){(t.f&Xt)!==0&&jt(t,kr);let e;try{e=da(t)}catch{e=!0}e&&xs(t)}ol.clear()}function sn(t){k(t,t.v+1)}function Gg(t,e,n){var r=t.reactions;if(r!==null)for(var i=Us(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===tt)){var c=(l&qt)===0;if(c&&jt(a,e),(l&rl)!==0)ol.add(a);else if((l&on)!==0){var u=a;dn==null||dn.delete(u),(l&Fi)===0&&(l&ir&&(tt===null||(tt.f&il)===0)&&(a.f|=Fi),Gg(u,kr,n))}else if(c){var f=a;(l&br)!==0&&fr!==null&&fr.add(f),n!==null?n.push(f):Cd(f)}}}}function it(t){if(typeof t!="object"||t===null||pi in t)return t;const e=Gl(t);if(e!==Eg&&e!==q_)return t;var n=new Map,r=jl(t),i=se(0),s=Er,o=a=>{if(Er===s)return a();var l=Qe,c=Er;Bn(null),qf(s);var u=a();return Bn(l),qf(c),u};return r&&n.set("length",se(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&ay();var u=n.get(l);return u===void 0?o(()=>{var f=se(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(()=>se(Zt));n.set(l,u),sn(i)}}else k(c,Zt),sn(i);return!0},get(a,l,c){var p;if(l===pi)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=it(f?a[l]:Zt),g=se(m);return g}),n.set(l,u)),u!==void 0){var h=d(u);return h===Zt?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!==Zt)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===pi)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Zt||Reflect.has(a,l);if(c!==void 0||tt!==null&&(!u||(h=ko(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?it(a[l]):Zt,m=se(p);return m}),n.set(l,c));var f=d(c);if(f===Zt)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,Zt):p in a&&(m=o(()=>se(Zt)),n.set(p+"",m))}if(f===void 0)(!h||(O=ko(a,l))!=null&&O.writable)&&(f=o(()=>se(void 0)),k(f,it(c)),n.set(l,f));else{h=f.v!==Zt;var g=o(()=>it(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"),w=Number(l);Number.isInteger(w)&&w>=_.v&&k(_,w+1)}sn(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!==Zt});for(var[c,u]of n)u.v!==Zt&&!(c in a)&&l.push(c);return l},setPrototypeOf(){ly()}})}function Zf(t){try{if(t!==null&&typeof t=="object"&&pi in t)return t[pi]}catch{}return t}function Ky(t,e){return Object.is(Zf(t),Zf(e))}var Mo,Vg,Zg,Wg;function Yy(){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[wu]=void 0,t[Ga]=null,t[ku]=void 0,t.__e=void 0),Ff(n)&&(n[oo]=void 0)}}function Zr(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 Xy(t){t.textContent=""}function qg(){return!1}function Jy(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function Qy(t){tt===null&&(Qe===null&&sy(),iy()),yi&&ry()}function ew(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function zr(t,e){var n=tt;n!==null&&(n.f&On)!==0&&(t|=On);var r={ctx:_t,deps:null,nodes:null,f:t|qt|ir,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};qe==null||qe.register_created_effect(r);var i=r;if((t&Es)!==0)is!==null?is.push(r):Gi.ensure().schedule(r);else if(e!==null){try{xs(r)}catch(o){throw hn(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&Bs)===0&&(i=i.first,(t&br)!==0&&(t&_i)!==0&&i!==null&&(i.f|=_i))}if(i!==null&&(i.parent=n,n!==null&&ew(i,n),Qe!==null&&(Qe.f&on)!==0&&(t&qr)===0)){var s=Qe;(s.effects??(s.effects=[])).push(i)}return r}function Rd(){return Qe!==null&&!_r}function Ad(t){const e=zr(Vl,null);return jt(e,Xt),e.teardown=t,e}function Kn(t){Qy();var e=tt.f,n=!Qe&&(e&or)!==0&&_t!==null&&!_t.i;if(n){var r=_t;(r.e??(r.e=[])).push(t)}else return Kg(t)}function Kg(t){return zr(Es|Q_,t)}function tw(t){Gi.ensure();const e=zr(qr|Bs,t);return(n={})=>new Promise(r=>{n.outro?Ui(e,()=>{hn(e),r(void 0)}):(hn(e),r(void 0))})}function Zl(t){return zr(Es,t)}function nw(t){return zr(as|Bs,t)}function Od(t,e=0){return zr(Vl|e,t)}function y(t,e=[],n=[],r=[]){Ng(r,e,n,i=>{zr(Vl,()=>{t(...i.map(d))})})}function $s(t,e=0){var n=zr(br|e,t);return n}function Yg(t,e=0){var n=zr(yd|e,t);return n}function zn(t){return zr(or|Bs,t)}function Xg(t){var e=t.teardown;if(e!==null){const n=yi,r=Qe;Wf(!0),Bn(null);try{e.call(null)}finally{Wf(n),Bn(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&qr)!==0?n.parent=null:hn(n,e),n=r}}function rw(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&or)===0&&hn(e),e=n}}function hn(t,e=!0){var n=!1;(e||(t.f&J_)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(iw(t.nodes.start,t.nodes.end),n=!0),t.f|=yu,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^=yu,t.f|=sr;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 iw(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 Ui(t,e,n=!0){var r=[];Qg(t,r,!0);var i=()=>{n&&hn(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&On)===0){t.f^=On;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&qr)===0){var o=(i.f&_i)!==0||(i.f&or)!==0&&(t.f&br)!==0;Qg(i,e,o?n:!1)}i=s}}}function ll(t){em(t,!0)}function em(t,e){if((t.f&On)!==0){t.f^=On,(t.f&Xt)===0&&(jt(t,qt),Gi.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&_i)!==0||(n.f&or)!==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,yi=!1;function Wf(t){yi=t}let Qe=null,_r=!1;function Bn(t){Qe=t}let tt=null;function ar(t){tt=t}let Lr=null;function tm(t){Qe!==null&&(Lr??(Lr=new Set)).add(t)}let In=null,Vn=0,er=null;function sw(t){er=t}let nm=1,Oi=0,Er=Oi;function qf(t){Er=t}function rm(){return++nm}function da(t){var e=t.f;if((e&qt)!==0)return!0;if(e&on&&(t.f&=~Fi),(e&kr)!==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&ir)!==0&&dn===null&&jt(t,Xt)}return!1}function im(t,e,n=!0){var r=t.reactions;if(r!==null&&!(Lr!==null&&Lr.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&on)!==0?im(s,e,!1):e===s&&(n?jt(s,qt):(s.f&Xt)!==0&&jt(s,kr),Cd(s))}}function sm(t){var g;var e=In,n=Vn,r=er,i=Qe,s=Lr,o=_t,a=_r,l=Er,c=t.f;In=null,Vn=0,er=null,Qe=(c&(or|qr))===0?t:null,Lr=null,Ss(t.ctx),_r=!1,Er=++Oi,t.ac!==null&&(ca(()=>{t.ac.abort(aa)}),t.ac=null);try{t.f|=il;var u=t.fn,f=u();t.f|=Hs;var h=t.deps,p=qe==null?void 0:qe.is_fork;if(In!==null){var m;if(p||No(t,Vn),h!==null&&Vn>0)for(h.length=Vn+In.length,m=0;m<In.length;m++)h[Vn+m]=In[m];else t.deps=h=In;if(Rd()&&(t.f&ir)!==0)for(m=Vn;m<h.length;m++)((g=h[m]).reactions??(g.reactions=[])).push(t)}else!p&&h!==null&&Vn<h.length&&(No(t,Vn),h.length=Vn);if(Us()&&er!==null&&!_r&&h!==null&&(t.f&(on|kr|qt))===0)for(m=0;m<er.length;m++)im(er[m],t);if(i!==null&&i!==t){if(Oi++,i.deps!==null)for(let b=0;b<n;b+=1)i.deps[b].rv=Oi;if(e!==null)for(const b of e)b.rv=Oi;er!==null&&(r===null?r=er:r.push(...er))}return(t.f&hi)!==0&&(t.f^=hi),f}catch(b){return Ag(b)}finally{t.f^=il,In=e,Vn=n,er=r,Qe=i,Lr=s,Ss(o),_r=a,Er=l}}function ow(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&on)!==0&&(In===null||!nl.call(In,e))){var s=e;(s.f&ir)!==0&&(s.f^=ir,s.f&=~Fi),s.v!==Zt&&Sd(s),s.ac!==null&&ca(()=>{s.ac.abort(aa),s.ac=null,jt(s,qt)}),jy(s),No(s,0)}}function No(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)ow(t,n[r])}function xs(t){var e=t.f;if((e&sr)===0){jt(t,Xt);var n=tt,r=Ka;tt=t,Ka=(e&(or|qr))===0;try{(e&(br|yd))!==0?rw(t):Md(t),Xg(t);var i=sm(t);t.teardown=typeof i=="function"?i:null,t.wv=nm;var s;wg&&ky&&(t.f&qt)!==0&&t.deps}finally{Ka=r,tt=n}}}async function To(){await Promise.resolve(),Vy()}function d(t){var e=t.f,n=(e&on)!==0;if(Qe!==null&&!_r){var r=tt!==null&&(tt.f&sr)!==0;if(!r&&(Lr===null||!Lr.has(t))){var i=Qe.deps;if((Qe.f&il)!==0)t.rv<Oi&&(t.rv=Oi,In===null&&i!==null&&i[Vn]===t?Vn++:In===null?In=[t]:In.push(t));else{Qe.deps??(Qe.deps=[]),nl.call(Qe.deps,t)||Qe.deps.push(t);var s=t.reactions;s===null?t.reactions=[Qe]:nl.call(s,Qe)||s.push(Qe)}}}if(yi&&Bi.has(t))return Bi.get(t);if(n){var o=t;if(yi){var a=o.v;return((o.f&Xt)===0&&o.reactions!==null||am(o))&&(a=xd(o)),Bi.set(o,a),a}var l=(o.f&ir)===0&&!_r&&Qe!==null&&(Ka||(Qe.f&ir)!==0),c=(o.f&Hs)===0;da(o)&&(l&&(o.f|=ir),zg(o)),l&&!c&&(Dg(o),om(o))}if(dn!=null&&dn.has(t))return dn.get(t);if((t.f&hi)!==0)throw t.v;return t.v}function om(t){if(t.f|=ir,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&on)!==0&&(e.f&ir)===0&&(Dg(e),om(e))}function am(t){if(t.v===Zt)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Bi.has(e)||(e.f&on)!==0&&am(e))return!0;return!1}function Qr(t){var e=_r;try{return _r=!0,t()}finally{_r=e}}function aw(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(pi in t)Au(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&pi 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 lw(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const cw=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function uw(t){return cw.includes(t)}const dw={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 fw(t){return t=t.toLowerCase(),dw[t]??t}const hw=["touchstart","touchmove"];function pw(t){return hw.includes(t)}const Mi=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"?Mr(()=>{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 Tt(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 he(t,e,n){(e[Mi]??(e[Mi]={}))[t]=n}function ht(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[Mi];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[Mi]=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=Qe,f=tt;Bn(null),ar(null);try{for(var h,p=[];s!==null&&s!==e;){try{var m=(b=s[Mi])==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[Mi]=e,delete t.currentTarget,Bn(u),ar(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 gw(t){return(Pc==null?void 0:Pc.createHTML(t))??t}function mw(t){var e=Jy("template");return e.innerHTML=gw(t.replaceAll("<!>","<!---->")),e.content}function cl(t,e){var n=tt;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function I(t,e){var n=(e&gy)!==0,r=(e&my)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=mw(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=Zr(t+"");return cl(e,e),e}}function Un(){var t=document.createDocumentFragment(),e=document.createComment(""),n=Zr();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 vw(t,e)}const Sa=new Map;function vw(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){Yy();var l=void 0,c=tw(()=>{var u=n??e.appendChild(Zr());Ly(u,{pending:()=>{}},p=>{Ve({});var m=_t;s&&(m.c=s),i&&(r.$$events=i),l=t(p,r)||{},Ze()},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=pw(g);for(const O of[e,document]){var _=Sa.get(O);_===void 0&&(_=new Map,Sa.set(O,_));var w=_.get(g);w===void 0?(O.addEventListener(g,Mu,{passive:b}),_.set(g,1)):_.set(g,w+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 pr,Pr,Wn,Di,Yo,Xo,Hl;class ql{constructor(e,n=!0){K(this,"anchor");xe(this,pr,new Map);xe(this,Pr,new Map);xe(this,Wn,new Map);xe(this,Di,new Set);xe(this,Yo,!0);xe(this,Xo,e=>{if(x(this,pr).has(e)){var n=x(this,pr).get(e),r=x(this,Pr).get(n);if(r)ll(r),x(this,Di).delete(n);else{var i=x(this,Wn).get(n);i&&(ll(i.effect),x(this,Pr).set(n,i.effect),x(this,Wn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of x(this,pr)){if(x(this,pr).delete(s),s===e)break;const a=x(this,Wn).get(o);a&&(hn(a.effect),x(this,Wn).delete(o))}for(const[s,o]of x(this,Pr)){if(s===n||x(this,Di).has(s))continue;const a=()=>{if(Array.from(x(this,pr).values()).includes(s)){var c=document.createDocumentFragment();Nd(o,c),c.append(Zr()),x(this,Wn).set(s,{effect:o,fragment:c})}else hn(o);x(this,Di).delete(s),x(this,Pr).delete(s)};x(this,Yo)||!r?(x(this,Di).add(s),Ui(o,a,!1)):a()}}});xe(this,Hl,e=>{x(this,pr).delete(e);const n=Array.from(x(this,pr).values());for(const[r,i]of x(this,Wn))n.includes(r)||(hn(i.effect),x(this,Wn).delete(r))});this.anchor=e,Fe(this,Yo,n)}ensure(e,n){var r=qe,i=qg();if(n&&!x(this,Pr).has(e)&&!x(this,Wn).has(e))if(i){var s=document.createDocumentFragment(),o=Zr();s.append(o),x(this,Wn).set(e,{effect:zn(()=>n(o)),fragment:s})}else x(this,Pr).set(e,zn(()=>n(this.anchor)));if(x(this,pr).set(r,e),i){for(const[a,l]of x(this,Pr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of x(this,Wn))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)}}pr=new WeakMap,Pr=new WeakMap,Wn=new WeakMap,Di=new WeakMap,Yo=new WeakMap,Xo=new WeakMap,Hl=new WeakMap;function X(t,e,n=!1){var r=new ql(t),i=n?_i:0;function s(o,a){r.ensure(o,a)}$s(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}const bw=Symbol("NaN");function cm(t,e,n){var r=new ql(t),i=!Us();$s(()=>{var s=e();s!==s&&(s=bw),i&&s!==null&&typeof s=="object"&&(s={}),r.ensure(s,n)})}function _w(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let f=e[a];Ui(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;Xy(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|=Or;const o=document.createDocumentFragment();Nd(s,o)}else hn(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(Zr())}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){(w.effect.f&sr)===0&&(w.pending.delete(O),w.fallback=u,yw(w,h,o,e,r),u!==null&&(h.length===0?(u.f&Or)===0?ll(u):(u.f^=Or,uo(u,null,o)):Ui(u,()=>{u=null})))}function b(O){w.pending.delete(O)}var _=$s(()=>{h=d(f);for(var O=h.length,N=new Set,S=qe,P=qg(),M=0;M<O;M+=1){var z=h[M],B=r(z,M),H=m?null:a.get(B);H?(H.v&&Ts(H.v,z),H.i&&Ts(H.i,M),P&&S.unskip_effect(H.e)):(H=ww(a,m?o:Xf??(Xf=Zr()),z,B,M,i,e,n),m||(H.e.f|=Or),a.set(B,H)),N.add(B)}if(O===0&&s&&!u&&(m?u=zn(()=>s(o)):(u=zn(()=>s(Xf??(Xf=Zr()))),u.f|=Or)),O>N.size&&ny(),!m)if(p.set(S,N),P){for(const[G,q]of a)N.has(G)||S.skip_effect(q.e);S.oncommit(g),S.ondiscard(b)}else g(S);d(f)}),w={effect:_,items:a,pending:p,outrogroups:null,fallback:u};m=!1}function eo(t){for(;t!==null&&(t.f&or)===0;)t=t.next;return t}function yw(t,e,n,r,i){var H,G,q,oe,ke,ve,ie,ge,Ee;var s=(r&hy)!==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&Or)===0&&((G=(H=b.nodes)==null?void 0:H.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 te of t.outrogroups)te.pending.delete(b),te.done.delete(b);if((b.f&On)!==0&&(ll(b),s&&((oe=(q=b.nodes)==null?void 0:q.a)==null||oe.unfix(),(f??(f=new Set)).delete(b))),(b.f&Or)!==0)if(b.f^=Or,b===l)uo(b,null,n);else{var w=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),ii(t,u,b),ii(t,b,w),uo(b,w,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]);ii(t,S.prev,P.next),ii(t,u,S),ii(t,P,O),l=O,u=P,_-=1,h=[],p=[]}else c.delete(b),uo(b,l,n),ii(t,b.prev,b.next),ii(t,b,u===null?t.effect.first:u.next),ii(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&Or)===0&&h.push(b),u=b,l=eo(b.next)}if(t.outrogroups!==null){for(const te of t.outrogroups)te.pending.size===0&&(Lu(t,Fl(te.done)),(ke=t.outrogroups)==null||ke.delete(te));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&On)===0&&M.push(b);for(;l!==null;)(l.f&On)===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)(ie=(ve=M[_].nodes)==null?void 0:ve.a)==null||ie.measure();for(_=0;_<z;_+=1)(Ee=(ge=M[_].nodes)==null?void 0:ge.a)==null||Ee.fix()}_w(t,M,B)}}s&&Mr(()=>{var te,me;if(f!==void 0)for(b of f)(me=(te=b.nodes)==null?void 0:te.a)==null||me.apply()})}function ww(t,e,n,r,i,s,o,a){var l=(o&dy)!==0?(o&py)===0?Wy(n,!1,!1):Kr(n):null,c=(o&fy)!==0?Kr(i):null;return{v:l,i:c,e:zn(()=>(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&Or)===0?e.nodes.start:n;r!==null;){var o=ua(r);if(s.before(r),r===i)return;r=o}}function ii(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function kw(t,e,...n){var r=new ql(t);$s(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},_i)}function Ew(t,e,n){var r=new ql(t);$s(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},_i)}function js(t,e,n){Zl(()=>{var r=Qr(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};Od(()=>{var o=n();aw(o),i&&Pg(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function Sw(t,e){var n=void 0,r;Yg(()=>{n!==(n=e())&&(r&&(hn(r),r=null),n&&(r=zn(()=>{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 Tw(){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 xw(t){return typeof t=="object"?Tw(t):t??""}const Jf=[...`
2
- \r\f \v\uFEFF`];function Pw(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 Cw(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 Ie(t,e,n,r,i,s){var o=t[wu];if(o!==n||o===void 0){var a=Pw(n,r,s);a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a),t[wu]=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=Cw(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 yy();for(var r of t.options)r.selected=e.includes(eh(r));return}for(r of t.options){var i=eh(r);if(Ky(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function Rw(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"),Aw=wd?"input":"INPUT",Ow=wd?"option":"OPTION",Mw=wd?"select":"SELECT";function Nw(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ne(t,e,n,r){var i=hm(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[ey]=n),n==null?t.removeAttribute(e):typeof n!="string"&&zd(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function R(t,e,n){var r=Qe,i=tt;Bn(null),ar(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:Ne(t,e,n==null?n:String(n))}finally{Bn(r),ar(i)}}function Lw(t,e,n,r,i=!1,s=!1){var o=hm(t),a=o[dm],l=!o[fm],c=e||{},u=t.nodeName===Ow;for(var f in e)f in n||(n[f]=null);n.class?n.class=xw(n.class):n.class=null,n[to]&&(n.style??(n.style=null));var h=zd(t);if(t.nodeName===Aw&&"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,Ne(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";Ie(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 _=uw(z);if(lw(z)&&(z=z.slice(0,-7),P.capture=!0),!_&&g){if(S!=null)continue;t.removeEventListener(z,c[M],P),c[M]=null}if(_)he(z,t,S),ht([z]);else if(S!=null){let B=function(H){c[N].call(this,H)};c[M]=Ld(z,t,B,P)}}else if(N==="style")Ne(t,N,S);else if(N==="autofocus")Oy(t,!!S);else if(!a&&(N==="__value"||N==="value"&&S!=null))t.value=t.__value=S;else if(N==="selected"&&u)Nw(t,S);else{var w=N;l||(w=fw(w));var O=w==="defaultValue"||w==="defaultChecked";if(S==null&&!a&&!O)if(o[N]=null,w==="value"||w==="checked"){let P=t;const M=e===void 0;if(w==="value"){let z=P.defaultValue;P.removeAttribute(w),P.defaultValue=z,P.value=P.__value=M?z:null}else{let z=P.defaultChecked;P.removeAttribute(w),P.defaultChecked=z,P.checked=M?z:!1}}else t.removeAttribute(N);else O||h.includes(w)&&(a||typeof S!="string")?(t[w]=S,w in o&&(o[w]=Zt)):typeof S!="function"&&Ne(t,w,S)}}}return c}function Iw(t,e,n=[],r=[],i=[],s,o=!1,a=!1){Ng(i,n,r,l=>{var c=void 0,u={},f=t.nodeName===Mw,h=!1;if(Yg(()=>{var m=e(...l.map(d)),g=Lw(t,c,m,s,o,a);h&&f&&"value"in m&&Iu(t,m.value);for(let _ of Object.getOwnPropertySymbols(u))m[_]||hn(u[_]);for(let _ of Object.getOwnPropertySymbols(m)){var b=m[_];_.description===by&&(!c||b!==c[_])&&(u[_]&&hn(u[_]),u[_]=zn(()=>Sw(t,()=>b))),g[_]=b}c=g}),f){var p=t;Zl(()=>{Iu(p,c.value,!0),Rw(p)})}h=!0})}function hm(t){return t[Ga]??(t[Ga]={[dm]:t.nodeName.includes("-"),[fm]:t.namespaceURI===vy})}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[pi])===e}function wi(t={},e,n,r){var i=_t.r,s=tt;return Zl(()=>{var o,a;return Od(()=>{o=a,a=(r==null?void 0:r())||[],Qr(()=>{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&yu;)l=l.parent;const c=()=>{a&&Ac(n(...a),t)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}function yn(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 $n(t){_t===null&&kd(),la&&_t.l!==null?zw(_t).m.push(t):Kn(()=>{const e=Qr(t);if(typeof e=="function")return e})}function ei(t){_t===null&&kd(),$n(()=>()=>Qr(t))}function zw(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const Dw="5";var _g;typeof window<"u"&&((_g=window.__svelte??(window.__svelte={})).v??(_g.v=new Set)).add(Dw);const Hw="modulepreload",Bw=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=Bw(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":Hw,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 Pt.name==="#"?t==="/"?"/#/":dl("#",t):Pt.name?dl(Pt.name,t):t}function Uw(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=>$w(e)))}function $w(t){return new Promise(e=>{jw(t)?Promise.resolve(t()).then(n=>{e(n.default)}):e(t)})}function jw(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 Pt.name&&t.startsWith(Pt.name)&&(t=t.slice(Pt.name.length)||"/"),t}function Hd(){const t=Pt.name==="#"?globalThis.location.hash.slice(1):globalThis.location.pathname,e=Pt.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,Fw(r)]))}return t}function Fw(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=Pt.name&&Pt.name!=="#"?xo(e):e;return t(Dn.pathname,s)}if(n)return Pt.name==="#"?t(Dn.pathname,xo(e,n).replace("/#","")):t(Dn.pathname,xo(e,n));const r=e.split("/").slice(1);let i=Dn.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=Gw(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 w=b?t:"/"+n.slice(p+1).join("/"),O=$d(w,_);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 Gw(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 Vw=200,Zw=Math.PI/6,Ww=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,Ji=new Set;function qw(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},Ww),Ji.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 Ji){b.isConnected||Ji.delete(b);const _=b.getBoundingClientRect(),w=[{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 w){const N=O.x-c,S=O.y-u,P=Math.hypot(N,S);if(P>Vw||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)))<=Zw){e(b),Ji.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":{Ji.size===0&&document.addEventListener("pointermove",r),Ji.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 Kw=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],Yw=["difference","intersection","symmetricDifference","union"],sh=!1,ks,gr,li,Bl,Ds,vm,bm;const Ul=class Ul extends Set{constructor(n){super();xe(this,Ds);xe(this,ks,new Map);xe(this,gr,se(0));xe(this,li,se(0));xe(this,Bl,Er||-1);if(n){for(var r of n)super.add(r);x(this,li).v=super.size}sh||Ge(this,Ds,bm).call(this)}has(n){var r=super.has(n),i=x(this,ks),s=i.get(n);if(s===void 0){if(!r)return d(x(this,gr)),!1;s=Ge(this,Ds,vm).call(this,!0),i.set(n,s)}return d(s),r}add(n){return super.has(n)||(super.add(n),k(x(this,li),super.size),sn(x(this,gr))),this}delete(n){var r=super.delete(n),i=x(this,ks),s=i.get(n);return s!==void 0&&(i.delete(n),k(s,!1)),r&&(k(x(this,li),super.size),sn(x(this,gr))),r}clear(){if(super.size!==0){super.clear();var n=x(this,ks);for(var r of n.values())k(r,!1);n.clear(),k(x(this,li),0),sn(x(this,gr))}}keys(){return this.values()}values(){return d(x(this,gr)),super.values()}entries(){return d(x(this,gr)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return d(x(this,li))}};ks=new WeakMap,gr=new WeakMap,li=new WeakMap,Bl=new WeakMap,Ds=new WeakSet,vm=function(n){return Er===x(this,Bl)?se(n):Kr(n)},bm=function(){sh=!0;var n=Ul.prototype,r=Set.prototype;for(const i of Kw)n[i]=function(...s){return d(x(this,gr)),r[i].apply(this,s)};for(const i of Yw)n[i]=function(...s){d(x(this,gr));var o=r[i].apply(this,s);return new Ul(o)}};let Ps=Ul;var Cr,Rr,Fr,$l,wr,fo,Ya;const Df=class Df extends Map{constructor(n){super();xe(this,wr);xe(this,Cr,new Map);xe(this,Rr,se(0));xe(this,Fr,se(0));xe(this,$l,Er||-1);if(n){for(var[r,i]of n)super.set(r,i);x(this,Fr).v=super.size}}has(n){var r=x(this,Cr),i=r.get(n);if(i===void 0)if(super.has(n))i=Ge(this,wr,fo).call(this,0),r.set(n,i);else return d(x(this,Rr)),!1;return d(i),!0}forEach(n,r){Ge(this,wr,Ya).call(this),super.forEach(n,r)}get(n){var r=x(this,Cr),i=r.get(n);if(i===void 0)if(super.has(n))i=Ge(this,wr,fo).call(this,0),r.set(n,i);else{d(x(this,Rr));return}return d(i),super.get(n)}set(n,r){var f;var i=x(this,Cr),s=i.get(n),o=super.get(n),a=super.set(n,r),l=x(this,Rr);if(s===void 0)s=Ge(this,wr,fo).call(this,0),i.set(n,s),k(x(this,Fr),super.size),sn(l);else if(o!==r){sn(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&&sn(l)}return a}delete(n){var r=x(this,Cr),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),k(i,-1)),s&&(k(x(this,Fr),super.size),sn(x(this,Rr))),s}clear(){if(super.size!==0){super.clear();var n=x(this,Cr);k(x(this,Fr),0);for(var r of n.values())k(r,-1);sn(x(this,Rr)),n.clear()}}keys(){return d(x(this,Rr)),super.keys()}values(){return Ge(this,wr,Ya).call(this),super.values()}entries(){return Ge(this,wr,Ya).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(x(this,Fr)),super.size}};Cr=new WeakMap,Rr=new WeakMap,Fr=new WeakMap,$l=new WeakMap,wr=new WeakSet,fo=function(n){return Er===x(this,$l)?se(n):Kr(n)},Ya=function(){d(x(this,Rr));var n=x(this,Cr);if(x(this,Fr).v!==n.size){for(var r of Bf(Df.prototype,this,"keys").call(this))if(!n.has(r)){var i=Ge(this,wr,fo).call(this,0);n.set(r,i)}}for([,i]of x(this,Cr))d(i)};let ki=Df;const Xw=Symbol("replace");var ln,Jo,Gr,Hi,ho;class Jw extends URLSearchParams{constructor(){super(...arguments);xe(this,Hi);xe(this,ln,se(0));xe(this,Jo,e0());xe(this,Gr,!1)}[Xw](n){if(!x(this,Gr)&&n.toString()!==super.toString()){Fe(this,Gr,!0);for(const r of[...super.keys()])super.delete(r);for(const[r,i]of n)super.append(r,i);sn(x(this,ln)),Fe(this,Gr,!1)}}append(n,r){super.append(n,r),Ge(this,Hi,ho).call(this),sn(x(this,ln))}delete(n,r){var i=super.has(n,r);super.delete(n,r),i&&(Ge(this,Hi,ho).call(this),sn(x(this,ln)))}get(n){return d(x(this,ln)),super.get(n)}getAll(n){return d(x(this,ln)),super.getAll(n)}has(n,r){return d(x(this,ln)),super.has(n,r)}keys(){return d(x(this,ln)),super.keys()}forEach(n,r){d(x(this,ln)),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]))&&(Ge(this,Hi,ho).call(this),sn(x(this,ln)))}sort(){super.sort(),Ge(this,Hi,ho).call(this),sn(x(this,ln))}toString(){return d(x(this,ln)),super.toString()}values(){return d(x(this,ln)),super.values()}entries(){return d(x(this,ln)),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(x(this,ln)),super.size}}ln=new WeakMap,Jo=new WeakMap,Gr=new WeakMap,Hi=new WeakSet,ho=function(){if(!x(this,Jo)||x(this,Gr))return;Fe(this,Gr,!0);const n=this.toString();x(this,Jo).search=n&&`?${n}`,Fe(this,Gr,!1)};let Qw=null;function e0(){return Qw}let xa=new Jw(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 Pt={name:void 0};let Hu=it({value:[]}),Dn=it({pathname:"/",search:"",state:null,hash:""});queueMicrotask(()=>{const t=Hd();Dn.pathname=t.pathname,Dn.search=t.search,Dn.state=t.state,Dn.hash=t.hash});let Bu=it({value:{}}),_m=it({value:{}}),Ri=null,Pa=null,Xa=null;function t0(t){if(t){const e=new URL(globalThis.location.toString());t==="#"?(Pt.name="#",globalThis.location.href.includes("#")||(e.hash="/",history.replaceState(history.state||{},"",e.toString()))):(Pt.name=(t.startsWith("/")?"":"/")+t,e.pathname.startsWith(Pt.name)||(e.pathname=dl(Pt.name,e.pathname),history.replaceState(history.state||{},"",e.toString())))}Object.assign(Dn,Hd())}function n0(t){return Po=t,qw(Po),{p:Uw,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(Dn.pathname)},get search(){return Ud(Dn.search)},get state(){return Dn.state},get hash(){return Dn.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),Pt.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!==Ri)return;Ri==null||Ri.abort(),Ri=new AbortController;const{signal:n}=Ri,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=Ri,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||"",Pt.name==="#"?m.hash=t:Pt.name&&!t.startsWith(Pt.name)?m.pathname=dl(Pt.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(Dn,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:Pt.name==="#"?e=globalThis.location.hash.slice(1):e=globalThis.location.pathname,Pt.name&&e.startsWith(Pt.name)&&(e=e.slice(Pt.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=Pt.name==="#"?n.hash:n.pathname,s=Pt.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 ym(t,e){Ve(e,!0);const n=V(()=>e.tree[0]),r=V(()=>e.tree.slice(1));var i=Un(),s=et(i);Ew(s,()=>d(n),(o,a)=>{a(o,{children:(l,c)=>{var u=Un(),f=et(u);{var h=p=>{ym(p,{get tree(){return d(r)}})};X(f,p=>{d(r).length>0&&p(h)})}A(l,u)},$$slots:{default:!0}})}),A(t,i),Ze()}function o0(t,e){Ve(e,!0),t0(e.base),fl(),Kn(()=>{const n=Kf(globalThis,"popstate",()=>fl()),r=Kf(globalThis,"click",s0);return()=>{n(),r()}}),ym(t,{get tree(){return Hu.value}}),Ze()}const a0=720;function fa(){return window.matchMedia("(max-width: "+a0+"px)")}const jd="mndw",Cs=`${jd}:plugin`,wm=["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",y0="/api/mgmt/device-hardware",ch="/api/mgmt/telemetry",w0="/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 ls 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 Yr(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 wt(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 Zi(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function xi(...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 Rs(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 Rs(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 As(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pi(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 Re(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=xi(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 Zi(this,"shape",o),o},checks:[]});return Pi(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=xi(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 Zi(this,"shape",o),o},checks:[]});return Pi(t,s)}function V0(t,e){if(!Rs(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=xi(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return Zi(this,"shape",s),s}});return Pi(t,i)}function Z0(t,e){if(!Rs(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=xi(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return Zi(this,"shape",r),r}});return Pi(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=xi(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return Zi(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Pi(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=xi(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 Zi(this,"shape",l),l},checks:[]});return Pi(e,o)}function K0(t,e,n){const r=xi(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 Zi(this,"shape",s),s}});return Pi(e,r)}function ss(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 os(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 Xr(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 ls;if(o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Xr(l,s,Yr())));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=>Xr(l,s,Yr())));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 ls;return s.issues.length?{success:!1,error:new(t??Am)(s.issues.map(o=>Xr(o,i,Yr())))}:{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=>Xr(o,i,Yr())))}:{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 y1=/^(?:(?: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])$/,w1=/^(([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]*$/,jn=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)=>{jn.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)=>{jn.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)=>{jn.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;jn.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;jn.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;jn.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;jn.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;jn.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)=>{jn.init(t,e);const n=As(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)=>{jn.init(t,e);const n=new RegExp(`^${As(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)=>{jn.init(t,e);const n=new RegExp(`.*${As(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)=>{jn.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},Ht=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=ss(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 ls;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(u||(u=ss(a,p)))});else{if(a.issues.length===p)continue;u||(u=ss(a,p))}}return f?f.then(()=>a):a},o=(a,l,c)=>{if(ss(a))return a.aborted=!0,a;const u=s(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new ls;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 ls;return c.then(u=>s(u,r,l))}return s(c,r,l)}}wt(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;Ht.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}}),Ot=W("$ZodStringFormat",(t,e)=>{Jl.init(t,e),Xd.init(t,e)}),K1=W("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=m1),Ot.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());Ot.init(t,e)}),X1=W("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=v1),Ot.init(t,e)}),J1=W("$ZodURL",(t,e)=>{Ot.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()),Ot.init(t,e)}),ek=W("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=p1),Ot.init(t,e)}),tk=W("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=c1),Ot.init(t,e)}),nk=W("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=u1),Ot.init(t,e)}),rk=W("$ZodULID",(t,e)=>{e.pattern??(e.pattern=d1),Ot.init(t,e)}),ik=W("$ZodXID",(t,e)=>{e.pattern??(e.pattern=f1),Ot.init(t,e)}),sk=W("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=h1),Ot.init(t,e)}),ok=W("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=R1(e)),Ot.init(t,e)}),ak=W("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=P1),Ot.init(t,e)}),lk=W("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=C1(e)),Ot.init(t,e)}),ck=W("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=g1),Ot.init(t,e)}),uk=W("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=y1),Ot.init(t,e),t._zod.bag.format="ipv4"}),dk=W("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=w1),Ot.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),Ot.init(t,e)}),hk=W("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=E1),Ot.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),Ot.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),Ot.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),Ot.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)=>{Ot.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)=>{Ht.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}}),yk=W("$ZodNumberFormat",(t,e)=>{z1.init(t,e),Um.init(t,e)}),wk=W("$ZodBoolean",(t,e)=>{Ht.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)=>{Ht.init(t,e),t._zod.parse=n=>n}),Ek=W("$ZodNever",(t,e)=>{Ht.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(...os(n,t.issues)),e.value[n]=t.value}const Sk=W("$ZodArray",(t,e)=>{Ht.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(...os(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)=>{Ht.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));wt(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",H=((N=z==null?void 0:z._zod)==null?void 0:N.optout)==="optional";p.write(`const ${P} = ${g(S)};`),B&&H?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 w=p.compile();return(S,P)=>w(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=>!ss(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=>Xr(o,r,Yr())))}),e)}const Fm=W("$ZodUnion",(t,e)=>{Ht.init(t,e),wt(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),wt(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),wt(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),wt(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;wt(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)=>{Ht.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(Rs(t)&&Rs(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}),ss(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)=>{Ht.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Rs(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=>Xr(p,r,Yr())),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(...os(c,p.issues)),n.value[f]=p.value})):(h.issues.length&&n.issues.push(...os(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=>Xr(f,r,Yr())),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(...os(a,f.issues)),n.value[l.value]=f.value})):(u.issues.length&&n.issues.push(...os(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Ak=W("$ZodEnum",(t,e)=>{Ht.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"?As(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(Ht.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"?As(r):r?As(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)=>{Ht.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 ls;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)=>{Ht.init(t,e),t._zod.optin="optional",t._zod.optout="optional",wt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),wt(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),wt(t._zod,"values",()=>e.innerType._zod.values),wt(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Lk=W("$ZodNullable",(t,e)=>{Ht.init(t,e),wt(t._zod,"optin",()=>e.innerType._zod.optin),wt(t._zod,"optout",()=>e.innerType._zod.optout),wt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Wd(n.source)}|null)$`):void 0}),wt(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)=>{Ht.init(t,e),t._zod.optin="optional",wt(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=>yh(s,e)):yh(i,e)}});function yh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const zk=W("$ZodPrefault",(t,e)=>{Ht.init(t,e),t._zod.optin="optional",wt(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)=>{Ht.init(t,e),wt(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=>wh(s,t)):wh(i,t)}});function wh(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)=>{Ht.init(t,e),t._zod.optin="optional",wt(t._zod,"optout",()=>e.innerType._zod.optout),wt(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=>Xr(o,r,Yr()))},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=>Xr(s,r,Yr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Vm=W("$ZodPipe",(t,e)=>{Ht.init(t,e),wt(t._zod,"values",()=>e.in._zod.values),wt(t._zod,"optin",()=>e.in._zod.optin),wt(t._zod,"optout",()=>e.out._zod.optout),wt(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)=>{Ht.init(t,e),wt(t._zod,"propValues",()=>e.innerType._zod.propValues),wt(t._zod,"values",()=>e.innerType._zod.values),wt(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),wt(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)=>{jn.init(t,e),Ht.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",...Re(e)})}function Vk(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Re(e)})}function Th(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Re(e)})}function Zk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Re(e)})}function Wk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Re(e)})}function qk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Re(e)})}function Kk(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Re(e)})}function Yk(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Re(e)})}function Xk(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Re(e)})}function Jk(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Re(e)})}function Qk(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Re(e)})}function eE(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Re(e)})}function tE(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Re(e)})}function nE(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Re(e)})}function rE(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Re(e)})}function iE(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Re(e)})}function sE(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Re(e)})}function oE(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Re(e)})}function aE(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Re(e)})}function lE(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Re(e)})}function cE(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Re(e)})}function uE(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Re(e)})}function dE(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Re(e)})}function fE(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Re(e)})}function hE(t,e){return new t({type:"string",format:"date",check:"string_format",...Re(e)})}function pE(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Re(e)})}function gE(t,e){return new t({type:"string",format:"duration",check:"string_format",...Re(e)})}function mE(t,e){return new t({type:"number",checks:[],...Re(e)})}function vE(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Re(e)})}function bE(t,e){return new t({type:"boolean",...Re(e)})}function _E(t){return new t({type:"unknown"})}function yE(t,e){return new t({type:"never",...Re(e)})}function xh(t,e){return new Dm({check:"less_than",...Re(e),value:t,inclusive:!1})}function Mc(t,e){return new Dm({check:"less_than",...Re(e),value:t,inclusive:!0})}function Ph(t,e){return new Hm({check:"greater_than",...Re(e),value:t,inclusive:!1})}function Nc(t,e){return new Hm({check:"greater_than",...Re(e),value:t,inclusive:!0})}function Ch(t,e){return new I1({check:"multiple_of",...Re(e),value:t})}function Zm(t,e){return new D1({check:"max_length",...Re(e),maximum:t})}function pl(t,e){return new H1({check:"min_length",...Re(e),minimum:t})}function Wm(t,e){return new B1({check:"length_equals",...Re(e),length:t})}function wE(t,e){return new U1({check:"string_format",format:"regex",...Re(e),pattern:t})}function kE(t){return new $1({check:"string_format",format:"lowercase",...Re(t)})}function EE(t){return new j1({check:"string_format",format:"uppercase",...Re(t)})}function SE(t,e){return new F1({check:"string_format",format:"includes",...Re(e),includes:t})}function TE(t,e){return new G1({check:"string_format",format:"starts_with",...Re(e),prefix:t})}function xE(t,e){return new V1({check:"string_format",format:"ends_with",...Re(e),suffix:t})}function Fs(t){return new Z1({check:"overwrite",tx:t})}function PE(t){return Fs(e=>e.normalize(t))}function CE(){return Fs(t=>t.trim())}function RE(){return Fs(t=>t.toLowerCase())}function AE(){return Fs(t=>t.toUpperCase())}function OE(){return Fs(t=>H0(t))}function ME(t,e,n){return new t({type:"array",element:e,...Re(n)})}function NE(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Re(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 jn({check:"custom",...Re(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 Kt(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),Kt(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"&&Pn(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 w=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=w,{defId:w,ref:`${_("__shared")}#/${f}/${w}`}}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),w=_.schema;if(w.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(w)):Object.assign(p,w),Object.assign(p,m),f._zod.parent===g)for(const N in p)N==="$ref"||N==="allOf"||N in m||delete p[N];if(w.$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 w in p)w==="$ref"||w==="allOf"||w in _.def&&JSON.stringify(p[w])===JSON.stringify(_.def[w])&&delete p[w]}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 Pn(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 Pn(r.element,n);if(r.type==="set")return Pn(r.valueType,n);if(r.type==="lazy")return Pn(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 Pn(r.innerType,n);if(r.type==="intersection")return Pn(r.left,n)||Pn(r.right,n);if(r.type==="record"||r.type==="map")return Pn(r.keyType,n)||Pn(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Pn(r.in,n)||Pn(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Pn(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Pn(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Pn(i,n))return!0;return!!(r.rest&&Pn(r.rest,n))}return!1}const zE=(t,e={})=>n=>{const r=qm({...n,processors:e});return Kt(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 Kt(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=Kt(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]=Kt(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=Kt(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)=>Kt(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=Kt(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Kt(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=Kt(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=Kt(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Kt(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=Kt(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;Kt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},eS=(t,e,n,r)=>{const i=t._zod.def;Kt(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;Kt(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;Kt(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;Kt(o,e,r);const a=e.seen.get(t);a.ref=o},iS=(t,e,n,r)=>{const i=t._zod.def;Kt(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;Kt(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},sS=W("ZodISODateTime",(t,e)=>{ok.init(t,e),Ut.init(t,e)});function oS(t){return fE(sS,t)}const aS=W("ZodISODate",(t,e)=>{ak.init(t,e),Ut.init(t,e)});function lS(t){return hE(aS,t)}const cS=W("ZodISOTime",(t,e)=>{lk.init(t,e),Ut.init(t,e)});function uS(t){return pE(cS,t)}const dS=W("ZodISODuration",(t,e)=>{ck.init(t,e),Ut.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}}})},lr=W("ZodError",hS,{Parent:Error}),pS=Kd(lr),gS=Yd(lr),mS=Yl(lr),vS=Xl(lr),bS=t1(lr),_S=n1(lr),yS=r1(lr),wS=i1(lr),kS=s1(lr),ES=o1(lr),SS=a1(lr),TS=l1(lr),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 Bt=W("ZodType",(t,e)=>(Ht.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)=>yS(t,n,r),t.decodeAsync=async(n,r)=>wS(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(xi(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 Pi(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(Fs(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 Dt(this)},or(n){return di([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),Bt.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(wE(...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 Ut=W("ZodStringFormat",(t,e)=>{Ot.init(t,e),Jm.init(t,e)}),PS=W("ZodEmail",(t,e)=>{X1.init(t,e),Ut.init(t,e)}),Ah=W("ZodGUID",(t,e)=>{K1.init(t,e),Ut.init(t,e)}),Aa=W("ZodUUID",(t,e)=>{Y1.init(t,e),Ut.init(t,e)}),CS=W("ZodURL",(t,e)=>{J1.init(t,e),Ut.init(t,e)}),RS=W("ZodEmoji",(t,e)=>{Q1.init(t,e),Ut.init(t,e)}),AS=W("ZodNanoID",(t,e)=>{ek.init(t,e),Ut.init(t,e)}),OS=W("ZodCUID",(t,e)=>{tk.init(t,e),Ut.init(t,e)}),MS=W("ZodCUID2",(t,e)=>{nk.init(t,e),Ut.init(t,e)}),NS=W("ZodULID",(t,e)=>{rk.init(t,e),Ut.init(t,e)}),LS=W("ZodXID",(t,e)=>{ik.init(t,e),Ut.init(t,e)}),IS=W("ZodKSUID",(t,e)=>{sk.init(t,e),Ut.init(t,e)}),zS=W("ZodIPv4",(t,e)=>{uk.init(t,e),Ut.init(t,e)}),DS=W("ZodIPv6",(t,e)=>{dk.init(t,e),Ut.init(t,e)}),HS=W("ZodCIDRv4",(t,e)=>{fk.init(t,e),Ut.init(t,e)}),BS=W("ZodCIDRv6",(t,e)=>{hk.init(t,e),Ut.init(t,e)}),US=W("ZodBase64",(t,e)=>{pk.init(t,e),Ut.init(t,e)}),$S=W("ZodBase64URL",(t,e)=>{mk.init(t,e),Ut.init(t,e)}),jS=W("ZodE164",(t,e)=>{vk.init(t,e),Ut.init(t,e)}),FS=W("ZodJWT",(t,e)=>{_k.init(t,e),Ut.init(t,e)}),Qm=W("ZodNumber",(t,e)=>{Um.init(t,e),Bt.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 fn(t){return mE(Qm,t)}const GS=W("ZodNumberFormat",(t,e)=>{yk.init(t,e),Qm.init(t,e)});function Oh(t){return vE(GS,t)}const VS=W("ZodBoolean",(t,e)=>{wk.init(t,e),Bt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>UE(t,n,r)});function gi(t){return bE(VS,t)}const ZS=W("ZodUnknown",(t,e)=>{kk.init(t,e),Bt.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),Bt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>$E(t,n,r)});function qS(t){return yE(WS,t)}const KS=W("ZodArray",(t,e)=>{Sk.init(t,e),Bt.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 Dt(t,e){return ME(KS,t,e)}const YS=W("ZodObject",(t,e)=>{xk.init(t,e),Bt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>qE(t,n,r,i),wt(t,"shape",()=>e.shape),ha(t,"ZodObject",{keyof(){return kn(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??{},...Re(e)};return new YS(n)}const ev=W("ZodUnion",(t,e)=>{Fm.init(t,e),Bt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>KE(t,n,r,i),t.options=e.options});function di(t,e){return new ev({type:"union",options:t,...Re(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,...Re(n)})}const JS=W("ZodIntersection",(t,e)=>{Ck.init(t,e),Bt.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),Bt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>XE(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function Gs(t,e,n){return!e||!e._zod?new Mh({type:"record",keyType:pe(),valueType:t,...Re(e)}):new Mh({type:"record",keyType:t,valueType:e,...Re(n)})}const Fu=W("ZodEnum",(t,e)=>{Ak.init(t,e),Bt.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:[],...Re(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:[],...Re(i),entries:s})}});function kn(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Fu({type:"enum",entries:n,...Re(e)})}const eT=W("ZodLiteral",(t,e)=>{Ok.init(t,e),Bt.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 Wt(t,e){return new eT({type:"literal",values:Array.isArray(t)?t:[t],...Re(e)})}const tT=W("ZodTransform",(t,e)=>{Mk.init(t,e),Bt.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),Bt.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),Bt.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),Bt.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),Bt.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),Bt.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),Bt.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,...Re(e)})}const uT=W("ZodCatch",(t,e)=>{Hk.init(t,e),Bt.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),Bt.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),Bt.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),Bt.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"],yT=new Set(_T);function sv(t){return yT.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 wT(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=fn().int(),Oa=Qd.nonnegative(),zh=4*1024;kn(["hook","log","internal"]);const ET=/^events:(\*|[a-z][a-z0-9]*(?:,[a-z][a-z0-9]*)*)$/,ST=pe().regex(ET),St=(t,e,n)=>{const r=typeof e=="string"?Wt(e):e;return Xe({id:kT,ts:Qd,topic:Wt(t),source:r,payload:n}).strict()},nn=t=>Xe(t).strict(),Dh=di([St("wan.connected",di([Wt("hook"),Wt("log")]),nn({interface:De,address:De,mask:De,gateway:De})),St("wan.disconnected",di([Wt("hook"),Wt("log")]),nn({interface:De})),St("net.ip_changed",di([Wt("hook"),Wt("log")]),Xe({address:De,mask:De,link:De,connected:gi()}).strict()),St("net.dhcp_lease","log",nn({mac:De,ip:De,hostname:De,action:De})),St("net.dns_changed","log",Xe({resolvers:Dt(De)}).strict()),St("wifi.client_join","log",nn({mac:De,band:De,ssid:De,iface:De})),St("wifi.client_leave","log",nn({mac:De,band:De,ssid:De,iface:De})),St("firewall.rebuilt","hook",nn({table_type:De,table:De})),St("usb.attached","hook",nn({device:De,model:De,vendor:De,port:De})),St("usb.detached","hook",nn({device:De,port:De})),St("fs.mounted","hook",nn({fs_type:De,label:De,directory:De})),St("fs.unmounted","hook",nn({label:De,directory:De})),St("clock.synced","hook",Xe({offset_ms:Qd.optional()}).strict()),St("schedule.fired","hook",Xe({name:De,action:De,elapsed:Oa}).strict()),St("button.pressed","hook",nn({button:De,gesture:De})),St("auth.login","log",Xe({user:De,ip:De,success:gi()}).strict()),St("firmware.available","log",nn({version:De})),St("plugin.installed","internal",nn({name:De,version:De})),St("plugin.removed","internal",nn({name:De})),St("plugin.approved","internal",nn({name:De,version:De})),St("plugin.started","internal",nn({name:De})),St("plugin.stopped","internal",Xe({name:De,reason:De}).strict()),St("daemon.started","internal",Xe({version:De,uptime_ms:Oa}).strict()),St("daemon.stopping","internal",nn({reason:De})),St("daemon.updated","internal",nn({version:De})),St("storage.low","internal",Xe({path:Wt("/opt"),available_bytes:Oa,threshold_bytes:Oa}).strict()),St("telemetry.gathering_changed","internal",Xe({enabled:gi()}).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 yv=/[ \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(`^${yv.source}*`),ZT=new RegExp(`${yv.source}*$`);function rt(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:rt(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:rt(s,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,rt(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:rt(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,rt(o,this.clonePosition()));const a=this.clonePosition();return r!==this.parseTagName()?this.error(26,rt(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:8,value:r,children:s,location:rt(n,this.clonePosition())},err:null}:this.error(23,rt(o,this.clonePosition())))}else return this.error(27,rt(n,this.clonePosition()))}else return this.error(23,rt(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=rt(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,rt(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,rt(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,rt(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,rt(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:rt(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,rt(n,this.clonePosition())):this.parseArgumentOptions(t,e,r,n);default:return this.error(3,rt(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:rt(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,rt(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,rt(this.clonePosition(),this.clonePosition()));a={style:h,styleLocation:rt(u,this.clonePosition())}}const l=this.tryParseArgumentClose(r);if(l.err)return l;const c=rt(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,rt(a,{...a}));this.bumpSpace();let l=this.parseIdentifierIfPossible(),c=0;if(s!=="select"&&l.value==="offset"){if(!this.bumpIf(":"))return this.error(13,rt(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=rt(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,rt(i,o))}}tryParseArgumentClose(t){return this.isEOF()||this.char()!==125?this.error(1,rt(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,rt(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=rt(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,rt(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:rt(c,this.clonePosition())}]),o.add(a),this.bumpSpace(),{value:a,location:l}=this.parseIdentifierIfPossible()}return s.length===0?this.error(e==="select"?15:16,rt(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,rt(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=rt(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 cn,fx=(cn=class{constructor(e,n=cn.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=cn.resolveLocale(n),typeof e=="string"){if(this.message=e,!cn.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");const{...s}=i||{};this.ast=cn.__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(cn.formats,r),this.formatters=i&&i.formatters||dx(this.formatterCache)}static get defaultLocale(){return cn.memoizedDefaultLocale||(cn.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),cn.memoizedDefaultLocale}},cn.memoizedDefaultLocale=null,cn.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])},cn.__parse=ix,cn.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"}}},cn),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"],wv=kn(tf),kv=di([wv,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),yx=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,wx=t=>{let e;return(e=t.match(yx))?Ev(parseInt(e[1],16),e[1].length):void 0},mi="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Ro=`${mi}%`,rf=`(?:${mi}%|${mi})`,kx=`(?:${mi}(deg|grad|rad|turn)|${mi})`,Os="\\s*,\\s*",Ex=new RegExp(`^rgba?\\(\\s*${mi}${Os}${mi}${Os}${mi}\\s*(?:,\\s*${rf}\\s*)?\\)$`),Sx=new RegExp(`^rgba?\\(\\s*${Ro}${Os}${Ro}${Os}${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,Ei=(t="rgb")=>e=>(e=ml(e,t))!==void 0?e.mode===t?e:Ar[e.mode][t]?Ar[e.mode][t](e):t==="rgb"?Ar[e.mode].rgb(e):Ar.rgb[t](Ar[e.mode].rgb(e)):void 0,Ar={},Sv={},vl=[],Tv={},xx=t=>t,vt=t=>(Ar[t.mode]={...Ar[t.mode],...t.toMode},Object.keys(t.fromMode||{}).forEach(e=>{Ar[e]||(Ar[e]={}),Ar[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)}),Ei(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]/,le={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let Ue=0;function Na(t){let e=t[Ue],n=t[Ue+1];return e==="-"||e==="+"?/\d/.test(n)||n==="."&&/\d/.test(t[Ue+2]):e==="."?/\d/.test(n):/\d/.test(e)}function qu(t){if(Ue>=t.length)return!1;let e=t[Ue];if(Wu.test(e))return!0;if(e==="-"){if(t.length-Ue<2)return!1;let n=t[Ue+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[Ue]==="-"||t[Ue]==="+")&&(e+=t[Ue++]),e+=La(t),t[Ue]==="."&&/\d/.test(t[Ue+1])&&(e+=t[Ue++]+La(t)),(t[Ue]==="e"||t[Ue]==="E")&&((t[Ue+1]==="-"||t[Ue+1]==="+")&&/\d/.test(t[Ue+2])?e+=t[Ue++]+t[Ue++]+La(t):/\d/.test(t[Ue+1])&&(e+=t[Ue++]+La(t))),qu(t)){let n=bl(t);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:le.Hue,value:e*Rx[n]}:void 0}return t[Ue]==="%"?(Ue++,{type:le.Percentage,value:+e}):{type:le.Number,value:+e}}function La(t){let e="";for(;/\d/.test(t[Ue]);)e+=t[Ue++];return e}function bl(t){let e="";for(;Ue<t.length&&Cx.test(t[Ue]);)e+=t[Ue++];return e}function Ax(t){let e=bl(t);return t[Ue]==="("?(Ue++,{type:le.Function,value:e}):e==="none"?{type:le.None,value:void 0}:{type:le.Ident,value:e}}function Ox(t=""){let e=t.trim(),n=[],r;for(Ue=0;Ue<e.length;){if(r=e[Ue++],r===`
78
- `||r===" "||r===" "){for(;Ue<e.length&&(e[Ue]===`
79
- `||e[Ue]===" "||e[Ue]===" ");)Ue++;continue}if(r===",")return;if(r===")"){n.push({type:le.ParenClose});continue}if(r==="+"){if(Ue--,Na(e)){n.push(no(e));continue}return}if(r==="-"){if(Ue--,Na(e)){n.push(no(e));continue}if(qu(e)){n.push({type:le.Ident,value:bl(e)});continue}return}if(r==="."){if(Ue--,Na(e)){n.push(no(e));continue}return}if(r==="/"){for(;Ue<e.length&&(e[Ue]===`
80
- `||e[Ue]===" "||e[Ue]===" ");)Ue++;let i;if(Na(e)&&(i=no(e),i.type!==le.Hue)){n.push({type:le.Alpha,value:i});continue}if(qu(e)&&bl(e)==="none"){n.push({type:le.Alpha,value:{type:le.None,value:void 0}});continue}return}if(/\d/.test(r)){Ue--,n.push(no(e));continue}if(Wu.test(r)){Ue--,n.push(Ax(e));continue}return}return n}function Mx(t){t._i=0;let e=t[t._i++];if(!e||e.type!==le.Function||e.value!=="color"||(e=t[t._i++],e.type!==le.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!==le.None&&(r[l]=a.type===le.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===le.None||r.type===le.Number||r.type===le.Alpha||r.type===le.Percentage||e&&r.type===le.Hue){n.push(r);continue}if(r.type===le.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==le.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:le.None,value:void 0}),n.every(i=>i.type!==le.Alpha)?n:void 0}}function Nx(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==le.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===le.Hue||i.type===le.Hue||s.type===le.Hue))return r.type!==le.None&&(n.r=r.type===le.Number?r.value/255:r.value/100),i.type!==le.None&&(n.g=i.type===le.Number?i.value/255:i.value/100),s.type!==le.None&&(n.b=s.type===le.Number?s.value/255:s.value/100),o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.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)}},_e=Bx(Dx),Jt=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},Vs={mode:"rgb",channels:["r","g","b","alpha"],parse:[Ix,wx,Tx,_x,zx,"srgb"],serialize:"srgb",interpolate:{r:_e,g:_e,b:_e,alpha:{use:_e,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)},Zs=({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},Wi=t=>{let{r:e,g:n,b:r,alpha:i}=Zs(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},Ws=({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},qi=({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=Ws({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={...Vs,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Wh(Wi(t)),xyz65:Wh},toMode:{rgb:t=>qi(Zh(t)),xyz65:Zh}},pn=t=>(t=t%360)<0?t+360:t,$x=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=pn(n);return r===0||t[r-1]===void 0?s:e(s-pn(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),[]),ti=t=>$x(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),rn=[-.14861,1.78277,-.29227,-.90649,1.97294,0],jx=Math.PI/180,Fx=180/Math.PI;let qh=rn[3]*rn[4],Kh=rn[1]*rn[4],Yh=rn[1]*rn[2]-rn[0]*rn[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=(rn[4]*(e-i)-rn[2]*s)/rn[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(rn[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*(rn[0]*o+rn[1]*a),i.g=n+s*(rn[2]*o+rn[3]*a),i.b=n+s*(rn[4]*o+rn[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=pn(t.h),r=pn(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=pn(t.h),r=pn(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=pn(t.h),r=pn(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},ni=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:_e,fixup:ti},s:_e,l:_e,alpha:{use:_e,fixup:Jt}},difference:{h:tc},average:{h:ni}},Si=({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=pn(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},Ti=({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),Yt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},cs={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)*cs.X,y:jc(i)*cs.Y,z:jc(o)*cs.Z};return r!==void 0&&(a.alpha=r),a},rc=t=>qi(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/cs.X),s=Fc(e/cs.Y),o=Fc(n/cs.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(Wi(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,yl=Math.cos(Ho),wl=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*yl-a/.83*wl,i.b=o*wl+a/.83*yl,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*yl+n*wl,s=.83*(n*yl-e*wl),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=pn((Math.atan2(s,i)+Ho)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},Xh=t=>Ku(Si(t,"dlch")),Jh=t=>Ti(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:_e,a:_e,b:_e,alpha:{use:_e,fixup:Jt}}},Kx={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:Ku,dlab:t=>Ti(t,"dlab"),rgb:t=>rc(Ku(t))},fromMode:{lab65:Yu,dlab:t=>Si(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:_e,c:_e,h:{use:_e,fixup:ti},alpha:{use:_e,fixup:Jt}},difference:{h:nc},average:{h:ni}};function Yx({h:t,s:e,i:n,alpha:r}){t=pn(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:_e,fixup:ti},s:_e,i:_e,alpha:{use:_e,fixup:Jt}},difference:{h:tc},average:{h:ni}};function Qx({h:t,s:e,l:n,alpha:r}){t=pn(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}${Os}${Ro}${Os}${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!==le.None){if(r.type===le.Percentage)return;n.h=r.value}if(i.type!==le.None){if(i.type===le.Hue)return;n.s=i.value/100}if(s.type!==le.None){if(s.type===le.Hue)return;n.l=s.value/100}return o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.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:_e,fixup:ti},s:_e,l:_e,alpha:{use:_e,fixup:Jt}},difference:{h:tc},average:{h:ni}};function Lv({h:t,s:e,v:n,alpha:r}){t=pn(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:_e,fixup:ti},s:_e,v:_e,alpha:{use:_e,fixup:Jt}},difference:{h:tc},average:{h:ni}};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!==le.None){if(r.type===le.Percentage)return;n.h=r.value}if(i.type!==le.None){if(i.type===le.Hue)return;n.w=i.value/100}if(s.type!==le.None){if(s.type===le.Hue)return;n.b=s.value/100}return o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.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:_e,fixup:ti},w:_e,b:_e,alpha:{use:_e,fixup:Jt}},difference:{h:Zx},average:{h:ni}},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=>qi(Qh(t))},fromMode:{xyz65:ep,rgb:t=>ep(Wi(t))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:_e,t:_e,p:_e,alpha:{use:_e,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(Wi(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},jv=t=>qi(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:_e,a:_e,b:_e,alpha:{use:_e,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=pn(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:_e,fixup:ti},c:_e,j:_e,alpha:{use:_e,fixup:Jt}},difference:{h:nc},average:{h:ni}},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)*Yt.X,y:Jc(i)*Yt.Y,z:Jc(o)*Yt.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=Ws({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}=Zs(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/Yt.X),s=Qc(e/Yt.Y),o=Qc(n/Yt.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===le.Hue||i.type===le.Hue||s.type===le.Hue))return r.type!==le.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==le.None&&(n.a=i.type===le.Number?i.value:i.value*125/100),s.type!==le.None&&(n.b=s.type===le.Number?s.value:s.value*125/100),o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.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:_e,a:_e,b:_e,alpha:{use:_e,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!==le.None){if(r.type===le.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==le.None&&(n.c=Math.max(0,i.type===le.Number?i.value:i.value*150/100)),s.type!==le.None){if(s.type===le.Percentage)return;n.h=s.value}return o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.Number?o.value:o.value/100))),n}const cf={mode:"lch",toMode:{lab:Ti,rgb:t=>Fv(Ti(t))},fromMode:{rgb:t=>Si(Gv(t)),lab:Si},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:_e,fixup:ti},c:_e,l:_e,alpha:{use:_e,fixup:Jt}},difference:{h:nc},average:{h:ni}},b2={...cf,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>Ti(t,"lab65"),rgb:t=>rc(Ti(t,"lab65"))},fromMode:{rgb:t=>Si(ic(t),"lch65"),lab65:t=>Si(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=pn(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(Yt.X,Yt.Y,Yt.Z),y2=qv(Yt.X,Yt.Y,Yt.Z),w2=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=w2(e/Yt.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-y2));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(Yt.X,Yt.Y,Yt.Z),T2=E2(Yt.X,Yt.Y,Yt.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=Yt.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:_e,fixup:ti},c:_e,l:_e,alpha:{use:_e,fixup:Jt}},difference:{h:nc},average:{h:ni}},R2={...Vs,mode:"lrgb",toMode:{rgb:Ws},fromMode:{rgb:Zs},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:_e,u:_e,v:_e,alpha:{use:_e,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(Zs(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=>Ws(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,w=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,H=a*_+l*w+c*O,G=a*N+l*S+c*P,q=a*M+l*z+c*B;u=u-H*G/(G*G-.5*H*q)}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,w=g+b*u,O=g+b*f,N=_*_*_,S=w*w*w,P=O*O*O,M=3*h*_*_,z=3*p*w*w,B=3*m*O*O,H=6*h*h*_,G=6*p*p*w,q=6*m*m*O,oe=4.0767416621*N-3.3077115913*S+.2309699292*P-1,ke=4.0767416621*M-3.3077115913*z+.2309699292*B,ve=4.0767416621*H-3.3077115913*G+.2309699292*q,ie=ke/(ke*ke-.5*oe*ve),ge=-oe*ie,Ee=-1.2684380046*N+2.6097574011*S-.3413193965*P-1,te=-1.2684380046*M+2.6097574011*z-.3413193965*B,me=-1.2684380046*H+2.6097574011*G-.3413193965*q,ee=te/(te*te-.5*Ee*me),Se=-Ee*ee,Ae=-.0041960863*N-.7034186147*S+1.707614701*P-1,$e=-.0041960863*M-.7034186147*z+1.707614701*B,pt=-.0041960863*H-.7034186147*G+1.707614701*q,at=$e/($e*$e-.5*Ae*pt),U=-Ae*at;ge=ie>=0?ge:1e6,Se=ee>=0?Se:1e6,U=at>=0?U:1e6,o+=Math.min(ge,Math.min(Se,U))}}}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=pn(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 w={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return w.s&&(w.h=pn(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(w.alpha=t.alpha),w}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),w=h*_/f;return e.l=_*b,e.a=w*s*b,e.b=w*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===le.Hue||i.type===le.Hue||s.type===le.Hue))return r.type!==le.None&&(n.l=Math.min(Math.max(0,r.type===le.Number?r.value:r.value/100),1)),i.type!==le.None&&(n.a=i.type===le.Number?i.value:i.value*.4/100),s.type!==le.None&&(n.b=s.type===le.Number?s.value:s.value*.4/100),o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.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!==le.None){if(r.type===le.Hue)return;n.l=Math.min(Math.max(0,r.type===le.Number?r.value:r.value/100),1)}if(i.type!==le.None&&(n.c=Math.max(0,i.type===le.Number?i.value:i.value*.4/100)),s.type!==le.None){if(s.type===le.Percentage)return;n.h=s.value}return o.type!==le.None&&(n.alpha=Math.min(1,Math.max(0,o.type===le.Number?o.value:o.value/100))),n}const H2={...cf,mode:"oklch",toMode:{oklab:t=>Ti(t,"oklab"),rgb:t=>dc(Ti(t,"oklab"))},fromMode:{rgb:t=>Si(uc(t),"oklch"),oklab:t=>Si(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}=Zs(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=Ws({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={...Vs,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:t=>cp(Wi(t)),xyz65:cp},toMode:{rgb:t=>qi(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={...Vs,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={...Vs,mode:"rec2020",fromMode:{xyz65:hp,rgb:t=>hp(Wi(t))},toMode:{xyz65:gp,rgb:t=>qi(gp(t))},parse:["rec2020"],serialize:"rec2020"},$i=.0037930732552754493,Xv=Math.cbrt($i),iu=t=>Math.cbrt(t)-Xv,G2=t=>{const{r:e,g:n,b:r,alpha:i}=Zs(t),s=iu(.3*e+.622*n+.078*r+$i),o=iu(.23*e+.692*n+.078*r+$i),a=iu(.2434226892454782*e+.2047674442449682*n+.5518098665095535*r+$i),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)-$i,s=su(e-t)-$i,o=su(n+e)-$i,a=Ws({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:_e,y:_e,b:_e,alpha:{use:_e,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:_e,y:_e,z:_e,alpha:{use:_e,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:qi,xyz50:q2},fromMode:{rgb:Wi,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:_e,y:_e,z:_e,alpha:{use:_e,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:_e,i:_e,q:_e,alpha:{use:_e,fixup:Jt}}},eP=t=>Math.max(0,Math.min(1,t||0)),ou=t=>Math.round(eP(t)*255),tP=Ei("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=Ei("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=Ei(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=Ei(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:Ei(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=Ei(t.mode);t=Ei(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})}vt(Ux);vt(Wx);vt(qx);vt(Kx);vt(Jx);vt(Nv);vt(zv);vt(l2);vt(c2);vt(h2);vt(p2);vt(lf);vt(m2);vt(cf);vt(b2);vt(C2);vt(R2);vt(A2);vt(N2);vt(L2);vt(z2);const lP=vt(H2);vt(B2);vt(U2);vt(F2);vt(Vs);vt(Z2);vt(W2);vt(Y2);vt(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:wv,reason:pe().min(1),prerequisite:pe().min(1).optional()}),ff=fn().int().nonnegative().nullable(),_P=Xe({kind:kn(["exec","service"]),state:Wt("blocked"),retryAfterSeconds:ff,blockers:Dt(ab).min(1)}),yP=Xe({kind:kn(["exec","service"]),state:Wt("incompatible"),retryAfterSeconds:ff,requiredProtocol:fn().int(),supportedProtocols:Dt(fn().int())}),wP=Xe({kind:kn(["exec","service"]),state:kn(["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,yP,wP])),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 wn 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 wn{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 wn{constructor(n,r={}){super(`Backend "${n}" is not approved`,"NOT_APPROVED",n,r);K(this,"code","NOT_APPROVED");this.name="BackendNotApproved"}}class hf extends wn{constructor(n,r={}){super(`Backend "${n}" is disabled`,"DISABLED",n,r);K(this,"code","DISABLED");this.name="BackendDisabled"}}class vp extends wn{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 wn{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 wn{constructor(n,r={}){super(`Backend "${n}" is unavailable`,"BACKEND_UNAVAILABLE",n,r);K(this,"code","BACKEND_UNAVAILABLE");this.name="BackendUnavailable"}}class CP extends wn{constructor(n,r={}){super(`Backend "${n}" is incompatible`,"BACKEND_INCOMPATIBLE",n,r);K(this,"code","BACKEND_INCOMPATIBLE");this.name="BackendIncompatible"}}class RP extends wn{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 wn{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 wn{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 wn{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=Dt(ab).safeParse(t);return e.success?e.data:[]},dr=(t,e)=>(n,r,i,s)=>new wn(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:dr("BAD_REQUEST","Backend request was rejected"),INTERNAL:dr("INTERNAL","Backend request failed"),SERVER_BUSY:dr("SERVER_BUSY","Backend request intake is busy"),REQUEST_TIMEOUT:dr("REQUEST_TIMEOUT","Backend request timed out"),SCRIPT_FAILED:dr("SCRIPT_FAILED","Backend script failed"),SCRIPT_TIMEOUT:dr("SCRIPT_TIMEOUT","Backend script timed out"),BACKEND_BUSY:dr("BACKEND_BUSY","Backend is busy"),BACKEND_BODY_TOO_LARGE:dr("BACKEND_BODY_TOO_LARGE","Backend request body is too large"),BACKEND_OUTPUT_TOO_LARGE:dr("BACKEND_OUTPUT_TOO_LARGE","Backend output is too large"),CSRF_REQUIRED:dr("CSRF_REQUIRED","Backend request requires CSRF protection"),UNAUTHORIZED:dr("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 wn(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 wn(`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 wn(`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 wn(`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 yp extends Error{constructor(n,r){super(r);K(this,"status");this.name="TelemetryError",this.status=n}}const vi=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&&(!vi(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},wp=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected point in ${e} is invalid`);const n=t;if(!vi(n.time))throw new Error(`projected point time in ${e} is invalid`);if(n.value!==null&&!vi(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(!vi(n.time)||!vi(n.min)||!vi(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=>wp(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=>wp(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(!vi(a.min)||!vi(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 yp(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw XP(o)?o:new yp(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:Gs(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=kn(["session","public"]).default("session"),sC=pe().transform(t=>t.toUpperCase()).pipe(kn(["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:Wt("http"),method:sC,path:pe().refine(hb,{message:"path must be canonical and safe"}),access:fb}),aC=Xe({id:pe().min(1),transport:Wt("websocket"),path:pe().refine(hb,{message:"path must be canonical and safe"}),access:fb,protocols:Dt(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:Wt("exec"),packages:Dt(db).optional(),routes:Dt(lC).min(1,{message:"backend.routes must contain at least one route"})}).strict().superRefine((t,e)=>{mb(t.routes,e)}),uC=Xe({kind:Wt("service"),protocolVersion:fn().int().positive(),command:pb,args:Dt(oC).optional(),packages:Dt(db).optional(),routes:Dt(di([gb,aC])).min(1,{message:"backend.routes must contain at least one route"})}).strict().superRefine((t,e)=>{mb(t.routes,e)}),dC=di([cC,uC]),kp=fn().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=fn().int().positive(),fC=Wt(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=Dt(bC).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"capabilities contains duplicate capability"})}),yC=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"]}),wC=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:Wt("widget"),size:yC},{error:pf("manifest")}).strict(),EC=Xe({...vb,type:Wt("page"),route:wC},{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":gi().optional(),capabilities:Gs(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.0",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=kn(["builtin","registry","upload"]),CC=kn(["pending","approved"]),RC=kn(["ready","installing","failed"]),AC=kn(["stopped","capacity_blocked","starting","ready","backoff","failed"]),OC=Xe({kind:kn(["exec","service"]),packages:Dt(pe()).optional(),args:Dt(pe()).optional(),publicRoutes:Dt(pe()).optional()}),MC=Gs(pe(),gi()).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:kn(["http","websocket"]),path:pe(),method:kn(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:Dt(pe()).optional()}),LC=Xe({routes:Gs(pe(),NC)}),IC=Xe({w:fn(),h:fn(),minW:fn().optional(),minH:fn().optional()}),zC=Xe({defaultLocale:pe(),locales:Gs(pe(),pe())}),DC=Xe({state:AC,restartCount:fn(),consecutiveFailures:fn(),startedAt:pe().optional(),nextAttemptAt:pe().optional(),lastExit:pe().optional(),lastError:pe().optional(),recentStderr:Dt(pe()).optional(),requiredProtocol:fn().optional(),compatible:gi().optional(),supportedProtocols:Dt(fn()).optional()}),HC=Xe({sdkVersion:pe(),sharedDependencies:Gs(pe(),pe())}),_b={name:pe(),version:pe(),label:pe(),description:pe().optional(),entry:pe(),source:PC,approval:CC,enabled:gi(),capabilities:Dt(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:Wt("widget"),size:IC}),UC=Xe({..._b,type:Wt("page"),route:pe()}),yb=Jd("type",[BC,UC]),$C=Xe({plugins:Dt(yb)}),wb=t=>$C.parse(t).plugins,cu=t=>yb.parse(t),Sl=new ki;function fc(t){return Sl.get(t)??"ready"}function Ms(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 Ir(){return Bo}function VC(){return Uo.signal}function ZC(t){t===Bo&&(Z.authInitInFlight=!1)}const Z=it({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",plugins:"Plugins","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","widget-size":"Size: {width} × {height}","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":"mndw update","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":"Plugins run with full access. 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. 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",plugins:"Плагины","page-load-failed":"Не удалось загрузить страницу",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},sR={"add-widget":"Добавить виджет","widget-size":"Размер: {width} × {height}","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":"Плагины работают с полным доступом. Страница плагина работает внутри панели и может вызывать API роутера; если у плагина есть серверная часть, она запускается на роутере с правами root. Доступы в манифесте описывают запросы плагина, но не изолируют его. Устанавливайте плагины только от авторов, которым доверяете.","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}; эта панель предоставляет {hostVersion}. Плагин может не работать.","sdk-newer-minor":"Собрано для более новой версии @mndw/sdk ({pluginVersion}), чем предоставляет эта панель ({hostVersion}). Некоторые функции могут не работать.","shared-major":"Собрано для {name} {pluginVersion}; эта панель предоставляет {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 wm}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 yR(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??S_;let s=se(it(wm[0])),o=!1;const a=new Ps,l=new Ps,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(w=>w!==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 w of l)w(!0);const _=e.preparePluginCatalogGeneration(b);await _.promise,e.commitPluginCatalogGeneration(_,()=>{u(b);try{n==null||n.setItem(Sb,b)}catch{}}),o=!1;for(const w of l)w(!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 wR=I('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),kR=I('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">&times;</button>'),ER=I('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),SR=I('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),TR=I('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function xR(t,e){Ve(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=wR(),S=v(N);y(()=>{Ne(N,"id",r),E(S,e.layer.shell.title)}),A(O,N)};X(g,O=>{var N;(N=e.layer.shell)!=null&&N.title&&O(b)})}var _=T(g,2);{var w=O=>{var N=kR();y(S=>Ne(N,"aria-label",S),[()=>L("common.close")]),he("click",N,()=>e.layer.close(void 0,"action")),A(O,N)};X(_,O=>{var N;(N=e.layer.shell)!=null&&N.showCloseButton&&O(w)})}A(p,m)};X(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);y(()=>{Ne(m,"id",i),E(g,e.layer.shell.description)}),A(p,m)};X(u,p=>{var m;(m=e.layer.shell)!=null&&m.description&&p(f)})}var h=T(u,2);js(h,(p,m)=>s==null?void 0:s(p,m),()=>e.layer.contentElement),y(()=>{var p,m;Ie(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"),Ne(a,"data-locale",Z.locale),Ne(a,"aria-modal",e.layer.kind==="modal"||e.layer.kind==="drawer"?"true":void 0),Ne(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Ne(a,"aria-describedby",(m=e.layer.shell)!=null&&m.description?i:void 0),Lo(a,d(o))}),A(t,a),Ze()}ht(["click"]);var PR=I('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),CR=I("<div><!> <div></div></div>");function RR(t,e){Ve(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}}Kn(()=>{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=Un();Tt("keydown",Mo,l),Tt("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 w=S=>{var P=PR();A(S,P)},O=V(()=>s(d(p))&&d(p).backdrop);X(_,S=>{d(O)&&S(w)})}var N=T(_,2);js(N,(S,P)=>a==null?void 0:a(S,P),()=>d(p)),y((S,P)=>{Ie(g,1,`mndw-overlay-layer mndw-overlay-layer--${d(p).kind??""}`,"svelte-11o3k6p"),b=Lo(g,"",b,S),Ie(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),Ze()}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,se(it([])));K(this,"nextId",1);K(this,"maxToasts",OR);K(this,"timers",new ki)}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=I('<button type="button" class="mndw-toast__action svelte-1g105wt"> </button>'),HR=I('<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=I('<div role="region"></div>');function UR(t,e){Ve(e,!0);let n=yn(e,"store",3,je);const r=fa();let i=se(it(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,w=!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,w=!0,h.style.transition="",h.setPointerCapture(M.pointerId))},S=M=>{if(!w||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(!w||M.pointerId!==g)return;const z=M.clientX-b,B=Math.max(1,M.timeStamp-_),H=z/B;w=!1,g=null,IR(z,h.offsetWidth,H)?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)}}}$n(()=>(n().setMaxToasts(d(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var c=Un(),u=et(c);{var f=h=>{var p=BR();let m;Ct(p,21,()=>n().toasts,g=>g.id,(g,b)=>{var _=HR(),w=v(_),O=v(w),N=T(w,2);{var S=z=>{var B=DR(),H=v(B);y(()=>{B.disabled=d(b).action.busy===!0,Ne(B,"aria-busy",d(b).action.busy===!0?"true":void 0),E(H,d(b).action.label)}),he("click",B,()=>{d(b).action!==void 0&&a(d(b).action)}),A(z,B)};X(N,z=>{d(b).action!==void 0&&z(S)})}var P=T(N,2),M=v(P);R(M,"name","x"),js(_,(z,B)=>l==null?void 0:l(z,B),()=>({enabled:d(i),onDismiss:()=>n().dismiss(d(b).id)})),y((z,B)=>{Ie(_,1,`mndw-toast mndw-alert mndw-alert--${z??""}`,"svelte-1g105wt"),Ne(_,"role",d(b).variant==="error"?"alert":"status"),Ne(_,"aria-live",d(b).variant==="error"?"assertive":"polite"),E(O,d(b).message),Ne(P,"aria-label",B)},[()=>o(d(b).variant),()=>L("toast.dismiss")]),he("click",P,()=>n().dismiss(d(b).id)),A(g,_)}),y(g=>{m=Ie(p,1,"mndw-toast-host svelte-1g105wt",null,m,{"mndw-toast-host--mobile":d(i)}),Ne(p,"aria-label",g)},[()=>L("toast.region")]),A(h,p)};X(u,h=>{n().toasts.length>0&&h(f)})}A(t,c),Ze()}ht(["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 wT(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 ki([["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 Mn(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.0",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 fi(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=fi(t.sdkVersion),a=fi(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=fi(c),m=fi(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=fi(a),u=fi(l);c===null||u===null||c!==u&&r.push(`${o} @${c} (host provides @${u})`)}const i=fi(t.sdkVersion),s=fi(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=it({});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 Nr=it({});let Db=se("pending"),sd=se(0);function Op(){return d(sd)}function Qn(){return d(Db)}function bi(t){k(Db,t,!0)}function _f(t,e=!1){var r;const n={...Nr};for(const i of Object.keys(Nr))delete Nr[i];for(const i of t){const s=i.enabled&&i.approval==="approved";Nr[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 Hn(t,e,n){const r=Nr[t];if(r!==void 0){const{failureKind:i,...s}=r;Nr[t]={...s,...e==="not-runnable"?{runnable:!1}:{},status:e,...e==="failed"&&n!==void 0?{failureKind:n}:{}}}}function yf(t,e){const n=Nr[t];if(n!==void 0){const{catalog:r,...i}=n;Nr[t]={...i,...e===void 0?{}:{catalog:e}}}}function un(t){return Nr[t]}function va(){return Nr}const us="plugin-load";let od=0,Ns=0,ds=!1,Ls=!1;function Hb(){return ds||Ns>0}function Bb(){return Object.entries(va()).filter(([,t])=>t.runnable&&t.status==="failed").map(([t,e])=>({name:t,label:Mn(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:Mn(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:us,getMessage:t,action:{label:L("common.retry"),getLabel:()=>L("common.retry"),busy:Hb(),onAction:()=>gA(e,n)}})}async function gA(t,e){if(!e()||ds)return;ds=!0,Ls=!0,Is(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()&&(ds=!1,Is(t,e))}function Is(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===us);r!==void 0&&Mp(()=>r.message,t,e);return}if(Ls){je.success(L("plugin-load.loaded"),{key:us,duration:4e3}),Ls=!1;return}je.dismissKey(us)}function mA(t,e){Ns+=1,Ls=!0,Is(t,e)}function vA(t,e){Ns=Math.max(0,Ns-1),Is(t,e)}function bA(){return od+=1,Ns=0,ds=!1,Ls=!1,je.dismissKey(us),od}function _A(t){t===od&&(Ns=0,ds=!1,Ls=!1,je.dismissKey(us))}let ad=0,Qi,Hr;const Ub=15e3;function yA(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}function wA(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 wb(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)||Hn(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=>yA(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(yf(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=wA(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 fs(t){return t.generation===ad&&t.authGeneration===Ir()&&!t.authSignal.aborted}async function wf(t,e,n=e.pluginTokens.get(t.name)??0){Hn(t.name,"loading");const r=()=>fs(e)&&e.pluginTokens.get(t.name)===n,i=await TA(t,e.deps,r);return r()&&Hn(t.name,i.loaded?"loaded":"failed",i.failureKind),i.loaded}async function Vi(t){const e=Ao,n=e==null?void 0:e.entries.get(t),r=un(t);if(e===void 0||n===void 0||(r==null?void 0:r.runnable)!==!0||!fs(e))return!1;const i=bo.get(t);if(i!==void 0)return i;const s=()=>fs(e);mA(Vi,s);const o=wf(n,e).finally(()=>{bo.get(t)===o&&bo.delete(t),s()&&vA(Vi,s)});return bo.set(t,o),o}async function xA(t){const e=Ao;if(e===void 0||!fs(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;Ms(t),pc(t,!0),bi("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){yf(l,f.catalog),f.entry.version!==a.version&&(s=!0),Hn(l,"loaded");continue}if(c===void 0||h){const p=(e.pluginTokens.get(l)??0)+1;e.pluginTokens.set(l,p),o.push(wf(a,e,p));continue}(u==null?void 0:u.status)==="failed"?Hn(l,"failed",u.failureKind):(u==null?void 0:u.status)==="loading"?Hn(l,"loading"):Hn(l,"failed","error")}return await Promise.all(o),fs(e)&&(Z.pluginLoadError=null,Is(Vi,()=>fs(e))),s}async function PA(t){Qi==null||Qi.abort();const e=++ad,n=Ir(),r=VC(),i=new AbortController;Qi=i;const s=()=>i.abort(r.reason);r.aborted?s():r.addEventListener("abort",s,{once:!0});const o=()=>e===ad&&n===Ir(),a=t.fetchList??kA,l=t.catalogService,c=t.registry,u={importModule:t.importModule??(b=>import(b)),acquireStylesheet:t.acquireStylesheet??((b,_,w)=>t.pluginStylesheets.acquire(_,w,b)),checkVersions:t.checkVersions??EA,catalogService:l,registry:c,retryPlugin:Vi,getLocale:t.getLocale??(()=>"en"),loadTimeoutMs:t.loadTimeoutMs??Ub};Ao=void 0,bo.clear(),Hr!==void 0&&(Hr.signal.removeEventListener("abort",Hr.handler),Hr=void 0);const f=bA(),h=()=>{(Hr==null?void 0:Hr.handler)===h&&(Hr=void 0),_A(f)};r.aborted?h():(Hr={signal:r,handler:h},r.addEventListener("abort",h,{once:!0})),bi("pending"),_f([]),u.registry.clear(),Ms([]),fA();let p;try{let b,_=()=>{};const w=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,w])}finally{clearTimeout(b),i.signal.removeEventListener("abort",O),r.removeEventListener("abort",s),Qi===i&&(Qi=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",bi("failed"));return}if(!o())return;Ms(p),pc(p),bi("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=>wf(b,g,0))),o()&&(Z.pluginLoadError=null,Is(Vi,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()&&yf(r.name,a);const l=CA(await t.importPluginModule());return{entry:r,module:l,...a===void 0?{}:{catalog:a}}}let mr,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;mr=void 0,_o.clear(),bi("pending"),_f([]),Ms([]),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;Ms([s]),pc([s]),bi("ok"),Z.pluginLoadError=null,mr={deps:{...t,isCurrent:n},entry:s,isCurrent:n};const c=await kf(t,s,i);if(!i())return;e.register(c),Hn(s.name,"loaded"),console.log(`[mndw] Sandbox plugin loaded: ${c.entry.name}`)}catch(o){if(!i())return;s===void 0?(Z.pluginLoadError="list",bi("failed")):Hn(s.name,"failed","error"),console.error("[mndw] Failed to load sandbox plugin:",o)}}async function OA(t){const e=mr,n=un(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=()=>mr===e&&xl(i,e.isCurrent);if(!s())return!1;Hn(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),Hn(t,"loaded"),!0):!1}catch(a){return s()&&(Hn(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??(mr==null?void 0:mr.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),Ms([a.entry]),pc([a.entry]),bi("ok"),Hn(l,"loaded"),Z.pluginLoadError=null,mr={deps:o,entry:a.entry,isCurrent:s},"reloaded"):"failed"}const u=Tl(),f=()=>xl(u,s);if(!f())return"failed";const h=mr;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"}mr={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 Hn(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(_),mr=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(()=>nN);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:fn().finite().int().nonnegative(),type:pe(),group:pe(),color:pe(),interfaceId:pe()}),HA=Xe({list:Dt(DA),layout:Dt(Dt(pe())),hasPortStats:gi()}),BA=Xe({switchports:HA,usbPortCount:fn().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(yg(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===Ir(),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-BSEUXASQ.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){xy(Pl,t)}function gn(){if(!Py(Pl))throw new Error("Host services context was not set");return Ty(Pl)}function YA(t){return new Map([[Pl,t]])}var XA=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),JA=I('<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){Ve(e,!0);const n=gn();let r=se(it(Z.loginUsername)),i=se(""),s=se(it(Z.loginError??"")),o=se(!1),a=se(!1);Z.loginUsername="",Z.loginError=null;let l;$n(()=>{let ve=!0;return(async()=>{await customElements.whenDefined("mndw-input");const ge=l;if(!ve||!ge||(await ge.updateComplete,!ve))return;const Ee=T_();(Ee===null||Ee===document.body)&&ge.focus()})(),()=>{ve=!1}});function c(){return d(r).trim()!==""&&d(i)!==""}function u(){return c()&&!d(o)&&!d(a)}function f(ve){Z.localeSwitchPending||n.locale.setLocale(ve.detail.value).catch(()=>{})}function h(ve){k(r,ve.detail.value,!0),k(a,!1)}function p(ve){k(i,ve.detail.value,!0),k(a,!1)}function m(ve){const ie=ve.target,ge=ve.composedPath()[0];ve.key!=="Enter"||!(ie instanceof HTMLElement)||ie.localName!=="mndw-input"||ge instanceof HTMLButtonElement||(ve.preventDefault(),u()&&g(ve))}function g(ve){ve.preventDefault(),u()&&(k(o,!0),k(s,""),n.rci.login(d(r),d(i)).subscribe({next(ie){if(ie){const ge=d(r);Z.authenticated=!0;const Ee=Ef(n),te=Ir();Ee.catch(()=>{te===Ir()&&(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),w=v(_);Ie(w,1,"mndw-login__locale-select"),y(()=>R(w,"label",L("nav.language"))),y(()=>R(w,"value",Z.locale)),y(()=>R(w,"aria-busy",String(Z.localeSwitchPending)));var O=v(w);R(O,"value","en");var N=T(O,2);R(N,"value","ru");var S=T(w,4);y(()=>R(S,"label",L("login.username")));var P=v(S);R(P,"name","username"),R(P,"autocomplete","username"),y(()=>R(P,"value",d(r))),y(()=>R(P,"disabled",d(o))),wi(P,ve=>l=ve,()=>l);var M=T(S,2);y(()=>R(M,"label",L("login.password")));var z=v(M);R(z,"type","password"),R(z,"name","password"),R(z,"autocomplete","current-password"),y(()=>R(z,"value",d(i))),y(()=>R(z,"disabled",d(o)));var B=T(M,2),H=v(B),G=T(B,2);{var q=ve=>{var ie=XA(),ge=v(ie);y(()=>E(ge,d(s))),A(ve,ie)};X(G,ve=>{d(s)&&ve(q)})}var oe=T(G,2);Ie(oe,1,"mndw-login__submit"),R(oe,"variant","primary"),R(oe,"type","submit"),y(()=>R(oe,"disabled",!u()));var ke=v(oe);y((ve,ie)=>{Ne(b,"data-locale",Z.locale),E(H,ve),E(ke,ie)},[()=>L("login.hint"),()=>d(o)?L("login.logging-in"):L("login.submit")]),Tt("submit",_,g),Tt("mndwchange",w,f),Tt("mndwinput",P,h),he("keydown",P,m),Tt("mndwinput",z,p),he("keydown",z,m),A(t,b),Ze()}ht(["keydown"]);var eO=I('<div class="mndw-loading" role="status" aria-busy="true"> </div>'),tO=I("<!> <!> <!>",1);function nO(t,e){Ve(e,!0);const n=Qr(()=>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});ei(()=>{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=Un(),g=et(m);cm(g,()=>Z.pluginLoadRevision,b=>{o0(b,{})}),A(p,m)},h=p=>{var m=eO(),g=v(m);y(b=>{Ne(m,"data-locale",Z.locale),E(g,b)},[()=>L("app.loading")]),A(p,m)};X(c,p=>{Z.authenticated?Z.ready?p(f,1):p(h,-1):p(u)})}A(t,o),Ze()}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 En=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Wr=t=>typeof t=="string"&&t.length>0,yo=Object.freeze({"X-Mndw-Csrf":"1"}),iO=async t=>{try{return await t.json()}catch{return}};function sO(t,e){const n=En(t)?t:void 0,r=n==null?void 0:n.error,i=En(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:Wr(s)?s:"UNKNOWN",message:Wr(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 ft(t){return t("Malformed response","UNKNOWN")}function _a(t,e){const n=()=>ft(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 w=oO(f.headers);if(m&&Ip(w,"Content-Type","application/json"),p)for(const[O,N]of Object.entries(yo))Ip(w,O,N);g.headers=w}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 hs extends ba{constructor(e,n,r,i){super(e,n,r,i),this.name="MgmtError"}}const Vb=(t,e,n,r)=>new hs(t,e,n,r);function aO(t){switch(t){case"read":return km;case"mutation":return u0;case"install":return d0}}function es(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function lO(t){if(!En(t)||!es(t.maxConcurrentExecTotal)||!es(t.maxConcurrentExecPerPlugin)||!es(t.maxSupervisedServices)||!es(t.currentExec)||!es(t.reservedServices)||!Array.isArray(t.supportedServiceProtocols)||!t.supportedServiceProtocols.every(es))throw ft(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 hs&&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 hs("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 wb(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(y0,{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 hs("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 hs("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 hs?t.code==="MANIFEST_INVALID"?Wr(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 ts(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=()=>ts(n??oA),s=()=>{const a=i();for(const l of r)l(ts(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:ts(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=ts(a);ro(e,l);for(const c of r)c(ts(l))},discardPreview:()=>{ro(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=ts(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 wo extends ba{constructor(e,n,r,i){super(e,n,r,i),this.name="OpkgError"}}const An=(t,e,n,r)=>new wo(t,e,n,r);function gO(t){if(t.code!=="DEPENDENCY_CONFLICT"||!En(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(!En(t))throw ft(An);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 ft(An);if(i==="update_available"){if(typeof s!="string"||s.length===0)throw ft(An)}else if(s!==void 0)throw ft(An);return{name:e,version:n,description:r,status:i,...s===void 0?{}:{newVersion:s}}}function vO(t){if(!En(t)||!Array.isArray(t.packages))throw ft(An);const e=t.metadataUpdatedAt;if(e!==null&&typeof e!="string"||typeof e=="string"&&Number.isNaN(Date.parse(e)))throw ft(An);return{packages:t.packages.map(n=>mO(n)),metadataUpdatedAt:e}}function bO(t){if(!En(t))throw ft(An);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 ft(An);const n=["size","installedSize","installedTime"];for(const o of n)if(t[o]!==void 0&&typeof t[o]!="string")throw ft(An);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(!En(t)||t.ok!==!0||typeof t.message!="string"||!Array.isArray(t.packages)||!t.packages.every(e=>typeof e=="string"))throw ft(An);return{message:t.message,packages:t.packages}}function yO(t){if(!En(t)||t.ok!==!0||typeof t.message!="string")throw ft(An);return{message:t.message}}function wO(t=globalThis.fetch){const e=_a(t,An);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(w0,{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 yO(r)}}}class dd extends ba{constructor(e,n,r,i){super(e,n,i,r),this.name="ServiceError"}}const zs=(t,e,n,r)=>new dd(t,e,r,n);function Tf(t){if(!En(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 ft(zs);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(!En(t)||!Array.isArray(t.services))throw ft(zs);return t.services.map(e=>Tf(e))}function Dp(t){if(!En(t)||t.ok!==!0||t.service===void 0)throw ft(zs);return{ok:!0,service:Tf(t.service)}}function EO(t=globalThis.fetch){const e=_a(t,zs);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(!En(o)||o.service===void 0)throw ft(zs);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 vr=(t,e,n,r)=>new Zb(t,e,r,n),Wb=t=>t==="update"||t==="revert";function SO(t){if(!En(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!Wr(t.version)||t.operation!==void 0&&!Wb(t.operation))throw ft(vr);for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!Wr(t[i]))throw ft(vr);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(!En(t)||!Wr(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!Wr(t.targetVersion)||t.rollbackVersion!==void 0&&!Wr(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw ft(vr);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(!En(t)||!Wb(t.operation)||!Wr(t.targetVersion))throw ft(vr);return{operation:t.operation,targetVersion:t.targetVersion}}function xO(t=globalThis.fetch){const e=_a(t,vr);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 ki);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 Tr 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:{...yo}}));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:{...yo}}))}async setEnabled(e){await this.read(await mo(`${Da}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...yo},body:JSON.stringify({enabled:e})}))}async post(e,n){return await mo(`${Da}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...yo},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 Tr("MALFORMED_RESPONSE",e.status)}if(!e.ok){const i=this.errorCode(r)??`HTTP_${e.status}`;throw new Tr(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 Tr("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 Tr("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 Tr("MALFORMED_RESPONSE",200);i.lastEnumerationError=e.lastEnumerationError}if(e.lastEnumerationErrorAt!==void 0){if(typeof e.lastEnumerationErrorAt!="string")throw new Tr("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 Tr("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 Tr("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 Tr("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,se("opening"));xe(this,ta,se(null));xe(this,na,se("center"));K(this,"mobileSheet");xe(this,ra,se(void 0));xe(this,ia,se(it({})));xe(this,sa,se(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,se(it([])))}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=I('<a class="mndw-empty-state__link"> </a>'),gM=I("<mndw-button> </mndw-button>",2),mM=I('<section><h2 class="mndw-empty-state__title"> </h2> <p class="mndw-empty-state__text"> </p> <!></section>');function ji(t,e){Ve(e,!0);let n=yn(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);y(()=>{Ne(p,"href",e.action.href),E(m,e.action.label)}),A(h,p)},f=h=>{var p=gM();y(()=>R(p,"variant",e.action.variant??"primary"));var m=v(p);y(()=>E(m,e.action.label)),he("click",p,function(...g){var b;(b=e.action.onActivate)==null||b.apply(this,g)}),A(h,p)};X(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)})}y(()=>{i=Ie(r,1,"mndw-empty-state",null,i,{"mndw-empty-state--compact":n()==="compact"}),E(o,e.title),E(l,e.text)}),A(t,r),Ze()}ht(["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 Vr{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??Vr._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 Vr({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 Vr({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)??Vr._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??Vr._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}}Vr._idSeq=0;const Gn={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 yr=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 qn{}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){qn.touchHandled||(qn.touchHandled=!0,Cl(t,"mousedown"))}function Al(t){qn.touchHandled&&Cl(t,"mousemove")}function Ol(t){if(!qn.touchHandled)return;qn.pointerLeaveTimeout&&(window.clearTimeout(qn.pointerLeaveTimeout),delete qn.pointerLeaveTimeout);const e=!!He.dragElement;Cl(t,"mouseup"),e||Cl(t,"click"),qn.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"&&(qn.pointerLeaveTimeout=window.setTimeout(()=>{delete qn.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),yr&&(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),yr&&(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),yr&&(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),yr&&(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),yr&&(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),yr&&(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(qn.touchHandled&&e.isTrusted&&(qn.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),yr&&(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),yr&&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),yr&&(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),yr&&(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||qn.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 xn=new _M;class Me{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const r=Me.getGridElement(n);return r?(r.gridstack||(r.gridstack=new Me(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"||(Me.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new Me(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")||Me.addRemoveCB)&&(Me.addRemoveCB?r=Me.addRemoveCB(e,n,!0,!0):r=$.createDiv(["grid-stack",n.class],e)),Me.init(n,r)}static registerEngine(e){Me.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=$.createDiv([this.opts.placeholderClass,Gn.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(Gn),column:$.toNumber(e.getAttribute("gs-column"))||Gn.column,minRow:r||$.toNumber(e.getAttribute("gs-min-row"))||Gn.minRow,maxRow:r||$.toNumber(e.getAttribute("gs-max-row"))||Gn.maxRow,staticGrid:$.toBool(e.getAttribute("gs-static"))||Gn.staticGrid,sizeToContent:$.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||Gn.draggable.handle},removableOptions:{accept:n.itemClass||Gn.removableOptions.accept,decline:Gn.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("."+Gn.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!==Gn.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=yr),this._setStaticClass();const l=n.engineClass||Me.engineClass||Vr;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:Me.addRemoveCB?n=Me.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,Me.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)})):Me.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),Me.addRemoveCB?u=Me.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,w=s.el.style;w.transition="none",this.update(s.el,{w:b,h:_}),setTimeout(()=>w.transition=null)}const h=s.subGrid=Me.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=Me.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,Gn),o.children=s,o}return s}load(e,n=Me.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=Me.addRemoveCB;typeof n=="function"&&(Me.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)||(Me.addRemoveCB&&Me.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?Me.addRemoveCB=s:delete Me.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=Me.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?(Me.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&&Me.addRemoveCB&&Me.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&&Me.addRemoveCB&&Me.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 Me.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,Me.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),Me.updateCB&&Me.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(Me.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} '${Me.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){Me.resizeToContentCB?Me.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return Me.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(Gn.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 Me.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 xn}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)=>{xn.isDraggable(o)||xn.dragIn(o,n),r!=null&&r[a]&&(o.gridstackNode=r[a])})}movable(e,n){return this.opts.staticGrid?this:(Me.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:(Me.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&&Me._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return xn.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 xn.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)){xn.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 xn.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),Me._itemRemoving(a.el,!1),xn.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,xn.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||Me.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&&!xn.isDroppable(e)&&xn.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,r)=>Me._itemRemoving(r,!0)).on(e,"dropout",(n,r)=>Me._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))}};xn.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 xn.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;xn.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),w=r.position.top+(r.position.top>i._lastUiPosition.top?-h:f);a.x=Math.round(_/s),a.y=Math.round(w/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,xn.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&&Me._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):r._isExternal&&this.engine.restoreInitial()}}Me.renderCB=(t,e)=>{t&&(e!=null&&e.content)&&(t.textContent=e.content)};Me.resizeToContentParent=".grid-stack-item-content";Me.Utils=$;Me.Engine=Vr;Me.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",yM=/^widget-(.+):([1-9]\d*)$/;function Rn(t){const e=yM.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 wM(t,e){const n=Rn(t),r=Rn(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||wM(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=Rn(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)||Rn(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=I('<div class="mndw-grid-scroll mndw-scrollbar"><div class="grid-stack"></div></div>');function OM(t,e){Ve(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}`}$n(()=>{const f=Me.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);wi(u,f=>n=f,()=>n),A(t,c),Ze()}var MM=I('<span class="mndw-floating-panel__description"> </span>'),NM=I('<span class="mndw-floating-panel__deps"> </span>'),LM=I('<span class="mndw-floating-panel__deps mndw-floating-panel__deps--failed"> </span>'),IM=I('<mndw-button><span class="mndw-floating-panel__label"> </span> <!> <span class="mndw-floating-panel__size"> </span> <!></mndw-button>',2),zM=I('<div class="mndw-floating-panel"><!></div>');function DM(t,e){Ve(e,!0);const n=gn().registry;let r=V(()=>{const c=Z.locale;return n.getWidgets().map(u=>({widget:u,...Mn(u.entry,u.catalog,c)})).sort((u,f)=>u.label.localeCompare(f.label)||u.widget.entry.name.localeCompare(f.widget.entry.name))});function i(c){e.onAddWidget(c),e.close(void 0)}var s=zM(),o=v(s);{var a=c=>{{let u=V(()=>L("dashboard.no-widgets")),f=V(()=>L("dashboard.empty-no-plugins"));ji(c,{mode:"compact",get title(){return d(u)},get text(){return d(f)}})}},l=c=>{var u=Un(),f=et(u);Ct(f,17,()=>d(r),h=>h.widget.entry.name,(h,p)=>{const m=V(()=>d(p).widget),g=V(()=>fc(d(m).entry.name));var b=IM();R(b,"variant","secondary");var _=v(b),w=v(_),O=T(_,2);{var N=H=>{var G=MM(),q=v(G);y(()=>E(q,d(p).description)),A(H,G)};X(O,H=>{d(p).description!==""&&H(N)})}var S=T(O,2),P=v(S),M=T(S,2);{var z=H=>{var G=NM(),q=v(G);y(oe=>E(q,oe),[()=>L("dashboard.preparing")]),A(H,G)},B=H=>{var G=LM(),q=v(G);y(oe=>E(q,oe),[()=>L("dashboard.unavailable")]),A(H,G)};X(M,H=>{d(g)==="installing"?H(z):d(g)==="failed"&&H(B,1)})}y(H=>{E(w,d(p).label),E(P,H)},[()=>L("dashboard.widget-size",{width:d(m).entry.size.w,height:d(m).entry.size.h})]),he("click",b,()=>i(d(m).entry.name)),A(h,b)}),A(c,u)};X(o,c=>{d(r).length===0?c(a):c(l,-1)})}A(t,s),Ze()}ht(["click"]);function HM(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)},w=()=>{u&&(u=!1,m+=1,f=!1,_(),g==null||g.abort(),g=void 0),o(w)},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(H){f=!1,g=void 0,z.abort(),u&&!b&&m===M&&c.onError(H,P);return}B.then(H=>{u&&!b&&m===M&&c.onSuccess(H)},H=>{u&&!b&&m===M&&c.onError(H,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(w),N(),P.immediate!==!1&&O(!0))},stop:w,setIntervalMs(P){h=P,u&&N()},dispose(){b=!0,w()}}}});return Object.freeze(l)}const Of=new Map;function BM(t){return t.includes(":instance:")}function Mf(t){return Of.get(t)}function UM(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=BM(e)?UM(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=`${Cs}:${t}:instance:${e}:`;Kb(n)}function $M(t,e){return Mf(`${Cs}:${t}:instance:${e}:`)}function Wp(t,e,n){const r=`${Cs}:${t}:instance:${e}:`;Mf(r)===n&&(Kb(r),Of.delete(r))}function jM(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 FM(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,GM=/^[a-z][a-z\d+.-]*:/i;function VM(t){if(t==="")return"";if(t.startsWith("/")||t.includes("\\")||t.includes("?")||t.includes("#")||GM.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 ZM(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=VM(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=ZM(t,n);return r===void 0?void 0:{router:n,path:r}}catch{return}}function WM(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 qM=0;const KM=()=>{const t=globalThis.crypto;return(t==null?void 0:t.randomUUID)!==void 0?t.randomUUID():`event-context-${++qM}`};function YM(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=q=>a.locale.subscribeLocale(q),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(),q=>a.theme.subscribeTheme(q),h),g=el(u,q=>a.palette.subscribePalette(q),h),b=el(()=>a.telemetryGathering.get(),q=>a.telemetryGathering.subscribe(()=>q(a.telemetryGathering.get())),h).pipe(U_(q=>q!==null)),_={fetchProjected:(...q)=>a.telemetry.fetchProjected(...q),gathering$:b},w=Object.create(null);Object.defineProperties(w,{theme:{enumerable:!0,get:()=>a.theme.getTheme()},theme$:{enumerable:!0,value:m},palette:{enumerable:!0,get:()=>u()},palette$:{enumerable:!0,value:g}}),Object.freeze(w);const{service:O,dispose:N}=xf(e.name,n,a.overlayRuntime),S=KM(),P=f.createFacade(S,e.name,e.capabilities??[],h);let M=!1;const z=WM({getRouter:()=>a.navigation(),isDisposed:()=>M}),B=q=>{M||(M=!0,p.abort(),h.end(),f.disposeFacade(S),N(q))},H=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(`${Cs}:${e.name}:instance:${n}:`),shared:new Zp(`${Cs}:${e.name}:shared:`)})),device:Object.freeze(Object.assign(Object.create(null),{info:FM(r),rci:bP(jM(a.rci.driver,sb))})),i18n:iA(o,l,c,h),instanceId:n,timers:HM(p.signal,()=>a.tickerPool.create(h)),backend:YM(e),overlay:O,...H,appearance:w};return Object.setPrototypeOf(G,null),{context:Object.freeze(G),dispose:B}}function XM(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 JM(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=JM(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 Yn=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=un(t.pluginName),s=(i==null?void 0:i.status)==="loading",o=i===void 0?t.pluginName:Mn(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 QM(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(Mn(e.entry,n,Z.locale).label),t.catalogUnsubscribe=(n==null?void 0:n.subscribe(()=>{t.setManifestLabel(Mn(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,XM(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||Yn.get(t.id)!==t||t.handle!==s||Lf(t,t.onRemoveRequest,()=>{Yn.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=Yn.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=un(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:Mn(u,u.catalog,Z.locale).label:Mn(c.entry,c.catalog,Z.locale).label,{frame:h,body:p,setTileTitle:m,getTileTitle:g,setManifestLabel:b}=QM(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}),w={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 Yn.set(o,w),c!==void 0&&t_(w,c,c.catalog),w.pluginLoadPlaceholder?Lf(w,i,()=>{e_(w)},w.hostT):c!==void 0&&mc(w,c,t,e),w}function eN(t,e,n,r){if(Yn.get(t.id)!==t||!t.pluginLoadPlaceholder)return;const i=un(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 Yn.values())n.pluginLoadPlaceholder&&eN(n,n.onRemoveRequest,e,t)}function Nl(t){return Yn.get(t)}function r_(t,e){for(const n of Yn.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 rs(t,e={}){const n=Yn.get(t);n!==void 0&&(Yn.delete(t),n.themeUnsubscribe(),n.catalogUnsubscribe(),n.frame.remove(),n.handle.dispose({clearStorage:e.clearStorage??!0,closeReason:"plugin-unmount"}))}async function tN(t,e,n,r,i,s){const o=[...Yn.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 Yn)try{n.handle.dispose({clearStorage:!1,closeReason:t})}catch(r){console.error(`[mndw] Failed to unmount tile ${e}:`,r)}finally{n.themeUnsubscribe(),n.catalogUnsubscribe()}Yn.clear()}const nN=Object.freeze(Object.defineProperty({__proto__:null,destroyAllTiles:i_,ensureTileController:vc,getTileController:Nl,hydratePendingTiles:r_,refreshPluginLoadPlaceholders:n_,remountWidgetTiles:tN,removeTileController:rs},Symbol.toStringTag,{value:"Module"}));var rN=I('<div class="mndw-mobile-tile"></div>'),iN=I('<div class="mndw-mobile-dashboard mndw-scrollbar"></div>');function sN(t,e){Ve(e,!0);const n=gn(),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=Rn(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=iN();Ct(o,20,()=>e.order,a=>a,(a,l)=>{var c=rN();js(c,(u,f)=>s==null?void 0:s(u,f),()=>l),A(a,c)}),A(t,o),Ze()}var oN=I('<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),aN=I('<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 lN(t,e){Ve(e,!0);let n=se(it(Qr(()=>e.cards.map(g=>({...g}))))),r=se(null),i=it([]);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 w=[...d(n)],[O]=w.splice(g,1);O!==void 0&&(w.splice(_,0,O),k(n,w,!0))}function a(g,b){var _,w;k(r,b,!0),(w=(_=g.currentTarget).setPointerCapture)==null||w.call(_,g.pointerId)}function l(g){var _;const b=d(r);if(b!==null)for(let w=0;w<d(n).length;w+=1){if(w===b)continue;const O=(_=i[w])==null?void 0:_.getBoundingClientRect();if(O!==void 0&&g.clientY>=O.top&&g.clientY<=O.bottom){o(b,w-b),k(r,w,!0);return}}}function c(){k(r,null)}var u=aN(),f=v(u);Ct(f,23,()=>d(n),g=>g.id,(g,b,_)=>{var w=oN();let O;var N=v(w),S=v(N);R(S,"name","menu");var P=T(N,2),M=v(P),z=T(P,2),B=v(z);R(B,"variant","ghost"),y(()=>R(B,"disabled",d(_)===0)),y(()=>R(B,"aria-label",L("dashboard.move-up",{label:d(b).label})));var H=v(B);R(H,"name","arrow-up");var G=T(B,2);R(G,"variant","ghost"),y(()=>R(G,"disabled",d(_)===d(n).length-1)),y(()=>R(G,"aria-label",L("dashboard.move-down",{label:d(b).label})));var q=v(G);R(q,"name","arrow-down"),wi(w,(oe,ke)=>i[ke]=oe,oe=>i==null?void 0:i[oe],()=>[d(_)]),y(()=>{O=Ie(w,1,"mndw-order-card",null,O,{"mndw-order-card--dragging":d(r)===d(_)}),E(M,d(b).label)}),he("pointerdown",N,oe=>a(oe,d(_))),he("pointermove",N,l),he("pointerup",N,c),he("click",B,()=>o(d(_),-1)),he("click",G,()=>o(d(_),1)),A(g,w)});var h=T(f,2),p=v(h);R(p,"variant","primary");var m=v(p);y(g=>E(m,g),[()=>L("common.save")]),he("click",p,s),A(t,u),Ze()}ht(["pointerdown","pointermove","pointerup","click"]);const Vo=new Map;function s_(t){return`${Cs}:${t}:counter`}function o_(t){return Number.isSafeInteger(t)&&t>=0}function cN(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(cN(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 uN(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 dN(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=dN(a)?a:void 0,c=un(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 fN(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 Jr(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 hN=I("<mndw-button> </mndw-button>",2),pN=I("<mndw-button><mndw-icon></mndw-icon> </mndw-button> <!>",3),gN=I('<div class="mndw-dashboard__grid-wrapper"><!></div>'),mN=I('<div class="mndw-dashboard-page"><div class="mndw-dashboard__toolbar"><!></div> <!> <!></div>');function gu(t,e){Ve(e,!0);const n=500,r="dashboard-layout-save",i="dashboard-widget-removal",s=8e3,o=gn(),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=se(null),m=se(!1),g=null,b=null,_=se(it(f.matches)),w=se(it([])),O=se(it([])),N=V(()=>d(w).filter(j=>q(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,H=se(null),G=null;{const j=RM(u,{listOutcome:Qn(),getPlugin:un});if(j!==null){k(w,j.tiles,!0),k(O,j.mobileOrder,!0);const re=new Map;for(const ne of j.tiles){const Y=Rn(ne.id);Y!==null&&re.set(Y.pluginName,Math.max(re.get(Y.pluginName)??0,Y.counter))}for(const[ne,Y]of re)uN(ne,Y)}}function q(j){var Y;const re=Rn(j);if(re===null)return!1;const ne=un(re.pluginName);return ne!==void 0?ne.runnable&&ne.type==="widget"&&ne.status!=="not-runnable":((Y=l.get(re.pluginName))==null?void 0:Y.entry.type)==="widget"}function oe(j){const re=Rn(j.id);if(re===null)return!1;const ne=un(re.pluginName);return ne!==void 0&&ne.type==="widget"&&!ne.runnable}function ke(j){const re=new Set(j.map(Y=>Y.id)),ne=d(w).filter(Y=>oe(Y)&&!re.has(Y.id));return[...j,...ne]}function ve(j){const re=new Set(d(S));let ne=0;const Y=d(O).map(Be=>{if(!re.has(Be))return Be;const We=j[ne];return ne+=1,We??Be});for(const Be of j.slice(ne))Y.includes(Be)||Y.push(Be);return Y}function ie(j={tiles:ka(d(w)),mobileOrder:ka(d(O))}){if(Qn()!=="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(){Qn()==="ok"&&(clearTimeout(M),G={tiles:ka(d(w)),mobileOrder:ka(d(O))},M=setTimeout(()=>{G!==null&&ie(G)},n))}function Ee(){const j=d(H);j!==null&&(k(H,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 te(){const j=d(H);j!==null&&(k(H,null),k(w,[...d(w)],!0),d(w).splice(Math.min(j.tileIndex,d(w).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&&Ae(),ie(),je.dismiss(j.toastId))}function me(j,re){var Xn;if(P||Qn()!=="ok")return;const ne=Rn(j),Y=d(w).findIndex(cr=>cr.id===j),Be=re??d(w)[Y]??{id:j,x:0,y:0,w:1,h:1};if(ne===null||Y===-1){rs(j,{clearStorage:!0});return}Ee();const We=Nl(j),Lt=((Xn=We==null?void 0:We.handle)==null?void 0:Xn.whenReady())??null,F=`${ne.pluginName}:${ne.counter}`,ue=l.get(ne.pluginName),ze=(We==null?void 0:We.getTileTitle())||(ue===void 0?void 0:Mn(ue.entry,ue.catalog,Z.locale).label)||ne.pluginName,Ke=d(O).indexOf(j);rs(j,{clearStorage:!1}),k(w,d(w).filter(cr=>cr.id!==j),!0),k(O,d(O).filter(cr=>cr!==j),!0),ie();const Fn=je.info(L("dashboard.widget-removed",{label:ze}),{key:i,duration:s,action:{label:L("common.undo"),onAction:te}});k(H,{tile:Be,tileIndex:Y,mobileIndex:Ke===-1?d(O).length:Ke,pluginName:ne.pluginName,instanceId:F,storageRevision:$M(ne.pluginName,F),mountSettlement:Lt,toastId:Fn},!0)}function ee(j){if(Qn()!=="ok")return;const re=d(p);if(!d(_)&&re!==null){const ne=re.getGridItems().find(Y=>{var Be;return((Be=Y.gridstackNode)==null?void 0:Be.id)===j});if(ne!==void 0){re.removeWidget(ne,!0);return}}me(j)}function Se(j){k(p,j,!0),P=!0;try{for(const re of d(N)){const ne=Rn(re.id);ne!==null&&pu(c,o.pluginStylesheets,l,j,ne.pluginName,ee,{x:re.x,y:re.y,w:re.w,h:re.h,instanceId:`${ne.pluginName}:${ne.counter}`})}}finally{P=!1}}function Ae(){var ne;if(d(_)||d(p)===null)return;const j=new Map(d(w).filter(Y=>q(Y.id)).map(Y=>[Y.id,Y])),re=[];P=!0;try{for(const Y of d(p).getGridItems()){const Be=(ne=Y.gridstackNode)==null?void 0:ne.id;if(typeof Be!="string"){d(p).removeWidget(Y,!0,!1);continue}const We=j.get(Be);if(We===void 0){d(p).removeWidget(Y,!0,!1);const Lt=Rn(Be),F=Lt===null?void 0:un(Lt.pluginName),ue=(F==null?void 0:F.type)==="widget"&&!F.runnable;rs(Be,{clearStorage:!ue});continue}re.push(Be),d(p).update(Y,{x:We.x,y:We.y,w:We.w,h:We.h})}for(const Y of j.values()){if(re.includes(Y.id))continue;const Be=Rn(Y.id);Be!==null&&pu(c,o.pluginStylesheets,l,d(p),Be.pluginName,ee,{x:Y.x,y:Y.y,w:Y.w,h:Y.h,instanceId:`${Be.pluginName}:${Be.counter}`})}}finally{P=!1}}function $e(){k(p,null)}function pt(j){P||Qn()!=="ok"||(k(w,ke(j),!0),ge())}function at(j,re){fN(j,re)}function U(j){if(Qn()!=="ok")return null;const re=u(j);if(re===void 0)return null;const ne=c_(j),Y=vc(c,l,j,ne,ee,o.pluginStylesheets);return Y===null?null:(k(w,[...d(w),{id:Y.id,...SM(d(w),re)}],!0),k(O,[...d(O),Y.id],!0),ie(),Y.id)}function J(j){if(Qn()!=="ok")return null;if(d(_))return U(j);const re=d(p);if(re===null)return null;const ne=pu(c,o.pluginStylesheets,l,re,j,ee);return ne!==null?(k(O,[...d(O),ne],!0),ie(),ne):null}async function ye(j){await To();const re=[...(h==null?void 0:h.querySelectorAll(".mndw-grid-tile"))??[]].find(Y=>Y.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 Ce(){if(g!==null)return;const j=document.activeElement;let re=null;const ne=Jr(o.hostOverlay,DM,{title:L("dashboard.add-widget"),props:{onAddWidget:Y=>(re=J(Y),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 Y=(h==null?void 0:h.querySelector(".mndw-dashboard__toolbar mndw-button"))??(h==null?void 0:h.querySelector(".mndw-grid-tile__close"));Y==null||Y.focus({preventScroll:!0})}await ye(re)}})}function Te(){if(b!==null)return;k(m,!0);const j=Jr(o.hostOverlay,lN,{title:L("dashboard.arrange-widgets"),props:{cards:d(ae),onCommit:fe},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))},ae=V(()=>d(m)?d(S).flatMap(j=>{var We;const re=Rn(j);if(re===null)return[];const ne=l.get(re.pluginName),Y=ne===void 0?re.pluginName:Mn(ne.entry,ne.catalog,Z.locale).label,Be=((We=Nl(j))==null?void 0:We.getTileTitle())??"";return[{id:j,label:Be||Y}]}):[]);function fe(j){Qn()==="ok"&&(k(O,ve(j),!0),ie())}let Oe=Qn(),nt=Op(),Et=!1;function kt(){var Lt;const j=d(H);j!==null&&((Lt=un(j.pluginName))==null?void 0:Lt.type)!=="widget"&&(Ee(),je.dismiss(j.toastId));const re=d(w).filter(F=>{var ze;const ue=Rn(F.id);return ue!==null&&((ze=un(ue.pluginName))==null?void 0:ze.type)==="widget"}),ne=new Set(re.map(F=>F.id)),Y=d(O).filter(F=>ne.has(F)),Be=re.length!==d(w).length,We=Y.length!==d(O).length;for(const F of d(w)){const ue=Rn(F.id);if(ue===null||!ne.has(F.id)){rs(F.id,{clearStorage:!0}),ue!==null&&Go(ue.pluginName,`${ue.pluginName}:${ue.counter}`);continue}const ze=un(ue.pluginName);(ze==null?void 0:ze.type)==="widget"&&!ze.runnable&&rs(F.id,{clearStorage:!1})}return!Be&&!We?!1:(k(w,re,!0),k(O,Y,!0),!0)}Kn(()=>{[...Sl.entries()],Object.values(va()).map(ne=>`${ne.status}:${ne.runnable}`);const j=Qn(),re=Op();if(r_(c,l),n_(c,l),j==="ok"){if(!Et||Oe!=="ok"||nt!==re){const ne=Oe!=="ok",Y=kt();Et=!0,Ae(),(ne||Y)&&ie()}}else Et=!1;Oe=j,nt=re}),Kn(()=>{const j=d(H);j!==null&&!je.toasts.some(re=>re.id===j.toastId)&&Ee()}),$n(()=>(f.addEventListener("change",Q),window.addEventListener("pagehide",Mt),()=>{f.removeEventListener("change",Q),window.removeEventListener("pagehide",Mt)}));function Mt(){Ee(),je.dismissKey(i)}ei(()=>{z!==void 0&&clearTimeout(z),B==null||B.classList.remove("mndw-grid-tile--newly-added"),B=void 0,G!==null&&Qn()==="ok"&&ie(G),Ee(),je.dismissKey(i),g==null||g.close(),b==null||b.close(),i_("host-navigation")});var At=mN(),Le=v(At),st=v(Le);{var bt=j=>{var re=pN(),ne=et(re);R(ne,"variant","secondary");var Y=v(ne);R(Y,"name","plus"),R(Y,"aria-hidden","true");var Be=T(Y),We=T(ne,2);{var Lt=F=>{var ue=hN();R(ue,"variant","secondary");var ze=v(ue);y(Ke=>E(ze,Ke),[()=>L("dashboard.arrange-widgets")]),he("click",ue,Te),A(F,ue)};X(We,F=>{d(_)&&d(S).length>1&&F(Lt)})}y(F=>E(Be,` ${F??""}`),[()=>L("dashboard.add-widget")]),he("click",ne,Ce),A(j,re)},$t=V(()=>l.getWidgets().length>0&&d(N).length>0);X(st,j=>{d($t)&&j(bt)})}var Nt=T(Le,2);{var Qt=j=>{{let re=V(()=>L("dashboard.empty-error-title")),ne=V(()=>L("dashboard.empty-error-text"));ji(j,{get title(){return d(re)},get text(){return d(ne)}})}},Ft=j=>{{let re=V(()=>L("dashboard.no-widgets")),ne=V(()=>L("dashboard.empty-no-plugins")),Y=V(()=>({label:L("dashboard.empty-install-plugins"),href:lt.settingsTab.plugins}));ji(j,{get title(){return d(re)},get text(){return d(ne)},get action(){return d(Y)}})}},Sn=V(()=>l.getWidgets().length===0&&d(N).length===0),en=j=>{{let re=V(()=>L("dashboard.empty-title")),ne=V(()=>L("dashboard.empty-add-widget")),Y=V(()=>({label:L("dashboard.add-widget"),onActivate:Ce}));ji(j,{get title(){return d(re)},get text(){return d(ne)},get action(){return d(Y)}})}};X(Nt,j=>{Z.pluginLoadError!==null?j(Qt):d(Sn)?j(Ft,1):d(N).length===0&&j(en,2)})}var an=T(Nt,2);{var Tn=j=>{sN(j,{get order(){return d(S)},onRemoveRequest:ee})},mn=j=>{var re=gN(),ne=v(re);OM(ne,{onGridReady:Se,onGridDestroyed:$e,onWidgetRemoved:me,onLayoutChanged:pt,onWidgetResized:at}),A(j,re)};X(an,j=>{d(_)?j(Tn):j(mn,-1)})}wi(At,j=>h=j,()=>h),y(()=>Ne(At,"data-locale",Z.locale)),A(t,At),Ze()}ht(["click"]);const u_="mndw-sidebar",d_="mndw-sidebar-toggle";var vN=I('<span class="mndw-header__device"> </span>'),bN=I('<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 _N(t,e){Ve(e,!0);const n=gn(),r=fa();let i=se(it(r.matches));$n(()=>{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=bN(),l=v(a),c=v(l);y(()=>R(c,"id",d_)),R(c,"variant","ghost"),Ie(c,1,"mndw-header__menu-toggle"),y(()=>R(c,"aria-label",L("nav.toggle-menu"))),y(()=>R(c,"aria-expanded",d(i)?Z.mobileSidebarOpen:!Z.desktopSidebarCollapsed)),y(()=>R(c,"aria-controls",u_));var u=v(c);R(u,"name","menu");var f=T(c,4);{var h=P=>{var M=vN(),z=v(M);y(()=>E(z,Z.deviceInfo.deviceName)),A(P,M)};X(f,P=>{Z.deviceInfo&&P(h)})}var p=T(l,2),m=v(p);Ie(m,1,"mndw-header__locale-select"),y(()=>R(m,"label",L("nav.language"))),y(()=>R(m,"value",Z.locale)),y(()=>R(m,"aria-busy",String(Z.localeSwitchPending)));var g=v(m);R(g,"value","en");var b=T(g,2);R(b,"value","ru");var _=T(m,2);R(_,"variant","ghost"),Ie(_,1,"mndw-header__theme-toggle"),y(()=>R(_,"title",Z.theme==="dark"?L("nav.light-theme"):L("nav.dark-theme"))),y(()=>R(_,"aria-label",L("nav.color-theme")));var w=v(_);y(()=>R(w,"name",Z.theme==="dark"?"sun":"moon"));var O=T(_,2);R(O,"variant","ghost"),Ie(O,1,"mndw-header__logout");var N=v(O);R(N,"name","log-out");var S=T(N);y(P=>{Ne(a,"data-locale",Z.locale),E(S,` ${P??""}`)},[()=>L("nav.logout")]),he("click",c,function(...P){uu==null||uu.apply(this,P)}),Tt("mndwchange",m,s),he("click",_,function(...P){var M;(M=n.theme.toggleTheme)==null||M.apply(this,P)}),he("click",O,o),A(t,a),Ze()}ht(["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=un(i.entry.name);return{name:i.entry.name,label:Mn(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}=Mn(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 yN=I('<div class="mndw-sidebar-backdrop" role="presentation"></div>'),wN=I('<mndw-icon></mndw-icon> <span class="mndw-visually-hidden svelte-mfxfye"> </span>',3),kN=I("<a> <!></a>"),EN=I('<div class="mndw-sidebar__section-label"> </div> <!>',1),SN=I('<!> <nav><a> </a> <a> </a> <!> <div class="mndw-sidebar__spacer"></div> <a> </a></nav>',1);function TN(t,e){Ve(e,!0);const n=gn(),r=n.registry,i=fa();let s=se(it(i.matches)),o;const a=V(()=>d(s)?!Z.mobileSidebarOpen:Z.desktopSidebarCollapsed);let l=Qr(()=>d(s)?!Z.mobileSidebarOpen:Z.desktopSidebarCollapsed);const c=ie=>{k(s,ie.matches,!0)},u=V(()=>(Z.locale,If(r).map(ie=>({...ie,failed:ie.status!=="loaded"})))),f=V(()=>{var ie;return((ie=n.router.current)==null?void 0:ie.route.pathname)??globalThis.location.pathname});function h(ie){return(ie.length>1&&ie.endsWith("/")?ie.slice(0,-1):ie).toLowerCase()}function p(ie){const ge=h(d(f)),Ee=h(ie);return Ee==="/"?ge==="/":ge===Ee||ge.startsWith(`${Ee}/`)}function m(){d(s)&&(Z.mobileSidebarOpen=!1)}function g(ie){ie.key==="Escape"&&d(s)&&Z.mobileSidebarOpen&&(Z.mobileSidebarOpen=!1)}$n(()=>(i.addEventListener("change",c),()=>{i.removeEventListener("change",c)})),Kn(()=>{var Ee;const ie=d(a),ge=l;l=ie,!ge&&ie&&(o!=null&&o.contains(document.activeElement))&&((Ee=document.getElementById(d_))==null||Ee.focus())});var b=SN();Tt("keydown",Mo,g);var _=et(b);{var w=ie=>{var ge=yN();he("click",ge,m),A(ie,ge)};X(_,ie=>{d(s)&&Z.mobileSidebarOpen&&ie(w)})}var O=T(_,2);let N;var S=v(O);let P;var M=v(S),z=T(S,2);let B;var H=v(z),G=T(z,2);{var q=ie=>{var ge=EN(),Ee=et(ge),te=v(Ee),me=T(Ee,2);Ct(me,17,()=>d(u),ee=>ee.name,(ee,Se)=>{var Ae=kN();let $e;var pt=v(Ae),at=T(pt);{var U=J=>{var ye=wN(),Ce=et(ye);Ie(Ce,1,"mndw-sidebar__warning svelte-mfxfye"),R(Ce,"name","circle-alert"),y(()=>R(Ce,"title",L("nav.page-load-failed"))),R(Ce,"aria-hidden","true");var Te=T(Ce,2),Q=v(Te);y(ae=>E(Q,ae),[()=>L("nav.page-load-failed")]),A(J,ye)};X(at,J=>{d(Se).failed&&J(U)})}y((J,ye)=>{Ne(Ae,"href",d(Se).route),$e=Ie(Ae,1,"mndw-sidebar__link",null,$e,J),Ne(Ae,"aria-current",ye),E(pt,`${d(Se).label??""} `)},[()=>({active:p(d(Se).route)}),()=>p(d(Se).route)?"page":void 0]),he("click",Ae,m),A(ee,Ae)}),y(ee=>E(te,ee),[()=>L("nav.plugins")]),A(ie,ge)};X(G,ie=>{d(u).length>0&&ie(q)})}var oe=T(G,4);let ke;var ve=v(oe);wi(O,ie=>o=ie,()=>o),js(O,(ie,ge)=>mu==null?void 0:mu(ie,ge),()=>({enabled:d(s)&&Z.mobileSidebarOpen})),y((ie,ge,Ee,te,me,ee,Se,Ae,$e)=>{Ne(O,"id",u_),N=Ie(O,1,"mndw-sidebar",null,N,{collapsed:!d(s)&&Z.desktopSidebarCollapsed,"mobile-collapsed":d(s)&&!Z.mobileSidebarOpen}),Ne(O,"data-locale",Z.locale),O.inert=d(a),Ne(S,"href",lt.dashboard),P=Ie(S,1,"mndw-sidebar__link",null,P,ie),Ne(S,"aria-current",ge),E(M,Ee),Ne(z,"href",lt.packages),B=Ie(z,1,"mndw-sidebar__link",null,B,te),Ne(z,"aria-current",me),E(H,ee),Ne(oe,"href",lt.settings),ke=Ie(oe,1,"mndw-sidebar__link",null,ke,Se),Ne(oe,"aria-current",Ae),E(ve,$e)},[()=>({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")]),he("click",S,m),he("click",z,m),he("click",oe,m),A(t,b),Ze()}ht(["click"]);var xN=I('<div class="mndw-alert mndw-alert--danger mndw-plugin-load-alert svelte-1bwqjg3" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),PN=I('<div class="mndw-app-shell"><!> <!> <div class="mndw-app-shell__body"><!> <main class="mndw-app-shell__content"><!></main></div></div>');function CN(t,e){Ve(e,!0);const n=gn();let r=se(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 _,w,O;if(Z.authInitInFlight)return;const m=i();let g,b;try{const N=Ef(n,{preservePluginLoadError:!0});b=Ir(),g=await N}catch{(b===void 0||b===Ir())&&hc();return}if(!(g===void 0||g!==Ir())){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=(w=N==null?void 0:N.shadowRoot)==null?void 0:w.querySelector("button"))==null||O.focus()}}}var o=PN(),a=v(o);_N(a,{});var l=T(a,2);{var c=m=>{var g=Un(),b=et(g);cm(b,()=>Z.pluginLoadFailureSeq,_=>{var w=xN(),O=v(w),N=v(O),S=T(O,2);R(S,"variant","secondary"),y(()=>R(S,"disabled",Z.authInitInFlight)),y(()=>R(S,"aria-busy",Z.authInitInFlight));var P=v(S);wi(w,M=>k(r,M),()=>d(r)),y((M,z)=>{E(N,M),E(P,z)},[()=>L("app.plugin-load-error"),()=>L("common.retry")]),he("click",S,s),A(_,w)}),A(m,g)};X(l,m=>{Z.authenticated&&Z.pluginLoadError==="list"&&m(c)})}var u=T(l,2),f=v(u);TN(f,{});var h=T(f,2),p=v(h);kw(p,()=>e.children),A(t,o),Ze()}ht(["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 RN(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 AN{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=RN(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 ON=I('<div class="mndw-page-plugin__notice"> </div>'),MN=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4"><span> </span> <mndw-button> </mndw-button></div>',2),NN=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="status"> </div>'),LN=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="status"><span> </span> <mndw-button> </mndw-button></div>',2),IN=I('<div class="mndw-page-plugin__notice mndw-page-plugin__panel svelte-190o6f4" role="alert"><span> </span> <mndw-button> </mndw-button></div>',2),zN=I('<div class="mndw-page-plugin-wrap"><!> <div class="mndw-page-plugin"></div></div>');function Jp(t,e){Ve(e,!0);const n={clearStorage:!1,closeReason:"host-navigation"};let r,i=null,s=0,o=null,a=se("none"),l=se(null),c,u;const f=gn(),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(U){return r=U,{destroy(){r=void 0}}}const g=V(()=>{const U=f.router.current;return U===void 0?null:zf(U.route.pathname,f.router.pageRouteDefinitions(h))}),b=V(()=>{var U;return((U=d(g))==null?void 0:U.name)??null}),_=V(()=>d(b)===null?"ready":fc(d(b))),w=V(()=>d(b)===null?void 0:un(d(b))),O=V(()=>{var U;return((U=d(w))==null?void 0:U.status)==="loading"}),N=V(()=>{var U;return((U=d(w))==null?void 0:U.status)==="failed"}),S=V(()=>d(_)==="ready"&&!d(O)&&!d(N)?d(b):null),P=V(()=>{var ye;if(d(b)===null)return"";const U=h.get(d(b)),J=(U==null?void 0:U.entry)??d(w);return J===void 0?"":Mn(J,(U==null?void 0:U.catalog)??((ye=d(w))==null?void 0:ye.catalog),Z.locale).label}),M=V(()=>d(l)===null?"":Mn(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 U;d(b)!==null&&((U=d(w))==null?void 0:U.runnable)===!0&&!d(O)&&await Vi(d(b))}function H(){c!==void 0&&(clearTimeout(c),c=void 0),u!==void 0&&(clearTimeout(u),u=void 0)}function G(){H(),k(a,"none"),k(l,null)}function q(U,J){H(),k(a,"pending"),k(l,J),c=setTimeout(()=>{U===s&&d(a)==="pending"&&k(a,"loading")},l0),u=setTimeout(()=>{U===s&&(d(a)==="pending"||d(a)==="loading")&&k(a,"slow")},c0)}function oe(){var U;s+=1,G(),o!==null&&(o.controller.complete(),(U=o.mount)==null||U.dispose(n),o.unsubscribeTheme(),o.child.remove(),o=null)}function ke(U){var ye;if(i=U,U===null)return;const J=h.get(U);r===void 0||J===void 0||J.entry.type!=="page"||ve(J,((ye=d(g))==null?void 0:ye.name)===U?d(g).childPath:"")}function ve(U,J,ye="full"){if(r===void 0)return Promise.resolve(!1);s+=1;const Ce=s,Te=document.createElement("div");Te.className="mndw-page-plugin__mount",Te.dataset.theme=f.theme.getTheme();const Q=f.theme.subscribeTheme(At=>{Te.dataset.theme=At});r.appendChild(Te);const ae=f.router.pageRouteDefinitions(f.registry).find(At=>At.name===U.entry.name);if(ae===void 0)return Q(),Te.remove(),Promise.resolve(!1);q(Ce,U);const fe=f.router.current,Oe=new AN(ae.route,J,{navigate:(At,Le)=>fe===void 0?Promise.reject(new Error("Host router is unavailable")):fe.navigate(At,Le),getLocation:()=>({search:globalThis.location.search,hash:globalThis.location.hash})}),nt={generation:Ce,pluginName:U.entry.name,child:Te,controller:Oe,mount:null,unsubscribeTheme:Q};o=nt,Z.hostInfo;const Et=Z.deviceInfo??Gd,kt=Nf({entry:U.entry,instanceId:`${U.entry.name}:1`,deviceInfo:Et,pageRoute:Oe.pageRoute,catalogCell:U.catalog,services:p}),Mt=Jb(Te,U,kt,{pluginStylesheets:f.pluginStylesheets});return nt.mount=Mt,Mt.whenReady().then(At=>(Ce!==s?Te.remove():(H(),At?(k(a,"none"),k(l,null)):ye==="full"?(Te.replaceChildren(),k(a,"error")):(k(a,"none"),k(l,null))),At))}async function ie(U,J){var ye,Ce;return oe(),await ve(U,((ye=d(g))==null?void 0:ye.childPath)??"","loading-only")?!0:(oe(),await ve(J,((Ce=d(g))==null?void 0:Ce.childPath)??"","full"),!1)}function ge(){oe(),ke(d(S))}function Ee(U){const{detail:J}=U;o===null||J.pluginName!==i||J.register(ie(J.next,J.prior))}Kn(()=>{d(S)!==i&&(oe(),ke(d(S)))}),Kn(()=>{const U=d(g);U!==null&&(o==null?void 0:o.pluginName)===U.name&&o.controller.setPath(U.childPath)}),Kn(()=>(window.addEventListener(ld,Ee),()=>window.removeEventListener(ld,Ee))),ei(oe);var te=zN(),me=v(te);{var ee=U=>{var J=ON(),ye=v(J);y(Ce=>{Ne(J,"role",d(_)==="failed"?"alert":"status"),E(ye,Ce)},[()=>d(_)==="installing"?L("dashboard.preparing-dependencies"):L("dashboard.dependency-install-failed")]),A(U,J)},Se=U=>{var J=MN(),ye=v(J),Ce=v(ye),Te=T(ye,2);R(Te,"variant","secondary"),y(()=>R(Te,"disabled",d(O))),y(()=>R(Te,"aria-busy",d(O)?"true":void 0));var Q=v(Te);y((ae,fe)=>{Ne(J,"role",d(O)?"status":"alert"),E(Ce,ae),E(Q,fe)},[()=>L("page-plugin.load-failed",{title:d(P)}),()=>L("common.retry")]),he("click",Te,B),A(U,J)},Ae=U=>{var J=NN(),ye=v(J);y(Ce=>E(ye,Ce),[()=>L("page-plugin.opening",{title:d(M)})]),A(U,J)},$e=U=>{var J=LN(),ye=v(J),Ce=v(ye),Te=T(ye,2);R(Te,"variant","secondary");var Q=v(Te);y((ae,fe)=>{E(Ce,ae),E(Q,fe)},[()=>L("page-plugin.slow"),()=>L("common.retry")]),he("click",Te,ge),A(U,J)},pt=U=>{var J=IN(),ye=v(J),Ce=v(ye),Te=T(ye,2);R(Te,"variant","secondary");var Q=v(Te);y((ae,fe)=>{E(Ce,ae),E(Q,fe)},[()=>L("page-plugin.open-error",{title:d(M)}),()=>L("common.retry")]),he("click",Te,ge),A(U,J)};X(me,U=>{d(b)!==null&&d(_)!=="ready"?U(ee):d(N)||d(O)?U(Se,1):d(a)==="loading"?U(Ae,2):d(a)==="slow"?U($e,3):d(a)==="error"&&U(pt,4)})}var at=T(me,2);js(at,U=>m==null?void 0:m(U)),y(()=>Ne(at,"aria-busy",d(z)?"true":void 0)),A(t,te),Ze()}ht(["click"]);Ey();function ya(t,e){return()=>{let n,r,i;const s=o=>{if(n!==void 0){if(i===void 0){const a=it({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=>ya(t,()=>({}))}var DN=I('<span class="package-name svelte-84q0nr"> </span>');function HN(t,e){var n=DN(),r=v(n);y(()=>{Ne(n,"title",e.value),E(r,e.value)}),A(t,n)}var BN=I('<span class="new-version svelte-sgt4ns"> </span>'),UN=I('<span class="ver-value svelte-sgt4ns"> </span><!>',1);function $N(t,e){Ve(e,!0);var n=UN(),r=et(n),i=v(r),s=T(r);{var o=a=>{var l=BN(),c=v(l);y(()=>E(c,`→ ${e.row.newVersion??""}`)),A(a,l)};X(s,a=>{e.row.newVersion&&a(o)})}y(()=>{Ne(r,"data-col",e.colId),Ne(r,"title",e.value),E(i,e.value)}),A(t,n),Ze()}var jN=I("<span> </span>");function FN(t,e){Ve(e,!0);const n=V(()=>e.value==="update_available"?L("packages.update-available"):e.value==="available"?L("packages.available"):e.value);var r=jN(),i=v(r);y(()=>{Ie(r,1,`badge badge-${e.value??""}`,"svelte-tq54e2"),Ne(r,"data-col",e.colId),E(i,d(n))}),A(t,r),Ze()}var GN=I("<mndw-button> </mndw-button>",2);function VN(t,e){Ve(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=GN();y(()=>R(s,"variant",d(r)==="remove"?"secondary":"primary")),y(()=>R(s,"data-package",e.row.name)),R(s,"data-package-action","primary"),R(s,"data-no-expand",!0),y(()=>R(s,"disabled",d(r)==="remove"&&d(n))),y(()=>R(s,"title",d(n)?L("packages.protected"):void 0));var o=v(s);y(()=>E(o,d(i))),he("click",s,()=>e.onAction(d(r))),A(t,s),Ze()}ht(["click"]);function ZN(t){return ya(VN,e=>({onAction:n=>t(n,e.row.name)}))}var WN=I("<p> </p>"),qN=I('<p role="alert"> </p> <mndw-button> </mndw-button>',3),Ba=I('<dt class="svelte-uhnzp9"> </dt><dd class="svelte-uhnzp9"> </dd>',1),KN=I('<dl class="svelte-uhnzp9"><dt class="svelte-uhnzp9"> </dt> <dd class="svelte-uhnzp9"> </dd> <!> <!> <!> <!></dl>'),YN=I("<mndw-button> </mndw-button>",2),XN=I('<div class="detail svelte-uhnzp9"><!> <!></div>');function JN(t,e){Ve(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)));Kn(()=>{e.load(d(n))});var s=XN(),o=v(s);{var a=h=>{var p=WN(),m=v(p);y(g=>E(m,g),[()=>L("packages.loading")]),A(h,p)},l=h=>{var p=qN(),m=et(p),g=v(m),b=T(m,2);R(b,"variant","secondary");var _=v(b);y(w=>{E(g,d(i).message),E(_,w)},[()=>L("common.retry")]),he("click",b,()=>e.retry(d(n))),A(h,p)},c=h=>{var p=KN(),m=v(p),g=v(m),b=T(m,2),_=v(b),w=T(b,2);{var O=H=>{var G=Ba(),q=et(G),oe=v(q),ke=T(q),ve=v(ke);y(ie=>{E(oe,ie),E(ve,d(i).info.size)},[()=>L("packages.size")]),A(H,G)};X(w,H=>{d(i).info.size&&H(O)})}var N=T(w,2);{var S=H=>{var G=Ba(),q=et(G),oe=v(q),ke=T(q),ve=v(ke);y(ie=>{E(oe,ie),E(ve,d(i).info.installedSize)},[()=>L("packages.installed-size")]),A(H,G)};X(N,H=>{d(i).info.installedSize&&H(S)})}var P=T(N,2);{var M=H=>{var G=Ba(),q=et(G),oe=v(q),ke=T(q),ve=v(ke);y(ie=>{E(oe,ie),E(ve,d(i).info.installedTime)},[()=>L("packages.installed-time")]),A(H,G)};X(P,H=>{d(i).info.installedTime&&H(M)})}var z=T(P,2);{var B=H=>{var G=Ba(),q=et(G),oe=v(q),ke=T(q),ve=v(ke);y((ie,ge)=>{E(oe,ie),E(ve,ge)},[()=>L("packages.dependencies"),()=>d(i).info.dependencies.join(", ")]),A(H,G)};X(z,H=>{d(i).info.dependencies.length>0&&H(B)})}y(H=>{E(g,H),E(_,d(i).info.description)},[()=>L("packages.description")]),A(h,p)};X(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=YN();R(p,"variant","secondary"),y(()=>R(p,"data-package",d(n))),R(p,"data-package-action","detail"),R(p,"data-no-expand",!0);var m=v(p);y(g=>E(m,g),[()=>L("packages.remove")]),he("click",p,()=>e.onRemove()),A(h,p)};X(u,h=>{e.row.status==="update_available"&&!d(r)&&h(f)})}y(()=>{Ne(s,"data-col",e.colId),Ne(s,"data-package",d(n))}),A(t,s),Ze()}ht(["click"]);function QN(t){return ya(JN,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 eL(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 tL=I('<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){Ve(e,!0);var n=tL(),r=v(n),i=v(r),s=T(r,2),o=v(s);R(o,"variant","secondary");var a=v(o),l=T(o,2);R(l,"variant","danger");var c=v(l);y(u=>{E(i,e.message),E(a,u),E(c,e.confirmLabel)},[()=>L("common.cancel")]),he("click",o,()=>e.close(!1)),he("click",l,()=>e.close(!0)),A(t,n),Ze()}ht(["click"]);var nL=I('<span class="selected-count svelte-m3c4ux"> </span>'),rL=I('<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),iL=I('<div class="msg-cell svelte-m3c4ux" role="status"> </div>'),sL=I('<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),oL=I("<mndw-table></mndw-table>",2),aL=I('<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 lL(t,e){Ve(e,!0);const n="packages.list",r="packages.refresh";function i(C){return`packages.${C}`}let s=yn(e,"now",3,()=>new Date);const o=gn(),a=o.locale.hostT,l=o.opkgClient;let c=se(it([])),u=se(null),f=se(null),h=new Ps,p=se(""),m=se("installed"),g=se(!1),b=se(!1),_=se(""),w=se(null),O,N=0,S=!1;ei(()=>{S=!0});const P=new ki;let M=0;const z=V(()=>d(c).filter(C=>d(m)==="installed"&&C.status==="available"||d(m)==="updates"&&C.status!=="update_available"?!1:C.name.toLowerCase().includes(d(p).toLowerCase()))),B=V(()=>h.size),H=V(()=>d(c).filter(C=>C.status==="update_available").length),G=V(()=>[...h]),q=V(()=>d(z).some(C=>h.has(C.name)&&C.status==="available")),oe=V(()=>d(z).some(C=>h.has(C.name)&&C.status!=="available"&&!Ee(C.name))),ke=V(()=>d(z).some(C=>h.has(C.name)&&C.status==="update_available")),ve=V(()=>{if(d(u)===null)return a("packages.never-refreshed");if(d(f)===null)return"";const C=Math.max(0,d(f).getTime()-Date.parse(d(u)));if(C<6e4)return a("packages.just-now");const D=new Intl.RelativeTimeFormat(Z.locale,{numeric:"auto"}),ce=Math.floor(C/6e4);if(ce<60)return a("packages.refreshed-ago",{age:D.format(-ce,"minute")});const we=Math.floor(C/36e5);if(we<24)return a("packages.refreshed-ago",{age:D.format(-we,"hour")});const be=Math.floor(C/864e5);return a("packages.refreshed-ago",{age:D.format(-be,"day")})}),ie=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 Ee(C){return C==="mndw"||C==="lighttpd"}function te(){M+=1,P.clear()}function me(C){if(P.has(C))return;const D=M,ce=l.info(C);P.set(C,{status:"pending",promise:ce}),ce.then(we=>{var be;D===M&&((be=P.get(C))==null?void 0:be.status)==="pending"&&P.set(C,{status:"success",info:we})}).catch(we=>{var be;D===M&&((be=P.get(C))==null?void 0:be.status)==="pending"&&P.set(C,{status:"failure",message:we instanceof wo?we.message:a("packages.detail-failed")})})}function ee(C){var D;((D=P.get(C))==null?void 0:D.status)==="failure"&&(P.delete(C),me(C))}async function Se(C=!1){k(g,!0);try{const D=await l.list();if(S)return;k(c,D.packages,!0),k(u,D.metadataUpdatedAt,!0),k(f,s()(),!0),te(),k(b,!1),k(_,""),h.clear(),je.dismissKey(n),C||je.info(a("packages.loaded",{count:d(c).length}),{key:n})}catch(D){if(S)return;k(c,[],!0),h.clear(),k(b,!0),k(_,D instanceof wo?D.message:a("packages.load-failed"),!0)}finally{S||k(g,!1)}}async function Ae(C,D){const ce=Array.from(h).filter(we=>{const be=d(c).find(Ye=>Ye.name===we);return be!==void 0&&D(be)});if(ce.length!==0){if(C==="remove"){const be=await Jr(o.hostOverlay,Zo,{title:a("packages.confirm-remove-title"),props:{message:a("packages.confirm-remove",{names:ce.join(", ")}),confirmLabel:a("packages.remove")}}).closed;if(S)return;be.result&&await $e("remove",ce);return}await $e(C,ce)}}async function $e(C,D,ce){k(g,!0);const we=C==="install"?"packages.installing":C==="remove"?"packages.removing":"packages.updating",be=i(C);try{const Ye=C==="install"?await l.install(D):C==="remove"?await l.remove(D):await l.upgrade(D);if(S||(await Se(!0),S))return;je.success(Ye.message,{key:be})}catch(Ye){if(S)return;je.error(at(Ye,we),{key:be})}finally{S||k(g,!1),!S&&ce!==void 0&&await pt(ce)}}async function pt(C){if(await To(),S)return;const D=d(w);D!==null&&await D.updateComplete,await To();const ce=[...document.querySelectorAll("mndw-button[data-package][data-package-action]")].filter(Ye=>Ye.dataset.package===C.packageName&&!Ye.disabled),be=ce.find(Ye=>Ye.dataset.packageAction===C.source)??ce[0]??document.querySelector(".packages-panel .header-actions mndw-button");be==null||be.focus()}function at(C,D){if(!(C instanceof wo))return a("packages.action-failed",{action:a(D)});const ce=gO(C);return ce===void 0?C.message:ce.dependents.length>0?a("packages.dependency-conflict",{package:ce.package,dependents:ce.dependents.join(", ")}):a("packages.dependency-conflict-generic",{package:ce.package})}async function U(){k(g,!0);try{const C=await l.update();if(S||(await Se(!0),S))return;je.success(C.message,{key:r})}catch(C){if(S)return;je.error(C instanceof wo?C.message:a("app.error"),{key:r})}finally{S||k(g,!1)}}function J(C){const D=C.detail.value;(D==="all"||D==="installed"||D==="updates")&&k(m,D,!0)}function ye(C){k(p,C.detail.value,!0)}async function Ce(C,D="primary"){const we=await Jr(o.hostOverlay,Zo,{title:a("packages.confirm-remove-title"),props:{message:a("packages.confirm-remove",{names:C}),confirmLabel:a("packages.remove")}}).closed;S||we.result&&await $e("remove",[C],{packageName:C,source:D})}const Te={installed:0,update_available:1,available:2},Q=Oo()(HN),ae=Oo()($N),fe=Oo()(FN),Oe=QN({cache:P,load:me,retry:ee,onRemove:C=>Ce(C,"detail")}),nt=ZN((C,D)=>{if(C==="remove"){Ce(D);return}$e(C,[D],{packageName:D,source:"primary"})}),Et=V(()=>[ci()({id:"name",label:a("packages.package"),accessor:C=>C.name,sortable:!0,width:"11.25rem",renderer:Q}),ci()({id:"version",label:a("packages.version"),accessor:C=>C.version,sortable:!0,comparator:eL,renderer:ae}),ci()({id:"status",label:a("packages.status"),accessor:C=>C.status,sortable:!0,comparator:(C,D)=>Te[C]-Te[D],renderer:fe}),ci()({id:"actions",label:"",renderer:nt})]);let kt=new Ps,Mt=se(null);const At=V(()=>({expandRow:C=>a("packages.expand",{name:C}),collapseRow:C=>a("packages.collapse",{name:C})}));function Le(C){h.clear();for(const D of C.detail.selected)h.add(D)}function st(C){k(Mt,C.detail.sort,!0)}function bt(C){kt.clear();for(const D of C.detail.expanded)kt.add(D)}Kn(()=>{const C=new Set(d(z).map(D=>D.name));Qr(()=>{const D=[...kt].filter(ce=>!C.has(ce));for(const ce of D)kt.delete(ce)})}),Kn(()=>{var we;const C=(we=d(z)[0])==null?void 0:we.name,D=d(w),ce=++N;C===void 0||D===null||(async()=>{var be;await D.updateComplete,!(ce!==N||((be=d(z)[0])==null?void 0:be.name)!==C)&&D.scrollToRow(C,{align:"start"})})()}),$n(()=>{Se()});var $t=aL(),Nt=v($t),Qt=v(Nt),Ft=v(Qt),Sn=v(Ft),en=T(Ft,2);let an;var Tn=v(en),mn=T(Qt,2),j=v(mn);R(j,"variant","secondary"),y(()=>R(j,"disabled",d(g)));var re=v(j),ne=T(Nt,2),Y=v(ne);Ie(Y,1,"search-field svelte-m3c4ux"),y(()=>R(Y,"label",a("packages.search-label")));var Be=v(Y);R(Be,"type","search"),y(()=>R(Be,"value",d(p))),y(()=>R(Be,"placeholder",a("packages.search"))),wi(Be,C=>O=C,()=>O);var We=T(Y,2);y(()=>R(We,"value",d(m)));var Lt=v(We);R(Lt,"id","all");var F=v(Lt),ue=T(Lt,2);R(ue,"id","installed");var ze=v(ue),Ke=T(ue,2);R(Ke,"id","updates");var Fn=v(Ke),Xn=T(ne,2);{var cr=C=>{var D=rL(),ce=v(D),we=v(ce),be=T(ce,2);R(be,"variant","primary"),y(()=>R(be,"disabled",d(g)||!d(q)));var Ye=v(be),ot=T(be,2);R(ot,"variant","secondary"),y(()=>R(ot,"disabled",d(g)||!d(oe)));var Gt=v(ot),ut=T(ot,2);R(ut,"variant","primary"),y(()=>R(ut,"disabled",d(g)||!d(ke)));var dt=v(ut),It=T(ut,2);{var zt=gt=>{var vn=nL(),tn=v(vn);y(Jn=>E(tn,Jn),[()=>a("packages.selected",{count:d(B)})]),A(gt,vn)};X(It,gt=>{d(B)>0&&gt(zt)})}y((gt,vn,tn,Jn)=>{E(we,gt),E(Ye,vn),E(Gt,tn),E(dt,Jn)},[()=>a("packages.with-selected"),()=>a("packages.install"),()=>a("packages.remove"),()=>a("packages.update")]),he("click",be,()=>void Ae("install",gt=>gt.status==="available")),he("click",ot,()=>void Ae("remove",gt=>gt.status!=="available"&&!Ee(gt.name))),he("click",ut,()=>void Ae("upgrade",gt=>gt.status==="update_available")),A(C,D)};X(Xn,C=>{d(B)>0&&C(cr)})}var Ki=T(Xn,2),qs=v(Ki);{var de=C=>{var D=iL(),ce=v(D);y(we=>E(ce,we),[()=>a("packages.loading")]),A(C,D)},Pe=C=>{var D=sL(),ce=v(D),we=v(ce),be=T(ce,2);R(be,"variant","secondary");var Ye=v(be);y(ot=>{E(we,d(_)),E(Ye,ot)},[()=>a("common.retry")]),he("click",be,()=>void Se()),A(C,D)},Je=C=>{{let D=V(()=>a(d(c).length===0?"packages.empty":"packages.no-match")),ce=V(()=>a(d(c).length===0?"packages.empty-next":"packages.no-match-next")),we=V(()=>d(c).length===0?{label:a("packages.refresh"),onActivate:()=>void Se(),variant:"secondary"}:{label:a("packages.show-all"),onActivate:ge,variant:"secondary"});ji(C,{mode:"compact",get title(){return d(D)},get text(){return d(ce)},get action(){return d(we)}})}},ct=C=>{var D=oL();y(()=>R(D,"columns",d(Et))),y(()=>R(D,"rows",d(z))),R(D,"rowKey","name"),R(D,"virtual",!0),R(D,"rowLabel",ce=>ce.name),R(D,"selectable",!0),y(()=>R(D,"selected",d(G))),R(D,"expandable",!0),R(D,"toggleAfterColumn","name"),R(D,"expandOn","row"),y(()=>R(D,"expanded",[...kt])),y(()=>R(D,"expandedRenderer",Oe)),R(D,"columnMenu",!1),R(D,"sortMode","client"),y(()=>R(D,"sort",d(Mt))),y(()=>R(D,"labels",d(At))),Ie(D,1,"svelte-m3c4ux"),wi(D,ce=>k(w,ce),()=>d(w)),Tt("mndwselectionchange",D,Le),Tt("mndwsortchange",D,st),Tt("mndwrowexpand",D,bt),A(C,D)};X(qs,C=>{d(g)?C(de):d(b)?C(Pe,1):d(z).length===0?C(Je,2):C(ct,-1)})}y((C,D,ce,we,be)=>{Ne($t,"data-locale",Z.locale),E(Sn,C),an=Ie(en,1,"freshness svelte-m3c4ux",null,an,{stale:d(ie)}),E(Tn,d(ve)),E(re,D),E(F,ce),E(ze,we),E(Fn,be)},[()=>a("packages.title"),()=>a("packages.refresh"),()=>a("packages.all"),()=>a("packages.installed"),()=>a("packages.updates",{count:d(H)})]),he("click",j,()=>void U()),Tt("mndwinput",Be,ye),Tt("mndwchange",We,J),A(t,$t),Ze()}ht(["click"]);var cL=I('<strong> </strong><small class="svelte-gqtyao"> </small>',1);function uL(t,e){Ve(e,!0);var n=cL(),r=et(n),i=v(r),s=T(r),o=v(s);y(()=>{E(i,e.row.service.label),E(o,e.row.service.name)}),A(t,n),Ze()}var dL=I('<small class="pid svelte-1ugk9ic"> </small>'),fL=I("<span> </span> <!>",1);function hL(t,e){Ve(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=fL(),o=et(s),a=v(o),l=T(o,2);{var c=u=>{var f=dL(),h=v(f);y(p=>E(h,p),[()=>L("services.pid",{pid:e.row.service.pid})]),A(u,f)};X(l,u=>{e.row.service.pid!==void 0&&u(c)})}y(()=>{Ie(o,1,`badge ${d(r)??""}`,"svelte-1ugk9ic"),E(a,d(i))}),A(t,s),Ze()}var pL=I("<mndw-button> </mndw-button>",2),gL=I('<div class="actions svelte-2q4dea"></div>');function mL(t,e){Ve(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=gL();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=pL(),u=()=>e.onRun(o());Iw(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);y(h=>E(f,h),[()=>L(a())]),A(i,c)}),A(t,r),Ze()}function vL(t){return ya(mL,e=>({onRun:n=>t(n,e.row.service.name)}))}var bL=I("<mndw-switch></mndw-switch>",2);function _L(t,e){Ve(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=bL();y(()=>R(o,"checked",e.row.service.enabledAtBoot)),y(()=>R(o,"disabled",d(n))),y(()=>R(o,"aria-label",d(r))),y(()=>R(o,"title",d(i))),Tt("mndwchange",o,s),A(t,o),Ze()}function yL(t){return ya(_L,e=>({onToggle:n=>t(e.row.service,n)}))}var wL=I('<div class="capability svelte-3v3gj2" role="status"><strong class="svelte-3v3gj2"> </strong><span> </span></div>'),kL=I('<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),EL=I('<p role="status"> </p>'),SL=I('<div class="table-wrap svelte-3v3gj2"><mndw-table></mndw-table></div>',2),TL=I('<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 xL(t,e){Ve(e,!0);let n=se(it([]));const r=gn(),i=r.locale.hostT,s=r.serviceClient;let o=se(it({})),a=se(!1),l=se(!1),c=se(!1),u=se(!1),f=se(it({})),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()(uL),_=Oo()(hL),w=yL((Q,ae)=>void ie(Q,ae)),O=vL((Q,ae)=>void ve(Q,ae)),N=V(()=>[ci()({id:"service",label:i("services.service"),width:"10rem",renderer:b}),ci()({id:"state",label:i("services.state"),width:"7.1rem",renderer:_}),ci()({id:"autostart",label:i("services.autostart"),width:"6.7rem",align:"center",renderer:w}),ci()({id:"actions",label:i("services.actions"),width:"18rem",renderer:O})]);function S(Q,ae){k(n,d(n).map(fe=>fe.name===Q?ae:fe),!0)}function P(Q){S(Q.name,Q)}async function M(Q,ae,fe){let Oe=0;const nt=async()=>{for(;Oe<Q.length;){const Et=Q[Oe++];Et!==void 0&&await fe(Et)}};await Promise.all(Array.from({length:Math.min(ae,Q.length)},()=>nt()))}function z(Q,ae,fe,Oe){return h===ae&&(d(f)[Q]??0)===fe&&!Oe.aborted}async function B(Q,ae,fe){const Oe=d(f)[Q.name]??0;try{const nt=await s.status(Q.name,fe);z(Q.name,ae,Oe,fe)&&P(nt)}catch{z(Q.name,ae,Oe,fe)&&k(o,{...d(o),[Q.name]:!0},!0)}}async function H(Q,ae,fe){await M(Q,m,Oe=>B(Oe,ae,fe))}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 ae=await s.list();if(h!==Q)return;k(n,ae,!0),k(a,!1),await H(ae,Q,p.signal)}catch(ae){if(h!==Q||p.signal.aborted)return;k(n,[],!0),k(l,ae instanceof dd&&ae.code==="SERVICE_UNAVAILABLE",!0),k(c,!d(l)),k(a,!1)}finally{h===Q&&k(a,!1)}}async function q(Q,ae){return(await Jr(r.hostOverlay,Zo,{title:i("services.confirm-title"),props:{message:Q,confirmLabel:ae}}).closed).result===!0}async function oe(Q,ae){return q(i("services.confirm",{action:Q,name:ae}),i(`services.${Q}`))}async function ke(Q,ae){return q(i(ae?"services.confirm-enable-boot":"services.confirm-disable-boot",{name:Q}),i(ae?"services.enable-at-boot":"services.disable-at-boot"))}async function ve(Q,ae){if(!d(u)&&!((Q==="stop"||Q==="restart")&&!await oe(Q,ae))){k(f,{...d(f),[ae]:(d(f)[ae]??0)+1},!0),k(u,!0);try{const fe=await s[Q](ae);P(fe.service),k(o,{...d(o),[ae]:!1},!0)}catch{k(o,{...d(o),[ae]:!0},!0)}finally{k(u,!1)}}}async function ie(Q,ae){if(d(u)||Q.protected||Q.autostartPinned)return;const fe=Q.name;if(await ke(fe,ae)){k(f,{...d(f),[fe]:(d(f)[fe]??0)+1},!0),k(u,!0);try{const Oe=await s.setEnabled(fe,ae);S(fe,Oe.service),k(o,{...d(o),[fe]:!1},!0)}catch(Oe){Oe instanceof dd&&Oe.code==="CONFLICT"?(S(fe,{...Q,autostartPinned:!0}),k(o,{...d(o),[fe]:!1},!0)):k(o,{...d(o),[fe]:!0},!0)}finally{k(u,!1)}}}$n(()=>(G(),()=>p==null?void 0:p.abort()));var ge=TL(),Ee=v(ge),te=v(Ee),me=v(te),ee=v(me),Se=T(me,2),Ae=v(Se),$e=T(te,2);R($e,"variant","secondary"),y(()=>R($e,"disabled",d(a)||d(u)));var pt=v($e),at=T(Ee,2);{var U=Q=>{var ae=wL(),fe=v(ae),Oe=v(fe),nt=T(fe),Et=v(nt);y((kt,Mt)=>{E(Oe,kt),E(Et,Mt)},[()=>i("services.unavailable"),()=>i("services.unavailable-description")]),A(Q,ae)},J=Q=>{var ae=kL(),fe=v(ae),Oe=v(fe),nt=T(fe,2);R(nt,"variant","secondary");var Et=v(nt);y((kt,Mt)=>{E(Oe,kt),E(Et,Mt)},[()=>i("services.load-failed"),()=>i("common.retry")]),he("click",nt,()=>void G()),A(Q,ae)},ye=Q=>{var ae=EL(),fe=v(ae);y(Oe=>E(fe,Oe),[()=>i("packages.loading")]),A(Q,ae)},Ce=Q=>{{let ae=V(()=>i("services.empty")),fe=V(()=>i("services.empty-next")),Oe=V(()=>({label:i("services.refresh"),onActivate:()=>void G(),variant:"secondary"}));ji(Q,{mode:"compact",get title(){return d(ae)},get text(){return d(fe)},get action(){return d(Oe)}})}},Te=Q=>{var ae=SL(),fe=v(ae);y(()=>R(fe,"columns",d(N))),y(()=>R(fe,"rows",d(g))),R(fe,"rowKey",Oe=>Oe.service.name),R(fe,"min-width","42rem"),R(fe,"columnMenu",!1),R(fe,"rowLabel",Oe=>Oe.service.label),y(()=>R(fe,"emptyLabel",i("services.empty"))),Ie(fe,1,"svelte-3v3gj2"),A(Q,ae)};X(at,Q=>{d(l)?Q(U):d(c)?Q(J,1):d(a)&&d(n).length===0?Q(ye,2):!d(a)&&d(n).length===0?Q(Ce,3):Q(Te,-1)})}y((Q,ae,fe)=>{Ne(ge,"data-locale",Z.locale),E(ee,Q),E(Ae,ae),E(pt,fe)},[()=>i("services.title"),()=>i("services.description"),()=>i("services.refresh")]),he("click",$e,()=>void G()),A(t,ge),Ze()}ht(["click"]);function md(t){return t==="services"?lt.packageServices:lt.packages}function PL(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 CL=I("<mndw-tab> </mndw-tab>",2),RL=I('<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 AL(t,e){Ve(e,!0);const n=gn(),r=n.locale.hostT,i=V(()=>{var b;const g=((b=n.router.current)==null?void 0:b.route.pathname)??globalThis.location.pathname;return PL(g)??"packages"});function s(g){const b=tg.find(w=>w.id===g.detail.value),_=n.router.current;b!==void 0&&_!==void 0&&_.navigate(md(b.id))}var o=RL(),a=v(o);Ie(a,1,"mndw-table-controls"),y(()=>R(a,"value",d(i)));var l=v(a);Ct(l,17,()=>tg,g=>g.id,(g,b)=>{var _=CL();y(()=>R(_,"id",d(b).id));var w=v(_);y(O=>E(w,O),[()=>r(d(b).labelKey)]),A(g,_)});var c=T(l,2);R(c,"for","packages");var u=v(c);{var f=g=>{lL(g,{})};X(u,g=>{d(i)==="packages"&&g(f)})}var h=T(c,2);R(h,"for","services");var p=v(h);{var m=g=>{xL(g,{})};X(p,g=>{d(i)==="services"&&g(m)})}y(()=>Ne(o,"data-locale",Z.locale)),Tt("mndwchange",a,s),A(t,o),Ze()}function ng(t){AL(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"}],OL=[/(["']?(?: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],ML={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()}},NL={request:mo,now:()=>new Date,browser:ML};async function LL(t=NL){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:zL(c.reason)}}),r=t.now(),i=IL(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-${HL(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 IL(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 DL(n.join(`
89
- `))}function zL(t){return t instanceof Error?vd(t.message):vd(String(t))}function vd(t){return t.length>rg?`${t.slice(0,rg)}…`:t}function DL(t){let e=t;for(const n of OL)e=e.replace(n,"$1[REDACTED]");return e}function HL(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 BL=I('<section class="mndw-diagnostics-settings svelte-np0xnl"><h3 class="svelte-np0xnl"> </h3> <p class="svelte-np0xnl"> </p> <mndw-button> </mndw-button></section>',2);function UL(t,e){Ve(e,!0);const n="settings.diagnostics.download";let r=se(!1),i=!1;ei(()=>{i=!0});async function s(){k(r,!0);try{if(await LL(),i)return;je.dismissKey(n)}catch{if(i)return;je.error(L("settings.diagnostics-failed"),{key:n})}finally{i||k(r,!1)}}var o=BL(),a=v(o),l=v(a),c=T(a,2),u=v(c),f=T(c,2);R(f,"variant","secondary"),y(()=>R(f,"disabled",d(r)));var h=v(f);y((p,m,g,b)=>{Ne(o,"data-locale",Z.locale),Ne(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")]),he("click",f,()=>void s()),A(t,o),Ze()}ht(["click"]);var $L=I("<mndw-button> </mndw-button>",2);function jL(t,e){Ve(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=$L();R(r,"variant","secondary"),y(()=>R(r,"disabled",e.disabled));var i=v(r);y(s=>E(i,s),[()=>L("settings.palette.export")]),he("click",r,n),A(t,r),Ze()}ht(["click"]);var FL=I('<label class="mndw-palette-import svelte-q9ugi0"><input accept=".json,application/json" type="file" class="svelte-q9ugi0"/> <span> </span></label>');function GL(t,e){Ve(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=FL(),a=v(o),l=T(a,2),c=v(l);y((u,f)=>{Ne(a,"aria-label",u),a.disabled=e.disabled,E(c,f)},[()=>L("settings.palette-import-aria-label"),()=>L("settings.palette.drop")]),Tt("dragover",o,u=>u.preventDefault()),Tt("drop",o,s),he("change",a,i),A(t,o),Ze()}ht(["change"]);var VL=I('<li class="svelte-1cguif5"><span class="mndw-palette-preview__chip svelte-1cguif5"></span> </li>'),ZL=I('<div><h4> </h4> <ul class="mndw-palette-preview__swatches svelte-1cguif5"></ul></div>'),WL=I("<li> </li>"),qL=I('<div class="mndw-palette-preview__warnings svelte-1cguif5"><h4> </h4> <ul></ul></div>'),KL=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),YL=I('<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 XL(t,e){Ve(e,!0);const n=["dark","light"];let r=V(()=>n.map(_=>({theme:_,entries:e.warnings.filter(w=>w.theme===_)})));function i(_){return L(_==="dark"?"settings.palette.theme-dark":"settings.palette.theme-light")}var s=YL(),o=v(s),a=v(o),l=T(o,2);Ct(l,16,()=>n,_=>_,(_,w)=>{var O=ZL(),N=v(O),S=v(N),P=T(N,2);Ct(P,21,()=>nf,M=>M.token,(M,z)=>{var B=VL(),H=v(B),G=T(H);y(()=>{Lo(H,`background: ${e.palette[w][d(z).token]??""}`),E(G,` ${d(z).token??""}`)}),A(M,B)}),y(M=>E(S,M),[()=>i(w)]),A(_,O)});var c=T(l,2);Ct(c,17,()=>d(r),_=>_.theme,(_,w)=>{var O=Un(),N=et(O);{var S=P=>{var M=qL(),z=v(M),B=v(z),H=T(z,2);Ct(H,21,()=>d(w).entries,G=>G.pair,(G,q)=>{var oe=WL(),ke=v(oe);y(ve=>E(ke,ve),[()=>L("settings.palette.warning-item",{pair:d(q).pair,ratio:d(q).ratio,min:d(q).min})]),A(G,oe)}),y(G=>E(B,G),[()=>L("settings.palette.contrast-warnings",{theme:i(d(w).theme)})]),A(P,M)};X(N,P=>{d(w).entries.length>0&&P(S)})}A(_,O)});var u=T(c,2);{var f=_=>{var w=KL(),O=v(w);y(()=>E(O,e.error)),A(_,w)};X(u,_=>{e.error&&_(f)})}var h=T(u,2),p=v(h);R(p,"variant","primary"),y(()=>R(p,"disabled",e.busy));var m=v(p),g=T(p,2);R(g,"variant","ghost"),y(()=>R(g,"disabled",e.busy));var b=v(g);y((_,w,O)=>{E(a,_),E(m,w),E(b,O)},[()=>L("settings.palette.preview-note"),()=>L("settings.palette.confirm"),()=>L("settings.palette.discard")]),he("click",p,function(..._){var w;(w=e.onConfirm)==null||w.apply(this,_)}),he("click",g,function(..._){var w;(w=e.onDiscard)==null||w.apply(this,_)}),A(t,s),Ze()}ht(["click"]);var JL=I("<p> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),QL=I("<mndw-button> </mndw-button>",2),eI=I('<div class="mndw-palette-reset svelte-16mndpw"><!></div>');function tI(t,e){Ve(e,!0);let n=se(!1);function r(){e.busy||e.disabled||k(n,!0)}function i(){k(n,!1),e.onReset()}var s=eI(),o=v(s);{var a=c=>{var u=JL(),f=et(u),h=v(f),p=T(f,2);R(p,"variant","danger"),y(()=>R(p,"disabled",e.busy||e.disabled));var m=v(p),g=T(p,2);R(g,"variant","secondary"),y(()=>R(g,"disabled",e.busy||e.disabled));var b=v(g);y((_,w,O)=>{E(h,_),E(m,w),E(b,O)},[()=>L("settings.palette.reset-confirmation"),()=>L("settings.palette.reset-confirm"),()=>L("common.cancel")]),he("click",p,i),he("click",g,()=>k(n,!1)),A(c,u)},l=c=>{var u=QL();R(u,"variant","danger"),y(()=>R(u,"disabled",e.busy||e.disabled));var f=v(u);y(h=>E(f,`${h??""}${e.busy?"…":""}`),[()=>L("settings.palette.reset")]),he("click",u,r),A(c,u)};X(o,c=>{d(n)?c(a):c(l,-1)})}A(t,s),Ze()}ht(["click"]);function Ll(t){return`${Em/1048576} ${t("settings.plugin-manager.upload-limit-unit")}`}var nI=I('<div class="mndw-alert mndw-alert--danger" role="alert"> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),sg=I('<p role="status"> </p>'),rI=I("<li> </li>"),iI=I('<div class="mndw-alert mndw-alert--danger" role="alert"><ul></ul> <mndw-button> </mndw-button></div>',2),sI=I('<!> <!> <!> <div class="mndw-palette-manager__actions svelte-1adkxr0"><!> <!></div>',1),oI=I('<section class="mndw-palette-manager svelte-1adkxr0"><h3> </h3> <!> <!> <!></section>');function aI(t,e){Ve(e,!0);const n="settings.palette.commit",r="settings.palette.reset";let i=se("loading");const s=gn(),o=s.palette,a=s.locale.hostT;let l=se(""),c=se(it([])),u=se(""),f=se(null),h=se(it([])),p=!1;ei(()=>{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 _(ee,Se){const Ae=Sf(ee,a,()=>Ll(a));return ee instanceof Error&&Ae===ee.message?(console.error("[mndw] Palette operation failed:",ee),a(Se)):Ae}async function w(){if(!(d(i)!=="loading"&&d(i)!=="idle")){k(i,"loading");try{if(await o.refreshPalette(),p)return;k(l,"")}catch(ee){if(p)return;k(l,_(ee,"settings.palette.load-failed"),!0)}finally{p||k(i,"idle")}}}function O(){k(l,"")}$n(()=>{w()});function N(){k(c,[],!0),k(u,""),k(i,"importing")}function S(ee,Se){k(c,[],!0),k(u,""),k(f,ee,!0),k(h,Se,!0),o.previewOverride(ee),k(i,"previewing")}function P(ee){k(c,ee,!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(ee){if(p)return;k(u,_(ee,"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 H(){k(i,"resetting");try{if(await o.resetToDefault(),p)return;je.dismissKey(r)}catch(ee){if(p)return;je.error(_(ee,"settings.palette.operation-failed"),{key:r})}finally{p||k(i,"idle")}}var G=oI(),q=v(G),oe=v(q),ke=T(q,2);{var ve=ee=>{var Se=nI(),Ae=v(Se),$e=T(Ae);R($e,"variant","secondary"),y(()=>R($e,"disabled",d(i)!=="idle"));var pt=v($e),at=T($e,2);R(at,"variant","ghost");var U=v(at);y((J,ye)=>{E(Ae,`${d(l)??""} `),E(pt,J),E(U,ye)},[()=>a("common.retry"),()=>a("settings.plugin-manager.dismiss")]),he("click",$e,()=>void w()),he("click",at,O),A(ee,Se)};X(ke,ee=>{d(l)&&ee(ve)})}var ie=T(ke,2);{var ge=ee=>{var Se=sg(),Ae=v(Se);y($e=>E(Ae,$e),[()=>a("settings.palette.loading")]),A(ee,Se)};X(ie,ee=>{d(i)==="loading"&&ee(ge)})}var Ee=T(ie,2);{var te=ee=>{var Se=Un(),Ae=et(Se);{var $e=pt=>{{let at=V(()=>d(i)==="committing");XL(pt,{get busy(){return d(at)},get error(){return d(u)},onConfirm:()=>void z(),onDiscard:B,get palette(){return d(f)},get warnings(){return d(h)}})}};X(Ae,pt=>{d(f)&&pt($e)})}A(ee,Se)},me=ee=>{var Se=sI(),Ae=et(Se);{var $e=Te=>{var Q=sg(),ae=v(Q);y(fe=>E(ae,fe),[()=>a("settings.palette.reading")]),A(Te,Q)};X(Ae,Te=>{d(i)==="importing"&&Te($e)})}var pt=T(Ae,2);GL(pt,{get disabled(){return d(m)},onErrors:P,onImportStart:N,onPreview:S});var at=T(pt,2);{var U=Te=>{var Q=iI(),ae=v(Q);Ct(ae,20,()=>d(c),nt=>nt,(nt,Et)=>{var kt=rI(),Mt=v(kt);y(()=>E(Mt,Et)),A(nt,kt)});var fe=T(ae,2);R(fe,"variant","ghost");var Oe=v(fe);y(nt=>E(Oe,nt),[()=>a("settings.plugin-manager.dismiss")]),he("click",fe,M),A(Te,Q)};X(at,Te=>{d(i)==="importError"&&Te(U)})}var J=T(at,2),ye=v(J);jL(ye,{get disabled(){return d(g)},get read(){return o.getExportable}});var Ce=T(ye,2);{let Te=V(()=>d(i)==="resetting");tI(Ce,{get busy(){return d(Te)},get disabled(){return d(b)},onReset:()=>void H()})}A(ee,Se)};X(Ee,ee=>{d(i)==="previewing"||d(i)==="committing"?ee(te):ee(me,-1)})}y(ee=>E(oe,ee),[()=>a("settings.palette.title")]),A(t,G),Ze()}ht(["click"]);var lI=I("<mndw-option>Pseudo (en-XA)</mndw-option>",2),cI=I('<span role="status"> </span>'),uI=I("<ul><li><strong> </strong> </li> <li><strong> </strong> </li> <li><strong> </strong> </li></ul>"),dI=I("<p> </p>"),Ua=I('<p role="status"> </p>'),og=I('<div class="mndw-alert mndw-alert--danger" role="alert"><p> </p> <mndw-button> </mndw-button></div>',2),fI=I("<mndw-field><mndw-switch></mndw-switch></mndw-field> <p> </p>",3),hI=I('<p role="alert"> </p>'),pI=I("<mndw-button> </mndw-button>",2),gI=I('<p class="unsupported-banner svelte-1vnn4f1" role="alert"> </p>'),mI=I('<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),vI=I("<mndw-field><mndw-switch></mndw-switch></mndw-field> <!> <!> <!>",3),bI=I("<span> </span>"),_I=I("<li> <!></li>"),yI=I("<ul></ul>"),wI=I('<details class="persistent-rci-extenders svelte-1vnn4f1"><summary class="svelte-1vnn4f1"><!> <!></summary> <!></details>'),kI=I("<!> <!>",1),EI=I('<p> <a href="#mndw-background-router-access"> </a></p>'),SI=I('<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 TI(t,e){Ve(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=gn(),l=a.locale,c=a.persistentRci,u=l.hostT;let f=se(null),h=V(()=>{var C;return((C=d(f))==null?void 0:C.controller.auth)??"unknown"}),p=V(()=>{var D;const C=(D=d(f))==null?void 0:D.controller.support;return C==="supported"||C==="invalid"}),m=V(()=>d(p)?u("settings.controller-token-set-placeholder"):""),g=se(!1),b=se(!0),_=se(!1),w=se(""),O=se(null),N=null,S=!1,P=se(!1),M=se(!0),z=se(""),B=V(()=>{var D,ce;const C=(D=d(f))==null?void 0:D.controller.support;return((ce=d(f))==null?void 0:ce.controller.enabled)===!0&&(C==="supported"||C==="invalid")}),H=V(()=>{var C;return((C=d(f))==null?void 0:C.controller.support)==="supported"?d(f).extenders:[]}),G=V(()=>d(H).filter(C=>!C.eligible||C.state!=="live").length);Kn(()=>{var C;e.onCapabilityStateChange({visible:d(h)!=="unknown",available:((C=d(f))==null?void 0:C.controller.support)==="supported"})}),$n(()=>{q(),oe()}),ei(()=>{S=!0,k(w,""),N==null||N.abort(),N=null});async function q(){k(b,!0);try{const C=await c.getCapability();if(S)return;k(f,C,!0),k(g,d(f).controller.enabled||d(f).controller.support==="needs-token",!0),pt()}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 C=await a.mgmtClient.getTelemetry();if(S)return;k(P,C.enabled,!0)}catch{if(S)return;k(z,u("settings.telemetry-error"),!0)}finally{S||k(M,!1)}}function ke(C){const D=C.detail.checked??C.detail.value??!1,ce=d(P);k(P,D,!0),k(z,""),k(M,!0),a.mgmtClient.setTelemetry(D).then(()=>{S||(a.telemetryGathering.report(D),je.dismissKey(n))}).catch(()=>{S||(k(P,ce,!0),je.error(u("settings.telemetry-error"),{key:n}))}).finally(()=>{S||k(M,!1)})}function ve(C){k(g,C.detail.checked??C.detail.value??!1,!0),k(O,null),d(g)||(k(w,""),N==null||N.abort(),N=null)}async function ie(C){var we;const D=C.detail.checked??C.detail.value??!1,ce=((we=d(f))==null?void 0:we.controller.enabled)??!1;k(_,!0),d(f)&&k(f,{...d(f),controller:{...d(f).controller,enabled:D}},!0);try{if(await c.setEnabled(D),S||(await q(),S))return;je.dismissKey(r)}catch(be){if(S||(d(f)&&k(f,{...d(f),controller:{...d(f).controller,enabled:ce}},!0),await q(),S))return;je.error(Ee(be),{key:r})}finally{S||k(_,!1)}}function ge(C){k(w,C.detail.value,!0)}function Ee(C){if(C instanceof Tr){if(C.code==="RCI_TOKEN_INVALID")return u("settings.controller-token-rejected");if(C.code==="RCI_FIRMWARE_UNSUPPORTED")return u("settings.firmware-unsupported");if(C.code==="RCI_DEVICE_UNREACHABLE")return u("settings.device-unreachable")}return u("settings.persistent-request-failed")}async function te(){k(_,!0),k(O,null);try{const C=await c.testController(d(w));if(S)return;Se(C,i)}catch(C){S||je.error(Ee(C),{key:i})}finally{S||k(_,!1)}}async function me(){k(_,!0),k(O,null);try{const C=await c.saveController(d(w));if(S)return;Se(C,s),k(w,""),await q()}catch(C){S||je.error(Ee(C),{key:s})}finally{S||(k(w,""),k(_,!1))}}async function ee(){const D=await Jr(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||D.result!==!0)){k(_,!0);try{if(await c.clearController(),S||(k(g,!1),k(w,""),k(O,null),await q(),S))return;je.dismissKey(o)}catch(ce){S||je.error(Ee(ce),{key:o})}finally{S||k(_,!1)}}}function Se(C,D){k(O,C,!0),C.result==="valid"?je.success(u("settings.controller-token-valid"),{key:D}):C.result==="unreachable"?je.error(u("settings.device-unreachable"),{key:D}):je.dismissKey(D)}function Ae(C){Z.localeSwitchPending||l.setLocale(C.detail.value).catch(()=>{})}function $e(C){C.preventDefault();const D=document.getElementById("mndw-background-router-access");D&&(D.scrollIntoView({behavior:"smooth",block:"start"}),D.focus({preventScroll:!0}))}function pt(){if(N==null||N.abort(),!d(f)||!at(d(f))){N=null;return}const C=new AbortController;N=C,U(C.signal)}function at(C){return C.controller.support==="invalid"||C.extenders.some(D=>D.state==="establishing"||D.state==="dead")}async function U(C){let D=null;for(;!C.aborted&&d(f)&&at(d(f));){if(d(f).extenders.some(ce=>ce.state==="establishing"))D=null;else if(D===null)D=Date.now();else if(Date.now()-D>=6e4)return;if(await new Promise(ce=>{const we=window.setTimeout(ce,2e3);C.addEventListener("abort",()=>{window.clearTimeout(we),ce()},{once:!0})}),C.aborted)return;try{k(f,await c.getCapability(),!0)}catch{}}}var J=SI(),ye=v(J),Ce=v(ye),Te=v(Ce),Q=T(Ce,2);y(()=>R(Q,"label",u("settings.dark-theme"))),Ie(Q,1,"svelte-1vnn4f1");var ae=v(Q);R(ae,"id","mndw-theme-switch"),y(()=>R(ae,"checked",Z.theme==="dark"));var fe=T(Q,2);y(()=>R(fe,"label",u("settings.language.label"))),Ie(fe,1,"svelte-1vnn4f1");var Oe=v(fe);y(()=>R(Oe,"value",Z.locale)),y(()=>R(Oe,"aria-busy",String(Z.localeSwitchPending)));var nt=v(Oe);R(nt,"value","en");var Et=v(nt),kt=T(nt,2);R(kt,"value","ru");var Mt=v(kt),At=T(kt,2);{var Le=C=>{var D=lI();R(D,"value","en-XA"),A(C,D)},st=V(()=>l.getAvailableLocales().includes("en-XA"));X(At,C=>{d(st)&&C(Le)})}var bt=T(Oe,2);{var $t=C=>{var D=cI(),ce=v(D);y(we=>E(ce,we),[()=>u("settings.language.pending")]),A(C,D)};X(bt,C=>{Z.localeSwitchPending&&C($t)})}var Nt=T(ye,2);aI(Nt,{});var Qt=T(Nt,2),Ft=v(Qt),Sn=v(Ft),en=T(Ft,2);{var an=C=>{var D=uI(),ce=v(D),we=v(ce),be=v(we),Ye=T(we),ot=T(ce,2),Gt=v(ot),ut=v(Gt),dt=T(Gt),It=T(ot,2),zt=v(It),gt=v(zt),vn=T(zt);y((tn,Jn,Ks)=>{E(be,tn),E(Ye,` ${Z.deviceInfo.deviceName??""}`),E(ut,Jn),E(dt,` ${Z.deviceInfo.vendor??""}`),E(gt,Ks),E(vn,` ${Z.deviceInfo.firmwareVersion??""}`)},[()=>u("settings.name"),()=>u("settings.vendor"),()=>u("settings.firmware")]),A(C,D)},Tn=C=>{var D=dI(),ce=v(D);y(we=>E(ce,we),[()=>u("settings.device-unavailable")]),A(C,D)};X(en,C=>{Z.deviceInfo?C(an):C(Tn,-1)})}var mn=T(Qt,2),j=v(mn),re=v(j),ne=T(j,2),Y=v(ne),Be=T(ne,2);{var We=C=>{var D=Ua(),ce=v(D);y(we=>E(ce,we),[()=>u("settings.persistent-loading")]),A(C,D)},Lt=C=>{var D=kI(),ce=et(D);{var we=ut=>{var dt=og(),It=v(dt),zt=v(It),gt=T(It,2);R(gt,"variant","secondary");var vn=v(gt);y((tn,Jn)=>{E(zt,tn),E(vn,Jn)},[()=>u("settings.persistent-state-unavailable"),()=>u("common.retry")]),he("click",gt,()=>void q()),A(ut,dt)},be=ut=>{var dt=fI(),It=et(dt);y(()=>R(It,"label",u("settings.persistent-tokenless-toggle"))),Ie(It,1,"svelte-1vnn4f1");var zt=v(It);R(zt,"id","mndw-persistent-rci-enabled"),y(()=>{var tn;return R(zt,"checked",((tn=d(f))==null?void 0:tn.controller.enabled)??!1)}),y(()=>R(zt,"disabled",d(_)));var gt=T(It,2),vn=v(gt);y(tn=>E(vn,tn),[()=>u("settings.persistent-tokenless-description")]),Tt("mndwchange",zt,tn=>void ie(tn)),A(ut,dt)},Ye=ut=>{var dt=vI(),It=et(dt);y(()=>R(It,"label",u("settings.configure-persistent"))),Ie(It,1,"svelte-1vnn4f1");var zt=v(It);R(zt,"id","mndw-persistent-rci-enabled"),y(()=>R(zt,"checked",d(g))),y(()=>R(zt,"disabled",d(b)||d(_)));var gt=T(It,2);{var vn=xt=>{var mt=Ua(),Vt=v(mt);y(_n=>E(Vt,_n),[()=>u("settings.persistent-storage-disabled")]),A(xt,mt)},tn=xt=>{var mt=hI(),Vt=v(mt);y(_n=>E(Vt,_n),[()=>u("settings.persistent-storage-decrypt-failed")]),A(xt,mt)};X(gt,xt=>{var mt,Vt;((mt=d(f))==null?void 0:mt.store.state)==="disabled"?xt(vn):((Vt=d(f))==null?void 0:Vt.store.state)==="decrypt-failed"&&xt(tn,1)})}var Jn=T(gt,2);{var Ks=xt=>{var mt=Ua(),Vt=v(mt);y(_n=>E(Vt,_n),[()=>u("settings.persistent-needs-token")]),A(xt,mt)};X(Jn,xt=>{var mt;((mt=d(f))==null?void 0:mt.controller.support)==="needs-token"&&xt(Ks)})}var bc=T(Jn,2);{var bn=xt=>{var mt=mI(),Vt=et(mt);y(()=>R(Vt,"label",u("settings.controller-token"))),Ie(Vt,1,"svelte-1vnn4f1");var _n=v(Vt);R(_n,"type","password"),R(_n,"autocomplete","off"),R(_n,"aria-describedby","mndw-controller-token-hint"),y(()=>R(_n,"placeholder",d(m))),y(()=>R(_n,"value",d(w))),y(()=>R(_n,"disabled",d(_)));var Ys=T(Vt,2),_c=v(Ys),wa=T(Ys,2),Ci=v(wa);R(Ci,"variant","secondary"),y(()=>R(Ci,"disabled",d(_)||d(w)===""));var ri=v(Ci),ur=T(Ci,2);R(ur,"variant","primary"),y(()=>R(ur,"disabled",d(_)||d(w)===""));var Xs=v(ur),g_=T(ur,2);{var m_=Dr=>{var Sr=pI();R(Sr,"variant","danger"),y(()=>R(Sr,"disabled",d(_)));var Js=v(Sr);y(yc=>E(Js,yc),[()=>u("settings.clear-controller-session")]),he("click",Sr,()=>void ee()),A(Dr,Sr)};X(g_,Dr=>{d(p)&&Dr(m_)})}var v_=T(wa,2);{var b_=Dr=>{var Sr=Un(),Js=et(Sr);{var yc=Yi=>{var Qs=Ua(),wc=v(Qs);y(kc=>E(wc,kc),[()=>u("settings.update-firmware-persistent")]),A(Yi,Qs)},__=Yi=>{var Qs=gI(),wc=v(Qs);y(kc=>E(wc,kc),[()=>u("settings.controller-token-rejected")]),A(Yi,Qs)};X(Js,Yi=>{d(O).result==="unsupported-firmware"?Yi(yc):d(O).result==="invalid-token"&&Yi(__,1)})}A(Dr,Sr)};X(v_,Dr=>{d(O)&&Dr(b_)})}y((Dr,Sr,Js)=>{E(_c,Dr),E(ri,Sr),E(Xs,Js)},[()=>u("settings.controller-token-hint"),()=>u("settings.test"),()=>u("settings.save")]),Tt("mndwinput",_n,ge),he("click",Ci,()=>void te()),he("click",ur,()=>void me()),A(xt,mt)};X(bc,xt=>{var mt;(d(g)||((mt=d(f))==null?void 0:mt.controller.support)==="needs-token")&&xt(bn)})}Tt("mndwchange",zt,ve),A(ut,dt)};X(ce,ut=>{d(h)==="unknown"?ut(we):d(h)==="none"?ut(be,1):ut(Ye,-1)})}var ot=T(ce,2);{var Gt=ut=>{var dt=wI(),It=v(dt),zt=v(It);{var gt=bn=>{var xt=Ea();y(mt=>E(xt,mt),[()=>u("settings.persistent-extenders-summary-problems",{count:d(H).length,problems:d(G)})]),A(bn,xt)},vn=bn=>{var xt=Ea();y(mt=>E(xt,mt),[()=>u("settings.persistent-extenders-summary",{count:d(H).length})]),A(bn,xt)};X(zt,bn=>{d(G)>0?bn(gt):bn(vn,-1)})}var tn=T(zt,2);{var Jn=bn=>{var xt=bI(),mt=v(xt);y(Vt=>E(mt,`— ${Vt??""}`),[()=>u("settings.persistent-enumeration-stale")]),A(bn,xt)};X(tn,bn=>{d(f).stale&&bn(Jn)})}var Ks=T(It,2);{var bc=bn=>{var xt=yI();Ct(xt,21,()=>d(H),mt=>mt.identity,(mt,Vt)=>{var _n=_I(),Ys=v(_n),_c=T(Ys);{var wa=ri=>{var ur=Ea();y(Xs=>E(ur,Xs),[()=>u(`settings.extender-reason-${d(Vt).reason}`)]),A(ri,ur)},Ci=ri=>{var ur=Ea();y(Xs=>E(ur,Xs),[()=>u(`settings.extender-state-${d(Vt).state??"establishing"}`)]),A(ri,ur)};X(_c,ri=>{d(Vt).eligible?ri(Ci,-1):ri(wa)})}y(()=>E(Ys,`${(d(Vt).name||d(Vt).identity)??""}: `)),A(mt,_n)}),A(bn,xt)};X(Ks,bn=>{d(H).length>0&&bn(bc)})}A(ut,dt)};X(ot,ut=>{var dt;((dt=d(f))==null?void 0:dt.controller.support)==="supported"&&ut(Gt)})}A(C,D)};X(Be,C=>{d(b)?C(We):C(Lt,-1)})}var F=T(mn,2),ue=v(F),ze=v(ue),Ke=T(ue,2);y(()=>R(Ke,"label",u("settings.telemetry-toggle"))),Ie(Ke,1,"svelte-1vnn4f1");var Fn=v(Ke);R(Fn,"id","mndw-telemetry-enabled"),y(()=>R(Fn,"checked",d(P))),y(()=>R(Fn,"disabled",d(M)||!d(B)));var Xn=T(Ke,2),cr=v(Xn),Ki=T(Xn,2);{var qs=C=>{var D=EI(),ce=v(D),we=T(ce),be=v(we);y((Ye,ot)=>{E(ce,`${Ye??""} `),E(be,ot)},[()=>u("settings.telemetry-session-note"),()=>u("settings.telemetry-session-link")]),he("click",we,$e),A(C,D)};X(Ki,C=>{d(B)||C(qs)})}var de=T(Ki,2),Pe=v(de),Je=T(de,2);{var ct=C=>{var D=og(),ce=v(D),we=v(ce),be=T(ce,2);R(be,"variant","secondary");var Ye=v(be);y(ot=>{E(we,d(z)),E(Ye,ot)},[()=>u("common.retry")]),he("click",be,()=>void oe()),A(C,D)};X(Je,C=>{d(z)&&C(ct)})}y((C,D,ce,we,be,Ye,ot,Gt,ut,dt,It)=>{Ne(J,"data-locale",Z.locale),E(Te,C),E(Et,D),E(Mt,ce),E(Sn,we),Ne(mn,"aria-label",be),E(re,Ye),E(Y,ot),Ne(F,"aria-label",Gt),E(ze,ut),E(cr,dt),E(Pe,It)},[()=>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")]),Tt("mndwchange",ae,function(...C){var D;(D=a.theme.toggleTheme)==null||D.apply(this,C)}),Tt("mndwchange",Oe,Ae),Tt("mndwchange",Fn,ke),A(t,J),Ze()}ht(["click"]);var xI=I('<span class="mndw-installed__description svelte-egoe9l"> </span>'),PI=I('<span class="mndw-installed__builtin svelte-egoe9l"> </span>'),CI=I('<span class="mndw-installed__deps-badge svelte-egoe9l"> </span>'),RI=I('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed svelte-egoe9l"> </span>'),AI=I('<span class="mndw-installed__deps-badge mndw-installed__deps-badge--failed mndw-installed__load-failed-badge svelte-egoe9l"> </span>'),ag=I('<span class="mndw-installed__version-badge svelte-egoe9l"> </span>'),OI=I('<p class="mndw-installed__load-failed-reason svelte-egoe9l"> </p>'),MI=I('<!> <div class="mndw-installed__actions svelte-egoe9l"><mndw-button> </mndw-button></div>',3),lg=I('<p class="mndw-installed__version-warning svelte-egoe9l"> </p>'),NI=I('<p class="mndw-installed__backend svelte-egoe9l"> </p>'),LI=I("<mndw-field><mndw-switch></mndw-switch></mndw-field>",2),II=I("<mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),zI=I('<div><span class="svelte-egoe9l"> </span> <!></div>'),cg=I("<mndw-button> </mndw-button>",2),DI=I('<div class="mndw-installed__confirmation svelte-egoe9l"><p class="svelte-egoe9l"> </p> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),HI=I("<!> <!>",1),BI=I('<p class="mndw-installed__runtime svelte-egoe9l"> </p>'),UI=I('<li class="mndw-installed__item svelte-egoe9l"><div class="mndw-installed__identity svelte-egoe9l"><strong class="svelte-egoe9l"> </strong> <!> <span class="svelte-egoe9l"> </span></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),$I=I('<ul class="mndw-installed__list svelte-egoe9l"></ul>'),jI=I('<section class="mndw-installed svelte-egoe9l" aria-labelledby="mndw-installed-title"><h3 id="mndw-installed-title" class="svelte-egoe9l"> </h3> <!></section>');function FI(t,e){Ve(e,!0);function n(P){const M=[],z=Object.values(P.routes??{}),B=z.filter(G=>G.transport==="http").length,H=z.filter(G=>G.transport==="websocket").length;return B>0&&M.push(L("settings.plugin-manager.endpoint",{count:B})),H>0&&M.push(L("settings.plugin-manager.websocket",{count:H})),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=yn(e,"rowStateFor",3,()=>{}),c=yn(e,"capabilityVisible",3,!1),u=yn(e,"capabilityAvailable",3,!1),f=yn(e,"onRestart",3,()=>{}),h=yn(e,"onRefresh",3,()=>{}),p=yn(e,"onKeepNotice",3,()=>{}),m=it({});function g(P){var z;const M=(z=un(P))==null?void 0:z.failureKind;M===void 0||m[P]!==void 0||(m[P]=M,Vi(P).catch(()=>!1).finally(()=>{delete m[P]}))}var b=jI(),_=v(b),w=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"}));ji(P,{mode:"compact",get title(){return d(M)},get text(){return d(z)},get action(){return d(B)}})}},S=P=>{var M=$I();Ct(M,21,()=>e.items,z=>z.name,(z,B)=>{const H=V(()=>n(d(B).backend)),G=V(()=>hA(d(B).name)),q=V(()=>o(d(B).lock)),oe=V(()=>fc(d(B).name)),ke=V(()=>l()(d(B).name)),ve=V(()=>{var de,Pe;return((de=d(ke))==null?void 0:de.state)==="error"?"danger":((Pe=d(ke))==null?void 0:Pe.state)==="notice-rejected"?"warning":"info"}),ie=V(()=>{var de;return((de=d(ke))==null?void 0:de.state)==="error"?"alert":"status"}),ge=V(()=>{var de,Pe;return((de=d(ke))==null?void 0:de.state)==="working"||((Pe=d(ke))==null?void 0:Pe.state)==="reconciling"}),Ee=V(()=>un(d(B).name)),te=V(()=>{var de;return Mn(d(B),(de=d(Ee))==null?void 0:de.catalog,Z.locale)}),me=V(()=>{var de;return d(B).enabled&&d(B).approval==="approved"&&((de=d(Ee))==null?void 0:de.runnable)===!0}),ee=V(()=>{var de;return d(me)&&((de=d(Ee))==null?void 0:de.status)==="failed"}),Se=V(()=>m[d(B).name]!==void 0),Ae=V(()=>d(me)&&(d(ee)||d(Se))),$e=V(()=>{var de;return d(ee)?(de=d(Ee))==null?void 0:de.failureKind:m[d(B).name]}),pt=V(()=>d($e)===void 0?void 0:r(d($e)));var at=UI(),U=v(at),J=v(U),ye=v(J),Ce=T(J,2);{var Te=de=>{var Pe=xI(),Je=v(Pe);y(()=>E(Je,d(te).description)),A(de,Pe)};X(Ce,de=>{d(te).description!==void 0&&de(Te)})}var Q=T(Ce,2),ae=v(Q),fe=T(U,2),Oe=v(fe),nt=v(Oe),Et=T(Oe,2),kt=v(Et),Mt=T(Et,2);{var At=de=>{var Pe=PI(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L(d(B).source==="builtin"?"settings.plugin-manager.builtin":"settings.plugin-manager.uploaded")]),A(de,Pe)};X(Mt,de=>{(d(B).source==="builtin"||d(B).source==="upload")&&de(At)})}var Le=T(Mt,2);{var st=de=>{var Pe=CI(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L("settings.plugin-manager.installing-dependencies")]),A(de,Pe)},bt=de=>{var Pe=RI(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L("settings.plugin-manager.dependency-install-failed")]),A(de,Pe)};X(Le,de=>{d(oe)==="installing"?de(st):d(oe)==="failed"&&de(bt,1)})}var $t=T(Le,2);{var Nt=de=>{var Pe=AI(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L("settings.plugin-manager.plugin-load-failed")]),A(de,Pe)};X($t,de=>{d(Ae)&&de(Nt)})}var Qt=T($t,2);{var Ft=de=>{var Pe=ag(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L("settings.plugin-manager.version-mismatch")]),A(de,Pe)};X(Qt,de=>{d(G).length>0&&de(Ft)})}var Sn=T(Qt,2);{var en=de=>{var Pe=ag(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L("settings.plugin-manager.sdk-major-badge")]),A(de,Pe)};X(Sn,de=>{d(q)!==void 0&&de(en)})}var an=T(fe,2);{var Tn=de=>{var Pe=MI(),Je=et(Pe);{var ct=we=>{var be=OI(),Ye=v(be);y(()=>E(Ye,d(pt))),A(we,be)};X(Je,we=>{d(pt)!==void 0&&we(ct)})}var C=T(Je,2),D=v(C);Ie(D,1,"mndw-installed__load-retry"),R(D,"variant","secondary"),y(()=>R(D,"disabled",d(Se))),y(()=>R(D,"aria-busy",d(Se)));var ce=v(D);y(we=>E(ce,we),[()=>L("settings.plugin-manager.retry")]),he("click",D,()=>g(d(B).name)),A(de,Pe)};X(an,de=>{d(Ae)&&de(Tn)})}var mn=T(an,2);{var j=de=>{var Pe=lg(),Je=v(Pe);y(ct=>E(Je,ct),[()=>L("settings.plugin-manager.load-version-warning",{versions:d(G).join(", ")})]),A(de,Pe)};X(mn,de=>{d(G).length>0&&de(j)})}var re=T(mn,2);{var ne=de=>{var Pe=lg(),Je=v(Pe);y(()=>E(Je,d(q))),A(de,Pe)};X(re,de=>{d(q)!==void 0&&de(ne)})}var Y=T(re,2);{var Be=de=>{var Pe=NI(),Je=v(Pe);y(ct=>E(Je,ct),[()=>d(H).join(", ")]),A(de,Pe)};X(Y,de=>{d(H).length>0&&de(Be)})}var We=T(Y,2);{var Lt=de=>{var Pe=Un(),Je=et(Pe);Ct(Je,16,()=>tf,ct=>ct,(ct,C)=>{var D=Un(),ce=et(D);{var we=Ye=>{var ot=LI();Ie(ot,1,"mndw-installed__capability-switch"),y(()=>R(ot,"label",s(C)));var Gt=v(ot);y(()=>R(Gt,"checked",i(d(B),C))),y(()=>R(Gt,"disabled",d(ge)||!i(d(B),C)&&!u())),Tt("mndwchange",Gt,ut=>e.onCapabilityChange(d(B).name,C,ut.detail.checked)),A(Ye,ot)},be=V(()=>{var Ye;return(Ye=d(B).capabilities)==null?void 0:Ye.includes(C)});X(ce,Ye=>{d(be)&&Ye(we)})}A(ct,D)}),A(de,Pe)};X(We,de=>{c()&&de(Lt)})}var F=T(We,2);{var ue=de=>{var Pe=zI(),Je=v(Pe),ct=v(Je),C=T(Je,2);{var D=ce=>{var we=II(),be=et(we);Ie(be,1,"mndw-installed__refresh"),R(be,"variant","ghost");var Ye=v(be),ot=T(be,2);Ie(ot,1,"mndw-installed__keep"),R(ot,"variant","ghost");var Gt=v(ot);y((ut,dt)=>{E(Ye,ut),E(Gt,dt)},[()=>L("settings.plugin-manager.refresh"),()=>L("settings.plugin-manager.keep-notice")]),he("click",be,function(...ut){var dt;(dt=h())==null||dt.apply(this,ut)}),he("click",ot,()=>p()(d(B).name)),A(ce,we)};X(C,ce=>{(d(ke).state==="notice-finishing"||d(ke).state==="outcome-unknown")&&ce(D)})}y(()=>{Ie(Pe,1,`mndw-alert mndw-alert--${d(ve)??""}`,"svelte-egoe9l"),Ne(Pe,"role",d(ie)),E(ct,d(ke).message)}),A(de,Pe)};X(F,de=>{var Pe;d(ke)!==void 0&&((Pe=d(ke))==null?void 0:Pe.message)!==""&&de(ue)})}var ze=T(F,2),Ke=v(ze);Ie(Ke,1,"mndw-installed__toggle"),y(()=>R(Ke,"variant",d(B).enabled?"secondary":"primary")),y(()=>R(Ke,"disabled",d(ge)));var Fn=v(Ke),Xn=T(Ke,2);{var cr=de=>{var Pe=HI(),Je=et(Pe);{var ct=we=>{var be=cg();Ie(be,1,"mndw-installed__restart"),R(be,"variant","secondary"),y(()=>R(be,"disabled",d(ge)));var Ye=v(be);y(ot=>E(Ye,ot),[()=>L("settings.plugin-manager.restart-backend")]),he("click",be,()=>f()(d(B).name)),A(we,be)};X(Je,we=>{d(B).runtime&&d(B).runtime.state!=="stopped"&&we(ct)})}var C=T(Je,2);{var D=we=>{var be=DI(),Ye=v(be),ot=v(Ye),Gt=T(Ye,2);Ie(Gt,1,"mndw-installed__cancel"),R(Gt,"variant","ghost"),y(()=>R(Gt,"disabled",d(ge)));var ut=v(Gt),dt=T(Gt,2);Ie(dt,1,"mndw-installed__confirm"),R(dt,"variant","danger"),y(()=>R(dt,"disabled",d(ge)));var It=v(dt);y((zt,gt,vn)=>{E(ot,zt),E(ut,gt),E(It,vn)},[()=>L("settings.plugin-manager.delete-confirmation",{label:d(te).label}),()=>L("settings.plugin-manager.cancel"),()=>L("settings.plugin-manager.delete-plugin")]),he("click",Gt,function(...zt){var gt;(gt=e.onCancelConfirm)==null||gt.apply(this,zt)}),he("click",dt,()=>e.onDelete(d(B).name)),A(we,be)},ce=we=>{var be=cg();Ie(be,1,"mndw-installed__delete"),R(be,"variant","danger"),y(()=>R(be,"disabled",d(ge)));var Ye=v(be);y(ot=>E(Ye,ot),[()=>L("settings.plugin-manager.delete")]),he("click",be,()=>e.onRequestConfirm(d(B).name)),A(we,be)};X(C,we=>{e.confirmingName===d(B).name?we(D):we(ce,-1)})}A(de,Pe)};X(Xn,de=>{d(B).source!=="builtin"&&de(cr)})}var Ki=T(ze,2);{var qs=de=>{var Pe=BI(),Je=v(Pe);y((ct,C)=>E(Je,`${ct??""}: ${C??""}`),[()=>L("settings.plugin-manager.backend"),()=>a(d(B).runtime.state)]),A(de,Pe)};X(Ki,de=>{d(B).runtime&&de(qs)})}y((de,Pe,Je)=>{E(ye,d(te).label),E(ae,d(B).name),E(nt,`${de??""}: ${d(B).version??""}`),E(kt,Pe),E(Fn,Je)},[()=>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")]),he("click",Ke,()=>d(B).enabled?e.onDisable(d(B).name):e.onEnable(d(B).name)),A(z,at)}),A(P,M)};X(O,P=>{e.items.length===0?P(N):P(S,-1)})}y(P=>E(w,P),[()=>L("settings.plugin-manager.installed-title")]),A(t,b),Ze()}ht(["click"]);var GI=I("<li> </li>"),VI=I('<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){Ve(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=Un(),s=et(i);{var o=a=>{var l=VI(),c=v(l),u=v(c),f=T(c,2);Ct(f,21,()=>d(n),m=>`${m.kind}:${m.name}`,(m,g)=>{var b=GI(),_=v(b);y(w=>E(_,w),[()=>r(d(g))]),A(m,b)});var h=T(f,2),p=v(h);y((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)};X(s,a=>{d(n).length>0&&a(o)})}A(t,i),Ze()}var ZI=I('<p class="mndw-cap__kind svelte-14iyjl4"> </p>'),io=I("<li> </li>"),so=I('<section class="mndw-cap__section svelte-14iyjl4"><h4 class="svelte-14iyjl4"> </h4> <ul class="svelte-14iyjl4"></ul></section>'),WI=I('<div class="mndw-cap svelte-14iyjl4"><!> <!> <!> <!> <!> <!> <!></div>');function h_(t,e){Ve(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=WI(),l=v(a);f_(l,{get lock(){return e.entry.lock}});var c=T(l,2);{var u=S=>{var P=ZI(),M=v(P);y(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)};X(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),H=>H,(H,G)=>{var q=io(),oe=v(q);y(()=>E(oe,G)),A(H,q)}),y(H=>E(z,H),[()=>L("settings.plugin-manager.packages")]),A(S,P)};X(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),(H,G)=>`${G}:${H}`,(H,G)=>{var q=io(),oe=v(q);y(()=>E(oe,d(G))),A(H,q)}),y(H=>E(z,H),[()=>L("settings.plugin-manager.service-args")]),A(S,P)};X(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),([H,G])=>H,(H,G)=>{var q=V(()=>X_(d(G),2));let oe=()=>d(q)[0],ke=()=>d(q)[1];var ve=io(),ie=v(ve);y(ge=>E(ie,`${oe()??""}: ${ke().transport==="http"?`${ke().method??"GET"} `:""}${ke().path??""}${ge??""}`),[()=>{var ge;return(ge=ke().protocols)!=null&&ge.length?` (${ke().protocols.join(", ")})`:""}]),A(H,ve)}),y(H=>E(z,H),[()=>L("settings.plugin-manager.routes")]),A(S,P)};X(g,S=>{d(n).length>0&&S(b)})}var _=T(g,2);{var w=S=>{var P=so(),M=v(P),z=v(M),B=T(M,2);Ct(B,20,()=>d(s),H=>H,(H,G)=>{var q=io(),oe=v(q);y(()=>E(oe,G)),A(H,q)}),y(H=>E(z,H),[()=>L("settings.plugin-manager.public-routes")]),A(S,P)};X(_,S=>{d(s).length>0&&S(w)})}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),H=>H,(H,G)=>{var q=io(),oe=v(q);y(()=>E(oe,G)),A(H,q)}),y(H=>E(z,H),[()=>L("settings.plugin-manager.capabilities")]),A(S,P)};X(O,S=>{d(o).length>0&&S(N)})}A(t,a),Ze()}var qI=I("<mndw-button> </mndw-button> <mndw-button> </mndw-button>",3),KI=I('<div><span class="svelte-1mbpuk3"> </span> <!></div>'),YI=I('<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),XI=I('<div class="mndw-pending__actions svelte-1mbpuk3"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),JI=I('<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>'),QI=I('<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 e3(t,e){Ve(e,!0);let n=yn(e,"rowStateFor",3,()=>{}),r=yn(e,"onRefresh",3,()=>{}),i=yn(e,"onKeepNotice",3,()=>{});var s=QI(),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,q;return((G=d(f))==null?void 0:G.state)==="error"?"danger":((q=d(f))==null?void 0:q.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,q;return((G=d(f))==null?void 0:G.state)==="working"||((q=d(f))==null?void 0:q.state)==="reconciling"});var g=JI(),b=v(g),_=v(b),w=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 q=KI(),oe=v(q),ke=v(oe),ve=T(oe,2);{var ie=ge=>{var Ee=qI(),te=et(Ee);Ie(te,1,"mndw-pending__refresh"),R(te,"variant","ghost");var me=v(te),ee=T(te,2);Ie(ee,1,"mndw-pending__keep"),R(ee,"variant","ghost");var Se=v(ee);y((Ae,$e)=>{E(me,Ae),E(Se,$e)},[()=>L("settings.plugin-manager.refresh"),()=>L("settings.plugin-manager.keep-notice")]),he("click",te,function(...Ae){var $e;($e=r())==null||$e.apply(this,Ae)}),he("click",ee,()=>i()(d(u).name)),A(ge,Ee)};X(ve,ge=>{(d(f).state==="notice-finishing"||d(f).state==="outcome-unknown")&&ge(ie)})}y(()=>{Ie(q,1,`mndw-alert mndw-alert--${d(h)??""}`,"svelte-1mbpuk3"),Ne(q,"role",d(p)),E(ke,d(f).message)}),A(G,q)};X(P,G=>{d(f)!==void 0&&d(f).message!==""&&G(M)})}var z=T(P,2);{var B=G=>{var q=YI(),oe=v(q),ke=v(oe),ve=T(oe,2),ie=v(ve);Ie(ie,1,"mndw-pending__cancel"),R(ie,"variant","ghost");var ge=v(ie),Ee=T(ie,2);Ie(Ee,1,"mndw-pending__confirm"),R(Ee,"variant","danger"),y(()=>R(Ee,"disabled",d(m)));var te=v(Ee);y((me,ee,Se)=>{E(ke,me),E(ge,ee),E(te,Se)},[()=>L("settings.plugin-manager.deny-confirmation",{label:d(u).label}),()=>L("settings.plugin-manager.cancel"),()=>L("settings.plugin-manager.deny-plugin")]),he("click",ie,function(...me){var ee;(ee=e.onCancelConfirm)==null||ee.apply(this,me)}),he("click",Ee,()=>e.onDeny(d(u).name)),A(G,q)},H=G=>{var q=XI(),oe=v(q);Ie(oe,1,"mndw-pending__deny"),R(oe,"variant","danger"),y(()=>R(oe,"disabled",d(m)));var ke=v(oe),ve=T(oe,2);Ie(ve,1,"mndw-pending__approve"),R(ve,"variant","primary"),y(()=>R(ve,"disabled",d(m)));var ie=v(ve);y((ge,Ee)=>{E(ke,ge),E(ie,Ee)},[()=>L("settings.plugin-manager.deny"),()=>L("settings.plugin-manager.approve")]),he("click",oe,()=>e.onRequestConfirm(d(u).name)),he("click",ve,()=>e.onApprove(d(u).name)),A(G,q)};X(z,G=>{e.confirmingName===d(u).name?G(B):G(H,-1)})}y(()=>{E(w,d(u).label),E(N,d(u).name)}),A(c,g)}),y(c=>E(a,c),[()=>L("settings.plugin-manager.pending-title")]),A(t,s),Ze()}ht(["click"]);var t3=I('<div class="mndw-approval svelte-s4a91i"><p class="mndw-approval__declaration svelte-s4a91i"><strong> </strong> </p> <p class="mndw-alert mndw-alert--warning" role="note"> </p> <!> <div class="mndw-approval__actions svelte-s4a91i"><mndw-button> </mndw-button> <mndw-button> </mndw-button></div></div>',2);function n3(t,e){Ve(e,!0);var n=t3(),r=v(n),i=v(r),s=v(i),o=T(i),a=T(r,2),l=v(a),c=T(a,2);h_(c,{get entry(){return e.entry}});var u=T(c,2),f=v(u);Ie(f,1,"mndw-approval__deny"),R(f,"variant","danger");var h=v(f),p=T(f,2);Ie(p,1,"mndw-approval__approve"),R(p,"variant","primary");var m=v(p);y((g,b,_,w)=>{E(s,e.entry.label),E(o,` (${e.entry.name??""}) ${g??""}`),E(l,b),E(h,_),E(m,w)},[()=>L("settings.backend-approval-declaration"),()=>L("settings.plugin-risk-warning"),()=>L("settings.backend-approval-deny"),()=>L("settings.backend-approval-approve")]),he("click",f,()=>e.close("deny")),he("click",p,()=>e.close("approve")),A(t,n),Ze()}ht(["click"]);async function r3(t,e,n){if(n!=null&&n.aborted)return;const r=Jr(t.hostOverlay,n3,{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 i3={"ping-widget-aarch64.zip":"aarch64","ping-widget-mips.zip":"mips","ping-widget-mipsel.zip":"mipsel"};function s3(t){switch(t){case"aarch64":return"aarch64";case"mips":return"mips";case"mipsel":return"mipsel";default:return}}function o3(t,e){const n=s3(e),r=i3[t];if(!(n===void 0||r===void 0||n===r))return{filename:t,archiveTarget:r,deviceTarget:n}}var ug=I('<p class="mndw-upload__status svelte-1mqre4o" role="status"> </p>'),a3=I('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),l3=I('<div class="mndw-upload svelte-1mqre4o"><div class="mndw-alert mndw-alert--warning" role="note"> </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 c3(t,e){Ve(e,!0);const n="settings.plugin-manager.install",r="settings.plugin-manager.approval",i=gn(),s=i.locale.hostT;function o(te,me){return e.openApproval?e.openApproval(te,me):r3(i,te,me)}function a(te){return Sf(te,s,()=>Ll(s))}let l=se("idle"),c=se(""),u=se(null),f,h=!1;ei(()=>{h=!0,f==null||f.abort()});function p(te){if(!te.name.toLowerCase().endsWith(".zip"))return s("settings.plugin-manager.choose-zip");if(te.size===0)return s("settings.plugin-manager.empty-zip");if(te.size>Em)return s("settings.plugin-manager.zip-too-large",{limit:Ll(s)})}function m(te){return s("settings.plugin-manager.upload-target-mismatch",{filename:te.filename,archiveTarget:te.archiveTarget,deviceTarget:te.deviceTarget})}function g(te){const me=p(te);if(me)return me;const ee=o3(te.name,e.architecture);if(ee!==void 0)return m(ee)}function b(te){k(c,te,!0),k(l,"error")}function _(te){k(u,te,!0),je.success(s("settings.plugin-manager.installed-success",{label:te.label}),{key:n}),k(l,"success"),e.onInstalled()}async function w(te){const me=new AbortController;f=me;try{return{decision:await o(te,me.signal),aborted:me.signal.aborted}}finally{f===me&&(f=void 0)}}async function O(te,me){if(!h)if(me==="approve"){const ee=await e.onApprove(te.name);if(h)return;if(!ee){k(l,"idle");return}je.success(s("settings.plugin-manager.approved-success",{label:te.label}),{key:r}),k(l,"success")}else if(me==="deny"){if(await e.onDeny(te.name),h)return;k(l,"idle")}else{if(h)return;e.onDismiss(),k(l,"idle")}}async function N(te){if(d(l)==="uploading"||d(l)==="busy")return;const me=g(te);if(me){b(me);return}k(c,""),k(l,"uploading");let ee;try{ee=await e.uploadFile(te)}catch(Ae){if(h)return;b(a(Ae));return}if(h)return;if(ee.status==="installed"){_(ee.entry);return}k(l,"busy");let Se;try{Se=await w(ee.entry)}catch(Ae){if(h)return;b(a(Ae));return}h||Se.aborted||await O(ee.entry,Se.decision)}function S(te){var Se;const me=te.currentTarget,ee=(Se=me.files)==null?void 0:Se[0];me.value="",ee&&N(ee)}function P(te){var ee;te.preventDefault();const me=(ee=te.dataTransfer)==null?void 0:ee.files[0];me&&N(me)}var M=l3(),z=v(M),B=v(z),H=T(z,2),G=v(H),q=T(G,2),oe=v(q),ke=T(H,2);{var ve=te=>{var me=ug(),ee=v(me);y(Se=>E(ee,Se),[()=>s("settings.plugin-manager.uploading")]),A(te,me)},ie=te=>{var me=ug(),ee=v(me);y(Se=>E(ee,Se),[()=>s("settings.plugin-manager.waiting-approval")]),A(te,me)},ge=te=>{var me=Un(),ee=et(me);{var Se=Ae=>{f_(Ae,{get lock(){return d(u).lock}})};X(ee,Ae=>{d(u)&&Ae(Se)})}A(te,me)},Ee=te=>{var me=a3(),ee=v(me);y(()=>E(ee,d(c))),A(te,me)};X(ke,te=>{d(l)==="uploading"?te(ve):d(l)==="busy"?te(ie,1):d(l)==="success"?te(ge,2):d(l)==="error"&&te(Ee,3)})}y((te,me,ee)=>{E(B,te),Ne(G,"aria-label",me),G.disabled=d(l)==="uploading"||d(l)==="busy",E(oe,ee)},[()=>s("settings.plugin-risk-warning"),()=>s("settings.upload-plugin-zip"),()=>s("settings.plugin-manager.upload-drop")]),Tt("dragover",H,te=>te.preventDefault()),Tt("drop",H,P),he("change",G,S),A(t,M),Ze()}ht(["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 u3(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 d3=I('<div class="mndw-reload svelte-1hlmyjs" role="status"><span> </span> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div>',2),f3=I('<p class="mndw-plugin-manager__loading svelte-1hlmyjs" role="status"> </p>'),h3=I('<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),p3=I('<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),g3=I('<section class="svelte-1hlmyjs"><strong> </strong> <span> </span> <span> </span> <span> </span> <span> </span></section>'),m3=I('<p class="svelte-1hlmyjs"> </p>'),$a=I("<span> </span>"),v3=I('<section class="mndw-plugin-diagnostics__item svelte-1hlmyjs"><strong> </strong> <!> <!> <!> <!></section>'),b3=I('<!> <details class="mndw-plugin-diagnostics svelte-1hlmyjs"><summary class="svelte-1hlmyjs"> </summary> <!> <!></details> <!> <!>',1),_3=I('<section class="mndw-plugin-manager svelte-1hlmyjs"><h3 class="svelte-1hlmyjs"> </h3> <!> <!> <!></section>');function y3(t,e){Ve(e,!0);let n=yn(e,"capabilityVisible",3,!1),r=yn(e,"capabilityAvailable",3,!1);const i=gn(),s=V(()=>e.client??i.mgmtClient),o=i.registry,a=i.locale.hostT;function l(U){return Sf(U,a,()=>Ll(a))}let c=se(it([])),u=se(null),f=se(""),h=se(!0),p=se(""),m=se(""),g=se(null),b=se(!1),_=0;const w=new ki,O={polls:3,intervalMs:1e3};let N=V(()=>d(c).filter(U=>U.approval==="approved")),S=V(()=>d(c).filter(U=>U.approval==="pending"));function P(U){return w.get(U)}function M(U){return U.some(J=>{if(!J.enabled||J.approval!=="approved")return!1;const ye=o.get(J.name);return ye!==void 0&&ye.entry.version!==J.version})}function z(U){for(const[J,ye]of w)ye.state==="notice-finishing"&&ye.operation!==void 0&&p_(ye.operation,J,U)&&w.delete(J)}async function B(){const U=++_;k(h,!0),k(p,"");try{const J=await d(s).listPlugins();U===_&&(k(c,J,!0),k(b,d(b)||M(J),!0),k(m,""),z(J))}catch(J){U===_&&k(p,l(J),!0)}finally{U===_&&k(h,!1)}}async function H(){const U=++_;let J=!1;try{const ye=await d(s).listPlugins();if(U===_){k(c,ye,!0),k(p,""),k(m,""),k(h,!1),z(ye);const Ce=xA(ye);i.router.refresh(i.registry),J=await Ce,k(b,d(b)||J||M(ye),!0),i.router.refresh(i.registry)}}catch(ye){U===_&&(k(m,l(ye),!0),k(h,!1))}return q(),J}async function G(){await H()&&k(b,!0)}async function q(){try{k(u,await d(s).getRuntime(),!0),k(f,"")}catch(U){k(f,l(U),!0)}}async function oe(U,J,ye){const Ce=w.get(U);if((Ce==null?void 0:Ce.state)==="working"||(Ce==null?void 0:Ce.state)==="reconciling")return!1;w.set(U,{state:"working",message:"",operation:J});let Te=!1;try{await ye(),Te=!0,w.delete(U),await G()}catch(Q){const ae=cO(Q);if(ae==="rejected-maintenance")w.set(U,{state:"notice-rejected",message:a("settings.plugin-manager.maintenance-busy"),operation:J});else if(ae==="ambiguous"){w.set(U,{state:"reconciling",message:a("settings.plugin-manager.confirming-state"),operation:J});try{const fe=await u3(J,U,()=>d(s).listPlugins(),O);fe==="ok"?(w.delete(U),Te=!0,await G()):fe==="notice-finishing"?w.set(U,{state:"notice-finishing",message:a("settings.plugin-manager.operation-finishing"),operation:J}):w.set(U,{state:"outcome-unknown",message:a("settings.plugin-manager.outcome-unknown"),operation:J})}catch(fe){w.set(U,{state:"outcome-unknown",message:l(fe),operation:J})}}else w.set(U,{state:"error",message:l(Q),operation:J}),await H()}finally{k(g,null)}return Te}function ke(){G()}function ve(){G()}function ie(U){w.delete(U)}$n(()=>{B(),q()});var ge=_3(),Ee=v(ge),te=v(Ee),me=T(Ee,2);{var ee=U=>{var J=d3(),ye=v(J),Ce=v(ye),Te=T(ye,2);R(Te,"variant","primary");var Q=v(Te),ae=T(Te,2);R(ae,"variant","ghost");var fe=v(ae);y((Oe,nt,Et)=>{E(Ce,Oe),E(Q,nt),E(fe,Et)},[()=>a("settings.plugin-manager.plugin-updated-notice"),()=>a("settings.plugin-manager.reload-now"),()=>a("settings.plugin-manager.later")]),he("click",Te,()=>window.location.reload()),he("click",ae,()=>k(b,!1)),A(U,J)};X(me,U=>{d(b)&&U(ee)})}var Se=T(me,2);{let U=V(()=>{var J;return(J=Z.deviceInfo)==null?void 0:J.architecture});c3(Se,{get architecture(){return d(U)},uploadFile:J=>d(s).uploadPlugin(J),onInstalled:ke,onApprove:J=>oe(J,{kind:"approve"},()=>d(s).approvePlugin(J)),onDeny:J=>oe(J,{kind:"deny"},()=>d(s).denyPlugin(J)),onDismiss:ve})}var Ae=T(Se,2);{var $e=U=>{var J=f3(),ye=v(J);y(Ce=>E(ye,Ce),[()=>a("settings.plugin-manager.loading")]),A(U,J)},pt=U=>{var J=h3(),ye=v(J),Ce=v(ye),Te=T(ye,2);R(Te,"variant","secondary");var Q=v(Te);y(ae=>{E(Ce,d(p)),E(Q,ae)},[()=>a("settings.plugin-manager.retry")]),he("click",Te,()=>void B()),A(U,J)},at=U=>{var J=b3(),ye=et(J);{var Ce=Le=>{var st=p3(),bt=v(st),$t=v(bt),Nt=T(bt,2);R(Nt,"variant","secondary");var Qt=v(Nt),Ft=T(Nt,2);R(Ft,"variant","ghost");var Sn=v(Ft);y((en,an)=>{E($t,d(m)),E(Qt,en),E(Sn,an)},[()=>a("settings.plugin-manager.retry"),()=>a("settings.plugin-manager.dismiss")]),he("click",Nt,()=>void H()),he("click",Ft,()=>k(m,"")),A(Le,st)};X(ye,Le=>{d(m)&&Le(Ce)})}var Te=T(ye,2),Q=v(Te),ae=v(Q),fe=T(Q,2);{var Oe=Le=>{var st=g3(),bt=v(st),$t=v(bt),Nt=T(bt,2),Qt=v(Nt),Ft=T(Nt,2),Sn=v(Ft),en=T(Ft,2),an=v(en),Tn=T(en,2),mn=v(Tn);y((j,re,ne,Y,Be,We,Lt)=>{Ne(st,"aria-label",j),E($t,re),E(Qt,`${ne??""}:
90
- ${d(u).currentExec??""}/${d(u).maxConcurrentExecTotal??""}`),E(Sn,`${Y??""}:
91
- ${d(u).reservedServices??""}/${d(u).maxSupervisedServices??""}`),E(an,`${Be??""}:
92
- ${d(u).maxConcurrentExecPerPlugin??""}`),E(mn,`${We??""}:
93
- ${Lt??""}`)},[()=>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(Le,st)},nt=Le=>{var st=m3(),bt=v(st);y($t=>E(bt,$t),[()=>a("settings.plugin-manager.runtime-status-unavailable",{error:d(f)})]),A(Le,st)};X(fe,Le=>{d(u)?Le(Oe):d(f)&&Le(nt,1)})}var Et=T(fe,2);Ct(Et,17,()=>d(N).filter(Le=>Le.runtime!==void 0),Le=>Le.name,(Le,st)=>{const bt=V(()=>d(st).runtime);var $t=v3(),Nt=v($t),Qt=v(Nt),Ft=T(Nt,2);{var Sn=ne=>{var Y=$a(),Be=v(Y);y(We=>E(Be,`${We??""}: ${d(bt).requiredProtocol??""}`),[()=>a("settings.plugin-manager.protocol")]),A(ne,Y)};X(Ft,ne=>{var Y;((Y=d(bt))==null?void 0:Y.requiredProtocol)!==void 0&&ne(Sn)})}var en=T(Ft,2);{var an=ne=>{var Y=$a(),Be=v(Y);y(We=>E(Be,We),[()=>a("settings.plugin-manager.incompatible")]),A(ne,Y)};X(en,ne=>{var Y;((Y=d(bt))==null?void 0:Y.compatible)===!1&&ne(an)})}var Tn=T(en,2);{var mn=ne=>{var Y=$a(),Be=v(Y);y(We=>E(Be,`${We??""}: ${d(bt).lastError??""}`),[()=>a("settings.plugin-manager.last-error")]),A(ne,Y)};X(Tn,ne=>{var Y;(Y=d(bt))!=null&&Y.lastError&&ne(mn)})}var j=T(Tn,2);{var re=ne=>{var Y=$a(),Be=v(Y);y((We,Lt)=>E(Be,`${We??""}:
94
- ${Lt??""}`),[()=>a("settings.plugin-manager.supported-service-protocols"),()=>d(bt).supportedProtocols.join(", ")]),A(ne,Y)};X(j,ne=>{var Y;((Y=d(bt))==null?void 0:Y.compatible)===!1&&d(bt).supportedProtocols&&ne(re)})}y(()=>E(Qt,d(st).name)),A(Le,$t)});var kt=T(Te,2);{var Mt=Le=>{e3(Le,{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 H(),onKeepNotice:ie})};X(kt,Le=>{d(S).length>0&&Le(Mt)})}var At=T(kt,2);FI(At,{get items(){return d(N)},get confirmingName(){return d(g)},rowStateFor:P,get capabilityVisible(){return n()},get capabilityAvailable(){return r()},onEnable:Le=>oe(Le,{kind:"enable"},()=>d(s).enablePlugin(Le)),onDisable:Le=>oe(Le,{kind:"disable"},()=>d(s).disablePlugin(Le)),onCapabilityChange:(Le,st,bt)=>oe(Le,{kind:"capability",capability:st,enabled:bt},()=>d(s).setPluginCapability(Le,st,bt)),onRestart:Le=>oe(Le,{kind:"restart"},()=>d(s).restartPlugin(Le)),onDelete:Le=>oe(Le,{kind:"delete"},()=>d(s).deletePlugin(Le)),onRequestConfirm:Le=>k(g,Le,!0),onCancelConfirm:()=>k(g,null),onRefresh:()=>void H(),onKeepNotice:ie}),y(Le=>E(ae,Le),[()=>a("settings.plugin-manager.diagnostics")]),A(U,J)};X(Ae,U=>{d(h)?U($e):d(p)?U(pt,1):U(at,-1)})}y(U=>E(te,U),[()=>a("settings.plugin-manager.title")]),A(t,ge),Ze()}ht(["click"]);var w3=I('<section class="mndw-plugin-settings"><!></section>');function k3(t,e){var n=w3(),r=v(n);y3(r,{get capabilityVisible(){return e.capabilityVisible},get capabilityAvailable(){return e.capabilityAvailable}}),A(t,n)}var E3=I("<mndw-button> </mndw-button>",2),S3=I('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p role="status" class="svelte-1khkewm"> </p> <!></div>');function T3(t,e){Ve(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=S3(),i=v(r),s=v(i),o=T(i,2);{var a=l=>{var c=E3();R(c,"variant","secondary"),Ie(c,1,"svelte-1khkewm");var u=v(c);y(f=>E(u,f),[()=>L("common.close")]),he("click",c,()=>e.close("close")),A(l,c)};X(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}y(()=>E(s,d(n))),A(t,r),Ze()}ht(["click"]);var vu=I('<p class="svelte-1ffuaq9"> </p>'),ja=I('<p role="status" class="svelte-1ffuaq9"> </p>'),dg=I('<p role="alert" class="svelte-1ffuaq9"> </p>'),x3=I('<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 P3(t,e){Ve(e,!0);let n=yn(e,"pollIntervalMs",3,2e3),r=yn(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=gn(),c=l.locale.hostT;let u=V(()=>e.client??l.selfUpdateClient),f=se(null),h=se(null),p=se(""),m=se(""),g=se("idle"),b=se(""),_=se(!1),w=null,O=0,N=0,S=!1,P=!1,M=se(null),z=null;$n(()=>{G()}),ei(()=>{S=!0,B(),me()});function B(){O+=1,w!==null&&(window.clearTimeout(w),w=null)}function H(F){k(f,F,!0),F.state==="failed"?(k(b,F.failureCode??"unknown",!0),k(g,"failure"),P=!1,me()):F.state==="idle"&&P?(P=!1,k(g,"idle"),je.success(c("settings.self-update-success",{version:F.version}),{key:ge(d(m))}),me()):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;H(F),F.state==="in-progress"&&(P=!0,q())}catch{k(g,"error")}finally{k(_,!1)}}function q(){if(B(),N=Math.max(0,r()),N===0){ke();return}oe(O)}function oe(F){S||F!==O||N<=0||(w=window.setTimeout(()=>{w=null,ve(F)},n()))}function ke(){B(),k(g,"unconfirmed"),d(M)!==null&&(d(M).phase="unconfirmed")}async function ve(F){if(!(S||F!==O)){N-=1;try{const ue=await d(u).status();if(S||F!==O)return;H(ue),ue.state==="in-progress"?N<=0?ke():oe(F):B()}catch{if(N<=0){ke();return}oe(F)}}}function ie(F){return F instanceof Zb?F.code:"UNKNOWN"}function ge(F){return F==="update"?s:F==="revert"?o:a}async function Ee(F,ue){const ze=F==="update";return(await Jr(l.hostOverlay,Zo,{title:c(ze?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:c(ze?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:ue}),confirmLabel:c(ze?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function te(F){k(M,{operation:F,phase:"preparing",targetVersion:""},!0);const ze=d(M);if(ze===null)return;const Ke=Jr(l.hostOverlay,T3,{title:c("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:ze}});z=Ke,Ke.closed.then(()=>{z===Ke&&(z=null,k(M,null))})}function me(){z==null||z.close(void 0,"api")}async function ee(F){try{const ue=await d(u).status();if(S)return;H(ue),ue.state==="in-progress"?(P=!0,q()):(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 Se(){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),ie(F)==="OPKG_BUSY"?await ee(i):(k(g,"idle"),je.error(c("settings.self-update-failure-generic"),{key:i}))}finally{S||k(_,!1)}}async function Ae(){const F=d(h);F===null||!F.updateAvailable||F.targetVersion===void 0||await Ee("update",F.targetVersion)&&(S||await J("update",()=>d(u).apply()))}async function $e(){d(Q)!==""&&await Ee("revert",d(Q))&&(S||await J("revert",()=>d(u).revert()))}function pt(F){B(),k(h,null),k(p,""),k(m,F,!0),k(b,""),k(_,!0),k(g,"preparing"),P=!1}async function at(F){const ue=await F();S||(k(p,ue.targetVersion,!0),k(m,ue.operation,!0),d(M)!==null&&(d(M).phase="running",d(M).targetVersion=ue.targetVersion),k(g,"idle"),P=!0,q())}async function U(F,ue){if(S)return;const ze=ge(ue);switch(me(),ie(F)){case"OPKG_BUSY":await ee(ze);return;case"SELF_UPDATE_NOT_AVAILABLE":je.info(c("settings.self-update-no-update"),{key:ze});break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":je.info(c("settings.self-update-rollback-unavailable"),{key:ze});break;default:je.error(c("settings.self-update-failure-generic"),{key:ze})}k(b,""),k(g,"idle")}async function J(F,ue){pt(F),te(F);try{await at(ue)}catch(ze){await U(ze,F)}finally{S||k(_,!1)}}function ye(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 Ce=V(()=>{var F;return((F=d(f))==null?void 0:F.version)??""}),Te=V(()=>{var F,ue;return((F=d(f))==null?void 0:F.state)==="in-progress"?d(p)||d(f).targetVersion||"":((ue=d(h))==null?void 0:ue.targetVersion)||""}),Q=V(()=>{var F,ue;return((F=d(h))==null?void 0:F.rollbackVersion)||((ue=d(f))==null?void 0:ue.rollbackVersion)||""}),ae=V(()=>{var F;return((F=d(h))==null?void 0:F.updateAvailable)===!0&&!d(_)}),fe=V(()=>{var F,ue;return(((F=d(h))==null?void 0:F.rollbackAvailable)===!0||!!((ue=d(f))!=null&&ue.rollbackVersion))&&!d(_)});var Oe=x3(),nt=v(Oe),Et=v(nt),kt=T(nt,2),Mt=v(kt),At=T(kt,2);{var Le=F=>{var ue=vu(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-current",{version:d(Ce)})]),A(F,ue)};X(At,F=>{d(Ce)&&F(Le)})}var st=T(At,2);{var bt=F=>{var ue=vu(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-rollback",{version:d(Q)})]),A(F,ue)};X(st,F=>{d(Q)&&F(bt)})}var $t=T(st,2);{var Nt=F=>{var ue=ja(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-checking")]),A(F,ue)},Qt=F=>{var ue=ja(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-preparing")]),A(F,ue)},Ft=F=>{var ue=ja(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c(d(m)==="revert"||d(f).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:d(Te)})]),A(F,ue)},Sn=F=>{var ue=dg(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>ye(d(b))]),A(F,ue)},en=F=>{var ue=ja(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-unconfirmed")]),A(F,ue)},an=F=>{var ue=dg(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-failure-generic")]),A(F,ue)};X($t,F=>{var ue;d(g)==="checking"?F(Nt):d(g)==="preparing"?F(Qt,1):((ue=d(f))==null?void 0:ue.state)==="in-progress"&&d(g)!=="unconfirmed"?F(Ft,2):d(g)==="failure"?F(Sn,3):d(g)==="unconfirmed"&&d(M)===null?F(en,4):d(g)==="error"&&F(an,5)})}var Tn=T($t,2);{var mn=F=>{var ue=vu(),ze=v(ue);y(Ke=>E(ze,Ke),[()=>c("settings.self-update-available",{version:d(h).targetVersion})]),A(F,ue)};X(Tn,F=>{d(h)!==null&&d(h).updateAvailable&&d(h).targetVersion!==void 0&&F(mn)})}var j=T(Tn,2),re=v(j);R(re,"variant","secondary"),y(()=>R(re,"disabled",d(_)));var ne=v(re),Y=T(re,2);R(Y,"variant","primary"),y(()=>R(Y,"disabled",!d(ae)));var Be=v(Y),We=T(Y,2);R(We,"variant","secondary"),y(()=>R(We,"disabled",!d(fe)));var Lt=v(We);y((F,ue,ze,Ke,Fn,Xn)=>{Ne(Oe,"data-locale",Z.locale),Ne(Oe,"aria-label",F),E(Et,ue),E(Mt,ze),E(ne,Ke),E(Be,Fn),E(Lt,Xn)},[()=>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")]),he("click",re,()=>void Se()),he("click",Y,()=>void Ae()),he("click",We,()=>void $e()),A(t,Oe),Ze()}ht(["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 C3(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 R3=I("<mndw-tab> </mndw-tab>",2),A3=I('<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){Ve(e,!0);let n=se(!1),r=se(!1);const i=gn().router,s=V(()=>{var P;const S=((P=i.current)==null?void 0:P.route.pathname)??globalThis.location.pathname;return C3(S)??fg});$n(()=>{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=A3(),c=v(l),u=v(c),f=T(c,2);y(()=>R(f,"value",d(s)));var h=v(f);Ct(h,17,()=>Il,S=>S.id,(S,P)=>{var M=R3();y(()=>R(M,"id",d(P).id)),y(()=>R(M,"data-icon",d(P).icon));var z=v(M);y(B=>E(z,B),[()=>L(d(P).labelKey)]),A(S,M)});var p=T(h,2);R(p,"for","general");var m=v(p);TI(m,{onCapabilityStateChange:a});var g=T(p,2);R(g,"for","diagnostics");var b=v(g);UL(b,{});var _=T(g,2);R(_,"for","plugins");var w=v(_);k3(w,{get capabilityVisible(){return d(n)},get capabilityAvailable(){return d(r)}});var O=T(_,2);R(O,"for","self-update");var N=v(O);P3(N,{}),y(S=>{Ne(l,"data-locale",Z.locale),E(u,S)},[()=>L("settings.title")]),Tt("mndwchange",f,o),A(t,l),Ze()}function ps(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function O3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||ps(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function M3(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;O3(l,a),M3(ps(l),a);const c=ps(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(ps(o))}}}}function N3(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 L3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function zf(t,e){var a;const n=L3(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=>ps(l.route)===ps(i)))==null?void 0:a.name,s===void 0)return null;const o=n.slice(i.length);return{name:s,childPath:o==="/"?"":o}}function I3(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 z3(){let t,e,n;return{get current(){return t},create:s=>{const{routes:o,pageTable:a}=gg(s),l=mg(o),c={layout:CN,...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}}),I3(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?[]:N3(s,o)}}}function D3(t={}){const e=t.fetch??globalThis.fetch,n=uO(e),r=sA({now:t.now}),i=pO({mgmtClient:n,document:t.document}),s=yR({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:z3(),opkgClient:wO(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 si=D3();function Fa(t){return t?t.includes("/plugins/")||t.includes("/user-plugins/"):!1}function H3(){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 B3(){const t=document.getElementById("app");if(t===null)throw new Error("Missing #app mount target");Wl(nO,{target:t,props:{services:si}})}async function U3(){const t=si.rci.isAuthenticated().pipe(yg(5e3));return _d(t)}function $3(t){si.rci.authError$.subscribe(t)}async function j3(){H3(),await rO({initLocale:()=>si.locale.initLocale(),defineUi:t=>A_({overlay:si.overlay,initialLocale:t,iconSpriteUrl:V_}),initTheme:()=>si.theme.initTheme(),initPalette:()=>si.palette.initPalette(),checkAuthenticated:U3,setAuthenticated:t=>{Z.authenticated=t},initAuthenticated:()=>Ef(si),getAuthRunGeneration:Ir,subscribeAuthErrors:$3,resetToLogin:hc,mountApp:B3})}j3();export{IA as s};