@matterbridge/frontend 3.11.2-dev-20261030-d621b1f → 3.11.2-dev-20261102-e93031b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
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=`
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[1]:e===1e4?En[0]:En[2]}function kn(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>1e4?`N/A`:`${t/100}%`}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};
package/build/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>Matterbridge</title>
7
7
  <link rel="icon" type="image/svg+xml" href="./matterbridge.svg" />
8
8
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet" />
9
- <script type="module" crossorigin src="./assets/index-Cera0zb7.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-DsE7hA3e.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-BWaJ3C7D.js">
11
11
  <link rel="modulepreload" crossorigin href="./assets/vendor_emotion-DDpeU9YY.js">
12
12
  <link rel="modulepreload" crossorigin href="./assets/vendor_mui-Bwi6U1rq.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/frontend",
3
- "version": "3.11.2-dev-20261030-d621b1f",
3
+ "version": "3.11.2-dev-20261102-e93031b",
4
4
  "description": "Matterbridge frontend application",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",