@matterbridge/frontend 3.11.1 → 3.11.2-dev-20261031-1af0fda
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/build/assets/{index-DrZFpM5c.js → index-Cera0zb7.js} +5 -5
- package/build/assets/{vendor_mui-DiHi-WpZ.js → vendor_mui-Bwi6U1rq.js} +1 -1
- package/build/assets/vendor_node_modules-CQymrk0g.js +57 -0
- package/build/assets/{vendor_notistack-DtGYh6nI.js → vendor_notistack-KR8UjZr-.js} +2 -2
- package/build/assets/{vendor_rjsf-Q5JuIJzr.js → vendor_rjsf-B6mpip0I.js} +3 -3
- package/build/index.html +5 -5
- package/package.json +1 -1
- package/build/assets/vendor_node_modules-Br1LuJmm.js +0 -57
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{s as t}from"./vendor_emotion-DDpeU9YY.js";import{c as n,d as r,l as i,o as a,p as o,s,u as c}from"./vendor_node_modules-Br1LuJmm.js";import{$ as l,$t as u,A as d,At as f,B as p,Bt as m,C as h,Ct as g,D as _,Dt as v,E as y,Et as b,F as x,Ft as S,G as C,Gt as w,H as T,Ht as E,I as D,It as O,J as k,Jt as A,K as j,Kt as M,L as ee,Lt as N,M as te,Mt as P,N as ne,Nt as F,O as re,Ot as I,P as ie,Pt as ae,Q as oe,Qt as se,R as ce,Rt as le,S as ue,St as de,T as fe,Tt as pe,U as me,Ut as he,V as L,Vt as ge,W as _e,Wt as R,X as ve,Xt as z,Y as ye,Yt as be,Z as xe,Zt as Se,_ as Ce,_t as we,a as Te,at as Ee,b as De,bt as Oe,c as ke,ct as Ae,d as je,dt as Me,en as Ne,et as Pe,f as Fe,ft as Ie,g as Le,gt as Re,h as ze,ht as Be,i as Ve,it as He,j as Ue,jt as We,k as Ge,kt as B,l as Ke,lt as qe,m as Je,mt as Ye,n as Xe,nt as Ze,o as Qe,ot as $e,p as et,pt as tt,q as nt,qt as V,r as rt,rt as it,s as at,st as ot,t as st,tt as ct,u as lt,ut,v as dt,vt as ft,w as pt,wt as mt,x as ht,xt as H,y as gt,yt as _t,z as vt,zt as yt}from"./vendor_mui-DiHi-WpZ.js";import{b as bt,c as xt,i as St,o as Ct,s as wt,t as Tt,v as Et,x as Dt}from"./vendor_mdi-ZZw2uLFo.js";import{n as Ot,t as kt}from"./vendor_notistack-DtGYh6nI.js";import{a as At,c as jt,i as Mt,l as Nt,n as Pt,o as Ft,r as It,s as Lt,t as Rt}from"./vendor_rjsf-Q5JuIJzr.js";import{t as zt}from"./vendor_qrcode-BukycYO1.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var U=e(t(),1),Bt=e(o(),1),W=`mbf-`,G={"enable-mobile":`${W}enable-mobile`,"devices-filter-plugins":`${W}devices-filter-plugins`,"devices-filter-devices":`${W}devices-filter-devices`,"devices-view-mode":`${W}devices-view-mode`,"devices-cluster-view-mode":`${W}devices-cluster-view-mode`,"frontend-version":`${W}frontend-version`,"matterbridge-version":`${W}matterbridge-version`,"home-page-mode":`${W}home-page-mode`,"log-filter-level":`${W}log-filter-level`,"log-filter-search":`${W}log-filter-search`,"log-auto-scroll":`${W}log-auto-scroll`,"log-length":`${W}log-length`,"frontend-theme":`${W}frontend-theme`,"home-page-plugins":`${W}home-page-plugins`,"virtual-mode":`${W}virtual-mode`,"install-auto-exit":`${W}install-auto-exit`,"search-plugins-total":`${W}search-plugins-total`,"search-plugins-meta":`${W}search-plugins-meta`,"search-plugins-versions":`${W}search-plugins-versions`,"search-plugins-search":`${W}search-plugins-search`},Vt={"devices-table-order-by":`${W}devices-table-order-by`,"devices-table-order":`${W}devices-table-order`,"devices-column-visibility":`${W}devices-column-visibility`,"plugins-table-order-by":`${W}plugins-table-order-by`,"plugins-table-order":`${W}plugins-table-order`,"plugins-column-visibility":`${W}plugins-column-visibility`,"search-plugins-table-order-by":`${W}search-plugins-table-order-by`,"search-plugins-table-order":`${W}search-plugins-table-order`,"search-plugins-column-visibility":`${W}search-plugins-column-visibility`,"registered-devices-table-order-by":`${W}registered-devices-table-order-by`,"registered-devices-table-order":`${W}registered-devices-table-order`,"registered-devices-column-visibility":`${W}registered-devices-column-visibility`,"clusters-table-order-by":`${W}clusters-table-order-by`,"clusters-table-order":`${W}clusters-table-order`,"clusters-column-visibility":`${W}clusters-column-visibility`};function Ht(){Object.values(G).forEach(e=>{localStorage.removeItem(e)}),Object.values(Vt).forEach(e=>{localStorage.removeItem(e)})}var K=!1,Ut=()=>{K=!K},q=localStorage.getItem(G[`enable-mobile`])!==`false`,Wt=()=>{q=!0,localStorage.setItem(G[`enable-mobile`],`true`)},Gt=()=>{q=!1,localStorage.setItem(G[`enable-mobile`],`false`)},Kt,qt=e=>{Kt=e},Jt=!1,Yt=e=>{Jt=e},Xt=`/`,Zt=e=>{Xt=e},J=Ne();function Qt(e){return(0,J.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,viewBox:`0 0 296.2 296.2`,...e,children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsxs)(`linearGradient`,{id:`lg1`,x1:`16.6`,y1:`16.6`,x2:`279.6`,y2:`279.6`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,J.jsx)(`stop`,{offset:`.1`,stopColor:`#3faa77`}),(0,J.jsx)(`stop`,{offset:`.3`,stopColor:`#234148`}),(0,J.jsx)(`stop`,{offset:`.7`,stopColor:`#203b44`}),(0,J.jsx)(`stop`,{offset:`.9`,stopColor:`#ad2e6e`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,J.jsxs)(`linearGradient`,{id:`lg2`,x1:`31.1`,y1:`31.1`,x2:`265.1`,y2:`265.1`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,J.jsx)(`stop`,{offset:`.2`,stopColor:`#285251`}),(0,J.jsx)(`stop`,{offset:`.4`,stopColor:`#234148`}),(0,J.jsx)(`stop`,{offset:`.8`,stopColor:`#203b44`}),(0,J.jsx)(`stop`,{offset:`.9`,stopColor:`#a8316c`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,J.jsxs)(`linearGradient`,{id:`lg3`,x1:`116.2`,y1:`143.9`,x2:`139.8`,y2:`143.9`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#8bc751`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#0db14b`})]}),(0,J.jsx)(`linearGradient`,{id:`lg4`,x1:`136.1`,y1:`100.8`,x2:`159.6`,y2:`100.8`,xlinkHref:`#lg3`}),(0,J.jsx)(`linearGradient`,{id:`lg5`,x1:`155.3`,y1:`143.9`,x2:`178.9`,y2:`143.9`,xlinkHref:`#lg3`}),(0,J.jsxs)(`linearGradient`,{id:`lg6`,x1:`46.8`,y1:`25.7`,x2:`89.6`,y2:`74.8`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#b1d34a`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#50b848`})]})]}),(0,J.jsx)(`rect`,{width:`296.2`,height:`296.2`,rx:`56.7`,ry:`56.7`,style:{fill:`url(#lg1)`}}),(0,J.jsx)(`rect`,{x:`16.3`,y:`16.3`,width:`263.6`,height:`263.6`,rx:`50.5`,ry:`50.5`,style:{fill:`url(#lg2)`}}),(0,J.jsx)(`circle`,{cx:`128`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg3)`}}),(0,J.jsx)(`circle`,{cx:`147.8`,cy:`100.8`,r:`11.8`,style:{fill:`url(#lg4)`}}),(0,J.jsx)(`path`,{d:`m244.6 114.5.4-.5L160 33a17 17 0 0 0-24.7-.5l-86.4 83.3a15 15 0 0 0 9.2 26.9h19.3v-4.7l-13.7-12.7v-.1l83.7-80.8 84.2 81-13.9 12.8v4.5h19.5a15 15 0 0 0 7.4-28.1Z`,style:{fill:`url(#lg3)`}}),(0,J.jsx)(`circle`,{cx:`167.1`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg5)`}}),(0,J.jsx)(`path`,{fill:`#fff`,d:`M219 89.3V35.5a10.5 10.5 0 1 0-21 0v33.7l21 20Z`}),(0,J.jsx)(`path`,{d:`M91.4 73.3H83a37 37 0 0 0-14.5-28.4L65 50.2c.1 0 12.6 9 11.7 25.4-5.3-.4-11.2-1.9-16.3-5.3-11.8-7.8-16-23.7-11.9-46 8.7 1.5 34 7 43 22.8 4.1 7.3 4.1 16.1 0 26.2Z`,style:{fill:`url(#lg6)`}}),(0,J.jsx)(`path`,{d:`M65.9 80a49.6 49.6 0 0 0 17.8 2.2l16.6-16c1.6-8.3.5-15.7-3.3-22.4C84.6 22 47.8 17.5 46.2 17.4l-3-.4-.6 3c-3.8 18.4-5.9 50.6 23.2 60ZM48.4 24.4c8.7 1.5 34 7 43 22.8 4.1 7.3 4.1 16.1 0 26.2H83a37 37 0 0 0-14.5-28.4l-3.7 5.3c.1 0 12.6 9 11.7 25.4-5.3-.4-11.2-1.9-16.3-5.3-11.9-7.8-16-23.7-11.9-46Z`,fill:`#1e5857`}),(0,J.jsx)(`path`,{fill:`#fff`,d:`M250.5 90.5a17.4 17.4 0 1 1 0-34.8 17.4 17.4 0 0 1 0 34.8Zm0-22.7a5.4 5.4 0 0 0 0 10.7 5.3 5.3 0 0 0 0-10.7ZM258.8 148.2a15.9 15.9 0 0 0-9.6 28.5c-.8 4.2-5.4 4.6-5.4 4.6h-26v-43l13.6-13-1.8-2-82.2-79-81.2 78.3-2.5 2.6 13.7 13v42.9H53a21.5 21.5 0 1 0 11.7 15h12.6v18.8c0 7.8 6.4 14.1 14.1 14.1h29.3v14.8H64a10.6 10.6 0 0 0-17.7 8 10.6 10.6 0 0 0 17.6 8h157.6a16.3 16.3 0 1 0 0-16h-84.8V229h66.8c7.8 0 14.2-6.3 14.2-14.1v-19.2h27.6c14.3 0 17.8-12.8 18.5-16.6a15.9 15.9 0 0 0-5-30.9ZM43.7 210.8a10.3 10.3 0 1 1 0-20.6 10.3 10.3 0 0 1 0 20.6Zm192 36a5 5 0 1 1 0 10 5 5 0 0 1 0-10Zm-77-34.8h-22v-34h22v34Zm8.4-79.8c2.7 0 5.2 1 7.2 2.5v-10.4L188 137s2.6 1.3 4.6 1.3h6.7v68c0 3.2-2.6 5.7-5.7 5.7h-19v-34h1.4a7.5 7.5 0 0 0 0-15H120a7.5 7.5 0 0 0 0 15h.7v34h-19.3a5.7 5.7 0 0 1-5.7-5.6v-68.1h6.7c2 0 4.6-1.3 4.6-1.3l13.7-12.7v10.4a11.7 11.7 0 0 1 16 1.6v-13a14.9 14.9 0 0 0-25-10.8s-.1.2-.1.2l-.5.5-6.9 7H92.5l55-53.2 55.1 53.2h-11.8l-7-7c0-.2-.2-.3-.4-.5l-.2-.2a14.8 14.8 0 0 0-25 10.9v12.9c2.2-2.5 5.3-4.1 8.9-4.1Zm91.7 36.7a4.9 4.9 0 1 1 0-9.7 4.9 4.9 0 0 1 0 9.7Z`})]})}var $t=(0,U.createContext)(null),en=(0,U.createContext)(null),Y=(0,U.createContext)(null);function tn({children:e}){let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(localStorage.getItem(G[`log-filter-level`])??`info`),[a,o]=(0,U.useState)(localStorage.getItem(G[`log-filter-search`])??`*`),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(1),{showSnackbarMessage:d,closeSnackbarMessage:f,closeSnackbar:p,showInstallProgress:m,hideInstallProgress:h,exitInstallProgressSuccess:g,exitInstallProgressError:_,addInstallProgress:v}=(0,U.useContext)($t),y=(0,U.useRef)([]),b=(0,U.useRef)(null),x=(0,U.useRef)(1),S=(0,U.useRef)(Math.floor(Math.random()*999e3)+1e3),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)(null),E=(0,U.useRef)(r),D=(0,U.useRef)(a),O=(0,U.useRef)(0),k=(0,U.useRef)(null),A=(0,U.useRef)(Number(localStorage.getItem(G[`log-length`])??200)),j=(0,U.useRef)(localStorage.getItem(G[`log-auto-scroll`])!==`false`),M=(0,U.useCallback)(e=>{A.current=e},[]),ee=(0,U.useCallback)(e=>{j.current=e},[]),N=(0,U.useMemo)(()=>window.location.href.replace(/^http/,`ws`),[]);(0,U.useEffect)(()=>(K&&console.log(`WebSocket started counter interval`),k.current=setInterval(()=>{O.current>0&&(K&&console.log(`WebSocket received ${O.current} messages in the last 10 seconds: ${O.current*6} messages/minute`),O.current=0)},1e4),()=>{K&&console.log(`WebSocket stopped counter interval`),k.current&&clearInterval(k.current),k.current=null}),[]),(0,U.useEffect)(()=>{E.current=r},[r]),(0,U.useEffect)(()=>{D.current=a},[a]);let te=(0,U.useCallback)(()=>Math.floor(Math.random()*999e3)+1e3,[]),P=(0,U.useCallback)((e,t)=>{K&&console.log(`WebSocket filterLogMessages called with level "${e}" and search "${t}"...`),n(n=>n.filter(n=>!([`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(n.level)&&(e===`info`&&n.level===`debug`||e===`notice`&&(n.level===`debug`||n.level===`info`)||e===`warn`&&(n.level===`debug`||n.level===`info`||n.level===`notice`)||e===`error`&&(n.level===`debug`||n.level===`info`||n.level===`notice`||n.level===`warn`)||e===`fatal`&&(n.level===`debug`||n.level===`info`||n.level===`notice`||n.level===`warn`||n.level===`error`))||t!==`*`&&t!==``&&!t.startsWith(`/`)&&!t.endsWith(`/`)&&!n.message.toLowerCase().includes(t.toLowerCase())&&!n.name.toLowerCase().includes(t.toLowerCase())||t.startsWith(`/`)&&t.endsWith(`/`)&&(()=>{try{let e=new RegExp(t.slice(1,-1),`i`);return!e.test(n.message)&&!e.test(n.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${t}":`,e),!1}})())))},[]),ne=(0,U.useCallback)(e=>{if(b.current&&b.current.readyState===WebSocket.OPEN)try{K&&console.log(`WebSocket sending message with id ${e.id}:`,e),e.id===void 0&&(e.id=S.current);let t=JSON.stringify(e);b.current.send(t),K&&console.log(`WebSocket sent message:`,e)}catch(e){K&&console.error(`WebSocket error sending message: ${String(e)}`)}else K&&console.error(`WebSocket message not sent, WebSocket not connected:`,e)},[]),F=(0,U.useCallback)((e,t)=>{n(n=>[...n,{level:e,time:``,name:``,message:t}])},[]),re=(0,U.useCallback)((e,t)=>{K&&console.log(`WebSocket addListener id ${t}:`,e),(t==null||Number.isNaN(t)||t===0)&&console.error(`WebSocket addListener called without id, listener not added:`,e),y.current=[...y.current,{listener:e,id:t}],K&&console.log(`WebSocket addListener total listeners:`,y.current.length)},[]),I=(0,U.useCallback)(e=>{K&&console.log(`WebSocket removeListener:`,e),y.current=y.current.filter(t=>t.listener!==e),K&&console.log(`WebSocket removeListener total listeners:`,y.current.length)},[]),ie=(0,U.useCallback)(()=>{N!==``&&N!=null&&(F(`WebSocket`,`Connecting ${Kt?`with password`:``} to WebSocket: ${N}`),K&&console.log(`WebSocket connecting to: ${N}${Kt?`?password=[redacted]`:``}`),b.current=new WebSocket(N+(Kt?`?password=${encodeURIComponent(Kt)}`:``)),b.current.onmessage=e=>{s||c(!0),O.current+=1;try{let t=JSON.parse(e.data);if(t.id===void 0||t.src===void 0||t.dst===void 0){K&&console.error(`WebSocket undefined message id/src/dst:`,t);return}if(t.src!==`Matterbridge`||t.dst!==`Frontend`){K&&console.error(`WebSocket invalid message src/dst:`,t);return}if(t.error){K&&console.error(`WebSocket error message response:`,t);return}if(t.id===S.current&&t.method===`pong`&&t.response===`pong`){K&&console.log(`WebSocket pong response message id ${t.id}:`,t),w.current&&clearTimeout(w.current),w.current=null;return}if(t.method===`snackbar`&&t.response?.message){K&&console.log(`WebSocket message id %s method %s:`,t.id,t.method,t),d(t.response.message,t.response.timeout,t.response.severity);return}if(t.method===`close_snackbar`&&t.response?.message){K&&console.log(`WebSocket message id %s method %s:`,t.id,t.method,t),f(t.response.message);return}if(t.method===`log`){if(!t.response?.level||!t.response.time||!t.response.name||!t.response.message||(t.response.level===`spawn`&&(t.response.name===`Matterbridge:spawn-init`?m(t.response.message,``,``):t.response.name===`Matterbridge:spawn-exit-success`?g():t.response.name===`Matterbridge:spawn-exit-error`?_():v(t.response.message+`
|
|
2
|
-
`)),[`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(t.response.level)&&(E.current===`info`&&t.response.level===`debug`||E.current===`notice`&&(t.response.level===`debug`||t.response.level===`info`)||E.current===`warn`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`)||E.current===`error`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`)||E.current===`fatal`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`||t.response.level===`error`)))||D.current!==`*`&&D.current!==``&&!D.current.startsWith(`/`)&&!D.current.endsWith(`/`)&&!t.response.message.toLowerCase().includes(D.current.toLowerCase())&&!t.response.name.toLowerCase().includes(D.current.toLowerCase())||D.current.startsWith(`/`)&&D.current.endsWith(`/`)&&(()=>{try{let e=new RegExp(D.current.slice(1,-1),`i`);return!e.test(t.response.message)&&!e.test(t.response.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${D.current}":`,e),!1}})()||t.response.name===`Commissioning`&&t.response.message.includes(`is uncommissioned`))return;n(e=>{let n=[...e,{level:t.response.level,time:t.response.time,name:t.response.name,message:t.response.message}];return K&&console.log(`WebSocket new log message added (${n.length}/${A.current}):`,n[n.length-1]),n.length>A.current+A.current*10/100?(K&&console.log(`WebSocket sliced log messages to the last ${A.current} entries`),n.slice(n.length-A.current)):n})}else{if(K&&console.log(`WebSocket received message id %s method %s:`,t.id,t.method,t),t.id===0)y.current.forEach(e=>e.listener(t));else{let e=y.current.find(e=>e.id===t.id);e?e.listener(t):K&&console.warn(`WebSocket no listener found for message id %s:`,t.id,t)}return}}catch(e){console.error(`WebSocket error parsing message: ${String(e)}`,e instanceof Error?e.stack:null)}},b.current.onopen=()=>{K&&console.log(`WebSocket: Connected to WebSocket: ${N}`),F(`WebSocket`,`Connected to WebSocket: ${N}`),c(!0),p(),x.current=1,u(1),T.current=setTimeout(()=>{C.current=setInterval(()=>{ne({id:S.current,method:`ping`,src:`Frontend`,dst:`Matterbridge`,params:{}}),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{K&&console.error(`WebSocketUse: No pong response received from WebSocket: ${N}`),F(`WebSocket`,`No pong response received from WebSocket: ${N}`),c(!1)},5e4)},6e4)},3e5)},b.current.onclose=()=>{K&&console.error(`WebSocket: Disconnected from WebSocket ${Jt?`with Ingress`:``}: ${N}`),F(`WebSocket`,`Disconnected from WebSocket: ${N}`),c(!1),p(),h(),T.current&&clearTimeout(T.current),w.current&&clearTimeout(w.current),C.current&&clearInterval(C.current),F(`WebSocket`,`Reconnecting (attempt ${x.current} of 100) to WebSocket${Jt?` (Ingress)`:``}: ${N}`),Jt?setTimeout(ae,5e3):x.current===1?ae():x.current<100?setTimeout(ae,1e3*x.current):F(`WebSocket`,`Reconnect attempts exceeded limit of 100 retries, refresh the page to reconnect to: ${N}`),x.current+=1,u(x.current)},b.current.onerror=e=>{K&&console.error(`WebSocket: WebSocket error connecting to %s:`,N,e),F(`WebSocket`,`WebSocket error connecting to ${N}`)})},[N]),ae=(0,U.useCallback)(()=>{K&&console.log(`WebSocket attemptReconnect ${x.current}/100 to:`,N),ie()},[ie]);(0,U.useEffect)(()=>(ie(),()=>{b.current&&b.current.readyState===WebSocket.OPEN&&b.current.close()}),[ie]);let oe=(0,U.useMemo)(()=>({messages:t,logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:ee,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:P}),[t,A,j,r,a,n,M,ee,i,o,P]),se=(0,U.useMemo)(()=>({logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:ee,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:P,online:s,retry:l,getUniqueId:te,addListener:re,removeListener:I,sendMessage:ne,logMessage:F}),[A,j,n,M,ee,i,o,s,l,re,I,ne,F]);return(0,J.jsx)(en.Provider,{value:oe,children:(0,J.jsx)(Y.Provider,{value:se,children:e})})}function nn(){let{retry:e}=(0,U.useContext)(Y);return(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100vw`,height:`100vh`,justifyContent:`center`,alignItems:`center`,fontSize:`20px`,color:`var(--main-text-color)`,backgroundColor:`var(--main-bg-color)`},children:[(0,J.jsx)(Qt,{style:{height:`128px`,width:`128px`,margin:`10px`,marginBottom:`20px`}}),e<100?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Se,{style:{color:`var(--primary-color)`}}),(0,J.jsx)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:(0,J.jsxs)(`span`,{children:[`Reconnecting to Matterbridge `,`(attempt `+e+`)`,`...`]})})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:[(0,J.jsx)(`span`,{children:`Unable to connect to Matterbridge after multiple attempts.`}),(0,J.jsx)(`br`,{}),(0,J.jsx)(`span`,{children:`Please check your network connection.`}),(0,J.jsx)(`br`,{})]}),(0,J.jsx)(M,{variant:`contained`,color:`primary`,onClick:()=>{window.location.reload()},style:{marginTop:`20px`},children:`Refresh the Page`})]})]})}var X=Tt();function Z({children:e,style:t}){return(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:`0 0 auto`,width:`100%`,overflow:`hidden`,margin:`0px`,padding:`0px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,boxShadow:`5px 5px 10px var(--div-shadow-color)`,border:`1px solid var(--table-border-color)`,borderRadius:`var(--div-border-radius)`,boxSizing:`border-box`,...t},children:e})}function rn({children:e,style:t}){return(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,borderBottom:`1px solid var(--table-border-color)`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function Q({children:e,style:t}){return(0,J.jsx)(`div`,{style:{color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,fontSize:`16px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function an({children:e,style:t}){return(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function on({children:e,style:t}){return(0,J.jsx)(`div`,{style:{color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,fontSize:`14px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function sn({children:e,style:t}){return(0,J.jsx)(`div`,{style:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,fontSize:`14px`,fontWeight:`normal`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function cn({children:e,style:t,onDragOver:n,onDragLeave:r,onDrop:i}){return(0,J.jsx)(`div`,{style:{flex:`0 0 auto`,display:`flex`,flexDirection:`row`,overflow:`hidden`,alignItems:`start`,justifyContent:`space-between`,margin:`0px`,padding:`10px`,gap:`20px`,...t},onDragOver:n,onDragLeave:r,onDrop:i,children:e})}function ln({children:e,style:t,close:n}){return(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,margin:`0px`,padding:`0px`,paddingRight:`10px`,gap:`10px`,...t},children:[e,!1]})}var un=[`Off`,`Low`,`Medium`,`High`,`On`,`Auto`,`Smart`],dn={display:`flex`,gap:`2px`,justifyContent:`space-evenly`,width:`100%`,height:`40px`},fn={margin:`0`,padding:`0`,fontSize:`36px`,fontWeight:`medium`,color:`var(--primary-color)`},pn={margin:`0`,padding:`0`,fontSize:`20px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},mn={margin:`0`,padding:`0`,paddingBottom:`2px`,fontSize:`16px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},hn={display:`flex`,gap:`2px`,justifyContent:`center`,width:`100%`,height:`18px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},gn={margin:`0`,padding:`0`,fontSize:`12px`,fontWeight:`normal`,color:`var(--div-text-color)`},_n={display:`flex`,justifyContent:`center`,width:`100%`,height:`52px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},vn={margin:`0`,padding:`0`,fontSize:`14px`,fontWeight:`bold`,color:`var(--div-text-color)`},yn={display:`flex`,gap:`4px`,justifyContent:`center`,width:`100%`,height:`15px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},bn={margin:`0`,padding:`0px 4px`,borderRadius:`5px`,textAlign:`center`,fontSize:`12px`,fontWeight:`normal`,color:`var(--secondary-color)`},xn=[256,257,268,269],Sn=[266,267],Cn=[271,272],wn=[256,257,268,269,266,267,272],Tn=[43,45],En=[`Closed`,`Open`,`Partial`,`Pedestrian`,`Ventilation`,`Signature`];function Dn(e){if(typeof e!=`object`||!e||!(`position`in e))return`N/A`;let t=e.position;return typeof t!=`number`||!Number.isInteger(t)||t<0||t>=En.length?`N/A`:En[t]}function On(e){return typeof e!=`number`||!Number.isInteger(e)||e<0||e>1e4?`N/A`:e===0?En[0]:e===1e4?En[1]:En[2]}function kn(e){return typeof e!=`object`||!e||!(`position`in e)?`N/A`:On(e.position)}function $({icon:e,iconColor:t,cluster:n,value:r,unit:i,prefix:a}){return K&&console.log(`Render cluster "${n.clusterName}.${n.attributeName}" value(${typeof r}-${Number.isNaN(r)}) "${r}" unit "${i}"`),a??=!1,(0,J.jsxs)(V,{sx:dn,children:[e&&(0,U.cloneElement)(e,{key:`${n.clusterId}-${n.attributeId}-icon`,sx:{...fn,color:t??`var(--primary-color)`}}),(0,J.jsxs)(V,{sx:{...dn,gap:`4px`,alignContent:`center`,alignItems:`end`,justifyContent:`center`},children:[i&&a&&(0,J.jsx)(A,{sx:mn,children:i},`${n.clusterId}-${n.attributeId}-unit-prefix`),(0,J.jsx)(A,{sx:pn,children:r==null||typeof r==`number`&&Number.isNaN(r)||r===`NaN`?`---`:r},`${n.clusterId}-${n.attributeId}-value`),i&&!a&&(0,J.jsx)(A,{sx:mn,children:i},`${n.clusterId}-${n.attributeId}-unit-suffix`)]},`${n.clusterId}-${n.attributeId}-valueunitbox`)]},`${n.clusterId}-${n.attributeId}-box`)}function An({device:e,endpoint:t,id:n,deviceType:r,clusters:i}){let a=[`Unknown`,`Good`,`Fair`,`Moderate`,`Poor`,`VeryPoor`,`Ext.Poor`],o=``,s=e=>{if(!e)return null;let t=e.attributeLocalValue;if(!t||typeof t!=`object`||!(`energy`in t))return null;let n=t.energy;return typeof n!=`number`&&typeof n!=`bigint`?null:Math.round(Number(n)/1e6)},c=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyImported`),u=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyExported`),d=s(c),f=s(u),p=c??u,m=d??(f===null?null:`+ ${f}`);K&&console.log(`Device "${e.deviceName}" endpoint "${t}" id "${n}" deviceType "0x${r.toString(16).padStart(4,`0`)}" clusters (${i?.length})`);let h=i.find(e=>e.clusterName===`Descriptor`&&e.attributeName===`tagList`)?.attributeLocalValue;if(h){let e=``;h.map(t=>{t.label&&(e+=t.label+` `)}),o=e.trim()}if(r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batVoltage`).map(e=>o=`${e.attributeLocalValue??0} mV`),wn.includes(r)&&i.filter(e=>e.clusterName===`LevelControl`&&e.attributeName===`currentLevel`).map(e=>o=`Level ${e.attributeValue}`),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>o=`Position ${e.attributeLocalValue/100}%`),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedHeatingSetpoint`).map(e=>o=`Heat ${e.attributeLocalValue/100}°C `),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedCoolingSetpoint`).map(e=>o+=`Cool ${e.attributeLocalValue/100}°C`),Tn.includes(r)&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`percentCurrent`).map(e=>o=`Speed ${e.attributeValue}%`),r===118&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>o=e.attributeLocalValue===0?`No CO detected`:`CO alarm!`),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`voltage`).map(e=>o=`${e.attributeLocalValue/1e3} V, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activeCurrent`).map(e=>o+=`${e.attributeLocalValue/1e3} A, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activePower`).map(e=>o+=`${e.attributeLocalValue/1e6} kW`),r===39){let e=i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}if(r===116){let e=i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}return(0,J.jsxs)(Z,{style:{margin:`0px`,padding:`5px`,width:`150px`,height:`150px`,borderColor:`var(--div-bg-color)`,borderRadius:`5px`,justifyContent:`space-between`},children:[r===19&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:e.attributeLocalValue===!0?(0,J.jsx)(C,{}):(0,J.jsx)(_e,{}),iconColor:e.attributeLocalValue===!0?`green`:`red`,cluster:e,value:e.attributeLocalValue===!0?`Online`:`Offline`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batPercentRemaining`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ye,{}),cluster:e,value:e.attributeLocalValue/2,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`wiredCurrentType`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(qe,{}),cluster:e,value:e.attributeLocalValue===0?`AC`:`DC`},`${e.clusterId}-${e.attributeId}`)),r===1293&&i.filter(e=>e.clusterName===`DeviceEnergyManagement`&&e.attributeName===`esaState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Offline`:`Online`},`${e.clusterId}-${e.attributeId}`)),xn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),Sn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M7.5,10.5A1.5,1.5 0 0,1 9,12A1.5,1.5 0 0,1 7.5,13.5C6.66,13.5 6,12.83 6,12A1.5,1.5 0 0,1 7.5,10.5M16.5,10.5A1.5,1.5 0 0,1 18,12A1.5,1.5 0 0,1 16.5,13.5A1.5,1.5 0 0,1 15,12A1.5,1.5 0 0,1 16.5,10.5M4.22,2H19.78C21,2 22,3 22,4.22V19.78A2.22,2.22 0 0,1 19.78,22H4.22C3,22 2,21 2,19.78V4.22A2.22,2.22 0 0,1 4.22,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),Cn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===259&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===260&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===261&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===2112&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===115&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M14.83,11.17C16.39,12.73 16.39,15.27 14.83,16.83C13.27,18.39 10.73,18.39 9.17,16.83L14.83,11.17M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===124&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8M8.11,10.5H10C9.76,11.88 10,12.67 10.58,13.29C11.68,14.36 12.16,15.71 11.89,17.5H10C10.24,16.12 10,15.33 9.42,14.71C8.32,13.64 7.85,12.29 8.11,10.5M12.11,10.5H14C13.76,11.88 14,12.67 14.58,13.29C15.68,14.36 16.16,15.71 15.89,17.5H14C14.24,16.12 14,15.33 13.42,14.71C12.32,13.64 11.85,12.29 12.11,10.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===117&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M18,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V4A2,2 0 0,0 18,2M10,4A1,1 0 0,1 11,5A1,1 0 0,1 10,6A1,1 0 0,1 9,5A1,1 0 0,1 10,4M7,4A1,1 0 0,1 8,5A1,1 0 0,1 7,6A1,1 0 0,1 6,5A1,1 0 0,1 7,4M18,20H6V8H18V20M14.67,15.33C14.69,16.03 14.41,16.71 13.91,17.21C12.86,18.26 11.15,18.27 10.09,17.21C9.59,16.71 9.31,16.03 9.33,15.33C9.4,14.62 9.63,13.94 10,13.33C10.37,12.5 10.81,11.73 11.33,11L12,10C13.79,12.59 14.67,14.36 14.67,15.33`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===123&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(l,{}),cluster:e,value:`Oven`},`${e.clusterId}-${e.attributeId}`)),r===112&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ee,{}),cluster:e,value:`Fridge`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`temperatureSetpoint`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===121&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(l,{}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===122&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M19,18.31V20A2,2 0 0,1 17,22H7A2,2 0 0,1 5,20V16.3C4.54,16.12 3.95,16 3,16A1,1 0 0,1 2,15A1,1 0 0,1 3,14C3.82,14 4.47,14.08 5,14.21V12.3C4.54,12.12 3.95,12 3,12A1,1 0 0,1 2,11A1,1 0 0,1 3,10C3.82,10 4.47,10.08 5,10.21V8.3C4.54,8.12 3.95,8 3,8A1,1 0 0,1 2,7A1,1 0 0,1 3,6C3.82,6 4.47,6.08 5,6.21V4A2,2 0 0,1 7,2H17A2,2 0 0,1 19,4V6.16C20.78,6.47 21.54,7.13 21.71,7.29C22.1,7.68 22.1,8.32 21.71,8.71C21.32,9.1 20.8,9.09 20.29,8.71V8.71C20.29,8.71 19.25,8 17,8C15.74,8 14.91,8.41 13.95,8.9C12.91,9.41 11.74,10 10,10C9.64,10 9.31,10 9,9.96V7.95C9.3,8 9.63,8 10,8C11.26,8 12.09,7.59 13.05,7.11C14.09,6.59 15.27,6 17,6V4H7V20H17V18C18.5,18 18.97,18.29 19,18.31M17,10C15.27,10 14.09,10.59 13.05,11.11C12.09,11.59 11.26,12 10,12C9.63,12 9.3,12 9,11.95V13.96C9.31,14 9.64,14 10,14C11.74,14 12.91,13.41 13.95,12.9C14.91,12.42 15.74,12 17,12C19.25,12 20.29,12.71 20.29,12.71V12.71C20.8,13.1 21.32,13.1 21.71,12.71C22.1,12.32 22.1,11.69 21.71,11.29C21.5,11.08 20.25,10 17,10M17,14C15.27,14 14.09,14.59 13.05,15.11C12.09,15.59 11.26,16 10,16C9.63,16 9.3,16 9,15.95V17.96C9.31,18 9.64,18 10,18C11.74,18 12.91,17.41 13.95,16.9C14.91,16.42 15.74,16 17,16C19.25,16 20.29,16.71 20.29,16.71V16.71C20.8,17.1 21.32,17.1 21.71,16.71C22.1,16.32 22.1,15.69 21.71,15.29C21.5,15.08 20.25,14 17,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===120&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Cooktop`},`${e.clusterId}-${e.attributeId}`)),r===119&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:On(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===515&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===560&&i.filter(e=>e.clusterName===`ClosureControl`&&e.attributeName===`overallCurrentState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:Dn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===574&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===561&&i.filter(e=>e.clusterName===`ClosureDimension`&&e.attributeName===`currentState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:kn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===778&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===10&&i.filter(e=>e.clusterName===`DoorLock`&&e.attributeName===`lockState`).map(e=>(0,J.jsx)($,{icon:e.attributeValue===`1`?(0,J.jsx)(Ze,{}):(0,J.jsx)(ct,{}),cluster:e,value:e.attributeValue===`1`?`Locked`:`Unlocked`},`${e.clusterId}-${e.attributeId}`)),r===11&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ze,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===43&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Be,{}),cluster:e,value:un[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===15&&i.filter(e=>e.clusterName===`Switch`&&e.attributeName===`currentPosition`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M13 5C15.21 5 17 6.79 17 9C17 10.5 16.2 11.77 15 12.46V11.24C15.61 10.69 16 9.89 16 9C16 7.34 14.66 6 13 6S10 7.34 10 9C10 9.89 10.39 10.69 11 11.24V12.46C9.8 11.77 9 10.5 9 9C9 6.79 10.79 5 13 5M20 20.5C19.97 21.32 19.32 21.97 18.5 22H13C12.62 22 12.26 21.85 12 21.57L8 17.37L8.74 16.6C8.93 16.39 9.2 16.28 9.5 16.28H9.7L12 18V9C12 8.45 12.45 8 13 8S14 8.45 14 9V13.47L15.21 13.6L19.15 15.79C19.68 16.03 20 16.56 20 17.14V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.11 2.9 14 4 14H8V12L4 12L4 4H20L20 12H18V14H20V13.96L20.04 14C21.13 14 22 13.09 22 12V4C22 2.9 21.11 2 20 2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`pos`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===39&&i.filter(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ie,{}),cluster:e,value:e.attributeValue,unit:`Mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===771&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Me,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===772&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Me,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===45&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)($e,{}),cluster:e,value:un[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===114&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)($e,{}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===67&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(j,{}),cluster:e,value:e.attributeLocalValue===!0?`Leak`:`No leak`},`${e.clusterId}-${e.attributeId}`)),r===65&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Re,{}),cluster:e,value:e.attributeLocalValue===!0?`Freeze`:`No freeze`},`${e.clusterId}-${e.attributeId}`)),r===68&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(k,{}),cluster:e,value:e.attributeLocalValue===!0?`Rain`:`No rain`},`${e.clusterId}-${e.attributeId}`)),r===116&&i.filter(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12,2C14.65,2 17.19,3.06 19.07,4.93L17.65,6.35C16.15,4.85 14.12,4 12,4C9.88,4 7.84,4.84 6.35,6.35L4.93,4.93C6.81,3.06 9.35,2 12,2M3.66,6.5L5.11,7.94C4.39,9.17 4,10.57 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,10.57 19.61,9.17 18.88,7.94L20.34,6.5C21.42,8.12 22,10.04 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12C2,10.04 2.58,8.12 3.66,6.5M12,6A6,6 0 0,1 18,12C18,13.59 17.37,15.12 16.24,16.24L14.83,14.83C14.08,15.58 13.06,16 12,16C10.94,16 9.92,15.58 9.17,14.83L7.76,16.24C6.63,15.12 6,13.59 6,12A6,6 0 0,1 12,6M12,8A1,1 0 0,0 11,9A1,1 0 0,0 12,10A1,1 0 0,0 13,9A1,1 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`Run mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===1292&&i.filter(e=>e.clusterName===`EnergyEvse`&&e.attributeName===`state`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M19.77,7.23L19.78,7.22L16.06,3.5L15,4.56L17.11,6.67C16.17,7.03 15.5,7.93 15.5,9A2.5,2.5 0 0,0 18,11.5C18.36,11.5 18.69,11.42 19,11.29V18.5A1,1 0 0,1 18,19.5A1,1 0 0,1 17,18.5V14A2,2 0 0,0 15,12H14V5A2,2 0 0,0 12,3H6A2,2 0 0,0 4,5V21H14V13.5H15.5V18.5A2.5,2.5 0 0,0 18,21A2.5,2.5 0 0,0 20.5,18.5V9C20.5,8.31 20.22,7.68 19.77,7.23M18,10A1,1 0 0,1 17,9A1,1 0 0,1 18,8A1,1 0 0,1 19,9A1,1 0 0,1 18,10M8,18V13.5H6L10,6V11H12L8,18Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Free`:`In use`},`${e.clusterId}-${e.attributeId}`)),r===1295&&i.filter(e=>e.clusterName===`WaterHeaterManagement`&&e.attributeName===`tankPercentage`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 2C6.89 2 6 2.89 6 4V16C6 17.11 6.89 18 8 18H9V20H6V22H9C10.11 22 11 21.11 11 20V18H13V20C13 21.11 13.89 22 15 22H18V20H15V18H16C17.11 18 18 17.11 18 16V4C18 2.89 17.11 2 16 2H8M12 4.97A2 2 0 0 1 14 6.97A2 2 0 0 1 12 8.97A2 2 0 0 1 10 6.97A2 2 0 0 1 12 4.97M10 14.5H14V16H10V14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tank `+(e.attributeLocalValue??0)+`%`},`${e.clusterId}-${e.attributeId}`)),r===1297&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Utility`},`${e.clusterId}-${e.attributeId}`)),r===1298&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Reference`},`${e.clusterId}-${e.attributeId}`)),r===1299&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tariff`},`${e.clusterId}-${e.attributeId}`)),r===1300&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Meter`},`${e.clusterId}-${e.attributeId}`)),r===777&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M12.75 7.08C13.57 7.2 14.32 7.5 14.95 8L12.75 10.19V7.08M11.25 7.08V10.19L9.05 8C9.68 7.5 10.43 7.2 11.25 7.08M8 9.05L10.19 11.25H7.08C7.2 10.43 7.5 9.68 8 9.05M7.08 12.75H10.19L8 14.95C7.5 14.32 7.2 13.57 7.08 12.75M11.25 16.92C10.43 16.8 9.68 16.5 9.05 16L11.25 13.81V16.92M12 13C11.45 13 11 12.55 11 12S11.45 11 12 11 13 11.45 13 12 12.55 13 12 13M12.75 16.92V13.81L14.95 16C14.32 16.5 13.57 16.8 12.75 16.92M16 14.95L13.81 12.75H16.92C16.8 13.57 16.5 14.32 16 14.95M13.81 11.25L16 9.05C16.5 9.69 16.8 10.44 16.92 11.25H13.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`HeatPump`},`${e.clusterId}-${e.attributeId}`)),r===23&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M4,2H20A2,2 0 0,1 22,4V14A2,2 0 0,1 20,16H15V20H18V22H13V16H11V22H6V20H9V16H4A2,2 0 0,1 2,14V4A2,2 0 0,1 4,2M4,4V8H11V4H4M4,14H11V10H4V14M20,14V10H13V14H20M20,4H13V8H20V4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Solar`},`${e.clusterId}-${e.attributeId}`)),r===24&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`featureMap`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12 20L5 20V12H2L12 3L14.78 5.5H14V7.17C12.84 7.58 12 8.7 12 10V20M15 9H16V7.5H20V9H21C21.55 9 22 9.45 22 10V21C22 21.55 21.55 22 21 22H15C14.45 22 14 21.55 14 21V10C14 9.45 14.45 9 15 9M16 11V14H20V11H16Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Inverter`},`${e.clusterId}-${e.attributeId}`)),r===40&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===35&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===34&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===41&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===42&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===36&&i.filter(e=>e.clusterName===`ApplicationBasic`&&e.attributeName===`applicationName`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`App`},`${e.clusterId}-${e.attributeId}`)),r===14&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M10,2C8.89,2 8,2.89 8,4V7C8,8.11 8.89,9 10,9H11V11H2V13H6V15H5C3.89,15 3,15.89 3,17V20C3,21.11 3.89,22 5,22H9C10.11,22 11,21.11 11,20V17C11,15.89 10.11,15 9,15H8V13H16V15H15C13.89,15 13,15.89 13,17V20C13,21.11 13.89,22 15,22H19C20.11,22 21,21.11 21,20V17C21,15.89 20.11,15 19,15H18V13H22V11H13V9H14C15.11,9 16,8.11 16,7V4C16,2.89 15.11,2 14,2H10M10,4H14V7H10V4M5,17H9V20H5V17M15,17H19V20H15V17Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Aggregator`},`${e.clusterId}-${e.attributeId}`)),r===322&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Camera`},`${e.clusterId}-${e.attributeId}`)),r===324&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Floodlight`},`${e.clusterId}-${e.attributeId}`)),r===323&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Video bell`},`${e.clusterId}-${e.attributeId}`)),r===320&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Intercom`},`${e.clusterId}-${e.attributeId}`)),r===325&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Snapshot`},`${e.clusterId}-${e.attributeId}`)),r===327&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===326&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(oe,{}),cluster:e,value:`Chime`},`${e.clusterId}-${e.attributeId}`)),r===328&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(oe,{}),cluster:e,value:`Doorbell`},`${e.clusterId}-${e.attributeId}`)),r===321&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(oe,{}),cluster:e,value:`Audio bell`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!0)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`smokeState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No smoke`:`Smoke!`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!1)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No Co`:`Co!`},`${e.clusterId}-${e.attributeId}`)),r===66&&i.filter(e=>e.clusterName===`ValveConfigurationAndControl`&&e.attributeName===`currentState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M4 22H2V2H4M22 2H20V22H22M17.24 5.34L13.24 9.34A3 3 0 0 0 9.24 13.34L5.24 17.34L6.66 18.76L10.66 14.76A3 3 0 0 0 14.66 10.76L18.66 6.76Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===64&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M10 10H14V22H10V10M7 9H9V7H7V9M4 8H6V6H4V8M4 11H6V9H4V11M1 13H3V11H1V13M1 7H3V5H1V7M1 10H3V8H1V10M18 11H20V9H18V11M21 10H23V8H21V10M21 5V7H23V5H21M21 13H23V11H21V13M15 9H17V7H15V9M18 8H20V6H18V8M10 7H10.33L11 9H13L13.67 7H14V6H10V7Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Irrigation`},`${e.clusterId}-${e.attributeId}`)),r===44&&i.filter(e=>e.clusterName===`AirQuality`&&e.attributeName===`airQuality`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M11,9A4,4 0 0,1 15,13A4,4 0 0,1 11,17A4,4 0 0,1 7,13A4,4 0 0,1 11,9M11,11A2,2 0 0,0 9,13A2,2 0 0,0 11,15A2,2 0 0,0 13,13A2,2 0 0,0 11,11M7,4H14A4,4 0 0,1 18,8V9H16V8A2,2 0 0,0 14,6H7A2,2 0 0,0 5,8V20H16V18H18V22H3V8A4,4 0 0,1 7,4M16,11C18.5,11 18.5,9 21,9V11C18.5,11 18.5,13 16,13V11M16,15C18.5,15 18.5,13 21,13V15C18.5,15 18.5,17 16,17V15Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:a[e.attributeLocalValue??0]},`${e.clusterId}-${e.attributeId}`)),r===770&&i.filter(e=>e.clusterName===`TemperatureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(ye,{}),cluster:e,value:e.attributeLocalValue/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===775&&i.filter(e=>e.clusterName===`RelativeHumidityMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue/100,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===69&&i.filter(e=>e.clusterName===`SoilMeasurement`&&e.attributeName===`soilMoistureMeasuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===774&&i.filter(e=>e.clusterName===`FlowMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(ot,{}),cluster:e,value:e.attributeLocalValue/10,unit:`m³/h`},`${e.clusterId}-${e.attributeId}`)),r===773&&i.filter(e=>e.clusterName===`PressureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ae,{}),cluster:e,value:e.attributeLocalValue,unit:`hPa`},`${e.clusterId}-${e.attributeId}`)),r===21&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:e.attributeValue===`true`?(0,J.jsx)(ut,{}):(0,J.jsx)(Pe,{}),cluster:e,value:e.attributeValue===`true`?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===263&&i.filter(e=>e.clusterName===`OccupancySensing`&&e.attributeName===`occupancy`).map(e=>(0,J.jsx)($,{icon:e.attributeValue===`{ occupied: true }`?(0,J.jsx)(xe,{}):(0,J.jsx)(ve,{}),cluster:e,value:e.attributeValue===`{ occupied: true }`?`Occupied`:`Unocc.`},`${e.clusterId}-${e.attributeId}`)),r===262&&i.filter(e=>e.clusterName===`IlluminanceMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(it,{}),cluster:e,value:Math.round(10**(e.attributeLocalValue/1e4)),unit:`lx`},`${e.clusterId}-${e.attributeId}`)),r===2128&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`---`},`${e.clusterId}-${e.attributeId}`)),r===1296&&p&&(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:p,value:m,unit:`kWh`},`${p.clusterId}-${p.attributeId}`),(0,J.jsx)(V,{sx:hn,children:(0,J.jsx)(A,{sx:gn,children:o})}),(0,J.jsx)(V,{sx:_n,children:(0,J.jsx)(A,{sx:vn,children:e.deviceName})}),(0,J.jsxs)(V,{sx:yn,children:[K&&(0,J.jsx)(A,{sx:bn,children:t}),(0,J.jsx)(A,{sx:bn,children:n}),K&&(0,J.jsxs)(A,{sx:bn,children:[`0x`,r.toString(16).padStart(4,`0`)]})]})]})}var jn=(0,U.memo)(An);function Mn({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)({}),[d,f]=(0,U.useState)({}),p=(0,U.useRef)(o()),m=(0,U.useRef)(s);(0,U.useEffect)(()=>{m.current=s},[s]);let h=(0,U.useRef)(d);(0,U.useEffect)(()=>{h.current=d},[d]);let g=(0,U.useCallback)(e=>{K&&console.log(`DevicesIcons received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=m.current,n=h.current,r=t.find(t=>t.plugin===e.response.plugin&&t.serialNumber===e.response.serialNumber);if(!r){K&&console.warn(`DevicesIcons updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" number "${e.response.number}" id "${e.response.id}" not found in devices(${t.length})`);return}let i=n[r.serialNumber]?.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);i?(i.attributeValue=String(e.response.value),i.attributeLocalValue=e.response.value,f(e=>({...e})),K&&console.log(`DevicesIcons updated "${i.clusterName}.${i.attributeName}" for device "${r.deviceName}" serial "${r.serialNumber}" to "${i.attributeValue}"`)):K&&console.warn(`DevicesIcons updater device "${r.deviceName}" serial "${r.serialNumber}" cluster "${e.response.cluster}" attribute "${e.response.attribute}" not found in clusters(${n[r.serialNumber]?.length})`)},[]),_=(0,U.useCallback)(e=>{if(K&&console.log(`DevicesIcons received for device "${e.response.deviceName}" serial "${e.response.serialNumber}" deviceTypes (${e.response.deviceTypes.length}) "${e.response.deviceTypes.join(`,`)}" clusters (${e.response.clusters.length}):`,e.response),e.response.clusters.length===0)return;let t=e.response.serialNumber,n=[],r=[];for(let t of e.response.clusters)n.find(e=>e.endpoint===t.endpoint)||n.push({endpoint:t.endpoint,id:t.id,deviceTypes:t.deviceTypes}),![`FixedLabel`,`Identify`,`Groups`,`ScenesManagement`,`PowerTopology`].includes(t.clusterName)&&r.push(t);u(e=>({...e,[t]:n})),f(e=>({...e,[t]:r})),K&&console.log(`DevicesIcons endpoints for "${t}":`,n),K&&console.log(`DevicesIcons deviceTypes for "${t}":`,e.response.deviceTypes),K&&console.log(`DevicesIcons clusters for "${t}":`,r)},[]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`)K&&console.log(`DevicesIcons received refresh_required: changed=${e.response.changed} and sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}});else if(e.method===`state_update`&&e.response)g(e);else if(e.method===`/api/devices`&&e.response){K&&console.log(`DevicesIcons received ${e.response.length} devices:`,e.response),c(e.response),u({}),f({});for(let t of e.response)K&&console.log(`DevicesIcons sending /api/clusters`),r({id:p.current,sender:`DevicesIcons`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{pluginName:t.plugin,number:t.number||0,serialNumber:t.serialNumber,uniqueId:t.uniqueId}})}else e.method===`/api/clusters`&&e.response&&_(e)};return i(e,p.current),K&&console.log(`DevicesIcons WebSocket effect mounted`),()=>{a(e),K&&console.log(`DevicesIcons WebSocket effect unmounted`)}},[i,_,a,r,g]),(0,U.useEffect)(()=>(K&&console.log(`DevicesIcons useEffect online mounting`),n&&(K&&console.log(`DevicesIcons useEffect online sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}})),K&&console.log(`DevicesIcons useEffect online mounted`),()=>{K&&console.log(`DevicesIcons useEffect online unmounted`)}),[n,r]);let v=e?.trim().toLowerCase(),y=v&&v!==`all plugins`;return K&&console.log(`DevicesIcons rendering...`),(0,J.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,paddingBottom:`5px`,gap:`20px`,width:`100%`,overflow:`auto`},children:s.filter(e=>y&&e.plugin.toLowerCase()!==v?!1:t===``||e.deviceName.toLowerCase().includes(t.toLowerCase())||e.serialNumber.toLowerCase().includes(t.toLowerCase())).map(e=>l[e.serialNumber]&&l[e.serialNumber].map(t=>t.deviceTypes.map(n=>(0,J.jsx)(jn,{device:e,endpoint:t.endpoint,id:t.id,deviceType:n,clusters:(d[e.serialNumber]??[]).filter(e=>e.endpoint===t.endpoint)},`${e.plugin}-${e.uniqueId}-${t.endpoint}-${t.id}-${n.toString()}`))))})}var Nn=(0,U.memo)(Mn),Pn=e=>`0x${e.toString(16).padStart(4,`0`)}`,Fn=e=>`ep:${e}`,In=(e,t)=>`cl:${e}::${t}`,Ln=(e,t,n)=>`at:${e}::${t}::${n}`;function Rn(e){let t=new Map;for(let n of e){let e=t.get(n.endpoint);e||(e={endpoint:n.endpoint,id:n.id,deviceTypes:n.deviceTypes,clusters:[]},t.set(n.endpoint,e));let r=e.clusters.find(e=>e.name===n.clusterName);r||(r={name:n.clusterName,id:n.clusterId,attributes:[]},e.clusters.push(r)),r.attributes.push(n)}return[...t.values()]}var zn=(e,t)=>({display:`flex`,alignItems:`center`,gap:`4px`,padding:`2px 8px 2px ${8+t*16}px`,cursor:`pointer`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`14px`,backgroundColor:e?`var(--table-selected-bg-color)`:`transparent`}),Bn={color:`var(--secondary-color)`,paddingRight:`16px`,verticalAlign:`top`,whiteSpace:`nowrap`};function Vn({label:e,children:t}){return(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{style:Bn,children:e}),(0,J.jsx)(`td`,{style:{wordBreak:`break-all`},children:t})]})}function Hn({node:e}){if(!e)return(0,J.jsx)(`div`,{style:{padding:`10px`,color:`var(--secondary-color)`},children:`Select a node in the tree to see its details.`});if(e.kind===`endpoint`)return(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`h3`,{style:{margin:`0 0 8px 0`},children:[`Endpoint `,e.group.endpoint]}),(0,J.jsx)(`table`,{children:(0,J.jsxs)(`tbody`,{children:[(0,J.jsx)(Vn,{label:`Id`,children:e.group.id}),(0,J.jsx)(Vn,{label:`Device types`,children:e.group.deviceTypes.map(Pn).join(`, `)}),(0,J.jsx)(Vn,{label:`Clusters`,children:e.group.clusters.length})]})})]});if(e.kind===`cluster`)return(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`h3`,{style:{margin:`0 0 8px 0`},children:[`Cluster `,e.cluster.name]}),(0,J.jsx)(`table`,{style:{marginBottom:`12px`},children:(0,J.jsxs)(`tbody`,{children:[(0,J.jsx)(Vn,{label:`Endpoint`,children:e.group.endpoint}),(0,J.jsx)(Vn,{label:`Cluster ID`,children:e.cluster.id})]})}),(0,J.jsxs)(`table`,{style:{borderCollapse:`collapse`,width:`100%`},children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{style:{...Bn,color:`var(--primary-color)`,textAlign:`left`},children:`Attribute`}),(0,J.jsx)(`th`,{style:{...Bn,color:`var(--primary-color)`,textAlign:`left`},children:`ID`}),(0,J.jsx)(`th`,{style:{...Bn,color:`var(--primary-color)`,textAlign:`left`},children:`Value`})]})}),(0,J.jsx)(`tbody`,{children:e.cluster.attributes.map(e=>(0,J.jsxs)(`tr`,{style:{borderTop:`1px solid var(--table-border-color)`},children:[(0,J.jsx)(`td`,{children:e.attributeName}),(0,J.jsx)(`td`,{children:e.attributeId}),(0,J.jsx)(`td`,{style:{wordBreak:`break-all`},children:e.attributeValue})]},e.attributeName))})]})]});let{attribute:t}=e;return(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`h3`,{style:{margin:`0 0 8px 0`},children:[`Attribute `,t.attributeName]}),(0,J.jsx)(`table`,{style:{marginBottom:`12px`},children:(0,J.jsxs)(`tbody`,{children:[(0,J.jsx)(Vn,{label:`Path`,children:`Endpoint ${e.group.endpoint} › ${e.cluster.name} › ${t.attributeName}`}),(0,J.jsx)(Vn,{label:`Cluster ID`,children:t.clusterId}),(0,J.jsx)(Vn,{label:`Attribute ID`,children:t.attributeId}),(0,J.jsx)(Vn,{label:`Device types`,children:e.group.deviceTypes.map(Pn).join(`, `)})]})}),(0,J.jsx)(`div`,{style:{fontWeight:`bold`},children:`Value`}),(0,J.jsx)(`pre`,{style:{margin:`4px 0 0 0`,padding:`8px`,border:`1px solid var(--table-border-color)`,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:JSON.stringify(t.attributeLocalValue,(e,t)=>typeof t==`bigint`?t.toString():t,2)??`undefined`})]})}function Un({clusters:e}){let[t,n]=(0,U.useState)(new Set),r=e=>e.startsWith(`ep:`)!==t.has(e),[i,a]=(0,U.useState)(null),o=(0,U.useMemo)(()=>Rn(e),[e]),s=(0,U.useMemo)(()=>{let e=new Map;for(let t of o){e.set(Fn(t.endpoint),{kind:`endpoint`,key:Fn(t.endpoint),group:t});for(let n of t.clusters){let r=In(t.endpoint,n.name);e.set(r,{kind:`cluster`,key:r,group:t,cluster:n});for(let r of n.attributes){let i=Ln(t.endpoint,n.name,r.attributeName);e.set(i,{kind:`attribute`,key:i,group:t,cluster:n,attribute:r})}}}return e},[o]),c=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=e=>{a(e),c(e)},u=(()=>{let e=[];return o.forEach((t,n)=>{let i=Fn(t.endpoint);e.push({key:i,depth:0,label:`Endpoint ${t.endpoint}`,expandable:!0,parent:null,posinset:n+1,setsize:o.length}),r(i)&&t.clusters.forEach((n,a)=>{let o=In(t.endpoint,n.name);e.push({key:o,depth:1,label:n.name,expandable:!0,parent:i,posinset:a+1,setsize:t.clusters.length}),r(o)&&n.attributes.forEach((r,i)=>e.push({key:Ln(t.endpoint,n.name,r.attributeName),depth:2,label:r.attributeName,expandable:!1,parent:o,posinset:i+1,setsize:n.attributes.length}))})}),e})(),[d,f]=(0,U.useState)(null),p=(0,U.useRef)(new Map),m=u.some(e=>e.key===d)?d:u[0]?.key,h=e=>{e&&(f(e),p.current.get(e)?.focus())},g=(e,t)=>{let n=u[t];switch(e.key){case`Enter`:case` `:l(n.key);break;case`ArrowDown`:h(u[t+1]?.key);break;case`ArrowUp`:h(u[t-1]?.key);break;case`Home`:h(u[0].key);break;case`End`:h(u[u.length-1].key);break;case`ArrowRight`:if(!n.expandable)break;r(n.key)?h(u[t+1]?.key):c(n.key);break;case`ArrowLeft`:n.expandable&&r(n.key)?c(n.key):h(n.parent??void 0);break;default:return}e.preventDefault()};return(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flex:`1 1 auto`,minHeight:0,width:`100%`,overflow:`hidden`,color:`var(--div-text-color)`},children:[(0,J.jsx)(`div`,{role:`tree`,"aria-label":`Clusters`,style:{flex:`0 0 30%`,minWidth:`200px`,overflowX:`hidden`,overflowY:`auto`,borderRight:`2px solid var(--main-grey-color)`},children:u.map((e,t)=>(0,J.jsxs)(`div`,{ref:t=>{t?p.current.set(e.key,t):p.current.delete(e.key)},role:`treeitem`,"aria-level":e.depth+1,"aria-posinset":e.posinset,"aria-setsize":e.setsize,"aria-selected":i===e.key,"aria-expanded":e.expandable?r(e.key):void 0,style:zn(i===e.key,e.depth),tabIndex:e.key===m?0:-1,onClick:()=>{f(e.key),l(e.key)},onKeyDown:e=>g(e,t),children:[(0,J.jsx)(`span`,{style:{width:`12px`},children:e.expandable?r(e.key)?`▾`:`▸`:``}),e.label]},e.key))}),(0,J.jsx)(`div`,{style:{flex:`1 1 auto`,overflowX:`hidden`,overflowY:`auto`},children:(0,J.jsx)(Hn,{node:i?s.get(i):void 0})})]})}var Wn=(0,U.memo)(Un);function Gn(e){return e?e.scrollWidth>e.clientWidth:!1}function Kn({title:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)(!1);return(0,J.jsx)(H,{title:e,open:r,disableHoverListener:!0,disableFocusListener:!0,disableTouchListener:!0,slotProps:{tooltip:{sx:{fontSize:`14px`,fontWeight:`normal`,color:`#ffffff`,backgroundColor:`var(--primary-color)`,maxWidth:500,whiteSpace:`pre-wrap`,wordBreak:`break-word`}}},children:(0,J.jsx)(`span`,{ref:n,onMouseEnter:()=>{i(Gn(n.current))},onMouseLeave:()=>{i(!1)},style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})})}function qn(e,t,n){let r=e?.[n],i=t?.[n];return r==null&&i==null?0:r==null?-1:i==null?1:typeof r==`boolean`&&typeof i==`boolean`?r===i?0:r?1:-1:typeof r==`number`&&typeof i==`number`?r-i:String(r).localeCompare(String(i))}function Jn({name:e,title:t,columns:n,rows:r,getRowKey:i,footerLeft:a,footerRight:o,headerActions:s,onRowClick:c}){let l=t=>{if(typeof i==`string`&&t&&t[i]!=null)return t[i];if(typeof i==`function`){let e=i(t);if(e!=null)return e}let a=n?.[0]?.id;return a&&t&&t[a]!=null?t[a]:(console.warn(`MbfTable(${e}): using fallback stable row key; consider providing getRowKey prop for better React performance`),`rk_${r.indexOf(t)}`)},u=e.replace(/\s+/g,`-`).toLowerCase(),d=`${W}${u}-table-order-by`,f=`${W}${u}-table-order`,p=`${W}${u}-column-visibility`,[m,h]=(0,U.useState)(localStorage.getItem(d)||null),[g,_]=(0,U.useState)(localStorage.getItem(f)||null),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(()=>{try{let e=localStorage.getItem(p);if(e)return JSON.parse(e)}catch{}return{}}),S=(0,U.useMemo)(()=>{let e={};for(let t of n)t.hidden||(e[t.id]=t.required?!0:b[t.id]!==!1);return e},[n,b]),C=(0,U.useMemo)(()=>{if(!m||!g)return r;let e=n.find(e=>e.id===m);if(!e||e.noSort)return r;let t=r.map((e,t)=>({el:e,index:t}));return t.sort((t,n)=>{let r;return r=typeof e.comparator==`function`?e.comparator(t.el,n.el):qn(t.el,n.el,m),r===0?t.index-n.index:g===`asc`?r:-r}),t.map(e=>e.el)},[r,m,g,n]),T=e=>{m!==e||!m?(h(e),_(`asc`),localStorage.setItem(d,e),localStorage.setItem(f,`asc`)):g===`asc`?(_(`desc`),localStorage.setItem(f,`desc`)):(h(null),_(null),localStorage.removeItem(d),localStorage.removeItem(f))},D=()=>{y(!v)},O=e=>{x(t=>{if(n.find(t=>t.id===e)?.required)return t;let r=S[e]!==!1,i={...t};r?i[e]=!1:delete i[e];try{localStorage.setItem(p,JSON.stringify(i))}catch{}return i})},k=()=>{x({});try{localStorage.removeItem(p)}catch{}y(!1)},[A,j]=(0,U.useState)(!1);return A?null:(K&&console.log(`Rendering table ${e}${m&&g?` ordered by ${m}:${g}`:``}`),(0,J.jsxs)(`div`,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,margin:`0`,padding:`0`,gap:`0`,width:`100%`,height:`100%`,overflow:`hidden`},children:[(0,J.jsxs)(R,{open:v,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&D()},disableRestoreFocus:!0,children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:`Configure ${e} columns`})]})}),(0,J.jsx)(E,{children:(0,J.jsx)(N,{children:n.filter(e=>!e.hidden).map(e=>(0,J.jsx)(le,{control:(0,J.jsx)(w,{disabled:!!e.required,checked:e.required?!0:S[e.id]!==!1,onChange:()=>O(e.id)}),label:e.label},e.id))})}),(0,J.jsxs)(he,{children:[(0,J.jsx)(M,{onClick:k,children:`Reset`}),(0,J.jsx)(M,{variant:`contained`,onClick:e=>{if(e?.currentTarget&&typeof e.currentTarget.blur==`function`)try{e.currentTarget.blur()}catch{}let t=document.activeElement;if(t&&t instanceof HTMLElement&&typeof t.blur==`function`)try{t.blur()}catch{}D()},children:`Close`})]})]}),(0,J.jsxs)(rn,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,borderBottom:`none`},children:[(0,J.jsx)(Q,{children:e}),t&&(0,J.jsx)(Q,{children:t}),(0,J.jsxs)(ln,{close:()=>j(!0),children:[s,(0,J.jsx)(z,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:e=>{if(e?.currentTarget?.blur)try{e.currentTarget.blur()}catch{}D()},"aria-label":`Configure Columns`,children:(0,J.jsx)(H,{title:`Configure ${e} columns`,children:(0,J.jsx)(X.Icon,{path:Ct,size:`20px`,color:`var(--header-text-color)`})})})]})]}),(0,J.jsx)(cn,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,minHeight:0,width:`100%`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0`},children:(0,J.jsxs)(`table`,{"aria-label":`${e} table`,style:{width:`100%`,borderCollapse:`collapse`},children:[(0,J.jsx)(`thead`,{style:{position:`sticky`,top:0,zIndex:10,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color`},children:(0,J.jsx)(`tr`,{style:{height:`30px`,minHeight:`30px`},children:n.map(e=>{if(e.hidden||!e.required&&S[e.id]===!1)return null;let t=!e.noSort,n=t&&m===e.id&&!!g;return(0,J.jsxs)(`th`,{onClick:t?()=>T(e.id):void 0,style:{margin:`0`,padding:`5px 10px`,position:`sticky`,top:0,minWidth:e.minWidth,maxWidth:e.maxWidth,textAlign:e.align||`left`,cursor:t?`pointer`:`default`,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,whiteSpace:e.maxWidth?`nowrap`:void 0,overflow:e.maxWidth?`hidden`:void 0,textOverflow:e.maxWidth?`ellipsis`:void 0},"aria-sort":t?n?g===`asc`?`ascending`:`descending`:`none`:void 0,children:[e.label,n&&(0,J.jsxs)(`span`,{style:{marginLeft:6},children:[g===`asc`&&(0,J.jsx)(X.Icon,{path:`M19 17H22L18 21L14 17H17V3H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`}),g===`desc`&&(0,J.jsx)(X.Icon,{path:`M19 7H22L18 3L14 7H17V21H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`})]})]},e.id)})})}),(0,J.jsx)(`tbody`,{children:C.map((e,t)=>{let r=l(e);return(0,J.jsx)(`tr`,{className:t%2==0?`table-content-even`:`table-content-odd`,onClick:c?t=>c(e,r,t):void 0,style:{height:`30px`,minHeight:`30px`,border:`none`,borderCollapse:`collapse`,cursor:c?`pointer`:void 0},children:n.map(t=>{if(t.hidden||!t.required&&S[t.id]===!1)return null;let n=e[t.id],i=typeof t.render==`function`?t.render(n,r,e,t):typeof n==`boolean`?(0,J.jsx)(w,{checked:n,disabled:!0,size:`small`,sx:{m:0,p:0,color:`var(--table-text-color)`,"&.Mui-disabled":{color:`var(--table-text-color)`,opacity:.7}}}):t.format&&typeof n==`number`?t.format(n):n==null?null:String(n),a=t.tooltip&&t.maxWidth!==void 0&&t.maxWidth!==null&&n!=null&&i!==null?(0,J.jsx)(Kn,{title:String(n),children:i}):i;return(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,textAlign:t.align||`left`,padding:`5px 10px`,margin:`0`,maxWidth:t.maxWidth,whiteSpace:t.maxWidth?`nowrap`:void 0,overflow:t.maxWidth?`hidden`:void 0,textOverflow:t.maxWidth?`ellipsis`:void 0},children:a},t.id)})},r)})})]})}),(a||o)&&(0,J.jsxs)(an,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,border:`none`},children:[(0,J.jsx)(on,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:a}),(0,J.jsx)(on,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:o})]})]}))}function Yn(e){return(0,U.memo)(e)}var Xn=Yn(Jn),Zn=[{label:`Plugin name`,id:`plugin`,required:!0},{label:`Device type`,id:`type`},{label:`Endpoint`,id:`number`,align:`right`},{label:`Name`,id:`deviceName`,required:!0},{label:`Serial number`,id:`serialNumber`},{label:`Unique ID`,id:`uniqueId`},{label:`Url`,id:`configUrl`},{label:`Config`,id:`configButton`,noSort:!0,render:(e,t,n,r)=>n.configUrl?(0,J.jsx)(z,{onClick:()=>window.open(n.configUrl,`_blank`),"aria-label":`Open Config`,sx:{margin:0,padding:0},children:(0,J.jsx)(T,{fontSize:`small`})}):null},{label:`Cluster`,id:`cluster`}],Qn=[{label:`Endpoint`,id:`endpoint`,required:!0},{label:`Id`,id:`id`},{label:`Device Types`,id:`deviceTypes`,render:(e,t,n,r)=>Array.isArray(e)?(0,J.jsx)(J.Fragment,{children:e.map(e=>`0x${e.toString(16).padStart(4,`0`)}`).join(`, `)}):(0,J.jsx)(J.Fragment,{children:e})},{label:`Cluster Name`,id:`clusterName`,required:!0},{label:`Cluster ID`,id:`clusterId`},{label:`Attribute Name`,id:`attributeName`,required:!0},{label:`Attribute ID`,id:`attributeId`},{label:`Attribute Value`,id:`attributeValue`,required:!0,maxWidth:350,tooltip:!0}],$n=e=>`${e.plugin}::${e.uniqueId}`,er=e=>`${e.endpoint}::${e.clusterName}::${e.attributeName}`;function tr({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)([]),[d,f]=(0,U.useState)(0),[p,m]=(0,U.useState)(()=>localStorage.getItem(G[`devices-cluster-view-mode`])===`tree`?`tree`:`grid`),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(null),[C,w]=(0,U.useState)(null),T=(0,U.useMemo)(()=>{let n=e?.trim().toLowerCase(),r=n&&n!==`all plugins`,i=s;return r&&(i=i.filter(e=>e.plugin.toLowerCase()===n)),t!==``&&(i=i.filter(e=>e.deviceName.toLowerCase().includes(t.toLowerCase())||e.serialNumber.toLowerCase().includes(t.toLowerCase()))),i},[s,e,t]),E=(0,U.useRef)(o()),D=(0,U.useRef)(T),O=(0,U.useCallback)(e=>{K&&console.log(`DevicesTable received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=D.current.find(t=>t.plugin===e.response.plugin&&t.uniqueId===e.response.uniqueId);if(!t)K&&console.warn(`DevicesTable updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" not found in filteredDevicesRef.current`);else if(h&&_&&t.plugin===h&&t.uniqueId===x&&e.response.number.toString()===_){let n=l.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);if(!n){K&&console.warn(`DevicesTable updater cluster ${e.response.cluster}.${e.response.attribute} for device "${t.deviceName}" serial "${t.serialNumber}" not found in clusters`);return}n.attributeValue=typeof e.response.value==`object`?JSON.stringify(e.response.value,void 0,1).replaceAll(`"`,``):String(e.response.value),n.attributeLocalValue=e.response.value,u([...l]),K&&console.log(`DevicesTable updated attribute ${n.clusterName}.${n.attributeName} for device "${t.deviceName}" serial "${t.serialNumber}" to "${n.attributeValue}"`)}},[l,_,h,x]);(0,U.useEffect)(()=>{let e=e=>{if(K&&console.log(`DevicesTable received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`devices`)K&&console.log(`DevicesTable received refresh_required: changed=${e.response.changed} and sending /api/devices request`),r({id:E.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!0}});else if(e.method===`state_update`&&e.response)O(e);else if(e.method===`/api/devices`)K&&console.log(`DevicesTable received ${e.response.length} devices:`,e.response),c(e.response);else if(e.method===`/api/clusters`){K&&console.log(`DevicesTable received ${e.response.clusters.length} clusters for plugin ${e.response.plugin}:`,e.response),u(e.response.clusters);let t={};for(let n of e.response.clusters)K&&console.log(`Cluster:`,n.endpoint),t[n.endpoint]?t[n.endpoint]++:t[n.endpoint]=1;f(Object.keys(t).length)}};return i(e,E.current),K&&console.log(`DevicesTable added WebSocket listener`),()=>{a(e),K&&console.log(`DevicesTable removed WebSocket listener`)}},[r,i,a,O]),(0,U.useEffect)(()=>{n&&(K&&console.log(`DevicesTable sending api requests with id `,E.current),r({id:E.current,sender:`DevicesTable`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:E.current,sender:`DevicesTable`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:E.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!0}}))},[n,r]),(0,U.useEffect)(()=>{h&&_&&C&&x&&(K&&console.log(`DevicesTable sending /api/clusters`),r({id:E.current,sender:`DevicesTable`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{pluginName:h,number:Number(_),serialNumber:C,uniqueId:x}}))},[h,_,C,x,r]),(0,U.useEffect)(()=>{D.current=T},[T]);let k=e=>{e.uniqueId===x?(S(null),w(null),g(null),v(null),b(null)):(K&&console.log(`DevicesTable handleDeviceClick: selected device "${e.deviceName}" with uniqueId "${e.uniqueId}", plugin "${e.plugin}", endpoint "${e.number}"`),S(e.uniqueId),w(e.serialNumber),g(e.plugin),v(e.number?e.number.toString():null),b(e.deviceName))},A=(0,J.jsx)(z,{onClick:()=>{let e=p===`tree`?`grid`:`tree`;localStorage.setItem(G[`devices-cluster-view-mode`],e),m(e)},"aria-label":p===`tree`?`Switch to grid view`:`Switch to tree view`,sx:{margin:0,padding:0,color:`var(--header-text-color)`},children:p===`tree`?(0,J.jsx)(ft,{fontSize:`small`}):(0,J.jsx)(me,{fontSize:`small`})}),j=`Total child endpoints: ${d-1}`;return K&&console.log(`DevicesTable rendering...`),n?(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,margin:`0px`,padding:`0px`,gap:`20px`,width:`100%`,flex:`1 1 auto`,minHeight:0,overflow:`hidden`},children:[(0,J.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,maxHeight:h&&_?`30%`:`100%`,flex:`1 1 auto`,overflow:`hidden`},children:(0,J.jsx)(Xn,{name:`Registered devices`,getRowKey:$n,onRowClick:k,rows:T,columns:Zn,footerLeft:`Total devices: ${T.length.toString()}`})}),h&&_&&(0,J.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,height:`70%`,maxHeight:`70%`,flex:`1 1 auto`,overflow:`hidden`},children:p===`tree`?(0,J.jsxs)(`div`,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,margin:`0`,padding:`0`,gap:`0`,width:`100%`,height:`100%`,overflow:`hidden`},children:[(0,J.jsxs)(rn,{style:{height:`30px`,minHeight:`30px`,borderBottom:`none`},children:[(0,J.jsx)(Q,{children:`Clusters`}),(0,J.jsx)(Q,{children:y||``}),(0,J.jsx)(ln,{children:A})]}),(0,J.jsx)(Wn,{clusters:l}),(0,J.jsx)(an,{children:(0,J.jsx)(on,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:j})})]}):(0,J.jsx)(Xn,{name:`Clusters`,title:y||``,getRowKey:er,rows:l,columns:Qn,footerLeft:j,headerActions:A})})]}):(0,J.jsx)(nn,{})}var nr=(0,U.memo)(tr);function rr({children:e,style:t,name:n}){let{setCurrentPage:r}=(0,U.useContext)($t);return r(n),K&&console.log(`MbfPage: current page set to ${n}`),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`20px`,...t},children:e})}function ir(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,U.useContext)(Y),[a,o]=(0,U.useState)([`All plugins`]),[s,c]=(0,U.useState)(()=>localStorage.getItem(G[`devices-filter-plugins`])||`All plugins`),[l,u]=(0,U.useState)(()=>localStorage.getItem(G[`devices-filter-devices`])||``),[d,f]=(0,U.useState)(()=>localStorage.getItem(G[`devices-view-mode`])||`icon`),p=(0,U.useRef)(i());(0,U.useEffect)(()=>{let e=e=>{K&&e.id&&console.log(`Devices received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`plugins`&&!e.response.lock?(K&&console.log(`Devices received refresh_required for plugins lock=${e.response.lock}, sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`/api/plugins`&&e.id===p.current&&e.response&&(K&&console.log(`Devices received ${e.response.length} plugins:`,e.response),o([`All plugins`,...e.response.map(e=>e.name)]))};return n(e,p.current),K&&console.log(`Devices added WebSocket listener`),()=>{r(e),K&&console.log(`Devices removed WebSocket listener`)}},[t,n,r]),(0,U.useEffect)(()=>{e&&(o([`All plugins`]),K&&console.log(`Devices sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[e,t]);let m=e=>{let t=e.target.value;c(t),localStorage.setItem(G[`devices-filter-plugins`],t)},h=e=>{u(e.target.value),localStorage.setItem(G[`devices-filter-devices`],e.target.value)},g=()=>{u(``),localStorage.removeItem(G[`devices-filter-devices`])},_=e=>{f(e),localStorage.setItem(G[`devices-view-mode`],e)};return K&&console.log(`Devices rendering...`),e?(0,J.jsxs)(rr,{name:`Devices`,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`,width:`100%`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`},children:[(0,J.jsxs)(V,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(A,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Plugin:`}),(0,J.jsx)(H,{title:`Filter devices by plugin`,children:(0,J.jsx)(de,{variant:`outlined`,value:s,onChange:m,sx:{width:`260px`,backgroundColor:`var(--main-bg-color)`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`},"& .MuiSelect-select":{backgroundColor:`var(--main-bg-color)`}},input:(0,J.jsx)(pe,{sx:{backgroundColor:`var(--main-bg-color)`}}),children:a.map(e=>(0,J.jsx)(b,{value:e,children:e},e))})})]}),(0,J.jsxs)(V,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(A,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Filter by:`}),(0,J.jsx)(H,{title:`Filter devices by name or serial number`,children:(0,J.jsx)(Oe,{variant:`outlined`,value:l,onChange:h,placeholder:`Enter the device name or serial`,sx:{width:`260px`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`}},slotProps:{input:{endAdornment:l?(0,J.jsx)(ae,{position:`end`,children:(0,J.jsx)(z,{"aria-label":`Clear device filter`,size:`small`,onClick:g,edge:`end`,children:(0,J.jsx)(_t,{sx:{fontSize:18,color:`var(--main-label-color)`}})})}):null}}})})]})]}),(0,J.jsxs)(V,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(A,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`View mode:`}),(0,J.jsx)(z,{onClick:()=>_(`table`),"aria-label":`Table View`,disabled:d===`table`,children:(0,J.jsx)(H,{title:`Table View`,children:(0,J.jsx)(ft,{style:{color:d===`table`?`var(--main-icon-color)`:`var(--primary-color)`}})})}),(0,J.jsx)(z,{onClick:()=>_(`icon`),"aria-label":`Icon View`,disabled:d===`icon`,children:(0,J.jsx)(H,{title:`Icon View (beta)`,children:(0,J.jsx)(we,{style:{color:d===`icon`?`var(--main-icon-color)`:`var(--primary-color)`}})})})]})]}),d===`table`&&(0,J.jsx)(nr,{filterPlugins:s,filterDevices:l},`table-${e}`),d===`icon`&&(0,J.jsx)(Nn,{filterPlugins:s,filterDevices:l},`icon-${e}`)]}):(0,J.jsx)(nn,{})}var ar=(0,U.memo)(ir);function or({version:e}){let{online:t}=(0,U.useContext)(Y);return K&&console.log(`HomeBrowserRefresh rendering...`),t?(0,J.jsxs)(Z,{children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Frontend Update`})}),(0,J.jsxs)(cn,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,J.jsxs)(`h4`,{style:{margin:0},children:[`The frontend has been updated to version `,e,`. You are viewing an outdated web UI. Please refresh the page now.`]}),(0,J.jsx)(`div`,{children:(0,J.jsx)(M,{onClick:()=>window.location.reload(),endIcon:(0,J.jsx)(L,{}),style:{marginLeft:`10px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Refresh`})})]})]}):(0,J.jsx)(nn,{})}var sr=(0,U.memo)(or);function cr(e){if(K&&console.log(`getQRColor (id: ${e?.id}) received matter:`,e??`undefined`),e===void 0||!e.online||!e.qrPairingCode&&!e.manualPairingCode&&!e.fabricInformations&&!e.sessionInformations)return`red`;if(!e.commissioned&&e.qrPairingCode&&e.manualPairingCode)return`var(--primary-color)`;let t=0,n=0;for(let r of e.sessionInformations??[])r.fabric&&r.isPeerActive&&t++,r.numberOfActiveSubscriptions>0&&(n+=r.numberOfActiveSubscriptions);return e.commissioned&&e.fabricInformations&&e.sessionInformations&&(t===0||n===0)?`var(--secondary-color)`:`var(--div-text-color)`}function lr(e,t,n=250){let r=(0,U.useRef)(null),i=()=>{r.current&&clearTimeout(r.current),r.current=null};return(0,U.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),a=>({onClick:()=>{i(),r.current=setTimeout(()=>{r.current=null,e(a)},n)},onDoubleClick:()=>{i(),t(a)}})}var ur=e=>`${e.plugin}::${e.serialNumber}`,dr=(e,t)=>{let n=`plugins/${t}`,r=e.replace(/^\.?\//,``);return r===e||!r.startsWith(n)?!1:[``,`/`,`?`,`#`].includes(r.charAt(n.length))},fr=(e,t)=>/^\.?\/plugins\//.test(e)&&!dr(e,t),pr=(e,t)=>e===void 0?t:e===100?x:e>=80?D:e>=60?ee:e>=40?Ye:e>=20?ce:e>=10?vt:p;function mr({storeId:e,setStoreId:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),{mobile:s}=(0,U.useContext)($t),[c,l]=(0,U.useState)(`Waiting for the plugins to fully load...`),[u,d]=(0,U.useState)(``),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)([]),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(`inactive`),C=(0,U.useRef)(o()),O=[{label:`Plugin`,id:`plugin`},{label:`Name`,id:`deviceName`,required:!0},{label:`Serial`,id:`serialNumber`},{label:`Availability`,id:`availability`,render:(e,t,n,r)=>n.reachable===!0?`Online`:n.reachable===!1?(0,J.jsx)(`span`,{style:{color:`red`},children:`Offline`}):``,comparator:(e,t)=>(e.reachable===!0?1:e.reachable===!1?0:-1)-(t.reachable===!0?1:t.reachable===!1?0:-1)},{label:`Power`,id:`powerSource`,render:(e,t,n,r)=>{if(n.powerSource===`ac`||n.powerSource===`dc`)return(0,J.jsx)(H,{title:n.powerSource===`ac`?`AC current`:`DC current`,children:(0,J.jsx)(qe,{fontSize:`small`,sx:{color:`var(--primary-color)`}})});if(n.powerSource===`ok`){let e=pr(n.batteryLevel,D);return n.batteryLevel===void 0?(0,J.jsx)(e,{fontSize:`small`,sx:{color:`gray`}}):(0,J.jsx)(H,{title:`Battery level: ${n.batteryLevel}%`,children:(0,J.jsx)(e,{fontSize:`small`,sx:{color:`green`}})})}if(n.powerSource===`warning`){let e=pr(n.batteryLevel,ce);return n.batteryLevel===void 0?(0,J.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}}):(0,J.jsx)(H,{title:`Battery level: ${n.batteryLevel}%`,children:(0,J.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}})})}if(n.powerSource===`critical`){let e=pr(n.batteryLevel,p);return n.batteryLevel===void 0?(0,J.jsx)(e,{fontSize:`small`,sx:{color:`red`}}):(0,J.jsx)(H,{title:`Battery level: ${n.batteryLevel}%`,children:(0,J.jsx)(e,{fontSize:`small`,sx:{color:`red`}})})}return(0,J.jsx)(`span`,{})}},{label:`Actions`,id:`selected`,required:!0,render:(n,r,i,a)=>(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`},children:[i.matter===void 0?(0,J.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,J.jsx)(H,{title:`Show the QRCode or the fabrics`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,J.jsx)(z,{onClick:()=>t(e===i.matter?.id?f?.matterbridgeInformation.bridgeMode===`bridge`?`Matterbridge`:null:i.matter?.id||null),"aria-label":`Show the QRCode`,sx:{margin:0,padding:0,color:cr(i.matter)},children:(0,J.jsx)(ne,{fontSize:`small`})})}),i.configUrl&&!fr(i.configUrl,i.plugin)?(0,J.jsx)(H,{title:dr(i.configUrl,i.plugin)?`Open the device page in the plugin frontend (double-click for a new tab)`:`Open the configuration page`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,J.jsx)(z,{...N(i),"aria-label":`Open config url`,sx:{margin:0,padding:0},children:dr(i.configUrl,i.plugin)?(0,J.jsx)(ie,{fontSize:`small`}):(0,J.jsx)(T,{fontSize:`small`})})}):(0,J.jsx)(`div`,{style:{width:`20px`,height:`20px`}}),i.selected===void 0?(0,J.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,J.jsx)(H,{title:`Select/unselect the device`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,J.jsx)(w,{checked:i.selected,onChange:e=>j(e,i),sx:{margin:`0`,marginLeft:`8px`,padding:`0`},size:`small`})})]})}],k=(0,U.useCallback)(e=>{e.selected=void 0;let t=h.find(t=>t.name===e.plugin);if(!t)return console.error(`HomeDevices isSelected: plugin ${e.plugin} not found for device ${e.deviceName} `),e.selected;let n=t.schemaJson?.properties?.whiteList?.selectFrom,r=t.configJson.postfix;return r===``&&(r=void 0),t.hasWhiteList===!0&&t.hasBlackList===!0&&n&&(e.selected=!0,n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(r?e.serialNumber.replace(`-`+r,``):e.serialNumber)&&(e.selected=!0),n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(r?e.serialNumber.replace(`-`+r,``):e.serialNumber)&&(e.selected=!1),n===`serial`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(r?e.serialNumber.replace(`-`+r,``):e.serialNumber)&&(e.selected=!1),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(e.deviceName)&&(e.selected=!0),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(e.deviceName)&&(e.selected=!1),n===`name`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(e.deviceName)&&(e.selected=!1)),e.selected},[h]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`&&e.response.changed!==`matter`)e.response.changed===`plugins`&&e.response.lock?K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} lock=${e.response.lock} skipping /api/plugins request`):(K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and sending /api/plugins request`),r({id:C.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}));else if(e.method===`refresh_required`&&e.response.changed===`matter`)K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and setting matter id ${e.response.matter?.id}`),v(t=>{let n=t.findIndex(t=>t.deviceName.replaceAll(` `,``)===e.response.matter?.id);if(n<0)return K&&console.debug(`HomeDevices: matter id ${e.response.matter?.id} not found`),t;let r=[...t];return r[n]={...r[n],matter:e.response.matter},K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and set matter id ${e.response.matter?.id}`),r});else if(e.method===`restart_required`)K&&console.log(`HomeDevices received restart_required`),d(`Restart Required`);else if(e.method===`restart_not_required`)K&&console.log(`HomeDevices received restart_not_required`),d(``);else if(e.method===`matterbridge_status_update`)K&&console.log(`HomeDevices received matterbridge_status_update: ${e.response.status}`),S(e.response.status);else if(e.method===`state_update`&&e.response.plugin&&e.response.serialNumber&&e.response.cluster.includes(`BasicInformation`)&&e.response.attribute===`reachable`){K&&console.log(`HomeDevices updating device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}...`);let t=e.response.value;v(n=>{let r=n.findIndex(t=>t.plugin===e.response.plugin&&t.serialNumber===e.response.serialNumber);if(r<0)return K&&console.warn(`HomeDevices: device to update not found for plugin ${e.response.plugin} serial ${e.response.serialNumber}`),n;let i=[...n];return i[r]={...i[r],reachable:t},i}),K&&console.log(`HomeDevices updated device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}`)}if(e.id===C.current&&e.method===`/api/settings`)K&&console.log(`HomeDevices (id: ${e.id}) received settings:`,e.response),m(e.response),d(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired?`Restart Required`:``),S(e.response.matterbridgeInformation.bridgeStatus);else if(e.id===C.current&&e.method===`/api/plugins`){if(K&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} plugins:`,e.response),e.response){let t=!0;for(let n of e.response)n.enabled&&(n.loaded!==!0||n.started!==!0||n.error===!0)&&(t=!1);if(!t)return;K&&console.log(`HomeDevices reset plugins and mixedDevices, starting a fresh load cycle`),l(`Loading devices...`),g(e.response),v([]),r({id:C.current,sender:`HomeDevices`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!0}}),K&&console.log(`HomeDevices sent /api/devices`);for(let t of e.response)t.enabled&&t.loaded===!0&&t.started===!0&&t.error!==!0&&(r({id:C.current,sender:`HomeDevices`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:t.name}}),K&&console.log(`HomeDevices sent /api/select/devices for plugin: ${t.name}`))}}else if(e.id===C.current&&e.method===`/api/devices`){if(K&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} devices:`,e.response),e.response){let t=e.response.map(e=>Object.assign(e,{selected:k(e),origin:`device`}));l(`Registering devices...`),v(e=>{let n=new Set(t.map(e=>`${e.plugin}::${e.serialNumber}`)),r=e.filter(e=>e.origin===`select`&&!n.has(`${e.plugin}::${e.serialNumber}`));return[...t,...r]}),l(`Registered devices:`)}}else if(e.id===C.current&&e.method===`/api/select/devices`&&(K&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} selectDevices for plugin ${e.response&&e.response.length>0?e.response[0].plugin:`without select devices`}:`,e.response),e.response&&e.response.length>0)){let t=e.response[0].plugin;l(`Registering selected devices for ${t}...`),v(n=>{let r=n.filter(e=>e.origin!==`select`||e.plugin!==t),i=r.filter(e=>e.origin===`device`),a=e.response.filter(e=>!i.some(t=>t.plugin===e.plugin&&t.serialNumber.includes(e.serialNumber))).map(e=>Object.assign(e,{selected:k(e),origin:`select`}));return[...r,...a]}),l(`Registered devices:`)}};return i(e,C.current),K&&console.log(`HomeDevices added WebSocket listener id ${C.current}`),()=>{a(e),K&&console.log(`HomeDevices removed WebSocket listener`)}},[i,a,r,k]);let A=c;c.startsWith(`Registered devices:`)&&(A=`Registered devices: ${_.filter(e=>e.origin===`device`).length}/${_.length}`),(0,U.useEffect)(()=>{n&&(K&&console.log(`HomeDevices sending /api/settings and /api/plugins requests`),r({id:C.current,sender:`HomeDevices`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),l(`Loading plugins...`),r({id:C.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[n,r]);let j=(e,t)=>{K&&console.log(`handleCheckboxChange: checkbox changed to ${e.target.checked} for device ${t.deviceName} serial ${t.serialNumber}`);let n=e.target.checked;v(e=>{let r=e.findIndex(e=>e.plugin===t.plugin&&e.serialNumber===t.serialNumber);if(r<0)return console.error(`handleCheckboxChange: device ${t.deviceName} serial ${t.serialNumber} not found in mixedDevices`),e;let i=[...e];return i[r]={...i[r],selected:n},i}),e.target.checked?r({id:C.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`selectdevice`,plugin:t.plugin,serial:t.serialNumber,name:t.deviceName}}):r({id:C.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`unselectdevice`,plugin:t.plugin,serial:t.serialNumber,name:t.deviceName}})},ee=(e,t=!1)=>{if(K&&console.log(`handleConfigUrl device:`,e.deviceName,`configUrl:`,e.configUrl),e.configUrl&&!fr(e.configUrl,e.plugin)){if(dr(e.configUrl,e.plugin)){let n=`${Xt}${e.configUrl.replace(/^\.?\//,``)}`,r=new URL(n,window.location.origin);r.pathname.endsWith(`/`)||(r.pathname+=`/`);let i=`${r.pathname}${r.search}${r.hash}`;K&&console.log(`handleConfigUrl opening plugin frontend for device:`,e.deviceName,`basePath:`,Xt,`configUrl:`,e.configUrl,`computed pluginFrontendPath:`,i),t?window.open(i,`_blank`):b({name:e.deviceName,path:i})}else window.open(e.configUrl,`_blank`)}},N=lr(e=>ee(e),e=>ee(e,!0));return K&&console.log(`HomeDevices rendering...`),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{style:{flex:`1 1 auto`},children:(0,J.jsx)(Xn,{name:`Devices`,getRowKey:ur,rows:_,columns:O,footerLeft:A,footerRight:u})}),(0,J.jsxs)(R,{open:y!==null,onClose:()=>b(null),slotProps:{paper:{sx:{width:q&&s?`100vw`:`75vw`,height:q&&s?`100vh`:`75vh`,maxWidth:q&&s?`100vw`:`75vw`,maxHeight:q&&s?`100vh`:`75vh`,margin:q&&s?`0px`:void 0,display:`flex`,flexDirection:`column`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`}}},children:[(0,J.jsx)(E,{style:{display:`flex`,flex:`1 1 auto`,minHeight:0,padding:`0px`,margin:`0px`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`},children:y&&(0,J.jsx)(`iframe`,{title:`${y.name} frontend`,src:y.path,onLoad:e=>{let t=e.currentTarget.contentDocument;if(!t?.head)return;let n=getComputedStyle(document.body),r=n.getPropertyValue(`--primary-color`).trim()||`#0d6efd`,i=n.getPropertyValue(`--div-bg-color`).trim()||`#111111`;t.getElementById(`matterbridge-plugin-scrollbar-style`)?.remove();let a=t.createElement(`style`);a.id=`matterbridge-plugin-scrollbar-style`,a.textContent=`
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{s as t}from"./vendor_emotion-DDpeU9YY.js";import{c as n,d as r,l as i,o as a,p as o,s,u as c}from"./vendor_node_modules-CQymrk0g.js";import{$ as l,$t as u,A as d,At as f,B as p,Bt as m,C as h,Ct as g,D as _,Dt as v,E as y,Et as b,F as x,Ft as S,G as C,Gt as w,H as T,Ht as E,I as D,It as O,J as k,Jt as A,K as j,Kt as M,L as ee,Lt as N,M as te,Mt as P,N as ne,Nt as F,O as re,Ot as I,P as ie,Pt as ae,Q as oe,Qt as se,R as ce,Rt as le,S as ue,St as de,T as fe,Tt as pe,U as me,Ut as he,V as L,Vt as ge,W as _e,Wt as R,X as ve,Xt as z,Y as ye,Yt as be,Z as xe,Zt as Se,_ as Ce,_t as we,a as Te,at as Ee,b as De,bt as Oe,c as ke,ct as Ae,d as je,dt as Me,en as Ne,et as Pe,f as Fe,ft as Ie,g as Le,gt as Re,h as ze,ht as Be,i as Ve,it as He,j as Ue,jt as We,k as Ge,kt as B,l as Ke,lt as qe,m as Je,mt as Ye,n as Xe,nt as Ze,o as Qe,ot as $e,p as et,pt as tt,q as nt,qt as V,r as rt,rt as it,s as at,st as ot,t as st,tt as ct,u as lt,ut,v as dt,vt as ft,w as pt,wt as mt,x as ht,xt as H,y as gt,yt as _t,z as vt,zt as yt}from"./vendor_mui-Bwi6U1rq.js";import{n as bt,t as xt}from"./vendor_notistack-KR8UjZr-.js";import{b as St,c as Ct,i as wt,o as Tt,s as Et,t as Dt,v as Ot,x as kt}from"./vendor_mdi-ZZw2uLFo.js";import{a as At,c as jt,i as Mt,l as Nt,n as Pt,o as Ft,r as It,s as Lt,t as Rt}from"./vendor_rjsf-B6mpip0I.js";import{t as zt}from"./vendor_qrcode-BukycYO1.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var U=e(t(),1),Bt=e(o(),1),W=`mbf-`,G={"enable-mobile":`${W}enable-mobile`,"devices-filter-plugins":`${W}devices-filter-plugins`,"devices-filter-devices":`${W}devices-filter-devices`,"devices-view-mode":`${W}devices-view-mode`,"devices-cluster-view-mode":`${W}devices-cluster-view-mode`,"frontend-version":`${W}frontend-version`,"matterbridge-version":`${W}matterbridge-version`,"home-page-mode":`${W}home-page-mode`,"log-filter-level":`${W}log-filter-level`,"log-filter-search":`${W}log-filter-search`,"log-auto-scroll":`${W}log-auto-scroll`,"log-length":`${W}log-length`,"frontend-theme":`${W}frontend-theme`,"home-page-plugins":`${W}home-page-plugins`,"virtual-mode":`${W}virtual-mode`,"install-auto-exit":`${W}install-auto-exit`,"search-plugins-total":`${W}search-plugins-total`,"search-plugins-meta":`${W}search-plugins-meta`,"search-plugins-versions":`${W}search-plugins-versions`,"search-plugins-search":`${W}search-plugins-search`},Vt={"devices-table-order-by":`${W}devices-table-order-by`,"devices-table-order":`${W}devices-table-order`,"devices-column-visibility":`${W}devices-column-visibility`,"plugins-table-order-by":`${W}plugins-table-order-by`,"plugins-table-order":`${W}plugins-table-order`,"plugins-column-visibility":`${W}plugins-column-visibility`,"search-plugins-table-order-by":`${W}search-plugins-table-order-by`,"search-plugins-table-order":`${W}search-plugins-table-order`,"search-plugins-column-visibility":`${W}search-plugins-column-visibility`,"registered-devices-table-order-by":`${W}registered-devices-table-order-by`,"registered-devices-table-order":`${W}registered-devices-table-order`,"registered-devices-column-visibility":`${W}registered-devices-column-visibility`,"clusters-table-order-by":`${W}clusters-table-order-by`,"clusters-table-order":`${W}clusters-table-order`,"clusters-column-visibility":`${W}clusters-column-visibility`};function Ht(){Object.values(G).forEach(e=>{localStorage.removeItem(e)}),Object.values(Vt).forEach(e=>{localStorage.removeItem(e)})}var K=!1,Ut=()=>{K=!K},q=localStorage.getItem(G[`enable-mobile`])!==`false`,Wt=()=>{q=!0,localStorage.setItem(G[`enable-mobile`],`true`)},Gt=()=>{q=!1,localStorage.setItem(G[`enable-mobile`],`false`)},Kt,qt=e=>{Kt=e},Jt=!1,Yt=e=>{Jt=e},Xt=`/`,Zt=e=>{Xt=e},J=Ne();function Qt(e){return(0,J.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,viewBox:`0 0 296.2 296.2`,...e,children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsxs)(`linearGradient`,{id:`lg1`,x1:`16.6`,y1:`16.6`,x2:`279.6`,y2:`279.6`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,J.jsx)(`stop`,{offset:`.1`,stopColor:`#3faa77`}),(0,J.jsx)(`stop`,{offset:`.3`,stopColor:`#234148`}),(0,J.jsx)(`stop`,{offset:`.7`,stopColor:`#203b44`}),(0,J.jsx)(`stop`,{offset:`.9`,stopColor:`#ad2e6e`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,J.jsxs)(`linearGradient`,{id:`lg2`,x1:`31.1`,y1:`31.1`,x2:`265.1`,y2:`265.1`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,J.jsx)(`stop`,{offset:`.2`,stopColor:`#285251`}),(0,J.jsx)(`stop`,{offset:`.4`,stopColor:`#234148`}),(0,J.jsx)(`stop`,{offset:`.8`,stopColor:`#203b44`}),(0,J.jsx)(`stop`,{offset:`.9`,stopColor:`#a8316c`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,J.jsxs)(`linearGradient`,{id:`lg3`,x1:`116.2`,y1:`143.9`,x2:`139.8`,y2:`143.9`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#8bc751`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#0db14b`})]}),(0,J.jsx)(`linearGradient`,{id:`lg4`,x1:`136.1`,y1:`100.8`,x2:`159.6`,y2:`100.8`,xlinkHref:`#lg3`}),(0,J.jsx)(`linearGradient`,{id:`lg5`,x1:`155.3`,y1:`143.9`,x2:`178.9`,y2:`143.9`,xlinkHref:`#lg3`}),(0,J.jsxs)(`linearGradient`,{id:`lg6`,x1:`46.8`,y1:`25.7`,x2:`89.6`,y2:`74.8`,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#b1d34a`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#50b848`})]})]}),(0,J.jsx)(`rect`,{width:`296.2`,height:`296.2`,rx:`56.7`,ry:`56.7`,style:{fill:`url(#lg1)`}}),(0,J.jsx)(`rect`,{x:`16.3`,y:`16.3`,width:`263.6`,height:`263.6`,rx:`50.5`,ry:`50.5`,style:{fill:`url(#lg2)`}}),(0,J.jsx)(`circle`,{cx:`128`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg3)`}}),(0,J.jsx)(`circle`,{cx:`147.8`,cy:`100.8`,r:`11.8`,style:{fill:`url(#lg4)`}}),(0,J.jsx)(`path`,{d:`m244.6 114.5.4-.5L160 33a17 17 0 0 0-24.7-.5l-86.4 83.3a15 15 0 0 0 9.2 26.9h19.3v-4.7l-13.7-12.7v-.1l83.7-80.8 84.2 81-13.9 12.8v4.5h19.5a15 15 0 0 0 7.4-28.1Z`,style:{fill:`url(#lg3)`}}),(0,J.jsx)(`circle`,{cx:`167.1`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg5)`}}),(0,J.jsx)(`path`,{fill:`#fff`,d:`M219 89.3V35.5a10.5 10.5 0 1 0-21 0v33.7l21 20Z`}),(0,J.jsx)(`path`,{d:`M91.4 73.3H83a37 37 0 0 0-14.5-28.4L65 50.2c.1 0 12.6 9 11.7 25.4-5.3-.4-11.2-1.9-16.3-5.3-11.8-7.8-16-23.7-11.9-46 8.7 1.5 34 7 43 22.8 4.1 7.3 4.1 16.1 0 26.2Z`,style:{fill:`url(#lg6)`}}),(0,J.jsx)(`path`,{d:`M65.9 80a49.6 49.6 0 0 0 17.8 2.2l16.6-16c1.6-8.3.5-15.7-3.3-22.4C84.6 22 47.8 17.5 46.2 17.4l-3-.4-.6 3c-3.8 18.4-5.9 50.6 23.2 60ZM48.4 24.4c8.7 1.5 34 7 43 22.8 4.1 7.3 4.1 16.1 0 26.2H83a37 37 0 0 0-14.5-28.4l-3.7 5.3c.1 0 12.6 9 11.7 25.4-5.3-.4-11.2-1.9-16.3-5.3-11.9-7.8-16-23.7-11.9-46Z`,fill:`#1e5857`}),(0,J.jsx)(`path`,{fill:`#fff`,d:`M250.5 90.5a17.4 17.4 0 1 1 0-34.8 17.4 17.4 0 0 1 0 34.8Zm0-22.7a5.4 5.4 0 0 0 0 10.7 5.3 5.3 0 0 0 0-10.7ZM258.8 148.2a15.9 15.9 0 0 0-9.6 28.5c-.8 4.2-5.4 4.6-5.4 4.6h-26v-43l13.6-13-1.8-2-82.2-79-81.2 78.3-2.5 2.6 13.7 13v42.9H53a21.5 21.5 0 1 0 11.7 15h12.6v18.8c0 7.8 6.4 14.1 14.1 14.1h29.3v14.8H64a10.6 10.6 0 0 0-17.7 8 10.6 10.6 0 0 0 17.6 8h157.6a16.3 16.3 0 1 0 0-16h-84.8V229h66.8c7.8 0 14.2-6.3 14.2-14.1v-19.2h27.6c14.3 0 17.8-12.8 18.5-16.6a15.9 15.9 0 0 0-5-30.9ZM43.7 210.8a10.3 10.3 0 1 1 0-20.6 10.3 10.3 0 0 1 0 20.6Zm192 36a5 5 0 1 1 0 10 5 5 0 0 1 0-10Zm-77-34.8h-22v-34h22v34Zm8.4-79.8c2.7 0 5.2 1 7.2 2.5v-10.4L188 137s2.6 1.3 4.6 1.3h6.7v68c0 3.2-2.6 5.7-5.7 5.7h-19v-34h1.4a7.5 7.5 0 0 0 0-15H120a7.5 7.5 0 0 0 0 15h.7v34h-19.3a5.7 5.7 0 0 1-5.7-5.6v-68.1h6.7c2 0 4.6-1.3 4.6-1.3l13.7-12.7v10.4a11.7 11.7 0 0 1 16 1.6v-13a14.9 14.9 0 0 0-25-10.8s-.1.2-.1.2l-.5.5-6.9 7H92.5l55-53.2 55.1 53.2h-11.8l-7-7c0-.2-.2-.3-.4-.5l-.2-.2a14.8 14.8 0 0 0-25 10.9v12.9c2.2-2.5 5.3-4.1 8.9-4.1Zm91.7 36.7a4.9 4.9 0 1 1 0-9.7 4.9 4.9 0 0 1 0 9.7Z`})]})}var $t=(0,U.createContext)(null),en=(0,U.createContext)(null),Y=(0,U.createContext)(null);function tn({children:e}){let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(localStorage.getItem(G[`log-filter-level`])??`info`),[a,o]=(0,U.useState)(localStorage.getItem(G[`log-filter-search`])??`*`),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(1),{showSnackbarMessage:d,closeSnackbarMessage:f,closeSnackbar:p,showInstallProgress:m,hideInstallProgress:h,exitInstallProgressSuccess:g,exitInstallProgressError:_,addInstallProgress:v}=(0,U.useContext)($t),y=(0,U.useRef)([]),b=(0,U.useRef)(null),x=(0,U.useRef)(1),S=(0,U.useRef)(Math.floor(Math.random()*999e3)+1e3),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)(null),E=(0,U.useRef)(r),D=(0,U.useRef)(a),O=(0,U.useRef)(0),k=(0,U.useRef)(null),A=(0,U.useRef)(Number(localStorage.getItem(G[`log-length`])??200)),j=(0,U.useRef)(localStorage.getItem(G[`log-auto-scroll`])!==`false`),M=(0,U.useCallback)(e=>{A.current=e},[]),ee=(0,U.useCallback)(e=>{j.current=e},[]),N=(0,U.useMemo)(()=>window.location.href.replace(/^http/,`ws`),[]);(0,U.useEffect)(()=>(K&&console.log(`WebSocket started counter interval`),k.current=setInterval(()=>{O.current>0&&(K&&console.log(`WebSocket received ${O.current} messages in the last 10 seconds: ${O.current*6} messages/minute`),O.current=0)},1e4),()=>{K&&console.log(`WebSocket stopped counter interval`),k.current&&clearInterval(k.current),k.current=null}),[]),(0,U.useEffect)(()=>{E.current=r},[r]),(0,U.useEffect)(()=>{D.current=a},[a]);let te=(0,U.useCallback)(()=>Math.floor(Math.random()*999e3)+1e3,[]),P=(0,U.useCallback)((e,t)=>{K&&console.log(`WebSocket filterLogMessages called with level "${e}" and search "${t}"...`),n(n=>n.filter(n=>!([`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(n.level)&&(e===`info`&&n.level===`debug`||e===`notice`&&(n.level===`debug`||n.level===`info`)||e===`warn`&&(n.level===`debug`||n.level===`info`||n.level===`notice`)||e===`error`&&(n.level===`debug`||n.level===`info`||n.level===`notice`||n.level===`warn`)||e===`fatal`&&(n.level===`debug`||n.level===`info`||n.level===`notice`||n.level===`warn`||n.level===`error`))||t!==`*`&&t!==``&&!t.startsWith(`/`)&&!t.endsWith(`/`)&&!n.message.toLowerCase().includes(t.toLowerCase())&&!n.name.toLowerCase().includes(t.toLowerCase())||t.startsWith(`/`)&&t.endsWith(`/`)&&(()=>{try{let e=new RegExp(t.slice(1,-1),`i`);return!e.test(n.message)&&!e.test(n.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${t}":`,e),!1}})())))},[]),ne=(0,U.useCallback)(e=>{if(b.current&&b.current.readyState===WebSocket.OPEN)try{K&&console.log(`WebSocket sending message with id ${e.id}:`,e),e.id===void 0&&(e.id=S.current);let t=JSON.stringify(e);b.current.send(t),K&&console.log(`WebSocket sent message:`,e)}catch(e){K&&console.error(`WebSocket error sending message: ${String(e)}`)}else K&&console.error(`WebSocket message not sent, WebSocket not connected:`,e)},[]),F=(0,U.useCallback)((e,t)=>{n(n=>[...n,{level:e,time:``,name:``,message:t}])},[]),re=(0,U.useCallback)((e,t)=>{K&&console.log(`WebSocket addListener id ${t}:`,e),(t==null||Number.isNaN(t)||t===0)&&console.error(`WebSocket addListener called without id, listener not added:`,e),y.current=[...y.current,{listener:e,id:t}],K&&console.log(`WebSocket addListener total listeners:`,y.current.length)},[]),I=(0,U.useCallback)(e=>{K&&console.log(`WebSocket removeListener:`,e),y.current=y.current.filter(t=>t.listener!==e),K&&console.log(`WebSocket removeListener total listeners:`,y.current.length)},[]),ie=(0,U.useCallback)(()=>{N!==``&&N!=null&&(F(`WebSocket`,`Connecting ${Kt?`with password`:``} to WebSocket: ${N}`),K&&console.log(`WebSocket connecting to: ${N}${Kt?`?password=[redacted]`:``}`),b.current=new WebSocket(N+(Kt?`?password=${encodeURIComponent(Kt)}`:``)),b.current.onmessage=e=>{s||c(!0),O.current+=1;try{let t=JSON.parse(e.data);if(t.id===void 0||t.src===void 0||t.dst===void 0){K&&console.error(`WebSocket undefined message id/src/dst:`,t);return}if(t.src!==`Matterbridge`||t.dst!==`Frontend`){K&&console.error(`WebSocket invalid message src/dst:`,t);return}if(t.error){K&&console.error(`WebSocket error message response:`,t);return}if(t.id===S.current&&t.method===`pong`&&t.response===`pong`){K&&console.log(`WebSocket pong response message id ${t.id}:`,t),w.current&&clearTimeout(w.current),w.current=null;return}if(t.method===`snackbar`&&t.response?.message){K&&console.log(`WebSocket message id %s method %s:`,t.id,t.method,t),d(t.response.message,t.response.timeout,t.response.severity);return}if(t.method===`close_snackbar`&&t.response?.message){K&&console.log(`WebSocket message id %s method %s:`,t.id,t.method,t),f(t.response.message);return}if(t.method===`log`){if(!t.response?.level||!t.response.time||!t.response.name||!t.response.message||(t.response.level===`spawn`&&(t.response.name===`Matterbridge:spawn-init`?m(t.response.message,``,``):t.response.name===`Matterbridge:spawn-exit-success`?g():t.response.name===`Matterbridge:spawn-exit-error`?_():v(t.response.message+`
|
|
2
|
+
`)),[`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(t.response.level)&&(E.current===`info`&&t.response.level===`debug`||E.current===`notice`&&(t.response.level===`debug`||t.response.level===`info`)||E.current===`warn`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`)||E.current===`error`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`)||E.current===`fatal`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`||t.response.level===`error`)))||D.current!==`*`&&D.current!==``&&!D.current.startsWith(`/`)&&!D.current.endsWith(`/`)&&!t.response.message.toLowerCase().includes(D.current.toLowerCase())&&!t.response.name.toLowerCase().includes(D.current.toLowerCase())||D.current.startsWith(`/`)&&D.current.endsWith(`/`)&&(()=>{try{let e=new RegExp(D.current.slice(1,-1),`i`);return!e.test(t.response.message)&&!e.test(t.response.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${D.current}":`,e),!1}})()||t.response.name===`Commissioning`&&t.response.message.includes(`is uncommissioned`))return;n(e=>{let n=[...e,{level:t.response.level,time:t.response.time,name:t.response.name,message:t.response.message}];return K&&console.log(`WebSocket new log message added (${n.length}/${A.current}):`,n[n.length-1]),n.length>A.current+A.current*10/100?(K&&console.log(`WebSocket sliced log messages to the last ${A.current} entries`),n.slice(n.length-A.current)):n})}else{if(K&&console.log(`WebSocket received message id %s method %s:`,t.id,t.method,t),t.id===0)y.current.forEach(e=>e.listener(t));else{let e=y.current.find(e=>e.id===t.id);e?e.listener(t):K&&console.warn(`WebSocket no listener found for message id %s:`,t.id,t)}return}}catch(e){console.error(`WebSocket error parsing message: ${String(e)}`,e instanceof Error?e.stack:null)}},b.current.onopen=()=>{K&&console.log(`WebSocket: Connected to WebSocket: ${N}`),F(`WebSocket`,`Connected to WebSocket: ${N}`),c(!0),p(),x.current=1,u(1),T.current=setTimeout(()=>{C.current=setInterval(()=>{ne({id:S.current,method:`ping`,src:`Frontend`,dst:`Matterbridge`,params:{}}),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{K&&console.error(`WebSocketUse: No pong response received from WebSocket: ${N}`),F(`WebSocket`,`No pong response received from WebSocket: ${N}`),c(!1)},5e4)},6e4)},3e5)},b.current.onclose=()=>{K&&console.error(`WebSocket: Disconnected from WebSocket ${Jt?`with Ingress`:``}: ${N}`),F(`WebSocket`,`Disconnected from WebSocket: ${N}`),c(!1),p(),h(),T.current&&clearTimeout(T.current),w.current&&clearTimeout(w.current),C.current&&clearInterval(C.current),F(`WebSocket`,`Reconnecting (attempt ${x.current} of 100) to WebSocket${Jt?` (Ingress)`:``}: ${N}`),Jt?setTimeout(ae,5e3):x.current===1?ae():x.current<100?setTimeout(ae,1e3*x.current):F(`WebSocket`,`Reconnect attempts exceeded limit of 100 retries, refresh the page to reconnect to: ${N}`),x.current+=1,u(x.current)},b.current.onerror=e=>{K&&console.error(`WebSocket: WebSocket error connecting to %s:`,N,e),F(`WebSocket`,`WebSocket error connecting to ${N}`)})},[N]),ae=(0,U.useCallback)(()=>{K&&console.log(`WebSocket attemptReconnect ${x.current}/100 to:`,N),ie()},[ie]);(0,U.useEffect)(()=>(ie(),()=>{b.current&&b.current.readyState===WebSocket.OPEN&&b.current.close()}),[ie]);let oe=(0,U.useMemo)(()=>({messages:t,logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:ee,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:P}),[t,A,j,r,a,n,M,ee,i,o,P]),se=(0,U.useMemo)(()=>({logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:ee,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:P,online:s,retry:l,getUniqueId:te,addListener:re,removeListener:I,sendMessage:ne,logMessage:F}),[A,j,n,M,ee,i,o,s,l,re,I,ne,F]);return(0,J.jsx)(en.Provider,{value:oe,children:(0,J.jsx)(Y.Provider,{value:se,children:e})})}function nn(){let{retry:e}=(0,U.useContext)(Y);return(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100vw`,height:`100vh`,justifyContent:`center`,alignItems:`center`,fontSize:`20px`,color:`var(--main-text-color)`,backgroundColor:`var(--main-bg-color)`},children:[(0,J.jsx)(Qt,{style:{height:`128px`,width:`128px`,margin:`10px`,marginBottom:`20px`}}),e<100?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Se,{style:{color:`var(--primary-color)`}}),(0,J.jsx)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:(0,J.jsxs)(`span`,{children:[`Reconnecting to Matterbridge `,`(attempt `+e+`)`,`...`]})})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:[(0,J.jsx)(`span`,{children:`Unable to connect to Matterbridge after multiple attempts.`}),(0,J.jsx)(`br`,{}),(0,J.jsx)(`span`,{children:`Please check your network connection.`}),(0,J.jsx)(`br`,{})]}),(0,J.jsx)(M,{variant:`contained`,color:`primary`,onClick:()=>{window.location.reload()},style:{marginTop:`20px`},children:`Refresh the Page`})]})]})}var X=Dt();function Z({children:e,style:t}){return(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:`0 0 auto`,width:`100%`,overflow:`hidden`,margin:`0px`,padding:`0px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,boxShadow:`5px 5px 10px var(--div-shadow-color)`,border:`1px solid var(--table-border-color)`,borderRadius:`var(--div-border-radius)`,boxSizing:`border-box`,...t},children:e})}function rn({children:e,style:t}){return(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,borderBottom:`1px solid var(--table-border-color)`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function Q({children:e,style:t}){return(0,J.jsx)(`div`,{style:{color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,fontSize:`16px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function an({children:e,style:t}){return(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function on({children:e,style:t}){return(0,J.jsx)(`div`,{style:{color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,fontSize:`14px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function sn({children:e,style:t}){return(0,J.jsx)(`div`,{style:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,fontSize:`14px`,fontWeight:`normal`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function cn({children:e,style:t,onDragOver:n,onDragLeave:r,onDrop:i}){return(0,J.jsx)(`div`,{style:{flex:`0 0 auto`,display:`flex`,flexDirection:`row`,overflow:`hidden`,alignItems:`start`,justifyContent:`space-between`,margin:`0px`,padding:`10px`,gap:`20px`,...t},onDragOver:n,onDragLeave:r,onDrop:i,children:e})}function ln({children:e,style:t,close:n}){return(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,margin:`0px`,padding:`0px`,paddingRight:`10px`,gap:`10px`,...t},children:[e,!1]})}var un=[`Off`,`Low`,`Medium`,`High`,`On`,`Auto`,`Smart`],dn={display:`flex`,gap:`2px`,justifyContent:`space-evenly`,width:`100%`,height:`40px`},fn={margin:`0`,padding:`0`,fontSize:`36px`,fontWeight:`medium`,color:`var(--primary-color)`},pn={margin:`0`,padding:`0`,fontSize:`20px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},mn={margin:`0`,padding:`0`,paddingBottom:`2px`,fontSize:`16px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},hn={display:`flex`,gap:`2px`,justifyContent:`center`,width:`100%`,height:`18px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},gn={margin:`0`,padding:`0`,fontSize:`12px`,fontWeight:`normal`,color:`var(--div-text-color)`},_n={display:`flex`,justifyContent:`center`,width:`100%`,height:`52px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},vn={margin:`0`,padding:`0`,fontSize:`14px`,fontWeight:`bold`,color:`var(--div-text-color)`},yn={display:`flex`,gap:`4px`,justifyContent:`center`,width:`100%`,height:`15px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},bn={margin:`0`,padding:`0px 4px`,borderRadius:`5px`,textAlign:`center`,fontSize:`12px`,fontWeight:`normal`,color:`var(--secondary-color)`},xn=[256,257,268,269],Sn=[266,267],Cn=[271,272],wn=[256,257,268,269,266,267,272],Tn=[43,45],En=[`Closed`,`Open`,`Partial`,`Pedestrian`,`Ventilation`,`Signature`];function Dn(e){if(typeof e!=`object`||!e||!(`position`in e))return`N/A`;let t=e.position;return typeof t!=`number`||!Number.isInteger(t)||t<0||t>=En.length?`N/A`:En[t]}function On(e){return typeof e!=`number`||!Number.isInteger(e)||e<0||e>1e4?`N/A`:e===0?En[0]:e===1e4?En[1]:En[2]}function kn(e){return typeof e!=`object`||!e||!(`position`in e)?`N/A`:On(e.position)}function $({icon:e,iconColor:t,cluster:n,value:r,unit:i,prefix:a}){return K&&console.log(`Render cluster "${n.clusterName}.${n.attributeName}" value(${typeof r}-${Number.isNaN(r)}) "${r}" unit "${i}"`),a??=!1,(0,J.jsxs)(V,{sx:dn,children:[e&&(0,U.cloneElement)(e,{key:`${n.clusterId}-${n.attributeId}-icon`,sx:{...fn,color:t??`var(--primary-color)`}}),(0,J.jsxs)(V,{sx:{...dn,gap:`4px`,alignContent:`center`,alignItems:`end`,justifyContent:`center`},children:[i&&a&&(0,J.jsx)(A,{sx:mn,children:i},`${n.clusterId}-${n.attributeId}-unit-prefix`),(0,J.jsx)(A,{sx:pn,children:r==null||typeof r==`number`&&Number.isNaN(r)||r===`NaN`?`---`:r},`${n.clusterId}-${n.attributeId}-value`),i&&!a&&(0,J.jsx)(A,{sx:mn,children:i},`${n.clusterId}-${n.attributeId}-unit-suffix`)]},`${n.clusterId}-${n.attributeId}-valueunitbox`)]},`${n.clusterId}-${n.attributeId}-box`)}function An({device:e,endpoint:t,id:n,deviceType:r,clusters:i}){let a=[`Unknown`,`Good`,`Fair`,`Moderate`,`Poor`,`VeryPoor`,`Ext.Poor`],o=``,s=e=>{if(!e)return null;let t=e.attributeLocalValue;if(!t||typeof t!=`object`||!(`energy`in t))return null;let n=t.energy;return typeof n!=`number`&&typeof n!=`bigint`?null:Math.round(Number(n)/1e6)},c=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyImported`),u=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyExported`),d=s(c),f=s(u),p=c??u,m=d??(f===null?null:`+ ${f}`);K&&console.log(`Device "${e.deviceName}" endpoint "${t}" id "${n}" deviceType "0x${r.toString(16).padStart(4,`0`)}" clusters (${i?.length})`);let h=i.find(e=>e.clusterName===`Descriptor`&&e.attributeName===`tagList`)?.attributeLocalValue;if(h){let e=``;h.map(t=>{t.label&&(e+=t.label+` `)}),o=e.trim()}if(r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batVoltage`).map(e=>o=`${e.attributeLocalValue??0} mV`),wn.includes(r)&&i.filter(e=>e.clusterName===`LevelControl`&&e.attributeName===`currentLevel`).map(e=>o=`Level ${e.attributeValue}`),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>o=`Position ${e.attributeLocalValue/100}%`),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedHeatingSetpoint`).map(e=>o=`Heat ${e.attributeLocalValue/100}°C `),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedCoolingSetpoint`).map(e=>o+=`Cool ${e.attributeLocalValue/100}°C`),Tn.includes(r)&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`percentCurrent`).map(e=>o=`Speed ${e.attributeValue}%`),r===118&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>o=e.attributeLocalValue===0?`No CO detected`:`CO alarm!`),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`voltage`).map(e=>o=`${e.attributeLocalValue/1e3} V, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activeCurrent`).map(e=>o+=`${e.attributeLocalValue/1e3} A, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activePower`).map(e=>o+=`${e.attributeLocalValue/1e6} kW`),r===39){let e=i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}if(r===116){let e=i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}return(0,J.jsxs)(Z,{style:{margin:`0px`,padding:`5px`,width:`150px`,height:`150px`,borderColor:`var(--div-bg-color)`,borderRadius:`5px`,justifyContent:`space-between`},children:[r===19&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:e.attributeLocalValue===!0?(0,J.jsx)(C,{}):(0,J.jsx)(_e,{}),iconColor:e.attributeLocalValue===!0?`green`:`red`,cluster:e,value:e.attributeLocalValue===!0?`Online`:`Offline`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batPercentRemaining`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ye,{}),cluster:e,value:e.attributeLocalValue/2,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`wiredCurrentType`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(qe,{}),cluster:e,value:e.attributeLocalValue===0?`AC`:`DC`},`${e.clusterId}-${e.attributeId}`)),r===1293&&i.filter(e=>e.clusterName===`DeviceEnergyManagement`&&e.attributeName===`esaState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Offline`:`Online`},`${e.clusterId}-${e.attributeId}`)),xn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),Sn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M7.5,10.5A1.5,1.5 0 0,1 9,12A1.5,1.5 0 0,1 7.5,13.5C6.66,13.5 6,12.83 6,12A1.5,1.5 0 0,1 7.5,10.5M16.5,10.5A1.5,1.5 0 0,1 18,12A1.5,1.5 0 0,1 16.5,13.5A1.5,1.5 0 0,1 15,12A1.5,1.5 0 0,1 16.5,10.5M4.22,2H19.78C21,2 22,3 22,4.22V19.78A2.22,2.22 0 0,1 19.78,22H4.22C3,22 2,21 2,19.78V4.22A2.22,2.22 0 0,1 4.22,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),Cn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===259&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===260&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===261&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===2112&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(He,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===115&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M14.83,11.17C16.39,12.73 16.39,15.27 14.83,16.83C13.27,18.39 10.73,18.39 9.17,16.83L14.83,11.17M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===124&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8M8.11,10.5H10C9.76,11.88 10,12.67 10.58,13.29C11.68,14.36 12.16,15.71 11.89,17.5H10C10.24,16.12 10,15.33 9.42,14.71C8.32,13.64 7.85,12.29 8.11,10.5M12.11,10.5H14C13.76,11.88 14,12.67 14.58,13.29C15.68,14.36 16.16,15.71 15.89,17.5H14C14.24,16.12 14,15.33 13.42,14.71C12.32,13.64 11.85,12.29 12.11,10.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===117&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M18,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V4A2,2 0 0,0 18,2M10,4A1,1 0 0,1 11,5A1,1 0 0,1 10,6A1,1 0 0,1 9,5A1,1 0 0,1 10,4M7,4A1,1 0 0,1 8,5A1,1 0 0,1 7,6A1,1 0 0,1 6,5A1,1 0 0,1 7,4M18,20H6V8H18V20M14.67,15.33C14.69,16.03 14.41,16.71 13.91,17.21C12.86,18.26 11.15,18.27 10.09,17.21C9.59,16.71 9.31,16.03 9.33,15.33C9.4,14.62 9.63,13.94 10,13.33C10.37,12.5 10.81,11.73 11.33,11L12,10C13.79,12.59 14.67,14.36 14.67,15.33`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===123&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(l,{}),cluster:e,value:`Oven`},`${e.clusterId}-${e.attributeId}`)),r===112&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ee,{}),cluster:e,value:`Fridge`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`temperatureSetpoint`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===121&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(l,{}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===122&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M19,18.31V20A2,2 0 0,1 17,22H7A2,2 0 0,1 5,20V16.3C4.54,16.12 3.95,16 3,16A1,1 0 0,1 2,15A1,1 0 0,1 3,14C3.82,14 4.47,14.08 5,14.21V12.3C4.54,12.12 3.95,12 3,12A1,1 0 0,1 2,11A1,1 0 0,1 3,10C3.82,10 4.47,10.08 5,10.21V8.3C4.54,8.12 3.95,8 3,8A1,1 0 0,1 2,7A1,1 0 0,1 3,6C3.82,6 4.47,6.08 5,6.21V4A2,2 0 0,1 7,2H17A2,2 0 0,1 19,4V6.16C20.78,6.47 21.54,7.13 21.71,7.29C22.1,7.68 22.1,8.32 21.71,8.71C21.32,9.1 20.8,9.09 20.29,8.71V8.71C20.29,8.71 19.25,8 17,8C15.74,8 14.91,8.41 13.95,8.9C12.91,9.41 11.74,10 10,10C9.64,10 9.31,10 9,9.96V7.95C9.3,8 9.63,8 10,8C11.26,8 12.09,7.59 13.05,7.11C14.09,6.59 15.27,6 17,6V4H7V20H17V18C18.5,18 18.97,18.29 19,18.31M17,10C15.27,10 14.09,10.59 13.05,11.11C12.09,11.59 11.26,12 10,12C9.63,12 9.3,12 9,11.95V13.96C9.31,14 9.64,14 10,14C11.74,14 12.91,13.41 13.95,12.9C14.91,12.42 15.74,12 17,12C19.25,12 20.29,12.71 20.29,12.71V12.71C20.8,13.1 21.32,13.1 21.71,12.71C22.1,12.32 22.1,11.69 21.71,11.29C21.5,11.08 20.25,10 17,10M17,14C15.27,14 14.09,14.59 13.05,15.11C12.09,15.59 11.26,16 10,16C9.63,16 9.3,16 9,15.95V17.96C9.31,18 9.64,18 10,18C11.74,18 12.91,17.41 13.95,16.9C14.91,16.42 15.74,16 17,16C19.25,16 20.29,16.71 20.29,16.71V16.71C20.8,17.1 21.32,17.1 21.71,16.71C22.1,16.32 22.1,15.69 21.71,15.29C21.5,15.08 20.25,14 17,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===120&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Cooktop`},`${e.clusterId}-${e.attributeId}`)),r===119&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:On(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===515&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===560&&i.filter(e=>e.clusterName===`ClosureControl`&&e.attributeName===`overallCurrentState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:Dn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===574&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===561&&i.filter(e=>e.clusterName===`ClosureDimension`&&e.attributeName===`currentState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(tt,{}),cluster:e,value:kn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===778&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===10&&i.filter(e=>e.clusterName===`DoorLock`&&e.attributeName===`lockState`).map(e=>(0,J.jsx)($,{icon:e.attributeValue===`1`?(0,J.jsx)(Ze,{}):(0,J.jsx)(ct,{}),cluster:e,value:e.attributeValue===`1`?`Locked`:`Unlocked`},`${e.clusterId}-${e.attributeId}`)),r===11&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ze,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===43&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Be,{}),cluster:e,value:un[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===15&&i.filter(e=>e.clusterName===`Switch`&&e.attributeName===`currentPosition`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M13 5C15.21 5 17 6.79 17 9C17 10.5 16.2 11.77 15 12.46V11.24C15.61 10.69 16 9.89 16 9C16 7.34 14.66 6 13 6S10 7.34 10 9C10 9.89 10.39 10.69 11 11.24V12.46C9.8 11.77 9 10.5 9 9C9 6.79 10.79 5 13 5M20 20.5C19.97 21.32 19.32 21.97 18.5 22H13C12.62 22 12.26 21.85 12 21.57L8 17.37L8.74 16.6C8.93 16.39 9.2 16.28 9.5 16.28H9.7L12 18V9C12 8.45 12.45 8 13 8S14 8.45 14 9V13.47L15.21 13.6L19.15 15.79C19.68 16.03 20 16.56 20 17.14V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.11 2.9 14 4 14H8V12L4 12L4 4H20L20 12H18V14H20V13.96L20.04 14C21.13 14 22 13.09 22 12V4C22 2.9 21.11 2 20 2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`pos`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===39&&i.filter(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ie,{}),cluster:e,value:e.attributeValue,unit:`Mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===771&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Me,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===772&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Me,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===45&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)($e,{}),cluster:e,value:un[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===114&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)($e,{}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===67&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(j,{}),cluster:e,value:e.attributeLocalValue===!0?`Leak`:`No leak`},`${e.clusterId}-${e.attributeId}`)),r===65&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Re,{}),cluster:e,value:e.attributeLocalValue===!0?`Freeze`:`No freeze`},`${e.clusterId}-${e.attributeId}`)),r===68&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(k,{}),cluster:e,value:e.attributeLocalValue===!0?`Rain`:`No rain`},`${e.clusterId}-${e.attributeId}`)),r===116&&i.filter(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12,2C14.65,2 17.19,3.06 19.07,4.93L17.65,6.35C16.15,4.85 14.12,4 12,4C9.88,4 7.84,4.84 6.35,6.35L4.93,4.93C6.81,3.06 9.35,2 12,2M3.66,6.5L5.11,7.94C4.39,9.17 4,10.57 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,10.57 19.61,9.17 18.88,7.94L20.34,6.5C21.42,8.12 22,10.04 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12C2,10.04 2.58,8.12 3.66,6.5M12,6A6,6 0 0,1 18,12C18,13.59 17.37,15.12 16.24,16.24L14.83,14.83C14.08,15.58 13.06,16 12,16C10.94,16 9.92,15.58 9.17,14.83L7.76,16.24C6.63,15.12 6,13.59 6,12A6,6 0 0,1 12,6M12,8A1,1 0 0,0 11,9A1,1 0 0,0 12,10A1,1 0 0,0 13,9A1,1 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`Run mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===1292&&i.filter(e=>e.clusterName===`EnergyEvse`&&e.attributeName===`state`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M19.77,7.23L19.78,7.22L16.06,3.5L15,4.56L17.11,6.67C16.17,7.03 15.5,7.93 15.5,9A2.5,2.5 0 0,0 18,11.5C18.36,11.5 18.69,11.42 19,11.29V18.5A1,1 0 0,1 18,19.5A1,1 0 0,1 17,18.5V14A2,2 0 0,0 15,12H14V5A2,2 0 0,0 12,3H6A2,2 0 0,0 4,5V21H14V13.5H15.5V18.5A2.5,2.5 0 0,0 18,21A2.5,2.5 0 0,0 20.5,18.5V9C20.5,8.31 20.22,7.68 19.77,7.23M18,10A1,1 0 0,1 17,9A1,1 0 0,1 18,8A1,1 0 0,1 19,9A1,1 0 0,1 18,10M8,18V13.5H6L10,6V11H12L8,18Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Free`:`In use`},`${e.clusterId}-${e.attributeId}`)),r===1295&&i.filter(e=>e.clusterName===`WaterHeaterManagement`&&e.attributeName===`tankPercentage`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 2C6.89 2 6 2.89 6 4V16C6 17.11 6.89 18 8 18H9V20H6V22H9C10.11 22 11 21.11 11 20V18H13V20C13 21.11 13.89 22 15 22H18V20H15V18H16C17.11 18 18 17.11 18 16V4C18 2.89 17.11 2 16 2H8M12 4.97A2 2 0 0 1 14 6.97A2 2 0 0 1 12 8.97A2 2 0 0 1 10 6.97A2 2 0 0 1 12 4.97M10 14.5H14V16H10V14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tank `+(e.attributeLocalValue??0)+`%`},`${e.clusterId}-${e.attributeId}`)),r===1297&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Utility`},`${e.clusterId}-${e.attributeId}`)),r===1298&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Reference`},`${e.clusterId}-${e.attributeId}`)),r===1299&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tariff`},`${e.clusterId}-${e.attributeId}`)),r===1300&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Meter`},`${e.clusterId}-${e.attributeId}`)),r===777&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M12.75 7.08C13.57 7.2 14.32 7.5 14.95 8L12.75 10.19V7.08M11.25 7.08V10.19L9.05 8C9.68 7.5 10.43 7.2 11.25 7.08M8 9.05L10.19 11.25H7.08C7.2 10.43 7.5 9.68 8 9.05M7.08 12.75H10.19L8 14.95C7.5 14.32 7.2 13.57 7.08 12.75M11.25 16.92C10.43 16.8 9.68 16.5 9.05 16L11.25 13.81V16.92M12 13C11.45 13 11 12.55 11 12S11.45 11 12 11 13 11.45 13 12 12.55 13 12 13M12.75 16.92V13.81L14.95 16C14.32 16.5 13.57 16.8 12.75 16.92M16 14.95L13.81 12.75H16.92C16.8 13.57 16.5 14.32 16 14.95M13.81 11.25L16 9.05C16.5 9.69 16.8 10.44 16.92 11.25H13.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`HeatPump`},`${e.clusterId}-${e.attributeId}`)),r===23&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M4,2H20A2,2 0 0,1 22,4V14A2,2 0 0,1 20,16H15V20H18V22H13V16H11V22H6V20H9V16H4A2,2 0 0,1 2,14V4A2,2 0 0,1 4,2M4,4V8H11V4H4M4,14H11V10H4V14M20,14V10H13V14H20M20,4H13V8H20V4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Solar`},`${e.clusterId}-${e.attributeId}`)),r===24&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`featureMap`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12 20L5 20V12H2L12 3L14.78 5.5H14V7.17C12.84 7.58 12 8.7 12 10V20M15 9H16V7.5H20V9H21C21.55 9 22 9.45 22 10V21C22 21.55 21.55 22 21 22H15C14.45 22 14 21.55 14 21V10C14 9.45 14.45 9 15 9M16 11V14H20V11H16Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Inverter`},`${e.clusterId}-${e.attributeId}`)),r===40&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===35&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===34&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===41&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===42&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===36&&i.filter(e=>e.clusterName===`ApplicationBasic`&&e.attributeName===`applicationName`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`App`},`${e.clusterId}-${e.attributeId}`)),r===14&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M10,2C8.89,2 8,2.89 8,4V7C8,8.11 8.89,9 10,9H11V11H2V13H6V15H5C3.89,15 3,15.89 3,17V20C3,21.11 3.89,22 5,22H9C10.11,22 11,21.11 11,20V17C11,15.89 10.11,15 9,15H8V13H16V15H15C13.89,15 13,15.89 13,17V20C13,21.11 13.89,22 15,22H19C20.11,22 21,21.11 21,20V17C21,15.89 20.11,15 19,15H18V13H22V11H13V9H14C15.11,9 16,8.11 16,7V4C16,2.89 15.11,2 14,2H10M10,4H14V7H10V4M5,17H9V20H5V17M15,17H19V20H15V17Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Aggregator`},`${e.clusterId}-${e.attributeId}`)),r===322&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Camera`},`${e.clusterId}-${e.attributeId}`)),r===324&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Floodlight`},`${e.clusterId}-${e.attributeId}`)),r===323&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Video bell`},`${e.clusterId}-${e.attributeId}`)),r===320&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Intercom`},`${e.clusterId}-${e.attributeId}`)),r===325&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Snapshot`},`${e.clusterId}-${e.attributeId}`)),r===327&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(nt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===326&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(oe,{}),cluster:e,value:`Chime`},`${e.clusterId}-${e.attributeId}`)),r===328&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(oe,{}),cluster:e,value:`Doorbell`},`${e.clusterId}-${e.attributeId}`)),r===321&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(oe,{}),cluster:e,value:`Audio bell`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!0)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`smokeState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No smoke`:`Smoke!`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!1)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No Co`:`Co!`},`${e.clusterId}-${e.attributeId}`)),r===66&&i.filter(e=>e.clusterName===`ValveConfigurationAndControl`&&e.attributeName===`currentState`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M4 22H2V2H4M22 2H20V22H22M17.24 5.34L13.24 9.34A3 3 0 0 0 9.24 13.34L5.24 17.34L6.66 18.76L10.66 14.76A3 3 0 0 0 14.66 10.76L18.66 6.76Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===64&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M10 10H14V22H10V10M7 9H9V7H7V9M4 8H6V6H4V8M4 11H6V9H4V11M1 13H3V11H1V13M1 7H3V5H1V7M1 10H3V8H1V10M18 11H20V9H18V11M21 10H23V8H21V10M21 5V7H23V5H21M21 13H23V11H21V13M15 9H17V7H15V9M18 8H20V6H18V8M10 7H10.33L11 9H13L13.67 7H14V6H10V7Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Irrigation`},`${e.clusterId}-${e.attributeId}`)),r===44&&i.filter(e=>e.clusterName===`AirQuality`&&e.attributeName===`airQuality`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M11,9A4,4 0 0,1 15,13A4,4 0 0,1 11,17A4,4 0 0,1 7,13A4,4 0 0,1 11,9M11,11A2,2 0 0,0 9,13A2,2 0 0,0 11,15A2,2 0 0,0 13,13A2,2 0 0,0 11,11M7,4H14A4,4 0 0,1 18,8V9H16V8A2,2 0 0,0 14,6H7A2,2 0 0,0 5,8V20H16V18H18V22H3V8A4,4 0 0,1 7,4M16,11C18.5,11 18.5,9 21,9V11C18.5,11 18.5,13 16,13V11M16,15C18.5,15 18.5,13 21,13V15C18.5,15 18.5,17 16,17V15Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:a[e.attributeLocalValue??0]},`${e.clusterId}-${e.attributeId}`)),r===770&&i.filter(e=>e.clusterName===`TemperatureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(ye,{}),cluster:e,value:e.attributeLocalValue/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===775&&i.filter(e=>e.clusterName===`RelativeHumidityMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue/100,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===69&&i.filter(e=>e.clusterName===`SoilMeasurement`&&e.attributeName===`soilMoistureMeasuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===774&&i.filter(e=>e.clusterName===`FlowMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(ot,{}),cluster:e,value:e.attributeLocalValue/10,unit:`m³/h`},`${e.clusterId}-${e.attributeId}`)),r===773&&i.filter(e=>e.clusterName===`PressureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(Ae,{}),cluster:e,value:e.attributeLocalValue,unit:`hPa`},`${e.clusterId}-${e.attributeId}`)),r===21&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,J.jsx)($,{icon:e.attributeValue===`true`?(0,J.jsx)(ut,{}):(0,J.jsx)(Pe,{}),cluster:e,value:e.attributeValue===`true`?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===263&&i.filter(e=>e.clusterName===`OccupancySensing`&&e.attributeName===`occupancy`).map(e=>(0,J.jsx)($,{icon:e.attributeValue===`{ occupied: true }`?(0,J.jsx)(xe,{}):(0,J.jsx)(ve,{}),cluster:e,value:e.attributeValue===`{ occupied: true }`?`Occupied`:`Unocc.`},`${e.clusterId}-${e.attributeId}`)),r===262&&i.filter(e=>e.clusterName===`IlluminanceMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(it,{}),cluster:e,value:Math.round(10**(e.attributeLocalValue/1e4)),unit:`lx`},`${e.clusterId}-${e.attributeId}`)),r===2128&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`---`},`${e.clusterId}-${e.attributeId}`)),r===1296&&p&&(0,J.jsx)($,{icon:(0,J.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:p,value:m,unit:`kWh`},`${p.clusterId}-${p.attributeId}`),(0,J.jsx)(V,{sx:hn,children:(0,J.jsx)(A,{sx:gn,children:o})}),(0,J.jsx)(V,{sx:_n,children:(0,J.jsx)(A,{sx:vn,children:e.deviceName})}),(0,J.jsxs)(V,{sx:yn,children:[K&&(0,J.jsx)(A,{sx:bn,children:t}),(0,J.jsx)(A,{sx:bn,children:n}),K&&(0,J.jsxs)(A,{sx:bn,children:[`0x`,r.toString(16).padStart(4,`0`)]})]})]})}var jn=(0,U.memo)(An);function Mn({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)({}),[d,f]=(0,U.useState)({}),p=(0,U.useRef)(o()),m=(0,U.useRef)(s);(0,U.useEffect)(()=>{m.current=s},[s]);let h=(0,U.useRef)(d);(0,U.useEffect)(()=>{h.current=d},[d]);let g=(0,U.useCallback)(e=>{K&&console.log(`DevicesIcons received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=m.current,n=h.current,r=t.find(t=>t.plugin===e.response.plugin&&t.serialNumber===e.response.serialNumber);if(!r){K&&console.warn(`DevicesIcons updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" number "${e.response.number}" id "${e.response.id}" not found in devices(${t.length})`);return}let i=n[r.serialNumber]?.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);i?(i.attributeValue=String(e.response.value),i.attributeLocalValue=e.response.value,f(e=>({...e})),K&&console.log(`DevicesIcons updated "${i.clusterName}.${i.attributeName}" for device "${r.deviceName}" serial "${r.serialNumber}" to "${i.attributeValue}"`)):K&&console.warn(`DevicesIcons updater device "${r.deviceName}" serial "${r.serialNumber}" cluster "${e.response.cluster}" attribute "${e.response.attribute}" not found in clusters(${n[r.serialNumber]?.length})`)},[]),_=(0,U.useCallback)(e=>{if(K&&console.log(`DevicesIcons received for device "${e.response.deviceName}" serial "${e.response.serialNumber}" deviceTypes (${e.response.deviceTypes.length}) "${e.response.deviceTypes.join(`,`)}" clusters (${e.response.clusters.length}):`,e.response),e.response.clusters.length===0)return;let t=e.response.serialNumber,n=[],r=[];for(let t of e.response.clusters)n.find(e=>e.endpoint===t.endpoint)||n.push({endpoint:t.endpoint,id:t.id,deviceTypes:t.deviceTypes}),[`FixedLabel`,`Identify`,`Groups`,`ScenesManagement`,`PowerTopology`].includes(t.clusterName)||r.push(t);u(e=>({...e,[t]:n})),f(e=>({...e,[t]:r})),K&&console.log(`DevicesIcons endpoints for "${t}":`,n),K&&console.log(`DevicesIcons deviceTypes for "${t}":`,e.response.deviceTypes),K&&console.log(`DevicesIcons clusters for "${t}":`,r)},[]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`)K&&console.log(`DevicesIcons received refresh_required: changed=${e.response.changed} and sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}});else if(e.method===`state_update`&&e.response)g(e);else if(e.method===`/api/devices`&&e.response){K&&console.log(`DevicesIcons received ${e.response.length} devices:`,e.response),c(e.response),u({}),f({});for(let t of e.response)K&&console.log(`DevicesIcons sending /api/clusters`),r({id:p.current,sender:`DevicesIcons`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{pluginName:t.plugin,number:t.number||0,serialNumber:t.serialNumber,uniqueId:t.uniqueId}})}else e.method===`/api/clusters`&&e.response&&_(e)};return i(e,p.current),K&&console.log(`DevicesIcons WebSocket effect mounted`),()=>{a(e),K&&console.log(`DevicesIcons WebSocket effect unmounted`)}},[i,_,a,r,g]),(0,U.useEffect)(()=>(K&&console.log(`DevicesIcons useEffect online mounting`),n&&(K&&console.log(`DevicesIcons useEffect online sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}})),K&&console.log(`DevicesIcons useEffect online mounted`),()=>{K&&console.log(`DevicesIcons useEffect online unmounted`)}),[n,r]);let v=e?.trim().toLowerCase(),y=v&&v!==`all plugins`;return K&&console.log(`DevicesIcons rendering...`),(0,J.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,paddingBottom:`5px`,gap:`20px`,width:`100%`,overflow:`auto`},children:s.filter(e=>y&&e.plugin.toLowerCase()!==v?!1:t===``||e.deviceName.toLowerCase().includes(t.toLowerCase())||e.serialNumber.toLowerCase().includes(t.toLowerCase())).map(e=>l[e.serialNumber]&&l[e.serialNumber].map(t=>t.deviceTypes.map(n=>(0,J.jsx)(jn,{device:e,endpoint:t.endpoint,id:t.id,deviceType:n,clusters:(d[e.serialNumber]??[]).filter(e=>e.endpoint===t.endpoint)},`${e.plugin}-${e.uniqueId}-${t.endpoint}-${t.id}-${n.toString()}`))))})}var Nn=(0,U.memo)(Mn),Pn=e=>`0x${e.toString(16).padStart(4,`0`)}`,Fn=e=>`ep:${e}`,In=(e,t)=>`cl:${e}::${t}`,Ln=(e,t,n)=>`at:${e}::${t}::${n}`;function Rn(e){let t=new Map;for(let n of e){let e=t.get(n.endpoint);e||(e={endpoint:n.endpoint,id:n.id,deviceTypes:n.deviceTypes,clusters:[]},t.set(n.endpoint,e));let r=e.clusters.find(e=>e.name===n.clusterName);r||(r={name:n.clusterName,id:n.clusterId,attributes:[]},e.clusters.push(r)),r.attributes.push(n)}return[...t.values()]}var zn=(e,t)=>({display:`flex`,alignItems:`center`,gap:`4px`,padding:`2px 8px 2px ${8+t*16}px`,cursor:`pointer`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`14px`,backgroundColor:e?`var(--table-selected-bg-color)`:`transparent`}),Bn={color:`var(--secondary-color)`,paddingRight:`16px`,verticalAlign:`top`,whiteSpace:`nowrap`};function Vn({label:e,children:t}){return(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{style:Bn,children:e}),(0,J.jsx)(`td`,{style:{wordBreak:`break-all`},children:t})]})}function Hn({node:e}){if(!e)return(0,J.jsx)(`div`,{style:{padding:`10px`,color:`var(--secondary-color)`},children:`Select a node in the tree to see its details.`});if(e.kind===`endpoint`)return(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`h3`,{style:{margin:`0 0 8px 0`},children:[`Endpoint `,e.group.endpoint]}),(0,J.jsx)(`table`,{children:(0,J.jsxs)(`tbody`,{children:[(0,J.jsx)(Vn,{label:`Id`,children:e.group.id}),(0,J.jsx)(Vn,{label:`Device types`,children:e.group.deviceTypes.map(Pn).join(`, `)}),(0,J.jsx)(Vn,{label:`Clusters`,children:e.group.clusters.length})]})})]});if(e.kind===`cluster`)return(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`h3`,{style:{margin:`0 0 8px 0`},children:[`Cluster `,e.cluster.name]}),(0,J.jsx)(`table`,{style:{marginBottom:`12px`},children:(0,J.jsxs)(`tbody`,{children:[(0,J.jsx)(Vn,{label:`Endpoint`,children:e.group.endpoint}),(0,J.jsx)(Vn,{label:`Cluster ID`,children:e.cluster.id})]})}),(0,J.jsxs)(`table`,{style:{borderCollapse:`collapse`,width:`100%`},children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{style:{...Bn,color:`var(--primary-color)`,textAlign:`left`},children:`Attribute`}),(0,J.jsx)(`th`,{style:{...Bn,color:`var(--primary-color)`,textAlign:`left`},children:`ID`}),(0,J.jsx)(`th`,{style:{...Bn,color:`var(--primary-color)`,textAlign:`left`},children:`Value`})]})}),(0,J.jsx)(`tbody`,{children:e.cluster.attributes.map(e=>(0,J.jsxs)(`tr`,{style:{borderTop:`1px solid var(--table-border-color)`},children:[(0,J.jsx)(`td`,{children:e.attributeName}),(0,J.jsx)(`td`,{children:e.attributeId}),(0,J.jsx)(`td`,{style:{wordBreak:`break-all`},children:e.attributeValue})]},e.attributeName))})]})]});let{attribute:t}=e;return(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`h3`,{style:{margin:`0 0 8px 0`},children:[`Attribute `,t.attributeName]}),(0,J.jsx)(`table`,{style:{marginBottom:`12px`},children:(0,J.jsxs)(`tbody`,{children:[(0,J.jsx)(Vn,{label:`Path`,children:`Endpoint ${e.group.endpoint} › ${e.cluster.name} › ${t.attributeName}`}),(0,J.jsx)(Vn,{label:`Cluster ID`,children:t.clusterId}),(0,J.jsx)(Vn,{label:`Attribute ID`,children:t.attributeId}),(0,J.jsx)(Vn,{label:`Device types`,children:e.group.deviceTypes.map(Pn).join(`, `)})]})}),(0,J.jsx)(`div`,{style:{fontWeight:`bold`},children:`Value`}),(0,J.jsx)(`pre`,{style:{margin:`4px 0 0 0`,padding:`8px`,border:`1px solid var(--table-border-color)`,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:JSON.stringify(t.attributeLocalValue,(e,t)=>typeof t==`bigint`?t.toString():t,2)??`undefined`})]})}function Un({clusters:e}){let[t,n]=(0,U.useState)(new Set),r=e=>e.startsWith(`ep:`)!==t.has(e),[i,a]=(0,U.useState)(null),o=(0,U.useMemo)(()=>Rn(e),[e]),s=(0,U.useMemo)(()=>{let e=new Map;for(let t of o){e.set(Fn(t.endpoint),{kind:`endpoint`,key:Fn(t.endpoint),group:t});for(let n of t.clusters){let r=In(t.endpoint,n.name);e.set(r,{kind:`cluster`,key:r,group:t,cluster:n});for(let r of n.attributes){let i=Ln(t.endpoint,n.name,r.attributeName);e.set(i,{kind:`attribute`,key:i,group:t,cluster:n,attribute:r})}}}return e},[o]),c=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=e=>{a(e),c(e)},u=(()=>{let e=[];return o.forEach((t,n)=>{let i=Fn(t.endpoint);e.push({key:i,depth:0,label:`Endpoint ${t.endpoint}`,expandable:!0,parent:null,posinset:n+1,setsize:o.length}),r(i)&&t.clusters.forEach((n,a)=>{let o=In(t.endpoint,n.name);e.push({key:o,depth:1,label:n.name,expandable:!0,parent:i,posinset:a+1,setsize:t.clusters.length}),r(o)&&n.attributes.forEach((r,i)=>e.push({key:Ln(t.endpoint,n.name,r.attributeName),depth:2,label:r.attributeName,expandable:!1,parent:o,posinset:i+1,setsize:n.attributes.length}))})}),e})(),[d,f]=(0,U.useState)(null),p=(0,U.useRef)(new Map),m=u.some(e=>e.key===d)?d:u[0]?.key,h=e=>{e&&(f(e),p.current.get(e)?.focus())},g=(e,t)=>{let n=u[t];switch(e.key){case`Enter`:case` `:l(n.key);break;case`ArrowDown`:h(u[t+1]?.key);break;case`ArrowUp`:h(u[t-1]?.key);break;case`Home`:h(u[0].key);break;case`End`:h(u[u.length-1].key);break;case`ArrowRight`:if(!n.expandable)break;r(n.key)?h(u[t+1]?.key):c(n.key);break;case`ArrowLeft`:n.expandable&&r(n.key)?c(n.key):h(n.parent??void 0);break;default:return}e.preventDefault()};return(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flex:`1 1 auto`,minHeight:0,width:`100%`,overflow:`hidden`,color:`var(--div-text-color)`},children:[(0,J.jsx)(`div`,{role:`tree`,"aria-label":`Clusters`,style:{flex:`0 0 30%`,minWidth:`200px`,overflowX:`hidden`,overflowY:`auto`,borderRight:`2px solid var(--main-grey-color)`},children:u.map((e,t)=>(0,J.jsxs)(`div`,{ref:t=>{t?p.current.set(e.key,t):p.current.delete(e.key)},role:`treeitem`,"aria-level":e.depth+1,"aria-posinset":e.posinset,"aria-setsize":e.setsize,"aria-selected":i===e.key,"aria-expanded":e.expandable?r(e.key):void 0,style:zn(i===e.key,e.depth),tabIndex:e.key===m?0:-1,onClick:()=>{f(e.key),l(e.key)},onKeyDown:e=>g(e,t),children:[(0,J.jsx)(`span`,{style:{width:`12px`},children:e.expandable?r(e.key)?`▾`:`▸`:``}),e.label]},e.key))}),(0,J.jsx)(`div`,{style:{flex:`1 1 auto`,overflowX:`hidden`,overflowY:`auto`},children:(0,J.jsx)(Hn,{node:i?s.get(i):void 0})})]})}var Wn=(0,U.memo)(Un);function Gn(e){return e?e.scrollWidth>e.clientWidth:!1}function Kn({title:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)(!1);return(0,J.jsx)(H,{title:e,open:r,disableHoverListener:!0,disableFocusListener:!0,disableTouchListener:!0,slotProps:{tooltip:{sx:{fontSize:`14px`,fontWeight:`normal`,color:`#ffffff`,backgroundColor:`var(--primary-color)`,maxWidth:500,whiteSpace:`pre-wrap`,wordBreak:`break-word`}}},children:(0,J.jsx)(`span`,{ref:n,onMouseEnter:()=>{i(Gn(n.current))},onMouseLeave:()=>{i(!1)},style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})})}function qn(e,t,n){let r=e?.[n],i=t?.[n];return r==null&&i==null?0:r==null?-1:i==null?1:typeof r==`boolean`&&typeof i==`boolean`?r===i?0:r?1:-1:typeof r==`number`&&typeof i==`number`?r-i:String(r).localeCompare(String(i))}function Jn({name:e,title:t,columns:n,rows:r,getRowKey:i,footerLeft:a,footerRight:o,headerActions:s,onRowClick:c}){let l=t=>{if(typeof i==`string`&&t&&t[i]!=null)return t[i];if(typeof i==`function`){let e=i(t);if(e!=null)return e}let a=n?.[0]?.id;return a&&t&&t[a]!=null?t[a]:(console.warn(`MbfTable(${e}): using fallback stable row key; consider providing getRowKey prop for better React performance`),`rk_${r.indexOf(t)}`)},u=e.replace(/\s+/g,`-`).toLowerCase(),d=`${W}${u}-table-order-by`,f=`${W}${u}-table-order`,p=`${W}${u}-column-visibility`,[m,h]=(0,U.useState)(localStorage.getItem(d)||null),[g,_]=(0,U.useState)(localStorage.getItem(f)||null),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(()=>{try{let e=localStorage.getItem(p);if(e)return JSON.parse(e)}catch{}return{}}),S=(0,U.useMemo)(()=>{let e={};for(let t of n)t.hidden||(e[t.id]=t.required?!0:b[t.id]!==!1);return e},[n,b]),C=(0,U.useMemo)(()=>{if(!m||!g)return r;let e=n.find(e=>e.id===m);if(!e||e.noSort)return r;let t=r.map((e,t)=>({el:e,index:t}));return t.sort((t,n)=>{let r;return r=typeof e.comparator==`function`?e.comparator(t.el,n.el):qn(t.el,n.el,m),r===0?t.index-n.index:g===`asc`?r:-r}),t.map(e=>e.el)},[r,m,g,n]),T=e=>{m!==e||!m?(h(e),_(`asc`),localStorage.setItem(d,e),localStorage.setItem(f,`asc`)):g===`asc`?(_(`desc`),localStorage.setItem(f,`desc`)):(h(null),_(null),localStorage.removeItem(d),localStorage.removeItem(f))},D=()=>{y(!v)},O=e=>{x(t=>{if(n.find(t=>t.id===e)?.required)return t;let r=S[e]!==!1,i={...t};r?i[e]=!1:delete i[e];try{localStorage.setItem(p,JSON.stringify(i))}catch{}return i})},k=()=>{x({});try{localStorage.removeItem(p)}catch{}y(!1)},[A,j]=(0,U.useState)(!1);return A?null:(K&&console.log(`Rendering table ${e}${m&&g?` ordered by ${m}:${g}`:``}`),(0,J.jsxs)(`div`,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,margin:`0`,padding:`0`,gap:`0`,width:`100%`,height:`100%`,overflow:`hidden`},children:[(0,J.jsxs)(R,{open:v,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&D()},disableRestoreFocus:!0,children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:`Configure ${e} columns`})]})}),(0,J.jsx)(E,{children:(0,J.jsx)(N,{children:n.filter(e=>!e.hidden).map(e=>(0,J.jsx)(le,{control:(0,J.jsx)(w,{disabled:!!e.required,checked:e.required?!0:S[e.id]!==!1,onChange:()=>O(e.id)}),label:e.label},e.id))})}),(0,J.jsxs)(he,{children:[(0,J.jsx)(M,{onClick:k,children:`Reset`}),(0,J.jsx)(M,{variant:`contained`,onClick:e=>{if(e?.currentTarget&&typeof e.currentTarget.blur==`function`)try{e.currentTarget.blur()}catch{}let t=document.activeElement;if(t&&t instanceof HTMLElement&&typeof t.blur==`function`)try{t.blur()}catch{}D()},children:`Close`})]})]}),(0,J.jsxs)(rn,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,borderBottom:`none`},children:[(0,J.jsx)(Q,{children:e}),t&&(0,J.jsx)(Q,{children:t}),(0,J.jsxs)(ln,{close:()=>j(!0),children:[s,(0,J.jsx)(z,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:e=>{if(e?.currentTarget?.blur)try{e.currentTarget.blur()}catch{}D()},"aria-label":`Configure Columns`,children:(0,J.jsx)(H,{title:`Configure ${e} columns`,children:(0,J.jsx)(X.Icon,{path:Tt,size:`20px`,color:`var(--header-text-color)`})})})]})]}),(0,J.jsx)(cn,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,minHeight:0,width:`100%`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0`},children:(0,J.jsxs)(`table`,{"aria-label":`${e} table`,style:{width:`100%`,borderCollapse:`collapse`},children:[(0,J.jsx)(`thead`,{style:{position:`sticky`,top:0,zIndex:10,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color`},children:(0,J.jsx)(`tr`,{style:{height:`30px`,minHeight:`30px`},children:n.map(e=>{if(e.hidden||!e.required&&S[e.id]===!1)return null;let t=!e.noSort,n=t&&m===e.id&&!!g;return(0,J.jsxs)(`th`,{onClick:t?()=>T(e.id):void 0,style:{margin:`0`,padding:`5px 10px`,position:`sticky`,top:0,minWidth:e.minWidth,maxWidth:e.maxWidth,textAlign:e.align||`left`,cursor:t?`pointer`:`default`,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,whiteSpace:e.maxWidth?`nowrap`:void 0,overflow:e.maxWidth?`hidden`:void 0,textOverflow:e.maxWidth?`ellipsis`:void 0},"aria-sort":t?n?g===`asc`?`ascending`:`descending`:`none`:void 0,children:[e.label,n&&(0,J.jsxs)(`span`,{style:{marginLeft:6},children:[g===`asc`&&(0,J.jsx)(X.Icon,{path:`M19 17H22L18 21L14 17H17V3H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`}),g===`desc`&&(0,J.jsx)(X.Icon,{path:`M19 7H22L18 3L14 7H17V21H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`})]})]},e.id)})})}),(0,J.jsx)(`tbody`,{children:C.map((e,t)=>{let r=l(e);return(0,J.jsx)(`tr`,{className:t%2==0?`table-content-even`:`table-content-odd`,onClick:c?t=>c(e,r,t):void 0,style:{height:`30px`,minHeight:`30px`,border:`none`,borderCollapse:`collapse`,cursor:c?`pointer`:void 0},children:n.map(t=>{if(t.hidden||!t.required&&S[t.id]===!1)return null;let n=e[t.id],i=typeof t.render==`function`?t.render(n,r,e,t):typeof n==`boolean`?(0,J.jsx)(w,{checked:n,disabled:!0,size:`small`,sx:{m:0,p:0,color:`var(--table-text-color)`,"&.Mui-disabled":{color:`var(--table-text-color)`,opacity:.7}}}):t.format&&typeof n==`number`?t.format(n):n==null?null:String(n),a=t.tooltip&&t.maxWidth!==void 0&&t.maxWidth!==null&&n!=null&&i!==null?(0,J.jsx)(Kn,{title:String(n),children:i}):i;return(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,textAlign:t.align||`left`,padding:`5px 10px`,margin:`0`,maxWidth:t.maxWidth,whiteSpace:t.maxWidth?`nowrap`:void 0,overflow:t.maxWidth?`hidden`:void 0,textOverflow:t.maxWidth?`ellipsis`:void 0},children:a},t.id)})},r)})})]})}),(a||o)&&(0,J.jsxs)(an,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,border:`none`},children:[(0,J.jsx)(on,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:a}),(0,J.jsx)(on,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:o})]})]}))}function Yn(e){return(0,U.memo)(e)}var Xn=Yn(Jn),Zn=[{label:`Plugin name`,id:`plugin`,required:!0},{label:`Device type`,id:`type`},{label:`Endpoint`,id:`number`,align:`right`},{label:`Name`,id:`deviceName`,required:!0},{label:`Serial number`,id:`serialNumber`},{label:`Unique ID`,id:`uniqueId`},{label:`Url`,id:`configUrl`},{label:`Config`,id:`configButton`,noSort:!0,render:(e,t,n,r)=>n.configUrl?(0,J.jsx)(z,{onClick:()=>window.open(n.configUrl,`_blank`),"aria-label":`Open Config`,sx:{margin:0,padding:0},children:(0,J.jsx)(T,{fontSize:`small`})}):null},{label:`Cluster`,id:`cluster`}],Qn=[{label:`Endpoint`,id:`endpoint`,required:!0},{label:`Id`,id:`id`},{label:`Device Types`,id:`deviceTypes`,render:(e,t,n,r)=>Array.isArray(e)?(0,J.jsx)(J.Fragment,{children:e.map(e=>`0x${e.toString(16).padStart(4,`0`)}`).join(`, `)}):(0,J.jsx)(J.Fragment,{children:e})},{label:`Cluster Name`,id:`clusterName`,required:!0},{label:`Cluster ID`,id:`clusterId`},{label:`Attribute Name`,id:`attributeName`,required:!0},{label:`Attribute ID`,id:`attributeId`},{label:`Attribute Value`,id:`attributeValue`,required:!0,maxWidth:350,tooltip:!0}],$n=e=>`${e.plugin}::${e.uniqueId}`,er=e=>`${e.endpoint}::${e.clusterName}::${e.attributeName}`;function tr({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)([]),[d,f]=(0,U.useState)(0),[p,m]=(0,U.useState)(()=>localStorage.getItem(G[`devices-cluster-view-mode`])===`tree`?`tree`:`grid`),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(null),[C,w]=(0,U.useState)(null),T=(0,U.useMemo)(()=>{let n=e?.trim().toLowerCase(),r=n&&n!==`all plugins`,i=s;return r&&(i=i.filter(e=>e.plugin.toLowerCase()===n)),t!==``&&(i=i.filter(e=>e.deviceName.toLowerCase().includes(t.toLowerCase())||e.serialNumber.toLowerCase().includes(t.toLowerCase()))),i},[s,e,t]),E=(0,U.useRef)(o()),D=(0,U.useRef)(T),O=(0,U.useCallback)(e=>{K&&console.log(`DevicesTable received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=D.current.find(t=>t.plugin===e.response.plugin&&t.uniqueId===e.response.uniqueId);if(!t)K&&console.warn(`DevicesTable updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" not found in filteredDevicesRef.current`);else if(h&&_&&t.plugin===h&&t.uniqueId===x&&e.response.number.toString()===_){let n=l.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);if(!n){K&&console.warn(`DevicesTable updater cluster ${e.response.cluster}.${e.response.attribute} for device "${t.deviceName}" serial "${t.serialNumber}" not found in clusters`);return}n.attributeValue=typeof e.response.value==`object`?JSON.stringify(e.response.value,void 0,1).replaceAll(`"`,``):String(e.response.value),n.attributeLocalValue=e.response.value,u([...l]),K&&console.log(`DevicesTable updated attribute ${n.clusterName}.${n.attributeName} for device "${t.deviceName}" serial "${t.serialNumber}" to "${n.attributeValue}"`)}},[l,_,h,x]);(0,U.useEffect)(()=>{let e=e=>{if(K&&console.log(`DevicesTable received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`devices`)K&&console.log(`DevicesTable received refresh_required: changed=${e.response.changed} and sending /api/devices request`),r({id:E.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!0}});else if(e.method===`state_update`&&e.response)O(e);else if(e.method===`/api/devices`)K&&console.log(`DevicesTable received ${e.response.length} devices:`,e.response),c(e.response);else if(e.method===`/api/clusters`){K&&console.log(`DevicesTable received ${e.response.clusters.length} clusters for plugin ${e.response.plugin}:`,e.response),u(e.response.clusters);let t={};for(let n of e.response.clusters)K&&console.log(`Cluster:`,n.endpoint),t[n.endpoint]?t[n.endpoint]++:t[n.endpoint]=1;f(Object.keys(t).length)}};return i(e,E.current),K&&console.log(`DevicesTable added WebSocket listener`),()=>{a(e),K&&console.log(`DevicesTable removed WebSocket listener`)}},[r,i,a,O]),(0,U.useEffect)(()=>{n&&(K&&console.log(`DevicesTable sending api requests with id `,E.current),r({id:E.current,sender:`DevicesTable`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:E.current,sender:`DevicesTable`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:E.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!0}}))},[n,r]),(0,U.useEffect)(()=>{h&&_&&C&&x&&(K&&console.log(`DevicesTable sending /api/clusters`),r({id:E.current,sender:`DevicesTable`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{pluginName:h,number:Number(_),serialNumber:C,uniqueId:x}}))},[h,_,C,x,r]),(0,U.useEffect)(()=>{D.current=T},[T]);let k=e=>{e.uniqueId===x?(S(null),w(null),g(null),v(null),b(null)):(K&&console.log(`DevicesTable handleDeviceClick: selected device "${e.deviceName}" with uniqueId "${e.uniqueId}", plugin "${e.plugin}", endpoint "${e.number}"`),S(e.uniqueId),w(e.serialNumber),g(e.plugin),v(e.number?e.number.toString():null),b(e.deviceName))},A=(0,J.jsx)(z,{onClick:()=>{let e=p===`tree`?`grid`:`tree`;localStorage.setItem(G[`devices-cluster-view-mode`],e),m(e)},"aria-label":p===`tree`?`Switch to grid view`:`Switch to tree view`,sx:{margin:0,padding:0,color:`var(--header-text-color)`},children:p===`tree`?(0,J.jsx)(ft,{fontSize:`small`}):(0,J.jsx)(me,{fontSize:`small`})}),j=`Total child endpoints: ${d-1}`;return K&&console.log(`DevicesTable rendering...`),n?(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,margin:`0px`,padding:`0px`,gap:`20px`,width:`100%`,flex:`1 1 auto`,minHeight:0,overflow:`hidden`},children:[(0,J.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,maxHeight:h&&_?`30%`:`100%`,flex:`1 1 auto`,overflow:`hidden`},children:(0,J.jsx)(Xn,{name:`Registered devices`,getRowKey:$n,onRowClick:k,rows:T,columns:Zn,footerLeft:`Total devices: ${T.length.toString()}`})}),h&&_&&(0,J.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,height:`70%`,maxHeight:`70%`,flex:`1 1 auto`,overflow:`hidden`},children:p===`tree`?(0,J.jsxs)(`div`,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,margin:`0`,padding:`0`,gap:`0`,width:`100%`,height:`100%`,overflow:`hidden`},children:[(0,J.jsxs)(rn,{style:{height:`30px`,minHeight:`30px`,borderBottom:`none`},children:[(0,J.jsx)(Q,{children:`Clusters`}),(0,J.jsx)(Q,{children:y||``}),(0,J.jsx)(ln,{children:A})]}),(0,J.jsx)(Wn,{clusters:l}),(0,J.jsx)(an,{children:(0,J.jsx)(on,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:j})})]}):(0,J.jsx)(Xn,{name:`Clusters`,title:y||``,getRowKey:er,rows:l,columns:Qn,footerLeft:j,headerActions:A})})]}):(0,J.jsx)(nn,{})}var nr=(0,U.memo)(tr);function rr({children:e,style:t,name:n}){let{setCurrentPage:r}=(0,U.useContext)($t);return r(n),K&&console.log(`MbfPage: current page set to ${n}`),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`20px`,...t},children:e})}function ir(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,U.useContext)(Y),[a,o]=(0,U.useState)([`All plugins`]),[s,c]=(0,U.useState)(()=>localStorage.getItem(G[`devices-filter-plugins`])||`All plugins`),[l,u]=(0,U.useState)(()=>localStorage.getItem(G[`devices-filter-devices`])||``),[d,f]=(0,U.useState)(()=>localStorage.getItem(G[`devices-view-mode`])||`icon`),p=(0,U.useRef)(i());(0,U.useEffect)(()=>{let e=e=>{K&&e.id&&console.log(`Devices received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`plugins`&&!e.response.lock?(K&&console.log(`Devices received refresh_required for plugins lock=${e.response.lock}, sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`/api/plugins`&&e.id===p.current&&e.response&&(K&&console.log(`Devices received ${e.response.length} plugins:`,e.response),o([`All plugins`,...e.response.map(e=>e.name)]))};return n(e,p.current),K&&console.log(`Devices added WebSocket listener`),()=>{r(e),K&&console.log(`Devices removed WebSocket listener`)}},[t,n,r]),(0,U.useEffect)(()=>{e&&(o([`All plugins`]),K&&console.log(`Devices sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[e,t]);let m=e=>{let t=e.target.value;c(t),localStorage.setItem(G[`devices-filter-plugins`],t)},h=e=>{u(e.target.value),localStorage.setItem(G[`devices-filter-devices`],e.target.value)},g=()=>{u(``),localStorage.removeItem(G[`devices-filter-devices`])},_=e=>{f(e),localStorage.setItem(G[`devices-view-mode`],e)};return K&&console.log(`Devices rendering...`),e?(0,J.jsxs)(rr,{name:`Devices`,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`,width:`100%`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`},children:[(0,J.jsxs)(V,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(A,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Plugin:`}),(0,J.jsx)(H,{title:`Filter devices by plugin`,children:(0,J.jsx)(de,{variant:`outlined`,value:s,onChange:m,sx:{width:`260px`,backgroundColor:`var(--main-bg-color)`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`},"& .MuiSelect-select":{backgroundColor:`var(--main-bg-color)`}},input:(0,J.jsx)(pe,{sx:{backgroundColor:`var(--main-bg-color)`}}),children:a.map(e=>(0,J.jsx)(b,{value:e,children:e},e))})})]}),(0,J.jsxs)(V,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(A,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Filter by:`}),(0,J.jsx)(H,{title:`Filter devices by name or serial number`,children:(0,J.jsx)(Oe,{variant:`outlined`,value:l,onChange:h,placeholder:`Enter the device name or serial`,sx:{width:`260px`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`}},slotProps:{input:{endAdornment:l?(0,J.jsx)(ae,{position:`end`,children:(0,J.jsx)(z,{"aria-label":`Clear device filter`,size:`small`,onClick:g,edge:`end`,children:(0,J.jsx)(_t,{sx:{fontSize:18,color:`var(--main-label-color)`}})})}):null}}})})]})]}),(0,J.jsxs)(V,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(A,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`View mode:`}),(0,J.jsx)(z,{onClick:()=>_(`table`),"aria-label":`Table View`,disabled:d===`table`,children:(0,J.jsx)(H,{title:`Table View`,children:(0,J.jsx)(ft,{style:{color:d===`table`?`var(--main-icon-color)`:`var(--primary-color)`}})})}),(0,J.jsx)(z,{onClick:()=>_(`icon`),"aria-label":`Icon View`,disabled:d===`icon`,children:(0,J.jsx)(H,{title:`Icon View (beta)`,children:(0,J.jsx)(we,{style:{color:d===`icon`?`var(--main-icon-color)`:`var(--primary-color)`}})})})]})]}),d===`table`&&(0,J.jsx)(nr,{filterPlugins:s,filterDevices:l},`table-${e}`),d===`icon`&&(0,J.jsx)(Nn,{filterPlugins:s,filterDevices:l},`icon-${e}`)]}):(0,J.jsx)(nn,{})}var ar=(0,U.memo)(ir);function or({version:e}){let{online:t}=(0,U.useContext)(Y);return K&&console.log(`HomeBrowserRefresh rendering...`),t?(0,J.jsxs)(Z,{children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Frontend Update`})}),(0,J.jsxs)(cn,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,J.jsxs)(`h4`,{style:{margin:0},children:[`The frontend has been updated to version `,e,`. You are viewing an outdated web UI. Please refresh the page now.`]}),(0,J.jsx)(`div`,{children:(0,J.jsx)(M,{onClick:()=>window.location.reload(),endIcon:(0,J.jsx)(L,{}),style:{marginLeft:`10px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Refresh`})})]})]}):(0,J.jsx)(nn,{})}var sr=(0,U.memo)(or);function cr(e){if(K&&console.log(`getQRColor (id: ${e?.id}) received matter:`,e??`undefined`),e===void 0||!e.online||!e.qrPairingCode&&!e.manualPairingCode&&!e.fabricInformations&&!e.sessionInformations)return`red`;if(!e.commissioned&&e.qrPairingCode&&e.manualPairingCode)return`var(--primary-color)`;let t=0,n=0;for(let r of e.sessionInformations??[])r.fabric&&r.isPeerActive&&t++,r.numberOfActiveSubscriptions>0&&(n+=r.numberOfActiveSubscriptions);return e.commissioned&&e.fabricInformations&&e.sessionInformations&&(t===0||n===0)?`var(--secondary-color)`:`var(--div-text-color)`}function lr(e,t,n=250){let r=(0,U.useRef)(null),i=()=>{r.current&&clearTimeout(r.current),r.current=null};return(0,U.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),a=>({onClick:()=>{i(),r.current=setTimeout(()=>{r.current=null,e(a)},n)},onDoubleClick:()=>{i(),t(a)}})}var ur=e=>`${e.plugin}::${e.serialNumber}`,dr=(e,t)=>{let n=`plugins/${t}`,r=e.replace(/^\.?\//,``);return r===e||!r.startsWith(n)?!1:[``,`/`,`?`,`#`].includes(r.charAt(n.length))},fr=(e,t)=>/^\.?\/plugins\//.test(e)&&!dr(e,t),pr=(e,t)=>e===void 0?t:e===100?x:e>=80?D:e>=60?ee:e>=40?Ye:e>=20?ce:e>=10?vt:p;function mr({storeId:e,setStoreId:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),{mobile:s}=(0,U.useContext)($t),[c,l]=(0,U.useState)(`Waiting for the plugins to fully load...`),[u,d]=(0,U.useState)(``),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)([]),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(`inactive`),C=(0,U.useRef)(o()),O=[{label:`Plugin`,id:`plugin`},{label:`Name`,id:`deviceName`,required:!0},{label:`Serial`,id:`serialNumber`},{label:`Availability`,id:`availability`,render:(e,t,n,r)=>n.reachable===!0?`Online`:n.reachable===!1?(0,J.jsx)(`span`,{style:{color:`red`},children:`Offline`}):``,comparator:(e,t)=>(e.reachable===!0?1:e.reachable===!1?0:-1)-(t.reachable===!0?1:t.reachable===!1?0:-1)},{label:`Power`,id:`powerSource`,render:(e,t,n,r)=>{if(n.powerSource===`ac`||n.powerSource===`dc`)return(0,J.jsx)(H,{title:n.powerSource===`ac`?`AC current`:`DC current`,children:(0,J.jsx)(qe,{fontSize:`small`,sx:{color:`var(--primary-color)`}})});if(n.powerSource===`ok`){let e=pr(n.batteryLevel,D);return n.batteryLevel===void 0?(0,J.jsx)(e,{fontSize:`small`,sx:{color:`gray`}}):(0,J.jsx)(H,{title:`Battery level: ${n.batteryLevel}%`,children:(0,J.jsx)(e,{fontSize:`small`,sx:{color:`green`}})})}if(n.powerSource===`warning`){let e=pr(n.batteryLevel,ce);return n.batteryLevel===void 0?(0,J.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}}):(0,J.jsx)(H,{title:`Battery level: ${n.batteryLevel}%`,children:(0,J.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}})})}if(n.powerSource===`critical`){let e=pr(n.batteryLevel,p);return n.batteryLevel===void 0?(0,J.jsx)(e,{fontSize:`small`,sx:{color:`red`}}):(0,J.jsx)(H,{title:`Battery level: ${n.batteryLevel}%`,children:(0,J.jsx)(e,{fontSize:`small`,sx:{color:`red`}})})}return(0,J.jsx)(`span`,{})}},{label:`Actions`,id:`selected`,required:!0,render:(n,r,i,a)=>(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`},children:[i.matter===void 0?(0,J.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,J.jsx)(H,{title:`Show the QRCode or the fabrics`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,J.jsx)(z,{onClick:()=>t(e===i.matter?.id?f?.matterbridgeInformation.bridgeMode===`bridge`?`Matterbridge`:null:i.matter?.id||null),"aria-label":`Show the QRCode`,sx:{margin:0,padding:0,color:cr(i.matter)},children:(0,J.jsx)(ne,{fontSize:`small`})})}),i.configUrl&&!fr(i.configUrl,i.plugin)?(0,J.jsx)(H,{title:dr(i.configUrl,i.plugin)?`Open the device page in the plugin frontend (double-click for a new tab)`:`Open the configuration page`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,J.jsx)(z,{...N(i),"aria-label":`Open config url`,sx:{margin:0,padding:0},children:dr(i.configUrl,i.plugin)?(0,J.jsx)(ie,{fontSize:`small`}):(0,J.jsx)(T,{fontSize:`small`})})}):(0,J.jsx)(`div`,{style:{width:`20px`,height:`20px`}}),i.selected===void 0?(0,J.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,J.jsx)(H,{title:`Select/unselect the device`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,J.jsx)(w,{checked:i.selected,onChange:e=>j(e,i),sx:{margin:`0`,marginLeft:`8px`,padding:`0`},size:`small`})})]})}],k=(0,U.useCallback)(e=>{e.selected=void 0;let t=h.find(t=>t.name===e.plugin);if(!t)return console.error(`HomeDevices isSelected: plugin ${e.plugin} not found for device ${e.deviceName} `),e.selected;let n=t.schemaJson?.properties?.whiteList?.selectFrom,r=t.configJson.postfix;return r===``&&(r=void 0),t.hasWhiteList===!0&&t.hasBlackList===!0&&n&&(e.selected=!0,n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(r?e.serialNumber.replace(`-`+r,``):e.serialNumber)&&(e.selected=!0),n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(r?e.serialNumber.replace(`-`+r,``):e.serialNumber)&&(e.selected=!1),n===`serial`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(r?e.serialNumber.replace(`-`+r,``):e.serialNumber)&&(e.selected=!1),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(e.deviceName)&&(e.selected=!0),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(e.deviceName)&&(e.selected=!1),n===`name`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(e.deviceName)&&(e.selected=!1)),e.selected},[h]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`&&e.response.changed!==`matter`)e.response.changed===`plugins`&&e.response.lock?K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} lock=${e.response.lock} skipping /api/plugins request`):(K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and sending /api/plugins request`),r({id:C.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}));else if(e.method===`refresh_required`&&e.response.changed===`matter`)K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and setting matter id ${e.response.matter?.id}`),v(t=>{let n=t.findIndex(t=>t.deviceName.replaceAll(` `,``)===e.response.matter?.id);if(n<0)return K&&console.debug(`HomeDevices: matter id ${e.response.matter?.id} not found`),t;let r=[...t];return r[n]={...r[n],matter:e.response.matter},K&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and set matter id ${e.response.matter?.id}`),r});else if(e.method===`restart_required`)K&&console.log(`HomeDevices received restart_required`),d(`Restart Required`);else if(e.method===`restart_not_required`)K&&console.log(`HomeDevices received restart_not_required`),d(``);else if(e.method===`matterbridge_status_update`)K&&console.log(`HomeDevices received matterbridge_status_update: ${e.response.status}`),S(e.response.status);else if(e.method===`state_update`&&e.response.plugin&&e.response.serialNumber&&e.response.cluster.includes(`BasicInformation`)&&e.response.attribute===`reachable`){K&&console.log(`HomeDevices updating device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}...`);let t=e.response.value;v(n=>{let r=n.findIndex(t=>t.plugin===e.response.plugin&&t.serialNumber===e.response.serialNumber);if(r<0)return K&&console.warn(`HomeDevices: device to update not found for plugin ${e.response.plugin} serial ${e.response.serialNumber}`),n;let i=[...n];return i[r]={...i[r],reachable:t},i}),K&&console.log(`HomeDevices updated device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}`)}if(e.id===C.current&&e.method===`/api/settings`)K&&console.log(`HomeDevices (id: ${e.id}) received settings:`,e.response),m(e.response),d(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired?`Restart Required`:``),S(e.response.matterbridgeInformation.bridgeStatus);else if(e.id===C.current&&e.method===`/api/plugins`){if(K&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} plugins:`,e.response),e.response){let t=!0;for(let n of e.response)n.enabled&&(n.loaded!==!0||n.started!==!0||n.error===!0)&&(t=!1);if(!t)return;K&&console.log(`HomeDevices reset plugins and mixedDevices, starting a fresh load cycle`),l(`Loading devices...`),g(e.response),v([]),r({id:C.current,sender:`HomeDevices`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!0}}),K&&console.log(`HomeDevices sent /api/devices`);for(let t of e.response)t.enabled&&t.loaded===!0&&t.started===!0&&t.error!==!0&&(r({id:C.current,sender:`HomeDevices`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:t.name}}),K&&console.log(`HomeDevices sent /api/select/devices for plugin: ${t.name}`))}}else if(e.id===C.current&&e.method===`/api/devices`){if(K&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} devices:`,e.response),e.response){let t=e.response.map(e=>Object.assign(e,{selected:k(e),origin:`device`}));l(`Registering devices...`),v(e=>{let n=new Set(t.map(e=>`${e.plugin}::${e.serialNumber}`)),r=e.filter(e=>e.origin===`select`&&!n.has(`${e.plugin}::${e.serialNumber}`));return[...t,...r]}),l(`Registered devices:`)}}else if(e.id===C.current&&e.method===`/api/select/devices`&&(K&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} selectDevices for plugin ${e.response&&e.response.length>0?e.response[0].plugin:`without select devices`}:`,e.response),e.response&&e.response.length>0)){let t=e.response[0].plugin;l(`Registering selected devices for ${t}...`),v(n=>{let r=n.filter(e=>e.origin!==`select`||e.plugin!==t),i=r.filter(e=>e.origin===`device`),a=e.response.filter(e=>!i.some(t=>t.plugin===e.plugin&&t.serialNumber.includes(e.serialNumber))).map(e=>Object.assign(e,{selected:k(e),origin:`select`}));return[...r,...a]}),l(`Registered devices:`)}};return i(e,C.current),K&&console.log(`HomeDevices added WebSocket listener id ${C.current}`),()=>{a(e),K&&console.log(`HomeDevices removed WebSocket listener`)}},[i,a,r,k]);let A=c;c.startsWith(`Registered devices:`)&&(A=`Registered devices: ${_.filter(e=>e.origin===`device`).length}/${_.length}`),(0,U.useEffect)(()=>{n&&(K&&console.log(`HomeDevices sending /api/settings and /api/plugins requests`),r({id:C.current,sender:`HomeDevices`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),l(`Loading plugins...`),r({id:C.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[n,r]);let j=(e,t)=>{K&&console.log(`handleCheckboxChange: checkbox changed to ${e.target.checked} for device ${t.deviceName} serial ${t.serialNumber}`);let n=e.target.checked;v(e=>{let r=e.findIndex(e=>e.plugin===t.plugin&&e.serialNumber===t.serialNumber);if(r<0)return console.error(`handleCheckboxChange: device ${t.deviceName} serial ${t.serialNumber} not found in mixedDevices`),e;let i=[...e];return i[r]={...i[r],selected:n},i}),e.target.checked?r({id:C.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`selectdevice`,plugin:t.plugin,serial:t.serialNumber,name:t.deviceName}}):r({id:C.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`unselectdevice`,plugin:t.plugin,serial:t.serialNumber,name:t.deviceName}})},ee=(e,t=!1)=>{if(K&&console.log(`handleConfigUrl device:`,e.deviceName,`configUrl:`,e.configUrl),e.configUrl&&!fr(e.configUrl,e.plugin)){if(dr(e.configUrl,e.plugin)){let n=`${Xt}${e.configUrl.replace(/^\.?\//,``)}`,r=new URL(n,window.location.origin);r.pathname.endsWith(`/`)||(r.pathname+=`/`);let i=`${r.pathname}${r.search}${r.hash}`;K&&console.log(`handleConfigUrl opening plugin frontend for device:`,e.deviceName,`basePath:`,Xt,`configUrl:`,e.configUrl,`computed pluginFrontendPath:`,i),t?window.open(i,`_blank`):b({name:e.deviceName,path:i})}else window.open(e.configUrl,`_blank`)}},N=lr(e=>ee(e),e=>ee(e,!0));return K&&console.log(`HomeDevices rendering...`),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{style:{flex:`1 1 auto`},children:(0,J.jsx)(Xn,{name:`Devices`,getRowKey:ur,rows:_,columns:O,footerLeft:A,footerRight:u})}),(0,J.jsxs)(R,{open:y!==null,onClose:()=>b(null),slotProps:{paper:{sx:{width:q&&s?`100vw`:`75vw`,height:q&&s?`100vh`:`75vh`,maxWidth:q&&s?`100vw`:`75vw`,maxHeight:q&&s?`100vh`:`75vh`,margin:q&&s?`0px`:void 0,display:`flex`,flexDirection:`column`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`}}},children:[(0,J.jsx)(E,{style:{display:`flex`,flex:`1 1 auto`,minHeight:0,padding:`0px`,margin:`0px`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`},children:y&&(0,J.jsx)(`iframe`,{title:`${y.name} frontend`,src:y.path,onLoad:e=>{let t=e.currentTarget.contentDocument;if(!t?.head)return;let n=getComputedStyle(document.body),r=n.getPropertyValue(`--primary-color`).trim()||`#0d6efd`,i=n.getPropertyValue(`--div-bg-color`).trim()||`#111111`;t.getElementById(`matterbridge-plugin-scrollbar-style`)?.remove();let a=t.createElement(`style`);a.id=`matterbridge-plugin-scrollbar-style`,a.textContent=`
|
|
3
3
|
html,
|
|
4
4
|
body {
|
|
5
5
|
background-color: ${i};
|
|
@@ -39,6 +39,6 @@ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{s as t}from"./vendor_e
|
|
|
39
39
|
::-webkit-scrollbar-track {
|
|
40
40
|
background: ${i};
|
|
41
41
|
}
|
|
42
|
-
`,t.head.appendChild(a)},[oe,se]=(0,U.useState)(),[ce,le]=(0,U.useState)(!1),de=e=>{K&&console.log(`handleConfigPlugin plugin:`,e.name),r({id:l.current,sender:`HomePlugins`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),r({id:l.current,sender:`HomePlugins`,method:`/api/select/entities`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),se(e),fe()},fe=()=>{le(!0)};return K&&console.log(`HomePlugins rendering...`),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Z,{children:[oe&&(0,J.jsx)(ti,{open:ce,onClose:()=>{le(!1)},onSave:e=>{g(t=>t.map(t=>t.name===oe?.name?{...t,configJson:e,restartRequired:!0}:t))},plugin:oe}),(0,J.jsx)(Xn,{name:`Plugins`,columns:C,rows:m,footerRight:``,footerLeft:``})]}),(0,J.jsxs)(R,{open:v!==null,onClose:()=>b(null),slotProps:{paper:{sx:{width:q&&s?`100vw`:`75vw`,height:q&&s?`100vh`:`75vh`,maxWidth:q&&s?`100vw`:`75vw`,maxHeight:q&&s?`100vh`:`75vh`,margin:q&&s?`0px`:void 0,display:`flex`,flexDirection:`column`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`}}},children:[(0,J.jsx)(E,{style:{display:`flex`,flex:`1 1 auto`,minHeight:0,padding:`0px`,margin:`0px`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`},children:v&&(0,J.jsx)(`iframe`,{title:`${v.name} frontend`,src:v.path,onLoad:ae,style:{display:`block`,flex:`1 1 auto`,width:`100%`,height:`100%`,border:`none`,backgroundColor:`var(--div-bg-color)`}})}),(0,J.jsx)(he,{sx:{flex:`0 0 auto`,justifyContent:`center`},children:(0,J.jsx)(M,{onClick:()=>b(null),children:`Close`})})]})]}):(0,J.jsx)(nn,{})}var ii=(0,U.memo)(ri);function ai({version:e,changelog:t}){let{online:n}=(0,U.useContext)(Y);return K&&console.log(`HomeShowChangelog rendering...`),n?(0,J.jsxs)(Z,{children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matterbridge Update`})}),(0,J.jsxs)(cn,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,J.jsxs)(`h4`,{style:{margin:0},children:[`Matterbridge has been updated to version `,e,`.`]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(M,{onClick:()=>window.open(`https://github.com/Luligu/matterbridge`,`_blank`),endIcon:(0,J.jsx)(at,{style:{color:`#FFD700`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Star`}),(0,J.jsx)(M,{onClick:()=>window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`),endIcon:(0,J.jsx)(pt,{style:{color:`#b6409c`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Sponsor`}),(0,J.jsx)(M,{onClick:()=>window.open(t,`_blank`),endIcon:(0,J.jsx)(y,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Changelog`}),(0,J.jsx)(M,{onClick:()=>window.location.reload(),endIcon:(0,J.jsx)(ke,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Close`})]})]})]}):(0,J.jsx)(nn,{})}var oi=(0,U.memo)(ai);function si({value:e,maxChars:t}){let n=e;if(e.length>t&&t>3){let r=t-3;n=`${e.substring(0,Math.ceil(r/2))} … ${e.substring(e.length-Math.floor(r/2),e.length)}`}return e===n?(0,J.jsx)(`span`,{children:n}):(0,J.jsx)(H,{title:e,placement:`top`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[0,12]}}]}},children:(0,J.jsx)(`span`,{children:n})})}var ci=new Map([[`matterbridgeVersion`,`Matterbridge version`],[`frontendVersion`,`Frontend version`],[`dockerVersion`,`Docker version`],[`homeDirectory`,`Home`],[`rootDirectory`,`Root`],[`matterbridgeDirectory`,`Storage`],[`matterbridgeCertDirectory`,`Cert`],[`matterbridgePluginDirectory`,`Plugins`],[`globalModulesDirectory`,`Modules`],[`bridgeMode`,`Bridge mode`],[`restartMode`,`Restart mode`],[`virtualMode`,`Virtual mode`],[`bridgeStatus`,`Bridge status`],[`profile`,`Profile`],[`loggerLevel`,`Logger level`],[`fileLogger`,`File logger`],[`matterLoggerLevel`,`Matter logger level`],[`matterFileLogger`,`Matter file logger`],[`restartRequired`,`Restart required`],[`updateRequired`,`Update required`],[`runningTimes`,`Running times`],[`runningDays`,`Running days`]]),li=new Set([`matterbridgeLatestVersion`,`matterbridgeDevVersion`,`dockerDev`,`dockerLatestVersion`,`dockerDevVersion`,`fixedRestartRequired`,`matterMdnsInterface`,`matterIpv4Address`,`matterIpv6Address`,`readOnly`,`matterPort`,`matterDiscriminator`,`matterPasscode`,`startupAt`,`shutdownAt`]);function ui({matterbridgeInfo:e}){let{mobile:t}=(0,U.useContext)($t);K&&console.log(`MatterbridgeInfoTable:`,e);let[n,r]=(0,U.useState)(!1);return K&&console.log(`MatterbridgeInfoTable rendering...`),!e||n?null:(0,J.jsxs)(Z,{style:q&&t?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`Matterbridge info`}),(0,J.jsx)(ln,{close:()=>r(!0)})]}),(0,J.jsx)(cn,{style:q&&t?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(e).filter(([e,t])=>!li.has(e)&&t!=null&&t!==``).map(([e,n],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:ci.get(e)??e}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&t?typeof n==`string`?n:n.toString():(0,J.jsx)(si,{value:typeof n==`string`?n:n.toString(),maxChars:24})})]},e))})]})})]})}var di=(0,U.memo)(ui),fi={margin:`0px`,padding:`0px`,color:`var(--div-text-color)`,transition:`color 0.2s ease`,"& svg":{display:`block`},"& svg path":{fill:`var(--div-text-color)`,transition:`fill 0.2s ease`},"&:hover":{color:`var(--primary-color)`},"&:hover svg path":{fill:`var(--primary-color)`},"&:focus-visible":{outline:`2px solid var(--primary-color)`,outlineOffset:`2px`}},pi=e=>{if(!e)return``;let t=e.replace(/[^0-9]/g,``);return t.length<5?t:[t.slice(0,4),t.slice(4,7),t.slice(7,11)].filter(Boolean).join(`-`)};function mi({id:e}){let{online:t,sendMessage:n,addListener:r,removeListener:i,getUniqueId:a}=(0,U.useContext)(Y),[o,s]=(0,U.useState)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(null),u=(0,U.useRef)(a()),{mobile:d,showConfirmCancelDialog:f}=(0,U.useContext)($t);K&&console.log(`QRDiv loading with id = "${e}" and matter:`,o),(0,U.useEffect)(()=>{K&&console.log(`QRDiv id effect "${e}"`),c.current=e,l.current&&clearTimeout(l.current),l.current=null,e?(K&&console.log(`QRDiv id effect sending data request for storeId "${e}"`),n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:e,server:!0}})):(K&&console.log(`QRDiv id effect setting matter to null`),s(null))},[e,n]),(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`QRDiv received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`matter`&&e.response.matter&&(K&&console.log(`QRDiv received refresh_required: changed=${e.response.changed} for storeId "${e.response.matter.id}":`,e.response.matter),c.current===e.response.matter.id&&(K&&console.log(`QRDiv received refresh_required/matter: setting matter data for storeId "${e.response.matter.id}":`,e.response.matter),l.current&&clearTimeout(l.current),s(e.response.matter)))};return r(e,u.current),K&&console.log(`QRDiv webSocket effect mounted`),()=>{i(e),l.current&&clearTimeout(l.current),l.current=null,K&&console.log(`QRDiv webSocket effect unmounted`)}},[r,i]);let p=()=>{K&&console.log(`QRDiv sent matter startCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,startCommission:!0}})},m=()=>{K&&console.log(`QRDiv sent matter stopCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,stopCommission:!0}})},h=()=>{K&&console.log(`QRDiv sent matter advertise for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,advertise:!0}})},g=e=>{K&&console.log(`QRDiv sent matter removeFabric for node "${o?.id}" and fabricIndex ${e}`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,removeFabric:e}})},_=async()=>{if(!o?.manualPairingCode)return;let e=o.manualPairingCode;try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}K&&console.log(`Manual pairing code copied to clipboard`)}catch(e){console.error(`Failed to copy manual pairing code`,e)}};return!o||!t?(K&&console.log(`QRDiv rendering undefined state`),null):o.online?o.advertising&&o.qrPairingCode&&o.manualPairingCode?(K&&console.log(`QRDiv rendering advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`QR pairing code`}),(0,J.jsxs)(ln,{children:[(0,J.jsx)(z,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:Et,size:`22px`})})}),(0,J.jsx)(z,{"aria-label":`stop pairing`,size:`small`,onClick:m,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Turn off pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:bt,size:`22px`})})})]})]}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(zt,{value:o.qrPairingCode,size:256,level:`M`,fgColor:`var(--div-text-color)`,bgColor:`var(--div-bg-color)`,style:{margin:`20px`}}),(0,J.jsxs)(an,{style:{justifyContent:`space-between`},children:[(0,J.jsxs)(on,{style:{fontWeight:`normal`,color:`var(--div-text-color)`},children:[`Manual pairing code: `,pi(o.manualPairingCode)]}),(0,J.jsx)(ln,{children:(0,J.jsx)(H,{title:`Copy manual pairing code`,arrow:!0,children:(0,J.jsx)(z,{"aria-label":`copy manual pairing code`,size:`small`,onClick:()=>void _(),sx:fi,children:(0,J.jsx)(X.Icon,{path:wt,size:.85})})})})]})]})):o.commissioned&&o.fabricInformations&&o.sessionInformations?(K&&console.log(`QRDiv rendering commissioned state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`,overflow:`hidden`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`Paired fabrics`}),(0,J.jsxs)(ln,{children:[(0,J.jsx)(z,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:Et,size:`22px`})})}),(0,J.jsx)(z,{"aria-label":`start pairing`,size:`small`,onClick:p,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Turn on pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:Dt,size:`22px`})})})]})]}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(cn,{style:{flexDirection:`column`,justifyContent:`flex-start`,flex:`1 1 auto`,overflow:`auto`,padding:`0px 0px 10px 0px`,gap:`0px`},children:o.fabricInformations.map((e,t)=>(0,J.jsxs)(`div`,{style:{margin:`0px`,padding:`10px`,gap:`0px`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,textAlign:`left`,fontSize:`14px`},children:[(0,J.jsxs)(`div`,{style:{marginLeft:`20px`,marginBottom:`10px`,display:`flex`,flexDirection:`row`,justifyContent:`space-between`,gap:`20px`,alignItems:`center`},children:[(0,J.jsxs)(`p`,{className:`status-blue`,style:{margin:`0px`,padding:`3px 10px`,width:`200px`,fontSize:`14px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},children:[`Fabric: `,e.fabricIndex]}),(0,J.jsx)(H,{title:`Remove the fabric. You will also need to remove it from the controller.`,arrow:!0,children:(0,J.jsx)(z,{"aria-label":`remove the fabric`,size:`small`,onClick:()=>f(`Remove fabric`,`Are you sure you want to remove this fabric? You will also need to remove it from the controller.`,`RemoveFabric`,()=>g(e.fabricIndex),()=>void 0),sx:{...fi,padding:`2px`},children:(0,J.jsx)(X.Icon,{path:xt,size:1})})})]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Vendor: `,e.rootVendorId,` `,e.rootVendorName]}),e.label!==``&&(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Label: `,e.label]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Sessions: `,o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive).length,` subscriptions:`,` `,o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive&&t.numberOfActiveSubscriptions>0).length]})]},t))}),(0,J.jsx)(an,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(on,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):!o.commissioned&&!o.advertising?(K&&console.log(`QRDiv rendering not commissioned and not advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`QR pairing code`})}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(M,{onClick:p,endIcon:(0,J.jsx)(X.Icon,{path:Dt,size:1}),style:{margin:`20px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`,minWidth:`90px`},children:`Turn on pairing`}),(0,J.jsx)(an,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(on,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):(K&&console.log(`QRDiv rendering unknown state`),null):(K&&console.log(`QRDiv rendering offline state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(rn,{style:{height:`30px`,justifyContent:`space-between`},children:(0,J.jsx)(Q,{children:`Server node`})}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(sn,{style:{fontWeight:`bold`},children:`Server offline`}),(0,J.jsx)(an,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(on,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]}))}var hi=(0,U.memo)(mi);function gi({systemInfo:e,compact:t}){let{mobile:n}=(0,U.useContext)($t),{addListener:r,removeListener:i,getUniqueId:a,sendMessage:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)(e),[l,u]=(0,U.useState)(!1),d=(0,U.useRef)(a());K&&console.log(`SystemInfoTable loading with systemInfo:`,s,`compact:`,t);let f=new Map([[`interfaceName`,`Interface name`],[`macAddress`,`Mac address`],[`ipv4Address`,`IPv4 address`],[`ipv6Address`,`IPv6 address`],[`nodeVersion`,`Node version`],[`bunVersion`,`Bun version`],[`hostname`,`Hostname`],[`user`,`User`],[`osType`,`Os`],[`osRelease`,`Os release`],[`osPlatform`,`Platform`],[`osArch`,`Architecture`],[`freeMemory`,t?`Host memory`:`Free memory`],[`totalMemory`,`Total memory`],[`constrainedMemory`,`Memory limit`],[`systemUptime`,`System uptime`],[`processUptime`,`Process uptime`],[`cpuUsage`,`Host CPU`],[`processCpuUsage`,`Process CPU`],[`rss`,`Process memory`],[`heapUsed`,t?`Process heap`:`Used heap`],[`heapTotal`,`Total heap`]]),p={...s};if(p.constrainedMemory===p.totalMemory&&(p.constrainedMemory=``),t&&p.totalMemory&&p.freeMemory){let e=p.totalMemory;p.freeMemory=`${p.freeMemory} / ${e}`,p.totalMemory=``}if(t&&p.heapTotal&&p.heapUsed){let e=p.heapTotal;p.heapUsed=`${p.heapUsed} / ${e}`,p.heapTotal=``}return t&&p.osRelease&&p.osType&&(p.osType=`${p.osType} (${p.osRelease})`,p.osRelease=``),t&&p.osArch&&p.osPlatform&&(p.osPlatform=`${p.osPlatform} (${p.osArch})`,p.osArch=``),p.bunVersion&&=(p.nodeVersion=p.bunVersion,void 0),(0,U.useEffect)(()=>{let e=e=>{c(t=>({...t,totalMemory:e.totalMemory,freeMemory:e.freeMemory,constrainedMemory:e.constrainedMemory,heapTotal:e.heapTotal,heapUsed:e.heapUsed,rss:e.rss,cpuUsage:e.cpuUsage.toFixed(2)+` %`,processCpuUsage:e.processCpuUsage.toFixed(2)+` %`,systemUptime:e.systemUptime,processUptime:e.processUptime}))},t=t=>{K&&console.log(`SystemInfoTable received WebSocket Message:`,t),t.method===`system_update`&&t.response?(K&&console.log(`SystemInfoTable received system_update`,t),e(t.response)):t.method===`/api/viewhistorypage`&&t.id===d.current&&t.success&&(K&&console.log(`SystemInfoTable received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`))};return r(t,d.current),K&&console.log(`SystemInfoTable added WebSocket listener id ${d.current}`),()=>{i(t),K&&console.log(`SystemInfoTable removed WebSocket listener`)}},[r,i]),!s||l?null:(K&&console.log(`SystemInfoTable rendering...`),(0,J.jsxs)(Z,{style:q&&n?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`System info`}),(0,J.jsx)(ln,{close:()=>u(!0),children:(0,J.jsx)(z,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:()=>{K&&console.log(`SystemInfoTable handleViewHistory clicked`),o({id:d.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}})},children:(0,J.jsx)(H,{title:`Open the cpu and memory usage page`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:St,size:`22px`})})})})]}),(0,J.jsx)(cn,{style:q&&n?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(p).filter(([e,t])=>e!==`bunVersion`&&t!==void 0&&t!==``).map(([e,t],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e===`nodeVersion`&&s.bunVersion?`Bun version`:f.get(e)??e}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&n?t:(0,J.jsx)(si,{value:t,maxChars:22})})]},e))})]})})]}))}var _i=(0,U.memo)(gi);function vi(){let[e,t]=(0,U.useState)(null),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)([]),[o]=(0,U.useState)(localStorage.getItem(G[`home-page-plugins`])!==`false`),[s]=(0,U.useState)(localStorage.getItem(G[`home-page-mode`])??`devices`),[c,l]=(0,U.useState)(`https://matterbridge.io/CHANGELOG.html`),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(null),{mobile:g}=(0,U.useContext)($t),{addListener:_,removeListener:v,online:y,sendMessage:b,getUniqueId:x}=(0,U.useContext)(Y),S=(0,U.useRef)(x());(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`Home received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Home received refresh_required: changed=${e.response.changed} and sending /api/settings request`),h(null),a([]),b({id:S.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),b({id:S.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`&&(K&&console.log(`Home received update_required`,e.response),e.response.devVersion?r(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):r(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)),e.method===`/api/settings`&&e.id===S.current?(K&&console.log(`Home received settings:`,e.response),t(e.response.systemInformation),r(e.response.matterbridgeInformation),localStorage.getItem(G[`frontend-version`])===null&&e.response.matterbridgeInformation.frontendVersion?localStorage.setItem(G[`frontend-version`],e.response.matterbridgeInformation.frontendVersion):e.response.matterbridgeInformation.frontendVersion!==localStorage.getItem(G[`frontend-version`])&&e.response.matterbridgeInformation.frontendVersion&&(localStorage.setItem(G[`frontend-version`],e.response.matterbridgeInformation.frontendVersion),p(!0)),localStorage.getItem(G[`matterbridge-version`])===null?localStorage.setItem(G[`matterbridge-version`],e.response.matterbridgeInformation.matterbridgeVersion):e.response.matterbridgeInformation.matterbridgeVersion!==localStorage.getItem(G[`matterbridge-version`])&&(localStorage.setItem(G[`matterbridge-version`],e.response.matterbridgeInformation.matterbridgeVersion),d(!0))):e.method===`/api/plugins`&&e.id===S.current&&(K&&console.log(`Home received plugins:`,e.response),a(e.response))};return _(e,S.current),K&&console.log(`Home added WebSocket listener id ${S.current}`),()=>{v(e),K&&console.log(`Home removed WebSocket listener`)}},[_,v,b]);let C=(0,U.useMemo)(()=>n?.bridgeMode===`bridge`?`Matterbridge`:n?.bridgeMode===`childbridge`?i.find(e=>e.matter?.id)?.matter?.id??null:null,[n,i]),w=m??C;return(0,U.useEffect)(()=>{y&&(K&&console.log(`Home online effect, sending /api/settings and /api/plugins requests`),b({id:S.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),b({id:S.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[y,b]),K&&console.log(`Home rendering...`),!y||!e||!n?(0,J.jsx)(nn,{}):(0,J.jsxs)(rr,{name:`Home`,style:q&&g?{alignItems:`center`,gap:`10px`}:{flexDirection:`row`},children:[(q&&!g||!q)&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`302px`,minWidth:`302px`,gap:`20px`},children:[(0,J.jsx)(hi,{id:w}),(0,J.jsx)(_i,{systemInfo:e,compact:!0})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`,gap:q&&g?`10px`:`20px`},children:[f&&(0,J.jsx)(sr,{version:n.frontendVersion}),u&&(0,J.jsx)(oi,{version:n.matterbridgeVersion,changelog:c}),q&&g&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(hi,{id:w}),(0,J.jsx)(_i,{systemInfo:e,compact:!1}),(0,J.jsx)(di,{matterbridgeInfo:n})]}),o&&!n.readOnly&&(0,J.jsx)(jr,{}),o&&(0,J.jsx)(ii,{storeId:w,setStoreId:h}),s===`devices`&&(0,J.jsx)(hr,{storeId:w,setStoreId:h}),s===`logs`&&(0,J.jsx)(Ir,{})]})]})}var yi=(0,U.memo)(vi);function bi(){let{logLength:e,logAutoScroll:t,setMessages:n,setLogLength:r,setLogAutoScroll:i,setLogFilterLevel:a,setLogFilterSearch:o,online:s,filterLogMessages:c}=(0,U.useContext)(Y),[l,u]=(0,U.useState)(localStorage.getItem(G[`log-filter-level`])??`info`),[d,f]=(0,U.useState)(localStorage.getItem(G[`log-filter-search`])??`*`),[p,m]=(0,U.useState)(e.current.toString()),[h,g]=(0,U.useState)(t.current);return K&&console.log(`Logs rendering...`),s?(0,J.jsxs)(rr,{name:`Logs`,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,margin:`0px`,padding:`0px`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(F,{id:`select-level`,style:{color:`var(--div-text-color)`},children:`Filter log by level:`}),(0,J.jsxs)(de,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-level`,id:`debug-level`,value:l,onChange:e=>{let t=e.target.value;u(t),a(t),c(t,d),localStorage.setItem(G[`log-filter-level`],t),K&&console.log(`handleLogFilterLevelChange called with value:`,t)},children:[(0,J.jsx)(b,{value:`debug`,children:`Debug`}),(0,J.jsx)(b,{value:`info`,children:`Info`}),(0,J.jsx)(b,{value:`notice`,children:`Notice`}),(0,J.jsx)(b,{value:`warn`,children:`Warn`}),(0,J.jsx)(b,{value:`error`,children:`Error`}),(0,J.jsx)(b,{value:`fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`5px`},children:[(0,J.jsx)(F,{id:`search`,style:{color:`var(--div-text-color)`},children:`Filter log by text:`}),(0,J.jsx)(H,{title:`Use /text/ for case-insensitive regex search`,children:(0,J.jsx)(Oe,{style:{width:`210px`},size:`small`,id:`logsearch`,variant:`outlined`,value:d,onChange:e=>{let t=e.target.value;f(t),o(t),c(l,t),localStorage.setItem(G[`log-filter-search`],t),K&&console.log(`handleLogFilterSearchChange called with value:`,t)},slotProps:{input:{style:{height:`30px`,padding:`0 0px`,backgroundColor:`var(--main-bg-color)`}}}})})]}),(0,J.jsx)(le,{control:(0,J.jsx)(w,{checked:h,onChange:e=>{let t=e.target.checked;g(t),i(t),c(l,d),localStorage.setItem(G[`log-auto-scroll`],t?`true`:`false`),K&&console.log(`handleAutoScrollChange called with value:`,t)}}),label:`Auto scroll`,style:{color:`var(--div-text-color)`}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(F,{id:`select-size-label`,style:{color:`var(--div-text-color)`},children:`Log length:`}),(0,J.jsxs)(de,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-size-label`,id:`select-size`,value:p,onChange:e=>{let t=e.target.value;m(t),r(Number(t)),localStorage.setItem(G[`log-length`],t),K&&console.log(`handleLogLengthChange called with value:`,t)},children:[(0,J.jsx)(b,{value:100,children:`100`}),(0,J.jsx)(b,{value:200,children:`200`}),(0,J.jsx)(b,{value:500,children:`500`}),(0,J.jsx)(b,{value:1e3,children:`1000`})]}),(0,J.jsx)(H,{title:`Clear the logs`,children:(0,J.jsx)(M,{onClick:()=>{K&&console.log(`handleClearLogsClick called`),n([])},endIcon:(0,J.jsx)(Le,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Clear`})})]})]}),(0,J.jsx)(`div`,{style:{flex:`1`,overflow:`auto`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(Pr,{})})]}):(0,J.jsx)(nn,{})}var xi=(0,U.memo)(bi),Si=1200,Ci,wi;function Ti(e,t){Ci=e,wi=t}function Ei(){let{mobile:e,showSnackbarMessage:t,showConfirmCancelDialog:n}=(0,U.useContext)($t),{online:i,sendMessage:a,logMessage:o,addListener:c,removeListener:l,getUniqueId:u}=(0,U.useContext)(Y),[f,p]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),[T,E]=(0,U.useState)(null),[D,O]=(0,U.useState)(`inactive`),k=(0,U.useRef)(u()),[A,j]=(0,U.useState)(null),[M,ee]=(0,U.useState)(null),[N,te]=(0,U.useState)(null),[P,ne]=(0,U.useState)(null),F=r(),re=()=>{window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`)},ie=()=>{window.open(`https://matterbridge.io/`)},ae=()=>{window.open(`https://matterbridge.io/README.html`)},oe=()=>{window.open(`https://matterbridge.io/CHANGELOG.html`)},se=()=>{window.open(`https://discord.com/invite/QX58CDe6hd`,`_blank`)},ce=()=>{window.open(`https://github.com/Luligu/matterbridge`,`_blank`)},le=()=>{a({id:k.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge`,restart:!0}}),S(!1)},ue=()=>{a({id:k.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge@dev`,restart:!0}}),w(!1)},de=()=>{a({id:k.current,sender:`Header`,method:`/api/checkupdates`,src:`Frontend`,dst:`Matterbridge`,params:{}})},pe=()=>{T?.matterbridgeInformation.restartMode===`none`?a({id:k.current,sender:`Header`,method:`/api/restart`,src:`Frontend`,dst:`Matterbridge`,params:{}}):a({id:k.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},me=()=>{a({id:k.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},he=e=>{j(e.currentTarget)},L=e=>{K&&console.log(`Header: handleMenuClose`,e),j(null),e===`/`||e===`/devices`||e===`/log`||e===`/settings`?F(e):e===`reset_frontend`?(o(`Matterbridge`,`Resetting frontend UI...`),t(`Resetting frontend UI...`,5),Ht(),window.location.reload()):e===`download-mblog`?(o(`Matterbridge`,`Downloading matterbridge log...`),t(`Downloading matterbridge log...`,5),window.location.href=`./api/download-mblog`):e===`download-mjlog`?(o(`Matterbridge`,`Downloading matter log...`),t(`Downloading matter log...`,5),window.location.href=`./api/download-mjlog`):e===`view-mblog`?(o(`Matterbridge`,`Loading matterbridge log...`),t(`Loading matterbridge log...`,5),window.open(`./api/view-mblog`,`_blank`,`noopener,noreferrer`)):e===`view-mjlog`?(o(`Matterbridge`,`Loading matter log...`),t(`Loading matter log...`,5),window.open(`./api/view-mjlog`,`_blank`,`noopener,noreferrer`)):e===`view-diagnostic`?(o(`Matterbridge`,`Loading diagnostic log...`),t(`Loading diagnostic log...`,5),window.open(`./api/view-diagnostic`,`_blank`,`noopener,noreferrer`)):e===`download-diagnostic`?(o(`Matterbridge`,`Downloading diagnostic log...`),t(`Downloading diagnostic log...`,5),window.location.href=`./api/download-diagnostic`):e===`view-history`?a({id:k.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`download-history`?a({id:k.current,sender:`Header`,method:`/api/downloadhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`download-mbstorage`?(o(`Matterbridge`,`Downloading matterbridge storage...`),t(`Downloading matterbridge storage...`,5),window.location.href=`./api/download-mbstorage`):e===`download-pluginstorage`?(o(`Matterbridge`,`Downloading matterbridge plugins storage...`),t(`Downloading matterbridge plugins storage...`,5),window.location.href=`./api/download-pluginstorage`):e===`download-pluginconfig`?(o(`Matterbridge`,`Downloading matterbridge plugins config...`),t(`Downloading matterbridge plugins config...`,5),window.location.href=`./api/download-pluginconfig`):e===`download-mjstorage`?(o(`Matterbridge`,`Downloading matter storage...`),t(`Downloading matter storage...`,5),window.location.href=`./api/download-mjstorage`):e===`download-backup`?(o(`Matterbridge`,`Downloading backup...`),t(`Downloading backup...`,10),window.location.href=`./api/download-backup`):e===`update`?le():e===`updatedev`?ue():e===`updatecheck`?de():e===`restart`?pe():e===`shutdown`?me():e===`create-backup`?a({id:k.current,sender:`Header`,method:`/api/create-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matterbridge-storage-backup`?a({id:k.current,sender:`Header`,method:`/api/create-matterbridge-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matter-storage-backup`?a({id:k.current,sender:`Header`,method:`/api/create-matter-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-plugin-backup`?a({id:k.current,sender:`Header`,method:`/api/create-plugin-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-config-backup`?a({id:k.current,sender:`Header`,method:`/api/create-config-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`unregister`?a({id:k.current,sender:`Header`,method:`/api/unregister`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`reset`?a({id:k.current,sender:`Header`,method:`/api/reset`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`factoryreset`&&a({id:k.current,sender:`Header`,method:`/api/factoryreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ge=e=>{K&&console.log(`Header: handleMenuCloseCancel:`,e),j(null)},_e=e=>{ee(e.currentTarget)},R=()=>{ee(null)},ve=e=>{te(e.currentTarget)},ye=()=>{te(null)},be=e=>{ne(e.currentTarget)},xe=()=>{ne(null)};return(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`Header received WebSocket Message:`,e),e.method===`/api/settings`&&e.id===k.current?(K&&console.log(`Header received settings:`,e.response),E(e.response),p(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired),g(e.response.matterbridgeInformation.fixedRestartRequired),S(e.response.matterbridgeInformation.updateRequired),O(e.response.matterbridgeInformation.bridgeStatus)):e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Header received refresh_required: changed=${e.response.changed} and sending /api/settings request`),a({id:k.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`restart_required`?(K&&console.log(`Header received restart_required with fixed: ${e.response.fixed}`),p(!0),e.response.fixed&&g(!0)):e.method===`restart_not_required`?(K&&console.log(`Header received restart_not_required`),p(!1)):e.method===`matterbridge_status_update`?(K&&console.log(`Header received matterbridge_status_update: ${e.response.status}`),O(e.response.status)):e.method===`update_required`?(K&&console.log(`Header received update_required`),e.response.devVersion?(E(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeDevVersion:e.response.version}}:null),w(!0)):(E(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeLatestVersion:e.response.version}}:null),S(!0))):e.method===`/api/viewhistorypage`&&e.id===k.current&&e.success?(K&&console.log(`Header received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`)):e.method===`/api/downloadhistorypage`&&e.id===k.current&&e.success?(K&&console.log(`Header received /api/downloadhistorypage success`),window.location.href=`./api/downloadhistory`):e.method===`archive`&&e.success&&e.response.command===`zip`&&(K&&console.log(`Header received archive success response for zip command`,e.response),e.response.archivePath.endsWith(`matterbridge.backup.zip`)?window.location.href=`./api/download-backup`:e.response.archivePath.endsWith(`matterbridge.storage.zip`)?window.location.href=`./api/download-mbstorage`:e.response.archivePath.endsWith(`matterbridge.matterstorage.zip`)?window.location.href=`./api/download-mjstorage`:e.response.archivePath.endsWith(`matterbridge.pluginstorage.zip`)?window.location.href=`./api/download-pluginstorage`:e.response.archivePath.endsWith(`matterbridge.pluginconfig.zip`)&&(window.location.href=`./api/download-pluginconfig`))};return c(e,k.current),K&&console.log(`Header added WebSocket listener id ${k.current}`),()=>{l(e),K&&console.log(`Header removed WebSocket listener`)}},[c,l,a]),(0,U.useEffect)(()=>{i&&(K&&console.log(`Header sending /api/settings and /api/checkupdates requests`),a({id:k.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[i,a]),K&&console.log(`Header rendering... mobile %s`,e),!i||!T?null:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(z,{style:{margin:`0`,padding:`0`},onClick:()=>{Ut(),K&&console.log(`Matterbridge logo clicked: debug is now`,K)},children:(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`30px`}})}),(0,J.jsx)(`h2`,{style:{fontSize:`22px`,color:`var(--main-icon-color)`,margin:`0px`},children:`Matterbridge`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:(0,J.jsxs)(`nav`,{children:[(0,J.jsx)(s,{to:`/`,className:`nav-link`,children:`Home`}),(0,J.jsx)(s,{to:`/devices`,className:`nav-link`,children:`Devices`}),(0,J.jsx)(s,{to:`/log`,className:`nav-link`,children:`Logs`}),(0,J.jsx)(s,{to:`/settings`,className:`nav-link`,children:`Settings`})]})})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[!T.matterbridgeInformation.readOnly&&(0,J.jsx)(H,{title:`Matterbridge v.${T.matterbridgeInformation.matterbridgeVersion}`,children:(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:x?`var(--primary-color)`:C?`var(--secondary-color)`:`green`},children:[`v.`,T.matterbridgeInformation.matterbridgeVersion.split(`-`)[0]+(T.matterbridgeInformation.matterbridgeVersion.includes(`-dev-`)?`@dev`:``)+(T.matterbridgeInformation.matterbridgeVersion.includes(`-edge-`)?`@edge`:``)+(T.matterbridgeInformation.matterbridgeVersion.includes(`-local-`)?`@local`:``)+(T.matterbridgeInformation.matterbridgeVersion.includes(`-git-`)?`@git`:``)]})}),T.matterbridgeInformation.bridgeMode!==`none`&&!T.matterbridgeInformation.readOnly?(0,J.jsx)(H,{title:`Bridge mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:D===`started`?`green`:D===`error`?`red`:void 0},children:T.matterbridgeInformation.bridgeMode})}):null,T.matterbridgeInformation.restartMode!==`none`&&!T.matterbridgeInformation.readOnly?(0,J.jsx)(H,{title:`Restart mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:T.matterbridgeInformation.restartMode})}):null,T.systemInformation.bunVersion?(0,J.jsx)(H,{title:`Bun version`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:`bun`})}):null,T.matterbridgeInformation.profile&&T.matterbridgeInformation.profile!==``&&!T.matterbridgeInformation.readOnly?(0,J.jsx)(H,{title:`Current profile`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:T.matterbridgeInformation.profile})}):null,K&&(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:[e?`Mobile `:`Desktop `,`${Ci}x${wi}`,` enabled ${localStorage.getItem(G[`enable-mobile`])!==`false`}`]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`5px`},children:[T.matterbridgeInformation.readOnly?null:(0,J.jsx)(H,{title:`Matterbridge discord group`,children:(0,J.jsx)(z,{style:{margin:`0`,padding:`0`},onClick:se,children:(0,J.jsx)(`img`,{src:`discord.svg`,alt:`Discord Logo`,style:{height:`25px`}})})}),T.matterbridgeInformation.readOnly?null:(0,J.jsx)(H,{title:`Give a star to Matterbridge`,children:(0,J.jsx)(z,{style:{color:`#FFD700`,margin:`0`,padding:`0`},onClick:ce,children:(0,J.jsx)(at,{})})}),T.matterbridgeInformation.readOnly?null:(0,J.jsx)(H,{title:`Sponsor Matterbridge`,children:(0,J.jsx)(z,{style:{color:`#b6409c`,margin:`0`,padding:`0`},onClick:re,children:(0,J.jsx)(pt,{})})}),(0,J.jsx)(H,{title:`Matterbridge homepage`,children:(0,J.jsx)(z,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ie,children:(0,J.jsx)(fe,{})})}),(0,J.jsx)(H,{title:`Matterbridge help`,children:(0,J.jsx)(z,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ae,children:(0,J.jsx)(_,{})})}),(0,J.jsx)(H,{title:`Matterbridge changelog`,children:(0,J.jsx)(z,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:oe,children:(0,J.jsx)(y,{})})}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&x&&(0,J.jsx)(H,{title:`Update matterbridge to latest version v.${T.matterbridgeInformation.matterbridgeLatestVersion}`,children:(0,J.jsx)(z,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:le,children:(0,J.jsx)(gt,{})})}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&C&&(0,J.jsx)(H,{title:`Update matterbridge to latest dev version v.${T.matterbridgeInformation.matterbridgeDevVersion}`,children:(0,J.jsx)(z,{style:{color:`var(--secondary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ue,children:(0,J.jsx)(gt,{})})}),(0,J.jsx)(H,{title:`Restart matterbridge`,children:(0,J.jsx)(z,{style:{color:f||h?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:pe,children:(0,J.jsx)(ht,{})})}),T.matterbridgeInformation.restartMode===`none`?(0,J.jsx)(H,{title:`Shut down matterbridge`,children:(0,J.jsx)(z,{style:{color:f||h?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:me,children:(0,J.jsx)(Te,{})})}):null,(0,J.jsx)(H,{title:`Download, backup and more`,children:(0,J.jsx)(z,{onClick:he,children:(0,J.jsx)(Qe,{style:{color:`var(--main-icon-color)`}})})}),(0,J.jsxs)(v,{id:`command-menu`,anchorEl:A,keepMounted:!0,open:!!A,onClose:()=>L(``),children:[q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Home page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/devices`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Devices page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/log`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Logs page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/settings`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Settings page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>L(`update`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(gt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Install latest stable`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>L(`updatedev`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(gt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Install latest dev`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>L(`updatecheck`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(gt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Check for updates`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>L(`restart`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(ht,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Restart`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation.restartMode===`none`?(0,J.jsxs)(b,{onClick:()=>L(`shutdown`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Shutdown`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}):null,(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:_e,children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`View`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(v,{id:`sub-menu-view`,anchorEl:M,keepMounted:!0,open:!!M,onClose:R,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(b,{onClick:()=>{Gt(),R(),ge(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Desktop site`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{Wt(),R(),ge(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Mobile site`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-mblog`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-mjlog`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matter log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-diagnostic`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge diagnostic log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-history`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge system history`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]})]}),(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:ve,children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Download`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(v,{id:`sub-menu-download`,anchorEl:N,keepMounted:!0,open:!!N,onClose:ye,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(b,{onClick:()=>{L(`create-matterbridge-storage-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge storage`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`create-plugin-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge plugins storage`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`create-config-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge plugins config`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-mblog`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`create-matter-storage-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matter storage`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-mjlog`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matter log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-diagnostic`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge diagnostic log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-history`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge system history`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]})]}),(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:()=>{L(`create-backup`)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(rt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Backup`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:be,children:[(0,J.jsx)(B,{children:(0,J.jsx)(Ve,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(v,{id:`sub-menu-reset`,anchorEl:P,keepMounted:!0,open:!!P,onClose:xe,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Reset the frontend UI`,`Are you sure you want to reset the frontend UI? This will reset all local settings and reload the page.`,`reset_frontend`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset the frontend UI...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Reset all devices and shutdown`,`Are you sure you want to unregister all devices? This will temporarily remove all devices from the controller and you may loose the controller configuration.`,`unregister`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset all devices...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Reset commissioning and shutdown`,`Are you sure you want to reset the commissioning? You will have to manually remove Matterbridge from the controller.`,`reset`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset commissioning...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Factory reset and shutdown`,`Are you sure you want to factory reset Matterbridge? You will have to manually remove Matterbridge from the controller.`,`factoryreset`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Factory reset...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]})]})]})]})]})}var Di=(0,U.memo)(Ei);function Oi(){if(typeof window<`u`){let e=Math.floor(window.visualViewport?.width??window.innerWidth),t=Math.floor(window.visualViewport?.height??window.innerHeight);Ti(e,t);let n=e<1200||t<900;return K&&console.log(`Visual viewport (%s) width %i height %i mobile %s`,window.visualViewport!==void 0,e,t,n),n}return!1}function ki({children:e}){let{mobile:t,setMobile:n}=(0,U.useContext)($t),{setLogAutoScroll:r}=(0,U.useContext)(Y);return(0,U.useEffect)(()=>{function e(){let e=Oi();e&&(r(!1),localStorage.setItem(G[`log-auto-scroll`],`false`)),n(e)}return window.addEventListener(`resize`,e),n(Oi()),()=>window.removeEventListener(`resize`,e)},[r,n]),K&&console.log(`MbfScreen rendering... mobile %s`,t),q&&t?(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`visible`,margin:`0px`,padding:`10px`,gap:`10px`},children:[(0,J.jsx)(Di,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`10px`},children:e})]}):(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`hidden`,width:t?`${Si}px`:`calc(100vw - 40px)`,height:t?`900px`:`calc(100vh - 40px)`,margin:`0px`,padding:`20px`,gap:`20px`},children:[(0,J.jsx)(Di,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,width:`100%`,height:`calc(100% - 60px)`,margin:`0px`,padding:`0px`,gap:`20px`},children:e})]})}function Ai(e=1e3){let t=null;return Object.assign(n=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{n(),t=null},e)},{cancel:()=>{t!==null&&(window.clearTimeout(t),t=null)}})}var ji=`(prefers-color-scheme: dark)`,Mi=null;function Ni(e){document.body.setAttribute(`frontend-theme`,e.matches?`dark`:`light`)}function Pi(e){return e===`auto`?typeof window.matchMedia==`function`&&!window.matchMedia(ji).matches?`light`:`dark`:e===`classic`||e===`light`?e:`dark`}function Fi(e){Mi?.removeEventListener(`change`,Ni),Mi=null,e===`auto`&&typeof window.matchMedia==`function`&&(Mi=window.matchMedia(ji),Mi.addEventListener(`change`,Ni));let t=Pi(e);return document.body.setAttribute(`frontend-theme`,t),t}var Ii=({open:e,onClose:t,onSave:n})=>{let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``),s=e=>{i(e.target.value)},c=e=>{o(e.target.value)},l=r.length>0&&r===a;return(0,J.jsxs)(R,{open:e,onClose:(e,n)=>{n!==`backdropClick`&&n!==`escapeKeyDown`&&t()},maxWidth:`sm`,style:{maxWidth:`500px`,margin:`auto`},children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:`Change Password`})]})}),(0,J.jsx)(E,{dividers:!0,children:(0,J.jsx)(yt,{component:`fieldset`,fullWidth:!0,sx:{margin:0,padding:0,gap:`20px`},children:(0,J.jsxs)(S,{container:!0,spacing:2,sx:{mt:2},children:[(0,J.jsx)(S,{size:12,children:(0,J.jsx)(Oe,{type:`password`,autoComplete:`new-password`,label:`New Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:r,onChange:s})}),(0,J.jsx)(S,{size:12,children:(0,J.jsx)(Oe,{type:`password`,autoComplete:`new-password`,label:`Confirm Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:a,onChange:c,error:a!==``&&r!==a,helperText:a!==``&&r!==a?`Passwords do not match`:``})})]})})}),(0,J.jsxs)(he,{children:[(0,J.jsx)(M,{onClick:()=>{t()},children:`Cancel`}),(0,J.jsx)(M,{variant:`contained`,onClick:()=>{l&&(n(r),t())},disabled:!l,children:`Change`}),(0,J.jsx)(M,{variant:`contained`,onClick:()=>{n(``),t()},children:`Reset`})]})]})},Li=330;function Ri(e){return e?e.charAt(0).toUpperCase()+e.slice(1):void 0}function zi(){let{mobile:e}=(0,U.useContext)($t),{online:t,addListener:n,removeListener:r,sendMessage:i,getUniqueId:a}=(0,U.useContext)(Y),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(0),f=(0,U.useRef)(a());return(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`Settings received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Settings received refresh_required: changed=${e.response.changed} and sending /api/settings request`),i({id:f.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`?(K&&console.log(`Settings received update_required`,e.response),e.response.devVersion?s(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):s(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)):e.method===`/api/settings`&&(K&&console.log(`Settings received /api/settings:`,e.response),s(e.response.matterbridgeInformation),l(e.response.systemInformation),d(e=>e+1))};return n(e,f.current),K&&console.log(`Settings added WebSocket listener`),()=>{r(e),K&&console.log(`Settings removed WebSocket listener`)}},[n,r,i]),(0,U.useEffect)(()=>{t&&(K&&console.log(`Settings received online`),i({id:f.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[t,i]),K&&console.log(`Settings rendering...`),!t||!o||!c?(0,J.jsx)(nn,{}):(0,J.jsx)(rr,{name:`Settings`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:q&&e?`10px`:`20px`},children:[(0,J.jsx)(Bi,{matterbridgeInfo:o,systemInfo:c},`matterbridge-${u}`),(0,J.jsx)(Vi,{matterbridgeInfo:o},`matter-${u}`),(0,J.jsx)(Hi,{matterbridgeInfo:o}),(0,J.jsx)(Ui,{systemInfo:c})]})})}function Bi({matterbridgeInfo:e,systemInfo:t}){let{sendMessage:n,getUniqueId:r}=(0,U.useContext)(Y),[i,a]=(0,U.useState)(()=>e?.bridgeMode===`bridge`?`bridge`:`childbridge`),[o,s]=(0,U.useState)(()=>Ri(e?.loggerLevel)??`Info`),[c,l]=(0,U.useState)(()=>e?.fileLogger??!1),[u,d]=(0,U.useState)(()=>localStorage.getItem(G[`frontend-theme`])||`dark`),[f,p]=(0,U.useState)(localStorage.getItem(G[`home-page-plugins`])!==`false`),[m,h]=(0,U.useState)(localStorage.getItem(G[`home-page-mode`])??`devices`),[_,v]=(0,U.useState)(()=>e?.virtualMode??localStorage.getItem(G[`virtual-mode`])??`outlet`),y=(0,U.useRef)(r()),[x,S]=(0,U.useState)(!1);return!e||!t?null:(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matterbridge settings`})}),(0,J.jsx)(Ii,{open:x,onClose:()=>S(!1),onSave:e=>{K&&console.log(`handleSaveChangePassword called with password:`,e),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setpassword`,value:e}}),qt(e)}}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`matterbridgeInfo-mode`,children:`Mode:`}),(0,J.jsxs)(g,{row:!0,name:`mode-buttons-group`,value:i,onChange:e=>{K&&console.log(`handleChangeBridgeMode called with value:`,e.target.value),a(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setbridgemode`,value:e.target.value}})},children:[(0,J.jsx)(le,{value:`bridge`,control:(0,J.jsx)(mt,{}),label:`Bridge`,disabled:e.readOnly}),(0,J.jsx)(le,{value:`childbridge`,control:(0,J.jsx)(mt,{}),label:`Childbridge`,disabled:e.readOnly})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mblogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`mblogger-level-label`,id:`mblogger-level`,value:o,onChange:e=>{K&&console.log(`handleChangeMbLoggerLevel called with value:`,e.target.value),s(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmbloglevel`,value:e.target.value}})},children:[(0,J.jsx)(b,{value:`Debug`,children:`Debug`}),(0,J.jsx)(b,{value:`Info`,children:`Info`}),(0,J.jsx)(b,{value:`Notice`,children:`Notice`}),(0,J.jsx)(b,{value:`Warn`,children:`Warn`}),(0,J.jsx)(b,{value:`Error`,children:`Error`}),(0,J.jsx)(b,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mblogger-file-label`,children:`Log on file:`}),(0,J.jsx)(w,{checked:c,onChange:e=>{K&&console.log(`handleLogOnFileMbChange called with value:`,e.target.checked),l(e.target.checked),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmblogfile`,value:e.target.checked}})},id:`mblogger-file`,name:`logOnFileMb`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-theme-label`,children:`Frontend theme:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`frontend-theme-label`,id:`frontend-theme`,value:u,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeTheme called with value:`,t),d(t),localStorage.setItem(G[`frontend-theme`],t),Fi(t)},children:[(0,J.jsx)(b,{value:`classic`,children:`Classic`}),(0,J.jsx)(b,{value:`light`,children:`Light`}),(0,J.jsx)(b,{value:`dark`,children:`Dark`}),(0,J.jsx)(b,{value:`auto`,children:`Auto`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-plugin-label`,children:`Home page plugins:`}),(0,J.jsx)(w,{checked:f,onChange:e=>{let t=e.target.checked;K&&console.log(`handleChangeHomePagePlugins called with value:`,t),p(t),localStorage.setItem(G[`home-page-plugins`],t?`true`:`false`)},name:`showPlugins`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-label`,children:`Home page bottom panel:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`frontend-home-label`,id:`frontend-home`,value:m,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeHomePageMode called with value:`,t),h(t),localStorage.setItem(G[`home-page-mode`],t)},children:[(0,J.jsx)(b,{value:`logs`,children:`Logs`}),(0,J.jsx)(b,{value:`devices`,children:`Devices`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`10px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-virtual-label`,children:`Virtual devices:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`frontend-virtual-label`,id:`frontend-virtual`,value:_,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeVirtualMode called with value:`,t),v(t),localStorage.setItem(G[`virtual-mode`],t),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setvirtualmode`,value:t}})},children:[(0,J.jsx)(b,{value:`disabled`,children:`Disabled`}),(0,J.jsx)(b,{value:`outlet`,children:`Outlet`}),(0,J.jsx)(b,{value:`light`,children:`Light`}),(0,J.jsx)(b,{value:`switch`,children:`Switch`}),(0,J.jsx)(b,{value:`mounted_switch`,children:`Mounted Switch`})]})]}),(0,J.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`20px`},children:(0,J.jsx)(M,{variant:`contained`,color:`primary`,onClick:()=>S(!0),children:`Change password`})})]})]})}function Vi({matterbridgeInfo:e}){let{sendMessage:t,getUniqueId:n}=(0,U.useContext)(Y),[r,i]=(0,U.useState)(()=>Ri(e?.matterLoggerLevel)??`Info`),[a,o]=(0,U.useState)(()=>e?.matterFileLogger??!1),[s,c]=(0,U.useState)(()=>e?.matterMdnsInterface||``),[l,u]=(0,U.useState)(()=>e?.matterIpv4Address||``),[d,f]=(0,U.useState)(()=>e?.matterIpv6Address||``),[p,m]=(0,U.useState)(()=>e?.matterPort?e.matterPort.toString():``),[h,g]=(0,U.useState)(()=>e?.matterDiscriminator?e.matterDiscriminator.toString():``),[_,v]=(0,U.useState)(()=>e?.matterPasscode?e.matterPasscode.toString():``),y=(0,U.useRef)(n()),x=(0,U.useMemo)(()=>Ai(1e3),[]),S=(0,U.useMemo)(()=>Ai(1e3),[]),C=(0,U.useMemo)(()=>Ai(1e3),[]),T=(0,U.useMemo)(()=>Ai(1e3),[]),E=(0,U.useMemo)(()=>Ai(1e3),[]),D=(0,U.useMemo)(()=>Ai(1e3),[]);return(0,U.useEffect)(()=>()=>x.cancel(),[x]),(0,U.useEffect)(()=>()=>S.cancel(),[S]),(0,U.useEffect)(()=>()=>C.cancel(),[C]),(0,U.useEffect)(()=>()=>T.cancel(),[T]),(0,U.useEffect)(()=>()=>E.cancel(),[E]),(0,U.useEffect)(()=>()=>D.cancel(),[D]),e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matter settings`})}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`mjlogger-level-label`,id:`mjlogger-level`,value:r,onChange:e=>{K&&console.log(`handleChangeMjLoggerLevel called with value:`,e.target.value),i(e.target.value),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjloglevel`,value:e.target.value}})},children:[(0,J.jsx)(b,{value:`Debug`,children:`Debug`}),(0,J.jsx)(b,{value:`Info`,children:`Info`}),(0,J.jsx)(b,{value:`Notice`,children:`Notice`}),(0,J.jsx)(b,{value:`Warn`,children:`Warn`}),(0,J.jsx)(b,{value:`Error`,children:`Error`}),(0,J.jsx)(b,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`10px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-file-label`,children:`Log on file:`}),(0,J.jsx)(w,{checked:a,onChange:e=>{K&&console.log(`handleLogOnFileMjChange called with value:`,e.target.checked),o(e.target.checked),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjlogfile`,value:e.target.checked}})},id:`mjlogger-file`,name:`logOnFileMj`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Mdns interface:`}),(0,J.jsx)(Oe,{value:s,onChange:e=>{K&&console.log(`handleChangeMdnsInterface called with value:`,e.target.value);let n=e.target.value;c(n),x(()=>{K&&console.log(`debounced sendMessage setmdnsinterface with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmdnsinterface`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv4 address:`}),(0,J.jsx)(Oe,{value:l,onChange:e=>{K&&console.log(`handleChangeIpv4Address called with value:`,e.target.value);let n=e.target.value;u(n),S(()=>{K&&console.log(`debounced sendMessage setipv4address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv4address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv6 address:`}),(0,J.jsx)(Oe,{value:d,onChange:e=>{K&&console.log(`handleChangeIpv6Address called with value:`,e.target.value);let n=e.target.value;f(n),C(()=>{K&&console.log(`debounced sendMessage setipv6address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv6address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning port:`}),(0,J.jsx)(Oe,{value:p,onChange:e=>{K&&console.log(`handleChangeMatterPort called with value:`,e.target.value);let n=e.target.value;m(n),T(()=>{K&&console.log(`debounced sendMessage setmatterport with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterport`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning discriminator:`}),(0,J.jsx)(Oe,{value:h,onChange:e=>{K&&console.log(`handleChangeMatterDiscriminator called with value:`,e.target.value);let n=e.target.value;g(n),E(()=>{K&&console.log(`debounced sendMessage setmatterdiscriminator with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterdiscriminator`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning passcode:`}),(0,J.jsx)(Oe,{value:_,onChange:e=>{K&&console.log(`handleChangemMatterPasscode called with value:`,e.target.value);let n=e.target.value;v(n),D(()=>{K&&console.log(`debounced sendMessage setmatterpasscode with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterpasscode`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]})]})]}):null}function Hi({matterbridgeInfo:e}){return e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matterbridge info`})}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(Wi,{value:e.matterbridgeVersion,label:`Current Version`}),(0,J.jsx)(Wi,{value:e.matterbridgeLatestVersion,label:`Latest Version`}),(0,J.jsx)(Wi,{value:e.rootDirectory,label:`Root Directory`}),(0,J.jsx)(Wi,{value:e.homeDirectory,label:`Home Directory`}),(0,J.jsx)(Wi,{value:e.matterbridgeDirectory,label:`Matterbridge Storage Directory`}),(0,J.jsx)(Wi,{value:e.matterbridgePluginDirectory,label:`Matterbridge Plugin Directory`}),(0,J.jsx)(Wi,{value:e.globalModulesDirectory,label:`Global Module Directory`})]})]}):null}function Ui({systemInfo:e}){if(!e)return null;let t=e.bunVersion??e.nodeVersion,n=e.bunVersion?`Bun Version`:`Node Version`;return(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`System info`})}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(Wi,{value:e.interfaceName,label:`Interface name`}),(0,J.jsx)(Wi,{value:e.macAddress,label:`MAC Address`}),(0,J.jsx)(Wi,{value:e.ipv4Address,label:`IPv4 Address`}),(0,J.jsx)(Wi,{value:e.ipv6Address,label:`IPv6 Address`}),(0,J.jsx)(Wi,{value:t,label:n}),(0,J.jsx)(Wi,{value:e.hostname,label:`Hostname`}),(0,J.jsx)(Wi,{value:e.user,label:`User`})]})]})}function Wi({value:e,label:t,width:n}){return(0,J.jsx)(Oe,{focused:!0,value:e,size:`small`,label:t,variant:`standard`,sx:{width:n?`${n-20}px`:`100%`,"& .MuiInput-underline:before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline:hover:not(.Mui-disabled):before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline.Mui-focused:after":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5}},slotProps:{input:{readOnly:!0,sx:{color:`var(--div-text-color)`,"&:before":{borderBottomColor:`var(--main-label-color)`},"&:after":{borderBottomColor:`var(--main-label-color)`}}},inputLabel:{sx:{marginTop:`3px`,color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}}})}var Gi=(0,U.memo)(zi);function Ki(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,U.useContext)(Y),{showSnackbarMessage:a}=(0,U.useContext)($t),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)([]),[u,d]=(0,U.useState)([]),f=(0,U.useRef)(i());return(0,U.useEffect)(()=>{K&&console.log(`Test useEffect WebSocketMessage mounting`);let e=e=>{if(e.method===`restart_required`)K&&console.log(`Test received restart_required`),a(`Restart required`,0);else if(e.method===`refresh_required`)K&&console.log(`Test received refresh_required: changed=${e.response.changed} and sending api requests`),a(`Refresh required`,0),t({id:f.current,method:`/api/settings`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/plugins`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/devices`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}});else if(e.method===`/api/settings`&&e.response)K&&console.log(`Test received /api/settings:`,e.response),a(`Test received /api/settings`,0),s(e.response);else if(e.method===`/api/plugins`&&e.response)K&&console.log(`Test received ${e.response.length} plugins:`,e.response),a(`Test received /api/plugins`,0),l(e.response);else if(e.method===`/api/devices`&&e.response){K&&console.log(`Test received ${e.response.length} devices:`,e.response),a(`Test received /api/devices`,0),d(e.response);for(let n of e.response)K&&console.log(`Test sending /api/clusters for device:`,n.plugin,n.deviceName,n.number),t({id:f.current,method:`/api/clusters`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{pluginName:n.plugin,number:n.number||0,serialNumber:n.serialNumber,uniqueId:n.uniqueId}})}};return n(e,f.current),K&&console.log(`Test useEffect WebSocketMessage mounted`),()=>{K&&console.log(`Test useEffect WebSocketMessage unmounting`),r(e),K&&console.log(`Test useEffect WebSocketMessage unmounted`)}},[n,r,t,a]),(0,U.useEffect)(()=>(K&&console.log(`Test useEffect online mounting`),e&&(K&&console.log(`Test useEffect online received online`),t({id:f.current,method:`/api/settings`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/plugins`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/devices`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}})),K&&console.log(`Test useEffect online mounted`),()=>{K&&console.log(`Test useEffect online unmounted`)}),[e,t]),K&&console.log(`Test rendering...`),e?(0,J.jsx)(rr,{name:`Test`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,alignContent:`center`,gap:`20px`,height:`100vh`,width:`100vw`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`256px`,width:`256px`,margin:`10px`}}),(0,J.jsx)(`p`,{children:`Welcome to the Test page of the Matterbridge frontend`})]})}):(0,J.jsx)(nn,{})}var qi=(0,U.memo)(Ki);function Ji({open:e,title:t,message:n,onConfirm:r,onCancel:i}){return(0,J.jsxs)(R,{open:e,children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:t})]})}),(0,J.jsxs)(E,{children:[(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:`0`,marginBottom:`20px`,maxHeight:`350px`,maxWidth:`350px`},children:(0,J.jsx)(`p`,{style:{flex:1,margin:`0`},children:n})}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-around`},children:[(0,J.jsx)(M,{onClick:e=>{K&&console.log(`Confirmed`),e.preventDefault(),r()},variant:`contained`,color:`primary`,size:`small`,children:`Confirm`}),(0,J.jsx)(M,{onClick:e=>{K&&console.log(`Canceled`),e.preventDefault(),i()},variant:`contained`,color:`primary`,size:`small`,children:`Cancel`})]})]})]})}var Yi=({open:e,output:t,title:n,_command:r,_packageName:i,onInstall:a,onClose:o})=>{let{installAutoExit:s,mobile:c,setInstallAutoExit:l}=(0,U.useContext)($t),u=(0,U.useRef)(null),d=e=>{l(e.target.checked),localStorage.setItem(G[`install-auto-exit`],e.target.checked?`true`:`false`),K&&console.log(`handleInstallAutoExitChange called with value:`,e.target.checked)};return(0,U.useEffect)(()=>{K&&console.log(`InstallProgressDialog output effect mounted, scrolling to bottom:`,u.current),setTimeout(()=>{K&&console.log(`Scrolling to bottom:`,u.current),u.current?.scrollIntoView({behavior:`smooth`,block:`end`})},0)},[t]),(0,J.jsxs)(R,{open:e,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&o()},slotProps:{paper:{sx:{width:q&&c?`100vw`:`75vw`,maxWidth:q&&c?`100vw`:`75vw`,height:q&&c?`100vh`:`75vw`,maxHeight:q&&c?`100vh`:`75vh`,margin:q&&c?`0px`:void 0,overflow:`hidden`}}},children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:n})]})}),(0,J.jsxs)(E,{dividers:!0,style:{overflow:`hidden`,display:`flex`,flexDirection:`column`,height:400,paddingBottom:0},children:[(0,J.jsx)(`div`,{style:{display:`block`,marginBottom:`10px`,fontSize:`16px`,fontWeight:`bold`,color:`var(--primary-color)`},children:`Process log`}),(0,J.jsxs)(`ul`,{style:{width:`100%`,height:`100%`,fontFamily:`monospace`,fontSize:`14px`,padding:`10px`,margin:0,marginBottom:`10px`,color:`var(--div-text-color)`,background:`var(--div-bg-color)`,overflow:`auto`,listStyle:`none`,boxSizing:`border-box`,borderRadius:4,border:`4px solid var(--primary-color)`,whiteSpace:`pre-wrap`,display:`block`},children:[t.split(`
|
|
43
|
-
`).map((e,t)=>(0,J.jsx)(`li`,{style:{padding:0,margin:0,wordBreak:`break-all`},children:e},t)),(0,J.jsx)(`li`,{ref:u,style:{padding:0,margin:0}})]})]}),(0,J.jsxs)(he,{sx:{justifyContent:`space-evenly`},children:[a&&(0,J.jsx)(M,{variant:`contained`,onClick:a,children:`Install`}),(0,J.jsx)(M,{onClick:o,children:`Close`}),(0,J.jsx)(le,{control:(0,J.jsx)(w,{checked:s,onChange:e=>d(e)}),label:`Close on success`,style:{color:`var(--div-text-color)`}})]})]})},Xi=[];function Zi({children:e}){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(null),{enqueueSnackbar:a,closeSnackbar:o}=
|
|
44
|
-
`)},[]),P=(0,U.useCallback)(()=>{K&&console.log(`UiProvider exitInstallProgressSuccess: package ${O}`),localStorage.getItem(G[`install-auto-exit`])!==`false`&&C(!1)},[O]),ne=(0,U.useCallback)(()=>{K&&console.log(`UiProvider exitInstallProgressError: package ${O}`)},[O]),F=(0,U.useCallback)(()=>{K&&console.log(`UiProvider hide install progress`),C(!1)},[]),re=()=>{K&&console.log(`UiProvider handle install close action`),C(!1),k(``),j(``)},I=(0,U.useMemo)(()=>({mobile:t,setMobile:n,currentPage:r,setCurrentPage:i,showSnackbarMessage:c,closeSnackbarMessage:s,closeSnackbar:o,showConfirmCancelDialog:x,showInstallProgress:N,exitInstallProgressSuccess:P,exitInstallProgressError:ne,hideInstallProgress:F,addInstallProgress:te,installAutoExit:M,setInstallAutoExit:ee}),[t,r,n,i,c,s,o,x,N,P,ne,F,te,M,ee]);return(0,J.jsxs)($t.Provider,{value:I,children:[(0,J.jsx)(Ji,{open:l,title:d,message:p,onConfirm:y,onCancel:b}),(0,J.jsx)(Yi,{open:S,title:w,_command:E,_packageName:O,output:A,onClose:re}),e]})}function Qi(e,t){K&&console.log(`getCssVariable:`,e,`defaultValue`,t);let n=getComputedStyle(document.body).getPropertyValue(e).trim();return n||console.error(`getCssVariable: undefined`,n),n||t}function $i(e){return u({palette:{primary:{main:e},action:{disabled:`var(--main-label-color)`},text:{disabled:`var(--main-label-color)`}},typography:{fontFamily:`Roboto, Helvetica, Arial, sans-serif`},components:{MuiDialog:{styleOverrides:{paper:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,border:`2px solid var(--div-border-color)`,borderRadius:`var(--div-border-radius)`,boxShadow:`2px 2px 5px var(--div-shadow-color)`}}},MuiTooltip:{defaultProps:{placement:`top-start`,arrow:!0}},MuiButton:{styleOverrides:{root:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,"&:hover":{backgroundColor:`var(--main-button-bg-color)`},"&.Mui-disabled":{color:`var(--main-button-color)`,backgroundColor:`var(--main-grey-color)`}},contained:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},outlined:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},text:{color:`var(--main-button-color)`}},defaultProps:{variant:`contained`,size:`small`}},MuiIconButton:{styleOverrides:{root:{color:`var(--main-icon-color)`,"&:hover .MuiSvgIcon-root":{color:`var(--primary-color)`}}}},MuiCheckbox:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-checked":{color:`var(--primary-color)`}}}},MuiTextField:{defaultProps:{size:`small`,variant:`outlined`,fullWidth:!0}},MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:`var(--div-bg-color)`,"& .MuiOutlinedInput-notchedOutline":{borderColor:`var(--main-label-color)`},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:`var(--main-text-color)`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`var(--primary-color)`},padding:`0px`},input:{color:`var(--div-text-color)`,padding:`4px 8px`}}},MuiInputLabel:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--primary-color)`}}}},MuiFormLabel:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}},MuiFormControl:{styleOverrides:{root:{color:`var(--main-grey-color)`}}},MuiRadio:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-checked":{color:`var(--primary-color)`}}}},MuiSelect:{styleOverrides:{root:{backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`,height:`30px`,"&:hover":{borderColor:`var(--main-text-color)`},"&.Mui-focused":{borderColor:`var(--primary-color)`}},icon:{color:`var(--main-label-color)`}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:`var(--main-menu-bg-color)`,padding:`0px`,margin:`0px`},list:{padding:`0px`}}},MuiMenuItem:{styleOverrides:{root:{color:`var(--main-menu-color)`,backgroundColor:`var(--main-menu-bg-color)`,"&:hover":{backgroundColor:`var(--main-menu-hover-color)`},"&.Mui-selected":{color:`var(--main-menu-color)`,backgroundColor:`var(--main-menu-bg-color)`},"&.Mui-selected:hover":{backgroundColor:`var(--main-menu-hover-color)`}}}},MuiListItemButton:{styleOverrides:{root:{cursor:`pointer`,"&:hover":{backgroundColor:`var(--main-bg-color)`}}}},MuiListItemIcon:{styleOverrides:{root:{color:`var(--div-text-color)`}}},MuiListItemText:{styleOverrides:{primary:{fontSize:`16px`,fontWeight:`bold`,color:`var(--div-text-color)`},secondary:{fontSize:`14px`,fontWeight:`normal`,color:`var(--div-text-color)`}}}}})}function ea({setLoggedIn:e}){let[t,n]=(0,U.useState)(``),[r,i]=(0,U.useState)(``),a={display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,backgroundColor:`var(--main-bg-color)`},o={display:`flex`,flexDirection:`column`,maxWidth:`400px`,margin:`0 auto`,padding:`20px`,gap:`20px`,border:`1px solid var(--div-border-color)`,borderRadius:`var(--div-border-radius)`,boxShadow:`2px 2px 5px var(--div-shadow-color)`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`},s={margin:`10px 0`,padding:`3px 3px`,fontSize:`14px`,width:`230px`,border:`1px solid var(--main-label-color)`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`},c=(0,U.useCallback)(async(t,n)=>{try{let r=await fetch(`./api/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t}),signal:n});if(r.ok){let{valid:a}=await r.json();if(n?.aborted)return;a?(e(!0),t!==``&&qt(t)):t!==``&&i(`Incorrect password!`)}else console.error(`Failed to log in:`,r.statusText)}catch(e){if(n?.aborted)return;console.error(`Failed to log in:`,e)}},[e]);return(0,U.useEffect)(()=>{let e=new AbortController;return c(``,e.signal),()=>{e.abort()}},[c]),(0,J.jsx)(`div`,{style:a,children:(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),c(t)},style:o,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h3`,{style:{color:`var(--div-text-color)`},children:`Welcome to Matterbridge`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-between`,gap:`20px`},children:[(0,J.jsx)(`input`,{type:`text`,name:`username`,autoComplete:`username`,style:{display:`none`},tabIndex:-1}),(0,J.jsx)(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),style:s,placeholder:`password`,autoComplete:`current-password`}),(0,J.jsx)(`button`,{type:`submit`,style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,borderColor:`var(--div-bg-color)`},children:`Log in`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:0,height:`30px`},children:r&&(0,J.jsx)(`p`,{style:{color:`red`},children:r})})]})})}function ta(){let[e,t]=(0,U.useState)(!1),r=localStorage.getItem(G[`frontend-theme`])||`dark`,o=Fi(r);K&&console.log(`Setting frontend theme "%s" (%s)`,r,o);let s=Qi(`--primary-color`,`#1976d2`);K&&console.log(`Primary color from CSS "%s"`,s);let l=$i(s),u=window.location.href,d=window.location.pathname;(d.endsWith(`/devices`)||d.endsWith(`/log`)||d.endsWith(`/settings`)||d.endsWith(`/test`))&&(d=d.substring(0,d.lastIndexOf(`/`)));let f=d.endsWith(`/`)?d:d+`/`;Zt(f);let p=d.includes(`/api/hassio_ingress/`);return Yt(p),K&&(console.log(`Loading App...`),console.log(`- href = "${u}"`),console.log(`- pathname = "${window.location.pathname}" >>> "${d}"`),console.log(`- baseName = "${f}"`),console.log(`- isIngress = "${p}"`)),e?(0,J.jsx)(se,{theme:l,children:(0,J.jsx)(
|
|
42
|
+
`,t.head.appendChild(a)},[oe,se]=(0,U.useState)(),[ce,le]=(0,U.useState)(!1),de=e=>{K&&console.log(`handleConfigPlugin plugin:`,e.name),r({id:l.current,sender:`HomePlugins`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),r({id:l.current,sender:`HomePlugins`,method:`/api/select/entities`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),se(e),fe()},fe=()=>{le(!0)};return K&&console.log(`HomePlugins rendering...`),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Z,{children:[oe&&(0,J.jsx)(ti,{open:ce,onClose:()=>{le(!1)},onSave:e=>{g(t=>t.map(t=>t.name===oe?.name?{...t,configJson:e,restartRequired:!0}:t))},plugin:oe}),(0,J.jsx)(Xn,{name:`Plugins`,columns:C,rows:m,footerRight:``,footerLeft:``})]}),(0,J.jsxs)(R,{open:v!==null,onClose:()=>b(null),slotProps:{paper:{sx:{width:q&&s?`100vw`:`75vw`,height:q&&s?`100vh`:`75vh`,maxWidth:q&&s?`100vw`:`75vw`,maxHeight:q&&s?`100vh`:`75vh`,margin:q&&s?`0px`:void 0,display:`flex`,flexDirection:`column`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`}}},children:[(0,J.jsx)(E,{style:{display:`flex`,flex:`1 1 auto`,minHeight:0,padding:`0px`,margin:`0px`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`},children:v&&(0,J.jsx)(`iframe`,{title:`${v.name} frontend`,src:v.path,onLoad:ae,style:{display:`block`,flex:`1 1 auto`,width:`100%`,height:`100%`,border:`none`,backgroundColor:`var(--div-bg-color)`}})}),(0,J.jsx)(he,{sx:{flex:`0 0 auto`,justifyContent:`center`},children:(0,J.jsx)(M,{onClick:()=>b(null),children:`Close`})})]})]}):(0,J.jsx)(nn,{})}var ii=(0,U.memo)(ri);function ai({version:e,changelog:t}){let{online:n}=(0,U.useContext)(Y);return K&&console.log(`HomeShowChangelog rendering...`),n?(0,J.jsxs)(Z,{children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matterbridge Update`})}),(0,J.jsxs)(cn,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,J.jsxs)(`h4`,{style:{margin:0},children:[`Matterbridge has been updated to version `,e,`.`]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(M,{onClick:()=>window.open(`https://github.com/Luligu/matterbridge`,`_blank`),endIcon:(0,J.jsx)(at,{style:{color:`#FFD700`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Star`}),(0,J.jsx)(M,{onClick:()=>window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`),endIcon:(0,J.jsx)(pt,{style:{color:`#b6409c`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Sponsor`}),(0,J.jsx)(M,{onClick:()=>window.open(t,`_blank`),endIcon:(0,J.jsx)(y,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Changelog`}),(0,J.jsx)(M,{onClick:()=>window.location.reload(),endIcon:(0,J.jsx)(ke,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Close`})]})]})]}):(0,J.jsx)(nn,{})}var oi=(0,U.memo)(ai);function si({value:e,maxChars:t}){let n=e;if(e.length>t&&t>3){let r=t-3;n=`${e.substring(0,Math.ceil(r/2))} … ${e.substring(e.length-Math.floor(r/2),e.length)}`}return e===n?(0,J.jsx)(`span`,{children:n}):(0,J.jsx)(H,{title:e,placement:`top`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[0,12]}}]}},children:(0,J.jsx)(`span`,{children:n})})}var ci=new Map([[`matterbridgeVersion`,`Matterbridge version`],[`frontendVersion`,`Frontend version`],[`dockerVersion`,`Docker version`],[`homeDirectory`,`Home`],[`rootDirectory`,`Root`],[`matterbridgeDirectory`,`Storage`],[`matterbridgeCertDirectory`,`Cert`],[`matterbridgePluginDirectory`,`Plugins`],[`globalModulesDirectory`,`Modules`],[`bridgeMode`,`Bridge mode`],[`restartMode`,`Restart mode`],[`virtualMode`,`Virtual mode`],[`bridgeStatus`,`Bridge status`],[`profile`,`Profile`],[`loggerLevel`,`Logger level`],[`fileLogger`,`File logger`],[`matterLoggerLevel`,`Matter logger level`],[`matterFileLogger`,`Matter file logger`],[`restartRequired`,`Restart required`],[`updateRequired`,`Update required`],[`runningTimes`,`Running times`],[`runningDays`,`Running days`]]),li=new Set([`matterbridgeLatestVersion`,`matterbridgeDevVersion`,`dockerDev`,`dockerLatestVersion`,`dockerDevVersion`,`fixedRestartRequired`,`matterMdnsInterface`,`matterIpv4Address`,`matterIpv6Address`,`readOnly`,`matterPort`,`matterDiscriminator`,`matterPasscode`,`startupAt`,`shutdownAt`]);function ui({matterbridgeInfo:e}){let{mobile:t}=(0,U.useContext)($t);K&&console.log(`MatterbridgeInfoTable:`,e);let[n,r]=(0,U.useState)(!1);return K&&console.log(`MatterbridgeInfoTable rendering...`),!e||n?null:(0,J.jsxs)(Z,{style:q&&t?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`Matterbridge info`}),(0,J.jsx)(ln,{close:()=>r(!0)})]}),(0,J.jsx)(cn,{style:q&&t?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(e).filter(([e,t])=>!li.has(e)&&t!=null&&t!==``).map(([e,n],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:ci.get(e)??e}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&t?typeof n==`string`?n:n.toString():(0,J.jsx)(si,{value:typeof n==`string`?n:n.toString(),maxChars:24})})]},e))})]})})]})}var di=(0,U.memo)(ui),fi={margin:`0px`,padding:`0px`,color:`var(--div-text-color)`,transition:`color 0.2s ease`,"& svg":{display:`block`},"& svg path":{fill:`var(--div-text-color)`,transition:`fill 0.2s ease`},"&:hover":{color:`var(--primary-color)`},"&:hover svg path":{fill:`var(--primary-color)`},"&:focus-visible":{outline:`2px solid var(--primary-color)`,outlineOffset:`2px`}},pi=e=>{if(!e)return``;let t=e.replace(/[^0-9]/g,``);return t.length<5?t:[t.slice(0,4),t.slice(4,7),t.slice(7,11)].filter(Boolean).join(`-`)};function mi({id:e}){let{online:t,sendMessage:n,addListener:r,removeListener:i,getUniqueId:a}=(0,U.useContext)(Y),[o,s]=(0,U.useState)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(null),u=(0,U.useRef)(a()),{mobile:d,showConfirmCancelDialog:f}=(0,U.useContext)($t);K&&console.log(`QRDiv loading with id = "${e}" and matter:`,o),(0,U.useEffect)(()=>{K&&console.log(`QRDiv id effect "${e}"`),c.current=e,l.current&&clearTimeout(l.current),l.current=null,e?(K&&console.log(`QRDiv id effect sending data request for storeId "${e}"`),n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:e,server:!0}})):(K&&console.log(`QRDiv id effect setting matter to null`),s(null))},[e,n]),(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`QRDiv received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`matter`&&e.response.matter&&(K&&console.log(`QRDiv received refresh_required: changed=${e.response.changed} for storeId "${e.response.matter.id}":`,e.response.matter),c.current===e.response.matter.id&&(K&&console.log(`QRDiv received refresh_required/matter: setting matter data for storeId "${e.response.matter.id}":`,e.response.matter),l.current&&clearTimeout(l.current),s(e.response.matter)))};return r(e,u.current),K&&console.log(`QRDiv webSocket effect mounted`),()=>{i(e),l.current&&clearTimeout(l.current),l.current=null,K&&console.log(`QRDiv webSocket effect unmounted`)}},[r,i]);let p=()=>{K&&console.log(`QRDiv sent matter startCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,startCommission:!0}})},m=()=>{K&&console.log(`QRDiv sent matter stopCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,stopCommission:!0}})},h=()=>{K&&console.log(`QRDiv sent matter advertise for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,advertise:!0}})},g=e=>{K&&console.log(`QRDiv sent matter removeFabric for node "${o?.id}" and fabricIndex ${e}`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,removeFabric:e}})},_=async()=>{if(!o?.manualPairingCode)return;let e=o.manualPairingCode;try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}K&&console.log(`Manual pairing code copied to clipboard`)}catch(e){console.error(`Failed to copy manual pairing code`,e)}};return!o||!t?(K&&console.log(`QRDiv rendering undefined state`),null):o.online?o.advertising&&o.qrPairingCode&&o.manualPairingCode?(K&&console.log(`QRDiv rendering advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`QR pairing code`}),(0,J.jsxs)(ln,{children:[(0,J.jsx)(z,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:Ot,size:`22px`})})}),(0,J.jsx)(z,{"aria-label":`stop pairing`,size:`small`,onClick:m,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Turn off pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:St,size:`22px`})})})]})]}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(zt,{value:o.qrPairingCode,size:256,level:`M`,fgColor:`var(--div-text-color)`,bgColor:`var(--div-bg-color)`,style:{margin:`20px`}}),(0,J.jsxs)(an,{style:{justifyContent:`space-between`},children:[(0,J.jsxs)(on,{style:{fontWeight:`normal`,color:`var(--div-text-color)`},children:[`Manual pairing code: `,pi(o.manualPairingCode)]}),(0,J.jsx)(ln,{children:(0,J.jsx)(H,{title:`Copy manual pairing code`,arrow:!0,children:(0,J.jsx)(z,{"aria-label":`copy manual pairing code`,size:`small`,onClick:()=>void _(),sx:fi,children:(0,J.jsx)(X.Icon,{path:Et,size:.85})})})})]})]})):o.commissioned&&o.fabricInformations&&o.sessionInformations?(K&&console.log(`QRDiv rendering commissioned state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`,overflow:`hidden`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`Paired fabrics`}),(0,J.jsxs)(ln,{children:[(0,J.jsx)(z,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:Ot,size:`22px`})})}),(0,J.jsx)(z,{"aria-label":`start pairing`,size:`small`,onClick:p,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(H,{title:`Turn on pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:kt,size:`22px`})})})]})]}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(cn,{style:{flexDirection:`column`,justifyContent:`flex-start`,flex:`1 1 auto`,overflow:`auto`,padding:`0px 0px 10px 0px`,gap:`0px`},children:o.fabricInformations.map((e,t)=>(0,J.jsxs)(`div`,{style:{margin:`0px`,padding:`10px`,gap:`0px`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,textAlign:`left`,fontSize:`14px`},children:[(0,J.jsxs)(`div`,{style:{marginLeft:`20px`,marginBottom:`10px`,display:`flex`,flexDirection:`row`,justifyContent:`space-between`,gap:`20px`,alignItems:`center`},children:[(0,J.jsxs)(`p`,{className:`status-blue`,style:{margin:`0px`,padding:`3px 10px`,width:`200px`,fontSize:`14px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},children:[`Fabric: `,e.fabricIndex]}),(0,J.jsx)(H,{title:`Remove the fabric. You will also need to remove it from the controller.`,arrow:!0,children:(0,J.jsx)(z,{"aria-label":`remove the fabric`,size:`small`,onClick:()=>f(`Remove fabric`,`Are you sure you want to remove this fabric? You will also need to remove it from the controller.`,`RemoveFabric`,()=>g(e.fabricIndex),()=>void 0),sx:{...fi,padding:`2px`},children:(0,J.jsx)(X.Icon,{path:Ct,size:1})})})]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Vendor: `,e.rootVendorId,` `,e.rootVendorName]}),e.label!==``&&(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Label: `,e.label]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Sessions: `,o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive).length,` subscriptions:`,` `,o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive&&t.numberOfActiveSubscriptions>0).length]})]},t))}),(0,J.jsx)(an,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(on,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):!o.commissioned&&!o.advertising?(K&&console.log(`QRDiv rendering not commissioned and not advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`QR pairing code`})}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(M,{onClick:p,endIcon:(0,J.jsx)(X.Icon,{path:kt,size:1}),style:{margin:`20px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`,minWidth:`90px`},children:`Turn on pairing`}),(0,J.jsx)(an,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(on,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):(K&&console.log(`QRDiv rendering unknown state`),null):(K&&console.log(`QRDiv rendering offline state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(rn,{style:{height:`30px`,justifyContent:`space-between`},children:(0,J.jsx)(Q,{children:`Server node`})}),(0,J.jsx)(sn,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:o.id}),(0,J.jsx)(sn,{style:{fontWeight:`bold`},children:`Server offline`}),(0,J.jsx)(an,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(on,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]}))}var hi=(0,U.memo)(mi);function gi({systemInfo:e,compact:t}){let{mobile:n}=(0,U.useContext)($t),{addListener:r,removeListener:i,getUniqueId:a,sendMessage:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)(e),[l,u]=(0,U.useState)(!1),d=(0,U.useRef)(a());K&&console.log(`SystemInfoTable loading with systemInfo:`,s,`compact:`,t);let f=new Map([[`interfaceName`,`Interface name`],[`macAddress`,`Mac address`],[`ipv4Address`,`IPv4 address`],[`ipv6Address`,`IPv6 address`],[`nodeVersion`,`Node version`],[`bunVersion`,`Bun version`],[`hostname`,`Hostname`],[`user`,`User`],[`osType`,`Os`],[`osRelease`,`Os release`],[`osPlatform`,`Platform`],[`osArch`,`Architecture`],[`freeMemory`,t?`Host memory`:`Free memory`],[`totalMemory`,`Total memory`],[`constrainedMemory`,`Memory limit`],[`systemUptime`,`System uptime`],[`processUptime`,`Process uptime`],[`cpuUsage`,`Host CPU`],[`processCpuUsage`,`Process CPU`],[`rss`,`Process memory`],[`heapUsed`,t?`Process heap`:`Used heap`],[`heapTotal`,`Total heap`]]),p={...s};if(p.constrainedMemory===p.totalMemory&&(p.constrainedMemory=``),t&&p.totalMemory&&p.freeMemory){let e=p.totalMemory;p.freeMemory=`${p.freeMemory} / ${e}`,p.totalMemory=``}if(t&&p.heapTotal&&p.heapUsed){let e=p.heapTotal;p.heapUsed=`${p.heapUsed} / ${e}`,p.heapTotal=``}return t&&p.osRelease&&p.osType&&(p.osType=`${p.osType} (${p.osRelease})`,p.osRelease=``),t&&p.osArch&&p.osPlatform&&(p.osPlatform=`${p.osPlatform} (${p.osArch})`,p.osArch=``),p.bunVersion&&=(p.nodeVersion=p.bunVersion,void 0),(0,U.useEffect)(()=>{let e=e=>{c(t=>({...t,totalMemory:e.totalMemory,freeMemory:e.freeMemory,constrainedMemory:e.constrainedMemory,heapTotal:e.heapTotal,heapUsed:e.heapUsed,rss:e.rss,cpuUsage:e.cpuUsage.toFixed(2)+` %`,processCpuUsage:e.processCpuUsage.toFixed(2)+` %`,systemUptime:e.systemUptime,processUptime:e.processUptime}))},t=t=>{K&&console.log(`SystemInfoTable received WebSocket Message:`,t),t.method===`system_update`&&t.response?(K&&console.log(`SystemInfoTable received system_update`,t),e(t.response)):t.method===`/api/viewhistorypage`&&t.id===d.current&&t.success&&(K&&console.log(`SystemInfoTable received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`))};return r(t,d.current),K&&console.log(`SystemInfoTable added WebSocket listener id ${d.current}`),()=>{i(t),K&&console.log(`SystemInfoTable removed WebSocket listener`)}},[r,i]),!s||l?null:(K&&console.log(`SystemInfoTable rendering...`),(0,J.jsxs)(Z,{style:q&&n?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(rn,{children:[(0,J.jsx)(Q,{children:`System info`}),(0,J.jsx)(ln,{close:()=>u(!0),children:(0,J.jsx)(z,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:()=>{K&&console.log(`SystemInfoTable handleViewHistory clicked`),o({id:d.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}})},children:(0,J.jsx)(H,{title:`Open the cpu and memory usage page`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:wt,size:`22px`})})})})]}),(0,J.jsx)(cn,{style:q&&n?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(p).filter(([e,t])=>e!==`bunVersion`&&t!==void 0&&t!==``).map(([e,t],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e===`nodeVersion`&&s.bunVersion?`Bun version`:f.get(e)??e}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&n?t:(0,J.jsx)(si,{value:t,maxChars:22})})]},e))})]})})]}))}var _i=(0,U.memo)(gi);function vi(){let[e,t]=(0,U.useState)(null),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)([]),[o]=(0,U.useState)(localStorage.getItem(G[`home-page-plugins`])!==`false`),[s]=(0,U.useState)(localStorage.getItem(G[`home-page-mode`])??`devices`),[c,l]=(0,U.useState)(`https://matterbridge.io/CHANGELOG.html`),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(null),{mobile:g}=(0,U.useContext)($t),{addListener:_,removeListener:v,online:y,sendMessage:b,getUniqueId:x}=(0,U.useContext)(Y),S=(0,U.useRef)(x());(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`Home received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Home received refresh_required: changed=${e.response.changed} and sending /api/settings request`),h(null),a([]),b({id:S.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),b({id:S.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`&&(K&&console.log(`Home received update_required`,e.response),e.response.devVersion?r(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):r(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)),e.method===`/api/settings`&&e.id===S.current?(K&&console.log(`Home received settings:`,e.response),t(e.response.systemInformation),r(e.response.matterbridgeInformation),localStorage.getItem(G[`frontend-version`])===null&&e.response.matterbridgeInformation.frontendVersion?localStorage.setItem(G[`frontend-version`],e.response.matterbridgeInformation.frontendVersion):e.response.matterbridgeInformation.frontendVersion!==localStorage.getItem(G[`frontend-version`])&&e.response.matterbridgeInformation.frontendVersion&&(localStorage.setItem(G[`frontend-version`],e.response.matterbridgeInformation.frontendVersion),p(!0)),localStorage.getItem(G[`matterbridge-version`])===null?localStorage.setItem(G[`matterbridge-version`],e.response.matterbridgeInformation.matterbridgeVersion):e.response.matterbridgeInformation.matterbridgeVersion!==localStorage.getItem(G[`matterbridge-version`])&&(localStorage.setItem(G[`matterbridge-version`],e.response.matterbridgeInformation.matterbridgeVersion),d(!0))):e.method===`/api/plugins`&&e.id===S.current&&(K&&console.log(`Home received plugins:`,e.response),a(e.response))};return _(e,S.current),K&&console.log(`Home added WebSocket listener id ${S.current}`),()=>{v(e),K&&console.log(`Home removed WebSocket listener`)}},[_,v,b]);let C=(0,U.useMemo)(()=>n?.bridgeMode===`bridge`?`Matterbridge`:n?.bridgeMode===`childbridge`?i.find(e=>e.matter?.id)?.matter?.id??null:null,[n,i]),w=m??C;return(0,U.useEffect)(()=>{y&&(K&&console.log(`Home online effect, sending /api/settings and /api/plugins requests`),b({id:S.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),b({id:S.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[y,b]),K&&console.log(`Home rendering...`),!y||!e||!n?(0,J.jsx)(nn,{}):(0,J.jsxs)(rr,{name:`Home`,style:q&&g?{alignItems:`center`,gap:`10px`}:{flexDirection:`row`},children:[(q&&!g||!q)&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`302px`,minWidth:`302px`,gap:`20px`},children:[(0,J.jsx)(hi,{id:w}),(0,J.jsx)(_i,{systemInfo:e,compact:!0})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`,gap:q&&g?`10px`:`20px`},children:[f&&(0,J.jsx)(sr,{version:n.frontendVersion}),u&&(0,J.jsx)(oi,{version:n.matterbridgeVersion,changelog:c}),q&&g&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(hi,{id:w}),(0,J.jsx)(_i,{systemInfo:e,compact:!1}),(0,J.jsx)(di,{matterbridgeInfo:n})]}),o&&!n.readOnly&&(0,J.jsx)(jr,{}),o&&(0,J.jsx)(ii,{storeId:w,setStoreId:h}),s===`devices`&&(0,J.jsx)(hr,{storeId:w,setStoreId:h}),s===`logs`&&(0,J.jsx)(Ir,{})]})]})}var yi=(0,U.memo)(vi);function bi(){let{logLength:e,logAutoScroll:t,setMessages:n,setLogLength:r,setLogAutoScroll:i,setLogFilterLevel:a,setLogFilterSearch:o,online:s,filterLogMessages:c}=(0,U.useContext)(Y),[l,u]=(0,U.useState)(localStorage.getItem(G[`log-filter-level`])??`info`),[d,f]=(0,U.useState)(localStorage.getItem(G[`log-filter-search`])??`*`),[p,m]=(0,U.useState)(e.current.toString()),[h,g]=(0,U.useState)(t.current);return K&&console.log(`Logs rendering...`),s?(0,J.jsxs)(rr,{name:`Logs`,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,margin:`0px`,padding:`0px`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(F,{id:`select-level`,style:{color:`var(--div-text-color)`},children:`Filter log by level:`}),(0,J.jsxs)(de,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-level`,id:`debug-level`,value:l,onChange:e=>{let t=e.target.value;u(t),a(t),c(t,d),localStorage.setItem(G[`log-filter-level`],t),K&&console.log(`handleLogFilterLevelChange called with value:`,t)},children:[(0,J.jsx)(b,{value:`debug`,children:`Debug`}),(0,J.jsx)(b,{value:`info`,children:`Info`}),(0,J.jsx)(b,{value:`notice`,children:`Notice`}),(0,J.jsx)(b,{value:`warn`,children:`Warn`}),(0,J.jsx)(b,{value:`error`,children:`Error`}),(0,J.jsx)(b,{value:`fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`5px`},children:[(0,J.jsx)(F,{id:`search`,style:{color:`var(--div-text-color)`},children:`Filter log by text:`}),(0,J.jsx)(H,{title:`Use /text/ for case-insensitive regex search`,children:(0,J.jsx)(Oe,{style:{width:`210px`},size:`small`,id:`logsearch`,variant:`outlined`,value:d,onChange:e=>{let t=e.target.value;f(t),o(t),c(l,t),localStorage.setItem(G[`log-filter-search`],t),K&&console.log(`handleLogFilterSearchChange called with value:`,t)},slotProps:{input:{style:{height:`30px`,padding:`0 0px`,backgroundColor:`var(--main-bg-color)`}}}})})]}),(0,J.jsx)(le,{control:(0,J.jsx)(w,{checked:h,onChange:e=>{let t=e.target.checked;g(t),i(t),c(l,d),localStorage.setItem(G[`log-auto-scroll`],t?`true`:`false`),K&&console.log(`handleAutoScrollChange called with value:`,t)}}),label:`Auto scroll`,style:{color:`var(--div-text-color)`}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(F,{id:`select-size-label`,style:{color:`var(--div-text-color)`},children:`Log length:`}),(0,J.jsxs)(de,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-size-label`,id:`select-size`,value:p,onChange:e=>{let t=e.target.value;m(t),r(Number(t)),localStorage.setItem(G[`log-length`],t),K&&console.log(`handleLogLengthChange called with value:`,t)},children:[(0,J.jsx)(b,{value:100,children:`100`}),(0,J.jsx)(b,{value:200,children:`200`}),(0,J.jsx)(b,{value:500,children:`500`}),(0,J.jsx)(b,{value:1e3,children:`1000`})]}),(0,J.jsx)(H,{title:`Clear the logs`,children:(0,J.jsx)(M,{onClick:()=>{K&&console.log(`handleClearLogsClick called`),n([])},endIcon:(0,J.jsx)(Le,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Clear`})})]})]}),(0,J.jsx)(`div`,{style:{flex:`1`,overflow:`auto`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(Pr,{})})]}):(0,J.jsx)(nn,{})}var xi=(0,U.memo)(bi),Si=1200,Ci,wi;function Ti(e,t){Ci=e,wi=t}function Ei(){let{mobile:e,showSnackbarMessage:t,showConfirmCancelDialog:n}=(0,U.useContext)($t),{online:i,sendMessage:a,logMessage:o,addListener:c,removeListener:l,getUniqueId:u}=(0,U.useContext)(Y),[f,p]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),[T,E]=(0,U.useState)(null),[D,O]=(0,U.useState)(`inactive`),k=(0,U.useRef)(u()),[A,j]=(0,U.useState)(null),[M,ee]=(0,U.useState)(null),[N,te]=(0,U.useState)(null),[P,ne]=(0,U.useState)(null),F=r(),re=()=>{window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`)},ie=()=>{window.open(`https://matterbridge.io/`)},ae=()=>{window.open(`https://matterbridge.io/README.html`)},oe=()=>{window.open(`https://matterbridge.io/CHANGELOG.html`)},se=()=>{window.open(`https://discord.com/invite/QX58CDe6hd`,`_blank`)},ce=()=>{window.open(`https://github.com/Luligu/matterbridge`,`_blank`)},le=()=>{a({id:k.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge`,restart:!0}}),S(!1)},ue=()=>{a({id:k.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge@dev`,restart:!0}}),w(!1)},de=()=>{a({id:k.current,sender:`Header`,method:`/api/checkupdates`,src:`Frontend`,dst:`Matterbridge`,params:{}})},pe=()=>{T?.matterbridgeInformation.restartMode===`none`?a({id:k.current,sender:`Header`,method:`/api/restart`,src:`Frontend`,dst:`Matterbridge`,params:{}}):a({id:k.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},me=()=>{a({id:k.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},he=e=>{j(e.currentTarget)},L=e=>{K&&console.log(`Header: handleMenuClose`,e),j(null),e===`/`||e===`/devices`||e===`/log`||e===`/settings`?F(e):e===`reset_frontend`?(o(`Matterbridge`,`Resetting frontend UI...`),t(`Resetting frontend UI...`,5),Ht(),window.location.reload()):e===`download-mblog`?(o(`Matterbridge`,`Downloading matterbridge log...`),t(`Downloading matterbridge log...`,5),window.location.href=`./api/download-mblog`):e===`download-mjlog`?(o(`Matterbridge`,`Downloading matter log...`),t(`Downloading matter log...`,5),window.location.href=`./api/download-mjlog`):e===`view-mblog`?(o(`Matterbridge`,`Loading matterbridge log...`),t(`Loading matterbridge log...`,5),window.open(`./api/view-mblog`,`_blank`,`noopener,noreferrer`)):e===`view-mjlog`?(o(`Matterbridge`,`Loading matter log...`),t(`Loading matter log...`,5),window.open(`./api/view-mjlog`,`_blank`,`noopener,noreferrer`)):e===`view-diagnostic`?(o(`Matterbridge`,`Loading diagnostic log...`),t(`Loading diagnostic log...`,5),window.open(`./api/view-diagnostic`,`_blank`,`noopener,noreferrer`)):e===`download-diagnostic`?(o(`Matterbridge`,`Downloading diagnostic log...`),t(`Downloading diagnostic log...`,5),window.location.href=`./api/download-diagnostic`):e===`view-history`?a({id:k.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`download-history`?a({id:k.current,sender:`Header`,method:`/api/downloadhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`download-mbstorage`?(o(`Matterbridge`,`Downloading matterbridge storage...`),t(`Downloading matterbridge storage...`,5),window.location.href=`./api/download-mbstorage`):e===`download-pluginstorage`?(o(`Matterbridge`,`Downloading matterbridge plugins storage...`),t(`Downloading matterbridge plugins storage...`,5),window.location.href=`./api/download-pluginstorage`):e===`download-pluginconfig`?(o(`Matterbridge`,`Downloading matterbridge plugins config...`),t(`Downloading matterbridge plugins config...`,5),window.location.href=`./api/download-pluginconfig`):e===`download-mjstorage`?(o(`Matterbridge`,`Downloading matter storage...`),t(`Downloading matter storage...`,5),window.location.href=`./api/download-mjstorage`):e===`download-backup`?(o(`Matterbridge`,`Downloading backup...`),t(`Downloading backup...`,10),window.location.href=`./api/download-backup`):e===`update`?le():e===`updatedev`?ue():e===`updatecheck`?de():e===`restart`?pe():e===`shutdown`?me():e===`create-backup`?a({id:k.current,sender:`Header`,method:`/api/create-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matterbridge-storage-backup`?a({id:k.current,sender:`Header`,method:`/api/create-matterbridge-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matter-storage-backup`?a({id:k.current,sender:`Header`,method:`/api/create-matter-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-plugin-backup`?a({id:k.current,sender:`Header`,method:`/api/create-plugin-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-config-backup`?a({id:k.current,sender:`Header`,method:`/api/create-config-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`unregister`?a({id:k.current,sender:`Header`,method:`/api/unregister`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`reset`?a({id:k.current,sender:`Header`,method:`/api/reset`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`factoryreset`&&a({id:k.current,sender:`Header`,method:`/api/factoryreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ge=e=>{K&&console.log(`Header: handleMenuCloseCancel:`,e),j(null)},_e=e=>{ee(e.currentTarget)},R=()=>{ee(null)},ve=e=>{te(e.currentTarget)},ye=()=>{te(null)},be=e=>{ne(e.currentTarget)},xe=()=>{ne(null)};return(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`Header received WebSocket Message:`,e),e.method===`/api/settings`&&e.id===k.current?(K&&console.log(`Header received settings:`,e.response),E(e.response),p(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired),g(e.response.matterbridgeInformation.fixedRestartRequired),S(e.response.matterbridgeInformation.updateRequired),O(e.response.matterbridgeInformation.bridgeStatus)):e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Header received refresh_required: changed=${e.response.changed} and sending /api/settings request`),a({id:k.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`restart_required`?(K&&console.log(`Header received restart_required with fixed: ${e.response.fixed}`),p(!0),e.response.fixed&&g(!0)):e.method===`restart_not_required`?(K&&console.log(`Header received restart_not_required`),p(!1)):e.method===`matterbridge_status_update`?(K&&console.log(`Header received matterbridge_status_update: ${e.response.status}`),O(e.response.status)):e.method===`update_required`?(K&&console.log(`Header received update_required`),e.response.devVersion?(E(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeDevVersion:e.response.version}}:null),w(!0)):(E(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeLatestVersion:e.response.version}}:null),S(!0))):e.method===`/api/viewhistorypage`&&e.id===k.current&&e.success?(K&&console.log(`Header received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`)):e.method===`/api/downloadhistorypage`&&e.id===k.current&&e.success?(K&&console.log(`Header received /api/downloadhistorypage success`),window.location.href=`./api/downloadhistory`):e.method===`archive`&&e.success&&e.response.command===`zip`&&(K&&console.log(`Header received archive success response for zip command`,e.response),e.response.archivePath.endsWith(`matterbridge.backup.zip`)?window.location.href=`./api/download-backup`:e.response.archivePath.endsWith(`matterbridge.storage.zip`)?window.location.href=`./api/download-mbstorage`:e.response.archivePath.endsWith(`matterbridge.matterstorage.zip`)?window.location.href=`./api/download-mjstorage`:e.response.archivePath.endsWith(`matterbridge.pluginstorage.zip`)?window.location.href=`./api/download-pluginstorage`:e.response.archivePath.endsWith(`matterbridge.pluginconfig.zip`)&&(window.location.href=`./api/download-pluginconfig`))};return c(e,k.current),K&&console.log(`Header added WebSocket listener id ${k.current}`),()=>{l(e),K&&console.log(`Header removed WebSocket listener`)}},[c,l,a]),(0,U.useEffect)(()=>{i&&(K&&console.log(`Header sending /api/settings and /api/checkupdates requests`),a({id:k.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[i,a]),K&&console.log(`Header rendering... mobile %s`,e),!i||!T?null:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(z,{style:{margin:`0`,padding:`0`},onClick:()=>{Ut(),K&&console.log(`Matterbridge logo clicked: debug is now`,K)},children:(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`30px`}})}),(0,J.jsx)(`h2`,{style:{fontSize:`22px`,color:`var(--main-icon-color)`,margin:`0px`},children:`Matterbridge`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:(0,J.jsxs)(`nav`,{children:[(0,J.jsx)(s,{to:`/`,className:`nav-link`,children:`Home`}),(0,J.jsx)(s,{to:`/devices`,className:`nav-link`,children:`Devices`}),(0,J.jsx)(s,{to:`/log`,className:`nav-link`,children:`Logs`}),(0,J.jsx)(s,{to:`/settings`,className:`nav-link`,children:`Settings`})]})})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[!T.matterbridgeInformation.readOnly&&(0,J.jsx)(H,{title:`Matterbridge v.${T.matterbridgeInformation.matterbridgeVersion}`,children:(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:x?`var(--primary-color)`:C?`var(--secondary-color)`:`green`},children:[`v.`,T.matterbridgeInformation.matterbridgeVersion.split(`-`)[0]+(T.matterbridgeInformation.matterbridgeVersion.includes(`-dev-`)?`@dev`:``)+(T.matterbridgeInformation.matterbridgeVersion.includes(`-edge-`)?`@edge`:``)+(T.matterbridgeInformation.matterbridgeVersion.includes(`-local-`)?`@local`:``)+(T.matterbridgeInformation.matterbridgeVersion.includes(`-git-`)?`@git`:``)]})}),T.matterbridgeInformation.bridgeMode!==`none`&&!T.matterbridgeInformation.readOnly?(0,J.jsx)(H,{title:`Bridge mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:D===`started`?`green`:D===`error`?`red`:void 0},children:T.matterbridgeInformation.bridgeMode})}):null,T.matterbridgeInformation.restartMode!==`none`&&!T.matterbridgeInformation.readOnly?(0,J.jsx)(H,{title:`Restart mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:T.matterbridgeInformation.restartMode})}):null,T.systemInformation.bunVersion?(0,J.jsx)(H,{title:`Bun version`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:`bun`})}):null,T.matterbridgeInformation.profile&&T.matterbridgeInformation.profile!==``&&!T.matterbridgeInformation.readOnly?(0,J.jsx)(H,{title:`Current profile`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:T.matterbridgeInformation.profile})}):null,K&&(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:[e?`Mobile `:`Desktop `,`${Ci}x${wi}`,` enabled ${localStorage.getItem(G[`enable-mobile`])!==`false`}`]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`5px`},children:[T.matterbridgeInformation.readOnly?null:(0,J.jsx)(H,{title:`Matterbridge discord group`,children:(0,J.jsx)(z,{style:{margin:`0`,padding:`0`},onClick:se,children:(0,J.jsx)(`img`,{src:`discord.svg`,alt:`Discord Logo`,style:{height:`25px`}})})}),T.matterbridgeInformation.readOnly?null:(0,J.jsx)(H,{title:`Give a star to Matterbridge`,children:(0,J.jsx)(z,{style:{color:`#FFD700`,margin:`0`,padding:`0`},onClick:ce,children:(0,J.jsx)(at,{})})}),T.matterbridgeInformation.readOnly?null:(0,J.jsx)(H,{title:`Sponsor Matterbridge`,children:(0,J.jsx)(z,{style:{color:`#b6409c`,margin:`0`,padding:`0`},onClick:re,children:(0,J.jsx)(pt,{})})}),(0,J.jsx)(H,{title:`Matterbridge homepage`,children:(0,J.jsx)(z,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ie,children:(0,J.jsx)(fe,{})})}),(0,J.jsx)(H,{title:`Matterbridge help`,children:(0,J.jsx)(z,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ae,children:(0,J.jsx)(_,{})})}),(0,J.jsx)(H,{title:`Matterbridge changelog`,children:(0,J.jsx)(z,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:oe,children:(0,J.jsx)(y,{})})}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&x&&(0,J.jsx)(H,{title:`Update matterbridge to latest version v.${T.matterbridgeInformation.matterbridgeLatestVersion}`,children:(0,J.jsx)(z,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:le,children:(0,J.jsx)(gt,{})})}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&C&&(0,J.jsx)(H,{title:`Update matterbridge to latest dev version v.${T.matterbridgeInformation.matterbridgeDevVersion}`,children:(0,J.jsx)(z,{style:{color:`var(--secondary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ue,children:(0,J.jsx)(gt,{})})}),(0,J.jsx)(H,{title:`Restart matterbridge`,children:(0,J.jsx)(z,{style:{color:f||h?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:pe,children:(0,J.jsx)(ht,{})})}),T.matterbridgeInformation.restartMode===`none`?(0,J.jsx)(H,{title:`Shut down matterbridge`,children:(0,J.jsx)(z,{style:{color:f||h?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:me,children:(0,J.jsx)(Te,{})})}):null,(0,J.jsx)(H,{title:`Download, backup and more`,children:(0,J.jsx)(z,{onClick:he,children:(0,J.jsx)(Qe,{style:{color:`var(--main-icon-color)`}})})}),(0,J.jsxs)(v,{id:`command-menu`,anchorEl:A,keepMounted:!0,open:!!A,onClose:()=>L(``),children:[q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Home page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/devices`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Devices page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/log`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Logs page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),q&&e&&(0,J.jsxs)(b,{onClick:()=>L(`/settings`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Settings page`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>L(`update`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(gt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Install latest stable`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>L(`updatedev`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(gt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Install latest dev`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation&&!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>L(`updatecheck`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(gt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Check for updates`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>L(`restart`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(ht,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Restart`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),T.matterbridgeInformation.restartMode===`none`?(0,J.jsxs)(b,{onClick:()=>L(`shutdown`),children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Shutdown`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}):null,(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:_e,children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`View`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(v,{id:`sub-menu-view`,anchorEl:M,keepMounted:!0,open:!!M,onClose:R,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(b,{onClick:()=>{Gt(),R(),ge(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Desktop site`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{Wt(),R(),ge(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Mobile site`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-mblog`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-mjlog`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matter log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-diagnostic`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge diagnostic log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`view-history`),R()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge system history`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]})]}),(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:ve,children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Download`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(v,{id:`sub-menu-download`,anchorEl:N,keepMounted:!0,open:!!N,onClose:ye,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(b,{onClick:()=>{L(`create-matterbridge-storage-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge storage`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`create-plugin-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge plugins storage`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`create-config-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge plugins config`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-mblog`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`create-matter-storage-backup`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matter storage`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-mjlog`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matter log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-diagnostic`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge diagnostic log`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{L(`download-history`),ye()},children:[(0,J.jsx)(B,{children:(0,J.jsx)(d,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Matterbridge system history`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]})]}),(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:()=>{L(`create-backup`)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(rt,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Backup`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsx)(m,{}),(0,J.jsxs)(b,{onClick:be,children:[(0,J.jsx)(B,{children:(0,J.jsx)(Ve,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(v,{id:`sub-menu-reset`,anchorEl:P,keepMounted:!0,open:!!P,onClose:xe,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Reset the frontend UI`,`Are you sure you want to reset the frontend UI? This will reset all local settings and reload the page.`,`reset_frontend`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset the frontend UI...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Reset all devices and shutdown`,`Are you sure you want to unregister all devices? This will temporarily remove all devices from the controller and you may loose the controller configuration.`,`unregister`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset all devices...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Reset commissioning and shutdown`,`Are you sure you want to reset the commissioning? You will have to manually remove Matterbridge from the controller.`,`reset`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Reset commissioning...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]}),!T.matterbridgeInformation.readOnly&&(0,J.jsxs)(b,{onClick:()=>{xe(),n(`Factory reset and shutdown`,`Are you sure you want to factory reset Matterbridge? You will have to manually remove Matterbridge from the controller.`,`factoryreset`,L,ge)},children:[(0,J.jsx)(B,{children:(0,J.jsx)(Te,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(I,{primary:`Factory reset...`,slotProps:{primary:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}}})]})]})]})]})]})}var Di=(0,U.memo)(Ei);function Oi(){if(typeof window<`u`){let e=Math.floor(window.visualViewport?.width??window.innerWidth),t=Math.floor(window.visualViewport?.height??window.innerHeight);Ti(e,t);let n=e<1200||t<900;return K&&console.log(`Visual viewport (%s) width %i height %i mobile %s`,window.visualViewport!==void 0,e,t,n),n}return!1}function ki({children:e}){let{mobile:t,setMobile:n}=(0,U.useContext)($t),{setLogAutoScroll:r}=(0,U.useContext)(Y);return(0,U.useEffect)(()=>{function e(){let e=Oi();e&&(r(!1),localStorage.setItem(G[`log-auto-scroll`],`false`)),n(e)}return window.addEventListener(`resize`,e),n(Oi()),()=>window.removeEventListener(`resize`,e)},[r,n]),K&&console.log(`MbfScreen rendering... mobile %s`,t),q&&t?(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`visible`,margin:`0px`,padding:`10px`,gap:`10px`},children:[(0,J.jsx)(Di,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`10px`},children:e})]}):(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`hidden`,width:t?`${Si}px`:`calc(100vw - 40px)`,height:t?`900px`:`calc(100vh - 40px)`,margin:`0px`,padding:`20px`,gap:`20px`},children:[(0,J.jsx)(Di,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,width:`100%`,height:`calc(100% - 60px)`,margin:`0px`,padding:`0px`,gap:`20px`},children:e})]})}function Ai(e=1e3){let t=null;return Object.assign(n=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{n(),t=null},e)},{cancel:()=>{t!==null&&(window.clearTimeout(t),t=null)}})}var ji=`(prefers-color-scheme: dark)`,Mi=null;function Ni(e){document.body.setAttribute(`frontend-theme`,e.matches?`dark`:`light`)}function Pi(e){return e===`auto`?typeof window.matchMedia==`function`&&!window.matchMedia(ji).matches?`light`:`dark`:e===`classic`||e===`light`?e:`dark`}function Fi(e){Mi?.removeEventListener(`change`,Ni),Mi=null,e===`auto`&&typeof window.matchMedia==`function`&&(Mi=window.matchMedia(ji),Mi.addEventListener(`change`,Ni));let t=Pi(e);return document.body.setAttribute(`frontend-theme`,t),t}var Ii=({open:e,onClose:t,onSave:n})=>{let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``),s=e=>{i(e.target.value)},c=e=>{o(e.target.value)},l=r.length>0&&r===a;return(0,J.jsxs)(R,{open:e,onClose:(e,n)=>{n!==`backdropClick`&&n!==`escapeKeyDown`&&t()},maxWidth:`sm`,style:{maxWidth:`500px`,margin:`auto`},children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:`Change Password`})]})}),(0,J.jsx)(E,{dividers:!0,children:(0,J.jsx)(yt,{component:`fieldset`,fullWidth:!0,sx:{margin:0,padding:0,gap:`20px`},children:(0,J.jsxs)(S,{container:!0,spacing:2,sx:{mt:2},children:[(0,J.jsx)(S,{size:12,children:(0,J.jsx)(Oe,{type:`password`,autoComplete:`new-password`,label:`New Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:r,onChange:s})}),(0,J.jsx)(S,{size:12,children:(0,J.jsx)(Oe,{type:`password`,autoComplete:`new-password`,label:`Confirm Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:a,onChange:c,error:a!==``&&r!==a,helperText:a!==``&&r!==a?`Passwords do not match`:``})})]})})}),(0,J.jsxs)(he,{children:[(0,J.jsx)(M,{onClick:()=>{t()},children:`Cancel`}),(0,J.jsx)(M,{variant:`contained`,onClick:()=>{l&&(n(r),t())},disabled:!l,children:`Change`}),(0,J.jsx)(M,{variant:`contained`,onClick:()=>{n(``),t()},children:`Reset`})]})]})},Li=330;function Ri(e){return e?e.charAt(0).toUpperCase()+e.slice(1):void 0}function zi(){let{mobile:e}=(0,U.useContext)($t),{online:t,addListener:n,removeListener:r,sendMessage:i,getUniqueId:a}=(0,U.useContext)(Y),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(0),f=(0,U.useRef)(a());return(0,U.useEffect)(()=>{let e=e=>{K&&console.log(`Settings received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Settings received refresh_required: changed=${e.response.changed} and sending /api/settings request`),i({id:f.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`?(K&&console.log(`Settings received update_required`,e.response),e.response.devVersion?s(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):s(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)):e.method===`/api/settings`&&(K&&console.log(`Settings received /api/settings:`,e.response),s(e.response.matterbridgeInformation),l(e.response.systemInformation),d(e=>e+1))};return n(e,f.current),K&&console.log(`Settings added WebSocket listener`),()=>{r(e),K&&console.log(`Settings removed WebSocket listener`)}},[n,r,i]),(0,U.useEffect)(()=>{t&&(K&&console.log(`Settings received online`),i({id:f.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[t,i]),K&&console.log(`Settings rendering...`),!t||!o||!c?(0,J.jsx)(nn,{}):(0,J.jsx)(rr,{name:`Settings`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:q&&e?`10px`:`20px`},children:[(0,J.jsx)(Bi,{matterbridgeInfo:o,systemInfo:c},`matterbridge-${u}`),(0,J.jsx)(Vi,{matterbridgeInfo:o},`matter-${u}`),(0,J.jsx)(Hi,{matterbridgeInfo:o}),(0,J.jsx)(Ui,{systemInfo:c})]})})}function Bi({matterbridgeInfo:e,systemInfo:t}){let{sendMessage:n,getUniqueId:r}=(0,U.useContext)(Y),[i,a]=(0,U.useState)(()=>e?.bridgeMode===`bridge`?`bridge`:`childbridge`),[o,s]=(0,U.useState)(()=>Ri(e?.loggerLevel)??`Info`),[c,l]=(0,U.useState)(()=>e?.fileLogger??!1),[u,d]=(0,U.useState)(()=>localStorage.getItem(G[`frontend-theme`])||`dark`),[f,p]=(0,U.useState)(localStorage.getItem(G[`home-page-plugins`])!==`false`),[m,h]=(0,U.useState)(localStorage.getItem(G[`home-page-mode`])??`devices`),[_,v]=(0,U.useState)(()=>e?.virtualMode??localStorage.getItem(G[`virtual-mode`])??`outlet`),y=(0,U.useRef)(r()),[x,S]=(0,U.useState)(!1);return!e||!t?null:(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matterbridge settings`})}),(0,J.jsx)(Ii,{open:x,onClose:()=>S(!1),onSave:e=>{K&&console.log(`handleSaveChangePassword called with password:`,e),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setpassword`,value:e}}),qt(e)}}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`matterbridgeInfo-mode`,children:`Mode:`}),(0,J.jsxs)(g,{row:!0,name:`mode-buttons-group`,value:i,onChange:e=>{K&&console.log(`handleChangeBridgeMode called with value:`,e.target.value),a(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setbridgemode`,value:e.target.value}})},children:[(0,J.jsx)(le,{value:`bridge`,control:(0,J.jsx)(mt,{}),label:`Bridge`,disabled:e.readOnly}),(0,J.jsx)(le,{value:`childbridge`,control:(0,J.jsx)(mt,{}),label:`Childbridge`,disabled:e.readOnly})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mblogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`mblogger-level-label`,id:`mblogger-level`,value:o,onChange:e=>{K&&console.log(`handleChangeMbLoggerLevel called with value:`,e.target.value),s(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmbloglevel`,value:e.target.value}})},children:[(0,J.jsx)(b,{value:`Debug`,children:`Debug`}),(0,J.jsx)(b,{value:`Info`,children:`Info`}),(0,J.jsx)(b,{value:`Notice`,children:`Notice`}),(0,J.jsx)(b,{value:`Warn`,children:`Warn`}),(0,J.jsx)(b,{value:`Error`,children:`Error`}),(0,J.jsx)(b,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mblogger-file-label`,children:`Log on file:`}),(0,J.jsx)(w,{checked:c,onChange:e=>{K&&console.log(`handleLogOnFileMbChange called with value:`,e.target.checked),l(e.target.checked),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmblogfile`,value:e.target.checked}})},id:`mblogger-file`,name:`logOnFileMb`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-theme-label`,children:`Frontend theme:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`frontend-theme-label`,id:`frontend-theme`,value:u,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeTheme called with value:`,t),d(t),localStorage.setItem(G[`frontend-theme`],t),Fi(t)},children:[(0,J.jsx)(b,{value:`classic`,children:`Classic`}),(0,J.jsx)(b,{value:`light`,children:`Light`}),(0,J.jsx)(b,{value:`dark`,children:`Dark`}),(0,J.jsx)(b,{value:`auto`,children:`Auto`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-plugin-label`,children:`Home page plugins:`}),(0,J.jsx)(w,{checked:f,onChange:e=>{let t=e.target.checked;K&&console.log(`handleChangeHomePagePlugins called with value:`,t),p(t),localStorage.setItem(G[`home-page-plugins`],t?`true`:`false`)},name:`showPlugins`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-label`,children:`Home page bottom panel:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`frontend-home-label`,id:`frontend-home`,value:m,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeHomePageMode called with value:`,t),h(t),localStorage.setItem(G[`home-page-mode`],t)},children:[(0,J.jsx)(b,{value:`logs`,children:`Logs`}),(0,J.jsx)(b,{value:`devices`,children:`Devices`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`10px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`frontend-virtual-label`,children:`Virtual devices:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`frontend-virtual-label`,id:`frontend-virtual`,value:_,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeVirtualMode called with value:`,t),v(t),localStorage.setItem(G[`virtual-mode`],t),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setvirtualmode`,value:t}})},children:[(0,J.jsx)(b,{value:`disabled`,children:`Disabled`}),(0,J.jsx)(b,{value:`outlet`,children:`Outlet`}),(0,J.jsx)(b,{value:`light`,children:`Light`}),(0,J.jsx)(b,{value:`switch`,children:`Switch`}),(0,J.jsx)(b,{value:`mounted_switch`,children:`Mounted Switch`})]})]}),(0,J.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`20px`},children:(0,J.jsx)(M,{variant:`contained`,color:`primary`,onClick:()=>S(!0),children:`Change password`})})]})]})}function Vi({matterbridgeInfo:e}){let{sendMessage:t,getUniqueId:n}=(0,U.useContext)(Y),[r,i]=(0,U.useState)(()=>Ri(e?.matterLoggerLevel)??`Info`),[a,o]=(0,U.useState)(()=>e?.matterFileLogger??!1),[s,c]=(0,U.useState)(()=>e?.matterMdnsInterface||``),[l,u]=(0,U.useState)(()=>e?.matterIpv4Address||``),[d,f]=(0,U.useState)(()=>e?.matterIpv6Address||``),[p,m]=(0,U.useState)(()=>e?.matterPort?e.matterPort.toString():``),[h,g]=(0,U.useState)(()=>e?.matterDiscriminator?e.matterDiscriminator.toString():``),[_,v]=(0,U.useState)(()=>e?.matterPasscode?e.matterPasscode.toString():``),y=(0,U.useRef)(n()),x=(0,U.useMemo)(()=>Ai(1e3),[]),S=(0,U.useMemo)(()=>Ai(1e3),[]),C=(0,U.useMemo)(()=>Ai(1e3),[]),T=(0,U.useMemo)(()=>Ai(1e3),[]),E=(0,U.useMemo)(()=>Ai(1e3),[]),D=(0,U.useMemo)(()=>Ai(1e3),[]);return(0,U.useEffect)(()=>()=>x.cancel(),[x]),(0,U.useEffect)(()=>()=>S.cancel(),[S]),(0,U.useEffect)(()=>()=>C.cancel(),[C]),(0,U.useEffect)(()=>()=>T.cancel(),[T]),(0,U.useEffect)(()=>()=>E.cancel(),[E]),(0,U.useEffect)(()=>()=>D.cancel(),[D]),e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matter settings`})}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(de,{style:{height:`30px`},labelId:`mjlogger-level-label`,id:`mjlogger-level`,value:r,onChange:e=>{K&&console.log(`handleChangeMjLoggerLevel called with value:`,e.target.value),i(e.target.value),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjloglevel`,value:e.target.value}})},children:[(0,J.jsx)(b,{value:`Debug`,children:`Debug`}),(0,J.jsx)(b,{value:`Info`,children:`Info`}),(0,J.jsx)(b,{value:`Notice`,children:`Notice`}),(0,J.jsx)(b,{value:`Warn`,children:`Warn`}),(0,J.jsx)(b,{value:`Error`,children:`Error`}),(0,J.jsx)(b,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`10px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-file-label`,children:`Log on file:`}),(0,J.jsx)(w,{checked:a,onChange:e=>{K&&console.log(`handleLogOnFileMjChange called with value:`,e.target.checked),o(e.target.checked),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjlogfile`,value:e.target.checked}})},id:`mjlogger-file`,name:`logOnFileMj`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Mdns interface:`}),(0,J.jsx)(Oe,{value:s,onChange:e=>{K&&console.log(`handleChangeMdnsInterface called with value:`,e.target.value);let n=e.target.value;c(n),x(()=>{K&&console.log(`debounced sendMessage setmdnsinterface with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmdnsinterface`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv4 address:`}),(0,J.jsx)(Oe,{value:l,onChange:e=>{K&&console.log(`handleChangeIpv4Address called with value:`,e.target.value);let n=e.target.value;u(n),S(()=>{K&&console.log(`debounced sendMessage setipv4address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv4address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv6 address:`}),(0,J.jsx)(Oe,{value:d,onChange:e=>{K&&console.log(`handleChangeIpv6Address called with value:`,e.target.value);let n=e.target.value;f(n),C(()=>{K&&console.log(`debounced sendMessage setipv6address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv6address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning port:`}),(0,J.jsx)(Oe,{value:p,onChange:e=>{K&&console.log(`handleChangeMatterPort called with value:`,e.target.value);let n=e.target.value;m(n),T(()=>{K&&console.log(`debounced sendMessage setmatterport with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterport`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning discriminator:`}),(0,J.jsx)(Oe,{value:h,onChange:e=>{K&&console.log(`handleChangeMatterDiscriminator called with value:`,e.target.value);let n=e.target.value;g(n),E(()=>{K&&console.log(`debounced sendMessage setmatterdiscriminator with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterdiscriminator`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(O,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning passcode:`}),(0,J.jsx)(Oe,{value:_,onChange:e=>{K&&console.log(`handleChangemMatterPasscode called with value:`,e.target.value);let n=e.target.value;v(n),D(()=>{K&&console.log(`debounced sendMessage setmatterpasscode with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterpasscode`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},slotProps:{input:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}}})]})]})]}):null}function Hi({matterbridgeInfo:e}){return e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`Matterbridge info`})}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(Wi,{value:e.matterbridgeVersion,label:`Current Version`}),(0,J.jsx)(Wi,{value:e.matterbridgeLatestVersion,label:`Latest Version`}),(0,J.jsx)(Wi,{value:e.rootDirectory,label:`Root Directory`}),(0,J.jsx)(Wi,{value:e.homeDirectory,label:`Home Directory`}),(0,J.jsx)(Wi,{value:e.matterbridgeDirectory,label:`Matterbridge Storage Directory`}),(0,J.jsx)(Wi,{value:e.matterbridgePluginDirectory,label:`Matterbridge Plugin Directory`}),(0,J.jsx)(Wi,{value:e.globalModulesDirectory,label:`Global Module Directory`})]})]}):null}function Ui({systemInfo:e}){if(!e)return null;let t=e.bunVersion??e.nodeVersion,n=e.bunVersion?`Bun Version`:`Node Version`;return(0,J.jsxs)(Z,{style:{flex:`1 1 ${Li}px`},children:[(0,J.jsx)(rn,{children:(0,J.jsx)(Q,{children:`System info`})}),(0,J.jsxs)(cn,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(Wi,{value:e.interfaceName,label:`Interface name`}),(0,J.jsx)(Wi,{value:e.macAddress,label:`MAC Address`}),(0,J.jsx)(Wi,{value:e.ipv4Address,label:`IPv4 Address`}),(0,J.jsx)(Wi,{value:e.ipv6Address,label:`IPv6 Address`}),(0,J.jsx)(Wi,{value:t,label:n}),(0,J.jsx)(Wi,{value:e.hostname,label:`Hostname`}),(0,J.jsx)(Wi,{value:e.user,label:`User`})]})]})}function Wi({value:e,label:t,width:n}){return(0,J.jsx)(Oe,{focused:!0,value:e,size:`small`,label:t,variant:`standard`,sx:{width:n?`${n-20}px`:`100%`,"& .MuiInput-underline:before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline:hover:not(.Mui-disabled):before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline.Mui-focused:after":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5}},slotProps:{input:{readOnly:!0,sx:{color:`var(--div-text-color)`,"&:before":{borderBottomColor:`var(--main-label-color)`},"&:after":{borderBottomColor:`var(--main-label-color)`}}},inputLabel:{sx:{marginTop:`3px`,color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}}})}var Gi=(0,U.memo)(zi);function Ki(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,U.useContext)(Y),{showSnackbarMessage:a}=(0,U.useContext)($t),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)([]),[u,d]=(0,U.useState)([]),f=(0,U.useRef)(i());return(0,U.useEffect)(()=>{K&&console.log(`Test useEffect WebSocketMessage mounting`);let e=e=>{if(e.method===`restart_required`)K&&console.log(`Test received restart_required`),a(`Restart required`,0);else if(e.method===`refresh_required`)K&&console.log(`Test received refresh_required: changed=${e.response.changed} and sending api requests`),a(`Refresh required`,0),t({id:f.current,method:`/api/settings`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/plugins`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/devices`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}});else if(e.method===`/api/settings`&&e.response)K&&console.log(`Test received /api/settings:`,e.response),a(`Test received /api/settings`,0),s(e.response);else if(e.method===`/api/plugins`&&e.response)K&&console.log(`Test received ${e.response.length} plugins:`,e.response),a(`Test received /api/plugins`,0),l(e.response);else if(e.method===`/api/devices`&&e.response){K&&console.log(`Test received ${e.response.length} devices:`,e.response),a(`Test received /api/devices`,0),d(e.response);for(let n of e.response)K&&console.log(`Test sending /api/clusters for device:`,n.plugin,n.deviceName,n.number),t({id:f.current,method:`/api/clusters`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{pluginName:n.plugin,number:n.number||0,serialNumber:n.serialNumber,uniqueId:n.uniqueId}})}};return n(e,f.current),K&&console.log(`Test useEffect WebSocketMessage mounted`),()=>{K&&console.log(`Test useEffect WebSocketMessage unmounting`),r(e),K&&console.log(`Test useEffect WebSocketMessage unmounted`)}},[n,r,t,a]),(0,U.useEffect)(()=>(K&&console.log(`Test useEffect online mounting`),e&&(K&&console.log(`Test useEffect online received online`),t({id:f.current,method:`/api/settings`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/plugins`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:f.current,method:`/api/devices`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{extended:!1}})),K&&console.log(`Test useEffect online mounted`),()=>{K&&console.log(`Test useEffect online unmounted`)}),[e,t]),K&&console.log(`Test rendering...`),e?(0,J.jsx)(rr,{name:`Test`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,alignContent:`center`,gap:`20px`,height:`100vh`,width:`100vw`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`256px`,width:`256px`,margin:`10px`}}),(0,J.jsx)(`p`,{children:`Welcome to the Test page of the Matterbridge frontend`})]})}):(0,J.jsx)(nn,{})}var qi=(0,U.memo)(Ki);function Ji({open:e,title:t,message:n,onConfirm:r,onCancel:i}){return(0,J.jsxs)(R,{open:e,children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:t})]})}),(0,J.jsxs)(E,{children:[(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:`0`,marginBottom:`20px`,maxHeight:`350px`,maxWidth:`350px`},children:(0,J.jsx)(`p`,{style:{flex:1,margin:`0`},children:n})}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-around`},children:[(0,J.jsx)(M,{onClick:e=>{K&&console.log(`Confirmed`),e.preventDefault(),r()},variant:`contained`,color:`primary`,size:`small`,children:`Confirm`}),(0,J.jsx)(M,{onClick:e=>{K&&console.log(`Canceled`),e.preventDefault(),i()},variant:`contained`,color:`primary`,size:`small`,children:`Cancel`})]})]})]})}var Yi=({open:e,output:t,title:n,_command:r,_packageName:i,onInstall:a,onClose:o})=>{let{installAutoExit:s,mobile:c,setInstallAutoExit:l}=(0,U.useContext)($t),u=(0,U.useRef)(null),d=e=>{l(e.target.checked),localStorage.setItem(G[`install-auto-exit`],e.target.checked?`true`:`false`),K&&console.log(`handleInstallAutoExitChange called with value:`,e.target.checked)};return(0,U.useEffect)(()=>{K&&console.log(`InstallProgressDialog output effect mounted, scrolling to bottom:`,u.current),setTimeout(()=>{K&&console.log(`Scrolling to bottom:`,u.current),u.current?.scrollIntoView({behavior:`smooth`,block:`end`})},0)},[t]),(0,J.jsxs)(R,{open:e,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&o()},slotProps:{paper:{sx:{width:q&&c?`100vw`:`75vw`,maxWidth:q&&c?`100vw`:`75vw`,height:q&&c?`100vh`:`75vw`,maxHeight:q&&c?`100vh`:`75vh`,margin:q&&c?`0px`:void 0,overflow:`hidden`}}},children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:n})]})}),(0,J.jsxs)(E,{dividers:!0,style:{overflow:`hidden`,display:`flex`,flexDirection:`column`,height:400,paddingBottom:0},children:[(0,J.jsx)(`div`,{style:{display:`block`,marginBottom:`10px`,fontSize:`16px`,fontWeight:`bold`,color:`var(--primary-color)`},children:`Process log`}),(0,J.jsxs)(`ul`,{style:{width:`100%`,height:`100%`,fontFamily:`monospace`,fontSize:`14px`,padding:`10px`,margin:0,marginBottom:`10px`,color:`var(--div-text-color)`,background:`var(--div-bg-color)`,overflow:`auto`,listStyle:`none`,boxSizing:`border-box`,borderRadius:4,border:`4px solid var(--primary-color)`,whiteSpace:`pre-wrap`,display:`block`},children:[t.split(`
|
|
43
|
+
`).map((e,t)=>(0,J.jsx)(`li`,{style:{padding:0,margin:0,wordBreak:`break-all`},children:e},t)),(0,J.jsx)(`li`,{ref:u,style:{padding:0,margin:0}})]})]}),(0,J.jsxs)(he,{sx:{justifyContent:`space-evenly`},children:[a&&(0,J.jsx)(M,{variant:`contained`,onClick:a,children:`Install`}),(0,J.jsx)(M,{onClick:o,children:`Close`}),(0,J.jsx)(le,{control:(0,J.jsx)(w,{checked:s,onChange:e=>d(e)}),label:`Close on success`,style:{color:`var(--div-text-color)`}})]})]})},Xi=[];function Zi({children:e}){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(null),{enqueueSnackbar:a,closeSnackbar:o}=bt(),s=(0,U.useCallback)(e=>{K&&console.log(`UiProvider closeSnackbarMessage: message ${e}`);let t=Xi.findIndex(t=>t.message===e);t!==-1&&(o(Xi[t].key),Xi.splice(t,1),K&&console.log(`UiProvider closeSnackbarMessage: message ${e} removed from persistMessages`))},[o]),c=(0,U.useCallback)((e,t,n)=>{K&&console.log(`UiProvider showSnackbarMessage: message ${e} timeout ${t}`);let r=a(e,{variant:`default`,autoHideDuration:t==null||t>0?(t??5)*1e3:null,persist:t===0,content:t=>(0,J.jsx)(V,{sx:{margin:`0`,padding:`0`,width:`300px`,marginRight:`30px`},children:(0,J.jsx)(be,{severity:n??`info`,variant:`filled`,sx:{color:`#fff`,fontWeight:`normal`,width:`100%`,cursor:`pointer`,padding:`0px 10px`},onClick:()=>o(t),action:(0,J.jsx)(z,{size:`small`,onClick:()=>o(t),sx:{color:`#fff`},children:(0,J.jsx)(st,{fontSize:`small`})}),children:e},t)},t)});t===0&&(K&&console.log(`UiProvider showSnackbarMessage: message ${e} timeout ${t} - persist key ${r}`),Xi.push({message:e,key:r}))},[a,o]),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(``),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=()=>{K&&console.log(`UiProvider handle confirm action ${h}`),u(!1),_.current&&_.current(h)},b=()=>{K&&console.log(`UiProvider handle cancel action ${h}`),u(!1),v.current&&v.current(h)},x=(0,U.useCallback)((e,t,n,r,i)=>{K&&console.log(`UiProvider showConfirmCancelDialog for command ${n}`),f(e),m(t),g(n),_.current=r,v.current=i,u(!0)},[]),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[A,j]=(0,U.useState)(``),[M,ee]=(0,U.useState)(localStorage.getItem(G[`install-auto-exit`])!==`false`),N=(0,U.useCallback)((e,t,n)=>{K&&console.log(`UiProvider show install progress for package ${e}`),T(e),D(t),k(n),C(!0)},[]),te=(0,U.useCallback)(e=>{K&&console.log(`UiProvider addInstallProgress: output ${e}`),j(t=>t+e+`
|
|
44
|
+
`)},[]),P=(0,U.useCallback)(()=>{K&&console.log(`UiProvider exitInstallProgressSuccess: package ${O}`),localStorage.getItem(G[`install-auto-exit`])!==`false`&&C(!1)},[O]),ne=(0,U.useCallback)(()=>{K&&console.log(`UiProvider exitInstallProgressError: package ${O}`)},[O]),F=(0,U.useCallback)(()=>{K&&console.log(`UiProvider hide install progress`),C(!1)},[]),re=()=>{K&&console.log(`UiProvider handle install close action`),C(!1),k(``),j(``)},I=(0,U.useMemo)(()=>({mobile:t,setMobile:n,currentPage:r,setCurrentPage:i,showSnackbarMessage:c,closeSnackbarMessage:s,closeSnackbar:o,showConfirmCancelDialog:x,showInstallProgress:N,exitInstallProgressSuccess:P,exitInstallProgressError:ne,hideInstallProgress:F,addInstallProgress:te,installAutoExit:M,setInstallAutoExit:ee}),[t,r,n,i,c,s,o,x,N,P,ne,F,te,M,ee]);return(0,J.jsxs)($t.Provider,{value:I,children:[(0,J.jsx)(Ji,{open:l,title:d,message:p,onConfirm:y,onCancel:b}),(0,J.jsx)(Yi,{open:S,title:w,_command:E,_packageName:O,output:A,onClose:re}),e]})}function Qi(e,t){K&&console.log(`getCssVariable:`,e,`defaultValue`,t);let n=getComputedStyle(document.body).getPropertyValue(e).trim();return n||console.error(`getCssVariable: undefined`,n),n||t}function $i(e){return u({palette:{primary:{main:e},action:{disabled:`var(--main-label-color)`},text:{disabled:`var(--main-label-color)`}},typography:{fontFamily:`Roboto, Helvetica, Arial, sans-serif`},components:{MuiDialog:{styleOverrides:{paper:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,border:`2px solid var(--div-border-color)`,borderRadius:`var(--div-border-radius)`,boxShadow:`2px 2px 5px var(--div-shadow-color)`}}},MuiTooltip:{defaultProps:{placement:`top-start`,arrow:!0}},MuiButton:{styleOverrides:{root:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,"&:hover":{backgroundColor:`var(--main-button-bg-color)`},"&.Mui-disabled":{color:`var(--main-button-color)`,backgroundColor:`var(--main-grey-color)`}},contained:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},outlined:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},text:{color:`var(--main-button-color)`}},defaultProps:{variant:`contained`,size:`small`}},MuiIconButton:{styleOverrides:{root:{color:`var(--main-icon-color)`,"&:hover .MuiSvgIcon-root":{color:`var(--primary-color)`}}}},MuiCheckbox:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-checked":{color:`var(--primary-color)`}}}},MuiTextField:{defaultProps:{size:`small`,variant:`outlined`,fullWidth:!0}},MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:`var(--div-bg-color)`,"& .MuiOutlinedInput-notchedOutline":{borderColor:`var(--main-label-color)`},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:`var(--main-text-color)`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`var(--primary-color)`},padding:`0px`},input:{color:`var(--div-text-color)`,padding:`4px 8px`}}},MuiInputLabel:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--primary-color)`}}}},MuiFormLabel:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}},MuiFormControl:{styleOverrides:{root:{color:`var(--main-grey-color)`}}},MuiRadio:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-checked":{color:`var(--primary-color)`}}}},MuiSelect:{styleOverrides:{root:{backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`,height:`30px`,"&:hover":{borderColor:`var(--main-text-color)`},"&.Mui-focused":{borderColor:`var(--primary-color)`}},icon:{color:`var(--main-label-color)`}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:`var(--main-menu-bg-color)`,padding:`0px`,margin:`0px`},list:{padding:`0px`}}},MuiMenuItem:{styleOverrides:{root:{color:`var(--main-menu-color)`,backgroundColor:`var(--main-menu-bg-color)`,"&:hover":{backgroundColor:`var(--main-menu-hover-color)`},"&.Mui-selected":{color:`var(--main-menu-color)`,backgroundColor:`var(--main-menu-bg-color)`},"&.Mui-selected:hover":{backgroundColor:`var(--main-menu-hover-color)`}}}},MuiListItemButton:{styleOverrides:{root:{cursor:`pointer`,"&:hover":{backgroundColor:`var(--main-bg-color)`}}}},MuiListItemIcon:{styleOverrides:{root:{color:`var(--div-text-color)`}}},MuiListItemText:{styleOverrides:{primary:{fontSize:`16px`,fontWeight:`bold`,color:`var(--div-text-color)`},secondary:{fontSize:`14px`,fontWeight:`normal`,color:`var(--div-text-color)`}}}}})}function ea({setLoggedIn:e}){let[t,n]=(0,U.useState)(``),[r,i]=(0,U.useState)(``),a={display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,backgroundColor:`var(--main-bg-color)`},o={display:`flex`,flexDirection:`column`,maxWidth:`400px`,margin:`0 auto`,padding:`20px`,gap:`20px`,border:`1px solid var(--div-border-color)`,borderRadius:`var(--div-border-radius)`,boxShadow:`2px 2px 5px var(--div-shadow-color)`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`},s={margin:`10px 0`,padding:`3px 3px`,fontSize:`14px`,width:`230px`,border:`1px solid var(--main-label-color)`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`},c=(0,U.useCallback)(async(t,n)=>{try{let r=await fetch(`./api/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t}),signal:n});if(r.ok){let{valid:a}=await r.json();if(n?.aborted)return;a?(e(!0),t!==``&&qt(t)):t!==``&&i(`Incorrect password!`)}else console.error(`Failed to log in:`,r.statusText)}catch(e){if(n?.aborted)return;console.error(`Failed to log in:`,e)}},[e]);return(0,U.useEffect)(()=>{let e=new AbortController;return c(``,e.signal),()=>{e.abort()}},[c]),(0,J.jsx)(`div`,{style:a,children:(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),c(t)},style:o,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h3`,{style:{color:`var(--div-text-color)`},children:`Welcome to Matterbridge`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-between`,gap:`20px`},children:[(0,J.jsx)(`input`,{type:`text`,name:`username`,autoComplete:`username`,style:{display:`none`},tabIndex:-1}),(0,J.jsx)(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),style:s,placeholder:`password`,autoComplete:`current-password`}),(0,J.jsx)(`button`,{type:`submit`,style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,borderColor:`var(--div-bg-color)`},children:`Log in`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:0,height:`30px`},children:r&&(0,J.jsx)(`p`,{style:{color:`red`},children:r})})]})})}function ta(){let[e,t]=(0,U.useState)(!1),r=localStorage.getItem(G[`frontend-theme`])||`dark`,o=Fi(r);K&&console.log(`Setting frontend theme "%s" (%s)`,r,o);let s=Qi(`--primary-color`,`#1976d2`);K&&console.log(`Primary color from CSS "%s"`,s);let l=$i(s),u=window.location.href,d=window.location.pathname;(d.endsWith(`/devices`)||d.endsWith(`/log`)||d.endsWith(`/settings`)||d.endsWith(`/test`))&&(d=d.substring(0,d.lastIndexOf(`/`)));let f=d.endsWith(`/`)?d:d+`/`;Zt(f);let p=d.includes(`/api/hassio_ingress/`);return Yt(p),K&&(console.log(`Loading App...`),console.log(`- href = "${u}"`),console.log(`- pathname = "${window.location.pathname}" >>> "${d}"`),console.log(`- baseName = "${f}"`),console.log(`- isIngress = "${p}"`)),e?(0,J.jsx)(se,{theme:l,children:(0,J.jsx)(xt,{dense:!0,maxSnack:10,preventDuplicate:!0,anchorOrigin:{vertical:`bottom`,horizontal:`right`},children:(0,J.jsx)(Zi,{children:(0,J.jsx)(tn,{children:(0,J.jsx)(a,{basename:f,children:(0,J.jsx)(ki,{children:(0,J.jsxs)(c,{children:[(0,J.jsx)(i,{path:`/`,element:(0,J.jsx)(yi,{})}),(0,J.jsx)(i,{path:`/devices`,element:(0,J.jsx)(ar,{})}),(0,J.jsx)(i,{path:`/log`,element:(0,J.jsx)(xi,{})}),(0,J.jsx)(i,{path:`/settings`,element:(0,J.jsx)(Gi,{})}),(0,J.jsx)(i,{path:`/test`,element:(0,J.jsx)(qi,{})}),(0,J.jsx)(i,{path:`*`,element:(0,J.jsx)(n,{to:`/`})})]})})})})})})}):(0,J.jsx)(ea,{setLoggedIn:t})}var na=document.getElementById(`root`);if(na===null)throw Error(`Root element not found`);Bt.createRoot(na).render((0,J.jsx)(U.StrictMode,{children:(0,J.jsx)(ta,{})}));
|