iobroker.admin 6.2.16 → 6.2.17

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.
@@ -0,0 +1,309 @@
1
+ "use strict";(self.webpackChunksrc_rx=self.webpackChunksrc_rx||[]).push([[2261],{94437:function(ue,j,o){var S=o(4819),c=o.n(S),V=o(15854),n=o.n(V),Q=o(23167),U=o(86856),W=o(58503),u=o.n(W),T=o(94427),te=o.n(T),P=o(72170),ae=o(62976),se=o(16055),R=o(42158),re=o(33919),f=o(4819),le=Object.defineProperty,oe=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,M=(C,E,v)=>E in C?le(C,E,{enumerable:!0,configurable:!0,writable:!0,value:v}):C[E]=v,J=(C,E)=>{for(var v in E||(E={}))pe.call(E,v)&&M(C,v,E[v]);if(oe)for(var v of oe(E))X.call(E,v)&&M(C,v,E[v]);return C};const Y=`
2
+ /*!
3
+ * Cropper.js v1.5.12
4
+ * https://fengyuanchen.github.io/cropperjs
5
+ *
6
+ * Copyright 2015-present Chen Fengyuan
7
+ * Released under the MIT license
8
+ *
9
+ * Date: 2021-06-12T08:00:11.623Z
10
+ */
11
+
12
+ .cropper-container {
13
+ direction: ltr;
14
+ font-size: 0;
15
+ line-height: 0;
16
+ position: relative;
17
+ -ms-touch-action: none;
18
+ touch-action: none;
19
+ -webkit-user-select: none;
20
+ -moz-user-select: none;
21
+ -ms-user-select: none;
22
+ user-select: none;
23
+ }
24
+
25
+ .cropper-container img {
26
+ display: block;
27
+ height: 100%;
28
+ image-orientation: 0deg;
29
+ max-height: none !important;
30
+ max-width: none !important;
31
+ min-height: 0 !important;
32
+ min-width: 0 !important;
33
+ width: 100%;
34
+ }
35
+
36
+ .cropper-wrap-box,
37
+ .cropper-canvas,
38
+ .cropper-drag-box,
39
+ .cropper-crop-box,
40
+ .cropper-modal {
41
+ bottom: 0;
42
+ left: 0;
43
+ position: absolute;
44
+ right: 0;
45
+ top: 0;
46
+ }
47
+
48
+ .cropper-wrap-box,
49
+ .cropper-canvas {
50
+ overflow: hidden;
51
+ }
52
+
53
+ .cropper-drag-box {
54
+ background-color: #fff;
55
+ opacity: 0;
56
+ }
57
+
58
+ .cropper-modal {
59
+ background-color: #000;
60
+ opacity: 0.5;
61
+ }
62
+
63
+ .cropper-view-box {
64
+ display: block;
65
+ height: 100%;
66
+ outline: 1px solid #39f;
67
+ outline-color: rgba(51, 153, 255, 0.75);
68
+ overflow: hidden;
69
+ width: 100%;
70
+ }
71
+
72
+ .cropper-dashed {
73
+ border: 0 dashed #eee;
74
+ display: block;
75
+ opacity: 0.5;
76
+ position: absolute;
77
+ }
78
+
79
+ .cropper-dashed.dashed-h {
80
+ border-bottom-width: 1px;
81
+ border-top-width: 1px;
82
+ height: calc(100% / 3);
83
+ left: 0;
84
+ top: calc(100% / 3);
85
+ width: 100%;
86
+ }
87
+
88
+ .cropper-dashed.dashed-v {
89
+ border-left-width: 1px;
90
+ border-right-width: 1px;
91
+ height: 100%;
92
+ left: calc(100% / 3);
93
+ top: 0;
94
+ width: calc(100% / 3);
95
+ }
96
+
97
+ .cropper-center {
98
+ display: block;
99
+ height: 0;
100
+ left: 50%;
101
+ opacity: 0.75;
102
+ position: absolute;
103
+ top: 50%;
104
+ width: 0;
105
+ }
106
+
107
+ .cropper-center::before,
108
+ .cropper-center::after {
109
+ background-color: #eee;
110
+ content: ' ';
111
+ display: block;
112
+ position: absolute;
113
+ }
114
+
115
+ .cropper-center::before {
116
+ height: 1px;
117
+ left: -3px;
118
+ top: 0;
119
+ width: 7px;
120
+ }
121
+
122
+ .cropper-center::after {
123
+ height: 7px;
124
+ left: 0;
125
+ top: -3px;
126
+ width: 1px;
127
+ }
128
+
129
+ .cropper-face,
130
+ .cropper-line,
131
+ .cropper-point {
132
+ display: block;
133
+ height: 100%;
134
+ opacity: 0.1;
135
+ position: absolute;
136
+ width: 100%;
137
+ }
138
+
139
+ .cropper-face {
140
+ background-color: #fff;
141
+ left: 0;
142
+ top: 0;
143
+ }
144
+
145
+ .cropper-line {
146
+ background-color: #39f;
147
+ }
148
+
149
+ .cropper-line.line-e {
150
+ cursor: ew-resize;
151
+ right: -3px;
152
+ top: 0;
153
+ width: 5px;
154
+ }
155
+
156
+ .cropper-line.line-n {
157
+ cursor: ns-resize;
158
+ height: 5px;
159
+ left: 0;
160
+ top: -3px;
161
+ }
162
+
163
+ .cropper-line.line-w {
164
+ cursor: ew-resize;
165
+ left: -3px;
166
+ top: 0;
167
+ width: 5px;
168
+ }
169
+
170
+ .cropper-line.line-s {
171
+ bottom: -3px;
172
+ cursor: ns-resize;
173
+ height: 5px;
174
+ left: 0;
175
+ }
176
+
177
+ .cropper-point {
178
+ background-color: #39f;
179
+ height: 5px;
180
+ opacity: 0.75;
181
+ width: 5px;
182
+ }
183
+
184
+ .cropper-point.point-e {
185
+ cursor: ew-resize;
186
+ margin-top: -3px;
187
+ right: -3px;
188
+ top: 50%;
189
+ }
190
+
191
+ .cropper-point.point-n {
192
+ cursor: ns-resize;
193
+ left: 50%;
194
+ margin-left: -3px;
195
+ top: -3px;
196
+ }
197
+
198
+ .cropper-point.point-w {
199
+ cursor: ew-resize;
200
+ left: -3px;
201
+ margin-top: -3px;
202
+ top: 50%;
203
+ }
204
+
205
+ .cropper-point.point-s {
206
+ bottom: -3px;
207
+ cursor: s-resize;
208
+ left: 50%;
209
+ margin-left: -3px;
210
+ }
211
+
212
+ .cropper-point.point-ne {
213
+ cursor: nesw-resize;
214
+ right: -3px;
215
+ top: -3px;
216
+ }
217
+
218
+ .cropper-point.point-nw {
219
+ cursor: nwse-resize;
220
+ left: -3px;
221
+ top: -3px;
222
+ }
223
+
224
+ .cropper-point.point-sw {
225
+ bottom: -3px;
226
+ cursor: nesw-resize;
227
+ left: -3px;
228
+ }
229
+
230
+ .cropper-point.point-se {
231
+ bottom: -3px;
232
+ cursor: nwse-resize;
233
+ height: 20px;
234
+ opacity: 1;
235
+ right: -3px;
236
+ width: 20px;
237
+ }
238
+
239
+ @media (min-width: 768px) {
240
+ .cropper-point.point-se {
241
+ height: 15px;
242
+ width: 15px;
243
+ }
244
+ }
245
+
246
+ @media (min-width: 992px) {
247
+ .cropper-point.point-se {
248
+ height: 10px;
249
+ width: 10px;
250
+ }
251
+ }
252
+
253
+ @media (min-width: 1200px) {
254
+ .cropper-point.point-se {
255
+ height: 5px;
256
+ opacity: 0.75;
257
+ width: 5px;
258
+ }
259
+ }
260
+
261
+ .cropper-point.point-se::before {
262
+ background-color: #39f;
263
+ bottom: -50%;
264
+ content: ' ';
265
+ display: block;
266
+ height: 200%;
267
+ opacity: 0;
268
+ position: absolute;
269
+ right: -50%;
270
+ width: 200%;
271
+ }
272
+
273
+ .cropper-invisible {
274
+ opacity: 0;
275
+ }
276
+
277
+ .cropper-bg {
278
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
279
+ }
280
+
281
+ .cropper-hide {
282
+ display: block;
283
+ height: 0;
284
+ position: absolute;
285
+ width: 0;
286
+ }
287
+
288
+ .cropper-hidden {
289
+ display: none !important;
290
+ }
291
+
292
+ .cropper-move {
293
+ cursor: move;
294
+ }
295
+
296
+ .cropper-crop {
297
+ cursor: crosshair;
298
+ }
299
+
300
+ .cropper-disabled .cropper-drag-box,
301
+ .cropper-disabled .cropper-face,
302
+ .cropper-disabled .cropper-line,
303
+ .cropper-disabled .cropper-point {
304
+ cursor: not-allowed;
305
+ }
306
+ `,ie=C=>({dropZone:{width:"100%",height:100,position:"relative"},dropZoneEmpty:{},image:{objectFit:"contain",margin:"auto",display:"flex",width:"100%",height:"100%"},uploadDiv:{position:"relative",width:"100%",height:300,opacity:.9,marginTop:30,cursor:"pointer",outline:"none"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"calc(100% - 10px)",height:"calc(100% - 10px)",position:"relative",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},disabledOpacity:{opacity:.3,cursor:"default"},buttonRemoveWrapper:{position:"absolute",zIndex:222,right:0},buttonCropWrapper:{position:"absolute",zIndex:222,right:0,top:50},error:{border:"2px solid red"}});class F extends S.Component{constructor(E){if(super(E),this.state={uploadFile:!1,anchorEl:null,cropHandler:!1},this.cropperRef=(0,S.createRef)(),!window.document.getElementById("cropper-style-json-component")){const v=window.document.createElement("style");v.setAttribute("id","cropper-style-json-component"),v.innerHTML=Y,window.document.head.appendChild(v)}}onDrop(E){const{maxSize:v,t:y,onChange:I}=this.props,N=E[0],O=new FileReader;O.onabort=()=>console.log("file reading was aborted"),O.onerror=()=>console.log("file reading has failed"),O.onload=()=>{let m="image/"+N.name.split(".").pop().toLowerCase();if(m==="image/jpg"?m="image/jpeg":m.includes("svg")&&(m="image/svg+xml"),N.size>v)return window.alert(y("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(v/1024)));const Z=`data:${m};base64,${btoa(new Uint8Array(O.result).reduce((H,_)=>H+String.fromCharCode(_),""))}`;I(Z)},O.readAsArrayBuffer(N)}render(){const{disabled:E,maxSize:v,classes:y,icon:I,t:N,removeIconFunc:O,accept:m,error:Z,crop:H,onChange:_}=this.props,{uploadFile:q,anchorEl:$,cropHandler:B}=this.state;return f.createElement(Q.default,{disabled:E||B,key:"dropzone",multiple:!1,accept:m,maxSize:v,onDragEnter:()=>this.setState({uploadFile:"dragging"}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(G,D)=>{if(this.setState({uploadFile:!1}),!G.length)window.alert(D&&D[0]&&D[0].errors&&D[0].errors[0]&&D[0].errors[0].message||N("ra_Cannot upload"));else return this.onDrop(G)}},({getRootProps:G,getInputProps:D})=>f.createElement("div",J({className:re.default.clsx(y.uploadDiv,q==="dragging"&&y.uploadDivDragging,y.dropZone,E&&y.disabledOpacity,!I&&y.dropZoneEmpty)},G()),f.createElement("input",J({},D())),f.createElement("div",{className:re.default.clsx(y.uploadCenterDiv,Z&&y.error)},I?O&&!B&&f.createElement("div",{className:y.buttonRemoveWrapper},f.createElement(T.Tooltip,{title:N("ra_Clear")},f.createElement(P.Z,{size:"large",onClick:L=>{O&&O(),L.stopPropagation()}},f.createElement(ae.default,null)))):f.createElement("div",{className:y.uploadCenterTextAndIcon},f.createElement(R.FaFileUpload,{className:y.uploadCenterIcon}),f.createElement("div",{className:y.uploadCenterText},N(q==="dragging"?"ra_Drop file here":"ra_Place your files here or click here to open the browse dialog"))),I&&H&&f.createElement("div",{className:y.buttonCropWrapper},f.createElement(T.Tooltip,{title:N("ra_Crop")},f.createElement(P.Z,{size:"large",onClick:L=>{B?this.setState({anchorEl:L.currentTarget}):this.setState({cropHandler:!0}),L.stopPropagation()}},f.createElement(se.default,{color:B?"primary":"inherit"}))),f.createElement(T.Menu,{anchorEl:$,keepMounted:!0,open:Boolean($),onClose:()=>this.setState({anchorEl:null})},f.createElement(T.MenuItem,{onClick:()=>this.setState({anchorEl:null,cropHandler:!1},()=>{var L,ne;const ce=(ne=(L=this.cropperRef)==null?void 0:L.current)==null?void 0:ne.cropper;_(ce.getCroppedCanvas().toDataURL())})},N("ra_Save")),f.createElement(T.MenuItem,{onClick:()=>this.setState({anchorEl:null,cropHandler:!1})},N("ra_Close")))),I&&!B?f.createElement("img",{src:I,className:y.image,alt:"icon"}):null,I&&H&&B?f.createElement(U.Cropper,{ref:this.cropperRef,className:y.image,src:I,initialAspectRatio:1,viewMode:1,guides:!1,minCropBoxHeight:10,minCropBoxWidth:10,background:!1,checkOrientation:!1}):null)))}}F.defaultProps={disabled:!1,maxSize:10*1024,icon:null,removeIconFunc:null,accept:{"image/*":[]},error:!1,onChange:C=>console.log(C),t:C=>C,crop:!1},F.propTypes={classes:n().object,maxSize:n().number,disabled:n().bool,crop:n().bool,error:n().bool,onChange:n().func,accept:n().object,t:n().func},j.Z=(0,W.withStyles)(ie)(F)},72261:function(ue,j,o){o.r(j),o.d(j,{default:function(){return Pe}});var S=o(4819),c=o.n(S),V=o(15854),n=o.n(V),Q=o(23261),U=o.n(Q),W=o(58503),u=o(94427),T=o(17773),te=o(26021),P=o(62976),ae=o(9956),se=o(33919),R=o(84998),re=o(23962),f=o.n(re),le=o(40314),oe=o(91495),pe=o(83358),X=o(11456),M=o(71429),J=o(94466),Y=o(78565),ie=o(66447),F=o(19974),C=o(6774),E=o(29480),v=o(72170),y=o(99296);const I=p=>({rootGrid:{flexGrow:1},closeButton:{position:"absolute",right:p.spacing(1),top:p.spacing(1),color:p.palette.grey[500]},paper:{},typography:{paddingRight:30},img:{width:"100%",height:"100%",objectFit:"contain"}});class N extends S.Component{constructor(e){super(e),this.cameraUpdateTimer=null,this.cameraRef=(0,S.createRef)()}componentDidMount(){this.props.camera&&this.props.camera!=="text"&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=null}updateCamera(){if(this.cameraRef.current)if(this.props.camera==="custom"){let e=this.props.children;this.props.addTs&&(e.includes("?")?e+="&ts="+Date.now():e+="?ts="+Date.now()),this.cameraRef.current.src=e}else{const e=this.props.camera.split("."),a=e.shift(),t=e.shift();this.props.socket.sendTo(a+"."+t,"image",{name:e.pop(),width:this.cameraRef.current.width}).then(s=>{s&&s.data&&this.cameraRef.current&&(this.cameraRef.current.src="data:image/jpeg;base64,"+s.data)})}}render(){const{classes:e}=this.props;return c().createElement(ie.Z,{onClose:()=>this.props.onClose(),open:!0,maxWidth:"xl",fullWidth:!0,fullScreen:!0,classes:{paper:e.paper}},c().createElement(E.Z,null,c().createElement(y.Z,{component:"h2",variant:"h6",classes:{root:e.typography}},this.props.name,c().createElement(v.Z,{size:"large",className:e.closeButton,onClick:()=>this.props.onClose()},c().createElement(P.default,null)))),c().createElement(C.Z,{dividers:!0},c().createElement("img",{className:this.props.classes.img,src:"",alt:"camera",ref:this.cameraRef})),c().createElement(F.Z,null,c().createElement(Y.Z,{variant:"contained",autoFocus:!0,onClick:a=>{a.stopPropagation(),this.props.onClose()},color:"primary",startIcon:c().createElement(P.default,null)},this.props.t("Close"))))}}N.propTypes={t:n().func.isRequired,camera:n().string,socket:n().object,interval:n().string,onClose:n().func.isRequired};var O=(0,W.withStyles)(I)(N),m=o(4819);const Z="0 2px 2px 0 rgba(0, 0, 0, .14),0 3px 1px -2px rgba(0, 0, 0, .12),0 1px 5px 0 rgba(0, 0, 0, .2)",H="0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)",_=p=>({root:{padding:".75rem",[p.breakpoints.up("xl")]:{flex:"0 1 20%"}},card:{display:"flex",minHeight:"235px",position:"relative",overflow:"hidden",maxHeight:"235p","&:hover":{overflowY:"auto",boxShadow:H}},cardInfo:{display:"flex",minHeight:"235px",position:"relative",overflow:"initial",maxHeight:"235p",flexDirection:"column","&:hover":{boxShadow:H}},cardInfoHead:{position:"sticky",top:0,background:p.palette.background.default,display:"flex",width:"100%",justifyContent:"space-between",borderBottom:"1px solid",padding:"5px 5px 0px 5px"},edit:{opacity:".6",userSelect:"none",pointerEvents:"none"},media:{backgroundColor:"#e2e2e2",maxWidth:"30%"},img:{width:"120px",height:"auto",padding:"2rem .5rem",maxWidth:"100%"},contentContainer:{display:"flex",flexDirection:"column",flex:1},content:{height:"170px",flexGrow:1,overflowY:"hidden"},action:{minHeight:"49px",padding:"16px 24px"},expand:{position:"absolute",right:"10px",bottom:"10px"},collapse:{minHeight:"100%",backgroundColor:"#ffffff",position:"absolute",width:"100%"},close:{right:"10px"},save:{right:"50px"},enabled:{color:"#ffffff",backgroundColor:X.default[500],position:"absolute",top:p.spacing(1),right:p.spacing(1),boxShadow:Z,"&:hover":{backgroundColor:X.default[300]},"&:focus":{backgroundColor:X.default[500]}},disabled:{color:"#ffffff",backgroundColor:M.Z[500],position:"absolute",top:p.spacing(1),right:p.spacing(1),boxShadow:Z,"&:hover":{backgroundColor:M.Z[300]},"&:focus":{backgroundColor:M.Z[500]}},editButton:{color:"#ffffff",backgroundColor:M.Z[500],position:"absolute",top:parseInt(p.spacing(2),10)+48,right:p.spacing(1),boxShadow:Z,"&:hover":{backgroundColor:M.Z[300]},"&:focus":{backgroundColor:M.Z[500]}},deleteButton:{color:"#ffffff",backgroundColor:J.Z[500],position:"absolute",top:parseInt(p.spacing(3),10)+48+48,right:p.spacing(1),boxShadow:Z,"&:hover":{backgroundColor:J.Z[300]},"&:focus":{backgroundColor:J.Z[500]}},cameraImg:{width:"100%",height:"100%",maxWidth:200,maxHeight:200,objectFit:"contain"},imgContainer:{height:"100%"},hidden:{display:"none"},contentGrid:{height:"100%"},imgSkeleton:{transform:"initial"},colorOrange:{color:"#ffcc80"}});class q extends S.Component{constructor(e){super(e),this.state={error:!1,expanded:!1,dialog:!1,loaded:!1},this.cameraRef=(0,S.createRef)(),this.cameraUpdateTimer=null,this.interval=this.props.interval,this.camera=this.props.camera,this.t=e.t}updateCamera(){if(this.cameraRef.current)if(this.props.camera==="custom"){let e=this.props.children;this.props.addTs&&(e.includes("?")?e+="&ts="+Date.now():e+="?ts="+Date.now()),this.cameraRef.current.src=e}else{const e=this.props.camera.split("."),a=e.shift(),t=e.shift();this.props.socket.sendTo(a+"."+t,"image",{name:e.pop(),width:this.cameraRef.current.width}).then(s=>{s&&s.data&&this.cameraRef.current&&(this.cameraRef.current.src="data:image/jpeg;base64,"+s.data)}).catch(s=>window.alert("Cannot send to instance: "+s))}}componentDidMount(){this.props.camera&&this.props.camera!=="text"&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=null}renderCameraDialog(){return this.state.dialog?m.createElement(O,{socket:this.props.socket,camera:this.props.camera,name:this.props.title,t:this.props.t,onClose:()=>{this.props.camera&&this.props.camera!=="text"&&(this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera()),this.setState({dialog:!1})}},this.props.children):null}static getDerivedStateFromProps(e){return e.edit?{expanded:!1}:null}handleExpandClick(){this.setState({expanded:!this.state.expanded})}handleImageLoad(){this.state.loaded||this.setState({loaded:!0,error:!1})}handleImageError(){this.state.error||this.setState({loaded:!1,error:!0})}renderContent(){const{classes:e}=this.props;if(!this.props.camera||this.props.camera==="text")return this.props.children;if(this.props.camera==="custom"){let a=this.props.children;return this.props.addTs&&(a.includes("?")?a+="&ts="+Date.now():a+="?ts="+Date.now()),m.createElement(u.Grid,{item:!0,container:!0,className:e.imgContainer,justifyContent:"center",alignItems:"center"},m.createElement("img",{ref:this.cameraRef,src:a,alt:"Camera",className:this.state.loaded&&!this.state.error?e.cameraImg:e.hidden,onLoad:()=>this.handleImageLoad(),onError:()=>this.handleImageError()}),!this.state.loaded&&!this.state.error&&m.createElement(u.Skeleton,{height:"100%",width:"100%",animation:"wave",className:e.imgSkeleton}),this.state.error&&m.createElement(le.default,{fontSize:"large"}))}else if(this.props.camera.startsWith("cameras."))return m.createElement("img",{ref:this.cameraRef,src:"",alt:"camera",className:this.props.classes.cameraImg})}render(){const{classes:e}=this.props,a=this.props.edit?" "+e.edit:"";this.props.camera&&this.props.camera!=="text"?this.interval!==this.props.interval&&(this.interval=this.props.interval,this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500))):this.cameraUpdateTimer&&(clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=null);let t=this.props.action.text||this.props.t("Link");return typeof t=="object"&&(t=t[this.props.lang]||t.en),m.createElement(u.Grid,{item:!0,xs:12,sm:6,md:4,lg:3,className:e.root},m.createElement(u.Link,{href:!this.props.edit&&this.props.action&&this.props.action.link?this.props.action.link:null,underline:"none",target:"_blank",rel:"noopener noreferrer"},m.createElement(u.Card,{className:e.card,onClick:s=>{s.stopPropagation(),!this.props.edit&&this.props.camera&&this.props.camera!=="text"&&(this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=null,this.setState({dialog:!0}))}},this.props.reveal&&!this.props.offline&&m.createElement(u.Button,{className:e.expand+a,variant:"contained",size:"small",disabled:this.props.disabled,onClick:()=>this.handleExpandClick(),color:"primary"},this.props.t("Info")),m.createElement("div",{className:e.media+a,style:{backgroundColor:this.props.color}},m.createElement(u.CardMedia,{className:e.img,component:"img",image:this.props.image})),m.createElement("div",{className:e.contentContainer+a},m.createElement(u.CardContent,{className:e.content},m.createElement(u.Grid,{container:!0,direction:"column",wrap:"nowrap",className:e.contentGrid},m.createElement(u.Typography,{gutterBottom:!0,variant:"h5",component:"h5"},this.props.title),this.renderContent())),this.props.action&&this.props.action.link&&m.createElement(u.Divider,null),this.props.action&&this.props.action.link&&m.createElement(u.CardActions,{className:e.action},m.createElement("div",{className:e.colorOrange},t))),this.props.reveal&&m.createElement(u.Collapse,{className:e.collapse,in:this.state.expanded,timeout:"auto",unmountOnExit:!0},m.createElement(u.Card,{className:e.cardInfo},m.createElement("div",{className:e.cardInfoHead},m.createElement(u.Typography,{gutterBottom:!0,variant:"h5",component:"h5"},this.props.t("Info")),m.createElement("div",null,m.createElement(u.IconButton,{size:"small",onClick:()=>{f()(this.props.getHostDescriptionAll()[1],{format:"text/plain"}),this.props.openSnackBarFunc()}},m.createElement(pe.default,null)),m.createElement(u.IconButton,{size:"small",onClick:()=>this.handleExpandClick()},m.createElement(P.default,null)))),m.createElement(u.CardContent,null,this.props.getHostDescriptionAll()[0]))),this.props.edit&&this.props.toggleActivation&&m.createElement(u.IconButton,{size:"large",className:this.props.enabled?e.enabled:e.disabled,onClick:()=>this.props.toggleActivation()},m.createElement(te.default,null)),this.props.edit&&this.props.onEdit&&m.createElement(u.IconButton,{size:"large",className:e.editButton,onClick:()=>this.props.onEdit()},m.createElement(ae.Z,null)),this.props.edit&&this.props.onRemove&&m.createElement(u.IconButton,{size:"large",className:e.deleteButton,onClick:()=>this.props.onRemove()},m.createElement(oe.default,null)),this.renderCameraDialog())))}}q.propTypes={camera:n().string,addTs:n().bool,interval:n().number,ready:n().bool,instances:n().object,updateIntro:n().string,openLinksInNewWindow:n().bool,onEdit:n().func,socket:n().object,offline:n().bool,t:n().func,lang:n().string};var $=(0,W.withStyles)(_)(q),B=o(17688),G=o(89316),D=o(18635),L=o(75836),ne=o(2598),ce=o(36315),Ee=o(22155),ye=o(66116),de=o(41381),xe=o(71386),Ce=o(67304),ke=o(94437);const be=p=>({formControl:{marginTop:p.spacing(4)},rootGrid:{flexGrow:1},closeButton:{position:"absolute",right:p.spacing(1),top:p.spacing(1),color:p.palette.grey[500]},paper:{},typography:{paddingRight:30},editItem:{marginTop:p.spacing(1)},editItemSlider:{marginTop:p.spacing(3)},labelSlider:{marginTop:p.spacing(2),fontSize:"1rem"},editColor:{width:"100%"},dropZone:{width:"100%",height:100,position:"relative"},dropZoneEmpty:{},image:{height:"100%",width:"auto",objectFir:"contain"},uploadDiv:{position:"relative",width:"100%",height:100,opacity:.9},uploadDivDragging:{opacity:1},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"calc(100% - 10px)",height:"calc(100% - 10px)",position:"relative"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0}});class ge extends S.Component{constructor(e){super(e);let a=Object.assign({image:"",name:e.t("New link"),link:"http://",linkName:"",color:"",desc:"",enabled:!0,addTs:!0,interval:5e3,camera:"text",cameraList:[]},e.link);this.state=a}componentDidMount(){this.getCamerasInstances()}getCamerasInstances(){this.props.socket.getAdapterInstances("cameras",!0).then(e=>{const a=[],t=[];e.forEach(s=>{const i=s._id.replace("system.adapter.","");s.common&&s.common.enabled&&t.push(this.props.socket.getState(s._id+".alive").then(h=>h&&h.val&&this.props.socket.sendTo(i,"list",null)).then(h=>h&&h.list&&h.list.forEach(g=>a.push({id:g.id,name:`${g.desc} [${i}/${g.name}]`}))))}),Promise.all(t).then(()=>this.setState({cameraList:a}))})}getLinkNameFromLink(e){const a=e.trim().match(/^https?:\/\/([^/:]+)(:\d+)?/);if(a)return a[1]+(a[2]||"")}render(){const{classes:e}=this.props;return c().createElement(ie.Z,{onClose:()=>this.props.onClose(),open:this.props.open,maxWidth:"md",fullWidth:!0,classes:{paper:e.paper}},c().createElement(E.Z,null,c().createElement(y.Z,{component:"h2",variant:"h6",classes:{root:e.typography}},this.props.isNew?this.props.t("Add new link: "):this.props.t("Edit link"),c().createElement(v.Z,{size:"large",className:e.closeButton,onClick:()=>this.props.onClose()},c().createElement(P.default,null)))),c().createElement(C.Z,{dividers:!0},c().createElement(L.ZP,{className:this.props.classes.rootGrid,container:!0,direction:"row"},c().createElement(L.ZP,{item:!0,xs:12,sm:6,md:8,lg:9},c().createElement(L.ZP,{container:!0,direction:"column"},c().createElement(xe.Z,{variant:"standard",className:e.formControl},c().createElement(ye.Z,{id:"select-helper-label"},this.props.t("Link type")),c().createElement(Ce.Z,{variant:"standard",labelId:"select-helper-label",value:this.state.camera,onChange:a=>this.setState({camera:a.target.value})},c().createElement(de.Z,{value:"text",key:"desc"},c().createElement("em",null,this.props.t("Description"))),this.state.cameraList.map(a=>c().createElement(de.Z,{key:a.id,value:a.id},a.name)),c().createElement(de.Z,{value:"custom",key:"custom"},this.props.t("Custom camera URL")))),c().createElement(D.Z,{variant:"standard",label:this.props.t("URL"),value:this.state.link,className:this.props.classes.editItem,onChange:a=>{const t=this.getLinkNameFromLink(this.state.link);t&&(!this.state.linkName||t===this.state.linkName)?this.setState({link:a.target.value,linkName:this.getLinkNameFromLink(a.target.value)}):this.setState({link:a.target.value})}}),c().createElement(D.Z,{variant:"standard",className:this.props.classes.editItem,label:this.props.t("Name"),value:this.state.name||"",onChange:a=>this.setState({name:a.target.value})}),this.state.link?c().createElement(D.Z,{variant:"standard",className:this.props.classes.editItem,label:this.props.t("Link name"),value:this.state.linkName||"",onChange:a=>this.setState({linkName:a.target.value})}):null,this.state.camera==="custom"||this.state.camera==="text"?c().createElement(D.Z,{variant:"standard",className:this.props.classes.editItem,label:this.state.camera==="custom"?this.props.t("Camera URL"):this.props.t("Description"),value:this.state.desc||"",onChange:a=>this.setState({desc:a.target.value})}):null,this.state.camera==="custom"?c().createElement(ne.Z,{className:this.props.classes.editItem,control:c().createElement(ce.Z,{checked:this.state.addTs,onChange:a=>this.setState({addTs:a.target.checked})}),label:this.props.t("Add timestamp to URL")}):null,this.state.camera!=="text"?c().createElement(y.Z,{className:this.props.classes.labelSlider,gutterBottom:!0},"Polling interval in ms"):null,this.state.camera!=="text"?c().createElement(Ee.ZP,{className:this.props.classes.editItemSlider,value:this.state.interval,getAriaValueText:()=>this.state.interval+"ms",onChange:(a,t)=>this.setState({interval:t}),step:100,min:500,max:6e4,valueLabelDisplay:"on"}):null,c().createElement("div",{style:{width:50},className:this.props.classes.editItem},c().createElement(D.Z,{variant:"standard",fullWidth:!0,label:this.props.t("Color"),className:this.props.editColor,type:"color",value:this.state.color,onChange:a=>this.setState({color:a.target.value})})),c().createElement(ke.Z,{disabled:!1,crop:!0,maxSize:256*1024,icon:this.state.image,removeIconFunc:()=>this.setState({image:""}),onChange:a=>this.setState({image:a}),t:this.props.t}))),c().createElement($,{interval:this.state.interval,camera:this.state.camera,addTs:this.state.addTs,image:this.state.image,title:this.state.name,socket:this.props.socket,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,color:this.state.color,enabled:!0},this.state.desc||""))),c().createElement(F.Z,null,c().createElement(Y.Z,{variant:"contained",autoFocus:!0,onClick:()=>{this.props.onClose({link:this.state.link,name:this.state.name,desc:this.state.desc,linkName:this.state.linkName,color:this.state.color,image:this.state.image,addTs:this.state.addTs,camera:this.state.camera,interval:this.state.interval})},color:"primary",startIcon:this.props.isNew?c().createElement(T.default,null):c().createElement(te.default,null)},this.props.isNew?this.props.t("Add"):this.props.t("Save")),c().createElement(Y.Z,{variant:"contained",onClick:()=>this.props.onClose(),color:"grey",startIcon:c().createElement(P.default,null)},this.props.t("Close"))))}}ge.propTypes={t:n().func.isRequired,socket:n().object.isRequired,lang:n().string.isRequired,open:n().bool.isRequired,link:n().object.isRequired,onClose:n().func.isRequired,isNew:n().bool};var Ne=(0,W.withStyles)(be)(ge),l=o(4819),Se=Object.defineProperty,De=Object.defineProperties,we=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,he=(p,e,a)=>e in p?Se(p,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):p[e]=a,Le=(p,e)=>{for(var a in e||(e={}))Ie.call(e,a)&&he(p,a,e[a]);if(fe)for(var a of fe(e))Oe.call(e,a)&&he(p,a,e[a]);return p},Ae=(p,e)=>De(p,we(e)),me=(p,e,a)=>(he(p,typeof e!="symbol"?e+"":e,a),a);const Te=p=>({root:{width:"100%",height:"100%"},button:{position:"absolute",bottom:p.spacing(2),right:p.spacing(2)},saveButton:{backgroundColor:p.palette.success.main,right:p.spacing(10),"&:hover":{backgroundColor:p.palette.success.dark}},addButton:{backgroundColor:p.palette.secondary.main,right:p.spacing(18),"&:hover":{backgroundColor:p.palette.secondary.dark}},closeButton:{backgroundColor:p.palette.error.main,"&:hover":{backgroundColor:p.palette.error.dark}},bold:{fontWeight:"bold"},container:{overflowY:"auto"},hostOffline:{color:"#bb0000"},updateExists:{color:"#c28700",marginRight:4},updateNo:{color:"#00b204",marginRight:4},nodeUpdate:{opacity:.6},instanceNumber:{opacity:.7,fontSize:16}}),ee={Uptime:R.Z.formatSeconds,"System uptime":R.Z.formatSeconds,RAM:R.Z.formatRam,Speed:R.Z.formatSpeed,"Disk size":R.Z.formatBytes,"Disk free":R.Z.formatBytes};class ve extends S.Component{constructor(e){super(e),me(this,"updateHostsAlive",a=>{let t=JSON.parse(JSON.stringify(this.state.alive)),s=[];if(a.find(i=>i.type==="delete"))return this.getDataDelayed();if(a.forEach(i=>{!!t[i.id]!=!!i.alive&&(t[i.id]=i.alive,s.push(i.id))}),s.length){const i=JSON.parse(JSON.stringify(this.state.hostsData));Promise.all(s.map(h=>this.getHostData(h,t[h]))).then(h=>{h.forEach(g=>i[g.id]=g.data),this.setState({alive:t,hostsData:i})})}}),me(this,"updateHosts",(a,t)=>{Array.isArray(a)||(a=[{id:a,obj:t,type:t?"changed":"delete"}]);let s=[];if(a.find(i=>!i.obj))return this.getDataDelayed();if(s=a.map(i=>i.id),s.length){const i=JSON.parse(JSON.stringify(this.state.hostsData));Promise.all(s.map(h=>this.getHostData(h))).then(h=>{h.forEach(g=>i[g.id]=g.data),this.setState({hostsData:i})})}}),me(this,"getDataDelayed",()=>{this.getDataTimeout&&clearTimeout(this.getDataTimeout),this.getDataTimeout=setTimeout(()=>{this.getDataTimeout=null,this.getData(!0)},300)}),this.state={instances:null,deactivated:{},edit:!1,introLinks:[],editLink:!1,editLinkIndex:-1,openSnackBar:!1,hasUnsavedChanges:!1,reverseProxy:null,alive:{},hostsData:{}},this.currentProxyPath=window.location.pathname,this.promises={},this.introLinksOriginal=null,this.deactivatedOriginal=null,this.t=e.t}componentDidMount(){this.getData().then(()=>{this.props.instancesWorker.registerHandler(this.getDataDelayed),this.props.hostsWorker.registerHandler(this.updateHosts),this.props.hostsWorker.registerAliveHandler(this.updateHostsAlive),this.props.socket.getObject("system.adapter."+this.props.adminInstance).then(e=>{var a;return this.setState({reverseProxy:((a=e==null?void 0:e.native)==null?void 0:a.reverseProxy)||[]})})})}componentWillUnmount(){this.getDataTimeout&&clearTimeout(this.getDataTimeout),this.props.instancesWorker.unregisterHandler(this.getDataDelayed),this.props.hostsWorker.unregisterHandler(this.updateHosts),this.props.hostsWorker.unregisterAliveHandler(this.updateHostsAlive)}activateEditMode(){let e;this.props.socket.getSystemConfig(!0).then(a=>(e=a,this.getInstances(!0,null,e))).then(a=>{const t=e&&e.native&&e.native.introLinks?e.native.introLinks:[];this.introLinksOriginal=JSON.parse(JSON.stringify(t)),this.deactivatedOriginal=JSON.parse(JSON.stringify(a.deactivated)),this.setState({instances:a.instances,deactivated:a.deactivated,edit:!0,introLinks:t,hasUnsavedChanges:!1})})}deactivateEditMode(){this.state.hasUnsavedChanges,this.setState({deactivated:this.deactivatedOriginal,introLinks:this.introLinksOriginal,hasUnsavedChanges:!1,edit:!1},()=>{this.deactivatedOriginal=null,this.introLinksOriginal=null})}toggleCard(e,a){if(!this.state.instances||!this.state.instances.length)return;const t=JSON.parse(JSON.stringify(this.state.deactivated)),s=t.indexOf(`${e}_${a}`);s!==-1?t.splice(s,1):(t.push(`${e}_${a}`),t.sort());const i=JSON.stringify(t)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(this.state.introLinks)!==JSON.stringify(this.introLinksOriginal);this.setState({deactivated:t,hasUnsavedChanges:i})}getInstancesCards(){return this.state.instances.map(e=>{const a=!this.state.deactivated.includes(`${e.id}_${e.linkName}`);if(a||this.state.edit){let t=e.link?e.link.replace(/^https?:\/\//,""):"";const s=t.indexOf("/");s!==-1&&(t=t.substring(0,s));let i=isFinite(e.id.split(".").pop());i&&(i=!!this.state.instances.find(g=>g.id!==e.id&&e.name===g.name&&e.id.split(".")[0]===g.id.split(".")[0]));const h=this.state.hostsData?this.state.hostsData[e.id]:null;return l.createElement($,{key:`${e.id}_${e.link}`,socket:this.props.socket,image:e.image,title:l.createElement(l.Fragment,null,l.createElement("span",null,e.name),i?l.createElement("span",{className:this.props.classes.instanceNumber},".",e.id.split(".").pop()):null),action:{link:e.link,text:t},t:this.props.t,lang:this.props.lang,color:e.color,reveal:e.info,edit:this.state.edit,reverseProxy:this.state.reverseProxy,offline:h&&h.alive===!1,enabled:a,disabled:!h||typeof h!="object",getHostDescriptionAll:()=>this.getHostDescriptionAll(e.id),toggleActivation:()=>this.toggleCard(e.id,e.linkName),openSnackBarFunc:()=>this.setState({openSnackBar:!0})},e.description||this.getHostDescription(e.id))}else return null})}toggleLinkCard(e){const a=JSON.parse(JSON.stringify(this.state.introLinks));a[e].enabled=!a[e].enabled;const t=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(a)!==JSON.stringify(this.introLinksOriginal);this.setState({introLinks:a,hasUnsavedChanges:t})}getLinkCards(){return this.state.introLinks.map((e,a)=>!e.enabled&&!this.state.edit?null:l.createElement($,{key:"link"+a,image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,socket:this.props.socket,color:e.color,edit:this.state.edit,interval:e.interval,camera:e.camera,addTs:e.addTs,onEdit:()=>this.setState({editLink:!0,editLinkIndex:a,link:JSON.parse(JSON.stringify(this.state.introLinks[a]))}),onRemove:()=>{const t=JSON.parse(JSON.stringify(this.state.introLinks));t.splice(a,1);const s=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==JSON.stringify(this.introLinksOriginal);this.setState({introLinks:t,hasUnsavedChanges:s})},enabled:e.enabled,toggleActivation:()=>this.toggleLinkCard(a)},e.desc||""))}editLinkCard(){return this.state.editLink?l.createElement(Ne,{open:this.state.editLink,link:this.state.link,socket:this.props.socket,isNew:this.state.editLinkIndex===-1,t:this.props.t,lang:this.props.lang,onClose:e=>{if(e){const a=JSON.parse(JSON.stringify(this.state.introLinks));this.state.editLinkIndex===-1?(e.enabled=!0,a.push(e)):(e.enabled=a[this.state.editLinkIndex].enabled,a[this.state.editLinkIndex]=e);const t=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(a)!==JSON.stringify(this.introLinksOriginal);this.setState({introLinks:a,editLink:!1,hasUnsavedChanges:t,link:null})}else this.setState({editLink:!1})}}):null}getButtons(e){const a=[];return this.state.edit?(a.push(l.createElement(u.Fab,{key:"add",color:"primary",className:`${e.button} ${e.addButton}`,onClick:()=>this.setState({editLink:!0,editLinkIndex:-1,link:{}})},l.createElement(T.default,null))),a.push(l.createElement(u.Fab,{key:"save",color:"primary",disabled:!this.state.hasUnsavedChanges,className:`${e.button} ${e.saveButton}`,onClick:()=>this.saveCards()},l.createElement(te.default,null))),a.push(l.createElement(u.Fab,{key:"close",color:"primary",className:`${e.button} ${e.closeButton}`,onClick:()=>this.deactivateEditMode()},l.createElement(P.default,null)))):a.push(l.createElement(u.Fab,{color:"primary",key:"edit",className:e.button,onClick:()=>this.activateEditMode()},l.createElement(ae.Z,null))),a}saveCards(){return this.props.socket.getSystemConfig(!0).then(e=>{let a=!1;JSON.stringify(e.common.intro)!==JSON.stringify(this.state.deactivated)&&(e.common.intro=this.state.deactivated,a=!0),!a&&JSON.stringify(e.native.introLinks)!==JSON.stringify(this.state.introLinks)&&(a=!0,e.native.introLinks=this.state.introLinks),a?this.props.socket.setSystemConfig(e).then(()=>this.props.showAlert("Updated","success")).catch(t=>{console.log(t),this.props.showAlert(t,"error")}).then(()=>this.setState({edit:!1})):this.setState({edit:!1})})}getHostData(e,a){return new Promise((t,s)=>a!==void 0?t({val:a}):this.props.socket.getState(e+".alive").then(i=>t(i)).catch(i=>s(i))).then(t=>t&&t.val?this.props.socket.getHostInfo(e,!1,1e4):{alive:!1}).catch(t=>(console.error(t),t)).then(t=>(t&&typeof t=="object"&&t.alive!==!1&&(t.alive=!0),this.props.socket.getForeignStates(`${e}.versions.*`).then(s=>(Object.keys(s).forEach(i=>t["_"+i.split(".").pop()]=s[i].val),t)))).then(t=>({id:e,data:t}))}getHostsData(e){const a=e.map(t=>this.getHostData(t._id));return Promise.all(a).then(t=>{const s={},i={};return t.forEach(h=>{s[h.id]=h.data,i[h.id]=h.data.alive}),{hostsData:s,alive:i}})}applyReverseProxy(e,a,t){e&&e.paths.forEach(s=>{var i;if(s.instance===t.id)t.link=s.path;else if(s.instance.startsWith("web.")){const h=a.find(g=>g._id===`system.adapter.${s.instance}`);if(((i=h==null?void 0:h.native)==null?void 0:i.port)&&(t.link||t.url).includes(":"+h.native.port)){const g=new RegExp(`^.*:${h.native.port}/`);t.link?t.link=t.link.replace(g,s.path):t.url&&(t.url=t.url.replace(g,s.path)),console.log(t.link||t.url)}}})}addLinks(e,a,t,s,i,h,g,z){const d=R.Z.replaceLink(e,a.name,t,{objects:i,hostname:this.props.hostname,protocol:this.props.protocol,port:this.props.port,adminInstance:this.props.adminInstance,hosts:h})||[];let r;if(this.state.reverseProxy&&this.state.reverseProxy.length&&(r=this.state.reverseProxy.find(x=>x.globalPath===this.currentProxyPath)),d.length===1){s.link=d[0].url,s.port=d[0].port,this.applyReverseProxy(r,g,s);const x=z.find(k=>k.link===s.link);x?console.log(`Double links: "${s.id}" and "${x.id}"`):z.push(s)}else d.length>1&&d.forEach(x=>{const k=z.find(A=>A.link===x.url);this.applyReverseProxy(r,g,x),k?console.log(`Double links: "${s.id}" and "${k.id}"`):z.push(Ae(Le({},s),{link:x.url,port:x.port}))})}getInstances(e,a,t){return a=a||this.state.hosts,this.props.socket.getAdapterInstances("",e).then(s=>{let i=t.common.intro||[];Array.isArray(i)||(i=Object.keys(i),i.sort());const h=[],g={};s.forEach(d=>g[d._id]=d),s.sort((d,r)=>(d=d&&d.common,r=r&&r.common,d=d||{},r=r||{},d.order===void 0&&r.order===void 0?d.name.toLowerCase()>r.name.toLowerCase()?1:d.name.toLowerCase()<r.name.toLowerCase()?-1:0:d.order===void 0?-1:r.order===void 0||d.order>r.order?1:d.order<r.order?-1:d.name.toLowerCase()>r.name.toLowerCase()?1:d.name.toLowerCase()<r.name.toLowerCase()?-1:0)),s.forEach(d=>{if(!d)return;const r=d.common||null,k=d._id.split(".").pop();if(!(r.name&&r.name==="admin"&&r.localLink===(this.props.hostname||""))){{if(r.name&&r.name==="web")return;if(r.name&&r.name!=="vis-web-admin"&&r.name.match(/^vis-/))return;if(r.name&&r.name.match(/^icons-/))return;if(r&&(r.enabled||r.onlyWWW)&&(r.localLinks||r.localLink)){let A=r.localLinks||r.localLink||"";typeof A=="string"&&(A={_default:A}),Object.keys(A).forEach(b=>{let w=A[b];const K={};typeof w=="string"&&(w={link:w}),K.id=d._id.replace("system.adapter.","")+(b==="_default"?"":" "+b),K.name=(r.titleLang?r.titleLang[this.props.lang]||r.titleLang.en:r.title)+(b==="_default"?"":" "+b),K.color=w.color||"",K.description=r.desc&&typeof r.desc=="object"?r.desc[this.props.lang]||r.desc.en:r.desc||"",K.image=r.icon?`adapter/${r.name}/${r.icon}`:"img/no-image.png",this.addLinks(w.link,r,k,K,g,a,s,h)})}}if(r&&(r.enabled||r.onlyWWW)&&r.name!=="admin"&&(r.welcomeScreen||r.welcomeScreenPro)){let A=[];r.welcomeScreen&&A.push(r.welcomeScreen),r.welcomeScreenPro&&A.push(r.welcomeScreenPro),A.forEach(b=>{const w={};w.id=d._id.replace("system.adapter.","")+"/"+b.link,w.name=b.name&&typeof b.name=="object"?b.name[this.props.lang]||b.name.en:b.name||"",w.color=b.color||"",w.description=r.desc&&typeof r.desc=="object"?r.desc[this.props.lang]||r.desc.en:r.desc||"",w.image=r.icon?`adapter/${r.name}/${r.icon}`:"img/no-image.png",w.order=b.order,this.addLinks(`%web_protocol%://%web_bind%:%web_port%/${b.link}`,r,k,w,g,a,s,h)})}}}),h.forEach(d=>{d.link&&(d.linkName=d.link.replace("https://","").replace("http://","").replace(/^[^_]+:/,""))}),h.sort((d,r)=>{if(d.order!==void 0||r.order!==void 0){if(d.order=d.order===void 0?1e3:d.order,r.order=r.order===void 0?1e3:r.order,d.order<r.order)return-1;if(d.order>r.order)return 1}return d.id>r.id?1:d.id<r.id?-1:0}),Object.keys(a).forEach(d=>{const r=a[d],x=r&&r.common;if(x){const k={};k.id=r._id,k.name=x.name&&typeof x.name=="object"?x.name[this.props.lang]||x.name.en:x.name||"",k.color="",k.image=x.icon||"img/no-image.png",k.info=this.t("Info"),k.linkName="",h.push(k)}});const z=[];return i.forEach(d=>{h.find(r=>d===`${r.id}_${r.linkName}`)&&z.push(d)}),i=z,{instances:h,deactivated:i}}).catch(s=>(console.log(s),{instances:[],deactivated:[]}))}getHostDescription(e){const{classes:a}=this.props,t=this.state.hostsData?this.state.hostsData[e]:null;if(t&&t.alive===!1)return l.createElement("div",{className:this.props.classes.hostOffline},this.props.t("Offline"));let s="",i="";if(t){try{t._nodeNewest&&t["Node.js"]&&U().gt(t._nodeNewest,t["Node.js"].replace(/^v/,""))&&(s=t._nodeNewest)}catch(h){}try{t._nodeNewest!==t._nodeNewestNext&&t._nodeNewestNext&&t["Node.js"]&&t._nodeNewest&&U().gt(t._nodeNewestNext,t["Node.js"].replace(/^v/,""))&&U().gt(t._nodeNewestNext,t._nodeNewest)&&(s+=(s?" / ":"")+t._nodeNewestNext)}catch(h){}s&&(s=l.createElement(u.Tooltip,{title:this.props.t("Some updates available")},l.createElement("span",{className:this.props.classes.nodeUpdate},"(",s,")")));try{t._npmNewest&&t.NPM&&U().gt(t._npmNewest,t.NPM)&&(i=t._npmNewest)}catch(h){}try{t._npmNewest!==t._npmNewestNext&&t._npmNewestNext&&t.NPM&&t._npmNewest&&U().gt(t._npmNewestNext,t.NPM)&&U().gt(t._npmNewestNext,t._npmNewest)&&(i+=(i?" / ":"")+t._npmNewestNext)}catch(h){}i&&(i=l.createElement(u.Tooltip,{title:this.props.t("Some updates available")},l.createElement("span",{className:this.props.classes.nodeUpdate},"(",i,")")))}return t&&typeof t=="object"?l.createElement("ul",{style:{textTransform:"none"}},l.createElement("li",null,l.createElement("span",null,l.createElement("span",{className:a.bold},this.t("Platform"),": "),t.Platform||"--")),l.createElement("li",null,l.createElement("span",null,l.createElement("span",{className:a.bold},this.t("RAM"),": "),ee.RAM(t.RAM))),l.createElement("li",null,l.createElement("span",null,l.createElement("span",{className:a.bold},this.t("Node.js"),": "),l.createElement("span",{className:se.default.clsx(s?this.props.classes.updateExists:this.props.classes.updateNo)},t["Node.js"]||"--"),s)),l.createElement("li",null,l.createElement("span",null,l.createElement("span",{className:a.bold},this.t("NPM"),": "),l.createElement("span",{className:se.default.clsx(i?this.props.classes.updateExists:this.props.classes.updateNo)},t.NPM||"--"),i))):l.createElement("ul",null,l.createElement(u.Skeleton,null),l.createElement(u.Skeleton,null),l.createElement(u.Skeleton,null),l.createElement(u.Skeleton,null))}getHostDescriptionAll(e){const{classes:a}=this.props,t=this.state.hostsData?this.state.hostsData[e]:null;return[l.createElement("ul",{style:{textTransform:"none"}},t&&typeof t=="object"&&Object.keys(t).filter(s=>!s.startsWith("_")).map(s=>l.createElement("li",{key:s},t&&typeof t=="object"?l.createElement("span",null,l.createElement("span",{className:a.bold},this.t(s),": "),ee[s]?ee[s](t[s],this.t):t[s]||"--"):l.createElement(u.Skeleton,null)))),t&&typeof t=="object"&&Object.keys(t).reduce((s,i)=>s+`${this.t(i)}:${ee[i]?ee[i](t[i],this.t):t[i]||"--"}
307
+ `)]}getData(e){let a,t;return this.props.socket.getSystemConfig(e).then(s=>(t=s,this.props.socket.getCompactHosts(e))).then(s=>(a=s,this.getInstances(e,a,t))).then(s=>(this.setState({instances:s.instances,hosts:a,deactivated:s.deactivated,introLinks:t&&t.native&&t.native.introLinks?t.native.introLinks:[]}),this.getHostsData(a))).then(s=>new Promise(i=>this.setState(s,()=>i()))).catch(s=>window.alert(`Cannot get data: ${s}`))}render(){if(!this.state.instances)return l.createElement(u.LinearProgress,null);const{classes:e}=this.props;return l.createElement(B.Z,{elevation:0,overflow:"visible"},l.createElement(u.Snackbar,{anchorOrigin:{vertical:"bottom",horizontal:"left"},open:this.state.openSnackBar,autoHideDuration:3e3,onClose:()=>this.setState({openSnackBar:!1}),message:this.t("copied")}),l.createElement(G.Z,{classes:{root:e.container}},l.createElement(u.Grid,{container:!0,spacing:2},this.getInstancesCards(),this.getLinkCards()),this.getButtons(e),this.editLinkCard()))}}ve.propTypes={action:n().object,children:n().node,color:n().string,edit:n().bool,enabled:n().bool,socket:n().object,image:n().string,reveal:n().node,title:n().string,t:n().func,lang:n().string,toggleActivation:n().func,instancesWorker:n().object,hostsWorker:n().object,hostname:n().string,protocol:n().string,port:n().number,adminInstance:n().string};var Pe=(0,W.withStyles)(Te)(ve)},9956:function(ue,j,o){var S,c=o(64836);S={value:!0},j.Z=void 0;var V=c(o(36128)),n=o(67557),Q=(0,V.default)((0,n.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),"Create");j.Z=Q}}]);
308
+
309
+ //# sourceMappingURL=2261.5341bfce.chunk.js.map