iobroker.admin 7.4.13 → 7.4.14
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/README.md +1 -1
- package/adminWww/asset-manifest.json +5 -8
- package/adminWww/index.html +1 -1
- package/adminWww/static/js/7435.4eee6b92.chunk.js +2 -0
- package/adminWww/static/js/7435.4eee6b92.chunk.js.map +1 -0
- package/adminWww/static/js/{main.6be9bde2.js → main.dc615e87.js} +2 -2
- package/adminWww/static/js/{main.6be9bde2.js.map → main.dc615e87.js.map} +1 -1
- package/io-package.json +2 -2
- package/package.json +4 -4
- package/adminWww/static/js/6858.7b3f28b9.chunk.js +0 -2
- package/adminWww/static/js/6858.7b3f28b9.chunk.js.map +0 -1
- package/adminWww/static/media/thread.78489b630e6b27d860ae133d9ccca0a6.svg +0 -4
- package/adminWww/static/media/z-wave.09176b331d7b6b4b101cffaddf3e441a.svg +0 -3
- package/adminWww/static/media/zigbee.0e17b818ea0c78a95e189da4dac70a6e.svg +0 -4
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ The icons may not be reused in other projects without the proper flaticon licens
|
|
|
87
87
|
<!--
|
|
88
88
|
### **WORK IN PROGRESS**
|
|
89
89
|
-->
|
|
90
|
-
### 7.4.
|
|
90
|
+
### 7.4.14 (2025-01-15)
|
|
91
91
|
|
|
92
92
|
- (@GermanBluefox) Extended DM with device type
|
|
93
93
|
- (@GermanBluefox) Corrected Save&Close button for the instance configs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
|
-
"main.js": "./static/js/main.
|
|
3
|
+
"main.js": "./static/js/main.dc615e87.js",
|
|
4
4
|
"static/css/288.c0edd320.chunk.css": "./static/css/288.c0edd320.chunk.css",
|
|
5
5
|
"static/js/288.492f41ab.chunk.js": "./static/js/288.492f41ab.chunk.js",
|
|
6
6
|
"static/js/4669.59fb05c3.chunk.js": "./static/js/4669.59fb05c3.chunk.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"static/js/7050.dcdd30eb.chunk.js": "./static/js/7050.dcdd30eb.chunk.js",
|
|
39
39
|
"static/js/921.f7fc8142.chunk.js": "./static/js/921.f7fc8142.chunk.js",
|
|
40
40
|
"static/js/7249.ff7ffd3f.chunk.js": "./static/js/7249.ff7ffd3f.chunk.js",
|
|
41
|
-
"static/js/
|
|
41
|
+
"static/js/7435.4eee6b92.chunk.js": "./static/js/7435.4eee6b92.chunk.js",
|
|
42
42
|
"static/js/3997.8ee38232.chunk.js": "./static/js/3997.8ee38232.chunk.js",
|
|
43
43
|
"static/js/5446.7055c034.chunk.js": "./static/js/5446.7055c034.chunk.js",
|
|
44
44
|
"static/js/6331.a5f853ac.chunk.js": "./static/js/6331.a5f853ac.chunk.js",
|
|
@@ -359,7 +359,6 @@
|
|
|
359
359
|
"static/media/Shed.svg": "./static/media/Shed.491a2ad372036118002c.svg",
|
|
360
360
|
"static/media/sentry.svg": "./static/media/sentry.e732e10c5c1ceed0955b2fec6dab33f8.svg",
|
|
361
361
|
"static/media/Water Consumption.svg": "./static/media/Water Consumption.68891649591cc2434c5b.svg",
|
|
362
|
-
"static/media/z-wave.svg": "./static/media/z-wave.09176b331d7b6b4b101cffaddf3e441a.svg",
|
|
363
362
|
"static/media/Stairwell.svg": "./static/media/Stairwell.0914feea948153a8637a.svg",
|
|
364
363
|
"static/media/Tv.svg": "./static/media/Tv.4e9745a548e57bfac0c7.svg",
|
|
365
364
|
"static/media/Hanging Lamps.svg": "./static/media/Hanging Lamps.0bd452fc843edd645c30.svg",
|
|
@@ -370,10 +369,8 @@
|
|
|
370
369
|
"static/media/Bedroom.svg": "./static/media/Bedroom.2a16d8d98fafe965fd1b.svg",
|
|
371
370
|
"static/media/pin.svg": "./static/media/pin.773680e20aed21cad6ec.svg",
|
|
372
371
|
"static/media/Window.svg": "./static/media/Window.421664f57c35e5109aa2.svg",
|
|
373
|
-
"static/media/thread.svg": "./static/media/thread.78489b630e6b27d860ae133d9ccca0a6.svg",
|
|
374
372
|
"static/media/Doors.svg": "./static/media/Doors.d59bf859f582d3488a04.svg",
|
|
375
373
|
"static/media/Garage Doors.svg": "./static/media/Garage Doors.0c2a1cfca7ad1ea59625.svg",
|
|
376
|
-
"static/media/zigbee.svg": "./static/media/zigbee.0e17b818ea0c78a95e189da4dac70a6e.svg",
|
|
377
374
|
"static/media/Outdoor Blinds.svg": "./static/media/Outdoor Blinds.37b85a9c060a4af48da9.svg",
|
|
378
375
|
"static/media/group.svg": "./static/media/group.a9326937fdec88c32aa3.svg",
|
|
379
376
|
"static/media/Upstairs.svg": "./static/media/Upstairs.441813e54e0daca0882d.svg",
|
|
@@ -384,7 +381,7 @@
|
|
|
384
381
|
"static/media/file.svg": "./static/media/file.d39f44d0930a01c6b1a0.svg",
|
|
385
382
|
"static/media/certificates.svg": "./static/media/certificates.0a7c4a4c750fa74d2f98.svg",
|
|
386
383
|
"static/media/rooms.svg": "./static/media/rooms.8d7a30c563e146914ecb.svg",
|
|
387
|
-
"main.
|
|
384
|
+
"main.dc615e87.js.map": "./static/js/main.dc615e87.js.map",
|
|
388
385
|
"288.c0edd320.chunk.css.map": "./static/css/288.c0edd320.chunk.css.map",
|
|
389
386
|
"288.492f41ab.chunk.js.map": "./static/js/288.492f41ab.chunk.js.map",
|
|
390
387
|
"4669.59fb05c3.chunk.js.map": "./static/js/4669.59fb05c3.chunk.js.map",
|
|
@@ -422,7 +419,7 @@
|
|
|
422
419
|
"7050.dcdd30eb.chunk.js.map": "./static/js/7050.dcdd30eb.chunk.js.map",
|
|
423
420
|
"921.f7fc8142.chunk.js.map": "./static/js/921.f7fc8142.chunk.js.map",
|
|
424
421
|
"7249.ff7ffd3f.chunk.js.map": "./static/js/7249.ff7ffd3f.chunk.js.map",
|
|
425
|
-
"
|
|
422
|
+
"7435.4eee6b92.chunk.js.map": "./static/js/7435.4eee6b92.chunk.js.map",
|
|
426
423
|
"9701.2178b9bd.chunk.js.map": "./static/js/9701.2178b9bd.chunk.js.map",
|
|
427
424
|
"2930.956c3757.chunk.js.map": "./static/js/2930.956c3757.chunk.js.map",
|
|
428
425
|
"9072.4505ce12.chunk.js.map": "./static/js/9072.4505ce12.chunk.js.map",
|
|
@@ -449,6 +446,6 @@
|
|
|
449
446
|
"3834.d81ffc60.chunk.js.map": "./static/js/3834.d81ffc60.chunk.js.map"
|
|
450
447
|
},
|
|
451
448
|
"entrypoints": [
|
|
452
|
-
"static/js/main.
|
|
449
|
+
"static/js/main.dc615e87.js"
|
|
453
450
|
]
|
|
454
451
|
}
|
package/adminWww/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en" translate="no"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="admin - ioBroker"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="stylesheet" href="./css/leaflet.css"/><link rel="manifest" href="./manifest.json" crossorigin="use-credentials"/><script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./lib/js/socket.io.js"></script><script type="text/javascript" src="./lib/js/sparkline.js"></script><title>Admin</title><script>window.loginHideLogo="@@loginHideLogo@@",window.loginMotto="@@loginMotto@@",window.login="@@auth@@",window.loginLogo="@@loginLogo@@",window.loginLink="@@loginLink@@",window.loginTitle="@@loginTitle@@",window.loginBackgroundColor="@@loginBackgroundColor@@",window.loginBackgroundImage="@@loginBackgroundImage@@",window.vendorPrefix="@@vendorPrefix@@",window.disableDataReporting="@@disableDataReporting@@",window.loadingBackgroundColor="@@loadingBackgroundColor@@",window.loadingBackgroundImage="@@loadingBackgroundImage@@",window.loadingHideLogo="@@loadingHideLogo@@"</script><style>.root{background-color:rgba(255,255,255,.87);border-radius:10px}.unsupported{width:200px;background-color:#aaa;margin:auto;margin-top:3rem;padding:10px;line-height:25px;border-radius:4px;text-align:center}.leaflet-container{height:400px;width:100%}</style><script>setTimeout((()=>{const o=document.body;window.location.search.includes("?login")?(window.loginBackgroundColor&&-1===window.loginBackgroundColor.indexOf("loginBackgroundColor")&&(o.style.backgroundColor=window.loginBackgroundColor),window.loginBackgroundImage&&-1===window.loginBackgroundImage.indexOf("loginBackgroundImage")&&(o.style.backgroundImage="url("+window.loginBackgroundImage+")",o.style.backgroundSize="cover")):(window.loadingBackgroundColor&&-1===window.loadingBackgroundColor.indexOf("loadingBackgroundColor")&&(o.style.backgroundColor=window.loadingBackgroundColor),window.loadingBackgroundImage&&-1===window.loadingBackgroundImage.indexOf("loadingBackgroundImage")&&(o.style.backgroundImage="url("+window.loadingBackgroundImage+")",o.style.backgroundSize="cover"))}),0),window.addEventListener("load",(function o(n){window.removeEventListener("load",o,!1);if(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./)){const o=document.getElementById("root");o.classList.add("unsupported"),o.innerHTML="Browser is not supported. Please use Firefox or Chrome."}}),!1)</script><script defer="defer" src="static/js/main.
|
|
1
|
+
<!doctype html><html lang="en" translate="no"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="admin - ioBroker"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="stylesheet" href="./css/leaflet.css"/><link rel="manifest" href="./manifest.json" crossorigin="use-credentials"/><script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./lib/js/socket.io.js"></script><script type="text/javascript" src="./lib/js/sparkline.js"></script><title>Admin</title><script>window.loginHideLogo="@@loginHideLogo@@",window.loginMotto="@@loginMotto@@",window.login="@@auth@@",window.loginLogo="@@loginLogo@@",window.loginLink="@@loginLink@@",window.loginTitle="@@loginTitle@@",window.loginBackgroundColor="@@loginBackgroundColor@@",window.loginBackgroundImage="@@loginBackgroundImage@@",window.vendorPrefix="@@vendorPrefix@@",window.disableDataReporting="@@disableDataReporting@@",window.loadingBackgroundColor="@@loadingBackgroundColor@@",window.loadingBackgroundImage="@@loadingBackgroundImage@@",window.loadingHideLogo="@@loadingHideLogo@@"</script><style>.root{background-color:rgba(255,255,255,.87);border-radius:10px}.unsupported{width:200px;background-color:#aaa;margin:auto;margin-top:3rem;padding:10px;line-height:25px;border-radius:4px;text-align:center}.leaflet-container{height:400px;width:100%}</style><script>setTimeout((()=>{const o=document.body;window.location.search.includes("?login")?(window.loginBackgroundColor&&-1===window.loginBackgroundColor.indexOf("loginBackgroundColor")&&(o.style.backgroundColor=window.loginBackgroundColor),window.loginBackgroundImage&&-1===window.loginBackgroundImage.indexOf("loginBackgroundImage")&&(o.style.backgroundImage="url("+window.loginBackgroundImage+")",o.style.backgroundSize="cover")):(window.loadingBackgroundColor&&-1===window.loadingBackgroundColor.indexOf("loadingBackgroundColor")&&(o.style.backgroundColor=window.loadingBackgroundColor),window.loadingBackgroundImage&&-1===window.loadingBackgroundImage.indexOf("loadingBackgroundImage")&&(o.style.backgroundImage="url("+window.loadingBackgroundImage+")",o.style.backgroundSize="cover"))}),0),window.addEventListener("load",(function o(n){window.removeEventListener("load",o,!1);if(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./)){const o=document.getElementById("root");o.classList.add("unsupported"),o.innerHTML="Browser is not supported. Please use Firefox or Chrome."}}),!1)</script><script defer="defer" src="static/js/main.dc615e87.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunksrc_rx=self.webpackChunksrc_rx||[]).push([[7435],{67435:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Z});var o=s(89379),i=s(29183),n=s(89303),r=s(32075),a=s(16904),l=s(23394),c=s(79159);function d(e){const{tooltip:t,label:s,disabled:o,Icon:i,onClick:r}=e,a=!!s&&(0,c.jsx)(n.Typography,{variant:"button",style:{marginLeft:4},children:s});return t?(0,c.jsx)(n.Tooltip,{title:t,slotProps:{popper:{sx:{pointerEvents:"none"}}},children:(0,c.jsx)("span",{children:(0,c.jsxs)(n.IconButton,{onClick:r,disabled:o,size:"small",children:[i,a]})})}):(0,c.jsxs)(n.IconButton,{onClick:r,disabled:o,size:"small",children:[i,a]})}function p(e,t){const s=e.split(" ").map((e=>e.trim())).filter((e=>"fa-solid"!==e));return s.includes("fa-trash-can")||s.includes("fa-trash")?(0,c.jsx)(r.Delete,{style:{color:t}}):s.includes("fa-pen")?(0,c.jsx)(r.Edit,{style:{color:t}}):s.includes("fa-redo-alt")?(0,c.jsx)(r.Refresh,{style:{color:t}}):s.includes("fa-plus")?(0,c.jsx)(r.Add,{style:{color:t}}):s.includes("fa-qrcode")||s.includes("qrcode")?(0,c.jsx)(r.QrCode,{style:{color:t}}):s.includes("fa-wifi")?(0,c.jsx)(r.Wifi,{style:{color:t}}):s.includes("fa-wifi-slash")?(0,c.jsx)(r.WifiOff,{style:{color:t}}):s.includes("fa-bluetooth")?(0,c.jsx)(r.Bluetooth,{style:{color:t}}):s.includes("fa-bluetooth-slash")?(0,c.jsx)(r.BluetoothDisabled,{style:{color:t}}):s.includes("fa-eye")?(0,c.jsx)(r.Visibility,{style:{color:t}}):s.includes("fa-search")?(0,c.jsx)(r.Search,{style:{color:t}}):s.includes("fa-unlink")?(0,c.jsx)(r.LinkOff,{style:{color:t}}):s.includes("fa-link")?(0,c.jsx)(r.Link,{style:{color:t}}):s.includes("fa-search-location")?(0,c.jsx)(r.NotListedLocation,{style:{color:t}}):s.includes("fa-play")?(0,c.jsx)(r.PlayArrow,{style:{color:t}}):s.includes("fa-stop")?(0,c.jsx)(r.Stop,{style:{color:t}}):s.includes("fa-pause")?(0,c.jsx)(r.Pause,{style:{color:t}}):(0,c.jsx)(r.QuestionMark,{style:{color:t}})}function h(e,t,s){return"edit"===e||"rename"===e||"edit"===t||"rename"===t?(0,c.jsx)(r.Edit,{style:{color:s}}):"delete"===e||"delete"===t?(0,c.jsx)(r.Delete,{style:{color:s}}):"refresh"===e||"refresh"===t?(0,c.jsx)(r.Refresh,{style:{color:s}}):"newDevice"===e||"new"===e||"add"===e||"newDevice"===t||"new"===t||"add"===t?(0,c.jsx)(r.Add,{style:{color:s}}):"discover"===e||"search"===e||"discover"===t||"search"===t?(0,c.jsx)(r.Search,{style:{color:s}}):"unpairDevice"===e||"unpair"===e||"unpairDevice"===t||"unpair"===t?(0,c.jsx)(r.LinkOff,{style:{color:s}}):"pairDevice"===e||"pair"===e||"pairDevice"===t||"pair"===t?(0,c.jsx)(r.Link,{style:{color:s}}):"identify"===e||"identify"===t?(0,c.jsx)(r.NotListedLocation,{style:{color:s}}):"play"===e||"play"===t?(0,c.jsx)(r.PlayArrow,{style:{color:s}}):"stop"===e||"stop"===t?(0,c.jsx)(r.Stop,{style:{color:s}}):"pause"===e||"pause"===t?(0,c.jsx)(r.Pause,{style:{color:s}}):"forward"===e||"next"===e||"forward"===t||"next"===t?(0,c.jsx)(r.FastForward,{style:{color:s}}):"rewind"===e||"previous"===e||"rewind"===t||"previous"===t?(0,c.jsx)(r.FastRewind,{style:{color:s}}):"lamp"===e||"light"===e||"lamp"===t||"light"===t?(0,c.jsx)(r.Lightbulb,{style:{color:s}}):"backlight"===e||"backlight"===t?(0,c.jsx)(r.Fluorescent,{style:{color:s}}):"dimmer"===e||"dimmer"===t?(0,c.jsx)(r.WbIncandescent,{style:{color:s}}):"socket"===e||"socket"===t?(0,c.jsx)(r.Power,{style:{color:s}}):"settings"===e||"settings"===t?(0,c.jsx)(r.Settings,{style:{color:s}}):"users"===e||"group"===e||"users"===t||"group"===t?(0,c.jsx)(r.Group,{style:{color:s}}):"user"===e||"user"===t?(0,c.jsx)(r.Person,{style:{color:s}}):"qrcode"===e||"qrcode"===t?(0,c.jsx)(r.QrCode,{style:{color:s}}):"info"===e||"info"===t?(0,c.jsx)(r.Info,{style:{color:s}}):"lines"===e||"lines"===t?(0,c.jsx)(r.Article,{style:{color:s}}):(0,c.jsx)(r.QuestionMark,{style:{color:s}})}function u(e,t,s){var o,i,n,r;if(!e)return null;let l=s&&e.colorOn||e.color||(e.state?"primary":"inherit");return t&&("primary"===l?l=t.primary:"secondary"===l&&(l=t.secondary)),null!==(o=e.icon)&&void 0!==o&&o.startsWith("fa-")||null!==(i=e.icon)&&void 0!==i&&i.startsWith("fas")?p(e.icon,l):s&&null!==(n=e.iconOn)&&void 0!==n&&n.startsWith("data:image")?(0,c.jsx)(a.Icon,{src:e.iconOn,style:{color:l}}):null!==(r=e.icon)&&void 0!==r&&r.startsWith("data:image")?(0,c.jsx)(a.Icon,{src:e.icon,style:{color:l}}):h(e.id,e.icon,l)}function v(e){var t,s,o;return e?null!==(t=e.icon)&&void 0!==t&&t.startsWith("fa-")||null!==(s=e.icon)&&void 0!==s&&s.startsWith("fas")?p(e.icon,e.color):null!==(o=e.icon)&&void 0!==o&&o.startsWith("data:image")?(0,c.jsx)(a.Icon,{src:e.icon,style:{color:e.color}}):h(e.id,e.icon,e.color):null}let m;function g(e,t){return m=m||a.I18n.getLanguage(),"object"===typeof e?e[m]||e.en:t?e:a.I18n.t(e)}function f(e){var t;const{deviceId:s,action:o,refresh:i,deviceHandler:n,disabled:r}=e,a=v(o),l=g(null!==(t=o.description)&&void 0!==t?t:"")||(a?null:o.id);return(0,c.jsx)(d,{tooltip:l||void 0,disabled:r||o.disabled,Icon:a,onClick:n(s,o,i)})}class x extends i.Component{constructor(e){var t,s;super(e),this.stateHandler=async(e,t)=>{if(e===this.props.control.stateId&&t){const e=await this.props.controlStateHandler(this.props.deviceId,this.props.control)();null!==e&&void 0!==e&&e.ts&&(!this.state.ts||e.ts>this.state.ts)&&this.setState({value:e.val,ts:e.ts})}},this.state={value:null===(t=e.control.state)||void 0===t?void 0:t.val,ts:null===(s=e.control.state)||void 0===s?void 0:s.ts}}async componentDidMount(){if(this.props.control.stateId){const e=this.props.socket.subscribeState(this.props.control.stateId,this.stateHandler);e instanceof Promise&&await e}}componentWillUnmount(){this.props.control.stateId&&this.props.socket.unsubscribeState(this.props.control.stateId,this.stateHandler)}static getDerivedStateFromProps(e,t){var s,o;return null!==(s=e.control.state)&&void 0!==s&&s.ts&&(!t.ts||(null===(o=e.control.state)||void 0===o?void 0:o.ts)>t.ts)?{value:e.control.state.val,ts:e.control.state.ts}:null}async sendControl(e,t,s){const o=await this.props.controlHandler(e,t,s)();null!==o&&void 0!==o&&o.ts&&(!this.state.ts||(null===o||void 0===o?void 0:o.ts)>this.state.ts)&&this.setState({value:o.val,ts:o.ts})}renderButton(){var e;const t=g(null!==(e=this.props.control.description)&&void 0!==e?e:""),s=u(this.props.control,this.props.colors,this.state.value);return this.props.control.label?(0,c.jsx)(n.Button,{disabled:this.props.disabled,title:t,onClick:()=>this.sendControl(this.props.deviceId,this.props.control,!0),startIcon:s,children:g(this.props.control.label)}):(0,c.jsx)(n.Fab,{size:"small",disabled:this.props.disabled,title:t,onClick:()=>this.sendControl(this.props.deviceId,this.props.control,!0),children:s})}renderSwitch(){var e;const t=g(null!==(e=this.props.control.description)&&void 0!==e?e:"");return(0,c.jsx)(n.Switch,{disabled:this.props.disabled,title:t,checked:!!this.state.value,onChange:e=>this.sendControl(this.props.deviceId,this.props.control,e.target.checked)})}getColor(){let e;return this.state.value?e=this.props.control.colorOn||"primary":"switch"===this.props.control.type&&(e=this.props.control.color),"primary"===e?this.props.colors.primary:"secondary"===e?this.props.colors.secondary:e}renderSelect(){return null}renderSlider(){return null}renderColor(){return null}renderIcon(){var e;const t=g(null!==(e=this.props.control.description)&&void 0!==e?e:""),s=u(this.props.control,this.props.colors,this.state.value),o=this.getColor(),i=o===this.props.colors.primary||o===this.props.colors.secondary?{}:{color:o},r=o===this.props.colors.primary?"primary":o===this.props.colors.secondary?"secondary":void 0;return this.props.control.label?(0,c.jsx)(n.Button,{disabled:this.props.disabled,title:t,color:r,style:i,onClick:()=>this.sendControl(this.props.deviceId,this.props.control,!this.state.value),startIcon:s,children:g(this.props.control.label)}):(i.width=34,i.height=34,i.minHeight=34,(0,c.jsx)(n.Fab,{disabled:this.props.disabled,size:"small",title:t,color:r,style:i,onClick:()=>this.sendControl(this.props.deviceId,this.props.control,!this.state.value),children:s}))}render(){return"button"===this.props.control.type?this.renderButton():"icon"===this.props.control.type?this.renderIcon():"switch"===this.props.control.type?this.renderSwitch():(0,c.jsx)("div",{style:{color:"red"},children:this.props.control.type})}}const I=20;class y extends i.Component{render(){const e=(0,c.jsxs)("div",{style:{width:"small"===this.props.size?30:34,height:I,display:"flex",alignItems:"center",cursor:"pointer",position:"relative",opacity:this.props.disabled?.7:1},onClick:e=>{this.props.disabled||(e.stopPropagation(),e.preventDefault(),this.props.onChange(!this.props.checked))},children:[(0,c.jsx)("div",{style:{borderRadius:15,width:"100%",height:.7*("small"===this.props.size?15:I),opacity:.6,backgroundColor:this.props.checked?this.props.theme.palette.primary.main:this.props.theme.palette.text.disabled}}),(0,c.jsx)("div",{style:{position:"absolute",top:"small"===this.props.size?2.5:0,left:this.props.checked?"small"===this.props.size?15:14:0,transition:"left 0.2s",borderRadius:50,width:"small"===this.props.size?15:I,height:"small"===this.props.size?15:I,backgroundColor:this.props.checked?this.props.theme.palette.primary.main:"#EEE",boxShadow:"rgba(0, 0, 0, 0.2) 0px 2px 1px -1px, rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px"}})]});return this.props.labelOn||this.props.labelOff?(0,c.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[this.props.labelOff,e,this.props.labelOn]}):e}}const T={tooltip:{pointerEvents:"none"}};function b(e){return(0,c.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:t=>e.onClick&&e.onClick(t),viewBox:"0 0 165 165",width:e.width||("small"===e.fontSize?16:20),height:e.height||e.width||("small"===e.fontSize?16:20),className:e.className,style:e.style,children:[(0,c.jsx)("path",{fill:"currentColor",d:"M82.498,0C37.008,0,0,37.008,0,82.496c0,45.181,36.51,81.977,81.573,82.476V82.569l-27.002-0.002 c-8.023,0-14.554,6.53-14.554,14.561c0,8.023,6.531,14.551,14.554,14.551v17.98c-17.939,0-32.534-14.595-32.534-32.531 c0-17.944,14.595-32.543,32.534-32.543l27.002,0.004v-9.096c0-14.932,12.146-27.08,27.075-27.08 c14.932,0,27.082,12.148,27.082,27.08c0,14.931-12.15,27.08-27.082,27.08l-9.097-0.001v80.641 C136.889,155.333,165,122.14,165,82.496C165,37.008,127.99,0,82.498,0z"}),(0,c.jsx)("path",{fill:"currentColor",d:"M117.748,55.493c0-5.016-4.082-9.098-9.1-9.098c-5.015,0-9.097,4.082-9.097,9.098v9.097l9.097,0.001 C113.666,64.591,117.748,60.51,117.748,55.493z"})]})}function C(e){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:t=>e.onClick&&e.onClick(t),viewBox:"0 0 1073 1068",width:e.width||("small"===e.fontSize?16:20),height:e.height||e.width||("small"===e.fontSize?16:20),className:e.className,style:e.style,children:(0,c.jsx)("path",{fill:"currentColor",d:"M716 1.1C632.9 5.3 549.8 23.7 472 55c-66.4 26.7-132.6 65.5-188.5 110.4-43.8 35.1-85.2 76.7-120.1 120.6C72.4 400.4 16.7 539.8 3.5 686 1.8 705.1-.1 754.7.7 758c.5 2 1 2 49.7 1.8l49.1-.3.7-20c2.4-64.6 13.4-126 33.2-186 80.8-243.9 297-419.9 552.1-449.4 20.2-2.4 44.2-4.1 56.6-4.1h8.9V50 0l-9.7.1c-5.4.1-16.8.6-25.3 1zm-.8 208c-78.5 4.7-158 27.4-226.5 64.5-68.7 37.3-126.4 86.3-175.2 148.9-11 14-33.2 47.3-42.3 63.5-44 77.8-68.6 164.9-70.9 251.2l-.6 22.8h49.5 49.4l1.2-19c6.3-98.7 40-185.8 102.2-263.3 12.7-15.9 41.2-45.2 57-58.7 66.1-56.3 142.1-91.8 226-105.5 18.9-3 44.1-5.5 56.7-5.5h9.3v-50-50l-11.2.1c-6.2.1-17.3.6-24.6 1zm17.8 251c-104.5 9.2-195.2 69.7-243.6 162.4-43.9 84-45.5 184.2-4.5 270 60.3 125.9 198.1 194.2 334.9 166 46.6-9.7 89.5-29.7 127.2-59.6 13.5-10.7 37.3-34.5 48-47.9 34.2-43.1 55.2-92 63.7-148.6 2.2-15.1 2.5-62.7.5-77.4-3.6-25.2-10.1-51.4-17.8-71.2-10.1-26.2-29.4-59.7-47-81.8-9.7-12.1-35-37.2-47.4-47-47.8-37.9-104.5-60.1-165.4-65-14.7-1.1-34.7-1.1-48.6.1zm174.7 138.6c-.3.5-30.9 49.2-68.1 108.3L772 814.5l67.9.5 68 .5-30.1 48.8-30 48.7h-131c-104.4 0-130.9-.3-130.5-1.3.2-.6 32.7-51.1 72.1-112.1L730 687.9c0-.5-29.5-1-66.5-1.1l-66.6-.3 27.7-44.3 27.6-44.2h128l127.5.7z"})})}function j(e){return(0,c.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:t=>e.onClick&&e.onClick(t),viewBox:"0 0 48 48",width:e.width||("small"===e.fontSize?16:20),height:e.height||e.width||("small"===e.fontSize?16:20),className:e.className,style:e.style,children:[(0,c.jsx)("path",{fill:"currentColor",d:"M32.042,9.792c4.595,1.238,4.88,3.165,5.524,5.048C34.841,17.664,17.35,35.7,17.35,35.7 s10.901,1.177,23.487-1.003c-0.001,0.029-0.002,0.048-0.003,0.076C42.829,31.661,44,27.97,44,24c0-11.046-8.954-20-20-20 c-5.634,0-10.715,2.338-14.35,6.087C15.489,9.124,26.89,8.403,32.042,9.792z"}),(0,c.jsx)("path",{fill:"currentColor",d:"M14.724,37.285c-1.982-0.347-4.212-2.131-4.707-5.302c1.437-1.239,19.994-20.507,19.994-20.507 c-7.008-0.424-14.569-0.465-22.237,0.864C5.408,15.625,4,19.644,4,24c0,11.046,8.954,20,20,20c6.173,0,11.689-2.8,15.358-7.195 C35.486,37.33,23.257,38.769,14.724,37.285z"})]})}function w(e){if(!e.status)return null;let t;t="string"===typeof e.status?{connection:e.status}:e.status;const s={fill:"#00ac00"},o={fill:"#ff0000"},i={fill:"#ff9900"},a={fill:"#8a8a8a"};let l=null;"number"===typeof t.battery&&(l=t.battery>=96&&t.battery<=100?(0,c.jsx)(r.BatteryFull,{style:s}):t.battery>=90&&t.battery<=95?(0,c.jsx)(r.Battery90,{style:s}):t.battery>=80&&t.battery<=89?(0,c.jsx)(r.Battery80,{style:s}):t.battery>=60&&t.battery<=79?(0,c.jsx)(r.Battery60,{style:s}):t.battery>=50&&t.battery<=59?(0,c.jsx)(r.Battery50,{style:s}):t.battery>=30&&t.battery<=49?(0,c.jsx)(r.Battery30,{style:s}):t.battery>=20&&t.battery<=29?(0,c.jsx)(r.Battery20,{style:o}):(0,c.jsx)(r.BatteryAlert,{style:o}));const d="boolean"===typeof e.enabled?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{style:{flexGrow:1}}),(0,c.jsx)(n.Tooltip,{title:e.enabled?g("disableIconTooltip"):g("enableIconTooltip"),slotProps:{popper:{sx:T.tooltip}},children:(0,c.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:(0,c.jsx)(y,{size:"small",checked:e.enabled,disabled:!e.disableEnableAction,onChange:()=>e.disableEnableAction&&e.deviceHandler(e.deviceId,e.disableEnableAction,e.refresh)(),theme:e.theme})})})]}):null;let p;p="wifi"===e.connectionType?"connected"===t.connection?(0,c.jsx)(r.Wifi,{style:s}):"disconnected"===t.connection?(0,c.jsx)(r.WifiOff,{style:o}):(0,c.jsx)(r.Wifi,{style:a}):"bluetooth"===e.connectionType?"connected"===t.connection?(0,c.jsx)(r.Bluetooth,{style:s}):"disconnected"===t.connection?(0,c.jsx)(r.BluetoothDisabled,{style:o}):(0,c.jsx)(r.Bluetooth,{style:a}):"lan"===e.connectionType?"connected"===t.connection?(0,c.jsx)(r.Cable,{style:s}):"disconnected"===t.connection?(0,c.jsx)(r.Cable,{style:o}):(0,c.jsx)(r.Cable,{style:a}):"thread"===e.connectionType?"connected"===t.connection?(0,c.jsx)(b,{style:s}):"disconnected"===t.connection?(0,c.jsx)(b,{style:o}):(0,c.jsx)(b,{style:a}):"z-wave"===e.connectionType?"connected"===t.connection?(0,c.jsx)(C,{style:s}):"disconnected"===t.connection?(0,c.jsx)(C,{style:o}):(0,c.jsx)(C,{style:a}):"zigbee"===e.connectionType?"connected"===t.connection?(0,c.jsx)(j,{style:s}):"disconnected"===t.connection?(0,c.jsx)(j,{style:o}):(0,c.jsx)(j,{style:a}):"connected"===t.connection?(0,c.jsx)(r.Link,{style:s}):"disconnected"===t.connection?(0,c.jsx)(r.LinkOff,{style:o}):null;const h="connected"===t.connection||"disconnected"===t.connection?(0,c.jsx)(n.Tooltip,{title:("connected"===t.connection?g("connectedIconTooltip"):g("disconnectedIconTooltip"))+(e.statusAction?". ".concat(g(e.statusAction.description||"moreInformation")):""),slotProps:{popper:{sx:T.tooltip}},children:e.statusAction?(0,c.jsxs)(n.IconButton,{onClick:t=>{e.statusAction&&(t.stopPropagation(),e.deviceHandler(e.deviceId,e.statusAction,e.refresh)())},children:[p,(0,c.jsx)("div",{style:{position:"absolute",top:0,left:0,color:"grey"},children:"*"})]}):(0,c.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:p})}):p;return(0,c.jsxs)("div",{style:{display:"flex",alignItems:"center",cursor:e.statusAction?"pointer":void 0,width:e.disableEnableAction?"100%":void 0,gap:8},children:[h,t.rssi&&(0,c.jsx)(n.Tooltip,{title:"RSSI",slotProps:{popper:{sx:T.tooltip}},children:(0,c.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,c.jsx)(r.NetworkCheck,{}),(0,c.jsx)("p",{style:{fontSize:"small",margin:0},children:t.rssi})]})}),"number"===typeof t.battery&&(0,c.jsx)(n.Tooltip,{title:g("batteryTooltip"),slotProps:{popper:{sx:T.tooltip}},children:(0,c.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[l,(0,c.jsxs)("p",{style:{fontSize:"small",margin:0},children:[t.battery,"%"]})]})}),"string"===typeof t.battery&&(0,c.jsx)(n.Tooltip,{title:g("batteryTooltip"),slotProps:{popper:{sx:T.tooltip}},children:(0,c.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:["charging"===t.battery?(0,c.jsx)(r.BatteryCharging50,{}):(0,c.jsx)(r.BatteryFull,{}),"charging"!==t.battery?t.battery.includes("V")||t.battery.includes("mV")?(0,c.jsx)("p",{style:{fontSize:"small",margin:0},children:t.battery}):(0,c.jsxs)("p",{style:{fontSize:"small",margin:0},children:[(0,c.jsx)("span",{style:{marginRight:4},children:t.battery}),"mV"]}):null]})}),"boolean"===typeof t.battery&&(0,c.jsx)(n.Tooltip,{title:g("batteryTooltip"),slotProps:{popper:{sx:T.tooltip}},children:(0,c.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:t.battery?(0,c.jsx)(r.BatteryFull,{style:s}):(0,c.jsx)(r.BatteryAlert,{style:o})})}),t.warning?"string"===typeof t.warning||"object"===typeof t.warning?(0,c.jsx)(n.Tooltip,{title:g(t.warning),slotProps:{popper:{sx:T.tooltip}},children:(0,c.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:(0,c.jsx)(r.Warning,{style:i})})}):(0,c.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:(0,c.jsx)(r.Warning,{style:i})}):null,d]})}var D=s(4531);function E(e){var t,s;const{instanceId:o,socket:n,schema:r,data:a,onChange:l}=e,[d,p]=(0,i.useState)(!1);if(void 0===r)return null;const[h,u]=o.split(".",2);return(0,c.jsxs)(c.Fragment,{children:[d&&(0,c.jsx)("div",{children:d}),(0,c.jsx)(D.JsonConfigComponent,{expertMode:e.expertMode,socket:n,adapterName:h,instance:parseInt(u,10),schema:r,data:a,onError:p,onChange:e=>l(e),embedded:!0,themeName:e.themeName,themeType:e.themeType,theme:e.theme,isFloatComma:void 0===e.isFloatComma?!(null===(t=e.socket.systemConfig)||void 0===t||!t.common.isFloatComma):e.isFloatComma,dateFormat:void 0===e.dateFormat?null===(s=e.socket.systemConfig)||void 0===s?void 0:s.common.dateFormat:e.dateFormat})]})}const N=function(e){const{socket:t,manufacturer:s,model:o,deviceId:i,onImageSelect:n,uploadImagesToInstance:r}=e;return(0,c.jsx)("div",{children:(0,c.jsx)("input",{style:{opacity:0,position:"absolute",width:"45px",height:"45px",zIndex:3},type:"file",accept:"image/*",onChange:e=>{const a=e.target.files;if(!a||0===a.length)return;const l=a[0];if(l){const e=new FileReader;e.onload=e=>{if(!e.target||!e.target.result)return;const a=new Image;a.src=e.target.result,a.onload=async()=>{let e=a.width,l=a.height;e>l?e>50&&(l*=50/e,e=50):l>50&&(e*=50/l,l=50);const c=document.createElement("canvas"),d=c.getContext("2d");if(d){c.width=e,c.height=l,d.drawImage(a,0,0,e,l);const p=c.toDataURL("image/webp"),h="".concat(s?"".concat(s,"_"):"").concat(o||i),u=p.replace(/^data:image\/webp;base64,/,""),v=await t.writeFile64(r,h,u);console.log("saveImage response: ".concat(JSON.stringify(v))),n&&n(p)}}},e.readAsDataURL(l)}}})})};function _(e){return(0,c.jsx)("svg",{viewBox:"0 0 24 24",width:"24",height:"24",style:e.style,className:e.className,children:(0,c.jsx)("path",{fill:"currentColor",d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})})}function S(e){return"object"===typeof e?e[a.I18n.getLanguage()]||e.en:e}class A extends i.Component{constructor(e){super(e),this.refresh=()=>{this.setState({details:null}),this.loadDetails().catch(console.error)},this.copyToClipboard=()=>{const e=this.props.device.id;a.Utils.copyToClipboard(e),alert("".concat(g("copied")," ").concat(e," ").concat(g("toClipboard"),"!"))},this.state={open:!1,details:null,data:{},icon:e.device.icon,showControlDialog:!1}}async fetchIcon(){if(!this.props.device.icon){const t=a.I18n.getLanguage(),s=this.props.device.manufacturer&&"object"===typeof this.props.device.manufacturer?this.props.device.manufacturer[t]||this.props.device.manufacturer.en:this.props.device.manufacturer,o=this.props.device.model&&"object"===typeof this.props.device.model?this.props.device.model[t]||this.props.device.model.en:this.props.device.model,i="".concat(s?"".concat(s,"_"):"").concat(o||this.props.device.id);try{const e=await this.props.socket.readFile(this.props.instanceId.replace("system.adapter.",""),"".concat(i,".webp"),!0);e?this.setState({icon:"data:image/".concat(e.mimeType,",").concat(e.file)}):this.setState({icon:""})}catch(e){this.state.icon&&this.setState({icon:""})}}}componentDidMount(){this.fetchIcon().catch((e=>console.error(e)))}async loadDetails(){console.log("Loading device details for ".concat(this.props.device.id,"... from ").concat(this.props.instanceId));const e=await this.props.socket.sendTo(this.props.instanceId,"dm:deviceDetails",this.props.device.id);console.log("Got device details for ".concat(this.props.device.id,":"),e),this.setState({details:e,data:(null===e||void 0===e?void 0:e.data)||{}})}renderDialog(){return this.state.open&&this.state.details?(0,c.jsxs)(n.Dialog,{open:!0,maxWidth:"md",onClose:()=>this.setState({open:!1}),children:[(0,c.jsx)(n.DialogContent,{children:(0,c.jsx)(E,{instanceId:this.props.instanceId,socket:this.props.socket,schema:this.state.details.schema,data:this.state.data,onChange:e=>this.setState({data:e}),themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat})}),(0,c.jsx)(n.DialogActions,{children:(0,c.jsx)(n.Button,{disabled:!this.props.alive,variant:"contained",color:"primary",onClick:()=>this.setState({open:!1}),autoFocus:!0,children:g("closeButtonText")})})]}):null}renderControlDialog(){var e;if(!this.state.showControlDialog||!this.props.alive)return null;const t={primary:"#111",secondary:"#888"};return(0,c.jsxs)(n.Dialog,{open:!0,onClose:()=>this.setState({showControlDialog:!1}),children:[(0,c.jsxs)(n.DialogTitle,{children:[this.props.title,(0,c.jsx)(n.IconButton,{style:{position:"absolute",top:5,right:5,zIndex:10},onClick:()=>this.setState({showControlDialog:!1}),children:(0,c.jsx)(r.Close,{})})]}),(0,c.jsx)(n.DialogContent,{style:{display:"flex",flexDirection:"column"},children:null===(e=this.props.device.controls)||void 0===e?void 0:e.map((e=>(0,c.jsx)(x,{disabled:!1,control:e,socket:this.props.socket,colors:t,deviceId:this.props.device.id,controlHandler:this.props.controlHandler,controlStateHandler:this.props.controlStateHandler},e.id)))})]})}renderControls(){var e,t,s;const o={primary:"#111",secondary:"#888"},i=null===(e=this.props.device.controls)||void 0===e?void 0:e[0];return 1!==(null===(t=this.props.device.controls)||void 0===t?void 0:t.length)||!i||"icon"!==i.type&&"switch"!==i.type||i.label?null!==(s=this.props.device.controls)&&void 0!==s&&s.length?(0,c.jsx)(n.Fab,{size:"small",disabled:!this.props.alive,onClick:()=>this.setState({showControlDialog:!0}),children:(0,c.jsx)(r.VideogameAsset,{})}):null:(0,c.jsx)(x,{disabled:!this.props.alive,control:i,colors:o,socket:this.props.socket,deviceId:this.props.device.id,controlHandler:this.props.controlHandler,controlStateHandler:this.props.controlStateHandler})}renderActions(){var e;const t=null===(e=this.props.device.actions)||void 0===e?void 0:e.filter((e=>e.id!==l.ACTIONS.STATUS&&e.id!==l.ACTIONS.ENABLE_DISABLE));return null!==t&&void 0!==t&&t.length?t.map((e=>(0,c.jsx)(f,{disabled:!this.props.alive,deviceId:this.props.device.id,action:e,deviceHandler:this.props.deviceHandler,refresh:this.refresh},e.id))):null}renderSmall(){const e=this.props.device.hasDetails,t=this.props.device.status?Array.isArray(this.props.device.status)?this.props.device.status:[this.props.device.status]:[],s=this.state.icon?(0,c.jsx)(a.IconDeviceType,{src:this.state.icon}):(0,c.jsx)(_,{});return(0,c.jsxs)(n.Card,{sx:{maxWidth:345,minWidth:200},children:[(0,c.jsx)(n.CardHeader,{sx:e=>({backgroundColor:"primary"===this.props.device.color?e.palette.primary.main:"secondary"===e.palette.secondary.main?e.palette.secondary.main:this.props.device.color||e.palette.secondary.main,color:this.props.device.color&&"primary"!==this.props.device.color&&"secondary"!==this.props.device.color?a.Utils.invertColor(this.props.device.color,!0):e.palette.secondary.contrastText,maxWidth:345}),avatar:(0,c.jsxs)("div",{children:[this.props.uploadImagesToInstance?(0,c.jsx)(N,{uploadImagesToInstance:this.props.uploadImagesToInstance,deviceId:this.props.device.id,manufacturer:S(this.props.device.manufacturer),model:S(this.props.device.model),onImageSelect:e=>{e&&this.setState({icon:e})},socket:this.props.socket}):null,s]}),action:e?(0,c.jsx)(n.IconButton,{"aria-label":"settings",onClick:()=>{this.state.open||(this.loadDetails().catch(console.error),this.setState({open:!0}))},children:(0,c.jsx)(r.MoreVert,{})}):null,title:this.props.title,subheader:this.props.device.manufacturer?(0,c.jsxs)("span",{children:[(0,c.jsxs)("b",{style:{marginRight:4},children:[g("manufacturer"),":"]}),S(this.props.device.manufacturer)]}):null}),(0,c.jsxs)(n.CardContent,{style:{position:"relative"},children:[null!==t&&void 0!==t&&t.length?(0,c.jsx)("div",{style:{display:"flex",position:"absolute",top:-11,background:"#88888880",padding:"0 8px",borderRadius:5,width:"calc(100% - 46px)"},children:t.map(((e,t)=>{var s,o;return(0,c.jsx)(w,{status:e,connectionType:this.props.device.connectionType,enabled:this.props.device.enabled,deviceId:this.props.device.id,statusAction:null===(s=this.props.device.actions)||void 0===s?void 0:s.find((e=>e.id===l.ACTIONS.STATUS)),disableEnableAction:null===(o=this.props.device.actions)||void 0===o?void 0:o.find((e=>e.id===l.ACTIONS.ENABLE_DISABLE)),deviceHandler:this.props.deviceHandler,refresh:this.refresh,theme:this.props.theme},t)}))}):null,(0,c.jsx)("div",{children:(0,c.jsxs)(n.Typography,{variant:"body1",children:[(0,c.jsxs)("div",{onClick:this.copyToClipboard,style:{textOverflow:"ellipsis",overflow:"hidden"},children:[(0,c.jsx)("b",{children:"ID:"}),(0,c.jsx)("span",{style:{marginLeft:4},children:this.props.device.id.replace(/.*\.\d\./,"")})]}),this.props.device.manufacturer?(0,c.jsxs)("div",{children:[(0,c.jsxs)("b",{style:{marginRight:4},children:[g("manufacturer"),":"]}),S(this.props.device.manufacturer)]}):null,this.props.device.model?(0,c.jsxs)("div",{children:[(0,c.jsxs)("b",{style:{marginRight:4},children:[g("model"),":"]}),S(this.props.device.model)]}):null]})})]}),(0,c.jsxs)(n.CardActions,{disableSpacing:!0,children:[this.renderActions(),(0,c.jsx)("div",{style:{flexGrow:1}}),this.renderControls()]}),this.renderDialog(),this.renderControlDialog()]})}renderBig(){var e,t,s,o,i;const d={zIndex:2,maxWidth:"100%",maxHeight:"100%",color:"#FFF"},p=this.props.device.status?Array.isArray(this.props.device.status)?this.props.device.status:[this.props.device.status]:[],h=this.state.icon?(0,c.jsx)(a.IconDeviceType,{src:this.state.icon,style:d}):(0,c.jsx)(_,{style:d}),u=(null===(e=this.state.details)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.name)||this.props.title||"";return(0,c.jsxs)(n.Paper,{style:{width:300,minHeight:280,margin:10,overflow:"hidden",display:"inline-block"},children:[(0,c.jsxs)(n.Box,{sx:e=>({backgroundColor:e.palette.secondary.main}),style:{display:"flex",alignItems:"center",gap:8,paddingLeft:8,paddingRight:8,position:"relative",minHeight:60,color:"#000"},children:[(0,c.jsxs)("div",{style:{height:45,width:45,justifyContent:"center",display:"flex",alignItems:"center"},children:[this.props.uploadImagesToInstance?(0,c.jsx)(N,{uploadImagesToInstance:this.props.uploadImagesToInstance,deviceId:this.props.device.id,manufacturer:S(this.props.device.manufacturer),model:S(this.props.device.model),onImageSelect:e=>{e&&this.setState({icon:e})},socket:this.props.socket}):null,h]}),(0,c.jsx)(n.Box,{style:{fontSize:16,fontWeight:"bold",overflow:"hidden",textOverflow:"ellipsis"},title:u.length>20?u:void 0,sx:e=>({color:e.palette.secondary.contrastText}),children:(null===(s=this.state.details)||void 0===s||null===(o=s.data)||void 0===o?void 0:o.name)||this.props.title}),this.props.device.hasDetails?(0,c.jsx)(n.Fab,{disabled:!this.props.alive,size:"small",style:{right:20,bottom:-20,position:"absolute"},onClick:()=>{this.state.open||(this.loadDetails().catch(console.error),this.setState({open:!0}))},color:"primary",children:(0,c.jsx)(r.MoreVert,{})}):null]}),(0,c.jsx)("div",{style:{padding:"15px 25px 0 15px",height:41},children:p.map(((e,t)=>{var s,o;return(0,c.jsx)(w,{deviceId:this.props.device.id,connectionType:this.props.device.connectionType,status:e,enabled:this.props.device.enabled,statusAction:null===(s=this.props.device.actions)||void 0===s?void 0:s.find((e=>e.id===l.ACTIONS.STATUS)),disableEnableAction:null===(o=this.props.device.actions)||void 0===o?void 0:o.find((e=>e.id===l.ACTIONS.ENABLE_DISABLE)),deviceHandler:this.props.deviceHandler,refresh:this.refresh,theme:this.props.theme},t)}))}),(0,c.jsxs)("div",{style:{height:"calc(100% - 116px)"},children:[(0,c.jsxs)(n.Typography,{variant:"body1",style:{padding:"20px 16px 0 16px",height:133},children:[(0,c.jsxs)("div",{onClick:this.copyToClipboard,children:[(0,c.jsx)("b",{style:{marginRight:4},children:"ID:"}),this.props.device.id.replace(/.*\.\d\./,"")]}),this.props.device.manufacturer?(0,c.jsxs)("div",{children:[(0,c.jsxs)("b",{style:{marginRight:4},children:[g("manufacturer"),":"]}),S(this.props.device.manufacturer)]}):null,this.props.device.model?(0,c.jsxs)("div",{children:[(0,c.jsxs)("b",{style:{marginRight:4},children:[g("model"),":"]}),S(this.props.device.model)]}):null]}),!(null===(i=this.props.device.actions)||void 0===i||!i.length)&&(0,c.jsxs)("div",{style:{flex:1,position:"relative",display:"flex",gap:8,paddingBottom:5,height:34,paddingLeft:10,paddingRight:10},children:[this.renderActions(),(0,c.jsx)("div",{style:{flexGrow:1}}),this.renderControls()]})]}),this.renderDialog(),this.renderControlDialog()]},this.props.id)}render(){return this.props.smallCards?this.renderSmall():this.renderBig()}}const O=A;class k extends i.Component{constructor(e){super(e),this.responseTimeout=null,this.instanceHandler=void 0,this.deviceHandler=void 0,this.controlHandler=void 0,this.controlStateHandler=void 0,this.sendActionToInstance=(e,t,s)=>{(async()=>{this.setState({showSpinner:!0}),this.responseTimeout=setTimeout((()=>{this.setState({showSpinner:!1}),window.alert(a.I18n.t("ra_No response from the backend"))}),5e3);const i=await this.props.socket.sendTo(this.props.selectedInstance,e,t);this.responseTimeout&&(clearTimeout(this.responseTimeout),this.responseTimeout=null);const n=i.type;switch(console.log("Response: ".concat(i.type)),n){case"message":console.log("Message received: ".concat(i.message)),i.message&&this.setState({message:{message:i.message,handleClose:()=>this.setState({message:null},(()=>this.sendActionToInstance("dm:actionProgress",{origin:i.origin},s)))},showSpinner:!1});break;case"confirm":console.log("Confirm received: ".concat(i.confirm)),i.confirm&&this.setState({confirm:{message:i.confirm,handleClose:e=>this.setState({confirm:null},(()=>this.sendActionToInstance("dm:actionProgress",{origin:i.origin,confirm:e},s)))},showSpinner:!1});break;case"form":if(console.log("Form received"),i.form){const e=i.form.data,t={};e&&Object.keys(e).forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),i.form.data=JSON.parse(JSON.stringify(t)),this.setState({form:(0,o.A)((0,o.A)({},i.form),{},{changed:!1,originalData:JSON.stringify(t),handleClose:e=>this.setState({form:null},(()=>{console.log("Form ".concat(JSON.stringify(e))),this.sendActionToInstance("dm:actionProgress",{origin:i.origin,data:e},s)}))}),showSpinner:!1})}break;case"progress":if(i.progress)if(this.state.progress){const e=(0,o.A)((0,o.A)({},this.state.progress),i.progress);this.setState({progress:e,showSpinner:!1})}else this.setState({progress:i.progress,showSpinner:!1});this.sendActionToInstance("dm:actionProgress",{origin:i.origin},s);break;case"result":console.log("Response content",i.result),i.result.refresh&&(!0===i.result.refresh?(console.log("Refreshing all"),this.loadData()):"instance"===i.result.refresh?console.log("Refreshing instance infos: ".concat(this.props.selectedInstance)):"device"===i.result.refresh?s?(console.log("Refreshing device infos: ".concat(this.props.selectedInstance)),s()):console.log('No refresh function provided to refresh "device"'):console.log("Not refreshing anything")),i.result.error?(console.error("Error: ".concat(i.result.error.message)),this.setState({showToast:i.result.error.message,showSpinner:!1})):this.setState({showSpinner:!1});break;default:console.log("Unknown response type: ".concat(n)),this.setState({showSpinner:!1})}})().catch(console.error)},this.sendControlToInstance=async(e,t)=>{const s=await this.props.socket.sendTo(this.props.selectedInstance,e,t),o=s.type;if(console.log("Response: ".concat(s.type)),"result"===s.type){if(console.log("Response content",s.result),s.result.error)console.error("Error: ".concat(s.result.error.message)),this.setState({showToast:s.result.error.message});else if(void 0!==s.result.state)return s.result.state}else console.warn("Unexpected response type",o);return null},this.state={showSpinner:!1,showToast:null,message:null,confirm:null,form:null,progress:null,showConfirmation:null,showInput:null,inputValue:null},this.instanceHandler=e=>()=>{e.confirmation?this.setState({showConfirmation:e}):e.inputBefore?this.setState({showInput:e}):this.sendActionToInstance("dm:instanceAction",{actionId:e.id})},this.deviceHandler=(e,t,s)=>()=>{t.confirmation?this.setState({showConfirmation:(0,o.A)((0,o.A)({},t),{},{deviceId:e,refresh:s})}):t.inputBefore?this.setState({showInput:(0,o.A)((0,o.A)({},t),{},{deviceId:e,refresh:s}),inputValue:t.inputBefore.defaultValue||""}):this.sendActionToInstance("dm:deviceAction",{deviceId:e,actionId:t.id},s)},this.controlHandler=(e,t,s)=>()=>this.sendControlToInstance("dm:deviceControl",{deviceId:e,controlId:t.id,state:s}),this.controlStateHandler=(e,t)=>()=>this.sendControlToInstance("dm:deviceControlState",{deviceId:e,controlId:t.id}),this.props.registerHandler&&this.props.registerHandler((()=>this.loadData()))}componentWillUnmount(){this.responseTimeout&&(clearTimeout(this.responseTimeout),this.responseTimeout=null)}loadData(){console.error("loadData not implemented")}loadDevices(){return this.props.socket.sendTo(this.props.selectedInstance,"dm:listDevices")}loadInstanceInfos(){return this.props.socket.sendTo(this.props.selectedInstance,"dm:instanceInfo")}renderMessageDialog(){var e;return this.state.message?(0,c.jsxs)(n.Dialog,{open:!0,onClose:()=>{var e;return null===(e=this.state.message)||void 0===e?void 0:e.handleClose()},hideBackdrop:!0,"aria-describedby":"message-dialog-description",children:[(0,c.jsx)(n.DialogContent,{children:(0,c.jsx)(n.DialogContentText,{id:"message-dialog-description",children:null===(e=this.state.message)||void 0===e?void 0:e.message})}),(0,c.jsx)(n.DialogActions,{children:(0,c.jsx)(n.Button,{color:"primary",onClick:()=>{var e;return null===(e=this.state.message)||void 0===e?void 0:e.handleClose()},variant:"contained",autoFocus:!0,children:g("okButtonText")})})]}):null}renderConfirmDialog(){var e;return this.state.confirm?(0,c.jsxs)(n.Dialog,{open:!0,onClose:()=>{var e;return null===(e=this.state.confirm)||void 0===e?void 0:e.handleClose()},hideBackdrop:!0,"aria-describedby":"confirm-dialog-description",children:[(0,c.jsx)(n.DialogContent,{children:(0,c.jsx)(n.DialogContentText,{id:"confirm-dialog-description",children:g(null===(e=this.state.confirm)||void 0===e?void 0:e.message)})}),(0,c.jsxs)(n.DialogActions,{children:[(0,c.jsx)(n.Button,{variant:"contained",color:"primary",onClick:()=>{var e;return null===(e=this.state.confirm)||void 0===e?void 0:e.handleClose(!0)},autoFocus:!0,children:g("yesButtonText")}),(0,c.jsx)(n.Button,{variant:"contained",color:"grey",onClick:()=>{var e;return null===(e=this.state.confirm)||void 0===e?void 0:e.handleClose(!1)},autoFocus:!0,children:g("noButtonText")})]})]}):null}renderSnackbar(){return(0,c.jsx)(n.Snackbar,{open:!!this.state.showToast,autoHideDuration:6e3,onClose:()=>this.setState({showToast:null}),message:this.state.showToast})}getOkButton(e){var t,s,o,i,r,l,d;return"string"===typeof e&&(e=void 0),(0,c.jsx)(n.Button,{disabled:!(null!==(t=this.state.form)&&void 0!==t&&t.changed),variant:(null===(s=e)||void 0===s?void 0:s.variant)||"contained",color:(null===(o=e)||void 0===o?void 0:o.color)||"primary",onClick:()=>{var e,t;return(null===(e=this.state.form)||void 0===e?void 0:e.handleClose)&&this.state.form.handleClose(null===(t=this.state.form)||void 0===t?void 0:t.data)},startIcon:null!==(i=e)&&void 0!==i&&i.icon?(0,c.jsx)(a.Icon,{src:null===(r=e)||void 0===r?void 0:r.icon}):void 0,children:g((null===(l=e)||void 0===l?void 0:l.label)||"okButtonText",null===(d=e)||void 0===d?void 0:d.noTranslation)},"apply")}getCancelButton(e){var t,s,o,i,l,d;let p=!1;return"string"===typeof e&&(p="close"===e,e=void 0),(0,c.jsx)(n.Button,{variant:(null===(t=e)||void 0===t?void 0:t.variant)||"contained",color:(null===(s=e)||void 0===s?void 0:s.color)||"grey",onClick:()=>{var e;return(null===(e=this.state.form)||void 0===e?void 0:e.handleClose)&&this.state.form.handleClose()},startIcon:p?(0,c.jsx)(r.Close,{}):null!==(o=e)&&void 0!==o&&o.icon?(0,c.jsx)(a.Icon,{src:null===(i=e)||void 0===i?void 0:i.icon}):void 0,children:g((null===(l=e)||void 0===l?void 0:l.label)||"cancelButtonText",null===(d=e)||void 0===d?void 0:d.noTranslation)},"cancel")}renderFormDialog(){var e,t,s;if(!this.state.form||!this.state.form.schema)return null;let i;return this.state.form.buttons?(i=[],this.state.form.buttons.forEach((e=>{"apply"===e||"apply"===e.type?i.push(this.getOkButton(e)):i.push(this.getCancelButton(e))}))):i=[this.getOkButton(),this.getCancelButton()],(0,c.jsxs)(n.Dialog,{open:!0,onClose:()=>{var e;return(null===(e=this.state.form)||void 0===e?void 0:e.handleClose)&&this.state.form.handleClose()},hideBackdrop:!0,fullWidth:!0,maxWidth:this.state.form.maxWidth||"md",children:[null!==(e=this.state.form)&&void 0!==e&&e.title?(0,c.jsx)(n.DialogTitle,{children:g((null===(t=this.state.form)||void 0===t?void 0:t.label)||(null===(s=this.state.form)||void 0===s?void 0:s.title),this.state.form.noTranslation)}):null,(0,c.jsx)(n.DialogContent,{children:(0,c.jsx)(E,{instanceId:this.props.selectedInstance,schema:this.state.form.schema,data:this.state.form.data||{},socket:this.props.socket,onChange:e=>{console.log("handleFormChange",{data:e});const t=(0,o.A)({},this.state.form);t&&(t.data=e,t.changed=JSON.stringify(e)!==t.originalData,this.setState({form:t}))},themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat})}),(0,c.jsx)(n.DialogActions,{children:i})]})}renderProgressDialog(){var e,t;return null!==(e=this.state.progress)&&void 0!==e&&e.open?(0,c.jsx)(n.Dialog,{open:!0,onClose:()=>{},hideBackdrop:!0,children:(0,c.jsx)(n.LinearProgress,{variant:"determinate",value:(null===(t=this.state.progress)||void 0===t?void 0:t.progress)||0})}):null}renderContent(){return null}renderSpinner(){return this.state.showSpinner?(0,c.jsx)(n.Backdrop,{style:{zIndex:1e3},open:!0,children:(0,c.jsx)(n.CircularProgress,{})}):null}renderConfirmationDialog(){return this.state.showConfirmation?(0,c.jsxs)(n.Dialog,{open:!0,onClose:()=>this.setState({showConfirmation:null}),children:[(0,c.jsx)(n.DialogTitle,{children:g(!0===this.state.showConfirmation.confirmation?g("areYouSureText"):g(this.state.showConfirmation.confirmation))}),(0,c.jsxs)(n.DialogActions,{children:[(0,c.jsx)(n.Button,{variant:"contained",color:"primary",onClick:()=>{if(!this.state.showConfirmation)return;const e=this.state.showConfirmation;this.setState({showConfirmation:null},(()=>{e.deviceId?this.sendActionToInstance("dm:deviceAction",{actionId:e.id,deviceId:e.deviceId},e.refresh):this.sendActionToInstance("dm:instanceAction",{actionId:e.id})}))},autoFocus:!0,startIcon:(0,c.jsx)(r.Check,{}),children:g("yesButtonText")}),(0,c.jsx)(n.Button,{variant:"contained",color:"grey",onClick:()=>this.setState({showConfirmation:null}),startIcon:(0,c.jsx)(r.Close,{}),children:g("cancelButtonText")})]})]}):null}onShowInputOk(){if(!this.state.showInput)return;const e=this.state.showInput;this.setState({showInput:null},(()=>{var t,s,o,i;e.deviceId?this.sendActionToInstance("dm:deviceAction",{actionId:e.id,deviceId:e.deviceId,value:"checkbox"===(null===(t=e.inputBefore)||void 0===t?void 0:t.type)?!!this.state.inputValue:"number"===(null===(s=e.inputBefore)||void 0===s?void 0:s.type)?parseFloat(this.state.inputValue)||0:this.state.inputValue},e.refresh):this.sendActionToInstance("dm:instanceAction",{actionId:e.id,value:"checkbox"===(null===(o=e.inputBefore)||void 0===o?void 0:o.type)?!!this.state.inputValue:"number"===(null===(i=e.inputBefore)||void 0===i?void 0:i.type)?parseFloat(this.state.inputValue)||0:this.state.inputValue})}))}renderInputDialog(){var e;if(!this.state.showInput||!this.state.showInput.inputBefore)return null;let t=!1;return this.state.showInput.inputBefore.allowEmptyValue||"checkbox"===this.state.showInput.inputBefore.type||(t="number"===this.state.showInput.inputBefore.type||"slider"===this.state.showInput.inputBefore.type?""===this.state.inputValue||null===this.state.inputValue||!window.isFinite(this.state.inputValue):!this.state.inputValue),(0,c.jsxs)(n.Dialog,{open:!0,onClose:()=>this.setState({showInput:null}),children:[(0,c.jsx)(n.DialogTitle,{children:g("pleaseEnterValueText")}),(0,c.jsxs)(n.DialogContent,{children:["text"!==this.state.showInput.inputBefore.type&&"number"!==this.state.showInput.inputBefore.type&&this.state.showInput.inputBefore.type?null:(0,c.jsx)(n.TextField,{autoFocus:!0,margin:"dense",label:g(this.state.showInput.inputBefore.label),slotProps:{htmlInput:"number"===this.state.showInput.inputBefore.type?{min:this.state.showInput.inputBefore.min,max:this.state.showInput.inputBefore.max,step:this.state.showInput.inputBefore.step}:void 0,input:{endAdornment:this.state.inputValue?(0,c.jsx)(n.InputAdornment,{position:"end",children:(0,c.jsx)(n.IconButton,{size:"small",onClick:()=>this.setState({inputValue:""}),children:(0,c.jsx)(r.Close,{})})}):null}},type:"number"===this.state.showInput.inputBefore.type?"number":"text",fullWidth:!0,value:this.state.inputValue,onChange:e=>this.setState({inputValue:e.target.value}),onKeyUp:e=>{"Enter"===e.key&&this.onShowInputOk()}}),"checkbox"===this.state.showInput.inputBefore.type?(0,c.jsx)(n.FormControlLabel,{control:(0,c.jsx)(n.Checkbox,{checked:!!this.state.inputValue,autoFocus:!0,onChange:e=>this.setState({inputValue:e.target.checked})}),label:g(this.state.showInput.inputBefore.label)}):null,"select"===this.state.showInput.inputBefore.type?(0,c.jsxs)(n.FormControl,{fullWidth:!0,children:[(0,c.jsx)(n.InputLabel,{children:g(this.state.showInput.inputBefore.label)}),(0,c.jsx)(n.Select,{variant:"standard",value:this.state.inputValue,onChange:e=>this.setState({inputValue:e.target.value}),children:null===(e=this.state.showInput.inputBefore.options)||void 0===e?void 0:e.map((e=>(0,c.jsx)(n.MenuItem,{value:e.value,children:g(e.label)},e.value)))})]}):null,"slider"===this.state.showInput.inputBefore.type?(0,c.jsxs)(n.Box,{sx:{width:"100%"},children:[(0,c.jsx)(n.Typography,{gutterBottom:!0,children:g(this.state.showInput.inputBefore.label)}),(0,c.jsxs)(n.Grid2,{container:!0,spacing:2,alignItems:"center",children:[(0,c.jsx)(n.Grid2,{children:(0,c.jsx)(n.Slider,{value:"number"===typeof this.state.inputValue?this.state.inputValue:0,onChange:(e,t)=>this.setState({inputValue:t})})}),(0,c.jsx)(n.Grid2,{children:(0,c.jsx)(n.Input,{value:this.state.inputValue,size:"small",onChange:e=>this.setState({inputValue:""===e.target.value?0:Number(e.target.value)}),onBlur:()=>{var e,t;if(!this.state.showInput)return;const s=void 0===(null===(e=this.state.showInput.inputBefore)||void 0===e?void 0:e.min)?0:this.state.showInput.inputBefore.min,o=void 0===(null===(t=this.state.showInput.inputBefore)||void 0===t?void 0:t.max)?100:this.state.showInput.inputBefore.max;this.state.inputValue<s?this.setState({inputValue:s}):this.state.inputValue>o&&this.setState({inputValue:o})},inputProps:{step:this.state.showInput.inputBefore.step,min:void 0===this.state.showInput.inputBefore.min?0:this.state.showInput.inputBefore.min,max:void 0===this.state.showInput.inputBefore.max?100:this.state.showInput.inputBefore.max,type:"number"}})})]})]}):null]}),(0,c.jsxs)(n.DialogActions,{children:[(0,c.jsx)(n.Button,{variant:"contained",disabled:t,color:"primary",onClick:()=>this.onShowInputOk(),startIcon:(0,c.jsx)(r.Check,{}),children:g("yesButtonText")}),(0,c.jsx)(n.Button,{variant:"contained",color:"grey",onClick:()=>this.setState({showInput:null}),startIcon:(0,c.jsx)(r.Close,{}),children:g("cancelButtonText")})]})]})}render(){return(0,c.jsxs)(c.Fragment,{children:[this.renderSnackbar(),this.renderContent(),this.renderConfirmDialog(),this.renderMessageDialog(),this.renderFormDialog(),this.renderProgressDialog(),this.renderConfirmationDialog(),this.renderInputDialog(),this.renderSpinner()]})}}const B=k;function L(e){const{action:t,instanceHandler:s}=e,o=g(null!==t&&void 0!==t&&t.description?t.description:""),i=g(null!==t&&void 0!==t&&t.title?t.title:""),n=v(t);return(0,c.jsx)(d,{tooltip:o,label:i,disabled:t.disabled,Icon:n,onClick:s(t)})}const F=JSON.parse('{"allDevicesFilteredOut":"Alle Ger\xe4te herausgefiltert","batteryTooltip":"Batterie","cancelButtonText":"Abbrechen","closeButtonText":"Schlie\xdfen","connectedIconTooltip":"Verbunden","copied":"Kopiert","disableIconTooltip":"Ger\xe4t deaktivieren","disconnectedIconTooltip":"Getrennt","enableIconTooltip":"Ger\xe4t aktivieren","filterLabelText":"Nach Name filtern","instanceLabelText":"Instanz","instanceNotAlive":"Instanz ist nicht aktiv","manufacturer":"Hersteller","model":"Modell","moreInformation":"Klicken, um weitere Informationen zu erhalten","noButtonText":"Nein","noDevicesFoundText":"Keine Ger\xe4te gefunden","noInstanceSelectedText":"Bitte Instanz ausw\xe4hlen","okButtonText":"OK","pleaseEnterValueText":"Bitte eingeben","refreshInstanceList":"Instanzliste aktualisieren","refreshTooltip":"Aktualisieren","toClipboard":"in die Zwischenablage kopiert","yesButtonText":"Ja"}'),V=JSON.parse('{"allDevicesFilteredOut":"All devices filtered out","batteryTooltip":"Battery","cancelButtonText":"Cancel","closeButtonText":"Close","connectedIconTooltip":"Connected","copied":"Copied","disableIconTooltip":"Disable device","disconnectedIconTooltip":"Disconnected","enableIconTooltip":"Enable device","filterLabelText":"Filter by name","instanceLabelText":"Instance","instanceNotAlive":"Instance is not alive","manufacturer":"Manufacturer","model":"Model","moreInformation":"Click to get more information","noButtonText":"No","noDevicesFoundText":"No devices found","noInstanceSelectedText":"Please select instance","okButtonText":"OK","pleaseEnterValueText":"Please enter","refreshInstanceList":"Refresh instance list","refreshTooltip":"Refresh","toClipboard":"to clipboard","yesButtonText":"Yes"}'),z=JSON.parse('{"allDevicesFilteredOut":"\u0412\u0441\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u044b","batteryTooltip":"\u0411\u0430\u0442\u0430\u0440\u0435\u044f","cancelButtonText":"\u041e\u0442\u043c\u0435\u043d\u0430","closeButtonText":"\u0417\u0430\u043a\u0440\u044b\u0442\u044c","connectedIconTooltip":"\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e","copied":"\u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043e","disableIconTooltip":"\u0414\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e","disconnectedIconTooltip":"\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e","enableIconTooltip":"\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e","filterLabelText":"\u0424\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0438\u043c\u0435\u043d\u0438","instanceLabelText":"\u0415\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440","instanceNotAlive":"\u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043d\u0435 \u0436\u0438\u0432","manufacturer":"\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c","model":"\u041c\u043e\u0434\u0435\u043b\u044c","moreInformation":"\u041d\u0430\u0436\u043c\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438","noButtonText":"\u041d\u0435\u0442","noDevicesFoundText":"\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b","noInstanceSelectedText":"\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440","okButtonText":"\u0425\u041e\u0420\u041e\u0428\u041e","pleaseEnterValueText":"\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0432\u0445\u043e\u0434\u0438\u0442\u0435","refreshInstanceList":"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432","refreshTooltip":"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c","toClipboard":"\u0432 \u0431\u0443\u0444\u0435\u0440 \u043e\u0431\u043c\u0435\u043d\u0430","yesButtonText":"\u0414\u0430"}'),H=JSON.parse('{"allDevicesFilteredOut":"Todos os dispositivos foram filtrados","batteryTooltip":"Bateria","cancelButtonText":"Cancelar","closeButtonText":"Fechar","connectedIconTooltip":"Conectado","copied":"Copiado","disableIconTooltip":"Desativar dispositivo","disconnectedIconTooltip":"Desconectado","enableIconTooltip":"Habilitar dispositivo","filterLabelText":"Filtrar por nome","instanceLabelText":"Inst\xe2ncia","instanceNotAlive":"A inst\xe2ncia n\xe3o est\xe1 ativa","manufacturer":"Fabricante","model":"Modelo","moreInformation":"Clique para obter mais informa\xe7\xf5es","noButtonText":"N\xe3o","noDevicesFoundText":"Nenhum dispositivo encontrado","noInstanceSelectedText":"Selecione a inst\xe2ncia","okButtonText":"OK","pleaseEnterValueText":"Por favor, insira","refreshInstanceList":"Atualizar lista de inst\xe2ncias","refreshTooltip":"Atualizar","toClipboard":"para a \xe1rea de transfer\xeancia","yesButtonText":"Sim"}'),P=JSON.parse('{"allDevicesFilteredOut":"Alle apparaten zijn eruit gefilterd","batteryTooltip":"Batterij","cancelButtonText":"Annuleren","closeButtonText":"Dichtbij","connectedIconTooltip":"Verbonden","copied":"Gekopieerd","disableIconTooltip":"Apparaat uitschakelen","disconnectedIconTooltip":"Losgekoppeld","enableIconTooltip":"Apparaat inschakelen","filterLabelText":"Filter op naam","instanceLabelText":"Voorbeeld","instanceNotAlive":"Instantie leeft niet","manufacturer":"Fabrikant","model":"Model","moreInformation":"Klik voor meer informatie","noButtonText":"Nee","noDevicesFoundText":"Geen apparaten gevonden","noInstanceSelectedText":"Selecteer een exemplaar","okButtonText":"OK","pleaseEnterValueText":"Kom binnen alstublieft","refreshInstanceList":"Ververs de exemplaarlijst","refreshTooltip":"Vernieuwen","toClipboard":"naar klembord","yesButtonText":"Ja"}'),R=JSON.parse('{"allDevicesFilteredOut":"Tous les appareils filtr\xe9s","batteryTooltip":"Batterie","cancelButtonText":"Annuler","closeButtonText":"Fermer","connectedIconTooltip":"Connect\xe9","copied":"Copi\xe9","disableIconTooltip":"D\xe9sactiver l\'appareil","disconnectedIconTooltip":"D\xe9branch\xe9","enableIconTooltip":"Activer l\'appareil","filterLabelText":"Filtrer par nom","instanceLabelText":"Exemple","instanceNotAlive":"L\'instance n\'est pas vivante","manufacturer":"Fabricant","model":"Mod\xe8le","moreInformation":"Cliquez pour obtenir plus d\'informations","noButtonText":"Non","noDevicesFoundText":"Aucun p\xe9riph\xe9rique trouv\xe9","noInstanceSelectedText":"Veuillez s\xe9lectionner une instance","okButtonText":"D\'ACCORD","pleaseEnterValueText":"Entrez s\'il vous plait","refreshInstanceList":"Actualiser la liste des instances","refreshTooltip":"Rafra\xeechir","toClipboard":"au presse-papiers","yesButtonText":"Oui"}'),M=JSON.parse('{"allDevicesFilteredOut":"Tutti i dispositivi sono stati filtrati","batteryTooltip":"Batteria","cancelButtonText":"Annulla","closeButtonText":"Vicino","connectedIconTooltip":"Connesso","copied":"Copiato","disableIconTooltip":"Disabilita dispositivo","disconnectedIconTooltip":"Disconnesso","enableIconTooltip":"Abilita dispositivo","filterLabelText":"Filtra per nome","instanceLabelText":"Esempio","instanceNotAlive":"L\'istanza non \xe8 viva","manufacturer":"Produttore","model":"Modello","moreInformation":"Clicca per avere maggiori informazioni","noButtonText":"NO","noDevicesFoundText":"Nessun dispositivo trovato","noInstanceSelectedText":"Seleziona l\'istanza","okButtonText":"OK","pleaseEnterValueText":"Prego entra","refreshInstanceList":"Aggiorna l\'elenco delle istanze","refreshTooltip":"ricaricare","toClipboard":"negli appunti","yesButtonText":"S\xcc"}'),W=JSON.parse('{"allDevicesFilteredOut":"Todos los dispositivos filtrados","batteryTooltip":"Bater\xeda","cancelButtonText":"Cancelar","closeButtonText":"Cerca","connectedIconTooltip":"Conectado","copied":"copiado","disableIconTooltip":"Deshabilitar dispositivo","disconnectedIconTooltip":"Desconectado","enableIconTooltip":"Habilitar dispositivo","filterLabelText":"Filtrar por nombre","instanceLabelText":"Instancia","instanceNotAlive":"La instancia no est\xe1 viva.","manufacturer":"Fabricante","model":"Modelo","moreInformation":"Haga clic para obtener m\xe1s informaci\xf3n","noButtonText":"No","noDevicesFoundText":"No se encontraron dispositivos","noInstanceSelectedText":"Por favor seleccione instancia","okButtonText":"DE ACUERDO","pleaseEnterValueText":"Por favor escribe","refreshInstanceList":"Actualizar lista de instancias","refreshTooltip":"Actualizar","toClipboard":"al portapapeles","yesButtonText":"S\xed"}'),K=JSON.parse('{"allDevicesFilteredOut":"Wszystkie urz\u0105dzenia zosta\u0142y odfiltrowane","batteryTooltip":"Bateria","cancelButtonText":"Anulowa\u0107","closeButtonText":"Zamkn\u0105\u0107","connectedIconTooltip":"Po\u0142\u0105czono","copied":"Skopiowano","disableIconTooltip":"Wy\u0142\u0105cz urz\u0105dzenie","disconnectedIconTooltip":"Bez\u0142adny","enableIconTooltip":"W\u0142\u0105cz urz\u0105dzenie","filterLabelText":"Filtruj wed\u0142ug nazwy","instanceLabelText":"Instancja","instanceNotAlive":"Instancja nie \u017cyje","manufacturer":"Producent","model":"Model","moreInformation":"Kliknij, aby uzyska\u0107 wi\u0119cej informacji","noButtonText":"NIE","noDevicesFoundText":"Nie znaleziono urz\u0105dze\u0144","noInstanceSelectedText":"Wybierz instancj\u0119","okButtonText":"OK","pleaseEnterValueText":"Podaj","refreshInstanceList":"Od\u015bwie\u017c list\u0119 instancji","refreshTooltip":"Od\u015bwie\u017ca\u0107","toClipboard":"do schowka","yesButtonText":"Tak"}'),U=JSON.parse('{"allDevicesFilteredOut":"\u0423\u0441\u0456 \u043f\u0440\u0438\u0441\u0442\u0440\u043e\u0457 \u0432\u0456\u0434\u0444\u0456\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043e","batteryTooltip":"\u0411\u0430\u0442\u0430\u0440\u0435\u044f","cancelButtonText":"\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438","closeButtonText":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438","connectedIconTooltip":"\u041f\u0456\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e","copied":"\u0421\u043a\u043e\u043f\u0456\u0439\u043e\u0432\u0430\u043d\u043e","disableIconTooltip":"\u0412\u0438\u043c\u043a\u043d\u0443\u0442\u0438 \u043f\u0440\u0438\u0441\u0442\u0440\u0456\u0439","disconnectedIconTooltip":"\u0412\u0456\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e","enableIconTooltip":"\u0423\u0432\u0456\u043c\u043a\u043d\u0443\u0442\u0438 \u043f\u0440\u0438\u0441\u0442\u0440\u0456\u0439","filterLabelText":"\u0424\u0456\u043b\u044c\u0442\u0440\u0443\u0432\u0430\u0442\u0438 \u0437\u0430 \u043d\u0430\u0437\u0432\u043e\u044e","instanceLabelText":"\u0415\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440","instanceNotAlive":"\u041f\u0440\u0438\u043c\u0456\u0440\u043d\u0438\u043a \u043d\u0435 \u0436\u0438\u0432\u0438\u0439","manufacturer":"\u0412\u0438\u0440\u043e\u0431\u043d\u0438\u043a","model":"\u041c\u043e\u0434\u0435\u043b\u044c","moreInformation":"\u041d\u0430\u0442\u0438\u0441\u043d\u0456\u0442\u044c, \u0449\u043e\u0431 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0431\u0456\u043b\u044c\u0448\u0435 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457","noButtonText":"\u041d\u0435\u043c\u0430\u0454","noDevicesFoundText":"\u041f\u0440\u0438\u0441\u0442\u0440\u043e\u0457\u0432 \u043d\u0435 \u0437\u043d\u0430\u0439\u0434\u0435\u043d\u043e","noInstanceSelectedText":"\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044c \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440","okButtonText":"\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0443","pleaseEnterValueText":"\u0411\u0443\u0434\u044c \u043b\u0430\u0441\u043a\u0430 \u0432\u0432\u0435\u0434\u0456\u0442\u044c","refreshInstanceList":"\u041e\u043d\u043e\u0432\u0438\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0456\u0432","refreshTooltip":"\u041e\u043d\u043e\u0432\u0438\u0442\u0438","toClipboard":"\u0432 \u0431\u0443\u0444\u0435\u0440 \u043e\u0431\u043c\u0456\u043d\u0443","yesButtonText":"\u0422\u0430\u043a"}'),G=JSON.parse('{"allDevicesFilteredOut":"\u6240\u6709\u8bbe\u5907\u5747\u88ab\u8fc7\u6ee4\u6389","batteryTooltip":"\u7535\u6c60","cancelButtonText":"\u53d6\u6d88","closeButtonText":"\u5173\u95ed","connectedIconTooltip":"\u5df2\u8fde\u63a5","copied":"\u5df2\u590d\u5236","disableIconTooltip":"\u7981\u7528\u8bbe\u5907","disconnectedIconTooltip":"\u5df2\u65ad\u5f00\u8fde\u63a5","enableIconTooltip":"\u542f\u7528\u8bbe\u5907","filterLabelText":"\u6309\u540d\u79f0\u8fc7\u6ee4","instanceLabelText":"\u5b9e\u4f8b","instanceNotAlive":"\u5b9e\u4f8b\u4e0d\u5b58\u5728","manufacturer":"\u5236\u9020\u5546","model":"\u578b\u53f7","moreInformation":"\u70b9\u51fb\u83b7\u53d6\u66f4\u591a\u4fe1\u606f","noButtonText":"\u4e0d","noDevicesFoundText":"\u672a\u627e\u5230\u8bbe\u5907","noInstanceSelectedText":"\u8bf7\u9009\u62e9\u5b9e\u4f8b","okButtonText":"\u597d\u7684","pleaseEnterValueText":"\u8bf7\u8f93\u5165","refreshInstanceList":"\u5237\u65b0\u5b9e\u4f8b\u5217\u8868","refreshTooltip":"\u5237\u65b0","toClipboard":"\u5230\u526a\u8d34\u677f","yesButtonText":"\u662f\u7684"}');class J extends B{constructor(e){super(e),this.lastPropsFilter=void 0,this.lastInstance=void 0,this.lastTriggerLoad=0,this.filterTimeout=void 0,this.language=void 0,this.aliveHandler=(e,t)=>{if(e==="system.adapter.".concat(this.props.selectedInstance,".alive")){const e=!(null===t||void 0===t||!t.val);e!==this.state.alive&&this.setState({alive:e},(()=>{e&&this.componentDidMount().catch(console.error)}))}},J.i18nInitialized||(J.i18nInitialized=!0,a.I18n.extendTranslations({en:V,de:F,ru:z,pt:H,nl:P,fr:R,it:M,es:W,pl:K,uk:U,"zh-cn":G})),Object.assign(this.state,{devices:[],filteredDevices:[],filter:"",instanceInfo:null,loading:null,alive:null,groupKey:""}),this.lastPropsFilter=this.props.filter,this.lastInstance=this.props.selectedInstance,this.lastTriggerLoad=this.props.triggerLoad||0,this.filterTimeout=null,this.language=a.I18n.getLanguage()}async componentDidMount(){let e=!1;if(null===this.state.alive){try{const t=await this.props.socket.getState("system.adapter.".concat(this.props.selectedInstance,".alive"));null!==t&&void 0!==t&&t.val&&(e=!0)}catch(t){console.error(t)}if(this.setState({alive:e},(()=>this.props.socket.subscribeState("system.adapter.".concat(this.props.selectedInstance,".alive"),this.aliveHandler))),!e)return}else e=this.state.alive;if(!this.props.embedded&&e)try{const e=await this.loadInstanceInfos();this.setState({instanceInfo:e})}catch(t){console.error(t)}e&&this.loadData()}componentWillUnmount(){this.props.socket.unsubscribeState("system.adapter.".concat(this.props.selectedInstance,".alive"),this.aliveHandler)}loadData(){this.setState({loading:!0},(async()=>{console.log("Loading devices for ".concat(this.props.selectedInstance,"..."));let e=[];try{e=await this.loadDevices(),e&&Array.isArray(e)||(console.error("Message returned from sendTo() doesn't look like one from DeviceManagement, did you accidentally handle the message in your adapter? ".concat(JSON.stringify(e))),e=[])}catch(t){console.error(t),e=[]}this.setState({devices:e,loading:!1},(()=>this.applyFilter()))}))}getText(e){return"object"===typeof e?e[this.language]||e.en:e}applyFilter(){const e=this.props.embedded?this.props.filter:this.state.filter;if(e){const t=this.state.devices.filter((t=>this.getText(t.name).toLowerCase().includes(e.toLowerCase())));this.setState({filteredDevices:t})}else this.setState({filteredDevices:this.state.devices})}handleFilterChange(e){this.setState({filter:e},(()=>{this.filterTimeout&&clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout((()=>{this.filterTimeout=null,this.applyFilter()}),250)}))}renderGroups(e){return null!==e&&void 0!==e&&e.length?(0,c.jsx)(n.Select,{style:{minWidth:120,marginRight:8,marginTop:12.5},variant:"standard",value:this.state.groupKey||"_",renderValue:t=>{"_"===t&&(t="");const s=e.find((e=>e.value===t));return(0,c.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(null===s||void 0===s?void 0:s.icon)||(0,c.jsx)("div",{style:{width:24}}),(null===s||void 0===s?void 0:s.name)||t]})},onChange:e=>this.setState({groupKey:"_"===e.target.value?"":e.target.value}),children:e.map((e=>(0,c.jsxs)(n.MenuItem,{value:e.value||"_",style:{display:"flex",alignItems:"center",gap:8},children:[e.icon||(0,c.jsx)("div",{style:{width:24}}),e.name]},e.value||"_")))}):null}renderContent(){var e,t;const s={padding:25};(this.props.triggerLoad||0)!==this.lastTriggerLoad&&(this.lastTriggerLoad=this.props.triggerLoad||0,setTimeout((()=>this.loadData()),50)),this.props.embedded&&this.lastPropsFilter!==this.props.filter&&(this.lastPropsFilter=this.props.filter,setTimeout((()=>this.applyFilter()),50)),this.props.embedded&&this.lastInstance!==this.props.selectedInstance&&(this.lastInstance=this.props.selectedInstance,setTimeout((()=>this.loadData()),50));const i=[];let l;if(this.props.embedded||this.state.alive)if(!this.state.devices.length&&this.props.selectedInstance)l=[(0,c.jsx)("div",{style:s,children:(0,c.jsx)("span",{children:g("noDevicesFoundText")})},"notFound")];else if(this.state.devices.length&&!this.state.filteredDevices.length)l=[(0,c.jsx)("div",{style:s,children:(0,c.jsx)("span",{children:g("allDevicesFilteredOut")})},"filtered")];else{let e=this.state.filteredDevices;if(!this.props.embedded&&e.find((e=>e.group))){i.push({name:a.I18n.t("All"),value:"",count:e.length,icon:(0,c.jsx)(r.FilterAltOff,{})}),e.forEach((e=>{if(e.group){const t=i.find((t=>{var s;return t.value===(null===(s=e.group)||void 0===s?void 0:s.key)}));if(t)t.count++;else{const t=e.group.icon?(0,c.jsx)(a.IconDeviceType,{src:e.group.icon}):null;i.push({name:this.getText(e.group.name||e.group.key),value:e.group.key,count:1,icon:t})}}}));const t=e.filter((e=>!e.group));t.length&&i.push({name:a.I18n.t("Unknown"),value:"?",count:t.length,icon:(0,c.jsx)(r.QuestionMark,{})}),this.state.groupKey&&(e="?"===this.state.groupKey?e.filter((e=>{var t;return!(null!==(t=e.group)&&void 0!==t&&t.key)})):e.filter((e=>{var t;return(null===(t=e.group)||void 0===t?void 0:t.key)===this.state.groupKey})),e.length||(l=[(0,c.jsx)("div",{style:s,children:(0,c.jsx)("span",{children:g("allDevicesFilteredOut")})},"filtered")]))}e.length&&(l=e.map((e=>(0,c.jsx)(O,{alive:!!this.state.alive,id:e.id,title:this.getText(e.name),device:e,instanceId:this.props.selectedInstance,uploadImagesToInstance:this.props.uploadImagesToInstance,deviceHandler:this.deviceHandler,controlHandler:this.controlHandler,controlStateHandler:this.controlStateHandler,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat},e.id))))}else l=[(0,c.jsx)("div",{style:s,children:(0,c.jsx)("span",{children:g("instanceNotAlive")})},"notAlive")];return this.props.embedded?(0,c.jsxs)(c.Fragment,{children:[this.state.loading?(0,c.jsx)(n.LinearProgress,{style:{width:"100%"}}):null,l]}):(0,c.jsxs)("div",{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,c.jsxs)(n.Toolbar,{variant:"dense",style:{backgroundColor:"#777",display:"flex"},children:[this.props.title,this.props.selectedInstance?(0,c.jsx)(n.Tooltip,{title:g("refreshTooltip"),slotProps:{popper:{sx:{pointerEvents:"none"}}},children:(0,c.jsx)("span",{children:(0,c.jsx)(n.IconButton,{onClick:()=>this.loadData(),disabled:!this.state.alive,size:"small",children:(0,c.jsx)(r.Refresh,{})})})}):null,this.state.alive&&null!==(e=this.state.instanceInfo)&&void 0!==e&&null!==(t=e.actions)&&void 0!==t&&t.length?(0,c.jsx)("div",{style:{marginLeft:20},children:this.state.instanceInfo.actions.map((e=>(0,c.jsx)(L,{action:e,instanceHandler:this.instanceHandler},e.id)))}):null,(0,c.jsx)("div",{style:{flexGrow:1}}),this.renderGroups(i),this.state.alive?(0,c.jsx)(n.TextField,{variant:"standard",style:{width:200},size:"small",label:g("filterLabelText"),onChange:e=>this.handleFilterChange(e.target.value),value:this.state.filter,autoComplete:"off",slotProps:{input:{autoComplete:"new-password",endAdornment:this.state.filter?(0,c.jsx)(n.InputAdornment,{position:"end",children:(0,c.jsx)(n.IconButton,{onClick:()=>this.handleFilterChange(""),edge:"end",children:(0,c.jsx)(r.Clear,{})})}):null},htmlInput:{autoComplete:"off"}}}):null]}),(0,c.jsxs)("div",{style:(0,o.A)({width:"100%",height:"calc(100% - 56px)",marginTop:8,overflow:"auto"},this.props.style),children:[this.state.loading?(0,c.jsx)(n.LinearProgress,{style:{width:"100%"}}):null,l]})]})}}J.i18nInitialized=!1;const Z=J},19597:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageContext=t.DeviceManagement=void 0;const o=s(54264);t.DeviceManagement=class{constructor(e){this.adapter=e,this.contexts=new Map,e.on("message",this.onMessage.bind(this))}get log(){return this.adapter.log}getInstanceInfo(){return{apiVersion:"v1"}}getDeviceDetails(e){return{id:e,schema:{}}}handleInstanceAction(e,t,s){var i;if(!this.instanceInfo)return this.log.warn("Instance action ".concat(e," was called before getInstanceInfo()")),{error:{code:o.ErrorCodes.E_INSTANCE_ACTION_NOT_INITIALIZED,message:"Instance action ".concat(e," was called before getInstanceInfo()")}};const n=null===(i=this.instanceInfo.actions)||void 0===i?void 0:i.find((t=>t.id===e));return n?n.handler?n.handler(t,s):(this.log.warn("Instance action ".concat(e," is disabled because it has no handler")),{error:{code:o.ErrorCodes.E_INSTANCE_ACTION_NO_HANDLER,message:"Instance action ".concat(e," is disabled because it has no handler")}}):(this.log.warn("Instance action ".concat(e," is unknown")),{error:{code:o.ErrorCodes.E_INSTANCE_ACTION_UNKNOWN,message:"Instance action ".concat(e," is unknown")}})}handleDeviceAction(e,t,s,i){var n;if(!this.devices)return this.log.warn("Device action ".concat(t," was called before listDevices()")),{error:{code:o.ErrorCodes.E_DEVICE_ACTION_NOT_INITIALIZED,message:"Device action ".concat(t," was called before listDevices()")}};const r=this.devices.get(e);if(!r)return this.log.warn("Device action ".concat(t," was called on unknown device: ").concat(e)),{error:{code:o.ErrorCodes.E_DEVICE_ACTION_DEVICE_UNKNOWN,message:"Device action ".concat(t," was called on unknown device: ").concat(e)}};const a=null===(n=r.actions)||void 0===n?void 0:n.find((e=>e.id===t));return a?a.handler?a.handler(e,s,i):(this.log.warn("Device action ".concat(t," on ").concat(e," is disabled because it has no handler")),{error:{code:o.ErrorCodes.E_DEVICE_ACTION_NO_HANDLER,message:"Device action ".concat(t," on ").concat(e," is disabled because it has no handler")}}):(this.log.warn("Device action ".concat(t," doesn't exist on device ").concat(e)),{error:{code:o.ErrorCodes.E_DEVICE_ACTION_UNKNOWN,message:"Device action ".concat(t," doesn't exist on device ").concat(e)}})}handleDeviceControl(e,t,s,i){var n;if(!this.devices)return this.log.warn("Device control ".concat(t," was called before listDevices()")),{error:{code:o.ErrorCodes.E_DEVICE_CONTROL_NOT_INITIALIZED,message:"Device control ".concat(t," was called before listDevices()")}};const r=this.devices.get(e);if(!r)return this.log.warn("Device control ".concat(t," was called on unknown device: ").concat(e)),{error:{code:o.ErrorCodes.E_DEVICE_CONTROL_DEVICE_UNKNOWN,message:"Device control ".concat(t," was called on unknown device: ").concat(e)}};const a=null===(n=r.controls)||void 0===n?void 0:n.find((e=>e.id===t));return a?a.handler?a.handler(e,t,s,i):(this.log.warn("Device control ".concat(t," on ").concat(e," is disabled because it has no handler")),{error:{code:o.ErrorCodes.E_DEVICE_CONTROL_NO_HANDLER,message:"Device control ".concat(t," on ").concat(e," is disabled because it has no handler")}}):(this.log.warn("Device control ".concat(t," doesn't exist on device ").concat(e)),{error:{code:o.ErrorCodes.E_DEVICE_CONTROL_UNKNOWN,message:"Device control ".concat(t," doesn't exist on device ").concat(e)}})}handleDeviceControlState(e,t,s){var i;if(!this.devices)return this.log.warn("Device get state ".concat(t," was called before listDevices()")),{error:{code:o.ErrorCodes.E_DEVICE_GET_STATE_NOT_INITIALIZED,message:"Device control ".concat(t," was called before listDevices()")}};const n=this.devices.get(e);if(!n)return this.log.warn("Device get state ".concat(t," was called on unknown device: ").concat(e)),{error:{code:o.ErrorCodes.E_DEVICE_GET_STATE_DEVICE_UNKNOWN,message:"Device control ".concat(t," was called on unknown device: ").concat(e)}};const r=null===(i=n.controls)||void 0===i?void 0:i.find((e=>e.id===t));return r?r.getStateHandler?r.getStateHandler(e,t,s):(this.log.warn("Device get state ".concat(t," on ").concat(e," is disabled because it has no handler")),{error:{code:o.ErrorCodes.E_DEVICE_GET_STATE_NO_HANDLER,message:"Device get state ".concat(t," on ").concat(e," is disabled because it has no handler")}}):(this.log.warn("Device get state ".concat(t," doesn't exist on device ").concat(e)),{error:{code:o.ErrorCodes.E_DEVICE_GET_STATE_UNKNOWN,message:"Device control ".concat(t," doesn't exist on device ").concat(e)}})}onMessage(e){e.command.startsWith("dm:")&&this.handleMessage(e).catch(this.log.error)}async handleMessage(e){switch(this.log.debug("DeviceManagement received: ".concat(JSON.stringify(e))),e.command){case"dm:instanceInfo":return this.instanceInfo=await this.getInstanceInfo(),void this.sendReply(Object.assign(Object.assign({},this.instanceInfo),{actions:this.convertActions(this.instanceInfo.actions)}),e);case"dm:listDevices":{const t=await this.listDevices();this.devices=t.reduce(((e,t)=>{if(e.has(t.id))throw new Error("Device ID ".concat(t.id," is not unique"));return e.set(t.id,t),e}),new Map);const s=t.map((e=>Object.assign(Object.assign({},e),{actions:this.convertActions(e.actions),controls:this.convertControls(e.controls)})));return this.sendReply(s,e),void this.adapter.sendTo(e.from,e.command,this.devices,e.callback)}case"dm:deviceDetails":{const t=await this.getDeviceDetails(e.message);return void this.adapter.sendTo(e.from,e.command,t,e.callback)}case"dm:instanceAction":{const t=e.message,s=new i(e,this.adapter);this.contexts.set(e._id,s);const o=await this.handleInstanceAction(t.actionId,s,{value:t.value});return this.contexts.delete(e._id),void s.sendFinalResult(o)}case"dm:deviceAction":{const t=e.message,s=new i(e,this.adapter);this.contexts.set(e._id,s);const o=await this.handleDeviceAction(t.deviceId,t.actionId,s,{value:t.value});return this.contexts.delete(e._id),void s.sendFinalResult(o)}case"dm:deviceControl":{const t=e.message,s=new i(e,this.adapter);this.contexts.set(e._id,s);const o=await this.handleDeviceControl(t.deviceId,t.controlId,t.state,s);return this.contexts.delete(e._id),void s.sendControlResult(t.deviceId,t.controlId,o)}case"dm:deviceControlState":{const t=e.message,s=new i(e,this.adapter);this.contexts.set(e._id,s);const o=await this.handleDeviceControlState(t.deviceId,t.controlId,s);return this.contexts.delete(e._id),void s.sendControlResult(t.deviceId,t.controlId,o)}case"dm:actionProgress":{const{origin:t}=e.message,s=this.contexts.get(t);return s?void s.handleProgress(e):(this.log.warn("Unknown message origin: ".concat(t)),void this.sendReply({error:"Unknown action origin"},e))}}}convertActions(e){if(!e)return;const t=new Set;return e.forEach((e=>{if(t.has(e.id))throw new Error("Action ID ".concat(e.id," is used twice, this would lead to unexpected behavior"));t.add(e.id)})),e.map((e=>Object.assign(Object.assign({},e),{handler:void 0,disabled:!e.handler})))}convertControls(e){if(!e)return;const t=new Set;return e.forEach((e=>{if(t.has(e.id))throw new Error("Control ID ".concat(e.id," is used twice, this would lead to unexpected behavior"));t.add(e.id)})),e.map((e=>Object.assign(Object.assign({},e),{handler:void 0,getStateHandler:void 0})))}sendReply(e,t){this.adapter.sendTo(t.from,t.command,e,t.callback)}};class i{constructor(e,t){this.adapter=t,this.hasOpenProgressDialog=!1,this.lastMessage=e}showMessage(e){this.checkPreconditions();const t=new Promise((e=>{this.progressHandler=()=>e()}));return this.send("message",{message:e}),t}showConfirmation(e){this.checkPreconditions();const t=new Promise((e=>{this.progressHandler=t=>e(!!t.confirm)}));return this.send("confirm",{confirm:e}),t}showForm(e,t){this.checkPreconditions();const s=new Promise((e=>{this.progressHandler=t=>e(t.data)}));return this.send("form",{form:Object.assign({schema:e},t)}),s}openProgress(e,t){this.checkPreconditions(),this.hasOpenProgressDialog=!0;const s={update:s=>{const o=new Promise((e=>{this.progressHandler=()=>e()}));return this.send("progress",{progress:Object.assign(Object.assign(Object.assign({title:e},t),s),{open:!0})},!0),o},close:()=>{const e=new Promise((e=>{this.progressHandler=()=>{this.hasOpenProgressDialog=!1,e()}}));return this.send("progress",{progress:{open:!1}}),e}},o=new Promise((e=>{this.progressHandler=()=>e(s)}));return this.send("progress",{progress:Object.assign(Object.assign({title:e},t),{open:!0})},!0),o}sendFinalResult(e){this.send("result",{result:e})}sendControlResult(e,t,s){"object"===typeof s&&"error"in s?this.send("result",{result:{error:s.error,deviceId:e,controlId:t}}):this.send("result",{result:{state:s,deviceId:e,controlId:t}})}handleProgress(e){const t=this.progressHandler;t&&"string"!==typeof e.message&&(this.lastMessage=e,this.progressHandler=void 0,t(e.message))}checkPreconditions(){if(this.hasOpenProgressDialog)throw new Error("Can't show another dialog while a progress dialog is open. Please call 'close()' on the dialog before opening another dialog.")}send(e,t,s){if(!this.lastMessage)throw new Error("No outstanding message, can't send a new one");this.adapter.sendTo(this.lastMessage.from,this.lastMessage.command,Object.assign(Object.assign({},t),{type:e,origin:this.lastMessage.message.origin||this.lastMessage._id}),this.lastMessage.callback),s||(this.lastMessage=void 0)}}t.MessageContext=i},23394:function(e,t,s){var o=this&&this.__createBinding||(Object.create?function(e,t,s,o){void 0===o&&(o=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,o,i)}:function(e,t,s,o){void 0===o&&(o=s),e[o]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||o(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(19597),t),i(s(54264),t)},46903:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ACTIONS=void 0,t.ACTIONS={STATUS:"status",ENABLE_DISABLE:"enable/disable"}},47242:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorCodes=void 0,function(e){e[e.E_INSTANCE_ACTION_NOT_INITIALIZED=101]="E_INSTANCE_ACTION_NOT_INITIALIZED",e[e.E_INSTANCE_ACTION_UNKNOWN=102]="E_INSTANCE_ACTION_UNKNOWN",e[e.E_INSTANCE_ACTION_NO_HANDLER=103]="E_INSTANCE_ACTION_NO_HANDLER",e[e.E_DEVICE_ACTION_NOT_INITIALIZED=201]="E_DEVICE_ACTION_NOT_INITIALIZED",e[e.E_DEVICE_ACTION_DEVICE_UNKNOWN=202]="E_DEVICE_ACTION_DEVICE_UNKNOWN",e[e.E_DEVICE_ACTION_UNKNOWN=203]="E_DEVICE_ACTION_UNKNOWN",e[e.E_DEVICE_ACTION_NO_HANDLER=204]="E_DEVICE_ACTION_NO_HANDLER",e[e.E_DEVICE_CONTROL_NOT_INITIALIZED=301]="E_DEVICE_CONTROL_NOT_INITIALIZED",e[e.E_DEVICE_CONTROL_DEVICE_UNKNOWN=302]="E_DEVICE_CONTROL_DEVICE_UNKNOWN",e[e.E_DEVICE_CONTROL_UNKNOWN=303]="E_DEVICE_CONTROL_UNKNOWN",e[e.E_DEVICE_CONTROL_NO_HANDLER=304]="E_DEVICE_CONTROL_NO_HANDLER",e[e.E_DEVICE_GET_STATE_NOT_INITIALIZED=401]="E_DEVICE_GET_STATE_NOT_INITIALIZED",e[e.E_DEVICE_GET_STATE_DEVICE_UNKNOWN=402]="E_DEVICE_GET_STATE_DEVICE_UNKNOWN",e[e.E_DEVICE_GET_STATE_UNKNOWN=403]="E_DEVICE_GET_STATE_UNKNOWN",e[e.E_DEVICE_GET_STATE_NO_HANDLER=404]="E_DEVICE_GET_STATE_NO_HANDLER"}(s||(t.ErrorCodes=s={}))},54264:function(e,t,s){var o=this&&this.__createBinding||(Object.create?function(e,t,s,o){void 0===o&&(o=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,o,i)}:function(e,t,s,o){void 0===o&&(o=s),e[o]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||o(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.ACTIONS=void 0,i(s(47242),t);var n=s(46903);Object.defineProperty(t,"ACTIONS",{enumerable:!0,get:function(){return n.ACTIONS}})}}]);
|
|
2
|
+
//# sourceMappingURL=7435.4eee6b92.chunk.js.map
|