iobroker.javascript
Version:
Rules Engine for ioBroker
1 lines • 1.83 MB
JavaScript
import{c as P,j as b,o as st,a as fc,b as Oc,d as Ec}from"./createSvgIcon-DPvF8xqu.js";import{a,c as Ce,r as De,e as dN,p as hr,j as Ka,q as Sg,_ as kg,b as et,k as Kt,f as vg,s as hN,i as Yg,l as Qg}from"./iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js";import{$ as So,F as zN,a0 as bt,_ as Ae,a as fe,b as _e,p as as,V,E as ue,h as xe,i as q,Q as Zn,o as W,z as J,c as Te,y as ws,f as nt,g as re,Z as bg,C as Ug,D as Us,a1 as $g,a2 as wN,P as Le,t as Xt,u as dt,a3 as Pg,v as qt,H as Wg,d as Qt,e as yi,J as IN,q as ts,s as _c,W as br,r as xc,G as Sc,x as Jg,a4 as Bg,a5 as Me,a6 as Nn,a7 as Rg,K as CN,N as it,M as kc,L as Fg,a8 as vc,O as Gg}from"./iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-QWG5Arqe.js";import{S as Xn}from"./Save-Cld9qv9i.js";import{c as we,I as We,b as wt,L as Hg,g as Vg,j as or,i as pN,H as AN,C as mN,Y as Zg,Z as te,$ as Xg,a0 as Kg,a1 as qg,a2 as ej,W as Yc,a3 as tj,a4 as sj,a5 as ij,a6 as rj,a7 as Qc,a8 as bc,a9 as oj,aa as nj,ab as aj,ac as Mj,ad as cj,ae as uj,af as lj,ag as Nj,ah as Lj,ai as gj,aj as jj,ak as yj,al as Uc,am as $c,an as Tj,ao as Pc,s as Dj,ap as dj,aq as hj,ar as zj,as as Wc,at as wj,au as Ij,av as Cj,N as pj,h as Kn,a as zr}from"./index-C49cpVll.js";import{c as Ur,r as ko}from"./iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js";function Aj(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import{P as _}from"./iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js";import{u as mj}from"./useTheme-hy6f3gra.js";import{R as fN,b as G}from"./index-gIA8x-8f.js";const fj=P(b.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),Oj=P(b.jsx("path",{d:"m10 17 5-5-5-5z"}),"ArrowRight"),Ej=P(b.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 11h-3v3.75c0 1.24-1.01 2.25-2.25 2.25S8.5 17.99 8.5 16.75s1.01-2.25 2.25-2.25c.46 0 .89.14 1.25.38V11h4zm-3-4V3.5L18.5 9z"}),"AudioFile"),_j=P([b.jsx("path",{d:"M16.5 12h-9c-.55 0-1 .45-1 1v1h11v-1c0-.55-.45-1-1-1M7.25 8.5h4v2h-4zm5.5 0h4v2h-4z"},"0"),b.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15h-1.5v-1.5h-11V17H5v-3.83c0-.66.25-1.26.65-1.72V9c0-1.1.9-2 2-2H11c.37 0 .72.12 1 .32.28-.2.63-.32 1-.32h3.35c1.1 0 2 .9 2 2v2.45c.4.46.65 1.06.65 1.72z"},"1")],"BedroomParent"),xj=P(b.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"}),"Bookmark"),Sj=P(b.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2m0 15-5-2.18L7 18V5h10z"}),"BookmarkBorder"),kj=P(b.jsx("path",{d:"M22 24H2v-4h20zM13.06 5.19l3.75 3.75L7.75 18H4v-3.75zm4.82 2.68-3.75-3.75 1.83-1.83c.39-.39 1.02-.39 1.41 0l2.34 2.34c.39.39.39 1.02 0 1.41z"}),"BorderColor"),vj=P(b.jsx("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness4"),Yj=P(b.jsx("path",{d:"M20 15.31 23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6"}),"Brightness5"),qa=P(b.jsx("path",{d:"M20 15.31 23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness6"),Qj=P(b.jsx("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7"),bj=P(b.jsx("path",{d:"m22.7 19-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4"}),"Build"),Uj=P(b.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday"),eM=P(b.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"Code"),$j=P(b.jsx("path",{d:"m20.71 5.63-2.34-2.34a.996.996 0 0 0-1.41 0l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.4-1.03.01-1.42M6.92 19 5 17.08l8.06-8.06 1.92 1.92z"}),"Colorize"),Pj=P(b.jsx("path",{d:"m13.7826 15.1719 2.1213-2.1213 5.9963 5.9962-2.1213 2.1213zM17.5 10c1.93 0 3.5-1.57 3.5-3.5 0-.58-.16-1.12-.41-1.6l-2.7 2.7-1.49-1.49 2.7-2.7c-.48-.25-1.02-.41-1.6-.41C15.57 3 14 4.57 14 6.5c0 .41.08.8.21 1.16l-1.85 1.85-1.78-1.78.71-.71-1.41-1.41L12 3.49c-1.17-1.17-3.07-1.17-4.24 0L4.22 7.03l1.41 1.41H2.81l-.71.71 3.54 3.54.71-.71V9.15l1.41 1.41.71-.71 1.78 1.78-7.41 7.41 2.12 2.12L16.34 9.79c.36.13.75.21 1.16.21"}),"Construction"),Wj=P(b.jsx("path",{d:"M19 2h-4.18C14.4.84 13.3 0 12 0S9.6.84 9.18 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m7 18H5V4h2v3h10V4h2z"}),"ContentPaste"),Jj=P(b.jsx("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2z"}),"Crop"),Bj=P(b.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"}),"DataObject"),vo=P(b.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),Rj=P(b.jsx("path",{d:"M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83M6.21 18H5v-1.21l8.66-8.66 1.21 1.21zM11 20l4-4h6v4z"}),"DriveFileRenameOutline"),Fj=P(b.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),Gj=P(b.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Hj=P(b.jsx("path",{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3"}),"FindInPage"),Vj=P(b.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z"}),"FolderOpen"),Zj=P(b.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m-2.06 11L15 15.28 12.06 17l.78-3.33-2.59-2.24 3.41-.29L15 8l1.34 3.14 3.41.29-2.59 2.24z"}),"FolderSpecial"),Xj=P(b.jsx("path",{d:"M9.93 13.5h4.14L12 7.98zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-4.05 16.5-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13z"}),"FontDownload"),Kj=P(b.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),qj=P(b.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"}),"Image"),tM=P(b.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),ON=P(b.jsx("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"}),"InsertDriveFile"),ey=P(b.jsx("path",{d:"M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"}),"KeyboardReturn"),EN=P(b.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5"}),"Link"),ty=P(b.jsx("path",{d:"M3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm4 4h14v-2H7zm0 4h14v-2H7zM7 7v2h14V7z"}),"List"),sy=P(b.jsx("path",{d:"M19 5v14H5V5zm1.1-2H3.9c-.5 0-.9.4-.9.9v16.2c0 .4.4.9.9.9h16.2c.4 0 .9-.5.9-.9V3.9c0-.5-.5-.9-.9-.9M11 7h6v2h-6zm0 4h6v2h-6zm0 4h6v2h-6zM7 7h2v2H7zm0 4h2v2H7zm0 4h2v2H7z"}),"ListAlt"),iy=P(b.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-5 14h-2V9h-2V7h4z"}),"LooksOne"),ry=P(b.jsx("path",{d:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3z"}),"MusicNote"),oy=P(b.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),sM=P(b.jsx("path",{d:"M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2m0-12C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"PersonOutlined"),ny=P(b.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"}),"Photo"),Lo=P(b.jsx("path",{d:"M5 4v2h14V4zm0 10h4v6h6v-6h4l-7-7z"}),"Publish"),iM=P(b.jsx("path",{d:"m20.2 5.9.8-.8C19.6 3.7 17.8 3 16 3s-3.6.7-5 2.1l.8.8C13 4.8 14.5 4.2 16 4.2s3 .6 4.2 1.7m-.9.8c-.9-.9-2.1-1.4-3.3-1.4s-2.4.5-3.3 1.4l.8.8c.7-.7 1.6-1 2.5-1s1.8.3 2.5 1zM19 13h-2V9h-2v4H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2M8 18H6v-2h2zm3.5 0h-2v-2h2zm3.5 0h-2v-2h2z"}),"Router"),ay=P(b.jsx("path",{d:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"}),"SaveAlt"),qn=P(b.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings"),go=P(b.jsx("path",{d:"M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m7-7H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69s.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69"}),"SettingsApplications"),My=P(b.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"}),"ShowChart"),rM=P(b.jsx("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10m3.61 6.34c1.07 0 1.93.86 1.93 1.93s-.86 1.93-1.93 1.93-1.93-.86-1.93-1.93c-.01-1.07.86-1.93 1.93-1.93m-6-1.58c1.3 0 2.36 1.06 2.36 2.36s-1.06 2.36-2.36 2.36-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36m0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68M11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09"}),"SupervisedUserCircle"),cy=P(b.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFields"),uy=P(b.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}),"UploadFile"),ly=P(b.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}),"UploadFileOutlined"),Ny=P(b.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottom"),Ly=P(b.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTop"),gy=P(b.jsx("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11z"}),"Videocam"),jy=P(b.jsx("path",{d:"M14.67 5v14H9.33V5zm1 14H21V5h-5.33zm-7.34 0V5H3v14z"}),"ViewColumn"),yy=P(b.jsx("path",{d:"M4 15h16v-2H4zm0 4h16v-2H4zm0-8h16V9H4zm0-6v2h16V5z"}),"ViewHeadline"),Ty=P(b.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"}),"ViewModule"),Dy=P(b.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility"),dy=P(b.jsx("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}),"Warning"),li=P(b.jsx("path",{d:"m1 9 2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9m8 8 3 3 3-3c-1.65-1.66-4.34-1.66-6 0m-4-4 2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13"}),"Wifi"),$r=P(b.jsx("path",{d:"M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0"}),"WifiOff"),Ln=11/23/100;function Jc(s){const e={r:0,g:0,b:0};if(s.length===7)e.r=parseInt(s.substring(1,3),16),e.g=parseInt(s.substring(3,5),16),e.b=parseInt(s.substring(5,7),16);else if(s.length===4){const t=s[1],i=s[2],r=s[3];e.r=parseInt(t+t,16),e.g=parseInt(i+i,16),e.b=parseInt(r+r,16)}return e}function hy(s){return`#${Math.round(s.r).toString(16)}${Math.round(s.g).toString(16)}${Math.round(s.b).toString(16)}`}function zy(s,e,t){const i=Jc(s),r=Jc(e);return i.r+=r.r*(.05+Ln*(t-1)),i.g+=r.g*(.05+Ln*(t-1)),i.b+=r.b*(.05+Ln*(t-1)),hy(i)}function gn(s,e){const t={};for(let i=1;i<=24;i++)t[`elevation${i}`]={backgroundColor:zy(s,e,i)};return t}function wy(s,e){var n,M,c,l,N,u,L,g,j,y,T;let t,i;s==="dark"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#272727"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:st[200],"&:hover":{color:st[100]}}},MuiPaper:gn("#121212","#fff")},t={name:s,palette:{mode:"dark",background:{paper:"#121212",default:"#121212"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):s==="blue"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#3399CC"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:st[400],"&:hover":{color:st[300]}}}},t={name:s,palette:{mode:"dark",background:{paper:"#151d21",default:"#151d21"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):s==="colored"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#2a3135"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:st[200],"&:hover":{color:st[100]}}},MuiPaper:gn("#151d21","#fff")},t={name:s,palette:{mode:"light",primary:{main:"#3399CC"},secondary:{main:"#164477"},expert:"#96fc96"}}):s==="PT"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#0F99DE"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:st[400],"&:hover":{color:st[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#0F99DE"},secondary:{main:"#88A536"},expert:"#BD1B24"}}):s==="NW"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#272727"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:st[400],"&:hover":{color:st[300]}}},MuiPaper:gn("#121212","#fff")},t={name:s,palette:{mode:"dark",background:{paper:"#121212",default:"#121212"},primary:{main:"#00af78"},secondary:{main:"#005a40"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):(i={MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:st[400],"&:hover":{color:st[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#3399CC",dark:"#256c97",light:"#76d0fd"},secondary:{main:"#164477"},expert:"#14bb00"}}),t.toolbar={height:48},t.saveToolbar={background:(M=(n=t.palette)==null?void 0:n.primary)==null?void 0:M.main,button:{borderRadius:3,height:32}},t.palette&&(t.palette.grey={main:fc[300],dark:fc[400]});const r=Oc(t),o=r.palette;return Oc(r,{...e||void 0,components:{...i,MuiButton:{variants:[{props:{variant:"contained",color:"grey"},style:{backgroundColor:(c=o.grey)==null?void 0:c[300],color:o.getContrastText&&((l=o.grey)!=null&&l[300])?o.getContrastText(o.grey[300]):void 0}},{props:{variant:"outlined",color:"grey"},style:{color:(N=o.text)==null?void 0:N.primary,borderColor:o.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)","&.Mui-disabled":{border:`1px solid ${(u=o.action)==null?void 0:u.disabledBackground}`},"&:hover":{borderColor:o.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)",backgroundColor:Ec(((L=o.text)==null?void 0:L.primary)||"",((g=o.action)==null?void 0:g.hoverOpacity)||.04)}}},{props:{variant:"text",color:"grey"},style:{color:(j=o.text)==null?void 0:j.primary,"&:hover":{backgroundColor:Ec(((y=o.text)==null?void 0:y.primary)||"",((T=o.action)==null?void 0:T.hoverOpacity)||.04)}}}]},...(e==null?void 0:e.components)||void 0}})}function Iy(){let s,e;const t=new Promise((i,r)=>{s=i,e=r});return t.resolve=s,t.reject=e,t}function ea(s){return(s==null?void 0:s.rows.map(e=>e.value).filter(e=>!!e))??[]}function vt(s){return s!=null&&s.startsWith("system.host.")||(s=`system.host.${s}`),s}function Pi(s){return s!=null&&s.startsWith("system.host.")&&(s=s.substring(12)),s}function Bc(s){return new Promise(e=>{setTimeout(e,s)})}function Pr(s){s=(s||"").toString();const e=s[0]==="*",t=s[s.length-1]==="*";return s=s.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+s+(t?"":"$")}typeof globalThis.process<"u"&&(globalThis.location||={href:"http://localhost:8081/",protocol:"http:",host:"localhost:8081",pathname:"/",hostname:"localhost",reload:()=>{}},globalThis.localStorage||={_keys:{},setItem:(s,e)=>{globalThis.localStorage._keys[s]=e},getItem:s=>s in globalThis.localStorage._keys?globalThis.localStorage._keys[s]:null,removeItem:s=>{s in globalThis.localStorage._keys&&delete globalThis.localStorage._keys[s]}},globalThis.sessionStorage||=globalThis.localStorage,globalThis.navigator||={language:"en"});var ht;(function(s){s[s.CONNECTING=0]="CONNECTING",s[s.CONNECTED=1]="CONNECTED",s[s.OBJECTS_LOADED=2]="OBJECTS_LOADED",s[s.READY=3]="READY"})(ht||(ht={}));var Qe;(function(s){s.PERMISSION_ERROR="permissionError",s.NOT_CONNECTED="notConnectedError",s.TIMEOUT="timeout",s.NOT_ADMIN="Allowed only in admin",s.NOT_SUPPORTED="Not supported"})(Qe||(Qe={}));const lve=Qe.PERMISSION_ERROR;Qe.NOT_CONNECTED;const Cy=["material","echarts","vis"];class ke{props;connId;lastAccessToken=null;ignoreState="";connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};objectViewCached;constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:""}${Math.round(Math.random()*1e6).toString().padStart(6,"0")}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(t=>{alert(`Socket connection could not be initialized: ${t}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||globalThis.location.protocol,host:e.host||globalThis.location.hostname,port:e.port||(globalThis.location.port==="3000"?8081:globalThis.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=Iy();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang="en";static isWeb(){return globalThis.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise?this._waitForSocketPromise:(this._waitForSocketPromise=new Promise(async(e,t)=>{if(this.props.connect){e();return}if(typeof globalThis.io>"u"&&typeof globalThis.iob>"u")if(typeof globalThis.registerSocketOnLoad=="function")globalThis.registerSocketOnLoad(()=>e());else{for(let i=1;i<=30;i++){if(globalThis.io||globalThis.iob)return e();await Bc(100)}t(new Error("Socket library could not be loaded!"))}else e()}),this._waitForSocketPromise)}async startSocket(){if(this._socket)return;let e=this.props.host,t=this.props.port,i=(this.props.protocol||globalThis.location.protocol).replace(":",""),r=globalThis.location.pathname;if(globalThis.location.hostname==="iobroker.net"||globalThis.location.hostname==="iobroker.pro")r="";else{if(globalThis.socketUrl){const c=new globalThis.URL(globalThis.socketUrl);e=c.hostname,t=c.port,i=c.protocol.replace(":","")}const M=r.lastIndexOf("/");if(M!==-1&&(r=r.substring(0,M+1)),ke.isWeb()){const c=r.split("/");c.length>2&&(c.pop(),c.pop(),Cy.includes(c[c.length-1])&&c.pop(),r=c.join("/"),r.endsWith("/")||(r+="/"))}}const o=t?`${i}://${e}:${t}`:`${i}://${e}`,n=this.props.connect||(globalThis.io||globalThis.iob).connect;return this._socket=n(o,{path:r.endsWith("/")?`${r}socket.io`:`${r}/socket.io`,query:"ws=true",name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token}),this._socket.on("connect",M=>{var l;(l=globalThis.addEventListener)==null||l.call(globalThis,"storage",this.onAccessTokenUpdated);const c=ke.readTokens();if(c&&!c.owner){const N=Date.now();this.saveTokens({access_token:c.access_token,refresh_token:c.refresh_token,expires_in:Math.round((c.expires_in.getTime()-N)/1e3),refresh_token_expires_in:Math.round((c.refresh_token_expires_in.getTime()-N)/1e3),token_type:"Bearer"},c.stayLoggedIn)}this.onReadyDone=!1,M!==!0?(this.connected=!0,setTimeout(()=>this.getVersion().then(N=>{const[u,L,g]=N.version.split(".");parseInt(u,10)*1e4+parseInt(L,10)*100+parseInt(g,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit("authenticate",(y,T)=>this.onPreConnect(y,T))}).catch(N=>this.onError({message:N.toString(),operation:"getVersion"})),500)):this._socket.emit("authenticate",(N,u)=>{this.onPreConnect(N,u)})}),this._socket.on("reconnect",()=>{var M,c;this.onReadyDone=!1,(c=(M=this.props).onProgress)==null||c.call(M,ht.READY),this.connected=!0,this.waitForRestart?globalThis.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(l=>l(!0)))}),this._socket.on("disconnect",()=>{var M,c;this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,(c=(M=this.props).onProgress)==null||c.call(M,ht.CONNECTING),this.onConnectionHandlers.forEach(l=>l(!1))}),this._socket.on("reauthenticate",()=>this.authenticate()),this._socket.on("log",M=>{var c,l;(l=(c=this.props).onLog)==null||l.call(c,M),this.onLogHandlers.forEach(N=>N(M))}),this._socket.on("error",M=>{let c;M==null?c="":typeof M.toString=="function"?c=M.toString():(c=JSON.stringify(M),console.error(`Received strange error: ${c}`)),c.includes("User not authorized")?this.authenticate():c.includes("websocket error")?(console.error(`Socket Error => reload: ${M}`),globalThis.location.reload()):console.error(`Socket Error: ${M}`)}),this._socket.on("connect_error",M=>console.error(`Connect error: ${M}`)),this._socket.on("permissionError",M=>this.onError({message:"no permission",operation:M.operation,type:M.type,id:M.id||""})),this._socket.on("objectChange",(M,c)=>{setTimeout(()=>this.objectChange(M,c),0)}),this._socket.on("stateChange",(M,c)=>{setTimeout(()=>this.stateChange(M,c),0)}),this._socket.on("im",(M,c,l)=>{setTimeout(()=>this.instanceMessage(M,c,l),0)}),this._socket.on("fileChange",(M,c,l)=>{setTimeout(()=>this.fileChange(M,c,l),0)}),this._socket.on("cmdStdout",(M,c)=>{var l;(l=this.onCmdStdoutHandler)==null||l.call(this,M,c)}),this._socket.on("cmdStderr",(M,c)=>{var l;(l=this.onCmdStderrHandler)==null||l.call(this,M,c)}),this._socket.on("cmdExit",(M,c)=>{var l;(l=this.onCmdExitHandler)==null||l.call(this,M,c)}),Promise.resolve()}onPreConnect(e,t){var i,r;this._authTimer&&(clearTimeout(this._authTimer),this._authTimer=null),this.connected=!0,this.isSecure=t,this.waitForRestart?globalThis.location.reload():(this.firstConnect?this.loadData().catch(o=>{console.error(`Cannot load data: ${o}`)}):(r=(i=this.props).onProgress)==null||r.call(i,ht.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(o=>o(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=globalThis.sessionStorage.getItem("iob_tokens");const t=!e;if(e||(e=globalThis.localStorage.getItem("iob_tokens")),!e)return null;const[i,r,o,n,M]=e.split(";"),c=new Date(r);return c.getTime()<Date.now()?null:{refresh_token:i,refresh_token_expires_in:c,access_token:o,expires_in:new Date(n),owner:M,stayLoggedIn:t}}static saveTokensStatic(e,t,i){const r=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${i?`;${i}`:""}`;t?globalThis.localStorage.setItem("iob_tokens",r):globalThis.sessionStorage.setItem("iob_tokens",r)}saveTokens(e,t){ke.saveTokensStatic(e,t,this.connId)}static deleteTokensStatic(){globalThis.localStorage.removeItem("iob_tokens"),globalThis.sessionStorage.removeItem("iob_tokens")}deleteTokens(e,t){const i=ke.readTokens();i&&(t?ke.deleteTokensStatic():i.stayLoggedIn===e&&i.owner===this.connId&&(i.stayLoggedIn?globalThis.localStorage.removeItem("iob_tokens"):globalThis.sessionStorage.removeItem("iob_tokens")))}onAccessTokenUpdated=e=>{if(e.key==="iob_tokens"){const t=ke.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit("updateTokenExpiration",e,(t,i)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),globalThis.location.reload()):i?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),globalThis.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>globalThis.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch("./oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(i=>{if(i.ok)return i.json();throw new Error("Cannot refresh access token")}).then(i=>{if(i.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${i.access_token}`),this.saveTokens(i,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(i.access_token);else throw new Error("Cannot get access token")}).catch(i=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${i}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(i),globalThis.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){const e=Date.now(),t=globalThis.localStorage.getItem("iob_token_semaphore");if(t)try{const r=JSON.parse(t);if(e<r.expiry)return!1}catch{}const i={connId:this.connId,expiry:e+10*1e3};return globalThis.localStorage.setItem("iob_token_semaphore",JSON.stringify(i)),!0}releaseTokenLock(){const e=globalThis.localStorage.getItem("iob_token_semaphore");if(e)try{JSON.parse(e).connId===this.connId&&globalThis.localStorage.removeItem("iob_token_semaphore")}catch{globalThis.localStorage.removeItem("iob_token_semaphore")}}checkAccessTokenExpire(){if(this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null),this.isSecure){const e=ke.readTokens();if(e){const t=e.expires_in.getTime();if(t<Date.now()+3e4){const i=t<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${e.access_token}`),e.refresh_token?e.owner===this.connId||i?(e.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(t).then(r=>{r?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(e,i)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>globalThis.location.reload(),Date.now()>t?500:t-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(e,i))):this.lastAccessToken!==e.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(e)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>globalThis.location.reload(),Date.now()>t?500:t-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},t-Date.now()-3e4>12e4?12e4:t-Date.now()-3e4)}}}static isCloud(){return globalThis.location.hostname.includes("amazonaws.com")||globalThis.location.hostname.includes("iobroker.in")?!0:typeof globalThis.socketUrl>"u"?!1:globalThis.socketUrl.includes("iobroker.in")||globalThis.socketUrl.includes("amazonaws")}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getUserPermissions",(i,r)=>{i?t(i):e(r||null)})}})}async loadData(){if(this.loaded)return;const e=10;for(let t=1;t<=e;t++){if(this.doLoadData().catch(i=>console.error(`Cannot load data: ${i}`)),this.loaded)return;await Bc(ke.isCloud()?5e3:1e3)}}async doLoadData(){var e,t,i,r,o,n,M,c,l;if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(N){this.onError(`Cannot read user permissions: ${N}`);return}try{this.props.admin5only&&!ke.isWeb()&&(!globalThis.vendorPrefix||globalThis.vendorPrefix==="@@vendorPrefix@@")?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(N){this.onError(`Cannot read system config: ${N}`);return}this._systemConfig&&(this.systemLang=(e=this._systemConfig.common)==null?void 0:e.language,this.systemLang||(this.systemLang=globalThis.navigator.userLanguage||globalThis.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang="en"),this._systemConfig.common.language=this.systemLang)),(i=(t=this.props).onLanguage)==null||i.call(t,this.systemLang),this.loaded=!0,(o=(r=this.props).onProgress)==null||o.call(r,ht.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),(M=(n=this.props).onProgress)==null||M.call(n,ht.READY),this.onReadyDone||(this.onReadyDone=!0,(l=(c=this.props).onReady)==null||l.call(c,this.objects))}}authenticate(){globalThis.location.search.includes("&href=")?globalThis.location.href=`${globalThis.location.protocol}//${globalThis.location.host}${globalThis.location.pathname}${globalThis.location.search}`:globalThis.location.href=`${globalThis.location.protocol}//${globalThis.location.host}${globalThis.location.pathname}?login&href=${encodeURIComponent(globalThis.location.search+globalThis.location.hash)}`}async subscribeState(...e){let t,i,r;e.length===3?[t,i,r]=e:([t,r]=e,i=!1);let o;if(Array.isArray(t)?o=t:o=[t],typeof r!="function")throw new Error("The state change handler must be a function!");const n=[];for(let M=0;M<o.length;M++){const c=o[M];this.statesSubscribes[c]?!this.statesSubscribes[c].cbs.includes(r)&&this.statesSubscribes[c].cbs.push(r):(this.statesSubscribes[c]={reg:new RegExp(Pr(c)),cbs:[r]},t!==this.ignoreState&&n.push(c))}if(this.connected)if(n.length&&this._socket.emit("subscribe",n),i){let M;for(let c=0;c<o.length;c++){try{M=await this.getBinaryState(o[c])}catch(l){console.error(`Cannot getBinaryState "${o[c]}": ${JSON.stringify(l)}`),M=void 0}M!=null&&r(o[c],M)}}else if(o.find(M=>M.includes("*"))){let M;for(let c=0;c<o.length;c++){try{M=await this.getForeignStates(o[c])}catch(l){console.error(`Cannot getForeignStates "${o[c]}": ${JSON.stringify(l)}`);return}if(M)for(const[l,N]of Object.entries(M)){const u=r(l,N);u instanceof Promise&&u.catch(L=>console.error(`Cannot call state change handler: ${L}`))}}}else try{const M=await(ke.isWeb()?this.getStates(o):this.getForeignStates(o));if(M)for(const[c,l]of Object.entries(M)){const N=r(c,l);N instanceof Promise&&N.catch(u=>console.error(`Cannot call state change handler: ${u}`))}}catch(M){console.error(`Cannot getState "${o.join(", ")}": ${M.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){var o;let i;Array.isArray(e)?i=e:i=[e];const r=[];for(let n=0;n<i.length;n++){const M=i[n];if(this.statesSubscribes[M]){const c=this.statesSubscribes[M];if(t){const l=c.cbs.indexOf(t);l!==-1&&c.cbs.splice(l,1)}else c.cbs=[];(o=c.cbs)!=null&&o.length||(delete this.statesSubscribes[M],M!==this.ignoreState&&r.push(M))}}this.connected&&r.length&&this._socket.emit("unsubscribe",i)}subscribeObject(e,t){let i;if(Array.isArray(e)?i=e:i=[e],typeof t!="function")throw new Error("The object change handler must be a function!");const r=[];for(let o=0;o<i.length;o++){const n=i[o];this.objectsSubscribes[n]?!this.objectsSubscribes[n].cbs.includes(t)&&this.objectsSubscribes[n].cbs.push(t):(this.objectsSubscribes[n]={reg:new RegExp(Pr(n)),cbs:[t]},r.push(n))}return this.connected&&r.length&&this._socket.emit("subscribeObjects",r),Promise.resolve()}unsubscribeObject(e,t){var o;let i;Array.isArray(e)?i=e:i=[e];const r=[];for(let n=0;n<i.length;n++){const M=i[n];if(this.objectsSubscribes[M]){const c=this.objectsSubscribes[M];if(t){const l=c.cbs.indexOf(t);l!==-1&&c.cbs.splice(l,1)}else c.cbs=[];(o=c.cbs)!=null&&o.length||(delete this.objectsSubscribes[M],r.push(M))}}return this.connected&&r.length&&this._socket.emit("unsubscribeObjects",r),Promise.resolve()}objectChange(e,t){var o,n;let i;this.objects[e]&&(i={_id:e,type:this.objects[e].type});let r=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,r=!0)):this.objects[e]&&(delete this.objects[e],r=!0);for(const[M,c]of Object.entries(this.objectsSubscribes))(M===e||c.reg.test(e))&&c.cbs.forEach(l=>{try{const N=l(e,t,i);N instanceof Promise&&N.catch(u=>console.error(`Cannot call object change handler: ${u}`))}catch(N){console.error(`Error by callback of objectChange: ${N}`)}});if(r){const M=(n=(o=this.props).onObjectChange)==null?void 0:n.call(o,e,t);M instanceof Promise&&M.catch(c=>console.error(`Cannot call object change handler: ${c}`))}}stateChange(e,t){for(const i of Object.values(this.statesSubscribes))if(i.reg.test(e))for(const r of i.cbs)try{const o=r(e,t??null);o instanceof Promise&&o.catch(n=>console.error(`Cannot call state change handler: ${n}`))}catch(o){console.error(`Error by callback of stateChanged: ${o}`)}}instanceMessage(e,t,i){var r;(r=this._instanceSubscriptions[t])==null||r.forEach(o=>{if(o.messageType===e){const n=o.callback(i,t,e);n instanceof Promise&&n.catch(M=>console.error(`Cannot call instance message handler: ${M}`))}})}fileChange(e,t,i){for(const r of Object.values(this.filesSubscribes))if(r.regId.test(e)&&r.regFilePattern.test(t))for(const o of r.cbs)try{o(e,t,i)}catch(n){console.error(`Error by callback of fileChange: ${n}`)}}async subscribeFiles(e,t,i){if(typeof i!="function")throw new Error("The state change handler must be a function!");let r;Array.isArray(t)?r=t:r=[t];const o=[];for(let n=0;n<r.length;n++){const M=r[n],c=`${e}$%$${M}`;this.filesSubscribes[c]?!this.filesSubscribes[c].cbs.includes(i)&&this.filesSubscribes[c].cbs.push(i):(this.filesSubscribes[c]={regId:new RegExp(Pr(e)),regFilePattern:new RegExp(Pr(M)),cbs:[i]},o.push(M))}return this.connected&&o.length&&this._socket.emit("subscribeFiles",e,o),Promise.resolve()}unsubscribeFiles(e,t,i){var n;let r;Array.isArray(t)?r=t:r=[t];const o=[];for(let M=0;M<r.length;M++){const c=r[M],l=`${e}$%$${c}`;if(this.filesSubscribes[l]){const N=this.filesSubscribes[l];if(i){const u=N.cbs.indexOf(i);u!==-1&&N.cbs.splice(u,1)}else N.cbs=[];(n=N.cbs)!=null&&n.length||(delete this.filesSubscribes[l],o.push(c))}}this.connected&&o.length&&this._socket.emit("unsubscribeFiles",e,o)}async request({cacheKey:e,forceUpdate:t,commandTimeout:i,onTimeout:r,requireAdmin:o,requireFeatures:n,executor:M}){if(o&&ke.isWeb())return Promise.reject(new Error(Qe.NOT_ADMIN));if(e&&!t&&e in this._promises)return this._promises[e];if(!this.connected)return Promise.reject(new Error(Qe.NOT_CONNECTED));if(n!=null&&n.length){for(const l of n)if(!await this.checkFeatureSupported(l))throw new Error(Qe.NOT_SUPPORTED)}const c=new Promise(async(l,N)=>{const u={elapsed:!1,clearTimeout:()=>{}};let L;i!==!1&&(L=setTimeout(()=>{u.elapsed=!0,r==null||r(),e&&this._promises[e]instanceof Promise&&delete this._promises[e],N(new Error(Qe.TIMEOUT))},i??this.props.cmdTimeout),u.clearTimeout=()=>{clearTimeout(L)});try{await M(l,N,u)}catch(g){e&&this._promises[e]instanceof Promise&&delete this._promises[e],N(new Error(g.toString()))}});return e&&(this._promises[e]=c),c}resetCache(e,t){t?Object.keys(this._promises).filter(i=>i.startsWith(e)).forEach(i=>{delete this._promises[i]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getStates",e,(r,o)=>{this.states=o??{},r?i(r):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,i)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit("getState",e,(r,o)=>{r?i(r):t(o)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getBinaryState",e,(r,o)=>{r?i(r):t(o)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("setBinaryState",e,t,o=>{o?r(o):i()})}})}setState(e,t,i){return typeof i=="boolean"&&(t={val:t,ack:i}),this.request({commandTimeout:!1,executor:(r,o)=>{if(e&&e===this.ignoreState){let n;if(typeof i=="boolean"||typeof t=="object"&&t.val!==void 0?n=t:n={val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:"system.adapter.vis.0"},this.simStates[e]=n,this.statesSubscribes[e])for(const M of this.statesSubscribes[e].cbs)try{const c=M(e,n);c instanceof Promise&&c.catch(l=>console.error(`Cannot call state change handler: ${l}`))}catch(c){console.error(`Error by callback of stateChanged: ${c}`)}r();return}this._socket.emit("setState",e,t,n=>{n?o(n):r()})}})}getObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{if(!e&&this.objects){i(this.objects);return}this._socket.emit(ke.isWeb()?"getObjects":"getAllObjects",(o,n)=>{var M,c;t||(c=(M=this.props).onProgress)==null||c.call(M,ht.OBJECTS_LOADED),o?r(o):(this.objects=n??{},i(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjects",e,(r,o)=>{r?i(r):t(o)})}})}_subscribe(e){var t,i;if(e&&!this.subscribed){this.subscribed=!0,(t=this.props.autoSubscribes)!=null&&t.length&&this._socket.emit("subscribeObjects",this.props.autoSubscribes);const r=Object.keys(this.objectsSubscribes);r.length&&this._socket.emit("subscribeObjects",r),Object.keys(this.objectsSubscribes).forEach(o=>this._socket.emit("subscribeObjects",o)),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!0),Object.keys(this.statesSubscribes).forEach(o=>this._socket.emit("subscribe",o)),Object.keys(this.filesSubscribes).forEach(o=>{const[n,M]=o.split("$%$");this._socket.emit("subscribeFiles",n,M)})}else if(!e&&this.subscribed){this.subscribed=!1,(i=this.props.autoSubscribes)!=null&&i.length&&this._socket.emit("unsubscribeObjects",this.props.autoSubscribes);const r=Object.keys(this.objectsSubscribes);r.length&&this._socket.emit("unsubscribeObjects",r),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!1),Object.keys(this.statesSubscribes).forEach(o=>this._socket.emit("unsubscribe",o)),Object.keys(this.filesSubscribes).forEach(o=>{const[n,M]=o.split("$%$");this._socket.emit("unsubscribeFiles",n,M)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("requireLog",e,r=>{r?i(r):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("delObject",e,{maintenance:t},o=>{o?r(o):i()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("delObjects",e,{maintenance:t},o=>{o?r(o):i()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("setObject",e,t,o=>{o?r(o):i()})}})):Promise.reject(new Error("Null object is not allowed"))}getObject(e){return this.request({commandTimeout:!1,executor:(t,i)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:"state",common:{name:"ignored state",type:"mixed"}});return}this._socket.emit("getObject",e,(r,o)=>{r?i(r):t(o)})}})}sendTo(e,t,i){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit("sendTo",e,t,i,o=>{r(o)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("extendObject",e,t,o=>{o?r(o):i()})}})):Promise.reject(new Error("Null object is not allowed"))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){const t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){const t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||"all"}`,forceUpdate:t,commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getObjectView","system","enum",{startkey:`enum.${e||""}`,endkey:e?`enum.${e}.香`:"enum.香"},(o,n)=>{if(o)r(o);else{const M={};if(n)for(let c=0;c<n.rows.length;c++)e&&n.rows[c].id===`enum.${e}`||(M[n.rows[c].id]=n.rows[c].value);i(M)}})}})}getObjectView(e,t,i){return this.getObjectViewCustom("system",i,e,t)}async getObjectViewSystem(e,t,i){var n;const r=`${e}_${t||""}_${i||""}`,o=await this.getObjectViewCustom("system",e,t,i);return(n=this.objectViewCached)!=null&&n[r]&&(this.objectViewCached[r]=o),o}async getObjectViewSystemCached(e,t,i){var n;const r=`${e}_${t||""}_${i||""}`;if((n=this.objectViewCached)!=null&&n[r])return Promise.resolve(this.objectViewCached[r]);const o=await this.getObjectViewCustom("system",e,t,i);return this.objectViewCached||={},this.objectViewCached[r]=o,o}getObjectViewCustom(e,t,i,r){return this.request({commandTimeout:!1,executor:(o,n)=>{i||="",r||="香",this._socket.emit("getObjectView",e,t,{startkey:i,endkey:r},(M,c)=>{if(M)n(M);else{const l={};if(c&&c.rows)for(let N=0;N<c.rows.length;N++)l[c.rows[N].id]=c.rows[N].value;o(l)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getObjectView","system","meta",{startkey:"",endkey:"香"},(i,r)=>{var o;i?t(i):e((o=r.rows)==null?void 0:o.map(n=>n.value).filter(n=>!!n))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("readDir",e,t,(o,n)=>{o?r(o):i(n)})}})}readFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit(i?"readFile64":"readFile",e,t,(n,M,c)=>{n?o(n):r({file:M,mimeType:c})})}})}writeFile64(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{if(typeof i=="string")this._socket.emit("writeFile",e,t,i,n=>{n?o(n):r()});else{const n=btoa(new Uint8Array(i).reduce((M,c)=>M+String.fromCharCode(c),""));this._socket.emit("writeFile64",e,t,n,M=>{M?o(M):r()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFile",e,t,o=>{o?r(o):i()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFolder",e,t,o=>{o?r(o):i()})}})}rename(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("rename",e,t,i,n=>{n?o(n):r()})}})}renameFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("renameFile",e,t,i,n=>{n?o(n):r()})}})}cmdExec(e,t,i,r){return this.request({commandTimeout:r,executor:(o,n,M)=>{e=vt(e),this._socket.emit("cmdExec",e,i,t,c=>{M.elapsed||(M.clearTimeout(),c?n(c):o())})}})}getSystemConfig(e){return this.request({cacheKey:"systemConfig",forceUpdate:e,commandTimeout:!1,executor:async t=>{let i=await this.getObject("system.config");i??={},i.common??={},i.native??={},t(i)}})}getCompactSystemConfig(e){return this.request({cacheKey:"systemConfigCommon",forceUpdate:e,commandTimeout:!1,requireAdmin:!0,executor:(t,i)=>{this._socket.emit("getCompactSystemConfig",(r,o)=>{r?i(r):(o??={},o.common??={},o.native??={},t(o))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getForeignStates",e||"*",(r,o)=>{r?i(r):t(o??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getForeignObjects",e||"*",t,(o,n)=>{o?r(o):i(n)})}})}setSystemConfig(e){return this.setObject("system.config",e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getHistory",e,t,(o,n)=>{o?r(o):i(n)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getHistory",e,t,(o,n,M,c)=>{o?r(o):i({values:n,sessionId:c,step:M})})}})}getIpAddresses(e,t){return e=vt(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObject(e);i((r==null?void 0:r.common.address)??[])}})}getVersion(e){return this.request({cacheKey:"version",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getVersion",(r,o,n)=>{r&&!o&&typeof r=="string"&&r.match(/\d+\.\d+\.\d+/)?t({version:r,serverName:"socketio"}):r?i(r):t({version:o,serverName:n})})}})}getWebServerName(){return this.request({cacheKey:"webName",commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getAdapterName",(i,r)=>{i?t(i):e(r)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("fileExists",e,t,(o,n)=>{o?r(o):i(!!n)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit("authEnabled",(t,i)=>{e(i)})}})}getUuid(){return this.request({cacheKey:"uuid",commandTimeout:!1,executor:async e=>{var i;const t=await this.getObject("system.meta.uuid");e((i=t==null?void 0:t.native)==null?void 0:i.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(i,r)=>{this._socket.emit("checkFeatureSupported",e,(o,n)=>{o?r(o):i(n)})}})}getAdapterInstances(e,t){return typeof e=="boolean"&&(t=e,e=""),e||="",this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=e?`system.adapter.${e}.`:"system.adapter.",o=`${r}香`,n=await this.getObjectViewSystem("instance",r,o),M=Object.values(n);i(e?M.filter(c=>c.common.name===e):M)}})}getAdapters(e,t){return typeof e=="boolean"&&(t=e,e=""),e||="",this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObjectViewSystem("adapter",`system.adapter.${e||""}`,`system.adapter.${e||"香"}`),o=Object.values(r);i(e?o.filter(n=>n.common.name===e):o)}})}getGroups(e){return this.request({cache