@matterbridge/frontend 3.5.0 → 3.5.1-dev-20260627-53ee5fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/index.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/build/assets/index.js
CHANGED
|
@@ -39,6 +39,6 @@ import{a as e}from"./rolldown-runtime.js";import{c as t}from"./vendor_emotion.js
|
|
|
39
39
|
::-webkit-scrollbar-track {
|
|
40
40
|
background: ${i};
|
|
41
41
|
}
|
|
42
|
-
`,t.head.appendChild(a)},[ce,le]=(0,W.useState)(),[ue,de]=(0,W.useState)(!1),fe=e=>{K&&console.log(`handleConfigPlugin plugin:`,e.name),r({id:l.current,sender:`HomePlugins`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),r({id:l.current,sender:`HomePlugins`,method:`/api/select/entities`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),le(e),pe()},pe=()=>{de(!0)};return K&&console.log(`HomePlugins rendering...`),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Z,{children:[ce&&(0,J.jsx)(Sr,{open:ue,onClose:()=>{de(!1)},plugin:ce}),(0,J.jsx)(wn,{name:`Plugins`,columns:w,rows:h,footerRight:``,footerLeft:``})]}),(0,J.jsxs)(M,{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)(x,{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:oe,style:{display:`block`,flex:`1 1 auto`,width:`100%`,height:`100%`,border:`none`,backgroundColor:`var(--div-bg-color)`}})}),(0,J.jsx)(D,{sx:{flex:`0 0 auto`,justifyContent:`center`},children:(0,J.jsx)(U,{onClick:()=>b(null),children:`Close`})})]})]}):(0,J.jsx)(qt,{})}var Tr=(0,W.memo)(wr);function Er({version:e,changelog:t}){let{online:n}=(0,W.useContext)(Y);return K&&console.log(`HomeShowChangelog rendering...`),n?(0,J.jsxs)(Z,{children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matterbridge Update`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,J.jsxs)(`h4`,{style:{margin:0},children:[`Matterbridge has been updated to version `,e,`.`]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(U,{onClick:()=>window.open(`https://github.com/Luligu/matterbridge`,`_blank`),endIcon:(0,J.jsx)(Ze,{style:{color:`#FFD700`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Star`}),(0,J.jsx)(U,{onClick:()=>window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`),endIcon:(0,J.jsx)(at,{style:{color:`#b6409c`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Sponsor`}),(0,J.jsx)(U,{onClick:()=>window.open(t,`_blank`),endIcon:(0,J.jsx)(v,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Changelog`}),(0,J.jsx)(U,{onClick:()=>window.location.reload(),endIcon:(0,J.jsx)(we,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Close`})]})]})]}):(0,J.jsx)(qt,{})}var Dr=(0,W.memo)(Er);function Or({value:e,maxChars:t}){let n=e;if(e.length>t&&t>3){let r=t-3;n=`${e.substring(0,Math.ceil(r/2))} … ${e.substring(e.length-Math.floor(r/2),e.length)}`}return e===n?(0,J.jsx)(`span`,{children:n}):(0,J.jsx)(z,{title:e,placement:`top`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[0,12]}}]}},children:(0,J.jsx)(`span`,{children:n})})}function kr({matterbridgeInfo:e}){let{mobile:t}=(0,W.useContext)(Wt);K&&console.log(`MatterbridgeInfoTable:`,e);let n=new Set([`matterbridgeLatestVersion`,`matterbridgeDevVersion`,`dockerDev`,`dockerLatestVersion`,`dockerDevVersion`,`--matterFileLogger`,`--fileLogger`,`--matterLoggerLevel`,`--loggerLevel`,`--virtualMode`,`--bridgeMode`,`--restartMode`,`--restartRequired`,`fixedRestartRequired`,`--updateRequired`,`matterMdnsInterface`,`matterIpv4Address`,`matterIpv6Address`,`readOnly`,`shellyBoard`,`shellySysUpdate`,`shellyMainUpdate`,`matterPort`,`matterDiscriminator`,`matterPasscode`]),[r,i]=(0,W.useState)(!1);return!e||r?null:(K&&console.log(`MatterbridgeInfoTable rendering...`),(0,J.jsxs)(Z,{style:q&&t?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`Matterbridge info`}),(0,J.jsx)($t,{close:()=>i(!0)})]}),(0,J.jsx)(Qt,{style:q&&t?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(e).filter(([e,t])=>!n.has(e)&&t!=null&&t!==``).map(([e,n],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e.replace(`matterbridgeVersion`,`Matterbridge version`).replace(`frontendVersion`,`Frontend version`).replace(`dockerVersion`,`Docker version`).replace(`homeDirectory`,`Home`).replace(`rootDirectory`,`Root`).replace(`matterbridgeDirectory`,`Storage`).replace(`matterbridgeCertDirectory`,`Cert`).replace(`matterbridgePluginDirectory`,`Plugins`).replace(`globalModulesDirectory`,`Modules`).replace(`bridgeMode`,`Bridge mode`).replace(`restartMode`,`Restart mode`).replace(`virtualMode`,`Virtual mode`).replace(`profile`,`Profile`).replace(`loggerLevel`,`Logger level`).replace(`fileLogger`,`File logger`).replace(`loggerLevel`,`Logger level`).replace(`fileLogger`,`File logger`).replace(`matterLoggerLevel`,`Matter logger level`).replace(`matterFileLogger`,`Matter file logger`).replace(`restartRequired`,`Restart required`).replace(`updateRequired`,`Update required`)}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&t?typeof n==`string`?n:n.toString():(0,J.jsx)(Or,{value:typeof n==`string`?n:n.toString(),maxChars:24})})]},e))})]})})]}))}var Ar=(0,W.memo)(kr),jr={margin:`0px`,padding:`0px`,color:`var(--div-text-color)`,transition:`color 0.2s ease`,"& svg":{display:`block`},"& svg path":{fill:`var(--div-text-color)`,transition:`fill 0.2s ease`},"&:hover":{color:`var(--primary-color)`},"&:hover svg path":{fill:`var(--primary-color)`},"&:focus-visible":{outline:`2px solid var(--primary-color)`,outlineOffset:`2px`}},Mr=e=>{if(!e)return``;let t=e.replace(/[^0-9]/g,``);return t.length<5?t:[t.slice(0,4),t.slice(4,7),t.slice(7,11)].filter(Boolean).join(`-`)};function Nr({id:e}){let{online:t,sendMessage:n,addListener:r,removeListener:i,getUniqueId:a}=(0,W.useContext)(Y),[o,s]=(0,W.useState)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(a()),{mobile:d,showConfirmCancelDialog:f}=(0,W.useContext)(Wt);K&&console.log(`QRDiv loading with id = "${e}" storeId = "${c.current}" timeout = ${l.current?`set`:`none`} and matter:`,o),(0,W.useEffect)(()=>{K&&console.log(`QRDiv id effect "${e}"`),c.current=e,l.current&&clearTimeout(l.current),l.current=null,e?(K&&console.log(`QRDiv id effect sending data request for storeId "${e}"`),n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:e,server:!0}})):(K&&console.log(`QRDiv id effect setting matter to null`),s(null))},[e,n]),(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`QRDiv received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`matter`&&e.response.matter&&(K&&console.log(`QRDiv received refresh_required: changed=${e.response.changed} for storeId "${e.response.matter.id}":`,e.response.matter),c.current===e.response.matter.id&&(K&&console.log(`QRDiv received refresh_required/matter: setting matter data for storeId "${e.response.matter.id}":`,e.response.matter),l.current&&clearTimeout(l.current),s(e.response.matter)))};return r(e,u.current),K&&console.log(`QRDiv webSocket effect mounted`),()=>{i(e),l.current&&clearTimeout(l.current),l.current=null,K&&console.log(`QRDiv webSocket effect unmounted`)}},[r,i]);let p=()=>{K&&console.log(`QRDiv sent matter startCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,startCommission:!0}})},m=()=>{K&&console.log(`QRDiv sent matter stopCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,stopCommission:!0}})},h=()=>{K&&console.log(`QRDiv sent matter advertise for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,advertise:!0}})},g=e=>{K&&console.log(`QRDiv sent matter removeFabric for node "${o?.id}" and fabricIndex ${e}`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,removeFabric:e}})};return!o||!t?(K&&console.log(`QRDiv rendering undefined state`),null):o.online?o.advertising&&o.qrPairingCode&&o.manualPairingCode?(K&&console.log(`QRDiv rendering advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`QR pairing code`}),(0,J.jsxs)($t,{children:[(0,J.jsx)(T,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:ft,size:`22px`})})}),(0,J.jsx)(T,{"aria-label":`stop pairing`,size:`small`,onClick:m,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Turn off pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:_t,size:`22px`})})})]})]}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(At,{value:o.qrPairingCode,size:256,level:`M`,fgColor:`var(--div-text-color)`,bgColor:`var(--div-bg-color)`,style:{margin:`20px`}}),(0,J.jsxs)(Yt,{style:{justifyContent:`space-between`},children:[(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,color:`var(--div-text-color)`},children:[`Manual pairing code: `,Mr(o.manualPairingCode)]}),(0,J.jsx)($t,{children:(0,J.jsx)(z,{title:`Copy manual pairing code`,arrow:!0,children:(0,J.jsx)(T,{"aria-label":`copy manual pairing code`,size:`small`,onClick:async()=>{if(!o||!o.manualPairingCode)return;let e=o.manualPairingCode;try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}K&&console.log(`Manual pairing code copied to clipboard`)}catch(e){console.error(`Failed to copy manual pairing code`,e)}},sx:jr,children:(0,J.jsx)(X.Icon,{path:ht,size:.85})})})})]})]})):o.commissioned&&o.fabricInformations&&o.sessionInformations?(K&&console.log(`QRDiv rendering commissioned state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`,overflow:`hidden`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`Paired fabrics`}),(0,J.jsxs)($t,{children:[(0,J.jsx)(T,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:ft,size:`22px`})})}),(0,J.jsx)(T,{"aria-label":`start pairing`,size:`small`,onClick:p,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Turn on pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:vt,size:`22px`})})})]})]}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(Qt,{style:{flexDirection:`column`,justifyContent:`flex-start`,flex:`1 1 auto`,overflow:`auto`,padding:`0px 0px 10px 0px`,gap:`0px`},children:o.fabricInformations.map((e,t)=>(0,J.jsxs)(`div`,{style:{margin:`0px`,padding:`10px`,gap:`0px`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,textAlign:`left`,fontSize:`14px`},children:[(0,J.jsxs)(`div`,{style:{marginLeft:`20px`,marginBottom:`10px`,display:`flex`,flexDirection:`row`,justifyContent:`space-between`,gap:`20px`,alignItems:`center`},children:[(0,J.jsxs)(`p`,{className:`status-blue`,style:{margin:`0px`,padding:`3px 10px`,width:`200px`,fontSize:`14px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},children:[`Fabric: `,e.fabricIndex]}),(0,J.jsx)(z,{title:`Remove the fabric. You will also need to remove it from the controller.`,arrow:!0,children:(0,J.jsx)(T,{"aria-label":`remove the fabric`,size:`small`,onClick:()=>f(`Remove fabric`,`Are you sure you want to remove this fabric? You will also need to remove it from the controller.`,`RemoveFabric`,()=>g(e.fabricIndex),()=>{}),sx:{...jr,padding:`2px`},children:(0,J.jsx)(X.Icon,{path:dt,size:1})})})]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Vendor: `,e.rootVendorId,` `,e.rootVendorName]}),e.label!==``&&(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Label: `,e.label]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Sessions: `,o.sessionInformations?o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive).length:`0`,` `,`subscriptions: `,o.sessionInformations?o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive&&t.numberOfActiveSubscriptions>0).length:`0`]})]},t))}),(0,J.jsx)(Yt,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):!o.commissioned&&!o.advertising?(K&&console.log(`QRDiv rendering not commissioned and not advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`QR pairing code`})}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(U,{onClick:p,endIcon:(0,J.jsx)(X.Icon,{path:vt,size:1}),style:{margin:`20px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`,minWidth:`90px`},children:`Turn on pairing`}),(0,J.jsx)(Yt,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):(K&&console.log(`QRDiv rendering unknown state`),null):(K&&console.log(`QRDiv rendering offline state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(Jt,{style:{height:`30px`,justifyContent:`space-between`},children:(0,J.jsx)(Q,{children:`Server node`})}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(Zt,{style:{fontWeight:`bold`},children:`Server offline`}),(0,J.jsx)(Yt,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]}))}var Pr=(0,W.memo)(Nr);function Fr({systemInfo:e,compact:t}){let{mobile:n}=(0,W.useContext)(Wt),{addListener:r,removeListener:i,getUniqueId:a,sendMessage:o}=(0,W.useContext)(Y),[s,c]=(0,W.useState)(e),l=(0,W.useRef)(a());if(K&&console.log(`SystemInfoTable loading with systemInfo:`,s,`compact:`,t),e&&t&&s.totalMemory&&s.freeMemory){let e=s.totalMemory;s.freeMemory=`${s.freeMemory} / ${e}`,s.totalMemory=``}if(e&&t&&s.heapTotal&&s.heapUsed){let e=s.heapTotal;s.heapUsed=`${s.heapUsed} / ${e}`,s.heapTotal=``}e&&t&&s.osRelease&&s.osType&&(s.osType=`${s.osType} (${s.osRelease})`,s.osRelease=``),e&&t&&s.osArch&&s.osPlatform&&(s.osPlatform=`${s.osPlatform} (${s.osArch})`,s.osArch=``);let u=(e,t,n,r,i)=>{c(a=>({...a,totalMemory:e,freeMemory:t,heapTotal:n,heapUsed:r,rss:i}))},d=e=>{c(t=>({...t,cpuUsage:e.toFixed(2)+` %`}))},f=e=>{c(t=>({...t,processCpuUsage:e.toFixed(2)+` %`}))},p=(e,t)=>{c(n=>({...n,systemUptime:e,processUptime:t}))},m=()=>{K&&console.log(`SystemInfoTable handleViewHistory clicked`),o({id:l.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}})};(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`SystemInfoTable received WebSocket Message:`,e),e.method===`memory_update`&&e.response&&e.response.totalMemory&&e.response.freeMemory&&e.response.heapTotal&&e.response.heapUsed&&e.response.rss?(K&&console.log(`SystemInfoTable received memory_update`,e),u(e.response.totalMemory,e.response.freeMemory,e.response.heapTotal,e.response.heapUsed,e.response.rss)):e.method===`cpu_update`&&e.response&&e.response.cpuUsage?(K&&console.log(`SystemInfoTable received cpu_update`,e),d(e.response.cpuUsage),f(e.response.processCpuUsage)):e.method===`uptime_update`&&e.response&&e.response.systemUptime&&e.response.processUptime?(K&&console.log(`SystemInfoTable received uptime_update`,e),p(e.response.systemUptime,e.response.processUptime)):e.method===`/api/viewhistorypage`&&e.id===l.current&&e.success&&(K&&console.log(`SystemInfoTable received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`))};return r(e,l.current),K&&console.log(`SystemInfoTable added WebSocket listener id ${l.current}`),()=>{i(e),K&&console.log(`SystemInfoTable removed WebSocket listener`)}},[r,i]);let[h,g]=(0,W.useState)(!1);return!s||h?null:(K&&console.log(`SystemInfoTable rendering...`),(0,J.jsxs)(Z,{style:q&&n?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`System info`}),(0,J.jsx)($t,{close:()=>g(!0),children:(0,J.jsx)(T,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:m,children:(0,J.jsx)(z,{title:`Open the cpu and memory usage page`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:pt,size:`22px`})})})})]}),(0,J.jsx)(Qt,{style:q&&n?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(s).filter(([e,t])=>e!==`bunVersion`&&t!==void 0&&t!==``).map(([e,t],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e.replace(`interfaceName`,`Interface name`).replace(`macAddress`,`Mac address`).replace(`ipv4Address`,`IPv4 address`).replace(`ipv6Address`,`IPv6 address`).replace(`nodeVersion`,`Node version`).replace(`bunVersion`,`Bun version`).replace(`hostname`,`Hostname`).replace(`user`,`User`).replace(`osType`,`Os`).replace(`osPlatform`,`Platform`).replace(`freeMemory`,`Memory`).replace(`systemUptime`,`System uptime`).replace(`processUptime`,`Process uptime`).replace(`cpuUsage`,`Host CPU`).replace(`processCpuUsage`,`Process CPU`).replace(`rss`,`Rss`).replace(`heapUsed`,`Heap`)}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&n?typeof t==`string`?t:t.toString():(0,J.jsx)(Or,{value:typeof t==`string`?t:t.toString(),maxChars:22})})]},e))})]})})]}))}var Ir=(0,W.memo)(Fr);function Lr(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)([]),[o]=(0,W.useState)(localStorage.getItem(G.homePagePlugins)!==`false`),[s,c]=(0,W.useState)(localStorage.getItem(G.homePageMode)??`devices`),[l,u]=(0,W.useState)(`https://matterbridge.io/CHANGELOG.html`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(null),{mobile:_}=(0,W.useContext)(Wt),{addListener:v,removeListener:y,online:b,sendMessage:x,getUniqueId:S}=(0,W.useContext)(Y),C=(0,W.useRef)(S());return(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`Home received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Home received refresh_required: changed=${e.response.changed} and sending /api/settings request`),g(null),a([]),x({id:C.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),x({id:C.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`&&(K&&console.log(`Home received update_required`,e.response),e.response.devVersion?r(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):r(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)),e.method===`/api/settings`&&e.id===C.current?(K&&console.log(`Home received settings:`,e.response),t(e.response.systemInformation),r(e.response.matterbridgeInformation),localStorage.getItem(G.frontendVersion)===null&&e.response.matterbridgeInformation.frontendVersion?localStorage.setItem(G.frontendVersion,e.response.matterbridgeInformation.frontendVersion):e.response.matterbridgeInformation.frontendVersion!==localStorage.getItem(G.frontendVersion)&&e.response.matterbridgeInformation.frontendVersion&&(localStorage.setItem(G.frontendVersion,e.response.matterbridgeInformation.frontendVersion),m(!0)),localStorage.getItem(G.matterbridgeVersion)===null?localStorage.setItem(G.matterbridgeVersion,e.response.matterbridgeInformation.matterbridgeVersion):e.response.matterbridgeInformation.matterbridgeVersion!==localStorage.getItem(G.matterbridgeVersion)&&(localStorage.setItem(G.matterbridgeVersion,e.response.matterbridgeInformation.matterbridgeVersion),f(!0)),e.response.matterbridgeInformation.shellyBoard&&(localStorage.getItem(G.homePageMode)||(localStorage.setItem(G.homePageMode,`devices`),c(`devices`)))):e.method===`/api/plugins`&&e.id===C.current&&(K&&console.log(`Home received plugins:`,e.response),a(e.response))};return v(e,C.current),K&&console.log(`Home added WebSocket listener id ${C.current}`),()=>{y(e),K&&console.log(`Home removed WebSocket listener`)}},[v,y,x]),(0,W.useEffect)(()=>{if(K&&console.log(`Home storeId effect with storeId ${h}`),n?.bridgeMode===`bridge`&&!h&&(K&&console.log(`Home storeId effect set storeId to Matterbridge`),g(`Matterbridge`)),n?.bridgeMode===`childbridge`&&!h&&i){for(let e of i)if(e.matter?.id){K&&console.log(`Home storeId effect set storeId to ${e.matter.id}`),g(e.matter.id);break}}},[n,i,h]),(0,W.useEffect)(()=>{b&&(K&&console.log(`Home online effect, sending /api/settings and /api/plugins requests`),x({id:C.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),x({id:C.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[b,x]),K&&console.log(`Home rendering...`),!b||!e||!n?(0,J.jsx)(qt,{}):(0,J.jsxs)(jn,{name:`Home`,style:q&&_?{alignItems:`center`,gap:`10px`}:{flexDirection:`row`},children:[(q&&!_||!q)&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`302px`,minWidth:`302px`,gap:`20px`},children:[(0,J.jsx)(Pr,{id:h}),(0,J.jsx)(Ir,{systemInfo:e,compact:!0})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`,gap:q&&_?`10px`:`20px`},children:[p&&(0,J.jsx)(Fn,{version:n.frontendVersion}),d&&(0,J.jsx)(Dr,{version:n.matterbridgeVersion,changelog:l}),q&&_&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(Pr,{id:h}),(0,J.jsx)(Ir,{systemInfo:e,compact:!0}),(0,J.jsx)(Ar,{matterbridgeInfo:n})]}),o&&!n.readOnly&&(0,J.jsx)(Qn,{}),o&&(0,J.jsx)(Tr,{storeId:h,setStoreId:g}),s===`devices`&&(0,J.jsx)(zn,{storeId:h,setStoreId:g}),s===`logs`&&(0,J.jsx)(rr,{})]})]})}var Rr=(0,W.memo)(Lr);function zr(){let{logLength:e,logAutoScroll:t,setMessages:n,setLogFilterLevel:r,setLogFilterSearch:i,online:a,filterLogMessages:o}=(0,W.useContext)(Y),[s,c]=(0,W.useState)(localStorage.getItem(G.logFilterLevel)??`info`),[l,u]=(0,W.useState)(localStorage.getItem(G.logFilterSearch)??`*`),[f,p]=(0,W.useState)(e.current.toString()),[m,h]=(0,W.useState)(t.current);return K&&console.log(`Logs rendering...`),a?(0,J.jsxs)(jn,{name:`Logs`,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,margin:`0px`,padding:`0px`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(ue,{id:`select-level`,style:{color:`var(--div-text-color)`},children:`Filter log by level:`}),(0,J.jsxs)(L,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-level`,id:`debug-level`,value:s,onChange:e=>{let t=e.target.value;c(t),r(t),o(t,l),localStorage.setItem(G.logFilterLevel,t),K&&console.log(`handleLogFilterLevelChange called with value:`,t)},children:[(0,J.jsx)(B,{value:`debug`,children:`Debug`}),(0,J.jsx)(B,{value:`info`,children:`Info`}),(0,J.jsx)(B,{value:`notice`,children:`Notice`}),(0,J.jsx)(B,{value:`warn`,children:`Warn`}),(0,J.jsx)(B,{value:`error`,children:`Error`}),(0,J.jsx)(B,{value:`fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`5px`},children:[(0,J.jsx)(ue,{id:`search`,style:{color:`var(--div-text-color)`},children:`Filter log by text:`}),(0,J.jsx)(z,{title:`Use /text/ for case-insensitive regex search`,children:(0,J.jsx)(V,{style:{width:`210px`},size:`small`,id:`logsearch`,variant:`outlined`,value:l,onChange:e=>{let t=e.target.value;u(t),i(t),o(s,t),localStorage.setItem(G.logFilterSearch,t),K&&console.log(`handleLogFilterSearchChange called with value:`,t)},slotProps:{input:{style:{height:`30px`,padding:`0 0px`,backgroundColor:`var(--main-bg-color)`}}}})})]}),(0,J.jsx)(d,{control:(0,J.jsx)(oe,{checked:m,onChange:e=>{let n=e.target.checked;h(n),t.current=n,o(s,l),localStorage.setItem(G.logAutoScroll,n?`true`:`false`),K&&console.log(`handleAutoScrollChange called with value:`,n)}}),label:`Auto scroll`,style:{color:`var(--div-text-color)`}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(ue,{id:`select-size-label`,style:{color:`var(--div-text-color)`},children:`Log length:`}),(0,J.jsxs)(L,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-size-label`,id:`select-size`,value:f,onChange:t=>{let n=t.target.value;p(n),e.current=Number(n),localStorage.setItem(G.logLength,n),K&&console.log(`handleLogLengthChange called with value:`,n)},children:[(0,J.jsx)(B,{value:100,children:`100`}),(0,J.jsx)(B,{value:200,children:`200`}),(0,J.jsx)(B,{value:500,children:`500`}),(0,J.jsx)(B,{value:1e3,children:`1000`})]}),(0,J.jsx)(z,{title:`Clear the logs`,children:(0,J.jsx)(U,{onClick:()=>{K&&console.log(`handleClearLogsClick called`),n([])},endIcon:(0,J.jsx)(Ae,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Clear`})})]})]}),(0,J.jsx)(`div`,{style:{flex:`1`,overflow:`auto`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(tr,{})})]}):(0,J.jsx)(qt,{})}var Br=(0,W.memo)(zr),Vr=1200,Hr,Ur;function Wr(e,t){Hr=e,Ur=t}function Gr(){let{mobile:e,showSnackbarMessage:t,showConfirmCancelDialog:n}=(0,W.useContext)(Wt),{online:i,sendMessage:a,logMessage:o,addListener:c,removeListener:l,getUniqueId:d}=(0,W.useContext)(Y),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[_,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(null),[w,E]=(0,W.useState)(`inactive`),D=(0,W.useRef)(d()),[O,k]=(0,W.useState)(null),[A,j]=(0,W.useState)(null),[M,N]=(0,W.useState)(null),[te,P]=(0,W.useState)(null),ne=r(),F=()=>{window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`)},re=()=>{window.open(`https://matterbridge.io/`)},I=()=>{window.open(`https://matterbridge.io/README.html`)},ie=()=>{window.open(`https://matterbridge.io/CHANGELOG.html`)},ae=()=>{window.open(`https://discord.gg/QX58CDe6hd`,`_blank`)},oe=()=>{window.open(`https://github.com/Luligu/matterbridge`,`_blank`)},se=()=>{a({id:D.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge`,restart:!0}}),y(!1)},ce=()=>{a({id:D.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge@dev`,restart:!0}}),x(!1)},ue=()=>{a({id:D.current,sender:`Header`,method:`/api/checkupdates`,src:`Frontend`,dst:`Matterbridge`,params:{}})},de=()=>{K&&console.log(`Header: handleShellySystemUpdateClick`),o(`Matterbridge`,`Installing system updates...`),a({id:D.current,sender:`Header`,method:`/api/shellysysupdate`,src:`Frontend`,dst:`Matterbridge`,params:{}})},fe=()=>{K&&console.log(`Header: handleShellyMainUpdateClick`),o(`Matterbridge`,`Installing software updates...`),a({id:D.current,sender:`Header`,method:`/api/shellymainupdate`,src:`Frontend`,dst:`Matterbridge`,params:{}})},pe=()=>{K&&console.log(`Header: handleShellyCreateSystemLog`),a({id:D.current,sender:`Header`,method:`/api/shellycreatesystemlog`,src:`Frontend`,dst:`Matterbridge`,params:{}})},me=()=>{K&&console.log(`Header: handleShellyDownloadSystemLog`),o(`Matterbridge`,`Downloading Shelly system log...`),t(`Downloading Shelly system log...`,5),window.location.href=`./api/shellydownloadsystemlog`},he=()=>{S?.matterbridgeInformation.restartMode===`none`?a({id:D.current,sender:`Header`,method:`/api/restart`,src:`Frontend`,dst:`Matterbridge`,params:{}}):a({id:D.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ge=()=>{a({id:D.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},_e=()=>{a({id:D.current,sender:`Header`,method:`/api/reboot`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ve=()=>{a({id:D.current,sender:`Header`,method:`/api/softreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ye=()=>{a({id:D.current,sender:`Header`,method:`/api/hardreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},be=e=>{k(e.currentTarget)},L=e=>{K&&console.log(`Header: handleMenuClose`,e),k(null),e===`/`||e===`/devices`||e===`/log`||e===`/settings`?ne(e):e===`reset_frontend`?(o(`Matterbridge`,`Resetting frontend UI...`),t(`Resetting frontend UI...`,5),Nt(),window.location.reload()):e===`download-mblog`?(o(`Matterbridge`,`Downloading matterbridge log...`),t(`Downloading matterbridge log...`,5),window.location.href=`./api/download-mblog`):e===`download-mjlog`?(o(`Matterbridge`,`Downloading matter log...`),t(`Downloading matter log...`,5),window.location.href=`./api/download-mjlog`):e===`view-mblog`?(o(`Matterbridge`,`Loading matterbridge log...`),t(`Loading matterbridge log...`,5),window.open(`./api/view-mblog`,`_blank`,`noopener,noreferrer`)):e===`view-mjlog`?(o(`Matterbridge`,`Loading matter log...`),t(`Loading matter log...`,5),window.open(`./api/view-mjlog`,`_blank`,`noopener,noreferrer`)):e===`view-diagnostic`?(o(`Matterbridge`,`Loading diagnostic log...`),t(`Loading diagnostic log...`,5),window.open(`./api/view-diagnostic`,`_blank`,`noopener,noreferrer`)):e===`download-diagnostic`?(o(`Matterbridge`,`Downloading diagnostic log...`),t(`Downloading diagnostic log...`,5),window.location.href=`./api/download-diagnostic`):e===`view-history`?a({id:D.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`download-history`?a({id:D.current,sender:`Header`,method:`/api/downloadhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`view-shellylog`?(o(`Matterbridge`,`Loading shelly system log...`),t(`Loading shelly system log...`,5),window.location.href=`./api/shellyviewsystemlog`):e===`download-mbstorage`?(o(`Matterbridge`,`Downloading matterbridge storage...`),t(`Downloading matterbridge storage...`,5),window.location.href=`./api/download-mbstorage`):e===`download-pluginstorage`?(o(`Matterbridge`,`Downloading matterbridge plugins storage...`),t(`Downloading matterbridge plugins storage...`,5),window.location.href=`./api/download-pluginstorage`):e===`download-pluginconfig`?(o(`Matterbridge`,`Downloading matterbridge plugins config...`),t(`Downloading matterbridge plugins config...`,5),window.location.href=`./api/download-pluginconfig`):e===`download-mjstorage`?(o(`Matterbridge`,`Downloading matter storage...`),t(`Downloading matter storage...`,5),window.location.href=`./api/download-mjstorage`):e===`download-backup`?(o(`Matterbridge`,`Downloading backup...`),t(`Downloading backup...`,10),window.location.href=`./api/download-backup`):e===`update`?se():e===`updatedev`?ce():e===`updatecheck`?ue():e===`shelly-sys-update`?de():e===`shelly-main-update`?fe():e===`shelly-create-system-log`?pe():e===`shelly-download-system-log`?me():e===`softreset`?ve():e===`hardreset`?ye():e===`restart`?he():e===`shutdown`?ge():e===`reboot`?_e():e===`create-backup`?a({id:D.current,sender:`Header`,method:`/api/create-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matterbridge-storage-backup`?a({id:D.current,sender:`Header`,method:`/api/create-matterbridge-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matter-storage-backup`?a({id:D.current,sender:`Header`,method:`/api/create-matter-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-plugin-backup`?a({id:D.current,sender:`Header`,method:`/api/create-plugin-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-config-backup`?a({id:D.current,sender:`Header`,method:`/api/create-config-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`unregister`?a({id:D.current,sender:`Header`,method:`/api/unregister`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`reset`?a({id:D.current,sender:`Header`,method:`/api/reset`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`factoryreset`&&a({id:D.current,sender:`Header`,method:`/api/factoryreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},Se=e=>{K&&console.log(`Header: handleMenuCloseCancel:`,e),k(null)},Ce=e=>{j(e.currentTarget)},we=()=>{j(null)},Te=e=>{N(e.currentTarget)},Ee=()=>{N(null)},De=e=>{P(e.currentTarget)},Oe=()=>{P(null)};return(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`Header received WebSocket Message:`,e),e.method===`/api/settings`&&e.id===D.current?(K&&console.log(`Header received settings:`,e.response),C(e.response),p(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired),h(e.response.matterbridgeInformation.fixedRestartRequired),y(e.response.matterbridgeInformation.updateRequired),E(e.response.matterbridgeInformation.bridgeStatus)):e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Header received refresh_required: changed=${e.response.changed} and sending /api/settings request`),a({id:D.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`restart_required`?(K&&console.log(`Header received restart_required with fixed: ${e.response.fixed}`),p(!0),e.response.fixed&&h(!0)):e.method===`restart_not_required`?(K&&console.log(`Header received restart_not_required`),p(!1)):e.method===`matterbridge_status_update`?(K&&console.log(`Header received matterbridge_status_update: ${e.response.status}`),E(e.response.status)):e.method===`update_required`?(K&&console.log(`Header received update_required`),e.response.devVersion?(C(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeDevVersion:e.response.version}}:null),x(!0)):(C(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeLatestVersion:e.response.version}}:null),y(!0))):e.method===`shelly_sys_update`?(K&&console.log(`Header received WS_ID_SHELLY_SYS_UPDATE:`),C(t=>t?{matterbridgeInformation:{...t.matterbridgeInformation,shellySysUpdate:e.response.available},systemInformation:t.systemInformation}:null)):e.method===`shelly_main_update`?(K&&console.log(`Header received WS_ID_SHELLY_MAIN_UPDATE:`),C(t=>t?{matterbridgeInformation:{...t.matterbridgeInformation,shellyMainUpdate:e.response.available},systemInformation:t.systemInformation}:null)):e.method===`/api/viewhistorypage`&&e.id===D.current&&e.success?(K&&console.log(`Header received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`)):e.method===`/api/downloadhistorypage`&&e.id===D.current&&e.success?(K&&console.log(`Header received /api/downloadhistorypage success`),window.location.href=`./api/downloadhistory`):e.method===`archive`&&e.success&&e.response.command===`zip`&&(K&&console.log(`Header received archive success response for zip command`,e.response),e.response.archivePath.endsWith(`matterbridge.backup.zip`)?window.location.href=`./api/download-backup`:e.response.archivePath.endsWith(`matterbridge.storage.zip`)?window.location.href=`./api/download-mbstorage`:e.response.archivePath.endsWith(`matterbridge.matterstorage.zip`)?window.location.href=`./api/download-mjstorage`:e.response.archivePath.endsWith(`matterbridge.pluginstorage.zip`)?window.location.href=`./api/download-pluginstorage`:e.response.archivePath.endsWith(`matterbridge.pluginconfig.zip`)&&(window.location.href=`./api/download-pluginconfig`))};return c(e,D.current),K&&console.log(`Header added WebSocket listener id ${D.current}`),()=>{l(e),K&&console.log(`Header removed WebSocket listener`)}},[c,l,a,t]),(0,W.useEffect)(()=>{i&&(K&&console.log(`Header sending /api/settings and /api/checkupdates requests`),a({id:D.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),a({id:D.current,sender:`Header`,method:`/api/checkupdates`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[i,a]),K&&console.log(`Header rendering... mobile %s`,e),!i||!S?null:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(T,{style:{margin:`0`,padding:`0`},onClick:()=>{Pt(),K&&console.log(`Matterbridge logo clicked: debug is now`,K)},children:(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`30px`}})}),(0,J.jsx)(`h2`,{style:{fontSize:`22px`,color:`var(--main-icon-color)`,margin:`0px`},children:`Matterbridge`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:(0,J.jsxs)(`nav`,{children:[(0,J.jsx)(s,{to:`/`,className:`nav-link`,children:`Home`}),(0,J.jsx)(s,{to:`/devices`,className:`nav-link`,children:`Devices`}),(0,J.jsx)(s,{to:`/log`,className:`nav-link`,children:`Logs`}),(0,J.jsx)(s,{to:`/settings`,className:`nav-link`,children:`Settings`})]})})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[!S.matterbridgeInformation.readOnly&&(0,J.jsx)(z,{title:`Matterbridge v.${S.matterbridgeInformation.matterbridgeVersion}`,children:(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:_?`var(--primary-color)`:b?`var(--secondary-color)`:`green`},children:[`v.`,S.matterbridgeInformation.matterbridgeVersion.split(`-`)[0]+(S.matterbridgeInformation.matterbridgeVersion.includes(`-dev-`)?`@dev`:``)+(S.matterbridgeInformation.matterbridgeVersion.includes(`-edge-`)?`@edge`:``)+(S.matterbridgeInformation.matterbridgeVersion.includes(`-local-`)?`@local`:``)+(S.matterbridgeInformation.matterbridgeVersion.includes(`-git-`)?`@git`:``)]})}),S.matterbridgeInformation.shellyBoard&&(0,J.jsx)(`img`,{src:`Shelly.svg`,alt:`Shelly Icon`,style:{height:`30px`,padding:`0px`,margin:`0px`,marginRight:`30px`}}),S.matterbridgeInformation.bridgeMode!==`none`&&!S.matterbridgeInformation.readOnly?(0,J.jsx)(z,{title:`Bridge mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:w===`started`?`green`:w===`error`?`red`:void 0},children:S.matterbridgeInformation.bridgeMode})}):null,S.matterbridgeInformation.restartMode!==`none`&&!S.matterbridgeInformation.readOnly?(0,J.jsx)(z,{title:`Restart mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:S.matterbridgeInformation.restartMode})}):null,S.systemInformation.bunVersion?(0,J.jsx)(z,{title:`Bun version`,children:(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:[`bun v.`,S.systemInformation.bunVersion]})}):null,S.matterbridgeInformation.profile&&S.matterbridgeInformation.profile!==``&&!S.matterbridgeInformation.readOnly?(0,J.jsx)(z,{title:`Current profile`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:S.matterbridgeInformation.profile})}):null,K&&(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:[e?`Mobile `:`Desktop `,`${Hr}x${Ur}`,` enabled ${localStorage.getItem(G.enableMobile)!==`false`}`]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`5px`},children:[S.matterbridgeInformation.readOnly?null:(0,J.jsx)(z,{title:`Matterbridge discord group`,children:(0,J.jsx)(T,{style:{margin:`0`,padding:`0`},onClick:ae,children:(0,J.jsx)(`img`,{src:`discord.svg`,alt:`Discord Logo`,style:{height:`25px`}})})}),S.matterbridgeInformation.readOnly?null:(0,J.jsx)(z,{title:`Give a star to Matterbridge`,children:(0,J.jsx)(T,{style:{color:`#FFD700`,margin:`0`,padding:`0`},onClick:oe,children:(0,J.jsx)(Ze,{})})}),S.matterbridgeInformation.readOnly?null:(0,J.jsx)(z,{title:`Sponsor Matterbridge`,children:(0,J.jsx)(T,{style:{color:`#b6409c`,margin:`0`,padding:`0`},onClick:F,children:(0,J.jsx)(at,{})})}),(0,J.jsx)(z,{title:`Matterbridge homepage`,children:(0,J.jsx)(T,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:re,children:(0,J.jsx)(le,{})})}),(0,J.jsx)(z,{title:`Matterbridge help`,children:(0,J.jsx)(T,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:I,children:(0,J.jsx)(g,{})})}),(0,J.jsx)(z,{title:`Matterbridge changelog`,children:(0,J.jsx)(T,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ie,children:(0,J.jsx)(v,{})})}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&_&&(0,J.jsx)(z,{title:`Update matterbridge to latest version v.${S.matterbridgeInformation.matterbridgeLatestVersion}`,children:(0,J.jsx)(T,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:se,children:(0,J.jsx)(ct,{})})}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&b&&(0,J.jsx)(z,{title:`Update matterbridge to latest dev version v.${S.matterbridgeInformation.matterbridgeDevVersion}`,children:(0,J.jsx)(T,{style:{color:`var(--secondary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ce,children:(0,J.jsx)(ct,{})})}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellySysUpdate&&(0,J.jsx)(z,{title:`Shelly system update`,children:(0,J.jsx)(T,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:de,children:(0,J.jsx)(ct,{})})}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellyMainUpdate&&(0,J.jsx)(z,{title:`Shelly software update`,children:(0,J.jsx)(T,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:fe,children:(0,J.jsx)(ct,{})})}),(0,J.jsx)(z,{title:`Restart matterbridge`,children:(0,J.jsx)(T,{style:{color:f||m?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:he,children:(0,J.jsx)(st,{})})}),S.matterbridgeInformation.restartMode===`none`?(0,J.jsx)(z,{title:`Shut down matterbridge`,children:(0,J.jsx)(T,{style:{color:f||m?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:ge,children:(0,J.jsx)(xe,{})})}):null,(0,J.jsx)(z,{title:`Download, backup and more`,children:(0,J.jsx)(T,{onClick:be,children:(0,J.jsx)(Ge,{style:{color:`var(--main-icon-color)`}})})}),(0,J.jsxs)(lt,{id:`command-menu`,anchorEl:O,keepMounted:!0,open:!!O,onClose:()=>L(``),children:[q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Home page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/devices`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Devices page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/log`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Logs page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/settings`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Settings page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>L(`update`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Install latest stable`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>L(`updatedev`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Install latest dev`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>L(`updatecheck`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Check for updates`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellySysUpdate&&(0,J.jsxs)(B,{onClick:()=>L(`shelly-sys-update`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shelly system update`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellyMainUpdate&&(0,J.jsxs)(B,{onClick:()=>L(`shelly-main-update`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shelly software update`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>L(`restart`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(st,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Restart`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation.restartMode===`none`?(0,J.jsxs)(B,{onClick:()=>L(`shutdown`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shutdown`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}):null,S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{n(`Reboot`,`Are you sure you want to reboot the Shelly board?`,`reboot`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(st,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reboot...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:Ce,children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`View`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(lt,{id:`sub-menu-view`,anchorEl:A,keepMounted:!0,open:!!A,onClose:we,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(B,{onClick:()=>{It(),we(),Se(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Desktop site`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{Ft(),we(),Se(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Mobile site`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-mblog`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-mjlog`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matter log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-diagnostic`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge diagnostic log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-history`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge system history`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{L(`view-shellylog`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shelly system log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:Te,children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Download`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(lt,{id:`sub-menu-download`,anchorEl:M,keepMounted:!0,open:!!M,onClose:Ee,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(B,{onClick:()=>{L(`create-matterbridge-storage-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge storage`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`create-plugin-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge plugins storage`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`create-config-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge plugins config`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-mblog`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`create-matter-storage-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matter storage`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-mjlog`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matter log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-diagnostic`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge diagnostic log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-history`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge system history`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{L(`shelly-create-system-log`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Create Shelly system log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{L(`shelly-download-system-log`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Download Shelly system log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:()=>{L(`create-backup`)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ye,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Backup`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:De,children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ne,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(lt,{id:`sub-menu-reset`,anchorEl:te,keepMounted:!0,open:!!te,onClose:Oe,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Reset the frontend UI`,`Are you sure you want to reset the frontend UI? This will reset all local settings and reload the page.`,`reset_frontend`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset the frontend UI...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Reset all devices and shutdown`,`Are you sure you want to unregister all devices? This will temporarily remove all devices from the controller and you may loose the controller configuration.`,`unregister`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset all devices...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Reset commissioning and shutdown`,`Are you sure you want to reset the commissioning? You will have to manually remove Matterbridge from the controller.`,`reset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset commissioning...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Factory reset and shutdown`,`Are you sure you want to factory reset Matterbridge? You will have to manually remove Matterbridge from the controller.`,`factoryreset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Factory reset...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Network reset`,`Are you sure you want to factory reset the network parameters?`,`softreset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset network...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Factory reset`,`Are you sure you want to factory reset Matterbridge? You will have to manually remove Matterbridge from the controller.`,`hardreset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Factory reset...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]})]})]})]})]})}var Kr=(0,W.memo)(Gr);function qr(){if(typeof window<`u`){let e=Math.floor(window.visualViewport?.width??window.innerWidth),t=Math.floor(window.visualViewport?.height??window.innerHeight);Wr(e,t);let n=e<1200||t<900;return K&&console.log(`Visual viewport (%s) width %i height %i mobile %s`,window.visualViewport!==void 0,e,t,n),n}return!1}function Jr({children:e}){let{mobile:t,setMobile:n}=(0,W.useContext)(Wt),{logAutoScroll:r}=(0,W.useContext)(Y);return(0,W.useEffect)(()=>{function e(){let e=qr();e&&(r.current=!1,localStorage.setItem(G.logAutoScroll,`false`)),n(e)}return window.addEventListener(`resize`,e),n(qr()),()=>window.removeEventListener(`resize`,e)},[r,n]),K&&console.log(`MbfScreen rendering... mobile %s`,t),q&&t?(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`visible`,margin:`0px`,padding:`10px`,gap:`10px`},children:[(0,J.jsx)(Kr,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`10px`},children:e})]}):(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`hidden`,width:t?`${Vr}px`:`calc(100vw - 40px)`,height:t?`900px`:`calc(100vh - 40px)`,margin:`0px`,padding:`20px`,gap:`20px`},children:[(0,J.jsx)(Kr,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,width:`100%`,height:`calc(100% - 60px)`,margin:`0px`,padding:`0px`,gap:`20px`},children:e})]})}function Yr(e=1e3){let t=null,n=(n=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{n(),t=null},e)});return n.cancel=()=>{t!==null&&(window.clearTimeout(t),t=null)},n}var Xr=({open:e,onClose:t,onSave:n})=>{let[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(``),s=e=>{i(e.target.value)},c=e=>{o(e.target.value)},l=r.length>0&&r===a;return(0,J.jsxs)(M,{open:e,onClose:(e,n)=>{n===`backdropClick`||n===`escapeKeyDown`||t()},maxWidth:`sm`,style:{maxWidth:`500px`,margin:`auto`},disableEscapeKeyDown:!0,children:[(0,J.jsx)(P,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:`Change Password`})]})}),(0,J.jsx)(x,{dividers:!0,children:(0,J.jsx)(Ie,{component:`fieldset`,fullWidth:!0,sx:{margin:0,padding:0,gap:`20px`},children:(0,J.jsxs)(_,{container:!0,spacing:2,sx:{mt:2},children:[(0,J.jsx)(_,{size:12,children:(0,J.jsx)(V,{type:`password`,autoComplete:`new-password`,label:`New Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:r,onChange:s})}),(0,J.jsx)(_,{size:12,children:(0,J.jsx)(V,{type:`password`,autoComplete:`new-password`,label:`Confirm Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:a,onChange:c,error:a!==``&&r!==a,helperText:a!==``&&r!==a?`Passwords do not match`:``})})]})})}),(0,J.jsxs)(D,{children:[(0,J.jsx)(U,{onClick:()=>{t()},children:`Cancel`}),(0,J.jsx)(U,{variant:`contained`,onClick:()=>{l&&(n(r),t())},disabled:!l,children:`Change`}),(0,J.jsx)(U,{variant:`contained`,onClick:()=>{n(``),t()},children:`Reset`})]})]})},Zr=({open:e,ip:t,onClose:n,onSave:r})=>{let i=t?t.split(`.`).slice(0,3).join(`.`)+`.1`:``,[a,o]=(0,W.useState)(`dhcp`),[s,c]=(0,W.useState)({ip:t??``,subnet:`255.255.255.0`,gateway:i,dns:i}),l=e=>t=>{c({...s,[e]:t.target.value})};return(0,J.jsxs)(M,{open:e,onClose:(e,t)=>{t===`backdropClick`||t===`escapeKeyDown`||n()},maxWidth:`sm`,style:{maxWidth:`550px`,margin:`auto`},children:[(0,J.jsx)(P,{gap:`20px`,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:`Network Configuration`})]})}),(0,J.jsxs)(x,{dividers:!0,children:[(0,J.jsxs)(Ie,{component:`fieldset`,fullWidth:!0,children:[(0,J.jsx)(F,{component:`legend`,children:`Select IP Configuration`}),(0,J.jsxs)(He,{row:!0,value:a,onChange:e=>o(e.target.value),children:[(0,J.jsx)(d,{value:`dhcp`,control:(0,J.jsx)(Me,{}),label:`DHCP`}),(0,J.jsx)(d,{value:`static`,control:(0,J.jsx)(Me,{}),label:`Static`})]})]}),a===`static`&&(0,J.jsxs)(_,{container:!0,spacing:2,sx:{mt:2},children:[(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`IP Address`,fullWidth:!0,value:s.ip,onChange:l(`ip`)})}),(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`Subnet Mask`,fullWidth:!0,value:s.subnet,onChange:l(`subnet`)})}),(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`Gateway`,fullWidth:!0,value:s.gateway,onChange:l(`gateway`)})}),(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`DNS Server`,fullWidth:!0,value:s.dns,onChange:l(`dns`)})})]})]}),(0,J.jsxs)(D,{children:[(0,J.jsx)(U,{onClick:()=>{n()},children:`Cancel`}),(0,J.jsx)(U,{variant:`contained`,onClick:()=>{r({type:a,...s}),n()},children:`Save`})]})]})},Qr=330;function $r(){let{mobile:e}=(0,W.useContext)(Wt),{online:t,addListener:n,removeListener:r,sendMessage:i,getUniqueId:a}=(0,W.useContext)(Y),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),u=(0,W.useRef)(a());return(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`Settings received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Settings received refresh_required: changed=${e.response.changed} and sending /api/settings request`),i({id:u.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`?(K&&console.log(`Settings received update_required`,e.response),e.response.devVersion?s(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):s(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)):e.method===`/api/settings`&&(K&&console.log(`Settings received /api/settings:`,e.response),s(e.response.matterbridgeInformation),l(e.response.systemInformation))};return n(e,u.current),K&&console.log(`Settings added WebSocket listener`),()=>{r(e),K&&console.log(`Settings removed WebSocket listener`)}},[n,r,i]),(0,W.useEffect)(()=>{t&&(K&&console.log(`Settings received online`),i({id:u.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[t,i]),K&&console.log(`Settings rendering...`),!t||!o||!c?(0,J.jsx)(qt,{}):(0,J.jsx)(jn,{name:`Settings`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:q&&e?`10px`:`20px`},children:[(0,J.jsx)(ei,{matterbridgeInfo:o,systemInfo:c}),(0,J.jsx)(ti,{matterbridgeInfo:o}),(0,J.jsx)(ni,{matterbridgeInfo:o}),(0,J.jsx)(ri,{systemInfo:c})]})})}function ei({matterbridgeInfo:e,systemInfo:t}){let{sendMessage:n,getUniqueId:r}=(0,W.useContext)(Y),[i,a]=(0,W.useState)(`bridge`),[o,s]=(0,W.useState)(`Info`),[c,l]=(0,W.useState)(!1),[u,f]=(0,W.useState)(`dark`),[p,m]=(0,W.useState)(localStorage.getItem(G.homePagePlugins)!==`false`),[h,g]=(0,W.useState)(localStorage.getItem(G.homePageMode)??`devices`),[_,v]=(0,W.useState)(localStorage.getItem(G.virtualMode)??`outlet`),y=(0,W.useRef)(r()),[b,x]=(0,W.useState)(!1),S=()=>x(!1),C=e=>{K&&console.log(`handleSaveNetConfig called with config:`,e),n({id:y.current,sender:`Settings`,method:`/api/shellynetconfig`,src:`Frontend`,dst:`Matterbridge`,params:e})},[w,T]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{e&&(a(e.bridgeMode===`bridge`?`bridge`:`childbridge`),s(e.loggerLevel.charAt(0).toUpperCase()+e.loggerLevel.slice(1)),l(e.fileLogger),v(e.virtualMode))},[e]),(0,W.useEffect)(()=>{let e=localStorage.getItem(G.frontendTheme);e&&f(e)},[]),!e||!t?null:(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matterbridge settings`})}),(0,J.jsx)(Zr,{open:b,ip:t.ipv4Address,onClose:S,onSave:C}),(0,J.jsx)(Xr,{open:w,onClose:()=>T(!1),onSave:e=>{K&&console.log(`handleSaveChangePassword called with password:`,e),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setpassword`,value:e}}),Rt(e)}}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`matterbridgeInfo-mode`,children:`Mode:`}),(0,J.jsxs)(He,{row:!0,name:`mode-buttons-group`,value:i,onChange:e=>{K&&console.log(`handleChangeBridgeMode called with value:`,e.target.value),a(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setbridgemode`,value:e.target.value}})},children:[(0,J.jsx)(d,{value:`bridge`,control:(0,J.jsx)(Me,{}),label:`Bridge`,disabled:e.readOnly}),(0,J.jsx)(d,{value:`childbridge`,control:(0,J.jsx)(Me,{}),label:`Childbridge`,disabled:e.readOnly})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mblogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`mblogger-level-label`,id:`mblogger-level`,value:o,onChange:e=>{K&&console.log(`handleChangeMbLoggerLevel called with value:`,e.target.value),s(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmbloglevel`,value:e.target.value}})},children:[(0,J.jsx)(B,{value:`Debug`,children:`Debug`}),(0,J.jsx)(B,{value:`Info`,children:`Info`}),(0,J.jsx)(B,{value:`Notice`,children:`Notice`}),(0,J.jsx)(B,{value:`Warn`,children:`Warn`}),(0,J.jsx)(B,{value:`Error`,children:`Error`}),(0,J.jsx)(B,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mblogger-file-label`,children:`Log on file:`}),(0,J.jsx)(oe,{checked:c,onChange:e=>{K&&console.log(`handleLogOnFileMbChange called with value:`,e.target.checked),l(e.target.checked),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmblogfile`,value:e.target.checked}})},id:`mblogger-file`,name:`logOnFileMb`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-theme-label`,children:`Frontend theme:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`frontend-theme-label`,id:`frontend-theme`,value:u,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeTheme called with value:`,t),f(t),localStorage.setItem(G.frontendTheme,t),document.body.setAttribute(`frontend-theme`,t)},children:[(0,J.jsx)(B,{value:`classic`,children:`Classic`}),(0,J.jsx)(B,{value:`light`,children:`Light`}),(0,J.jsx)(B,{value:`dark`,children:`Dark`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-plugin-label`,children:`Home page plugins:`}),(0,J.jsx)(oe,{checked:p,onChange:e=>{let t=e.target.checked;K&&console.log(`handleChangeHomePagePlugins called with value:`,t),m(t),localStorage.setItem(G.homePagePlugins,t?`true`:`false`)},name:`showPlugins`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-label`,children:`Home page bottom panel:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`frontend-home-label`,id:`frontend-home`,value:h,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeHomePageMode called with value:`,t),g(t),localStorage.setItem(G.homePageMode,t)},children:[(0,J.jsx)(B,{value:`logs`,children:`Logs`}),(0,J.jsx)(B,{value:`devices`,children:`Devices`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`10px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-virtual-label`,children:`Virtual devices:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`frontend-virtual-label`,id:`frontend-virtual`,value:_,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeVirtualMode called with value:`,t),v(t),localStorage.setItem(G.virtualMode,t),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setvirtualmode`,value:t}})},children:[(0,J.jsx)(B,{value:`disabled`,children:`Disabled`}),(0,J.jsx)(B,{value:`outlet`,children:`Outlet`}),(0,J.jsx)(B,{value:`light`,children:`Light`}),(0,J.jsx)(B,{value:`switch`,children:`Switch`}),(0,J.jsx)(B,{value:`mounted_switch`,children:`Mounted Switch`})]})]}),(0,J.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`20px`},children:(0,J.jsx)(U,{variant:`contained`,color:`primary`,onClick:()=>T(!0),children:`Change password`})}),e.shellyBoard&&(0,J.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`20px`},children:(0,J.jsx)(U,{variant:`contained`,color:`primary`,onClick:()=>x(!0),children:`Configure IP`})})]})]})}function ti({matterbridgeInfo:e}){let{sendMessage:t,getUniqueId:n}=(0,W.useContext)(Y),[r,i]=(0,W.useState)(`Info`),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),y=(0,W.useRef)(n()),b=(0,W.useMemo)(()=>Yr(1e3),[]),x=(0,W.useMemo)(()=>Yr(1e3),[]),S=(0,W.useMemo)(()=>Yr(1e3),[]),C=(0,W.useMemo)(()=>Yr(1e3),[]),w=(0,W.useMemo)(()=>Yr(1e3),[]),T=(0,W.useMemo)(()=>Yr(1e3),[]);return(0,W.useEffect)(()=>{e&&(i(e.matterLoggerLevel.charAt(0).toUpperCase()+e.matterLoggerLevel.slice(1)),o(e.matterFileLogger),c(e.matterMdnsInterface||``),u(e.matterIpv4Address||``),f(e.matterIpv6Address||``),m(e.matterPort?e.matterPort.toString():``),g(e.matterDiscriminator?e.matterDiscriminator.toString():``),v(e.matterPasscode?e.matterPasscode.toString():``))},[e]),(0,W.useEffect)(()=>()=>b.cancel(),[b]),(0,W.useEffect)(()=>()=>x.cancel(),[x]),(0,W.useEffect)(()=>()=>S.cancel(),[S]),(0,W.useEffect)(()=>()=>C.cancel(),[C]),(0,W.useEffect)(()=>()=>w.cancel(),[w]),(0,W.useEffect)(()=>()=>T.cancel(),[T]),e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matter settings`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`mjlogger-level-label`,id:`mjlogger-level`,value:r,onChange:e=>{K&&console.log(`handleChangeMjLoggerLevel called with value:`,e.target.value),i(e.target.value),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjloglevel`,value:e.target.value}})},children:[(0,J.jsx)(B,{value:`Debug`,children:`Debug`}),(0,J.jsx)(B,{value:`Info`,children:`Info`}),(0,J.jsx)(B,{value:`Notice`,children:`Notice`}),(0,J.jsx)(B,{value:`Warn`,children:`Warn`}),(0,J.jsx)(B,{value:`Error`,children:`Error`}),(0,J.jsx)(B,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`10px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-file-label`,children:`Log on file:`}),(0,J.jsx)(oe,{checked:a,onChange:e=>{K&&console.log(`handleLogOnFileMjChange called with value:`,e.target.checked),o(e.target.checked),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjlogfile`,value:e.target.checked}})},id:`mjlogger-file`,name:`logOnFileMj`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Mdns interface:`}),(0,J.jsx)(V,{value:s,onChange:e=>{K&&console.log(`handleChangeMdnsInterface called with value:`,e.target.value);let n=e.target.value;c(n),b(()=>{K&&console.log(`debounced sendMessage setmdnsinterface with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmdnsinterface`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv4 address:`}),(0,J.jsx)(V,{value:l,onChange:e=>{K&&console.log(`handleChangeIpv4Address called with value:`,e.target.value);let n=e.target.value;u(n),x(()=>{K&&console.log(`debounced sendMessage setipv4address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv4address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv6 address:`}),(0,J.jsx)(V,{value:d,onChange:e=>{K&&console.log(`handleChangeIpv6Address called with value:`,e.target.value);let n=e.target.value;f(n),S(()=>{K&&console.log(`debounced sendMessage setipv6address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv6address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning port:`}),(0,J.jsx)(V,{value:p,onChange:e=>{K&&console.log(`handleChangeMatterPort called with value:`,e.target.value);let n=e.target.value;m(n),C(()=>{K&&console.log(`debounced sendMessage setmatterport with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterport`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning discriminator:`}),(0,J.jsx)(V,{value:h,onChange:e=>{K&&console.log(`handleChangeMatterDiscriminator called with value:`,e.target.value);let n=e.target.value;g(n),w(()=>{K&&console.log(`debounced sendMessage setmatterdiscriminator with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterdiscriminator`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning passcode:`}),(0,J.jsx)(V,{value:_,onChange:e=>{K&&console.log(`handleChangemMatterPasscode called with value:`,e.target.value);let n=e.target.value;v(n),T(()=>{K&&console.log(`debounced sendMessage setmatterpasscode with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterpasscode`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]})]})]}):null}function ni({matterbridgeInfo:e}){return e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matterbridge info`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(ii,{value:e.matterbridgeVersion,label:`Current Version`}),(0,J.jsx)(ii,{value:e.matterbridgeLatestVersion,label:`Latest Version`}),(0,J.jsx)(ii,{value:e.rootDirectory,label:`Root Directory`}),(0,J.jsx)(ii,{value:e.homeDirectory,label:`Home Directory`}),(0,J.jsx)(ii,{value:e.matterbridgeDirectory,label:`Matterbridge Storage Directory`}),(0,J.jsx)(ii,{value:e.matterbridgePluginDirectory,label:`Matterbridge Plugin Directory`}),(0,J.jsx)(ii,{value:e.globalModulesDirectory,label:`Global Module Directory`})]})]}):null}function ri({systemInfo:e}){return e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`System info`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(ii,{value:e.interfaceName,label:`Interface name`}),(0,J.jsx)(ii,{value:e.macAddress,label:`MAC Address`}),(0,J.jsx)(ii,{value:e.ipv4Address,label:`IPv4 Address`}),(0,J.jsx)(ii,{value:e.ipv6Address,label:`IPv6 Address`}),(0,J.jsx)(ii,{value:e.nodeVersion,label:`Node Version`}),(0,J.jsx)(ii,{value:e.hostname,label:`Hostname`}),(0,J.jsx)(ii,{value:e.user,label:`User`})]})]}):null}function ii({value:e,label:t,width:n}){return(0,J.jsx)(V,{focused:!0,value:e,size:`small`,label:t,variant:`standard`,sx:{width:n?`${n-20}px`:`100%`,"& .MuiInput-underline:before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline:hover:not(.Mui-disabled):before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline.Mui-focused:after":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5}},slotProps:{input:{readOnly:!0,sx:{color:`var(--div-text-color)`,"&:before":{borderBottomColor:`var(--main-label-color)`},"&:after":{borderBottomColor:`var(--main-label-color)`}}},inputLabel:{sx:{marginTop:`3px`,color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}}})}var ai=(0,W.memo)($r);function oi(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,W.useContext)(Y),{showSnackbarMessage:a}=(0,W.useContext)(Wt),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)([]),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)({cpuUsage:0}),[g,_]=(0,W.useState)({totalMemory:``,freeMemory:``,heapTotal:``,heapUsed:``,external:``,arrayBuffers:``,rss:``}),[v,y]=(0,W.useState)({systemUptime:``,processUptime:``}),b=(0,W.useRef)(i());return K&&console.log(`Test uniqueId:`,b),(0,W.useEffect)(()=>{K&&console.log(`Test useEffect WebSocketMessage mounting`);let e=e=>{if(e.method===`restart_required`)K&&console.log(`Test received restart_required`),a(`Restart required`,0);else if(e.method===`refresh_required`)K&&console.log(`Test received refresh_required: changed=${e.response.changed} and sending api requests`),a(`Refresh required`,0),t({id:b.current,method:`/api/settings`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:b.current,method:`/api/plugins`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:b.current,method:`/api/devices`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}});else if(e.method===`memory_update`)K&&console.log(`Test received memory_update`,e),_(e.response);else if(e.method===`cpu_update`)K&&console.log(`Test received cpu_update`,e),h(e.response);else if(e.method===`uptime_update`)K&&console.log(`Test received uptime_update`,e),y(e.response);else if(e.method===`/api/settings`&&e.response)K&&console.log(`Test received /api/settings:`,e.response),a(`Test received /api/settings`,0),s(e.response);else if(e.method===`/api/plugins`&&e.response)K&&console.log(`Test received ${e.response.length} plugins:`,e.response),a(`Test received /api/plugins`,0),l(e.response);else if(e.method===`/api/devices`&&e.response){K&&console.log(`Test received ${e.response.length} devices:`,e.response),a(`Test received /api/devices`,0),d(e.response);for(let n of e.response)K&&console.log(`Test sending /api/clusters for device:`,n.pluginName,n.name,n.endpoint),t({id:b.current,method:`/api/clusters`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:n.pluginName,endpoint:n.endpoint||0}})}else e.method===`/api/clusters`&&e.response&&(K&&console.log(`Test received ${e.response.clusters.length} clusters for device ${e.response.deviceName} endpoint ${e.response.id}:${e.response.number}:`,e),a(`Test received /api/clusters for ${e.response.plugin}::${e.response.deviceName}`,0),p(e.response))};return n(e,b.current),K&&console.log(`Test useEffect WebSocketMessage mounted`),()=>{K&&console.log(`Test useEffect WebSocketMessage unmounting`),r(e),K&&console.log(`Test useEffect WebSocketMessage unmounted`)}},[n,r,t,a]),(0,W.useEffect)(()=>(K&&console.log(`Test useEffect online mounting`),e&&K&&console.log(`Test useEffect online received online`),K&&console.log(`Test useEffect online mounted`),()=>{K&&console.log(`Test useEffect online unmounted`)}),[e,t,a]),K&&console.log(`Test rendering...`),e?(0,J.jsx)(jn,{name:`Test`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,alignContent:`center`,gap:`20px`,height:`100vh`,width:`100vw`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`256px`,width:`256px`,margin:`10px`}}),(0,J.jsx)(`p`,{children:`Welcome to the Test page of the Matterbridge frontend`})]})}):(0,J.jsx)(qt,{})}var si=(0,W.memo)(oi);function ci({open:e,title:t,message:n,onConfirm:r,onCancel:i}){return(0,J.jsxs)(M,{open:e,children:[(0,J.jsx)(P,{gap:`20px`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:t})]})}),(0,J.jsxs)(x,{children:[(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:`0`,marginBottom:`20px`,maxHeight:`350px`,maxWidth:`350px`},children:(0,J.jsx)(`p`,{style:{flex:1,margin:`0`},children:n})}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-around`},children:[(0,J.jsx)(U,{onClick:e=>{K&&console.log(`Confirmed`),e.preventDefault(),r()},variant:`contained`,color:`primary`,size:`small`,children:`Confirm`}),(0,J.jsx)(U,{onClick:e=>{K&&console.log(`Canceled`),e.preventDefault(),i()},variant:`contained`,color:`primary`,size:`small`,children:`Cancel`})]})]})]})}var li=({open:e,output:t,title:n,_command:r,_packageName:i,onInstall:a,onClose:o})=>{let{installAutoExit:s,mobile:c,setInstallAutoExit:l}=(0,W.useContext)(Wt),u=(0,W.useRef)(null),f=e=>{l(e.target.checked),localStorage.setItem(G.installAutoExit,e.target.checked?`true`:`false`),K&&console.log(`handleInstallAutoExitChange called with value:`,e.target.checked)};return(0,W.useEffect)(()=>{K&&console.log(`InstallProgressDialog output effect mounted, scrolling to bottom:`,u.current),setTimeout(()=>{K&&console.log(`Scrolling to bottom:`,u.current),u.current?.scrollIntoView({behavior:`smooth`,block:`end`})},0)},[t]),(0,J.jsxs)(M,{open:e,onClose:(e,t)=>{t===`backdropClick`||t===`escapeKeyDown`||o()},slotProps:{paper:{sx:{width:q&&c?`100vw`:`75vw`,maxWidth:q&&c?`100vw`:`75vw`,height:q&&c?`100vh`:`75vw`,maxHeight:q&&c?`100vh`:`75vh`,margin:q&&c?`0px`:void 0,overflow:`hidden`}}},children:[(0,J.jsx)(P,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:n})]})}),(0,J.jsxs)(x,{dividers:!0,style:{overflow:`hidden`,display:`flex`,flexDirection:`column`,height:400,paddingBottom:0},children:[(0,J.jsx)(`div`,{style:{display:`block`,marginBottom:`10px`,fontSize:`16px`,fontWeight:`bold`,color:`var(--primary-color)`},children:`Process log`}),(0,J.jsxs)(`ul`,{style:{width:`100%`,height:`100%`,fontFamily:`monospace`,fontSize:`14px`,padding:`10px`,margin:0,marginBottom:`10px`,color:`var(--div-text-color)`,background:`var(--div-bg-color)`,overflow:`auto`,listStyle:`none`,boxSizing:`border-box`,borderRadius:4,border:`4px solid var(--primary-color)`,whiteSpace:`pre-wrap`,display:`block`},children:[t.split(`
|
|
42
|
+
`,t.head.appendChild(a)},[ce,le]=(0,W.useState)(),[ue,de]=(0,W.useState)(!1),fe=e=>{K&&console.log(`handleConfigPlugin plugin:`,e.name),r({id:l.current,sender:`HomePlugins`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),r({id:l.current,sender:`HomePlugins`,method:`/api/select/entities`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:e.name}}),le(e),pe()},pe=()=>{de(!0)};return K&&console.log(`HomePlugins rendering...`),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Z,{children:[ce&&(0,J.jsx)(Sr,{open:ue,onClose:()=>{de(!1)},plugin:ce}),(0,J.jsx)(wn,{name:`Plugins`,columns:w,rows:h,footerRight:``,footerLeft:``})]}),(0,J.jsxs)(M,{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)(x,{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:oe,style:{display:`block`,flex:`1 1 auto`,width:`100%`,height:`100%`,border:`none`,backgroundColor:`var(--div-bg-color)`}})}),(0,J.jsx)(D,{sx:{flex:`0 0 auto`,justifyContent:`center`},children:(0,J.jsx)(U,{onClick:()=>b(null),children:`Close`})})]})]}):(0,J.jsx)(qt,{})}var Tr=(0,W.memo)(wr);function Er({version:e,changelog:t}){let{online:n}=(0,W.useContext)(Y);return K&&console.log(`HomeShowChangelog rendering...`),n?(0,J.jsxs)(Z,{children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matterbridge Update`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,J.jsxs)(`h4`,{style:{margin:0},children:[`Matterbridge has been updated to version `,e,`.`]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(U,{onClick:()=>window.open(`https://github.com/Luligu/matterbridge`,`_blank`),endIcon:(0,J.jsx)(Ze,{style:{color:`#FFD700`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Star`}),(0,J.jsx)(U,{onClick:()=>window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`),endIcon:(0,J.jsx)(at,{style:{color:`#b6409c`}}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Sponsor`}),(0,J.jsx)(U,{onClick:()=>window.open(t,`_blank`),endIcon:(0,J.jsx)(v,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Changelog`}),(0,J.jsx)(U,{onClick:()=>window.location.reload(),endIcon:(0,J.jsx)(we,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Close`})]})]})]}):(0,J.jsx)(qt,{})}var Dr=(0,W.memo)(Er);function Or({value:e,maxChars:t}){let n=e;if(e.length>t&&t>3){let r=t-3;n=`${e.substring(0,Math.ceil(r/2))} … ${e.substring(e.length-Math.floor(r/2),e.length)}`}return e===n?(0,J.jsx)(`span`,{children:n}):(0,J.jsx)(z,{title:e,placement:`top`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[0,12]}}]}},children:(0,J.jsx)(`span`,{children:n})})}function kr({matterbridgeInfo:e}){let{mobile:t}=(0,W.useContext)(Wt);K&&console.log(`MatterbridgeInfoTable:`,e);let n=new Set([`matterbridgeLatestVersion`,`matterbridgeDevVersion`,`dockerDev`,`dockerLatestVersion`,`dockerDevVersion`,`--matterFileLogger`,`--fileLogger`,`--matterLoggerLevel`,`--loggerLevel`,`--virtualMode`,`--bridgeMode`,`--restartMode`,`--restartRequired`,`fixedRestartRequired`,`--updateRequired`,`matterMdnsInterface`,`matterIpv4Address`,`matterIpv6Address`,`readOnly`,`shellyBoard`,`shellySysUpdate`,`shellyMainUpdate`,`matterPort`,`matterDiscriminator`,`matterPasscode`]),[r,i]=(0,W.useState)(!1);return!e||r?null:(K&&console.log(`MatterbridgeInfoTable rendering...`),(0,J.jsxs)(Z,{style:q&&t?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`Matterbridge info`}),(0,J.jsx)($t,{close:()=>i(!0)})]}),(0,J.jsx)(Qt,{style:q&&t?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(e).filter(([e,t])=>!n.has(e)&&t!=null&&t!==``).map(([e,n],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e.replace(`matterbridgeVersion`,`Matterbridge version`).replace(`frontendVersion`,`Frontend version`).replace(`dockerVersion`,`Docker version`).replace(`homeDirectory`,`Home`).replace(`rootDirectory`,`Root`).replace(`matterbridgeDirectory`,`Storage`).replace(`matterbridgeCertDirectory`,`Cert`).replace(`matterbridgePluginDirectory`,`Plugins`).replace(`globalModulesDirectory`,`Modules`).replace(`bridgeMode`,`Bridge mode`).replace(`restartMode`,`Restart mode`).replace(`virtualMode`,`Virtual mode`).replace(`profile`,`Profile`).replace(`loggerLevel`,`Logger level`).replace(`fileLogger`,`File logger`).replace(`loggerLevel`,`Logger level`).replace(`fileLogger`,`File logger`).replace(`matterLoggerLevel`,`Matter logger level`).replace(`matterFileLogger`,`Matter file logger`).replace(`restartRequired`,`Restart required`).replace(`updateRequired`,`Update required`)}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&t?typeof n==`string`?n:n.toString():(0,J.jsx)(Or,{value:typeof n==`string`?n:n.toString(),maxChars:24})})]},e))})]})})]}))}var Ar=(0,W.memo)(kr),jr={margin:`0px`,padding:`0px`,color:`var(--div-text-color)`,transition:`color 0.2s ease`,"& svg":{display:`block`},"& svg path":{fill:`var(--div-text-color)`,transition:`fill 0.2s ease`},"&:hover":{color:`var(--primary-color)`},"&:hover svg path":{fill:`var(--primary-color)`},"&:focus-visible":{outline:`2px solid var(--primary-color)`,outlineOffset:`2px`}},Mr=e=>{if(!e)return``;let t=e.replace(/[^0-9]/g,``);return t.length<5?t:[t.slice(0,4),t.slice(4,7),t.slice(7,11)].filter(Boolean).join(`-`)};function Nr({id:e}){let{online:t,sendMessage:n,addListener:r,removeListener:i,getUniqueId:a}=(0,W.useContext)(Y),[o,s]=(0,W.useState)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(a()),{mobile:d,showConfirmCancelDialog:f}=(0,W.useContext)(Wt);K&&console.log(`QRDiv loading with id = "${e}" storeId = "${c.current}" timeout = ${l.current?`set`:`none`} and matter:`,o),(0,W.useEffect)(()=>{K&&console.log(`QRDiv id effect "${e}"`),c.current=e,l.current&&clearTimeout(l.current),l.current=null,e?(K&&console.log(`QRDiv id effect sending data request for storeId "${e}"`),n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:e,server:!0}})):(K&&console.log(`QRDiv id effect setting matter to null`),s(null))},[e,n]),(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`QRDiv received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`matter`&&e.response.matter&&(K&&console.log(`QRDiv received refresh_required: changed=${e.response.changed} for storeId "${e.response.matter.id}":`,e.response.matter),c.current===e.response.matter.id&&(K&&console.log(`QRDiv received refresh_required/matter: setting matter data for storeId "${e.response.matter.id}":`,e.response.matter),l.current&&clearTimeout(l.current),s(e.response.matter)))};return r(e,u.current),K&&console.log(`QRDiv webSocket effect mounted`),()=>{i(e),l.current&&clearTimeout(l.current),l.current=null,K&&console.log(`QRDiv webSocket effect unmounted`)}},[r,i]);let p=()=>{K&&console.log(`QRDiv sent matter startCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,startCommission:!0}})},m=()=>{K&&console.log(`QRDiv sent matter stopCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,stopCommission:!0}})},h=()=>{K&&console.log(`QRDiv sent matter advertise for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,advertise:!0}})},g=e=>{K&&console.log(`QRDiv sent matter removeFabric for node "${o?.id}" and fabricIndex ${e}`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,removeFabric:e}})};return!o||!t?(K&&console.log(`QRDiv rendering undefined state`),null):o.online?o.advertising&&o.qrPairingCode&&o.manualPairingCode?(K&&console.log(`QRDiv rendering advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`QR pairing code`}),(0,J.jsxs)($t,{children:[(0,J.jsx)(T,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:ft,size:`22px`})})}),(0,J.jsx)(T,{"aria-label":`stop pairing`,size:`small`,onClick:m,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Turn off pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:_t,size:`22px`})})})]})]}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(At,{value:o.qrPairingCode,size:256,level:`M`,fgColor:`var(--div-text-color)`,bgColor:`var(--div-bg-color)`,style:{margin:`20px`}}),(0,J.jsxs)(Yt,{style:{justifyContent:`space-between`},children:[(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,color:`var(--div-text-color)`},children:[`Manual pairing code: `,Mr(o.manualPairingCode)]}),(0,J.jsx)($t,{children:(0,J.jsx)(z,{title:`Copy manual pairing code`,arrow:!0,children:(0,J.jsx)(T,{"aria-label":`copy manual pairing code`,size:`small`,onClick:async()=>{if(!o||!o.manualPairingCode)return;let e=o.manualPairingCode;try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}K&&console.log(`Manual pairing code copied to clipboard`)}catch(e){console.error(`Failed to copy manual pairing code`,e)}},sx:jr,children:(0,J.jsx)(X.Icon,{path:ht,size:.85})})})})]})]})):o.commissioned&&o.fabricInformations&&o.sessionInformations?(K&&console.log(`QRDiv rendering commissioned state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`,overflow:`hidden`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`Paired fabrics`}),(0,J.jsxs)($t,{children:[(0,J.jsx)(T,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:ft,size:`22px`})})}),(0,J.jsx)(T,{"aria-label":`start pairing`,size:`small`,onClick:p,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(z,{title:`Turn on pairing`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:vt,size:`22px`})})})]})]}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(Qt,{style:{flexDirection:`column`,justifyContent:`flex-start`,flex:`1 1 auto`,overflow:`auto`,padding:`0px 0px 10px 0px`,gap:`0px`},children:o.fabricInformations.map((e,t)=>(0,J.jsxs)(`div`,{style:{margin:`0px`,padding:`10px`,gap:`0px`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,textAlign:`left`,fontSize:`14px`},children:[(0,J.jsxs)(`div`,{style:{marginLeft:`20px`,marginBottom:`10px`,display:`flex`,flexDirection:`row`,justifyContent:`space-between`,gap:`20px`,alignItems:`center`},children:[(0,J.jsxs)(`p`,{className:`status-blue`,style:{margin:`0px`,padding:`3px 10px`,width:`200px`,fontSize:`14px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},children:[`Fabric: `,e.fabricIndex]}),(0,J.jsx)(z,{title:`Remove the fabric. You will also need to remove it from the controller.`,arrow:!0,children:(0,J.jsx)(T,{"aria-label":`remove the fabric`,size:`small`,onClick:()=>f(`Remove fabric`,`Are you sure you want to remove this fabric? You will also need to remove it from the controller.`,`RemoveFabric`,()=>g(e.fabricIndex),()=>{}),sx:{...jr,padding:`2px`},children:(0,J.jsx)(X.Icon,{path:dt,size:1})})})]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Vendor: `,e.rootVendorId,` `,e.rootVendorName]}),e.label!==``&&(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Label: `,e.label]}),(0,J.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Sessions: `,o.sessionInformations?o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive).length:`0`,` `,`subscriptions: `,o.sessionInformations?o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive&&t.numberOfActiveSubscriptions>0).length:`0`]})]},t))}),(0,J.jsx)(Yt,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):!o.commissioned&&!o.advertising?(K&&console.log(`QRDiv rendering not commissioned and not advertising state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`QR pairing code`})}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(U,{onClick:p,endIcon:(0,J.jsx)(X.Icon,{path:vt,size:1}),style:{margin:`20px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`,minWidth:`90px`},children:`Turn on pairing`}),(0,J.jsx)(Yt,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]})):(K&&console.log(`QRDiv rendering unknown state`),null):(K&&console.log(`QRDiv rendering offline state`),(0,J.jsxs)(Z,{style:q&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,J.jsx)(Jt,{style:{height:`30px`,justifyContent:`space-between`},children:(0,J.jsx)(Q,{children:`Server node`})}),(0,J.jsx)(Zt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,J.jsx)(Zt,{style:{fontWeight:`bold`},children:`Server offline`}),(0,J.jsx)(Yt,{style:{justifyContent:`center`,height:`auto`,minHeight:`30px`},children:(0,J.jsxs)(Xt,{style:{fontWeight:`normal`,overflowWrap:`anywhere`,textAlign:`center`},children:[`Serial number: `,o.serialNumber]})})]}))}var Pr=(0,W.memo)(Nr);function Fr({systemInfo:e,compact:t}){let{mobile:n}=(0,W.useContext)(Wt),{addListener:r,removeListener:i,getUniqueId:a,sendMessage:o}=(0,W.useContext)(Y),[s,c]=(0,W.useState)(e),l=(0,W.useRef)(a());if(K&&console.log(`SystemInfoTable loading with systemInfo:`,s,`compact:`,t),e&&t&&s.totalMemory&&s.freeMemory){let e=s.totalMemory;s.freeMemory=`${s.freeMemory} / ${e}`,s.totalMemory=``}if(e&&t&&s.heapTotal&&s.heapUsed){let e=s.heapTotal;s.heapUsed=`${s.heapUsed} / ${e}`,s.heapTotal=``}e&&t&&s.osRelease&&s.osType&&(s.osType=`${s.osType} (${s.osRelease})`,s.osRelease=``),e&&t&&s.osArch&&s.osPlatform&&(s.osPlatform=`${s.osPlatform} (${s.osArch})`,s.osArch=``);let u=(e,t,n,r,i)=>{c(a=>({...a,totalMemory:e,freeMemory:t,heapTotal:n,heapUsed:r,rss:i}))},d=e=>{c(t=>({...t,cpuUsage:e.toFixed(2)+` %`}))},f=e=>{c(t=>({...t,processCpuUsage:e.toFixed(2)+` %`}))},p=(e,t)=>{c(n=>({...n,systemUptime:e,processUptime:t}))},m=()=>{K&&console.log(`SystemInfoTable handleViewHistory clicked`),o({id:l.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}})};(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`SystemInfoTable received WebSocket Message:`,e),e.method===`memory_update`&&e.response&&e.response.totalMemory&&e.response.freeMemory&&e.response.heapTotal&&e.response.heapUsed&&e.response.rss?(K&&console.log(`SystemInfoTable received memory_update`,e),u(e.response.totalMemory,e.response.freeMemory,e.response.heapTotal,e.response.heapUsed,e.response.rss)):e.method===`cpu_update`&&e.response&&e.response.cpuUsage?(K&&console.log(`SystemInfoTable received cpu_update`,e),d(e.response.cpuUsage),f(e.response.processCpuUsage)):e.method===`uptime_update`&&e.response&&e.response.systemUptime&&e.response.processUptime?(K&&console.log(`SystemInfoTable received uptime_update`,e),p(e.response.systemUptime,e.response.processUptime)):e.method===`/api/viewhistorypage`&&e.id===l.current&&e.success&&(K&&console.log(`SystemInfoTable received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`))};return r(e,l.current),K&&console.log(`SystemInfoTable added WebSocket listener id ${l.current}`),()=>{i(e),K&&console.log(`SystemInfoTable removed WebSocket listener`)}},[r,i]);let[h,g]=(0,W.useState)(!1);return!s||h?null:(K&&console.log(`SystemInfoTable rendering...`),(0,J.jsxs)(Z,{style:q&&n?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,J.jsxs)(Jt,{children:[(0,J.jsx)(Q,{children:`System info`}),(0,J.jsx)($t,{close:()=>g(!0),children:(0,J.jsx)(T,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:m,children:(0,J.jsx)(z,{title:`Open the cpu and memory usage page`,arrow:!0,children:(0,J.jsx)(X.Icon,{path:pt,size:`22px`})})})})]}),(0,J.jsx)(Qt,{style:q&&n?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,J.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{style:{width:`40%`}}),(0,J.jsx)(`col`,{style:{width:`60%`}})]}),(0,J.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(s).filter(([e,t])=>e!==`bunVersion`&&t!==void 0&&t!==``).map(([e,t],r)=>(0,J.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e.replace(`interfaceName`,`Interface name`).replace(`macAddress`,`Mac address`).replace(`ipv4Address`,`IPv4 address`).replace(`ipv6Address`,`IPv6 address`).replace(`nodeVersion`,`Node version`).replace(`bunVersion`,`Bun version`).replace(`hostname`,`Hostname`).replace(`user`,`User`).replace(`osType`,`Os`).replace(`osPlatform`,`Platform`).replace(`freeMemory`,`Memory`).replace(`systemUptime`,`System uptime`).replace(`processUptime`,`Process uptime`).replace(`cpuUsage`,`Host CPU`).replace(`processCpuUsage`,`Process CPU`).replace(`rss`,`Rss`).replace(`heapUsed`,`Heap`)}),(0,J.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:q&&n?typeof t==`string`?t:t.toString():(0,J.jsx)(Or,{value:typeof t==`string`?t:t.toString(),maxChars:22})})]},e))})]})})]}))}var Ir=(0,W.memo)(Fr);function Lr(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)([]),[o]=(0,W.useState)(localStorage.getItem(G.homePagePlugins)!==`false`),[s,c]=(0,W.useState)(localStorage.getItem(G.homePageMode)??`devices`),[l,u]=(0,W.useState)(`https://matterbridge.io/CHANGELOG.html`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(null),{mobile:_}=(0,W.useContext)(Wt),{addListener:v,removeListener:y,online:b,sendMessage:x,getUniqueId:S}=(0,W.useContext)(Y),C=(0,W.useRef)(S());return(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`Home received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Home received refresh_required: changed=${e.response.changed} and sending /api/settings request`),g(null),a([]),x({id:C.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),x({id:C.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`&&(K&&console.log(`Home received update_required`,e.response),e.response.devVersion?r(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):r(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)),e.method===`/api/settings`&&e.id===C.current?(K&&console.log(`Home received settings:`,e.response),t(e.response.systemInformation),r(e.response.matterbridgeInformation),localStorage.getItem(G.frontendVersion)===null&&e.response.matterbridgeInformation.frontendVersion?localStorage.setItem(G.frontendVersion,e.response.matterbridgeInformation.frontendVersion):e.response.matterbridgeInformation.frontendVersion!==localStorage.getItem(G.frontendVersion)&&e.response.matterbridgeInformation.frontendVersion&&(localStorage.setItem(G.frontendVersion,e.response.matterbridgeInformation.frontendVersion),m(!0)),localStorage.getItem(G.matterbridgeVersion)===null?localStorage.setItem(G.matterbridgeVersion,e.response.matterbridgeInformation.matterbridgeVersion):e.response.matterbridgeInformation.matterbridgeVersion!==localStorage.getItem(G.matterbridgeVersion)&&(localStorage.setItem(G.matterbridgeVersion,e.response.matterbridgeInformation.matterbridgeVersion),f(!0)),e.response.matterbridgeInformation.shellyBoard&&(localStorage.getItem(G.homePageMode)||(localStorage.setItem(G.homePageMode,`devices`),c(`devices`)))):e.method===`/api/plugins`&&e.id===C.current&&(K&&console.log(`Home received plugins:`,e.response),a(e.response))};return v(e,C.current),K&&console.log(`Home added WebSocket listener id ${C.current}`),()=>{y(e),K&&console.log(`Home removed WebSocket listener`)}},[v,y,x]),(0,W.useEffect)(()=>{if(K&&console.log(`Home storeId effect with storeId ${h}`),n?.bridgeMode===`bridge`&&!h&&(K&&console.log(`Home storeId effect set storeId to Matterbridge`),g(`Matterbridge`)),n?.bridgeMode===`childbridge`&&!h&&i){for(let e of i)if(e.matter?.id){K&&console.log(`Home storeId effect set storeId to ${e.matter.id}`),g(e.matter.id);break}}},[n,i,h]),(0,W.useEffect)(()=>{b&&(K&&console.log(`Home online effect, sending /api/settings and /api/plugins requests`),x({id:C.current,sender:`Home`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),x({id:C.current,sender:`Home`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[b,x]),K&&console.log(`Home rendering...`),!b||!e||!n?(0,J.jsx)(qt,{}):(0,J.jsxs)(jn,{name:`Home`,style:q&&_?{alignItems:`center`,gap:`10px`}:{flexDirection:`row`},children:[(q&&!_||!q)&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`302px`,minWidth:`302px`,gap:`20px`},children:[(0,J.jsx)(Pr,{id:h}),(0,J.jsx)(Ir,{systemInfo:e,compact:!0})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`,gap:q&&_?`10px`:`20px`},children:[p&&(0,J.jsx)(Fn,{version:n.frontendVersion}),d&&(0,J.jsx)(Dr,{version:n.matterbridgeVersion,changelog:l}),q&&_&&(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:`10px`},children:[(0,J.jsx)(Pr,{id:h}),(0,J.jsx)(Ir,{systemInfo:e,compact:!0}),(0,J.jsx)(Ar,{matterbridgeInfo:n})]}),o&&!n.readOnly&&(0,J.jsx)(Qn,{}),o&&(0,J.jsx)(Tr,{storeId:h,setStoreId:g}),s===`devices`&&(0,J.jsx)(zn,{storeId:h,setStoreId:g}),s===`logs`&&(0,J.jsx)(rr,{})]})]})}var Rr=(0,W.memo)(Lr);function zr(){let{logLength:e,logAutoScroll:t,setMessages:n,setLogFilterLevel:r,setLogFilterSearch:i,online:a,filterLogMessages:o}=(0,W.useContext)(Y),[s,c]=(0,W.useState)(localStorage.getItem(G.logFilterLevel)??`info`),[l,u]=(0,W.useState)(localStorage.getItem(G.logFilterSearch)??`*`),[f,p]=(0,W.useState)(e.current.toString()),[m,h]=(0,W.useState)(t.current);return K&&console.log(`Logs rendering...`),a?(0,J.jsxs)(jn,{name:`Logs`,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,margin:`0px`,padding:`0px`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(ue,{id:`select-level`,style:{color:`var(--div-text-color)`},children:`Filter log by level:`}),(0,J.jsxs)(L,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-level`,id:`debug-level`,value:s,onChange:e=>{let t=e.target.value;c(t),r(t),o(t,l),localStorage.setItem(G.logFilterLevel,t),K&&console.log(`handleLogFilterLevelChange called with value:`,t)},children:[(0,J.jsx)(B,{value:`debug`,children:`Debug`}),(0,J.jsx)(B,{value:`info`,children:`Info`}),(0,J.jsx)(B,{value:`notice`,children:`Notice`}),(0,J.jsx)(B,{value:`warn`,children:`Warn`}),(0,J.jsx)(B,{value:`error`,children:`Error`}),(0,J.jsx)(B,{value:`fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`5px`},children:[(0,J.jsx)(ue,{id:`search`,style:{color:`var(--div-text-color)`},children:`Filter log by text:`}),(0,J.jsx)(z,{title:`Use /text/ for case-insensitive regex search`,children:(0,J.jsx)(V,{style:{width:`210px`},size:`small`,id:`logsearch`,variant:`outlined`,value:l,onChange:e=>{let t=e.target.value;u(t),i(t),o(s,t),localStorage.setItem(G.logFilterSearch,t),K&&console.log(`handleLogFilterSearchChange called with value:`,t)},slotProps:{input:{style:{height:`30px`,padding:`0 0px`,backgroundColor:`var(--main-bg-color)`}}}})})]}),(0,J.jsx)(d,{control:(0,J.jsx)(oe,{checked:m,onChange:e=>{let n=e.target.checked;h(n),t.current=n,o(s,l),localStorage.setItem(G.logAutoScroll,n?`true`:`false`),K&&console.log(`handleAutoScrollChange called with value:`,n)}}),label:`Auto scroll`,style:{color:`var(--div-text-color)`}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(ue,{id:`select-size-label`,style:{color:`var(--div-text-color)`},children:`Log length:`}),(0,J.jsxs)(L,{style:{height:`30px`,backgroundColor:`var(--main-bg-color)`},labelId:`select-size-label`,id:`select-size`,value:f,onChange:t=>{let n=t.target.value;p(n),e.current=Number(n),localStorage.setItem(G.logLength,n),K&&console.log(`handleLogLengthChange called with value:`,n)},children:[(0,J.jsx)(B,{value:100,children:`100`}),(0,J.jsx)(B,{value:200,children:`200`}),(0,J.jsx)(B,{value:500,children:`500`}),(0,J.jsx)(B,{value:1e3,children:`1000`})]}),(0,J.jsx)(z,{title:`Clear the logs`,children:(0,J.jsx)(U,{onClick:()=>{K&&console.log(`handleClearLogsClick called`),n([])},endIcon:(0,J.jsx)(Ae,{}),style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Clear`})})]})]}),(0,J.jsx)(`div`,{style:{flex:`1`,overflow:`auto`,margin:`0px`,padding:`0px`},children:(0,J.jsx)(tr,{})})]}):(0,J.jsx)(qt,{})}var Br=(0,W.memo)(zr),Vr=1200,Hr,Ur;function Wr(e,t){Hr=e,Ur=t}function Gr(){let{mobile:e,showSnackbarMessage:t,showConfirmCancelDialog:n}=(0,W.useContext)(Wt),{online:i,sendMessage:a,logMessage:o,addListener:c,removeListener:l,getUniqueId:d}=(0,W.useContext)(Y),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[_,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(null),[w,E]=(0,W.useState)(`inactive`),D=(0,W.useRef)(d()),[O,k]=(0,W.useState)(null),[A,j]=(0,W.useState)(null),[M,N]=(0,W.useState)(null),[te,P]=(0,W.useState)(null),ne=r(),F=()=>{window.open(`https://www.buymeacoffee.com/luligugithub`,`_blank`)},re=()=>{window.open(`https://matterbridge.io/`)},I=()=>{window.open(`https://matterbridge.io/README.html`)},ie=()=>{window.open(`https://matterbridge.io/CHANGELOG.html`)},ae=()=>{window.open(`https://discord.gg/QX58CDe6hd`,`_blank`)},oe=()=>{window.open(`https://github.com/Luligu/matterbridge`,`_blank`)},se=()=>{a({id:D.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge`,restart:!0}}),y(!1)},ce=()=>{a({id:D.current,sender:`Header`,method:`/api/install`,src:`Frontend`,dst:`Matterbridge`,params:{packageName:`matterbridge@dev`,restart:!0}}),x(!1)},ue=()=>{a({id:D.current,sender:`Header`,method:`/api/checkupdates`,src:`Frontend`,dst:`Matterbridge`,params:{}})},de=()=>{K&&console.log(`Header: handleShellySystemUpdateClick`),o(`Matterbridge`,`Installing system updates...`),a({id:D.current,sender:`Header`,method:`/api/shellysysupdate`,src:`Frontend`,dst:`Matterbridge`,params:{}})},fe=()=>{K&&console.log(`Header: handleShellyMainUpdateClick`),o(`Matterbridge`,`Installing software updates...`),a({id:D.current,sender:`Header`,method:`/api/shellymainupdate`,src:`Frontend`,dst:`Matterbridge`,params:{}})},pe=()=>{K&&console.log(`Header: handleShellyCreateSystemLog`),a({id:D.current,sender:`Header`,method:`/api/shellycreatesystemlog`,src:`Frontend`,dst:`Matterbridge`,params:{}})},me=()=>{K&&console.log(`Header: handleShellyDownloadSystemLog`),o(`Matterbridge`,`Downloading Shelly system log...`),t(`Downloading Shelly system log...`,5),window.location.href=`./api/shellydownloadsystemlog`},he=()=>{S?.matterbridgeInformation.restartMode===`none`?a({id:D.current,sender:`Header`,method:`/api/restart`,src:`Frontend`,dst:`Matterbridge`,params:{}}):a({id:D.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ge=()=>{a({id:D.current,sender:`Header`,method:`/api/shutdown`,src:`Frontend`,dst:`Matterbridge`,params:{}})},_e=()=>{a({id:D.current,sender:`Header`,method:`/api/reboot`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ve=()=>{a({id:D.current,sender:`Header`,method:`/api/softreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},ye=()=>{a({id:D.current,sender:`Header`,method:`/api/hardreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},be=e=>{k(e.currentTarget)},L=e=>{K&&console.log(`Header: handleMenuClose`,e),k(null),e===`/`||e===`/devices`||e===`/log`||e===`/settings`?ne(e):e===`reset_frontend`?(o(`Matterbridge`,`Resetting frontend UI...`),t(`Resetting frontend UI...`,5),Nt(),window.location.reload()):e===`download-mblog`?(o(`Matterbridge`,`Downloading matterbridge log...`),t(`Downloading matterbridge log...`,5),window.location.href=`./api/download-mblog`):e===`download-mjlog`?(o(`Matterbridge`,`Downloading matter log...`),t(`Downloading matter log...`,5),window.location.href=`./api/download-mjlog`):e===`view-mblog`?(o(`Matterbridge`,`Loading matterbridge log...`),t(`Loading matterbridge log...`,5),window.open(`./api/view-mblog`,`_blank`,`noopener,noreferrer`)):e===`view-mjlog`?(o(`Matterbridge`,`Loading matter log...`),t(`Loading matter log...`,5),window.open(`./api/view-mjlog`,`_blank`,`noopener,noreferrer`)):e===`view-diagnostic`?(o(`Matterbridge`,`Loading diagnostic log...`),t(`Loading diagnostic log...`,5),window.open(`./api/view-diagnostic`,`_blank`,`noopener,noreferrer`)):e===`download-diagnostic`?(o(`Matterbridge`,`Downloading diagnostic log...`),t(`Downloading diagnostic log...`,5),window.location.href=`./api/download-diagnostic`):e===`view-history`?a({id:D.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`download-history`?a({id:D.current,sender:`Header`,method:`/api/downloadhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`view-shellylog`?(o(`Matterbridge`,`Loading shelly system log...`),t(`Loading shelly system log...`,5),window.location.href=`./api/shellyviewsystemlog`):e===`download-mbstorage`?(o(`Matterbridge`,`Downloading matterbridge storage...`),t(`Downloading matterbridge storage...`,5),window.location.href=`./api/download-mbstorage`):e===`download-pluginstorage`?(o(`Matterbridge`,`Downloading matterbridge plugins storage...`),t(`Downloading matterbridge plugins storage...`,5),window.location.href=`./api/download-pluginstorage`):e===`download-pluginconfig`?(o(`Matterbridge`,`Downloading matterbridge plugins config...`),t(`Downloading matterbridge plugins config...`,5),window.location.href=`./api/download-pluginconfig`):e===`download-mjstorage`?(o(`Matterbridge`,`Downloading matter storage...`),t(`Downloading matter storage...`,5),window.location.href=`./api/download-mjstorage`):e===`download-backup`?(o(`Matterbridge`,`Downloading backup...`),t(`Downloading backup...`,10),window.location.href=`./api/download-backup`):e===`update`?se():e===`updatedev`?ce():e===`updatecheck`?ue():e===`shelly-sys-update`?de():e===`shelly-main-update`?fe():e===`shelly-create-system-log`?pe():e===`shelly-download-system-log`?me():e===`softreset`?ve():e===`hardreset`?ye():e===`restart`?he():e===`shutdown`?ge():e===`reboot`?_e():e===`create-backup`?a({id:D.current,sender:`Header`,method:`/api/create-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matterbridge-storage-backup`?a({id:D.current,sender:`Header`,method:`/api/create-matterbridge-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-matter-storage-backup`?a({id:D.current,sender:`Header`,method:`/api/create-matter-storage-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-plugin-backup`?a({id:D.current,sender:`Header`,method:`/api/create-plugin-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`create-config-backup`?a({id:D.current,sender:`Header`,method:`/api/create-config-backup`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`unregister`?a({id:D.current,sender:`Header`,method:`/api/unregister`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`reset`?a({id:D.current,sender:`Header`,method:`/api/reset`,src:`Frontend`,dst:`Matterbridge`,params:{}}):e===`factoryreset`&&a({id:D.current,sender:`Header`,method:`/api/factoryreset`,src:`Frontend`,dst:`Matterbridge`,params:{}})},Se=e=>{K&&console.log(`Header: handleMenuCloseCancel:`,e),k(null)},Ce=e=>{j(e.currentTarget)},we=()=>{j(null)},Te=e=>{N(e.currentTarget)},Ee=()=>{N(null)},De=e=>{P(e.currentTarget)},Oe=()=>{P(null)};return(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`Header received WebSocket Message:`,e),e.method===`/api/settings`&&e.id===D.current?(K&&console.log(`Header received settings:`,e.response),C(e.response),p(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired),h(e.response.matterbridgeInformation.fixedRestartRequired),y(e.response.matterbridgeInformation.updateRequired),E(e.response.matterbridgeInformation.bridgeStatus)):e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Header received refresh_required: changed=${e.response.changed} and sending /api/settings request`),a({id:D.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`restart_required`?(K&&console.log(`Header received restart_required with fixed: ${e.response.fixed}`),p(!0),e.response.fixed&&h(!0)):e.method===`restart_not_required`?(K&&console.log(`Header received restart_not_required`),p(!1)):e.method===`matterbridge_status_update`?(K&&console.log(`Header received matterbridge_status_update: ${e.response.status}`),E(e.response.status)):e.method===`update_required`?(K&&console.log(`Header received update_required`),e.response.devVersion?(C(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeDevVersion:e.response.version}}:null),x(!0)):(C(t=>t?{...t,matterbridgeInformation:{...t.matterbridgeInformation,matterbridgeLatestVersion:e.response.version}}:null),y(!0))):e.method===`shelly_sys_update`?(K&&console.log(`Header received WS_ID_SHELLY_SYS_UPDATE:`),C(t=>t?{matterbridgeInformation:{...t.matterbridgeInformation,shellySysUpdate:e.response.available},systemInformation:t.systemInformation}:null)):e.method===`shelly_main_update`?(K&&console.log(`Header received WS_ID_SHELLY_MAIN_UPDATE:`),C(t=>t?{matterbridgeInformation:{...t.matterbridgeInformation,shellyMainUpdate:e.response.available},systemInformation:t.systemInformation}:null)):e.method===`/api/viewhistorypage`&&e.id===D.current&&e.success?(K&&console.log(`Header received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`)):e.method===`/api/downloadhistorypage`&&e.id===D.current&&e.success?(K&&console.log(`Header received /api/downloadhistorypage success`),window.location.href=`./api/downloadhistory`):e.method===`archive`&&e.success&&e.response.command===`zip`&&(K&&console.log(`Header received archive success response for zip command`,e.response),e.response.archivePath.endsWith(`matterbridge.backup.zip`)?window.location.href=`./api/download-backup`:e.response.archivePath.endsWith(`matterbridge.storage.zip`)?window.location.href=`./api/download-mbstorage`:e.response.archivePath.endsWith(`matterbridge.matterstorage.zip`)?window.location.href=`./api/download-mjstorage`:e.response.archivePath.endsWith(`matterbridge.pluginstorage.zip`)?window.location.href=`./api/download-pluginstorage`:e.response.archivePath.endsWith(`matterbridge.pluginconfig.zip`)&&(window.location.href=`./api/download-pluginconfig`))};return c(e,D.current),K&&console.log(`Header added WebSocket listener id ${D.current}`),()=>{l(e),K&&console.log(`Header removed WebSocket listener`)}},[c,l,a,t]),(0,W.useEffect)(()=>{i&&(K&&console.log(`Header sending /api/settings and /api/checkupdates requests`),a({id:D.current,sender:`Header`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[i,a]),K&&console.log(`Header rendering... mobile %s`,e),!i||!S?null:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(T,{style:{margin:`0`,padding:`0`},onClick:()=>{Pt(),K&&console.log(`Matterbridge logo clicked: debug is now`,K)},children:(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`30px`}})}),(0,J.jsx)(`h2`,{style:{fontSize:`22px`,color:`var(--main-icon-color)`,margin:`0px`},children:`Matterbridge`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:(0,J.jsxs)(`nav`,{children:[(0,J.jsx)(s,{to:`/`,className:`nav-link`,children:`Home`}),(0,J.jsx)(s,{to:`/devices`,className:`nav-link`,children:`Devices`}),(0,J.jsx)(s,{to:`/log`,className:`nav-link`,children:`Logs`}),(0,J.jsx)(s,{to:`/settings`,className:`nav-link`,children:`Settings`})]})})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`10px`},children:[!S.matterbridgeInformation.readOnly&&(0,J.jsx)(z,{title:`Matterbridge v.${S.matterbridgeInformation.matterbridgeVersion}`,children:(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:_?`var(--primary-color)`:b?`var(--secondary-color)`:`green`},children:[`v.`,S.matterbridgeInformation.matterbridgeVersion.split(`-`)[0]+(S.matterbridgeInformation.matterbridgeVersion.includes(`-dev-`)?`@dev`:``)+(S.matterbridgeInformation.matterbridgeVersion.includes(`-edge-`)?`@edge`:``)+(S.matterbridgeInformation.matterbridgeVersion.includes(`-local-`)?`@local`:``)+(S.matterbridgeInformation.matterbridgeVersion.includes(`-git-`)?`@git`:``)]})}),S.matterbridgeInformation.shellyBoard&&(0,J.jsx)(`img`,{src:`Shelly.svg`,alt:`Shelly Icon`,style:{height:`30px`,padding:`0px`,margin:`0px`,marginRight:`30px`}}),S.matterbridgeInformation.bridgeMode!==`none`&&!S.matterbridgeInformation.readOnly?(0,J.jsx)(z,{title:`Bridge mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:w===`started`?`green`:w===`error`?`red`:void 0},children:S.matterbridgeInformation.bridgeMode})}):null,S.matterbridgeInformation.restartMode!==`none`&&!S.matterbridgeInformation.readOnly?(0,J.jsx)(z,{title:`Restart mode`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:S.matterbridgeInformation.restartMode})}):null,S.systemInformation.bunVersion?(0,J.jsx)(z,{title:`Bun version`,children:(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:[`bun v.`,S.systemInformation.bunVersion]})}):null,S.matterbridgeInformation.profile&&S.matterbridgeInformation.profile!==``&&!S.matterbridgeInformation.readOnly?(0,J.jsx)(z,{title:`Current profile`,children:(0,J.jsx)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:S.matterbridgeInformation.profile})}):null,K&&(0,J.jsxs)(`span`,{className:`status-information`,style:{cursor:`default`,backgroundColor:`green`},children:[e?`Mobile `:`Desktop `,`${Hr}x${Ur}`,` enabled ${localStorage.getItem(G.enableMobile)!==`false`}`]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignItems:`center`,gap:`5px`},children:[S.matterbridgeInformation.readOnly?null:(0,J.jsx)(z,{title:`Matterbridge discord group`,children:(0,J.jsx)(T,{style:{margin:`0`,padding:`0`},onClick:ae,children:(0,J.jsx)(`img`,{src:`discord.svg`,alt:`Discord Logo`,style:{height:`25px`}})})}),S.matterbridgeInformation.readOnly?null:(0,J.jsx)(z,{title:`Give a star to Matterbridge`,children:(0,J.jsx)(T,{style:{color:`#FFD700`,margin:`0`,padding:`0`},onClick:oe,children:(0,J.jsx)(Ze,{})})}),S.matterbridgeInformation.readOnly?null:(0,J.jsx)(z,{title:`Sponsor Matterbridge`,children:(0,J.jsx)(T,{style:{color:`#b6409c`,margin:`0`,padding:`0`},onClick:F,children:(0,J.jsx)(at,{})})}),(0,J.jsx)(z,{title:`Matterbridge homepage`,children:(0,J.jsx)(T,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:re,children:(0,J.jsx)(le,{})})}),(0,J.jsx)(z,{title:`Matterbridge help`,children:(0,J.jsx)(T,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:I,children:(0,J.jsx)(g,{})})}),(0,J.jsx)(z,{title:`Matterbridge changelog`,children:(0,J.jsx)(T,{style:{color:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ie,children:(0,J.jsx)(v,{})})}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&_&&(0,J.jsx)(z,{title:`Update matterbridge to latest version v.${S.matterbridgeInformation.matterbridgeLatestVersion}`,children:(0,J.jsx)(T,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:se,children:(0,J.jsx)(ct,{})})}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&b&&(0,J.jsx)(z,{title:`Update matterbridge to latest dev version v.${S.matterbridgeInformation.matterbridgeDevVersion}`,children:(0,J.jsx)(T,{style:{color:`var(--secondary-color)`,margin:`0`,marginLeft:`5px`,padding:`0`},onClick:ce,children:(0,J.jsx)(ct,{})})}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellySysUpdate&&(0,J.jsx)(z,{title:`Shelly system update`,children:(0,J.jsx)(T,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:de,children:(0,J.jsx)(ct,{})})}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellyMainUpdate&&(0,J.jsx)(z,{title:`Shelly software update`,children:(0,J.jsx)(T,{style:{color:`var(--primary-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:fe,children:(0,J.jsx)(ct,{})})}),(0,J.jsx)(z,{title:`Restart matterbridge`,children:(0,J.jsx)(T,{style:{color:f||m?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:he,children:(0,J.jsx)(st,{})})}),S.matterbridgeInformation.restartMode===`none`?(0,J.jsx)(z,{title:`Shut down matterbridge`,children:(0,J.jsx)(T,{style:{color:f||m?`var(--primary-color)`:`var(--main-icon-color)`,margin:`0`,marginLeft:`5px`,padding:`0px`},onClick:ge,children:(0,J.jsx)(xe,{})})}):null,(0,J.jsx)(z,{title:`Download, backup and more`,children:(0,J.jsx)(T,{onClick:be,children:(0,J.jsx)(Ge,{style:{color:`var(--main-icon-color)`}})})}),(0,J.jsxs)(lt,{id:`command-menu`,anchorEl:O,keepMounted:!0,open:!!O,onClose:()=>L(``),children:[q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Home page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/devices`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Devices page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/log`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Logs page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),q&&e&&(0,J.jsxs)(B,{onClick:()=>L(`/settings`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Settings page`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>L(`update`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Install latest stable`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>L(`updatedev`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Install latest dev`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>L(`updatecheck`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Check for updates`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellySysUpdate&&(0,J.jsxs)(B,{onClick:()=>L(`shelly-sys-update`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shelly system update`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&S.matterbridgeInformation.shellyMainUpdate&&(0,J.jsxs)(B,{onClick:()=>L(`shelly-main-update`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(ct,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shelly software update`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>L(`restart`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(st,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Restart`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation.restartMode===`none`?(0,J.jsxs)(B,{onClick:()=>L(`shutdown`),children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shutdown`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}):null,S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{n(`Reboot`,`Are you sure you want to reboot the Shelly board?`,`reboot`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(st,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reboot...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:Ce,children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`View`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(lt,{id:`sub-menu-view`,anchorEl:A,keepMounted:!0,open:!!A,onClose:we,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(B,{onClick:()=>{It(),we(),Se(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Desktop site`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{Ft(),we(),Se(``),window.open(`/home`,`_self`)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Mobile site`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-mblog`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-mjlog`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matter log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-diagnostic`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge diagnostic log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`view-history`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge system history`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{L(`view-shellylog`),we()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ue,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Shelly system log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:Te,children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Download`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(lt,{id:`sub-menu-download`,anchorEl:M,keepMounted:!0,open:!!M,onClose:Ee,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(B,{onClick:()=>{L(`create-matterbridge-storage-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge storage`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`create-plugin-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge plugins storage`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`create-config-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge plugins config`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-mblog`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`create-matter-storage-backup`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matter storage`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-mjlog`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matter log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-diagnostic`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge diagnostic log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{L(`download-history`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Matterbridge system history`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{L(`shelly-create-system-log`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Create Shelly system log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{L(`shelly-download-system-log`),Ee()},children:[(0,J.jsx)(H,{children:(0,J.jsx)(u,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Download Shelly system log`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:()=>{L(`create-backup`)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ye,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Backup`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsx)(ee,{}),(0,J.jsxs)(B,{onClick:De,children:[(0,J.jsx)(H,{children:(0,J.jsx)(Ne,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(lt,{id:`sub-menu-reset`,anchorEl:te,keepMounted:!0,open:!!te,onClose:Oe,sx:{"& .MuiPaper-root":{backgroundColor:`#e2e2e2`}},children:[(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Reset the frontend UI`,`Are you sure you want to reset the frontend UI? This will reset all local settings and reload the page.`,`reset_frontend`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset the frontend UI...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Reset all devices and shutdown`,`Are you sure you want to unregister all devices? This will temporarily remove all devices from the controller and you may loose the controller configuration.`,`unregister`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset all devices...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Reset commissioning and shutdown`,`Are you sure you want to reset the commissioning? You will have to manually remove Matterbridge from the controller.`,`reset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset commissioning...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),!S.matterbridgeInformation.readOnly&&(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Factory reset and shutdown`,`Are you sure you want to factory reset Matterbridge? You will have to manually remove Matterbridge from the controller.`,`factoryreset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Factory reset...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Network reset`,`Are you sure you want to factory reset the network parameters?`,`softreset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Reset network...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]}),S.matterbridgeInformation&&S.matterbridgeInformation.shellyBoard&&(0,J.jsxs)(B,{onClick:()=>{Oe(),n(`Factory reset`,`Are you sure you want to factory reset Matterbridge? You will have to manually remove Matterbridge from the controller.`,`hardreset`,L,Se)},children:[(0,J.jsx)(H,{children:(0,J.jsx)(xe,{style:{color:`var(--main-icon-color)`}})}),(0,J.jsx)(R,{primary:`Factory reset...`,primaryTypographyProps:{style:{fontWeight:`normal`,color:`var(--main-icon-color)`}}})]})]})]})]})]})}var Kr=(0,W.memo)(Gr);function qr(){if(typeof window<`u`){let e=Math.floor(window.visualViewport?.width??window.innerWidth),t=Math.floor(window.visualViewport?.height??window.innerHeight);Wr(e,t);let n=e<1200||t<900;return K&&console.log(`Visual viewport (%s) width %i height %i mobile %s`,window.visualViewport!==void 0,e,t,n),n}return!1}function Jr({children:e}){let{mobile:t,setMobile:n}=(0,W.useContext)(Wt),{logAutoScroll:r}=(0,W.useContext)(Y);return(0,W.useEffect)(()=>{function e(){let e=qr();e&&(r.current=!1,localStorage.setItem(G.logAutoScroll,`false`)),n(e)}return window.addEventListener(`resize`,e),n(qr()),()=>window.removeEventListener(`resize`,e)},[r,n]),K&&console.log(`MbfScreen rendering... mobile %s`,t),q&&t?(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`visible`,margin:`0px`,padding:`10px`,gap:`10px`},children:[(0,J.jsx)(Kr,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`10px`},children:e})]}):(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,overflow:`hidden`,width:t?`${Vr}px`:`calc(100vw - 40px)`,height:t?`900px`:`calc(100vh - 40px)`,margin:`0px`,padding:`20px`,gap:`20px`},children:[(0,J.jsx)(Kr,{}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,width:`100%`,height:`calc(100% - 60px)`,margin:`0px`,padding:`0px`,gap:`20px`},children:e})]})}function Yr(e=1e3){let t=null,n=(n=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{n(),t=null},e)});return n.cancel=()=>{t!==null&&(window.clearTimeout(t),t=null)},n}var Xr=({open:e,onClose:t,onSave:n})=>{let[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(``),s=e=>{i(e.target.value)},c=e=>{o(e.target.value)},l=r.length>0&&r===a;return(0,J.jsxs)(M,{open:e,onClose:(e,n)=>{n===`backdropClick`||n===`escapeKeyDown`||t()},maxWidth:`sm`,style:{maxWidth:`500px`,margin:`auto`},disableEscapeKeyDown:!0,children:[(0,J.jsx)(P,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:`Change Password`})]})}),(0,J.jsx)(x,{dividers:!0,children:(0,J.jsx)(Ie,{component:`fieldset`,fullWidth:!0,sx:{margin:0,padding:0,gap:`20px`},children:(0,J.jsxs)(_,{container:!0,spacing:2,sx:{mt:2},children:[(0,J.jsx)(_,{size:12,children:(0,J.jsx)(V,{type:`password`,autoComplete:`new-password`,label:`New Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:r,onChange:s})}),(0,J.jsx)(_,{size:12,children:(0,J.jsx)(V,{type:`password`,autoComplete:`new-password`,label:`Confirm Password`,size:`small`,variant:`outlined`,fullWidth:!0,value:a,onChange:c,error:a!==``&&r!==a,helperText:a!==``&&r!==a?`Passwords do not match`:``})})]})})}),(0,J.jsxs)(D,{children:[(0,J.jsx)(U,{onClick:()=>{t()},children:`Cancel`}),(0,J.jsx)(U,{variant:`contained`,onClick:()=>{l&&(n(r),t())},disabled:!l,children:`Change`}),(0,J.jsx)(U,{variant:`contained`,onClick:()=>{n(``),t()},children:`Reset`})]})]})},Zr=({open:e,ip:t,onClose:n,onSave:r})=>{let i=t?t.split(`.`).slice(0,3).join(`.`)+`.1`:``,[a,o]=(0,W.useState)(`dhcp`),[s,c]=(0,W.useState)({ip:t??``,subnet:`255.255.255.0`,gateway:i,dns:i}),l=e=>t=>{c({...s,[e]:t.target.value})};return(0,J.jsxs)(M,{open:e,onClose:(e,t)=>{t===`backdropClick`||t===`escapeKeyDown`||n()},maxWidth:`sm`,style:{maxWidth:`550px`,margin:`auto`},children:[(0,J.jsx)(P,{gap:`20px`,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:`Network Configuration`})]})}),(0,J.jsxs)(x,{dividers:!0,children:[(0,J.jsxs)(Ie,{component:`fieldset`,fullWidth:!0,children:[(0,J.jsx)(F,{component:`legend`,children:`Select IP Configuration`}),(0,J.jsxs)(He,{row:!0,value:a,onChange:e=>o(e.target.value),children:[(0,J.jsx)(d,{value:`dhcp`,control:(0,J.jsx)(Me,{}),label:`DHCP`}),(0,J.jsx)(d,{value:`static`,control:(0,J.jsx)(Me,{}),label:`Static`})]})]}),a===`static`&&(0,J.jsxs)(_,{container:!0,spacing:2,sx:{mt:2},children:[(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`IP Address`,fullWidth:!0,value:s.ip,onChange:l(`ip`)})}),(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`Subnet Mask`,fullWidth:!0,value:s.subnet,onChange:l(`subnet`)})}),(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`Gateway`,fullWidth:!0,value:s.gateway,onChange:l(`gateway`)})}),(0,J.jsx)(_,{size:6,children:(0,J.jsx)(V,{label:`DNS Server`,fullWidth:!0,value:s.dns,onChange:l(`dns`)})})]})]}),(0,J.jsxs)(D,{children:[(0,J.jsx)(U,{onClick:()=>{n()},children:`Cancel`}),(0,J.jsx)(U,{variant:`contained`,onClick:()=>{r({type:a,...s}),n()},children:`Save`})]})]})},Qr=330;function $r(){let{mobile:e}=(0,W.useContext)(Wt),{online:t,addListener:n,removeListener:r,sendMessage:i,getUniqueId:a}=(0,W.useContext)(Y),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),u=(0,W.useRef)(a());return(0,W.useEffect)(()=>{let e=e=>{K&&console.log(`Settings received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`settings`?(K&&console.log(`Settings received refresh_required: changed=${e.response.changed} and sending /api/settings request`),i({id:u.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`update_required`?(K&&console.log(`Settings received update_required`,e.response),e.response.devVersion?s(t=>t?{...t,matterbridgeDevVersion:e.response.version}:null):s(t=>t?{...t,matterbridgeLatestVersion:e.response.version}:null)):e.method===`/api/settings`&&(K&&console.log(`Settings received /api/settings:`,e.response),s(e.response.matterbridgeInformation),l(e.response.systemInformation))};return n(e,u.current),K&&console.log(`Settings added WebSocket listener`),()=>{r(e),K&&console.log(`Settings removed WebSocket listener`)}},[n,r,i]),(0,W.useEffect)(()=>{t&&(K&&console.log(`Settings received online`),i({id:u.current,sender:`Settings`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[t,i]),K&&console.log(`Settings rendering...`),!t||!o||!c?(0,J.jsx)(qt,{}):(0,J.jsx)(jn,{name:`Settings`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,gap:q&&e?`10px`:`20px`},children:[(0,J.jsx)(ei,{matterbridgeInfo:o,systemInfo:c}),(0,J.jsx)(ti,{matterbridgeInfo:o}),(0,J.jsx)(ni,{matterbridgeInfo:o}),(0,J.jsx)(ri,{systemInfo:c})]})})}function ei({matterbridgeInfo:e,systemInfo:t}){let{sendMessage:n,getUniqueId:r}=(0,W.useContext)(Y),[i,a]=(0,W.useState)(`bridge`),[o,s]=(0,W.useState)(`Info`),[c,l]=(0,W.useState)(!1),[u,f]=(0,W.useState)(`dark`),[p,m]=(0,W.useState)(localStorage.getItem(G.homePagePlugins)!==`false`),[h,g]=(0,W.useState)(localStorage.getItem(G.homePageMode)??`devices`),[_,v]=(0,W.useState)(localStorage.getItem(G.virtualMode)??`outlet`),y=(0,W.useRef)(r()),[b,x]=(0,W.useState)(!1),S=()=>x(!1),C=e=>{K&&console.log(`handleSaveNetConfig called with config:`,e),n({id:y.current,sender:`Settings`,method:`/api/shellynetconfig`,src:`Frontend`,dst:`Matterbridge`,params:e})},[w,T]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{e&&(a(e.bridgeMode===`bridge`?`bridge`:`childbridge`),s(e.loggerLevel.charAt(0).toUpperCase()+e.loggerLevel.slice(1)),l(e.fileLogger),v(e.virtualMode))},[e]),(0,W.useEffect)(()=>{let e=localStorage.getItem(G.frontendTheme);e&&f(e)},[]),!e||!t?null:(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matterbridge settings`})}),(0,J.jsx)(Zr,{open:b,ip:t.ipv4Address,onClose:S,onSave:C}),(0,J.jsx)(Xr,{open:w,onClose:()=>T(!1),onSave:e=>{K&&console.log(`handleSaveChangePassword called with password:`,e),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setpassword`,value:e}}),Rt(e)}}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`matterbridgeInfo-mode`,children:`Mode:`}),(0,J.jsxs)(He,{row:!0,name:`mode-buttons-group`,value:i,onChange:e=>{K&&console.log(`handleChangeBridgeMode called with value:`,e.target.value),a(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setbridgemode`,value:e.target.value}})},children:[(0,J.jsx)(d,{value:`bridge`,control:(0,J.jsx)(Me,{}),label:`Bridge`,disabled:e.readOnly}),(0,J.jsx)(d,{value:`childbridge`,control:(0,J.jsx)(Me,{}),label:`Childbridge`,disabled:e.readOnly})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mblogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`mblogger-level-label`,id:`mblogger-level`,value:o,onChange:e=>{K&&console.log(`handleChangeMbLoggerLevel called with value:`,e.target.value),s(e.target.value),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmbloglevel`,value:e.target.value}})},children:[(0,J.jsx)(B,{value:`Debug`,children:`Debug`}),(0,J.jsx)(B,{value:`Info`,children:`Info`}),(0,J.jsx)(B,{value:`Notice`,children:`Notice`}),(0,J.jsx)(B,{value:`Warn`,children:`Warn`}),(0,J.jsx)(B,{value:`Error`,children:`Error`}),(0,J.jsx)(B,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mblogger-file-label`,children:`Log on file:`}),(0,J.jsx)(oe,{checked:c,onChange:e=>{K&&console.log(`handleLogOnFileMbChange called with value:`,e.target.checked),l(e.target.checked),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmblogfile`,value:e.target.checked}})},id:`mblogger-file`,name:`logOnFileMb`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-theme-label`,children:`Frontend theme:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`frontend-theme-label`,id:`frontend-theme`,value:u,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeTheme called with value:`,t),f(t),localStorage.setItem(G.frontendTheme,t),document.body.setAttribute(`frontend-theme`,t)},children:[(0,J.jsx)(B,{value:`classic`,children:`Classic`}),(0,J.jsx)(B,{value:`light`,children:`Light`}),(0,J.jsx)(B,{value:`dark`,children:`Dark`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-plugin-label`,children:`Home page plugins:`}),(0,J.jsx)(oe,{checked:p,onChange:e=>{let t=e.target.checked;K&&console.log(`handleChangeHomePagePlugins called with value:`,t),m(t),localStorage.setItem(G.homePagePlugins,t?`true`:`false`)},name:`showPlugins`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`5px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-home-label`,children:`Home page bottom panel:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`frontend-home-label`,id:`frontend-home`,value:h,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeHomePageMode called with value:`,t),g(t),localStorage.setItem(G.homePageMode,t)},children:[(0,J.jsx)(B,{value:`logs`,children:`Logs`}),(0,J.jsx)(B,{value:`devices`,children:`Devices`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`10px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`frontend-virtual-label`,children:`Virtual devices:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`frontend-virtual-label`,id:`frontend-virtual`,value:_,onChange:e=>{let t=e.target.value;K&&console.log(`handleChangeVirtualMode called with value:`,t),v(t),localStorage.setItem(G.virtualMode,t),n({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setvirtualmode`,value:t}})},children:[(0,J.jsx)(B,{value:`disabled`,children:`Disabled`}),(0,J.jsx)(B,{value:`outlet`,children:`Outlet`}),(0,J.jsx)(B,{value:`light`,children:`Light`}),(0,J.jsx)(B,{value:`switch`,children:`Switch`}),(0,J.jsx)(B,{value:`mounted_switch`,children:`Mounted Switch`})]})]}),(0,J.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`20px`},children:(0,J.jsx)(U,{variant:`contained`,color:`primary`,onClick:()=>T(!0),children:`Change password`})}),e.shellyBoard&&(0,J.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`15px`,marginTop:`20px`},children:(0,J.jsx)(U,{variant:`contained`,color:`primary`,onClick:()=>x(!0),children:`Configure IP`})})]})]})}function ti({matterbridgeInfo:e}){let{sendMessage:t,getUniqueId:n}=(0,W.useContext)(Y),[r,i]=(0,W.useState)(`Info`),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),y=(0,W.useRef)(n()),b=(0,W.useMemo)(()=>Yr(1e3),[]),x=(0,W.useMemo)(()=>Yr(1e3),[]),S=(0,W.useMemo)(()=>Yr(1e3),[]),C=(0,W.useMemo)(()=>Yr(1e3),[]),w=(0,W.useMemo)(()=>Yr(1e3),[]),T=(0,W.useMemo)(()=>Yr(1e3),[]);return(0,W.useEffect)(()=>{e&&(i(e.matterLoggerLevel.charAt(0).toUpperCase()+e.matterLoggerLevel.slice(1)),o(e.matterFileLogger),c(e.matterMdnsInterface||``),u(e.matterIpv4Address||``),f(e.matterIpv6Address||``),m(e.matterPort?e.matterPort.toString():``),g(e.matterDiscriminator?e.matterDiscriminator.toString():``),v(e.matterPasscode?e.matterPasscode.toString():``))},[e]),(0,W.useEffect)(()=>()=>b.cancel(),[b]),(0,W.useEffect)(()=>()=>x.cancel(),[x]),(0,W.useEffect)(()=>()=>S.cancel(),[S]),(0,W.useEffect)(()=>()=>C.cancel(),[C]),(0,W.useEffect)(()=>()=>w.cancel(),[w]),(0,W.useEffect)(()=>()=>T.cancel(),[T]),e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matter settings`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-level-label`,children:`Logger level:`}),(0,J.jsxs)(L,{style:{height:`30px`},labelId:`mjlogger-level-label`,id:`mjlogger-level`,value:r,onChange:e=>{K&&console.log(`handleChangeMjLoggerLevel called with value:`,e.target.value),i(e.target.value),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjloglevel`,value:e.target.value}})},children:[(0,J.jsx)(B,{value:`Debug`,children:`Debug`}),(0,J.jsx)(B,{value:`Info`,children:`Info`}),(0,J.jsx)(B,{value:`Notice`,children:`Notice`}),(0,J.jsx)(B,{value:`Warn`,children:`Warn`}),(0,J.jsx)(B,{value:`Error`,children:`Error`}),(0,J.jsx)(B,{value:`Fatal`,children:`Fatal`})]})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:`5px`,gap:`10px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`},id:`mjlogger-file-label`,children:`Log on file:`}),(0,J.jsx)(oe,{checked:a,onChange:e=>{K&&console.log(`handleLogOnFileMjChange called with value:`,e.target.checked),o(e.target.checked),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmjlogfile`,value:e.target.checked}})},id:`mjlogger-file`,name:`logOnFileMj`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Mdns interface:`}),(0,J.jsx)(V,{value:s,onChange:e=>{K&&console.log(`handleChangeMdnsInterface called with value:`,e.target.value);let n=e.target.value;c(n),b(()=>{K&&console.log(`debounced sendMessage setmdnsinterface with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmdnsinterface`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv4 address:`}),(0,J.jsx)(V,{value:l,onChange:e=>{K&&console.log(`handleChangeIpv4Address called with value:`,e.target.value);let n=e.target.value;u(n),x(()=>{K&&console.log(`debounced sendMessage setipv4address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv4address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Ipv6 address:`}),(0,J.jsx)(V,{value:d,onChange:e=>{K&&console.log(`handleChangeIpv6Address called with value:`,e.target.value);let n=e.target.value;f(n),S(()=>{K&&console.log(`debounced sendMessage setipv6address with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setipv6address`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning port:`}),(0,J.jsx)(V,{value:p,onChange:e=>{K&&console.log(`handleChangeMatterPort called with value:`,e.target.value);let n=e.target.value;m(n),C(()=>{K&&console.log(`debounced sendMessage setmatterport with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterport`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning discriminator:`}),(0,J.jsx)(V,{value:h,onChange:e=>{K&&console.log(`handleChangeMatterDiscriminator called with value:`,e.target.value);let n=e.target.value;g(n),w(()=>{K&&console.log(`debounced sendMessage setmatterdiscriminator with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterdiscriminator`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`,marginBottom:`10px`,gap:`15px`},children:[(0,J.jsx)(F,{style:{padding:`0px`,margin:`0px`,textWrap:`nowrap`},children:`Commissioning passcode:`}),(0,J.jsx)(V,{value:_,onChange:e=>{K&&console.log(`handleChangemMatterPasscode called with value:`,e.target.value);let n=e.target.value;v(n),T(()=>{K&&console.log(`debounced sendMessage setmatterpasscode with value:`,n),t({id:y.current,sender:`Settings`,method:`/api/config`,src:`Frontend`,dst:`Matterbridge`,params:{name:`setmatterpasscode`,value:n}})})},size:`small`,variant:`outlined`,style:{height:`30px`,flexGrow:1},InputProps:{readOnly:e.readOnly,style:{height:`30px`,padding:`0`}}})]})]})]}):null}function ni({matterbridgeInfo:e}){return e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`Matterbridge info`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(ii,{value:e.matterbridgeVersion,label:`Current Version`}),(0,J.jsx)(ii,{value:e.matterbridgeLatestVersion,label:`Latest Version`}),(0,J.jsx)(ii,{value:e.rootDirectory,label:`Root Directory`}),(0,J.jsx)(ii,{value:e.homeDirectory,label:`Home Directory`}),(0,J.jsx)(ii,{value:e.matterbridgeDirectory,label:`Matterbridge Storage Directory`}),(0,J.jsx)(ii,{value:e.matterbridgePluginDirectory,label:`Matterbridge Plugin Directory`}),(0,J.jsx)(ii,{value:e.globalModulesDirectory,label:`Global Module Directory`})]})]}):null}function ri({systemInfo:e}){return e?(0,J.jsxs)(Z,{style:{flex:`1 1 ${Qr}px`},children:[(0,J.jsx)(Jt,{children:(0,J.jsx)(Q,{children:`System info`})}),(0,J.jsxs)(Qt,{style:{flexDirection:`column`,padding:`10px`,gap:`5px`},children:[(0,J.jsx)(ii,{value:e.interfaceName,label:`Interface name`}),(0,J.jsx)(ii,{value:e.macAddress,label:`MAC Address`}),(0,J.jsx)(ii,{value:e.ipv4Address,label:`IPv4 Address`}),(0,J.jsx)(ii,{value:e.ipv6Address,label:`IPv6 Address`}),(0,J.jsx)(ii,{value:e.nodeVersion,label:`Node Version`}),(0,J.jsx)(ii,{value:e.hostname,label:`Hostname`}),(0,J.jsx)(ii,{value:e.user,label:`User`})]})]}):null}function ii({value:e,label:t,width:n}){return(0,J.jsx)(V,{focused:!0,value:e,size:`small`,label:t,variant:`standard`,sx:{width:n?`${n-20}px`:`100%`,"& .MuiInput-underline:before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline:hover:not(.Mui-disabled):before":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5},"& .MuiInput-underline.Mui-focused:after":{borderBottomColor:`var(--main-label-color)`,borderBottomWidth:`1px`,opacity:.5}},slotProps:{input:{readOnly:!0,sx:{color:`var(--div-text-color)`,"&:before":{borderBottomColor:`var(--main-label-color)`},"&:after":{borderBottomColor:`var(--main-label-color)`}}},inputLabel:{sx:{marginTop:`3px`,color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}}})}var ai=(0,W.memo)($r);function oi(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,W.useContext)(Y),{showSnackbarMessage:a}=(0,W.useContext)(Wt),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)([]),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)({cpuUsage:0}),[g,_]=(0,W.useState)({totalMemory:``,freeMemory:``,heapTotal:``,heapUsed:``,external:``,arrayBuffers:``,rss:``}),[v,y]=(0,W.useState)({systemUptime:``,processUptime:``}),b=(0,W.useRef)(i());return K&&console.log(`Test uniqueId:`,b),(0,W.useEffect)(()=>{K&&console.log(`Test useEffect WebSocketMessage mounting`);let e=e=>{if(e.method===`restart_required`)K&&console.log(`Test received restart_required`),a(`Restart required`,0);else if(e.method===`refresh_required`)K&&console.log(`Test received refresh_required: changed=${e.response.changed} and sending api requests`),a(`Refresh required`,0),t({id:b.current,method:`/api/settings`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:b.current,method:`/api/plugins`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}}),t({id:b.current,method:`/api/devices`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{}});else if(e.method===`memory_update`)K&&console.log(`Test received memory_update`,e),_(e.response);else if(e.method===`cpu_update`)K&&console.log(`Test received cpu_update`,e),h(e.response);else if(e.method===`uptime_update`)K&&console.log(`Test received uptime_update`,e),y(e.response);else if(e.method===`/api/settings`&&e.response)K&&console.log(`Test received /api/settings:`,e.response),a(`Test received /api/settings`,0),s(e.response);else if(e.method===`/api/plugins`&&e.response)K&&console.log(`Test received ${e.response.length} plugins:`,e.response),a(`Test received /api/plugins`,0),l(e.response);else if(e.method===`/api/devices`&&e.response){K&&console.log(`Test received ${e.response.length} devices:`,e.response),a(`Test received /api/devices`,0),d(e.response);for(let n of e.response)K&&console.log(`Test sending /api/clusters for device:`,n.pluginName,n.name,n.endpoint),t({id:b.current,method:`/api/clusters`,sender:`Test`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:n.pluginName,endpoint:n.endpoint||0}})}else e.method===`/api/clusters`&&e.response&&(K&&console.log(`Test received ${e.response.clusters.length} clusters for device ${e.response.deviceName} endpoint ${e.response.id}:${e.response.number}:`,e),a(`Test received /api/clusters for ${e.response.plugin}::${e.response.deviceName}`,0),p(e.response))};return n(e,b.current),K&&console.log(`Test useEffect WebSocketMessage mounted`),()=>{K&&console.log(`Test useEffect WebSocketMessage unmounting`),r(e),K&&console.log(`Test useEffect WebSocketMessage unmounted`)}},[n,r,t,a]),(0,W.useEffect)(()=>(K&&console.log(`Test useEffect online mounting`),e&&K&&console.log(`Test useEffect online received online`),K&&console.log(`Test useEffect online mounted`),()=>{K&&console.log(`Test useEffect online unmounted`)}),[e,t,a]),K&&console.log(`Test rendering...`),e?(0,J.jsx)(jn,{name:`Test`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,alignContent:`center`,gap:`20px`,height:`100vh`,width:`100vw`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`256px`,width:`256px`,margin:`10px`}}),(0,J.jsx)(`p`,{children:`Welcome to the Test page of the Matterbridge frontend`})]})}):(0,J.jsx)(qt,{})}var si=(0,W.memo)(oi);function ci({open:e,title:t,message:n,onConfirm:r,onCancel:i}){return(0,J.jsxs)(M,{open:e,children:[(0,J.jsx)(P,{gap:`20px`,children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:t})]})}),(0,J.jsxs)(x,{children:[(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:`0`,marginBottom:`20px`,maxHeight:`350px`,maxWidth:`350px`},children:(0,J.jsx)(`p`,{style:{flex:1,margin:`0`},children:n})}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-around`},children:[(0,J.jsx)(U,{onClick:e=>{K&&console.log(`Confirmed`),e.preventDefault(),r()},variant:`contained`,color:`primary`,size:`small`,children:`Confirm`}),(0,J.jsx)(U,{onClick:e=>{K&&console.log(`Canceled`),e.preventDefault(),i()},variant:`contained`,color:`primary`,size:`small`,children:`Cancel`})]})]})]})}var li=({open:e,output:t,title:n,_command:r,_packageName:i,onInstall:a,onClose:o})=>{let{installAutoExit:s,mobile:c,setInstallAutoExit:l}=(0,W.useContext)(Wt),u=(0,W.useRef)(null),f=e=>{l(e.target.checked),localStorage.setItem(G.installAutoExit,e.target.checked?`true`:`false`),K&&console.log(`handleInstallAutoExitChange called with value:`,e.target.checked)};return(0,W.useEffect)(()=>{K&&console.log(`InstallProgressDialog output effect mounted, scrolling to bottom:`,u.current),setTimeout(()=>{K&&console.log(`Scrolling to bottom:`,u.current),u.current?.scrollIntoView({behavior:`smooth`,block:`end`})},0)},[t]),(0,J.jsxs)(M,{open:e,onClose:(e,t)=>{t===`backdropClick`||t===`escapeKeyDown`||o()},slotProps:{paper:{sx:{width:q&&c?`100vw`:`75vw`,maxWidth:q&&c?`100vw`:`75vw`,height:q&&c?`100vh`:`75vw`,maxHeight:q&&c?`100vh`:`75vh`,margin:q&&c?`0px`:void 0,overflow:`hidden`}}},children:[(0,J.jsx)(P,{children:(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h4`,{style:{margin:0},children:n})]})}),(0,J.jsxs)(x,{dividers:!0,style:{overflow:`hidden`,display:`flex`,flexDirection:`column`,height:400,paddingBottom:0},children:[(0,J.jsx)(`div`,{style:{display:`block`,marginBottom:`10px`,fontSize:`16px`,fontWeight:`bold`,color:`var(--primary-color)`},children:`Process log`}),(0,J.jsxs)(`ul`,{style:{width:`100%`,height:`100%`,fontFamily:`monospace`,fontSize:`14px`,padding:`10px`,margin:0,marginBottom:`10px`,color:`var(--div-text-color)`,background:`var(--div-bg-color)`,overflow:`auto`,listStyle:`none`,boxSizing:`border-box`,borderRadius:4,border:`4px solid var(--primary-color)`,whiteSpace:`pre-wrap`,display:`block`},children:[t.split(`
|
|
43
43
|
`).map((e,t)=>(0,J.jsx)(`li`,{style:{padding:0,margin:0,wordBreak:`break-all`},children:e},t)),(0,J.jsx)(`li`,{ref:u,style:{padding:0,margin:0}})]})]}),(0,J.jsxs)(D,{sx:{justifyContent:`space-evenly`},children:[a&&(0,J.jsx)(U,{variant:`contained`,onClick:a,children:`Install`}),(0,J.jsx)(U,{onClick:o,children:`Close`}),(0,J.jsx)(d,{control:(0,J.jsx)(oe,{checked:s,onChange:e=>f(e)}),label:`Close on success`,style:{color:`var(--div-text-color)`}})]})]})},ui=[];function di({children:e}){let[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(null),{enqueueSnackbar:a,closeSnackbar:o}=yt(),s=(0,W.useCallback)(e=>{K&&console.log(`UiProvider closeSnackbarMessage: message ${e}`);let t=ui.findIndex(t=>t.message===e);t!==-1&&(o(ui[t].key),ui.splice(t,1),K&&console.log(`UiProvider closeSnackbarMessage: message ${e} removed from persistMessages`))},[o]),c=(0,W.useCallback)((e,t,n)=>{K&&console.log(`UiProvider showSnackbarMessage: message ${e} timeout ${t}`);let r=a(e,{variant:`default`,autoHideDuration:t==null||t>0?(t??5)*1e3:null,persist:t===0,content:t=>(0,J.jsx)(p,{sx:{margin:`0`,padding:`0`,width:`300px`,marginRight:`30px`},children:(0,J.jsx)(me,{severity:n??`info`,variant:`filled`,sx:{color:`#fff`,fontWeight:`normal`,width:`100%`,cursor:`pointer`,padding:`0px 10px`},onClick:()=>o(t),action:(0,J.jsx)(T,{size:`small`,onClick:()=>o(t),sx:{color:`#fff`},children:(0,J.jsx)($e,{fontSize:`small`})}),children:e},t)},t)});t===0&&(K&&console.log(`UiProvider showSnackbarMessage: message ${e} timeout ${t} - persist key ${r}`),ui.push({message:e,key:r}))},[a,o]),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(``),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),v=(0,W.useRef)(null),y=(0,W.useRef)(null),b=()=>{K&&console.log(`UiProvider handle confirm action ${g}`),u(!1),v.current&&v.current(g)},x=()=>{K&&console.log(`UiProvider handle cancel action ${g}`),u(!1),y.current&&y.current(g)},S=(0,W.useCallback)((e,t,n,r,i)=>{K&&console.log(`UiProvider showConfirmCancelDialog for command ${n}`),f(e),h(t),_(n),v.current=r,y.current=i,u(!0)},[]),[C,w]=(0,W.useState)(!1),[E,D]=(0,W.useState)(``),[O,k]=(0,W.useState)(``),[A,j]=(0,W.useState)(``),[M,N]=(0,W.useState)(``),[ee,te]=(0,W.useState)(localStorage.getItem(G.installAutoExit)!==`false`),P=(0,W.useCallback)((e,t,n)=>{K&&console.log(`UiProvider show install progress for package ${e}`),D(e),k(t),j(n),w(!0)},[]),ne=(0,W.useCallback)(e=>{K&&console.log(`UiProvider addInstallProgress: output ${e}`),N(t=>t+e+`
|
|
44
44
|
`)},[]),F=(0,W.useCallback)(()=>{K&&console.log(`UiProvider exitInstallProgressSuccess: package ${A}`),localStorage.getItem(G.installAutoExit)!==`false`&&w(!1)},[A]),re=(0,W.useCallback)(()=>{K&&console.log(`UiProvider exitInstallProgressError: package ${A}`)},[A]),I=(0,W.useCallback)(()=>{K&&console.log(`UiProvider hide install progress`),w(!1)},[]),ie=()=>{K&&console.log(`UiProvider handle install close action`),w(!1),j(``),N(``)},ae=(0,W.useMemo)(()=>({mobile:t,setMobile:n,currentPage:r,setCurrentPage:i,showSnackbarMessage:c,closeSnackbarMessage:s,closeSnackbar:o,showConfirmCancelDialog:S,showInstallProgress:P,exitInstallProgressSuccess:F,exitInstallProgressError:re,hideInstallProgress:I,addInstallProgress:ne,installAutoExit:ee,setInstallAutoExit:te}),[t,r,n,i,c,s,o,S,P,F,re,I,ne,ee,te]);return(0,J.jsxs)(Wt.Provider,{value:ae,children:[(0,J.jsx)(ci,{open:l,title:d,message:m,onConfirm:b,onCancel:x}),(0,J.jsx)(li,{open:C,title:E,_command:O,_packageName:A,output:M,onClose:ie}),e]})}function fi(e,t){K&&console.log(`getCssVariable:`,e,`defaultValue`,t);let n=getComputedStyle(document.body).getPropertyValue(e).trim();return n||console.error(`getCssVariable: undefined`,n),n||t}function pi(e){return C({palette:{primary:{main:e},action:{disabled:`var(--main-label-color)`},text:{disabled:`var(--main-label-color)`}},typography:{fontFamily:`Roboto, Helvetica, Arial, sans-serif`},components:{MuiDialog:{styleOverrides:{paper:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,border:`2px solid var(--div-border-color)`,borderRadius:`var(--div-border-radius)`,boxShadow:`2px 2px 5px var(--div-shadow-color)`}}},MuiTooltip:{defaultProps:{placement:`top-start`,arrow:!0}},MuiButton:{styleOverrides:{root:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,"&:hover":{backgroundColor:`var(--main-button-bg-color)`},"&.Mui-disabled":{color:`var(--main-button-color)`,backgroundColor:`var(--main-grey-color)`}},contained:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},outlined:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},text:{color:`var(--main-button-color)`}},defaultProps:{variant:`contained`,size:`small`}},MuiIconButton:{styleOverrides:{root:{color:`var(--main-icon-color)`,"&:hover .MuiSvgIcon-root":{color:`var(--primary-color)`}}}},MuiCheckbox:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-checked":{color:`var(--primary-color)`}}}},MuiTextField:{defaultProps:{size:`small`,variant:`outlined`,fullWidth:!0}},MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:`var(--div-bg-color)`,"& .MuiOutlinedInput-notchedOutline":{borderColor:`var(--main-label-color)`},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:`var(--main-text-color)`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`var(--primary-color)`},padding:`0px`},input:{color:`var(--div-text-color)`,padding:`4px 8px`}}},MuiInputLabel:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--primary-color)`}}}},MuiFormLabel:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-focused":{color:`var(--main-label-color)`}}}},MuiFormControl:{styleOverrides:{root:{color:`var(--main-grey-color)`}}},MuiRadio:{styleOverrides:{root:{color:`var(--main-label-color)`,"&.Mui-checked":{color:`var(--primary-color)`}}}},MuiSelect:{styleOverrides:{root:{backgroundColor:`var(--div-bg-color)`,color:`var(--div-text-color)`,height:`30px`,"&:hover":{borderColor:`var(--main-text-color)`},"&.Mui-focused":{borderColor:`var(--primary-color)`}}}},MuiMenu:{styleOverrides:{paper:{backgroundColor:`var(--main-menu-bg-color)`,padding:`0px`,margin:`0px`},list:{padding:`0px`}}},MuiMenuItem:{styleOverrides:{root:{color:`var(--main-menu-color)`,backgroundColor:`var(--main-menu-bg-color)`,"&:hover":{backgroundColor:`var(--main-menu-hover-color)`},"&.Mui-selected":{color:`var(--main-menu-color)`,backgroundColor:`var(--main-menu-bg-color)`},"&.Mui-selected:hover":{backgroundColor:`var(--main-menu-hover-color)`}}}},MuiListItemButton:{styleOverrides:{root:{cursor:`pointer`,"&:hover":{backgroundColor:`var(--main-bg-color)`}}}},MuiListItemIcon:{styleOverrides:{root:{color:`var(--div-text-color)`}}},MuiListItemText:{styleOverrides:{primary:{fontSize:`16px`,fontWeight:`bold`,color:`var(--div-text-color)`},secondary:{fontSize:`14px`,fontWeight:`normal`,color:`var(--div-text-color)`}}}}})}function mi({setLoggedIn:e}){let[t,n]=(0,W.useState)(``),[r,i]=(0,W.useState)(``),a={display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,backgroundColor:`var(--main-bg-color)`},o={display:`flex`,flexDirection:`column`,maxWidth:`400px`,margin:`0 auto`,padding:`20px`,gap:`20px`,border:`1px solid var(--div-border-color)`,borderRadius:`var(--div-border-radius)`,boxShadow:`2px 2px 5px var(--div-shadow-color)`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`},s={margin:`10px 0`,padding:`3px 3px`,fontSize:`14px`,width:`230px`,border:`1px solid var(--main-label-color)`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`},c=(0,W.useCallback)(async t=>{try{let n=await fetch(`./api/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t})});if(n.ok){let{valid:r}=await n.json();r?(e(!0),t!==``&&Rt(t)):t!==``&&i(`Incorrect password!`)}else console.error(`Failed to log in:`,n.statusText)}catch(e){console.error(`Failed to log in:`,e)}},[e]);return(0,W.useEffect)(()=>{c(``)},[c]),(0,J.jsx)(`div`,{style:a,children:(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),c(t)},style:o,children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,J.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,J.jsx)(`h3`,{style:{color:`var(--div-text-color)`},children:`Welcome to Matterbridge`})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-between`,gap:`20px`},children:[(0,J.jsx)(`input`,{type:`text`,name:`username`,autoComplete:`username`,style:{display:`none`},tabIndex:-1}),(0,J.jsx)(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),style:s,placeholder:`password`,autoComplete:`current-password`}),(0,J.jsx)(`button`,{type:`submit`,style:{color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,borderColor:`var(--div-bg-color)`},children:`Log in`})]}),(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:0,height:`30px`},children:r&&(0,J.jsx)(`p`,{style:{color:`red`},children:r})})]})})}function hi(){let[e,t]=(0,W.useState)(!1),r=localStorage.getItem(G.frontendTheme)||`dark`;K&&console.log(`Setting frontend theme "%s"`,r),document.body.setAttribute(`frontend-theme`,r);let o=fi(`--primary-color`,`#1976d2`);K&&console.log(`Primary color from CSS "%s"`,o);let s=pi(o),l=window.location.href,u=window.location.pathname;(u.endsWith(`/devices`)||u.endsWith(`/log`)||u.endsWith(`/settings`)||u.endsWith(`/test`))&&(u=u.substring(0,u.lastIndexOf(`/`)));let d=u.endsWith(`/`)?u:u+`/`;Ht(d);let f=u.includes(`/api/hassio_ingress/`);return Bt(f),K&&(console.log(`Loading App...`),console.log(`- href = "${l}"`),console.log(`- pathname = "${window.location.pathname}" >>> "${u}"`),console.log(`- baseName = "${d}"`),console.log(`- isIngress = "${f}"`)),e?(0,J.jsx)(ge,{theme:s,children:(0,J.jsx)(bt,{dense:!0,maxSnack:10,preventDuplicate:!0,anchorOrigin:{vertical:`bottom`,horizontal:`right`},children:(0,J.jsx)(di,{children:(0,J.jsx)(Kt,{children:(0,J.jsx)(a,{basename:d,children:(0,J.jsx)(Jr,{children:(0,J.jsxs)(c,{children:[(0,J.jsx)(i,{path:`/`,element:(0,J.jsx)(Rr,{})}),(0,J.jsx)(i,{path:`/devices`,element:(0,J.jsx)(Nn,{})}),(0,J.jsx)(i,{path:`/log`,element:(0,J.jsx)(Br,{})}),(0,J.jsx)(i,{path:`/settings`,element:(0,J.jsx)(ai,{})}),(0,J.jsx)(i,{path:`/test`,element:(0,J.jsx)(si,{})}),(0,J.jsx)(i,{path:`*`,element:(0,J.jsx)(n,{to:`/`})})]})})})})})})}):(0,J.jsx)(mi,{setLoggedIn:t})}var gi=document.getElementById(`root`);if(gi===null)throw Error(`Root element not found`);jt.createRoot(gi).render((0,J.jsx)(W.StrictMode,{children:(0,J.jsx)(hi,{})}));
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/frontend",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1-dev-20260627-53ee5fe",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@matterbridge/frontend",
|
|
9
|
-
"version": "3.5.
|
|
9
|
+
"version": "3.5.1-dev-20260627-53ee5fe",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@emotion/react": "11.14.0",
|