iobroker.admin 6.3.1 → 6.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +0,0 @@
1
- "use strict";(self.webpackChunksrc_rx=self.webpackChunksrc_rx||[]).push([[6322],{56322:function(ls,lt,b){var se=b(4819),l=b.n(se),ot=b(15854),v=b.n(ot),Oe=b(97230),De=b(21879),D=b(29138),at=b(56474),Ne=b(33378),nt=b(19889),rt=b(57578),ct=b(19368),X=b(62003),ht=b(62074),I=b(90541),dt=b(96550),ce=b(98964),ut=b(5846),mt=b(3574),pt=b(66797),ft=b(69340),gt=b(6911),Y=b(17958),Q=b(19702),ie=b(46754),he=b(75090),le=b(55710),$=b(86107),bt=b(22889),yt=b(74187),de=b(81325),je=b(62743),_t=b(39323),Ie=b(91495),xe=b(23922),Ae=b(23251),Et=b(32245),Te=b(28184),vt=b(73167),ke=b(62363),Ve=b(89854),q=b(70563),Ct=b(54198),Me=b(9790),wt=b(41173),St=b(13423),Ot=b(52812),Dt=b(34595),L=b(62976),ue=b(26021),Nt=b(59599),Be=b(43820),jt=b(17773),It=b(22675),xt=b(58866),At=b(15907),Tt=b(40314),oe=b(36859),kt=b(94201),Vt=b(86732),Mt=b(4372),Bt=b(71672),me=b(83358),Pt=b(24963),Wt=b(86544),Rt=b(6621),Ft=b(95837),$t=b(87280),ae=b(37943),pe=b(78444),Lt=b(13627),fe=b(94475),Zt=b(70703),w=b(61984),zt=b(17688),Ut=b(89316),Kt=b(86887),Jt=Object.defineProperty,Pe=Object.getOwnPropertySymbols,Ht=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,ge=(c,e,s)=>e in c?Jt(c,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[e]=s,Z=(c,e)=>{for(var s in e||(e={}))Ht.call(e,s)&&ge(c,s,e[s]);if(Pe)for(var s of Pe(e))Gt.call(e,s)&&ge(c,s,e[s]);return c},T=(c,e,s)=>(ge(c,typeof e!="symbol"?e+"":e,s),s),be=(c,e,s)=>new Promise((t,i)=>{var a=u=>{try{h(s.next(u))}catch(g){i(g)}},o=u=>{try{h(s.throw(u))}catch(g){i(g)}},h=u=>u.done?t(u.value):Promise.resolve(u.value).then(a,o);h((s=s.apply(c,e)).next())});const K=24,k=32,Xt=16,j=20,Yt="#ff6d69",Qt="#5773ff",We="#ff413c",Re="#86211f",ye="#57ff45",_e="#098c04",Ee="#f3ad11",ve="#6c5008",qt=c=>({toolbar:{minHeight:38},toolbarButtons:{padding:4,marginLeft:4},switchColumnAuto:{marginLeft:c.spacing(2)},dialogColumns:{transition:"opacity 1s"},dialogColumnsLabel:{fontSize:12,paddingTop:c.spacing(1)},columnCustom:{width:"100%",display:"inline-block"},columnCustomEditable:{cursor:"text"},columnCustomCenter:{textAlign:"center"},columnCustomLeft:{textAlign:"left"},columnCustomRight:{textAlign:"right"},width100:{width:"100%"},transparent_10:{opacity:.1},transparent_20:{opacity:.2},transparent_30:{opacity:.3},transparent_40:{opacity:.4},transparent_50:{opacity:.5},transparent_60:{opacity:.6},transparent_70:{opacity:.7},transparent_80:{opacity:.8},transparent_90:{opacity:.9},transparent_100:{opacity:1},columnsDialogInputWidth:{width:80},headerRow:{paddingLeft:c.spacing(1),height:38,whiteSpace:"nowrap",userSelect:"none"},buttonClearFilter:{position:"relative",float:"right",padding:0},buttonClearFilterIcon:{zIndex:2,position:"absolute",top:0,left:0,color:"#FF0000",opacity:.7},tableDiv:{paddingTop:0,paddingLeft:0,width:`calc(100% - ${c.spacing(1)})`,height:"calc(100% - 38px)",overflow:"auto"},tableRow:{paddingLeft:c.spacing(1),height:k,lineHeight:`${k}px`,verticalAlign:"top",userSelect:"none",width:"100%","&:hover":{background:`${c.palette.mode==="dark"?c.palette.primary.dark:c.palette.primary.light} !important`,color:w.Z.invertColor(c.palette.primary.main,!0)},whiteSpace:"nowrap",flexWrap:"nowrap"},tableRowLines:{borderBottom:`1px solid ${c.palette.mode==="dark","#8888882e"}`,"& > div":{borderRight:`1px solid ${c.palette.mode==="dark","#8888882e"}`}},tableRowNoDragging:{cursor:"pointer"},tableRowAlias:{height:k+10},tableRowAliasReadWrite:{height:k+22},checkBox:{padding:0},cellId:{position:"relative",fontSize:"1rem",overflow:"hidden",textOverflow:"ellipsis","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"},"& .iconOwn":{display:"block",width:k-4,height:k-4,marginTop:2,float:"right"},"&:hover .iconOwn":{display:"none"},"& *":{width:"initial"}},cellIdSpan:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},cellIdIconFolder:{marginRight:c.spacing(1),width:k-4,height:k-4,cursor:"pointer",color:c.palette.secondary.main||"#fbff7d",verticalAlign:"top"},cellIdIconDocument:{verticalAlign:"middle",marginLeft:(k-j)/2,marginRight:c.spacing(1),width:j,height:j},cellIdIconOwn:{},cellIdTooltip:{fontSize:14},cellIdTooltipLink:{color:"#7ec2fd","&:hover":{color:"#7ec2fd"},"&:visited":{color:"#7ec2fd"}},cellCopyButton:{width:j,height:j,top:(k-j)/2,opacity:.8,"&:hover":{opacity:1},position:"absolute",right:3},cellEditButton:{width:j,height:j,color:"white",position:"absolute",top:(k-j)/2,right:j+3,opacity:.7,"&:hover":{opacity:1}},cellName:{display:"inline-block",verticalAlign:"top",fontSize:14,marginLeft:5,overflow:"hidden",textOverflow:"ellipsis",position:"relative","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"}},cellIdAlias:{fontStyle:"italic",fontSize:12,opacity:.7,"&:hover":{color:c.palette.mode==="dark"?"#009900":"#007700"}},cellIdAliasReadWriteDiv:{height:24,marginTop:-5},cellIdAliasAlone:{lineHeight:0},cellIdAliasReadWrite:{lineHeight:"12px"},cellType:{display:"inline-block",verticalAlign:"top","& .itemIcon":{verticalAlign:"middle",width:K,height:K,display:"inline-block"},"& .itemIconFolder":{marginLeft:3}},cellRole:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellRoom:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellEnumParent:{opacity:.4},cellFunc:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellValue:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellValueButton:{marginTop:5,"&:active":{transform:"scale(0.8)"}},cellValueButtonFalse:{opacity:.3},cellAdapter:{display:"inline-block",verticalAlign:"top"},cellValueTooltip:{fontSize:12},cellValueText:{width:"100%",height:k,fontSize:16,display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",position:"relative",verticalAlign:"top","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"}},cellValueFile:{color:"#2837b9"},cellValueTooltipTitle:{fontStyle:"italic",width:100,display:"inline-block"},cellValueTooltipValue:{width:120,display:"inline-block",whiteSpace:"nowrap",textOverflow:"ellipsis"},cellValueTooltipBoth:{width:220,display:"inline-block",whiteSpace:"nowrap"},cellValueTooltipBox:{width:250,overflow:"hidden"},cellValueTextUnit:{marginLeft:c.spacing(.5),opacity:.8},newValue:{animation:"$newValueAnimation 2s ease-in-out"},"@keyframes newValueAnimation":{"0%":{color:"#00f900"},"80%":{color:"#008000"},"100%":{color:c.palette.mode==="dark"?"#fff":"#000"}},cellValueTextState:{opacity:.7},cellValueTooltipCopy:{position:"absolute",bottom:3,right:3},cellValueTooltipEdit:{position:"absolute",bottom:3,right:15},cellButtons:{display:"inline-block",verticalAlign:"top"},cellButtonsButton:{display:"inline-block",opacity:.7,width:j+4,height:j+4,"&:hover":{opacity:1},paddingTop:0,paddingLeft:0,marginTop:-2},cellButtonsEmptyButton:{fontSize:12},cellButtonMinWidth:{minWidth:47},cellButtonsButtonAlone:{marginLeft:j+4,paddingTop:0,marginTop:-2},cellButtonsButtonWithCustoms:{color:c.palette.secondary.main},cellButtonsButtonWithoutCustoms:{opacity:.2},cellButtonsValueButton:{position:"absolute",display:"inline-block",top:j/2-2,opacity:.7,width:j-2,height:j-2,color:c.palette.action.active,"&:hover":{opacity:1}},cellButtonsValueButtonCopy:{right:c.spacing(1),cursor:"pointer"},cellButtonsValueButtonEdit:{right:j/2+parseInt(c.spacing(2),10)},filteredOut:{opacity:.5},filteredParentOut:{opacity:.3},filterInput:{marginTop:0,marginBottom:0},selectIcon:{width:24,height:24,marginRight:4},selectNone:{opacity:.5},itemSelected:{background:`${c.palette.primary.main} !important`,color:`${w.Z.invertColor(c.palette.primary.main,!0)} !important`},header:{width:"100%"},headerCell:{display:"inline-block",verticalAlign:"top"},headerCellValue:{paddingTop:4,fontSize:16},headerCellInput:{width:"calc(100% - 5px)",height:k,paddingTop:3,"& .itemIcon":{verticalAlign:"middle",width:K,height:K,display:"inline-block"}},headerCellSelectItem:{"& .itemIcon":{width:K,height:K,marginRight:5,display:"inline-block"}},visibleButtons:{color:"#2196f3",opacity:.7},grow:{flexGrow:1},enumIconDiv:{marginRight:c.spacing(1),width:32,height:32,borderRadius:8,background:"#FFFFFF"},enumIcon:{marginTop:4,marginLeft:4,width:24,height:24},enumDialog:{overflow:"hidden"},enumList:{minWidth:250,height:"calc(100% - 50px)",overflow:"auto"},enumButton:{float:"right"},enumCheckbox:{minWidth:0},buttonDiv:{display:"flex",height:"100%",alignItems:"center"},aclText:{fontSize:13},rightsObject:{color:"#55ff55",paddingLeft:3},rightsState:{color:"#86b6ff",paddingLeft:3},textCenter:{padding:12,textAlign:"center"},tooltipAccessControl:{display:"flex",flexDirection:"column"},"@media screen and (max-width: 465px)":{columnsDialogInputWidth:{width:50},fontSizeTitle:{"& *":{fontSize:12}}},"@media screen and (max-width: 700px)":{},"@media screen and (max-width: 430px)":{},draggable:{cursor:"copy"},nonDraggable:{cursor:"no-drop"},selectClearButton:{position:"absolute",top:0,right:0,borderRadius:20,backgroundColor:c.palette.background.default},iconDeviceConnected:{color:c.palette.mode==="dark"?ye:_e,opacity:.8,position:"absolute",top:4,right:32,width:20},iconDeviceDisconnected:{color:c.palette.mode==="dark"?Ee:ve,opacity:.8,position:"absolute",top:4,right:32,width:20},iconDeviceError:{color:c.palette.mode==="dark"?We:Re,opacity:.8,position:"absolute",top:4,right:50,width:20},resizeHandle:{display:"block",position:"absolute",cursor:"col-resize",width:7,top:2,bottom:2,zIndex:1},resizeHandleRight:{right:3,borderRight:"2px dotted #888","&:hover":{borderColor:"#ccc",borderRightStyle:"solid"},"&.active":{borderColor:"#517ea5",borderRightStyle:"solid"}},resizeHandleLeft:{left:-4,borderLeft:"2px dotted #888","&:hover":{borderColor:"#ccc",borderLeftStyle:"solid"},"&.active":{borderColor:"#517ea5",borderLeftStyle:"solid"}},invertedBackground:{backgroundColor:c.palette.mode==="dark"?"#9a9a9a":"#565656",padding:"0 3px",borderRadius:"2px 0 0 2px"},invertedBackgroundFlex:{backgroundColor:c.palette.mode==="dark"?"#9a9a9a":"#565656",borderRadius:"0 2px 2px 0"}});function Fe(c,e){const s=document.createElement("a");s.setAttribute("href",`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(e,null,2))}`),s.setAttribute("download",c),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)}function ee(c,e,s,t){if(s=s||0,t===void 0&&(t=c.length-1,!t))return c[0]===e;const i=Math.floor((s+t)/2);return e===c[i]?c[i]:t-1===s?c[s]===e||c[t]===e:e>c[i]?ee(c,e,i,t):e<c[i]?ee(c,e,s,i):!1}function V(c,e){return c&&typeof c=="object"?(c[e]||c.en||"").toString():(c||"").toString()}function ne(c,e,s){s=s||".";let t="";const i=`system.adapter.${e}`,a=e&&c[i]&&c[i].common&&c[i].common.icon;if(a){if(!a.startsWith("data:image/"))if(a.includes("."))t=`${s}/adapter/${c[i].common.name}/${a}`;else return a&&a.length<3?a:null;a.startsWith("data:image/svg")?t=l().createElement(De.default,{className:"iconOwn",src:a,width:28,height:28}):t=a}else{const o=c[e]&&c[e].common;if(o){const h=o.icon;if(h)if(h.startsWith("data:image/"))h.startsWith("data:image/svg")?t=l().createElement(De.default,{className:"iconOwn",src:h,width:28,height:28}):t=h;else if(h.includes(".")){let u;c[e].type==="instance"||c[e].type==="adapter"?t=`${s}/adapter/${o.name}/${h}`:e&&e.startsWith("system.adapter.")?(u=e.split(".",3),h[0]==="/"?u[2]+=h:u[2]+=`/${h}`,t=`${s}/adapter/${u[2]}`):(u=e.split(".",2),h[0]==="/"?u[0]+=h:u[0]+=`/${h}`,t=`${s}/adapter/${u[0]}`)}else return a&&a.length<3?a:null}}return t||null}function Ce(c,e,s,t,i,a,o,h,u){var g,y,d,p;u=u||0;let n=!1;i||(i={},e.id&&(i.id=e.id.toLowerCase()),e.name&&(i.name=e.name.toLowerCase()),e.type&&(i.type=e.type.toLowerCase()),e.custom&&(i.custom=e.custom.toLowerCase()),e.role&&(i.role=e.role.toLowerCase()),e.room&&(i.room=t[e.room]&&t[e.room].common&&t[e.room].common.members||[]),e.func&&(i.func=t[e.func]&&t[e.func].common&&t[e.func].common.members||[]));const r=c.data;if(r&&r.id){const f=(g=r.obj)==null?void 0:g.common;o&&(o.type&&(typeof o.type=="string"?(!r.obj||o.type!==r.obj.type)&&(n=!0):Array.isArray(o.type)&&(!r.obj||!o.type.includes(r.obj.type))&&(n=!0)),!n&&((y=o.common)==null?void 0:y.type)&&(f!=null&&f.type?typeof o.common.type=="string"?o.common.type!==f.type&&(n=!0):Array.isArray(o.common.type)&&(o.type.includes(f.type)||(n=!0)):n=!0),!n&&((d=o.common)==null?void 0:d.role)&&(f!=null&&f.role?typeof o.common.role=="string"?f.role.startsWith(o.common.role)&&(n=!0):Array.isArray(o.common.role)&&(o.common.role.find(m=>o.role.includes(m))||(n=!0)):n=!0),!n&&((p=o.common)==null?void 0:p.custom)&&(f!=null&&f.custom?o.common.custom==="_dataSources"?Object.keys(f.custom).find(m=>m.startsWith("history.")||m.startsWith("sql.")||m.startsWith("influxdb."))||(n=!0):o.common.custom!==!0&&!Object.keys(f.custom).find(m=>m.startsWith(o.common.custom))&&(n=!0):n=!0)),!n&&!e.expertMode&&(n=r.id==="system"||r.id==="enum"||r.id.startsWith("system.")||r.id.startsWith("enum.")||r.id.startsWith("_design/")||r.id.endsWith(".admin")||f&&f.expert),!n&&i.id&&(r.fID===void 0&&(r.fID=r.id.toLowerCase()),n=!r.fID.includes(i.id)),!n&&i.name&&(f?(r.fName===void 0&&(r.fName=f&&V(f.name,s)||"",r.fName=r.fName.toLowerCase()),n=!r.fName.includes(i.name)):n=!0),!n&&e.role&&f&&(f?n=!(f.role&&f.role.startsWith(i.role)):n=!0),!n&&i.room&&(n=!i.room.find(m=>m===r.id||r.id.startsWith(`${m}.`))),!n&&i.func&&(n=!i.func.find(m=>m===r.id||r.id.startsWith(`${m}.`))),!n&&i.type&&(n=!(r.obj&&r.obj.type&&r.obj.type===i.type)),!n&&h&&(n=!(r.obj&&r.obj.type&&h.includes(r.obj.type))),!n&&i.custom&&(f?n=!f.custom||!f.custom[i.custom]:n=!0)}return r.visible=!n,r.hasVisibleChildren=!1,c.children&&u<20&&c.children.forEach(f=>{Ce(f,e,s,t,i,a,o,h,u+1)&&(r.hasVisibleChildren=!0)}),r.sumVisibility=r.visible||r.hasVisibleChildren,a&&r.sumVisibility&&a.count++,r.id&&r.sumVisibility&&c.children&&c.children.forEach(f=>f.data.hasVisibleParent=!0),r.visible||r.hasVisibleChildren}function $e(c,e,s,t){var i;t=t||[];const a=c.data;return a.sumVisibility&&(a.id&&s[a.id]&&(!e||s[a.id].type===e)&&t.push(a.id),(i=c.children)==null||i.forEach(o=>$e(o,e,s,t))),t}function Le(c,e,s,t){let i;return e.startsWith("_design/")||e==="system"?i=l().createElement(Ae.default,{className:"iconOwn"}):e==="0_userdata"||e==="0_userdata.0"?i=l().createElement(Et.default,{className:"iconOwn"}):e==="alias"||e==="alias.0"?i=l().createElement(Mt.default,{className:"iconOwn"}):e==="system.adapter"?i=l().createElement(Ae.default,{className:"iconOwn"}):e==="system.group"?i=l().createElement(Te.default,{className:"iconOwn"}):e==="system.user"?i=l().createElement(ke.default,{className:"iconOwn"}):e==="system.host"?i=l().createElement(Ve.default,{className:"iconOwn"}):e.endsWith(".connection")||e.endsWith(".connected")?i=l().createElement(q.default,{className:"iconOwn"}):e.endsWith(".info")?i=l().createElement(Ct.default,{className:"iconOwn"}):c[e]&&c[e].type==="meta"?i=l().createElement(Me.default,{className:"iconOwn"}):s<2&&c[`system.adapter.${e}`]&&(i=ne(c,`system.adapter.${e}`,t)),i||null}function Ze(c,e){var s,t,i,a;e=e||{};const o=e.imagePrefix||".",h=Object.keys(c);h.sort((r,f)=>r===f?0:(r=r.replace(/\./g,"!!!"),f=f.replace(/\./g,"!!!"),r>f?1:-1));let u=[],g="",y=0;const d={data:{name:"",id:""},children:[]},p={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:c,customs:[],enums:[],hasSomeCustoms:!1};let n=d;for(let r=0;r<h.length;r++){const f=h[r];if(!f)continue;const m=c[f],C=f.split(".");if(m.type&&!p.types.includes(m.type)&&p.types.push(m.type),m){const E=m.common,O=E&&E.role;O&&!p.roles.includes(O)?p.roles.push(O):f.startsWith("enum.rooms.")?(p.roomEnums.push(f),p.enums.push(f)):f.startsWith("enum.functions.")?(p.funcEnums.push(f),p.enums.push(f)):m.type==="enum"?p.enums.push(f):m.type==="instance"&&E&&(E.supportCustoms||((s=E.adminUI)==null?void 0:s.custom))&&(p.hasSomeCustoms=!0,p.customs.push(f.substring(15)))}p.ids.push(f);let S;do if(S=!1,!g||f.startsWith(`${g}.`)){if(C.length-y>1){let O=g;for(let x=y;x<C.length-1;x++)if(O+=(O?".":"")+C[x],ee(p.ids,O))n=n.children.find(J=>J.data.name===C[x]);else{const J={data:{name:C[x],parent:n,id:O,obj:c[O],level:x,icon:Le(c,O,x,o),generated:!0}};n.children=n.children||[],n.children.push(J),n=J,p.ids.push(O)}}const E={data:{name:C[C.length-1],title:V(m&&m.common&&m.common.name,e.lang),obj:m,parent:n,icon:ne(c,f,o)||Le(c,f,0,o),id:f,hasCustoms:((t=m.common)==null?void 0:t.custom)&&Object.keys(m.common.custom).length,level:C.length-1,generated:!1,button:m.type==="state"&&((i=m.common)==null?void 0:i.role)&&typeof m.common.role=="string"&&m.common.role.startsWith("button")&&((a=m.common)==null?void 0:a.write)!==!1}};n.children=n.children||[],n.children.push(E),n=E,y=C.length,u=C,g=f}else{let E=0;for(;u[E]===C[E];)E++;if(E>0){let O=u.length;for(u=u.splice(0,E),y=E,g=u.join(".");O>E;)n=n.data.parent,O--}else n=d,u=[],g="",y=0;S=!0}while(S)}return p.roomEnums.sort((r,f)=>{var m,C,S,E;const O=V(((C=(m=c[r])==null?void 0:m.common)==null?void 0:C.name)||r.split(".").pop()),x=V(((E=(S=c[f])==null?void 0:S.common)==null?void 0:E.name)||f.split(".").pop());return O>x?1:O<x?-1:0}),p.funcEnums.sort((r,f)=>{var m,C,S,E;const O=V(((C=(m=c[r])==null?void 0:m.common)==null?void 0:C.name)||r.split(".").pop()),x=V(((E=(S=c[f])==null?void 0:S.common)==null?void 0:E.name)||f.split(".").pop());return O>x?1:O<x?-1:0}),p.roles.sort(),p.types.sort(),{info:p,root:d}}function ze(c,e,s,t,i){if(c.data.id===e)return c;if(s||(s=e.split("."),i=0,t=s[i]),!c.children&&c.data.id!==e)return null;let a;for(let o=0;o<c.children.length;o++){const h=c.children[o].data.id;if(h===t){a=c.children[o];break}else if(h>t)break}return a?ze(a,e,s,`${t}.${s[i+1]}`,i+1):null}function Ue(c,e,s,t,i){var a,o;if(!e)return{rooms:[],per:!1};i=i||[];for(let g=0;g<c.roomEnums.length;g++){const y=(a=c.objects[c.roomEnums[g]])==null?void 0:a.common,d=V(y.name,s);((o=y==null?void 0:y.members)==null?void 0:o.includes(e))&&!i.includes(d)&&(t?i.push({name:d,origin:e}):i.push(d))}let h;const u=e.split(".");return u.pop(),e=u.join("."),c.objects[e]&&(h=i.length,Ue(c,e,s,t,i)),{rooms:i,per:!h}}function Ke(c,e,s,t){var i,a;if(!e)return[];t=t||[];for(let o=0;o<c[s].length;o++){const h=(i=c.objects[c[s][o]])==null?void 0:i.common;((a=h==null?void 0:h.members)==null?void 0:a.includes(e))&&!t.includes(c[s][o])&&t.push(c[s][o])}return t.sort(),t}function Je(c,e,s,t,i){var a,o;if(!e)return{funcs:[],pef:!1};i=i||[];for(let g=0;g<c.funcEnums.length;g++){const y=(a=c.objects[c.funcEnums[g]])==null?void 0:a.common,d=V(y.name,s);((o=y==null?void 0:y.members)==null?void 0:o.includes(e))&&!i.includes(d)&&(t?i.push({name:d,origin:e}):i.push(d))}let h;const u=e.split(".");return u.pop(),e=u.join("."),c.objects[e]&&(h=i.length,Je(c,e,s,t,i)),{funcs:i,pef:!h}}function es(c,e,s,t,i,a){const o=w.Z.getStates(s),h=s.common,u={};let g=h&&h.type==="file"?"[file]":!e||e.val===null?"(null)":e.val===void 0?"[undef]":e.val;const y=typeof g;h&&h.role&&typeof h.role=="string"&&h.role.match(/^value\.time|^date/)?g&&typeof g=="string"?g.length===13&&(g=new Date(parseInt(g,10)).toString()):(g>946681200&&g<9466812e5&&(g*=1e3),g=g&&new Date(g).toString()):(y==="number"?(g=Math.round(g*1e8)/1e8,a&&(g=g.toString().replace(".",","))):y==="object"?g=JSON.stringify(g):y!=="string"&&(g=g.toString()),typeof g!="string"&&(g=g.toString())),o&&o[g]!==void 0&&g!==o[g]&&(u.s=g,g=o[g]),h&&h.unit&&(u.u=h.unit);const d=[{t:t.value,v:g}];if(e){if(e.ack!==void 0&&e.ack!==null&&d.push({t:t.ack,v:e.ack.toString()}),e.ts&&d.push({t:t.ts,v:e.ts?w.Z.formatDate(new Date(e.ts),i):""}),e.lc&&d.push({t:t.lc,v:e.lc?w.Z.formatDate(new Date(e.lc),i):""}),e.from){let p=e.from.toString();p.startsWith("system.adapter.")&&(p=p.substring(15)),d.push({t:t.from,v:p})}if(e.user){let p=e.user.toString();p.startsWith("system.user.")&&(p=p.substring(12)),d.push({t:t.user,v:p})}e.c&&d.push({t:t.c,v:e.c}),d.push({t:t.quality,v:w.Z.quality2text(e.q||0).join(", "),nbr:!0})}return u.v=g,{valText:u,valFull:d,style:{color:e!=null&&e.ack?e.q?"#ffa500":"":"#ff2222c9"}}}function ts(c,e){let s=e,t=1;const i=[];for(;t<c.length&&s<e+25*36e5;){for(;c[t-1].ts<s&&s<=c[t].ts&&t<c.length;)t++;if(t===1&&c[t-1].ts>=s)i.push(0);else if(t<c.length)if(typeof c[t].val=="boolean"||typeof c[t-1].val=="boolean")i.push(c[t].val?1:0);else{c[t-1].val=c[t-1].val||0,c[t].val=c[t].val||0;const a=c[t-1].val+(c[t].val-c[t-1].val)*(s-c[t-1].ts)/(c[t].ts-c[t-1].ts);i.push(a)}s+=36e5}return i}const re={id:"",name:"",room:"",func:"",role:"",type:"",custom:"",expertMode:!1},He={state:l().createElement($t.default,{className:"itemIcon"}),channel:l().createElement(Bt.default,{className:"itemIcon"}),device:l().createElement(Pt.default,{className:"itemIcon"}),adapter:l().createElement(Vt.default,{className:"itemIcon"}),meta:l().createElement(Me.default,{className:"itemIcon"}),instance:l().createElement(Ft.default,{className:"itemIcon",style:{color:"#7da7ff"}}),enum:l().createElement(Ot.default,{className:"itemIcon"}),chart:l().createElement(St.default,{className:"itemIcon"}),config:l().createElement(xe.default,{className:"itemIcon"}),group:l().createElement(Te.default,{className:"itemIcon"}),user:l().createElement(ke.default,{className:"itemIcon"}),host:l().createElement(Ve.default,{className:"itemIcon"}),schedule:l().createElement(vt.default,{className:"itemIcon"}),script:l().createElement(wt.default,{className:"itemIcon"}),folder:l().createElement(ae.default,{className:"itemIcon itemIconFolder"})},Ge=(0,Oe.Z)(c=>({badge:{right:3,top:3,border:`2px solid ${c.palette.background.paper}`,padding:"0 4px"}}))(ht.Z),N={xs:{idWidth:"100%",fields:[],widths:{}},sm:{idWidth:300,fields:["room","val"],widths:{room:100,val:200}},md:{idWidth:300,fields:["room","func","val","buttons"],widths:{name:200,room:150,func:150,val:120,buttons:120}},lg:{idWidth:300,fields:["name","type","role","room","func","val","buttons","changedFrom","qualityCode","timestamp","lastChange"],widths:{name:300,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:165,lastChange:165}},xl:{idWidth:550,fields:["name","type","role","room","func","val","buttons","changedFrom","qualityCode","timestamp","lastChange"],widths:{name:400,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:170,lastChange:170}}};let Xe=!1;class R extends se.Component{constructor(e){super(e),T(this,"onStateChange",(d,p)=>{if(console.log(`> stateChange ${d}`),this.states[d]){const n=this.findItem(d);n&&n.data.state&&(n.data.state=null)}this.states[d]=p,this.pausedSubscribes?this.statesUpdateTimer&&(clearTimeout(this.statesUpdateTimer),this.statesUpdateTimer=null):this.statesUpdateTimer||(this.statesUpdateTimer=setTimeout(()=>{this.statesUpdateTimer=null,this.forceUpdate()},300))}),T(this,"onObjectChange",(d,p)=>{let n;if(Array.isArray(d))d.forEach(r=>{if(console.log(`> objectChange ${r.id}`),!(r.obj&&typeof this.props.filterFunc=="function"&&!this.props.filterFunc(r.obj))){if(r.id.startsWith("system.adapter.")&&r.obj&&r.obj.type==="adapter"){const f=JSON.parse(JSON.stringify(this.state.columnsForAdmin));this.parseObjectForAdmins(f,r.obj),JSON.stringify(this.state.columnsForAdmin)!==JSON.stringify(f)&&(n={columnsForAdmin:f})}this.objects=this.objects||[],this.objects[r.id]&&(r.obj?this.objects[r.id]=r.obj:delete this.objects[r.id])}});else{if(console.log(`> objectChange ${d}`),this.objects=this.objects||[],p&&typeof this.props.filterFunc=="function"&&!this.props.filterFunc(p))return;if(d.startsWith("system.adapter.")&&p&&p.type==="adapter"){const r=JSON.parse(JSON.stringify(this.state.columnsForAdmin));this.parseObjectForAdmins(r,p),JSON.stringify(this.state.columnsForAdmin)!==JSON.stringify(r)&&(n={columnsForAdmin:r})}this.objects[d]&&(p?this.objects[d]=p:delete this.objects[d])}n&&this.setState(n),!this.objectsUpdateTimer&&this.objects&&(this.objectsUpdateTimer=setTimeout(()=>{this.objectsUpdateTimer=null;const{info:r,root:f}=Ze(this.objects,this.props);this.root=f,this.info=r,this.lastAppliedFilter=null,this.pausedSubscribes||this.forceUpdate()},500))}),T(this,"getEnumsForId",d=>{const p=[];return this.info.enums.forEach(n=>{var r,f,m;if((m=(f=(r=this.objects[n])==null?void 0:r.common)==null?void 0:f.members)!=null&&m.includes(d)){const C={_id:this.objects[n]._id,common:JSON.parse(JSON.stringify(this.objects[n].common)),native:this.objects[n].native,type:"enum"};C.common&&(delete C.common.members,delete C.common.custom,delete C.common.mobile),p.push(C)}}),p.length?p:void 0}),T(this,"_createAllEnums",(d,p)=>be(this,null,function*(){var n,r;for(let f=0;f<d.length;f++){let m=d[f],C;typeof m=="object"&&(C=m,m=m._id);let S=this.objects[m];S?(r=(n=S.common)==null?void 0:n.members)!=null&&r.includes(p)||(S.common=S.common||{},S.common.members=S.common.members||[],S.common.members.push(p),S.common.members.sort(),yield this.props.socket.setObject(m,S)):(S=C||{_id:m,common:{name:m.split(".").pop(),members:[]},native:{}},S.common=S.common||{},S.common.members=[p],yield this.props.socket.setObject(m,S))}})),T(this,"loadObjects",d=>be(this,null,function*(){if(d)for(const p in d){if(!Object.hasOwn(d,p)||!d[p])continue;const n=d[p];let r=null;n&&n.common&&n.common.enums?(r=n.common.enums,delete n.common.enums):r=null;try{if(yield this.props.socket.setObject(p,n),r&&(yield this._createAllEnums(r,n._id)),n.type==="state")try{const f=yield this.props.socket.getState(n._id);if(!f||f.val===null)try{yield this.props.socket.setState(n._id,!n.common||n.common.def===void 0?null:n.common.def,!0)}catch(m){window.alert(`Cannot set state "${n._id}": ${m}`)}}catch(f){window.alert(`Cannot read state "${n._id}": ${f}`)}}catch(f){window.alert(f)}}})),T(this,"handleJsonUpload",d=>{const p=d.target.files[0];if(p){const n=new FileReader;n.onload=r=>be(this,null,function*(){const f=r.target.result;try{const m=JSON.parse(f),C=Object.keys(m).length,S=m._id;if(S===void 0&&C)yield this.loadObjects(m),window.alert(this.props.t("ra_%s object(s) processed",C));else{if(!S)return window.alert(this.props.t("ra_Invalid structure"));try{let E;if(m.common.enums&&(E=m.common.enums,delete m.common.enums),yield this.props.socket.setObject(m._id,m),m.type==="state"){const O=yield this.props.socket.getState(m._id);(!O||O.val===null||O.val===void 0)&&(yield this.props.socket.getState(m._id,m.common.def===void 0?null:m.common.def,!0))}E&&(yield this._createAllEnums(E,m._id)),window.alert(this.props.t("ra_%s was imported",m._id))}catch(E){window.alert(E)}}}catch(m){window.alert(m)}return null}),n.readAsText(p)}else window.alert(this.props.t("ra_Failed to open JSON File"))}),T(this,"toolTipObjectCreating",()=>{var d,p;const{t:n}=this.props;let r=[l().createElement("div",{key:1},n("ra_Only following structures of objects are available:")),l().createElement("div",{key:2},n("ra_Folder \u2192 State")),l().createElement("div",{key:3},n("ra_Folder \u2192 Channel \u2192 State")),l().createElement("div",{key:4},n("ra_Folder \u2192 Device \u2192 Channel \u2192 State")),l().createElement("div",{key:5},n("ra_Device \u2192 Channel \u2192 State")),l().createElement("div",{key:6},n("ra_Channel \u2192 State")),l().createElement("div",{key:7,style:{height:10}}),l().createElement("div",{key:8},n('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),l().createElement("div",{key:9},n('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];if(this.state.selected.length||this.state.selectedNonObject){const f=this.state.selected[0]||this.state.selectedNonObject;if(!(f.split(".").length<2||this.objects[f]&&((d=this.objects[f])==null?void 0:d.type)==="state"))if(this.state.filter.expertMode)switch((p=this.objects[f])==null?void 0:p.type){case"device":r=[l().createElement("div",{key:1},n("ra_Only following structures of objects are available:")),l().createElement("div",{key:5},n("ra_Device \u2192 Channel \u2192 State")),l().createElement("div",{key:7,style:{height:10}}),l().createElement("div",{key:8},n('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),l().createElement("div",{key:9},n('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;case"folder":r=[l().createElement("div",{key:1},n("ra_Only following structures of objects are available:")),l().createElement("div",{key:2},n("ra_Folder \u2192 State")),l().createElement("div",{key:3},n("ra_Folder \u2192 Channel \u2192 State")),l().createElement("div",{key:4},n("ra_Folder \u2192 Device \u2192 Channel \u2192 State")),l().createElement("div",{key:7,style:{height:10}}),l().createElement("div",{key:8},n('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),l().createElement("div",{key:9},n('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;case"channel":r=[l().createElement("div",{key:1},n("ra_Only following structures of objects are available:")),l().createElement("div",{key:1},n("ra_Channel \u2192 State")),l().createElement("div",{key:7,style:{height:10}}),l().createElement("div",{key:8},n('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),l().createElement("div",{key:9},n('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;default:break}else(f.startsWith("alias.0")||f.startsWith("0_userdata"))&&(r=[l().createElement("div",{key:1},n("ra_Only following structures of objects are available:")),l().createElement("div",{key:2},n("ra_Folder \u2192 State")),l().createElement("div",{key:3},n("ra_Folder \u2192 Channel \u2192 State")),l().createElement("div",{key:4},n("ra_Folder \u2192 Device \u2192 Channel \u2192 State")),l().createElement("div",{key:5},n("ra_Device \u2192 Channel \u2192 State")),l().createElement("div",{key:6},n("ra_Channel \u2192 State")),l().createElement("div",{key:7,style:{height:10}}),l().createElement("div",{key:7},n('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),l().createElement("div",{key:8},n('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))])}return r.length?r:n("ra_Add new child object to selected parent")}),T(this,"renderTooltipAccessControl",d=>{if(!d)return null;const p=[{value:"0x400",valueNum:1024,title:"read",group:"Owner"},{value:"0x200",valueNum:512,title:"write",group:"Owner"},{value:"0x40",valueNum:64,title:"read",group:"Group"},{value:"0x20",valueNum:32,title:"write",group:"Group"},{value:"0x4",valueNum:4,title:"read",group:"Everyone"},{value:"0x2",valueNum:2,title:"write",group:"Everyone"}],n=[],r=(f="object")=>{const m=d[f];p.forEach((C,S)=>{m&C.valueNum&&n.push(l().createElement("span",{key:f+S},this.texts[`acl${C.group}_${C.title}_${f}`],",",l().createElement("span",{className:f==="object"?this.props.classes.rightsObject:this.props.classes.rightsState},C.value)))})};return n.push(l().createElement("span",{key:"group"},`${this.texts.ownerGroup}: ${(d.ownerGroup||"").replace("system.group.","")}`)),n.push(l().createElement("span",{key:"owner"},`${this.texts.ownerUser}: ${(d.owner||"").replace("system.user.","")}`)),r(),d.state&&r("state"),n.length?l().createElement("span",{className:this.props.classes.tooltipAccessControl},n.map(f=>f)):""}),T(this,"resizerMouseMove",d=>{if(this.resizerActiveDiv){let p,n;this.resizeLeft?(p=this.resizerOldWidth-d.clientX+this.resizerPosition,n=this.resizerOldWidthNext+d.clientX-this.resizerPosition):(p=this.resizerOldWidth+d.clientX-this.resizerPosition,n=this.resizerOldWidthNext-d.clientX+this.resizerPosition),(!this.resizerMin||p>this.resizerMin)&&(!this.resizerNextMin||n>this.resizerNextMin)&&(this.resizerCurrentWidths[this.resizerActiveName]=p,this.resizerCurrentWidths[this.resizerNextName]=n,this.resizerActiveDiv.style.width=`${p}px`,this.resizerNextDiv.style.width=`${n}px`,this.columnsVisibility[this.resizerActiveName]=p,this.columnsVisibility[this.resizerNextName]=n,this.resizerNextName==="nameHeader"?(this.columnsVisibility.name=n-this.state.scrollBarWidth,this.resizerCurrentWidths.name=n-this.state.scrollBarWidth):this.resizerActiveName==="nameHeader"&&(this.columnsVisibility.name=p-this.state.scrollBarWidth,this.resizerCurrentWidths.name=p-this.state.scrollBarWidth),this.customWidth=!0,this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=null,this.forceUpdate()},200))}}),T(this,"resizerMouseUp",()=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerActiveName=null,this.resizerNextName=null,this.resizerActiveDiv=null,this.resizerNextDiv=null,window.removeEventListener("mousemove",this.resizerMouseMove),window.removeEventListener("mouseup",this.resizerMouseUp)}),T(this,"resizerMouseDown",d=>{if(this.resizerActiveIndex===null||this.resizerActiveIndex===void 0){this.storedWidths||(this.storedWidths=JSON.parse(JSON.stringify(N[this.props.width]))),this.resizerCurrentWidths=this.resizerCurrentWidths||{},this.resizerActiveDiv=d.target.parentNode,this.resizerActiveName=this.resizerActiveDiv.dataset.name;let p=0;if(d.target.dataset.left==="true"){this.resizeLeft=!0,this.resizerNextDiv=this.resizerActiveDiv.previousElementSibling;let n=this.resizerNextDiv.querySelector(`.${this.props.classes.resizeHandle}`);for(;this.resizerNextDiv&&!n&&p<10;)this.resizerNextDiv=this.resizerNextDiv.previousElementSibling,n=this.resizerNextDiv.querySelector(`.${this.props.classes.resizeHandle}`),p++;n&&n.dataset.left!=="true"&&(this.resizerNextDiv=this.resizerNextDiv.nextElementSibling)}else this.resizeLeft=!1,this.resizerNextDiv=this.resizerActiveDiv.nextElementSibling;this.resizerNextName=this.resizerNextDiv.dataset.name,this.resizerMin=parseInt(this.resizerActiveDiv.dataset.min,10)||0,this.resizerNextMin=parseInt(this.resizerNextDiv.dataset.min,10)||0,this.resizerPosition=d.clientX,this.resizerCurrentWidths[this.resizerActiveName]=this.resizerActiveDiv.offsetWidth,this.resizerCurrentWidths[this.resizerNextName]=this.resizerNextDiv.offsetWidth,this.resizerOldWidth=this.resizerCurrentWidths[this.resizerActiveName],this.resizerOldWidthNext=this.resizerCurrentWidths[this.resizerNextName],window.addEventListener("mousemove",this.resizerMouseMove),window.addEventListener("mouseup",this.resizerMouseUp)}}),T(this,"resizerReset",()=>{this.customWidth=!1,N[this.props.width]=JSON.parse(JSON.stringify(this.storedWidths)),this.calculateColumnsVisibility(),(window._localStorage||window.localStorage).removeItem(`${this.props.dialogName||"App"}.table`),this.forceUpdate()}),T(this,"extendObject",(d,p)=>this.props.socket.extendObject(d,p).catch(n=>window.alert(n))),T(this,"setObject",(d,p)=>this.props.socket.setObject(d,p).catch(n=>window.alert(n))),this.lastSelectedItems=(window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.objectSelected`)||"[]";try{this.lastSelectedItems=JSON.parse(this.lastSelectedItems),typeof this.lastSelectedItems!="object"&&(this.lastSelectedItems=[this.lastSelectedItems]),this.lastSelectedItems=this.lastSelectedItems.filter(d=>d)}catch(d){}let s=(window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.objectExpanded`)||"[]";try{s=JSON.parse(s)}catch(d){s=[]}let t=e.defaultFilters||(window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.objectFilter`)||Z({},re);if(typeof t=="string")try{t=JSON.parse(t)}catch(d){t=Z({},re)}if(t.expertMode=e.expertMode!==void 0?e.expertMode:(window._sessionStorage||window.sessionStorage).getItem("App.expertMode")==="true",this.tableRef=(0,se.createRef)(),this.filterRefs={},Object.keys(re).forEach(d=>this.filterRefs[d]=(0,se.createRef)()),this.lastAppliedFilter=null,this.pausedSubscribes=!1,this.selectedFound=!1,this.root=null,this.states={},this.subscribes=[],this.statesUpdateTimer=null,this.objectsUpdateTimer=null,this.visibleCols=e.columns||N[e.width].fields,e.types&&e.types.length===1){const d=this.visibleCols.indexOf("type");d!==-1&&this.visibleCols.splice(d,1)}let i=null;if(e.router){const d=e.router.getLocation();d.id&&d.dialog==="customs"&&(i=[d.id],this.pauseSubscribe(!0))}let a=e.selected||"";typeof a!="object"&&(a=[a]),a=a.map(d=>d.replace(/["']/g,"")).filter(d=>d);let o=null;try{o=o?JSON.parse(o):null}catch(d){o=null}let h=null;try{h=h?JSON.parse(h):{}}catch(d){h={}}this.imagePrefix=e.imagePrefix||".";let u=(window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.foldersFirst`);u==="false"?u=!1:u==="true"?u=!0:u=e.foldersFirst===void 0?!0:e.foldersFirst;let g=!1;try{g=this.props.objectStatesView&&JSON.parse((window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.objectStatesView`))||!1}catch(d){}this.state={loaded:!1,foldersFirst:u,selected:a,selectedNonObject:(window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.selectedNonObject`)||"",filter:t,filterKey:0,depth:0,expandAllVisible:!1,expanded:s,toast:"",lang:e.lang,scrollBarWidth:16,customDialog:i,editObjectDialog:"",viewFileDialog:"",enumDialog:null,roleDialog:null,statesView:g,columns:o,columnsForAdmin:null,columnsSelectorShow:!1,columnsAuto:!0,columnsWidths:h,columnsDialogTransparent:100,columnsEditCustomDialog:null,customColumnDialogValueChanged:!1,showExportDialog:!1,linesEnabled:(window._localStorage||window.localStorage).getItem(`${e.dialogName||"App"}.lines`)==="true"},this.edit={},this.texts={value:e.t("ra_tooltip_value"),ack:e.t("ra_tooltip_ack"),ts:e.t("ra_tooltip_ts"),lc:e.t("ra_tooltip_lc"),from:e.t("ra_tooltip_from"),user:e.t("ra_tooltip_user"),c:e.t("ra_tooltip_comment"),quality:e.t("ra_tooltip_quality"),editObject:e.t("ra_tooltip_editObject"),deleteObject:e.t("ra_tooltip_deleteObject"),customConfig:e.t("ra_tooltip_customConfig"),copyState:e.t("ra_tooltip_copyState"),editState:e.t("ra_tooltip_editState"),close:e.t("ra_Close"),filter_id:e.t("ra_filter_id"),filter_name:e.t("ra_filter_name"),filter_type:e.t("ra_filter_type"),filter_role:e.t("ra_filter_role"),filter_room:e.t("ra_filter_room"),filter_func:e.t("ra_filter_func"),filter_custom:e.t("ra_filter_customs"),objectChangedByUser:e.t("ra_object_changed_by_user"),objectChangedBy:e.t("ra_object_changed_by"),objectChangedFrom:e.t("ra_state_changed_from"),stateChangedBy:e.t("ra_state_changed_by"),stateChangedFrom:e.t("ra_state_changed_from"),ownerGroup:e.t("ra_Owner group"),ownerUser:e.t("ra_Owner user"),deviceError:e.t("ra_Error"),deviceDisconnected:e.t("ra_Disconnected"),deviceConnected:e.t("ra_Connected"),aclOwner_read_object:e.t("ra_aclOwner_read_object"),aclOwner_read_state:e.t("ra_aclOwner_read_state"),aclOwner_write_object:e.t("ra_aclOwner_write_object"),aclOwner_write_state:e.t("ra_aclOwner_write_state"),aclGroup_read_object:e.t("ra_aclGroup_read_object"),aclGroup_read_state:e.t("ra_aclGroup_read_state"),aclGroup_write_object:e.t("ra_aclGroup_write_object"),aclGroup_write_state:e.t("ra_aclGroup_write_state"),aclEveryone_read_object:e.t("ra_aclEveryone_read_object"),aclEveryone_read_state:e.t("ra_aclEveryone_read_state"),aclEveryone_write_object:e.t("ra_aclEveryone_write_object"),aclEveryone_write_state:e.t("ra_aclEveryone_write_state")},this.levelPadding=e.levelPadding||Xt;let y=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.table`);if(y)try{y=JSON.parse(y),this.storedWidths=JSON.parse(JSON.stringify(N[this.props.width])),Object.keys(y).forEach(d=>{d==="id"?N[this.props.width].idWidth=y.id:d==="nameHeader"?N[this.props.width].widths.name=y[d]:N[this.props.width].widths[d]!==void 0&&(N[this.props.width].widths[d]=y[d])}),this.customWidth=!0}catch(d){}this.calculateColumnsVisibility()}loadAllObjects(e){const s=this.props;let t;return new Promise(i=>{this.setState({updating:!0},()=>i())}).then(()=>this.props.objectsWorker?this.props.objectsWorker.getObjects(e):s.socket.getObjects(e,!0)).then(i=>(t=i,s.types&&s.types[0]!=="state"?(s.length>=1&&console.error("more than one type does not supported! Use filterFunc instead"),s.socket.getObjectView(null,null,s.types[0])):t["system.config"]?Promise.resolve(null):s.socket.getObject("system.config").then(a=>({"system.config":a})))).then(i=>(this.systemConfig=t["system.config"]||i["system.config"]||{},i&&(i["system.config"]&&delete i["system.config"],Object.assign(t,i)),this.systemConfig.common=this.systemConfig.common||{},this.systemConfig.common.defaultNewAcl=this.systemConfig.common.defaultNewAcl||{},this.systemConfig.common.defaultNewAcl.owner=this.systemConfig.common.defaultNewAcl.owner||"system.user.admin",this.systemConfig.common.defaultNewAcl.ownerGroup=this.systemConfig.common.defaultNewAcl.ownerGroup||"system.group.administrator",typeof this.systemConfig.common.defaultNewAcl.state!="number"&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof this.systemConfig.common.defaultNewAcl.object!="number"&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof s.filterFunc=="function"?(this.objects={},Object.keys(t).forEach(a=>{try{s.filterFunc(t[a])&&(this.objects[a]=t[a])}catch(o){console.log(`Error by filtering of "${a}": ${o}`)}})):s.types?(this.objects={},Object.keys(t).forEach(a=>{const o=t[a]&&t[a].type;o&&(o==="channel"||o==="device"||o==="enum"||o==="folder"||o==="adapter"||o==="instance"||s.types.includes(o))&&(this.objects[a]=t[a])})):this.objects=t,this.defaultHistory=this.systemConfig.common.defaultHistory,this.defaultHistory&&s.socket.getState(`system.adapter.${this.defaultHistory}.alive`).then(a=>{(!a||!a.val)&&(this.defaultHistory="")}).catch(a=>window.alert(`Cannot get state: ${a}`)),this.getAdditionalColumns())).then(i=>{this.calculateColumnsVisibility(null,null,i);const{info:a,root:o}=Ze(this.objects,this.props);this.root=o,this.info=a;const h=this.state.selected&&this.state.selected.length&&ze(this.root,this.state.selected[0]);this.lastAppliedFilter=null,h&&!Ce(h,this.state.filter,this.state.lang,this.objects,null,null,s.customFilter,s.types)?this.setState({filter:Z({},re),columnsForAdmin:i},()=>{this.setState({loaded:!0,updating:!1},()=>this.expandAllSelected(()=>this.onAfterSelect()))}):this.setState({loaded:!0,updating:!1,columnsForAdmin:i},()=>this.expandAllSelected(()=>this.onAfterSelect()))}).catch(i=>this.showError(i))}expandAllSelected(e){const s=[...this.state.expanded];let t=!1;this.state.selected.forEach(i=>{const a=i.split("."),o=[];for(let h=0;h<a.length-1;h++)o.push(a[h]),s.includes(o.join("."))||(s.push(o.join(".")),t=!0)}),t?(s.sort(),(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(s)),this.setState({expanded:s},e)):e&&e()}onAfterSelect(e){if(this.lastSelectedItems=[...this.state.selected],this.state.selected&&this.state.selected.length){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectSelected`,JSON.stringify(this.lastSelectedItems));const s=this.lastSelectedItems.length===1?w.Z.getObjectName(this.objects,this.lastSelectedItems[0],null,{language:this.state.lang}):"";this.props.onSelect&&this.props.onSelect(this.lastSelectedItems,s,e)}else(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectSelected`,""),this.state.selected.length?this.setState({selected:[]},()=>this.props.onSelect&&this.props.onSelect([],"")):this.props.onSelect&&this.props.onSelect([],"")}static getDerivedStateFromProps(e,s){const t={};let i=!1;return e.expertMode!==void 0&&e.expertMode!==s.filter.expertMode&&(i=!0,t.filter=Z({},s.filter),t.filter.expertMode=e.expertMode),i?t:null}componentDidMount(){this.loadAllObjects(!Xe).then(()=>{this.props.objectsWorker?this.props.objectsWorker.registerHandler(this.onObjectChange):this.props.socket.subscribeObject("*",this.onObjectChange),Xe=!0})}componentWillUnmount(){this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=null,this.props.objectsWorker?this.props.objectsWorker.unregisterHandler(this.onObjectChange,!0):this.props.socket.unsubscribeObject("*",this.onObjectChange),this.subscribes.forEach(e=>{console.log(`- unsubscribe ${e}`),this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.objects={}}refreshComponent(){this.subscribes.forEach(e=>{console.log(`- unsubscribe ${e}`),this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.loadAllObjects(!0).then(()=>console.log("updated!"))}renderErrorDialog(){return this.state.error?l().createElement(Q.Z,{open:!0,maxWidth:"sm",fullWidth:!0,onClose:()=>this.setState({error:""}),"aria-labelledby":"error-dialog-title","aria-describedby":"error-dialog-description"},l().createElement(Y.Z,{id:"alert-dialog-title"},this.props.title||this.props.t("ra_Error")),l().createElement(ie.Z,null,l().createElement(he.Z,{id:"alert-dialog-description"},this.state.error)),l().createElement(le.Z,null,l().createElement($.Z,{variant:"contained",onClick:()=>this.setState({error:""}),color:"primary",autoFocus:!0,startIcon:l().createElement(ue.default,null)},this.props.t("ra_Ok")))):null}showError(e){this.setState({error:typeof e=="object"?e&&typeof e.toString=="function"?e.toString():JSON.stringify(e):e})}onSelect(e,s){if(!this.props.multiSelect)this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))?((window._localStorage||window.localStorage).removeItem(`${this.props.dialogName||"App"}.selectedNonObject`),this.state.selected[0]!==e?this.setState({selected:[e],selectedNonObject:""},()=>this.onAfterSelect(s)):s&&this.props.onSelect&&this.onAfterSelect(s)):((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.selectedNonObject`,e),this.setState({selected:[],selectedNonObject:e},()=>this.onAfterSelect()));else if(this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))){(window._localStorage||window.localStorage).removeItem(`${this.props.dialogName||"App"}.selectedNonObject`);const t=[...this.state.selected],i=t.indexOf(e);i===-1?(t.push(e),t.sort()):s||t.splice(i,1),this.setState({selected:t,selectedNonObject:""},()=>this.onAfterSelect(s))}}renderColumnsSelectorDialog(){return this.state.columnsSelectorShow?l().createElement(Q.Z,{onClose:()=>this.setState({columnsSelectorShow:!1}),open:!0,classes:{root:w.Z.clsx(this.props.classes.dialogColumns,this.props.classes[`transparent_${this.state.columnsDialogTransparent}`])}},l().createElement(Y.Z,{className:this.props.classes.fontSizeTitle},this.props.t("ra_Configure")),l().createElement(ie.Z,{className:this.props.classes.fontSizeTitle},l().createElement(de.Z,{className:this.props.classes.switchColumnAuto,control:l().createElement(je.Z,{checked:this.state.foldersFirst,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.foldersFirst`,this.state.foldersFirst?"false":"true"),this.setState({foldersFirst:!this.state.foldersFirst})}}),label:this.props.t("ra_Folders always first")}),l().createElement(de.Z,{className:this.props.classes.switchColumnAuto,control:l().createElement(je.Z,{checked:this.state.linesEnabled,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.lines`,this.state.linesEnabled?"false":"true"),this.setState({linesEnabled:!this.state.linesEnabled})}}),label:this.props.t("ra_Show lines between rows")})),l().createElement(le.Z,null,l().createElement($.Z,{variant:"contained",onClick:()=>this.setState({columnsSelectorShow:!1}),color:"primary",startIcon:l().createElement(L.default,null)},this.texts.close))):null}getAdditionalColumns(){return this.props.socket.getAdapters().then(e=>{let s=null;return e.forEach(t=>s=this.parseObjectForAdmins(s,t)),s}).catch(()=>{})}checkUnsubscribes(){for(let e=this.subscribes.length-1;e>=0;e--)!this.recordStates.includes(this.subscribes[e])&&this.unsubscribe(this.subscribes[e]);this.recordStates=[]}findItem(e,s,t,i){if(s=s||e.split("."),t=t||this.root,!t||!s.length)return null;if(i=(i?`${i}.`:"")+s.shift(),t.children){const a=t.children.find(o=>o.data.id===i);if(a){if(a.data.id===e)return a;if(s.length)return this.findItem(e,s,a,i)}else return null}return null}parseObjectForAdmins(e,s){if(s.common&&s.common.adminColumns&&s.common.name){let t=s.common.adminColumns;typeof t!="object"&&(t=[t]),t=t.map(i=>typeof i!="object"?{path:i,name:i.split(".").pop()}:(i.objTypes&&typeof i.objTypes!="object"?i.objTypes=[i.objTypes]:i.objTypes||(i.objTypes=null),!i.name&&i.path?{path:i.path,name:i.path.split(".").pop(),width:i.width,edit:!!i.edit,type:i.type,objTypes:i.objTypes}:typeof i.name!="object"&&i.path?{path:i.path,name:i.name,width:i.width,edit:!!i.edit,type:i.type,objTypes:i.objTypes}:i.path?{path:i.path,name:i.name[this.props.lang]||i.name.en,width:i.width,edit:!!i.edit,type:i.type,objTypes:i.objTypes}:(console.warn(`Admin columns for ${s._id} ignored, because path not found`),null))).filter(i=>i),t&&t.length&&(e=e||{},e[s.common.name]=t.sort((i,a)=>i.path>a.path?-1:i.path<a.path?1:0))}else s.common&&s.common.name&&e&&e[s.common.name]&&delete e[s.common.name];return e}subscribe(e){this.subscribes.includes(e)||(this.subscribes.push(e),console.log(`+ subscribe ${e}`),!this.pausedSubscribes&&this.props.socket.subscribeState(e,this.onStateChange))}unsubscribe(e){const s=this.subscribes.indexOf(e);s!==-1&&(this.subscribes.splice(s,1),this.states[e]&&delete this.states[e],console.log(`- unsubscribe ${e}`),this.props.socket.unsubscribeState(e,this.onStateChange),this.pausedSubscribes&&console.warn("Unsubscribe during pause?"))}pauseSubscribe(e){!this.pausedSubscribes&&e?(this.pausedSubscribes=!0,this.subscribes.forEach(s=>this.props.socket.unsubscribeState(s,this.onStateChange))):this.pausedSubscribes&&!e&&(this.pausedSubscribes=!1,this.subscribes.forEach(s=>this.props.socket.subscribeState(s,this.onStateChange)))}onFilter(e,s){this.filterTimer=null;const t=Z({},this.state.filter);Object.keys(this.filterRefs).forEach(i=>{if(this.filterRefs[i]&&this.filterRefs[i].current){for(let a=0;a<this.filterRefs[i].current.children.length;a++)if(this.filterRefs[i].current.children[a].tagName==="INPUT"){t[i]=this.filterRefs[i].current.children[a].value;break}}}),e&&(t[e]=s,e==="expertMode"&&(window._sessionStorage||window.sessionStorage).setItem("App.expertMode",s?"true":"false")),JSON.stringify(this.state.filter)!==JSON.stringify(t)&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(t)),this.setState({filter:t},()=>this.props.onFilterChanged&&this.props.onFilterChanged(t)))}clearFilter(){const e=Z({},this.state.filter);Object.keys(this.filterRefs).forEach(s=>{if(this.filterRefs[s]&&this.filterRefs[s].current)for(let t=0;t<this.filterRefs[s].current.childNodes.length;t++){const i=this.filterRefs[s].current.childNodes[t];if(i.tagName==="INPUT"){e[s]="",i.value="";break}}}),JSON.stringify(this.state.filter)!==JSON.stringify(e)&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(e)),this.setState({filter:e,filterKey:this.state.filterKey+1},()=>this.props.onFilterChanged&&this.props.onFilterChanged(e)))}isFilterEmpty(){return!Object.keys(this.state.filter).find(s=>s!=="expertMode"&&this.state.filter[s])}getFilterInput(e){var s,t;return l().createElement(rt.Z,{className:w.Z.clsx(this.props.classes.headerCellInput,this.props.classes.filterInput),key:`${e}_${this.state.filterKey}`,margin:"dense"},l().createElement(ct.Z,{ref:this.filterRefs[e],classes:{underline:"no-underline"},id:e,placeholder:this.texts[`filter_${e}`],defaultValue:this.state.filter[e],onChange:()=>{this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>this.onFilter(),400)},autoComplete:"off"}),(t=(s=this.filterRefs[e])==null?void 0:s.current)!=null&&t.firstChild.value?l().createElement("div",{style:{position:"absolute",right:0}},l().createElement(D.Z,{size:"small",onClick:()=>{this.filterRefs[e].current.firstChild.value="",this.onFilter(e,"")}},l().createElement(L.default,null))):null)}getFilterSelect(e,s){var t,i,a;const o=!!s.find(h=>h.icon);return l().createElement("div",{style:{position:"relative"}},l().createElement(nt.Z,{variant:"standard",key:`${e}_${this.state.filterKey}`,ref:this.filterRefs[e],className:`${this.props.classes.headerCellInput} no-underline`,onChange:()=>{this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>this.onFilter(),400)},defaultValue:this.state.filter[e]||"",inputProps:{name:e,id:e},displayEmpty:!0},l().createElement(Ne.Z,{key:"empty",value:""},l().createElement("span",{className:this.props.classes.selectNone},this.texts[`filter_${e}`])),s.map(h=>{let u,g,y;return typeof h=="object"?(u=h.value,g=h.name,y=h.icon):(u=h,g=h),l().createElement(Ne.Z,{className:this.props.classes.headerCellSelectItem,key:u,value:u},y||(o?l().createElement("div",{className:"itemIcon"}):null),g)})),(a=(i=(t=this.filterRefs[e])==null?void 0:t.current)==null?void 0:i.childNodes[1])!=null&&a.value?l().createElement("div",{className:w.Z.clsx(this.props.classes.selectClearButton)},l().createElement(D.Z,{size:"small",onClick:()=>{const h=Z({},this.state.filter);h[e]="",this.filterRefs[e].current.childNodes[1].value="",(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(h)),this.setState({filter:h,filterKey:this.state.filterKey+1},()=>this.props.onFilterChanged&&this.props.onFilterChanged(h))}},l().createElement(L.default,null))):null)}getFilterSelectRole(){return this.getFilterSelect("role",this.info.roles)}getFilterSelectRoom(){const e=this.info.roomEnums.map(s=>{var t,i,a,o;return{name:V(((i=(t=this.objects[s])==null?void 0:t.common)==null?void 0:i.name)||s.split(".").pop()),value:s,icon:l().createElement(fe.default,{src:((o=(a=this.objects[s])==null?void 0:a.common)==null?void 0:o.icon)||"",className:this.props.classes.selectIcon})}});return this.getFilterSelect("room",e)}getFilterSelectFunction(){const e=this.info.funcEnums.map(s=>{var t,i;return{name:V(this.objects[s]&&this.objects[s].common&&this.objects[s].common.name||s.split(".").pop()),value:s,icon:l().createElement(fe.default,{src:((i=(t=this.objects[s])==null?void 0:t.common)==null?void 0:i.icon)||"",className:this.props.classes.selectIcon})}});return this.getFilterSelect("func",e)}getFilterSelectType(){const e=this.info.types.map(s=>({name:s,value:s,icon:He[s]}));return this.getFilterSelect("type",e)}getFilterSelectCustoms(){if(this.info.customs.length){const e=this.info.customs.map(s=>({name:s,value:s,icon:l().createElement(fe.default,{src:ne(this.objects,s,this.imagePrefix)||"",className:this.props.classes.selectIcon})}));return this.getFilterSelect("custom",e)}return null}onExpandAll(e,s){e=e||this.root,s=s||[],e.children&&e.children.forEach(t=>{t.data.sumVisibility&&(s.push(t.data.id),this.onExpandAll(t,s))}),e===this.root&&(s.sort(),(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(s)),this.setState({expanded:s}))}onCollapseAll(){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify([])),(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectSelected`,"[]"),this.setState({expanded:[],depth:0,selected:[]},()=>this.onAfterSelect())}expandDepth(e,s,t){e=e||this.root,s>0&&e.children&&e.children.forEach(i=>{i.data.sumVisibility&&(ee(t,i.data.id)||(t.push(i.data.id),t.sort()),s-1>0&&this.expandDepth(i,s-1,t))})}static collapseDepth(e,s){return s.filter(t=>t.split(".").length<=e)}onExpandVisible(){if(this.state.depth<9){const e=this.state.depth+1,s=[...this.state.expanded];this.expandDepth(this.root,e,s),(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(s)),this.setState({depth:e,expanded:s})}}onStatesViewVisible(){const e=!this.state.statesView;(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectStatesView`,JSON.stringify(e)),this.setState({statesView:e})}onCollapseVisible(){if(this.state.depth>0){const e=this.state.depth-1,s=R.collapseDepth(e,this.state.expanded);(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(s)),this.setState({depth:e,expanded:s})}}_getSelectedIdsForExport(){if(this.state.selected.length||this.state.selectedNonObject){const e=[],s=Object.keys(this.objects);s.sort();const t=this.state.selected[0]||this.state.selectedNonObject,i=`${t}.`,a=i.length;for(let o=0;o<s.length;o++){const h=s[o];if((t===h||h.startsWith(i))&&e.push(h),h.substring(0,a)>i)break}return e}return[]}_exportObjects(e){if(e)Fe("allObjects.json",this.objects);else if(this.state.selected.length||this.state.selectedNonObject){const s={},t=this.state.selected[0]||this.state.selectedNonObject;this._getSelectedIdsForExport().forEach(i=>{if(s[i]=JSON.parse(JSON.stringify(this.objects[i])),s[i].common){const a=this.getEnumsForId(i);a&&(s[i].common.enums=a)}}),Fe(`${t}.json`,s)}else window.alert(this.props.t("ra_Save of objects-tree is not possible"))}renderExportDialog(){return this.state.showExportDialog===!1?null:l().createElement(Q.Z,{open:!0},l().createElement(Y.Z,null,this.props.t("Select type of export")),l().createElement(ie.Z,null,l().createElement(he.Z,null,this.props.t("You can export all objects or just the selected branch."),l().createElement("br",null),this.props.t("Selected %s object(s)",this.state.showExportDialog))),l().createElement(le.Z,null,l().createElement($.Z,{color:"grey",variant:"outlined",onClick:()=>this.setState({showExportDialog:!1},()=>this._exportObjects(!0))},this.props.t("ra_All objects")," (",Object.keys(this.objects).length,")"),l().createElement($.Z,{color:"primary",variant:"contained",autoFocus:!0,onClick:()=>this.setState({showExportDialog:!1},()=>this._exportObjects(!1))},this.props.t("ra_Only selected")," (",this.state.showExportDialog,")"),l().createElement($.Z,{color:"grey",variant:"contained",onClick:()=>this.setState({showExportDialog:!1}),startIcon:l().createElement(L.default,null)},this.props.t("ra_Cancel"))))}getToolbar(){let e=!1;if(this.state.selected.length||this.state.selectedNonObject){const s=this.state.selected[0]||this.state.selectedNonObject;s.split(".").length<2||this.objects[s]&&this.objects[s].type==="state"?e=!1:(this.state.filter.expertMode||s.startsWith("alias.0")||s.startsWith("0_userdata"))&&(e=!0)}return l().createElement("div",{style:{display:"flex",width:"100%",alignItems:"center"}},l().createElement("div",{style:{display:"flex",width:"100%",alignItems:"center"}},l().createElement(I.Z,{title:this.props.t("ra_Refresh tree")},l().createElement("div",null,l().createElement(D.Z,{onClick:()=>this.refreshComponent(),disabled:this.state.updating,size:"large"},l().createElement(It.default,null)))),this.props.showExpertButton&&!this.props.expertMode&&l().createElement(I.Z,{title:this.props.t("ra_expertMode")},l().createElement(D.Z,{key:"expertMode",color:this.state.filter.expertMode?"secondary":"default",onClick:()=>this.onFilter("expertMode",!this.state.filter.expertMode),size:"large"},l().createElement(kt.default,null))),!this.props.disableColumnSelector&&l().createElement(I.Z,{title:this.props.t("ra_Configure")},l().createElement(D.Z,{key:"columnSelector",onClick:()=>this.setState({columnsSelectorShow:!0}),size:"large"},l().createElement(Dt.default,null))),this.state.expandAllVisible&&l().createElement(I.Z,{title:this.props.t("ra_Expand all nodes")},l().createElement(D.Z,{key:"expandAll",onClick:()=>this.onExpandAll(),size:"large"},l().createElement(pe.default,null))),l().createElement(I.Z,{title:this.props.t("ra_Collapse all nodes")},l().createElement(D.Z,{key:"collapseAll",onClick:()=>this.onCollapseAll(),size:"large"},l().createElement(ae.default,null))),l().createElement(I.Z,{title:this.props.t("ra_Expand one step node")},l().createElement(D.Z,{key:"expandVisible",color:"primary",onClick:()=>this.onExpandVisible(),size:"large"},l().createElement(Ge,{badgeContent:this.state.depth,color:"secondary"},l().createElement(pe.default,null)))),l().createElement(I.Z,{title:this.props.t("ra_Collapse one step node")},l().createElement(D.Z,{key:"collapseVisible",color:"primary",onClick:()=>this.onCollapseVisible(),size:"large"},l().createElement(Ge,{badgeContent:this.state.depth,color:"secondary"},l().createElement(ae.default,null)))),this.props.objectStatesView&&l().createElement(I.Z,{title:this.props.t("ra_Toggle the states view")},l().createElement(D.Z,{onClick:()=>this.onStatesViewVisible(),size:"large"},l().createElement(xt.default,{color:this.state.statesView?"primary":"inherit"}))),this.props.objectAddBoolean?l().createElement(I.Z,{title:this.toolTipObjectCreating()},l().createElement("div",null,l().createElement(D.Z,{disabled:!e,onClick:()=>this.setState({modalNewObj:!0}),size:"large"},l().createElement(jt.default,null)))):null,this.props.objectImportExport&&l().createElement(I.Z,{title:this.props.t("ra_Add objects tree from JSON file")},l().createElement(D.Z,{onClick:()=>{const s=document.createElement("input");s.setAttribute("type","file"),s.setAttribute("id","files"),s.setAttribute("opacity",0),s.addEventListener("change",t=>this.handleJsonUpload(t),!1),s.click()},size:"large"},l().createElement(Be.default,null))),this.props.objectImportExport&&(!!this.state.selected.length||this.state.selectedNonObject)&&l().createElement(I.Z,{title:this.props.t("ra_Save objects tree as JSON file")},l().createElement(D.Z,{onClick:()=>this.setState({showExportDialog:this._getSelectedIdsForExport().length}),size:"large"},l().createElement(Be.default,{style:{transform:"rotate(180deg)"}})))),!!this.props.objectBrowserEditObject&&l().createElement("div",{style:{display:"flex",whiteSpace:"nowrap"}},`${this.props.t("ra_Objects")}: ${Object.keys(this.info.objects).length}, ${this.props.t("ra_States")}: ${Object.keys(this.info.objects).filter(s=>this.info.objects[s].type==="state").length}`),this.props.objectEditBoolean&&l().createElement(I.Z,{title:this.props.t("ra_Edit custom config")},l().createElement(D.Z,{onClick:()=>{const s=$e(this.root,"state",this.objects);s.length?(this.pauseSubscribe(!0),s.length===1&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectSelected`,this.state.selected[0]),this.props.router&&this.props.router.doNavigate(null,"custom",this.state.selected[0])),this.setState({customDialog:s})):this.setState({toast:this.props.t("ra_please select object")})},size:"large"},l().createElement(Nt.default,null))))}toggleExpanded(e){const s=JSON.parse(JSON.stringify(this.state.expanded)),t=s.indexOf(e);t===-1?(s.push(e),s.sort()):s.splice(t,1),(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(s)),this.setState({expanded:s})}onCopy(e,s){e.stopPropagation(),e.preventDefault(),w.Z.copyToClipboard(s,null),s.length<50?this.setState({toast:this.props.t("ra_Copied %s",s)}):this.setState({toast:this.props.t("ra_Copied")})}renderColumnButtons(e,s,t){var i,a,o;if(!s.data.obj)return this.props.onObjectDelete||this.props.objectEditOfAccessControl?l().createElement("div",{className:t.buttonDiv},this.state.filter.expertMode&&this.props.objectEditOfAccessControl?l().createElement(D.Z,{className:w.Z.clsx(t.cellButtonsButton,t.cellButtonsEmptyButton,t.cellButtonMinWidth),onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:s.data}),size:"large"},"---"):null,this.props.onObjectDelete&&s.children&&s.children.length?l().createElement(D.Z,{className:w.Z.clsx(t.cellButtonsButton,t.cellButtonsButtonAlone),size:"small","aria-label":"delete",title:this.texts.deleteObject,onClick:()=>{const g=Object.keys(this.objects);g.sort();let y=0;const d=`${e}.`;for(let p=0;p<g.length;p++)if(g[p].startsWith(d))y++;else if(g[p]>d)break;this.props.onObjectDelete(e,!!(s.children&&s.children.length),!1,y+1)}},l().createElement(Ie.default,{className:t.cellButtonsButtonIcon})):null):null;s.data.aclTooltip=s.data.aclTooltip||this.renderTooltipAccessControl(s.data.obj.acl);const h=s.data.obj.acl?s.data.obj.type==="state"?s.data.obj.acl.state:s.data.obj.acl.object:0,u=s.data.obj.acl&&(s.data.obj.type==="state"?this.systemConfig.common.defaultNewAcl.state:this.systemConfig.common.defaultNewAcl.object);return[this.state.filter.expertMode&&this.props.objectEditOfAccessControl?l().createElement(I.Z,{key:"acl",title:s.data.aclTooltip},l().createElement(D.Z,{className:t.cellButtonMinWidth,onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:s.data}),size:"large"},l().createElement("div",{className:t.aclText},Number.isNaN(Number(h).toString(16))?Number(u).toString(16):Number(h).toString(16)))):l().createElement("div",{key:"aclEmpty",className:t.cellButtonMinWidth}),l().createElement(D.Z,{key:"edit",className:t.cellButtonsButton,size:"small","aria-label":"edit",title:this.texts.editObject,onClick:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectSelected`,e),this.setState({editObjectDialog:e})}},l().createElement(_t.default,{className:t.cellButtonsButtonIcon})),this.props.onObjectDelete&&(((i=s.children)==null?void 0:i.length)||!((a=s.data.obj.common)!=null&&a.dontDelete))?l().createElement(D.Z,{key:"delete",className:t.cellButtonsButton,size:"small","aria-label":"delete",onClick:()=>{var g,y;const d=Object.keys(this.objects);d.sort();let p=0;const n=`${e}.`;for(let r=0;r<d.length;r++)if(d[r].startsWith(n))p++;else if(d[r]>n)break;this.props.onObjectDelete(e,!!((g=s.children)!=null&&g.length),!((y=s.data.obj.common)!=null&&y.dontDelete),p)},title:this.texts.deleteObject},l().createElement(Ie.default,{className:t.cellButtonsButtonIcon})):null,this.props.objectCustomDialog&&this.info.hasSomeCustoms&&s.data.obj.type==="state"&&((o=s.data.obj.common)==null?void 0:o.type)!=="file"?l().createElement(D.Z,{className:w.Z.clsx(t.cellButtonsButton,s.data.hasCustoms?t.cellButtonsButtonWithCustoms:t.cellButtonsButtonWithoutCustoms),key:"custom",size:"small","aria-label":"config",title:this.texts.customConfig,onClick:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.objectSelected`,e),this.pauseSubscribe(!0),this.props.router&&this.props.router.doNavigate(null,"customs",e),this.setState({customDialog:[e]})}},l().createElement(xe.default,{className:t.cellButtonsButtonIcon})):null]}readHistory(e){if(window.sparkline&&this.defaultHistory&&this.objects[e]&&this.objects[e].common&&this.objects[e].common.custom&&this.objects[e].common.custom[this.defaultHistory]){const s=new Date;s.setHours(s.getHours()-24),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0);const t=s.getTime();this.props.socket.getHistory(e,{instance:this.defaultHistory,start:t,end:Date.now(),step:36e5,from:!1,ack:!1,q:!1,addID:!1,aggregate:"minmax"}).then(i=>{const a=window.document.getElementsByClassName("sparkline");for(let o=0;o<a.length;o++)if(a[o].dataset.id===e){const h=ts(i,t);window.sparkline.sparkline(a[o],h);break}}).catch(i=>console.warn(`Cannot read history: ${i}`))}}renderColumnValue(e,s,t){var i;const a=s.data.obj;if(!a||!this.states)return null;if(((i=a.common)==null?void 0:i.type)==="file")return l().createElement("div",{className:w.Z.clsx(t.cellValueText,t.cellValueFile)},"[file]");if(!this.states[e])return a.type==="state"&&(!this.recordStates.includes(e)&&this.recordStates.push(e),this.states[e]={val:null},this.subscribe(e)),null;!this.recordStates.includes(e)&&this.recordStates.push(e);const o=this.states[e];let h=s.data.state;if(!h){s.data.state=s.data.state||es(e,o,a,this.texts,this.props.dateFormat,this.props.isFloatComma),h=s.data.state,h.valFull=h.valFull.map(y=>y.t===this.texts.quality&&o.q?[l().createElement("div",{className:t.cellValueTooltipBoth,key:y.t},y.t,":\xA0",y.v),y.nbr?null:l().createElement("br",{key:`${y.t}_br`})]:[l().createElement("div",{className:t.cellValueTooltipTitle,key:y.t},y.t,":\xA0"),l().createElement("div",{className:t.cellValueTooltipValue,key:`${y.t}_v`},y.v),y.nbr?null:l().createElement("br",{key:`${y.t}_br`})]),this.defaultHistory&&this.objects[e]&&this.objects[e].common&&this.objects[e].common.custom&&this.objects[e].common.custom[this.defaultHistory]&&h.valFull.push(l().createElement("svg",{key:"sparkline",className:"sparkline","data-id":e,style:{fill:"#3d85de"},width:"200",height:"30",strokeWidth:"3"}));const g=h.valText.v||"";h.val=g,h.valText=[l().createElement("span",{className:t.newValue,key:`${h.valText.v.toString()}valText`},h.valText.v.toString()),h.valText.u?l().createElement("span",{className:w.Z.clsx(t.cellValueTextUnit,t.newValue),key:`${h.valText.v.toString()}unit`},h.valText.u):null,h.valText.s!==void 0?l().createElement("span",{className:w.Z.clsx(t.cellValueTextState,t.newValue),key:`${h.valText.v.toString()}states`},"(",h.valText.s,")"):null,l().createElement(me.default,{className:w.Z.clsx(t.cellButtonsValueButton,"copyButton",t.cellButtonsValueButtonCopy),onClick:y=>this.onCopy(y,g),key:"cc"})]}let u=h.valText;return!this.state.filter.expertMode&&s.data.button&&(u=l().createElement(At.default,{className:w.Z.clsx(this.props.classes.cellValueButton,!this.states[e]||!this.states[e].val?this.props.classes.cellValueButtonFalse:"")})),l().createElement(I.Z,{key:"value",title:h.valFull,classes:{tooltip:this.props.classes.cellValueTooltip,popper:this.props.classes.cellValueTooltipBox},onOpen:()=>this.readHistory(e)},l().createElement("div",{style:h.style,className:t.cellValueText},u))}_syncEnum(e,s,t,i){var a,o,h;if(!s||!s.length){i&&i();return}const u=s.pop(),g=[];if((a=this.info.objects[u])!=null&&a.common){if((o=this.info.objects[u].common.members)!=null&&o.length){const y=this.info.objects[u].common.members.indexOf(e);if(y!==-1&&!t.includes(u)){const d=JSON.parse(JSON.stringify(this.info.objects[u]));d.common.members.splice(y,1),g.push(this.props.socket.setObject(u,d).then(()=>this.info.objects[u]=d).catch(p=>this.showError(p)))}}if(t.includes(u)&&!((h=this.info.objects[u].common.members)!=null&&h.includes(e))){const y=JSON.parse(JSON.stringify(this.info.objects[u]));y.common.members=y.common.members||[],y.common.members.push(e),y.common.members.sort(),g.push(this.props.socket.setObject(u,y).then(()=>this.info.objects[u]=y).catch(d=>this.showError(d)))}}Promise.all(g).then(()=>setTimeout(()=>this._syncEnum(e,s,t,i),0))}syncEnum(e,s,t){const i=[...this.info[s==="func"?"funcEnums":"roomEnums"]];return new Promise(a=>{this._syncEnum(e,i,t,o=>{o&&this.showError(o),a()})})}renderEnumDialog(){if(this.state.enumDialog){const e=this.state.enumDialog.type,s=this.state.enumDialog.item,t=this.state.enumDialogEnums,i=this.state.enumDialog.enumsOriginal,a=(e==="room"?this.info.roomEnums:this.info.funcEnums).map(o=>({name:V(this.objects[o]&&this.objects[o].common&&this.objects[o].common.name||o.split(".").pop(),this.props.lang),value:o,icon:ne(this.objects,o,this.imagePrefix)})).sort((o,h)=>o.name>h.name?1:-1);return a.forEach(o=>{o.icon&&typeof o.icon=="string"&&(o.icon=l().createElement("div",{className:this.props.classes.enumIconDiv},l().createElement("img",{src:o.icon,className:this.props.classes.enumIcon,alt:o.name})))}),l().createElement(Q.Z,{className:this.props.classes.enumDialog,onClose:()=>this.setState({enumDialog:null}),"aria-labelledby":"enum-dialog-title",open:!0},l().createElement(Y.Z,{id:"enum-dialog-title"},e==="func"?this.props.t("ra_Define functions"):this.props.t("ra_Define rooms"),l().createElement(bt.Z,{className:this.props.classes.enumButton,color:"primary",disabled:JSON.stringify(i)===JSON.stringify(t),size:"small",onClick:()=>this.syncEnum(s.data.id,e,t).then(()=>this.setState({enumDialog:null,enumDialogEnums:null}))},l().createElement(ue.default,null))),l().createElement(ut.Z,{classes:{root:this.props.classes.enumList}},a.map(o=>{let h,u,g;typeof o=="object"?(h=o.value,u=o.name,g=o.icon):(h=o,u=o);const y=`checkbox-list-label-${h}`;return l().createElement(mt.ZP,{className:this.props.classes.headerCellSelectItem,key:h,onClick:()=>{const d=t.indexOf(h),p=JSON.parse(JSON.stringify(this.state.enumDialogEnums));d===-1?(p.push(h),p.sort()):p.splice(d,1),this.setState({enumDialogEnums:p})}},l().createElement(pt.Z,{classes:{root:this.props.classes.enumCheckbox}},l().createElement(ce.Z,{edge:"start",checked:t.includes(h),tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":y}})),l().createElement(gt.Z,{id:y},u),g?l().createElement(ft.Z,null,g):null)})))}return null}renderEditRoleDialog(){if(this.state.roleDialog&&this.props.objectBrowserEditRole){const e=this.props.objectBrowserEditRole;return l().createElement(e,{key:"objectBrowserEditRole",id:this.state.roleDialog,socket:this.props.socket,t:this.props.t,roles:this.info.roles,onClose:s=>{s&&(this.info.objects[this.state.roleDialog]=s),this.setState({roleDialog:!1})}})}return null}onColumnsEditCustomDialogClose(e){if(e){let s=this.customColumnDialog.value;this.customColumnDialog.type==="boolean"?s=s==="true"||s===!0:this.customColumnDialog.type==="number"&&(s=parseFloat(s)),this.customColumnDialog=null,this.props.socket.getObject(this.state.columnsEditCustomDialog.obj._id).then(t=>{if(R.setCustomValue(t,this.state.columnsEditCustomDialog.it,s))return this.props.socket.setObject(t._id,t);throw new Error(this.props.t("ra_Cannot update attribute, because not found in the object"))}).then(()=>this.setState({columnsEditCustomDialog:null})).catch(t=>this.showError(t))}else this.customColumnDialog=null,this.setState({columnsEditCustomDialog:null})}renderColumnsEditCustomDialog(){if(this.state.columnsEditCustomDialog){if(!this.customColumnDialog){const e=R.getCustomValue(this.state.columnsEditCustomDialog.obj,this.state.columnsEditCustomDialog.it);this.customColumnDialog={type:this.state.columnsEditCustomDialog.it.type||typeof e,initValue:(e==null?"":e).toString(),value:(e==null?"":e).toString()}}return l().createElement(Q.Z,{onClose:()=>this.setState({columnsEditCustomDialog:null}),maxWidth:"md","aria-labelledby":"custom-dialog-title",open:!0},l().createElement(Y.Z,{id:"custom-dialog-title"},`${this.props.t("ra_Edit object field")}: ${this.state.columnsEditCustomDialog.obj._id}`),l().createElement(ie.Z,null,l().createElement(he.Z,{id:"alert-dialog-description"},this.customColumnDialog.type==="boolean"?l().createElement(de.Z,{control:l().createElement(ce.Z,{onKeyUp:e=>e.keyCode===13&&this.onColumnsEditCustomDialogClose(!0),defaultChecked:this.customColumnDialog.value==="true",onChange:e=>{this.customColumnDialog.value=e.target.checked.toString();const s=this.customColumnDialog.value!==this.customColumnDialog.initValue;s===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:s})}}),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`}):l().createElement(yt.Z,{variant:"standard",defaultValue:this.customColumnDialog.value,fullWidth:!0,onKeyUp:e=>e.keyCode===13&&this.onColumnsEditCustomDialogClose(!0),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`,onChange:e=>{this.customColumnDialog.value=e.target.value;const s=this.customColumnDialog.value!==this.customColumnDialog.initValue;s===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:s})},autoFocus:!0}))),l().createElement(le.Z,null,l().createElement($.Z,{variant:"contained",onClick:()=>this.onColumnsEditCustomDialogClose(!0),disabled:!this.state.customColumnDialogValueChanged,color:"primary",startIcon:l().createElement(ue.default,null)},this.props.t("ra_Update")),l().createElement($.Z,{color:"grey",variant:"contained",onClick:()=>this.onColumnsEditCustomDialogClose(),startIcon:l().createElement(L.default,null)},this.props.t("ra_Cancel"))))}return null}static getCustomValue(e,s){if(e&&e._id&&e._id.startsWith(`${s.adapter}.`)&&s.path.length>1){const t=s.path;let i;if(e[t[0]]&&typeof e[t[0]]=="object")return t.length===2?i=e[t[0]][t[1]]:t.length===3?i=e[t[0]][t[1]]&&typeof e[t[0]][t[1]]=="object"?e[t[0]][t[1]][t[2]]:null:t.length===4?i=e[t[0]][t[1]]&&typeof e[t[0]][t[1]]=="object"&&e[t[0]][t[1]][t[2]]?e[t[0]][t[1]][t[2]][t[3]]:null:t.length===5?i=e[t[0]][t[1]]&&typeof e[t[0]][t[1]]=="object"&&e[t[0]][t[1]][t[2]]&&e[t[0]][t[1]][t[2]][t[3]]?e[t[0]][t[1]][t[2]][t[3]][t[4]]:null:t.length===6&&(i=e[t[0]][t[1]]&&typeof e[t[0]][t[1]]=="object"&&e[t[0]][t[1]][t[2]]&&e[t[0]][t[1]][t[2]][t[3]]&&e[t[0]][t[1]][t[2]][t[3]][t[4]]?e[t[0]][t[1]][t[2]][t[3]][t[4]][t[5]]:null),i==null?null:i}return null}static setCustomValue(e,s,t){if(e&&e._id&&e._id.startsWith(`${s.adapter}.`)&&s.path.length>1){const i=s.path;if(e[i[0]]&&typeof e[i[0]]=="object"){if(i.length===2)return e[i[0]][i[1]]=t,!0;if(i.length===3){if(e[i[0]][i[1]]&&typeof e[i[0]][i[1]]=="object")return e[i[0]][i[1]][i[2]]=t,!0}else if(i.length===4){if(e[i[0]][i[1]]&&typeof e[i[0]][i[1]]=="object"&&e[i[0]][i[1]][i[2]]&&typeof e[i[0]][i[1]][i[2]]=="object")return e[i[0]][i[1]][i[2]][i[3]]=t,!0}else if(i.length===5){if(e[i[0]][i[1]]&&typeof e[i[0]][i[1]]=="object"&&e[i[0]][i[1]][i[2]]&&typeof e[i[0]][i[1]][i[2]]=="object"&&e[i[0]][i[1]][i[2]][i[3]]&&typeof e[i[0]][i[1]][i[2]][i[3]]=="object")return e[i[0]][i[1]][i[2]][i[3]][i[4]]=t,!0}else if(i.length===6&&e[i[0]][i[1]]&&typeof e[i[0]][i[1]]=="object"&&e[i[0]][i[1]][i[2]]&&typeof e[i[0]][i[1]][i[2]]=="object"&&e[i[0]][i[1]][i[2]][i[3]]&&typeof e[i[0]][i[1]][i[2]][i[3]]=="object"&&e[i[0]][i[1]][i[2]][i[3]][i[4]]&&typeof e[i[0]][i[1]][i[2]][i[3]][i[4]]=="object")return e[i[0]][i[1]][i[2]][i[3]][i[4]][i[5]]=t,!0}}return!1}renderCustomValue(e,s,t){const i=R.getCustomValue(e,s);return i!=null?s.edit&&!this.props.notEditable&&(!s.objTypes||s.objTypes.includes(e.type))?l().createElement("div",{className:w.Z.clsx(this.props.classes.columnCustom,this.props.classes.columnCustomEditable,this.props.classes[`columnCustom_${s.align}`]),onClick:()=>this.setState({columnsEditCustomDialog:{item:t,it:s,obj:e},customColumnDialogValueChanged:!1})},i):l().createElement("div",{className:w.Z.clsx(this.props.classes.columnCustom,this.props.classes[`columnCustom_${s.align}`])},i):null}renderLeaf(e,s,t,i){var a,o,h,u,g,y,d,p,n;const r=e.data.id;i.count++,s=s===void 0?this.state.expanded.includes(r):s;let f;const m=e.data.obj,C=m==null?void 0:m.type;e.children||C==="folder"||C==="device"||C==="channel"||C==="meta"?f=s?l().createElement(pe.default,{className:t.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):l().createElement(ae.default,{className:t.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):m.common&&m.common.write===!1&&m.type==="state"?f=l().createElement(Rt.default,{className:t.cellIdIconDocument}):f=l().createElement(Wt.default,{className:t.cellIdIconDocument});let S=null;e.data.icon&&(typeof e.data.icon=="string"?e.data.icon.length<3?S=l().createElement("span",{className:w.Z.clsx(t.cellIdIconOwn,"iconOwn")},e.data.icon):S=l().createElement("img",{className:w.Z.clsx(t.cellIdIconOwn,"iconOwn"),src:e.data.icon,alt:""}):S=e.data.icon);const E=m==null?void 0:m.common,O=m&&m.type&&He[m.type]||l().createElement("div",{className:"itemIcon"}),x=this.levelPadding*e.data.level;if(e.data.lang!==this.state.lang){const{rooms:_,per:W}=Ue(this.info,r,this.state.lang);e.data.rooms=_.join(", "),e.data.per=W;const{funcs:z,pef:U}=Je(this.info,r,this.state.lang);e.data.funcs=z.join(", "),e.data.pef=U,e.data.lang=this.state.lang}const J=this.props.multiSelect&&this.objects[r]&&(!this.props.types||this.props.types.includes(this.objects[r].type))?l().createElement(ce.Z,{className:t.checkBox,checked:this.state.selected.includes(r)}):null;let we=!this.props.notEditable&&C==="state"&&(this.state.filter.expertMode||(E==null?void 0:E.write)!==!1);this.props.objectBrowserViewFile&&(E==null?void 0:E.type)==="file"&&(we=!0);const H=!this.props.notEditable&&this.objects[r]&&(this.state.filter.expertMode||C==="state"||C==="channel"||C==="device"),te=this.state.statesView&&(C==="state"||C==="channel"||C==="device");let P="";const G=[];if(te&&(P=(a=this.states[r])==null?void 0:a.from,P===void 0?P="&nbsp;":(P=P?P.replace(/^system\.adapter\.|^system\./,""):"",G.push(`${this.texts.stateChangedFrom} ${P}`)),m.user)){const _=m.user.replace("system.user.","");P+=`/${_}`,G.push(`${this.texts.stateChangedBy} ${_}`)}m&&(m.from&&G.push(`${this.texts.objectChangedFrom} ${m.from.replace(/^system\.adapter\.|^system\./,"")}`),m.user&&G.push(`${this.texts.objectChangedBy} ${m.user.replace(/^system\.user\./,"")}`),m.ts&&G.push(`${this.texts.objectChangedByUser} ${w.Z.formatDate(new Date(m.ts),this.props.dateFormat)}`));const Ye=typeof((o=E==null?void 0:E.alias)==null?void 0:o.id)=="object",Qe=r.startsWith("alias.")&&((h=E==null?void 0:E.alias)==null?void 0:h.id)?Ye?l().createElement("div",{className:t.cellIdAliasReadWriteDiv},E.alias.id.read?l().createElement("div",{onClick:_=>{_.stopPropagation(),_.preventDefault(),this.onSelect(E.alias.id.read),setTimeout(()=>{this.expandAllSelected(()=>this.scrollToItem(E.alias.id.read))},100)},className:w.Z.clsx(t.cellIdAlias,t.cellIdAliasReadWrite)},"\u2190",E.alias.id.read):null,E.alias.id.write?l().createElement("div",{onClick:_=>{_.stopPropagation(),_.preventDefault(),this.onSelect(E.alias.id.write),setTimeout(()=>{this.expandAllSelected(()=>this.scrollToItem(E.alias.id.write))},100)},className:w.Z.clsx(t.cellIdAlias,t.cellIdAliasReadWrite)},"\u2192",E.alias.id.write):null):l().createElement("div",{onClick:_=>{_.stopPropagation(),_.preventDefault(),this.onSelect(E.alias.id),setTimeout(()=>{this.expandAllSelected(()=>this.scrollToItem(E.alias.id))},100)},className:w.Z.clsx(t.cellIdAlias,t.cellIdAliasAlone)},"\u2192",E.alias.id):null;let M=E==null?void 0:E.color,Se;if(M&&!this.state.selected.includes(r)){let _=this.props.themeName==="dark"?"#1f1f1f":this.props.themeName==="blue"?"#222a2e":"#FFFFFF";w.Z.colorDistance(M,_)<1e3&&(Se=this.props.themeType==="dark"?"#9a9a9a":"#565656")}(!M||this.state.selected.includes(r))&&(M="inherit");const B=[];if(E!=null&&E.statusStates){const _={};Object.keys(E.statusStates).forEach(z=>{var U;let A=E.statusStates[z];A.split(".").length<3&&(A=`${r}.${A}`),_[z]=A,this.states[A]?!this.recordStates.includes(A)&&this.recordStates.push(A):((U=this.objects[A])==null?void 0:U.type)==="state"&&(!this.recordStates.includes(A)&&this.recordStates.push(A),this.states[A]={val:null},this.subscribe(A))});let W=!1;E.statusStates.errorId&&this.states[_.errorId]&&this.states[_.errorId].val&&(M=this.props.themeType==="dark"?We:Re,W=!0,B.push(l().createElement(Tt.default,{key:"error",title:this.texts.deviceError,className:this.props.classes.iconDeviceError}))),_.onlineId&&this.states[_.onlineId]&&this.states[_.onlineId].val!==null?W?this.states[_.onlineId].val?B.push(l().createElement(q.default,{key:"conn",title:this.texts.deviceError,className:this.props.classes.iconDeviceConnected})):B.push(l().createElement(oe.default,{key:"disc",title:this.texts.deviceError,className:this.props.classes.iconDeviceDisconnected})):this.states[_.onlineId].val?(M=this.props.themeType==="dark"?ye:_e,B.push(l().createElement(q.default,{key:"conn",title:this.texts.deviceError,className:this.props.classes.iconDeviceConnected}))):(M=this.props.themeType==="dark"?Ee:ve,B.push(l().createElement(oe.default,{key:"disc",title:this.texts.deviceError,className:this.props.classes.iconDeviceDisconnected}))):_.offlineId&&this.states[_.offlineId]&&this.states[_.offlineId].val!==null&&(W?this.states[_.offlineId].val?B.push(l().createElement(oe.default,{key:"disc",title:this.texts.deviceError,className:this.props.classes.iconDeviceDisconnected})):B.push(l().createElement(q.default,{key:"conn",title:this.texts.deviceError,className:this.props.classes.iconDeviceConnected})):this.states[_.offlineId].val?(M=this.props.themeType==="dark"?Ee:ve,B.push(l().createElement(oe.default,{key:"disc",title:this.texts.deviceError,className:this.props.classes.iconDeviceDisconnected}))):(M=this.props.themeType==="dark"?ye:_e,B.push(l().createElement(q.default,{key:"conn",title:this.texts.deviceError,className:this.props.classes.iconDeviceConnected}))))}const qe=te?w.Z.quality2text(((u=this.states[r])==null?void 0:u.q)||0).join(", "):null,is=_=>{var W,z,U,A,et,tt,st,it;if(((z=(W=_==null?void 0:_.obj)==null?void 0:W.common)==null?void 0:z.desc)&&_.obj.common.desc!==""){let F="";if(typeof((A=(U=_==null?void 0:_.obj)==null?void 0:U.common)==null?void 0:A.desc)=="object"&&_.obj.common.desc[this.props.lang]!==void 0)F=_.obj.common.desc[this.props.lang];else if(typeof((tt=(et=_==null?void 0:_.obj)==null?void 0:et.common)==null?void 0:tt.desc)=="object"&&_.obj.common.desc.en!==void 0)F=_.obj.common.desc.en;else{if(typeof((it=(st=_==null?void 0:_.obj)==null?void 0:st.common)==null?void 0:it.desc)=="object"&&_.obj.common.desc[this.props.lang]===void 0)return _.id;F=_.obj.common.desc}return F!=null&&F.startsWith("http")?l().createElement("a",{className:w.Z.clsx(this.props.classes.cellIdTooltipLink),href:F,target:"_blank",rel:"noreferrer"},F):l().createElement("span",{className:w.Z.clsx(this.props.classes.cellIdTooltip)},F)}return _.id};return l().createElement(X.ZP,{container:!0,direction:"row",wrap:"nowrap",className:w.Z.clsx(t.tableRow,this.state.linesEnabled&&t.tableRowLines,!this.props.dragEnabled&&t.tableRowNoDragging,Qe&&t.tableRowAlias,Ye&&t.tableRowAliasReadWrite,!e.data.visible&&t.filteredOut,e.data.hasVisibleParent&&!e.data.visible&&!e.data.hasVisibleChildren&&t.filteredParentOut,this.state.selected.includes(r)&&t.itemSelected,this.state.selectedNonObject===r&&t.itemSelected),key:r,id:r,onClick:()=>this.onSelect(r),onDoubleClick:()=>{e.children?this.toggleExpanded(r):this.onSelect(r,!0)}},l().createElement(X.ZP,{container:!0,wrap:"nowrap",direction:"row",className:t.cellId,style:{width:this.columnsVisibility.id,paddingLeft:x}},l().createElement(X.ZP,{item:!0,container:!0,alignItems:"center",style:{}},J,f),l().createElement(X.ZP,{item:!0,component:()=>l().createElement(I.Z,{title:is(e.data)},l().createElement("div",null,e.data.name)),title:r,className:w.Z.clsx(t.cellIdSpan,Se&&t.invertedBackground),style:{color:r==="system"?Yt:r==="system.adapter"?Qt:M}},e.data.name,Qe,B),l().createElement("div",{className:w.Z.clsx(t.grow,Se&&t.invertedBackgroundFlex)}),l().createElement(X.ZP,{item:!0,container:!0,alignItems:"center"},S),l().createElement("div",null,l().createElement(me.default,{className:w.Z.clsx(t.cellCopyButton,"copyButton"),onClick:_=>this.onCopy(_,r)}))),this.columnsVisibility.name?l().createElement("div",{className:t.cellName,style:{width:this.columnsVisibility.name}},((g=e.data)==null?void 0:g.title)||"",(y=e.data)!=null&&y.title?l().createElement("div",{style:{color:M}},l().createElement(me.default,{className:w.Z.clsx(t.cellCopyButton,"copyButton"),onClick:_=>this.onCopy(_,e.data.title)})):null):null,this.state.statesView?l().createElement(l().Fragment,null,this.columnsVisibility.changedFrom?l().createElement("div",{className:t.cellRole,style:{width:this.columnsVisibility.changedFrom},title:G.join(`
2
- `)},te&&((d=this.states[r])==null?void 0:d.from)?P:null):null,this.columnsVisibility.qualityCode?l().createElement("div",{className:t.cellRole,style:{width:this.columnsVisibility.qualityCode},title:qe||""},qe):null,this.columnsVisibility.timestamp?l().createElement("div",{className:t.cellRole,style:{width:this.columnsVisibility.timestamp}},te&&((p=this.states[r])==null?void 0:p.ts)?w.Z.formatDate(new Date(this.states[r].ts),this.props.dateFormat):null):null,this.columnsVisibility.lastChange?l().createElement("div",{className:t.cellRole,style:{width:this.columnsVisibility.lastChange}},te&&((n=this.states[r])==null?void 0:n.lc)?w.Z.formatDate(new Date(this.states[r].lc),this.props.dateFormat):null):null):l().createElement(l().Fragment,null,this.columnsVisibility.type?l().createElement("div",{className:t.cellType,style:{width:this.columnsVisibility.type}},O,"\xA0",m&&m.type):null,this.columnsVisibility.role?l().createElement("div",{className:t.cellRole,style:{width:this.columnsVisibility.role,cursor:this.state.filter.expertMode&&H&&this.props.objectBrowserEditRole?"text":"default"},onClick:this.state.filter.expertMode&&H&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0},E==null?void 0:E.role):null,this.columnsVisibility.room?l().createElement("div",{className:`${t.cellRoom} ${e.data.per?t.cellEnumParent:""}`,style:{width:this.columnsVisibility.room,cursor:H?"text":"default"},onClick:H?()=>{const _=Ke(this.info,e.data.id,"roomEnums");this.setState({enumDialogEnums:_,enumDialog:{item:e,type:"room",enumsOriginal:JSON.parse(JSON.stringify(_))}})}:void 0},e.data.rooms):null,this.columnsVisibility.func?l().createElement("div",{className:`${t.cellFunc} ${e.data.pef?t.cellEnumParent:""}`,style:{width:this.columnsVisibility.func,cursor:H?"text":"default"},onClick:H?()=>{const _=Ke(this.info,e.data.id,"funcEnums");this.setState({enumDialogEnums:_,enumDialog:{item:e,type:"func",enumsOriginal:JSON.parse(JSON.stringify(_))}})}:void 0},e.data.funcs):null),this.adapterColumns.map(_=>l().createElement("div",{className:t.cellAdapter,style:{width:this.columnsVisibility[_.id]},key:_.id,title:`${_.adapter} => ${_.pathText}`},this.renderCustomValue(m,_,e))),this.columnsVisibility.val?l().createElement("div",{className:t.cellValue,style:{width:this.columnsVisibility.val,cursor:we?(E==null?void 0:E.type)==="file"?"zoom-in":e.data.button?"grab":"text":"default"},onClick:we?()=>{!m||!this.states||((E==null?void 0:E.type)==="file"?this.setState({viewFileDialog:r}):!this.state.filter.expertMode&&e.data.button?this.props.socket.setState(r,!0).catch(_=>window.alert(`Cannot write state "${r}": ${_}`)):(this.edit={val:this.states[r]?this.states[r].val:"",q:this.states[r]&&this.states[r].q||0,ack:!1,id:r},this.setState({updateOpened:!0})))}:void 0},this.renderColumnValue(r,e,t)):null,this.columnsVisibility.buttons?l().createElement("div",{className:t.cellButtons,style:{width:this.columnsVisibility.buttons}},this.renderColumnButtons(r,e,t)):null)}renderItem(e,s,t,i){const a=[];i=i||{count:0};let o=this.renderLeaf(e,s,t,i);const h=this.props.DragWrapper;return this.props.dragEnabled&&(e.data.sumVisibility?o=l().createElement(h,{key:e.data.id,item:e,className:t.draggable},o):o=l().createElement("div",{key:e.data.id,className:t.nonDraggable},o)),e.data.id&&a.push(o),s=s===void 0?ee(this.state.expanded,e.data.id):s,(!e.data.id||s)&&(this.state.foldersFirst?(e.children&&a.push(e.children.map(u=>u.children&&(!this.state.columnsSelectorShow||i.count<15)&&u.data.sumVisibility?this.renderItem(u,void 0,t,i):null)),e.children&&a.push(e.children.map(u=>!u.children&&(!this.state.columnsSelectorShow||i.count<15)&&u.data.sumVisibility?this.renderItem(u,void 0,t,i):null))):e.children&&a.push(e.children.map(u=>(!this.state.columnsSelectorShow||i.count<15)&&u.data.sumVisibility?this.renderItem(u,void 0,t,i):null))),a}calculateColumnsVisibility(e,s,t,i){i=i||this.state.columnsWidths,t=t||this.state.columnsForAdmin,s=s||this.state.columns||[],e=typeof e!="boolean"?this.state.columnsAuto:e,i=JSON.parse(JSON.stringify(i)),Object.keys(i).forEach(o=>{i[o]&&(i[o]=parseInt(i[o],10)||0)}),this.adapterColumns=[];const a=N[this.props.width].widths;if(e){if(this.columnsVisibility={id:N[this.props.width].idWidth,name:this.visibleCols.includes("name")&&a.name||0,nameHeader:this.visibleCols.includes("name")&&a.name||0,type:this.visibleCols.includes("type")&&a.type||0,role:this.visibleCols.includes("role")&&a.role||0,room:this.visibleCols.includes("room")&&a.room||0,func:this.visibleCols.includes("func")&&a.func||0,changedFrom:this.visibleCols.includes("changedFrom")&&a.changedFrom||0,qualityCode:this.visibleCols.includes("qualityCode")&&a.qualityCode||0,timestamp:this.visibleCols.includes("timestamp")&&a.timestamp||0,lastChange:this.visibleCols.includes("lastChange")&&a.lastChange||0,val:this.visibleCols.includes("val")&&a.val||0,buttons:this.visibleCols.includes("buttons")&&a.buttons||0},this.columnsVisibility.name&&!this.customWidth){let o=this.columnsVisibility.id;this.state.statesView?(o+=this.columnsVisibility.changedFrom,o+=this.columnsVisibility.qualityCode,o+=this.columnsVisibility.timestamp,o+=this.columnsVisibility.lastChange):(o+=this.columnsVisibility.type,o+=this.columnsVisibility.role,o+=this.columnsVisibility.room,o+=this.columnsVisibility.func),o+=this.columnsVisibility.val,o+=this.columnsVisibility.buttons,this.columnsVisibility.name=`calc(100% - ${o+5}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${o+5+this.state.scrollBarWidth}px)`}else if(!this.customWidth){let o=0;this.state.statesView?(o+=this.columnsVisibility.changedFrom,o+=this.columnsVisibility.qualityCode,o+=this.columnsVisibility.timestamp,o+=this.columnsVisibility.lastChange):(o+=this.columnsVisibility.type,o+=this.columnsVisibility.role,o+=this.columnsVisibility.room,o+=this.columnsVisibility.func),o+=this.columnsVisibility.val,o+=this.columnsVisibility.buttons,this.columnsVisibility.id=`calc(100% - ${o+5}px)`}}else{this.columnsVisibility={id:i.id||N[this.props.width].idWidth,name:s.includes("name")&&(i.name||a.name||N[this.props.width].widths.name)||0,type:s.includes("type")&&(i.type||a.type||N[this.props.width].widths.type)||0,role:s.includes("role")&&(i.role||a.role||N[this.props.width].widths.role)||0,room:s.includes("room")&&(i.room||a.room||N[this.props.width].widths.room)||0,func:s.includes("func")&&(i.func||a.func||N[this.props.width].widths.func)||0};let o=this.columnsVisibility.id;if(this.columnsVisibility.name&&(o+=this.columnsVisibility.type,o+=this.columnsVisibility.role,o+=this.columnsVisibility.room,o+=this.columnsVisibility.func),t&&s&&Object.keys(t).sort().forEach(h=>t[h].forEach(u=>{const g=`_${h}_${u.path}`;if(this.columnsVisibility[g]=s.includes(g),s.includes(g)){const y={adapter:h,id:`_${h}_${u.path}`,name:u.name,path:u.path.split("."),pathText:u.path};u.edit&&(y.edit=!0,u.type&&(y.type=u.type),u.objTypes&&(y.objTypes=u.objTypes)),this.adapterColumns.push(y),this.columnsVisibility[g]=i[y.id]||u.width||N[this.props.width].widths.func||N.xl.widths.func,o+=this.columnsVisibility[g]}else this.columnsVisibility[g]=0})),this.adapterColumns.sort((h,u)=>h.id>u.id?-1:h.id<u.id?1:0),this.columnsVisibility.val=s.includes("val")?i.val||a.val||N.xl.widths.val:0,(!this.props.columns||this.props.columns.includes("buttons"))&&(this.columnsVisibility.buttons=s.includes("buttons")?i.buttons||a.buttons||N.xl.widths.buttons:0,o+=this.columnsVisibility.buttons),this.columnsVisibility.name&&!i.name)o+=this.columnsVisibility.val,this.columnsVisibility.name=`calc(100% - ${o}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${o+5+this.state.scrollBarWidth}px)`;else{const h=Object.keys(this.columnsVisibility).reduce((u,g)=>g==="id"||typeof this.columnsVisibility[g]=="string"||!this.columnsVisibility[g]?u:u+this.columnsVisibility[g],0);this.columnsVisibility.id=`calc(100% - ${h}px)`}}}renderHeader(){const e=this.props.classes;let s=null;return!this.columnsVisibility.buttons&&!this.isFilterEmpty()&&(s=l().createElement(D.Z,{onClick:()=>this.clearFilter(),className:e.buttonClearFilter,title:this.props.t("ra_Clear filter"),size:"large"},l().createElement(Lt.default,null),l().createElement(L.default,{className:e.buttonClearFilterIcon}))),l().createElement("div",{className:e.headerRow},l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.id,position:"relative"},"data-min":240,"data-name":"id"},this.getFilterInput("id"),l().createElement("div",{className:`${this.props.classes.resizeHandle} ${this.props.classes.resizeHandleRight}`,onMouseDown:this.resizerMouseDown,onDoubleClick:this.resizerReset,title:this.props.t("ra_Double click to reset table layout")})),this.columnsVisibility.name?l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.nameHeader},"data-min":100,"data-name":"nameHeader"},this.getFilterInput("name")):null,!this.state.statesView&&l().createElement(l().Fragment,null,this.columnsVisibility.type?l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.type},"data-min":100,"data-name":"type"},this.getFilterSelectType()):null,this.columnsVisibility.role?l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.role},"data-min":100,"data-name":"role"},this.getFilterSelectRole()):null,this.columnsVisibility.room?l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.room},"data-min":100,"data-name":"room"},this.getFilterSelectRoom()):null,this.columnsVisibility.func?l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.func},"data-min":100,"data-name":"func"},this.getFilterSelectFunction()):null),this.state.statesView&&l().createElement(l().Fragment,null,l().createElement("div",{className:w.Z.clsx(e.headerCell,e.headerCellValue),style:{width:this.columnsVisibility.changedFrom},"data-min":100,"data-name":"changedFrom"},this.props.t("ra_Changed from")),l().createElement("div",{className:w.Z.clsx(e.headerCell,e.headerCellValue),style:{width:this.columnsVisibility.qualityCode},"data-min":100,"data-name":"qualityCode"},this.props.t("ra_Quality code")),l().createElement("div",{className:w.Z.clsx(e.headerCell,e.headerCellValue),style:{width:this.columnsVisibility.timestamp},"data-min":100,"data-name":"timestamp"},this.props.t("ra_Timestamp")),l().createElement("div",{className:w.Z.clsx(e.headerCell,e.headerCellValue),style:{width:this.columnsVisibility.lastChange},"data-min":100,"data-name":"lastChange"},this.props.t("ra_Last change"))),this.adapterColumns.map(t=>l().createElement("div",{className:w.Z.clsx(e.headerCell,e.headerCellValue),style:{width:this.columnsVisibility[t.id]},title:t.adapter,key:t.id,"data-min":100,"data-name":t.id},t.name)),this.columnsVisibility.val?l().createElement("div",{className:w.Z.clsx(e.headerCell,e.headerCellValue),style:{width:this.columnsVisibility.val,position:"relative"},"data-min":120,"data-name":"val"},l().createElement("div",{className:`${this.props.classes.resizeHandle} ${this.props.classes.resizeHandleLeft}`,"data-left":"true",onMouseDown:this.resizerMouseDown,onDoubleClick:this.resizerReset,title:this.props.t("ra_Double click to reset table layout")}),this.props.t("ra_Value"),s):null,this.columnsVisibility.buttons?l().createElement("div",{className:e.headerCell,style:{width:this.columnsVisibility.buttons}}," ",this.getFilterSelectCustoms()):null)}renderToast(){return l().createElement(dt.Z,{open:!!this.state.toast,autoHideDuration:3e3,onClick:()=>this.setState({toast:""}),onClose:()=>this.setState({toast:""}),message:this.state.toast,action:l().createElement(D.Z,{size:"small","aria-label":"close",color:"inherit",onClick:()=>this.setState({toast:""})},l().createElement(L.default,{fontSize:"small"}))})}componentDidUpdate(){if(this.tableRef.current){const e=this.tableRef.current.offsetWidth-this.tableRef.current.clientWidth;this.state.scrollBarWidth!==e?setTimeout(()=>this.setState({scrollBarWidth:e}),100):!this.selectedFound&&(this.state.selected&&this.state.selected[0]||this.lastSelectedItems)&&this.scrollToItem(this.state.selected&&this.state.selected[0]||this.lastSelectedItems)}}scrollToItem(e){const s=window.document.getElementById(e);s&&s.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.selectedFound=!0}renderCustomDialog(){if(this.state.customDialog&&this.props.objectCustomDialog){const e=this.props.objectCustomDialog;return l().createElement(e,{reportChangedIds:s=>this.changedIds=[...s],objectIDs:this.state.customDialog,expertMode:this.state.filter.expertMode,isFloatComma:this.props.isFloatComma,t:this.props.t,lang:this.props.lang,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,objects:this.objects,customsInstances:this.info.customs,onClose:()=>{this.pauseSubscribe(!1),this.setState({customDialog:null}),this.changedIds&&(this.changedIds=null,this.forceUpdate()),this.props.router&&this.props.router.doNavigate("tab-objects")}})}return null}onUpdate(e){this.props.socket.setState(this.edit.id,{val:e.val,ack:e.ack,q:e.q||0,expire:e.expire||void 0}).catch(s=>this.showError(`Cannot write value: ${s}`))}renderEditObjectDialog(){if(!this.state.editObjectDialog||!this.props.objectBrowserEditObject)return null;const e=this.props.objectBrowserEditObject;return l().createElement(e,{key:this.state.editObjectDialog,obj:this.objects[this.state.editObjectDialog],roleArray:this.info.roles,objects:this.objects,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,themeName:this.props.themeName,socket:this.props.socket,dialogName:this.props.dialogName,t:this.props.t,expertMode:this.state.filter.expertMode,onNewObject:s=>this.props.socket.setObject(s._id,s).then(()=>this.setState({editObjectDialog:s._id},()=>this.onSelect(s._id))).catch(t=>this.showError(`Cannot write object: ${t}`)),onClose:s=>{var t,i;if(s){let a;this.state.editObjectDialog.startsWith("alias.")&&JSON.stringify((t=this.objects[this.state.editObjectDialog].common)==null?void 0:t.alias)!==JSON.stringify((i=s.common)==null?void 0:i.alias)&&(a=this.state.editObjectDialog),this.props.socket.setObject(s._id,s).then(()=>{a&&this.subscribes.includes(a)&&(this.unsubscribe(a),setTimeout(()=>this.subscribe(a),100))}).catch(o=>this.showError(`Cannot write object: ${o}`))}this.setState({editObjectDialog:""})}})}renderViewObjectFileDialog(){if(!this.state.viewFileDialog||!this.props.objectBrowserViewFile)return null;const e=this.props.objectBrowserViewFile;return l().createElement(e,{key:"viewFile",obj:this.objects[this.state.viewFileDialog],themeType:this.props.themeType,socket:this.props.socket,dialogName:this.props.dialogName,t:this.props.t,expertMode:this.state.filter.expertMode,onClose:()=>this.setState({viewFileDialog:""})})}renderEditValueDialog(){var e;if(!this.state.updateOpened||!this.props.objectBrowserValue)return null;if(!this.edit.id)return console.error(`Invalid ID for edit: ${JSON.stringify(this.edit)}`),null;if(!this.objects[this.edit.id])return console.error(`Something went wrong. Possibly the object ${this.edit.id} was deleted.`),null;const s=(e=this.objects[this.edit.id].common)!=null&&e.type?this.objects[this.edit.id].common.type:typeof this.edit.val,t=this.props.objectBrowserValue;return l().createElement(t,{t:this.props.t,lang:this.props.lang,type:s,states:w.Z.getStates(this.objects[this.edit.id]),themeType:this.props.themeType,expertMode:this.state.filter.expertMode,value:this.edit.val,socket:this.props.socket,object:this.objects[this.edit.id],defaultHistory:this.defaultHistory,dateFormat:this.props.dateFormat,onClose:i=>{this.setState({updateOpened:!1}),i&&this.onUpdate(i)}})}render(){this.recordStates=[],this.unsubscribeTimer&&clearTimeout(this.unsubscribeTimer);const e=JSON.stringify(this.state.filter);if(this.lastAppliedFilter!==e&&this.objects&&this.root){const i={count:0};Ce(this.root,this.state.filter,this.state.lang,this.objects,null,i,this.props.customFilter,this.props.types),i.count<500&&!this.state.expandAllVisible?setTimeout(()=>this.setState({expandAllVisible:!0})):i.count>=500&&this.state.expandAllVisible&&setTimeout(()=>this.setState({expandAllVisible:!1})),this.lastAppliedFilter=e}if(this.unsubscribeTimer=setTimeout(()=>{this.unsubscribeTimer=null,this.checkUnsubscribes()},200),!this.state.loaded)return l().createElement(at.Z,{key:`${this.props.dialogName}_c`});const s=this.props.classes,t=this.renderItem(this.root,void 0,s);return l().createElement(zt.Z,{key:this.props.dialogName,classes:{}},l().createElement(Kt.Z,null,this.getToolbar()),l().createElement(Ut.Z,{classes:{}},this.renderHeader(),l().createElement("div",{className:this.props.classes.tableDiv,ref:this.tableRef},t)),this.renderToast(),this.renderColumnsEditCustomDialog(),this.renderColumnsSelectorDialog(),this.renderCustomDialog(),this.renderEditValueDialog(),this.renderEditObjectDialog(),this.renderViewObjectFileDialog(),this.renderEditRoleDialog(),this.renderEnumDialog(),this.renderErrorDialog(),this.renderExportDialog(),this.state.modalNewObj&&this.props.modalNewObject&&this.props.modalNewObject(this),this.state.modalEditOfAccess&&this.props.modalEditOfAccessControl&&this.props.modalEditOfAccessControl(this,this.state.modalEditOfAccessObjData))}}R.defaultProps={objectAddBoolean:!1,objectEditBoolean:!1,objectStatesView:!1,objectImportExport:!1,objectEditOfAccessControl:!1,modalNewObject:()=>{},modalEditOfAccessControl:()=>{}},R.propTypes={dialogName:v().string,classes:v().object,defaultFilters:v().object,selected:v().oneOfType([v().string,v().array]),onSelect:v().func,onFilterChanged:v().func,socket:v().object,showExpertButton:v().bool,expertMode:v().bool,imagePrefix:v().string,themeName:v().string,themeType:v().string,theme:v().object,t:v().func,lang:v().string.isRequired,multiSelect:v().bool,notEditable:v().bool,foldersFirst:v().bool,disableColumnSelector:v().bool,isFloatComma:v().bool,dateFormat:v().string,levelPadding:v().number,objectCustomDialog:v().oneOfType([v().object,v().func]),objectAddBoolean:v().bool,objectEditBoolean:v().bool,objectStatesView:v().bool,objectImportExport:v().bool,objectEditOfAccessControl:v().bool,modalNewObject:v().func,modalEditOfAccessControl:v().func,onObjectDelete:v().func,customFilter:v().object,objectBrowserValue:v().object,objectBrowserEditObject:v().object,objectBrowserEditRole:v().object,objectBrowserViewFile:v().func,router:v().oneOfType([v().object,v().func]),types:v().array,columns:v().array,objectsWorker:v().object,filterFunc:v().func,dragSettings:v().object,DragWrapper:v().func,dragEnabled:v().bool,useDrag:v().func};const ss=(0,Zt.default)()((0,Oe.Z)(qt)(R));lt.Z=ss}}]);
3
-
4
- //# sourceMappingURL=6322.6d1b948d.chunk.js.map