mqtt2matter 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/dist/model/presets.d.ts +14 -1
- package/dist/model/presets.js +95 -17
- package/dist/model/presets.js.map +1 -1
- package/dist/server/fabrics.d.ts +42 -0
- package/dist/server/fabrics.js +50 -0
- package/dist/server/fabrics.js.map +1 -0
- package/dist/server/server.d.ts +19 -7
- package/dist/server/server.js +72 -8
- package/dist/server/server.js.map +1 -1
- package/dist/server/stats.d.ts +36 -0
- package/dist/server/stats.js +76 -0
- package/dist/server/stats.js.map +1 -0
- package/docs/api.md +21 -14
- package/docs/config.md +14 -5
- package/package.json +1 -1
- package/presets/mqtt-smarthome/button.json +1 -1
- package/presets/mqtt-smarthome/contact.json +1 -1
- package/presets/mqtt-smarthome/cover.json +1 -1
- package/presets/mqtt-smarthome/dimmer.json +1 -1
- package/presets/mqtt-smarthome/humidity.json +1 -1
- package/presets/mqtt-smarthome/light.json +1 -1
- package/presets/mqtt-smarthome/occupancy.json +1 -1
- package/presets/mqtt-smarthome/switch.json +1 -1
- package/presets/mqtt-smarthome/temperature.json +1 -1
- package/presets/openbeken/color-light.json +1 -1
- package/presets/openbeken/ct-light.json +1 -1
- package/presets/openbeken/dimmer.json +1 -1
- package/presets/openbeken/humidity.json +1 -1
- package/presets/openbeken/relay.json +1 -1
- package/presets/openbeken/temperature.json +1 -1
- package/presets/shelly-gen1/dimmer.json +1 -1
- package/presets/shelly-gen1/door-window.json +1 -1
- package/presets/shelly-gen1/ht.json +1 -1
- package/presets/shelly-gen1/relay-pm.json +1 -1
- package/presets/shelly-gen1/relay.json +1 -1
- package/presets/shelly-gen1/roller.json +1 -1
- package/presets/shelly-gen2/cover.json +1 -1
- package/presets/shelly-gen2/dimmer.json +1 -1
- package/presets/shelly-gen2/ht.json +1 -1
- package/presets/shelly-gen2/i4.json +1 -1
- package/presets/shelly-gen2/switch-pm.json +1 -1
- package/presets/shelly-gen2/switch.json +1 -1
- package/presets/tasmota/climate.json +1 -1
- package/presets/tasmota/color-light.json +1 -1
- package/presets/tasmota/ct-light.json +1 -1
- package/presets/tasmota/dimmer.json +1 -1
- package/presets/tasmota/relay.json +1 -1
- package/presets/tasmota/shutter.json +1 -1
- package/presets/tasmota/temperature-humidity.json +1 -1
- package/presets/tasmota/temperature.json +1 -1
- package/presets/valetudo/vacuum.json +1 -1
- package/presets/wled/dimmer.json +1 -1
- package/presets/wled/light.json +1 -1
- package/ui/dist/assets/index-1HdbTkGD.css +1 -0
- package/ui/dist/assets/index-CoG5Wu5Q.js +10 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/licenses.json +1 -0
- package/ui/dist/assets/index-BDtT6bdH.js +0 -10
- package/ui/dist/assets/index-CHiG-aoU.css +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const su=!1;var la=Array.isArray,bl=Array.prototype.indexOf,na=Array.prototype.includes,Ia=Array.from,uu=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,lu=Object.getOwnPropertyDescriptors,du=Object.prototype,yl=Array.prototype,Oa=Object.getPrototypeOf,ts=Object.isExtensible;const wl=()=>{};function kl(e){return e()}function To(e){for(var t=0;t<e.length;t++)e[t]()}function cu(){var e,t,n=new Promise((i,a)=>{e=i,t=a});return{promise:n,resolve:e,reject:t}}function Ea(e,t){if(Array.isArray(e))return e;if(!(Symbol.iterator in e))return Array.from(e);const n=[];for(const i of e)if(n.push(i),n.length===t)break;return n}const mr=2,Si=4,da=8,vu=1<<24,tn=16,on=32,jn=64,Co=128,Uo=256,an=512,ir=1024,Jt=2048,Jr=4096,wr=8192,cr=16384,Ii=32768,ia=1<<25,ui=65536,Ta=1<<17,xl=1<<18,Oi=1<<19,fu=1<<20,mn=1<<25,Ca=1<<21,Ei=1<<22,Fn=1<<23,Mn=Symbol("$state"),pu=Symbol("component"),El=Symbol("legacy props"),Tl=Symbol(""),hu=Symbol("attributes"),So=Symbol("class"),Ao=Symbol("style"),Po=Symbol("text"),wa=Symbol("form reset"),ca=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Cl=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),Sl=1,Al=2,mu=4,Pl=8,Nl=16,Ml=1,Rl=2,Il=4,Ol=8,Dl=16,Ll=1,Bl=2,_u={},rr=Symbol("uninitialized"),ql="http://www.w3.org/1999/xhtml";function Ul(){console.warn("https://svelte.dev/e/derived_inert")}function Fl(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function jl(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function gu(e){return e===this.v}function zl(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function bu(e){return!zl(e,this.v)}function yu(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function $l(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Hl(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Gl(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Kl(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Vl(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Jl(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Wl(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Yl(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ql(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Zl(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Xl(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Di=!1,ed=!1;function td(){Di=!0}const rd=[];function Wi(e,t=!1,n=!1){return ka(e,new Map,"",rd,null,n)}function ka(e,t,n,i,a=null,o=!1){if(typeof e=="object"&&e!==null){var s=t.get(e);if(s!==void 0)return s;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(la(e)){var u=Array(e.length);t.set(e,u),a!==null&&t.set(a,u);for(var c=0;c<e.length;c+=1){var m=e[c];c in e&&(u[c]=ka(m,t,n,i,null,o))}return u}if(Oa(e)===du){u={},t.set(e,u),a!==null&&t.set(a,u);for(var y of Object.keys(e))u[y]=ka(e[y],t,n,i,null,o);return u}if(e instanceof Date)return e.getTime(),structuredClone(e);if(typeof e.toJSON=="function"&&!o)return ka(e.toJSON(),t,n,i,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}let Dt=null;function Ai(e){Dt=e}function $t(e,t=!1,n){Dt={p:Dt,i:!1,c:null,e:null,s:e,x:null,r:_t,l:Di&&!t?{s:null,u:null,$:[]}:null}}function Ht(e){var t=Dt,n=t.e;if(n!==null){t.e=null;for(var i of n)Bu(i)}return t.i=!0,Dt=t.p,Fo(e)}function Fo(e={}){return uu(e,pu,{value:!0}),e}function va(){return!Di||Dt!==null&&Dt.l===null}let ni=[];function wu(){var e=ni;ni=[],To(e)}function Pn(e){if(ni.length===0&&!Xi){var t=ni;queueMicrotask(()=>{t===ni&&wu()})}ni.push(e)}function nd(){for(;ni.length>0;)wu()}const id=-7169;function Vt(e,t){e.f=e.f&id|t}function jo(e){(e.f&an)!==0||e.deps===null?Vt(e,ir):Vt(e,Jr)}function ku(e,t,n){(e.f&Jt)!==0?t.add(e):(e.f&Jr)!==0&&n.add(e),Vt(e,ir)}let rs=!1;function ad(){rs||(rs=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t[wa]?.()})},{capture:!0}))}function Li(e){var t=pt,n=_t;Wr(null),bn(null);try{return e()}finally{Wr(t),bn(n)}}function zo(e,t,n,i=n){e.addEventListener(t,()=>Li(n));const a=e[wa];a?e[wa]=()=>{a(),i(!0)}:e[wa]=()=>i(!0),ad()}function od(e,t,n,i){const a=va()?Pi:$o;var o=e.filter(b=>!b.settled),s=t.map(a);if(n.length===0&&o.length===0){i(s);return}var u=_t,c=sd(),m=o.length===1?o[0].promise:o.length>1?Promise.all(o.map(b=>b.promise)):null;function y(b){if((u.f&cr)===0){c();try{i([...s,...b])}catch(T){hn(T,u)}Sa()}}var g=xu();if(n.length===0){m.then(()=>y([])).finally(g);return}function _(){Promise.all(n.map(b=>ud(b))).then(y).catch(b=>hn(b,u)).finally(g)}m?m.then(()=>{if((u.f&cr)!==0){g();return}c(),_(),Sa()}):_()}function sd(){var e=_t,t=pt,n=Dt,i=Xe;return function(o=!0){bn(e),Wr(t),Ai(n),o&&(e.f&cr)===0&&(i?.activate(),i?.apply())}}function Sa(e=!0){bn(null),Wr(null),Ai(null),e&&Xe?.deactivate()}function xu(){var e=_t,t=e.b,n=Xe,i=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(i,e),()=>{t?.update_pending_count(-1,n),n.decrement(i,e)}}function Pi(e){var t=mr|Jt;return _t!==null&&(_t.f|=Oi),{ctx:Dt,deps:null,effects:null,equals:gu,f:t,fn:e,reactions:null,rv:0,v:rr,wv:0,parent:_t,ac:null}}const Yi=Symbol("obsolete");function ud(e,t,n){let i=_t;i===null&&$l();var a=void 0,o=li(rr),s=!pt,u=new Set;return xd(()=>{var c=_t,m=cu();a=m.promise;try{Promise.resolve(e()).then(m.resolve,b=>{b!==ca&&m.reject(b)}).finally(Sa)}catch(b){m.reject(b),Sa()}var y=Xe;if(s){if((c.f&Ii)!==0)var g=xu();if(i.b?.is_rendered())y.async_deriveds.get(c)?.reject(Yi);else for(const b of u.values())b.reject(Yi);u.add(m),y.async_deriveds.set(c,m)}const _=(b,T=void 0)=>{g?.(),u.delete(m),T!==Yi&&(y.activate(),T?(o.f|=Fn,Ni(o,T)):((o.f&Fn)!==0&&(o.f^=Fn),Ni(o,b)),y.deactivate())};m.promise.then(_,b=>_(null,b||"unknown"))}),Jo(()=>{for(const c of u)c.reject(Yi)}),new Promise(c=>{function m(y){function g(){y===a?c(o):m(a)}y.then(g,g)}m(a)})}function ie(e){const t=Pi(e);return $u(t),t}function $o(e){const t=Pi(e);return t.equals=bu,t}function ld(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Tr(t[n])}}function Ho(e){var t,n=_t,i=e.parent;if(!In&&i!==null&&e.v!==rr&&(i.f&(cr|wr))!==0)return Ul(),e.v;bn(i);try{ld(e),t=Vu(e)}finally{bn(n)}return t}function Eu(e){var t=Ho(e);if(!e.equals(t)&&(e.wv=Gu(),(!Xe?.is_fork||e.deps===null)&&(Xe!==null?(Xe.capture(e,t,!0),Ti?.capture(e,t,!0)):e.v=t,e.deps===null))){Vt(e,ir);return}In||(rn!==null?(Vo()||Xe?.is_fork)&&rn.set(e,t):jo(e))}function dd(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Li(()=>{t.ac.abort(ca),t.ac=null}),t.fn!==null&&(t.teardown=wl),aa(t,0),Wo(t))}function Tu(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&Mi(t)}let za=null,bi=null,Xe=null,Ti=null,rn=null,No=null,Xi=!1,$a=!1,ea=null,xa=null;var ns=0;let cd=1;class zn{id=cd++;#e=!1;linked=!0;#r=null;#t=null;async_deriveds=new Map;current=new Map;previous=new Map;#u=new Set;#i=new Set;#o=0;#n=new Map;#s=null;#a=[];#m=[];#l=new Set;#d=new Set;#v=new Map;#_=new Set;is_fork=!1;#c=!1;constructor(){bi===null?za=bi=this:(bi.#t=this,this.#r=bi),bi=this}#w(){if(this.is_fork)return!0;for(const i of this.#n.keys()){for(var t=i,n=!1;t.parent!==null;){if(this.#v.has(t)){n=!0;break}t=t.parent}if(!n)return!0}return!1}skip_effect(t){this.#v.has(t)||this.#v.set(t,{d:[],m:[]}),this.#_.delete(t)}unskip_effect(t,n=i=>this.schedule(i)){var i=this.#v.get(t);if(i){this.#v.delete(t);for(var a of i.d)Vt(a,Jt),n(a);for(a of i.m)Vt(a,Jr),n(a)}this.#_.add(t)}#k(){var t=[];for(const o of this.#a)if(!((o.f&cr)!==0||(o.f&(Jt|Jr))===0)){for(var n=o,i=!1;n.parent!==null;){n=n.parent;var a=n.f;if((a&(jn|on))!==0){if((a&ir)===0){i=!0;break}n.f^=ir}}i||t.push(n)}return this.#a=[],t}#g(){this.#e=!0;for(const u of this.#l)this.#d.delete(u),Vt(u,Jt),this.schedule(u);for(const u of this.#d)Vt(u,Jr),this.schedule(u);this.apply();for(var t=ea=[],n=[],i=xa=[];this.#a.length>0;){ns++>1e3&&(this.#h(),fd());for(const u of this.#k())try{this.#b(u,t,n)}catch(c){throw Au(u),this.#w()||this.discard(),c}}if(Xe=null,i.length>0){var a=zn.ensure();for(const u of i)a.schedule(u)}if(ea=null,xa=null,this.#w()){this.#p(n),this.#p(t);for(const[u,c]of this.#v)Su(u,c);i.length>0&&Xe.#g();return}const o=this.#f();if(o){this.#p(n),this.#p(t),o.#x(this);return}this.#l.clear(),this.#d.clear();for(const u of this.#u)u(this);this.#u.clear(),Ti=this,is(n),is(t),Ti=null,this.#s?.resolve();var s=Xe;if(this.#o===0&&(this.#a.length===0||s!==null)&&this.#h(),this.#a.length>0)if(s!==null){for(const u of this.#a)s.#a.push(u);this.#a=[]}else s=this;s!==null&&(_n.clear(),s.#g())}#b(t,n,i){t.f^=ir;for(var a=t.first;a!==null;){var o=a.f,s=(o&(on|jn))!==0,u=s&&(o&ir)!==0,c=u||(o&wr)!==0||this.#v.has(a);if(!c&&a.fn!==null){s?a.f^=ir:(o&Si)!==0?n.push(a):pa(a)&&((o&tn)!==0&&this.#d.add(a),Mi(a));var m=a.first;if(m!==null){a=m;continue}}for(;a!==null;){var y=a.next;if(y!==null){a=y;break}a=a.parent}}}#f(){for(var t=this.#r;t!==null;){if(!t.is_fork){for(const[n,[,i]]of this.current)if(t.current.has(n)&&!i)return t}t=t.#r}return null}#x(t){for(const[i,a]of t.current)!this.previous.has(i)&&t.previous.has(i)&&this.previous.set(i,t.previous.get(i)),this.current.set(i,a);for(const[i,a]of t.async_deriveds){const o=this.async_deriveds.get(i);o&&a.promise.then(o.resolve).catch(o.reject)}t.async_deriveds.clear(),this.transfer_effects(t.#l,t.#d);const n=i=>{var a=i.reactions;if(a!==null&&!((i.f&mr)!==0&&(i.f&(Jt|Jr))===0))for(const u of a){var o=u.f;if((o&mr)!==0)n(u);else{var s=u;o&(Ei|tn)&&!this.async_deriveds.has(s)&&(this.#d.delete(s),Vt(s,Jt),this.schedule(s))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>t.discard()),t.#h(),Xe=this,this.#g()}#p(t){for(var n=0;n<t.length;n+=1)ku(t[n],this.#l,this.#d)}capture(t,n,i=!1){t.v!==rr&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&Fn)===0&&(this.current.set(t,[n,i]),rn?.set(t,n)),this.is_fork||(t.v=n)}activate(){Xe=this}deactivate(){Xe=null,rn=null}flush(){try{$a=!0,Xe=this,this.#g()}finally{ns=0,No=null,ea=null,xa=null,$a=!1,Xe=null,rn=null,_n.clear()}}discard(){for(const t of this.#i)t(this);this.#i.clear();for(const t of this.async_deriveds.values())t.reject(Yi);this.#h(),this.#s?.resolve()}register_created_effect(t){this.#m.push(t)}#y(){for(let g=za;g!==null;g=g.#t){var t=g.id<this.id,n=[];for(const[_,[b,T]]of this.current){if(g.current.has(_)){var i=g.current.get(_)[0];if(t&&b!==i)g.current.set(_,[b,T]);else continue}n.push(_)}if(t)for(const[_,b]of this.async_deriveds){const T=g.async_deriveds.get(_);T&&b.promise.then(T.resolve).catch(T.reject)}var a=[...g.current.keys()].filter(_=>!g.current.get(_)[1]);if(!(!g.#e||a.length===0)){var o=a.filter(_=>!this.current.has(_));if(o.length===0)t&&g.discard();else if(n.length>0){if(t)for(const _ of this.#_)g.unskip_effect(_,b=>{(b.f&(tn|Ei))!==0?g.schedule(b):g.#p([b])});g.activate();var s=new Set,u=new Map;for(var c of n)Cu(c,o,s,u);u=new Map;var m=[...g.current].filter(([_,b])=>{const T=this.current.get(_);return T?T[0]!==b[0]||T[1]!==b[1]:!0}).map(([_])=>_);if(m.length>0)for(const _ of this.#m)(_.f&(cr|wr|Ta))===0&&Go(_,m,u)&&((_.f&(Ei|tn))!==0?(Vt(_,Jt),g.schedule(_)):g.#l.add(_));if(g.#a.length>0&&!g.#c){g.apply();for(var y of g.#k())g.#b(y,[],[])}g.deactivate()}}}}increment(t,n){if(this.#o+=1,t){let i=this.#n.get(n)??0;this.#n.set(n,i+1)}}decrement(t,n){if(this.#o-=1,t){let i=this.#n.get(n)??0;i===1?this.#n.delete(n):this.#n.set(n,i-1)}this.#c||(this.#c=!0,Pn(()=>{this.#c=!1,this.linked&&this.flush()}))}transfer_effects(t,n){for(const i of t)this.#l.add(i);for(const i of n)this.#d.add(i);t.clear(),n.clear()}oncommit(t){this.#u.add(t)}ondiscard(t){this.#i.add(t)}settled(){return(this.#s??=cu()).promise}static ensure(){if(Xe===null){const t=Xe=new zn;!$a&&!Xi&&Pn(()=>{t.#e||t.flush()})}return Xe}apply(){{rn=null;return}}schedule(t){if(No=t,t.b?.is_pending&&(t.f&(Si|da|vu))!==0&&(t.f&Ii)===0){t.b.defer_effect(t);return}this.#a.push(t)}#h(){if(this.linked){var t=this.#r,n=this.#t;t===null?za=n:t.#t=n,n===null?bi=t:n.#r=t,this.linked=!1}}}function vd(e){var t=Xi,n=Ti;Ti=null,Xi=!0;try{for(var i;;){if(nd(),Xe===null)return i;Xe.flush()}}finally{Xi=t,Ti=n}}function fd(){try{Jl()}catch(e){hn(e,No)}}let An=null;function is(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var i=e[n++];if((i.f&(cr|wr))===0&&pa(i)&&(An=new Set,Mi(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&Fu(i),An?.size>0)){_n.clear();for(const a of An){if((a.f&(cr|wr))!==0)continue;const o=[a];let s=a.parent;for(;s!==null;)An.has(s)&&(An.delete(s),o.push(s)),s=s.parent;for(let u=o.length-1;u>=0;u--){const c=o[u];(c.f&(cr|wr))===0&&Mi(c)}}An.clear()}}An=null}}function Cu(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const a of e.reactions){const o=a.f;(o&mr)!==0?Cu(a,t,n,i):(o&(Ei|tn))!==0&&(o&Jt)===0&&Go(a,t,i)&&(Vt(a,Jt),Ko(a))}}function Go(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const a of e.deps){if(na.call(t,a))return!0;if((a.f&mr)!==0&&Go(a,t,n))return n.set(a,!0),!0}return n.set(e,!1),!1}function Ko(e){Xe.schedule(e)}function Su(e,t){if(!((e.f&on)!==0&&(e.f&ir)!==0)){(e.f&Jt)!==0?t.d.push(e):(e.f&Jr)!==0&&t.m.push(e),Vt(e,ir);for(var n=e.first;n!==null;)Su(n,t),n=n.next}}function Au(e){Vt(e,ir);for(var t=e.first;t!==null;)Au(t),t=t.next}let Aa=new Set;const _n=new Map;let Pu=!1;function li(e,t){var n={f:0,v:e,reactions:null,equals:gu,rv:0,wv:0};return n}function F(e,t){const n=li(e);return $u(n),n}function pd(e,t=!1,n=!0){const i=li(e);return t||(i.equals=bu),Di&&n&&Dt!==null&&Dt.l!==null&&(Dt.l.s??=[]).push(i),i}function w(e,t,n=!1){pt!==null&&(!nn||(pt.f&Ta)!==0)&&va()&&(pt.f&(mr|tn|Ei|Ta))!==0&&(gn===null||!gn.has(e))&&Zl();let i=n?Pt(t):t;return Ni(e,i,xa)}var ri=null,Mo=0;function Ni(e,t,n=null){if(!e.equals(t)){In?_n.set(e,t):_n.has(e)||_n.set(e,e.v);var i=zn.ensure();if(i.capture(e,t),(e.f&mr)!==0){const a=e;(e.f&Jt)!==0&&Ho(a),rn===null&&jo(a)}e.wv=Gu(),ri=null,Mo=0,Nu(e,Jt,n),ri=null,va()&&_t!==null&&(_t.f&ir)!==0&&(_t.f&(on|jn))===0&&(Hr===null?Cd([e]):Hr.push(e)),!i.is_fork&&Aa.size>0&&!Pu&&hd()}return t}function hd(){Pu=!1;for(const e of Aa){(e.f&ir)!==0&&Vt(e,Jr);let t;try{t=pa(e)}catch{t=!0}t&&Mi(e)}Aa.clear()}function ta(e){w(e,e.v+1)}function Nu(e,t,n){var i=e.reactions;if(i!==null){var a=va(),o=i.length;if(Mo+=o,Mo>1e5&&ri===null&&(ri=new Set),ri!==null){if(ri.has(e))return;ri.add(e)}for(var s=0;s<o;s++){var u=i[s],c=u.f;if(!(!a&&u===_t)){var m=(c&Jt)===0;if(m&&Vt(u,t),(c&Ta)!==0)Aa.add(u);else if((c&mr)!==0){var y=u;rn?.delete(y),Nu(y,Jr,n)}else if(m){var g=u;(c&tn)!==0&&An!==null&&An.add(g),n!==null?n.push(g):Ko(g)}}}}}function Pt(e){if(typeof e!="object"||e===null||Mn in e||pu in e)return e;const t=Oa(e);if(t!==du&&t!==yl)return e;var n=new Map,i=la(e),a=F(0),o=oi,s=u=>{if(oi===o)return u();var c=pt,m=oi;Wr(null),us(o);var y=u();return Wr(c),us(m),y};return i&&n.set("length",F(e.length)),new Proxy(e,{defineProperty(u,c,m){(!("value"in m)||m.configurable===!1||m.enumerable===!1||m.writable===!1)&&Yl();var y=n.get(c);return y===void 0?s(()=>{var g=F(m.value);return n.set(c,g),g}):w(y,m.value,!0),!0},deleteProperty(u,c){var m=n.get(c);if(m===void 0){if(c in u){const y=s(()=>F(rr));n.set(c,y),ta(a)}}else w(m,rr),ta(a);return!0},get(u,c,m){if(c===Mn)return e;var y=n.get(c),g=c in u;if(y===void 0&&(!g||xi(u,c)?.writable)&&(y=s(()=>{var b=Pt(g?u[c]:rr),T=F(b);return T}),n.set(c,y)),y!==void 0){var _=r(y);return _===rr?void 0:_}return Reflect.get(u,c,m)},getOwnPropertyDescriptor(u,c){this.has?.(u,c);var m=Reflect.getOwnPropertyDescriptor(u,c),y=n.get(c);if(y!==void 0){var g=r(y);if(g===rr)return;if(m&&"value"in m)m.value=g;else return{enumerable:!0,configurable:!0,value:g,writable:!0}}return m},has(u,c){if(c===Mn)return!0;var m=n.get(c),y=m!==void 0&&m.v!==rr||Reflect.has(u,c);if(m!==void 0||_t!==null&&(!y||xi(u,c)?.writable)){m===void 0&&(m=s(()=>{var _=y?Pt(u[c]):rr,b=F(_);return b}),n.set(c,m));var g=r(m);if(g===rr)return!1}return y},set(u,c,m,y){var g=n.get(c),_=c in u;if(i&&c==="length")for(var b=m;b<g.v;b+=1){var T=n.get(b+"");T!==void 0?w(T,rr):b in u&&(T=s(()=>F(rr)),n.set(b+"",T))}if(g===void 0)(!_||xi(u,c)?.writable)&&(g=s(()=>F(void 0)),w(g,Pt(m)),n.set(c,g));else{_=g.v!==rr;var A=s(()=>Pt(m));w(g,A)}var C=Reflect.getOwnPropertyDescriptor(u,c);if(C?.set&&C.set.call(y,m),!_){if(i&&typeof c=="string"){var E=n.get("length"),O=Number(c);Number.isInteger(O)&&O>=E.v&&w(E,O+1)}ta(a)}return!0},ownKeys(u){r(a);var c=Reflect.ownKeys(u).filter(g=>{var _=n.get(g);return _===void 0||_.v!==rr});for(var[m,y]of n)y.v!==rr&&!(m in u)&&c.push(m);return c},setPrototypeOf(){Ql()}})}function as(e){try{if(e!==null&&typeof e=="object"&&Mn in e)return e[Mn]}catch{}return e}function Mu(e,t){return Object.is(as(e),as(t))}var os,Ru,Iu,Ou;function md(){if(os===void 0){os=window,Ru=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Iu=xi(t,"firstChild").get,Ou=xi(t,"nextSibling").get,ts(e)&&(e[So]=void 0,e[hu]=null,e[Ao]=void 0,e.__e=void 0),ts(n)&&(n[Po]=void 0)}}function Rn(e=""){return document.createTextNode(e)}function di(e){return Iu.call(e)}function fa(e){return Ou.call(e)}function h(e,t){return di(e)}function Pe(e,t=!1){{var n=di(e);return n instanceof Comment&&n.data===""?fa(n):n}}function f(e,t=!1){return di(e)}function l(e,t=1,n=!1){let i=e;for(;t--;)i=fa(i);return i}function _d(e){e.textContent=""}function Du(){return!1}function gd(e,t,n){return n?document.createElement(e,{is:n}):document.createElement(e)}function bd(e){var t=_t;if(t===null)return pt.f|=Fn,e;if((t.f&Ii)===0&&(t.f&Si)===0)throw e;hn(e,t)}function hn(e,t){if(e===_u)throw e;if(!(t!==null&&(t.f&cr)!==0)){for(;t!==null;){if((t.f&Co)!==0&&(t.f&(cr|ia))===0){if((t.f&Ii)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}function Lu(e){_t===null&&(pt===null&&Vl(),Kl()),In&&Gl()}function yd(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function yn(e,t){var n=_t;n!==null&&(n.f&wr)!==0&&(e|=wr);var i={ctx:Dt,deps:null,nodes:null,f:e|Jt|an,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Xe?.register_created_effect(i);var a=i;if((e&Si)!==0)ea!==null?ea.push(i):zn.ensure().schedule(i);else if(t!==null){try{Mi(i)}catch(s){throw Tr(i),s}a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&(a.f&Oi)===0&&(a=a.first,(e&tn)!==0&&(e&ui)!==0&&a!==null&&(a.f|=ui))}if(a!==null&&(a.parent=n,n!==null&&yd(a,n),pt!==null&&(pt.f&mr)!==0&&(e&jn)===0)){var o=pt;(o.effects??=[]).push(a)}return i}function Vo(){return pt!==null&&!nn}function Jo(e){const t=yn(da,null);return Vt(t,ir),t.teardown=e,t}function sn(e){Lu();var t=_t.f,n=!pt&&(t&on)!==0&&Dt!==null&&!Dt.i;if(n){var i=Dt;(i.e??=[]).push(e)}else return Bu(e)}function Bu(e){return yn(Si|fu,e)}function wd(e){return Lu(),yn(da|fu,e)}function kd(e){zn.ensure();const t=yn(jn|Oi,e);return(n={})=>new Promise(i=>{n.outro?ai(t,()=>{Tr(t),i(void 0)}):(Tr(t),i(void 0))})}function qu(e){return yn(Si,e)}function xd(e){return yn(Ei|Oi,e)}function Da(e,t=0){return yn(da|t,e)}function x(e,t=[],n=[],i=[]){od(i,t,n,a=>{yn(da,()=>{e(...a.map(r))})})}function La(e,t=0){var n=yn(tn|t,e);return n}function Gr(e){return yn(on|Oi,e)}function Uu(e){var t=e.teardown;if(t!==null){const n=In,i=pt;ss(!0),Wr(null);try{t.call(null)}catch(a){hn(a,e.parent)}finally{ss(n),Wr(i)}}}function Wo(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const a=n.ac;a!==null&&Li(()=>{a.abort(ca)});var i=n.next;(n.f&jn)!==0?n.parent=null:Tr(n,t),n=i}}function Ed(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&on)===0&&Tr(t),t=n}}function Tr(e,t=!0){var n=!1;(t||(e.f&xl)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Td(e.nodes.start,e.nodes.end),n=!0),e.f|=ia,Wo(e,t&&!n),aa(e,0);var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)o.stop();Uu(e),e.f^=ia,e.f|=cr;var a=e.parent;a!==null&&a.first!==null&&Fu(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Td(e,t){for(;e!==null;){var n=e===t?null:fa(e);e.remove(),e=n}}function Fu(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function ai(e,t,n=!0){var i=[];e.f|=Uo,ju(e,i,!0);var a=()=>{n&&Tr(e),t&&t()},o=i.length;if(o>0){var s=()=>--o||a();for(var u of i)u.out(s)}else a()}function ju(e,t,n){if((e.f&wr)===0){e.f^=wr;var i=e.nodes&&e.nodes.t;if(i!==null)for(const u of i)(u.is_global||n)&&t.push(u);for(var a=e.first;a!==null;){var o=a.next;if((a.f&jn)===0){var s=(a.f&ui)!==0||(a.f&on)!==0&&(e.f&tn)!==0;ju(a,t,s?n:!1)}a=o}}}function Pa(e){e.f&=~Uo,zu(e,!0)}function zu(e,t){if((e.f&Uo)===0&&(e.f&wr)!==0){e.f^=wr,(e.f&ir)===0&&(Vt(e,Jt),zn.ensure().schedule(e));for(var n=e.first;n!==null;){var i=n.next,a=(n.f&ui)!==0||(n.f&on)!==0;zu(n,a?t:!1),n=i}var o=e.nodes&&e.nodes.t;if(o!==null)for(const s of o)(s.is_global||t)&&s.in()}}function Yo(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;n!==null;){var a=n===i?null:fa(n);t.append(n),n=a}}let In=!1;function ss(e){In=e}let pt=null,nn=!1;function Wr(e){pt=e}let _t=null;function bn(e){_t=e}let gn=null;function $u(e){pt!==null&&((pt.f&Ca)!==0||(pt.f&mr)!==0)&&(gn??=new Set).add(e)}let Er=null,Dr=0,Hr=null;function Cd(e){Hr=e}let Hu=1,ii=0,oi=ii;function us(e){oi=e}function Gu(){return++Hu}function pa(e){var t=e.f;if((t&Jt)!==0)return!0;if((t&Jr)!==0){for(var n=e.deps,i=n.length,a=0;a<i;a++){var o=n[a];if(pa(o)&&Eu(o),o.wv>e.wv)return!0}(t&an)!==0&&rn===null&&Vt(e,ir)}return!1}function Ku(e,t,n=!0){var i=e.reactions;if(i!==null&&!(gn!==null&&gn.has(e)))for(var a=0;a<i.length;a++){var o=i[a];(o.f&mr)!==0?Ku(o,t,!1):t===o&&(n?Vt(o,Jt):(o.f&ir)!==0&&Vt(o,Jr),Ko(o))}}function Vu(e){var t=Er,n=Dr,i=Hr,a=pt,o=gn,s=Dt,u=nn,c=oi,m=e.f;Er=null,Dr=0,Hr=null,pt=(m&(on|jn))===0?e:null,gn=null,Ai(e.ctx),nn=!1,oi=++ii,e.ac!==null&&(Li(()=>{e.ac.abort(ca)}),e.ac=null);try{e.f|=Ca;var y=e.fn,g=y();e.f|=Ii;var _=ls(e);if(va()&&Hr!==null&&!nn&&_!==null&&(e.f&(mr|Jr|Jt))===0)for(var b=0;b<Hr.length;b++)Ku(Hr[b],e);if(a!==null&&a!==e){if(ii++,a.deps!==null)for(let T=0;T<n;T+=1)a.deps[T].rv=ii;if(t!==null)for(const T of t)T.rv=ii;Hr!==null&&(i===null?i=Hr:i.push(...Hr))}return(e.f&Fn)!==0&&(e.f^=Fn),g}catch(T){return ls(e),bd(T)}finally{e.f^=Ca,Er=t,Dr=n,Hr=i,pt=a,gn=o,Ai(s),nn=u,oi=c}}function ls(e){var t=e.deps,n=Xe?.is_fork;if(Er!==null){var i;if(n||aa(e,Dr),t!==null&&Dr>0)for(t.length=Dr+Er.length,i=0;i<Er.length;i++)t[Dr+i]=Er[i];else e.deps=t=Er;if(Vo()&&(e.f&an)!==0)for(i=Dr;i<t.length;i++)(t[i].reactions??=[]).push(e)}else!n&&t!==null&&Dr<t.length&&(aa(e,Dr),t.length=Dr);return t}function Sd(e,t){let n=t.reactions;if(n!==null){var i=bl.call(n,e);if(i!==-1){var a=n.length-1;a===0?n=t.reactions=null:(n[i]=n[a],n.pop())}}if(n===null&&(t.f&mr)!==0&&(Er===null||!na.call(Er,t))){var o=t;(o.f&an)!==0&&(o.f^=an),o.v!==rr&&jo(o),o.ac!==null&&Li(()=>{o.ac.abort(ca),o.ac=null,Vt(o,Jt)}),dd(o),aa(o,0)}}function aa(e,t){var n=e.deps;if(n!==null)for(var i=t;i<n.length;i++)Sd(e,n[i])}function Mi(e){var t=e.f;if((t&cr)===0){Vt(e,ir);var n=_t;_t=e;try{(t&(tn|vu))!==0?Ed(e):Wo(e),Uu(e);var i=Vu(e);e.teardown=typeof i=="function"?i:null,e.wv=Hu;var a;su&&ed&&(e.f&Jt)!==0&&e.deps}finally{_t=n}}}async function Ju(){await Promise.resolve(),vd()}function r(e){var t=e.f,n=(t&mr)!==0;if(pt!==null&&!nn){var i=_t!==null&&(_t.f&cr)!==0;if(!i&&(gn===null||!gn.has(e))){var a=pt.deps;if((pt.f&Ca)!==0)e.rv<ii&&(e.rv=ii,Er===null&&a!==null&&a[Dr]===e?Dr++:Er===null?Er=[e]:Er.push(e));else{pt.deps??=[],na.call(pt.deps,e)||pt.deps.push(e);var o=e.reactions;o===null?e.reactions=[pt]:na.call(o,pt)||o.push(pt)}}}if(In&&_n.has(e))return _n.get(e);if(n){var s=e;if(In){var u=s.v;return((s.f&ir)===0&&s.reactions!==null||Yu(s))&&(u=Ho(s)),_n.set(s,u),u}var c=(s.f&an)===0&&!nn&&pt!==null&&(pt.f&an)!==0,m=(s.f&Ii)===0;pa(s)&&(c&&(s.f|=an),Eu(s)),c&&!m&&(Tu(s),Wu(s))}if(rn?.has(e))return rn.get(e);if((e.f&Fn)!==0)throw e.v;return e.v}function Wu(e){if(e.f|=an,e.deps!==null)for(const n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:na.call(t,e)||t.push(e),(n.f&mr)!==0&&(n.f&an)===0&&(Tu(n),Wu(n))}}function Yu(e){if(e.v===rr)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(_n.has(t)||(t.f&mr)!==0&&Yu(t))return!0;return!1}function $n(e){var t=nn;try{return nn=!0,e()}finally{nn=t}}function Ad(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Mn in e)Ro(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&Mn in n&&Ro(n)}}}function Ro(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let i in e)try{Ro(e[i],t)}catch{}const n=Oa(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const i=lu(n);for(let a in i){const o=i[a].get;if(o)try{o.call(e)}catch{}}}}}const Pd=["touchstart","touchmove"];function Nd(e){return Pd.includes(e)}const Qi=Symbol("events"),Qu=new Set,Io=new Set;function Md(e,t,n,i={}){function a(o){if(i.capture||Oo.call(t,o),!o.cancelBubble)return Li(()=>n?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?(a.__removed=!1,Pn(()=>{a.__removed||t.addEventListener(e,a,i)})):t.addEventListener(e,a,i),a}function Na(e,t,n,i,a){var o={capture:i,passive:a},s=Md(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Jo(()=>{s.__removed=!0,t.removeEventListener(e,s,o)})}function N(e,t,n){(t[Qi]??={})[e]=n}function or(e){for(var t=0;t<e.length;t++)Qu.add(e[t]);for(var n of Io)n(e)}let Ha=null,Ga=!1;function Oo(e){var t=this,n=t.ownerDocument,i=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;Ha=e,Ga||(Ga=!0,setTimeout(()=>{Ga=!1,Ha=null}));var s=0,u=Ha===e&&e[Qi];if(u){var c=a.indexOf(u);if(c!==-1&&(t===document||t===window)){e[Qi]=t;return}var m=a.indexOf(t);if(m===-1)return;c<=m&&(s=c)}if(o=a[s]||e.target,o!==t){uu(e,"currentTarget",{configurable:!0,get(){return o||n}});var y=pt,g=_t;Wr(null),bn(null);try{for(var _,b=[];o!==null&&o!==t;){try{var T=o[Qi]?.[i];T!=null&&(!o.disabled||e.target===o)&&T.call(o,e)}catch(A){_?b.push(A):_=A}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(_){for(let A of b)queueMicrotask(()=>{throw A});throw _}}finally{e[Qi]=t,delete e.currentTarget,Wr(y),bn(g)}}}const Rd=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Id(e){return Rd?.createHTML(e)??e}function Zu(e){var t=gd("template");return t.innerHTML=Id(e.replaceAll("<!>","<!---->")),t.content}function oa(e,t){var n=_t;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function S(e,t){var n=(t&Ll)!==0,i=(t&Bl)!==0,a,o=!e.startsWith("<!>");return()=>{a===void 0&&(a=Zu(o?e:"<!>"+e),n||(a=di(a)));var s=i||Ru?document.importNode(a,!0):a.cloneNode(!0);if(n){var u=di(s),c=s.lastChild;oa(u,c)}else oa(s,s);return s}}function Od(e,t,n="svg"){var i=!e.startsWith("<!>"),a=`<${n}>${i?e:"<!>"+e}</${n}>`,o;return()=>{if(!o){var s=Zu(a),u=di(s);o=di(u)}var c=o.cloneNode(!0);return oa(c,c),c}}function Dd(e,t){return Od(e,t,"svg")}function ki(e=""){{var t=Rn(e+"");return oa(t,t),t}}function ci(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Rn();return e.append(t,n),oa(t,n),e}function k(e,t){e!==null&&e.before(t)}function Ld(e){let t=0,n=li(0),i;return()=>{Vo()&&(r(n),Da(()=>(t===0&&(i=$n(()=>e(()=>ta(n)))),t+=1,()=>{Pn(()=>{t-=1,t===0&&(i?.(),i=void 0,ta(n))})})))}}var Bd=ui|Oi;function qd(e,t,n,i){new Ud(e,t,n,i)}class Ud{parent;is_pending=!1;transform_error;#e;#r=null;#t;#u;#i;#o=null;#n=null;#s=null;#a=null;#m=0;#l=0;#d=!1;#v=new Set;#_=new Set;#c=null;#w=Ld(()=>(this.#c=li(this.#m),()=>{this.#c=null}));constructor(t,n,i,a){this.#e=t,this.#t=n,this.#u=o=>{var s=_t;s.b=this,s.f|=Co,i(o)},this.parent=_t.b,this.transform_error=a??this.parent?.transform_error??(o=>o),this.#i=La(()=>{this.#p()},Bd)}#k(){try{this.#o=Gr(()=>this.#u(this.#e))}catch(t){this.error(t)}}#g(t){const n=this.#t.failed,{reset:i,invoke_onerror:a}=this.#b(t);Pn(a),n&&(this.#s=Gr(()=>{n(this.#e,()=>t,()=>i)}))}#b(t){var n=!1,i=!1;const a=()=>{if(!this.#f()){if(n){jl();return}n=!0,i&&Xl(),this.#s!==null&&ai(this.#s,()=>{this.#s=null}),this.#h(()=>{this.#p()})}};return{reset:a,invoke_onerror:()=>{if(!this.#f())try{i=!0,this.#t.onerror?.(t,a),i=!1}catch(s){hn(s,this.#i&&this.#i.parent)}}}}#f(){return(this.#i.f&(cr|ia))!==0}#x(){const t=this.#t.pending;t&&(this.is_pending=!0,this.#n=Gr(()=>t(this.#e)),Pn(()=>{if(!this.#f()){var n=this.#a=document.createDocumentFragment(),i=Rn(),a=!1;if(n.append(i),this.#o=this.#h(()=>{try{return Gr(()=>this.#u(i))}catch(o){try{this.error(o),a=!0}catch(s){hn(s,this.#i.parent)}return null}}),this.#o===null){this.#a=null,a&&this.#y(Xe);return}this.#l===0&&(this.#e.before(n),this.#a=null,ai(this.#n,()=>{this.#n=null}),this.#y(Xe))}}))}#p(){try{if(this.is_pending=this.has_pending_snippet(),this.#l=0,this.#m=0,this.#o=Gr(()=>{this.#u(this.#e)}),this.#l>0){var t=this.#a=document.createDocumentFragment();Yo(this.#o,t);const n=this.#t.pending;this.#n=Gr(()=>n(this.#e))}else this.#y(Xe)}catch(n){this.error(n)}}#y(t){this.is_pending=!1,t.transfer_effects(this.#v,this.#_)}defer_effect(t){ku(t,this.#v,this.#_)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#h(t){var n=_t,i=pt,a=Dt;bn(this.#i),Wr(this.#i),Ai(this.#i.ctx);try{return zn.ensure(),t()}finally{bn(n),Wr(i),Ai(a)}}#E(t,n){if(!this.has_pending_snippet()){this.parent&&this.parent.#E(t,n);return}this.#l+=t,this.#l===0&&(this.#y(n),this.#n&&ai(this.#n,()=>{this.#n=null}),this.#a&&(this.#e.before(this.#a),this.#a=null))}update_pending_count(t,n){this.#E(t,n),this.#m+=t,!(!this.#c||this.#d)&&(this.#d=!0,Pn(()=>{this.#d=!1,this.#c&&Ni(this.#c,this.#m)}))}get_effect_pending(){return this.#w(),r(this.#c)}error(t){if(t===_u||!this.#t.onerror&&!this.#t.failed)throw t;Xe?.is_fork?(this.#o&&Xe.skip_effect(this.#o),this.#n&&Xe.skip_effect(this.#n),this.#s&&Xe.skip_effect(this.#s),Xe.oncommit(()=>{this.#f()||this.#T(t)})):this.#T(t)}#T(t){this.#o&&(Tr(this.#o),this.#o=null),this.#n&&(Tr(this.#n),this.#n=null),this.#s&&(Tr(this.#s),this.#s=null);let n=this.#t.failed;const i=a=>{if(this.#f())return;const{reset:o,invoke_onerror:s}=this.#b(a);s(),n&&!this.#f()&&(this.#s=this.#h(()=>{try{return Gr(()=>{var u=_t;u.b=this,u.f|=Co,n(this.#e,()=>a,()=>o)})}catch(u){return hn(u,this.#i.parent),null}}))};Pn(()=>{if(!this.#f()){var a;try{a=this.transform_error(t)}catch(o){hn(o,this.#i&&this.#i.parent);return}a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(i,o=>hn(o,this.#i&&this.#i.parent)):i(a)}})}}function v(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[Po]??=e.nodeValue)&&(e[Po]=n,e.nodeValue=`${n}`)}function Fd(e,t){return jd(e,t)}const ma=new Map;function jd(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:u}){md();var c=void 0,m=kd(()=>{var y=n??t.appendChild(Rn());qd(y,{pending:()=>{}},b=>{$t({});var T=Dt;o&&(T.c=o),a&&(i.$$events=a),c=e(b,i)||Fo(),Ht()},u);var g=new Set,_=b=>{for(var T=0;T<b.length;T++){var A=b[T];if(!g.has(A)){g.add(A);var C=Nd(A);for(const P of[t,document]){var E=ma.get(P);E===void 0&&(E=new Map,ma.set(P,E));var O=E.get(A);O===void 0?(P.addEventListener(A,Oo,{passive:C}),E.set(A,1)):E.set(A,O+1)}}}};return _(Ia(Qu)),Io.add(_),()=>{for(var b of g)for(const C of[t,document]){var T=ma.get(C),A=T.get(b);--A==0?(C.removeEventListener(b,Oo),T.delete(b),T.size===0&&ma.delete(C)):T.set(b,A)}Io.delete(_),y!==n&&y.parentNode?.removeChild(y)}});return zd.set(c,m),c}let zd=new WeakMap;class Xu{anchor;#e=new Map;#r=new Map;#t=new Map;#u=new Set;#i=!0;constructor(t,n=!0){this.anchor=t,this.#i=n}#o=t=>{if(this.#e.has(t)){var n=this.#e.get(t),i=this.#r.get(n);if(i)Pa(i),this.#u.delete(n);else{var a=this.#t.get(n);a&&(Pa(a.effect),this.#r.set(n,a.effect),this.#t.delete(n),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),i=a.effect)}for(const[o,s]of this.#e){if(this.#e.delete(o),o===t)break;const u=this.#t.get(s);u&&(Tr(u.effect),this.#t.delete(s))}for(const[o,s]of this.#r){if(o===n||this.#u.has(o))continue;const u=()=>{if(Array.from(this.#e.values()).includes(o)){var m=document.createDocumentFragment();Yo(s,m),m.append(Rn()),this.#t.set(o,{effect:s,fragment:m})}else Tr(s);this.#u.delete(o),this.#r.delete(o)};this.#i||!i?(this.#u.add(o),ai(s,u,!1)):u()}}};#n=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[i,a]of this.#t)n.includes(i)||(Tr(a.effect),this.#t.delete(i))};ensure(t,n){var i=Xe,a=Du();if(n&&!this.#r.has(t)&&!this.#t.has(t))if(a){var o=document.createDocumentFragment(),s=Rn();o.append(s),this.#t.set(t,{effect:Gr(()=>n(s)),fragment:o})}else this.#r.set(t,Gr(()=>n(this.anchor)));if(this.#e.set(i,t),a){for(const[u,c]of this.#r)u===t?i.unskip_effect(c):i.skip_effect(c);for(const[u,c]of this.#t)u===t?i.unskip_effect(c.effect):i.skip_effect(c.effect);i.oncommit(this.#o),i.ondiscard(this.#n)}else this.#o(i)}}function H(e,t,n=!1){var i=new Xu(e),a=n?ui:0;function o(s,u){i.ensure(s,u)}La(()=>{var s=!1;t((u,c=0)=>{s=!0,o(c,u)}),s||o(-1,null)},a)}function si(e,t){return t}function $d(e,t,n){for(var i=[],a=t.length,o,s=t.length,u=0;u<a;u++){let g=t[u];ai(g,()=>{if(o){if(o.pending.delete(g),o.done.add(g),o.pending.size===0){var _=e.outrogroups;Do(e,Ia(o.done)),_.delete(o),_.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var c=i.length===0&&n!==null&&e.pending.size===0;if(c){var m=n,y=m.parentNode;_d(y),y.append(m),e.items.clear()}Do(e,t,!c)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Do(e,t,n=!0){var i;if(e.pending.size>0){i=new Set;for(const s of e.pending.values())for(const u of s)i.add(e.items.get(u).e)}for(var a=0;a<t.length;a++){var o=t[a];if(i?.has(o)){o.f|=mn;const s=document.createDocumentFragment();Yo(o,s)}else Tr(t[a],n)}}var ds;function et(e,t,n,i,a,o=null){var s=e,u=new Map,c=(t&mu)!==0;if(c){var m=e;s=m.appendChild(Rn())}var y=null,g=$o(()=>{var O=n();return la(O)?O:O==null?[]:Ia(O)}),_=new Map,b=!0;function T(O){if((E.effect.f&cr)===0){E.pending.delete(O);var P=r(g);E.fallback=y,Hd(E,P,s,t,i),y!==null&&(P.length===0?(y.f&mn)===0?Pa(y):(y.f^=mn,Zi(y,null,s)):ai(y,()=>{y=null}))}}function A(O){E.pending.delete(O)}var C=La(()=>{for(var O=r(g),P=O.length,L=new Set,Z=Xe,j=Du(),G=0;G<P;G+=1){var U=O[G],q=i(U,G),I=b?null:u.get(q);I?(I.v&&Ni(I.v,U),I.i&&Ni(I.i,G),j&&Z.unskip_effect(I.e)):(I=Gd(u,b?s:ds??=Rn(),U,q,G,a,t,n),b||(I.e.f|=mn),u.set(q,I)),L.add(q)}if(P===0&&o&&!y&&(b?y=Gr(()=>o(s)):(y=Gr(()=>o(ds??=Rn())),y.f|=mn)),P>L.size&&Hl(),!b)if(_.set(Z,L),j){for(const[R,V]of u)L.has(R)||Z.skip_effect(V.e);Z.oncommit(T),Z.ondiscard(A)}else T(Z);r(g)}),E={effect:C,items:u,pending:_,outrogroups:null,fallback:y};b=!1}function Ki(e){for(;e!==null&&(e.f&on)===0;)e=e.next;return e}function Hd(e,t,n,i,a){var o=(i&Pl)!==0,s=t.length,u=e.items,c=Ki(e.effect.first),m,y=null,g,_=[],b=[],T,A,C,E;if(o)for(E=0;E<s;E+=1)T=t[E],A=a(T,E),C=u.get(A).e,(C.f&mn)===0&&(C.nodes?.a?.measure(),(g??=new Set).add(C));for(E=0;E<s;E+=1){if(T=t[E],A=a(T,E),C=u.get(A).e,e.outrogroups!==null)for(const I of e.outrogroups)I.pending.delete(C),I.done.delete(C);if((C.f&wr)!==0&&(Pa(C),o&&(C.nodes?.a?.unfix(),(g??=new Set).delete(C))),(C.f&mn)!==0)if(C.f^=mn,C===c)Zi(C,null,n);else{var O=y?y.next:c;C===e.effect.last&&(e.effect.last=C.prev),C.prev&&(C.prev.next=C.next),C.next&&(C.next.prev=C.prev),qn(e,y,C),qn(e,C,O),Zi(C,O,n),y=C,_=[],b=[],c=Ki(y.next);continue}if(C!==c){if(m!==void 0&&m.has(C)){if(_.length<b.length){var P=b[0],L;y=P.prev;var Z=_[0],j=_[_.length-1];for(L=0;L<_.length;L+=1)Zi(_[L],P,n);for(L=0;L<b.length;L+=1)m.delete(b[L]);qn(e,Z.prev,j.next),qn(e,y,Z),qn(e,j,P),c=P,y=j,E-=1,_=[],b=[]}else m.delete(C),Zi(C,c,n),qn(e,C.prev,C.next),qn(e,C,y===null?e.effect.first:y.next),qn(e,y,C),y=C;continue}for(_=[],b=[];c!==null&&c!==C;)(m??=new Set).add(c),b.push(c),c=Ki(c.next);if(c===null)continue}(C.f&mn)===0&&_.push(C),y=C,c=Ki(C.next)}if(e.outrogroups!==null){for(const I of e.outrogroups)I.pending.size===0&&(Do(e,Ia(I.done)),e.outrogroups?.delete(I));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||m!==void 0){var G=[];if(m!==void 0)for(C of m)(C.f&wr)===0&&G.push(C);for(;c!==null;)(c.f&wr)===0&&c!==e.fallback&&G.push(c),c=Ki(c.next);var U=G.length;if(U>0){var q=(i&mu)!==0&&s===0?n:null;if(o){for(E=0;E<U;E+=1)G[E].nodes?.a?.measure();for(E=0;E<U;E+=1)G[E].nodes?.a?.fix()}$d(e,G,q)}}o&&Pn(()=>{if(g!==void 0)for(C of g)C.nodes?.a?.apply()})}function Gd(e,t,n,i,a,o,s,u){var c=(s&Sl)!==0?(s&Nl)===0?pd(n,!1,!1):li(n):null,m=(s&Al)!==0?li(a):null;return{v:c,i:m,e:Gr(()=>(o(t,c??n,m??a,u),()=>{e.delete(i)}))}}function Zi(e,t,n){if(e.nodes)for(var i=e.nodes.start,a=e.nodes.end,o=t&&(t.f&mn)===0?t.nodes.start:n;i!==null;){var s=fa(i);if(o.before(i),i===a)return;i=s}}function qn(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function cs(e,t,...n){var i=new Xu(e);La(()=>{const a=t()??null;i.ensure(a,a&&(o=>a(o,...n)))},ui)}function el(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=el(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Kd(){for(var e,t,n=0,i="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=el(e))&&(i&&(i+=" "),i+=t);return i}function tl(e){return typeof e=="object"?Kd(e):e??""}const vs=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Vd(e,t,n){var i=e==null?"":""+e;if(t&&(i=i?i+" "+t:t),n){for(var a of Object.keys(n))if(n[a])i=i?i+" "+a:a;else if(i.length)for(var o=a.length,s=0;(s=i.indexOf(a,s))>=0;){var u=s+o;(s===0||vs.includes(i[s-1]))&&(u===i.length||vs.includes(i[u]))?i=(s===0?"":i.substring(0,s))+i.substring(u+1):s=u}}return i===""?null:i}function fs(e,t=!1){var n=t?" !important;":";",i="";for(var a of Object.keys(e)){var o=e[a];o!=null&&o!==""&&(i+=" "+a+": "+o+n)}return i}function Jd(e,t){if(t){var n="",i,a;return Array.isArray(t)?(i=t[0],a=t[1]):i=t,i&&(n+=fs(i)),a&&(n+=fs(a,!0)),n=n.trim(),n===""?null:n}return String(e)}function Nt(e,t,n,i,a,o){var s=e[So];if(s!==n||s===void 0){var u=Vd(n,i,o);u==null?e.removeAttribute("class"):e.className=u,e[So]=n}else if(o&&a!==o)for(var c in o){var m=!!o[c];(a==null||m!==!!a[c])&&e.classList.toggle(c,m)}return o}function Ka(e,t={},n,i){for(var a in n){var o=n[a];t[a]!==o&&(n[a]==null?e.style.removeProperty(a):e.style.setProperty(a,o,i))}}function Wd(e,t,n,i){var a=e[Ao];if(a!==t){var o=Jd(t,i);o==null?e.removeAttribute("style"):e.style.cssText=o,e[Ao]=t}else i&&(Array.isArray(i)?(Ka(e,n?.[0],i[0]),Ka(e,n?.[1],i[1],"important")):Ka(e,n,i));return i}function Yd(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Qd(e,t){var n=e.__defaultValue,i=e.multiple,a=i?n??[]:null;if(!(i&&!la(a))){e.selectedIndex;for(var o of e.options){var s=Ci(o);Yd(o,i?a.includes(s):Mu(s,n))}}}function Bi(e,t,n=!1){if(e.multiple){if(t==null)return;if(!la(t))return Fl();for(var i of e.options)i.selected=t.includes(Ci(i));return}for(i of e.options){var a=Ci(i);if(Mu(a,t)){i.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Qt(e){var t=new MutationObserver(n=>{n.every(Zd)||("__defaultValue"in e&&Qd(e),"__value"in e&&Bi(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Jo(()=>{t.disconnect()})}function pr(e,t,n=t){var i=new WeakSet,a=!0;zo(e,"change",o=>{var s=o?"[selected]":":checked",u;if(e.multiple)u=[].map.call(e.querySelectorAll(s),Ci);else{var c=e.querySelector(s)??e.querySelector("option:not([disabled])");u=c&&Ci(c)}n(u),e.__value=u,Xe!==null&&i.add(Xe)}),qu(()=>{var o=t();if(e===document.activeElement){var s=Xe;if(i.has(s))return}if(Bi(e,o,a),a&&o===void 0){var u=e.querySelector(":checked");u!==null&&(o=Ci(u),n(o))}e.__value=o,a=!1})}function Ci(e){return"__value"in e?e.__value:e.value}function Zd(e){if(e.target.closest("selectedcontent")!==null)return!0;if(e.type==="childList"){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(n=>n.nodeName==="SELECTEDCONTENT")}return!1}const Xd=Symbol("is custom element"),ec=Symbol("is html"),tc=Cl?"progress":"PROGRESS";function Sn(e,t){var n=Qo(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==tc)||(e.value=t??"")}function rc(e,t){var n=Qo(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function ne(e,t,n,i){var a=Qo(e);a[t]!==(a[t]=n)&&(t==="loading"&&(e[Tl]=n),n==null?e.removeAttribute(t):typeof n!="string"&&nc(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Qo(e){return e[hu]??={[Xd]:e.nodeName.includes("-"),[ec]:e.namespaceURI===ql}}var ps=new Map;function nc(e){var t=e.getAttribute("is")||e.nodeName,n=ps.get(t);if(n)return n;ps.set(t,n=new Set);for(var i,a=e,o=Element.prototype;o!==a;){i=lu(a);for(var s in i)i[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&n.add(s);a=Oa(a)}return n}function Ee(e,t,n=t){var i=new WeakSet;zo(e,"input",async a=>{var o=a?e.defaultValue:e.value;if(o=Va(e)?Ja(o):o,n(o),Xe!==null&&i.add(Xe),await Ju(),o!==(o=t())){var s=e.selectionStart,u=e.selectionEnd,c=e.value.length;if(e.value=o??"",u!==null){var m=e.value.length;s===u&&u===c&&m>c?(e.selectionStart=m,e.selectionEnd=m):(e.selectionStart=s,e.selectionEnd=Math.min(u,m))}}}),$n(t)==null&&e.value&&(n(Va(e)?Ja(e.value):e.value),Xe!==null&&i.add(Xe)),Da(()=>{var a=t();if(e===document.activeElement){var o=Xe;if(i.has(o))return}Va(e)&&a===Ja(e.value)||e.type==="date"&&!a&&!e.value||a!==e.value&&(e.value=a??"")})}function rl(e,t,n=t){zo(e,"change",i=>{var a=i?e.defaultChecked:e.checked;n(a)}),$n(t)==null&&n(e.checked),Da(()=>{var i=t();e.checked=!!i})}function Va(e){var t=e.type;return t==="number"||t==="range"}function Ja(e){return e===""?null:+e}function Wa(e,t){return e===t||e?.[Mn]===t}function Ba(e=Fo(),t,n,i){var a=Dt.r,o=_t;return qu(()=>{var s,u;return Da(()=>{s=u,u=[],$n(()=>{Wa(n(...u),e)||(t(e,...u),s&&Wa(n(...s),e)&&t(null,...s))})}),()=>{let c=o;for(;c!==a&&c.parent!==null&&c.parent.f&ia;)c=c.parent;const m=()=>{u&&Wa(n(...u),e)&&t(null,...u)},y=c.teardown;c.teardown=()=>{m(),y?.()}}}),e}function ic(e=!1){const t=Dt,n=t.l.u;if(!n)return;let i=()=>Ad(t.s);if(e){let a=0,o={};const s=Pi(()=>{let u=!1;const c=t.s;for(const m in c)c[m]!==o[m]&&(o[m]=c[m],u=!0);return u&&a++,a});i=()=>r(s)}n.b.length&&wd(()=>{hs(t,i),To(n.b)}),sn(()=>{const a=$n(()=>n.m.map(kl));return()=>{for(const o of a)typeof o=="function"&&o()}}),n.a.length&&sn(()=>{hs(t,i),To(n.a)})}function hs(e,t){if(e.l.s)for(const n of e.l.s)r(n);t()}let _a=!1;function ac(e){var t=_a;try{return _a=!1,[e(),_a]}finally{_a=t}}function yr(e,t,n,i){var a=!Di||(n&Rl)!==0,o=(n&Ol)!==0,s=(n&Dl)!==0,u=i,c=!0,m=void 0,y=()=>s&&a?(m??=Pi(i),r(m)):(c&&(c=!1,u=s?$n(i):i),u);let g;if(o){var _=Mn in e||El in e;g=xi(e,t)?.set??(_&&t in e?L=>e[t]=L:void 0)}var b,T=!1;o?[b,T]=ac(()=>e[t]):b=e[t],b===void 0&&i!==void 0&&(b=y(),g&&(a&&Wl(),g(b)));var A;if(a?A=()=>{var L=e[t];return L===void 0?y():(c=!0,L)}:A=()=>{var L=e[t];return L!==void 0&&(u=void 0),L===void 0?u:L},a&&(n&Il)===0)return A;if(g){var C=e.$$legacy;return(function(L,Z){return arguments.length>0?((!a||!Z||C||T)&&g(Z?A():L),L):A()})}var E=!1,O=((n&Ml)!==0?Pi:$o)(()=>(E=!1,A()));o&&r(O);var P=_t;return(function(L,Z){if(arguments.length>0){const j=Z?r(O):a&&o?Pt(L):L;return w(O,j),E=!0,u!==void 0&&(u=j),L}return In&&E||(P.f&cr)!==0?O.v:r(O)})}function Cr(e){Dt===null&&yu(),Di&&Dt.l!==null?sc(Dt).m.push(e):sn(()=>{const t=$n(e);if(typeof t=="function")return t})}function oc(e){Dt===null&&yu(),Cr(()=>()=>$n(e))}function sc(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const uc="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(uc);td();class Lo extends Error{status;details;constructor(t,n,i){super(n),this.name="ApiError",this.status=t,this.details=i}get issues(){const t=this.details;return Array.isArray(t?.issues)?t.issues:[]}}let nl=()=>{};function lc(e){nl=e}async function ft(e,t,n){let i;try{i=await fetch(t,{method:e,...n===void 0?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(n)}})}catch(s){throw new Lo(0,s instanceof Error?s.message:String(s))}const a=await i.text(),o=a===""?void 0:JSON.parse(a);if(!i.ok){i.status===401&&!t.startsWith("/api/auth")&&nl();const s=o;throw new Lo(i.status,s?.error??`${i.status} ${i.statusText}`,s?.details)}return o}const Ie={auth:()=>ft("GET","/api/auth"),login:e=>ft("POST","/api/auth/login",{password:e}),logout:()=>ft("POST","/api/auth/logout",{}),setAccess:e=>ft("PUT","/api/auth",e),status:()=>ft("GET","/api/status"),updateStatus:(e=!1)=>ft("GET",`/api/update${e?"?check=1":""}`),requestUpdate:e=>ft("POST","/api/update",{version:e}),restart:()=>ft("POST","/api/restart",{}),config:()=>ft("GET","/api/config"),saveConfig:e=>ft("PUT","/api/config",e),devices:()=>ft("GET","/api/devices"),device:e=>ft("GET",`/api/devices/${encodeURIComponent(e)}`),saveDevice:(e,t)=>ft("PUT",`/api/devices/${encodeURIComponent(e)}`,t),deleteDevice:e=>ft("DELETE",`/api/devices/${encodeURIComponent(e)}`),deviceState:e=>ft("GET",`/api/devices/${encodeURIComponent(e)}/state`),validate:e=>ft("POST","/api/validate",{device:e}),check:e=>ft("POST","/api/check",e===void 0?{}:{devices:e}),previewStatus:(e,t,n,i)=>ft("POST","/api/preview",{direction:"status",half:e,payload:t,attribute:n,topic:i}),previewCommand:(e,t,n,i)=>ft("POST","/api/preview",{direction:"command",half:e,value:t,attribute:n,fields:i}),publish:(e,t,n=!1,i=0)=>ft("POST","/api/publish",{topic:e,payload:t,retain:n,qos:i}),topics:(e="")=>ft("GET",`/api/topics?prefix=${encodeURIComponent(e)}`),catalog:()=>ft("GET","/api/catalog"),cluster:e=>ft("GET",`/api/catalog/clusters/${encodeURIComponent(e)}`),presets:()=>ft("GET","/api/presets"),applyPreset:(e,t)=>ft("POST",`/api/presets/${encodeURIComponent(e)}/apply`,{values:t}),bridges:()=>ft("GET","/api/bridges"),commissioning:(e,t,n)=>ft("POST",`/api/bridges/${encodeURIComponent(e)}/commissioning`,{open:t,minutes:n}),removeFabric:(e,t)=>ft("DELETE",`/api/bridges/${encodeURIComponent(e)}/fabrics/${t}`),adopt:()=>ft("GET","/api/adopt"),resync:()=>ft("POST","/api/adopt/resync"),adoptDevice:(e,t,n={})=>ft("POST",`/api/adopt/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,n),exportAll:()=>ft("GET","/api/export"),exportDevice:e=>ft("GET",`/api/export?device=${encodeURIComponent(e)}`),importDevices:(e,t)=>ft("POST","/api/import",{devices:e,replace:t}),log:(e=500,t=0)=>ft("GET",`/api/log?limit=${e}&after=${t}`)};function ut(e){if(e instanceof Lo){const t=e.issues;return t.length>0?`${e.message}: ${t.map(n=>`${n.path}: ${n.message}`).join("; ")}`:e.message}return e instanceof Error?e.message:String(e)}class dc{#e=F(void 0);get state(){return r(this.#e)}set state(t){w(this.#e,t,!0)}#r=F(!1);get unreachable(){return r(this.#r)}set unreachable(t){w(this.#r,t,!0)}constructor(){lc(()=>{this.state!==void 0&&(this.state={...this.state,authenticated:!1})})}async load(){try{this.state=await Ie.auth(),this.unreachable=!1}catch{this.unreachable=!0}}async login(t){this.state=await Ie.login(t)}async logout(){const t=this.state?.mode,n=this.state?.logoutUrl;if(t==="proxy"){n!==void 0&&(window.location.href=n);return}this.state=await Ie.logout()}}const nr=new dc,p=(e,t)=>({de:e,en:t}),cc={Devices:p("Geräte","Devices"),Presets:p("Vorlagen","Presets"),Adopt:p("Übernehmen","Adopt"),Bridges:p("Bridges","Bridges"),Log:p("Protokoll","Log"),Check:p("Prüfen","Check"),Configuration:p("Konfiguration","Configuration"),Pages:p("Seiten","Pages"),Live:p("Live","Live"),Language:p("Sprache","Language"),"Browser language":p("Sprache des Browsers","Browser language"),"Theme: {theme}":p("Design: {theme}","Theme: {theme}"),system:p("System","system"),light:p("hell","light"),dark:p("dunkel","dark"),"Connected to the broker":p("Mit dem Broker verbunden","Connected to the broker"),"Not connected to the broker":p("Nicht mit dem Broker verbunden","Not connected to the broker"),"Event stream connected":p("Ereignisstrom verbunden","Event stream connected"),"Event stream disconnected":p("Ereignisstrom getrennt","Event stream disconnected"),"Show fewer":p("Weniger anzeigen","Show fewer"),"{count} more":p("{count} weitere","{count} more"),Dismiss:p("Schließen","Dismiss"),Close:p("Schließen","Close"),Cancel:p("Abbrechen","Cancel"),OK:p("OK","OK"),Confirm:p("Bestätigen","Confirm"),Input:p("Eingabe","Input"),Apply:p("Übernehmen","Apply"),Save:p("Speichern","Save"),Reload:p("Neu laden","Reload"),Remove:p("Entfernen","Remove"),Delete:p("Löschen","Delete"),Duplicate:p("Duplizieren","Duplicate"),Export:p("Exportieren","Export"),Import:p("Importieren","Import"),Filter:p("Filter","Filter"),Open:p("Öffnen","Open"),Update:p("Aktualisieren","Update"),Loading:p("Wird geladen","Loading"),Name:p("Name","Name"),Key:p("Schlüssel","Key"),error:p("Fehler","error"),warning:p("Warnung","warning"),ok:p("ok","ok"),"New device":p("Neues Gerät","New device"),"From preset":p("Aus Vorlage","From preset"),"{count} devices":p("{count} Geräte","{count} devices"),"No devices yet. Create one by hand, apply a preset, or adopt a discovered device.":p("Noch keine Geräte. Lege eines von Hand an, wende eine Vorlage an oder übernimm ein entdecktes Gerät.","No devices yet. Create one by hand, apply a preset, or adopt a discovered device."),"Device types":p("Gerätetypen","Device types"),"Device type":p("Gerätetyp","Device type"),Source:p("Quelle","Source"),Bridge:p("Bridge","Bridge"),Endpoint:p("Endpunkt","Endpoint"),State:p("Zustand","State"),manual:p("manuell","manual"),preset:p("Vorlage","preset"),orphaned:p("verwaist","orphaned"),disabled:p("deaktiviert","disabled"),"not built":p("nicht gebaut","not built"),reachable:p("erreichbar","reachable"),unreachable:p("nicht erreichbar","unreachable"),"{count} errors":p("{count} Fehler","{count} errors"),"{count} warnings":p("{count} Warnungen","{count} warnings"),Disable:p("Deaktivieren","Disable"),Enable:p("Aktivieren","Enable"),"Key of the copy":p("Schlüssel der Kopie","Key of the copy"),"Delete {name}? Controllers lose the device, its rooms and automations.":p("{name} löschen? Controller verlieren das Gerät, seine Räume und Automationen.","Delete {name}? Controllers lose the device, its rooms and automations."),"{name} deleted":p("{name} gelöscht","{name} deleted"),"The key is the Matter endpoint id: stable, never renamed. Letters, digits, : . _ -":p("Der Schlüssel ist die Matter-Endpunkt-Id: stabil, wird nie umbenannt. Buchstaben, Ziffern, : . _ -","The key is the Matter endpoint id: stable, never renamed. Letters, digits, : . _ -"),"The device type brings its mandatory clusters; their mappings are filled in the editor.":p("Der Gerätetyp bringt seine Pflicht-Cluster mit; ihre Zuordnungen werden im Editor ausgefüllt.","The device type brings its mandatory clusters; their mappings are filled in the editor."),Create:p("Anlegen","Create"),Device:p("Gerät","Device"),Vendor:p("Hersteller","Vendor"),Model:p("Modell","Model"),Serial:p("Seriennummer","Serial"),Enabled:p("Aktiviert","Enabled"),"assigned automatically":p("automatisch zugewiesen","assigned automatically"),Availability:p("Verfügbarkeit","Availability"),Mode:p("Modus","Mode"),Topic:p("Topic","Topic"),extract:p("Pfad","extract"),"topic · JSON path · the online payload · the offline payload":p("Topic · JSON-Pfad · das Online-Payload · das Offline-Payload","topic · JSON path · the online payload · the offline payload"),"Without an availability topic the device counts as reachable while it reports (see expire on a status half).":p("Ohne Verfügbarkeits-Topic gilt das Gerät als erreichbar, solange es meldet (siehe expire an einer Status-Hälfte).","Without an availability topic the device counts as reachable while it reports (see expire on a status half)."),"Endpoint (the bridged node)":p("Endpunkt (der Bridged Node)","Endpoint (the bridged node)"),"Child endpoint":p("Kind-Endpunkt","Child endpoint"),"coalesce (ms)":p("zusammenfassen (ms)","coalesce (ms)"),"add type":p("Typ hinzufügen","add type"),Options:p("Optionen","Options"),Target:p("Ziel","Target"),"Status (device → Matter)":p("Status (Gerät → Matter)","Status (device → Matter)"),"Command (Matter → device)":p("Befehl (Matter → Gerät)","Command (Matter → device)"),mandatory:p("Pflicht","mandatory"),Mapping:p("Zuordnung","Mapping"),map:p("Map","map"),format:p("Format","format"),template:p("Template","template"),Form:p("Formular","Form"),"Apply to the form":p("Ins Formular übernehmen","Apply to the form"),"Not valid JSON":p("Kein gültiges JSON","Not valid JSON"),"Checking…":p("Prüfe…","Checking…"),"Strict dry run":p("Strenger Probelauf","Strict dry run"),"matter.js builds the device without complaint.":p("matter.js baut das Gerät ohne Beanstandung.","matter.js builds the device without complaint."),"The device validates.":p("Das Gerät ist gültig.","The device validates."),"endpoint {number}":p("Endpunkt {number}","endpoint {number}"),"{name} saved":p("{name} gespeichert","{name} saved"),"{name} saved and built":p("{name} gespeichert und gebaut","{name} saved and built"),"Discard the unsaved changes?":p("Die ungespeicherten Änderungen verwerfen?","Discard the unsaved changes?"),Discard:p("Verwerfen","Discard"),"Remove this endpoint and its mappings?":p("Diesen Endpunkt und seine Zuordnungen entfernen?","Remove this endpoint and its mappings?"),Kind:p("Art","Kind"),attribute:p("Attribut","attribute"),"command (invoke)":p("Befehl (invoke)","command (invoke)"),"event channel":p("Ereigniskanal","event channel"),"— cluster —":p("— Cluster —","— cluster —"),"— attribute —":p("— Attribut —","— attribute —"),"— command —":p("— Befehl —","— command —"),"— none —":p("— keine —","— none —"),writable:p("schreibbar","writable"),nullable:p("nullable","nullable"),Comment:p("Kommentar","Comment"),Pick:p("Wählen","Pick"),"Extract (JSON path)":p("Extrahieren (JSON-Pfad)","Extract (JSON path)"),Template:p("Template","Template"),Map:p("Map","Map"),payload:p("Payload","payload"),value:p("Wert","value"),Row:p("Zeile","Row"),"Enum names":p("Enum-Namen","Enum names"),Default:p("Standardwert","Default"),Type:p("Typ","Type"),Unit:p("Einheit","Unit"),Scale:p("Skalierung","Scale"),"Offset / round / invert":p("Offset / Runden / Invertieren","Offset / round / invert"),offset:p("Offset","offset"),round:p("Runden","round"),precision:p("Nachkommastellen","precision"),invert:p("invertieren","invert"),"Expire (s)":p("Verfall (s)","Expire (s)"),"without a message for this long the device is unreachable":p("so lange ohne Nachricht gilt das Gerät als nicht erreichbar","without a message for this long the device is unreachable"),"Get request":p("Abfrage (get)","Get request"),topic:p("Topic","topic"),Preview:p("Vorschau","Preview"),Payload:p("Payload","Payload"),"Publish as the device would":p("Senden, wie es das Gerät täte","Publish as the device would"),Format:p("Format","Format"),"Fixed payload":p("Festes Payload","Fixed payload"),"Wrap (JSON path)":p("Einpacken (JSON-Pfad)","Wrap (JSON path)"),"Retain / QoS / optimistic":p("Retain / QoS / optimistisch","Retain / QoS / optimistic"),retain:p("retain","retain"),"optimistic: automatic":p("optimistisch: automatisch","optimistic: automatic"),"optimistic: yes":p("optimistisch: ja","optimistic: yes"),"optimistic: no":p("optimistisch: nein","optimistic: no"),"Matter value":p("Matter-Wert","Matter value"),"a number, text or JSON":p("eine Zahl, Text oder JSON","a number, text or JSON"),"Test-publish":p("Testweise senden","Test-publish"),"Published to {topic}":p("Gesendet an {topic}","Published to {topic}"),"Pick a topic":p("Topic wählen","Pick a topic"),Time:p("Zeit","Time"),"No topic seen yet that matches.":p("Noch kein passendes Topic gesehen.","No topic seen yet that matches."),"Click a key to use the topic with that JSON path:":p("Klicke einen Schlüssel, um das Topic mit diesem JSON-Pfad zu übernehmen:","Click a key to use the topic with that JSON path:"),"Use topic":p("Topic übernehmen","Use topic"),Other:p("Sonstige","Other"),own:p("eigene","own"),"No presets. Put preset files into a directory named in the configuration.":p("Keine Vorlagen. Lege Vorlagen-Dateien in ein Verzeichnis, das in der Konfiguration genannt ist.","No presets. Put preset files into a directory named in the configuration."),"Preset files with problems":p("Vorlagen-Dateien mit Problemen","Preset files with problems"),optional:p("optional","optional"),"Create device":p("Gerät anlegen","Create device"),"{name} created":p("{name} angelegt","{name} created"),"Re-sync":p("Neu abgleichen","Re-sync"),"Adopt all new":p("Alle neuen übernehmen","Adopt all new"),"show unsupported":p("nicht unterstützte zeigen","show unsupported"),"{count} new":p("{count} neu","{count} new"),"{count} changed":p("{count} geändert","{count} changed"),"{count} orphaned":p("{count} verwaist","{count} orphaned"),"{count} adopted":p("{count} übernommen","{count} adopted"),"{count} unsupported":p("{count} nicht unterstützt","{count} unsupported"),"No importer is configured. Discovered devices from Zigbee2MQTT and Home Assistant discovery appear here.":p("Kein Importer ist eingerichtet. Entdeckte Geräte aus Zigbee2MQTT und Home-Assistant-Discovery erscheinen hier.","No importer is configured. Discovered devices from Zigbee2MQTT and Home Assistant discovery appear here."),"Nothing discovered yet. Zigbee2MQTT publishes its devices on <base>/bridge/devices, Home Assistant discovery under <prefix>/; the bridge subscribes both.":p("Noch nichts entdeckt. Zigbee2MQTT veröffentlicht seine Geräte auf <base>/bridge/devices, Home-Assistant-Discovery unter <prefix>/; die Bridge abonniert beides.","Nothing discovered yet. Zigbee2MQTT publishes its devices on <base>/bridge/devices, Home Assistant discovery under <prefix>/; the bridge subscribes both."),Area:p("Bereich","Area"),Native:p("Nativ","Native"),"native: {source}":p("nativ: {source}","native: {source}"),"Also described natively by {source} as {key}; the native description is preferred.":p("Auch nativ von {source} als {key} beschrieben; die native Beschreibung ist vorzuziehen.","Also described natively by {source} as {key}; the native description is preferred."),new:p("neu","new"),changed:p("geändert","changed"),adopted:p("übernommen","adopted"),"back again":p("wieder da","back again"),invalid:p("ungültig","invalid"),unsupported:p("nicht unterstützt","unsupported"),duplicate:p("doppelt","duplicate"),Twins:p("Doppelt übernommen","Twins"),"Adopt anyway":p("Trotzdem übernehmen","Adopt anyway"),Replace:p("Ersetzen","Replace"),"{name} is the same device as {key}, which {source} describes natively. Adopting it here makes a second Matter device for one device: controllers show it twice. Adopt it anyway?":p("{name} ist dasselbe Gerät wie {key}, das {source} nativ beschreibt. Hier übernommen wird es ein zweites Matter-Gerät für ein Gerät: Controller zeigen es doppelt. Trotzdem übernehmen?","{name} is the same device as {key}, which {source} describes natively. Adopting it here makes a second Matter device for one device: controllers show it twice. Adopt it anyway?"),"{name} is already adopted as {key}. Replace it: the native description is adopted and {key} is disabled — it stays in the configuration until you delete it. Controllers see a new device.":p("{name} ist schon als {key} übernommen. Ersetzen: die native Beschreibung wird übernommen und {key} abgeschaltet — es bleibt in der Konfiguration, bis du es löschst. Controller sehen ein neues Gerät.","{name} is already adopted as {key}. Replace it: the native description is adopted and {key} is disabled — it stays in the configuration until you delete it. Controllers see a new device."),"{count} duplicates":p("{count} doppelt","{count} duplicates"),group:p("Gruppe","group"),Notes:p("Hinweise","Notes"),Details:p("Details","Details"),"{count} conflicts":p("{count} Konflikte","{count} conflicts"),"{count} edits":p("{count} eigene Änderungen","{count} edits"),"{count} unmapped":p("{count} nicht abgebildet","{count} unmapped"),"Not mapped":p("Nicht abgebildet","Not mapped"),"Your edits":p("Eigene Änderungen","Your edits"),"Your edit":p("Eigene Änderung","Your edit"),Conflicts:p("Konflikte","Conflicts"),"Your edit and the new description changed the same value; your edit stays.":p("Eigene Änderung und neue Beschreibung ändern denselben Wert; die eigene Änderung bleibt.","Your edit and the new description changed the same value; your edit stays."),"Re-sync every adopted device? {count} entries change: updated ones take the new description (your edits are kept, conflicts reported), orphans are marked.":p("Jedes übernommene Gerät neu abgleichen? {count} Einträge ändern sich: geänderte übernehmen die neue Beschreibung (eigene Änderungen bleiben, Konflikte werden gemeldet), verwaiste werden markiert.","Re-sync every adopted device? {count} entries change: updated ones take the new description (your edits are kept, conflicts reported), orphans are marked."),"{count} devices written":p("{count} Geräte geschrieben","{count} devices written"),"Update {name}? {count} of your edits conflict with the new description; your edits win, the conflicts are listed in the details.":p("{name} aktualisieren? {count} eigene Änderungen stehen im Konflikt mit der neuen Beschreibung; die eigenen Änderungen gewinnen, die Konflikte stehen in den Details.","Update {name}? {count} of your edits conflict with the new description; your edits win, the conflicts are listed in the details."),"Update {name} from the source? Your own edits are kept.":p("{name} aus der Quelle aktualisieren? Eigene Änderungen bleiben erhalten.","Update {name} from the source? Your own edits are kept."),"{name} adopted as {key}":p("{name} übernommen als {key}","{name} adopted as {key}"),"Adopt {count} new devices?":p("{count} neue Geräte übernehmen?","Adopt {count} new devices?"),Path:p("Pfad","Path"),commissioned:p("gekoppelt","commissioned"),"not commissioned":p("nicht gekoppelt","not commissioned"),"port {port}":p("Port {port}","port {port}"),"Manual pairing code":p("Manueller Kopplungscode","Manual pairing code"),"QR payload":p("QR-Inhalt","QR payload"),"No pairing codes: the bridge is not running.":p("Keine Kopplungscodes: die Bridge läuft nicht.","No pairing codes: the bridge is not running."),"Commissioning window":p("Kopplungsfenster","Commissioning window"),closed:p("geschlossen","closed"),"open (basic)":p("offen (basic)","open (basic)"),"open (enhanced)":p("offen (enhanced)","open (enhanced)"),"Open for 15 minutes":p("Für 15 Minuten öffnen","Open for 15 minutes"),"Commissioning window open for 15 minutes":p("Kopplungsfenster für 15 Minuten geöffnet","Commissioning window open for 15 minutes"),"Commissioning window closed":p("Kopplungsfenster geschlossen","Commissioning window closed"),"Pair the bridge from Apple Home, Home Assistant, Google Home or Alexa with the QR code or the manual code. A commissioned bridge needs an open window for a second controller.":p("Kopple die Bridge aus Apple Home, Home Assistant, Google Home oder Alexa mit dem QR-Code oder dem manuellen Code. Eine gekoppelte Bridge braucht für einen zweiten Controller ein offenes Fenster.","Pair the bridge from Apple Home, Home Assistant, Google Home or Alexa with the QR code or the manual code. A commissioned bridge needs an open window for a second controller."),Fabrics:p("Fabrics","Fabrics"),"No controller has paired this bridge yet.":p("Noch kein Controller hat diese Bridge gekoppelt.","No controller has paired this bridge yet."),Label:p("Bezeichnung","Label"),"Node id":p("Node-Id","Node id"),"Remove fabric {label}? The controller loses the bridge and every device on it.":p("Fabric {label} entfernen? Der Controller verliert die Bridge und jedes Gerät darauf.","Remove fabric {label}? The controller loses the bridge and every device on it."),Topics:p("Topics","Topics"),"{count} topics":p("{count} Topics","{count} topics"),retained:p("retained","retained"),Publish:p("Senden","Publish"),Messages:p("Nachrichten","Messages"),pause:p("Pause","pause"),Clear:p("Leeren","Clear"),follow:p("folgen","follow"),"{count} lines":p("{count} Zeilen","{count} lines"),"Check every device":p("Jedes Gerät prüfen","Check every device"),"The strict dry run: every device is built in a throw-away Matter node, nothing goes online.":p("Der strenge Probelauf: jedes Gerät wird in einem Wegwerf-Matter-Node gebaut, nichts geht online.","The strict dry run: every device is built in a throw-away Matter node, nothing goes online."),"Every device conforms.":p("Jedes Gerät ist konform.","Every device conforms."),"Some devices do not conform.":p("Manche Geräte sind nicht konform.","Some devices do not conform."),Settings:p("Einstellungen","Settings"),"The top level of the configuration file without the devices: mqtt, storage, log, vendorId, productId, bridges, server, presets. Changes apply at the next start.":p("Die oberste Ebene der Konfigurationsdatei ohne die Geräte: mqtt, storage, log, vendorId, productId, bridges, server, presets. Änderungen gelten ab dem nächsten Start.","The top level of the configuration file without the devices: mqtt, storage, log, vendorId, productId, bridges, server, presets. Changes apply at the next start."),"Set by the environment and not editable here: {paths}":p("Durch die Umgebung gesetzt und hier nicht änderbar: {paths}","Set by the environment and not editable here: {paths}"),"Settings saved. They apply at the next start of mqtt2matter.":p("Einstellungen gespeichert. Sie gelten ab dem nächsten Start von mqtt2matter.","Settings saved. They apply at the next start of mqtt2matter."),"The whole configuration file, as it is on disk. One device exports from the device list.":p("Die ganze Konfigurationsdatei, wie sie auf der Platte liegt. Ein einzelnes Gerät exportiert die Geräteliste.","The whole configuration file, as it is on disk. One device exports from the device list."),"Download mqtt2matter.json":p("mqtt2matter.json herunterladen","Download mqtt2matter.json"),"A configuration file or a devices object; every device is validated before anything is written.":p("Eine Konfigurationsdatei oder ein devices-Objekt; jedes Gerät wird geprüft, bevor etwas geschrieben wird.","A configuration file or a devices object; every device is validated before anything is written."),"The file could not be read.":p("Die Datei konnte nicht gelesen werden.","The file could not be read."),"Import {count} devices":p("{count} Geräte importieren","Import {count} devices"),"Import {count} devices and delete every other device?":p("{count} Geräte importieren und jedes andere Gerät löschen?","Import {count} devices and delete every other device?"),"Import {count} devices? Existing devices with the same key are replaced.":p("{count} Geräte importieren? Vorhandene Geräte mit demselben Schlüssel werden ersetzt.","Import {count} devices? Existing devices with the same key are replaced."),"{count} devices imported":p("{count} Geräte importiert","{count} devices imported"),"replace every device":p("jedes Gerät ersetzen","replace every device"),"The bridge does not answer.":p("Die Bridge antwortet nicht.","The bridge does not answer."),"Try again":p("Erneut versuchen","Try again"),Password:p("Passwort","Password"),"Log in":p("Anmelden","Log in"),"Log out":p("Abmelden","Log out"),"This request was not authenticated by the reverse proxy. Open the UI through the proxy.":p("Diese Anfrage wurde nicht vom Reverse-Proxy authentifiziert. Öffne die Oberfläche über den Proxy.","This request was not authenticated by the reverse proxy. Open the UI through the proxy."),Access:p("Zugang","Access"),"Who may use this UI and its API. Without a login, keep the port on a trusted network.":p("Wer diese Oberfläche und ihre API benutzen darf. Ohne Anmeldung gehört der Port in ein vertrauenswürdiges Netz.","Who may use this UI and its API. Without a login, keep the port on a trusted network."),Login:p("Anmeldung","Login"),none:p("keine","none"),password:p("Passwort","password"),"reverse proxy":p("Reverse-Proxy","reverse proxy"),unchanged:p("unverändert","unchanged"),Repeat:p("Wiederholen","Repeat"),"The passwords differ.":p("Die Passwörter sind verschieden.","The passwords differ."),Header:p("Header","Header"),"Logout URL":p("Abmelde-URL","Logout URL"),'Optional: where "Log out" goes — the sign-out of the proxy.':p("Optional: wohin „Abmelden“ führt — die Abmeldung des Proxys.",'Optional: where "Log out" goes — the sign-out of the proxy.'),"Open the UI to everyone who reaches its port?":p("Die Oberfläche für jeden öffnen, der ihren Port erreicht?","Open the UI to everyone who reaches its port?"),"Protect the UI with this password? Other open sessions end.":p("Die Oberfläche mit diesem Passwort schützen? Andere offene Sitzungen enden.","Protect the UI with this password? Other open sessions end."),"Trust the {header} header of the reverse proxy? Only the proxy may reach the port then, or anyone can send the header.":p("Dem Header {header} des Reverse-Proxys vertrauen? Dann darf nur der Proxy den Port erreichen, sonst kann jeder den Header schicken.","Trust the {header} header of the reverse proxy? Only the proxy may reach the port then, or anyone can send the header."),"Access saved; it applies at once.":p("Zugang gespeichert; er gilt sofort.","Access saved; it applies at once."),Version:p("Version","Version"),Running:p("Läuft","Running"),Latest:p("Neueste","Latest"),"not published on npm yet":p("noch nicht auf npm veröffentlicht","not published on npm yet"),newer:p("neuer","newer"),"Check now":p("Jetzt prüfen","Check now"),Restart:p("Neu starten","Restart"),"Install mqtt2matter {version} and restart? The bridge is offline for a moment; the pairings stay.":p("mqtt2matter {version} installieren und neu starten? Die Bridge ist kurz offline; die Kopplungen bleiben.","Install mqtt2matter {version} and restart? The bridge is offline for a moment; the pairings stay."),"Update to {version} requested.":p("Update auf {version} angefordert.","Update to {version} requested."),"Restart mqtt2matter? The bridge is offline for a moment.":p("mqtt2matter neu starten? Die Bridge ist kurz offline.","Restart mqtt2matter? The bridge is offline for a moment."),"Restarting…":p("Startet neu …","Restarting…"),"Waiting for mqtt2matter to come back…":p("Warte, bis mqtt2matter wieder da ist …","Waiting for mqtt2matter to come back…"),"mqtt2matter {version} is running.":p("mqtt2matter {version} läuft.","mqtt2matter {version} is running."),"Update {version}":p("Update {version}","Update {version}")},il=["de","en"],al={de:"Deutsch",en:"English"},ol="mqtt2matter.language";function vc(e=fc()){for(const t of e){const n=t.toLowerCase().split("-")[0];if(n==="de"||n==="en")return n}return"en"}function fc(){return typeof navigator>"u"?[]:navigator.languages.length>0?navigator.languages:[navigator.language]}function pc(){try{const e=localStorage.getItem(ol);return e==="de"||e==="en"?e:"auto"}catch{return"auto"}}function hc(e){return e==="auto"?vc():e}function mc(e,t){return e.replace(/\{(\w+)\}/g,(n,i)=>i in t?String(t[i]):n)}class _c{#e=F(Pt(pc()));get choice(){return r(this.#e)}set choice(t){w(this.#e,t,!0)}#r=ie(()=>hc(this.choice));get language(){return r(this.#r)}set language(t){w(this.#r,t)}set(t){this.choice=t;try{localStorage.setItem(ol,t)}catch{}}t(t,n){const i=cc[t],a=i===void 0?t:i[this.language];return n===void 0?a:mc(a,n)}}const sa=new _c;function d(e,t){return sa.t(e,t)}var gc=S('<p class="ui-error-text svelte-12tsuzi"> </p> <div><button type="button" class="ui-button"> </button></div>',1),bc=S('<p class="ui-error-text svelte-12tsuzi" data-testid="login-error"> </p>'),yc=S('<form class="svelte-12tsuzi"><label class="ui-form-label svelte-12tsuzi" for="login-password"> </label> <input id="login-password" class="ui-input" type="password" autocomplete="current-password" data-testid="login-password"/> <!> <button type="submit" class="ui-button ui-button-primary" data-testid="login-submit"> </button></form>'),wc=S('<p class="svelte-12tsuzi"> </p> <div><button type="button" class="ui-button"> </button></div>',1),kc=S("<option> </option>"),xc=S('<div class="login svelte-12tsuzi" data-testid="login"><div class="card ui-section svelte-12tsuzi"><div class="brand svelte-12tsuzi">mqtt2matter</div> <!> <select class="ui-select language svelte-12tsuzi"><option> </option><!></select></div></div>');function Ec(e,t){$t(t,!0);let n=F(""),i=F(""),a=F(!1);async function o(E){if(E.preventDefault(),!(r(n)===""||r(a))){w(a,!0),w(i,"");try{await nr.login(r(n)),w(n,"")}catch(O){w(i,ut(O),!0)}finally{w(a,!1)}}}var s=xc(),u=h(s),c=l(h(u),2);{var m=E=>{var O=gc(),P=Pe(O),L=f(P,!0),Z=l(P,2),j=h(Z),G=f(j,!0);x((U,q)=>{v(L,U),v(G,q)},[()=>d("The bridge does not answer."),()=>d("Try again")]),N("click",j,()=>nr.load()),k(E,O)},y=E=>{var O=yc(),P=h(O),L=f(P,!0),Z=l(P,2),j=l(Z,2);{var G=I=>{var R=bc(),V=f(R,!0);x(()=>v(V,r(i))),k(I,R)};H(j,I=>{r(i)!==""&&I(G)})}var U=l(j,2),q=f(U,!0);x((I,R)=>{v(L,I),U.disabled=r(n)===""||r(a),v(q,R)},[()=>d("Password"),()=>d("Log in")]),Na("submit",O,o),Ee(Z,()=>r(n),I=>w(n,I)),k(E,O)},g=E=>{var O=wc(),P=Pe(O),L=f(P,!0),Z=l(P,2),j=h(Z),G=f(j,!0);x((U,q)=>{v(L,U),v(G,q)},[()=>d("This request was not authenticated by the reverse proxy. Open the UI through the proxy."),()=>d("Try again")]),N("click",j,()=>nr.load()),k(E,O)};H(c,E=>{nr.unreachable?E(m):nr.state?.mode==="password"?E(y,1):nr.state?.mode==="proxy"&&E(g,2)})}var _=l(c,2),b=h(_),T=f(b,!0);b.value=b.__value="auto";var A=l(b);et(A,16,()=>il,E=>E,(E,O)=>{var P=kc(),L=f(P,!0),Z={};x(()=>{v(L,al[O]),Z!==(Z=O)&&(P.value=(P.__value=Z)??"")}),k(E,P)});var C;Qt(_),x((E,O)=>{ne(_,"aria-label",E),v(T,O),C!==(C=sa.choice)&&(_.value=(_.__value=C)??"",Bi(_,C))},[()=>d("Language"),()=>d("Browser language")]),N("change",_,E=>sa.set(E.currentTarget.value)),k(e,s),Ht()}or(["click","change"]);class Tc{#e=F(void 0);get pending(){return r(this.#e)}set pending(t){w(this.#e,t,!0)}confirm(t,n={}){return new Promise(i=>{this.pending={kind:"confirm",message:t,options:n,resolve:i}})}prompt(t,n={}){return new Promise(i=>{this.pending={kind:"prompt",message:t,options:n,resolve:i}})}settle(t){const n=this.pending;this.pending=void 0,n!==void 0&&(n.kind==="confirm"?n.resolve(t===!0):n.resolve(typeof t=="string"?t:null))}}const Zt=new Tc;var Cc=S('<button type="button" class="ui-dialog-close svelte-1vv01t1">✕</button>'),Sc=S('<div class="ui-dialog-buttons svelte-1vv01t1"><!></div>'),Ac=S('<dialog class="ui-dialog svelte-1vv01t1"><div class="ui-dialog-titlebar svelte-1vv01t1"><span class="ui-dialog-title svelte-1vv01t1"> </span> <!></div> <div class="ui-dialog-body svelte-1vv01t1"><!></div> <!></dialog>');function qi(e,t){$t(t,!0);let n=yr(t,"width",3,"560px"),i=yr(t,"closable",3,!0),a=yr(t,"onclose",3,void 0),o=F(void 0);sn(()=>{r(o)!==void 0&&(t.open&&!r(o).open?r(o).showModal():!t.open&&r(o).open&&r(o).close())});function s(P){P.preventDefault(),i()&&a()?.()}var u=Ac();let c;var m=h(u),y=h(m),g=f(y,!0),_=l(y,2);{var b=P=>{var L=Cc();x(Z=>ne(L,"aria-label",Z),[()=>d("Close")]),N("click",L,()=>a()?.()),k(P,L)};H(_,P=>{i()&&P(b)})}var T=l(m,2),A=h(T);{var C=P=>{var L=ci(),Z=Pe(L);cs(Z,()=>t.children),k(P,L)};H(A,P=>{t.open&&t.children&&P(C)})}var E=l(T,2);{var O=P=>{var L=Sc(),Z=h(L);cs(Z,()=>t.buttons),k(P,L)};H(E,P=>{t.buttons&&P(O)})}Ba(u,P=>w(o,P),()=>r(o)),x(()=>{ne(u,"data-testid",t.testId),c=Wd(u,"",c,{width:n()}),v(g,t.title)}),Na("cancel",u,s),Na("close",u,()=>{t.open&&a()?.()}),k(e,u),Ht()}or(["click"]);var Pc=S('<button type="button" class="ui-button"> </button> <button type="button" data-testid="dialog-ok"> </button>',1),Nc=S('<input data-testid="dialog-input"/>'),Mc=S('<p class="message svelte-kd97iv"> </p> <!>',1);function Rc(e,t){$t(t,!0);let n=F(""),i=F(void 0);const a=ie(()=>Zt.pending),o=ie(()=>r(a)?.kind!=="prompt"||r(a).options.pattern===void 0||r(a).options.pattern.test(r(n)));sn(()=>{r(a)?.kind==="prompt"&&(w(n,r(a).options.value??"",!0),setTimeout(()=>r(i)?.focus(),0))});function s(){r(a)?.kind==="prompt"?r(o)&&Zt.settle(r(n)):Zt.settle(!0)}var u=ci(),c=Pe(u);{var m=y=>{{const g=b=>{var T=Pc(),A=Pe(T),C=f(A,!0),E=l(A,2);let O;var P=f(E,!0);x((L,Z)=>{v(C,L),O=Nt(E,1,"ui-button",null,O,{"ui-button-primary":!r(a).options.danger,"ui-button-danger":r(a).options.danger}),E.disabled=!r(o),v(P,Z)},[()=>r(a).options.cancel??d("Cancel"),()=>r(a).options.confirm??d("OK")]),N("click",A,()=>Zt.settle(r(a).kind==="prompt"?null:!1)),N("click",E,s),k(b,T)};let _=ie(()=>r(a).options.title??(r(a).kind==="prompt"?d("Input"):d("Confirm")));qi(y,{open:!0,get title(){return r(_)},width:"420px",onclose:()=>Zt.settle(r(a).kind==="prompt"?null:!1),get testId(){return`dialog-${r(a).kind??""}`},buttons:g,children:(b,T)=>{var A=Mc(),C=Pe(A),E=f(C,!0),O=l(C,2);{var P=L=>{var Z=Nc();let j;Ba(Z,G=>w(i,G),()=>r(i)),x(()=>{j=Nt(Z,1,"ui-input",null,j,{"ui-invalid":!r(o)}),ne(Z,"placeholder",r(a).options.placeholder??"")}),N("keydown",Z,G=>{G.key==="Enter"&&s()}),Ee(Z,()=>r(n),G=>w(n,G)),k(L,Z)};H(O,L=>{r(a).kind==="prompt"&&L(P)})}x(()=>v(E,r(a).message)),k(b,A)},$$slots:{buttons:!0,default:!0}})}};H(c,y=>{r(a)&&y(m)})}k(e,u),Ht()}or(["click","keydown"]);const ms=4;let Ic=class{#e=F(Pt([]));get list(){return r(this.#e)}set list(t){w(this.#e,t,!0)}next=1;push(t,n){const i=this.next++;return this.list=[...this.list,{id:i,level:t,message:n}],t!=="error"&&setTimeout(()=>{this.dismiss(i)},6e3),i}info(t){this.push("info",t)}warn(t){this.push("warn",t)}error(t){this.push("error",t)}dismiss(t){this.list=this.list.filter(n=>n.id!==t)}};const Ne=new Ic;var Oc=S('<button type="button" class="more svelte-1cnh99m"> </button>'),Dc=S('<div data-testid="notice"><span class="text svelte-1cnh99m"> </span> <button type="button" class="close svelte-1cnh99m">✕</button></div>'),Lc=S('<div class="notices svelte-1cnh99m" role="log" aria-live="polite" data-testid="notices"><!> <!></div>');function Bc(e,t){$t(t,!0);let n=F(!1);const i=ie(()=>Ne.list),a=ie(()=>Math.max(0,r(i).length-ms)),o=ie(()=>r(n)?r(i):r(i).slice(Math.max(0,r(i).length-ms)));sn(()=>{r(a)===0&&r(n)&&w(n,!1)});var s=Lc(),u=h(s);{var c=y=>{var g=Oc(),_=f(g,!0);x(b=>v(_,b),[()=>r(n)?d("Show fewer"):d("{count} more",{count:r(a)})]),N("click",g,()=>w(n,!r(n))),k(y,g)};H(u,y=>{r(a)>0&&y(c)})}var m=l(u,2);et(m,17,()=>r(o),y=>y.id,(y,g)=>{var _=Dc();let b;var T=h(_),A=f(T,!0),C=l(T,2);x(E=>{b=Nt(_,1,"notice svelte-1cnh99m",null,b,{warn:r(g).level==="warn",error:r(g).level==="error"}),v(A,r(g).message),ne(C,"aria-label",E)},[()=>d("Dismiss")]),N("click",C,()=>Ne.dismiss(r(g).id)),k(y,_)}),k(e,s),Ht()}or(["click"]);var qc=S("<span></span>"),Uc=S('<span class="ui-tab-badge svelte-1p26yap"> </span>'),Fc=S('<button type="button" role="tab"><!> <span> </span> <!></button>'),jc=S('<div class="ui-tabs svelte-1p26yap" role="tablist"></div>');function zc(e,t){$t(t,!0);let n=yr(t,"label",3,"Pages"),i=yr(t,"onselect",3,void 0);function a(s,u){const c=s.key==="ArrowRight"?1:s.key==="ArrowLeft"?-1:0;if(c===0)return;s.preventDefault();const m=t.tabs[(u+c+t.tabs.length)%t.tabs.length];m!==void 0&&(i()?.(m.id),s.currentTarget.parentElement?.querySelector(`#tab-${m.id}`)?.focus())}var o=jc();et(o,23,()=>t.tabs,s=>s.id,(s,u,c)=>{var m=Fc();let y;var g=h(m);{var _=E=>{var O=qc();x(()=>Nt(O,1,`ui-dot ui-dot-${r(u).dot??""}`,"svelte-1p26yap")),k(E,O)};H(g,E=>{r(u).dot!==void 0&&r(u).dot!=="none"&&E(_)})}var b=l(g,2),T=f(b,!0),A=l(b,2);{var C=E=>{var O=Uc(),P=f(O,!0);x(()=>v(P,r(u).badge)),k(E,O)};H(A,E=>{r(u).badge!==void 0&&r(u).badge!==""&&E(C)})}x(()=>{y=Nt(m,1,"ui-tab svelte-1p26yap",null,y,{"ui-tab-active":r(u).id===t.active}),ne(m,"id",`tab-${r(u).id??""}`),ne(m,"aria-selected",r(u).id===t.active),ne(m,"tabindex",r(u).id===t.active?0:-1),ne(m,"data-testid",`tab-${r(u).id??""}`),v(T,r(u).label)}),N("click",m,()=>i()?.(r(u).id)),N("keydown",m,E=>a(E,r(c))),k(s,m)}),x(()=>ne(o,"aria-label",n())),k(e,o),Ht()}or(["click","keydown"]);class $c{#e=F(!1);get connected(){return r(this.#e)}set connected(t){w(this.#e,t,!0)}#r=F(void 0);get mqttConnected(){return r(this.#r)}set mqttConnected(t){w(this.#r,t,!0)}#t=F("");get version(){return r(this.#t)}set version(t){w(this.#t,t,!0)}socket;listeners=new Set;mqttWanted=0;retry;start(){if(this.socket!==void 0||typeof WebSocket>"u")return;const t=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/events`,n=new WebSocket(t);this.socket=n,n.onopen=()=>{this.connected=!0,this.sendSubscription()},n.onmessage=i=>{let a;try{a=JSON.parse(String(i.data))}catch{return}a.type==="hello"?this.version=a.version:a.type==="status"&&(this.mqttConnected=a.mqtt);for(const o of this.listeners)o(a)},n.onclose=()=>{this.connected=!1,this.socket=void 0,this.retry=setTimeout(()=>{this.start()},2e3)},n.onerror=()=>{n.close()}}stop(){this.retry!==void 0&&clearTimeout(this.retry),this.socket?.close(),this.socket=void 0}on(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}wantMqtt(){return this.mqttWanted++,this.sendSubscription(),()=>{this.mqttWanted--,this.sendSubscription()}}sendSubscription(){this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify({type:"subscribe",mqtt:this.mqttWanted>0}))}}const hr=new $c,Hc=["devices","presets","adopt","bridges","mqtt","log","check","config"];function Ya(e){const t=e.replace(/^#\/?/,""),[n,...i]=t.split("/"),a=Hc.includes(n??"")?n:"devices",o=i.map(s=>{try{return decodeURIComponent(s)}catch{return s}}).join("/");return{page:a,rest:a===(n??"")?o:""}}function Gc(e,t=""){return t===""?`#/${e}`:`#/${e}/${t.split("/").map(encodeURIComponent).join("/")}`}class Kc{#e=F(Pt(Ya(typeof location>"u"?"":location.hash)));get route(){return r(this.#e)}set route(t){w(this.#e,t,!0)}constructor(){typeof window<"u"&&window.addEventListener("hashchange",()=>{this.route=Ya(location.hash)})}go(t,n=""){const i=Gc(t,n);location.hash===i?this.route=Ya(i):location.hash=i}}const Br=new Kc,sl="mqtt2matter.theme",Qa=["system","light","dark"];function ul(){try{const e=localStorage.getItem(sl);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}function ll(e=ul()){const t=document.documentElement;e==="system"?t.removeAttribute("data-theme"):t.setAttribute("data-theme",e)}function Vc(e){try{localStorage.setItem(sl,e)}catch{}ll(e)}function Jc(e){return Qa[(Qa.indexOf(e)+1)%Qa.length]??"system"}var Wc=Dd('<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path></path></svg>');function Kr(e,t){let n=yr(t,"size",3,14);const i={pause:"M6 4h3v16H6zM15 4h3v16h-3z",play:"M7 4l12 8-12 8z",copy:"M8 8h12v12H8zM4 4h12v2H6v10H4z",download:"M11 3h2v10.2l3.6-3.6 1.4 1.4-6 6-6-6 1.4-1.4L11 13.2zM4 19h16v2H4z",trash:"M9 3h6v2h5v2H4V5h5zM6 8h12l-1 13H7zM10 10v9h1.5v-9zm2.5 0v9H14v-9z",info:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 3h2v2h-2zm0 4h2v6h-2z",close:"M5.6 4.2 12 10.6l6.4-6.4 1.4 1.4-6.4 6.4 6.4 6.4-1.4 1.4-6.4-6.4-6.4 6.4-1.4-1.4 6.4-6.4-6.4-6.4z"};var a=Wc(),o=f(a);x(()=>{ne(a,"width",n()),ne(a,"height",n()),ne(o,"d",i[t.name])}),k(e,a)}function ra(e){const t=typeof e=="number"?new Date(e):new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleTimeString(void 0,{hour12:!1})}function Ri(e){return e===void 0?"":e===null?"null":typeof e=="object"?JSON.stringify(e):typeof e=="number"&&!Number.isInteger(e)?String(Number(e.toFixed(6))):String(e)}function ua(e){try{return JSON.parse(e)}catch{return}}function Vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Bo(e,t="$"){return Vr(e)?Object.entries(e).flatMap(([n,i])=>Bo(i,/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)?`${t}.${n}`:`${t}["${n}"]`)):Array.isArray(e)?e.flatMap((n,i)=>Bo(n,`${t}[${i}]`)):t==="$"?[]:[{path:t,value:e}]}function Nn(e){return JSON.stringify(e,null,2)??""}function qo(e,t){let n;return(...i)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...i)},t)}}function Zo(e,t){const n=new Blob([t],{type:"application/json"}),i=URL.createObjectURL(n),a=document.createElement("a");a.href=i,a.download=e,a.click(),setTimeout(()=>{URL.revokeObjectURL(i)},1e3)}var _s=S('<div class="ui-empty"> </div>'),Yc=S('<span class="ui-badge group svelte-izwxip"> </span>'),Qc=S('<span class="ui-badge native svelte-izwxip"> </span>'),Zc=S('<span class="ui-badge ui-badge-warn"> </span>'),gs=S('<span class="ui-badge"> </span>'),bs=S('<button type="button" class="ui-button" data-testid="adopt"> </button>'),Xc=S('<button type="button" class="ui-button" data-testid="update"> </button>'),ev=S('<button type="button" class="ui-button"> </button> <button type="button" class="ui-button ui-button-danger" data-testid="remove-orphan"> </button>',1),ys=S('<button type="button" class="ui-button"> </button>'),tv=S('<tr data-testid="adopt-row"><td><span> </span></td><td> <!></td><td> <!></td><td data-testid="adopt-area"> </td><td><code> </code></td><td class="notes svelte-izwxip"><!> <!> <!> <span class="ui-muted"> </span></td><td class="ui-actions"><button type="button" class="ui-icon-button" data-testid="show-details"><!></button> <!></td></tr>'),rv=S('<table class="ui-table" data-testid="adopt-table"><thead><tr><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th></th></tr></thead><tbody></tbody></table>'),nv=S('<button type="button" class="ui-button ui-button-primary"> </button>'),iv=S('<button type="button" class="ui-button"> </button> <!>',1),ga=S("<dt> </dt> <dd> </dd>",1),ws=S("<dt> </dt> <dd><code> </code></dd>",1),av=S('<tr><td><code> </code></td><td class="ui-ok-text"><code> </code></td><td class="ui-warn-text"><code> </code></td></tr>'),ov=S('<h3> </h3> <p class="ui-muted svelte-izwxip"> </p> <table class="ui-table"><thead><tr><th> </th><th> </th><th> </th></tr></thead><tbody></tbody></table>',1),sv=S('<dl class="ui-kv"><dt> </dt> <dd> </dd> <dt> </dt> <dd><code> </code></dd> <!> <!> <!> <!> <!> <!></dl> <!>',1),uv=S('<div class="ui-page" data-testid="adopt-page"><div class="ui-toolbar"><button type="button" class="ui-button" data-testid="resync"> </button> <button type="button" class="ui-button ui-button-primary"> </button> <input class="ui-input filter svelte-izwxip"/> <label class="ui-check"><input type="checkbox"/> </label> <div class="ui-toolbar-trailing"> </div></div> <div class="ui-page-scroll"><!></div></div> <!>',1);function lv(e,t){$t(t,!0);let n=F(Pt([])),i=F(Pt([])),a=F(!1),o=F(!1),s=F(""),u=F(!1),c=F(void 0);const m={new:0,updated:1,restored:1,orphaned:2,invalid:3,covered:4,unchanged:5,unsupported:6},y=ie(()=>{const D=r(s).trim().toLowerCase();return r(i).filter($=>r(u)||$.status!=="unsupported").filter($=>D===""||`${$.name} ${$.key} ${$.area??""} ${$.notes.join(" ")}`.toLowerCase().includes(D)).sort(($,z)=>m[$.status]-m[z.status]||$.name.localeCompare(z.name))}),g=ie(()=>{const D={};for(const $ of r(i))D[$.status]=(D[$.status]??0)+1;return D});async function _(){try{const D=await Ie.adopt();w(n,D.importers,!0),w(i,D.entries,!0),w(a,!0)}catch(D){Ne.error(ut(D))}}Cr(()=>(_(),hr.on(D=>{(D.type==="discovered"||D.type==="devices")&&_()})));async function b(){const D=r(i).filter(z=>z.status==="updated"||z.status==="restored"||z.status==="orphaned");if(await Zt.confirm(d("Re-sync every adopted device? {count} entries change: updated ones take the new description (your edits are kept, conflicts reported), orphans are marked.",{count:D.length}),{confirm:d("Re-sync")})){w(o,!0);try{const z=await Ie.resync();w(n,z.importers,!0),w(i,z.entries,!0),Ne.info(d("{count} devices written",{count:z.written.length}))}catch(z){Ne.error(ut(z))}finally{w(o,!1)}}}async function T(D){const $=D.twins??[];if(D.native===void 0&&$.length>0)return await Zt.confirm(d("{name} is already adopted as {key}. Replace it: the native description is adopted and {key} is disabled — it stays in the configuration until you delete it. Controllers see a new device.",{name:D.name,key:$.join(", ")}),{confirm:d("Replace")})?{force:!0,replace:!0}:void 0;const z=D.covered??D.native??"";return await Zt.confirm(d("{name} is the same device as {key}, which {source} describes natively. Adopting it here makes a second Matter device for one device: controllers show it twice. Adopt it anyway?",{name:D.name,key:z,source:P(z.split(":")[0]??"")}),{confirm:d("Adopt anyway"),danger:!0})?{force:!0,replace:!1}:void 0}async function A(D){let $={};if(D.status==="covered"){const z=await T(D);if(z===void 0)return;$=z}if(!((D.status==="updated"||D.status==="restored")&&!await Zt.confirm(D.conflicts.length>0?d("Update {name}? {count} of your edits conflict with the new description; your edits win, the conflicts are listed in the details.",{name:D.name,count:D.conflicts.length}):d("Update {name} from the source? Your own edits are kept.",{name:D.name}),{confirm:d("Update")})))try{const z=await Ie.adoptDevice(D.importer,D.key,$);Ne.info(d("{name} adopted as {key}",{name:D.name,key:z.key})),w(c,void 0),await _()}catch(z){Ne.error(ut(z))}}async function C(){const D=r(i).filter($=>$.status==="new");if(await Zt.confirm(d("Adopt {count} new devices?",{count:D.length}),{confirm:d("Adopt")})){w(o,!0);for(const $ of D)try{await Ie.adoptDevice($.importer,$.key)}catch(z){Ne.error(`${$.name}: ${ut(z)}`)}w(o,!1),await _()}}async function E(D){if(await Zt.confirm(d("Delete {name}? Controllers lose the device, its rooms and automations.",{name:D.name}),{confirm:d("Delete"),danger:!0}))try{await Ie.deleteDevice(D.key),await _()}catch(z){Ne.error(ut(z))}}function O(D){return{new:d("new"),unchanged:d("adopted"),updated:d("changed"),restored:d("back again"),orphaned:d("orphaned"),invalid:d("invalid"),unsupported:d("unsupported"),covered:d("duplicate")}[D]}function P(D){return{z2m:"Zigbee2MQTT","ha-discovery":"HA discovery"}[D]??D}function L(D){switch(D){case"new":return"ui-badge-accent";case"unchanged":return"ui-badge-ok";case"updated":case"restored":case"orphaned":return"ui-badge-warn";case"invalid":return"ui-badge-error";default:return""}}var Z=uv(),j=Pe(Z),G=h(j),U=h(G),q=f(U,!0),I=l(U,2),R=f(I,!0),V=l(I,2),B=l(V,2),W=h(B),oe=l(W),ve=l(B,2),Te=f(ve),tt=l(G,2),Oe=h(tt);{var Le=D=>{var $=_s(),z=f($,!0);x(de=>v(z,de),[()=>d("No importer is configured. Discovered devices from Zigbee2MQTT and Home Assistant discovery appear here.")]),k(D,$)},He=D=>{var $=_s(),z=f($,!0);x(de=>v(z,de),[()=>d("Nothing discovered yet. Zigbee2MQTT publishes its devices on <base>/bridge/devices, Home Assistant discovery under <prefix>/; the bridge subscribes both.")]),k(D,$)},Et=D=>{var $=rv(),z=h($),de=h(z),Y=h(de),re=f(Y,!0),se=l(Y),le=f(se,!0),Ce=l(se),Je=f(Ce,!0),De=l(Ce),X=f(De,!0),he=l(De),ke=f(he,!0),We=l(he),nt=f(We,!0),yt=l(z);et(yt,21,()=>r(y),ot=>`${ot.importer}/${ot.key}`,(ot,be)=>{var Tt=tv(),Mt=h(Tt),Ft=h(Mt),Lt=f(Ft,!0),Bt=l(Mt),Se=h(Bt),_e=l(Se);{var Be=xe=>{var ye=Yc(),it=f(ye,!0);x(qe=>v(it,qe),[()=>d("group")]),k(xe,ye)};H(_e,xe=>{r(be).kind==="group"&&xe(Be)})}var Ge=l(Bt),Fe=h(Ge),M=l(Fe);{var J=xe=>{var ye=Qc(),it=f(ye,!0);x((qe,It)=>{ne(ye,"title",qe),v(it,It)},[()=>d("Also described natively by {source} as {key}; the native description is preferred.",{source:P(r(be).native.split(":")[0]??""),key:r(be).native}),()=>d("native: {source}",{source:P(r(be).native.split(":")[0]??"")})]),k(xe,ye)};H(M,xe=>{r(be).native!==void 0&&xe(J)})}var K=l(Ge),ue=f(K,!0),Ke=l(K),ht=h(Ke),fe=f(ht,!0),pe=l(Ke),me=h(pe);{var Me=xe=>{var ye=Zc(),it=f(ye,!0);x(qe=>v(it,qe),[()=>d("{count} conflicts",{count:r(be).conflicts.length})]),k(xe,ye)};H(me,xe=>{r(be).conflicts.length>0&&xe(Me)})}var Ye=l(me,2);{var lt=xe=>{var ye=gs(),it=f(ye,!0);x(qe=>v(it,qe),[()=>d("{count} edits",{count:r(be).edits})]),k(xe,ye)};H(Ye,xe=>{r(be).edits>0&&xe(lt)})}var gt=l(Ye,2);{var mt=xe=>{var ye=gs(),it=f(ye,!0);x((qe,It)=>{ne(ye,"title",qe),v(it,It)},[()=>r(be).unmapped.join(", "),()=>d("{count} unmapped",{count:r(be).unmapped.length})]),k(xe,ye)};H(gt,xe=>{r(be).unmapped.length>0&&xe(mt)})}var Ct=l(gt,2),Rt=f(Ct,!0),rt=l(pe),st=h(rt),wt=h(st);Kr(wt,{name:"info"});var St=l(st,2);{var ae=xe=>{var ye=bs(),it=f(ye,!0);x(qe=>{ye.disabled=r(o),v(it,qe)},[()=>d("Adopt")]),N("click",ye,()=>A(r(be))),k(xe,ye)},Ve=xe=>{var ye=bs(),it=f(ye,!0);x(qe=>{ye.disabled=r(o),v(it,qe)},[()=>r(be).native===void 0&&(r(be).twins??[]).length>0?d("Replace"):d("Adopt anyway")]),N("click",ye,()=>A(r(be))),k(xe,ye)},je=xe=>{var ye=Xc(),it=f(ye,!0);x(qe=>{ye.disabled=r(o),v(it,qe)},[()=>d("Update")]),N("click",ye,()=>A(r(be))),k(xe,ye)},At=xe=>{var ye=ev(),it=Pe(ye),qe=f(it,!0),It=l(it,2),Xt=f(It,!0);x((er,ct)=>{v(qe,er),v(Xt,ct)},[()=>d("Open"),()=>d("Delete")]),N("click",it,()=>Br.go("devices",r(be).key)),N("click",It,()=>E(r(be))),k(xe,ye)},qt=xe=>{var ye=ys(),it=f(ye,!0);x(qe=>v(it,qe),[()=>d("Open")]),N("click",ye,()=>Br.go("devices",r(be).key)),k(xe,ye)};H(St,xe=>{r(be).status==="new"?xe(ae):r(be).status==="covered"?xe(Ve,1):r(be).status==="updated"||r(be).status==="restored"?xe(je,2):r(be).status==="orphaned"?xe(At,3):(r(be).status==="unchanged"||r(be).status==="invalid")&&xe(qt,4)})}x((xe,ye,it,qe,It)=>{ne(Tt,"data-status",r(be).status),ne(Tt,"data-key",r(be).key),Nt(Ft,1,`ui-badge ${xe??""}`,"svelte-izwxip"),v(Lt,ye),v(Se,r(be).name),v(Fe,it),v(ue,r(be).area??""),v(fe,r(be).key),v(Rt,qe),ne(st,"title",It)},[()=>L(r(be).status),()=>O(r(be).status),()=>P(r(be).importer),()=>r(be).notes.join("; "),()=>d("Details")]),N("click",st,()=>w(c,r(be),!0)),k(ot,Tt)}),x((ot,be,Tt,Mt,Ft,Lt)=>{v(re,ot),v(le,be),v(Je,Tt),v(X,Mt),v(ke,Ft),v(nt,Lt)},[()=>d("State"),()=>d("Name"),()=>d("Source"),()=>d("Area"),()=>d("Key"),()=>d("Notes")]),k(D,$)};H(Oe,D=>{r(a)&&r(n).length===0?D(Le):r(a)&&r(i).length===0?D(He,1):D(Et,-1)})}var Q=l(j,2);{var ee=D=>{qi(D,{open:!0,get title(){return r(c).name},width:"760px",onclose:()=>w(c,void 0),testId:"details-dialog",buttons:z=>{var de=ci(),Y=Pe(de);{var re=se=>{const le=ie(()=>r(c));var Ce=iv(),Je=Pe(Ce),De=f(Je,!0),X=l(Je,2);{var he=We=>{var nt=nv(),yt=f(nt,!0);x(ot=>v(yt,ot),[()=>r(le).status==="new"?d("Adopt"):d("Update")]),N("click",nt,()=>A(r(le))),k(We,nt)},ke=We=>{var nt=ys(),yt=f(nt,!0);x(ot=>v(yt,ot),[()=>r(le).native===void 0&&(r(le).twins??[]).length>0?d("Replace"):d("Adopt anyway")]),N("click",nt,()=>A(r(le))),k(We,nt)};H(X,We=>{r(le).status==="new"||r(le).status==="updated"||r(le).status==="restored"?We(he):r(le).status==="covered"&&We(ke,1)})}x(We=>v(De,We),[()=>d("Close")]),N("click",Je,()=>w(c,void 0)),k(se,Ce)};H(Y,se=>{r(c)&&se(re)})}k(z,de)},children:(z,de)=>{var Y=sv(),re=Pe(Y),se=h(re),le=f(se,!0),Ce=l(se,2),Je=f(Ce,!0),De=l(Ce,2),X=f(De,!0),he=l(De,2),ke=h(he),We=f(ke,!0),nt=l(he,2);{var yt=M=>{var J=ga(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=f(Ke,!0);x(fe=>{v(ue,fe),v(ht,r(c).area)},[()=>d("Area")]),k(M,J)};H(nt,M=>{r(c).area!==void 0&&M(yt)})}var ot=l(nt,2);{var be=M=>{var J=ga(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=f(Ke,!0);x((fe,pe)=>{v(ue,fe),v(ht,pe)},[()=>d("Native"),()=>d("Also described natively by {source} as {key}; the native description is preferred.",{source:P(r(c).native.split(":")[0]??""),key:r(c).native})]),k(M,J)};H(ot,M=>{r(c).native!==void 0&&M(be)})}var Tt=l(ot,2);{var Mt=M=>{var J=ws(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=h(Ke),fe=f(ht,!0);x((pe,me)=>{v(ue,pe),v(fe,me)},[()=>d("Twins"),()=>(r(c).twins??[]).join(", ")]),k(M,J)};H(Tt,M=>{(r(c).twins??[]).length>0&&M(Mt)})}var Ft=l(Tt,2);{var Lt=M=>{var J=ga(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=f(Ke,!0);x((fe,pe)=>{v(ue,fe),v(ht,pe)},[()=>d("Notes"),()=>r(c).notes.join("; ")]),k(M,J)};H(Ft,M=>{r(c).notes.length>0&&M(Lt)})}var Bt=l(Ft,2);{var Se=M=>{var J=ws(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=h(Ke),fe=f(ht,!0);x((pe,me)=>{v(ue,pe),v(fe,me)},[()=>d("Not mapped"),()=>r(c).unmapped.join(", ")]),k(M,J)};H(Bt,M=>{r(c).unmapped.length>0&&M(Se)})}var _e=l(Bt,2);{var Be=M=>{var J=ga(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=f(Ke,!0);x(fe=>{v(ue,fe),v(ht,r(c).edits)},[()=>d("Your edits")]),k(M,J)};H(_e,M=>{r(c).edits>0&&M(Be)})}var Ge=l(re,2);{var Fe=M=>{var J=ov(),K=Pe(J),ue=f(K,!0),Ke=l(K,2),ht=f(Ke,!0),fe=l(Ke,2),pe=h(fe),me=h(pe),Me=h(me),Ye=f(Me,!0),lt=l(Me),gt=f(lt,!0),mt=l(lt),Ct=f(mt,!0),Rt=l(pe);et(Rt,21,()=>r(c).conflicts,si,(rt,st)=>{var wt=av(),St=h(wt),ae=h(St),Ve=f(ae,!0),je=l(St),At=h(je),qt=f(At,!0),xe=l(je),ye=h(xe),it=f(ye,!0);x((qe,It)=>{v(Ve,r(st).path),v(qt,qe),v(it,It)},[()=>Ri(r(st).user),()=>Ri(r(st).now)]),k(rt,wt)}),x((rt,st,wt,St,ae)=>{v(ue,rt),v(ht,st),v(Ye,wt),v(gt,St),v(Ct,ae)},[()=>d("Conflicts"),()=>d("Your edit and the new description changed the same value; your edit stays."),()=>d("Path"),()=>d("Your edit"),()=>d("Source")]),k(M,J)};H(Ge,M=>{r(c).conflicts.length>0&&M(Fe)})}x((M,J,K)=>{v(le,M),v(Je,J),v(X,K),v(We,r(c).key)},[()=>d("State"),()=>O(r(c).status),()=>d("Key")]),k(z,Y)},$$slots:{buttons:!0,default:!0}})};H(Q,D=>{r(c)&&D(ee)})}x((D,$,z,de,Y,re,se,le,Ce,Je)=>{U.disabled=r(o)||r(n).length===0,v(q,D),I.disabled=r(o)||(r(g).new??0)===0,v(R,$),ne(V,"placeholder",z),v(oe,` ${de??""}`),v(Te,`${Y??""} · ${re??""} · ${se??""} · ${le??""} · ${Ce??""} · ${Je??""}`)},[()=>d("Re-sync"),()=>d("Adopt all new"),()=>d("Filter"),()=>d("show unsupported"),()=>d("{count} new",{count:r(g).new??0}),()=>d("{count} changed",{count:(r(g).updated??0)+(r(g).restored??0)}),()=>d("{count} orphaned",{count:r(g).orphaned??0}),()=>d("{count} adopted",{count:r(g).unchanged??0}),()=>d("{count} duplicates",{count:r(g).covered??0}),()=>d("{count} unsupported",{count:r(g).unsupported??0})]),N("click",U,b),N("click",I,C),Ee(V,()=>r(s),D=>w(s,D)),rl(W,()=>r(u),D=>w(u,D)),k(e,Z),Ht()}or(["click"]);function dv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yi={},Za,ks;function cv(){return ks||(ks=1,Za=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Za}var Xa={},Un={},xs;function vi(){if(xs)return Un;xs=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Un.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},Un.getSymbolTotalCodewords=function(i){return t[i]},Un.getBCHDigit=function(n){let i=0;for(;n!==0;)i++,n>>>=1;return i},Un.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},Un.isKanjiModeEnabled=function(){return typeof e<"u"},Un.toSJIS=function(i){return e(i)},Un}var eo={},Es;function Xo(){return Es||(Es=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,a){if(e.isValid(i))return i;try{return t(i)}catch{return a}}})(eo)),eo}var to,Ts;function vv(){if(Ts)return to;Ts=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let i=0;i<n;i++)this.putBit((t>>>n-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},to=e,to}var ro,Cs;function fv(){if(Cs)return ro;Cs=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,i,a){const o=t*this.size+n;this.data[o]=i,a&&(this.reservedBit[o]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,i){this.data[t*this.size+n]^=i},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},ro=e,ro}var no={},Ss;function pv(){return Ss||(Ss=1,(function(e){const t=vi().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const a=Math.floor(i/7)+2,o=t(i),s=o===145?26:Math.ceil((o-13)/(2*a-2))*2,u=[o-7];for(let c=1;c<a-1;c++)u[c]=u[c-1]-s;return u.push(6),u.reverse()},e.getPositions=function(i){const a=[],o=e.getRowColCoords(i),s=o.length;for(let u=0;u<s;u++)for(let c=0;c<s;c++)u===0&&c===0||u===0&&c===s-1||u===s-1&&c===0||a.push([o[u],o[c]]);return a}})(no)),no}var io={},As;function hv(){if(As)return io;As=1;const e=vi().getSymbolSize,t=7;return io.getPositions=function(i){const a=e(i);return[[0,0],[a-t,0],[0,a-t]]},io}var ao={},Ps;function mv(){return Ps||(Ps=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(a){return a!=null&&a!==""&&!isNaN(a)&&a>=0&&a<=7},e.from=function(a){return e.isValid(a)?parseInt(a,10):void 0},e.getPenaltyN1=function(a){const o=a.size;let s=0,u=0,c=0,m=null,y=null;for(let g=0;g<o;g++){u=c=0,m=y=null;for(let _=0;_<o;_++){let b=a.get(g,_);b===m?u++:(u>=5&&(s+=t.N1+(u-5)),m=b,u=1),b=a.get(_,g),b===y?c++:(c>=5&&(s+=t.N1+(c-5)),y=b,c=1)}u>=5&&(s+=t.N1+(u-5)),c>=5&&(s+=t.N1+(c-5))}return s},e.getPenaltyN2=function(a){const o=a.size;let s=0;for(let u=0;u<o-1;u++)for(let c=0;c<o-1;c++){const m=a.get(u,c)+a.get(u,c+1)+a.get(u+1,c)+a.get(u+1,c+1);(m===4||m===0)&&s++}return s*t.N2},e.getPenaltyN3=function(a){const o=a.size;let s=0,u=0,c=0;for(let m=0;m<o;m++){u=c=0;for(let y=0;y<o;y++)u=u<<1&2047|a.get(m,y),y>=10&&(u===1488||u===93)&&s++,c=c<<1&2047|a.get(y,m),y>=10&&(c===1488||c===93)&&s++}return s*t.N3},e.getPenaltyN4=function(a){let o=0;const s=a.data.length;for(let c=0;c<s;c++)o+=a.data[c];return Math.abs(Math.ceil(o*100/s/5)-10)*t.N4};function n(i,a,o){switch(i){case e.Patterns.PATTERN000:return(a+o)%2===0;case e.Patterns.PATTERN001:return a%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(a+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(a/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return a*o%2+a*o%3===0;case e.Patterns.PATTERN110:return(a*o%2+a*o%3)%2===0;case e.Patterns.PATTERN111:return(a*o%3+(a+o)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(a,o){const s=o.size;for(let u=0;u<s;u++)for(let c=0;c<s;c++)o.isReserved(c,u)||o.xor(c,u,n(a,c,u))},e.getBestMask=function(a,o){const s=Object.keys(e.Patterns).length;let u=0,c=1/0;for(let m=0;m<s;m++){o(m),e.applyMask(m,a);const y=e.getPenaltyN1(a)+e.getPenaltyN2(a)+e.getPenaltyN3(a)+e.getPenaltyN4(a);e.applyMask(m,a),y<c&&(c=y,u=m)}return u}})(ao)),ao}var ba={},Ns;function dl(){if(Ns)return ba;Ns=1;const e=Xo(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return ba.getBlocksCount=function(a,o){switch(o){case e.L:return t[(a-1)*4+0];case e.M:return t[(a-1)*4+1];case e.Q:return t[(a-1)*4+2];case e.H:return t[(a-1)*4+3];default:return}},ba.getTotalCodewordsCount=function(a,o){switch(o){case e.L:return n[(a-1)*4+0];case e.M:return n[(a-1)*4+1];case e.Q:return n[(a-1)*4+2];case e.H:return n[(a-1)*4+3];default:return}},ba}var oo={},Vi={},Ms;function _v(){if(Ms)return Vi;Ms=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let a=0;a<255;a++)e[a]=i,t[i]=a,i<<=1,i&256&&(i^=285);for(let a=255;a<512;a++)e[a]=e[a-255]})(),Vi.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},Vi.exp=function(i){return e[i]},Vi.mul=function(i,a){return i===0||a===0?0:e[t[i]+t[a]]},Vi}var Rs;function gv(){return Rs||(Rs=1,(function(e){const t=_v();e.mul=function(i,a){const o=new Uint8Array(i.length+a.length-1);for(let s=0;s<i.length;s++)for(let u=0;u<a.length;u++)o[s+u]^=t.mul(i[s],a[u]);return o},e.mod=function(i,a){let o=new Uint8Array(i);for(;o.length-a.length>=0;){const s=o[0];for(let c=0;c<a.length;c++)o[c]^=t.mul(a[c],s);let u=0;for(;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},e.generateECPolynomial=function(i){let a=new Uint8Array([1]);for(let o=0;o<i;o++)a=e.mul(a,new Uint8Array([1,t.exp(o)]));return a}})(oo)),oo}var so,Is;function bv(){if(Is)return so;Is=1;const e=gv();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const a=new Uint8Array(i.length+this.degree);a.set(i);const o=e.mod(a,this.genPoly),s=this.degree-o.length;if(s>0){const u=new Uint8Array(this.degree);return u.set(o,s),u}return o},so=t,so}var uo={},lo={},co={},Os;function cl(){return Os||(Os=1,co.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),co}var pn={},Ds;function vl(){if(Ds)return pn;Ds=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
|
|
3
|
-
]))+`;pn.KANJI=new RegExp(n,"g"),pn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),pn.BYTE=new RegExp(i,"g"),pn.NUMERIC=new RegExp(e,"g"),pn.ALPHANUMERIC=new RegExp(t,"g");const a=new RegExp("^"+n+"$"),o=new RegExp("^"+e+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return pn.testKanji=function(c){return a.test(c)},pn.testNumeric=function(c){return o.test(c)},pn.testAlphanumeric=function(c){return s.test(c)},pn}var Ls;function fi(){return Ls||(Ls=1,(function(e){const t=cl(),n=vl();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return n.testNumeric(o)?e.NUMERIC:n.testAlphanumeric(o)?e.ALPHANUMERIC:n.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+a)}}e.from=function(o,s){if(e.isValid(o))return o;try{return i(o)}catch{return s}}})(lo)),lo}var Bs;function yv(){return Bs||(Bs=1,(function(e){const t=vi(),n=dl(),i=Xo(),a=fi(),o=cl(),s=7973,u=t.getBCHDigit(s);function c(_,b,T){for(let A=1;A<=40;A++)if(b<=e.getCapacity(A,T,_))return A}function m(_,b){return a.getCharCountIndicator(_,b)+4}function y(_,b){let T=0;return _.forEach(function(A){const C=m(A.mode,b);T+=C+A.getBitsLength()}),T}function g(_,b){for(let T=1;T<=40;T++)if(y(_,T)<=e.getCapacity(T,b,a.MIXED))return T}e.from=function(b,T){return o.isValid(b)?parseInt(b,10):T},e.getCapacity=function(b,T,A){if(!o.isValid(b))throw new Error("Invalid QR Code version");typeof A>"u"&&(A=a.BYTE);const C=t.getSymbolTotalCodewords(b),E=n.getTotalCodewordsCount(b,T),O=(C-E)*8;if(A===a.MIXED)return O;const P=O-m(A,b);switch(A){case a.NUMERIC:return Math.floor(P/10*3);case a.ALPHANUMERIC:return Math.floor(P/11*2);case a.KANJI:return Math.floor(P/13);case a.BYTE:default:return Math.floor(P/8)}},e.getBestVersionForData=function(b,T){let A;const C=i.from(T,i.M);if(Array.isArray(b)){if(b.length>1)return g(b,C);if(b.length===0)return 1;A=b[0]}else A=b;return c(A.mode,A.getLength(),C)},e.getEncodedBits=function(b){if(!o.isValid(b)||b<7)throw new Error("Invalid QR Code version");let T=b<<12;for(;t.getBCHDigit(T)-u>=0;)T^=s<<t.getBCHDigit(T)-u;return b<<12|T}})(uo)),uo}var vo={},qs;function wv(){if(qs)return vo;qs=1;const e=vi(),t=1335,n=21522,i=e.getBCHDigit(t);return vo.getEncodedBits=function(o,s){const u=o.bit<<3|s;let c=u<<10;for(;e.getBCHDigit(c)-i>=0;)c^=t<<e.getBCHDigit(c)-i;return(u<<10|c)^n},vo}var fo={},po,Us;function kv(){if(Us)return po;Us=1;const e=fi();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let a,o,s;for(a=0;a+3<=this.data.length;a+=3)o=this.data.substr(a,3),s=parseInt(o,10),i.put(s,10);const u=this.data.length-a;u>0&&(o=this.data.substr(a),s=parseInt(o,10),i.put(s,u*3+1))},po=t,po}var ho,Fs;function xv(){if(Fs)return ho;Fs=1;const e=fi(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(i){this.mode=e.ALPHANUMERIC,this.data=i}return n.getBitsLength=function(a){return 11*Math.floor(a/2)+6*(a%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(a){let o;for(o=0;o+2<=this.data.length;o+=2){let s=t.indexOf(this.data[o])*45;s+=t.indexOf(this.data[o+1]),a.put(s,11)}this.data.length%2&&a.put(t.indexOf(this.data[o]),6)},ho=n,ho}var mo,js;function Ev(){if(js)return mo;js=1;const e=fi();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let i=0,a=this.data.length;i<a;i++)n.put(this.data[i],8)},mo=t,mo}var _o,zs;function Tv(){if(zs)return _o;zs=1;const e=fi(),t=vi();function n(i){this.mode=e.KANJI,this.data=i}return n.getBitsLength=function(a){return a*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let a;for(a=0;a<this.data.length;a++){let o=t.toSJIS(this.data[a]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[a]+`
|
|
4
|
-
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),i.put(o,13)}},_o=n,_o}var go={exports:{}},$s;function Cv(){return $s||($s=1,(function(e){var t={single_source_shortest_paths:function(n,i,a){var o={},s={};s[i]=0;var u=t.PriorityQueue.make();u.push(i,0);for(var c,m,y,g,_,b,T,A,C;!u.empty();){c=u.pop(),m=c.value,g=c.cost,_=n[m]||{};for(y in _)_.hasOwnProperty(y)&&(b=_[y],T=g+b,A=s[y],C=typeof s[y]>"u",(C||A>T)&&(s[y]=T,u.push(y,T),o[y]=m))}if(typeof a<"u"&&typeof s[a]>"u"){var E=["Could not find a path from ",i," to ",a,"."].join("");throw new Error(E)}return o},extract_shortest_path_from_predecessor_list:function(n,i){for(var a=[],o=i;o;)a.push(o),n[o],o=n[o];return a.reverse(),a},find_path:function(n,i,a){var o=t.single_source_shortest_paths(n,i,a);return t.extract_shortest_path_from_predecessor_list(o,a)},PriorityQueue:{make:function(n){var i=t.PriorityQueue,a={},o;n=n||{};for(o in i)i.hasOwnProperty(o)&&(a[o]=i[o]);return a.queue=[],a.sorter=n.sorter||i.default_sorter,a},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var a={value:n,cost:i};this.queue.push(a),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(go)),go.exports}var Hs;function Sv(){return Hs||(Hs=1,(function(e){const t=fi(),n=kv(),i=xv(),a=Ev(),o=Tv(),s=vl(),u=vi(),c=Cv();function m(E){return unescape(encodeURIComponent(E)).length}function y(E,O,P){const L=[];let Z;for(;(Z=E.exec(P))!==null;)L.push({data:Z[0],index:Z.index,mode:O,length:Z[0].length});return L}function g(E){const O=y(s.NUMERIC,t.NUMERIC,E),P=y(s.ALPHANUMERIC,t.ALPHANUMERIC,E);let L,Z;return u.isKanjiModeEnabled()?(L=y(s.BYTE,t.BYTE,E),Z=y(s.KANJI,t.KANJI,E)):(L=y(s.BYTE_KANJI,t.BYTE,E),Z=[]),O.concat(P,L,Z).sort(function(G,U){return G.index-U.index}).map(function(G){return{data:G.data,mode:G.mode,length:G.length}})}function _(E,O){switch(O){case t.NUMERIC:return n.getBitsLength(E);case t.ALPHANUMERIC:return i.getBitsLength(E);case t.KANJI:return o.getBitsLength(E);case t.BYTE:return a.getBitsLength(E)}}function b(E){return E.reduce(function(O,P){const L=O.length-1>=0?O[O.length-1]:null;return L&&L.mode===P.mode?(O[O.length-1].data+=P.data,O):(O.push(P),O)},[])}function T(E){const O=[];for(let P=0;P<E.length;P++){const L=E[P];switch(L.mode){case t.NUMERIC:O.push([L,{data:L.data,mode:t.ALPHANUMERIC,length:L.length},{data:L.data,mode:t.BYTE,length:L.length}]);break;case t.ALPHANUMERIC:O.push([L,{data:L.data,mode:t.BYTE,length:L.length}]);break;case t.KANJI:O.push([L,{data:L.data,mode:t.BYTE,length:m(L.data)}]);break;case t.BYTE:O.push([{data:L.data,mode:t.BYTE,length:m(L.data)}])}}return O}function A(E,O){const P={},L={start:{}};let Z=["start"];for(let j=0;j<E.length;j++){const G=E[j],U=[];for(let q=0;q<G.length;q++){const I=G[q],R=""+j+q;U.push(R),P[R]={node:I,lastCount:0},L[R]={};for(let V=0;V<Z.length;V++){const B=Z[V];P[B]&&P[B].node.mode===I.mode?(L[B][R]=_(P[B].lastCount+I.length,I.mode)-_(P[B].lastCount,I.mode),P[B].lastCount+=I.length):(P[B]&&(P[B].lastCount=I.length),L[B][R]=_(I.length,I.mode)+4+t.getCharCountIndicator(I.mode,O))}}Z=U}for(let j=0;j<Z.length;j++)L[Z[j]].end=0;return{map:L,table:P}}function C(E,O){let P;const L=t.getBestModeForData(E);if(P=t.from(O,L),P!==t.BYTE&&P.bit<L.bit)throw new Error('"'+E+'" cannot be encoded with mode '+t.toString(P)+`.
|
|
5
|
-
Suggested mode is: `+t.toString(L));switch(P===t.KANJI&&!u.isKanjiModeEnabled()&&(P=t.BYTE),P){case t.NUMERIC:return new n(E);case t.ALPHANUMERIC:return new i(E);case t.KANJI:return new o(E);case t.BYTE:return new a(E)}}e.fromArray=function(O){return O.reduce(function(P,L){return typeof L=="string"?P.push(C(L,null)):L.data&&P.push(C(L.data,L.mode)),P},[])},e.fromString=function(O,P){const L=g(O,u.isKanjiModeEnabled()),Z=T(L),j=A(Z,P),G=c.find_path(j.map,"start","end"),U=[];for(let q=1;q<G.length-1;q++)U.push(j.table[G[q]].node);return e.fromArray(b(U))},e.rawSplit=function(O){return e.fromArray(g(O,u.isKanjiModeEnabled()))}})(fo)),fo}var Gs;function Av(){if(Gs)return Xa;Gs=1;const e=vi(),t=Xo(),n=vv(),i=fv(),a=pv(),o=hv(),s=mv(),u=dl(),c=bv(),m=yv(),y=wv(),g=fi(),_=Sv();function b(j,G){const U=j.size,q=o.getPositions(G);for(let I=0;I<q.length;I++){const R=q[I][0],V=q[I][1];for(let B=-1;B<=7;B++)if(!(R+B<=-1||U<=R+B))for(let W=-1;W<=7;W++)V+W<=-1||U<=V+W||(B>=0&&B<=6&&(W===0||W===6)||W>=0&&W<=6&&(B===0||B===6)||B>=2&&B<=4&&W>=2&&W<=4?j.set(R+B,V+W,!0,!0):j.set(R+B,V+W,!1,!0))}}function T(j){const G=j.size;for(let U=8;U<G-8;U++){const q=U%2===0;j.set(U,6,q,!0),j.set(6,U,q,!0)}}function A(j,G){const U=a.getPositions(G);for(let q=0;q<U.length;q++){const I=U[q][0],R=U[q][1];for(let V=-2;V<=2;V++)for(let B=-2;B<=2;B++)V===-2||V===2||B===-2||B===2||V===0&&B===0?j.set(I+V,R+B,!0,!0):j.set(I+V,R+B,!1,!0)}}function C(j,G){const U=j.size,q=m.getEncodedBits(G);let I,R,V;for(let B=0;B<18;B++)I=Math.floor(B/3),R=B%3+U-8-3,V=(q>>B&1)===1,j.set(I,R,V,!0),j.set(R,I,V,!0)}function E(j,G,U){const q=j.size,I=y.getEncodedBits(G,U);let R,V;for(R=0;R<15;R++)V=(I>>R&1)===1,R<6?j.set(R,8,V,!0):R<8?j.set(R+1,8,V,!0):j.set(q-15+R,8,V,!0),R<8?j.set(8,q-R-1,V,!0):R<9?j.set(8,15-R-1+1,V,!0):j.set(8,15-R-1,V,!0);j.set(q-8,8,1,!0)}function O(j,G){const U=j.size;let q=-1,I=U-1,R=7,V=0;for(let B=U-1;B>0;B-=2)for(B===6&&B--;;){for(let W=0;W<2;W++)if(!j.isReserved(I,B-W)){let oe=!1;V<G.length&&(oe=(G[V]>>>R&1)===1),j.set(I,B-W,oe),R--,R===-1&&(V++,R=7)}if(I+=q,I<0||U<=I){I-=q,q=-q;break}}}function P(j,G,U){const q=new n;U.forEach(function(W){q.put(W.mode.bit,4),q.put(W.getLength(),g.getCharCountIndicator(W.mode,j)),W.write(q)});const I=e.getSymbolTotalCodewords(j),R=u.getTotalCodewordsCount(j,G),V=(I-R)*8;for(q.getLengthInBits()+4<=V&&q.put(0,4);q.getLengthInBits()%8!==0;)q.putBit(0);const B=(V-q.getLengthInBits())/8;for(let W=0;W<B;W++)q.put(W%2?17:236,8);return L(q,j,G)}function L(j,G,U){const q=e.getSymbolTotalCodewords(G),I=u.getTotalCodewordsCount(G,U),R=q-I,V=u.getBlocksCount(G,U),B=q%V,W=V-B,oe=Math.floor(q/V),ve=Math.floor(R/V),Te=ve+1,tt=oe-ve,Oe=new c(tt);let Le=0;const He=new Array(V),Et=new Array(V);let Q=0;const ee=new Uint8Array(j.buffer);for(let Y=0;Y<V;Y++){const re=Y<W?ve:Te;He[Y]=ee.slice(Le,Le+re),Et[Y]=Oe.encode(He[Y]),Le+=re,Q=Math.max(Q,re)}const D=new Uint8Array(q);let $=0,z,de;for(z=0;z<Q;z++)for(de=0;de<V;de++)z<He[de].length&&(D[$++]=He[de][z]);for(z=0;z<tt;z++)for(de=0;de<V;de++)D[$++]=Et[de][z];return D}function Z(j,G,U,q){let I;if(Array.isArray(j))I=_.fromArray(j);else if(typeof j=="string"){let oe=G;if(!oe){const ve=_.rawSplit(j);oe=m.getBestVersionForData(ve,U)}I=_.fromString(j,oe||40)}else throw new Error("Invalid data");const R=m.getBestVersionForData(I,U);if(!R)throw new Error("The amount of data is too big to be stored in a QR Code");if(!G)G=R;else if(G<R)throw new Error(`
|
|
6
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
7
|
-
Minimum version required to store current data is: `+R+`.
|
|
8
|
-
`);const V=P(G,U,I),B=e.getSymbolSize(G),W=new i(B);return b(W,G),T(W),A(W,G),E(W,U,0),G>=7&&C(W,G),O(W,V),isNaN(q)&&(q=s.getBestMask(W,E.bind(null,W,U))),s.applyMask(q,W),E(W,U,q),{modules:W,version:G,errorCorrectionLevel:U,maskPattern:q,segments:I}}return Xa.create=function(G,U){if(typeof G>"u"||G==="")throw new Error("No input text");let q=t.M,I,R;return typeof U<"u"&&(q=t.from(U.errorCorrectionLevel,t.M),I=m.from(U.version),R=s.from(U.maskPattern),U.toSJISFunc&&e.setToSJISFunction(U.toSJISFunc)),Z(G,I,q,R)},Xa}var bo={},yo={},Ks;function fl(){return Ks||(Ks=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let i=n.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+n);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const a=parseInt(i.join(""),16);return{r:a>>24&255,g:a>>16&255,b:a>>8&255,a:a&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const a=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:o,scale:o?4:s,margin:a,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,a){return a.width&&a.width>=i+a.margin*2?a.width/(i+a.margin*2):a.scale},e.getImageWidth=function(i,a){const o=e.getScale(i,a);return Math.floor((i+a.margin*2)*o)},e.qrToImageData=function(i,a,o){const s=a.modules.size,u=a.modules.data,c=e.getScale(s,o),m=Math.floor((s+o.margin*2)*c),y=o.margin*c,g=[o.color.light,o.color.dark];for(let _=0;_<m;_++)for(let b=0;b<m;b++){let T=(_*m+b)*4,A=o.color.light;if(_>=y&&b>=y&&_<m-y&&b<m-y){const C=Math.floor((_-y)/c),E=Math.floor((b-y)/c);A=g[u[C*s+E]?1:0]}i[T++]=A.r,i[T++]=A.g,i[T++]=A.b,i[T]=A.a}}})(yo)),yo}var Vs;function Pv(){return Vs||(Vs=1,(function(e){const t=fl();function n(a,o,s){a.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=s,o.width=s,o.style.height=s+"px",o.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,s,u){let c=u,m=s;typeof c>"u"&&(!s||!s.getContext)&&(c=s,s=void 0),s||(m=i()),c=t.getOptions(c);const y=t.getImageWidth(o.modules.size,c),g=m.getContext("2d"),_=g.createImageData(y,y);return t.qrToImageData(_.data,o,c),n(g,m,y),g.putImageData(_,0,0),m},e.renderToDataURL=function(o,s,u){let c=u;typeof c>"u"&&(!s||!s.getContext)&&(c=s,s=void 0),c||(c={});const m=e.render(o,s,c),y=c.type||"image/png",g=c.rendererOpts||{};return m.toDataURL(y,g.quality)}})(bo)),bo}var wo={},Js;function Nv(){if(Js)return wo;Js=1;const e=fl();function t(a,o){const s=a.a/255,u=o+'="'+a.hex+'"';return s<1?u+" "+o+'-opacity="'+s.toFixed(2).slice(1)+'"':u}function n(a,o,s){let u=a+o;return typeof s<"u"&&(u+=" "+s),u}function i(a,o,s){let u="",c=0,m=!1,y=0;for(let g=0;g<a.length;g++){const _=Math.floor(g%o),b=Math.floor(g/o);!_&&!m&&(m=!0),a[g]?(y++,g>0&&_>0&&a[g-1]||(u+=m?n("M",_+s,.5+b+s):n("m",c,0),c=0,m=!1),_+1<o&&a[g+1]||(u+=n("h",y),y=0)):c++}return u}return wo.render=function(o,s,u){const c=e.getOptions(s),m=o.modules.size,y=o.modules.data,g=m+c.margin*2,_=c.color.light.a?"<path "+t(c.color.light,"fill")+' d="M0 0h'+g+"v"+g+'H0z"/>':"",b="<path "+t(c.color.dark,"stroke")+' d="'+i(y,m,c.margin)+'"/>',T='viewBox="0 0 '+g+" "+g+'"',C='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+T+' shape-rendering="crispEdges">'+_+b+`</svg>
|
|
9
|
-
`;return typeof u=="function"&&u(null,C),C},wo}var Ws;function Mv(){if(Ws)return yi;Ws=1;const e=cv(),t=Av(),n=Pv(),i=Nv();function a(o,s,u,c,m){const y=[].slice.call(arguments,1),g=y.length,_=typeof y[g-1]=="function";if(!_&&!e())throw new Error("Callback required as last argument");if(_){if(g<2)throw new Error("Too few arguments provided");g===2?(m=u,u=s,s=c=void 0):g===3&&(s.getContext&&typeof m>"u"?(m=c,c=void 0):(m=c,c=u,u=s,s=void 0))}else{if(g<1)throw new Error("Too few arguments provided");return g===1?(u=s,s=c=void 0):g===2&&!s.getContext&&(c=u,u=s,s=void 0),new Promise(function(b,T){try{const A=t.create(u,c);b(o(A,s,c))}catch(A){T(A)}})}try{const b=t.create(u,c);m(null,o(b,s,c))}catch(b){m(b)}}return yi.create=t.create,yi.toCanvas=a.bind(null,n.render),yi.toDataURL=a.bind(null,n.renderToDataURL),yi.toString=a.bind(null,function(o,s,u){return i.render(o,u)}),yi}var Rv=Mv();const Iv=dv(Rv);var Ov=S('<canvas class="qr svelte-qzpscf"></canvas>');function Dv(e,t){$t(t,!0);let n=yr(t,"size",3,180),i=F(void 0);sn(()=>{r(i)===void 0||t.text===""||Iv.toCanvas(r(i),t.text,{width:n(),margin:1,color:{dark:"#000000",light:"#ffffff"}})});var a=Ov();Ba(a,o=>w(i,o),()=>r(i)),x(()=>{ne(a,"width",n()),ne(a,"height",n()),ne(a,"aria-label",t.text)}),k(e,a),Ht()}var Lv=S('<!> <dl class="ui-kv"><dt> </dt> <dd><code class="code svelte-1amxn89" data-testid="manual-code"> </code></dd> <dt> </dt> <dd><code> </code></dd></dl>',1),Ys=S('<div class="ui-muted"> </div>'),Bv=S('<button type="button" class="ui-button" data-testid="open-window"> </button>'),qv=S('<button type="button" class="ui-button" data-testid="close-window"> </button>'),Uv=S('<tr><td> </td><td> </td><td><code> </code></td><td><code> </code></td><td class="ui-actions"><button type="button" class="ui-icon-button"><!></button></td></tr>'),Fv=S('<table class="ui-table"><thead><tr><th>#</th><th> </th><th> </th><th> </th><th></th></tr></thead><tbody></tbody></table>'),jv=S('<section class="ui-section bridge" data-testid="bridge"><div class="ui-section-title"><span></span> <span> </span> <div class="ui-toolbar-trailing"> </div></div> <div class="ui-split"><div class="pairing svelte-1amxn89"><!> <div class="ui-toolbar"><span class="ui-muted"> </span> <!></div> <p class="ui-faint ui-small svelte-1amxn89"> </p></div> <div><h3> </h3> <!></div></div></section>'),zv=S('<div class="ui-page" data-testid="bridges-page"><div class="ui-page-scroll bridges svelte-1amxn89"></div></div>');function $v(e,t){$t(t,!0);let n=F(Pt([])),i=F("");async function a(){try{w(n,await Ie.bridges(),!0)}catch(g){Ne.error(ut(g))}}Cr(()=>{a();const g=setInterval(()=>{a()},1e4),_=hr.on(b=>{b.type==="bridges"&&a()});return()=>{clearInterval(g),_()}});async function o(g,_){w(i,g.id,!0);try{await Ie.commissioning(g.id,_,15),Ne.info(d(_?"Commissioning window open for 15 minutes":"Commissioning window closed")),await a()}catch(b){Ne.error(ut(b))}finally{w(i,"")}}async function s(g,_){if(await Zt.confirm(d("Remove fabric {label}? The controller loses the bridge and every device on it.",{label:_.label||`#${_.index}`}),{confirm:d("Remove"),danger:!0}))try{await Ie.removeFabric(g.id,_.index),await a()}catch(T){Ne.error(ut(T))}}function u(g){return d(g===0?"closed":g===2?"open (basic)":"open (enhanced)")}function c(g){return g.length===11?`${g.slice(0,4)}-${g.slice(4,7)}-${g.slice(7)}`:g}var m=zv(),y=h(m);et(y,21,()=>r(n),g=>g.id,(g,_)=>{var b=jv(),T=h(b),A=h(T);let C;var E=l(A),O=l(E);let P;var L=f(O,!0),Z=l(O,2),j=f(Z),G=l(T,2),U=h(G),q=h(U);{var I=$=>{var z=Lv(),de=Pe(z);Dv(de,{get text(){return r(_).pairingCodes.qrPairingCode}});var Y=l(de,2),re=h(Y),se=f(re,!0),le=l(re,2),Ce=h(le),Je=f(Ce,!0),De=l(le,2),X=f(De,!0),he=l(De,2),ke=h(he),We=f(ke,!0);x((nt,yt,ot)=>{v(se,nt),v(Je,yt),v(X,ot),v(We,r(_).pairingCodes.qrPairingCode)},[()=>d("Manual pairing code"),()=>c(r(_).pairingCodes.manualPairingCode),()=>d("QR payload")]),k($,z)},R=$=>{var z=Ys(),de=f(z,!0);x(Y=>v(de,Y),[()=>d("No pairing codes: the bridge is not running.")]),k($,z)};H(q,$=>{r(_).pairingCodes?$(I):$(R,-1)})}var V=l(q,2),B=h(V),W=f(B),oe=l(B,2);{var ve=$=>{var z=Bv(),de=f(z,!0);x(Y=>{z.disabled=r(i)===r(_).id,v(de,Y)},[()=>d("Open for 15 minutes")]),N("click",z,()=>o(r(_),!0)),k($,z)},Te=$=>{var z=qv(),de=f(z,!0);x(Y=>{z.disabled=r(i)===r(_).id,v(de,Y)},[()=>d("Close")]),N("click",z,()=>o(r(_),!1)),k($,z)};H(oe,$=>{r(_).windowStatus===0?$(ve):$(Te,-1)})}var tt=l(V,2),Oe=f(tt,!0),Le=l(U,2),He=h(Le),Et=f(He,!0),Q=l(He,2);{var ee=$=>{var z=Ys(),de=f(z,!0);x(Y=>v(de,Y),[()=>d("No controller has paired this bridge yet.")]),k($,z)},D=$=>{var z=Fv(),de=h(z),Y=h(de),re=l(h(Y)),se=f(re,!0),le=l(re),Ce=f(le,!0),Je=l(le),De=f(Je,!0),X=l(de);et(X,21,()=>r(_).fabrics,he=>he.index,(he,ke)=>{var We=Uv(),nt=h(We),yt=f(nt,!0),ot=l(nt),be=f(ot,!0),Tt=l(ot),Mt=h(Tt),Ft=f(Mt),Lt=l(Tt),Bt=h(Lt),Se=f(Bt,!0),_e=l(Lt),Be=h(_e),Ge=h(Be);Kr(Ge,{name:"trash"}),x((Fe,M)=>{v(yt,r(ke).index),v(be,r(ke).label),v(Ft,`0x${Fe??""}`),v(Se,r(ke).nodeId),ne(Be,"title",M)},[()=>r(ke).vendorId.toString(16),()=>d("Remove")]),N("click",Be,()=>s(r(_),r(ke))),k(he,We)}),x((he,ke,We)=>{v(se,he),v(Ce,ke),v(De,We)},[()=>d("Label"),()=>d("Vendor"),()=>d("Node id")]),k($,z)};H(Q,$=>{r(_).fabrics.length===0?$(ee):$(D,-1)})}x(($,z,de,Y,re,se,le)=>{ne(b,"data-id",r(_).id),C=Nt(A,1,"ui-dot",null,C,{"ui-dot-ok":r(_).online,"ui-dot-error":!r(_).online}),v(E,` ${r(_).id??""} `),P=Nt(O,1,"ui-badge",null,P,{"ui-badge-ok":r(_).commissioned,"ui-badge-warn":!r(_).commissioned}),v(L,$),v(j,`${z??""} · ${de??""}`),v(W,`${Y??""}: ${re??""}`),v(Oe,se),v(Et,le)},[()=>r(_).commissioned?d("commissioned"):d("not commissioned"),()=>d("port {port}",{port:r(_).port}),()=>d("{count} devices",{count:r(_).devices}),()=>d("Commissioning window"),()=>u(r(_).windowStatus),()=>d("Pair the bridge from Apple Home, Home Assistant, Google Home or Alexa with the QR code or the manual code. A commissioned bridge needs an open window for a second controller."),()=>d("Fabrics")]),k(g,b)}),k(e,m),Ht()}or(["click"]);var Hv=S('<div class="ui-ok-text"> </div>'),Gv=S("<code> </code>"),Kv=S("<li><span> </span> <!> </li>"),Vv=S('<ul class="issues svelte-1j1p4r5" data-testid="issues"></ul>');function Ma(e,t){$t(t,!0);let n=yr(t,"empty",3,void 0);var i=ci(),a=Pe(i);{var o=u=>{var c=ci(),m=Pe(c);{var y=g=>{var _=Hv(),b=f(_,!0);x(()=>v(b,n())),k(g,_)};H(m,g=>{n()!==void 0&&g(y)})}k(u,c)},s=u=>{var c=Vv();et(c,21,()=>t.issues,si,(m,y)=>{var g=Kv(),_=h(g);let b;var T=f(_,!0),A=l(_,2);{var C=O=>{var P=Gv(),L=f(P,!0);x(()=>v(L,r(y).path)),k(O,P)};H(A,O=>{r(y).path!==""&&O(C)})}var E=l(A);x(O=>{Nt(g,1,tl(r(y).level==="error"?"ui-error-text":"ui-warn-text"),"svelte-1j1p4r5"),b=Nt(_,1,"ui-badge",null,b,{"ui-badge-error":r(y).level==="error","ui-badge-warn":r(y).level!=="error"}),v(T,O),v(E,` ${r(y).message??""}`)},[()=>r(y).level==="error"?d("error"):d("warning")]),k(m,g)}),k(u,c)};H(a,u=>{t.issues.length===0?u(o):u(s,-1)})}k(e,i),Ht()}var Jv=S('<section class="ui-section svelte-1wugbv7"><div class="ui-section-title"><a> </a></div> <!></section>'),Wv=S('<div data-testid="check-verdict"> </div> <!>',1),Yv=S('<div class="ui-page" data-testid="check-page"><div class="ui-toolbar"><button type="button" class="ui-button ui-button-primary" data-testid="run-check"> </button> <span class="ui-muted"> </span></div> <div class="ui-page-scroll"><!></div></div>');function Qv(e,t){$t(t,!0);let n=F(void 0),i=F(!1);async function a(){w(i,!0);try{w(n,await Ie.check(),!0)}catch(T){Ne.error(ut(T))}finally{w(i,!1)}}var o=Yv(),s=h(o),u=h(s),c=f(u,!0),m=l(u,2),y=f(m,!0),g=l(s,2),_=h(g);{var b=T=>{var A=Wv(),C=Pe(A);let E;var O=f(C,!0),P=l(C,2);et(P,17,()=>Object.entries(r(n).devices),([L,Z])=>L,(L,Z)=>{var j=ie(()=>Ea(r(Z),2));let G=()=>r(j)[0],U=()=>r(j)[1];var q=Jv(),I=h(q),R=h(I),V=f(R,!0),B=l(I,2);Ma(B,{get issues(){return U()}}),x(W=>{ne(R,"href",W),v(V,G())},[()=>`#/devices/${encodeURIComponent(G())}`]),N("click",R,W=>{W.preventDefault(),Br.go("devices",G())}),k(L,q)}),x(L=>{E=Nt(C,1,"verdict svelte-1wugbv7",null,E,{"ui-ok-text":r(n).ok,"ui-error-text":!r(n).ok}),v(O,L)},[()=>r(n).ok?d("Every device conforms."):d("Some devices do not conform.")]),k(T,A)};H(_,T=>{r(n)&&T(b)})}x((T,A)=>{u.disabled=r(i),v(c,T),v(y,A)},[()=>r(i)?d("Checking…"):d("Check every device"),()=>d("The strict dry run: every device is built in a throw-away Matter node, nothing goes online.")]),N("click",u,a),k(e,o),Ht()}or(["click"]);var Zv=S("<span> </span>"),Xv=S('<label><input type="checkbox"/> <!></label>');function Lr(e,t){$t(t,!0);let n=yr(t,"checked",15),i=yr(t,"label",3,""),a=yr(t,"disabled",3,!1),o=yr(t,"title",3,void 0),s=yr(t,"onchange",3,void 0);var u=Xv();let c;var m=h(u),y=l(m,2);{var g=_=>{var b=Zv(),T=f(b,!0);x(()=>v(T,i())),k(_,b)};H(y,_=>{i()!==""&&_(g)})}x(()=>{c=Nt(u,1,"ui-check",null,c,{"ui-disabled":a()}),ne(u,"title",o()),m.disabled=a(),ne(m,"data-testid",t.testId)}),N("change",m,_=>s()?.(_.currentTarget.checked)),rl(m,n),k(e,u),Ht()}or(["change"]);var ef=S('<span class="ui-badge ui-badge-accent"> </span>'),tf=S(" <!>",1),rf=S('<span class="ui-warn-text"> </span>'),nf=S('<p class="ui-muted svelte-1be0y1b"> </p>'),af=S('<p class="ui-warn-text svelte-1be0y1b" data-testid="waiting"> </p>'),of=S('<pre class="log svelte-1be0y1b" data-testid="update-log"> </pre>'),sf=S('<dl class="ui-kv"><dt> </dt> <dd data-testid="version-current"> </dd> <dt> </dt> <dd data-testid="version-latest"><!> <!></dd></dl> <div class="ui-toolbar"><button type="button" class="ui-button" data-testid="check-update"> </button> <button type="button" class="ui-button ui-button-primary" data-testid="update"> </button> <button type="button" class="ui-button" data-testid="restart"> </button></div> <!> <!> <!>',1),uf=S('<section class="ui-section" data-testid="version"><div class="ui-section-title"> </div> <!></section>');function lf(e,t){$t(t,!0);let n=F(void 0),i=F(!1),a=F(void 0),o;async function s(C=!1){try{w(n,await Ie.updateStatus(C),!0)}catch(E){r(a)===void 0&&Ne.error(ut(E))}}Cr(()=>{s()}),oc(()=>{o!==void 0&&clearInterval(o)});function u(){w(a,r(n)?.current,!0);let C=!1;const E=Date.now();o!==void 0&&clearInterval(o),o=setInterval(()=>{Ie.updateStatus().then(O=>{w(n,O,!0);const P=r(a)!==void 0&&O.current!==r(a);(P||C&&O.update.requested===void 0)&&(clearInterval(o),o=void 0,w(a,void 0),Ne.info(d("mqtt2matter {version} is running.",{version:O.current})),P&&window.location.reload())},()=>{C=!0}),Date.now()-E>900*1e3&&(clearInterval(o),o=void 0,w(a,void 0))},2e3)}async function c(){w(i,!0),await s(!0),w(i,!1)}async function m(){const C=r(n)?.latest;if(!(C===void 0||!await Zt.confirm(d("Install mqtt2matter {version} and restart? The bridge is offline for a moment; the pairings stay.",{version:C}),{confirm:d("Update")})))try{await Ie.requestUpdate(C),Ne.info(d("Update to {version} requested.",{version:C})),await s(),u()}catch(O){Ne.error(ut(O))}}async function y(){if(await Zt.confirm(d("Restart mqtt2matter? The bridge is offline for a moment."),{confirm:d("Restart")}))try{await Ie.restart(),Ne.info(d("Restarting…")),u()}catch(E){Ne.error(ut(E))}}var g=uf(),_=h(g),b=f(_,!0),T=l(_,2);{var A=C=>{var E=sf(),O=Pe(E),P=h(O),L=f(P,!0),Z=l(P,2),j=f(Z,!0),G=l(Z,2),U=f(G,!0),q=l(G,2),I=h(q);{var R=Y=>{var re=ki();x(se=>v(re,se),[()=>d("not published on npm yet")]),k(Y,re)},V=Y=>{var re=tf(),se=Pe(re),le=l(se);{var Ce=Je=>{var De=ef(),X=f(De,!0);x(he=>v(X,he),[()=>d("newer")]),k(Je,De)};H(le,Je=>{r(n).newer&&Je(Ce)})}x(()=>v(se,`${r(n).latest??""} `)),k(Y,re)},B=Y=>{var re=ki("—");k(Y,re)};H(I,Y=>{r(n).published===!1?Y(R):r(n).latest!==void 0?Y(V,1):Y(B,-1)})}var W=l(I,2);{var oe=Y=>{var re=rf(),se=f(re,!0);x(()=>v(se,r(n).error)),k(Y,re)};H(W,Y=>{r(n).error&&Y(oe)})}var ve=l(O,2),Te=h(ve),tt=f(Te,!0),Oe=l(Te,2),Le=f(Oe,!0),He=l(Oe,2),Et=f(He,!0),Q=l(ve,2);{var ee=Y=>{var re=nf(),se=f(re,!0);x(()=>v(se,r(n).restart.reason)),k(Y,re)};H(Q,Y=>{!r(n).restart.available&&r(n).restart.reason&&Y(ee)})}var D=l(Q,2);{var $=Y=>{var re=af(),se=f(re,!0);x(le=>v(se,le),[()=>d("Waiting for mqtt2matter to come back…")]),k(Y,re)};H(D,Y=>{r(a)!==void 0&&Y($)})}var z=l(D,2);{var de=Y=>{var re=of(),se=f(re,!0);x(le=>v(se,le),[()=>r(n).update.log.join(`
|
|
10
|
-
`)]),k(Y,re)};H(z,Y=>{r(n).update.log.length>0&&Y(de)})}x((Y,re,se,le,Ce)=>{v(L,Y),v(j,r(n).current),v(U,re),Te.disabled=r(i),v(tt,se),Oe.disabled=!r(n).newer||!r(n).update.available||r(a)!==void 0,ne(Oe,"title",r(n).update.reason??""),v(Le,le),He.disabled=!r(n).restart.available||r(a)!==void 0,ne(He,"title",r(n).restart.reason??""),v(Et,Ce)},[()=>d("Running"),()=>d("Latest"),()=>d("Check now"),()=>d("Update"),()=>d("Restart")]),N("click",Te,c),N("click",Oe,m),N("click",He,y),k(C,E)};H(T,C=>{r(n)&&C(A)})}x(C=>v(b,C),[()=>d("Version")]),k(e,g),Ht()}or(["click"]);var df=S('<span class="ui-faint ui-small"> </span>'),Qs=S('<p class="ui-warn-text svelte-ovo0td"> </p>'),cf=S('<span class="ui-error-text"> </span>'),vf=S('<div class="ui-form-help ui-error-text"> </div>'),ff=S('<label class="ui-form-label" for="access-password"> </label> <div class="ui-form-field"><input id="access-password" class="ui-input" type="password" autocomplete="new-password" data-testid="access-password"/></div> <label class="ui-form-label" for="access-repeat"> </label> <div class="ui-form-field"><input id="access-repeat" class="ui-input" type="password" autocomplete="new-password" data-testid="access-repeat"/></div> <!>',1),pf=S('<label class="ui-form-label" for="access-header"> </label> <div class="ui-form-field"><input id="access-header" class="ui-input"/></div> <label class="ui-form-label" for="access-logout"> </label> <div class="ui-form-field"><input id="access-logout" class="ui-input" placeholder="https://…"/></div> <div class="ui-form-help"> </div>',1),hf=S('<div class="ui-page" data-testid="config-page"><div class="ui-page-scroll columns svelte-ovo0td"><section class="ui-section"><div class="ui-section-title"> <!></div> <p class="ui-muted svelte-ovo0td"> </p> <!> <textarea class="ui-textarea" rows="18" spellcheck="false" data-testid="settings-json"></textarea> <div class="ui-toolbar"><button type="button" class="ui-button ui-button-primary" data-testid="save-settings"> </button> <button type="button" class="ui-button"> </button> <!></div></section> <div class="stack svelte-ovo0td"><section class="ui-section" data-testid="access"><div class="ui-section-title"> </div> <p class="ui-muted svelte-ovo0td"> </p> <!> <div class="ui-form"><label class="ui-form-label" for="access-mode"> </label> <div class="ui-form-field"><select id="access-mode" class="ui-select" data-testid="access-mode"><option> </option><option> </option><option> </option></select></div> <!></div> <div><button type="button" class="ui-button ui-button-primary" data-testid="save-access"> </button></div></section> <section class="ui-section"><div class="ui-section-title"> </div> <p class="ui-muted svelte-ovo0td"> </p> <div><button type="button" class="ui-button" data-testid="export-all"> </button></div></section> <section class="ui-section"><div class="ui-section-title"> </div> <p class="ui-muted svelte-ovo0td"> </p> <input type="file" accept="application/json,.json"/> <textarea class="ui-textarea" rows="8" spellcheck="false" data-testid="import-json"></textarea> <div class="ui-toolbar"><button type="button" class="ui-button ui-button-primary" data-testid="import"> </button> <!></div></section> <!></div></div></div>');function mf(e,t){$t(t,!0);let n=F(void 0),i=F(""),a=F(""),o=F(!1),s=F(!1);const u=ie(()=>ua(r(i))),c=ie(()=>Vr(r(u))),m=ie(()=>ua(r(a))),y=ie(()=>{if(!Vr(r(m)))return;const ae=Vr(r(m).devices)?r(m).devices:r(m);return Object.keys(ae).length>0?ae:void 0});let g=F("none"),_=F(""),b=F(""),T=F("X-Remote-User"),A=F(""),C=F(!1);const E=ie(()=>r(n)?.overridden.some(ae=>ae.startsWith("server.auth"))??!1),O=ie(()=>r(g)!=="password"||r(_)===r(b)&&(r(_)!==""||nr.state?.mode==="password"));function P(ae){const Ve=Vr(ae.effective.server)?ae.effective.server:{},je=Vr(Ve.auth)?Ve.auth:{};w(g,je.mode==="password"||je.mode==="proxy"?je.mode:"none",!0),w(T,typeof je.proxyHeader=="string"?je.proxyHeader:"X-Remote-User",!0),w(A,typeof je.proxyLogoutUrl=="string"?je.proxyLogoutUrl:"",!0),w(_,""),w(b,"")}async function L(){if(!r(O))return;const ae={none:d("Open the UI to everyone who reaches its port?"),password:d("Protect the UI with this password? Other open sessions end."),proxy:d("Trust the {header} header of the reverse proxy? Only the proxy may reach the port then, or anyone can send the header.",{header:r(T)})}[r(g)];if(await Zt.confirm(ae,{confirm:d("Save")})){w(C,!0);try{await Ie.setAccess({mode:r(g),...r(_)===""?{}:{password:r(_)},...r(g)==="proxy"?{proxyHeader:r(T)}:{},...r(g)==="proxy"&&r(A)!==""?{proxyLogoutUrl:r(A)}:{}}),Ne.info(d("Access saved; it applies at once.")),await nr.load(),await Z()}catch(Ve){Ne.error(ut(Ve))}finally{w(C,!1)}}}async function Z(){try{w(n,await Ie.config(),!0),w(i,Nn(r(n).settings),!0),P(r(n))}catch(ae){Ne.error(ut(ae))}}Cr(()=>{Z()});async function j(){if(r(c)){w(s,!0);try{await Ie.saveConfig(r(u)),Ne.warn(d("Settings saved. They apply at the next start of mqtt2matter.")),await Z()}catch(ae){Ne.error(ut(ae))}finally{w(s,!1)}}}async function G(){try{Zo("mqtt2matter.json",Nn(await Ie.exportAll()))}catch(ae){Ne.error(ut(ae))}}function U(ae){const Ve=ae.currentTarget.files?.[0];Ve!==void 0&&Ve.text().then(je=>{w(a,je,!0)},()=>Ne.error(d("The file could not be read.")))}async function q(){if(r(y)===void 0)return;const ae=Object.keys(r(y)).length;if(await Zt.confirm(r(o)?d("Import {count} devices and delete every other device?",{count:ae}):d("Import {count} devices? Existing devices with the same key are replaced.",{count:ae}),{confirm:d("Import"),danger:r(o)}))try{const je=await Ie.importDevices(r(y),r(o));Ne.info(d("{count} devices imported",{count:je.imported})),w(a,"")}catch(je){Ne.error(ut(je))}}var I=hf(),R=h(I),V=h(R),B=h(V),W=h(B),oe=l(W);{var ve=ae=>{var Ve=df(),je=f(Ve,!0);x(()=>v(je,r(n).path)),k(ae,Ve)};H(oe,ae=>{r(n)&&ae(ve)})}var Te=l(B,2),tt=f(Te,!0),Oe=l(Te,2);{var Le=ae=>{var Ve=Qs(),je=f(Ve,!0);x(At=>v(je,At),[()=>d("Set by the environment and not editable here: {paths}",{paths:r(n).overridden.join(", ")})]),k(ae,Ve)};H(Oe,ae=>{r(n)&&r(n).overridden.length>0&&ae(Le)})}var He=l(Oe,2),Et=l(He,2),Q=h(Et),ee=f(Q,!0),D=l(Q,2),$=f(D,!0),z=l(D,2);{var de=ae=>{var Ve=cf(),je=f(Ve,!0);x(At=>v(je,At),[()=>d("Not valid JSON")]),k(ae,Ve)};H(z,ae=>{r(c)||ae(de)})}var Y=l(V,2),re=h(Y),se=h(re),le=f(se,!0),Ce=l(se,2),Je=f(Ce,!0),De=l(Ce,2);{var X=ae=>{var Ve=Qs(),je=f(Ve,!0);x(At=>v(je,At),[()=>d("Set by the environment and not editable here: {paths}",{paths:"server.auth"})]),k(ae,Ve)};H(De,ae=>{r(E)&&ae(X)})}var he=l(De,2),ke=h(he),We=f(ke,!0),nt=l(ke,2),yt=h(nt),ot=h(yt),be=f(ot,!0);ot.value=ot.__value="none";var Tt=l(ot),Mt=f(Tt,!0);Tt.value=Tt.__value="password";var Ft=l(Tt),Lt=f(Ft,!0);Ft.value=Ft.__value="proxy",Qt(yt);var Bt=l(nt,2);{var Se=ae=>{var Ve=ff(),je=Pe(Ve),At=f(je,!0),qt=l(je,2),xe=h(qt),ye=l(qt,2),it=f(ye,!0),qe=l(ye,2),It=h(qe),Xt=l(qe,2);{var er=ct=>{var Wt=vf(),ze=f(Wt,!0);x(kt=>v(ze,kt),[()=>d("The passwords differ.")]),k(ct,Wt)};H(Xt,ct=>{r(_)!==r(b)&&ct(er)})}x((ct,Wt,ze)=>{v(At,ct),ne(xe,"placeholder",Wt),v(it,ze)},[()=>d("Password"),()=>nr.state?.mode==="password"?d("unchanged"):"",()=>d("Repeat")]),Ee(xe,()=>r(_),ct=>w(_,ct)),Ee(It,()=>r(b),ct=>w(b,ct)),k(ae,Ve)},_e=ae=>{var Ve=pf(),je=Pe(Ve),At=f(je,!0),qt=l(je,2),xe=h(qt),ye=l(qt,2),it=f(ye,!0),qe=l(ye,2),It=h(qe),Xt=l(qe,2),er=f(Xt,!0);x((ct,Wt,ze)=>{v(At,ct),v(it,Wt),v(er,ze)},[()=>d("Header"),()=>d("Logout URL"),()=>d('Optional: where "Log out" goes — the sign-out of the proxy.')]),Ee(xe,()=>r(T),ct=>w(T,ct)),Ee(It,()=>r(A),ct=>w(A,ct)),k(ae,Ve)};H(Bt,ae=>{r(g)==="password"?ae(Se):r(g)==="proxy"&&ae(_e,1)})}var Be=l(he,2),Ge=h(Be),Fe=f(Ge,!0),M=l(re,2),J=h(M),K=f(J,!0),ue=l(J,2),Ke=f(ue,!0),ht=l(ue,2),fe=h(ht),pe=f(fe,!0),me=l(M,2),Me=h(me),Ye=f(Me,!0),lt=l(Me,2),gt=f(lt,!0),mt=l(lt,2),Ct=l(mt,2);ne(Ct,"placeholder",'{"devices": {…}}');var Rt=l(Ct,2),rt=h(Rt),st=f(rt,!0),wt=l(rt,2);{let ae=ie(()=>d("replace every device"));Lr(wt,{get label(){return r(ae)},get checked(){return r(o)},set checked(Ve){w(o,Ve,!0)}})}var St=l(me,2);lf(St,{}),x((ae,Ve,je,At,qt,xe,ye,it,qe,It,Xt,er,ct,Wt,ze,kt,Ot)=>{v(W,`${ae??""} `),v(tt,Ve),Q.disabled=!r(c)||r(s),v(ee,je),v($,At),v(le,qt),v(Je,xe),v(We,ye),yt.disabled=r(E),v(be,it),v(Mt,qe),v(Lt,It),Ge.disabled=r(E)||!r(O)||r(C),v(Fe,Xt),v(K,er),v(Ke,ct),v(pe,Wt),v(Ye,ze),v(gt,kt),rt.disabled=r(y)===void 0,v(st,Ot)},[()=>d("Settings"),()=>d("The top level of the configuration file without the devices: mqtt, storage, log, vendorId, productId, bridges, server, presets. Changes apply at the next start."),()=>d("Save"),()=>d("Reload"),()=>d("Access"),()=>d("Who may use this UI and its API. Without a login, keep the port on a trusted network."),()=>d("Login"),()=>d("none"),()=>d("password"),()=>d("reverse proxy"),()=>d("Save"),()=>d("Export"),()=>d("The whole configuration file, as it is on disk. One device exports from the device list."),()=>d("Download mqtt2matter.json"),()=>d("Import"),()=>d("A configuration file or a devices object; every device is validated before anything is written."),()=>r(y)===void 0?d("Import"):d("Import {count} devices",{count:Object.keys(r(y)).length})]),Ee(He,()=>r(i),ae=>w(i,ae)),N("click",Q,j),N("click",D,Z),pr(yt,()=>r(g),ae=>w(g,ae)),N("click",Ge,L),N("click",fe,G),N("change",mt,U),Ee(Ct,()=>r(a),ae=>w(a,ae)),N("click",rt,q),k(e,I),Ht()}or(["click","change"]);const _f={OnOff:[{kind:"attribute",name:"OnOff.onOff"}],LevelControl:[{kind:"attribute",name:"LevelControl.currentLevel"}],ColorControl:[{kind:"attribute",name:"ColorControl.colorTemperatureMireds"},{kind:"attribute",name:"ColorControl.colorHs"},{kind:"attribute",name:"ColorControl.colorXy"},{kind:"attribute",name:"ColorControl.colorRgb"},{kind:"attribute",name:"ColorControl.colorMode"}],WindowCovering:[{kind:"attribute",name:"WindowCovering.currentPositionLiftPercent100ths"},{kind:"attribute",name:"WindowCovering.targetPositionLiftPercent100ths"},{kind:"attribute",name:"WindowCovering.motion"},{kind:"invoke",name:"WindowCovering.upOrOpen"},{kind:"invoke",name:"WindowCovering.downOrClose"},{kind:"invoke",name:"WindowCovering.stopMotion"},{kind:"attribute",name:"WindowCovering.currentPositionTiltPercent100ths"},{kind:"attribute",name:"WindowCovering.targetPositionTiltPercent100ths"}],Thermostat:[{kind:"attribute",name:"Thermostat.localTemperature"},{kind:"attribute",name:"Thermostat.occupiedHeatingSetpoint"},{kind:"attribute",name:"Thermostat.occupiedCoolingSetpoint"},{kind:"attribute",name:"Thermostat.systemMode"},{kind:"attribute",name:"Thermostat.thermostatRunningState"}],DoorLock:[{kind:"attribute",name:"DoorLock.lockState"}],FanControl:[{kind:"attribute",name:"FanControl.percentSetting"},{kind:"attribute",name:"FanControl.percentCurrent"},{kind:"attribute",name:"FanControl.fanMode"},{kind:"attribute",name:"FanControl.speedSetting"}],Switch:[{kind:"event",name:"Switch"}],PowerSource:[{kind:"attribute",name:"PowerSource.batPercentRemaining"},{kind:"attribute",name:"PowerSource.batVoltage"},{kind:"attribute",name:"PowerSource.batChargeLevel"}],TemperatureMeasurement:[{kind:"attribute",name:"TemperatureMeasurement.measuredValue"}],RelativeHumidityMeasurement:[{kind:"attribute",name:"RelativeHumidityMeasurement.measuredValue"}],IlluminanceMeasurement:[{kind:"attribute",name:"IlluminanceMeasurement.measuredValue"}],PressureMeasurement:[{kind:"attribute",name:"PressureMeasurement.measuredValue"}],FlowMeasurement:[{kind:"attribute",name:"FlowMeasurement.measuredValue"}],BooleanState:[{kind:"attribute",name:"BooleanState.stateValue"}],OccupancySensing:[{kind:"attribute",name:"OccupancySensing.occupancy"}],AirQuality:[{kind:"attribute",name:"AirQuality.airQuality"}],SmokeCoAlarm:[{kind:"attribute",name:"SmokeCoAlarm.smokeState"},{kind:"attribute",name:"SmokeCoAlarm.coState"},{kind:"attribute",name:"SmokeCoAlarm.batteryAlert"}],Identify:[{kind:"invoke",name:"Identify.identify"}]},pl={onOff:["OnOff"],light:["OnOff","LevelControl","ColorControl"],cover:["WindowCovering"],climate:["Thermostat"],fan:["FanControl"],switch:["Switch"],powerSource:["PowerSource"]},gf={light:{onCommandType:["first","last","brightness"]},switch:{kind:["momentary","latching"]}};function es(e){return e.split(".")[0]??e}function Ra(e){return e.attribute!==void 0?{kind:"attribute",name:e.attribute}:e.invoke!==void 0?{kind:"invoke",name:e.invoke}:{kind:"event",name:e.event??""}}function Zs(e){return new Set(e.mappings.map(t=>es(Ra(t).name)))}function bf(e){const t=new Set(e);return Object.entries(pl).filter(([,n])=>n.some(i=>t.has(i))).map(([n])=>n)}function yf(e,t){return{id:e,deviceTypes:t,mappings:[],options:{},coalesce:0}}function wf(e){const t={};return e.kind==="attribute"?t.attribute=e.name:e.kind==="invoke"?t.invoke=e.name:t.event=e.name,t}function Xs(e){const t={};for(const[n,i]of Object.entries(e))if(!(i===void 0||i===""||typeof i=="number"&&Number.isNaN(i))&&!(Vr(i)&&n!=="scale"&&n!=="get"&&n!=="codec"&&Object.keys(i).length===0)&&!(n==="get"&&Vr(i)&&(i.topic===""||i.topic===void 0))){if(n==="scale"&&Vr(i)){const a=i.from,o=i.to;if([...a,...o].some(s=>typeof s!="number"||Number.isNaN(s)))continue}t[n]=i}return t}function hl(e){const t={...e};return t.status!==void 0&&(t.status=Xs(t.status)),t.command!==void 0&&(t.command=Xs(t.command)),t.comment===""&&delete t.comment,t}function Ji(e){const t=JSON.parse(JSON.stringify(e));for(const n of t.endpoints)n.mappings=n.mappings.map(hl),n.features!==void 0&&Object.keys(n.features).length===0&&delete n.features,n.attributes!==void 0&&Object.keys(n.attributes).length===0&&delete n.attributes;if(t.availability!==void 0)if(t.availability.topics=t.availability.topics.filter(n=>n.topic!==""),t.availability.topics.length===0)delete t.availability;else for(const n of t.availability.topics)n.extract===""&&delete n.extract,n.template===""&&delete n.template;for(const n of["vendor","model","serial","bridge"])t[n]===""&&delete t[n];return t}function eu(e){return e==="true"?!0:e==="false"?!1:e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):e}function kf(e){const t=e.trim();if(t==="")return"";try{return JSON.parse(t)}catch{return t}}var xf=S('<button type="button" class="ui-button"> </button> <button type="button" class="ui-button ui-button-primary" data-testid="picker-use"> </button>',1),Ef=S('<tr data-testid="picker-row"><td><code> </code></td><td class="payload svelte-1w7v0oq"><code> </code></td><td class="ui-muted"> </td></tr>'),Tf=S('<div class="ui-empty"> </div>'),Cf=S('<button type="button" class="ui-button" data-testid="picker-path"><code> </code> <span class="ui-muted"> </span></button>'),Sf=S('<div class="ui-muted"> </div> <div class="paths svelte-1w7v0oq"></div>',1),Af=S('<div class="detail svelte-1w7v0oq"><div><code> </code></div> <pre class="ui-pre short svelte-1w7v0oq"> </pre> <!></div>'),Pf=S('<input class="ui-input" data-testid="picker-filter"/> <div class="list svelte-1w7v0oq"><table class="ui-table"><thead><tr><th> </th><th> </th><th> </th></tr></thead><tbody></tbody></table> <!></div> <!>',1);function Nf(e,t){$t(t,!0);let n=yr(t,"initial",3,""),i=yr(t,"withExtract",3,!0),a=F(Pt([])),o=F(""),s=F(void 0);const u=ie(()=>{const y=r(o).trim().toLowerCase();return r(a).filter(g=>y===""||g.topic.toLowerCase().includes(y)).slice(0,500)}),c=ie(()=>r(s)===void 0?[]:Bo(ua(r(s).payload)));async function m(){try{w(a,await Ie.topics(),!0)}catch(y){Ne.error(ut(y))}}sn(()=>{t.open&&(w(o,n().split("/").slice(0,2).join("/"),!0),w(s,void 0),m())}),Cr(()=>{const y=hr.wantMqtt(),g=hr.on(_=>{if(_.type!=="mqtt"||!t.open)return;const b=r(a).findIndex(A=>A.topic===_.topic),T={topic:_.topic,payload:_.payload,retain:_.retain,ts:_.ts};b===-1?w(a,[...r(a),T].sort((A,C)=>A.topic.localeCompare(C.topic)),!0):r(a)[b]=T,r(s)?.topic===_.topic&&w(s,T,!0)});return()=>{y(),g()}});{const y=_=>{var b=xf(),T=Pe(b),A=f(T,!0),C=l(T,2),E=f(C,!0);x((O,P)=>{v(A,O),C.disabled=r(s)===void 0,v(E,P)},[()=>d("Cancel"),()=>d("Use topic")]),N("click",T,function(...O){t.onclose?.apply(this,O)}),N("click",C,()=>r(s)&&t.onpick(r(s).topic)),k(_,b)};let g=ie(()=>d("Pick a topic"));qi(e,{get open(){return t.open},get title(){return r(g)},width:"760px",get onclose(){return t.onclose},testId:"topic-picker",buttons:y,children:(_,b)=>{var T=Pf(),A=Pe(T),C=l(A,2),E=h(C),O=h(E),P=h(O),L=h(P),Z=f(L,!0),j=l(L),G=f(j,!0),U=l(j),q=f(U,!0),I=l(O);et(I,21,()=>r(u),oe=>oe.topic,(oe,ve)=>{var Te=Ef();let tt;var Oe=h(Te),Le=h(Oe),He=f(Le,!0),Et=l(Oe),Q=h(Et),ee=f(Q,!0),D=l(Et),$=f(D,!0);x(z=>{tt=Nt(Te,1,"ui-row-link",null,tt,{"ui-row-selected":r(ve).topic===r(s)?.topic}),v(He,r(ve).topic),v(ee,r(ve).payload),v($,z)},[()=>ra(r(ve).ts)]),N("click",Te,()=>w(s,r(ve),!0)),N("dblclick",Te,()=>t.onpick(r(ve).topic)),k(oe,Te)});var R=l(E,2);{var V=oe=>{var ve=Tf(),Te=f(ve,!0);x(tt=>v(Te,tt),[()=>d("No topic seen yet that matches.")]),k(oe,ve)};H(R,oe=>{r(u).length===0&&oe(V)})}var B=l(C,2);{var W=oe=>{var ve=Af(),Te=h(ve),tt=h(Te),Oe=f(tt,!0),Le=l(Te,2),He=f(Le,!0),Et=l(Le,2);{var Q=ee=>{var D=Sf(),$=Pe(D),z=f($,!0),de=l($,2);et(de,21,()=>r(c),Y=>Y.path,(Y,re)=>{var se=Cf(),le=h(se),Ce=f(le,!0),Je=l(le,2),De=f(Je);x(X=>{v(Ce,r(re).path),v(De,`= ${X??""}`)},[()=>Ri(r(re).value)]),N("click",se,()=>r(s)&&t.onpick(r(s).topic,r(re).path)),k(Y,se)}),x(Y=>v(z,Y),[()=>d("Click a key to use the topic with that JSON path:")]),k(ee,D)};H(Et,ee=>{i()&&r(c).length>0&&ee(Q)})}x(()=>{v(Oe,r(s).topic),v(He,r(s).payload)}),k(oe,ve)};H(B,oe=>{r(s)&&oe(W)})}x((oe,ve,Te,tt)=>{ne(A,"placeholder",oe),v(Z,ve),v(G,Te),v(q,tt)},[()=>d("Filter"),()=>d("Topic"),()=>d("Payload"),()=>d("Time")]),Ee(A,()=>r(o),oe=>w(o,oe)),k(_,T)},$$slots:{buttons:!0,default:!0}})}Ht()}or(["click","dblclick"]);var Mf=S('<button type="button" class="ui-button"> </button> <button type="button" class="ui-button ui-button-primary" data-testid="mapping-save"> </button>',1),wi=S("<option> </option>"),Rf=S('<select class="ui-select ui-field-medium"></select>'),If=S('<select class="ui-select ui-field-medium" data-testid="mapping-cluster"><option> </option><!></select> <select class="ui-select" data-testid="mapping-member"><option> </option><!></select>',1),Of=S('<div class="ui-form-help"> </div>'),Df=S('<div class="ui-form-help"> <!> <!></div>'),Lf=S('<div class="row svelte-92wfck"><input class="ui-input ui-mono" data-testid="map-key"/> <span>→</span> <input class="ui-input ui-mono" data-testid="map-value"/> <button type="button" class="ui-icon-button">✕</button></div>'),tu=S('<button type="button" class="ui-button"> </button>'),ru=S('<input class="ui-input ui-field-narrow" type="number"/>–<input class="ui-input ui-field-narrow" type="number"/> → <input class="ui-input ui-field-narrow" type="number"/>–<input class="ui-input ui-field-narrow" type="number"/>',1),nu=S("<code> </code>"),iu=S('<li><span class="ui-muted step svelte-92wfck"> </span> <!></li>'),au=S('<div class="ui-error-text"> </div>'),Bf=S('<ol class="stages svelte-92wfck" data-testid="status-stages"></ol> <!>',1),qf=S('<div class="ui-form compact svelte-92wfck"><label class="ui-form-label" for="status-topic"> </label> <div class="ui-form-field"><input id="status-topic" class="ui-input ui-mono" data-testid="status-topic"/> <button type="button" class="ui-button" data-testid="pick-status-topic"> </button></div> <label class="ui-form-label" for="status-extract"> </label> <div class="ui-form-field"><input id="status-extract" class="ui-input ui-mono" placeholder="$.state" data-testid="status-extract"/></div> <label class="ui-form-label" for="status-template"> </label> <div class="ui-form-field"><input id="status-template" class="ui-input ui-mono"/></div> <span class="ui-form-label"> </span> <div class="rows svelte-92wfck"><!> <div><button type="button" class="ui-button" data-testid="map-add"> </button> <!></div></div> <label class="ui-form-label" for="status-default"> </label> <div class="ui-form-field"><input id="status-default" class="ui-input ui-field-medium"/></div> <label class="ui-form-label" for="status-type"> </label> <div class="ui-form-field"><select id="status-type" class="ui-select ui-field-medium"><option> </option><option>boolean</option><option>number</option><option>string</option></select></div> <label class="ui-form-label" for="status-unit"> </label> <div class="ui-form-field"><select id="status-unit" class="ui-select ui-field-medium" data-testid="status-unit"><option> </option><!></select></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><!> <!></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><input class="ui-input ui-field-narrow" type="number" step="any"/> <input class="ui-input ui-field-narrow" type="number" min="0" max="10"/> <!></div> <label class="ui-form-label" for="status-expire"> </label> <div class="ui-form-field"><input id="status-expire" class="ui-input ui-field-narrow" type="number" min="1"/> <span class="ui-muted ui-small"> </span></div> <label class="ui-form-label" for="status-get"> </label> <div class="ui-form-field"><input id="status-get" class="ui-input ui-mono"/> <input class="ui-input ui-mono ui-field-medium"/></div></div> <div class="preview svelte-92wfck"><div class="ui-section-title"> </div> <div class="ui-form compact svelte-92wfck"><label class="ui-form-label" for="status-payload"> </label> <div class="ui-form-field"><textarea id="status-payload" class="ui-textarea" rows="2" data-testid="status-payload"></textarea></div></div> <!> <div><button type="button" class="ui-button" data-testid="send-status"> </button></div></div>',1),Uf=S('<div class="row svelte-92wfck"><input class="ui-input ui-mono" data-testid="format-key"/> <span>→</span> <input class="ui-input ui-mono" data-testid="format-value"/> <button type="button" class="ui-icon-button">✕</button></div>'),Ff=S('<button type="button" class="ui-button">ON / OFF</button>'),jf=S('<select id="command-value" class="ui-select"><option>—</option><!></select>'),zf=S('<select id="command-value" class="ui-select ui-field-medium" data-testid="command-value"><option>—</option><option>true</option><option>false</option></select>'),$f=S('<input id="command-value" class="ui-input ui-mono" data-testid="command-value"/>'),Hf=S('<ol class="stages svelte-92wfck" data-testid="command-stages"></ol> <!>',1),Gf=S('<div class="ui-form compact svelte-92wfck"><label class="ui-form-label" for="command-topic"> </label> <div class="ui-form-field"><input id="command-topic" class="ui-input ui-mono" data-testid="command-topic"/> <button type="button" class="ui-button"> </button></div> <label class="ui-form-label" for="command-unit"> </label> <div class="ui-form-field"><select id="command-unit" class="ui-select ui-field-medium"><option> </option><!></select></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><!> <!></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><input class="ui-input ui-field-narrow" type="number" step="any"/> <input class="ui-input ui-field-narrow" type="number" min="0" max="10"/> <input class="ui-input ui-field-narrow" type="number" min="0" max="10"/> <!></div> <span class="ui-form-label"> </span> <div class="rows svelte-92wfck"><!> <div><button type="button" class="ui-button" data-testid="format-add"> </button> <!> <!></div></div> <label class="ui-form-label" for="command-payload"> </label> <div class="ui-form-field"><input id="command-payload" class="ui-input ui-mono"/></div> <label class="ui-form-label" for="command-template"> </label> <div class="ui-form-field"><input id="command-template" class="ui-input ui-mono"/></div> <label class="ui-form-label" for="command-wrap"> </label> <div class="ui-form-field"><input id="command-wrap" class="ui-input ui-mono" placeholder="state" data-testid="command-wrap"/></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><!> <select class="ui-select ui-field-narrow"><option>QoS 0</option><option>QoS 1</option><option>QoS 2</option></select> <select class="ui-select ui-field-medium"><option> </option><option> </option><option> </option></select></div></div> <div class="preview svelte-92wfck"><div class="ui-section-title"> </div> <div class="ui-form compact svelte-92wfck"><label class="ui-form-label" for="command-value"> </label> <div class="ui-form-field"><!></div></div> <!> <div><button type="button" class="ui-button" data-testid="send-command"> </button></div></div>',1),Kf=S('<div class="ui-form compact svelte-92wfck"><span class="ui-form-label"> </span> <div class="ui-form-field"><select class="ui-select ui-field-medium" data-testid="mapping-kind"><option> </option><option> </option><option> </option></select> <!></div> <!> <label class="ui-form-label" for="mapping-comment"> </label> <div class="ui-form-field"><input id="mapping-comment" class="ui-input"/></div></div> <div class="halves svelte-92wfck"><section class="ui-section"><div class="ui-section-title"><!></div> <!></section> <section class="ui-section"><div class="ui-section-title"><!></div> <!></section></div>',1),Vf=S("<!> <!>",1);function Jf(e,t){$t(t,!0);let n=F("attribute"),i=F(""),a=F(""),o=F(""),s=F(void 0),u=F(void 0),c=F(Pt([])),m=F(Pt([])),y=F("auto"),g=F(void 0),_=F(""),b=F(void 0),T=F(""),A=F(void 0),C=F(void 0);const E=ie(()=>r(i)===""||r(a)===""?"":r(n)==="event"?r(i):`${r(i)}.${r(a)}`),O=ie(()=>[...t.endpointClusters,...t.catalog.clusters.filter(Q=>!t.endpointClusters.includes(Q))]),P=ie(()=>r(g)?.attributes.find(Q=>Q.name===r(a))),L=ie(()=>t.catalog.composites[r(E)]),Z=ie(()=>{if(r(n)==="event")return[];if(r(n)==="invoke")return(r(g)?.commands??[]).map(D=>({name:D.name,hint:D.fields.join(", ")}));const Q=(r(g)?.attributes??[]).map(D=>({name:D.name,hint:`${D.metatype}${D.writable?` · ${d("writable")}`:""}${D.conformance==="M"?` · ${d("mandatory")}`:""}`}));return[...Object.entries(t.catalog.composites).filter(([,D])=>D.cluster===r(i)).map(([D,$])=>({name:D.split(".")[1]??D,hint:$.description})),...Q]}),j=ie(()=>r(P)?.enumMembers===void 0?[]:Object.keys(r(P).enumMembers));sn(()=>{if(!t.open)return;const Q=Ra(t.mapping);w(n,Q.kind,!0),w(i,Q.kind==="event"?Q.name||"Switch":es(Q.name),!0),w(a,Q.kind==="event"?"Switch":Q.name.split(".")[1]??"",!0),w(o,t.mapping.comment??"",!0),w(s,t.mapping.status===void 0?void 0:structuredClone(Wi(t.mapping.status)),!0),w(u,t.mapping.command===void 0?void 0:structuredClone(Wi(t.mapping.command)),!0),w(c,Object.entries(t.mapping.status?.map??{}).map(([ee,D])=>({key:ee,value:String(D)})),!0),w(m,Object.entries(t.mapping.command?.format??{}).map(([ee,D])=>({key:ee,value:D})),!0),w(y,t.mapping.command?.optimistic===void 0?"auto":t.mapping.command.optimistic?"true":"false",!0),w(b,void 0),w(A,void 0),w(T,""),w(_,""),G(t.mapping.status?.topic)}),sn(()=>{if(r(i)===""||r(n)==="event"){w(g,void 0);return}const Q=r(i);Ie.cluster(Q).then(ee=>{Q===r(i)&&w(g,ee,!0)},()=>{w(g,void 0)})});async function G(Q){if(!(Q===void 0||Q===""))try{const ee=(await Ie.topics(Q)).find(D=>D.topic===Q);ee!==void 0&&r(_)===""&&(w(_,ee.payload,!0),q())}catch{}}function U(){const Q={};if(r(n)==="attribute"?Q.attribute=r(E):r(n)==="invoke"?Q.invoke=r(E):Q.event=r(i),r(o)!==""&&(Q.comment=r(o)),r(s)!==void 0){const ee={...Wi(r(s))},D=Object.fromEntries(r(c).filter($=>$.key!=="").map($=>[$.key,eu($.value)]));Object.keys(D).length>0?ee.map=D:delete ee.map,ee.default!==void 0&&typeof ee.default=="string"&&(ee.default=eu(ee.default)),Q.status=ee}if(r(u)!==void 0){const ee={...Wi(r(u))},D=Object.fromEntries(r(m).filter($=>$.key!=="").map($=>[$.key,$.value]));Object.keys(D).length>0?ee.format=D:delete ee.format,r(y)==="auto"?delete ee.optimistic:ee.optimistic=r(y)==="true",Q.command=ee}return hl(Q)}const q=qo(()=>{const Q=U();if(Q.status===void 0){w(b,void 0);return}Ie.previewStatus(Q.status,r(_),Q.attribute).then(ee=>w(b,ee,!0),ee=>{w(b,{stages:[],ok:!1,reason:ut(ee)},!0)})},250),I=qo(()=>{const Q=U();if(Q.command===void 0){w(A,void 0);return}Ie.previewCommand(Q.command,kf(r(T)),Q.attribute).then(ee=>w(A,ee,!0),ee=>{w(A,{stages:[],ok:!1,reason:ut(ee)},!0)})},250);function R(){q(),I()}async function V(Q,ee){if(!(Q===void 0||Q===""||typeof ee!="string"))try{await Ie.publish(Q,ee),Ne.info(d("Published to {topic}",{topic:Q}))}catch(D){Ne.error(ut(D))}}function B(Q){w(s,Q?{topic:""}:void 0,!0),R()}function W(Q){w(u,Q?{topic:""}:void 0,!0),R()}function oe(Q){return Q.scale??={from:[0,100],to:[0,100]},Q.scale}function ve(Q,ee){ee?oe(Q):delete Q.scale,R()}function Te(Q,ee){r(C)==="status"&&r(s)!==void 0?(r(s).topic=Q,ee!==void 0&&(r(s).extract=ee),G(Q)):r(C)==="command"&&r(u)!==void 0?r(u).topic=Q:r(C)==="get"&&r(s)!==void 0&&(r(s).get={topic:Q,payload:r(s).get?.payload??""}),w(C,void 0),R()}function tt(){r(E)===""||r(s)===void 0&&r(u)===void 0||t.onsave(U())}function Oe(Q){return Q===""?void 0:Number(Q)}Cr(()=>()=>{});var Le=Vf(),He=Pe(Le);{const Q=D=>{var $=Mf(),z=Pe($),de=f(z,!0),Y=l(z,2),re=f(Y,!0);x((se,le)=>{v(de,se),Y.disabled=r(E)===""||r(s)===void 0&&r(u)===void 0,v(re,le)},[()=>d("Cancel"),()=>d("Apply")]),N("click",z,function(...se){t.onclose?.apply(this,se)}),N("click",Y,tt),k(D,$)};let ee=ie(()=>r(E)===""?d("Mapping"):r(E));qi(He,{get open(){return t.open},get title(){return r(ee)},width:"980px",get onclose(){return t.onclose},testId:"mapping-editor",buttons:Q,children:(D,$)=>{var z=Kf(),de=Pe(z),Y=h(de),re=f(Y,!0),se=l(Y,2),le=h(se),Ce=h(le),Je=f(Ce,!0);Ce.value=Ce.__value="attribute";var De=l(Ce),X=f(De,!0);De.value=De.__value="invoke";var he=l(De),ke=f(he,!0);he.value=he.__value="event",Qt(le);var We=l(le,2);{var nt=fe=>{var pe=Rf();et(pe,20,()=>t.catalog.eventChannels,me=>me,(me,Me)=>{var Ye=wi(),lt=f(Ye,!0),gt={};x(()=>{v(lt,Me),gt!==(gt=Me)&&(Ye.value=(Ye.__value=gt)??"")}),k(me,Ye)}),Qt(pe),N("change",pe,R),pr(pe,()=>r(i),me=>w(i,me)),k(fe,pe)},yt=fe=>{var pe=If(),me=Pe(pe),Me=h(me),Ye=f(Me,!0);Me.value=Me.__value="";var lt=l(Me);et(lt,16,()=>r(O),rt=>rt,(rt,st)=>{var wt=wi(),St=f(wt,!0),ae={};x(()=>{v(St,st),ae!==(ae=st)&&(wt.value=(wt.__value=ae)??"")}),k(rt,wt)}),Qt(me);var gt=l(me,2),mt=h(gt),Ct=f(mt,!0);mt.value=mt.__value="";var Rt=l(mt);et(Rt,17,()=>r(Z),rt=>rt.name,(rt,st)=>{var wt=wi(),St=f(wt),ae={};x(()=>{v(St,`${r(st).name??""} — ${r(st).hint??""}`),ae!==(ae=r(st).name)&&(wt.value=(wt.__value=ae)??"")}),k(rt,wt)}),Qt(gt),x((rt,st)=>{v(Ye,rt),v(Ct,st)},[()=>d("— cluster —"),()=>r(n)==="invoke"?d("— command —"):d("— attribute —")]),N("change",me,()=>{w(a,""),R()}),pr(me,()=>r(i),rt=>w(i,rt)),N("change",gt,R),pr(gt,()=>r(a),rt=>w(a,rt)),k(fe,pe)};H(We,fe=>{r(n)==="event"?fe(nt):fe(yt,-1)})}var ot=l(se,2);{var be=fe=>{var pe=Of(),me=f(pe,!0);x(()=>v(me,r(L).description)),k(fe,pe)},Tt=fe=>{var pe=Df(),me=h(pe),Me=l(me);{var Ye=mt=>{var Ct=ki();x(Rt=>v(Ct,`· ${Rt??""}`),[()=>r(j).join(", ")]),k(mt,Ct)};H(Me,mt=>{r(j).length>0&&mt(Ye)})}var lt=l(Me,2);{var gt=mt=>{var Ct=ki();x(Rt=>v(Ct,`· ${Rt??""}`),[()=>r(P).bitFields.map(Rt=>Rt.name).join(", ")]),k(mt,Ct)};H(lt,mt=>{r(P).bitFields&&mt(gt)})}x(mt=>v(me,`${r(P).metatype??""}${mt??""}${r(P).min!==void 0||r(P).max!==void 0?` · ${r(P).min??""}–${r(P).max??""}`:""} `),[()=>r(P).nullable?` · ${d("nullable")}`:""]),k(fe,pe)};H(ot,fe=>{r(L)?fe(be):r(P)&&fe(Tt,1)})}var Mt=l(ot,2),Ft=f(Mt,!0),Lt=l(Mt,2),Bt=h(Lt),Se=l(de,2),_e=h(Se),Be=h(_e),Ge=h(Be);{let fe=ie(()=>r(s)!==void 0),pe=ie(()=>d("Status (device → Matter)"));Lr(Ge,{get checked(){return r(fe)},get label(){return r(pe)},onchange:B,testId:"status-enabled"})}var Fe=l(Be,2);{var M=fe=>{var pe=qf(),me=Pe(pe),Me=h(me),Ye=f(Me,!0),lt=l(Me,2),gt=h(lt),mt=l(gt,2),Ct=f(mt,!0),Rt=l(lt,2),rt=f(Rt,!0),st=l(Rt,2),wt=h(st),St=l(st,2),ae=f(St,!0),Ve=l(St,2),je=h(Ve);ne(je,"placeholder","{{ value_json.state }}");var At=l(Ve,2),qt=f(At,!0),xe=l(At,2),ye=h(xe);et(ye,17,()=>r(c),si,(we,xt,te)=>{var ce=Lf(),ge=h(ce),Ue=l(ge,4),Ae=l(Ue,2);x((at,bt,Ut)=>{ne(ge,"placeholder",at),ne(Ue,"placeholder",bt),ne(Ae,"title",Ut)},[()=>d("payload"),()=>d("value"),()=>d("Remove")]),N("input",ge,R),Ee(ge,()=>r(xt).key,at=>r(xt).key=at),N("input",Ue,R),Ee(Ue,()=>r(xt).value,at=>r(xt).value=at),N("click",Ae,()=>{r(c).splice(te,1),R()}),k(we,ce)});var it=l(ye,2),qe=h(it),It=f(qe),Xt=l(qe,2);{var er=we=>{var xt=tu(),te=f(xt,!0);x(ce=>v(te,ce),[()=>d("Enum names")]),N("click",xt,()=>{w(c,r(j).map(ce=>({key:ce.toLowerCase(),value:ce})),!0),R()}),k(we,xt)};H(Xt,we=>{r(j).length>0&&r(c).length===0&&we(er)})}var ct=l(xe,2),Wt=f(ct,!0),ze=l(ct,2),kt=h(ze),Ot=l(ze,2),jt=f(Ot,!0),wn=l(Ot,2),un=h(wn),Sr=h(un),Ui=f(Sr,!0);Sr.value=(Sr.__value=void 0)??"";var kn=l(Sr);kn.value=kn.__value="boolean";var Hn=l(kn);Hn.value=Hn.__value="number";var Gn=l(Hn);Gn.value=Gn.__value="string",Qt(un);var pi=l(wn,2),hi=f(pi,!0),On=l(pi,2),ln=h(On),xn=h(ln),Kn=f(xn,!0);xn.value=(xn.__value=void 0)??"";var Fi=l(xn);et(Fi,16,()=>t.catalog.units,we=>we,(we,xt)=>{var te=wi(),ce=f(te,!0),ge={};x(()=>{v(ce,xt),ge!==(ge=xt)&&(te.value=(te.__value=ge)??"")}),k(we,te)}),Qt(ln);var Vn=l(On,2),Jn=f(Vn,!0),Wn=l(Vn,2),Yn=h(Wn);{let we=ie(()=>r(s).scale!==void 0);Lr(Yn,{get checked(){return r(we)},onchange:xt=>r(s)&&ve(r(s),xt)})}var mi=l(Yn,2);{var _i=we=>{var xt=ru(),te=Pe(xt),ce=l(te,2),ge=l(ce,2),Ue=l(ge,2);N("input",te,R),Ee(te,()=>r(s).scale.from[0],Ae=>r(s).scale.from[0]=Ae),N("input",ce,R),Ee(ce,()=>r(s).scale.from[1],Ae=>r(s).scale.from[1]=Ae),N("input",ge,R),Ee(ge,()=>r(s).scale.to[0],Ae=>r(s).scale.to[0]=Ae),N("input",Ue,R),Ee(Ue,()=>r(s).scale.to[1],Ae=>r(s).scale.to[1]=Ae),k(we,xt)};H(mi,we=>{r(s).scale&&we(_i)})}var Qn=l(Wn,2),ji=f(Qn,!0),Zn=l(Qn,2),En=h(Zn),_r=l(En,2),Xn=l(_r,2);{let we=ie(()=>r(s).invert===!0),xt=ie(()=>d("invert"));Lr(Xn,{get checked(){return r(we)},get label(){return r(xt)},onchange:te=>{r(s)&&(r(s).invert=te?!0:void 0),R()}})}var Re=l(Zn,2),Qe=f(Re,!0),Ze=l(Re,2),zt=h(Ze),Yt=l(zt,2),sr=f(Yt,!0),ar=l(Ze,2),qr=f(ar,!0),Ur=l(ar,2),Ar=h(Ur),Fr=l(Ar,2),Tn=l(me,2),Yr=h(Tn),Dn=f(Yr,!0),Cn=l(Yr,2),Pr=h(Cn),ur=f(Pr,!0),Qr=l(Pr,2),dn=h(Qr),Nr=l(Cn,2);{var cn=we=>{var xt=Bf(),te=Pe(xt);et(te,21,()=>r(b).stages,Ue=>Ue.step,(Ue,Ae)=>{var at=iu();let bt;var Ut=h(at),gr=f(Ut,!0),lr=l(Ut,2);{var zr=vr=>{var kr=nu(),xr=f(kr,!0);x($e=>v(xr,$e),[()=>Ri(r(Ae).value)]),k(vr,kr)},Mr=vr=>{var kr=ki();x(()=>v(kr,r(Ae).reason)),k(vr,kr)};H(lr,vr=>{r(Ae).ok?vr(zr):vr(Mr,-1)})}x(()=>{bt=Nt(at,1,"",null,bt,{"ui-error-text":!r(Ae).ok}),v(gr,r(Ae).step)}),k(Ue,at)});var ce=l(te,2);{var ge=Ue=>{var Ae=au(),at=f(Ae,!0);x(()=>v(at,r(b).reason)),k(Ue,Ae)};H(ce,Ue=>{r(b).stages.length===0&&r(b).reason&&Ue(ge)})}k(we,xt)};H(Nr,we=>{r(b)&&we(cn)})}var Ln=l(Nr,2),jr=h(Ln),Zr=f(jr,!0);x((we,xt,te,ce,ge,Ue,Ae,at,bt,Ut,gr,lr,zr,Mr,vr,kr,xr,$e,dt,vt,Gt,tr,fr)=>{v(Ye,we),v(Ct,xt),v(rt,te),v(ae,ce),v(qt,ge),v(It,`+ ${Ue??""}`),v(Wt,Ae),v(jt,at),v(Ui,bt),v(hi,Ut),v(Kn,gr),v(Jn,lr),v(ji,zr),ne(En,"placeholder",Mr),Sn(En,r(s).offset??""),ne(_r,"placeholder",vr),Sn(_r,r(s).round??""),v(Qe,kr),Sn(zt,r(s).expire??""),v(sr,xr),v(qr,$e),ne(Ar,"placeholder",dt),Sn(Ar,r(s).get?.topic??""),ne(Fr,"placeholder",vt),Sn(Fr,r(s).get?.payload??""),v(Dn,Gt),v(ur,tr),jr.disabled=r(s).topic===""||r(_)==="",v(Zr,fr)},[()=>d("Topic"),()=>d("Pick"),()=>d("Extract (JSON path)"),()=>d("Template"),()=>d("Map"),()=>d("Row"),()=>d("Default"),()=>d("Type"),()=>d("— none —"),()=>d("Unit"),()=>d("— none —"),()=>d("Scale"),()=>d("Offset / round / invert"),()=>d("offset"),()=>d("round"),()=>d("Expire (s)"),()=>d("without a message for this long the device is unreachable"),()=>d("Get request"),()=>d("topic"),()=>d("payload"),()=>d("Preview"),()=>d("Payload"),()=>d("Publish as the device would")]),N("input",gt,R),Ee(gt,()=>r(s).topic,we=>r(s).topic=we),N("click",mt,()=>w(C,"status")),N("input",wt,R),Ee(wt,()=>r(s).extract,we=>r(s).extract=we),N("input",je,R),Ee(je,()=>r(s).template,we=>r(s).template=we),N("click",qe,()=>r(c).push({key:"",value:""})),N("input",kt,R),Ee(kt,()=>r(s).default,we=>r(s).default=we),N("change",un,R),pr(un,()=>r(s).type,we=>r(s).type=we),N("change",ln,R),pr(ln,()=>r(s).unit,we=>r(s).unit=we),N("input",En,we=>{r(s)&&(r(s).offset=Oe(we.currentTarget.value)),R()}),N("input",_r,we=>{r(s)&&(r(s).round=Oe(we.currentTarget.value)),R()}),N("input",zt,we=>{r(s)&&(r(s).expire=Oe(we.currentTarget.value))}),N("input",Ar,we=>{r(s)&&(r(s).get={topic:we.currentTarget.value,payload:r(s).get?.payload??""})}),N("input",Fr,we=>{r(s)&&(r(s).get={topic:r(s).get?.topic??"",payload:we.currentTarget.value})}),N("input",dn,q),Ee(dn,()=>r(_),we=>w(_,we)),N("click",jr,()=>V(r(s)?.topic,r(_))),k(fe,pe)};H(Fe,fe=>{r(s)&&fe(M)})}var J=l(_e,2),K=h(J),ue=h(K);{let fe=ie(()=>r(u)!==void 0),pe=ie(()=>d("Command (Matter → device)"));Lr(ue,{get checked(){return r(fe)},get label(){return r(pe)},onchange:W,testId:"command-enabled"})}var Ke=l(K,2);{var ht=fe=>{var pe=Gf(),me=Pe(pe),Me=h(me),Ye=f(Me,!0),lt=l(Me,2),gt=h(lt),mt=l(gt,2),Ct=f(mt,!0),Rt=l(lt,2),rt=f(Rt,!0),st=l(Rt,2),wt=h(st),St=h(wt),ae=f(St,!0);St.value=(St.__value=void 0)??"";var Ve=l(St);et(Ve,16,()=>t.catalog.units,te=>te,(te,ce)=>{var ge=wi(),Ue=f(ge,!0),Ae={};x(()=>{v(Ue,ce),Ae!==(Ae=ce)&&(ge.value=(ge.__value=Ae)??"")}),k(te,ge)}),Qt(wt);var je=l(st,2),At=f(je,!0),qt=l(je,2),xe=h(qt);{let te=ie(()=>r(u).scale!==void 0);Lr(xe,{get checked(){return r(te)},onchange:ce=>r(u)&&ve(r(u),ce)})}var ye=l(xe,2);{var it=te=>{var ce=ru(),ge=Pe(ce),Ue=l(ge,2),Ae=l(Ue,2),at=l(Ae,2);N("input",ge,R),Ee(ge,()=>r(u).scale.from[0],bt=>r(u).scale.from[0]=bt),N("input",Ue,R),Ee(Ue,()=>r(u).scale.from[1],bt=>r(u).scale.from[1]=bt),N("input",Ae,R),Ee(Ae,()=>r(u).scale.to[0],bt=>r(u).scale.to[0]=bt),N("input",at,R),Ee(at,()=>r(u).scale.to[1],bt=>r(u).scale.to[1]=bt),k(te,ce)};H(ye,te=>{r(u).scale&&te(it)})}var qe=l(qt,2),It=f(qe,!0),Xt=l(qe,2),er=h(Xt),ct=l(er,2),Wt=l(ct,2),ze=l(Wt,2);{let te=ie(()=>r(u).invert===!0),ce=ie(()=>d("invert"));Lr(ze,{get checked(){return r(te)},get label(){return r(ce)},onchange:ge=>{r(u)&&(r(u).invert=ge?!0:void 0),R()}})}var kt=l(Xt,2),Ot=f(kt,!0),jt=l(kt,2),wn=h(jt);et(wn,17,()=>r(m),si,(te,ce,ge)=>{var Ue=Uf(),Ae=h(Ue),at=l(Ae,4),bt=l(at,2);x((Ut,gr,lr)=>{ne(Ae,"placeholder",Ut),ne(at,"placeholder",gr),ne(bt,"title",lr)},[()=>d("value"),()=>d("payload"),()=>d("Remove")]),N("input",Ae,R),Ee(Ae,()=>r(ce).key,Ut=>r(ce).key=Ut),N("input",at,R),Ee(at,()=>r(ce).value,Ut=>r(ce).value=Ut),N("click",bt,()=>{r(m).splice(ge,1),R()}),k(te,Ue)});var un=l(wn,2),Sr=h(un),Ui=f(Sr),kn=l(Sr,2);{var Hn=te=>{var ce=Ff();N("click",ce,()=>{w(m,[{key:"true",value:"ON"},{key:"false",value:"OFF"}],!0),R()}),k(te,ce)};H(kn,te=>{r(P)?.metatype==="boolean"&&r(m).length===0&&te(Hn)})}var Gn=l(kn,2);{var pi=te=>{var ce=tu(),ge=f(ce,!0);x(Ue=>v(ge,Ue),[()=>d("Enum names")]),N("click",ce,()=>{w(m,r(j).map(Ue=>({key:Ue,value:Ue.toLowerCase()})),!0),R()}),k(te,ce)};H(Gn,te=>{r(j).length>0&&r(m).length===0&&te(pi)})}var hi=l(jt,2),On=f(hi,!0),ln=l(hi,2),xn=h(ln),Kn=l(ln,2),Fi=f(Kn,!0),Vn=l(Kn,2),Jn=h(Vn);ne(Jn,"placeholder",'{"brightness": {{ brightness }}}');var Wn=l(Vn,2),Yn=f(Wn,!0),mi=l(Wn,2),_i=h(mi),Qn=l(mi,2),ji=f(Qn,!0),Zn=l(Qn,2),En=h(Zn);{let te=ie(()=>r(u).retain===!0),ce=ie(()=>d("retain"));Lr(En,{get checked(){return r(te)},get label(){return r(ce)},onchange:ge=>{r(u)&&(r(u).retain=ge?!0:void 0)}})}var _r=l(En,2),Xn=h(_r);Xn.value=Xn.__value=0;var Re=l(Xn);Re.value=Re.__value=1;var Qe=l(Re);Qe.value=Qe.__value=2;var Ze;Qt(_r);var zt=l(_r,2),Yt=h(zt),sr=f(Yt,!0);Yt.value=Yt.__value="auto";var ar=l(Yt),qr=f(ar,!0);ar.value=ar.__value="true";var Ur=l(ar),Ar=f(Ur,!0);Ur.value=Ur.__value="false",Qt(zt);var Fr=l(me,2),Tn=h(Fr),Yr=f(Tn,!0),Dn=l(Tn,2),Cn=h(Dn),Pr=f(Cn,!0),ur=l(Cn,2),Qr=h(ur);{var dn=te=>{var ce=jf(),ge=h(ce);ge.value=ge.__value="";var Ue=l(ge);et(Ue,17,()=>Object.entries(r(P).enumMembers),([Ae,at])=>Ae,(Ae,at)=>{var bt=ie(()=>Ea(r(at),2));let Ut=()=>r(bt)[0],gr=()=>r(bt)[1];var lr=wi(),zr=f(lr),Mr={};x(vr=>{v(zr,`${Ut()??""} (${gr()??""})`),Mr!==(Mr=vr)&&(lr.value=(lr.__value=Mr)??"")},[()=>String(gr())]),k(Ae,lr)}),Qt(ce),N("change",ce,I),pr(ce,()=>r(T),Ae=>w(T,Ae)),k(te,ce)},Nr=te=>{var ce=zf(),ge=h(ce);ge.value=ge.__value="";var Ue=l(ge);Ue.value=Ue.__value="true";var Ae=l(Ue);Ae.value=Ae.__value="false",Qt(ce),N("change",ce,I),pr(ce,()=>r(T),at=>w(T,at)),k(te,ce)},cn=te=>{var ce=$f();x(ge=>ne(ce,"placeholder",ge),[()=>d("a number, text or JSON")]),N("input",ce,I),Ee(ce,()=>r(T),ge=>w(T,ge)),k(te,ce)};H(Qr,te=>{r(j).length>0&&r(P)?.enumMembers?te(dn):r(P)?.metatype==="boolean"?te(Nr,1):te(cn,-1)})}var Ln=l(Dn,2);{var jr=te=>{var ce=Hf(),ge=Pe(ce);et(ge,21,()=>r(A).stages,at=>at.step,(at,bt)=>{var Ut=iu();let gr;var lr=h(Ut),zr=f(lr,!0),Mr=l(lr,2);{var vr=xr=>{var $e=nu(),dt=f($e,!0);x(vt=>v(dt,vt),[()=>Ri(r(bt).value)]),k(xr,$e)},kr=xr=>{var $e=ki();x(()=>v($e,r(bt).reason)),k(xr,$e)};H(Mr,xr=>{r(bt).ok?xr(vr):xr(kr,-1)})}x(()=>{gr=Nt(Ut,1,"",null,gr,{"ui-error-text":!r(bt).ok}),v(zr,r(bt).step)}),k(at,Ut)});var Ue=l(ge,2);{var Ae=at=>{var bt=au(),Ut=f(bt,!0);x(()=>v(Ut,r(A).reason)),k(at,bt)};H(Ue,at=>{r(A).stages.length===0&&r(A).reason&&at(Ae)})}k(te,ce)};H(Ln,te=>{r(A)&&te(jr)})}var Zr=l(Ln,2),we=h(Zr),xt=f(we,!0);x((te,ce,ge,Ue,Ae,at,bt,Ut,gr,lr,zr,Mr,vr,kr,xr,$e,dt,vt,Gt,tr,fr)=>{v(Ye,te),v(Ct,ce),v(rt,ge),v(ae,Ue),v(At,Ae),v(It,at),ne(er,"placeholder",bt),Sn(er,r(u).offset??""),ne(ct,"placeholder",Ut),Sn(ct,r(u).round??""),ne(Wt,"placeholder",gr),Sn(Wt,r(u).precision??""),v(Ot,lr),v(Ui,`+ ${zr??""}`),v(On,Mr),v(Fi,vr),v(Yn,kr),v(ji,xr),Ze!==(Ze=r(u).qos??0)&&(_r.value=(_r.__value=Ze)??"",Bi(_r,Ze)),v(sr,$e),v(qr,dt),v(Ar,vt),v(Yr,Gt),v(Pr,tr),we.disabled=r(u).topic===""||r(A)?.ok!==!0,v(xt,fr)},[()=>d("Topic"),()=>d("Pick"),()=>d("Unit"),()=>d("— none —"),()=>d("Scale"),()=>d("Offset / round / invert"),()=>d("offset"),()=>d("round"),()=>d("precision"),()=>d("Format"),()=>d("Row"),()=>d("Fixed payload"),()=>d("Template"),()=>d("Wrap (JSON path)"),()=>d("Retain / QoS / optimistic"),()=>d("optimistic: automatic"),()=>d("optimistic: yes"),()=>d("optimistic: no"),()=>d("Preview"),()=>d("Matter value"),()=>d("Test-publish")]),N("input",gt,R),Ee(gt,()=>r(u).topic,te=>r(u).topic=te),N("click",mt,()=>w(C,"command")),N("change",wt,R),pr(wt,()=>r(u).unit,te=>r(u).unit=te),N("input",er,te=>{r(u)&&(r(u).offset=Oe(te.currentTarget.value)),R()}),N("input",ct,te=>{r(u)&&(r(u).round=Oe(te.currentTarget.value)),R()}),N("input",Wt,te=>{r(u)&&(r(u).precision=Oe(te.currentTarget.value)),R()}),N("click",Sr,()=>r(m).push({key:"",value:""})),N("input",xn,R),Ee(xn,()=>r(u).payload,te=>r(u).payload=te),N("input",Jn,R),Ee(Jn,()=>r(u).template,te=>r(u).template=te),N("input",_i,R),Ee(_i,()=>r(u).wrap,te=>r(u).wrap=te),N("change",_r,te=>{r(u)&&(r(u).qos=Number(te.currentTarget.value))}),pr(zt,()=>r(y),te=>w(y,te)),N("click",we,()=>V(r(u)?.topic,r(A)?.result)),k(fe,pe)};H(Ke,fe=>{r(u)&&fe(ht)})}x((fe,pe,me,Me,Ye)=>{v(re,fe),v(Je,pe),v(X,me),v(ke,Me),v(Ft,Ye)},[()=>d("Kind"),()=>d("attribute"),()=>d("command (invoke)"),()=>d("event channel"),()=>d("Comment")]),N("change",le,()=>{w(a,r(n)==="event"?"Switch":"",!0),r(n)==="event"&&w(i,"Switch"),R()}),pr(le,()=>r(n),fe=>w(n,fe)),Ee(Bt,()=>r(o),fe=>w(o,fe)),k(D,z)},$$slots:{buttons:!0,default:!0}})}var Et=l(He,2);{let Q=ie(()=>r(C)!==void 0),ee=ie(()=>r(C)==="command"?r(u)?.topic??"":r(s)?.topic??""),D=ie(()=>r(C)==="status");Nf(Et,{get open(){return r(Q)},get initial(){return r(ee)},get withExtract(){return r(D)},onpick:Te,onclose:()=>w(C,void 0)})}k(e,Le),Ht()}or(["click","change","input"]);var Wf=S('<span class="ui-badge ui-badge-ok"> </span>'),ya=S('<span class="ui-badge"> </span>'),ko=S('<span class="ui-badge ui-badge-warn"> </span>'),ou=S("<!> <!>",1),Yf=S('<span class="ui-error-text"> </span>'),Qf=S('<div class="ui-page-scroll column svelte-21g4qu"><textarea class="ui-textarea json svelte-21g4qu" spellcheck="false" data-testid="device-json"></textarea> <div class="ui-toolbar"><button type="button" class="ui-button ui-button-primary" data-testid="apply-json"> </button> <!></div></div>'),Zf=S('<section class="ui-section"><div class="ui-section-title"> </div> <!></section>'),xo=S("<option> </option>"),Xf=S("<code> </code>"),ep=S('<label class="ui-form-label"> </label> <div class="ui-form-field"><input class="ui-input ui-mono"/> <input class="ui-input ui-mono ui-field-narrow"/> <input class="ui-input ui-field-narrow"/> <input class="ui-input ui-field-narrow"/> <button type="button" class="ui-icon-button"><!></button></div>',1),tp=S('<div class="ui-form"><label class="ui-form-label" for="av-mode"> </label> <div class="ui-form-field"><select id="av-mode" class="ui-select ui-field-medium"><option>latest</option><option>all</option><option>any</option></select></div> <!> <span></span> <div><button type="button" class="ui-button"> </button></div> <div class="ui-form-help"> </div></div>'),rp=S('<div class="ui-muted"> </div>'),np=S('<button type="button" class="ui-icon-button"><!></button>'),ip=S('<button type="button" class="chip-remove svelte-21g4qu"><!></button>'),ap=S('<span class="chip svelte-21g4qu" data-testid="device-type-chip"> <!></span>'),op=S('<select class="ui-select svelte-21g4qu"></select>'),sp=S('<input type="checkbox"/>'),up=S('<input class="ui-input ui-field-narrow" type="number" step="any"/>'),lp=S('<label class="option svelte-21g4qu"><span class="ui-muted"> </span> <!></label>'),dp=S('<div class="options svelte-21g4qu"><span class="ui-muted"> </span> <!></div>'),cp=S('<span class="ui-faint"> </span>'),vp=S('<tr class="ui-row-link" data-testid="mapping-row"><td><code> </code> <!> <!></td><td><code> </code></td><td><code> </code></td><td><code> </code></td><td class="ui-actions"><button type="button" class="ui-icon-button"><!></button> <button type="button" class="ui-icon-button" data-testid="remove-mapping"><!></button></td></tr>'),fp=S('<button type="button" class="ui-button suggest svelte-21g4qu" data-testid="bind-suggestion"> </button>'),pp=S('<tr class="suggestion svelte-21g4qu" data-testid="suggestion-row"><td colspan="4" class="svelte-21g4qu"><span class="ui-muted"> </span> <!> <!></td><td class="svelte-21g4qu"></td></tr>'),hp=S('<section class="ui-section" data-testid="endpoint"><div class="ui-section-title"> <input class="ui-input ui-mono ui-field-medium"/> <!> <div class="ui-toolbar-trailing"><label class="ui-muted"> </label> <input class="ui-input ui-field-narrow" type="number" min="0" max="5000"/> <!></div></div> <div class="types svelte-21g4qu"><span class="ui-muted"> </span> <!> <select class="ui-select ui-field-medium" data-testid="add-device-type"><option> </option><!></select></div> <!> <table class="ui-table" data-testid="mappings"><thead><tr><th> </th><th> </th><th> </th><th> </th><th></th></tr></thead><tbody><!><!></tbody></table> <div><button type="button" class="ui-button" data-testid="add-mapping"> </button></div></section>'),mp=S('<div class="ui-page-scroll column svelte-21g4qu"><!> <!> <div class="ui-split"><section class="ui-section"><div class="ui-section-title"> </div> <div class="ui-form"><label class="ui-form-label" for="dev-name"> </label> <div class="ui-form-field"><input id="dev-name" class="ui-input" maxlength="32" data-testid="device-name"/></div> <label class="ui-form-label" for="dev-vendor"> </label> <div class="ui-form-field"><input id="dev-vendor" class="ui-input" maxlength="32"/></div> <label class="ui-form-label" for="dev-model"> </label> <div class="ui-form-field"><input id="dev-model" class="ui-input" maxlength="32"/></div> <label class="ui-form-label" for="dev-serial"> </label> <div class="ui-form-field"><input id="dev-serial" class="ui-input" maxlength="32"/></div> <label class="ui-form-label" for="dev-bridge"> </label> <div class="ui-form-field"><select id="dev-bridge" class="ui-select ui-field-medium"><option> </option><!></select></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><!></div> <span class="ui-form-label"> </span> <div class="ui-form-field"><span> </span> <!> <!></div></div></section> <section class="ui-section"><div class="ui-section-title"><!></div> <!></section></div> <!> <div><button type="button" class="ui-button" data-testid="add-endpoint"> </button></div></div>'),_p=S('<div class="ui-empty"> </div>'),gp=S('<div class="ui-page" data-testid="device-editor"><div class="ui-toolbar"><button type="button" class="ui-button" data-testid="editor-back"> </button> <h2 class="title svelte-21g4qu"> <code class="ui-faint"> </code></h2> <!> <div class="ui-toolbar-trailing"><button type="button"> </button> <button type="button" data-testid="view-json">JSON</button> <button type="button" class="ui-button"> </button> <button type="button" class="ui-button" data-testid="check-device"> </button> <button type="button" class="ui-button ui-button-primary" data-testid="save-device"> </button></div></div> <!></div>');function bp(e,t){$t(t,!0);let n=F(void 0),i=F(void 0),a=F(void 0),o=F(Pt([])),s=F(void 0),u=F(Pt([])),c=F(!1),m=F(!1),y=F(!1),g=F(void 0),_=F("form"),b=F(""),T=F(!1),A=F(void 0),C=Pt({});const E=ie(()=>ua(r(b))),O=ie(()=>(r(a)?.deviceTypes??[]).filter(M=>M.classification!=="node"&&M.name!=="RootNode"&&M.name!=="Aggregator").map(M=>M.name));function P(M){const J=new Map;for(const K of M.deviceTypes)for(const ue of r(a)?.deviceTypes.find(Ke=>Ke.name===K)?.clusters??[])ue.cluster==="Identify"||ue.cluster==="Groups"||ue.cluster==="ScenesManagement"||J.set(ue.cluster,(J.get(ue.cluster)??!1)||ue.mandatory);for(const K of Zs(M))J.has(K)||J.set(K,!1);return[...J.entries()].map(([K,ue])=>({cluster:K,mandatory:ue})).sort((K,ue)=>Number(ue.mandatory)-Number(K.mandatory))}function L(M){return P(M).map(J=>J.cluster)}function Z(M){const J=new Set(M.mappings.map(K=>Ra(K).name));return P(M).map(({cluster:K,mandatory:ue})=>({cluster:K,mandatory:ue,targets:(_f[K]??[]).filter(Ke=>!J.has(Ke.name))})).filter(K=>K.targets.length>0)}function j(M){const J=new Set([...L(M),...Zs(M)]);return bf(J).map(K=>({family:K,options:M.options[K]??{}}))}const G=qo(()=>{r(i)!==void 0&&Ie.validate(Ji(r(i))).then(M=>w(u,M.issues,!0),()=>{})},300);function U(){w(c,!0),G()}async function q(){try{w(n,await Ie.device(t.key),!0),w(i,JSON.parse(JSON.stringify(r(n).device)),!0),w(u,r(n).issues,!0),w(s,r(n).state,!0),w(T,r(i).availability!==void 0),w(c,!1),w(b,Nn(r(i)),!0)}catch(M){Ne.error(ut(M)),t.onclose()}}Cr(()=>(q(),Ie.catalog().then(M=>w(a,M,!0)),Ie.bridges().then(M=>w(o,M,!0)),hr.on(M=>{if(M.type==="attribute"&&M.key===t.key&&r(s)!==void 0){const J=r(s)[M.endpoint];J!==void 0&&(J.state[M.cluster]={...J.state[M.cluster]??{},[M.attribute]:M.value})}})));async function I(){if(r(i)!==void 0){w(m,!0);try{const M=await Ie.saveDevice(t.key,Ji(r(i)));w(n,M,!0),w(i,JSON.parse(JSON.stringify(M.device)),!0),w(u,M.issues,!0),w(s,M.state,!0),w(c,!1),w(b,Nn(r(i)),!0),Ne.info(M.built?d("{name} saved and built",{name:M.device.name}):d("{name} saved",{name:M.device.name}))}catch(M){Ne.error(ut(M))}finally{w(m,!1)}}}async function R(){if(r(i)!==void 0){w(y,!0);try{const M=await Ie.check({[t.key]:Ji(r(i))});w(g,M.devices[t.key]??[],!0)}catch(M){Ne.error(ut(M))}finally{w(y,!1)}}}async function V(){r(c)&&!await Zt.confirm(d("Discard the unsaved changes?"),{confirm:d("Discard"),danger:!0})||t.onclose()}function B(){Vr(r(E))&&(w(i,r(E),!0),w(T,r(i).availability!==void 0),w(_,"form"),U())}function W(){r(i)!==void 0&&Zo(`${t.key}.json`,Nn({[t.key]:Ji(r(i))}))}function oe(){if(r(i)===void 0)return;const M=`child${r(i).endpoints.length}`;r(i).endpoints.push(yf(M,["TemperatureSensor"])),U()}async function ve(M){r(i)===void 0||M===0||await Zt.confirm(d("Remove this endpoint and its mappings?"),{confirm:d("Remove"),danger:!0})&&(r(i).endpoints.splice(M,1),U())}function Te(M){const J=C[M],K=r(i)?.endpoints[M];K===void 0||J===void 0||J===""||K.deviceTypes.includes(J)||(K.deviceTypes.push(J),C[M]="",U())}function tt(M,J){const K=r(i)?.endpoints[M];K===void 0||K.deviceTypes.length<=1||(K.deviceTypes=K.deviceTypes.filter(ue=>ue!==J),U())}function Oe(M,J,K){w(A,{endpoint:M,index:J,mapping:K},!0)}function Le(M,J){w(A,{endpoint:M,index:-1,mapping:wf(J)},!0)}function He(M){if(r(A)===void 0||r(i)===void 0)return;const J=r(i).endpoints[r(A).endpoint];J!==void 0&&(r(A).index===-1?J.mappings.push(M):J.mappings[r(A).index]=M,w(A,void 0),U())}function Et(M,J){r(i)?.endpoints[M]?.mappings.splice(J,1),U()}function Q(M,J){const K=r(i)?.endpoints[M]?.mappings,ue=K?.[J];K!==void 0&&ue!==void 0&&(K.splice(J+1,0,structuredClone(Wi(ue))),U())}function ee(M,J,K,ue){M.options[J]={...M.options[J]??{},[K]:ue},U()}function D(M){return{onOff:["momentary"],light:["onCommandType","transition","minMireds","maxMireds"],cover:["echoFilter","reportTimeout","tolerance"],climate:["minHeat","maxHeat","minCool","maxCool","deadband"],fan:["low","medium","speedMax"],switch:["kind","numberOfPositions","multiPressMax","multiPressDelay","longPressDelay","pressDuration"],powerSource:["warning","critical"]}[M]??[]}const $={onOff:{momentary:0},light:{onCommandType:"last",transition:!0,minMireds:153,maxMireds:500},cover:{echoFilter:!1,reportTimeout:30,tolerance:100},climate:{minHeat:7,maxHeat:30,minCool:16,maxCool:32,deadband:2},fan:{low:33,medium:66,speedMax:0},switch:{kind:"momentary",numberOfPositions:2,multiPressMax:3,multiPressDelay:300,longPressDelay:500,pressDuration:50},powerSource:{warning:20,critical:10}};function z(M){r(i)!==void 0&&(w(T,M,!0),M?r(i).availability??={mode:"latest",topics:[{topic:"",online:"online",offline:"offline"}]}:delete r(i).availability,U())}function de(M,J){const K=M[J];if(K===void 0)return"";const ue=[K.topic];return"extract"in K&&K.extract!==void 0&&ue.push(K.extract),K.unit!==void 0&&ue.push(K.unit),"map"in K&&K.map!==void 0&&ue.push(d("map")),"format"in K&&K.format!==void 0&&ue.push(d("format")),K.template!==void 0&&ue.push(d("template")),ue.join(" · ")}var Y=gp(),re=h(Y),se=h(re),le=f(se),Ce=l(se,2),Je=h(Ce),De=l(Je),X=f(De,!0),he=l(Ce,2);{var ke=M=>{var J=ou(),K=Pe(J);{var ue=me=>{var Me=Wf(),Ye=f(Me,!0);x(lt=>v(Ye,lt),[()=>d("endpoint {number}",{number:r(n).number})]),k(me,Me)},Ke=me=>{var Me=ya(),Ye=f(Me,!0);x(lt=>v(Ye,lt),[()=>d("disabled")]),k(me,Me)},ht=me=>{var Me=ko(),Ye=f(Me,!0);x(lt=>v(Ye,lt),[()=>d("not built")]),k(me,Me)};H(K,me=>{r(n).built?me(ue):r(i)?.enabled===!1?me(Ke,1):me(ht,-1)})}var fe=l(K,2);{var pe=me=>{var Me=ya(),Ye=f(Me,!0);x(()=>v(Ye,r(n).bridge)),k(me,Me)};H(fe,me=>{r(n).bridge&&me(pe)})}k(M,J)};H(he,M=>{r(n)&&M(ke)})}var We=l(he,2),nt=h(We);let yt;var ot=f(nt,!0),be=l(nt,2);let Tt;var Mt=l(be,2),Ft=f(Mt,!0),Lt=l(Mt,2),Bt=f(Lt,!0),Se=l(Lt,2),_e=f(Se,!0),Be=l(re,2);{var Ge=M=>{var J=ou(),K=Pe(J);{var ue=pe=>{var me=Qf(),Me=h(me),Ye=l(Me,2),lt=h(Ye),gt=f(lt,!0),mt=l(lt,2);{var Ct=rt=>{var st=Yf(),wt=f(st,!0);x(St=>v(wt,St),[()=>d("Not valid JSON")]),k(rt,st)},Rt=ie(()=>!Vr(r(E)));H(mt,rt=>{r(Rt)&&rt(Ct)})}x((rt,st)=>{lt.disabled=rt,v(gt,st)},[()=>!Vr(r(E)),()=>d("Apply to the form")]),Ee(Me,()=>r(b),rt=>w(b,rt)),N("click",lt,B),k(pe,me)},Ke=pe=>{var me=mp(),Me=h(me);{let Re=ie(()=>d("The device validates."));Ma(Me,{get issues(){return r(u)},get empty(){return r(Re)}})}var Ye=l(Me,2);{var lt=Re=>{var Qe=Zf(),Ze=h(Qe),zt=f(Ze,!0),Yt=l(Ze,2);{let sr=ie(()=>d("matter.js builds the device without complaint."));Ma(Yt,{get issues(){return r(g)},get empty(){return r(sr)}})}x(sr=>v(zt,sr),[()=>d("Strict dry run")]),k(Re,Qe)};H(Ye,Re=>{r(g)&&Re(lt)})}var gt=l(Ye,2),mt=h(gt),Ct=h(mt),Rt=f(Ct,!0),rt=l(Ct,2),st=h(rt),wt=f(st,!0),St=l(st,2),ae=h(St),Ve=l(St,2),je=f(Ve,!0),At=l(Ve,2),qt=h(At),xe=l(At,2),ye=f(xe,!0),it=l(xe,2),qe=h(it),It=l(it,2),Xt=f(It,!0),er=l(It,2),ct=h(er),Wt=l(er,2),ze=f(Wt,!0),kt=l(Wt,2),Ot=h(kt),jt=h(Ot),wn=f(jt,!0);jt.value=(jt.__value=void 0)??"";var un=l(jt);et(un,17,()=>r(o),Re=>Re.id,(Re,Qe)=>{var Ze=xo(),zt=f(Ze,!0),Yt={};x(()=>{v(zt,r(Qe).id),Yt!==(Yt=r(Qe).id)&&(Ze.value=(Ze.__value=Yt)??"")}),k(Re,Ze)}),Qt(Ot);var Sr=l(kt,2),Ui=f(Sr,!0),kn=l(Sr,2),Hn=h(kn);Lr(Hn,{onchange:U,testId:"device-enabled",get checked(){return r(i).enabled},set checked(Re){r(i).enabled=Re}});var Gn=l(kn,2),pi=f(Gn,!0),hi=l(Gn,2),On=h(hi);let ln;var xn=f(On,!0),Kn=l(On,2);{var Fi=Re=>{var Qe=Xf(),Ze=f(Qe,!0);x(()=>v(Ze,r(i).source.key)),k(Re,Qe)};H(Kn,Re=>{r(i).source.key&&Re(Fi)})}var Vn=l(Kn,2);{var Jn=Re=>{var Qe=ko(),Ze=f(Qe,!0);x(zt=>v(Ze,zt),[()=>d("orphaned")]),k(Re,Qe)};H(Vn,Re=>{r(i).source.orphaned&&Re(Jn)})}var Wn=l(mt,2),Yn=h(Wn),mi=h(Yn);{let Re=ie(()=>d("Availability"));Lr(mi,{get checked(){return r(T)},get label(){return r(Re)},onchange:z})}var _i=l(Yn,2);{var Qn=Re=>{var Qe=tp(),Ze=h(Qe),zt=f(Ze,!0),Yt=l(Ze,2),sr=h(Yt),ar=h(sr);ar.value=ar.__value="latest";var qr=l(ar);qr.value=qr.__value="all";var Ur=l(qr);Ur.value=Ur.__value="any",Qt(sr);var Ar=l(Yt,2);et(Ar,17,()=>r(i).availability.topics,si,(Pr,ur,Qr)=>{var dn=ep(),Nr=Pe(dn);ne(Nr,"for",`av-topic-${Qr}`);var cn=f(Nr,!0),Ln=l(Nr,2),jr=h(Ln);ne(jr,"id",`av-topic-${Qr}`);var Zr=l(jr,2),we=l(Zr,2),xt=l(we,2),te=l(xt,2),ce=h(te);Kr(ce,{name:"close",size:12}),x((ge,Ue,Ae)=>{v(cn,ge),ne(Zr,"placeholder",Ue),ne(te,"title",Ae)},[()=>d("Topic"),()=>d("extract"),()=>d("Remove")]),N("input",jr,U),Ee(jr,()=>r(ur).topic,ge=>r(ur).topic=ge),N("input",Zr,U),Ee(Zr,()=>r(ur).extract,ge=>r(ur).extract=ge),N("input",we,U),Ee(we,()=>r(ur).online,ge=>r(ur).online=ge),N("input",xt,U),Ee(xt,()=>r(ur).offline,ge=>r(ur).offline=ge),N("click",te,()=>{r(i)?.availability?.topics.splice(Qr,1),U()}),k(Pr,dn)});var Fr=l(Ar,4),Tn=h(Fr),Yr=f(Tn),Dn=l(Fr,2),Cn=f(Dn,!0);x((Pr,ur,Qr)=>{v(zt,Pr),v(Yr,`+ ${ur??""}`),v(Cn,Qr)},[()=>d("Mode"),()=>d("Topic"),()=>d("topic · JSON path · the online payload · the offline payload")]),N("change",sr,U),pr(sr,()=>r(i).availability.mode,Pr=>r(i).availability.mode=Pr),N("click",Tn,()=>{r(i)?.availability?.topics.push({topic:"",online:"online",offline:"offline"}),U()}),k(Re,Qe)},ji=Re=>{var Qe=rp(),Ze=f(Qe,!0);x(zt=>v(Ze,zt),[()=>d("Without an availability topic the device counts as reachable while it reports (see expire on a status half).")]),k(Re,Qe)};H(_i,Re=>{r(i).availability?Re(Qn):Re(ji,-1)})}var Zn=l(gt,2);et(Zn,17,()=>r(i).endpoints,si,(Re,Qe,Ze)=>{var zt=hp(),Yt=h(zt),sr=h(Yt),ar=l(sr),qr=l(ar,2);{var Ur=$e=>{var dt=ya(),vt=f(dt);x(()=>v(vt,`#${r(s)[r(Qe).id]?.number??""}`)),k($e,dt)};H(qr,$e=>{r(s)?.[r(Qe).id]?.number!==void 0&&$e(Ur)})}var Ar=l(qr,2),Fr=h(Ar);ne(Fr,"for",`coalesce-${Ze}`);var Tn=f(Fr,!0),Yr=l(Fr,2);ne(Yr,"id",`coalesce-${Ze}`);var Dn=l(Yr,2);{var Cn=$e=>{var dt=np(),vt=h(dt);Kr(vt,{name:"trash"}),x(Gt=>ne(dt,"title",Gt),[()=>d("Remove")]),N("click",dt,()=>ve(Ze)),k($e,dt)};H(Dn,$e=>{Ze>0&&$e(Cn)})}var Pr=l(Yt,2),ur=h(Pr),Qr=f(ur),dn=l(ur,2);et(dn,16,()=>r(Qe).deviceTypes,$e=>$e,($e,dt)=>{var vt=ap(),Gt=h(vt),tr=l(Gt);{var fr=Rr=>{var Ir=ip(),Or=h(Ir);Kr(Or,{name:"close",size:12}),x(Kt=>ne(Ir,"title",Kt),[()=>d("Remove")]),N("click",Ir,()=>tt(Ze,dt)),k(Rr,Ir)};H(tr,Rr=>{r(Qe).deviceTypes.length>1&&Rr(fr)})}x(()=>v(Gt,`${dt??""} `)),k($e,vt)});var Nr=l(dn,2),cn=h(Nr),Ln=f(cn);cn.value=cn.__value="";var jr=l(cn);et(jr,16,()=>r(O),$e=>$e,($e,dt)=>{var vt=xo(),Gt=f(vt,!0),tr={};x(()=>{v(Gt,dt),tr!==(tr=dt)&&(vt.value=(vt.__value=tr)??"")}),k($e,vt)}),Qt(Nr);var Zr=l(Pr,2);et(Zr,17,()=>j(r(Qe)),({family:$e,options:dt})=>$e,($e,dt)=>{let vt=()=>r(dt).family,Gt=()=>r(dt).options;var tr=dp(),fr=h(tr),Rr=f(fr),Ir=l(fr,2);et(Ir,16,()=>D(vt()),Or=>Or,(Or,Kt)=>{const br=ie(()=>Gt()[Kt]??$[vt()]?.[Kt]),Xr=ie(()=>gf[vt()]?.[Kt]);var Bn=lp(),zi=h(Bn),qa=f(zi,!0),Ua=l(zi,2);{var ha=$r=>{var dr=op();et(dr,20,()=>r(Xr),fn=>fn,(fn,ei)=>{var gi=xo(),$i=f(gi,!0),Hi={};x(()=>{v($i,ei),Hi!==(Hi=ei)&&(gi.value=(gi.__value=Hi)??"")}),k(fn,gi)});var vn;Qt(dr),x(fn=>{vn!==(vn=fn)&&(dr.value=(dr.__value=vn)??"",Bi(dr,vn))},[()=>String(r(br))]),N("change",dr,fn=>ee(r(Qe),vt(),Kt,fn.currentTarget.value)),k($r,dr)},Fa=$r=>{var dr=sp();x(()=>rc(dr,r(br))),N("change",dr,vn=>ee(r(Qe),vt(),Kt,vn.currentTarget.checked)),k($r,dr)},ja=$r=>{var dr=up();x(()=>Sn(dr,r(br))),N("change",dr,vn=>ee(r(Qe),vt(),Kt,Number(vn.currentTarget.value))),k($r,dr)};H(Ua,$r=>{r(Xr)?$r(ha):typeof r(br)=="boolean"?$r(Fa,1):$r(ja,-1)})}x(()=>v(qa,Kt)),k(Or,Bn)}),x((Or,Kt)=>v(Rr,`${Or??""} ${vt()??""} (${Kt??""}):`),[()=>d("Options"),()=>pl[vt()]?.join(", ")]),k($e,tr)});var we=l(Zr,2),xt=h(we),te=h(xt),ce=h(te),ge=f(ce,!0),Ue=l(ce),Ae=f(Ue,!0),at=l(Ue),bt=f(at,!0),Ut=l(at),gr=f(Ut,!0),lr=l(xt),zr=h(lr);et(zr,17,()=>r(Qe).mappings,si,($e,dt,vt)=>{const Gt=ie(()=>Ra(r(dt))),tr=ie(()=>r(s)?.[r(Qe).id]?.state[es(r(Gt).name)]?.[r(Gt).name.split(".")[1]??""]);var fr=vp(),Rr=h(fr),Ir=h(Rr),Or=f(Ir,!0),Kt=l(Ir,2);{var br=en=>{var ti=ya(),Gi=f(ti,!0);x(()=>v(Gi,r(Gt).kind)),k(en,ti)};H(Kt,en=>{r(Gt).kind!=="attribute"&&en(br)})}var Xr=l(Kt,2);{var Bn=en=>{var ti=cp(),Gi=f(ti);x(()=>v(Gi,`— ${r(dt).comment??""}`)),k(en,ti)};H(Xr,en=>{r(dt).comment&&en(Bn)})}var zi=l(Rr),qa=h(zi),Ua=f(qa,!0),ha=l(zi),Fa=h(ha),ja=f(Fa,!0),$r=l(ha),dr=h($r),vn=f(dr,!0),fn=l($r),ei=h(fn),gi=h(ei);Kr(gi,{name:"copy"});var $i=l(ei,2),Hi=h($i);Kr(Hi,{name:"trash"}),x((en,ti,Gi,_l,gl)=>{v(Or,r(Gt).name),v(Ua,en),v(ja,ti),v(vn,Gi),ne(ei,"title",_l),ne($i,"title",gl)},[()=>de(r(dt),"status"),()=>de(r(dt),"command"),()=>Ri(r(tr)),()=>d("Duplicate"),()=>d("Remove")]),N("click",fr,()=>Oe(Ze,vt,r(dt))),N("click",fn,en=>en.stopPropagation()),N("click",ei,()=>Q(Ze,vt)),N("click",$i,()=>Et(Ze,vt)),k($e,fr)});var Mr=l(zr);et(Mr,17,()=>Z(r(Qe)),$e=>$e.cluster,($e,dt)=>{var vt=pp(),Gt=h(vt),tr=h(Gt),fr=f(tr,!0),Rr=l(tr,2);{var Ir=Kt=>{var br=ko(),Xr=f(br,!0);x(Bn=>v(Xr,Bn),[()=>d("mandatory")]),k(Kt,br)};H(Rr,Kt=>{r(dt).mandatory&&Kt(Ir)})}var Or=l(Rr,2);et(Or,17,()=>r(dt).targets,Kt=>Kt.name,(Kt,br)=>{var Xr=fp(),Bn=f(Xr);x(()=>{ne(Xr,"data-target",r(br).name),v(Bn,`+ ${r(br).name??""}${r(br).kind!=="attribute"?` (${r(br).kind})`:""}`)}),N("click",Xr,()=>Le(Ze,r(br))),k(Kt,Xr)}),x(()=>v(fr,r(dt).cluster)),k($e,vt)});var vr=l(we,2),kr=h(vr),xr=f(kr);x(($e,dt,vt,Gt,tr,fr,Rr,Ir,Or)=>{ne(zt,"data-id",r(Qe).id),v(sr,`${$e??""} `),ar.disabled=Ze===0&&r(Qe).id==="main",v(Tn,dt),v(Qr,`${vt??""}:`),v(Ln,`+ ${Gt??""}`),v(ge,tr),v(Ae,fr),v(bt,Rr),v(gr,Ir),v(xr,`+ ${Or??""}`)},[()=>d(Ze===0?"Endpoint (the bridged node)":"Child endpoint"),()=>d("coalesce (ms)"),()=>d("Device types"),()=>d("add type"),()=>d("Target"),()=>d("Status (device → Matter)"),()=>d("Command (Matter → device)"),()=>d("Live"),()=>d("Mapping")]),N("input",ar,U),Ee(ar,()=>r(Qe).id,$e=>r(Qe).id=$e),N("input",Yr,U),Ee(Yr,()=>r(Qe).coalesce,$e=>r(Qe).coalesce=$e),N("change",Nr,()=>Te(Ze)),pr(Nr,()=>C[Ze],$e=>C[Ze]=$e),N("click",kr,()=>Le(Ze,{kind:"attribute",name:""})),k(Re,zt)});var En=l(Zn,2),_r=h(En),Xn=f(_r);x((Re,Qe,Ze,zt,Yt,sr,ar,qr,Ur,Ar)=>{v(Rt,Re),v(wt,Qe),v(je,Ze),v(ye,zt),v(Xt,Yt),ne(ct,"placeholder",t.key),v(ze,sr),v(wn,ar),v(Ui,qr),v(pi,Ur),ln=Nt(On,1,"ui-badge",null,ln,{"ui-badge-accent":r(i).source.kind!=="manual"}),v(xn,r(i).source.kind),v(Xn,`+ ${Ar??""}`)},[()=>d("Device"),()=>d("Name"),()=>d("Vendor"),()=>d("Model"),()=>d("Serial"),()=>d("Bridge"),()=>d("assigned automatically"),()=>d("Enabled"),()=>d("Source"),()=>d("Child endpoint")]),N("input",ae,U),Ee(ae,()=>r(i).name,Re=>r(i).name=Re),N("input",qt,U),Ee(qt,()=>r(i).vendor,Re=>r(i).vendor=Re),N("input",qe,U),Ee(qe,()=>r(i).model,Re=>r(i).model=Re),N("input",ct,U),Ee(ct,()=>r(i).serial,Re=>r(i).serial=Re),N("change",Ot,U),pr(Ot,()=>r(i).bridge,Re=>r(i).bridge=Re),N("click",_r,oe),k(pe,me)};H(K,pe=>{r(_)==="json"?pe(ue):pe(Ke,-1)})}var ht=l(K,2);{var fe=pe=>{const me=ie(()=>r(i).endpoints[r(A).endpoint]);{let Me=ie(()=>r(me)===void 0?[]:L(r(me)));Jf(pe,{open:!0,get mapping(){return r(A).mapping},get catalog(){return r(a)},get endpointClusters(){return r(Me)},onsave:He,onclose:()=>w(A,void 0)})}};H(ht,pe=>{r(A)&&pe(fe)})}k(M,J)},Fe=M=>{var J=_p(),K=f(J);x(ue=>v(K,`${ue??""}…`),[()=>d("Loading")]),k(M,J)};H(Be,M=>{r(i)&&r(a)?M(Ge):M(Fe,-1)})}x((M,J,K,ue,Ke)=>{v(le,`← ${M??""}`),v(Je,`${r(i)?.name??t.key??""} `),v(X,t.key),yt=Nt(nt,1,"ui-button",null,yt,{"ui-button-primary":r(_)==="form"}),v(ot,J),Tt=Nt(be,1,"ui-button",null,Tt,{"ui-button-primary":r(_)==="json"}),v(Ft,K),Lt.disabled=r(y),v(Bt,ue),Se.disabled=r(m)||!r(c),v(_e,Ke)},[()=>d("Devices"),()=>d("Form"),()=>d("Export"),()=>r(y)?d("Checking…"):d("Check"),()=>d("Save")]),N("click",se,V),N("click",nt,()=>w(_,"form")),N("click",be,()=>{w(b,r(i)===void 0?"":Nn(Ji(r(i))),!0),w(_,"json")}),N("click",Mt,W),N("click",Lt,R),N("click",Se,I),k(e,Y),Ht()}or(["click","input","change"]);var yp=S('<div class="ui-empty"> </div>'),Eo=S('<span class="ui-badge ui-badge-warn"> </span>'),wp=S('<span class="ui-badge"> </span>'),kp=S('<span class="ui-badge ui-badge-error"> </span>'),xp=S('<span class="ui-badge ui-badge-ok"> </span>'),Ep=S('<tr class="ui-row-link" data-testid="device-row"><td><span></span> </td><td><code> </code></td><td> </td><td><span> </span> <!></td><td> </td><td> </td><td><!></td><td class="ui-actions"><button type="button" class="ui-icon-button"><!></button> <button type="button" class="ui-icon-button"><!></button> <button type="button" class="ui-icon-button"><!></button> <button type="button" class="ui-icon-button" data-testid="delete-device"><!></button></td></tr>'),Tp=S('<table class="ui-table" data-testid="device-table"><thead><tr><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th></th></tr></thead><tbody></tbody></table>'),Cp=S('<button type="button" class="ui-button"> </button> <button type="button" class="ui-button ui-button-primary" data-testid="create-device"> </button>',1),Sp=S("<option> </option>"),Ap=S('<div class="ui-form"><label class="ui-form-label" for="new-name"> </label> <div class="ui-form-field"><input id="new-name" class="ui-input" maxlength="32" data-testid="new-name"/></div> <label class="ui-form-label" for="new-key"> </label> <div class="ui-form-field"><input id="new-key" data-testid="new-key"/></div> <div class="ui-form-help"> </div> <label class="ui-form-label" for="type-filter"> </label> <div class="ui-form-field"><input id="type-filter" class="ui-input"/></div> <div class="ui-form-full"><select class="ui-select types svelte-19ysaj4" size="8" data-testid="new-type"></select></div> <div class="ui-form-help"> </div></div>'),Pp=S('<div class="ui-page" data-testid="devices-page"><div class="ui-toolbar"><button type="button" class="ui-button ui-button-primary" data-testid="new-device"> </button> <button type="button" class="ui-button"> </button> <input class="ui-input filter svelte-19ysaj4" data-testid="device-filter"/> <div class="ui-toolbar-trailing"> </div></div> <div class="ui-page-scroll"><!></div></div> <!>',1);function Np(e,t){$t(t,!0);let n=F(Pt([])),i=F(!1),a=F(""),o=F(void 0),s=F(!1),u=F(""),c=F(""),m=F("OnOffPlugInUnit"),y=F("");const g=ie(()=>Br.route.rest),_=/^[A-Za-z0-9][A-Za-z0-9:._-]{0,63}$/,b=ie(()=>_.test(r(u))&&!r(n).some(B=>B.key===r(u))),T=ie(()=>{const B=r(a).trim().toLowerCase();return[...B===""?r(n):r(n).filter(oe=>[oe.key,oe.name,oe.deviceTypes.join(" "),oe.source.kind,oe.bridge??""].join(" ").toLowerCase().includes(B))].sort((oe,ve)=>oe.name.localeCompare(ve.name))}),A=ie(()=>{const B=r(y).trim().toLowerCase();return(r(o)?.deviceTypes??[]).filter(W=>W.classification!=="node"&&W.name!=="RootNode"&&W.name!=="Aggregator").filter(W=>B===""||W.name.toLowerCase().includes(B))});async function C(){try{w(n,await Ie.devices(),!0),w(i,!0)}catch(B){Ne.error(ut(B))}}Cr(()=>(C(),Ie.catalog().then(B=>w(o,B,!0)),hr.on(B=>{(B.type==="devices"||B.type==="attribute"&&B.cluster==="BridgedDeviceBasicInformation")&&C()})));function E(B){return{manual:d("manual"),z2m:"Zigbee2MQTT","ha-discovery":"HA discovery",preset:d("preset")}[B]??B}function O(){w(u,""),w(c,""),w(y,""),w(s,!0)}function P(){(r(u)===""||!r(b))&&w(u,r(c).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64),!0)}async function L(){if(!(!r(b)||r(c).trim()===""))try{await Ie.saveDevice(r(u),{name:r(c).trim(),endpoints:[{deviceTypes:[r(m)]}]}),w(s,!1),Br.go("devices",r(u))}catch(B){Ne.error(ut(B))}}async function Z(B){try{const W=await Ie.device(B.key);await Ie.saveDevice(B.key,{...W.device,enabled:!B.enabled}),await C()}catch(W){Ne.error(ut(W))}}async function j(B){const W=await Zt.prompt(d("Key of the copy"),{value:`${B.key}-copy`,pattern:_,confirm:d("Duplicate")});if(W!==null)try{const oe=await Ie.device(B.key);await Ie.saveDevice(W,{...oe.device,name:`${oe.device.name} 2`.slice(0,32),source:{kind:"manual"},bridge:void 0}),Br.go("devices",W)}catch(oe){Ne.error(ut(oe))}}async function G(B){try{Zo(`${B.key}.json`,Nn(await Ie.exportDevice(B.key)))}catch(W){Ne.error(ut(W))}}async function U(B){if(await Zt.confirm(d("Delete {name}? Controllers lose the device, its rooms and automations.",{name:B.name}),{confirm:d("Delete"),danger:!0}))try{await Ie.deleteDevice(B.key),Ne.info(d("{name} deleted",{name:B.name})),await C()}catch(oe){Ne.error(ut(oe))}}var q=ci(),I=Pe(q);{var R=B=>{bp(B,{get key(){return r(g)},onclose:()=>Br.go("devices")})},V=B=>{var W=Pp(),oe=Pe(W),ve=h(oe),Te=h(ve),tt=f(Te),Oe=l(Te,2),Le=f(Oe,!0),He=l(Oe,2),Et=l(He,2),Q=f(Et,!0),ee=l(ve,2),D=h(ee);{var $=Y=>{var re=yp(),se=f(re,!0);x(le=>v(se,le),[()=>d("No devices yet. Create one by hand, apply a preset, or adopt a discovered device.")]),k(Y,re)},z=Y=>{var re=Tp(),se=h(re),le=h(se),Ce=h(le),Je=f(Ce,!0),De=l(Ce),X=f(De,!0),he=l(De),ke=f(he,!0),We=l(he),nt=f(We,!0),yt=l(We),ot=f(yt,!0),be=l(yt),Tt=f(be,!0),Mt=l(be),Ft=f(Mt,!0),Lt=l(se);et(Lt,21,()=>r(T),Bt=>Bt.key,(Bt,Se)=>{var _e=Ep(),Be=h(_e),Ge=h(Be);let Fe;var M=l(Ge),J=l(Be),K=h(J),ue=f(K,!0),Ke=l(J),ht=f(Ke),fe=l(Ke),pe=h(fe);let me;var Me=f(pe,!0),Ye=l(pe,2);{var lt=ze=>{var kt=Eo(),Ot=f(kt,!0);x(jt=>v(Ot,jt),[()=>d("orphaned")]),k(ze,kt)};H(Ye,ze=>{r(Se).source.orphaned&&ze(lt)})}var gt=l(fe),mt=f(gt,!0),Ct=l(gt),Rt=f(Ct,!0),rt=l(Ct),st=h(rt);{var wt=ze=>{var kt=wp(),Ot=f(kt,!0);x(jt=>v(Ot,jt),[()=>d("disabled")]),k(ze,kt)},St=ze=>{var kt=kp(),Ot=f(kt,!0);x(jt=>v(Ot,jt),[()=>d("{count} errors",{count:r(Se).errors})]),k(ze,kt)},ae=ze=>{var kt=Eo(),Ot=f(kt,!0);x(jt=>v(Ot,jt),[()=>d("not built")]),k(ze,kt)},Ve=ze=>{var kt=Eo(),Ot=f(kt,!0);x(jt=>v(Ot,jt),[()=>d("{count} warnings",{count:r(Se).violations+r(Se).warnings})]),k(ze,kt)},je=ze=>{var kt=xp(),Ot=f(kt,!0);x(jt=>v(Ot,jt),[()=>d("ok")]),k(ze,kt)};H(st,ze=>{r(Se).enabled?r(Se).errors>0?ze(St,1):r(Se).built?r(Se).violations>0||r(Se).warnings>0?ze(Ve,3):ze(je,-1):ze(ae,2):ze(wt)})}var At=l(rt),qt=h(At),xe=h(qt);{var ye=ze=>{Kr(ze,{name:"pause"})},it=ze=>{Kr(ze,{name:"play"})};H(xe,ze=>{r(Se).enabled?ze(ye):ze(it,-1)})}var qe=l(qt,2),It=h(qe);Kr(It,{name:"copy"});var Xt=l(qe,2),er=h(Xt);Kr(er,{name:"download"});var ct=l(Xt,2),Wt=h(ct);Kr(Wt,{name:"trash"}),x((ze,kt,Ot,jt,wn,un,Sr)=>{ne(_e,"data-key",r(Se).key),Fe=Nt(Ge,1,"ui-dot",null,Fe,{"ui-dot-ok":r(Se).reachable===!0,"ui-dot-error":r(Se).reachable===!1}),ne(Ge,"title",ze),v(M,` ${r(Se).name??""}`),v(ue,r(Se).key),v(ht,`${kt??""}${r(Se).endpoints>1?` +${r(Se).endpoints-1}`:""}`),me=Nt(pe,1,"ui-badge",null,me,{"ui-badge-accent":r(Se).source.kind!=="manual"}),v(Me,Ot),v(mt,r(Se).bridge??""),v(Rt,r(Se).number??""),ne(qt,"title",jt),ne(qe,"title",wn),ne(Xt,"title",un),ne(ct,"title",Sr)},[()=>r(Se).reachable===void 0?d("not built"):r(Se).reachable?d("reachable"):d("unreachable"),()=>r(Se).deviceTypes.join(", "),()=>E(r(Se).source.kind),()=>r(Se).enabled?d("Disable"):d("Enable"),()=>d("Duplicate"),()=>d("Export"),()=>d("Delete")]),N("click",_e,()=>Br.go("devices",r(Se).key)),N("click",At,ze=>ze.stopPropagation()),N("click",qt,()=>Z(r(Se))),N("click",qe,()=>j(r(Se))),N("click",Xt,()=>G(r(Se))),N("click",ct,()=>U(r(Se))),k(Bt,_e)}),x((Bt,Se,_e,Be,Ge,Fe,M)=>{v(Je,Bt),v(X,Se),v(ke,_e),v(nt,Be),v(ot,Ge),v(Tt,Fe),v(Ft,M)},[()=>d("Name"),()=>d("Key"),()=>d("Device types"),()=>d("Source"),()=>d("Bridge"),()=>d("Endpoint"),()=>d("State")]),k(Y,re)};H(D,Y=>{r(i)&&r(n).length===0?Y($):Y(z,-1)})}var de=l(oe,2);{const Y=se=>{var le=Cp(),Ce=Pe(le),Je=f(Ce,!0),De=l(Ce,2),X=f(De,!0);x((he,ke,We)=>{v(Je,he),De.disabled=ke,v(X,We)},[()=>d("Cancel"),()=>!r(b)||r(c).trim()==="",()=>d("Create")]),N("click",Ce,()=>w(s,!1)),N("click",De,L),k(se,le)};let re=ie(()=>d("New device"));qi(de,{get open(){return r(s)},get title(){return r(re)},onclose:()=>w(s,!1),testId:"create-dialog",buttons:Y,children:(se,le)=>{var Ce=Ap(),Je=h(Ce),De=f(Je,!0),X=l(Je,2),he=h(X),ke=l(X,2),We=f(ke,!0),nt=l(ke,2),yt=h(nt);let ot;var be=l(nt,2),Tt=f(be,!0),Mt=l(be,2),Ft=f(Mt,!0),Lt=l(Mt,2),Bt=h(Lt),Se=l(Lt,2),_e=h(Se);et(_e,21,()=>r(A),Fe=>Fe.name,(Fe,M)=>{var J=Sp(),K=f(J,!0),ue={};x(()=>{v(K,r(M).name),ue!==(ue=r(M).name)&&(J.value=(J.__value=ue)??"")}),k(Fe,J)}),Qt(_e);var Be=l(Se,2),Ge=f(Be,!0);x((Fe,M,J,K,ue,Ke)=>{v(De,Fe),v(We,M),ot=Nt(yt,1,"ui-input ui-mono",null,ot,{"ui-invalid":r(u)!==""&&!r(b)}),v(Tt,J),v(Ft,K),ne(Bt,"placeholder",ue),v(Ge,Ke)},[()=>d("Name"),()=>d("Key"),()=>d("The key is the Matter endpoint id: stable, never renamed. Letters, digits, : . _ -"),()=>d("Device type"),()=>d("Filter"),()=>d("The device type brings its mandatory clusters; their mappings are filled in the editor.")]),Na("blur",he,P),Ee(he,()=>r(c),Fe=>w(c,Fe)),Ee(yt,()=>r(u),Fe=>w(u,Fe)),Ee(Bt,()=>r(y),Fe=>w(y,Fe)),pr(_e,()=>r(m),Fe=>w(m,Fe)),k(se,Ce)},$$slots:{buttons:!0,default:!0}})}x((Y,re,se,le)=>{v(tt,`+ ${Y??""}`),v(Le,re),ne(He,"placeholder",se),v(Q,le)},[()=>d("New device"),()=>d("From preset"),()=>d("Filter"),()=>d("{count} devices",{count:r(n).length})]),N("click",Te,O),N("click",Oe,()=>Br.go("presets")),Ee(He,()=>r(a),Y=>w(a,Y)),k(B,W)};H(I,B=>{r(g)!==""?B(R):B(V,-1)})}k(e,q),Ht()}or(["click"]);var Mp=S('<tr data-testid="log-row"><td class="ui-muted ts svelte-skp5ex"> </td><td class="level-cell svelte-skp5ex"> </td><td class="ui-muted scope svelte-skp5ex"> </td><td class="message svelte-skp5ex"> </td></tr>'),Rp=S('<div class="ui-page" data-testid="log-page"><div class="ui-toolbar"><select class="ui-select level svelte-skp5ex" data-testid="log-level"><option>debug</option><option>info</option><option>warn</option><option>error</option></select> <input class="ui-input filter svelte-skp5ex"/> <!> <div class="ui-toolbar-trailing"> </div></div> <div class="ui-page-scroll"><table class="ui-table log svelte-skp5ex"><tbody></tbody></table></div></div>');function Ip(e,t){$t(t,!0);let n=F(Pt([])),i=F(""),a=F("debug"),o=F(!0),s=F(void 0);const u={debug:0,info:1,warn:2,error:3},c=2e3,m=ie(()=>{const q=r(i).trim().toLowerCase(),I=u[r(a)]??0;return r(n).filter(R=>(u[R.level]??0)>=I&&(q===""||`${R.scope} ${R.message}`.toLowerCase().includes(q)))});async function y(){await Ju(),r(o)&&r(s)!==void 0&&(r(s).scrollTop=r(s).scrollHeight)}Cr(()=>(Ie.log(c).then(q=>{w(n,q,!0),y()}).catch(q=>Ne.error(ut(q))),hr.on(q=>{q.type==="log"&&(w(n,[...r(n),q.entry].slice(-c),!0),y())})));var g=Rp(),_=h(g),b=h(_),T=h(b);T.value=T.__value="debug";var A=l(T);A.value=A.__value="info";var C=l(A);C.value=C.__value="warn";var E=l(C);E.value=E.__value="error",Qt(b);var O=l(b,2),P=l(O,2);{let q=ie(()=>d("follow"));Lr(P,{get label(){return r(q)},get checked(){return r(o)},set checked(I){w(o,I,!0)}})}var L=l(P,2),Z=f(L,!0),j=l(_,2),G=h(j),U=h(G);et(U,21,()=>r(m),q=>q.id,(q,I)=>{var R=Mp(),V=h(R),B=f(V,!0),W=l(V),oe=f(W,!0),ve=l(W),Te=f(ve,!0),tt=l(ve),Oe=f(tt,!0);x(Le=>{Nt(R,1,tl(r(I).level),"svelte-skp5ex"),v(B,Le),v(oe,r(I).level),v(Te,r(I).scope),v(Oe,r(I).message)},[()=>ra(r(I).ts)]),k(q,R)}),Ba(j,q=>w(s,q),()=>r(s)),x((q,I)=>{ne(O,"placeholder",q),v(Z,I)},[()=>d("Filter"),()=>d("{count} lines",{count:r(m).length})]),pr(b,()=>r(a),q=>w(a,q)),Ee(O,()=>r(i),q=>w(i,q)),k(e,g),Ht()}var Op=S('<span class="ui-badge retain svelte-1q9v7x1">R</span>'),Dp=S('<tr data-testid="topic-row"><td><code> </code><!></td><td class="payload svelte-1q9v7x1"><code> </code></td><td class="ui-muted"> </td></tr>'),Lp=S('<div class="detail svelte-1q9v7x1"><div class="ui-muted"><code> </code> </div> <pre class="ui-pre"> </pre></div>'),Bp=S('<tr data-testid="message-row"><td class="ui-muted time svelte-1q9v7x1"> </td><td><code> </code></td><td class="payload svelte-1q9v7x1"><code> </code></td></tr>'),qp=S('<div class="ui-page" data-testid="mqtt-page"><div class="ui-split split svelte-1q9v7x1"><section class="ui-section column svelte-1q9v7x1"><div class="ui-section-title"> <div class="ui-toolbar-trailing"> </div></div> <input class="ui-input" data-testid="topic-filter"/> <div class="ui-page-scroll"><table class="ui-table"><thead><tr><th> </th><th> </th><th> </th></tr></thead><tbody></tbody></table></div> <!></section> <div class="column right svelte-1q9v7x1"><section class="ui-section"><div class="ui-section-title"> </div> <div class="ui-form"><label class="ui-form-label" for="pub-topic"> </label> <div class="ui-form-field"><input id="pub-topic" class="ui-input ui-mono" data-testid="publish-topic"/></div> <label class="ui-form-label" for="pub-payload"> </label> <div class="ui-form-field"><textarea id="pub-payload" class="ui-textarea" rows="3" data-testid="publish-payload"></textarea></div> <span></span> <div class="ui-form-field"><!> <button type="button" class="ui-button ui-button-primary" data-testid="publish"> </button></div></div></section> <section class="ui-section column svelte-1q9v7x1"><div class="ui-section-title"> <div class="ui-toolbar-trailing"><!> <button type="button" class="ui-button"> </button></div></div> <div class="ui-page-scroll"><table class="ui-table"><tbody></tbody></table></div></section></div></div></div>');function Up(e,t){$t(t,!0);let n=F(Pt(new Map)),i=F(""),a=F(""),o=F(Pt([])),s=F(!1),u=F(""),c=F(""),m=F(!1),y=1;const g=300,_=ie(()=>{const _e=r(i).trim().toLowerCase();return[...r(n).values()].filter(Be=>_e===""||Be.topic.toLowerCase().includes(_e)).sort((Be,Ge)=>Be.topic.localeCompare(Ge.topic))}),b=ie(()=>r(a)===""?void 0:r(n).get(r(a))),T=ie(()=>r(b)===void 0?void 0:ua(r(b).payload));async function A(){try{w(n,new Map((await Ie.topics()).map(_e=>[_e.topic,_e])),!0)}catch(_e){Ne.error(ut(_e))}}Cr(()=>{A();const _e=hr.wantMqtt(),Be=hr.on(Ge=>{if(Ge.type!=="mqtt")return;const Fe={topic:Ge.topic,payload:Ge.payload,retain:Ge.retain,ts:Ge.ts};r(n).set(Ge.topic,Fe),w(n,new Map(r(n)),!0),r(s)||w(o,[{id:y++,...Fe},...r(o)].slice(0,g),!0)});return()=>{_e(),Be()}});async function C(){try{await Ie.publish(r(u),r(c),r(m)),Ne.info(d("Published to {topic}",{topic:r(u)}))}catch(_e){Ne.error(ut(_e))}}function E(_e){w(a,_e.topic,!0),w(u,_e.topic,!0),w(c,_e.payload,!0)}var O=qp(),P=h(O),L=h(P),Z=h(L),j=h(Z),G=l(j),U=f(G,!0),q=l(Z,2),I=l(q,2),R=h(I),V=h(R),B=h(V),W=h(B),oe=f(W,!0),ve=l(W),Te=f(ve,!0),tt=l(ve),Oe=f(tt,!0),Le=l(V);et(Le,21,()=>r(_),_e=>_e.topic,(_e,Be)=>{var Ge=Dp();let Fe;var M=h(Ge),J=h(M),K=f(J,!0),ue=l(J);{var Ke=Ye=>{var lt=Op();k(Ye,lt)};H(ue,Ye=>{r(Be).retain&&Ye(Ke)})}var ht=l(M),fe=h(ht),pe=f(fe,!0),me=l(ht),Me=f(me,!0);x(Ye=>{Fe=Nt(Ge,1,"ui-row-link",null,Fe,{"ui-row-selected":r(Be).topic===r(a)}),v(K,r(Be).topic),v(pe,r(Be).payload),v(Me,Ye)},[()=>ra(r(Be).ts)]),N("click",Ge,()=>E(r(Be))),k(_e,Ge)});var He=l(I,2);{var Et=_e=>{var Be=Lp(),Ge=h(Be),Fe=h(Ge),M=f(Fe,!0),J=l(Fe),K=l(Ge,2),ue=f(K,!0);x((Ke,ht,fe)=>{v(M,r(b).topic),v(J,` · ${Ke??""}${ht??""}`),v(ue,fe)},[()=>ra(r(b).ts),()=>r(b).retain?` · ${d("retained")}`:"",()=>r(T)===void 0?r(b).payload:Nn(r(T))]),k(_e,Be)};H(He,_e=>{r(b)&&_e(Et)})}var Q=l(L,2),ee=h(Q),D=h(ee),$=f(D,!0),z=l(D,2),de=h(z),Y=f(de,!0),re=l(de,2),se=h(re),le=l(re,2),Ce=f(le,!0),Je=l(le,2),De=h(Je),X=l(Je,4),he=h(X);{let _e=ie(()=>d("retain"));Lr(he,{get label(){return r(_e)},get checked(){return r(m)},set checked(Be){w(m,Be,!0)}})}var ke=l(he,2),We=f(ke,!0),nt=l(ee,2),yt=h(nt),ot=h(yt),be=l(ot),Tt=h(be);{let _e=ie(()=>d("pause"));Lr(Tt,{get label(){return r(_e)},get checked(){return r(s)},set checked(Be){w(s,Be,!0)}})}var Mt=l(Tt,2),Ft=f(Mt,!0),Lt=l(yt,2),Bt=h(Lt),Se=h(Bt);et(Se,21,()=>r(o),_e=>_e.id,(_e,Be)=>{var Ge=Bp(),Fe=h(Ge),M=f(Fe,!0),J=l(Fe),K=h(J),ue=f(K,!0),Ke=l(J),ht=h(Ke),fe=f(ht,!0);x(pe=>{v(M,pe),v(ue,r(Be).topic),v(fe,r(Be).payload)},[()=>ra(r(Be).ts)]),k(_e,Ge)}),x((_e,Be,Ge,Fe,M,J,K,ue,Ke,ht,fe,pe)=>{v(j,`${_e??""} `),v(U,Be),ne(q,"placeholder",Ge),v(oe,Fe),v(Te,M),v(Oe,J),v($,K),v(Y,ue),v(Ce,Ke),ke.disabled=r(u)==="",v(We,ht),v(ot,`${fe??""} `),v(Ft,pe)},[()=>d("Topics"),()=>d("{count} topics",{count:r(n).size}),()=>d("Filter"),()=>d("Topic"),()=>d("Payload"),()=>d("Time"),()=>d("Publish"),()=>d("Topic"),()=>d("Payload"),()=>d("Publish"),()=>d("Messages"),()=>d("Clear")]),Ee(q,()=>r(i),_e=>w(i,_e)),Ee(se,()=>r(u),_e=>w(u,_e)),Ee(De,()=>r(c),_e=>w(c,_e)),N("click",ke,C),N("click",Mt,()=>w(o,[],!0)),k(e,O),Ht()}or(["click"]);var Fp=S('<div class="ui-empty"> </div>'),jp=S('<span class="ui-muted description svelte-11516m7"> </span>'),zp=S('<button type="button" class="card svelte-11516m7" data-testid="preset"><span class="name svelte-11516m7"> </span> <!> <span class="ui-faint ui-small"><code> </code> </span></button>'),$p=S('<section class="group svelte-11516m7"><h3 class="svelte-11516m7"> </h3> <div class="cards svelte-11516m7"></div></section>'),Hp=S('<div class="ui-small"><code> </code> </div>'),Gp=S('<section class="ui-section"><div class="ui-section-title ui-warn-text"> </div> <!></section>'),Kp=S('<button type="button" class="ui-button"> </button> <button type="button" class="ui-button ui-button-primary" data-testid="preset-create"> </button>',1),Vp=S('<p class="ui-muted intro svelte-11516m7"> </p>'),Jp=S('<div class="ui-form-help"> </div>'),Wp=S('<label class="ui-form-label"> </label> <div class="ui-form-field"><input class="ui-input"/></div> <!>',1),Yp=S('<div class="ui-form"><label class="ui-form-label" for="preset-key"> </label> <div class="ui-form-field"><input id="preset-key" data-testid="preset-key"/></div></div> <!> <pre class="ui-pre"> </pre>',1),Qp=S('<!> <div class="ui-form"><!> <span></span> <div class="ui-form-field"><button type="button" class="ui-button" data-testid="preset-preview"> </button></div></div> <!>',1),Zp=S('<div class="ui-page" data-testid="presets-page"><div class="ui-page-scroll"><!> <!> <!></div></div> <!>',1);function Xp(e,t){$t(t,!0);let n=F(Pt([])),i=F(Pt([])),a=F(!1),o=F(void 0),s=F(Pt({})),u=F(""),c=F(void 0),m=F(!1);const y=/^[A-Za-z0-9][A-Za-z0-9:._-]{0,63}$/,g=ie(()=>y.test(r(u))),_=ie(()=>{const I=new Map;for(const R of r(n)){const V=R.vendor??d("Other");I.set(V,[...I.get(V)??[],R])}return[...I.entries()].sort(([R],[V])=>R.localeCompare(V))});Cr(()=>{Ie.presets().then(I=>{w(n,I.presets,!0),w(i,I.problems,!0),w(a,!0)}).catch(I=>Ne.error(ut(I)))});function b(I){w(o,I,!0),w(s,Object.fromEntries(Object.entries(I.variables).map(([R,V])=>[R,V.default??""])),!0),w(u,""),w(c,void 0)}async function T(){if(r(o)!==void 0){w(m,!0);try{w(c,await Ie.applyPreset(r(o).id,r(s)),!0),r(u)===""&&w(u,r(c).device.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),!0)}catch(I){Ne.error(ut(I))}finally{w(m,!1)}}}async function A(){if(!(r(c)===void 0||!r(g)))try{await Ie.saveDevice(r(u),r(c).device),Ne.info(d("{name} created",{name:r(c).device.name})),w(o,void 0),Br.go("devices",r(u))}catch(I){Ne.error(ut(I))}}var C=Zp(),E=Pe(C),O=h(E),P=h(O);{var L=I=>{var R=Fp(),V=f(R,!0);x(B=>v(V,B),[()=>d("No presets. Put preset files into a directory named in the configuration.")]),k(I,R)};H(P,I=>{r(a)&&r(n).length===0&&I(L)})}var Z=l(P,2);et(Z,17,()=>r(_),([I,R])=>I,(I,R)=>{var V=ie(()=>Ea(r(R),2));let B=()=>r(V)[0],W=()=>r(V)[1];var oe=$p(),ve=h(oe),Te=f(ve,!0),tt=l(ve,2);et(tt,21,W,Oe=>Oe.id,(Oe,Le)=>{var He=zp(),Et=h(He),Q=f(Et,!0),ee=l(Et,2);{var D=re=>{var se=jp(),le=f(se,!0);x(()=>v(le,r(Le).description)),k(re,se)};H(ee,re=>{r(Le).description&&re(D)})}var $=l(ee,2),z=h($),de=f(z,!0),Y=l(z,1,!0);x(re=>{ne(He,"data-id",r(Le).id),v(Q,r(Le).name),v(de,r(Le).id),v(Y,re)},[()=>r(Le).shipped?"":` · ${d("own")}`]),N("click",He,()=>b(r(Le))),k(Oe,He)}),x(()=>v(Te,B())),k(I,oe)});var j=l(Z,2);{var G=I=>{var R=Gp(),V=h(R),B=f(V,!0),W=l(V,2);et(W,17,()=>r(i),oe=>oe.file,(oe,ve)=>{var Te=Hp(),tt=h(Te),Oe=f(tt,!0),Le=l(tt);x(()=>{v(Oe,r(ve).file),v(Le,`: ${r(ve).message??""}`)}),k(oe,Te)}),x(oe=>v(B,oe),[()=>d("Preset files with problems")]),k(I,R)};H(j,I=>{r(i).length>0&&I(G)})}var U=l(E,2);{var q=I=>{qi(I,{open:!0,get title(){return r(o).name},width:"640px",onclose:()=>w(o,void 0),testId:"preset-dialog",buttons:V=>{var B=Kp(),W=Pe(B),oe=f(W,!0),ve=l(W,2),Te=f(ve,!0);x((tt,Oe)=>{v(oe,tt),ve.disabled=r(c)===void 0||!r(g),v(Te,Oe)},[()=>d("Cancel"),()=>d("Create device")]),N("click",W,()=>w(o,void 0)),N("click",ve,A),k(V,B)},children:(V,B)=>{var W=Qp(),oe=Pe(W);{var ve=ee=>{var D=Vp(),$=f(D,!0);x(()=>v($,r(o).description)),k(ee,D)};H(oe,ee=>{r(o).description&&ee(ve)})}var Te=l(oe,2),tt=h(Te);et(tt,17,()=>Object.entries(r(o).variables),([ee,D])=>ee,(ee,D)=>{var $=ie(()=>Ea(r(D),2));let z=()=>r($)[0],de=()=>r($)[1];var Y=Wp(),re=Pe(Y),se=f(re,!0),le=l(re,2),Ce=h(le),Je=l(le,2);{var De=X=>{var he=Jp(),ke=f(he,!0);x(()=>v(ke,de().description)),k(X,he)};H(Je,X=>{de().description&&X(De)})}x(X=>{ne(re,"for",`var-${z()??""}`),v(se,de().label),ne(Ce,"id",`var-${z()??""}`),ne(Ce,"placeholder",X),ne(Ce,"data-testid",`preset-var-${z()??""}`)},[()=>de().optional?d("optional"):""]),Ee(Ce,()=>r(s)[z()],X=>r(s)[z()]=X),k(ee,Y)});var Oe=l(tt,4),Le=h(Oe),He=f(Le,!0),Et=l(Te,2);{var Q=ee=>{var D=Yp(),$=Pe(D),z=h($),de=f(z,!0),Y=l(z,2),re=h(Y);let se;var le=l($,2);{let De=ie(()=>d("The device validates."));Ma(le,{get issues(){return r(c).issues},get empty(){return r(De)}})}var Ce=l(le,2),Je=f(Ce,!0);x((De,X)=>{v(de,De),se=Nt(re,1,"ui-input ui-mono",null,se,{"ui-invalid":!r(g)}),v(Je,X)},[()=>d("Key"),()=>Nn(r(c).device)]),Ee(re,()=>r(u),De=>w(u,De)),k(ee,D)};H(Et,ee=>{r(c)&&ee(Q)})}x(ee=>{Le.disabled=r(m),v(He,ee)},[()=>d("Preview")]),N("click",Le,T),k(V,W)},$$slots:{buttons:!0,default:!0}})};H(U,I=>{r(o)&&I(q)})}k(e,C),Ht()}or(["click"]);var eh=S('<span class="version ui-faint svelte-pjescm"> </span>'),th=S('<button type="button" class="ui-badge ui-badge-accent update svelte-pjescm" data-testid="update-available"> </button>'),rh=S('<span class="status svelte-pjescm" data-testid="user"> </span>'),nh=S('<button type="button" class="ui-button logout svelte-pjescm" data-testid="logout"> </button>'),ih=S("<option> </option>"),ah=S('<div class="shell svelte-pjescm" data-testid="app"><header class="header svelte-pjescm"><span class="brand svelte-pjescm">mqtt2matter</span> <!> <div class="actions svelte-pjescm"><span class="status svelte-pjescm"><span></span>MQTT</span> <span class="status svelte-pjescm"><span></span> </span> <!> <!> <!> <!> <select class="ui-select language svelte-pjescm" data-testid="language"><option> </option><!></select> <button type="button" class="theme svelte-pjescm" data-testid="theme"><span aria-hidden="true"> </span></button></div></header> <main class="main svelte-pjescm"><!></main> <!> <!></div>');function oh(e,t){$t(t,!0);let n=F(Pt(ul())),i=F(void 0),a=F("none");const o=ie(()=>Br.route.page),s=ie(()=>hr.mqttConnected??r(i)?.mqtt.connected??!1),u=ie(()=>r(i)?.bridges.some(X=>X.commissioned)??!1),c=ie(()=>r(i)?.importers??[]),m={system:"◐",light:"☀",dark:"☾"},y=ie(()=>[{id:"devices",label:d("Devices"),badge:r(i)===void 0?void 0:String(r(i).devices)},{id:"presets",label:d("Presets")},{id:"adopt",label:d("Adopt"),dot:r(c).length===0?"none":void 0},{id:"bridges",label:d("Bridges"),dot:r(u)?"ok":"warn"},{id:"mqtt",label:"MQTT",dot:r(s)?"ok":"error"},{id:"log",label:d("Log"),dot:r(a)==="none"?"none":r(a)},{id:"check",label:d("Check")},{id:"config",label:d("Configuration")}]);async function g(){try{w(i,await Ie.status(),!0)}catch{w(i,void 0)}}Cr(()=>{hr.start(),g();const X=setInterval(()=>{g()},15e3),he=hr.on(ke=>{(ke.type==="devices"||ke.type==="bridges"||ke.type==="status")&&g(),ke.type==="log"&&r(o)!=="log"&&(ke.entry.level==="error"?w(a,"error"):ke.entry.level==="warn"&&r(a)!=="error"&&w(a,"warn"))});return()=>{clearInterval(X),he(),hr.stop()}}),sn(()=>{r(o)==="log"&&w(a,"none")});function _(){w(n,Jc(r(n)),!0),Vc(r(n))}var b=ah(),T=h(b),A=l(h(T),2);{let X=ie(()=>d("Pages"));zc(A,{get tabs(){return r(y)},get active(){return r(o)},get label(){return r(X)},onselect:he=>Br.go(he)})}var C=l(A,2),E=h(C),O=h(E);let P;var L=l(E,2),Z=h(L);let j;var G=l(Z),U=l(L,2);{var q=X=>{var he=eh(),ke=f(he,!0);x(()=>v(ke,r(i).version)),k(X,he)};H(U,X=>{r(i)&&X(q)})}var I=l(U,2);{var R=X=>{var he=th(),ke=f(he,!0);x(We=>v(ke,We),[()=>d("Update {version}",{version:r(i).update.latest??""})]),N("click",he,()=>Br.go("config")),k(X,he)};H(I,X=>{r(i)?.update?.newer===!0&&X(R)})}var V=l(I,2);{var B=X=>{var he=rh(),ke=f(he,!0);x(()=>v(ke,nr.state.user)),k(X,he)};H(V,X=>{nr.state?.mode==="proxy"&&nr.state.user!==void 0&&X(B)})}var W=l(V,2);{var oe=X=>{var he=nh(),ke=f(he,!0);x(We=>v(ke,We),[()=>d("Log out")]),N("click",he,()=>nr.logout()),k(X,he)};H(W,X=>{(nr.state?.mode==="password"||nr.state?.logoutUrl!==void 0)&&X(oe)})}var ve=l(W,2),Te=h(ve),tt=f(Te,!0);Te.value=Te.__value="auto";var Oe=l(Te);et(Oe,16,()=>il,X=>X,(X,he)=>{var ke=ih(),We=f(ke,!0),nt={};x(()=>{v(We,al[he]),nt!==(nt=he)&&(ke.value=(ke.__value=nt)??"")}),k(X,ke)});var Le;Qt(ve);var He=l(ve,2),Et=h(He),Q=f(Et,!0),ee=l(T,2),D=h(ee);{var $=X=>{Np(X,{})},z=X=>{Xp(X,{})},de=X=>{lv(X,{})},Y=X=>{$v(X,{})},re=X=>{Up(X,{})},se=X=>{Ip(X,{})},le=X=>{Qv(X,{})},Ce=X=>{mf(X,{})};H(D,X=>{r(o)==="devices"?X($):r(o)==="presets"?X(z,1):r(o)==="adopt"?X(de,2):r(o)==="bridges"?X(Y,3):r(o)==="mqtt"?X(re,4):r(o)==="log"?X(se,5):r(o)==="check"?X(le,6):r(o)==="config"&&X(Ce,7)})}var Je=l(ee,2);Bc(Je,{});var De=l(Je,2);Rc(De,{}),x((X,he,ke,We,nt,yt,ot,be)=>{ne(E,"title",X),P=Nt(O,1,"ui-dot",null,P,{"ui-dot-ok":r(s),"ui-dot-error":!r(s)}),ne(L,"title",he),j=Nt(Z,1,"ui-dot",null,j,{"ui-dot-ok":hr.connected,"ui-dot-error":!hr.connected}),v(G,` ${ke??""}`),ne(ve,"aria-label",We),ne(ve,"title",nt),v(tt,yt),Le!==(Le=sa.choice)&&(ve.value=(ve.__value=Le)??"",Bi(ve,Le)),ne(He,"aria-label",ot),ne(He,"title",be),v(Q,m[r(n)])},[()=>r(s)?d("Connected to the broker"):d("Not connected to the broker"),()=>hr.connected?d("Event stream connected"):d("Event stream disconnected"),()=>d("Live"),()=>d("Language"),()=>d("Language"),()=>d("Browser language"),()=>d("Theme: {theme}",{theme:d(r(n))}),()=>d("Theme: {theme}",{theme:d(r(n))})]),N("change",ve,X=>sa.set(X.currentTarget.value)),N("click",He,_),k(e,b),Ht()}or(["click","change"]);function sh(e,t){$t(t,!1),Cr(()=>{nr.load()}),ic();var n=ci(),i=Pe(n);{var a=s=>{oh(s,{})},o=s=>{Ec(s,{})};H(i,s=>{nr.state?.authenticated===!0?s(a):(nr.state!==void 0||nr.unreachable)&&s(o,1)})}k(e,n),Ht()}ll();const ml=document.getElementById("app");if(ml===null)throw new Error("no #app");Fd(sh,{target:ml});
|