Partinally ran code thru JsHint

Ylian Saint-Hilaire committed Aug 29, 2018 at 17:40 UTC c531b646430e493a267c4e64607499903cf229ad
22 files changed +820 -791
amtevents.js
+15 -10
@@ -6,13 +6,18 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*jslint node: true */
10 +/*jshint node: true */
11 +/*jshint strict:false */
12 +/*jshint -W097 */
13 +/*jshint esversion: 6 */
14 +"use strict";
15
16 // Construct a MeshAgent object, called upon connection
17 module.exports.CreateAmtEventsHandler = function (parent) {
18 var obj = {};
19 obj.parent = parent;
15 -
20 +
21 // Private method
22 function ParseWsman(xml) {
23 try {
@@ -30,7 +35,7 @@ module.exports.CreateAmtEventsHandler = function (parent) {
35 if (body.childNodes.length > 0) {
36 t = body.childNodes[0].localName;
37 if (t.indexOf("_OUTPUT") == t.length - 7) { t = t.substring(0, t.length - 7); }
33 - r.Header['Method'] = t;
38 + r.Header.Method = t;
39 r.Body = _ParseWsmanRec(body.childNodes[0]);
40 }
41 return r;
@@ -39,7 +44,7 @@ module.exports.CreateAmtEventsHandler = function (parent) {
44 return null;
45 }
46 }
42 -
47 +
48 // Private method
49 function _ParseWsmanRec(node) {
50 var data, r = {};
@@ -48,7 +53,7 @@ module.exports.CreateAmtEventsHandler = function (parent) {
53 if (child.childNodes == null) { data = child.textContent; } else { data = _ParseWsmanRec(child); }
54 if (data == 'true') data = true; // Convert 'true' into true
55 if (data == 'false') data = false; // Convert 'false' into false
51 -
56 +
57 var childObj = data;
58 if (child.attributes != null) {
59 childObj = { 'Value': data };
@@ -56,14 +61,14 @@ module.exports.CreateAmtEventsHandler = function (parent) {
61 childObj['@' + child.attributes[j].name] = child.attributes[j].value;
62 }
63 }
59 -
64 +
65 if (r[child.localName] instanceof Array) { r[child.localName].push(childObj); }
66 else if (r[child.localName] == undefined) { r[child.localName] = childObj; }
67 else { r[child.localName] = [r[child.localName], childObj]; }
68 }
69 return r;
70 }
66 -
71 +
72 // Private method
73 function _turnToXml(text) {
74 var DOMParser = require('xmldom').DOMParser;
@@ -79,10 +84,10 @@ module.exports.CreateAmtEventsHandler = function (parent) {
84 //console.log(x);
85 }
86 return x;
82 - }
83 -
87 + };
88 +
89 // DEBUG: This is an example event, to test parsing and dispatching
90 //obj.handleAmtEvent('<?xml version="1.0" encoding="UTF-8"?><a:Envelope xmlns:a="http://www.w3.org/2003/05/soap-envelope" xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:d="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:e="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:f="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:g="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_AlertIndication" xmlns:h="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a:Header><b:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</b:To><b:ReplyTo><b:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</b:Address></b:ReplyTo><c:AckRequested></c:AckRequested><b:Action a:mustUnderstand="true">http://schemas.dmtf.org/wbem/wsman/1/wsman/Event</b:Action><b:MessageID>uuid:00000000-8086-8086-8086-000000128538</b:MessageID><c:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_AlertIndication</c:ResourceURI></a:Header><a:Body><g:CIM_AlertIndication><g:AlertType>8</g:AlertType><g:AlertingElementFormat>2</g:AlertingElementFormat><g:AlertingManagedElement>Interop:CIM_ComputerSystem.CreationClassName=&quot;CIM_ComputerSystem&quot;,Name=&quot;Intel(r) AMT&quot;</g:AlertingManagedElement><g:IndicationFilterName>Intel(r) AMT:AllEvents</g:IndicationFilterName><g:IndicationIdentifier>Intel(r):2950234687</g:IndicationIdentifier><g:IndicationTime><h:Datetime>2017-01-31T15:40:09.000Z</h:Datetime></g:IndicationTime><g:Message></g:Message><g:MessageArguments>0</g:MessageArguments><g:MessageArguments>Interop:CIM_ComputerSystem.CreationClassName=CIM_ComputerSystem,Name=Intel(r) AMT</g:MessageArguments><g:MessageID>iAMT0005</g:MessageID><g:OtherAlertingElementFormat></g:OtherAlertingElementFormat><g:OtherSeverity></g:OtherSeverity><g:OwningEntity>Intel(r) AMT</g:OwningEntity><g:PerceivedSeverity>2</g:PerceivedSeverity><g:ProbableCause>0</g:ProbableCause><g:SystemName>Intel(r) AMT</g:SystemName></g:CIM_AlertIndication></a:Body></a:Envelope>', 'aabbccdd', '1.2.3.4');
91
92 return obj;
88 -}
93 +};
amtscanner.js
+45 -39
@@ -6,7 +6,12 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*jslint node: true */
10 +/*jshint node: true */
11 +/*jshint strict:false */
12 +/*jshint -W097 */
13 +/*jshint esversion: 6 */
14 +"use strict";
15
16 // Construct a Intel AMT Scanner object
17 module.exports.CreateAmtScanner = function (parent) {
@@ -37,7 +42,7 @@ module.exports.CreateAmtScanner = function (parent) {
42 var packet = new Buffer(obj.common.hex2rstr('06000006000011BE80000000'), 'ascii');
43 packet[9] = tag;
44 return packet;
40 - }
45 + };
46
47 // Start scanning for local network Intel AMT computers
48 obj.start = function () {
@@ -45,7 +50,7 @@ module.exports.CreateAmtScanner = function (parent) {
50 obj.performScan();
51 obj.mainTimer = setInterval(obj.performScan, PeriodicScanTime);
52 return obj;
48 - }
53 + };
54
55 // Stop scanning for local network Intel AMT computers
56 obj.stop = function () {
@@ -53,7 +58,7 @@ module.exports.CreateAmtScanner = function (parent) {
58 for (var i in obj.servers) { obj.servers[i].close(); } // Stop all servers
59 obj.servers = {};
60 if (obj.mainTimer != null) { clearInterval(obj.mainTimer); obj.mainTimer = null; }
56 - }
61 + };
62
63 // Scan for Intel AMT computers using network multicast
64 obj.performRangeScan = function (userid, rangestr) {
@@ -76,7 +81,7 @@ module.exports.CreateAmtScanner = function (parent) {
81 delete rangeinfo.server;
82 }, 3000);
83 return true;
79 - }
84 + };
85
86 // Parse range, used to parse "ip", "ip/mask" or "ip-ip" notation.
87 // Return the start and end value of the scan
@@ -95,19 +100,19 @@ module.exports.CreateAmtScanner = function (parent) {
100 x = obj.parseIpv4Addr(range);
101 if (x == null) return null;
102 return { min: x, max: x };
98 - }
103 + };
104
105 // Parse IP address. Takes a
106 obj.parseIpv4Addr = function (addr) {
107 var x = addr.split('.');
108 if (x.length == 4) { return (parseInt(x[0]) << 24) + (parseInt(x[1]) << 16) + (parseInt(x[2]) << 8) + (parseInt(x[3]) << 0); }
109 return null;
105 - }
110 + };
111
112 // IP address number to string
113 obj.IPv4NumToStr = function (num) {
114 return ((num >> 24) & 0xFF) + '.' + ((num >> 16) & 0xFF) + '.' + ((num >> 8) & 0xFF) + '.' + (num & 0xFF);
110 - }
115 + };
116
117 /*
118 // Sample we could use to optimize DNS resolving, may not be needed at all.
@@ -144,14 +149,14 @@ module.exports.CreateAmtScanner = function (parent) {
149 }
150 });
151 return r;
147 - }
152 + };
153 */
154
155 obj.ResolveName = function (hostname, func) {
156 if ((hostname == '127.0.0.1') || (hostname == '::1') || (hostname == 'localhost')) { func(hostname, null); } // Don't scan localhost
157 if (obj.net.isIP(hostname) > 0) { func(hostname, hostname); return; } // This is an IP address, already resolved.
158 obj.dns.lookup(hostname, function (err, address, family) { if (err == null) { func(hostname, address); } else { func(hostname, null); } });
154 - }
159 + };
160
161 // Look for all Intel AMT computers that may be locally reachable and poll their presence
162 obj.performScan = function () {
@@ -178,6 +183,7 @@ module.exports.CreateAmtScanner = function (parent) {
183 } else if ((scaninfo.tcp == null) && ((scaninfo.state == 0) || isNaN(delta) || (delta > PeriodicScanTime))) {
184 // More than 30 seconds without a response, try TCP detection
185 obj.checkTcpPresence(host, (doc.intelamt.tls == 1) ? 16993 : 16992, scaninfo, function (tag, result, version) {
186 + // TODO: It is bad that "obj" is being accessed within this function.
187 if (result == false) return;
188 tag.lastpong = Date.now();
189 if (tag.state == 0) {
@@ -192,7 +198,7 @@ module.exports.CreateAmtScanner = function (parent) {
198 scaninfo.lastping = Date.now();
199 obj.checkAmtPresence(host, scaninfo.tag);
200 }
195 - }
201 + }
202 }
203 for (var i in obj.scanTable) {
204 if (obj.scanTable[i].present == false) {
@@ -203,10 +209,10 @@ module.exports.CreateAmtScanner = function (parent) {
209 }
210 });
211 return true;
206 - }
212 + };
213
214 // Check the presense of a specific Intel AMT computer using RMCP
209 - obj.checkAmtPresence = function (host, tag) { obj.ResolveName(host, function (hostname, ip) { obj.checkAmtPresenceEx(ip, tag); }); }
215 + obj.checkAmtPresence = function (host, tag) { obj.ResolveName(host, function (hostname, ip) { obj.checkAmtPresenceEx(ip, tag); }); };
216
217 // Check the presense of a specific Intel AMT computer using RMCP
218 obj.checkAmtPresenceEx = function (host, tag) {
@@ -221,20 +227,20 @@ module.exports.CreateAmtScanner = function (parent) {
227 server.on('error', (err) => { });
228 server.on('message', (data, rinfo) => { obj.parseRmcpPacket(data, rinfo, serverid, obj.changeConnectState, null); });
229 server.on('listening', () => {
224 - obj.pendingSends.push([ server, packet, host ]);
230 + obj.pendingSends.push([server, packet, host]);
231 if (obj.pendingSendTimer == null) { obj.pendingSendTimer = setInterval(obj.sendPendingPacket, 10); }
232 });
233 server.bind(0);
234 obj.servers[serverid] = server;
235 } else {
236 // Use existing server
231 - obj.pendingSends.push([ server, packet, host ]);
237 + obj.pendingSends.push([server, packet, host]);
238 if (obj.pendingSendTimer == null) { obj.pendingSendTimer = setInterval(obj.sendPendingPacket, 10); }
239 }
234 - }
240 + };
241
242 // Send a pending RMCP packet
237 - obj.sendPendingPacket = function() {
243 + obj.sendPendingPacket = function () {
244 try {
245 var p = obj.pendingSends.shift();
246 if (p != undefined) {
@@ -245,7 +251,7 @@ module.exports.CreateAmtScanner = function (parent) {
251 obj.pendingSendTimer = null;
252 }
253 } catch (e) { }
248 - }
254 + };
255
256 // Parse RMCP packet
257 obj.parseRmcpPacket = function (data, rinfo, serverid, func, user) {
@@ -256,14 +262,14 @@ module.exports.CreateAmtScanner = function (parent) {
262 var minorVersion = data[18] & 0x0F;
263 var majorVersion = (data[18] >> 4) & 0x0F;
264 var provisioningState = data[19] & 0x03; // Pre = 0, In = 1, Post = 2
259 -
265 +
266 var openPort = (data[16] * 256) + data[17];
267 var dualPorts = ((data[19] & 0x04) != 0) ? true : false;
268 var openPorts = [openPort];
269 if (dualPorts == true) { openPorts = [16992, 16993]; }
270 if (provisioningState <= 2) { func(tag, minorVersion, majorVersion, provisioningState, openPort, dualPorts, rinfo, user); }
271 }
266 - }
272 + };
273
274 // Use the RMCP packet to change the computer state
275 obj.changeConnectState = function (tag, minorVersion, majorVersion, provisioningState, openPort, dualPorts, rinfo, user) {
@@ -282,21 +288,21 @@ module.exports.CreateAmtScanner = function (parent) {
288 obj.changeAmtState(scaninfo.nodeinfo._id, scaninfo.nodeinfo.intelamt.ver, provisioningState, scaninfo.nodeinfo.intelamt.tls);
289 }
290 }
285 - }
291 + };
292
287 - // Use the RMCP packet to change the computer state
288 - obj.reportMachineState = function (tag, minorVersion, majorVersion, provisioningState, openPort, dualPorts, rinfo, user) {
289 - //var provisioningStates = { 0: 'Pre', 1: 'in', 2: 'Post' };
290 - //var provisioningStateStr = provisioningStates[provisioningState];
291 - //console.log(rinfo.address + ': Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning, Open Ports: [' + openPorts.join(', ') + ']');
293 + // Use the RMCP packet to change the computer state
294 + obj.reportMachineState = function (tag, minorVersion, majorVersion, provisioningState, openPort, dualPorts, rinfo, user) {
295 + //var provisioningStates = { 0: 'Pre', 1: 'in', 2: 'Post' };
296 + //var provisioningStateStr = provisioningStates[provisioningState];
297 + //console.log(rinfo.address + ': Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning, Open Ports: [' + openPorts.join(', ') + ']');
298 obj.dns.reverse(rinfo.address, function (err, hostname) {
299 if ((err != undefined) && (hostname != undefined)) {
294 - user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: hostname[0] };
295 - } else {
296 - user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: rinfo.address };
297 - }
298 - });
299 - }
300 + user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: hostname[0] };
301 + } else {
302 + user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: rinfo.address };
303 + }
304 + });
305 + };
306
307 // Change Intel AMT information in the database and event the changes
308 obj.changeAmtState = function (nodeid, version, provisioningState, tls) {
@@ -317,7 +323,7 @@ module.exports.CreateAmtScanner = function (parent) {
323 // Make the change & save
324 var change = false;
325 if (node.intelamt == undefined) { node.intelamt = {}; }
320 - if (node.intelamt.tls != tls) { node.intelamt.tls = tls; change = true; changes.push(tls==1?'TLS':'NoTLS'); }
326 + if (node.intelamt.tls != tls) { node.intelamt.tls = tls; change = true; changes.push(tls == 1 ? 'TLS' : 'NoTLS'); }
327 if (obj.compareAmtVersionStr(node.intelamt.ver, version)) { node.intelamt.ver = version; change = true; changes.push('AMT Version ' + version); }
328 if (node.intelamt.state != provisioningState) { node.intelamt.state = provisioningState; change = true; changes.push('AMT State'); }
329 if (change == true) {
@@ -333,7 +339,7 @@ module.exports.CreateAmtScanner = function (parent) {
339 }
340 });
341 });
336 - }
342 + };
343
344 // Return true if we should change the Intel AMT version number
345 obj.compareAmtVersionStr = function (oldVer, newVer) {
@@ -347,10 +353,10 @@ module.exports.CreateAmtScanner = function (parent) {
353 if (newVerArr.length > oldVerArr.length) return true;
354 if ((newVerArr.length == 3) && (oldVerArr.length == 3) && (oldVerArr[2] != newVerArr[2])) return true;
355 return false;
350 - }
356 + };
357
358 // Check the presense of a specific Intel AMT computer using RMCP
353 - obj.checkTcpPresence = function (host, port, scaninfo, func) { obj.ResolveName(host, function (hostname, ip) { obj.checkTcpPresenceEx(ip, port, scaninfo, func); }); }
359 + obj.checkTcpPresence = function (host, port, scaninfo, func) { obj.ResolveName(host, function (hostname, ip) { obj.checkTcpPresenceEx(ip, port, scaninfo, func); }); };
360
361 // Check that we can connect TCP to a given port
362 obj.checkTcpPresenceEx = function (host, port, scaninfo, func) {
@@ -378,7 +384,7 @@ module.exports.CreateAmtScanner = function (parent) {
384 client.on('end', function () { if (this.scaninfo.tcp != null) { delete this.scaninfo.tcp; try { this.destroy(); } catch (ex) { } this.func(this.scaninfo, false); } });
385 scaninfo.tcp = client;
386 } catch (ex) { console.log(ex); }
381 - }
387 + };
388
389 // Return the Intel AMT version from the HTTP headers. Return null if nothing is found.
390 obj.getIntelAmtVersionFromHeaders = function (headers) {
@@ -393,9 +399,9 @@ module.exports.CreateAmtScanner = function (parent) {
399 }
400 }
401 return null;
396 - }
402 + };
403
404 //console.log(obj.getIntelAmtVersionFromHeaders("HTTP/1.1 303 See Other\r\nLocation: /logon.htm\r\nContent-Length: 0\r\nServer: Intel(R) Active Management Technology 7.1.91\r\n\r\n"));
405
406 return obj;
401 -}
\ No newline at end of file
407 +};
\ No newline at end of file
amtscript.js
+28 -23
@@ -6,7 +6,12 @@
6 * @version v0.1.0e
7 */
8
9 -'use strict';
9 +/*jslint node: true */
10 +/*jshint node: true */
11 +/*jshint strict:false */
12 +/*jshint -W097 */
13 +/*jshint esversion: 6 */
14 +"use strict";
15
16 module.exports.CreateAmtScriptEngine = function () {
17 var o = {};
@@ -284,14 +289,14 @@ module.exports.CreateAmtScriptEngine = function () {
289 if (obj.state == 1 && obj.ip >= obj.script.length) { obj.state = 0; obj.stop(); }
290 if (obj.onStep) obj.onStep(obj);
291 return obj;
287 - }
292 + };
293
294 obj.xxStepDialogOk = function (button) {
295 obj.variables['DialogSelect'] = button;
296 obj.state = 1;
297 obj.dialog = false;
298 if (obj.onStep) obj.onStep(obj);
294 - }
299 + };
300
301 // ###BEGIN###{**ClosureAdvancedMode}
302 obj.xxWsmanReturnFix = function (x) {
@@ -301,7 +306,7 @@ module.exports.CreateAmtScriptEngine = function () {
306 if (x.Responses) { x['Responses'] = x.Responses; delete x.Responses; }
307 if (x.Response) { x['Response'] = x.Response; delete x.Response; }
308 if (x.ReturnValueStr) { x['ReturnValueStr'] = x.ReturnValueStr; delete x.ReturnValueStr; }
304 - }
309 + };
310 // ###END###{**ClosureAdvancedMode}
311
312 obj.xxWsmanReturn = function (stack, name, responses, status) {
@@ -320,34 +325,34 @@ module.exports.CreateAmtScriptEngine = function () {
325 obj.setVar('wsman_result_str', ((httpErrorTable[status]) ? (httpErrorTable[status]) : ('Error #' + status)));
326 obj.state = 1;
327 if (obj.onStep) obj.onStep(obj);
323 - }
328 + };
329
330 // ###BEGIN###{Certificates}
331 obj.xxSignWithDummyCaReturn = function (cert) {
332 obj.setVar('signed_cert', btoa(_arrayBufferToString(cert)));
333 obj.state = 1;
334 if (obj.onStep) obj.onStep(obj);
330 - }
335 + };
336 // ###END###{Certificates}
337
333 - obj.toString = function (x) { if (typeof x == 'object') return JSON.stringify(x); return x; }
338 + obj.toString = function (x) { if (typeof x == 'object') return JSON.stringify(x); return x; };
339
340 obj.reset();
341 return obj;
342 }
343 */
344
340 - ReadShort = function (v, p) { return (v.charCodeAt(p) << 8) + v.charCodeAt(p + 1); }
341 - ReadShortX = function (v, p) { return (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); }
342 - ReadInt = function (v, p) { return (v.charCodeAt(p) * 0x1000000) + (v.charCodeAt(p + 1) << 16) + (v.charCodeAt(p + 2) << 8) + v.charCodeAt(p + 3); } // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.
343 - ReadIntX = function (v, p) { return (v.charCodeAt(p + 3) * 0x1000000) + (v.charCodeAt(p + 2) << 16) + (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); }
344 - ShortToStr = function (v) { return String.fromCharCode((v >> 8) & 0xFF, v & 0xFF); }
345 - ShortToStrX = function (v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF); }
346 - IntToStr = function (v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); }
347 - IntToStrX = function (v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF); }
345 + var ReadShort = function (v, p) { return (v.charCodeAt(p) << 8) + v.charCodeAt(p + 1); };
346 + var ReadShortX = function (v, p) { return (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); };
347 + var ReadInt = function (v, p) { return (v.charCodeAt(p) * 0x1000000) + (v.charCodeAt(p + 1) << 16) + (v.charCodeAt(p + 2) << 8) + v.charCodeAt(p + 3); }; // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.
348 + var ReadIntX = function (v, p) { return (v.charCodeAt(p + 3) * 0x1000000) + (v.charCodeAt(p + 2) << 16) + (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); };
349 + var ShortToStr = function (v) { return String.fromCharCode((v >> 8) & 0xFF, v & 0xFF); };
350 + var ShortToStrX = function (v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF); };
351 + var IntToStr = function (v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); };
352 + var IntToStrX = function (v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF); };
353
354 // Argument types: 0 = Variable, 1 = String, 2 = Integer, 3 = Label
350 - o.script_compile = function(script, onmsg) {
355 + o.script_compile = function (script, onmsg) {
356 var r = '', scriptlines = script.split('\n'), labels = {}, labelswap = [], swaps = [];
357 // Go thru each script line and encode it
358 for (var i in scriptlines) {
@@ -392,11 +397,11 @@ module.exports.CreateAmtScriptEngine = function () {
397 r = r.substr(0, position) + IntToStr(target) + r.substr(position + 4);
398 }
399 return IntToStr(0x247D2945) + ShortToStr(1) + r;
395 - }
400 + };
401
402 // Decompile the script, intended for debugging only
398 - o.script_decompile = function(binary, onecmd) {
399 - var r = '', ptr = 6, labelcount = 0, labels = {};
403 + o.script_decompile = function (binary, onecmd) {
404 + var r = '', ptr = 6, labels = {};
405 if (onecmd >= 0) {
406 ptr = onecmd; // If we are decompiling just one command, set the ptr to that command.
407 } else {
@@ -413,7 +418,7 @@ module.exports.CreateAmtScriptEngine = function () {
418 var argcount = ReadShort(binary, ptr + 4);
419 var argptr = ptr + 6;
420 var argstr = '';
416 - if (!(onecmd >= 0)) r += ":label" + (ptr - 6) + "\n";
421 + if (!(onecmd >= 0)) { r += ":label" + (ptr - 6) + "\n"; }
422 // Loop on each argument, moving forward by the argument length each time
423 for (var i = 0; i < argcount; i++) {
424 var arglen = ReadShort(binary, argptr);
@@ -451,7 +456,7 @@ module.exports.CreateAmtScriptEngine = function () {
456 if (line[0] != ':') { r += line + '\n'; } else { if (labels[line]) { r += line + '\n'; } }
457 }
458 return r;
454 - }
459 + };
460
461 // Convert the list of blocks into a script that can be compiled
462 o.script_blocksToScript = function (script_BuildingBlocks, script_BlockScript) {
@@ -467,7 +472,7 @@ module.exports.CreateAmtScriptEngine = function () {
472 if (script_BuildingBlocks['_end']) { script += '##### Ending Block #####\r\n' + script_BuildingBlocks['_end']['code'] + '\r\nHighlightBlock\r\n'; }
473 }
474 return script;
470 - }
475 + };
476
477 return o;
473 -}
\ No newline at end of file
478 +};
\ No newline at end of file
certoperations.js
+200 -257
@@ -6,268 +6,214 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
17 module.exports.CertificateOperations = function () {
18 var obj = {};
19
14 - obj.fs = require('fs');
15 - obj.forge = require('node-forge');
16 - obj.crypto = require('crypto');
20 + obj.fs = require("fs");
21 + obj.forge = require("node-forge");
22 + obj.crypto = require("crypto");
23 obj.pki = obj.forge.pki;
18 - obj.dirExists = function (filePath) { try { return obj.fs.statSync(filePath).isDirectory(); } catch (err) { return false; } }
19 - obj.getFilesizeInBytes = function(filename) { try { return obj.fs.statSync(filename)["size"]; } catch (err) { return -1; } }
20 - obj.fileExists = function(filePath) { try { return obj.fs.statSync(filePath).isFile(); } catch (err) { return false; } }
24 + obj.dirExists = function (filePath) { try { return obj.fs.statSync(filePath).isDirectory(); } catch (err) { return false; } };
25 + obj.getFilesizeInBytes = function (filename) { try { return obj.fs.statSync(filename).size; } catch (err) { return -1; } };
26 + obj.fileExists = function (filePath) { try { return obj.fs.statSync(filePath).isFile(); } catch (err) { return false; } };
27
28 // Return the SHA386 hash of the certificate public key
29 obj.getPublicKeyHash = function (cert) {
30 var publickey = obj.pki.certificateFromPem(cert).publicKey;
25 - return obj.pki.getPublicKeyFingerprint(publickey, { encoding: 'hex', md: obj.forge.md.sha384.create() });
26 - }
31 + return obj.pki.getPublicKeyFingerprint(publickey, { encoding: "hex", md: obj.forge.md.sha384.create() });
32 + };
33
34 // Create a self-signed certificate
35 obj.GenerateRootCertificate = function (addThumbPrintToName, commonName, country, organization, strong) {
30 - var keys = obj.pki.rsa.generateKeyPair((strong == true) ? 3072 : 2048);
36 + var keys = obj.pki.rsa.generateKeyPair((strong === true) ? 3072 : 2048);
37 var cert = obj.pki.createCertificate();
38 cert.publicKey = keys.publicKey;
33 - cert.serialNumber = '' + Math.floor((Math.random() * 100000) + 1); ;
39 + cert.serialNumber = String(Math.floor((Math.random() * 100000) + 1));
40 cert.validity.notBefore = new Date();
35 - cert.validity.notBefore.setFullYear(cert.validity.notBefore.getFullYear() - 1); // Create a certificate that is valid one year before, to make sure out-of-sync clocks don't reject this cert.
41 + cert.validity.notBefore.setFullYear(cert.validity.notBefore.getFullYear() - 1); // Create a certificate that is valid one year before, to make sure out-of-sync clocks don"t reject this cert.
42 cert.validity.notAfter = new Date();
43 cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 30);
38 - if (addThumbPrintToName == true) { commonName += '-' + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: 'hex' }).substring(0, 6); }
39 - if (country == undefined) { country = 'unknown'; }
40 - if (organization == undefined) { organization = 'unknown'; }
41 - var attrs = [{ name: 'commonName', value: commonName }, { name: 'organizationName', value: organization }, { name: 'countryName', value: country }];
44 + if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: "hex" }).substring(0, 6); }
45 + if (country === undefined) { country = "unknown"; }
46 + if (organization === undefined) { organization = "unknown"; }
47 + var attrs = [{ name: "commonName", value: commonName }, { name: "organizationName", value: organization }, { name: "countryName", value: country }];
48 cert.setSubject(attrs);
49 cert.setIssuer(attrs);
50 // Create a root certificate
45 - cert.setExtensions([{
46 - name: 'basicConstraints',
47 - cA: true
48 - }, {
49 - name: 'nsCertType',
50 - sslCA: true,
51 - emailCA: true,
52 - objCA: true
53 - }, {
54 - name: 'subjectKeyIdentifier'
55 - }]);
51 + cert.setExtensions([{ name: "basicConstraints", cA: true }, { name: "nsCertType", sslCA: true, emailCA: true, objCA: true }, { name: "subjectKeyIdentifier" }]);
52 cert.sign(keys.privateKey, obj.forge.md.sha384.create());
53
54 return { cert: cert, key: keys.privateKey };
59 - }
60 -
55 + };
56 +
57 // Issue a certificate from a root
58 obj.IssueWebServerCertificate = function (rootcert, addThumbPrintToName, commonName, country, organization, extKeyUsage, strong) {
63 - var keys = obj.pki.rsa.generateKeyPair((strong == true) ? 3072 : 2048);
59 + var keys = obj.pki.rsa.generateKeyPair((strong === true) ? 3072 : 2048);
60 var cert = obj.pki.createCertificate();
61 cert.publicKey = keys.publicKey;
66 - cert.serialNumber = '' + Math.floor((Math.random() * 100000) + 1); ;
62 + cert.serialNumber = String(Math.floor((Math.random() * 100000) + 1));
63 cert.validity.notBefore = new Date();
68 - cert.validity.notBefore.setFullYear(cert.validity.notAfter.getFullYear() - 1); // Create a certificate that is valid one year before, to make sure out-of-sync clocks don't reject this cert.
64 + cert.validity.notBefore.setFullYear(cert.validity.notAfter.getFullYear() - 1); // Create a certificate that is valid one year before, to make sure out-of-sync clocks don"t reject this cert.
65 cert.validity.notAfter = new Date();
66 cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 30);
71 - if (addThumbPrintToName == true) { commonName += '-' + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: 'hex' }).substring(0, 6); }
72 - var attrs = [ { name: 'commonName', value: commonName }];
73 - if (country != undefined) attrs.push({ name: 'countryName', value: country });
74 - if (organization != undefined) attrs.push({ name: 'organizationName', value: organization });
67 + if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: "hex" }).substring(0, 6); }
68 + var attrs = [{ name: "commonName", value: commonName }];
69 + if (country != undefined) { attrs.push({ name: "countryName", value: country }); }
70 + if (organization != undefined) { attrs.push({ name: "organizationName", value: organization }); }
71 cert.setSubject(attrs);
72 cert.setIssuer(rootcert.cert.subject.attributes);
73
78 - if (extKeyUsage == null) { extKeyUsage = { name: 'extKeyUsage', serverAuth: true, } } else { extKeyUsage.name = 'extKeyUsage'; }
74 + if (extKeyUsage == null) { extKeyUsage = { name: "extKeyUsage", serverAuth: true }; } else { extKeyUsage.name = "extKeyUsage"; }
75 var subjectAltName = null;
80 - if (extKeyUsage.serverAuth == true) {
81 - subjectAltName = {
82 - name: 'subjectAltName',
83 - altNames: [{
84 - type: 6, // URI
85 - value: 'http://' + commonName + '/'
86 - }, {
87 - type: 6, // URL
88 - value: 'http://localhost/'
89 - }]
90 - }
91 - }
92 -
93 - /*
94 - {
95 - name: 'extKeyUsage',
96 - serverAuth: true,
97 - clientAuth: true,
98 - codeSigning: true,
99 - emailProtection: true,
100 - timeStamping: true,
101 - '2.16.840.1.113741.1.2.1': true
102 - }
103 - */
104 -
105 - var extensions = [{
106 - name: 'basicConstraints',
107 - cA: false
108 - }, {
109 - name: 'keyUsage',
110 - keyCertSign: true,
111 - digitalSignature: true,
112 - nonRepudiation: true,
113 - keyEncipherment: true,
114 - dataEncipherment: true
115 - }, extKeyUsage, {
116 - name: 'nsCertType',
117 - client: false,
118 - server: true,
119 - email: false,
120 - objsign: false,
121 - sslCA: false,
122 - emailCA: false,
123 - objCA: false
124 - }, {
125 - name: 'subjectKeyIdentifier'
126 - }]
127 - if (subjectAltName != null) extensions.push(subjectAltName);
76 + if (extKeyUsage.serverAuth === true) { subjectAltName = { name: "subjectAltName", altNames: [{ type: 6, value: "http://" + commonName + "/" }, { type: 6, value: "http://localhost/" }] }; }
77 + var extensions = [{ name: "basicConstraints", cA: false }, { name: "keyUsage", keyCertSign: true, digitalSignature: true, nonRepudiation: true, keyEncipherment: true, dataEncipherment: true }, extKeyUsage, { name: "nsCertType", client: false, server: true, email: false, objsign: false, sslCA: false, emailCA: false, objCA: false }, { name: "subjectKeyIdentifier" }];
78 + if (subjectAltName != null) { extensions.push(subjectAltName); }
79 cert.setExtensions(extensions);
80 cert.sign(rootcert.key, obj.forge.md.sha384.create());
130 -
81 +
82 return { cert: cert, key: keys.privateKey };
132 - }
83 + };
84
85 // Returns the web server TLS certificate and private key, if not present, create demonstration ones.
86 obj.GetMeshServerCertificate = function (parent, args, config, func) {
87 + var i = 0;
88 var certargs = args.cert;
89 var mpscertargs = args.mpscert;
90 var strongCertificate = (args.fastcert ? false : true);
91 var rcountmax = 5;
92 + var caindex = 1;
93 + var caok = false;
94 + var calist = [];
95 + var dnsname = null;
96 // commonName, country, organization
141 -
97 +
98 // If the certificates directory does not exist, create it.
99 if (!obj.dirExists(parent.datapath)) { obj.fs.mkdirSync(parent.datapath); }
144 - var r = {}, rcount = 0;
145 -
100 + var r = {};
101 + var rcount = 0;
102 +
103 // If the root certificate already exist, load it
147 - if (obj.fileExists(parent.getConfigFilePath('root-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('root-cert-private.key'))) {
148 - var rootCertificate = obj.fs.readFileSync(parent.getConfigFilePath('root-cert-public.crt'), 'utf8');
149 - var rootPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('root-cert-private.key'), 'utf8');
104 + if (obj.fileExists(parent.getConfigFilePath("root-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("root-cert-private.key"))) {
105 + var rootCertificate = obj.fs.readFileSync(parent.getConfigFilePath("root-cert-public.crt"), "utf8");
106 + var rootPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath("root-cert-private.key"), "utf8");
107 r.root = { cert: rootCertificate, key: rootPrivateKey };
108 rcount++;
109 }
110
154 - if (args.tlsoffload == true) {
111 + if (args.tlsoffload === true) {
112 // If the web certificate already exist, load it. Load just the certificate since we are in TLS offload situation
156 - if (obj.fileExists(parent.getConfigFilePath('webserver-cert-public.crt'))) {
157 - var webCertificate = obj.fs.readFileSync(parent.getConfigFilePath('webserver-cert-public.crt'), 'utf8');
158 - r.web = { cert: webCertificate };
113 + if (obj.fileExists(parent.getConfigFilePath("webserver-cert-public.crt"))) {
114 + r.web = { cert: obj.fs.readFileSync(parent.getConfigFilePath("webserver-cert-public.crt"), "utf8") };
115 rcount++;
116 }
117 } else {
118 // If the web certificate already exist, load it. Load both certificate and private key
163 - if (obj.fileExists(parent.getConfigFilePath('webserver-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('webserver-cert-private.key'))) {
164 - var webCertificate = obj.fs.readFileSync(parent.getConfigFilePath('webserver-cert-public.crt'), 'utf8');
165 - var webPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('webserver-cert-private.key'), 'utf8');
166 - r.web = { cert: webCertificate, key: webPrivateKey };
119 + if (obj.fileExists(parent.getConfigFilePath("webserver-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("webserver-cert-private.key"))) {
120 + r.web = { cert: obj.fs.readFileSync(parent.getConfigFilePath("webserver-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("webserver-cert-private.key"), "utf8") };
121 rcount++;
122 }
123 }
170 -
124 +
125 // If the mps certificate already exist, load it
172 - if (obj.fileExists(parent.getConfigFilePath('mpsserver-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('mpsserver-cert-private.key'))) {
173 - var mpsCertificate = obj.fs.readFileSync(parent.getConfigFilePath('mpsserver-cert-public.crt'), 'utf8');
174 - var mpsPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('mpsserver-cert-private.key'), 'utf8');
175 - r.mps = { cert: mpsCertificate, key: mpsPrivateKey };
126 + if (obj.fileExists(parent.getConfigFilePath("mpsserver-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("mpsserver-cert-private.key"))) {
127 + r.mps = { cert: obj.fs.readFileSync(parent.getConfigFilePath("mpsserver-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("mpsserver-cert-private.key"), "utf8") };
128 rcount++;
129 }
178 -
130 +
131 // If the agent certificate already exist, load it
180 - if (obj.fileExists(parent.getConfigFilePath('agentserver-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('agentserver-cert-private.key'))) {
181 - var agentCertificate = obj.fs.readFileSync(parent.getConfigFilePath('agentserver-cert-public.crt'), 'utf8');
182 - var agentPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('agentserver-cert-private.key'), 'utf8');
183 - r.agent = { cert: agentCertificate, key: agentPrivateKey };
132 + if (obj.fileExists(parent.getConfigFilePath("agentserver-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("agentserver-cert-private.key"))) {
133 + r.agent = { cert: obj.fs.readFileSync(parent.getConfigFilePath("agentserver-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("agentserver-cert-private.key"), "utf8") };
134 rcount++;
135 }
136
137 // If the console certificate already exist, load it
188 - if (obj.fileExists(parent.getConfigFilePath('amtconsole-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('agentserver-cert-private.key'))) {
189 - var amtConsoleCertificate = obj.fs.readFileSync(parent.getConfigFilePath('amtconsole-cert-public.crt'), 'utf8');
190 - var amtConsolePrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('amtconsole-cert-private.key'), 'utf8');
191 - r.console = { cert: amtConsoleCertificate, key: amtConsolePrivateKey };
138 + if (obj.fileExists(parent.getConfigFilePath("amtconsole-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("agentserver-cert-private.key"))) {
139 + r.console = { cert: obj.fs.readFileSync(parent.getConfigFilePath("amtconsole-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("amtconsole-cert-private.key"), "utf8") };
140 rcount++;
141 }
142
143 // If the swarm server certificate exist, load it (This is an optional certificate)
196 - if (obj.fileExists(parent.getConfigFilePath('swarmserver-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('swarmserver-cert-private.key'))) {
197 - var swarmServerCertificate = obj.fs.readFileSync(parent.getConfigFilePath('swarmserver-cert-public.crt'), 'utf8');
198 - var swarmServerPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('swarmserver-cert-private.key'), 'utf8');
199 - r.swarmserver = { cert: swarmServerCertificate, key: swarmServerPrivateKey };
144 + if (obj.fileExists(parent.getConfigFilePath("swarmserver-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("swarmserver-cert-private.key"))) {
145 + r.swarmserver = { cert: obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-private.key"), "utf8") };
146 }
147
148 // If the swarm server root certificate exist, load it (This is an optional certificate)
203 - if (obj.fileExists(parent.getConfigFilePath('swarmserverroot-cert-public.crt'))) {
204 - var swarmServerRootCertificate = obj.fs.readFileSync(parent.getConfigFilePath('swarmserverroot-cert-public.crt'), 'utf8');
205 - r.swarmserverroot = { cert: swarmServerRootCertificate };
149 + if (obj.fileExists(parent.getConfigFilePath("swarmserverroot-cert-public.crt"))) {
150 + r.swarmserverroot = { cert: obj.fs.readFileSync(parent.getConfigFilePath("swarmserverroot-cert-public.crt"), "utf8") };
151 }
152
153 // If CA certificates are present, load them
209 - if (r.web != null) {
210 - var caok, caindex = 1, calist = [];
211 - do {
212 - caok = false;
213 - if (obj.fileExists(parent.getConfigFilePath('webserver-cert-chain' + caindex + '.crt'))) {
214 - var caCertificate = obj.fs.readFileSync(parent.getConfigFilePath('webserver-cert-chain' + caindex + '.crt'), 'utf8');
215 - calist.push(caCertificate);
216 - caok = true;
217 - }
218 - caindex++;
219 - } while (caok == true);
220 - r.web.ca = calist;
221 - }
154 + do {
155 + caok = false;
156 + if (obj.fileExists(parent.getConfigFilePath("webserver-cert-chain" + caindex + ".crt"))) {
157 + calist.push(obj.fs.readFileSync(parent.getConfigFilePath("webserver-cert-chain" + caindex + ".crt"), "utf8"));
158 + caok = true;
159 + }
160 + caindex++;
161 + } while (caok === true);
162 + if (r.web != null) { r.web.ca = calist; }
163
164 // Decode certificate arguments
224 - var commonName = 'un-configured', country, organization, forceWebCertGen = 0, forceMpsCertGen = 0;
165 + var commonName = "un-configured";
166 + var country = null;
167 + var organization = null;
168 + var forceWebCertGen = 0;
169 + var forceMpsCertGen = 0;
170 if (certargs != undefined) {
226 - var args = certargs.split(',');
227 - if (args.length > 0) commonName = args[0];
228 - if (args.length > 1) country = args[1];
229 - if (args.length > 2) organization = args[2];
171 + var xargs = certargs.split(",");
172 + if (xargs.length > 0) { commonName = xargs[0]; }
173 + if (xargs.length > 1) { country = xargs[1]; }
174 + if (xargs.length > 2) { organization = xargs[2]; }
175 }
176
177 // Decode MPS certificate arguments, this is for the Intel AMT CIRA server
233 - var mpsCommonName = commonName, mpsCountry = country, mpsOrganization = organization;
234 - if (mpscertargs != undefined) {
235 - var args = mpscertargs.split(',');
236 - if (args.length > 0) mpsCommonName = args[0];
237 - if (args.length > 1) mpsCountry = args[1];
238 - if (args.length > 2) mpsOrganization = args[2];
178 + var mpsCommonName = commonName;
179 + var mpsCountry = country;
180 + var mpsOrganization = organization;
181 + if (mpscertargs !== undefined) {
182 + var xxargs = mpscertargs.split(",");
183 + if (xxargs.length > 0) { mpsCommonName = xxargs[0]; }
184 + if (xxargs.length > 1) { mpsCountry = xxargs[1]; }
185 + if (xxargs.length > 2) { mpsOrganization = xxargs[2]; }
186 }
187
188 // Look for domains that have DNS names and load their certificates
189 r.dns = {};
243 - for (var i in config.domains) {
244 - if ((i != '') && (config.domains[i] != null) && (config.domains[i].dns != null)) {
245 - var dnsname = config.domains[i].dns;
246 - if (args.tlsoffload == true) {
190 + for (i = 0; i < config.domains.length; i++) {
191 + if ((i != "") && (config.domains[i] != null) && (config.domains[i].dns != null)) {
192 + dnsname = config.domains[i].dns;
193 + if (args.tlsoffload === true) {
194 // If the web certificate already exist, load it. Load just the certificate since we are in TLS offload situation
248 - if (obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'))) {
249 - r.dns[i] = { cert: obj.fs.readFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'), 'utf8') };
195 + if (obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt"))) {
196 + r.dns[i] = { cert: obj.fs.readFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt"), "utf8") };
197 config.domains[i].certs = r.dns[i];
198 } else {
252 - console.log('WARNING: File "webserver-' + i + '-cert-public.crt" missing, domain "' + i + '" will not work correctly.');
199 + console.log("WARNING: File \"webserver-" + i + "-cert-public.crt\" missing, domain \"" + i + "\" will not work correctly.");
200 }
201 } else {
202 // If the web certificate already exist, load it. Load both certificate and private key
256 - if (obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-private.key'))) {
257 - r.dns[i] = { cert: obj.fs.readFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'), 'utf8'), key: obj.fs.readFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-private.key'), 'utf8') };
203 + if (obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-private.key"))) {
204 + r.dns[i] = { cert: obj.fs.readFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-private.key"), "utf8") };
205 config.domains[i].certs = r.dns[i];
206 // If CA certificates are present, load them
260 - var caok, caindex = 1, calist = [];
207 + caindex = 1;
208 + r.dns[i].ca = [];
209 do {
210 caok = false;
263 - if (obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-chain' + caindex + '.crt'))) {
264 - var caCertificate = obj.fs.readFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-chain' + caindex + '.crt'), 'utf8');
265 - calist.push(caCertificate);
211 + if (obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-chain" + caindex + ".crt"))) {
212 + r.dns[i].ca.push(obj.fs.readFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-chain" + caindex + ".crt"), "utf8"));
213 caok = true;
214 }
215 caindex++;
269 - } while (caok == true);
270 - r.dns[i].ca = calist;
216 + } while (caok === true);
217 } else {
218 rcountmax++; // This certificate must be generated
219 }
@@ -275,205 +221,201 @@ module.exports.CertificateOperations = function () {
221 }
222 }
223
278 - if (rcount == rcountmax) {
224 + if (rcount === rcountmax) {
225 // Fetch the Intel AMT console name
280 - var consoleCertificate = obj.pki.certificateFromPem(r.console.cert);
281 - r.AmtConsoleName = consoleCertificate.subject.getField('CN').value;
226 + r.AmtConsoleName = obj.pki.certificateFromPem(r.console.cert).subject.getField("CN").value;
227 // Fetch the Intel AMT MPS common name
283 - var mpsCertificate = obj.pki.certificateFromPem(r.mps.cert);
284 - r.AmtMpsName = mpsCertificate.subject.getField('CN').value;
228 + r.AmtMpsName = obj.pki.certificateFromPem(r.mps.cert).subject.getField("CN").value;
229 // Fetch the name of the server
230 var webCertificate = obj.pki.certificateFromPem(r.web.cert);
287 - r.CommonName = webCertificate.subject.getField('CN').value;
288 - r.CommonNames = [ r.CommonName.toLowerCase() ];
289 - var altNames = webCertificate.getExtension('subjectAltName')
290 - if (altNames) { for (var i in altNames.altNames) { r.CommonNames.push(altNames.altNames[i].value.toLowerCase()); } }
231 + r.WebIssuer = webCertificate.issuer.getField("CN").value;
232 + r.CommonName = webCertificate.subject.getField("CN").value;
233 + r.CommonNames = [r.CommonName.toLowerCase()];
234 + var altNames = webCertificate.getExtension("subjectAltName");
235 + if (altNames) { for (i = 0; i < altNames.altNames.length; i++) { r.CommonNames.push(altNames.altNames[i].value.toLowerCase()); } }
236 var rootCertificate = obj.pki.certificateFromPem(r.root.cert);
292 - r.RootName = rootCertificate.subject.getField('CN').value;
237 + r.RootName = rootCertificate.subject.getField("CN").value;
238
294 - if ((certargs == null) && (mpscertargs == null)) { if (func != undefined) { func(r); } return r }; // If no certificate arguments are given, keep the certificate
295 - var xcountry, xcountryField = webCertificate.subject.getField('C');
239 + if ((certargs == null) && (mpscertargs == null)) { if (func != undefined) { func(r); } return r; } // If no certificate arguments are given, keep the certificate
240 + var xcountry, xcountryField = webCertificate.subject.getField("C");
241 if (xcountryField != null) { xcountry = xcountryField.value; }
297 - var xorganization, xorganizationField = webCertificate.subject.getField('O');
242 + var xorganization, xorganizationField = webCertificate.subject.getField("O");
243 if (xorganizationField != null) { xorganization = xorganizationField.value; }
244 if (certargs == null) { commonName = r.CommonName; country = xcountry; organization = xorganization; }
245
246 // Check if we have correct certificates
247 if ((r.CommonNames.indexOf(commonName.toLowerCase()) >= 0) && (r.AmtMpsName == mpsCommonName)) {
248 // Certificate matches what we want, keep it.
304 - if (func != undefined) { func(r); } return r;
249 + if (func !== undefined) { func(r); }
250 + return r;
251 } else {
252 // Check what certificates we really need to re-generate.
253 if ((r.CommonNames.indexOf(commonName.toLowerCase()) < 0)) { forceWebCertGen = 1; }
254 if (r.AmtMpsName != mpsCommonName) { forceMpsCertGen = 1; }
255 }
256 }
311 - console.log('Generating certificates, may take a few minutes...');
312 - parent.updateServerState('state', 'generatingcertificates');
257 + console.log("Generating certificates, may take a few minutes...");
258 + parent.updateServerState("state", "generatingcertificates");
259
260 // If a certificate is missing, but web certificate is present and --cert is not used, set the names to be the same as the web certificate
261 if ((certargs == null) && (r.web != null)) {
262 var webCertificate = obj.pki.certificateFromPem(r.web.cert);
317 - commonName = webCertificate.subject.getField('CN').value;
318 - var xcountryField = webCertificate.subject.getField('C');
263 + commonName = webCertificate.subject.getField("CN").value;
264 + var xcountryField = webCertificate.subject.getField("C");
265 if (xcountryField != null) { country = xcountryField.value; }
320 - var xorganizationField = webCertificate.subject.getField('O');
266 + var xorganizationField = webCertificate.subject.getField("O");
267 if (xorganizationField != null) { organization = xorganizationField.value; }
268 }
269
270 var rootCertAndKey, rootCertificate, rootPrivateKey, rootName;
325 - if (r.root == undefined) {
271 + if (r.root === undefined) {
272 // If the root certificate does not exist, create one
327 - console.log('Generating root certificate...');
328 - rootCertAndKey = obj.GenerateRootCertificate(true, 'MeshCentralRoot', null, null, strongCertificate);
273 + console.log("Generating root certificate...");
274 + rootCertAndKey = obj.GenerateRootCertificate(true, "MeshCentralRoot", null, null, strongCertificate);
275 rootCertificate = obj.pki.certificateToPem(rootCertAndKey.cert);
276 rootPrivateKey = obj.pki.privateKeyToPem(rootCertAndKey.key);
331 - obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-public.crt'), rootCertificate);
332 - obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-private.key'), rootPrivateKey);
277 + obj.fs.writeFileSync(parent.getConfigFilePath("root-cert-public.crt"), rootCertificate);
278 + obj.fs.writeFileSync(parent.getConfigFilePath("root-cert-private.key"), rootPrivateKey);
279 } else {
280 // Keep the root certificate we have
281 rootCertAndKey = { cert: obj.pki.certificateFromPem(r.root.cert), key: obj.pki.privateKeyFromPem(r.root.key) };
336 - rootCertificate = r.root.cert
337 - rootPrivateKey = r.root.key
282 + rootCertificate = r.root.cert;
283 + rootPrivateKey = r.root.key;
284 }
339 - var rootName = rootCertAndKey.cert.subject.getField('CN').value;
285 + var rootName = rootCertAndKey.cert.subject.getField("CN").value;
286
287 // If the web certificate does not exist, create one
288 var webCertAndKey, webCertificate, webPrivateKey;
289 if ((r.web == null) || (forceWebCertGen == 1)) {
344 - console.log('Generating HTTPS certificate...');
290 + console.log("Generating HTTPS certificate...");
291 webCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, commonName, country, organization, null, strongCertificate);
292 webCertificate = obj.pki.certificateToPem(webCertAndKey.cert);
293 webPrivateKey = obj.pki.privateKeyToPem(webCertAndKey.key);
348 - obj.fs.writeFileSync(parent.getConfigFilePath('webserver-cert-public.crt'), webCertificate);
349 - obj.fs.writeFileSync(parent.getConfigFilePath('webserver-cert-private.key'), webPrivateKey);
294 + obj.fs.writeFileSync(parent.getConfigFilePath("webserver-cert-public.crt"), webCertificate);
295 + obj.fs.writeFileSync(parent.getConfigFilePath("webserver-cert-private.key"), webPrivateKey);
296 } else {
297 // Keep the console certificate we have
298 webCertAndKey = { cert: obj.pki.certificateFromPem(r.web.cert), key: obj.pki.privateKeyFromPem(r.web.key) };
353 - webCertificate = r.web.cert
354 - webPrivateKey = r.web.key
299 + webCertificate = r.web.cert;
300 + webPrivateKey = r.web.key;
301 }
302 + var webIssuer = webCertAndKey.cert.issuer.getField("CN").value;
303
304 // If the mesh agent server certificate does not exist, create one
305 var agentCertAndKey, agentCertificate, agentPrivateKey;
306 if (r.agent == null) {
360 - console.log('Generating MeshAgent certificate...');
361 - agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, 'MeshCentralAgentServer', null, strongCertificate);
307 + console.log("Generating MeshAgent certificate...");
308 + agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, "MeshCentralAgentServer", null, strongCertificate);
309 agentCertificate = obj.pki.certificateToPem(agentCertAndKey.cert);
310 agentPrivateKey = obj.pki.privateKeyToPem(agentCertAndKey.key);
364 - obj.fs.writeFileSync(parent.getConfigFilePath('agentserver-cert-public.crt'), agentCertificate);
365 - obj.fs.writeFileSync(parent.getConfigFilePath('agentserver-cert-private.key'), agentPrivateKey);
311 + obj.fs.writeFileSync(parent.getConfigFilePath("agentserver-cert-public.crt"), agentCertificate);
312 + obj.fs.writeFileSync(parent.getConfigFilePath("agentserver-cert-private.key"), agentPrivateKey);
313 } else {
314 // Keep the mesh agent server certificate we have
315 agentCertAndKey = { cert: obj.pki.certificateFromPem(r.agent.cert), key: obj.pki.privateKeyFromPem(r.agent.key) };
369 - agentCertificate = r.agent.cert
370 - agentPrivateKey = r.agent.key
316 + agentCertificate = r.agent.cert;
317 + agentPrivateKey = r.agent.key;
318 }
319
320 // If the Intel AMT MPS certificate does not exist, create one
321 var mpsCertAndKey, mpsCertificate, mpsPrivateKey;
322 if ((r.mps == null) || (forceMpsCertGen == 1)) {
376 - console.log('Generating Intel AMT MPS certificate...');
323 + console.log("Generating Intel AMT MPS certificate...");
324 mpsCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, mpsCommonName, mpsCountry, mpsOrganization, null, false);
325 mpsCertificate = obj.pki.certificateToPem(mpsCertAndKey.cert);
326 mpsPrivateKey = obj.pki.privateKeyToPem(mpsCertAndKey.key);
380 - obj.fs.writeFileSync(parent.getConfigFilePath('mpsserver-cert-public.crt'), mpsCertificate);
381 - obj.fs.writeFileSync(parent.getConfigFilePath('mpsserver-cert-private.key'), mpsPrivateKey);
327 + obj.fs.writeFileSync(parent.getConfigFilePath("mpsserver-cert-public.crt"), mpsCertificate);
328 + obj.fs.writeFileSync(parent.getConfigFilePath("mpsserver-cert-private.key"), mpsPrivateKey);
329 } else {
330 // Keep the console certificate we have
331 mpsCertAndKey = { cert: obj.pki.certificateFromPem(r.mps.cert), key: obj.pki.privateKeyFromPem(r.mps.key) };
385 - mpsCertificate = r.mps.cert
386 - mpsPrivateKey = r.mps.key
332 + mpsCertificate = r.mps.cert;
333 + mpsPrivateKey = r.mps.key;
334 }
335
336 // If the Intel AMT console certificate does not exist, create one
390 - var consoleCertAndKey, consoleCertificate, consolePrivateKey, amtConsoleName = 'MeshCentral';
337 + var consoleCertAndKey, consoleCertificate, consolePrivateKey, amtConsoleName = "MeshCentral";
338 if (r.console == null) {
392 - console.log('Generating Intel AMT console certificate...');
393 - consoleCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, amtConsoleName, country, organization, { name: 'extKeyUsage', clientAuth: true, '2.16.840.1.113741.1.2.1': true, '2.16.840.1.113741.1.2.2': true, '2.16.840.1.113741.1.2.3': true }, false); // Intel AMT Remote, Agent and Activation usages
339 + console.log("Generating Intel AMT console certificate...");
340 + consoleCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, amtConsoleName, country, organization, { name: "extKeyUsage", clientAuth: true, "2.16.840.1.113741.1.2.1": true, "2.16.840.1.113741.1.2.2": true, "2.16.840.1.113741.1.2.3": true }, false); // Intel AMT Remote, Agent and Activation usages
341 consoleCertificate = obj.pki.certificateToPem(consoleCertAndKey.cert);
342 consolePrivateKey = obj.pki.privateKeyToPem(consoleCertAndKey.key);
396 - obj.fs.writeFileSync(parent.getConfigFilePath('amtconsole-cert-public.crt'), consoleCertificate);
397 - obj.fs.writeFileSync(parent.getConfigFilePath('amtconsole-cert-private.key'), consolePrivateKey);
343 + obj.fs.writeFileSync(parent.getConfigFilePath("amtconsole-cert-public.crt"), consoleCertificate);
344 + obj.fs.writeFileSync(parent.getConfigFilePath("amtconsole-cert-private.key"), consolePrivateKey);
345 } else {
346 // Keep the console certificate we have
347 consoleCertAndKey = { cert: obj.pki.certificateFromPem(r.console.cert), key: obj.pki.privateKeyFromPem(r.console.key) };
401 - consoleCertificate = r.console.cert
402 - consolePrivateKey = r.console.key
403 - amtConsoleName = consoleCertAndKey.cert.subject.getField('CN').value;
348 + consoleCertificate = r.console.cert;
349 + consolePrivateKey = r.console.key;
350 + amtConsoleName = consoleCertAndKey.cert.subject.getField("CN").value;
351 }
352
406 - var r = { root: { cert: rootCertificate, key: rootPrivateKey }, web: { cert: webCertificate, key: webPrivateKey, ca: [] }, mps: { cert: mpsCertificate, key: mpsPrivateKey }, agent: { cert: agentCertificate, key: agentPrivateKey }, console: { cert: consoleCertificate, key: consolePrivateKey }, ca: calist, CommonName: commonName, RootName: rootName, AmtConsoleName: amtConsoleName, AmtMpsName: mpsCommonName, dns: {} };
353 + r = { root: { cert: rootCertificate, key: rootPrivateKey }, web: { cert: webCertificate, key: webPrivateKey, ca: [] }, mps: { cert: mpsCertificate, key: mpsPrivateKey }, agent: { cert: agentCertificate, key: agentPrivateKey }, console: { cert: consoleCertificate, key: consolePrivateKey }, ca: calist, CommonName: commonName, RootName: rootName, AmtConsoleName: amtConsoleName, AmtMpsName: mpsCommonName, dns: {}, WebIssuer: webIssuer };
354
355 // Look for domains with DNS names that have no certificates and generated them.
409 - for (var i in config.domains) {
410 - if ((i != '') && (config.domains[i] != null) && (config.domains[i].dns != null)) {
411 - var dnsname = config.domains[i].dns;
356 + for (i = 0; i < config.domains.length; i++) {
357 + if ((i != "") && (config.domains[i] != null) && (config.domains[i].dns != null)) {
358 + dnsname = config.domains[i].dns;
359 if (args.tlsoffload != true) {
360 // If the web certificate does not exist, create it
414 - if ((obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt')) == false) || (obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-private.key')) == false)) {
415 - console.log('Generating HTTPS certificate for ' + i + '...');
361 + if ((obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt")) === false) || (obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-private.key")) === false)) {
362 + console.log("Generating HTTPS certificate for " + i + "...");
363 var xwebCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, dnsname, country, organization, null, strongCertificate);
364 var xwebCertificate = obj.pki.certificateToPem(xwebCertAndKey.cert);
365 var xwebPrivateKey = obj.pki.privateKeyToPem(xwebCertAndKey.key);
419 - obj.fs.writeFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'), xwebCertificate);
420 - obj.fs.writeFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-private.key'), xwebPrivateKey);
366 + obj.fs.writeFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt"), xwebCertificate);
367 + obj.fs.writeFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-private.key"), xwebPrivateKey);
368 r.dns[i] = { cert: xwebCertificate, key: xwebPrivateKey };
369 config.domains[i].certs = r.dns[i];
370
371 // If CA certificates are present, load them
425 - var caok, caindex = 1, calist = [];
372 + caindex = 1;
373 + r.dns[i].ca = [];
374 do {
375 caok = false;
428 - if (obj.fileExists(parent.getConfigFilePath('webserver-' + i + '-cert-chain' + caindex + '.crt'))) {
429 - var caCertificate = obj.fs.readFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-chain' + caindex + '.crt'), 'utf8');
430 - calist.push(caCertificate);
376 + if (obj.fileExists(parent.getConfigFilePath("webserver-" + i + "-cert-chain" + caindex + ".crt"))) {
377 + r.dns[i].ca.push(obj.fs.readFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-chain" + caindex + ".crt"), "utf8"));
378 caok = true;
379 }
380 caindex++;
434 - } while (caok == true);
435 - r.dns[i].ca = calist;
381 + } while (caok === true);
382 }
383 }
384 }
385 }
386
387 // If the swarm server certificate exist, load it (This is an optional certificate)
442 - if (obj.fileExists(parent.getConfigFilePath('swarmserver-cert-public.crt')) && obj.fileExists(parent.getConfigFilePath('swarmserver-cert-private.key'))) {
443 - var swarmServerCertificate = obj.fs.readFileSync(parent.getConfigFilePath('swarmserver-cert-public.crt'), 'utf8');
444 - var swarmServerPrivateKey = obj.fs.readFileSync(parent.getConfigFilePath('swarmserver-cert-private.key'), 'utf8');
445 - r.swarmserver = { cert: swarmServerCertificate, key: swarmServerPrivateKey };
388 + if (obj.fileExists(parent.getConfigFilePath("swarmserver-cert-public.crt")) && obj.fileExists(parent.getConfigFilePath("swarmserver-cert-private.key"))) {
389 + r.swarmserver = { cert: obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-public.crt"), "utf8"), key: obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-private.key"), "utf8") };
390 }
391
392 // If the swarm server root certificate exist, load it (This is an optional certificate)
449 - if (obj.fileExists(parent.getConfigFilePath('swarmserverroot-cert-public.crt'))) {
450 - var swarmServerRootCertificate = obj.fs.readFileSync(parent.getConfigFilePath('swarmserverroot-cert-public.crt'), 'utf8');
451 - r.swarmserverroot = { cert: swarmServerRootCertificate };
393 + if (obj.fileExists(parent.getConfigFilePath("swarmserverroot-cert-public.crt"))) {
394 + r.swarmserverroot = { cert: obj.fs.readFileSync(parent.getConfigFilePath("swarmserverroot-cert-public.crt"), "utf8") };
395 }
396
397 // If CA certificates are present, load them
398 if (r.web != null) {
456 - var caok, caindex = 1, calist = [];
399 + caindex = 1;
400 + r.web.ca = [];
401 do {
402 caok = false;
459 - if (obj.fileExists(parent.getConfigFilePath('webserver-cert-chain' + caindex + '.crt'))) {
460 - var caCertificate = obj.fs.readFileSync(parent.getConfigFilePath('webserver-cert-chain' + caindex + '.crt'), 'utf8');
461 - calist.push(caCertificate);
403 + if (obj.fileExists(parent.getConfigFilePath("webserver-cert-chain" + caindex + ".crt"))) {
404 + r.web.ca.push(obj.fs.readFileSync(parent.getConfigFilePath("webserver-cert-chain" + caindex + ".crt"), "utf8"));
405 caok = true;
406 }
407 caindex++;
465 - } while (caok == true);
466 - r.web.ca = calist;
408 + } while (caok === true);
409 }
410
411 if (func != undefined) { func(r); }
412 return r;
471 - }
413 + };
414
415 // Accelerators, used to dispatch work to other processes
474 - const fork = require('child_process').fork;
475 - const program = require('path').join(__dirname, 'meshaccelerator.js');
476 - const acceleratorTotalCount = require('os').cpus().length;
416 + const fork = require("child_process").fork;
417 + const program = require("path").join(__dirname, "meshaccelerator.js");
418 + const acceleratorTotalCount = require("os").cpus().length;
419 var acceleratorCreateCount = acceleratorTotalCount;
420 var freeAccelerators = [];
421 var pendingAccelerator = [];
@@ -485,9 +427,9 @@ module.exports.CertificateOperations = function () {
427 if (freeAccelerators.length > 0) { return freeAccelerators.pop(); }
428 if (acceleratorCreateCount > 0) {
429 acceleratorCreateCount--;
488 - var accelerator = fork(program, [], { stdio: ['pipe', 'pipe', 'pipe', 'ipc'] });
430 + var accelerator = fork(program, [], { stdio: ["pipe", "pipe", "pipe", "ipc"] });
431 accelerator.accid = acceleratorCreateCount;
490 - accelerator.on('message', function (message) {
432 + accelerator.on("message", function (message) {
433 this.func(this.tag, message);
434 delete this.tag;
435 if (pendingAccelerator.length > 0) {
@@ -496,40 +438,41 @@ module.exports.CertificateOperations = function () {
438 accelerator.send(x);
439 } else { freeAccelerators.push(this); }
440 });
499 - accelerator.send({ action: 'setState', certs: obj.acceleratorCertStore });
441 + accelerator.send({ action: "setState", certs: obj.acceleratorCertStore });
442 return accelerator;
443 +
444 }
445 return null;
503 - }
446 + };
447
505 - // Set the state of the accelerators. This way, we don't have to send certificate & keys to them each time.
448 + // Set the state of the accelerators. This way, we don"t have to send certificate & keys to them each time.
449 obj.acceleratorStart = function (certificates) {
507 - if (obj.acceleratorCertStore != null) { console.error('ERROR: Accelerators can only be started once.'); return; }
450 + if (obj.acceleratorCertStore != null) { console.error("ERROR: Accelerators can only be started once."); return; }
451 obj.acceleratorCertStore = [{ cert: certificates.agent.cert, key: certificates.agent.key }];
452 if (certificates.swarmserver != null) { obj.acceleratorCertStore.push({ cert: certificates.swarmserver.cert, key: certificates.swarmserver.key }); }
510 - }
453 + };
454
455 // Perform any RSA signature, just pass in the private key and data.
456 obj.acceleratorPerformSignature = function (privatekey, data, tag, func) {
457 if (acceleratorTotalCount <= 1) {
458 // No accelerators available
516 - if (typeof privatekey == 'number') { privatekey = obj.acceleratorCertStore[privatekey].key; }
517 - const sign = obj.crypto.createSign('SHA384');
518 - sign.end(new Buffer(data, 'binary'));
519 - func(tag, sign.sign(privatekey).toString('binary'));
459 + if (typeof privatekey == "number") { privatekey = obj.acceleratorCertStore[privatekey].key; }
460 + const sign = obj.crypto.createSign("SHA384");
461 + sign.end(new Buffer(data, "binary"));
462 + func(tag, sign.sign(privatekey).toString("binary"));
463 } else {
464 var acc = obj.getAccelerator();
465 if (acc == null) {
466 // Add to pending accelerator workload
524 - pendingAccelerator.push({ action: 'sign', key: privatekey, data: data, tag: tag });
467 + pendingAccelerator.push({ action: "sign", key: privatekey, data: data, tag: tag });
468 } else {
469 // Send to accelerator now
470 acc.func = func;
471 acc.tag = tag;
529 - acc.send({ action: 'sign', key: privatekey, data: data });
472 + acc.send({ action: "sign", key: privatekey, data: data });
473 }
474 }
532 - }
475 + };
476
477 return obj;
478 };
common.js
+67 -61
@@ -6,86 +6,92 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
11 -const crypto = require('crypto');
17 +const crypto = require("crypto");
18
19 // Binary encoding and decoding functions
14 -module.exports.ReadShort = function(v, p) { return (v.charCodeAt(p) << 8) + v.charCodeAt(p + 1); }
15 -module.exports.ReadShortX = function(v, p) { return (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); }
16 -module.exports.ReadInt = function(v, p) { return (v.charCodeAt(p) * 0x1000000) + (v.charCodeAt(p + 1) << 16) + (v.charCodeAt(p + 2) << 8) + v.charCodeAt(p + 3); } // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.
17 -module.exports.ReadIntX = function(v, p) { return (v.charCodeAt(p + 3) * 0x1000000) + (v.charCodeAt(p + 2) << 16) + (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); }
18 -module.exports.ShortToStr = function(v) { return String.fromCharCode((v >> 8) & 0xFF, v & 0xFF); }
19 -module.exports.ShortToStrX = function(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF); }
20 -module.exports.IntToStr = function(v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); }
21 -module.exports.IntToStrX = function(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF); }
22 -module.exports.MakeToArray = function(v) { if (!v || v == null || typeof v == 'object') return v; return [v]; }
23 -module.exports.SplitArray = function(v) { return v.split(','); }
24 -module.exports.Clone = function(v) { return JSON.parse(JSON.stringify(v)); }
25 -module.exports.IsFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return module.exports.validateString(fname, 1, 4096) && x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })();
20 +module.exports.ReadShort = function (v, p) { return (v.charCodeAt(p) << 8) + v.charCodeAt(p + 1); };
21 +module.exports.ReadShortX = function (v, p) { return (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); };
22 +module.exports.ReadInt = function (v, p) { return (v.charCodeAt(p) * 0x1000000) + (v.charCodeAt(p + 1) << 16) + (v.charCodeAt(p + 2) << 8) + v.charCodeAt(p + 3); }; // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.
23 +module.exports.ReadIntX = function (v, p) { return (v.charCodeAt(p + 3) * 0x1000000) + (v.charCodeAt(p + 2) << 16) + (v.charCodeAt(p + 1) << 8) + v.charCodeAt(p); };
24 +module.exports.ShortToStr = function (v) { return String.fromCharCode((v >> 8) & 0xFF, v & 0xFF); };
25 +module.exports.ShortToStrX = function (v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF); };
26 +module.exports.IntToStr = function (v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); };
27 +module.exports.IntToStrX = function (v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF); };
28 +module.exports.MakeToArray = function (v) { if (!v || v == null || typeof v == "object") return v; return [v]; };
29 +module.exports.SplitArray = function (v) { return v.split(","); };
30 +module.exports.Clone = function (v) { return JSON.parse(JSON.stringify(v)); };
31 +module.exports.IsFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return module.exports.validateString(fname, 1, 4096) && x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); }; })();
32
33 // Move an element from one position in an array to a new position
34 module.exports.ArrayElementMove = function(arr, from, to) { arr.splice(to, 0, arr.splice(from, 1)[0]); };
35
36 // Print object for HTML
31 -module.exports.ObjectToStringEx = function(x, c) {
32 - var r = "";
37 +module.exports.ObjectToStringEx = function (x, c) {
38 + var r = "", i;
39 if (x != 0 && (!x || x == null)) return "(Null)";
34 - if (x instanceof Array) { for (var i in x) { r += '<br />' + gap(c) + "Item #" + i + ": " + module.exports.ObjectToStringEx(x[i], c + 1); } }
35 - else if (x instanceof Object) { for (var i in x) { r += '<br />' + gap(c) + i + " = " + module.exports.ObjectToStringEx(x[i], c + 1); } }
40 + if (x instanceof Array) { for (i in x) { r += '<br />' + gap(c) + "Item #" + i + ": " + module.exports.ObjectToStringEx(x[i], c + 1); } }
41 + else if (x instanceof Object) { for (i in x) { r += '<br />' + gap(c) + i + " = " + module.exports.ObjectToStringEx(x[i], c + 1); } }
42 else { r += x; }
43 return r;
38 -}
44 +};
45
46 // Print object for console
41 -module.exports.ObjectToStringEx2 = function(x, c) {
42 - var r = "";
47 +module.exports.ObjectToStringEx2 = function (x, c) {
48 + var r = "", i;
49 if (x != 0 && (!x || x == null)) return "(Null)";
44 - if (x instanceof Array) { for (var i in x) { r += '\r\n' + gap2(c) + "Item #" + i + ": " + module.exports.ObjectToStringEx2(x[i], c + 1); } }
45 - else if (x instanceof Object) { for (var i in x) { r += '\r\n' + gap2(c) + i + " = " + module.exports.ObjectToStringEx2(x[i], c + 1); } }
50 + if (x instanceof Array) { for (i in x) { r += '\r\n' + gap2(c) + "Item #" + i + ": " + module.exports.ObjectToStringEx2(x[i], c + 1); } }
51 + else if (x instanceof Object) { for (i in x) { r += '\r\n' + gap2(c) + i + " = " + module.exports.ObjectToStringEx2(x[i], c + 1); } }
52 else { r += x; }
53 return r;
48 -}
54 +};
55
56 // Create an ident gap
51 -module.exports.gap = function(c) { var x = ''; for (var i = 0; i < (c * 4) ; i++) { x += '&nbsp;'; } return x; }
52 -module.exports.gap2 = function(c) { var x = ''; for (var i = 0; i < (c * 4) ; i++) { x += ' '; } return x; }
57 +module.exports.gap = function (c) { var x = ''; for (var i = 0; i < (c * 4); i++) { x += '&nbsp;'; } return x; };
58 +module.exports.gap2 = function (c) { var x = ''; for (var i = 0; i < (c * 4); i++) { x += ' '; } return x; };
59
60 // Print an object in html
55 -module.exports.ObjectToString = function(x) { return module.exports.ObjectToStringEx(x, 0); }
56 -module.exports.ObjectToString2 = function(x) { return module.exports.ObjectToStringEx2(x, 0); }
61 +module.exports.ObjectToString = function (x) { return module.exports.ObjectToStringEx(x, 0); };
62 +module.exports.ObjectToString2 = function (x) { return module.exports.ObjectToStringEx2(x, 0); };
63
64 // Convert a hex string to a raw string
59 -module.exports.hex2rstr = function(d) {
65 +module.exports.hex2rstr = function (d) {
66 var r = '', m = ('' + d).match(/../g), t;
61 - while (t = m.shift()) r += String.fromCharCode('0x' + t);
62 - return r
63 -}
67 + while (t = m.shift()) { r += String.fromCharCode('0x' + t); }
68 + return r;
69 +};
70
71 // Convert decimal to hex
66 -module.exports.char2hex = function(i) { return (i + 0x100).toString(16).substr(-2).toUpperCase(); }
72 +module.exports.char2hex = function (i) { return (i + 0x100).toString(16).substr(-2).toUpperCase(); };
73
74 // Convert a raw string to a hex string
69 -module.exports.rstr2hex = function(input) {
75 +module.exports.rstr2hex = function (input) {
76 var r = '', i;
77 for (i = 0; i < input.length; i++) { r += module.exports.char2hex(input.charCodeAt(i)); }
78 return r;
73 -}
79 +};
80
81 // UTF-8 encoding & decoding functions
76 -module.exports.encode_utf8 = function(s) { return unescape(encodeURIComponent(s)); }
77 -module.exports.decode_utf8 = function(s) { return decodeURIComponent(escape(s)); }
82 +module.exports.encode_utf8 = function (s) { return unescape(encodeURIComponent(s)); };
83 +module.exports.decode_utf8 = function (s) { return decodeURIComponent(escape(s)); };
84
85 // Convert a string into a blob
80 -module.exports.data2blob = function(data) {
86 +module.exports.data2blob = function (data) {
87 var bytes = new Array(data.length);
88 for (var i = 0; i < data.length; i++) bytes[i] = data.charCodeAt(i);
89 var blob = new Blob([new Uint8Array(bytes)]);
90 return blob;
85 -}
91 +};
92
93 // Generate random numbers
88 -module.exports.random = function (max) { return Math.floor(Math.random() * max); }
94 +module.exports.random = function (max) { return Math.floor(Math.random() * max); };
95
96 // Split a comma seperated string, ignoring commas in quotes.
97 module.exports.quoteSplit = function (str) {
@@ -93,7 +99,7 @@ module.exports.quoteSplit = function (str) {
99 for (var i in str) { if (str[i] == '"') { quote = (quote + 1) % 2; } if ((str[i] == ',') && (quote == 0)) { tmp = tmp.trim(); result.push(tmp); tmp = ''; } else { tmp += str[i]; } }
100 if (tmp.length > 0) result.push(tmp.trim());
101 return result;
96 -}
102 +};
103
104 // Convert list of "name = value" into object
105 module.exports.parseNameValueList = function (list) {
@@ -107,43 +113,43 @@ module.exports.parseNameValueList = function (list) {
113 }
114 }
115 return result;
110 -}
116 +};
117
118 // Compute the MD5 digest hash for a set of values
119 module.exports.ComputeDigesthash = function (username, password, realm, method, path, qop, nonce, nc, cnonce) {
120 var ha1 = crypto.createHash('md5').update(username + ":" + realm + ":" + password).digest("hex");
121 var ha2 = crypto.createHash('md5').update(method + ":" + path).digest("hex");
122 return crypto.createHash('md5').update(ha1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2).digest("hex");
117 -}
123 +};
124
119 -module.exports.toNumber = function (str) { var x = parseInt(str); if (x == str) return x; return str; }
120 -module.exports.escapeHtml = function (string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;' }[s]; }); }
121 -module.exports.escapeHtmlBreaks = function (string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;', '\r': '<br />', '\n': '' }[s]; }); }
125 +module.exports.toNumber = function (str) { var x = parseInt(str); if (x == str) return x; return str; };
126 +module.exports.escapeHtml = function (string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;' }[s]; }); };
127 +module.exports.escapeHtmlBreaks = function (string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;', '\r': '<br />', '\n': '' }[s]; }); };
128
129 // Lowercase all the names in a object recursively
130 module.exports.objKeysToLower = function (obj) {
131 for (var i in obj) {
132 if (i.toLowerCase() !== i) { obj[i.toLowerCase()] = obj[i]; delete obj[i]; } // LowerCase all key names
133 if (typeof obj[i] == 'object') { module.exports.objKeysToLower(obj[i]); } // LowerCase all key names in the child object
128 - }
134 + }
135 return obj;
130 -}
136 +};
137
138 // Escape and unexcape feild names so there are no invalid characters for MongoDB
133 -module.exports.escapeFieldName = function (name) { return name.split('%').join('%25').split('.').join('%2E').split('$').join('%24'); }
134 -module.exports.unEscapeFieldName = function (name) { return name.split('%2E').join('.').split('%24').join('$').split('%25').join('%'); }
139 +module.exports.escapeFieldName = function (name) { return name.split('%').join('%25').split('.').join('%2E').split('$').join('%24'); };
140 +module.exports.unEscapeFieldName = function (name) { return name.split('%2E').join('.').split('%24').join('$').split('%25').join('%'); };
141
142 // Escape all links
137 -module.exports.escapeLinksFieldName = function (docx) { var doc = module.exports.Clone(docx); if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.escapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } return doc; }
138 -module.exports.unEscapeLinksFieldName = function (doc) { if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } return doc; }
139 -//module.exports.escapeAllLinksFieldName = function (docs) { for (var i in docs) { module.exports.escapeLinksFieldName(docs[i]); } }
140 -module.exports.unEscapeAllLinksFieldName = function (docs) { for (var i in docs) { docs[i] = module.exports.unEscapeLinksFieldName(docs[i]); } }
143 +module.exports.escapeLinksFieldName = function (docx) { var doc = module.exports.Clone(docx); if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.escapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } return doc; };
144 +module.exports.unEscapeLinksFieldName = function (doc) { if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } return doc; };
145 +//module.exports.escapeAllLinksFieldName = function (docs) { for (var i in docs) { module.exports.escapeLinksFieldName(docs[i]); } };
146 +module.exports.unEscapeAllLinksFieldName = function (docs) { for (var i in docs) { docs[i] = module.exports.unEscapeLinksFieldName(docs[i]); } };
147
148 // Validation methods
143 -module.exports.validateString = function(str, minlen, maxlen) { return ((str != null) && (typeof str == 'string') && ((minlen == null) || (str.length >= minlen)) && ((maxlen == null) || (str.length <= maxlen))); }
144 -module.exports.validateInt = function(int, minval, maxval) { return ((int != null) && (typeof int == 'number') && ((minval == null) || (int >= minval)) && ((maxval == null) || (int <= maxval))); }
145 -module.exports.validateArray = function (array, minlen, maxlen) { return ((array != null) && Array.isArray(array) && ((minlen == null) || (array.length >= minlen)) && ((maxlen == null) || (array.length <= maxlen))); }
146 -module.exports.validateStrArray = function (array, minlen, maxlen) { if (((array != null) && Array.isArray(array)) == false) return false; for (var i in array) { if ((typeof array[i] != 'string') && ((minlen == null) || (array[i].length >= minlen)) && ((maxlen == null) || (array[i].length <= maxlen))) return false; } return true; }
147 -module.exports.validateObject = function (obj) { return ((obj != null) && (typeof obj == 'object')); }
148 -module.exports.validateEmail = function (email, minlen, maxlen) { if (module.exports.validateString(email, minlen, maxlen) == false) return false; var emailReg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailReg.test(email); }
149 -module.exports.validateUsername = function (username, minlen, maxlen) { return (module.exports.validateString(username, minlen, maxlen) && (username.indexOf(' ') == -1)); }
\ No newline at end of file
149 +module.exports.validateString = function (str, minlen, maxlen) { return ((str != null) && (typeof str == 'string') && ((minlen == null) || (str.length >= minlen)) && ((maxlen == null) || (str.length <= maxlen))); };
150 +module.exports.validateInt = function (int, minval, maxval) { return ((int != null) && (typeof int == 'number') && ((minval == null) || (int >= minval)) && ((maxval == null) || (int <= maxval))); };
151 +module.exports.validateArray = function (array, minlen, maxlen) { return ((array != null) && Array.isArray(array) && ((minlen == null) || (array.length >= minlen)) && ((maxlen == null) || (array.length <= maxlen))); };
152 +module.exports.validateStrArray = function (array, minlen, maxlen) { if (((array != null) && Array.isArray(array)) == false) return false; for (var i in array) { if ((typeof array[i] != 'string') && ((minlen == null) || (array[i].length >= minlen)) && ((maxlen == null) || (array[i].length <= maxlen))) return false; } return true; };
153 +module.exports.validateObject = function (obj) { return ((obj != null) && (typeof obj == 'object')); };
154 +module.exports.validateEmail = function (email, minlen, maxlen) { if (module.exports.validateString(email, minlen, maxlen) == false) return false; var emailReg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailReg.test(email); };
155 +module.exports.validateUsername = function (username, minlen, maxlen) { return (module.exports.validateString(username, minlen, maxlen) && (username.indexOf(' ') == -1)); };
\ No newline at end of file
db.js
+43 -36
@@ -6,7 +6,13 @@
6 * @version v0.0.2
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
17 //
18 // Construct Meshcentral database object
@@ -21,6 +27,7 @@
27 //
28 module.exports.CreateDB = function (parent) {
29 var obj = {};
30 + var Datastore = null;
31 obj.path = require('path');
32 obj.parent = parent;
33 obj.identifier = null;
@@ -28,7 +35,7 @@ module.exports.CreateDB = function (parent) {
35 if (obj.parent.args.mongodb) {
36 // Use MongoDB
37 obj.databaseType = 2;
31 - var Datastore = require('mongojs');
38 + Datastore = require('mongojs');
39 var db = Datastore(obj.parent.args.mongodb);
40 var dbcollection = 'meshcentral';
41 if (obj.parent.args.mongodbcol) { dbcollection = obj.parent.args.mongodbcol; }
@@ -36,11 +43,11 @@ module.exports.CreateDB = function (parent) {
43 } else {
44 // Use NeDB (The default)
45 obj.databaseType = 1;
39 - var Datastore = require('nedb');
46 + Datastore = require('nedb');
47 obj.file = new Datastore({ filename: obj.parent.getConfigFilePath('meshcentral.db'), autoload: true });
48 obj.file.persistence.setAutocompactionInterval(3600);
49 }
43 -
50 +
51 obj.SetupDatabase = function (func) {
52 // Check if the database unique identifier is present
53 // This is used to check that in server peering mode, everyone is using the same database.
@@ -64,7 +71,7 @@ module.exports.CreateDB = function (parent) {
71
72 func(ver);
73 });
67 - }
74 + };
75
76 obj.cleanup = function () {
77 // TODO: Remove all mesh links to invalid users
@@ -83,41 +90,41 @@ module.exports.CreateDB = function (parent) {
90 for (var i in docs) { if (docs[i].subscriptions != null) { console.log('Clean user: ' + docs[i].name); obj.SetUser(docs[i]); } } // Remove "subscriptions" that should not be there.
91 });
92 */
86 - }
93 + };
94
88 - obj.Set = function (data, func) { obj.file.update({ _id: data._id }, data, { upsert: true }, func); }
89 - obj.Get = function (id, func) { obj.file.find({ _id: id }, func); }
90 - obj.GetAll = function (func) { obj.file.find({}, func); }
91 - obj.GetAllTypeNoTypeField = function (type, domain, func) { obj.file.find({ type: type, domain: domain }, { type : 0 }, func); }
92 - obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, domain, type, func) { obj.file.find({ type: type, domain: domain, meshid: { $in: meshes } }, { type : 0 }, func); }
93 - obj.GetAllType = function (type, func) { obj.file.find({ type: type }, func); }
94 - obj.GetAllIdsOfType = function (ids, domain, type, func) { obj.file.find({ type: type, domain: domain, _id: { $in: ids } }, func); }
95 - obj.GetUserWithEmail = function (domain, email, func) { obj.file.find({ type: 'user', domain: domain, email: email }, { type: 0 }, func); }
96 - obj.GetUserWithVerifiedEmail = function (domain, email, func) { obj.file.find({ type: 'user', domain: domain, email: email, emailVerified: true }, { type: 0 }, func); }
97 - obj.Remove = function (id) { obj.file.remove({ _id: id }); }
98 - obj.RemoveNode = function (id) { obj.file.remove({ node: id }, { multi: true }); }
99 - obj.RemoveAll = function (func) { obj.file.remove({}, { multi: true }, func); }
100 - obj.RemoveAllOfType = function (type, func) { obj.file.remove({ type: type }, { multi: true }, func); }
101 - obj.InsertMany = function (data, func) { obj.file.insert(data, func); }
102 - obj.StoreEvent = function (ids, source, event) { obj.file.insert(event); }
103 - obj.GetEvents = function (ids, domain, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).exec(func); } else { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }, func) } }
104 - obj.GetEventsWithLimit = function (ids, domain, limit, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); } }
105 - obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'event', domain: domain, nodeid: nodeid }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.file.find({ type: 'event', domain: domain, nodeid: nodeid }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); } }
106 - obj.RemoveMesh = function (id) { obj.file.remove({ mesh: id }, { multi: true }); obj.file.remove({ _id: id }); obj.file.remove({ _id: 'nt' + id }); }
107 - obj.RemoveAllEvents = function (domain) { obj.file.remove({ type: 'event', domain: domain }, { multi: true }); }
108 - obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if (docs.length == 1) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); }
109 - obj.DeleteDomain = function (domain, func) { obj.file.remove({ domain: domain }, { multi: true }, func); }
110 - obj.SetUser = function(user) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); }
111 - obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } }
112 - obj.clearOldEntries = function (type, days, domain) { var cutoff = Date.now() - (1000 * 60 * 60 * 24 * days); obj.file.remove({ type: type, time: { $lt: cutoff } }, { multi: true }); }
113 - obj.getPowerTimeline = function (nodeid, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'power', node: { $in: ['*', nodeid] } }).sort({ time: 1 }).exec(func); } else { obj.file.find({ type: 'power', node: { $in: ['*', nodeid] } }).sort({ time: 1 }, func); } }
114 - obj.getLocalAmtNodes = function (func) { obj.file.find({ type: 'node', host: { $exists: true, $ne: null }, intelamt: { $exists: true } }, func); }
115 - obj.getAmtUuidNode = function (meshid, uuid, func) { obj.file.find({ type: 'node', meshid: meshid, 'intelamt.uuid': uuid }, func); }
95 + obj.Set = function (data, func) { obj.file.update({ _id: data._id }, data, { upsert: true }, func); };
96 + obj.Get = function (id, func) { obj.file.find({ _id: id }, func); };
97 + obj.GetAll = function (func) { obj.file.find({}, func); };
98 + obj.GetAllTypeNoTypeField = function (type, domain, func) { obj.file.find({ type: type, domain: domain }, { type: 0 }, func); };
99 + obj.GetAllTypeNoTypeFieldMeshFiltered = function (meshes, domain, type, func) { obj.file.find({ type: type, domain: domain, meshid: { $in: meshes } }, { type: 0 }, func); };
100 + obj.GetAllType = function (type, func) { obj.file.find({ type: type }, func); };
101 + obj.GetAllIdsOfType = function (ids, domain, type, func) { obj.file.find({ type: type, domain: domain, _id: { $in: ids } }, func); };
102 + obj.GetUserWithEmail = function (domain, email, func) { obj.file.find({ type: 'user', domain: domain, email: email }, { type: 0 }, func); };
103 + obj.GetUserWithVerifiedEmail = function (domain, email, func) { obj.file.find({ type: 'user', domain: domain, email: email, emailVerified: true }, { type: 0 }, func); };
104 + obj.Remove = function (id) { obj.file.remove({ _id: id }); };
105 + obj.RemoveNode = function (id) { obj.file.remove({ node: id }, { multi: true }); };
106 + obj.RemoveAll = function (func) { obj.file.remove({}, { multi: true }, func); };
107 + obj.RemoveAllOfType = function (type, func) { obj.file.remove({ type: type }, { multi: true }, func); };
108 + obj.InsertMany = function (data, func) { obj.file.insert(data, func); };
109 + obj.StoreEvent = function (ids, source, event) { obj.file.insert(event); };
110 + obj.GetEvents = function (ids, domain, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).exec(func); } else { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }, func); } };
111 + obj.GetEventsWithLimit = function (ids, domain, limit, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.file.find({ type: 'event', domain: domain, ids: { $in: ids } }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); } };
112 + obj.GetNodeEventsWithLimit = function (nodeid, domain, limit, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'event', domain: domain, nodeid: nodeid }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit).exec(func); } else { obj.file.find({ type: 'event', domain: domain, nodeid: nodeid }, { type: 0, _id: 0, domain: 0, ids: 0, node: 0 }).sort({ time: -1 }).limit(limit, func); } };
113 + obj.RemoveMesh = function (id) { obj.file.remove({ mesh: id }, { multi: true }); obj.file.remove({ _id: id }); obj.file.remove({ _id: 'nt' + id }); };
114 + obj.RemoveAllEvents = function (domain) { obj.file.remove({ type: 'event', domain: domain }, { multi: true }); };
115 + obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if (docs.length == 1) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); };
116 + obj.DeleteDomain = function (domain, func) { obj.file.remove({ domain: domain }, { multi: true }, func); };
117 + obj.SetUser = function (user) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); };
118 + obj.dispose = function () { for (var x in obj) { if (obj[x].close) { obj[x].close(); } delete obj[x]; } };
119 + obj.clearOldEntries = function (type, days, domain) { var cutoff = Date.now() - (1000 * 60 * 60 * 24 * days); obj.file.remove({ type: type, time: { $lt: cutoff } }, { multi: true }); };
120 + obj.getPowerTimeline = function (nodeid, func) { if (obj.databaseType == 1) { obj.file.find({ type: 'power', node: { $in: ['*', nodeid] } }).sort({ time: 1 }).exec(func); } else { obj.file.find({ type: 'power', node: { $in: ['*', nodeid] } }).sort({ time: 1 }, func); } };
121 + obj.getLocalAmtNodes = function (func) { obj.file.find({ type: 'node', host: { $exists: true, $ne: null }, intelamt: { $exists: true } }, func); };
122 + obj.getAmtUuidNode = function (meshid, uuid, func) { obj.file.find({ type: 'node', meshid: meshid, 'intelamt.uuid': uuid }, func); };
123
124 // This is used to rate limit a number of operation per day. Returns a startValue each new days, but you can substract it and save the value in the db.
118 - obj.getValueOfTheDay = function (id, startValue, func) { obj.Get(id, function (err, docs) { var date = new Date(), t = date.toLocaleDateString(); if (docs.length == 1) { var r = docs[0]; if (r.day == t) { func({ _id: id, value: r.value, day: t }); return; } } func({ _id: id, value: startValue, day: t }); }); }
125 + obj.getValueOfTheDay = function (id, startValue, func) { obj.Get(id, function (err, docs) { var date = new Date(), t = date.toLocaleDateString(); if (docs.length == 1) { var r = docs[0]; if (r.day == t) { func({ _id: id, value: r.value, day: t }); return; } } func({ _id: id, value: startValue, day: t }); }); };
126
127 function Clone(v) { return JSON.parse(JSON.stringify(v)); }
128
129 return obj;
123 -}
\ No newline at end of file
130 +};
\ No newline at end of file
exeHandler.js
+13 -8
@@ -14,7 +14,13 @@ See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 -'use strict';
17 +/*xjslint node: true */
18 +/*xjslint plusplus: true */
19 +/*xjslint maxlen: 256 */
20 +/*jshint node: true */
21 +/*jshint strict: false */
22 +/*jshint esversion: 6 */
23 +"use strict";
24
25 const exeJavaScriptGuid = 'B996015880544A19B7F7E9BE44914C18';
26 const exeMeshPolicyGuid = 'B996015880544A19B7F7E9BE44914C19';
@@ -59,7 +65,7 @@ module.exports.streamExeWithJavaScript = function (options) {
65 } else {
66 throw ('js content not specified');
67 }
62 -}
68 +};
69
70
71 // Changes a Windows Executable to add the MSH inside of it.
@@ -144,7 +150,7 @@ module.exports.streamExeWithMeshPolicy = function (options) {
150 });
151 options.destinationStream.sourceStream.pipe(options.destinationStream, { end: false });
152 }
147 -}
153 +};
154
155
156 // Return information about this executable
@@ -157,6 +163,7 @@ module.exports.parseWindowsExecutable = function (exePath) {
163 var dosHeader = Buffer.alloc(64);
164 var ntHeader = Buffer.alloc(24);
165 var optHeader;
166 + var numRVA;
167
168 // Read the DOS header
169 bytesRead = fs.readSync(fd, dosHeader, 0, 64, 0);
@@ -185,7 +192,6 @@ module.exports.parseWindowsExecutable = function (exePath) {
192 // Read the optional header
193 optHeader = Buffer.alloc(ntHeader.readUInt16LE(20));
194 bytesRead = fs.readSync(fd, optHeader, 0, optHeader.length, dosHeader.readUInt32LE(60) + 24);
188 - var numRVA = undefined;
195
196 retVal.CheckSumPos = dosHeader.readUInt32LE(60) + 24 + 64;
197 retVal.SizeOfCode = optHeader.readUInt32LE(4);
@@ -223,7 +229,7 @@ module.exports.parseWindowsExecutable = function (exePath) {
229 }
230 fs.closeSync(fd);
231 return (retVal);
226 -}
232 +};
233
234
235 //
@@ -254,8 +260,7 @@ module.exports.hashExecutableFile = function (options) {
260 // Setup initial state
261 options.state = { endIndex: 0, checkSumIndex: 0, tableIndex: 0, stats: fs.statSync(options.sourcePath) };
262
257 - if (options.platform == 'win32')
258 - {
263 + if (options.platform == 'win32') {
264 if (options.peinfo.CertificateTableAddress != 0) { options.state.endIndex = options.peinfo.CertificateTableAddress; }
265 options.state.tableIndex = options.peinfo.CertificateTableSizePos - 4;
266 options.state.checkSumIndex = options.peinfo.CheckSumPos;
@@ -299,4 +304,4 @@ module.exports.hashExecutableFile = function (options) {
304 options.state.source = fs.createReadStream(options.sourcePath, { flags: 'r', start: 0, end: options.state.endIndex - 1 });
305 options.state.source.pipe(options.targetStream);
306 }
302 -}
307 +};
interceptor.js
+83 -73
@@ -6,29 +6,35 @@
6 * @version v0.0.3
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
11 -const crypto = require('crypto');
12 -const common = require('./common.js');
17 +const crypto = require("crypto");
18 +const common = require("./common.js");
19
20 var HttpInterceptorAuthentications = {};
15 -var RedirInterceptorAuthentications = {};
21 +//var RedirInterceptorAuthentications = {};
22
23 // Construct a HTTP interceptor object
24 module.exports.CreateHttpInterceptor = function (args) {
25 var obj = {};
20 -
26 +
27 // Create a random hex string of a given length
22 - obj.randomValueHex = function (len) { return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); }
28 + obj.randomValueHex = function (len) { return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); };
29
30 obj.args = args;
31 obj.amt = { acc: "", mode: 0, count: 0, error: false }; // mode: 0:Header, 1:LengthBody, 2:ChunkedBody, 3:UntilClose
32 obj.ws = { acc: "", mode: 0, count: 0, error: false, authCNonce: obj.randomValueHex(10), authCNonceCount: 1 };
33 obj.blockAmtStorage = false;
28 -
34 +
35 // Private method
30 - obj.Debug = function (msg) { console.log(msg); }
31 -
36 + obj.Debug = function (msg) { console.log(msg); };
37 +
38 // Process data coming from Intel AMT
39 obj.processAmtData = function (data) {
40 obj.amt.acc += data; // Add data to accumulator
@@ -39,13 +45,14 @@ module.exports.CreateHttpInterceptor = function (args) {
45 data += obj.processAmtDataEx();
46 } while (datalen != data.length); // Process as much data as possible
47 return data;
42 - }
43 -
48 + };
49 +
50 // Process data coming from AMT in the accumulator
51 obj.processAmtDataEx = function () {
52 + var i, r, headerend;
53 if (obj.amt.mode == 0) { // Header Mode
54 // Decode the HTTP header
48 - var headerend = obj.amt.acc.indexOf('\r\n\r\n');
55 + headerend = obj.amt.acc.indexOf('\r\n\r\n');
56 if (headerend < 0) return "";
57 var headerlines = obj.amt.acc.substring(0, headerend).split('\r\n');
58 obj.amt.acc = obj.amt.acc.substring(headerend + 4);
@@ -53,7 +60,7 @@ module.exports.CreateHttpInterceptor = function (args) {
60 var headers = headerlines.slice(1);
61 obj.amt.headers = {};
62 obj.amt.mode = 3; // UntilClose
56 - for (var i in headers) {
63 + for (i in headers) {
64 var j = headers[i].indexOf(':');
65 if (j > 0) {
66 var v1 = headers[i].substring(0, j).trim().toLowerCase();
@@ -73,46 +80,46 @@ module.exports.CreateHttpInterceptor = function (args) {
80 }
81 }
82 }
76 -
83 +
84 // Reform the HTTP header
78 - var r = obj.amt.directive.join(' ') + '\r\n';
79 - for (var i in obj.amt.headers) { r += (i + ': ' + obj.amt.headers[i] + '\r\n'); }
85 + r = obj.amt.directive.join(' ') + '\r\n';
86 + for (i in obj.amt.headers) { r += (i + ': ' + obj.amt.headers[i] + '\r\n'); }
87 r += '\r\n';
88 return r;
89 } else if (obj.amt.mode == 1) { // Length Body Mode
90 // Send the body of content-length size
91 var rl = obj.amt.count;
92 if (rl < obj.amt.acc.length) rl = obj.amt.acc.length;
86 - var r = obj.amt.acc.substring(0, rl);
93 + r = obj.amt.acc.substring(0, rl);
94 obj.amt.acc = obj.amt.acc.substring(rl);
95 obj.amt.count -= rl;
96 if (obj.amt.count == 0) { obj.amt.mode = 0; }
97 return r;
98 } else if (obj.amt.mode == 2) { // Chunked Body Mode
99 // Send data one chunk at a time
93 - var headerend = obj.amt.acc.indexOf('\r\n');
100 + headerend = obj.amt.acc.indexOf('\r\n');
101 if (headerend < 0) return "";
102 var chunksize = parseInt(obj.amt.acc.substring(0, headerend), 16);
103 if ((chunksize == 0) && (obj.amt.acc.length >= headerend + 4)) {
104 // Send the ending chunk (NOTE: We do not support trailing headers)
98 - var r = obj.amt.acc.substring(0, headerend + 4);
105 + r = obj.amt.acc.substring(0, headerend + 4);
106 obj.amt.acc = obj.amt.acc.substring(headerend + 4);
107 obj.amt.mode = 0;
108 return r;
109 } else if ((chunksize > 0) && (obj.amt.acc.length >= (headerend + 4 + chunksize))) {
110 // Send a chunk
104 - var r = obj.amt.acc.substring(0, headerend + chunksize + 4);
111 + r = obj.amt.acc.substring(0, headerend + chunksize + 4);
112 obj.amt.acc = obj.amt.acc.substring(headerend + chunksize + 4);
113 return r;
114 }
115 } else if (obj.amt.mode == 3) { // Until Close Mode
109 - var r = obj.amt.acc;
116 + r = obj.amt.acc;
117 obj.amt.acc = "";
118 return r;
119 }
120 return "";
114 - }
115 -
121 + };
122 +
123 // Process data coming from the Browser
124 obj.processBrowserData = function (data) {
125 obj.ws.acc += data; // Add data to accumulator
@@ -123,13 +130,14 @@ module.exports.CreateHttpInterceptor = function (args) {
130 data += obj.processBrowserDataEx();
131 } while (datalen != data.length); // Process as much data as possible
132 return data;
126 - }
127 -
133 + };
134 +
135 // Process data coming from the Browser in the accumulator
136 obj.processBrowserDataEx = function () {
137 + var i, r, headerend;
138 if (obj.ws.mode == 0) { // Header Mode
139 // Decode the HTTP header
132 - var headerend = obj.ws.acc.indexOf('\r\n\r\n');
140 + headerend = obj.ws.acc.indexOf('\r\n\r\n');
141 if (headerend < 0) return "";
142 var headerlines = obj.ws.acc.substring(0, headerend).split('\r\n');
143 obj.ws.acc = obj.ws.acc.substring(headerend + 4);
@@ -139,7 +147,7 @@ module.exports.CreateHttpInterceptor = function (args) {
147 var headers = headerlines.slice(1);
148 obj.ws.headers = {};
149 obj.ws.mode = 3; // UntilClose
142 - for (var i in headers) {
150 + for (i in headers) {
151 var j = headers[i].indexOf(':');
152 if (j > 0) {
153 var v1 = headers[i].substring(0, j).trim().toLowerCase();
@@ -159,14 +167,14 @@ module.exports.CreateHttpInterceptor = function (args) {
167 }
168 }
169 }
162 -
170 +
171 // Insert authentication
172 if (obj.args.user && obj.args.pass && HttpInterceptorAuthentications[obj.args.host + ':' + obj.args.port]) {
173 // We have authentication data, lets use it.
174 var AuthArgs = obj.GetAuthArgs(HttpInterceptorAuthentications[obj.args.host + ':' + obj.args.port]);
175 var hash = obj.ComputeDigesthash(obj.args.user, obj.args.pass, AuthArgs.realm, obj.ws.directive[0], obj.ws.directive[1], AuthArgs.qop, AuthArgs.nonce, obj.ws.authCNonceCount, obj.ws.authCNonce);
176 var authstr = 'Digest username="' + obj.args.user + '",realm="' + AuthArgs.realm + '",nonce="' + AuthArgs.nonce + '",uri="' + obj.ws.directive[1] + '",qop=' + AuthArgs.qop + ',nc=' + obj.ws.authCNonceCount + ',cnonce="' + obj.ws.authCNonce + '",response="' + hash + '"';
169 - if (AuthArgs.opaque) { authstr += ',opaque="' + AuthArgs.opaque + '"'}
177 + if (AuthArgs.opaque) { authstr += (',opaque="' + AuthArgs.opaque + '"'); }
178 obj.ws.headers.authorization = authstr;
179 obj.ws.authCNonceCount++;
180 } else {
@@ -175,27 +183,27 @@ module.exports.CreateHttpInterceptor = function (args) {
183 }
184
185 // Reform the HTTP header
178 - var r = obj.ws.directive.join(' ') + '\r\n';
179 - for (var i in obj.ws.headers) { r += (i + ': ' + obj.ws.headers[i] + '\r\n'); }
186 + r = obj.ws.directive.join(' ') + '\r\n';
187 + for (i in obj.ws.headers) { r += (i + ': ' + obj.ws.headers[i] + '\r\n'); }
188 r += '\r\n';
189 return r;
190 } else if (obj.ws.mode == 1) { // Length Body Mode
191 // Send the body of content-length size
192 var rl = obj.ws.count;
193 if (rl < obj.ws.acc.length) rl = obj.ws.acc.length;
186 - var r = obj.ws.acc.substring(0, rl);
194 + r = obj.ws.acc.substring(0, rl);
195 obj.ws.acc = obj.ws.acc.substring(rl);
196 obj.ws.count -= rl;
197 if (obj.ws.count == 0) { obj.ws.mode = 0; }
198 return r;
199 } else if (obj.amt.mode == 2) { // Chunked Body Mode
200 // Send data one chunk at a time
193 - var headerend = obj.amt.acc.indexOf('\r\n');
201 + headerend = obj.amt.acc.indexOf('\r\n');
202 if (headerend < 0) return "";
203 var chunksize = parseInt(obj.amt.acc.substring(0, headerend), 16);
204 if (isNaN(chunksize)) { // TODO: Check this path
205 // Chunk is not in this batch, move one
198 - var r = obj.amt.acc.substring(0, headerend + 2);
206 + r = obj.amt.acc.substring(0, headerend + 2);
207 obj.amt.acc = obj.amt.acc.substring(headerend + 2);
208 // Peek if we next is the end of chunked transfer
209 headerend = obj.amt.acc.indexOf('\r\n');
@@ -206,24 +214,24 @@ module.exports.CreateHttpInterceptor = function (args) {
214 return r;
215 } else if (chunksize == 0 && obj.amt.acc.length >= headerend + 4) {
216 // Send the ending chunk (NOTE: We do not support trailing headers)
209 - var r = obj.amt.acc.substring(0, headerend + 4);
217 + r = obj.amt.acc.substring(0, headerend + 4);
218 obj.amt.acc = obj.amt.acc.substring(headerend + 4);
219 obj.amt.mode = 0;
220 return r;
221 } else if (chunksize > 0 && obj.amt.acc.length >= headerend + 4) {
222 // Send a chunk
215 - var r = obj.amt.acc.substring(0, headerend + chunksize + 4);
223 + r = obj.amt.acc.substring(0, headerend + chunksize + 4);
224 obj.amt.acc = obj.amt.acc.substring(headerend + chunksize + 4);
225 return r;
226 }
227 } else if (obj.ws.mode == 3) { // Until Close Mode
220 - var r = obj.ws.acc;
228 + r = obj.ws.acc;
229 obj.ws.acc = "";
230 return r;
231 }
232 return "";
225 - }
226 -
233 + };
234 +
235 // Parse authentication values from the HTTP header
236 obj.GetAuthArgs = function (authheader) {
237 var authargs = {};
@@ -233,42 +241,42 @@ module.exports.CreateHttpInterceptor = function (args) {
241 var i = argstr.indexOf('=');
242 var k = argstr.substring(0, i).trim().toLowerCase();
243 var v = argstr.substring(i + 1).trim();
236 - if (v.substring(0,1) == '\"') { v = v.substring(1, v.length - 1); }
244 + if (v.substring(0, 1) == '\"') { v = v.substring(1, v.length - 1); }
245 if (i > 0) authargs[k] = v;
246 }
247 return authargs;
240 - }
241 -
248 + };
249 +
250 // Compute the MD5 digest hash for a set of values
251 obj.ComputeDigesthash = function (username, password, realm, method, path, qop, nonce, nc, cnonce) {
252 var ha1 = crypto.createHash('md5').update(username + ":" + realm + ":" + password).digest("hex");
253 var ha2 = crypto.createHash('md5').update(method + ":" + path).digest("hex");
254 return crypto.createHash('md5').update(ha1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2).digest("hex");
247 - }
248 -
255 + };
256 +
257 return obj;
250 -}
258 +};
259
260
261 // Construct a redirection interceptor object
262 module.exports.CreateRedirInterceptor = function (args) {
263 var obj = {};
256 -
264 +
265 // Create a random hex string of a given length
258 - obj.randomValueHex = function (len) { return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); }
266 + obj.randomValueHex = function (len) { return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); };
267
268 obj.args = args;
261 - obj.amt = { acc: "", mode: 0, count: 0, error: false, direct: false};
262 - obj.ws = { acc: "", mode: 0, count: 0, error: false, direct: false, authCNonce: obj.randomValueHex(10), authCNonceCount: 1 };
263 -
269 + obj.amt = { acc: "", mode: 0, count: 0, error: false, direct: false };
270 + obj.ws = { acc: "", mode: 0, count: 0, error: false, direct: false, authCNonce: obj.randomValueHex(10), authCNonceCount: 1 };
271 +
272 obj.RedirectCommands = { StartRedirectionSession: 0x10, StartRedirectionSessionReply: 0x11, EndRedirectionSession: 0x12, AuthenticateSession: 0x13, AuthenticateSessionReply: 0x14 };
273 obj.StartRedirectionSessionReplyStatus = { SUCCESS: 0, TYPE_UNKNOWN: 1, BUSY: 2, UNSUPPORTED: 3, ERROR: 0xFF };
274 obj.AuthenticationStatus = { SUCCESS: 0, FALIURE: 1, NOTSUPPORTED: 2 };
275 obj.AuthenticationType = { QUERY: 0, USERPASS: 1, KERBEROS: 2, BADDIGEST: 3, DIGEST: 4 };
276
277 // Private method
270 - obj.Debug = function (msg) { console.log(msg); }
271 -
278 + obj.Debug = function (msg) { console.log(msg); };
279 +
280 // Process data coming from Intel AMT
281 obj.processAmtData = function (data) {
282 obj.amt.acc += data; // Add data to accumulator
@@ -276,10 +284,11 @@ module.exports.CreateRedirInterceptor = function (args) {
284 var datalen = 0;
285 do { datalen = data.length; data += obj.processAmtDataEx(); } while (datalen != data.length); // Process as much data as possible
286 return data;
279 - }
280 -
287 + };
288 +
289 // Process data coming from AMT in the accumulator
290 obj.processAmtDataEx = function () {
291 + var r;
292 if (obj.amt.acc.length == 0) return "";
293 if (obj.amt.direct == true) {
294 var data = obj.amt.acc;
@@ -294,7 +303,7 @@ module.exports.CreateRedirInterceptor = function (args) {
303 if (obj.amt.acc.length < 13) return "";
304 var oemlen = obj.amt.acc.charCodeAt(12);
305 if (obj.amt.acc.length < 13 + oemlen) return "";
297 - var r = obj.amt.acc.substring(0, 13 + oemlen);
306 + r = obj.amt.acc.substring(0, 13 + oemlen);
307 obj.amt.acc = obj.amt.acc.substring(13 + oemlen);
308 return r;
309 }
@@ -306,7 +315,7 @@ module.exports.CreateRedirInterceptor = function (args) {
315 if (obj.amt.acc.length < 9 + l) return "";
316 var authstatus = obj.amt.acc.charCodeAt(1);
317 var authType = obj.amt.acc.charCodeAt(4);
309 -
318 +
319 if (authType == obj.AuthenticationType.DIGEST && authstatus == obj.AuthenticationStatus.FALIURE) {
320 // Grab and keep all authentication parameters
321 var realmlen = obj.amt.acc.charCodeAt(9);
@@ -322,7 +331,7 @@ module.exports.CreateRedirInterceptor = function (args) {
331 obj.amt.direct = true;
332 }
333
325 - var r = obj.amt.acc.substring(0, 9 + l);
334 + r = obj.amt.acc.substring(0, 9 + l);
335 obj.amt.acc = obj.amt.acc.substring(9 + l);
336 return r;
337 }
@@ -333,8 +342,8 @@ module.exports.CreateRedirInterceptor = function (args) {
342 }
343 }
344 return "";
336 - }
337 -
345 + };
346 +
347 // Process data coming from the Browser
348 obj.processBrowserData = function (data) {
349 obj.ws.acc += data; // Add data to accumulator
@@ -342,10 +351,11 @@ module.exports.CreateRedirInterceptor = function (args) {
351 var datalen = 0;
352 do { datalen = data.length; data += obj.processBrowserDataEx(); } while (datalen != data.length); // Process as much data as possible
353 return data;
345 - }
346 -
354 + };
355 +
356 // Process data coming from the Browser in the accumulator
357 obj.processBrowserDataEx = function () {
358 + var r;
359 if (obj.ws.acc.length == 0) return "";
360 if (obj.ws.direct == true) {
361 var data = obj.ws.acc;
@@ -355,13 +365,13 @@ module.exports.CreateRedirInterceptor = function (args) {
365 switch (obj.ws.acc.charCodeAt(0)) {
366 case obj.RedirectCommands.StartRedirectionSession: {
367 if (obj.ws.acc.length < 8) return "";
358 - var r = obj.ws.acc.substring(0, 8);
368 + r = obj.ws.acc.substring(0, 8);
369 obj.ws.acc = obj.ws.acc.substring(8);
370 return r;
371 }
372 case obj.RedirectCommands.EndRedirectionSession: {
373 if (obj.ws.acc.length < 4) return "";
364 - var r = obj.ws.acc.substring(0, 4);
374 + r = obj.ws.acc.substring(0, 4);
375 obj.ws.acc = obj.ws.acc.substring(4);
376 return r;
377 }
@@ -369,7 +379,7 @@ module.exports.CreateRedirInterceptor = function (args) {
379 if (obj.ws.acc.length < 9) return "";
380 var l = common.ReadIntX(obj.ws.acc, 5);
381 if (obj.ws.acc.length < 9 + l) return "";
372 -
382 +
383 var authType = obj.ws.acc.charCodeAt(4);
384 if (authType == obj.AuthenticationType.DIGEST && obj.args.user && obj.args.pass) {
385 var authurl = "/RedirectionService";
@@ -379,10 +389,10 @@ module.exports.CreateRedirInterceptor = function (args) {
389 var nc = obj.ws.authCNonceCount;
390 obj.ws.authCNonceCount++;
391 var digest = obj.ComputeDigesthash(obj.args.user, obj.args.pass, obj.amt.digestRealm, "POST", authurl, obj.amt.digestQOP, obj.amt.digestNonce, nc, obj.ws.authCNonce);
382 -
392 +
393 // Replace this authentication digest with a server created one
394 // We have everything we need to authenticate
385 - var r = String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x04);
395 + r = String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x04);
396 r += common.IntToStrX(obj.args.user.length + obj.amt.digestRealm.length + obj.amt.digestNonce.length + authurl.length + obj.ws.authCNonce.length + nc.toString().length + digest.length + obj.amt.digestQOP.length + 8);
397 r += String.fromCharCode(obj.args.user.length); // Username Length
398 r += obj.args.user; // Username
@@ -400,13 +410,13 @@ module.exports.CreateRedirInterceptor = function (args) {
410 r += digest; // Response
411 r += String.fromCharCode(obj.amt.digestQOP.length); // QOP Length
412 r += obj.amt.digestQOP; // QOP
403 -
413 +
414 obj.ws.acc = obj.ws.acc.substring(9 + l); // Don't relay the original message
415 return r;
416 } else {
417 // Replace this authentication digest with a server created one
418 // Since we don't have authentication parameters, fill them in with blanks to get an error back what that info.
409 - var r = String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x04);
419 + r = String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x04);
420 r += common.IntToStrX(obj.args.user.length + authurl.length + 8);
421 r += String.fromCharCode(obj.args.user.length);
422 r += obj.args.user;
@@ -418,7 +428,7 @@ module.exports.CreateRedirInterceptor = function (args) {
428 }
429 }
430
421 - var r = obj.ws.acc.substring(0, 9 + l);
431 + r = obj.ws.acc.substring(0, 9 + l);
432 obj.ws.acc = obj.ws.acc.substring(9 + l);
433 return r;
434 }
@@ -429,14 +439,14 @@ module.exports.CreateRedirInterceptor = function (args) {
439 }
440 }
441 return "";
432 - }
433 -
442 + };
443 +
444 // Compute the MD5 digest hash for a set of values
445 obj.ComputeDigesthash = function (username, password, realm, method, path, qop, nonce, nc, cnonce) {
446 var ha1 = crypto.createHash('md5').update(username + ":" + realm + ":" + password).digest("hex");
447 var ha2 = crypto.createHash('md5').update(method + ":" + path).digest("hex");
448 return crypto.createHash('md5').update(ha1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2).digest("hex");
439 - }
449 + };
450
451 return obj;
442 -}
\ No newline at end of file
452 +};
\ No newline at end of file
letsEncrypt.js
+17 -11
@@ -6,12 +6,17 @@
6 * @version v0.0.2
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
17 module.exports.CreateLetsEncrypt = function (parent) {
18 try {
13 - const greenlock = require('greenlock');;
14 - const path = require('path');
19 + const greenlock = require('greenlock');
20
21 var obj = {};
22 obj.parent = parent;
@@ -42,8 +47,8 @@ module.exports.CreateLetsEncrypt = function (parent) {
47 challengeType: 'http-01',
48 agreeToTerms: leAgree,
49 debug: obj.parent.args.debug > 0
45 - }
46 - if (obj.parent.args.debug == null) { greenlockargs.log = function (debug) { } } // If not in debug mode, ignore all console output from greenlock (makes things clean).
50 + };
51 + if (obj.parent.args.debug == null) { greenlockargs.log = function (debug) { }; } // If not in debug mode, ignore all console output from greenlock (makes things clean).
52 obj.le = greenlock.create(greenlockargs);
53
54 // Hook up GreenLock to the redirection server
@@ -61,7 +66,7 @@ module.exports.CreateLetsEncrypt = function (parent) {
66 obj.leDomains = [certs.CommonName];
67 if (obj.parent.config.letsencrypt.names != null) {
68 if (typeof obj.parent.config.letsencrypt.names == 'string') { obj.parent.config.letsencrypt.names = obj.parent.config.letsencrypt.names.split(','); }
64 - obj.parent.config.letsencrypt.names.map(function (s) { return s.trim() }); // Trim each name
69 + obj.parent.config.letsencrypt.names.map(function (s) { return s.trim(); }); // Trim each name
70 if ((typeof obj.parent.config.letsencrypt.names != 'object') || (obj.parent.config.letsencrypt.names.length == null)) { console.log("ERROR: Let's Encrypt names must be an array in config.json."); func(certs); return; }
71 obj.leDomains = obj.parent.config.letsencrypt.names;
72 obj.leDomains.sort(); // Sort the array so it's always going to be in the same order.
@@ -106,7 +111,7 @@ module.exports.CreateLetsEncrypt = function (parent) {
111 console.error("ERROR: Let's encrypt error: ", err);
112 });
113 });
109 - }
114 + };
115
116 // Check if we need to renew the certificate, call this every day.
117 obj.checkRenewCertificate = function () {
@@ -116,8 +121,9 @@ module.exports.CreateLetsEncrypt = function (parent) {
121 obj.le.renew({ duplicate: false, domains: obj.leDomains, email: obj.parent.config.letsencrypt.email }, obj.leResults).then(function (xresults) {
122 obj.parent.performServerCertUpdate(); // Reset the server, TODO: Reset all peers
123 }, function (err) { }); // If we can't renew, ignore.
119 - }
124 + };
125
121 - } catch (e) { console.error(e); return null; } // Unable to start Let's Encrypt
122 - return obj;
123 -}
\ No newline at end of file
126 + return obj;
127 + } catch (e) { console.error(e); } // Unable to start Let's Encrypt
128 + return null;
129 +};
\ No newline at end of file
meshaccelerator.js
+7 -1
@@ -6,7 +6,13 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
17 const crypto = require('crypto');
18 var certStore = null;
meshagent.js
+42 -39
@@ -6,7 +6,13 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
17 var AgentConnectCount = 0;
18
@@ -29,7 +35,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
35 obj.receivedCommands = 0;
36 obj.connectTime = null;
37 obj.agentCoreCheck = 0;
32 - obj.agentInfo;
38 + obj.agentInfo = null;
39 obj.agentUpdate = null;
40 const agentUpdateBlockSize = 65520;
41 obj.remoteaddr = obj.ws._socket.remoteAddress;
@@ -39,7 +45,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
45 ws._socket.setKeepAlive(true, 240000); // Set TCP keep alive, 4 minutes
46
47 // Send a message to the mesh agent
42 - obj.send = function (data) { try { if (typeof data == 'string') { obj.ws.send(new Buffer(data, 'binary')); } else { obj.ws.send(data); } } catch (e) { } }
48 + obj.send = function (data) { try { if (typeof data == 'string') { obj.ws.send(new Buffer(data, 'binary')); } else { obj.ws.send(data); } } catch (e) { } };
49
50 // Disconnect this agent
51 obj.close = function (arg) {
@@ -61,7 +67,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
67 obj.db.RemoveNode(obj.dbNodeKey); // Remove all entries with node:id
68
69 // Event node deletion
64 - obj.parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, { etype: 'node', action: 'removenode', nodeid: obj.dbNodeKey, domain: obj.domain.id, nolog: 1 })
70 + obj.parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, { etype: 'node', action: 'removenode', nodeid: obj.dbNodeKey, domain: obj.domain.id, nolog: 1 });
71
72 // Disconnect all connections if needed
73 var state = obj.parent.parent.GetConnectivityState(obj.dbNodeKey);
@@ -71,7 +77,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
77 }
78 }
79 delete obj.nodeid;
74 - }
80 + };
81
82 // When data is received from the mesh agent web socket
83 ws.on('message', function (msg) {
@@ -296,37 +302,33 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
302 // Event the new node
303 if (obj.agentInfo.capabilities & 0x20) {
304 // This is a temporary agent, don't log.
299 - obj.parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, { etype: 'node', action: 'addnode', node: device, domain: domain.id, nolog: 1 })
305 + obj.parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, { etype: 'node', action: 'addnode', node: device, domain: domain.id, nolog: 1 });
306 } else {
301 - var change = 'Added device ' + obj.agentInfo.computerName + ' to mesh ' + mesh.name;
302 - obj.parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, { etype: 'node', action: 'addnode', node: device, msg: change, domain: domain.id })
307 + obj.parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, { etype: 'node', action: 'addnode', node: device, msg: ('Added device ' + obj.agentInfo.computerName + ' to mesh ' + mesh.name), domain: domain.id });
308 }
309 } else {
310 // Device already exists, look if changes has occured
311 device = nodes[0];
307 - if (device.agent == null) {
308 - device.agent = { ver: obj.agentInfo.agentVersion, id: obj.agentInfo.agentId, caps: obj.agentInfo.capabilities }; change = 1;
309 - } else {
310 - var changes = [], change = 0, log = 0;
311 - if (device.rname != obj.agentInfo.computerName) { device.rname = obj.agentInfo.computerName; change = 1; changes.push('computer name'); }
312 - if (device.agent.ver != obj.agentInfo.agentVersion) { device.agent.ver = obj.agentInfo.agentVersion; change = 1; changes.push('agent version'); }
313 - if (device.agent.id != obj.agentInfo.agentId) { device.agent.id = obj.agentInfo.agentId; change = 1; changes.push('agent type'); }
314 - if ((device.agent.caps & 24) != (obj.agentInfo.capabilities & 24)) { device.agent.caps = obj.agentInfo.capabilities; change = 1; changes.push('agent capabilities'); } // If agent console or javascript support changes, update capabilities
315 - if (device.meshid != obj.dbMeshKey) { device.meshid = obj.dbMeshKey; change = 1; log = 1; changes.push('agent meshid'); } // TODO: If the meshid changes, we need to event a device add/remove on both meshes
316 - if (change == 1) {
317 - obj.db.Set(device);
318 -
319 - // If this is a temporary device, don't log changes
320 - if (obj.agentInfo.capabilities & 0x20) { log = 0; }
321 -
322 - // Event the node change
323 - var event = { etype: 'node', action: 'changenode', nodeid: obj.dbNodeKey, domain: domain.id };
324 - if (log == 0) { event.nolog = 1; } else { event.msg = 'Changed device ' + device.name + ' from mesh ' + mesh.name + ': ' + changes.join(', '); }
325 - var device2 = obj.common.Clone(device);
326 - if (device2.intelamt && device2.intelamt.pass) delete device2.intelamt.pass; // Remove the Intel AMT password before eventing this.
327 - event.node = device;
328 - obj.parent.parent.DispatchEvent(['*', device.meshid], obj, event);
329 - }
312 + var changes = [], change = 0, log = 0;
313 + if (device.agent == null) { device.agent = { ver: obj.agentInfo.agentVersion, id: obj.agentInfo.agentId, caps: obj.agentInfo.capabilities }; change = 1; }
314 + if (device.rname != obj.agentInfo.computerName) { device.rname = obj.agentInfo.computerName; change = 1; changes.push('computer name'); }
315 + if (device.agent.ver != obj.agentInfo.agentVersion) { device.agent.ver = obj.agentInfo.agentVersion; change = 1; changes.push('agent version'); }
316 + if (device.agent.id != obj.agentInfo.agentId) { device.agent.id = obj.agentInfo.agentId; change = 1; changes.push('agent type'); }
317 + if ((device.agent.caps & 24) != (obj.agentInfo.capabilities & 24)) { device.agent.caps = obj.agentInfo.capabilities; change = 1; changes.push('agent capabilities'); } // If agent console or javascript support changes, update capabilities
318 + if (device.meshid != obj.dbMeshKey) { device.meshid = obj.dbMeshKey; change = 1; log = 1; changes.push('agent meshid'); } // TODO: If the meshid changes, we need to event a device add/remove on both meshes
319 + if (change == 1) {
320 + obj.db.Set(device);
321 +
322 + // If this is a temporary device, don't log changes
323 + if (obj.agentInfo.capabilities & 0x20) { log = 0; }
324 +
325 + // Event the node change
326 + var event = { etype: 'node', action: 'changenode', nodeid: obj.dbNodeKey, domain: domain.id };
327 + if (log == 0) { event.nolog = 1; } else { event.msg = 'Changed device ' + device.name + ' from mesh ' + mesh.name + ': ' + changes.join(', '); }
328 + var device2 = obj.common.Clone(device);
329 + if (device2.intelamt && device2.intelamt.pass) delete device2.intelamt.pass; // Remove the Intel AMT password before eventing this.
330 + event.node = device;
331 + obj.parent.parent.DispatchEvent(['*', device.meshid], obj, event);
332 }
333 }
334
@@ -425,9 +427,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
427
428 // Process incoming agent JSON data
429 function processAgentData(msg) {
430 + var i;
431 var str = msg.toString('utf8'), command = null;
432 if (str[0] == '{') {
430 - try { command = JSON.parse(str) } catch (ex) { console.log('Unable to parse agent JSON (' + obj.remoteaddr + '): ' + str, ex); return; } // If the command can't be parsed, ignore it.
433 + try { command = JSON.parse(str); } catch (ex) { console.log('Unable to parse agent JSON (' + obj.remoteaddr + '): ' + str, ex); return; } // If the command can't be parsed, ignore it.
434 if (typeof command != 'object') { return; }
435 switch (command.action) {
436 case 'msg':
@@ -441,7 +444,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
444 if ((splitsessionid[0] == 'user') && (splitsessionid[1] == domain.id)) {
445 // Check if this user has rights to get this message
446 //if (mesh.links[user._id] == null || ((mesh.links[user._id].rights & 16) == 0)) return; // TODO!!!!!!!!!!!!!!!!!!!!!
444 -
447 +
448 // See if the session is connected. If so, go ahead and send this message to the target node
449 var ws = obj.parent.wssessions2[command.sessionid];
450 if (ws != null) {
@@ -472,7 +475,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
475 if (sessions != null) {
476 command.nodeid = obj.dbNodeKey; // Set the nodeid, required for responses.
477 delete command.userid; // Remove the userid, since we are sending to that userid, so it's implyed.
475 - for (var i in sessions) { sessions[i].send(JSON.stringify(command)); }
478 + for (i in sessions) { sessions[i].send(JSON.stringify(command)); }
479 }
480
481 if (obj.parent.parent.multiServer != null) {
@@ -487,9 +490,9 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
490 if ((user != null) && (user.links != null)) {
491 var rights = user.links[obj.dbMeshKey];
492 if (rights != null) { // TODO: Look at what rights are needed for message routing
490 - var sessions = obj.parent.wssessions[userid];
493 + var xsessions = obj.parent.wssessions[userid];
494 // Send the message to all users on this server
492 - for (var i in sessions) { try { sessions[i].send(cmdstr); } catch (e) { } }
495 + for (i in xsessions) { try { xsessions[i].send(cmdstr); } catch (e) { } }
496 }
497 }
498 }
@@ -530,7 +533,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
533 if ((command.type == 'publicip') && (command.value != null) && (typeof command.value == 'object') && (command.value.ip) && (command.value.loc)) {
534 var x = {};
535 x.publicip = command.value.ip;
533 - x.iploc = command.value.loc + ',' + (Math.floor(Date.now() / 1000) );
536 + x.iploc = command.value.loc + ',' + (Math.floor(Date.now() / 1000));
537 ChangeAgentLocationInfo(x);
538 command.value._id = 'iploc_' + command.value.ip;
539 command.value.type = 'iploc';
@@ -559,7 +562,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
562
563 // Event node deletion
564 var change = 'Migrated device ' + node.name;
562 - obj.parent.parent.DispatchEvent(['*', node.meshid], obj, { etype: 'node', action: 'removenode', nodeid: node._id, msg: change, domain: node.domain })
565 + obj.parent.parent.DispatchEvent(['*', node.meshid], obj, { etype: 'node', action: 'removenode', nodeid: node._id, msg: change, domain: node.domain });
566 }
567 });
568 break;
@@ -678,4 +681,4 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
681 }
682
683 return obj;
681 -}
684 +};
meshmail.js
+18 -12
@@ -6,7 +6,13 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*xjslint node: true */
10 +/*xjslint plusplus: true */
11 +/*xjslint maxlen: 256 */
12 +/*jshint node: true */
13 +/*jshint strict: false */
14 +/*jshint esversion: 6 */
15 +"use strict";
16
17 // Construct a MeshAgent object, called upon connection
18 module.exports.CreateMeshMain = function (parent) {
@@ -34,7 +40,7 @@ module.exports.CreateMeshMain = function (parent) {
40 const accountInviteMailText = '[[[SERVERNAME]]] - Agent Installation Invitation\r\n\r\nUser [[[USERNAME]]] on server [[[SERVERNAME]]] ([[[SERVERURL]]]) is requesting you install a remote management agent. WARNING: This will allow the requester to take control of your computer. If you wish to do this, click on the following link to download the agent: [[[CALLBACKURL]]]\r\nIf you do not know about this request, please ignore this mail.\r\n';
41
42 function EscapeHtml(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
37 - function EscapeHtmlBreaks(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;').replace(/\r/g, '<br />').replace(/\n/g, '').replace(/\t/g, '&nbsp;&nbsp;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
43 + //function EscapeHtmlBreaks(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;').replace(/\r/g, '<br />').replace(/\n/g, '').replace(/\t/g, '&nbsp;&nbsp;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
44
45 // Setup mail server
46 var options = { host: parent.config.smtp.host, secure: (parent.config.smtp.tls == true), tls: { rejectUnauthorized: false } };
@@ -53,8 +59,8 @@ module.exports.CreateMeshMain = function (parent) {
59 url = 'http' + ((obj.parent.args.notls == null) ? 's' : '') + '://' + domain.dns + ':' + obj.parent.args.port + domain.url;
60 }
61 if (options) {
56 - if (options.cookie != null) { text = text.split('[[[CALLBACKURL]]]').join(url + 'checkmail?c=' + options.cookie) }
57 - if (options.meshid != null) { text = text.split('[[[CALLBACKURL]]]').join(url + 'meshagents?id=3&meshid=' + options.meshid.split('/')[2] + '&tag=mailto:' + EscapeHtml(email)) }
62 + if (options.cookie != null) { text = text.split('[[[CALLBACKURL]]]').join(url + 'checkmail?c=' + options.cookie); }
63 + if (options.meshid != null) { text = text.split('[[[CALLBACKURL]]]').join(url + 'meshagents?id=3&meshid=' + options.meshid.split('/')[2] + '&tag=mailto:' + EscapeHtml(email)); }
64 }
65 return text.split('[[[USERNAME]]]').join(username).split('[[[SERVERURL]]]').join(url).split('[[[SERVERNAME]]]').join(domain.title);
66 }
@@ -63,7 +69,7 @@ module.exports.CreateMeshMain = function (parent) {
69 obj.sendMail = function (to, subject, text, html) {
70 obj.pendingMails.push({ to: to, from: parent.config.smtp.from, subject: subject, text: text, html: html });
71 sendNextMail();
66 - }
72 + };
73
74 // Send account check mail
75 obj.sendAccountCheckMail = function (domain, username, email) {
@@ -71,7 +77,7 @@ module.exports.CreateMeshMain = function (parent) {
77 var cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 1 }, obj.mailCookieEncryptionKey);
78 obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(accountCheckSubject, domain, username, email), text: mailReplacements(accountCheckMailText, domain, username, email, { cookie: cookie }), html: mailReplacements(accountCheckMailHtml, domain, username, email, { cookie: cookie }) });
79 sendNextMail();
74 - }
80 + };
81
82 // Send account reset mail
83 obj.sendAccountResetMail = function (domain, username, email) {
@@ -79,14 +85,14 @@ module.exports.CreateMeshMain = function (parent) {
85 var cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 2 }, obj.mailCookieEncryptionKey);
86 obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(accountResetSubject, domain, username, email), text: mailReplacements(accountResetMailText, domain, username, email, { cookie: cookie }), html: mailReplacements(accountResetMailHtml, domain, username, email, { cookie: cookie }) });
87 sendNextMail();
82 - }
88 + };
89
90 // Send agent invite mail
91 obj.sendAgentInviteMail = function (domain, username, email, meshid) {
92 if ((parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, can't do this.
93 obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(accountInviteSubject, domain, username, email), text: mailReplacements(accountInviteMailText, domain, username, email, { meshid: meshid }), html: mailReplacements(accountInviteMailHtml, domain, username, email, { meshid: meshid }) });
94 sendNextMail();
89 - }
95 + };
96
97 // Send out the next mail in the pending list
98 function sendNextMail() {
@@ -111,7 +117,7 @@ module.exports.CreateMeshMain = function (parent) {
117 }
118
119 // Send out the next mail in the pending list
114 - obj.verify = function() {
120 + obj.verify = function () {
121 obj.smtpServer.verify(function (err, info) {
122 if (err == null) {
123 console.log('SMTP mail server ' + parent.config.smtp.host + ' working as expected.');
@@ -119,7 +125,7 @@ module.exports.CreateMeshMain = function (parent) {
125 console.log('SMTP mail server ' + parent.config.smtp.host + ' failed: ' + JSON.stringify(err));
126 }
127 });
122 - }
128 + };
129
130 // Load the cookie encryption key from the database
131 obj.parent.db.Get('MailCookieEncryptionKey', function (err, docs) {
@@ -133,5 +139,5 @@ module.exports.CreateMeshMain = function (parent) {
139 }
140 });
141
136 - return obj;
137 -}
\ No newline at end of file
142 + return obj;
143 +};
\ No newline at end of file
mpsserver.js
+182 -169
@@ -6,7 +6,12 @@
6 * @version v0.0.1
7 */
8
9 -'use strict';
9 +/*jslint node: true */
10 +/*jshint node: true */
11 +/*jshint strict:false */
12 +/*jshint -W097 */
13 +/*jshint esversion: 6 */
14 +"use strict";
15
16 // Construct a Intel AMT MPS server object
17 module.exports.CreateMpsServer = function (parent, db, args, certificates) {
@@ -16,9 +21,9 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
21 obj.args = args;
22 obj.certificates = certificates;
23 obj.ciraConnections = {};
19 - const common = require('./common.js');
20 - const net = require('net');
21 - const tls = require('tls');
24 + const common = require("./common.js");
25 + const net = require("net");
26 + const tls = require("tls");
27 const MAX_IDLE = 90000; // 90 seconds max idle time, higher than the typical KEEP-ALIVE periode of 60 seconds
28
29 if (obj.args.tlsoffload) {
@@ -27,10 +32,10 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
32 obj.server = tls.createServer({ key: certificates.mps.key, cert: certificates.mps.cert, requestCert: true, rejectUnauthorized: false }, onConnection);
33 }
34
30 - obj.server.listen(args.mpsport, function () { console.log('MeshCentral Intel(R) AMT server running on ' + certificates.AmtMpsName + ':' + args.mpsport + ((args.mpsaliasport != null) ? (', alias port ' + args.mpsaliasport):'') + '.'); }).on('error', function (err) { console.error('ERROR: MeshCentral Intel(R) AMT server port ' + args.mpsport + ' is not available.'); if (args.exactports) { process.exit(); } });
31 - obj.parent.updateServerState('mps-port', args.mpsport);
32 - obj.parent.updateServerState('mps-name', certificates.AmtMpsName);
33 - if (args.mpsaliasport != null) { obj.parent.updateServerState('mps-alias-port', args.mpsaliasport); }
35 + obj.server.listen(args.mpsport, function () { console.log("MeshCentral Intel(R) AMT server running on " + certificates.AmtMpsName + ":" + args.mpsport + ((args.mpsaliasport != null) ? (", alias port " + args.mpsaliasport) : "") + "."); }).on("error", function (err) { console.error("ERROR: MeshCentral Intel(R) AMT server port " + args.mpsport + " is not available."); if (args.exactports) { process.exit(); } });
36 + obj.parent.updateServerState("mps-port", args.mpsport);
37 + obj.parent.updateServerState("mps-name", certificates.AmtMpsName);
38 + if (args.mpsaliasport != null) { obj.parent.updateServerState("mps-alias-port", args.mpsaliasport); }
39
40 const APFProtocol = {
41 UNKNOWN: 0,
@@ -54,8 +59,9 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
59 KEEPALIVE_REPLY: 209,
60 KEEPALIVE_OPTIONS_REQUEST: 210,
61 KEEPALIVE_OPTIONS_REPLY: 211
57 - }
58 -
62 + };
63 +
64 + /*
65 const APFDisconnectCode = {
66 HOST_NOT_ALLOWED_TO_CONNECT: 1,
67 PROTOCOL_ERROR: 2,
@@ -75,46 +81,47 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
81 CONNECTION_TIMED_OUT: 16,
82 BY_POLICY: 17,
83 TEMPORARILY_UNAVAILABLE: 18
78 - }
79 -
84 + };
85 +
86 const APFChannelOpenFailCodes = {
87 ADMINISTRATIVELY_PROHIBITED: 1,
88 CONNECT_FAILED: 2,
89 UNKNOWN_CHANNEL_TYPE: 3,
90 RESOURCE_SHORTAGE: 4,
85 - }
86 -
91 + };
92 + */
93 +
94 const APFChannelOpenFailureReasonCode = {
95 AdministrativelyProhibited: 1,
96 ConnectFailed: 2,
97 UnknownChannelType: 3,
98 ResourceShortage: 4,
92 - }
93 -
99 + };
100 +
101 function onConnection(socket) {
102 if (obj.args.tlsoffload) {
103 socket.tag = { first: true, clientCert: null, accumulator: "", activetunnels: 0, boundPorts: [], socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0 };
104 } else {
105 socket.tag = { first: true, clientCert: socket.getPeerCertificate(true), accumulator: "", activetunnels: 0, boundPorts: [], socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0 };
106 }
100 - socket.setEncoding('binary');
101 - Debug(1, 'MPS:New CIRA connection');
107 + socket.setEncoding("binary");
108 + Debug(1, "MPS:New CIRA connection");
109
110 // Setup the CIRA keep alive timer
111 socket.setTimeout(MAX_IDLE);
105 - socket.on('timeout', () => { Debug(1, "MPS:CIRA timeout, disconnecting."); try { socket.end(); } catch (e) { } });
112 + socket.on("timeout", () => { Debug(1, "MPS:CIRA timeout, disconnecting."); try { socket.end(); } catch (e) { } });
113
114 socket.addListener("data", function (data) {
108 - if (args.mpsdebug) { var buf = new Buffer(data, "binary"); console.log('MPS <-- (' + buf.length + '):' + buf.toString('hex')); } // Print out received bytes
115 + if (args.mpsdebug) { var buf = new Buffer(data, "binary"); console.log("MPS <-- (" + buf.length + "):" + buf.toString('hex')); } // Print out received bytes
116 socket.tag.accumulator += data;
110 -
117 +
118 // Detect if this is an HTTPS request, if it is, return a simple answer and disconnect. This is useful for debugging access to the MPS port.
119 if (socket.tag.first == true) {
120 if (socket.tag.accumulator.length < 3) return;
121 //if (!socket.tag.clientCert.subject) { console.log("MPS Connection, no client cert: " + socket.remoteAddress); socket.write('HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\nMeshCentral2 MPS server.\r\nNo client certificate given.'); socket.end(); return; }
115 - if (socket.tag.accumulator.substring(0, 3) == 'GET') { console.log("MPS Connection, HTTP GET detected: " + socket.remoteAddress); socket.write('HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>MeshCentral2 MPS server.<br />Intel&reg; AMT computers should connect here.</body></html>'); socket.end(); return; }
122 + if (socket.tag.accumulator.substring(0, 3) == "GET") { console.log("MPS Connection, HTTP GET detected: " + socket.remoteAddress); socket.write("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n<!DOCTYPE html><html><head><meta charset=\"UTF-8\"></head><body>MeshCentral2 MPS server.<br />Intel&reg; AMT computers should connect here.</body></html>"); socket.end(); return; }
123 socket.tag.first = false;
117 -
124 +
125 // Setup this node with certificate authentication
126 if (socket.tag.clientCert && socket.tag.clientCert.subject && socket.tag.clientCert.subject.O && socket.tag.clientCert.subject.O.length == 64) {
127 // This is a node where the MeshID is indicated within the CIRA certificate
@@ -144,7 +151,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
151 var device2 = common.Clone(device);
152 if (device2.intelamt.pass != undefined) delete device2.intelamt.pass; // Remove the Intel AMT password before eventing this.
153 var change = 'CIRA added device ' + socket.tag.name + ' to mesh ' + mesh.name;
147 - obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: device2, msg: change, domain: domainid })
154 + obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: device2, msg: change, domain: domainid });
155 } else {
156 // New CIRA connection for unknown node, disconnect.
157 console.log('CIRA connection for unknown node with incorrect mesh type. meshid: ' + socket.tag.meshid);
@@ -258,7 +265,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
265 var device2 = common.Clone(device);
266 if (device2.intelamt.pass != undefined) delete device2.intelamt.pass; // Remove the Intel AMT password before eventing this.
267 var change = 'CIRA added device ' + socket.tag.name + ' to mesh ' + mesh.name;
261 - obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: device2, msg: change, domain: mesh.domain })
268 + obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: device2, msg: change, domain: mesh.domain });
269 } else {
270 // New CIRA connection for unknown node, disconnect.
271 console.log('CIRA connection for unknown node with incorrect mesh type. meshid: ' + socket.tag.meshid);
@@ -309,20 +316,20 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
316 }
317 case APFProtocol.SERVICE_REQUEST: {
318 if (len < 5) return 0;
312 - var serviceNameLen = common.ReadInt(data, 1);
313 - if (len < 5 + serviceNameLen) return 0;
314 - var serviceName = data.substring(5, 5 + serviceNameLen);
315 - Debug(3, 'MPS:SERVICE_REQUEST', serviceName);
316 - if (serviceName == "pfwd@amt.intel.com") { SendServiceAccept(socket, "pfwd@amt.intel.com"); }
317 - if (serviceName == "auth@amt.intel.com") { SendServiceAccept(socket, "auth@amt.intel.com"); }
318 - return 5 + serviceNameLen;
319 + var xserviceNameLen = common.ReadInt(data, 1);
320 + if (len < 5 + xserviceNameLen) return 0;
321 + var xserviceName = data.substring(5, 5 + xserviceNameLen);
322 + Debug(3, 'MPS:SERVICE_REQUEST', xserviceName);
323 + if (xserviceName == "pfwd@amt.intel.com") { SendServiceAccept(socket, "pfwd@amt.intel.com"); }
324 + if (xserviceName == "auth@amt.intel.com") { SendServiceAccept(socket, "auth@amt.intel.com"); }
325 + return 5 + xserviceNameLen;
326 }
327 case APFProtocol.GLOBAL_REQUEST: {
328 if (len < 14) return 0;
329 var requestLen = common.ReadInt(data, 1);
330 if (len < 14 + requestLen) return 0;
331 var request = data.substring(5, 5 + requestLen);
325 - var wantResponse = data.charCodeAt(5 + requestLen);
332 + //var wantResponse = data.charCodeAt(5 + requestLen);
333
334 if (request == "tcpip-forward") {
335 var addrLen = common.ReadInt(data, 6 + requestLen);
@@ -388,7 +395,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
395 if (len < (33 + ChannelTypeLength + TargetLen + SourceLen)) return 0;
396 var Source = data.substring(29 + ChannelTypeLength + TargetLen, 29 + ChannelTypeLength + TargetLen + SourceLen);
397 var SourcePort = common.ReadInt(data, 29 + ChannelTypeLength + TargetLen + SourceLen);
391 -
398 +
399 Debug(3, 'MPS:CHANNEL_OPEN', ChannelType, SenderChannel, WindowSize, Target + ':' + TargetPort, Source + ':' + SourcePort);
400
401 // Check if we understand this channel type
@@ -398,7 +405,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
405 SendChannelOpenFailure(socket, SenderChannel, APFChannelOpenFailureReasonCode.UnknownChannelType);
406 return 33 + ChannelTypeLength + TargetLen + SourceLen;
407 }
401 -
408 +
409 /*
410 // This is a correct connection. Lets get it setup
411 var MeshAmtEventEndpoint = { ServerChannel: GetNextBindId(), AmtChannel: SenderChannel, MaxWindowSize: 2048, CurrentWindowSize:2048, SendWindow: WindowSize, InfoHeader: "Target: " + Target + ":" + TargetPort + ", Source: " + Source + ":" + SourcePort};
@@ -408,25 +415,84 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
415
416 return 33 + ChannelTypeLength + TargetLen + SourceLen;
417 }
411 - case APFProtocol.CHANNEL_OPEN_CONFIRMATION:
412 - {
413 - if (len < 17) return 0;
414 - var RecipientChannel = common.ReadInt(data, 1);
415 - var SenderChannel = common.ReadInt(data, 5);
416 - var WindowSize = common.ReadInt(data, 9);
417 - socket.tag.activetunnels++;
418 - var cirachannel = socket.tag.channels[RecipientChannel];
419 - if (cirachannel == undefined) { /*console.log("MPS Error in CHANNEL_OPEN_CONFIRMATION: Unable to find channelid " + RecipientChannel);*/ return 17; }
420 - cirachannel.amtchannelid = SenderChannel;
421 - cirachannel.sendcredits = cirachannel.amtCiraWindow = WindowSize;
422 - Debug(3, 'MPS:CHANNEL_OPEN_CONFIRMATION', RecipientChannel, SenderChannel, WindowSize);
423 - if (cirachannel.closing == 1) {
424 - // Close this channel
425 - SendChannelClose(cirachannel.socket, cirachannel.amtchannelid);
426 - } else {
427 - cirachannel.state = 2;
428 - // Send any pending data
429 - if (cirachannel.sendBuffer != undefined) {
418 + case APFProtocol.CHANNEL_OPEN_CONFIRMATION:
419 + {
420 + if (len < 17) return 0;
421 + var RecipientChannel = common.ReadInt(data, 1);
422 + var SenderChannel = common.ReadInt(data, 5);
423 + var WindowSize = common.ReadInt(data, 9);
424 + socket.tag.activetunnels++;
425 + var cirachannel = socket.tag.channels[RecipientChannel];
426 + if (cirachannel == undefined) { /*console.log("MPS Error in CHANNEL_OPEN_CONFIRMATION: Unable to find channelid " + RecipientChannel);*/ return 17; }
427 + cirachannel.amtchannelid = SenderChannel;
428 + cirachannel.sendcredits = cirachannel.amtCiraWindow = WindowSize;
429 + Debug(3, 'MPS:CHANNEL_OPEN_CONFIRMATION', RecipientChannel, SenderChannel, WindowSize);
430 + if (cirachannel.closing == 1) {
431 + // Close this channel
432 + SendChannelClose(cirachannel.socket, cirachannel.amtchannelid);
433 + } else {
434 + cirachannel.state = 2;
435 + // Send any pending data
436 + if (cirachannel.sendBuffer != undefined) {
437 + if (cirachannel.sendBuffer.length <= cirachannel.sendcredits) {
438 + // Send the entire pending buffer
439 + SendChannelData(cirachannel.socket, cirachannel.amtchannelid, cirachannel.sendBuffer);
440 + cirachannel.sendcredits -= cirachannel.sendBuffer.length;
441 + delete cirachannel.sendBuffer;
442 + if (cirachannel.onSendOk) { cirachannel.onSendOk(cirachannel); }
443 + } else {
444 + // Send a part of the pending buffer
445 + SendChannelData(cirachannel.socket, cirachannel.amtchannelid, cirachannel.sendBuffer.substring(0, cirachannel.sendcredits));
446 + cirachannel.sendBuffer = cirachannel.sendBuffer.substring(cirachannel.sendcredits);
447 + cirachannel.sendcredits = 0;
448 + }
449 + }
450 + // Indicate the channel is open
451 + if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
452 + }
453 + return 17;
454 + }
455 + case APFProtocol.CHANNEL_OPEN_FAILURE:
456 + {
457 + if (len < 17) return 0;
458 + var RecipientChannel = common.ReadInt(data, 1);
459 + var ReasonCode = common.ReadInt(data, 5);
460 + Debug(3, 'MPS:CHANNEL_OPEN_FAILURE', RecipientChannel, ReasonCode);
461 + var cirachannel = socket.tag.channels[RecipientChannel];
462 + if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_OPEN_FAILURE: Unable to find channelid " + RecipientChannel); return 17; }
463 + if (cirachannel.state > 0) {
464 + cirachannel.state = 0;
465 + if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
466 + delete socket.tag.channels[RecipientChannel];
467 + }
468 + return 17;
469 + }
470 + case APFProtocol.CHANNEL_CLOSE:
471 + {
472 + if (len < 5) return 0;
473 + var RecipientChannel = common.ReadInt(data, 1);
474 + Debug(3, 'MPS:CHANNEL_CLOSE', RecipientChannel);
475 + var cirachannel = socket.tag.channels[RecipientChannel];
476 + if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_CLOSE: Unable to find channelid " + RecipientChannel); return 5; }
477 + socket.tag.activetunnels--;
478 + if (cirachannel.state > 0) {
479 + cirachannel.state = 0;
480 + if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
481 + delete socket.tag.channels[RecipientChannel];
482 + }
483 + return 5;
484 + }
485 + case APFProtocol.CHANNEL_WINDOW_ADJUST:
486 + {
487 + if (len < 9) return 0;
488 + var RecipientChannel = common.ReadInt(data, 1);
489 + var ByteToAdd = common.ReadInt(data, 5);
490 + var cirachannel = socket.tag.channels[RecipientChannel];
491 + if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_WINDOW_ADJUST: Unable to find channelid " + RecipientChannel); return 9; }
492 + cirachannel.sendcredits += ByteToAdd;
493 + Debug(3, 'MPS:CHANNEL_WINDOW_ADJUST', RecipientChannel, ByteToAdd, cirachannel.sendcredits);
494 + if (cirachannel.state == 2 && cirachannel.sendBuffer != undefined) {
495 + // Compute how much data we can send
496 if (cirachannel.sendBuffer.length <= cirachannel.sendcredits) {
497 // Send the entire pending buffer
498 SendChannelData(cirachannel.socket, cirachannel.amtchannelid, cirachannel.sendBuffer);
@@ -440,170 +506,117 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
506 cirachannel.sendcredits = 0;
507 }
508 }
443 - // Indicate the channel is open
444 - if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
509 + return 9;
510 }
446 - return 17;
447 - }
448 - case APFProtocol.CHANNEL_OPEN_FAILURE:
449 - {
450 - if (len < 17) return 0;
451 - var RecipientChannel = common.ReadInt(data, 1);
452 - var ReasonCode = common.ReadInt(data, 5);
453 - Debug(3, 'MPS:CHANNEL_OPEN_FAILURE', RecipientChannel, ReasonCode);
454 - var cirachannel = socket.tag.channels[RecipientChannel];
455 - if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_OPEN_FAILURE: Unable to find channelid " + RecipientChannel); return 17; }
456 - if (cirachannel.state > 0) {
457 - cirachannel.state = 0;
458 - if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
459 - delete socket.tag.channels[RecipientChannel];
460 - }
461 - return 17;
462 - }
463 - case APFProtocol.CHANNEL_CLOSE:
464 - {
465 - if (len < 5) return 0;
466 - var RecipientChannel = common.ReadInt(data, 1);
467 - Debug(3, 'MPS:CHANNEL_CLOSE', RecipientChannel);
468 - var cirachannel = socket.tag.channels[RecipientChannel];
469 - if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_CLOSE: Unable to find channelid " + RecipientChannel); return 5; }
470 - socket.tag.activetunnels--;
471 - if (cirachannel.state > 0) {
472 - cirachannel.state = 0;
473 - if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
474 - delete socket.tag.channels[RecipientChannel];
475 - }
476 - return 5;
477 - }
478 - case APFProtocol.CHANNEL_WINDOW_ADJUST:
479 - {
480 - if (len < 9) return 0;
481 - var RecipientChannel = common.ReadInt(data, 1);
482 - var ByteToAdd = common.ReadInt(data, 5);
483 - var cirachannel = socket.tag.channels[RecipientChannel];
484 - if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_WINDOW_ADJUST: Unable to find channelid " + RecipientChannel); return 9; }
485 - cirachannel.sendcredits += ByteToAdd;
486 - Debug(3, 'MPS:CHANNEL_WINDOW_ADJUST', RecipientChannel, ByteToAdd, cirachannel.sendcredits);
487 - if (cirachannel.state == 2 && cirachannel.sendBuffer != undefined) {
488 - // Compute how much data we can send
489 - if (cirachannel.sendBuffer.length <= cirachannel.sendcredits) {
490 - // Send the entire pending buffer
491 - SendChannelData(cirachannel.socket, cirachannel.amtchannelid, cirachannel.sendBuffer);
492 - cirachannel.sendcredits -= cirachannel.sendBuffer.length;
493 - delete cirachannel.sendBuffer;
494 - if (cirachannel.onSendOk) { cirachannel.onSendOk(cirachannel); }
495 - } else {
496 - // Send a part of the pending buffer
497 - SendChannelData(cirachannel.socket, cirachannel.amtchannelid, cirachannel.sendBuffer.substring(0, cirachannel.sendcredits));
498 - cirachannel.sendBuffer = cirachannel.sendBuffer.substring(cirachannel.sendcredits);
499 - cirachannel.sendcredits = 0;
511 + case APFProtocol.CHANNEL_DATA:
512 + {
513 + if (len < 9) return 0;
514 + var RecipientChannel = common.ReadInt(data, 1);
515 + var LengthOfData = common.ReadInt(data, 5);
516 + if (len < (9 + LengthOfData)) return 0;
517 + Debug(4, 'MPS:CHANNEL_DATA', RecipientChannel, LengthOfData);
518 + var cirachannel = socket.tag.channels[RecipientChannel];
519 + if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_DATA: Unable to find channelid " + RecipientChannel); return 9 + LengthOfData; }
520 + cirachannel.amtpendingcredits += LengthOfData;
521 + if (cirachannel.onData) cirachannel.onData(cirachannel, data.substring(9, 9 + LengthOfData));
522 + if (cirachannel.amtpendingcredits > (cirachannel.ciraWindow / 2)) {
523 + SendChannelWindowAdjust(cirachannel.socket, cirachannel.amtchannelid, cirachannel.amtpendingcredits); // Adjust the buffer window
524 + cirachannel.amtpendingcredits = 0;
525 }
526 + return 9 + LengthOfData;
527 }
502 - return 9;
503 - }
504 - case APFProtocol.CHANNEL_DATA:
505 - {
506 - if (len < 9) return 0;
507 - var RecipientChannel = common.ReadInt(data, 1);
508 - var LengthOfData = common.ReadInt(data, 5);
509 - if (len < (9 + LengthOfData)) return 0;
510 - Debug(4, 'MPS:CHANNEL_DATA', RecipientChannel, LengthOfData);
511 - var cirachannel = socket.tag.channels[RecipientChannel];
512 - if (cirachannel == undefined) { console.log("MPS Error in CHANNEL_DATA: Unable to find channelid " + RecipientChannel); return 9 + LengthOfData; }
513 - cirachannel.amtpendingcredits += LengthOfData;
514 - if (cirachannel.onData) cirachannel.onData(cirachannel, data.substring(9, 9 + LengthOfData));
515 - if (cirachannel.amtpendingcredits > (cirachannel.ciraWindow / 2)) {
516 - SendChannelWindowAdjust(cirachannel.socket, cirachannel.amtchannelid, cirachannel.amtpendingcredits); // Adjust the buffer window
517 - cirachannel.amtpendingcredits = 0;
528 + case APFProtocol.DISCONNECT:
529 + {
530 + if (len < 7) return 0;
531 + var ReasonCode = common.ReadInt(data, 1);
532 + Debug(3, 'MPS:DISCONNECT', ReasonCode);
533 + try { delete obj.ciraConnections[socket.tag.nodeid]; } catch (e) { }
534 + obj.parent.ClearConnectivityState(socket.tag.meshid, socket.tag.nodeid, 2);
535 + return 7;
536 + }
537 + default:
538 + {
539 + Debug(1, 'MPS:Unknown CIRA command: ' + cmd);
540 + return -1;
541 }
519 - return 9 + LengthOfData;
520 - }
521 - case APFProtocol.DISCONNECT:
522 - {
523 - if (len < 7) return 0;
524 - var ReasonCode = common.ReadInt(data, 1);
525 - Debug(3, 'MPS:DISCONNECT', ReasonCode);
526 - try { delete obj.ciraConnections[socket.tag.nodeid]; } catch (e) { }
527 - obj.parent.ClearConnectivityState(socket.tag.meshid, socket.tag.nodeid, 2);
528 - return 7;
529 - }
530 - default:
531 - {
532 - Debug(1, 'MPS:Unknown CIRA command: ' + cmd);
533 - return -1;
534 - }
542 }
543 }
537 -
544 +
545 socket.addListener("close", function () {
546 Debug(1, 'MPS:CIRA connection closed');
547 try { delete obj.ciraConnections[socket.tag.nodeid]; } catch (e) { }
548 obj.parent.ClearConnectivityState(socket.tag.meshid, socket.tag.nodeid, 2);
549 });
543 -
550 +
551 socket.addListener("error", function () {
552 //console.log("MPS Error: " + socket.remoteAddress);
553 });
554
555 }
549 -
556 +
557 // Disconnect CIRA tunnel
558 obj.close = function (socket) {
559 try { socket.end(); } catch (e) { }
560 try { delete obj.ciraConnections[socket.tag.nodeid]; } catch (e) { }
561 obj.parent.ClearConnectivityState(socket.tag.meshid, socket.tag.nodeid, 2);
555 - }
562 + };
563
564 function SendServiceAccept(socket, service) {
565 Write(socket, String.fromCharCode(APFProtocol.SERVICE_ACCEPT) + common.IntToStr(service.length) + service);
566 }
560 -
567 +
568 function SendTcpForwardSuccessReply(socket, port) {
569 Write(socket, String.fromCharCode(APFProtocol.REQUEST_SUCCESS) + common.IntToStr(port));
570 }
564 -
571 +
572 function SendTcpForwardCancelReply(socket) {
573 Write(socket, String.fromCharCode(APFProtocol.REQUEST_SUCCESS));
574 }
568 -
575 +
576 + /*
577 function SendKeepAliveRequest(socket, cookie) {
578 Write(socket, String.fromCharCode(APFProtocol.KEEPALIVE_REQUEST) + common.IntToStr(cookie));
579 }
580 + */
581
582 function SendKeepAliveReply(socket, cookie) {
583 Write(socket, String.fromCharCode(APFProtocol.KEEPALIVE_REPLY) + common.IntToStr(cookie));
584 }
576 -
585 +
586 function SendChannelOpenFailure(socket, senderChannel, reasonCode) {
587 Write(socket, String.fromCharCode(APFProtocol.CHANNEL_OPEN_FAILURE) + common.IntToStr(senderChannel) + common.IntToStr(reasonCode) + common.IntToStr(0) + common.IntToStr(0));
588 }
580 -
589 +
590 + /*
591 function SendChannelOpenConfirmation(socket, recipientChannelId, senderChannelId, initialWindowSize) {
592 Write(socket, String.fromCharCode(APFProtocol.CHANNEL_OPEN_CONFIRMATION) + common.IntToStr(recipientChannelId) + common.IntToStr(senderChannelId) + common.IntToStr(initialWindowSize) + common.IntToStr(-1));
593 }
584 -
594 + */
595 +
596 function SendChannelOpen(socket, direct, channelid, windowsize, target, targetport, source, sourceport) {
597 var connectionType = ((direct == true) ? "direct-tcpip" : "forwarded-tcpip");
598 if ((target == null) || (target == undefined)) target = ''; // TODO: Reports of target being undefined that causes target.length to fail. This is a hack.
599 Write(socket, String.fromCharCode(APFProtocol.CHANNEL_OPEN) + common.IntToStr(connectionType.length) + connectionType + common.IntToStr(channelid) + common.IntToStr(windowsize) + common.IntToStr(-1) + common.IntToStr(target.length) + target + common.IntToStr(targetport) + common.IntToStr(source.length) + source + common.IntToStr(sourceport));
600 }
590 -
601 +
602 function SendChannelClose(socket, channelid) {
603 Write(socket, String.fromCharCode(APFProtocol.CHANNEL_CLOSE) + common.IntToStr(channelid));
604 }
594 -
605 +
606 function SendChannelData(socket, channelid, data) {
607 Write(socket, String.fromCharCode(APFProtocol.CHANNEL_DATA) + common.IntToStr(channelid) + common.IntToStr(data.length) + data);
608 }
598 -
609 +
610 function SendChannelWindowAdjust(socket, channelid, bytestoadd) {
611 Debug(3, 'MPS:SendChannelWindowAdjust', channelid, bytestoadd);
612 Write(socket, String.fromCharCode(APFProtocol.CHANNEL_WINDOW_ADJUST) + common.IntToStr(channelid) + common.IntToStr(bytestoadd));
613 }
603 -
614 +
615 + /*
616 function SendDisconnect(socket, reasonCode) {
605 - Write(socket, String.fromCharCode(APFProtocol.DISCONNECT) + common.IntToStr(ReasonCode) + common.ShortToStr(0));
617 + Write(socket, String.fromCharCode(APFProtocol.DISCONNECT) + common.IntToStr(reasonCode) + common.ShortToStr(0));
618 }
619 + */
620
621 function SendUserAuthFail(socket) {
622 Write(socket, String.fromCharCode(APFProtocol.USERAUTH_FAILURE) + common.IntToStr(8) + 'password' + common.ShortToStr(0));
@@ -623,12 +636,12 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
636 socket.write(new Buffer(data, "binary"));
637 }
638 }
626 -
639 +
640 obj.SetupCiraChannel = function (socket, targetport) {
641 var sourceport = (socket.tag.nextsourceport++ % 30000) + 1024;
642 var cirachannel = { targetport: targetport, channelid: socket.tag.nextchannelid++, socket: socket, state: 1, sendcredits: 0, amtpendingcredits: 0, amtCiraWindow: 0, ciraWindow: 32768 };
643 SendChannelOpen(socket, false, cirachannel.channelid, cirachannel.ciraWindow, socket.tag.host, targetport, "1.2.3.4", sourceport);
631 -
644 +
645 // This function writes data to this CIRA channel
646 cirachannel.write = function (data) {
647 if (cirachannel.state == 0) return false;
@@ -649,8 +662,8 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
662 SendChannelData(cirachannel.socket, cirachannel.amtchannelid, data.substring(0, cirachannel.sendcredits));
663 cirachannel.sendcredits = 0;
664 return false;
652 - }
653 -
665 + };
666 +
667 // This function closes this CIRA channel
668 cirachannel.close = function () {
669 if (cirachannel.state == 0 || cirachannel.closing == 1) return;
@@ -659,16 +672,16 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
672 cirachannel.closing = 1;
673 SendChannelClose(cirachannel.socket, cirachannel.amtchannelid);
674 if (cirachannel.onStateChange) { cirachannel.onStateChange(cirachannel, cirachannel.state); }
662 - }
663 -
675 + };
676 +
677 socket.tag.channels[cirachannel.channelid] = cirachannel;
678 return cirachannel;
666 - }
679 + };
680
681 function ChangeHostname(socket, host) {
682 if (socket.tag.host == host) return; // Nothing to change
683 socket.tag.host = host;
671 -
684 +
685 // Change the device
686 obj.db.Get(socket.tag.nodeid, function (err, nodes) {
687 if (nodes.length != 1) return;
@@ -676,7 +689,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
689
690 // See if any changes need to be made
691 if ((node.intelamt != undefined) && (node.intelamt.host == host) && (node.name != '') && (node.intelamt.state == 2)) return;
679 -
692 +
693 // Get the mesh for this device
694 obj.db.Get(node.meshid, function (err, meshes) {
695 if (meshes.length != 1) return;
@@ -685,7 +698,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
698 // Ready the node change event
699 var changes = ['host'], event = { etype: 'node', action: 'changenode', nodeid: node._id };
700 event.msg = +": ";
688 -
701 +
702 // Make the change & save
703 if (node.intelamt == undefined) node.intelamt = {};
704 node.intelamt.host = host;
@@ -704,7 +717,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
717 }
718
719 function guidToStr(g) { return g.substring(6, 8) + g.substring(4, 6) + g.substring(2, 4) + g.substring(0, 2) + "-" + g.substring(10, 12) + g.substring(8, 10) + "-" + g.substring(14, 16) + g.substring(12, 14) + "-" + g.substring(16, 20) + "-" + g.substring(20); }
707 -
720 +
721 // Debug
722 function Debug(lvl) {
723 if (lvl > obj.parent.debugLevel) return;
@@ -717,4 +730,4 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
730 }
731
732 return obj;
720 -}
733 +};
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.1.9-r",
3 + "version": "0.1.9-v",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
public/scripts/agent-desktop-0.0.2.js
+2 -2
@@ -159,7 +159,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
159 }
160
161 obj.ProcessScreenMsg = function (width, height) {
162 - //obj.Debug("ScreenSize: " + width + " x " + height);
162 + if (obj.debugmode == 1) { console.log("ScreenSize: " + width + " x " + height); }
163 obj.Canvas.setTransform(1, 0, 0, 1, 0, 0);
164 obj.rotation = 0;
165 obj.FirstDraw = true;
@@ -190,7 +190,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
190 cmdmsg = str.substring(4, cmdsize);
191 X = ((cmdmsg.charCodeAt(0) & 0xFF) << 8) + (cmdmsg.charCodeAt(1) & 0xFF);
192 Y = ((cmdmsg.charCodeAt(2) & 0xFF) << 8) + (cmdmsg.charCodeAt(3) & 0xFF);
193 - //if (obj.debugmode == 1) { console.log("X=" + X + " Y=" + Y); }
193 + if (obj.debugmode == 1) { console.log("CMD" + command + " at X=" + X + " Y=" + Y); }
194 }
195
196 switch (command) {
redirserver.js
+42 -35
@@ -3,10 +3,15 @@
3 * @author Ylian Saint-Hilaire
4 * @copyright Intel Corporation 2018
5 * @license Apache-2.0
6 -* @version v0.0.1
6 +* @version v0.0.2
7 */
8
9 -'use strict';
9 +/*jslint node: true */
10 +/*jshint node: true */
11 +/*jshint strict:false */
12 +/*jshint -W097 */
13 +/*jshint esversion: 6 */
14 +"use strict";
15
16 // ExpressJS login sample
17 // https://github.com/expressjs/express/blob/master/examples/auth/index.js
@@ -18,93 +23,95 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
23 obj.db = db;
24 obj.args = args;
25 obj.certificates = null;
21 - obj.express = require('express');
22 - obj.net = require('net');
26 + obj.express = require("express");
27 + obj.net = require("net");
28 obj.app = obj.express();
24 - obj.tcpServer;
29 + obj.tcpServer = null;
30 obj.port = null;
26 -
31 +
32 // Perform an HTTP to HTTPS redirection
33 function performRedirection(req, res) {
34 var host = req.headers.host;
35 if (obj.certificates != null) {
36 host = obj.certificates.CommonName;
32 - if ((obj.certificates.CommonName == 'sample.org') || (obj.certificates.CommonName == 'un-configured')) { host = req.headers.host; }
37 + if ((obj.certificates.CommonName == "sample.org") || (obj.certificates.CommonName == "un-configured")) { host = req.headers.host; }
38 }
39 var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
35 - if (req.headers && req.headers.host && (req.headers.host.split(':')[0].toLowerCase() == 'localhost')) { res.redirect('https://localhost:' + httpsPort + req.url); } else { res.redirect('https://' + host + ':' + httpsPort + req.url); }
40 + if (req.headers && req.headers.host && (req.headers.host.split(":")[0].toLowerCase() == "localhost")) { res.redirect("https://localhost:" + httpsPort + req.url); } else { res.redirect("https://" + host + ":" + httpsPort + req.url); }
41 }
37 -
42 +
43 + /*
44 // Return the current domain of the request
45 function getDomain(req) {
40 - var x = req.url.split('/');
41 - if (x.length < 2) return parent.config.domains[''];
42 - if (parent.config.domains[x[1].toLowerCase()]) return parent.config.domains[x[1].toLowerCase()];
43 - return parent.config.domains[''];
46 + var x = req.url.split("/");
47 + if (x.length < 2) { return parent.config.domains[""]; }
48 + if (parent.config.domains[x[1].toLowerCase()]) { return parent.config.domains[x[1].toLowerCase()]; }
49 + return parent.config.domains[""];
50 }
51 + */
52
53 // Renter the terms of service.
47 - obj.app.get('/MeshServerRootCert.cer', function (req, res) {
48 - res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=' + certificates.RootName + '.cer' });
54 + obj.app.get("/MeshServerRootCert.cer", function (req, res) {
55 + res.set({ "Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache", "Expires": "0", "Content-Type": "application/octet-stream", "Content-Disposition": "attachment; filename=" + obj.certificates.RootName + ".cer" });
56 var rootcert = obj.certificates.root.cert;
57 var i = rootcert.indexOf("-----BEGIN CERTIFICATE-----\r\n");
58 if (i >= 0) { rootcert = rootcert.substring(i + 29); }
59 i = rootcert.indexOf("-----END CERTIFICATE-----");
60 if (i >= 0) { rootcert = rootcert.substring(i, 0); }
54 - res.send(new Buffer(rootcert, 'base64'));
61 + res.send(new Buffer(rootcert, "base64"));
62 });
63
64 // Add HTTP security headers to all responses
65 obj.app.use(function (req, res, next) {
66 res.removeHeader("X-Powered-By");
60 - res.set({ 'strict-transport-security': 'max-age=60000; includeSubDomains', 'Referrer-Policy': 'no-referrer', 'x-frame-options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "default-src http: ws: 'self' 'unsafe-inline'" });
67 + res.set({ "strict-transport-security": "max-age=60000; includeSubDomains", "Referrer-Policy": "no-referrer", "x-frame-options": "SAMEORIGIN", "X-XSS-Protection": "1; mode=block", "X-Content-Type-Options": "nosniff", "Content-Security-Policy": "default-src http: ws: \"self\" \"unsafe-inline\"" });
68 return next();
69 });
70
71 // Once the main web server is started, call this to hookup additional handlers
72 obj.hookMainWebServer = function (certs) {
73 obj.certificates = certs;
67 - for (var i in parent.config.domains) {
74 + for (var i = 0; i < parent.config.domains.length; i++) {
75 if (parent.config.domains[i].dns != null) { continue; }
76 var url = parent.config.domains[i].url;
70 - obj.app.post(url + 'amtevents.ashx', obj.parent.webserver.handleAmtEventRequest);
71 - obj.app.get(url + 'meshsettings', obj.parent.webserver.handleMeshSettingsRequest);
72 - obj.app.get(url + 'meshagents', obj.parent.webserver.handleMeshAgentRequest);
77 + obj.app.post(url + "amtevents.ashx", obj.parent.webserver.handleAmtEventRequest);
78 + obj.app.get(url + "meshsettings", obj.parent.webserver.handleMeshSettingsRequest);
79 + obj.app.get(url + "meshagents", obj.parent.webserver.handleMeshAgentRequest);
80 }
74 - }
81 + };
82
83 // Setup all HTTP redirection handlers
77 - //obj.app.set('etag', false);
78 - for (var i in parent.config.domains) {
84 + //obj.app.set("etag", false);
85 + for (var i = 0; i < parent.config.domains; i++) {
86 if (parent.config.domains[i].dns != null) { continue; }
87 var url = parent.config.domains[i].url;
88 obj.app.get(url, performRedirection);
82 - obj.app.use(url + 'clickonce', obj.express.static(obj.parent.path.join(__dirname, 'public/clickonce'))); // Indicates the clickonce folder is public
89 + obj.app.use(url + "clickonce", obj.express.static(obj.parent.path.join(__dirname, "public/clickonce"))); // Indicates the clickonce folder is public
90 }
84 -
91 +
92 // Find a free port starting with the specified one and going up.
93 function CheckListenPort(port, func) {
94 var s = obj.net.createServer(function (socket) { });
88 - obj.tcpServer = s.listen(port, function () { s.close(function () { if (func) { func(port); } }); }).on('error', function (err) {
89 - if (args.exactports) { console.error('ERROR: MeshCentral HTTP web server port ' + port + ' not available.'); process.exit(); }
95 + obj.tcpServer = s.listen(port, function () { s.close(function () { if (func) { func(port); } }); }).on("error", function (err) {
96 + if (args.exactports) { console.error("ERROR: MeshCentral HTTP web server port " + port + " not available."); process.exit(); }
97 else { if (port < 65535) { CheckListenPort(port + 1, func); } else { if (func) { func(0); } } }
98 });
99 }
100
101 // Start the ExpressJS web server, if the port is busy try the next one.
102 function StartRedirServer(port) {
96 - if (port == 0 || port == 65535) return;
103 + if (port == 0 || port == 65535) { return; }
104 obj.tcpServer = obj.app.listen(port, function () {
105 obj.port = port;
99 - console.log('MeshCentral HTTP redirection web server running on port ' + port + '.');
100 - obj.parent.updateServerState('redirect-port', port);
106 + console.log("MeshCentral HTTP redirection web server running on port " + port + ".");
107 + obj.parent.updateServerState("redirect-port", port);
108 func(obj.port);
102 - }).on('error', function (err) {
103 - if ((err.code == 'EACCES') && (port < 65535)) { StartRedirServer(port + 1); } else { console.log(err); func(obj.port); }
109 + }).on("error", function (err) {
110 + if ((err.code == "EACCES") && (port < 65535)) { StartRedirServer(port + 1); } else { console.log(err); func(obj.port); }
111 });
112 }
106 -
113 +
114 CheckListenPort(args.redirport, StartRedirServer);
115
116 return obj;
110 -}
117 +};
views/default-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;}#container{background-color:#fff;width:960px;min-width:960px;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}#masthead{width:auto;margin:0;padding:0;overflow:auto;text-align:right;background-color:#036;width:960px;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:center;background-color:#D3D9D6;}.style7{font-size:large;background-color:#FFFFFF;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;width:201px;background-color:#c9c9c9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}</style> <style>.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f;}.ol-mouse-position{top:8px;right:8px;position:absolute;}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute;}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;}.ol-overlay-container{will-change:left,right,top,bottom;}.ol-unsupported{display:none;}.ol-unselectable, .ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing;}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px;}.ol-control:hover{background-color:rgba(255,255,255,.6);}.ol-zoom{top:.5em;right:.5em;}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear;}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s;}.ol-zoom-extent{top:4.643em;left:.5em;}.ol-full-screen{right:.5em;top:.5em;}@media print{.ol-control{display:none;}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px;}.ol-control button::-moz-focus-inner{border:none;padding:0;}.ol-zoom-extent button{line-height:1.4em;}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform;}.ol-touch .ol-control button{font-size:1.5em;}.ol-touch .ol-zoom-extent{top:5.5em;}.ol-control button:focus, .ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7);}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0;}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px;}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff;}.ol-attribution li{display:inline;list-style:none;line-height:inherit;}.ol-attribution li:not(:last-child):after{content:" ";}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle;}.ol-attribution button, .ol-attribution ul{display:inline-block;}.ol-attribution.ol-collapsed ul{display:none;}.ol-attribution.ol-logo-only ul{display:block;}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em;}.ol-attribution.ol-logo-only{background:0 0;bottom:.4em;height:1.1em;line-height:1em;}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em;}.ol-attribution.ol-logo-only button, .ol-attribution.ol-uncollapsible button{display:none;}.ol-zoomslider{top:4.5em;left:.5em;height:200px;}.ol-zoomslider button{position:relative;height:10px;}.ol-touch .ol-zoomslider{top:5.5em;}.ol-overviewmap{left:.5em;bottom:.5em;}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0;}.ol-overviewmap .ol-overviewmap-map, .ol-overviewmap button{display:inline-block;}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px;}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute;}.ol-overviewmap.ol-collapsed .ol-overviewmap-map, .ol-overviewmap.ol-uncollapsible button{display:none;}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7);}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move;}</style> <style> .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,.2);box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :after,.ol-ctx-menu-container :before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(270deg,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:0}.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=")}.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC")}</style> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <script type="text/javascript" src="scripts/ol.js"></script> <script type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <title>MeshCentral</title> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)"> <div id="contextMenu" class="contextMenu" style="display:none"> <div id="cxinfo" class="cmtext" onclick="cmaction(1)"><b>Information</b></div> <div id="cxterminal" class="cmtext" onclick="cmaction(2)">Terminal</div> <div id="cxdesktop" class="cmtext" onclick="cmaction(3)">Desktop</div> <div id="cxfiles" class="cmtext" onclick="cmaction(4)">Files</div> <div id="cxevents" class="cmtext" onclick="cmaction(5)">Events</div> <div id="cxconsole" class="cmtext" onclick="cmaction(6)">Console</div> <hr id="cxmgroupsplit"> <div id="cxmdesktop" class="cmtext" onclick="cmaction(7)" style="display:none">Multi-Desktop</div> </div> <div id="meshContextMenu" class="contextMenu" style="display:none;min-width:0px"> <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1)">Select All</div> <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2)">Select None</div> <hr id="cxmgroupsplit2" style="display:none"> <div id="cxmmdesktop" class="cmtext" style="display:none" onclick="cmmeshaction(3)">Multi-Desktop</div> </div> <div id="container" style="max-height:100vh;position:relative"> <div id="notifiyBox" class="notifiyBox" style="display:none"></div> <div id="mastheadx"></div> <div id="masthead" class="noselect" style="background:url(images/logoback.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px"> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px"> <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> <div style="float:right"> <div id="notificationCount" onclick="clickNotificationIcon()" class="unselectable" style="display:none;min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px" title="Click to view current notifications">0</div> </div> <p id="logoutControl">{{{logoutControl}}}</p> </div> <div id="topbarmaster"> <div id="topbar" class="noselect" style="display:none"> <div> <div> <table style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainMenuMyDevices" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(1)">My Devices</td> <td id="MainMenuMyAccount" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(2)">My Account</td> <td id="MainMenuMyEvents" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(3)">My Events</td> <td id="MainMenuMyFiles" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(5)">My Files</td> <td id="MainMenuMyUsers" style="width:100px;height:24px;cursor:pointer;display:none" class="style3" onclick="go(4)">My Users</td> <td class="style3" style="text-align:right;height:24px"><span title="Toggle full width" style="cursor:pointer;opacity:0.2" onclick="toggleFullScreen(1)">&harr;</span>&nbsp;</td> </tr> </table> <div id="MainSubMenuSpan" style="display:none"> <table id="MainSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainDev" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(10)">General</td> <td id="MainDevDesktop" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(11)">Desktop</td> <td id="MainDevTerminal" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(12)">Terminal</td> <td id="MainDevFiles" style="width:100px;height:24px;cursor:pointer;display:none" class="style3" onclick="go(13)">Files</td> <td id="MainDevEvents" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(16)">Events</td> <td id="MainDevAmt" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(14)">Intel&reg; AMT</td> <td id="MainDevConsole" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(15)">Console</td> <td class="style3" style="height:24px">&nbsp;</td> </tr> </table> </div> <div id="MeshSubMenuSpan" style="display:none"> <table id="MeshSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MeshGeneral" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(20)">General</td> <td class="style3" style="height:24px">&nbsp;</td> </tr> </table> </div> <div id="UserSubMenuSpan" style="display:none"> <table id="UserSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="UserGeneral" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(30)">General</td> <td id="UserEvents" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(31)">Events</td> <td class="style3" style="height:24px">&nbsp;</td> </tr> </table> </div> </div> </div> </div> </div> <div id="page_content" style="max-height:calc(100vh - 138px)"> <div id="column_l"> <div id="p0" style="display:none"> <div id="p0message" style="margin:50px;text-align:center">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> <div id="p1" style="display:none"> <h1>My Devices</h1> <div style="width:100%;height:24px;background-color:#d3d9d6"> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div id="devListToolbar" class="style14" style="height:100%;float:left"> &nbsp;&nbsp;<input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All">&nbsp; <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction()">&nbsp; <input id="SearchInput" type="text" style="width:120px" placeholder="Search" onchange="onSearchInputChanged()" onkeyup="onSearchInputChanged()" autocomplete="off" onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)">&nbsp; <input type="checkbox" id="RealNameCheckBox" onclick="onRealNameCheckBox()"><span title="Show devices operating system name">OS Name</span> </div> <div id="kvmListToolbar" class="style14" style="height:100%;float:left"> &nbsp;&nbsp;<input type="button" onclick="connectAllKvmFunction()" value="Connect All">&nbsp; <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All">&nbsp; <input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)">AutoConnect&nbsp; <input type="button" onclick="showMultiDesktopSettings()" value="Settings">&nbsp; </div> <div id="devMapToolbar" class="style14" style="height:100%;float:left"> &nbsp;&nbsp;<input type="text" id="mapSearchLocation" placeholder="Search Location" onfocus="onMapSearchFocus(1)" onblur="onMapSearchFocus(0)"> <input type="button" value="Search" title="Search for location" onclick="getSearchLocation()"> <input type="button" id="refreshmap" title="Reset map view" value="Reset" style="margin-left:5px" onclick="refreshMap(false,true)"> </div> <div class="auto-style1" style="height:100%;float:right"> <div style="height:100%;width:4px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right">&nbsp;</div> <div style="float:right" id="devListToolbarView"> View <select id="viewselect" onchange="onDeviceViewChange()"> <option value="1">Columns <option value="2">List <option value="3">Desktops <option id="viewselectmapoption" value="4">Map </select> </div> <div style="float:right" id="devListToolbarSort"> Sort <select id="sortselect" onchange="onSortSelectChange()"> <option>Mesh <option>Power <option>Device <option>Group </select> &nbsp; </div> <div style="float:right" id="devListToolbarSize"> Size <select id="sizeselect" onchange="onDeviceViewChange()"> <option value="0">Small <option value="1">Medium <option value="2">Large </select> &nbsp; </div> </div> </div> <div id="NoMeshesPanel" style="display:none"> <table style="width:100%;padding:20px"> <tr> <td valign="top" style="width:50px"> <img src="images/info.png" height="48" width="47"> </td> <td> To get started managing devices, <a onclick="account_createMesh()" style="cursor:pointer"><strong>click here to create a new group of devices called a Mesh</strong></a>. </td> </tr> </table> </div> <div id="xdevices" style="max-height:calc(100vh - 242px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch"></div> <div id="xdevicesmap" style="height:500px;width:100%;overflow:hidden;position:relative"> <div id="xmapSearchResultsDlg" style="position:absolute;display:none;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="xmapSearchClose" style="float:right;padding:5px;cursor:pointer" onclick="mapCloseSearchWindow()"><b>X</b></div> <div style="padding:5px">Location Results</div> <div style="width:100%;margin:6px"></div> </div> <div id="xmapSearchResults" style="margin:6px"></div> </div> </div> <div id="xmap-info-window" style="text-shadow:0px 0px 15px #FFF"></div> </div> <div id="p2" style="display:none"> <h1>My Account</h1> <div id="p2AccountActions"> <p><strong><img alt="" width="150" height="103" src="images/mainaccount.png" style="margin-bottom:10px;margin-right:20px;float:right">Account actions</strong></p> <p style="margin-left:40px"> <span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br></span> <a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br> <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br> <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br> </p> </div> <p id="p2ServerActions"><strong>Server actions</strong></p> <p style="margin-left:40px"> <a id="p2ServerActionsBackup" href="/backup.zip" target="_blank" style="cursor:pointer">Download server backup</a><br> <a id="p2ServerActionsRestore" onclick="server_showRestoreDlg()" style="cursor:pointer">Restore server with backup</a><br> <a id="p2ServerActionsVersion" onclick="server_showVersionDlg()" style="cursor:pointer">Check server version</a><br> </p> <br style="clear:both"> <strong>Administrative Meshes</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p2meshes"></div> <div id="p2noMeshFound" style="margin-left:40px;display:none">No meshes. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> <div id="p3" style="display:none"> <h1>My Events</h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left">&nbsp;&nbsp;<input id="p2deleteall" type="button" onclick="showDeleteAllEventsDialog()" style="display:none" value="Delete All...">&nbsp;</div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p3limitdropdown" onchange="refreshEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right;">&nbsp;</div> </div> </div> <div id="p3events" style="max-height:600px;overflow-y:scroll"></div> </div> <div id="p4" style="display:none"> <h1>My Users</h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left"> &nbsp;&nbsp; <input type="button" onclick="showCreateNewAccountDialog()" value="New Account...">&nbsp; <input id="UserSearchInput" type="text" style="width:120px" placeholder="Search" onchange="onUserSearchInputChanged()" onkeyup="onUserSearchInputChanged()" autocomplete="off" onfocus="onUserSearchFocus(1)" onblur="onUserSearchFocus(0)">&nbsp; </div> <div class="auto-style1" style="height:100%;float:right"> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right">&nbsp;</div> </div> </div> <div id="p3users" style="max-height:600px;overflow-y:auto"></div> </div> <div id="p5" style="display:none"> <h1>My Files</h1> <table id="p5toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p5rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p5FolderUp" disabled="disabled" onclick="p5folderup();" value="Up">&nbsp; <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Select All" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile();" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile();" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5NewFolderButton" disabled="disabled" value="New Folder" onclick="p5createfolder();" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false">&nbsp; </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div>&nbsp;&nbsp;<span id="p5currentpath"></span></div> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:500px;overflow:auto;-webkit-user-select:none;position:relative"> <div id="p5PublicShare" style="display:none;width:100%;padding:4px;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue">This files is shared publically, click "link" to get public url.</div> <div id="bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&checkmark;</b></div> <div id="bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&#10007;</b></div> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px">&nbsp;<span id="p5bottomstatus"></span></td></tr> </table> </div> <div id="p10" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p10title"> <h1>General - <span id="p10deviceName"></span></h1> </div> <div id="p10html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <a style="cursor:pointer" onclick="p10showiconselector()"><img id="MainComputerImage" style="border-width:0px;height:200px;width:200px"></a> <div style="width:100%;text-align:center"><strong><span id="MainComputerState"></span></strong></div> </td> </tr> </table><br> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p11" style="display:none"> <div id="p11title"> <h1 id="p11deviceNameHeader">Desktop - <span id="p11deviceName"></span></h1> </div> <div id="p14warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel&reg; AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p14warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr id="deskarea1"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span>&nbsp; <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Left" onclick="drotate(-1)">&olarr;</div> <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Right" onclick="drotate(1)">&orarr;</div> <input id="deskFullBtn" type="button" title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value="Full" onclick="deskToggleFull()" style="margin-right:3px"> <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none"> <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" style="margin-right:3px"> <input id="deskActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> <input type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none"> </div> <div> <div id="idx_deskFullBtn2" onclick="deskToggleFull()" style="float:left;font-size:large;cursor:pointer;display:none">&nbsp;X</div> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton1span">&nbsp;<input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> &nbsp;<span id="deskstatus">Disconnected</span> </div> </td> </tr> <tr id="deskarea2"> <td> <div style="background-color:gray"><div id="progressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr id="deskarea3"> <td id="deskarea3x" style="background:black;text-align:center;height:400px;position:relative"> <div id="DeskFocus" style="color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </td> </tr> <tr id="deskarea4"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>&nbsp; <input id="DeskToastButton" type="button" value="Toast" title="Display a notification message on the remote computer" onkeypress="return false" onkeydown="return false" onclick="deviceToastFunction()">&nbsp; <input id="DeskToolsButton" type="button" value="Tools" title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">&nbsp; </div> <div> <select style="margin-left:6px" id="deskkeys"> <option value="5">Win <option value="0">Win+Down <option value="1">Win+Up <option value="2">Win+L <option value="3">Win+M <option value="4">Shift+Win+M </select> <input id="DeskWD" type="button" value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()"> <input id="DeskCAD" style="margin-left:6px" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> <span style="margin-left:6px" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Input</span>&nbsp; </div> </td> </tr> </table> </div> <div id="p12" style="display:none"> <div id="p12title"><h1>Terminal - <span id="p12deviceName"></span></h1></div> <div id="p12warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel&reg; AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p12warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <input id="termActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick="autoConnectTerminal(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton2span">&nbsp;<input type="button" id="connectbutton2" value="Connect" onclick="connectTerminal(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton2hspan">&nbsp;<input type="button" id="connectbutton2h" value="HW Connect" onclick="connectTerminal(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton2span">&nbsp;<input type="button" id="disconnectbutton2" value="Disconnect" onclick="connectTerminal(event,0)" onkeypress="return false" onkeydown="return false"></span> &nbsp;<span id="termstatus">Disconnected</span> </div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="termprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td style="background:black;text-align:center;height:500px;position:relative"> <pre id="Term" style="background:black;margin:0;padding:0"></pre> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()">&nbsp; <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()">&nbsp;&nbsp; <select id="specialkeylist" onkeypress="return false"></select> <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Send" title="Send the selected special key" onclick="sendSpecialKey()">&nbsp; </div> <div> &nbsp; <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Paste" title="Paste text into the terminal" onclick="showTermPasteDialog()"> </div> </td> </tr> </table> </div> <div id="p13" style="display:none"> <div id="p13title"><h1>Files - <span id="p13deviceName"></span></h1></div> <table id="p13toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p13rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up">&nbsp; <input type="button" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Select All" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13NewFolderButton" disabled="disabled" value="New Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false">&nbsp; </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div>&nbsp;&nbsp;<span id="p13currentpath"></span></div> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:500px;overflow:auto;-webkit-user-select:none"> <div id="p13bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&checkmark;</b></div> <div id="p13bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&#10007;</b></div> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px">&nbsp;<span id="p13bottomstatus"></span></td></tr> </table> </div> <div id="p14" style="display:none"> <div id="p14title"><h1>Intel&reg; AMT - <span id="p14deviceName"></span></h1></div> <iframe id="p14iframe" style="width:100%;height:650px;border:0;overflow:hidden" src="/commander.htm"></iframe> </div> <div id="p15" style="display:none"> <div id="p15title"><h1>Console - <span id="p15deviceName"></span></h1></div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="background:#C0C0C0"> <div style="float:right;padding-right:4px"> <div style="padding:4px;display:inline-block" id="p15coreName" title="Information about current core running on this agent"></div> <input type="button" id="p15uploadCore" value="Agent Action" onclick="p15uploadCore(event)" title="Change the agent Java Script code module"> </div> <div id="p15statetext" style="padding:4px"></div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="consoleprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td style="background:black;text-align:center;height:500px;position:relative"> <div id="p15agentConsole" style="background:black;margin:0;padding:0;color:lightgray;width:100%;max-width:930px;height:100%;text-align:left;overflow-y:scroll"><pre id="p15agentConsoleText"></pre></div> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <table style="width:100%"> <tr> <td style="width:99%"> <input id="p15consoleText" style="width:100%" onkeyup="p15consoleSend(event)" onfocus="onConsoleFocus(1)" onblur="onConsoleFocus(0)"> </td> <td>&nbsp;</td> <td style="width:1%"><input id="id_p15consoleClear" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td> </tr> </table> </td> </tr> </table> </div> <div id="p16" style="display:none"> <div id="p16title"><h1>Events - <span id="p16deviceName"></span></h1></div> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left">&nbsp;&nbsp;<input type="button" value="Refresh" onclick="refreshDeviceEvents()">&nbsp;</div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p16limitdropdown" onchange="refreshDeviceEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right">&nbsp;</div> </div> </div> <div id="p16events" style="max-height:600px;overflow-y:scroll"></div> </div> <div id="p20" style="display:none"> <img id="MainMeshImage" src="images/mesh-200.png" style="border-width:0px;height:200px;width:200px;float:right"> <h1><span id="p20meshName"></span> - General</h1> <p id="p20info"> </div> <div id="p30" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p30title"> <h1><span id="p30userName"></span> - General</h1> </div> <div id="p30html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <img id="MainUserImage" src="images/user-200.png" style="border-width:0px;height:200px;width:200px"> <div style="width:100%;text-align:center"><strong><span id="MainUserState"></span></strong></div> </td> </tr> </table><br> <div id="p30html2"></div> <div id="p30html3"></div> </div> <div id="p31" style="display:none"> <h1><span id="p31userName"></span> - Events</h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left">&nbsp;&nbsp;<input type="button" value="Refresh" onclick="refreshUsersEvents()">&nbsp;</div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p31limitdropdown" onchange="refreshUsersEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right;">&nbsp;</div> </div> </div> <div id="p31events" style="max-height:600px;overflow-y:scroll"></div> </div> <br id="column_l_bottomgap"> </div> <div id="footer" class="noselect"> <table cellpadding="0" cellspacing="10" style="width:100%"> <tr> <td style="text-align:left;color:white"> {{{footer}}} </td> <td style="text-align:right"> <a id="verifyEmailId2" style="color:yellow;margin-left:3px;cursor:pointer;display:none" onclick="account_showVerifyEmail()">Verify Email</a> <a style="margin-left:3px" href="terms">Terms &amp; Privacy</a> </td> </tr> </table> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:160px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog3" style="margin:auto;margin:3px"> <div style="height:26px"> <select id="d3uploadMode" style="float:right;width:260px" onchange="d3modechange()"> <option value="1">Local file upload <option value="2">Server file selection </select> <div>File Selection</div> </div> <div id="d3localmode" style="height:26px;display:none"> <form id="d3localmodeform" method="post" enctype="multipart/form-data" action="uploadfile.ashx" target="fileUploadFrame"> <input type="text" id="d3attrib" name="attrib" style="display:none"> <input type="file" id="d3localFile" name="files" style="float:right;width:260px" onchange="d3setActions()"> <input type="submit" id="d3submit" style="display:none"> </form> <div>Upload File</div> </div> <div id="d3servermode"> <div style="width:100%;background-color:#d3d9d6;text-align:left;padding:3px" valign="bottom"> <input type="button" id="p3FolderUp" disabled="disabled" onclick="d3folderup()" value="Up">&nbsp; </div> <div id="d3serverfiles" style="width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll"></div> </div> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Mesh Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Frame rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel&reg; AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Image Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <input type="checkbox" id='d7showfocus'>Show Focus Tool<br> <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br> </div> <div>Other Settings</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:4px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> <div style="height:25px"><input id="idx_dlgDeleteButton" type="button" value="Delete" style="width:80px;display:none" onclick="dialogclose(2)"></div> </div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <form style="display:none" method="post" action="uploadfile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p5fileDragName" name="name"><input id="p5fileDragSize" name="size"><input id="p5fileDragType" name="type"><input id="p5fileDragData" name="data"><input id="p5fileDragLink" name="link"><input type="submit" id="p5loginSubmit2" style="display:none"></form> <form style="display:none" method="post" action="uploadnodefile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p13fileDragName" name="name"><input id="p13fileDragSize" name="size"><input id="p13fileDragType" name="type"><input id="p13fileDragData" name="data"><input id="p13fileDragLink" name="link"><input type="submit" id="p13loginSubmit2" style="display:none"></form> <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></source></audio> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(f,a){var d="";if(f!=0&&(!f||f==null)){return"(Null)"}if(f instanceof Array){for(var b in f){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(f[b],a+1)}}else{if(f instanceof Object){for(var b in f){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(f[b],a+1)}}else{d+=EscapeHtml(f)}}return d}function ObjectToStringEx2(f,a){var d="";if(f!=0&&(!f||f==null)){return"(Null)"}if(f instanceof Array){for(var b in f){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(f[b],a+1)}}else{if(f instanceof Object){for(var b in f){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(f[b],a+1)}}else{d+=EscapeHtml(f)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),f;while(f=b.shift()){c+=String.fromCharCode("0x"+f)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};function AmtStackCreateService(t){var s=new Object();s.wsman=t;s.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];s.PendingEnums=[];s.PendingBatchOperations=0;s.ActiveEnumsCount=0;s.MaxActiveEnumsCount=1;s.onProcessChanged=null;var n=0;var m=0;s.GetPendingActions=function(){return(s.PendingEnums.length*2)+(s.ActiveEnumsCount)+s.wsman.comm.PendingAjax.length+s.wsman.comm.ActiveAjaxCount+s.PendingBatchOperations};function r(){var u=s.GetPendingActions();if(n<u){n=u}if(s.onProcessChanged!=null&&m!=u){m=u;s.onProcessChanged(u,n)}if(u==0){n=0}}s.Subscribe=function(w,v,D,u,C,A,B,y,E,z){s.wsman.ExecSubscribe(s.CompleteName(w),v,D,function(H,G,F,I){r();u(s,w,F,I,C)},0,A,B,y,E,z);r()};s.UnSubscribe=function(v,u,z,w,y){s.wsman.ExecUnSubscribe(s.CompleteName(v),function(C,B,A,D){r();u(s,v,A,D,z)},0,w,y);r()};s.Get=function(v,u,y,w){s.wsman.ExecGet(s.CompleteName(v),function(B,A,z,C){r();u(s,v,z,C,y)},0,w);r()};s.Put=function(v,y,u,A,w,z){s.wsman.ExecPut(s.CompleteName(v),y,function(D,C,B,E){r();u(s,v,B,E,A)},0,w,z);r()};s.Create=function(v,y,u,z,w){s.wsman.ExecCreate(s.CompleteName(v),y,function(C,B,A,D){r();u(s,v,A,D,z)},0,w);r()};s.Delete=function(v,y,u,z,w){s.wsman.ExecDelete(s.CompleteName(v),y,function(C,B,A,D){r();u(s,v,A,D,z)},0,w);r()};s.Exec=function(y,w,u,v,B,z,A){s.wsman.ExecMethod(s.CompleteName(y),w,u,function(E,D,C,F){r();v(s,y,s.CompleteExecResponse(C),F,B)},0,z,A);r()};s.ExecWithXml=function(y,w,u,v,B,z,A){s.wsman.ExecMethodXml(s.CompleteName(y),w,execArgumentsToXml(u),function(E,D,C,F){r();v(s,y,s.CompleteExecResponse(C),F,B)},0,z,A);r()};s.Enum=function(v,u,y,w){if(s.ActiveEnumsCount<s.MaxActiveEnumsCount){s.ActiveEnumsCount++;s.wsman.ExecEnum(s.CompleteName(v),function(C,A,z,D,B){r();d(v,z,u,A,D,B)},y,w)}else{s.PendingEnums.push([v,u,y,w])}r()};function d(w,z,u,A,B,C,y){if(B!=200){u(s,w,null,B,C);c(1);return}if(z==null||z.Header.Method!="EnumerateResponse"||!z.Body.EnumerationContext){u(s,w,null,603,C);c(1);return}var v=z.Body.EnumerationContext;s.wsman.ExecPull(A,v,function(F,E,D,G){b(w,D,u,E,[],G,C,y)})}function b(A,C,u,D,y,E,F,B){if(E!=200){u(s,A,null,E,F);c(1);return}if(C==null||C.Header.Method!="PullResponse"){u(s,A,null,604,F);c(1);return}for(var w in C.Body.Items){if(C.Body.Items[w] instanceof Array){for(var z in C.Body.Items[w]){y.push(C.Body.Items[w][z])}}else{y.push(C.Body.Items[w])}}if(C.Body.EnumerationContext){var v=C.Body.EnumerationContext;s.wsman.ExecPull(D,v,function(I,H,G,J){b(A,G,u,H,y,J,F,1)})}else{c(1);u(s,A,y,E,F);r()}}function c(u){s.ActiveEnumsCount-=u;if(s.ActiveEnumsCount>=s.MaxActiveEnumsCount||s.PendingEnums.length==0){return}var v=s.PendingEnums.shift();s.Enum(v[0],v[1],v[2]);c(0)}s.BatchEnum=function(u,y,v,A,w,z){s.PendingBatchOperations+=(y.length*2);a(u,Clone(y),v,A,{},w,z);r()};function a(u,A,v,D,C,w,B){s.PendingBatchOperations-=2;var z=A.shift(),y=s.Enum;if(z[0]=="*"){y=s.Get;z=z.substring(1)}y(z,function(G,E,F,H,I){I[2][E]={response:(F==null?null:F.Body),responses:F,status:H};if(I[1].length==0||H==401||(w!=true&&H!=200&&H!=400)){s.PendingBatchOperations-=(A.length*2);r();v(s,u,I[2],H,D)}else{r();a(u,A,v,D,I[2],B)}},[u,A,C],B);r()}s.BatchGet=function(u,w,v,z,y){h({name:u,names:w,callback:v,current:0,responses:{},tag:z,pri:y});r()};function h(u){if(u.names.length<=u.current){u.callback(s,u.name,u.responses,200,u.tag)}else{s.wsman.ExecGet(s.CompleteName(u.names[u.current]),function(y,w,v,z){g(u,v,z)},u.pri);u.current++}r()}function g(u,v,w){if(v==null||w!=200){u.callback(s,u.name,null,w,u.tag)}else{u.responses[v.Header.Method]=v;h(u)}}s.CompleteName=function(u){if(u.indexOf("AMT_")==0){return s.pfx[0]+u}if(u.indexOf("CIM_")==0){return s.pfx[1]+u}if(u.indexOf("IPS_")==0){return s.pfx[2]+u}};s.CompleteExecResponse=function(u){if(u&&u!=null&&u.Body&&u.Body.ReturnValue){u.Body.ReturnValueStr=s.AmtStatusToStr(u.Body.ReturnValue)}return u};s.RequestPowerStateChange=function(v,u){s.CIM_PowerManagementService_RequestPowerStateChange(v,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,u)};s.SetBootConfigRole=function(v,u){s.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',v,u)};s.CancelAllQueries=function(u){s.wsman.CancelAllQueries(u)};s.AMT_AgentPresenceWatchdog_RegisterAgent=function(u){s.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},u)};s.AMT_AgentPresenceWatchdog_AssertPresence=function(v,u){s.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:v},u)};s.AMT_AgentPresenceWatchdog_AssertShutdown=function(v,u){s.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:v},u)};s.AMT_AgentPresenceWatchdog_AddAction=function(A,z,y,v,u,w,D,B,C){s.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:A,NewState:z,EventOnTransition:y,ActionSd:v,ActionEac:u},w,D,B,C)};s.AMT_AgentPresenceWatchdog_DeleteAllActions=function(u,y,v,w){s.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},u,y,v,w)};s.AMT_AgentPresenceWatchdogAction_GetActionEac=function(u){s.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},u)};s.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(u){s.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},u)};s.AMT_AgentPresenceWatchdogVA_AssertPresence=function(v,u){s.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:v},u)};s.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(v,u){s.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:v},u)};s.AMT_AgentPresenceWatchdogVA_AddAction=function(A,z,y,v,u,w){s.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:A,NewState:z,EventOnTransition:y,ActionSd:v,ActionEac:u},w)};s.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(u,v){s.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:u},v)};s.AMT_AuditLog_ClearLog=function(u){s.Exec("AMT_AuditLog","ClearLog",{},u)};s.AMT_AuditLog_RequestStateChange=function(v,w,u){s.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.AMT_AuditLog_ReadRecords=function(v,u,w){s.Exec("AMT_AuditLog","ReadRecords",{StartIndex:v},u,w)};s.AMT_AuditLog_SetAuditLock=function(y,v,w,u){s.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:y,Flag:v,Handle:w},u)};s.AMT_AuditLog_ExportAuditLogSignature=function(v,u){s.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:v},u)};s.AMT_AuditLog_SetSigningKeyMaterial=function(z,y,w,v,u){s.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:z,SigningKey:y,LengthOfCertificates:w,Certificates:v},u)};s.AMT_AuditPolicyRule_SetAuditPolicy=function(w,u,y,z,v){s.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:w,AuditedAppID:u,EventID:y,PolicyType:z},v)};s.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(w,u,y,z,v){s.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:w,AuditedAppID:u,EventID:y,PolicyType:z},v)};s.AMT_AuthorizationService_AddUserAclEntryEx=function(y,w,z,u,A,v){s.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:y,DigestPassword:w,KerberosUserSid:z,AccessPermission:u,Realms:A},v)};s.AMT_AuthorizationService_EnumerateUserAclEntries=function(v,u){s.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:v},u)};s.AMT_AuthorizationService_GetUserAclEntryEx=function(v,u,w){s.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:v},u,w)};s.AMT_AuthorizationService_UpdateUserAclEntryEx=function(z,y,w,A,u,B,v){s.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:z,DigestUsername:y,DigestPassword:w,KerberosUserSid:A,AccessPermission:u,Realms:B},v)};s.AMT_AuthorizationService_RemoveUserAclEntry=function(v,u){s.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:v},u)};s.AMT_AuthorizationService_SetAdminAclEntryEx=function(w,v,u){s.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:w,DigestPassword:v},u)};s.AMT_AuthorizationService_GetAdminAclEntry=function(u){s.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},u)};s.AMT_AuthorizationService_GetAdminAclEntryStatus=function(u){s.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},u)};s.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(u){s.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},u)};s.AMT_AuthorizationService_SetAclEnabledState=function(w,v,u,y){s.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:w,Enabled:v},u,y)};s.AMT_AuthorizationService_GetAclEnabledState=function(v,u,w){s.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:v},u,w)};s.AMT_EndpointAccessControlService_RequestStateChange=function(v,w,u){s.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.AMT_EndpointAccessControlService_GetPosture=function(v,u){s.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:v},u)};s.AMT_EndpointAccessControlService_GetPostureHash=function(v,u){s.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:v},u)};s.AMT_EndpointAccessControlService_UpdatePostureState=function(v,u){s.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:v},u)};s.AMT_EndpointAccessControlService_GetEacOptions=function(u){s.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},u)};s.AMT_EndpointAccessControlService_SetEacOptions=function(v,w,u){s.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:v,PostureHashAlgorithm:w},u)};s.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(v,u){s.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:v},u)};s.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(v,u){s.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:v},u)};s.AMT_EthernetPortSettings_SetLinkPreference=function(v,w,u){s.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:v,Timeout:w},u)};s.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(v,u){s.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:v},u)};s.AMT_KerberosSettingData_GetCredentialCacheState=function(u){s.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},u)};s.AMT_KerberosSettingData_SetCredentialCacheState=function(v,u){s.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:v},u)};s.AMT_MessageLog_CancelIteration=function(v,u){s.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:v},u)};s.AMT_MessageLog_RequestStateChange=function(v,w,u){s.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.AMT_MessageLog_ClearLog=function(u){s.Exec("AMT_MessageLog","ClearLog",{},u)};s.AMT_MessageLog_GetRecords=function(v,w,u,y){s.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:v,MaxReadRecords:w},u,y)};s.AMT_MessageLog_GetRecord=function(v,w,u){s.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:v,PositionToNext:w},u)};s.AMT_MessageLog_PositionAtRecord=function(v,w,y,u){s.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:v,MoveAbsolute:w,RecordNumber:y},u)};s.AMT_MessageLog_PositionToFirstRecord=function(u,v){s.Exec("AMT_MessageLog","PositionToFirstRecord",{},u,v)};s.AMT_MessageLog_FreezeLog=function(v,u){s.Exec("AMT_MessageLog","FreezeLog",{Freeze:v},u)};s.AMT_PublicKeyManagementService_AddCRL=function(w,v,u){s.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:w,SerialNumbers:v},u)};s.AMT_PublicKeyManagementService_ResetCRLList=function(u,v){s.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:u},v)};s.AMT_PublicKeyManagementService_AddCertificate=function(v,u){s.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:v},u)};s.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(v,u){s.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:v},u)};s.AMT_PublicKeyManagementService_AddKey=function(v,u){s.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:v},u)};s.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(w,v,y,u){s.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:w,DNName:v,Usage:y},u)};s.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(v,y,w,u){s.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:v,SigningAlgorithm:y,NullSignedCertificateRequest:w},u)};s.AMT_PublicKeyManagementService_GenerateKeyPair=function(v,w,u){s.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:v,KeyLength:w},u)};s.AMT_RedirectionService_RequestStateChange=function(v,u){s.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:v},u)};s.AMT_RedirectionService_TerminateSession=function(v,u){s.Exec("AMT_RedirectionService","TerminateSession",{SessionType:v},u)};s.AMT_RemoteAccessService_AddMpServer=function(u,A,C,v,y,D,B,z,w){s.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:u,InfoFormat:A,Port:C,AuthMethod:v,Certificate:y,Username:D,Password:B,CN:z},w)};s.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(y,z,v,w,u){s.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:y,TunnelLifeTime:z,ExtendedData:v,MpServer:w},u)};s.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(u,v){s.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:u},v)};s.AMT_SetupAndConfigurationService_CommitChanges=function(u,v){s.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:u},v)};s.AMT_SetupAndConfigurationService_Unprovision=function(v,u){s.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:v},u)};s.AMT_SetupAndConfigurationService_PartialUnprovision=function(u,v){s.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:u},v)};s.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(u,v){s.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:u},v)};s.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(v,u){s.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:v},u)};s.AMT_SetupAndConfigurationService_SetMEBxPassword=function(v,u){s.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:v},u)};s.AMT_SetupAndConfigurationService_SetTLSPSK=function(v,w,u){s.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:v,PPS:w},u)};s.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(u){s.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},u)};s.AMT_SetupAndConfigurationService_GetUuid=function(u){s.Exec("AMT_SetupAndConfigurationService","GetUuid",{},u)};s.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(u){s.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},u)};s.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(u){s.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},u)};s.AMT_SystemDefensePolicy_GetTimeout=function(u){s.Exec("AMT_SystemDefensePolicy","GetTimeout",{},u)};s.AMT_SystemDefensePolicy_SetTimeout=function(v,u){s.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:v},u)};s.AMT_SystemDefensePolicy_UpdateStatistics=function(v,y,u,A,w,z){s.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:v,ResetOnRead:y},u,A,w,z)};s.AMT_SystemPowerScheme_SetPowerScheme=function(u,v,w){s.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},u,w,0,{InstanceID:v})};s.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(u,v){s.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},u,v)};s.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(v,y,z,u,w){s.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:v,Tm1:y,Tm2:z},u,w)};s.AMT_UserInitiatedConnectionService_RequestStateChange=function(v,w,u){s.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.AMT_WebUIService_RequestStateChange=function(v,w,u){s.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(z,A,y,w,u,v){s.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:z,WiFiEndpointSettingsInput:A,IEEE8021xSettingsInput:y,ClientCredential:w,CACredential:u},v)};s.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(z,A,y,w,u,v){s.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:z,WiFiEndpointSettingsInput:A,IEEE8021xSettingsInput:y,ClientCredential:w,CACredential:u},v)};s.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(u,v){s.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:u},v)};s.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(u,v){s.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:u},v)};s.CIM_Account_RequestStateChange=function(v,w,u){s.Exec("CIM_Account","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_AccountManagementService_CreateAccount=function(w,u,v){s.Exec("CIM_AccountManagementService","CreateAccount",{System:w,AccountTemplate:u},v)};s.CIM_BootConfigSetting_ChangeBootOrder=function(v,u){s.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:v},u)};s.CIM_BootService_SetBootConfigRole=function(u,w,v){s.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:u,Role:w},v,0,1)};s.CIM_Card_ConnectorPower=function(v,w,u){s.Exec("CIM_Card","ConnectorPower",{Connector:v,PoweredOn:w},u)};s.CIM_Card_IsCompatible=function(v,u){s.Exec("CIM_Card","IsCompatible",{ElementToCheck:v},u)};s.CIM_Chassis_IsCompatible=function(v,u){s.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:v},u)};s.CIM_Fan_SetSpeed=function(v,u){s.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:v},u)};s.CIM_KVMRedirectionSAP_RequestStateChange=function(v,w,u){s.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:v},u)};s.CIM_MediaAccessDevice_LockMedia=function(v,u){s.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:v},u)};s.CIM_MediaAccessDevice_SetPowerState=function(v,w,u){s.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:v,Time:w},u)};s.CIM_MediaAccessDevice_Reset=function(u){s.Exec("CIM_MediaAccessDevice","Reset",{},u)};s.CIM_MediaAccessDevice_EnableDevice=function(v,u){s.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:v},u)};s.CIM_MediaAccessDevice_OnlineDevice=function(v,u){s.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:v},u)};s.CIM_MediaAccessDevice_QuiesceDevice=function(v,u){s.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:v},u)};s.CIM_MediaAccessDevice_SaveProperties=function(u){s.Exec("CIM_MediaAccessDevice","SaveProperties",{},u)};s.CIM_MediaAccessDevice_RestoreProperties=function(u){s.Exec("CIM_MediaAccessDevice","RestoreProperties",{},u)};s.CIM_MediaAccessDevice_RequestStateChange=function(v,w,u){s.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_PhysicalFrame_IsCompatible=function(v,u){s.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:v},u)};s.CIM_PhysicalPackage_IsCompatible=function(v,u){s.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:v},u)};s.CIM_PowerManagementService_RequestPowerStateChange=function(w,v,y,z,u){s.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:w,ManagedElement:v,Time:y,TimeoutPeriod:z},u,0,1)};s.CIM_PowerSupply_SetPowerState=function(v,w,u){s.Exec("CIM_PowerSupply","SetPowerState",{PowerState:v,Time:w},u)};s.CIM_PowerSupply_Reset=function(u){s.Exec("CIM_PowerSupply","Reset",{},u)};s.CIM_PowerSupply_EnableDevice=function(v,u){s.Exec("CIM_PowerSupply","EnableDevice",{Enabled:v},u)};s.CIM_PowerSupply_OnlineDevice=function(v,u){s.Exec("CIM_PowerSupply","OnlineDevice",{Online:v},u)};s.CIM_PowerSupply_QuiesceDevice=function(v,u){s.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:v},u)};s.CIM_PowerSupply_SaveProperties=function(u){s.Exec("CIM_PowerSupply","SaveProperties",{},u)};s.CIM_PowerSupply_RestoreProperties=function(u){s.Exec("CIM_PowerSupply","RestoreProperties",{},u)};s.CIM_PowerSupply_RequestStateChange=function(v,w,u){s.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_Processor_SetPowerState=function(v,w,u){s.Exec("CIM_Processor","SetPowerState",{PowerState:v,Time:w},u)};s.CIM_Processor_Reset=function(u){s.Exec("CIM_Processor","Reset",{},u)};s.CIM_Processor_EnableDevice=function(v,u){s.Exec("CIM_Processor","EnableDevice",{Enabled:v},u)};s.CIM_Processor_OnlineDevice=function(v,u){s.Exec("CIM_Processor","OnlineDevice",{Online:v},u)};s.CIM_Processor_QuiesceDevice=function(v,u){s.Exec("CIM_Processor","QuiesceDevice",{Quiesce:v},u)};s.CIM_Processor_SaveProperties=function(u){s.Exec("CIM_Processor","SaveProperties",{},u)};s.CIM_Processor_RestoreProperties=function(u){s.Exec("CIM_Processor","RestoreProperties",{},u)};s.CIM_Processor_RequestStateChange=function(v,w,u){s.Exec("CIM_Processor","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_RecordLog_ClearLog=function(u){s.Exec("CIM_RecordLog","ClearLog",{},u)};s.CIM_RecordLog_RequestStateChange=function(v,w,u){s.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_RedirectionService_RequestStateChange=function(v,w,u){s.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_Sensor_SetPowerState=function(v,w,u){s.Exec("CIM_Sensor","SetPowerState",{PowerState:v,Time:w},u)};s.CIM_Sensor_Reset=function(u){s.Exec("CIM_Sensor","Reset",{},u)};s.CIM_Sensor_EnableDevice=function(v,u){s.Exec("CIM_Sensor","EnableDevice",{Enabled:v},u)};s.CIM_Sensor_OnlineDevice=function(v,u){s.Exec("CIM_Sensor","OnlineDevice",{Online:v},u)};s.CIM_Sensor_QuiesceDevice=function(v,u){s.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:v},u)};s.CIM_Sensor_SaveProperties=function(u){s.Exec("CIM_Sensor","SaveProperties",{},u)};s.CIM_Sensor_RestoreProperties=function(u){s.Exec("CIM_Sensor","RestoreProperties",{},u)};s.CIM_Sensor_RequestStateChange=function(v,w,u){s.Exec("CIM_Sensor","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_StatisticalData_ResetSelectedStats=function(v,u){s.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:v},u)};s.CIM_Watchdog_KeepAlive=function(u){s.Exec("CIM_Watchdog","KeepAlive",{},u)};s.CIM_Watchdog_SetPowerState=function(v,w,u){s.Exec("CIM_Watchdog","SetPowerState",{PowerState:v,Time:w},u)};s.CIM_Watchdog_Reset=function(u){s.Exec("CIM_Watchdog","Reset",{},u)};s.CIM_Watchdog_EnableDevice=function(v,u){s.Exec("CIM_Watchdog","EnableDevice",{Enabled:v},u)};s.CIM_Watchdog_OnlineDevice=function(v,u){s.Exec("CIM_Watchdog","OnlineDevice",{Online:v},u)};s.CIM_Watchdog_QuiesceDevice=function(v,u){s.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:v},u)};s.CIM_Watchdog_SaveProperties=function(u){s.Exec("CIM_Watchdog","SaveProperties",{},u)};s.CIM_Watchdog_RestoreProperties=function(u){s.Exec("CIM_Watchdog","RestoreProperties",{},u)};s.CIM_Watchdog_RequestStateChange=function(v,w,u){s.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.CIM_WiFiPort_SetPowerState=function(v,w,u){s.Exec("CIM_WiFiPort","SetPowerState",{PowerState:v,Time:w},u)};s.CIM_WiFiPort_Reset=function(u){s.Exec("CIM_WiFiPort","Reset",{},u)};s.CIM_WiFiPort_EnableDevice=function(v,u){s.Exec("CIM_WiFiPort","EnableDevice",{Enabled:v},u)};s.CIM_WiFiPort_OnlineDevice=function(v,u){s.Exec("CIM_WiFiPort","OnlineDevice",{Online:v},u)};s.CIM_WiFiPort_QuiesceDevice=function(v,u){s.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:v},u)};s.CIM_WiFiPort_SaveProperties=function(u){s.Exec("CIM_WiFiPort","SaveProperties",{},u)};s.CIM_WiFiPort_RestoreProperties=function(u){s.Exec("CIM_WiFiPort","RestoreProperties",{},u)};s.CIM_WiFiPort_RequestStateChange=function(v,w,u){s.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.IPS_HostBasedSetupService_Setup=function(z,A,y,v,B,w,u){s.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:z,NetworkAdminPassword:A,McNonce:y,Certificate:v,SigningAlgorithm:B,DigitalSignature:w},u)};s.IPS_HostBasedSetupService_AddNextCertInChain=function(y,v,w,u){s.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:y,IsLeafCertificate:v,IsRootCertificate:w},u)};s.IPS_HostBasedSetupService_AdminSetup=function(y,z,w,A,v,u){s.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:y,NetworkAdminPassword:z,McNonce:w,SigningAlgorithm:A,DigitalSignature:v},u)};s.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(w,y,v,u){s.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:w,SigningAlgorithm:y,DigitalSignature:v},u)};s.IPS_HostBasedSetupService_DisableClientControlMode=function(u,v){s.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:u},v)};s.IPS_KVMRedirectionSettingData_TerminateSession=function(u){s.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},u)};s.IPS_OptInService_StartOptIn=function(u){s.Exec("IPS_OptInService","StartOptIn",{},u)};s.IPS_OptInService_CancelOptIn=function(u){s.Exec("IPS_OptInService","CancelOptIn",{},u)};s.IPS_OptInService_SendOptInCode=function(v,u){s.Exec("IPS_OptInService","SendOptInCode",{OptInCode:v},u)};s.IPS_OptInService_StartService=function(u){s.Exec("IPS_OptInService","StartService",{},u)};s.IPS_OptInService_StopService=function(u){s.Exec("IPS_OptInService","StopService",{},u)};s.IPS_OptInService_RequestStateChange=function(v,w,u){s.Exec("IPS_OptInService","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.IPS_ProvisioningRecordLog_RequestStateChange=function(v,w,u){s.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.IPS_ProvisioningRecordLog_ClearLog=function(u,v){s.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:u},v)};s.IPS_SecIOService_RequestStateChange=function(v,w,u){s.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:v,TimeoutPeriod:w},u)};s.AmtStatusToStr=function(u){if(s.AmtStatusCodes[u]){return s.AmtStatusCodes[u]}else{return"UNKNOWN_ERROR"}};s.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};s.GetMessageLog=function(u,v){s.AMT_MessageLog_PositionToFirstRecord(k,[u,v,[]])};function k(w,u,v,y,z){if(y!=200||v.Body.ReturnValue!="0"){z[0](s,null,z[2]);return}s.AMT_MessageLog_GetRecords(v.Body.IterationIdentifier,390,l,z)}function l(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](s,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=o[I.Entity];I.Desc=j(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){s.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,l,[G[0],u,G[2]])}else{G[0](s,u,G[2])}}var f="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var p="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var q="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var o="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");s.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");s.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function j(y,w,v,u){if(y==15){if(v[0]==235){return"Invalid Data"}if(w==0){return p[v[1]]}return q[v[1]]}if(y==18&&v[0]==170){return"Agent watchdog "+char2hex(v[4])+char2hex(v[3])+char2hex(v[2])+char2hex(v[1])+"-"+char2hex(v[6])+char2hex(v[5])+"-... changed to "+s.WatchdogCurrentStates[v[7]]}if(y==6){return"Authentication failed "+(v[1]+(v[2]<<8))+" times. The system may be under attack."}if(y==30){return"No bootable media"}if(y==32){return"Operating system lockup or power interrupt"}if(y==35){return"System boot failure"}if(y==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+y}return s}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(p){var g,k,l,o,r=[],q=unescape(encodeURI(p)),f=q.length,m=[g=1732584193,k=-271733879,~g,~k],n=0;for(;n<=f;){r[n>>2]|=(q.charCodeAt(n)||128)<<8*(n++%4)}r[p=(f+8>>6)*16+14]=f*8;n=0;for(;n<p;n+=16){f=m;o=0;for(;o<64;){f=[l=f[3],((g=f[1]|0)+((l=((f[0]+[g&(k=f[2])|~g&l,l&g|~l&k,g^k^l,k^(g|~l)][f=o>>4])+(md5_k[o]+(r[[o,5*o+1,3*o+5,7*o][f]%16+n]|0))))<<(f=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*f+o++%4])|l>>>32-f)),g,k]}for(o=4;o;){m[--o]=m[o]+f[o]}}p="";for(;o<32;){p+=((m[o>>3]>>((1^o++&7)*4))&15).toString(16)}return p}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var j=b?"<q:":"<";var a=b?"</q:":"</";var f=b?(' xmlns:q="'+c.__namespace+'"'):"";var h="<r:"+d+f+">";for(var g in c){if(!c.hasOwnProperty(g)||g.indexOf("__")===0){continue}if(typeof c[g]==="function"||Array.isArray(c[g])){continue}if(typeof c[g]==="object"){console.error("only convert one level down...")}else{h+=j+g+">"+c[g].toString()+a+g+">"}}h+="</r:"+d+">";return h}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var f=parseInt(c[a]);if(f!=c[a]){return null}c[a]=f}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var WsmanStackCreateService=function(h,l,n,k,m,g){var j={};j.NextMessageId=1;j.Address="/wsman";j.comm=CreateWsmanComm(h,l,n,k,m,g);j.PerformAjax=function(q,o,s,r,p){if(p==undefined){p=""}j.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+p+"><Header><a:Action>"+q,function(t,u,v){if(u!=200){o(j,null,{Header:{HttpError:u}},u,v);return}var w=j.ParseWsman(t);if(!w||w==null){o(j,null,{Header:{HttpError:u}},601,v)}else{o(j,w.Header.ResourceURI,w,200,v)}},s,r)};j.CancelAllQueries=function(o){j.comm.CancelAllQueries(o)};j.GetNameFromUrl=function(o){var p=o.lastIndexOf("/");return(p==-1)?o:o.substring(p+1)};j.ExecSubscribe=function(w,q,A,o,z,v,y,t,B,u){var r="",s="";if(B!=undefined&&u!=undefined){r="<t:IssuedTokens><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>"+B+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+u+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>";s='<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'}if(t!=undefined&&t!=null){t="<a:ReferenceParameters>"+t+"</a:ReferenceParameters>"}else{t=""}var p="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+w+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(y)+r+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/'+q+'"><e:NotifyTo><a:Address>'+A+"</a:Address></e:NotifyTo>"+s+"</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>";j.PerformAjax(p+"</Body></Envelope>",o,z,v,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:m="http://x.com"')};j.ExecUnSubscribe=function(r,o,t,q,s){var p="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(s)+"</Header><Body><e:Unsubscribe/>";j.PerformAjax(p+"</Body></Envelope>",o,t,q,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};j.ExecPut=function(s,r,o,u,q,t){var p="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+s+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+d(t)+"</Header><Body>"+c(s,r);j.PerformAjax(p+"</Body></Envelope>",o,u,q)};j.ExecCreate=function(u,t,o,w,s,v){var r=j.GetNameFromUrl(u);var p="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+u+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(v)+"</Header><Body><g:"+r+' xmlns:g="'+u+'">';for(var q in t){p+="<g:"+q+">"+t[q]+"</g:"+q+">"}j.PerformAjax(p+"</g:"+r+"></Body></Envelope>",o,w,s)};j.ExecCreateXml=function(s,o,p,u,r){var q=j.GetNameFromUrl(s),t="";j.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+s+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout></Header><Body><r:"+q+' xmlns:r="'+s+'">'+o+"</r:"+q+"></Body></Envelope>",p,u,r)};j.ExecDelete=function(s,r,o,t,q){var p="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+s+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(r)+"</Header><Body /></Envelope>";j.PerformAjax(p,o,t,q)};j.ExecGet=function(q,o,r,p){j.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",o,r,p)};j.ExecMethod=function(u,s,o,q,w,t,v){var p="";for(var r in o){if(o[r]!=null){if(Array.isArray(o[r])){for(var y in o[r]){p+="<r:"+r+">"+o[r][y]+"</r:"+r+">"}}else{p+="<r:"+r+">"+o[r]+"</r:"+r+">"}}}j.ExecMethodXml(u,s,p,q,w,t,v)};j.ExecMethodXml=function(s,q,o,p,u,r,t){j.PerformAjax(s+"/"+q+"</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+s+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(t)+"</Header><Body><r:"+q+'_INPUT xmlns:r="'+s+'">'+o+"</r:"+q+"_INPUT></Body></Envelope>",p,u,r)};j.ExecEnum=function(q,o,r,p){j.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',o,r,p)};j.ExecPull=function(r,p,o,s,q){j.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+j.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(j.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+p+"</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>",o,s,q)};j.ParseWsman=function(y){try{if(!y.childNodes){y=f(y)}var v={Header:{}},s=y.getElementsByTagName("Header")[0],w;if(!s){s=y.getElementsByTagName("a:Header")[0]}if(!s){return null}for(var u=0;u<s.childNodes.length;u++){var p=s.childNodes[u];v.Header[p.localName]=p.textContent}var o=y.getElementsByTagName("Body")[0];if(!o){o=y.getElementsByTagName("a:Body")[0]}if(!o){return null}if(o.childNodes.length>0){w=o.childNodes[0].localName;if(w.indexOf("_OUTPUT")==w.length-7){w=w.substring(0,w.length-7)}v.Header.Method=w;v.Body=b(o.childNodes[0])}return v}catch(q){console.log("Unable to parse XML: "+y);return null}};function b(u){var q,v={};for(var s=0;s<u.childNodes.length;s++){var o=u.childNodes[s];if(o.childElementCount==0){q=o.textContent}else{q=b(o)}if(q=="true"){q=true}if(q=="false"){q=false}var p=q;if(o.attributes.length>0){p={Value:q};for(var t=0;t<o.attributes.length;t++){p["@"+o.attributes[t].name]=o.attributes[t].value}}if(v[o.localName] instanceof Array){v[o.localName].push(p)}else{if(v[o.localName]==undefined){v[o.localName]=p}else{v[o.localName]=[v[o.localName],p]}}}return v}function c(t,r){if(!t||r===undefined||r===null){return""}var p=j.GetNameFromUrl(t);var s="<r:"+p+' xmlns:r="'+t+'">';for(var q in r){if(!r.hasOwnProperty(q)||q.indexOf("__")===0||q.indexOf("@")===0){continue}if(r[q]===undefined||r[q]===null||typeof r[q]==="function"){continue}if(typeof r[q]==="object"&&r[q]["ReferenceParameters"]){s+="<r:"+q+"><a:Address>"+r[q].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+r[q]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var u=r[q]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(u)){for(var o=0;o<u.length;o++){s+="<w:Selector"+a(u[o])+">"+u[o]["Value"]+"</w:Selector>"}}else{s+="<w:Selector"+a(u)+">"+u.Value+"</w:Selector>"}s+="</w:SelectorSet></a:ReferenceParameters></r:"+q+">"}else{if(Array.isArray(r[q])){for(var o=0;o<r[q].length;o++){s+="<r:"+q+">"+r[q][o].toString()+"</r:"+q+">"}}else{s+="<r:"+q+">"+r[q].toString()+"</r:"+q+">"}}}s+="</r:"+p+">";return s}function a(o){if(!o){return""}var q=" ";for(var p in o){if(!o.hasOwnProperty(p)||p.indexOf("@")!==0){continue}q+=p.substring(1)+'="'+o[p]+'" '}return q}function d(s){if(!s){return""}if(typeof s=="string"){return s}if(s.InstanceID){return'<w:SelectorSet><w:Selector Name="InstanceID">'+s.InstanceID+"</w:Selector></w:SelectorSet>"}var q="<w:SelectorSet>";for(var p in s){if(!s.hasOwnProperty(p)){continue}q+='<w:Selector Name="'+p+'">';if(s[p]["ReferenceParameters"]){q+="<a:EndpointReference>";q+="<a:Address>"+s[p]["Address"]+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+s[p]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var r=s[p]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(r)){for(var o=0;o<r.length;o++){q+="<w:Selector"+a(r[o])+">"+r[o]["Value"]+"</w:Selector>"}}else{q+="<w:Selector"+a(r)+">"+r.Value+"</w:Selector>"}q+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else{q+=s[p]}q+="</w:Selector>"}q+="</w:SelectorSet>";return q}function f(o){if(window.DOMParser){return new DOMParser().parseFromString(o,"text/xml")}else{var p=new ActiveXObject("Microsoft.XMLDOM");p.async=false;p.loadXML(o);return p}}return j};var CreateAmtRemoteDesktop=function(k,m){var l={};l.canvasid=k;l.CanvasId=Q(k);l.scrolldiv=m;l.canvas=Q(k).getContext("2d");l.protocol=2;l.state=0;l.acc="";l.ScreenWidth=960;l.ScreenHeight=700;l.width=0;l.height=0;l.rwidth=0;l.rheight=0;l.bpp=2;l.useZRLE=true;l.showmouse=true;l.buttonmask=0;l.spare=null;l.sparew=0;l.spareh=0;l.sparew2=0;l.spareh2=0;l.sparecache={};l.ZRLEfirst=1;l.onScreenSizeChange=null;l.frameRateDelay=0;l.Debug=function(n){console.log(n)};l.xxStateChange=function(n){if(n==0){l.canvas.fillStyle="#000000";l.canvas.fillRect(0,0,l.width,l.height);l.canvas.canvas.width=l.rwidth=l.width=640;l.canvas.canvas.height=l.rheight=l.height=400;QS(l.canvasid).cursor="auto"}else{if(!l.showmouse){QS(l.canvasid).cursor="none"}}};l.ProcessData=function(q){if(!q){return}l.acc+=q;while(l.acc.length>0){var o=0;if(l.state==0&&l.acc.length>=12){o=12;l.state=1;l.send("RFB 003.008\n")}else{if(l.state==1&&l.acc.length>=1){o=l.acc.charCodeAt(0)+1;l.send(String.fromCharCode(1));l.state=2}else{if(l.state==2&&l.acc.length>=4){o=4;if(ReadInt(l.acc,0)!=0){return l.Stop()}l.send(String.fromCharCode(1));l.state=3}else{if(l.state==3&&l.acc.length>=24){var A=ReadInt(l.acc,20);if(l.acc.length<24+A){return}o=24+A;l.canvas.canvas.width=l.rwidth=l.width=l.ScreenWidth=ReadShort(l.acc,0);l.canvas.canvas.height=l.rheight=l.height=l.ScreenHeight=ReadShort(l.acc,2);var D="";if(l.useZRLE){D+=IntToStr(16)}D+=IntToStr(0);l.send(String.fromCharCode(2,0)+ShortToStr((D.length/4)+1)+D+IntToStr(-223));if(l.bpp==1){l.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}l.state=4;l.parent.xxStateChange(3);h();if(l.onScreenSizeChange!=null){l.onScreenSizeChange(l,l.ScreenWidth,l.ScreenHeight)}}else{if(l.state==4){var n=l.acc.charCodeAt(0);if(n==2){o=1}else{if(n==0){if(l.acc.length<4){return}l.state=100+ReadShort(l.acc,2);o=4}}}else{if(l.state>100&&l.acc.length>=12){var F=ReadShort(l.acc,0),H=ReadShort(l.acc,2),E=ReadShort(l.acc,4),w=ReadShort(l.acc,6),C=E*w,v=ReadInt(l.acc,8);if(v<17){if(E<1||E>64||w<1||w>64){console.log("Invalid tile size ("+E+","+w+"), disconnecting.");return l.Stop()}if(l.sparew!=E||l.spareh!=w){l.sparew=l.sparew2=E;l.spareh=l.spareh2=w;var G=l.sparew2+"x"+l.spareh2;l.spare=l.sparecache[G];if(!l.spare){l.sparecache[G]=l.spare=l.canvas.createImageData(l.sparew2,l.spareh2)}}}if(v==4294967073){l.canvas.canvas.width=l.rwidth=l.width=E;l.canvas.canvas.height=l.rheight=l.height=w;l.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(l.width)+ShortToStr(l.height));o=12;if(l.onScreenSizeChange!=null){l.onScreenSizeChange(l,l.ScreenWidth,l.ScreenHeight)}}else{if(v==0){var B=12,p=12+(C*l.bpp);if(l.acc.length<p){return}o=p;for(var z=0;z<C;z++){j(l.acc.charCodeAt(B++)+((l.bpp==2)?(l.acc.charCodeAt(B++)<<8):0),z)}g(l.spare,F,H)}else{if(v==16){if(l.acc.length<16){return}var r=ReadInt(l.acc,12);if(l.acc.length<(16+r)){return}var B=16,t=5,u=0;if(r>5&&l.acc.charCodeAt(B)==0&&ReadShortX(l.acc,B+1)==(r-t)){a(l.acc,B+5,F,H,E,w,C,r)}o=16+r}else{l.Debug("Unknown Encoding: "+v);return l.Stop()}}}if(--l.state==100){l.state=4;if(l.frameRateDelay==0){h()}else{setTimeout(h,l.frameRateDelay)}}}}}}}}if(o==0){return}l.acc=l.acc.substring(o)}};function a(p,z,H,I,G,r,D,q){var E=p.charCodeAt(z++),u,F,C,w={},A=0,B=0,t;if(E==0){for(t=0;t<D;t++){j(p.charCodeAt(z++)+((l.bpp==2)?(p.charCodeAt(z++)<<8):0),t)}g(l.spare,H,I)}else{if(E==1){F=p.charCodeAt(z++)+((l.bpp==2)?(p.charCodeAt(z++)<<8):0);l.canvas.fillStyle="rgb("+((l.bpp==1)?((F&224)+","+((F&28)<<3)+","+b((F&3)<<6)):(((F>>8)&248)+","+((F>>3)&252)+","+((F&31)<<3)))+")";l.canvas.fillRect(H,I,G,r)}else{if(E>1&&E<17){var o=4,n=15;for(t=0;t<E;t++){w[t]=p.charCodeAt(z++)+((l.bpp==2)?(p.charCodeAt(z++)<<8):0)}if(E==2){o=1;n=1}else{if(E<=4){o=2;n=3}}while(A<D&&z<p.length){F=p.charCodeAt(z++);for(t=(8-o);t>=0;t-=o){j(w[(F>>t)&n],A++)}}g(l.spare,H,I)}else{if(E==128){while(A<D&&z<p.length){F=p.charCodeAt(z++)+((l.bpp==2)?(p.charCodeAt(z++)<<8):0);B=1;do{B+=(C=p.charCodeAt(z++))}while(C==255);while(--B>=0){j(F,A++)}}g(l.spare,H,I)}else{if(E>129){for(t=0;t<(E-128);t++){w[t]=p.charCodeAt(z++)+((l.bpp==2)?(p.charCodeAt(z++)<<8):0)}while(A<D&&z<p.length){B=1;u=p.charCodeAt(z++);F=w[u%128];if(u>127){do{B+=(C=p.charCodeAt(z++))}while(C==255)}while(--B>=0){j(F,A++)}}g(l.spare,H,I)}}}}}}function g(n,o,p){l.canvas.putImageData(n,o,p)}function j(q,n){var o=n*4;if(l.bpp==1){l.spare.data[o++]=q&224;l.spare.data[o++]=(q&28)<<3;l.spare.data[o++]=b((q&3)<<6)}else{l.spare.data[o++]=(q>>8)&248;l.spare.data[o++]=(q>>3)&252;l.spare.data[o++]=(q&31)<<3}l.spare.data[o]=255}function b(n){return(n>127)?(n+32):n}function h(){l.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(l.rwidth)+ShortToStr(l.rheight))}l.Start=function(){l.state=0;l.acc="";l.ZRLEfirst=1;for(var n in l.sparecache){delete l.sparecache[n]}};l.Stop=function(){l.UnGrabMouseInput();l.UnGrabKeyInput();l.parent.Stop()};l.send=function(n){l.parent.send(n)};function c(n,o){if(!o){o=window.event}var p=o.keyCode,q=p;if(o.shiftKey==false&&p>=65&&p<=90){q=p+32}if(p>=112&&p<=124){q=p+65358}if(p==8){q=65288}if(p==9){q=65289}if(p==13){q=65293}if(p==16){q=65505}if(p==17){q=65507}if(p==18){q=65513}if(p==27){q=65307}if(p==33){q=65365}if(p==34){q=65366}if(p==35){q=65367}if(p==36){q=65360}if(p==37){q=65361}if(p==38){q=65362}if(p==39){q=65363}if(p==40){q=65364}if(p==45){q=65379}if(p==46){q=65535}if(p>=96&&p<=105){q=p-48}if(p==106){q=42}if(p==107){q=43}if(p==109){q=45}if(p==110){q=46}if(p==111){q=47}if(p==186){q=59}if(p==187){q=61}if(p==188){q=44}if(p==189){q=45}if(p==190){q=46}if(p==191){q=47}if(p==192){q=96}if(p==219){q=91}if(p==220){q=92}if(p==221){q=93}if(p==222){q=39}l.sendkey(q,n);return l.haltEvent(o)}l.sendkey=function(p,n){if(typeof p=="object"){for(var o in p){l.sendkey(p[o][0],p[o][1])}}else{l.send(String.fromCharCode(4,n,0,0)+IntToStr(p))}};l.SendCtrlAltDelMsg=function(){l.sendcad()};l.sendcad=function(){l.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var f=false;var d=false;l.GrabMouseInput=function(){if(f==true){return}var n=l.canvas.canvas;n.onmouseup=l.mouseup;n.onmousedown=l.mousedown;n.onmousemove=l.mousemove;f=true};l.UnGrabMouseInput=function(){if(f==false){return}var n=l.canvas.canvas;n.onmousemove=null;n.onmouseup=null;n.onmousedown=null;f=false};l.GrabKeyInput=function(){if(d==true){return}document.onkeyup=l.handleKeyUp;document.onkeydown=l.handleKeyDown;document.onkeypress=l.handleKeys;d=true};l.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};l.handleKeys=function(n){return l.haltEvent(n)};l.handleKeyUp=function(n){return c(0,n)};l.handleKeyDown=function(n){return c(1,n)};l.haltEvent=function(n){if(n.preventDefault){n.preventDefault()}if(n.stopPropagation){n.stopPropagation()}return false};l.mousedown=function(n){l.buttonmask|=(1<<n.button);return l.mousemove(n)};l.mouseup=function(n){l.buttonmask&=(65535-(1<<n.button));return l.mousemove(n)};l.mousemove=function(n){if(l.state!=4){return true}var o=l.getPositionOfControl(Q(l.canvasid));l.mx=(n.pageX-o[0])*(l.canvas.canvas.height/Q(l.canvasid).offsetHeight);l.my=((n.pageY-o[1]+(m?m.scrollTop:0))*(l.canvas.canvas.width/Q(l.canvasid).offsetWidth));l.send(String.fromCharCode(5,l.buttonmask)+ShortToStr(l.mx)+ShortToStr(l.my));return l.haltEvent(n)};l.getPositionOfControl=function(n){var o=Array(2);o[0]=o[1]=0;while(n){o[0]+=n.offsetLeft;o[1]+=n.offsetTop;n=n.offsetParent}return o};return l};var CreateAmtRemoteTerminal=function(C){var D={};D.DivId=C;D.DivElement=document.getElementById(C);D.protocol=1;D.fxEmulation=0;D.width=80;D.height=25;D.lineFeed="\r\n";var r=21;var s=13;var m=["000000","BB0000","00BB00","BBBB00","0000BB","BB00BB","00BBBB","BBBBBB","555555","FF5555","55FF55","FFFF55","5555FF","FF55FF","55FFFF","FFFFFF"];var p=0;var o=7;var n=0;var t=true;var w=0;var y=0;var v=0;var d=[];var f=0;var l=[];var z=[];var B=1;var A=2;D.Start=function(){};D.Init=function(F,E){D.width=F?F:80;D.height=E?E:25;for(var H=0;H<D.height;H++){z[H]=[];l[H]=[];for(var G=0;G<D.width;G++){z[H][G]=" ";l[H][G]=(7<<6)}}D.TermInit();D.TermDraw()};D.xxStateChange=function(E){};D.ProcessData=function(E){if(D.capture!=null){D.capture+=E}k(E);D.TermDraw()};function k(F){for(var E=0;E<F.length;E++){j(String.fromCharCode(F.charCodeAt(E)),F.charCodeAt(E))}}function j(E,F){switch(v){case 0:switch(F){case 27:v=1;break;default:h(E);break}break;case 1:switch(E){case"[":f=0;d=[];v=2;break;case"(":v=4;break;case")":v=5;break;default:v=0;break}break;case 2:if(E>="0"&&E<="9"){if(!d[f]){d[f]=(E-"0")}else{d[f]=((d[f]*10)+(E-"0"))}break}else{if(E==";"){f++;break}else{if(!d[0]){d[0]=0}g(E,d,f+1);v=0}}break;case 4:v=0;break;case 5:v=0;break}}function g(H,E,F){var I;switch(H){case"c":D.TermResetScreen();break;case"A":if(F==1){y-=E[0];if(y<0){y=0}}break;case"B":if(F==1){y+=E[0];if(y>D.height){y=D.height}}break;case"C":if(F==1){w+=E[0];if(w>D.width){w=D.width}}break;case"D":if(F==1){w-=E[0];if(w<0){w=0}}break;case"d":if(F==1){y=E[0]-1;if(y>D.height){y=D.height}if(y<0){y=0}}break;case"G":if(F==1){w=E[0]-1;if(w<0){w=0}if(w>79){w=79}}break;case"J":if(F==1&&E[0]==2){D.TermClear((n<<12)+(o<<6));w=0;y=0}else{if(F==0||F==1&&E[0]==0){b();for(I=y+1;I<D.height;I++){c(I)}}else{if(F==1&&E[0]==1){b();for(I=0;I<y-1;I++){c(I)}}}}break;case"H":if(F==2){if(E[0]<1){E[0]=1}if(E[1]<1){E[1]=1}if(E[0]>D.height){E[0]=D.height}if(E[1]>D.width){E[1]=D.width}y=E[0]-1;w=E[1]-1}else{y=0;w=0}break;case"m":for(I=0;I<F;I++){if(!E[I]||E[I]==0){n=0;o=7;p=0}else{if(E[I]==1){if(o<8){o+=8}}else{if(E[I]==2||E[I]==22){if(o>=8){o-=8}}else{if(E[I]==7){p=2}else{if(E[I]==27){p=0}else{if(E[I]>=30&&E[I]<=37){var G=(o>=8);o=(E[I]-30);if(G&&o<=8){o+=8}}else{if(E[I]>=40&&E[I]<=47){n=(E[I]-40)}else{if(E[I]>=90&&E[I]<=99){o=(E[I]-82)}else{if(E[I]>=100&&E[I]<=109){n=(E[I]-92)}}}}}}}}}}break;case"K":if(F==0||(F==1&&(!E[0]||E[0]==0))){b()}else{if(F==1){if(E[0]==1){a()}else{if(E[0]==2){c(y)}}}}break;case"h":t=true;break;case"l":t=false;break;default:break}}D.ProcessVt100String=function(F){for(var E=0;E<F.length;E++){h(String.fromCharCode(F.charCodeAt(E)))}};function h(E){if(E=="\0"||E.charCodeAt()==7){return}var F=E.charCodeAt();switch(F){case 16:E=" ";break;case 24:E="?";break;case 25:E="?";break}if(w>D.width){w=D.width}if(y>(D.height-1)){y=(D.height-1)}switch(E){case"\b":if(w>0){w=w-1;q(" ")}break;case"\t":var G=8-(w%8);for(var H=0;H<G;H++){h(" ")}break;case"\n":y++;if(y>(D.height-1)){u(1);y=(D.height-1)}break;case"\r":w=0;break;default:if(w>=D.width){w=0;if(t){y++}if(y>=(D.height-1)){u(1);y=(D.height-1)}}q(E);w++;break}}function q(E){z[y][w]=E;l[y][w]=(o<<6)+(n<<12)+p}D.TermClear=function(E){for(var G=0;G<D.height;G++){for(var F=0;F<D.width;F++){z[G][F]=" ";l[G][F]=E}}};D.TermResetScreen=function(){p=0;o=7;n=0;t=true;w=0;y=0;D.TermClear(7<<6)};function b(){var E=(n<<12);for(var F=w;F<D.width;F++){z[y][F]=" ";l[y][F]=E}}function a(){var E=(n<<12);for(var F=0;F<w;F++){z[y][F]=" ";l[y][F]=E}}function c(E){var F=(n<<12);for(var G=0;G<D.width;G++){z[E][G]=" ";l[E][G]=F}}D.TermSendKeys=function(E){D.parent.send(E)};D.TermSendKey=function(E){D.parent.send(String.fromCharCode(E))};function u(E){var F,G;for(G=0;G<D.height-E;G++){z[G]=z[G+E];l[G]=l[G+E]}for(G=D.height-E;G<D.height;G++){z[G]=[];l[G]=[];for(F=0;F<D.width;F++){z[G][F]=" ";l[G][F]=(7<<6)}}}D.TermHandleKeys=function(E){if(!E.ctrlKey){if(E.which==127){D.TermSendKey(8)}else{if(E.which==13){D.TermSendKeys(D.lineFeed)}else{if(E.which!=0){D.TermSendKey(E.which)}}}return false}if(E.preventDefault){E.preventDefault()}if(E.stopPropagation){E.stopPropagation()}};D.TermHandleKeyUp=function(E){if((E.which!=8)&&(E.which!=32)&&(E.which!=9)){return true}if(E.preventDefault){E.preventDefault()}if(E.stopPropagation){E.stopPropagation()}return false};D.TermHandleKeyDown=function(E){if((E.which>=65)&&(E.which<=90)&&(E.ctrlKey==true)){D.TermSendKey(E.which-64);if(E.preventDefault){E.preventDefault()}if(E.stopPropagation){E.stopPropagation()}return}if(E.which==27){D.TermSendKeys(String.fromCharCode(27));return true}if(E.which==37){D.TermSendKeys(String.fromCharCode(27,91,68));return true}if(E.which==38){D.TermSendKeys(String.fromCharCode(27,91,65));return true}if(E.which==39){D.TermSendKeys(String.fromCharCode(27,91,67));return true}if(E.which==40){D.TermSendKeys(String.fromCharCode(27,91,66));return true}if(E.which==9){D.TermSendKeys("\t");if(E.preventDefault){E.preventDefault()}if(E.stopPropagation){E.stopPropagation()}return true}if(E.which!=8&&E.which!=32&&E.which!=9){return true}D.TermSendKey(E.which);if(E.preventDefault){E.preventDefault()}if(E.stopPropagation){E.stopPropagation()}return false};D.TermDraw=function(){var F,E="",G="",H,I=1,K,L;for(var M=0;M<D.height;++M){for(var J=0;J<D.width;++J){H=l[M][J];if(w==J&&y==M){H|=A}if(H!=I){E+=G;G="";K=6;L=12;if(H&A){K=12;L=6}E+='<span style="color:#'+m[(H>>K)&63]+";background-color:#"+m[(H>>L)&63];if(H&B){E+=";text-decoration:underline"}E+=';">';G="</span>"+G;I=H}F=z[M][J];switch(F){case"&":E+="&amp;";break;case"<":E+="&lt;";break;case">":E+="&gt;";break;case" ":E+="&nbsp;";break;default:E+=F;break}}if(M!=(D.height-1)){E+="<br>"}}D.DivElement.innerHTML="<font size='4'><b>"+E+G+"</b></font>"};D.TermInit=function(){D.TermResetScreen()};D.Init();return D};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var o=15;var H=0;var E=1;var an=2;var ag=3;var B=4;var C=5;var ad=6;var j=7;var G=8;var q=9;var p=10;var ao=11;var ap=12;var ak=13;var l=14;var k=15;var am=16;var X=17;var g=18;var T=19;var S=20;var U=21;var r=22;var s=23;var ab=24;var Z=25;var d=26;var W=27;var v=28;var a=29;var ac=30;var al=31;var A=852;var z=592;var y=(A+z);var h=0;var Y=1;var u=2;var O=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var P=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var M=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var N=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function L(aS,aW){var aN=15;var aV=aS.next;var au=(aW==u?aS.distbits:aS.lenbits);var aY=aS.work;var aI=aS.lens;var aJ=(aW==u?aS.nlen:0);var aT=aS.codes;var av;if(aW==Y){av=aS.nlen}else{if(aW==u){av=aS.ndist}else{av=19}}var aH;var aU;var aO,aM;var aR;var ax;var ay;var aG;var aX;var aE;var aF;var aC;var aK;var aL;var aD;var aP;var ar;var at;var aA;var aB;var az;var aw=new Array(aN+1);var aQ=new Array(aN+1);for(aH=0;aH<=aN;aH++){aw[aH]=0}for(aU=0;aU<av;aU++){aw[aI[aJ+aU]]++}aR=au;for(aM=aN;aM>=1;aM--){if(aw[aM]!=0){break}}if(aR>aM){aR=aM}if(aM==0){aD={op:64,bits:1,val:0};aT[aV++]=aD;aT[aV++]=aD;if(aW==u){aS.distbits=1}else{aS.lenbits=1}aS.next=aV;return 0}for(aO=1;aO<aM;aO++){if(aw[aO]!=0){break}}if(aR<aO){aR=aO}aG=1;for(aH=1;aH<=aN;aH++){aG<<=1;aG-=aw[aH];if(aG<0){return -1}}if(aG>0&&(aW==h||aM!=1)){aS.next=aV;return -1}aQ[1]=0;for(aH=1;aH<aN;aH++){aQ[aH+1]=aQ[aH]+aw[aH]}for(aU=0;aU<av;aU++){if(aI[aJ+aU]!=0){aY[aQ[aI[aJ+aU]]++]=aU}}switch(aW){case h:ar=aA=aY;at=0;aB=0;az=19;break;case Y:ar=O;at=-257;aA=P;aB=-257;az=256;break;default:ar=M;aA=N;at=0;aB=0;az=-1}aE=0;aU=0;aH=aO;aP=aV;ax=aR;ay=0;aK=-1;aX=1<<aR;aL=aX-1;if((aW==Y&&aX>=A)||(aW==u&&aX>=z)){aS.next=aV;return 1}for(;;){aD={op:0,bits:aH-ay,val:0};if(aY[aU]<az){aD.val=aY[aU]}else{if(aY[aU]>az){aD.op=aA[aB+aY[aU]];aD.val=ar[at+aY[aU]]}else{aD.op=32+64}}aF=1<<(aH-ay);aC=1<<ax;aO=aC;do{aC-=aF;aT[aP+(aE>>>ay)+aC]=aD}while(aC!=0);aF=1<<(aH-1);while(aE&aF){aF>>>=1}if(aF!=0){aE&=aF-1;aE+=aF}else{aE=0}aU++;if(--(aw[aH])==0){if(aH==aM){break}aH=aI[aJ+aY[aU]]}if(aH>aR&&(aE&aL)!=aK){if(ay==0){ay=aR}aP+=aO;ax=aH-ay;aG=(1<<ax);while(ax+ay<aM){aG-=aw[ax+ay];if(aG<=0){break}ax++;aG<<=1}aX+=1<<ax;if((aW==Y&&aX>=A)||(aW==u&&aX>=z)){aS.next=aV;return 1}aK=aE&aL;aT[aV+aK]={op:ax,bits:aR,val:aP-aV}}}if(aE!=0){aT[aP+aE]={op:64,bits:aH-ay,val:0}}aS.next=aV+aX;if(aW==u){aS.distbits=aR}else{aS.lenbits=aR}return 0}function I(aO,aM){var aN;var aD;var aJ;var aE;var aL;var ar;var ay;var aS;var aP;var aR;var aQ;var aC;var at;var au;var aF;var av;var aI;var ax;var aB;var aK;var aG;var aw;var aA=-1;var az=-1;aN=aO.state;aD=aO.input_data;aJ=aO.next_in;aE=aJ+aO.avail_in-5;aL=aO.next_out;ar=aL-(aM-aO.avail_out);ay=aL+(aO.avail_out-257);aS=aN.wsize;aP=aN.whave;aR=aN.wnext;aQ=aN.window;aC=aN.hold;at=aN.bits;au=aN.codes;aF=aN.lencode;av=aN.distcode;aI=(1<<aN.lenbits)-1;ax=(1<<aN.distbits)-1;loop:do{if(at<15){aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8;aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8}aB=au[aF+(aC&aI)];dolen:while(true){aK=aB.bits;aC>>>=aK;at-=aK;aK=aB.op;if(aK==0){aO.output_data+=String.fromCharCode(aB.val);aL++}else{if(aK&16){aG=aB.val;aK&=15;if(aK){if(at<aK){aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8}aG+=aC&((1<<aK)-1);aC>>>=aK;at-=aK}if(at<15){aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8;aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8}aB=au[av+(aC&ax)];dodist:while(true){aK=aB.bits;aC>>>=aK;at-=aK;aK=aB.op;if(aK&16){aw=aB.val;aK&=15;if(at<aK){aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8;if(at<aK){aC+=(aD.charCodeAt(aJ++)&255)<<at;at+=8}}aw+=aC&((1<<aK)-1);aC>>>=aK;at-=aK;aK=aL-ar;if(aw>aK){aK=aw-aK;if(aK>aP){if(aN.sane){aO.msg="invalid distance too far back";aN.mode=a;break loop}}aA=0;az=-1;if(aR==0){aA+=aS-aK;if(aK<aG){aG-=aK;aO.output_data+=aQ.substring(aA,aA+aK);aL+=aK;aK=0;aA=-1;az=aL-aw}}else{aA+=aR-aK;if(aK<aG){aG-=aK;aO.output_data+=aQ.substring(aA,aA+aK);aL+=aK;aA=-1;az=aL-aw}}}else{aA=-1;az=aL-aw}if(aA>=0){aO.output_data+=aQ.substring(aA,aA+aG);aL+=aG;aA+=aG}else{var aH=aG;if(aH>aL-az){aH=aL-az}aO.output_data+=aO.output_data.substring(az,az+aH);aL+=aH;aG-=aH;az+=aH;aL+=aG;while(aG>2){aO.output_data+=aO.output_data.charAt(az++);aO.output_data+=aO.output_data.charAt(az++);aO.output_data+=aO.output_data.charAt(az++);aG-=3}if(aG){aO.output_data+=aO.output_data.charAt(az++);if(aG>1){aO.output_data+=aO.output_data.charAt(az++)}}}}else{if((aK&64)==0){aB=au[av+(aB.val+(aC&((1<<aK)-1)))];continue dodist}else{aO.msg="invalid distance code";aN.mode=a;break loop}}break dodist}}else{if((aK&64)==0){aB=au[aF+(aB.val+(aC&((1<<aK)-1)))];continue dolen}else{if(aK&32){aN.mode=ao;break loop}else{aO.msg="invalid literal/length code";aN.mode=a;break loop}}}}break dolen}}while(aJ<aE&&aL<ay);aG=at>>>3;aJ-=aG;at-=aG<<3;aC&=(1<<at)-1;aO.next_in=aJ;aO.next_out=aL;aO.avail_in=(aJ<aE?5+(aE-aJ):5-(aJ-aE));aO.avail_out=(aL<ay?257+(ay-aL):257-(aL-ay));aN.hold=aC;aN.bits=at}function af(au){var at;var ar=new Array(au);for(at=0;at<au;at++){ar[at]=0}return ar}function F(au,at,ar){return(au&&(at in au))?au[at]:ar}function f(){return 0}function K(){var at;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=af(320);this.work=af(288);this.codes=new Array(y);var ar={op:0,bits:0,val:0};for(at=0;at<y;at++){this.codes[at]=ar}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(at){var ar;if(!at||!at.state){return ZLIB.Z_STREAM_ERROR}ar=at.state;at.total_in=at.total_out=ar.total=0;at.msg=null;if(ar.wrap){at.adler=ar.wrap&1}ar.mode=H;ar.last=0;ar.havedict=0;ar.dmax=32768;ar.head=null;ar.hold=0;ar.bits=0;ar.lencode=0;ar.distcode=0;ar.next=0;ar.sane=1;ar.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(at,au){var av;var ar;if(!at||!at.state){return ZLIB.Z_STREAM_ERROR}ar=at.state;if(typeof au==="undefined"){au=o}if(au<0){av=0;au=-au}else{av=(au>>>4)+1;if(au<48){au&=15}}if(av==1&&(typeof ZLIB.adler32==="function")){at.checksum_function=ZLIB.adler32}else{if(av==2&&(typeof ZLIB.crc32==="function")){at.checksum_function=ZLIB.crc32}else{at.checksum_function=f}}if(au&&(au<8||au>15)){return ZLIB.Z_STREAM_ERROR}if(ar.window&&ar.wbits!=au){ar.window=null}ar.wrap=av;ar.wbits=au;ar.wsize=0;ar.whave=0;ar.wnext=0;return ZLIB.inflateResetKeep(at)};ZLIB.inflateInit=function(at){var ar=new ZLIB.z_stream();ar.state=new K();ZLIB.inflateReset(ar,at);return ar};ZLIB.inflatePrime=function(au,ar,av){var at;if(!au||!au.state){return ZLIB.Z_STREAM_ERROR}at=au.state;if(ar<0){at.hold=0;at.bits=0;return ZLIB.Z_OK}if(ar>16||at.bits+ar>32){return ZLIB.Z_STREAM_ERROR}av&=(1<<ar)-1;at.hold+=av<<at.bits;at.bits+=ar;return ZLIB.Z_OK};var V=null;var t=null;function D(at){var ar;if(!V){V=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!t){t=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}at.lencode=0;at.distcode=512;for(ar=0;ar<512;ar++){at.codes[ar]=V[ar]}for(ar=0;ar<32;ar++){at.codes[ar+512]=t[ar]}at.lenbits=9;at.distbits=5}function aq(au){var at=au.state;var ar=au.output_data.length;if(at.window===null){at.window=""}if(at.wsize==0){at.wsize=1<<at.wbits}if(ar>=at.wsize){at.window=au.output_data.substring(ar-at.wsize)}else{if(at.whave+ar<at.wsize){at.window+=au.output_data}else{at.window=at.window.substring(at.whave-(at.wsize-ar))+au.output_data}}at.whave=at.window.length;if(at.whave<at.wsize){at.wnext=at.whave}else{at.wnext=0}return 0}function m(at,au){var ar=[au&255,(au>>>8)&255];at.state.check=at.checksum_function(at.state.check,ar,0,2)}function n(at,au){var ar=[au&255,(au>>>8)&255,(au>>>16)&255,(au>>>24)&255];at.state.check=at.checksum_function(at.state.check,ar,0,4)}function aa(at,ar){ar.strm=at;ar.left=at.avail_out;ar.next=at.next_in;ar.have=at.avail_in;ar.hold=at.state.hold;ar.bits=at.state.bits;return ar}function ai(ar){var at=ar.strm;at.next_in=ar.next;at.avail_out=ar.left;at.avail_in=ar.have;at.state.hold=ar.hold;at.state.bits=ar.bits}function R(ar){ar.hold=0;ar.bits=0}function ah(ar){if(ar.have==0){return false}ar.have--;ar.hold+=(ar.strm.input_data.charCodeAt(ar.next++)&255)<<ar.bits;ar.bits+=8;return true}function ae(at,ar){while(at.bits<ar){if(!ah(at)){return false}}return true}function b(at,ar){return at.hold&((1<<ar)-1)}function w(at,ar){at.hold>>>=ar;at.bits-=ar}function c(ar){ar.hold>>>=ar.bits&7;ar.bits-=ar.bits&7}function aj(ar){return((ar>>>24)&255)+((ar>>>8)&65280)+((ar&65280)<<8)+((ar&255)<<24)}var J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aE,au){var aD;var aC;var ar,aA;var at;var aw=-1;var av=-1;var ax;var ay;var az;var aB;if(!aE||!aE.state||(!aE.input_data&&aE.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aD=aE.state;if(aD.mode==ao){aD.mode=ap}aC={};aa(aE,aC);ar=aC.have;aA=aC.left;aB=ZLIB.Z_OK;inf_leave:for(;;){switch(aD.mode){case H:if(aD.wrap==0){aD.mode=ap;break}if(!ae(aC,16)){break inf_leave}if((aD.wrap&2)&&aC.hold==35615){aD.check=aE.checksum_function(0,null,0,0);m(aE,aC.hold);R(aC);aD.mode=E;break}aD.flags=0;if(aD.head!==null){aD.head.done=-1}if(!(aD.wrap&1)||((b(aC,8)<<8)+(aC.hold>>>8))%31){aE.msg="incorrect header check";aD.mode=a;break}if(b(aC,4)!=ZLIB.Z_DEFLATED){aE.msg="unknown compression method";aD.mode=a;break}w(aC,4);az=b(aC,4)+8;if(aD.wbits==0){aD.wbits=az}else{if(az>aD.wbits){aE.msg="invalid window size";aD.mode=a;break}}aD.dmax=1<<az;aE.adler=aD.check=aE.checksum_function(0,null,0,0);aD.mode=aC.hold&512?q:ao;R(aC);break;case E:if(!ae(aC,16)){break inf_leave}aD.flags=aC.hold;if((aD.flags&255)!=ZLIB.Z_DEFLATED){aE.msg="unknown compression method";aD.mode=a;break}if(aD.flags&57344){aE.msg="unknown header flags set";aD.mode=a;break}if(aD.head!==null){aD.head.text=(aC.hold>>>8)&1}if(aD.flags&512){m(aE,aC.hold)}R(aC);aD.mode=an;case an:if(!ae(aC,32)){break inf_leave}if(aD.head!==null){aD.head.time=aC.hold}if(aD.flags&512){n(aE,aC.hold)}R(aC);aD.mode=ag;case ag:if(!ae(aC,16)){break inf_leave}if(aD.head!==null){aD.head.xflags=aC.hold&255;aD.head.os=aC.hold>>>8}if(aD.flags&512){m(aE,aC.hold)}R(aC);aD.mode=B;case B:if(aD.flags&1024){if(!ae(aC,16)){break inf_leave}aD.length=aC.hold;if(aD.head!==null){aD.head.extra_len=aC.hold}if(aD.flags&512){m(aE,aC.hold)}R(aC);aD.head.extra=""}else{if(aD.head!==null){aD.head.extra=null}}aD.mode=C;case C:if(aD.flags&1024){at=aD.length;if(at>aC.have){at=aC.have}if(at){if(aD.head!==null&&aD.head.extra!==null){az=aD.head.extra_len-aD.length;aD.head.extra+=aE.input_data.substring(aC.next,aC.next+(az+at>aD.head.extra_max?aD.head.extra_max-az:at))}if(aD.flags&512){aD.check=aE.checksum_function(aD.check,aE.input_data,aC.next,at)}aC.have-=at;aC.next+=at;aD.length-=at}if(aD.length){break inf_leave}}aD.length=0;aD.mode=ad;case ad:if(aD.flags&2048){if(aC.have==0){break inf_leave}if(aD.head!==null&&aD.head.name===null){aD.head.name=""}at=0;do{az=aE.input_data.charAt(aC.next+at);at++;if(az==="\0"){break}if(aD.head!==null&&aD.length<aD.head.name_max){aD.head.name+=az;aD.length++}}while(at<aC.have);if(aD.flags&512){aD.check=aE.checksum_function(aD.check,aE.input_data,aC.next,at)}aC.have-=at;aC.next+=at;if(az!=="\0"){break inf_leave}}else{if(aD.head!==null){aD.head.name=null}}aD.length=0;aD.mode=j;case j:if(aD.flags&4096){if(aC.have==0){break inf_leave}at=0;if(aD.head!==null&&aD.head.comment===null){aD.head.comment=""}do{az=aE.input_data.charAt(aC.next+at);at++;if(az==="\0"){break}if(aD.head!==null&&aD.length<aD.head.comm_max){aD.head.comment+=az;aD.length++}}while(at<aC.have);if(aD.flags&512){aD.check=aE.checksum_function(aD.check,aE.input_data,aC.next,at)}aC.have-=at;aC.next+=at;if(az!=="\0"){break inf_leave}}else{if(aD.head!==null){aD.head.comment=null}}aD.mode=G;case G:if(aD.flags&512){if(!ae(aC,16)){break inf_leave}if(aC.hold!=(aD.check&65535)){aE.msg="header crc mismatch";aD.mode=a;break}R(aC)}if(aD.head!==null){aD.head.hcrc=(aD.flags>>>9)&1;aD.head.done=1}aE.adler=aD.check=aE.checksum_function(0,null,0,0);aD.mode=ao;break;case q:if(!ae(aC,32)){break inf_leave}aE.adler=aD.check=aj(aC.hold);R(aC);aD.mode=p;case p:if(aD.havedict==0){ai(aC);return ZLIB.Z_NEED_DICT}aE.adler=aD.check=aE.checksum_function(0,null,0,0);aD.mode=ao;case ao:if(au==ZLIB.Z_BLOCK||au==ZLIB.Z_TREES){break inf_leave}case ap:if(aD.last){c(aC);aD.mode=d;break}if(!ae(aC,3)){break inf_leave}aD.last=b(aC,1);w(aC,1);switch(b(aC,2)){case 0:aD.mode=ak;break;case 1:D(aD);aD.mode=T;if(au==ZLIB.Z_TREES){w(aC,2);break inf_leave}break;case 2:aD.mode=am;break;case 3:aE.msg="invalid block type";aD.mode=a}w(aC,2);break;case ak:c(aC);if(!ae(aC,32)){break inf_leave}if((aC.hold&65535)!=(((aC.hold>>>16)&65535)^65535)){aE.msg="invalid stored block lengths";aD.mode=a;break}aD.length=aC.hold&65535;R(aC);aD.mode=l;if(au==ZLIB.Z_TREES){break inf_leave}case l:aD.mode=k;case k:at=aD.length;if(at){if(at>aC.have){at=aC.have}if(at>aC.left){at=aC.left}if(at==0){break inf_leave}aE.output_data+=aE.input_data.substring(aC.next,aC.next+at);aE.next_out+=at;aC.have-=at;aC.next+=at;aC.left-=at;aD.length-=at;break}aD.mode=ao;break;case am:if(!ae(aC,14)){break inf_leave}aD.nlen=b(aC,5)+257;w(aC,5);aD.ndist=b(aC,5)+1;w(aC,5);aD.ncode=b(aC,4)+4;w(aC,4);if(aD.nlen>286||aD.ndist>30){aE.msg="too many length or distance symbols";aD.mode=a;break}aD.have=0;aD.mode=X;case X:while(aD.have<aD.ncode){if(!ae(aC,3)){break inf_leave}var aF=b(aC,3);aD.lens[J[aD.have++]]=aF;w(aC,3)}while(aD.have<19){aD.lens[J[aD.have++]]=0}aD.next=0;aD.lencode=0;aD.lenbits=7;aB=L(aD,h);if(aB){aE.msg="invalid code lengths set";aD.mode=a;break}aD.have=0;aD.mode=g;case g:while(aD.have<aD.nlen+aD.ndist){for(;;){ax=aD.codes[aD.lencode+b(aC,aD.lenbits)];if(ax.bits<=aC.bits){break}if(!ah(aC)){break inf_leave}}if(ax.val<16){w(aC,ax.bits);aD.lens[aD.have++]=ax.val}else{if(ax.val==16){if(!ae(aC,ax.bits+2)){break inf_leave}w(aC,ax.bits);if(aD.have==0){aE.msg="invalid bit length repeat";aD.mode=a;break}az=aD.lens[aD.have-1];at=3+b(aC,2);w(aC,2)}else{if(ax.val==17){if(!ae(aC,ax.bits+3)){break inf_leave}w(aC,ax.bits);az=0;at=3+b(aC,3);w(aC,3)}else{if(!ae(aC,ax.bits+7)){break inf_leave}w(aC,ax.bits);az=0;at=11+b(aC,7);w(aC,7)}}if(aD.have+at>aD.nlen+aD.ndist){aE.msg="invalid bit length repeat";aD.mode=a;break}while(at--){aD.lens[aD.have++]=az}}}if(aD.mode==a){break}if(aD.lens[256]==0){aE.msg="invalid code -- missing end-of-block";aD.mode=a;break}aD.next=0;aD.lencode=aD.next;aD.lenbits=9;aB=L(aD,Y);if(aB){aE.msg="invalid literal/lengths set";aD.mode=a;break}aD.distcode=aD.next;aD.distbits=6;aB=L(aD,u);if(aB){aE.msg="invalid distances set";aD.mode=a;break}aD.mode=T;if(au==ZLIB.Z_TREES){break inf_leave}case T:aD.mode=S;case S:if(aC.have>=6&&aC.left>=258){ai(aC);I(aE,aA);aa(aE,aC);if(aD.mode==ao){aD.back=-1}break}aD.back=0;for(;;){ax=aD.codes[aD.lencode+b(aC,aD.lenbits)];if(ax.bits<=aC.bits){break}if(!ah(aC)){break inf_leave}}if(ax.op&&(ax.op&240)==0){ay=ax;for(;;){ax=aD.codes[aD.lencode+ay.val+(b(aC,ay.bits+ay.op)>>>ay.bits)];if(ay.bits+ax.bits<=aC.bits){break}if(!ah(aC)){break inf_leave}}w(aC,ay.bits);aD.back+=ay.bits}w(aC,ax.bits);aD.back+=ax.bits;aD.length=ax.val;if(ax.op==0){aD.mode=Z;break}if(ax.op&32){aD.back=-1;aD.mode=ao;break}if(ax.op&64){aE.msg="invalid literal/length code";aD.mode=a;break}aD.extra=ax.op&15;aD.mode=U;case U:if(aD.extra){if(!ae(aC,aD.extra)){break inf_leave}aD.length+=b(aC,aD.extra);w(aC,aD.extra);aD.back+=aD.extra}aD.was=aD.length;aD.mode=r;case r:for(;;){ax=aD.codes[aD.distcode+b(aC,aD.distbits)];if(ax.bits<=aC.bits){break}if(!ah(aC)){break inf_leave}}if((ax.op&240)==0){ay=ax;for(;;){ax=aD.codes[aD.distcode+ay.val+(b(aC,ay.bits+ay.op)>>>ay.bits)];if((ay.bits+ax.bits)<=aC.bits){break}if(!ah(aC)){break inf_leave}}w(aC,ay.bits);aD.back+=ay.bits}w(aC,ax.bits);aD.back+=ax.bits;if(ax.op&64){aE.msg="invalid distance code";aD.mode=a;break}aD.offset=ax.val;aD.extra=ax.op&15;aD.mode=s;case s:if(aD.extra){if(!ae(aC,aD.extra)){break inf_leave}aD.offset+=b(aC,aD.extra);w(aC,aD.extra);aD.back+=aD.extra}aD.mode=ab;case ab:if(aC.left==0){break inf_leave}at=aA-aC.left;if(aD.offset>at){at=aD.offset-at;if(at>aD.whave){if(aD.sane){aE.msg="invalid distance too far back";aD.mode=a;break}}if(at>aD.wnext){at-=aD.wnext;aw=aD.wsize-at;av=-1}else{aw=aD.wnext-at;av=-1}if(at>aD.length){at=aD.length}}else{aw=-1;av=aE.next_out-aD.offset;at=aD.length}if(at>aC.left){at=aC.left}aC.left-=at;aD.length-=at;if(aw>=0){aE.output_data+=aD.window.substring(aw,aw+at);aE.next_out+=at;at=0}else{aE.next_out+=at;do{aE.output_data+=aE.output_data.charAt(av++)}while(--at)}if(aD.length==0){aD.mode=S}break;case Z:if(aC.left==0){break inf_leave}aE.output_data+=String.fromCharCode(aD.length);aE.next_out++;aC.left--;aD.mode=S;break;case d:if(aD.wrap){if(!ae(aC,32)){break inf_leave}aA-=aC.left;aE.total_out+=aA;aD.total+=aA;if(aA){aE.adler=aD.check=aE.checksum_function(aD.check,aE.output_data,aE.output_data.length-aA,aA)}aA=aC.left;if((aD.flags?aC.hold:aj(aC.hold))!=aD.check){aE.msg="incorrect data check";aD.mode=a;break}R(aC)}aD.mode=W;case W:if(aD.wrap&&aD.flags){if(!ae(aC,32)){break inf_leave}if(aC.hold!=(aD.total&4294967295)){aE.msg="incorrect length check";aD.mode=a;break}R(aC)}aD.mode=v;case v:aB=ZLIB.Z_STREAM_END;break inf_leave;case a:aB=ZLIB.Z_DATA_ERROR;break inf_leave;case ac:return ZLIB.Z_MEM_ERROR;case al:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ai(aC);if(aD.wsize||(aA!=aE.avail_out&&aD.mode<a&&(aD.mode<d||au!=ZLIB.Z_FINISH))){if(aq(aE)){aD.mode=ac;return ZLIB.Z_MEM_ERROR}}ar-=aE.avail_in;aA-=aE.avail_out;aE.total_in+=ar;aE.total_out+=aA;aD.total+=aA;if(aD.wrap&&aA){aE.adler=aD.check=aE.checksum_function(aD.check,aE.output_data,0,aE.output_data.length)}aE.data_type=aD.bits+(aD.last?64:0)+(aD.mode==ao?128:0)+(aD.mode==T||aD.mode==l?256:0);if(((ar==0&&aA==0)||au==ZLIB.Z_FINISH)&&aB==ZLIB.Z_OK){aB=ZLIB.Z_BUF_ERROR}return aB};ZLIB.inflateEnd=function(at){var ar;if(!at||!at.state){return ZLIB.Z_STREAM_ERROR}ar=at.state;ar.window=null;at.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(av,aw){var au;var ar;var at=16384;this.input_data=av;this.next_in=F(aw,"next_in",0);this.avail_in=F(aw,"avail_in",av.length-this.next_in);au=F(aw,"flush",ZLIB.Z_SYNC_FLUSH);ar=F(aw,"avail_out",-1);var ax="";do{this.avail_out=(ar>=0?ar:at);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,au);if(ar>=0){return this.output_data}ax+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return ax};ZLIB.z_stream.prototype.inflateReset=function(ar){return ZLIB.inflateReset(this,ar)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(f,g,k,h){var l;var j;l=(f>>>16)&65535;f&=65535;if(h==1){f+=g.charCodeAt(k)&255;if(f>=c){f-=c}l+=f;if(l>=c){l-=c}return f|(l<<16)}if(g===null){return 1}if(h<16){while(h--){f+=g.charCodeAt(k++)&255;l+=f}if(f>=c){f-=c}l%=c;return f|(l<<16)}while(h>=d){h-=d;j=d>>4;do{f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f}while(--j);f%=c;l%=c}if(h){while(h>=16){h-=16;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f;f+=g.charCodeAt(k++)&255;l+=f}while(h--){f+=g.charCodeAt(k++)&255;l+=f}f%=c;l%=c}return f|(l<<16)}function a(f,g,k,h){var l;var j;l=(f>>>16)&65535;f&=65535;if(h==1){f+=g[k];if(f>=c){f-=c}l+=f;if(l>=c){l-=c}return f|(l<<16)}if(g===null){return 1}if(h<16){while(h--){f+=g[k++];l+=f}if(f>=c){f-=c}l%=c;return f|(l<<16)}while(h>=d){h-=d;j=d>>4;do{f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f}while(--j);f%=c;l%=c}if(h){while(h>=16){h-=16;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f;f+=g[k++];l+=f}while(h--){f+=g[k++];l+=f}f%=c;l%=c}return f|(l<<16)}ZLIB.adler32=function(f,g,j,h){if(typeof g==="string"){return b(f,g,j,h)}else{return a(f,g,j,h)}};ZLIB.adler32_combine=function(f,g,h){var k;var l;var j;if(h<0){return 4294967295}h%=c;j=h;k=f&65535;l=j*k;l%=c;k+=(g&65535)+c-1;l+=((f>>16)&65535)+((g>>16)&65535)+c-j;if(k>=c){k-=c}if(k>=c){k-=c}if(l>=(c<<1)){l-=(c<<1)}if(l>=c){l-=c}return k|(l<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(j,h,l,k){if(h==null){return 0}j=j^4294967295;while(k>=8){j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);j=a[(j^h.charCodeAt(l++))&255]^(j>>>8);k-=8}if(k){do{j=a[(j^h.charCodeAt(l++))&255]^(j>>>8)}while(--k)}return j^4294967295}function b(j,h,l,k){if(h==null){return 0}j=j^4294967295;while(k>=8){j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);j=a[(j^h[l++])&255]^(j>>>8);k-=8}if(k){do{j=a[(j^h[l++])&255]^(j>>>8)}while(--k)}return j^4294967295}ZLIB.crc32=function(j,h,l,k){if(typeof h==="string"){return c(j,h,l,k)}else{return b(j,h,l,k)}};var d=32;function g(h,l){var k;var j=0;k=0;while(l){if(l&1){k^=h[j]}l>>=1;j++}return k}function f(k,h){var j;for(j=0;j<d;j++){k[j]=g(h,h[j])}}ZLIB.crc32_combine=function(h,j,l){var m;var p;var k;var o;if(l<=0){return h}k=new Array(d);o=new Array(d);o[0]=3988292384;p=1;for(m=1;m<d;m++){o[m]=p;p<<=1}f(k,o);f(o,k);do{f(k,o);if(l&1){h=g(k,h)}l>>=1;if(l==0){break}f(o,k);if(l&1){h=g(o,h)}l>>=1}while(l!=0);h^=j;return h}}());var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,f,h,d,g){b.host=c;b.port=f;b.user=h;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+f+"&tls="+g+((h=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+h):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(p){if(!p||b.connectstate==-1){return}if(typeof p==="object"){var h="";var k=new Uint8Array(p);var u=k.byteLength;for(var t=0;t<u;t++){h+=String.fromCharCode(k[t])}p=h}else{if(typeof p!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(p)}b.amtaccumulator+=p;while(b.amtaccumulator.length>=1){var l=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var I=b.amtaccumulator.charCodeAt(1);switch(I){case 0:if(b.amtaccumulator.length<13){return}var z=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+z){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));l=(13+z);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var f=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+f){return}var H=b.amtaccumulator.charCodeAt(1);var g=b.amtaccumulator.charCodeAt(4);var c=[];for(t=0;t<f;t++){c.push(b.amtaccumulator.charCodeAt(9+t))}var d=b.amtaccumulator.substring(9,9+f);l=9+f;if(g==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((g==3||g==4)&&H==1){var o=0;var D=d.charCodeAt(o);var C=d.substring(o+1,o+1+D);o+=(D+1);var y=d.charCodeAt(o);var w=d.substring(o+1,o+1+y);o+=(y+1);var B=0;var A=null;var m=b.xxRandomNonce(32);var G="00000002";var r="";if(g==4){B=d.charCodeAt(o);A=d.substring(o+1,o+1+B);o+=(B+1);r=G+":"+m+":"+A+":"}var q=hex_md5(hex_md5(b.user+":"+C+":"+b.pass)+":"+w+":"+r+hex_md5("POST:"+b.authuri));var J=b.user.length+C.length+w.length+b.authuri.length+m.length+G.length+q.length+7;if(g==4){J+=(A.length+1)}var j=String.fromCharCode(19,0,0,0,g)+IntToStrX(J)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(C.length)+C+String.fromCharCode(w.length)+w+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(m.length)+m+String.fromCharCode(G.length)+G+String.fromCharCode(q.length)+q;if(g==4){j+=(String.fromCharCode(A.length)+A)}b.xxSend(j)}else{if(H==0){if(b.protocol==1){var v=10000;var L=100;var K=0;var F=10000;var E=100;var s=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(v)+ShortToStrX(L)+ShortToStrX(K)+ShortToStrX(F)+ShortToStrX(E)+ShortToStrX(s)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}l=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}l=10;break;case 42:if(b.amtaccumulator.length<10){break}var n=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<n){break}b.m.ProcessData(b.amtaccumulator.substring(10,n));l=n;break;case 43:if(b.amtaccumulator.length<8){break}l=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}l=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(l==0){return}b.amtaccumulator=b.amtaccumulator.substring(l)}};b.xxSend=function(f){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",f)}var c=new Uint8Array(f.length);for(var d=0;d<f.length;++d){c[d]=f.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var f="";for(var c=0;c<d;c++){f+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return f};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateWsmanComm=function(h,l,n,k,m){var j={};j.PendingAjax=[];j.ActiveAjaxCount=0;j.MaxActiveAjaxCount=1;j.FailAllError=0;j.challengeParams=null;j.noncecounter=1;j.authcounter=0;j.socket=null;j.socketState=0;j.host=h;j.port=l;j.user=n;j.pass=k;j.tls=m;j.tlsv1only=1;j.cnonce=Math.random().toString(36).substring(7);j.PerformAjax=function(q,p,s,r,t,o){if(j.ActiveAjaxCount<j.MaxActiveAjaxCount&&j.PendingAjax.length==0){j.PerformAjaxEx(q,p,s,t,o)}else{if(r==1){j.PendingAjax.unshift([q,p,s,t,o])}else{j.PendingAjax.push([q,p,s,t,o])}}};j.PerformNextAjax=function(){if(j.ActiveAjaxCount>=j.MaxActiveAjaxCount||j.PendingAjax.length==0){return}var o=j.PendingAjax.shift();j.PerformAjaxEx(o[0],o[1],o[2],o[3],o[4]);j.PerformNextAjax()};j.PerformAjaxEx=function(q,p,r,s,o){if(j.FailAllError!=0){j.gotNextMessagesError({status:j.FailAllError},"error",null,[q,p,r,s,o]);return}if(!q){q=""}j.ActiveAjaxCount++;return j.PerformAjaxExNodeJS(q,p,r,s,o)};j.pendingAjaxCall=[];j.PerformAjaxExNodeJS=function(q,p,r,s,o){j.PerformAjaxExNodeJS2(q,p,r,s,o,3)};j.PerformAjaxExNodeJS2=function(q,p,s,t,o,r){if(r<=0||j.FailAllError!=0){j.ActiveAjaxCount--;if(j.FailAllError!=999){j.gotNextMessages(null,"error",{status:((j.FailAllError==0)?408:j.FailAllError)},[q,p,s,t,o])}j.PerformNextAjax();return}j.pendingAjaxCall.push([q,p,s,t,o,r]);if(j.socketState==0){j.xxConnectHttpSocket()}else{if(j.socketState==2){j.sendRequest(q,t,o)}}};j.sendRequest=function(q,s,o){s=s?s:"/wsman";o=o?o:"POST";var p=o+" "+s+" HTTP/1.1\r\n";if(j.challengeParams!=null){var r=hex_md5(hex_md5(j.user+":"+j.challengeParams.realm+":"+j.pass)+":"+j.challengeParams.nonce+":"+j.noncecounter+":"+j.cnonce+":"+j.challengeParams.qop+":"+hex_md5(o+":"+s));p+="Authorization: "+j.renderDigest({username:j.user,realm:j.challengeParams.realm,nonce:j.challengeParams.nonce,uri:s,qop:j.challengeParams.qop,response:r,nc:j.noncecounter++,cnonce:j.cnonce})+"\r\n"}p+="Host: "+j.host+":"+j.port+"\r\nTransfer-Encoding: chunked\r\n\r\n"+q.length.toString(16).toUpperCase()+"\r\n"+q+"\r\n0\r\n\r\n";g(p)};j.parseDigest=function(o){var p=o.substring(7).split(",");for(i in p){p[i]=p[i].trim()}return p.reduce(function(q,t){var r=t.split("=");q[r[0]]=r[1].replace(/"/g,"");return q},{})};j.renderDigest=function(o){var p=[];for(i in o){p.push(i)}return"Digest "+p.reduce(function(r,q){return r+","+q+'="'+o[q]+'"'},"").substring(1)};j.xxConnectHttpSocket=function(){j.socketParseState=0;j.socketAccumulator="";j.socketHeader=null;j.socketData="";j.socketState=1;console.log(j.tlsv1only);j.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+j.host+"&port="+j.port+"&tls="+j.tls+"&tlsv1only="+j.tlsv1only+((n=="*")?"&serverauth=1":"")+((typeof k==="undefined")?("&serverauth=1&user="+n):""));j.socket.onopen=c;j.socket.onmessage=a;j.socket.onclose=b};function c(){j.socketState=2;for(i in j.pendingAjaxCall){j.sendRequest(j.pendingAjaxCall[i][0],j.pendingAjaxCall[i][3],j.pendingAjaxCall[i][4])}}function a(q){if(typeof q.data=="object"){var r=new FileReader();if(r.readAsBinaryString){r.onload=function(u){d(u.target.result)};r.readAsBinaryString(new Blob([q.data]))}else{if(r.readAsArrayBuffer){r.onloadend=function(u){d(u.target.result)};r.readAsArrayBuffer(q.data)}else{var o="";var p=new Uint8Array(q.data);var t=p.byteLength;for(var s=0;s<t;s++){o+=String.fromCharCode(p[s])}d(o)}}}else{if(typeof q.data=="string"){d(q.data)}}}function d(s){if(typeof s==="object"){var o="",p=new Uint8Array(s),v=p.byteLength;for(var u=0;u<v;u++){o+=String.fromCharCode(p[u])}s=o}else{if(typeof s!=="string"){return}}j.socketAccumulator+=s;while(true){if(j.socketParseState==0){var t=j.socketAccumulator.indexOf("\r\n\r\n");if(t<0){return}j.socketHeader=j.socketAccumulator.substring(0,t).split("\r\n");j.socketAccumulator=j.socketAccumulator.substring(t+4);j.socketParseState=1;j.socketData="";j.socketXHeader={Directive:j.socketHeader[0].split(" ")};for(u in j.socketHeader){if(u!=0){var w=j.socketHeader[u].indexOf(":");j.socketXHeader[j.socketHeader[u].substring(0,w).toLowerCase()]=j.socketHeader[u].substring(w+2)}}}if(j.socketParseState==1){var r=-1;if((j.socketXHeader.connection!=undefined)&&(j.socketXHeader.connection.toLowerCase()=="close")&&((j.socketXHeader["transfer-encoding"]==undefined)||(j.socketXHeader["transfer-encoding"].toLowerCase()!="chunked"))){r=0}else{if(j.socketXHeader["content-length"]!=undefined){r=parseInt(j.socketXHeader["content-length"]);if(j.socketAccumulator.length<r){return}var s=j.socketAccumulator.substring(0,r);j.socketAccumulator=j.socketAccumulator.substring(r);j.socketData=s;r=0}else{var q=j.socketAccumulator.indexOf("\r\n");if(q<0){return}r=parseInt(j.socketAccumulator.substring(0,q),16);if(isNaN(r)){if(j.websocket){j.websocket.close()}return}if(j.socketAccumulator.length<q+2+r+2){return}var s=j.socketAccumulator.substring(q+2,q+2+r);j.socketAccumulator=j.socketAccumulator.substring(q+2+r+2);j.socketData+=s}}if(r==0){f(j.socketXHeader,j.socketData);j.socketParseState=0;j.socketHeader=null}}}}function f(p,o){var t=parseInt(p.Directive[1]);if(isNaN(t)){t=602}if(t==401&&++(j.authcounter)<3){j.challengeParams=j.parseDigest(p["www-authenticate"])}else{var q=j.pendingAjaxCall.shift();j.authcounter=0;j.ActiveAjaxCount--;j.gotNextMessages(o,"success",{status:t},q);j.PerformNextAjax()}}function b(o){j.socketState=0;if(j.socket!=null){j.socket.close();j.socket=null}if(j.pendingAjaxCall.length>0){var p=j.pendingAjaxCall.shift();var q=p[5];j.PerformAjaxExNodeJS2(p[0],p[1],p[2],p[3],p[4],--q)}}function g(r){if(j.socketState==2&&j.socket!=null&&j.socket.readyState==WebSocket.OPEN){var o=new Uint8Array(r.length);for(var q=0;q<r.length;++q){o[q]=r.charCodeAt(q)}try{j.socket.send(o.buffer)}catch(p){}}}j.gotNextMessages=function(p,r,q,o){if(j.FailAllError==999){return}if(j.FailAllError!=0){o[1](null,j.FailAllError,o[2]);return}if(q.status!=200){o[1](null,q.status,o[2]);return}o[1](p,200,o[2])};j.gotNextMessagesError=function(q,r,p,o){if(j.FailAllError==999){return}if(j.FailAllError!=0){o[1](null,j.FailAllError,o[2]);return}o[1](j,null,{Header:{HttpError:q.status}},q.status,o[2])};j.CancelAllQueries=function(o){while(j.PendingAjax.length>0){var p=j.PendingAjax.shift();p[1](null,o,p[2])}if(j.websocket!=null){j.websocket.close();j.websocket=null;j.socketState=0}};return j};var CreateAgentRedirect=function(a,b,f){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(g){var j,h=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=g;c.connectstate=0;c.socket=new WebSocket(h);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(k){console.error(k)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(j){var g;try{g=JSON.parse(j)}catch(h){return}if(g.ctrlChannel!="102938"){c.xxOnSocketData(j);return}if(c.webrtc!=null){if(g.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(g),function(){},c.xxCloseWebRTC)}else{if(g.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(g.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(g.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(h){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof h,h)}try{c.socket.send(h)}catch(g){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(p){c.xxOnMessage({data:p.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(p){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(p){if(p.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(q){}}else{c.webrtcoffer.sdp+=("a="+p.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){c.Stop()}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(p){c.webrtcoffer=p;c.webrtc.setLocalDescription(p,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(p){c.xxOnSocketData(p.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(p){c.xxOnSocketData(p.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(j){if(!j||c.connectstate==-1){return}if(typeof j==="object"){var g="",h=new Uint8Array(j),l=h.byteLength;for(var k=0;k<l;k++){g+=String.fromCharCode(h[k])}j=g}else{if(typeof j!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof j,j.length,j)}return c.m.ProcessData(j)};c.sendText=function(g){if(typeof g!="string"){g=JSON.stringify(g)}c.send(encode_utf8(g))};c.send=function(l){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof l,l.length,l)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof l=="string"){if(c.debugmode==1){var g=new Uint8Array(l.length),h=[];for(var k=0;k<l.length;++k){g[k]=l.charCodeAt(k);h.push(l.charCodeAt(k))}if(c.webRtcActive==true){c.webchannel.send(g.buffer)}else{c.socket.send(g.buffer)}}else{var g=new Uint8Array(l.length);for(var k=0;k<l.length;++k){g[k]=l.charCodeAt(k)}if(c.webRtcActive==true){c.webchannel.send(g.buffer)}else{c.socket.send(g.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(l)}else{c.socket.send(l)}}}}catch(j){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(g){if(c.State==g){return}c.State=g;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(g){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(g){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(h){if(c.debugmode==1){console.log("stop",h)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(g){}c.socket=null}c.xxStateChange(0)};return c};var CreateAgentRemoteDesktop=function(a,c){var b={};b.CanvasId=a;if(typeof a==="string"){b.CanvasId=Q(a)}b.Canvas=b.CanvasId.getContext("2d");b.scrolldiv=c;b.State=0;b.PendingOperations=[];b.tilesReceived=0;b.TilesDrawn=0;b.KillDraw=0;b.ipad=false;b.tabletKeyboardVisible=false;b.LastX=0;b.LastY=0;b.touchenabled=0;b.submenuoffset=0;b.touchtimer=null;b.TouchArray={};b.connectmode=0;b.connectioncount=0;b.rotation=0;b.protocol=2;b.debugmode=0;b.firstUpKeys=[];b.stopInput=false;b.sessionid=0;b.username;b.oldie=false;b.CompressionLevel=50;b.ScalingLevel=1024;b.FrameRateTimer=50;b.FirstDraw=false;b.ScreenWidth=960;b.ScreenHeight=700;b.width=960;b.height=960;b.onScreenSizeChange=null;b.onMessage=null;b.onConnectCountChanged=null;b.onDebugMessage=null;b.onTouchEnabledChanged=null;b.onDisplayinfo=null;b.Start=function(){b.State=0};b.Stop=function(){b.setRotation(0);b.UnGrabKeyInput();b.UnGrabMouseInput();b.touchenabled=0;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}b.Canvas.clearRect(0,0,b.CanvasId.width,b.CanvasId.height)};b.xxStateChange=function(d){if(b.State==d){return}b.State=d;switch(d){case 0:b.Stop();break;case 3:break}};b.send=function(d){b.parent.send(d)};b.ProcessPictureMsg=function(f,h,j){var g=new Image();g.xcount=b.tilesReceived++;var d=b.tilesReceived;g.src="data:image/jpeg;base64,"+btoa(f.substring(4,f.length));g.onload=function(){if(b.Canvas!=null&&b.KillDraw<d&&b.State!=0){b.PendingOperations.push([d,2,g,h,j]);while(b.DoPendingOperations()){}}};g.error=function(){console.log("DecodeTileError")}};b.DoPendingOperations=function(){if(b.PendingOperations.length==0){return false}for(var d=0;d<b.PendingOperations.length;d++){var f=b.PendingOperations[d];if(f[0]==(b.TilesDrawn+1)){if(f[1]==1){b.ProcessCopyRectMsg(f[2])}else{if(f[1]==2){b.Canvas.drawImage(f[2],b.rotX(f[3],f[4]),b.rotY(f[3],f[4]));delete f[2]}}b.PendingOperations.splice(d,1);delete f;b.TilesDrawn++;if(b.TilesDrawn==b.tilesReceived&&b.KillDraw<b.TilesDrawn){b.KillDraw=b.TilesDrawn=b.tilesReceived=0}return true}}if(b.oldie&&b.PendingOperations.length>0){b.TilesDrawn++}return false};b.ProcessCopyRectMsg=function(h){var j=((h.charCodeAt(0)&255)<<8)+(h.charCodeAt(1)&255);var k=((h.charCodeAt(2)&255)<<8)+(h.charCodeAt(3)&255);var d=((h.charCodeAt(4)&255)<<8)+(h.charCodeAt(5)&255);var f=((h.charCodeAt(6)&255)<<8)+(h.charCodeAt(7)&255);var l=((h.charCodeAt(8)&255)<<8)+(h.charCodeAt(9)&255);var g=((h.charCodeAt(10)&255)<<8)+(h.charCodeAt(11)&255);b.Canvas.drawImage(Canvas.canvas,j,k,l,g,d,f,l,g)};b.SendUnPause=function(){b.send(String.fromCharCode(0,8,0,5,0))};b.SendPause=function(){b.send(String.fromCharCode(0,8,0,5,1))};b.SendCompressionLevel=function(h,f,g,d){if(f){b.CompressionLevel=f}if(g){b.ScalingLevel=g}if(d){b.FrameRateTimer=d}b.send(String.fromCharCode(0,5,0,10,h,b.CompressionLevel)+b.shortToStr(b.ScalingLevel)+b.shortToStr(b.FrameRateTimer))};b.SendRefresh=function(){b.send(String.fromCharCode(0,6,0,4))};b.ProcessScreenMsg=function(f,d){b.Canvas.setTransform(1,0,0,1,0,0);b.rotation=0;b.FirstDraw=true;b.ScreenWidth=b.width=f;b.ScreenHeight=b.height=d;b.KillDraw=b.tilesReceived;while(b.PendingOperations.length>0){b.PendingOperations.shift()}b.SendCompressionLevel(1);b.SendUnPause();if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}};b.ProcessData=function(f){var d=0;while(d<f.length){d+=b.ProcessDataEx(f.substring(d))}};b.ProcessDataEx=function(o){if(o.length<4){return}var d=null,p=0,q=0,g=ReadShort(o,0),f=ReadShort(o,2);if((f!=o.length)&&(b.debugmode==1)){console.log(f,o.length,f==o.length)}if(g>=18){console.error("Invalid KVM command "+g+" of size "+f);console.log("Invalid KVM data",o.length,o,rstr2hex(o));return}if(f>o.length){console.error("KVM invalid command size",f,o.length);return}if(g==3||g==4||g==7){d=o.substring(4,f);p=((d.charCodeAt(0)&255)<<8)+(d.charCodeAt(1)&255);q=((d.charCodeAt(2)&255)<<8)+(d.charCodeAt(3)&255)}switch(g){case 3:if(b.FirstDraw){b.onResize()}b.ProcessPictureMsg(d,p,q);break;case 4:if(b.FirstDraw){b.onResize()}if(b.TilesDrawn==b.tilesReceived){b.ProcessCopyRectMsg(d)}else{b.PendingOperations.push([++tilesReceived,1,d])}break;case 7:b.ProcessScreenMsg(p,q);b.SendKeyMsgKC(b.KeyAction.UP,16);b.SendKeyMsgKC(b.KeyAction.UP,17);b.SendKeyMsgKC(b.KeyAction.UP,18);b.SendKeyMsgKC(b.KeyAction.UP,91);b.SendKeyMsgKC(b.KeyAction.UP,92);b.SendKeyMsgKC(b.KeyAction.UP,16);b.send(String.fromCharCode(0,14,0,4));break;case 11:var l=[],h=((o.charCodeAt(4)&255)<<8)+(o.charCodeAt(5)&255);if(h>0){var n=0,m=((o.charCodeAt(6+(h*2))&255)<<8)+(o.charCodeAt(7+(h*2))&255);for(var k=0;k<h;k++){var j=((o.charCodeAt(6+(k*2))&255)<<8)+(o.charCodeAt(7+(k*2))&255);if(j==65535){l.push("All Displays")}else{l.push("Display "+j)}if(j==m){n=k}}}if(b.onDisplayinfo!=null){b.onDisplayinfo(b,l,n)}break;case 12:break;case 14:b.touchenabled=1;b.TouchArray={};if(b.onTouchEnabledChanged!=null){b.onTouchEnabledChanged(b.touchenabled)}break;case 15:b.TouchArray={};break;case 16:b.connectioncount=ReadInt(o,4);if(b.onConnectCountChanged!=null){b.onConnectCountChanged(b.connectioncount,b)}break;case 17:if(b.onMessage!=null){b.onMessage(o.substring(4,f),b)}break}return f};b.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};b.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};b.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};b.Alternate=0;b.SendKeyMsg=function(d,f){if(d==null){return}if(!f){var f=window.event}var g=f.keyCode;if(g==59){g=186}b.SendKeyMsgKC(d,g)};b.SendMessage=function(d){if(b.State==3){b.send(String.fromCharCode(0,17)+b.shortToStr(4+d.length)+d)}};b.SendKeyMsgKC=function(d,g){if(b.State!=3){return}if(typeof d=="object"){for(var f in d){b.SendKeyMsgKC(d[f][0],d[f][1])}}else{b.send(String.fromCharCode(0,b.InputType.KEY,0,6,(d-1),g))}};b.sendcad=function(){b.SendCtrlAltDelMsg()};b.SendCtrlAltDelMsg=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.CTRLALTDEL,0,4))}};b.SendEscKey=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.KEY,0,6,0,27,0,b.InputType.KEY,0,6,1,27))}};b.SendStartMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendCharmsMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.DOWN,67);b.SendKeyMsgKC(b.KeyAction.UP,67);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendTouchMsg1=function(f,d,g,h){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(14)+String.fromCharCode(1,f)+b.intToStr(d)+b.shortToStr(g)+b.shortToStr(h))}};b.SendTouchMsg2=function(g,d){var j="";var f;var l="TOUCHSEND: ";for(var h in b.TouchArray){if(h==g){f=d}else{if(b.TouchArray[h].f==1){f=65536|2|4;b.TouchArray[h].f=3;l+="START"+h}else{if(b.TouchArray[h].f==2){f=262144;l+="STOP"+h}else{f=2|4|131072}}}j+=String.fromCharCode(h)+b.intToStr(f)+b.shortToStr(b.TouchArray[h].x)+b.shortToStr(b.TouchArray[h].y);if(b.TouchArray[h].f==2){delete b.TouchArray[h]}}if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(5+j.length)+String.fromCharCode(2)+j)}if(Object.keys(b.TouchArray).length==0&&b.touchtimer!=null){clearInterval(b.touchtimer);b.touchtimer=null}};b.SendMouseMsg=function(d,h){if(b.State!=3){return}if(d!=null&&b.Canvas!=null){if(!h){var h=window.event}var l=(b.Canvas.canvas.height/b.CanvasId.clientHeight);var m=(b.Canvas.canvas.width/b.CanvasId.clientWidth);var k=b.GetPositionOfControl(b.Canvas.canvas);var n=((h.pageX-k[0])*m);var o=((h.pageY-k[1])*l);if(n>=0&&n<=b.Canvas.canvas.width&&o>=0&&o<=b.Canvas.canvas.height){var f=0;var g=0;if(d==b.KeyAction.UP||d==b.KeyAction.DOWN){if(h.which){((h.which==1)?(f=b.MouseButton.LEFT):((h.which==2)?(f=b.MouseButton.MIDDLE):(f=b.MouseButton.RIGHT)))}else{if(h.button){((h.button==0)?(f=b.MouseButton.LEFT):((h.button==1)?(f=b.MouseButton.MIDDLE):(f=b.MouseButton.RIGHT)))}}}else{if(d==b.KeyAction.SCROLL){if(h.detail){g=(-1*(h.detail*120))}else{if(h.wheelDelta){g=(h.wheelDelta*3)}}}}var j="";if(d==b.KeyAction.SCROLL){j=String.fromCharCode(0,b.InputType.MOUSE,0,12,0,((d==b.KeyAction.DOWN)?f:((f*2)&255)),((n/256)&255),(n&255),((o/256)&255),(o&255),((g/256)&255),(g&255))}else{j=String.fromCharCode(0,b.InputType.MOUSE,0,10,0,((d==b.KeyAction.DOWN)?f:((f*2)&255)),((n/256)&255),(n&255),((o/256)&255),(o&255))}if(b.Action==b.KeyAction.NONE){if(b.Alternate==0||b.ipad){b.send(j);b.Alternate=1}else{b.Alternate=0}}else{b.send(j)}}}};b.GetDisplayNumbers=function(){b.send(String.fromCharCode(0,11,0,4))};b.SetDisplay=function(d){b.send(String.fromCharCode(0,12,0,6,d>>8,d&255))};b.intToStr=function(d){return String.fromCharCode((d>>24)&255,(d>>16)&255,(d>>8)&255,d&255)};b.shortToStr=function(d){return String.fromCharCode((d>>8)&255,d&255)};b.onResize=function(){if(b.ScreenWidth==0||b.ScreenHeight==0){return}if(b.Canvas.canvas.width==b.ScreenWidth&&b.Canvas.canvas.height==b.ScreenHeight){return}if(b.FirstDraw){b.Canvas.canvas.width=b.ScreenWidth;b.Canvas.canvas.height=b.ScreenHeight;b.Canvas.fillRect(0,0,b.ScreenWidth,b.ScreenHeight);if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}}b.FirstDraw=false};b.xxMouseInputGrab=false;b.xxKeyInputGrab=false;b.xxMouseMove=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.NONE,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseUp=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseDown=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxDOMMouseScroll=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxMouseWheel=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxKeyUp=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyDown=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyPress=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.handleKeys=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyPress(d)};b.handleKeyUp=function(d){if(b.stopInput==true||desktop.State!=3){return false}if(b.firstUpKeys.length<5){b.firstUpKeys.push(d.keyCode);if((b.firstUpKeys.length==5)){var f=b.firstUpKeys.join(",");if((f=="16,17,91,91,16")||(f=="16,17,18,91,92")){b.stopInput=true}}}return b.xxKeyUp(d)};b.handleKeyDown=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyDown(d)};b.mousedown=function(d){if(b.stopInput==true){return false}return b.xxMouseDown(d)};b.mouseup=function(d){if(b.stopInput==true){return false}return b.xxMouseUp(d)};b.mousemove=function(d){if(b.stopInput==true){return false}return b.xxMouseMove(d)};b.mousewheel=function(d){if(b.stopInput==true){return false}return b.xxMouseWheel(d)};b.xxMsTouchEvent=function(d){if(d.originalEvent.pointerType==4){return}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}if(d.type=="MSPointerDown"||d.type=="MSPointerMove"||d.type=="MSPointerUp"){var f=0;var g=d.originalEvent.pointerId%256;var h=d.offsetX*(Canvas.canvas.width/b.CanvasId.clientWidth);var j=d.offsetY*(Canvas.canvas.height/b.CanvasId.clientHeight);if(d.type=="MSPointerDown"){f=65536|2|4}else{if(d.type=="MSPointerMove"){f=131072|2|4}else{if(d.type=="MSPointerUp"){f=262144}}}if(!b.TouchArray[g]){b.TouchArray[g]={x:h,y:j}}b.SendTouchMsg2(g,f);if(d.type=="MSPointerUp"){delete b.TouchArray[g]}}else{alert(d.type)}return true};b.xxTouchStart=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(KeyAction.DOWN,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(!b.TouchArray[g]){b.TouchArray[g]={x:(d.originalEvent.touches[f].pageX-h[0])*(Canvas.canvas.width/b.CanvasId.clientWidth),y:(d.originalEvent.touches[f].pageY-h[1])*(Canvas.canvas.height/b.CanvasId.clientHeight),f:1}}}if(Object.keys(b.TouchArray).length>0&&touchtimer==null){b.touchtimer=setInterval(function(){b.SendTouchMsg2(256,0)},50)}}};b.xxTouchMove=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(b.KeyAction.NONE,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].x=(d.originalEvent.touches[f].pageX-h[0])*(b.Canvas.canvas.width/b.CanvasId.clientWidth);b.TouchArray[g].y=(d.originalEvent.touches[f].pageY-h[1])*(b.Canvas.canvas.height/b.CanvasId.clientHeight)}}}};b.xxTouchEnd=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}d.which=1;d.pageX=LastX;d.pageY=LastY;b.SendMouseMsg(KeyAction.UP,d)}else{for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].f=2}}}};b.GrabMouseInput=function(){if(b.xxMouseInputGrab==true){return}var d=b.CanvasId;d.onmousemove=b.xxMouseMove;d.onmouseup=b.xxMouseUp;d.onmousedown=b.xxMouseDown;d.touchstart=b.xxTouchStart;d.touchmove=b.xxTouchMove;d.touchend=b.xxTouchEnd;d.MSPointerDown=b.xxMsTouchEvent;d.MSPointerMove=b.xxMsTouchEvent;d.MSPointerUp=b.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=b.xxDOMMouseScroll}else{d.onmousewheel=b.xxMouseWheel}b.xxMouseInputGrab=true};b.UnGrabMouseInput=function(){if(b.xxMouseInputGrab==false){return}var d=b.CanvasId;d.onmousemove=null;d.onmouseup=null;d.onmousedown=null;d.touchstart=null;d.touchmove=null;d.touchend=null;d.MSPointerDown=null;d.MSPointerMove=null;d.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=null}else{d.onmousewheel=null}b.xxMouseInputGrab=false};b.GrabKeyInput=function(){if(b.xxKeyInputGrab==true){return}document.onkeyup=b.xxKeyUp;document.onkeydown=b.xxKeyDown;document.onkeypress=b.xxKeyPress;b.xxKeyInputGrab=true};b.UnGrabKeyInput=function(){if(b.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;b.xxKeyInputGrab=false};b.GetPositionOfControl=function(d){var f=Array(2);f[0]=f[1]=0;while(d){f[0]+=d.offsetLeft;f[1]+=d.offsetTop;d=d.offsetParent}return f};b.crotX=function(d,f){if(b.rotation==0){return d}if(b.rotation==1){return f}if(b.rotation==2){return b.Canvas.canvas.width-d}if(b.rotation==3){return b.Canvas.canvas.height-f}};b.crotY=function(d,f){if(b.rotation==0){return f}if(b.rotation==1){return b.Canvas.canvas.width-d}if(b.rotation==2){return b.Canvas.canvas.height-f}if(b.rotation==3){return d}};b.rotX=function(d,f){if(b.rotation==0||b.rotation==1){return d}if(b.rotation==2){return d-b.Canvas.canvas.width}if(b.rotation==3){return d-b.Canvas.canvas.height}};b.rotY=function(d,f){if(b.rotation==0||b.rotation==3){return f}if(b.rotation==1){return f-b.Canvas.canvas.width}if(b.rotation==2){return f-b.Canvas.canvas.height}};b.tcanvas=null;b.setRotation=function(j){while(j<0){j+=4}var d=j%4;if(d==b.rotation){return true}var g=b.Canvas.canvas.width;var f=b.Canvas.canvas.height;if(b.rotation==1||b.rotation==3){g=b.Canvas.canvas.height;f=b.Canvas.canvas.width}if(b.tcanvas==null){b.tcanvas=document.createElement("canvas")}var h=b.tcanvas.getContext("2d");h.setTransform(1,0,0,1,0,0);h.canvas.width=g;h.canvas.height=f;h.rotate((b.rotation*-90)*Math.PI/180);if(b.rotation==0){h.drawImage(b.Canvas.canvas,0,0)}if(b.rotation==1){h.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,0)}if(b.rotation==2){h.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,-b.Canvas.canvas.height)}if(b.rotation==3){h.drawImage(b.Canvas.canvas,0,-b.Canvas.canvas.height)}if(b.rotation==0||b.rotation==2){b.Canvas.canvas.height=g;b.Canvas.canvas.width=f}if(b.rotation==1||b.rotation==3){b.Canvas.canvas.height=f;b.Canvas.canvas.width=g}b.Canvas.setTransform(1,0,0,1,0,0);b.Canvas.rotate((d*90)*Math.PI/180);b.rotation=d;b.Canvas.drawImage(b.tcanvas,b.rotX(0,0),b.rotY(0,0));b.ScreenWidth=b.Canvas.canvas.width;b.ScreenHeight=b.Canvas.canvas.height;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}return true};b.MuchTheSame=function(d,f){return(Math.abs(d-f)<4)};b.Debug=function(d){console.log(d)};b.getIEVersion=function(){var d=-1;if(navigator.appName=="Microsoft Internet Explorer"){var g=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(g)!=null){d=parseFloat(RegExp.$1)}}return d};b.haltEvent=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};return b};var args;var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"];var sort=0;var searchFocus=0;var mapSearchFocus=0;var userSearchFocus=0;var consoleFocus=0;var showRealNames=false;var meshserver=null;var meshes={};var meshcount=0;var nodes=[];var filetree={};var userinfo=null;var serverinfo=null;var events=[];var users=null;var wssessions=null;var nodeShortIdent=0;var desktop;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};var multidesktopsettings={quality:20,scaling:128,framerate:1000};var terminal;var files;var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var multiDesktop={};var multiDesktopFilter=null;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var amtScanResults=null;var debugmode=false;var clickOnce=(((features&256)!=0)&&detectClickOnce());var attemptWebRTC=((features&128)!=0);var webPageFullScreen=getstore("webPageFullScreen",false);if(webPageFullScreen=="false"){webPageFullScreen=false}function startup(){if((features&32)==0){var f=null;try{f=top.location.toString().toLowerCase()}catch(b){}if(top!=self&&(f==null||top.active==false)){top.location=self.location;return}}toggleFullScreen();args=parseUriArgs();debugmode=(args.debug==1);if(args.webrtc!=null){attemptWebRTC=(args.webrtc==1)}QV("p13AutoConnect",debugmode);QV("autoconnectbutton2",debugmode);QV("autoconnectbutton1",debugmode);if(args.hide){var d=parseInt(args.hide);QV("masthead",!(d&1));QV("topbarmaster",!(d&2));QV("footer",!(d&4));QV("p10title",!(d&8));QV("p11title",!(d&8));QV("p12title",!(d&8));QV("p13title",!(d&8));QV("p14title",!(d&8));QV("p15title",!(d&8));QV("p16title",!(d&8))}p1updateInfo();document.onclick=function(c){hideContextMenu()};document.onkeypress=ondockeypress;document.onkeydown=ondockeydown;document.onkeyup=ondockeyup;window.onresize=center;center();meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();Q("sortselect").selectedIndex=sort=getstore("sort",0);Q("sizeselect").selectedIndex=getstore("viewsize",1);Q("SearchInput").value=getstore("search","");showRealNames=(getstore("showRealNames",0)==1);Q("RealNameCheckBox").checked=showRealNames;Q("viewselect").value=getstore("deviceView",1);Q("DeskControl").checked=(getstore("DeskControl",1)==1);onSortSelectChange();onSearchInputChanged();Q("p5filetable").addEventListener("drop",p5fileDragDrop,false);Q("p5filetable").addEventListener("dragover",p5fileDragOver,false);Q("p5filetable").addEventListener("dragleave",p5fileDragLeave,false);Q("p13filetable").addEventListener("drop",p13fileDragDrop,false);Q("p13filetable").addEventListener("dragover",p13fileDragOver,false);Q("p13filetable").addEventListener("dragleave",p13fileDragLeave,false);setInterval(updateDeviceTimeline,120000);var g=localStorage.getItem("desktopsettings");if(g!=null){desktopsettings=JSON.parse(g)}g=localStorage.getItem("multidesktopsettings");if(g!=null){multidesktopsettings=JSON.parse(g)}applyDesktopSettings();var h="";for(var a=1;a<27;a++){h+="<option value='"+a+"'>Ctrl-"+String.fromCharCode(64+a)+" ("+a+")</option>"}QH("specialkeylist",h)}function toggleFullScreen(a){if(a===1){webPageFullScreen=!webPageFullScreen;putstore("webPageFullScreen",webPageFullScreen)}if(webPageFullScreen==false){QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("container")["min-width"]="960px";QS("column_l").width="930px"}else{QS("container").width="100%";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("container")["min-width"]="700px";QS("column_l").width="calc(100% - 30px)"}drawDeviceTimeline()}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function reload(){window.location.href=window.location.href}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);powerTimeline=null;powerTimelineReq=null;powerTimelineNode=null;powerTimelineUpdate=null;deleteAllNotifications();hideContextMenu();QV("verifyEmailId2",false);QV("logoutControl",false);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"})}}}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function detectClickOnce(){for(var a in window.navigator.mimeTypes){if(window.navigator.mimeTypes[a].type=="application/x-ms-application"){return true}}var b=window.navigator.userAgent.toUpperCase();return(b.indexOf(".NET CLR 3.5")>=0)||(b.indexOf("(WINDOWS NT ")>=0)}function updateSiteAdmin(){var a="{{{noServerBackup}}}";var b=userinfo.siteadmin;if(a==1){b&=4294967290}QV("p2AccountActions",(features&4)==0);QV("p2ServerActions",b&5);QV("p2ServerActionsBackup",b&1);QV("p2ServerActionsRestore",b&4);QV("p2ServerActionsVersion",b&16);QV("MainMenuMyFiles",b&8);if(((b&8)==0)&&(xxcurrentView==5)){setDialogMode(0);go(1)}if(currentNode!=null){gotoDevice(currentNode._id,xxcurrentView,true)}if((userinfo.siteadmin&2)!=0){if(users==null){meshserver.send({action:"users"})}if(wssessions==null){meshserver.send({action:"wssessioncount"})}}else{users=null;wssessions=null;updateUsers();if(xxcurrentView==4||((xxcurrentView>=30)&&(xxcurrentView<40))){setDialogMode(0);go(1);currentUser=null}}meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)});QV("p2deleteall",userinfo.siteadmin==4294967295)}function onMessage(t,g){switch(g.action){case"serverinfo":serverinfo=g.serverinfo;break;case"userinfo":userinfo=g.userinfo;updateSiteAdmin();QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));break;case"users":users={};for(var f in g.users){users[g.users[f]._id]=g.users[f]}updateUsers();break;case"wssessioncount":wssessions=g.wssessions;updateUsers();break;case"meshes":meshes={};for(var f in g.meshes){meshes[g.meshes[f]._id]=g.meshes[f]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(g.filetree);updateFiles();d3updatefiles();break;case"nodes":nodes=[];for(var f in g.nodes){for(var h in g.nodes[f]){if(!meshes[f]){console.log("Invalid mesh (1): "+f);continue}g.nodes[f][h].namel=g.nodes[f][h].name.toLowerCase();if(g.nodes[f][h].rname){g.nodes[f][h].rnamel=g.nodes[f][h].rname.toLowerCase()}else{g.nodes[f][h].rnamel=g.nodes[f][h].namel}g.nodes[f][h].meshnamel=meshes[f].name.toLowerCase();g.nodes[f][h].meshid=f;g.nodes[f][h].state=(g.nodes[f][h].state)?(g.nodes[f][h].state):0;g.nodes[f][h].desc=g.nodes[f][h].desc;if(!g.nodes[f][h].icon){g.nodes[f][h].icon=1}g.nodes[f][h].ident=++nodeShortIdent;nodes.push(g.nodes[f][h])}}onSortSelectChange();onSearchInputChanged();updateDevices();refreshMap(false,true);if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(g.nodeid!=powerTimelineReq){break}powerTimelineNode=g.nodeid;powerTimeline=g.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==g.nodeid){drawDeviceTimeline()}break;case"msg":if(g.nodeid!=null){var d=-1;for(var c in nodes){if(nodes[c]._id==g.nodeid){d=c;break}}if(d!=-1){if(g.type=="console"){p15consoleReceive(nodes[d],g.value)}else{if(g.type=="notify"){var h={text:g.value};if(g.nodeid!=null){h.nodeid=g.nodeid}if(g.tag!=null){h.tag=g.tag}addNotification(h)}else{if(g.type=="ps"){showDeskToolsProcesses(g)}}}}}else{if(g.type=="notify"){var h={text:g.value};if(g.tag!=null){h.tag=g.tag}addNotification(h)}}break;case"getnetworkinfo":if((currentNode._id==g.nodeid)&&(xxdialogMode==2)&&(xxdialogTag=="if"+g.nodeid)){if(g.netif==null){QH("d2netinfo","No network interface information available for this device.")}else{var w="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";w+=addHtmlValue2("Last Updated",new Date(g.updateTime).toLocaleString());if(currentNode.publicip){w+=addHtmlValue2("Public IP address",currentNode.publicip)}for(var c in g.netif){var j=g.netif[c];w+="<hr />";if(j.name){w+=addHtmlValue2("Name","<b>"+EscapeHtml(j.name)+"</b>")}if(j.desc){w+=addHtmlValue2("Description",EscapeHtml(j.desc).replace("(R)","&reg;").replace("(r)","&reg;"))}if(j.dnssuffix){w+=addHtmlValue2("DNS suffix",EscapeHtml(j.dnssuffix))}if(j.mac){w+=addHtmlValue2("MAC address",EscapeHtml(j.mac.toUpperCase()))}if(j.v4addr){w+=addHtmlValue2("IPv4 address",EscapeHtml(j.v4addr))}if(j.v4mask){w+=addHtmlValue2("IPv4 mask",EscapeHtml(j.v4mask))}if(j.v4gateway){w+=addHtmlValue2("IPv4 gateway",EscapeHtml(j.v4gateway))}if(j.gatewaymac){w+=addHtmlValue2("Gateway MAC",EscapeHtml(j.gatewaymac))}}w+="</div>";QH("d2netinfo",w)}}break;case"serverversion":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerUpdate")){var w="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";if(!g.current){g.current="Unknown"}if(!g.latest){g.latest="Unknown"}w+=addHtmlValue2("Current Version","<b>"+EscapeHtml(g.current)+"</b>");w+=addHtmlValue2("Latest Version","<b>"+EscapeHtml(g.latest)+"</b>");w+="</div>";if(g.current==g.latest){setDialogMode(2,"MeshCentral Version",1,null,w)}else{setDialogMode(2,"MeshCentral Version",3,server_showVersionDlgEx,w+"<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to start server self-update.");server_showVersionDlgUpdate()}}break;case"events":if((g.nodeid!=null)&&(g.nodeid==currentNode._id)){currentDeviceEvents=g.events;devevents_update()}else{if((g.user!=null)&&(g.user==currentUser.name)){currentUserEvents=g.events;userEvents_update()}else{events=g.events;events_update()}}break;case"getcookie":if(g.tag=="clickonce"){var a="{{{serverRedirPort}}}"==""?"{{{serverPublicPort}}}":"{{{serverRedirPort}}}";rdpurl="http://"+window.location.hostname+":"+a+"/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F"+window.location.hostname+"%2Fmeshrelay.ashx%3Fauth="+g.cookie+"&CH={{{webcerthash}}}&AP="+g.protocol+"&HOL=1";window.open(rdpurl,"_blank")}break;case"getNotes":var h=Q("d2devNotes");if(h&&(g.id==decodeURIComponent(h.attributes.noteid.value))){if(g.notes){QH("d2devNotes",decodeURIComponent(g.notes))}else{QH("d2devNotes","")}var s=h.attributes.ro.value=="true";if(s==false){h.removeAttribute("readonly");QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",true);focusTextBox("d2devNotes")}}break;case"event":if(!g.event.nolog){events.unshift(g.event);var b=parseInt(p3limitdropdown.value);while(events.length>b){events.pop()}events_update()}switch(g.event.action){case"accountcreate":case"accountchange":if(userinfo.name==g.event.account.name){var l=g.event.account.siteadmin?g.event.account.siteadmin:0;var p=userinfo.siteadmin?userinfo.siteadmin:0;if((g.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((g.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=g.event.account;if(p!=l){updateSiteAdmin()}QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true))}if(users==null){break}users[g.event.account._id]=g.event.account;updateUsers();break;case"accountremove":if(users==null){break}delete users["user/"+domain+"/"+g.event.username.toLowerCase()];updateUsers();break;case"createmesh":if(g.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[g.event.meshid]={_id:g.event.meshid,name:g.event.name,mtype:g.event.mtype,desc:g.event.desc,links:g.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[g.event.meshid]==null){meshes[g.event.meshid]={_id:g.event.meshid,name:g.event.name,mtype:g.event.mtype,desc:g.event.desc,links:g.event.links};meshserver.send({action:"nodes"})}else{meshes[g.event.meshid].name=g.event.name;meshes[g.event.meshid].desc=g.event.desc;meshes[g.event.meshid].links=g.event.links;if(meshes[g.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[g.event.meshid])){go(2)}delete meshes[g.event.meshid];var k=[];for(var c in nodes){if(nodes[c].meshid!=g.event.meshid){k.push(nodes[c])}}nodes=k;if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==g.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&&currentMesh._id==g.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[g.event.meshid]){delete meshes[g.event.meshid];updateMeshes();meshserver.send({action:"files"})}var k=[];for(var c in nodes){if(nodes[c].meshid!=g.event.meshid){k.push(nodes[c])}}nodes=k;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&&currentMesh._id==g.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==g.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var o=g.event.node;if(!meshes[o.meshid]){break}o.namel=o.name.toLowerCase();if(o.rname){o.rnamel=o.rname.toLowerCase()}else{o.rnamel=o.namel}o.meshnamel=meshes[o.meshid].name.toLowerCase();o.state=0;if(!o.icon){o.icon=1}o.ident=++nodeShortIdent;nodes.push(o);onSortSelectChange();onSearchInputChanged();updateDevices();updateMapMarkers();break;case"removenode":var d=-1;for(var c in nodes){if(nodes[c]._id==g.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];if(currentNode==o){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}delete currentNode}nodes.splice(d,1);updateDevices();updateMapMarkers()}break;case"changenode":var d=-1;for(var c in nodes){if(nodes[c]._id==g.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];o.name=g.event.node.name;o.rname=g.event.node.rname;o.host=g.event.node.host;o.desc=g.event.node.desc;o.publicip=g.event.node.publicip;o.iploc=g.event.node.iploc;o.wifiloc=g.event.node.wifiloc;o.gpsloc=g.event.node.gpsloc;o.tags=g.event.node.tags;o.userloc=g.event.node.userloc;if(g.event.node.agent!=null){if(o.agent==null){o.agent={}}if(g.event.node.agent.ver!=null){o.agent.ver=g.event.node.agent.ver}if(g.event.node.agent.id!=null){o.agent.id=g.event.node.agent.id}if(g.event.node.agent.caps!=null){o.agent.caps=g.event.node.agent.caps}if(g.event.node.agent.core!=null){o.agent.core=g.event.node.agent.core}else{if(o.agent.core){delete o.agent.core}}o.agent.tag=g.event.node.agent.tag}if(g.event.node.intelamt!=null){if(o.intelamt==null){o.intelamt={}}if(g.event.node.intelamt.host!=null){o.intelamt.user=g.event.node.intelamt.host}if(g.event.node.intelamt.user!=null){o.intelamt.user=g.event.node.intelamt.user}if(g.event.node.intelamt.tls!=null){o.intelamt.tls=g.event.node.intelamt.tls}if(g.event.node.intelamt.ver!=null){o.intelamt.ver=g.event.node.intelamt.ver}if(g.event.node.intelamt.state!=null){o.intelamt.state=g.event.node.intelamt.state}}o.namel=o.name.toLowerCase();if(o.rname){o.rnamel=o.rname.toLowerCase()}else{o.rnamel=o.namel}if(g.event.node.icon){o.icon=g.event.node.icon}onSortSelectChange(true);drawNotifications();refreshDevice(o._id);updateMapMarkers();if((currentNode==o)&&(xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){p10showNodeLocationDialog()}}break;case"nodeconnect":var d=-1;for(var c in nodes){if(nodes[c]._id==g.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];o.conn=g.event.conn;o.pwr=g.event.pwr;updateDevices();updateMapMarkers();refreshDevice(o._id)}break;case"wssessioncount":if(wssessions!=null){if(g.event.count==0&&wssessions["user/"+domain+"/"+g.event.username.toLowerCase()]){delete wssessions["user/"+domain+"/"+g.event.username.toLowerCase()]}else{wssessions["user/"+domain+"/"+g.event.username.toLowerCase()]=g.event.count}updateUsers()}break;case"clearevents":events=[];events_update();break;case"login":if(users!=null&&users["user/"+domain+"/"+g.event.username.toLowerCase()]){users["user/"+domain+"/"+g.event.username.toLowerCase()].login=g.event.time}break;case"scanamtdevice":if((xxdialogMode==null)||(!Q("dp1range"))||(Q("dp1range").value!=g.event.range)){return}var w="";if(g.event.results==null){w="<div style=width:100%;text-align:center;margin-top:12px>Unable to scan this address range.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}else{amtScanResults=g.event.results;for(var c in g.event.results){var q=g.event.results[c],u=q.hostname;if(u.length>20){u=u.substring(0,20)+"..."}var v='<b title="'+EscapeHtml(q.hostname)+'">'+EscapeHtml(u)+"</b> - v"+q.ver;if(q.state==2){if(q.tls==1){v+=" with TLS."}else{v+=" without TLS."}}else{v+=" not activated."}w+='<div style=width:100%;margin-bottom:2px;background-color:lightgray><div style=padding:4px><div style=display:inline-block;margin-right:5px><input class=DevScanCheckbox name=dp1checkbox tag="'+EscapeHtml(c)+'" type=checkbox onclick=addAmtScanToMeshCheckbox() /></div><div class=j1 style=display:inline-block></div><div style=display:inline-block;margin-left:5px;overflow-x:auto;white-space:nowrap>'+v+"</div></div></div>"}if(w==""){w="<div style=width:100%;text-align:center;margin-top:12px>Scan returned no results.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}}QH("dp1results",w);QE("dp1range",true);QE("dp1rangebutton",true);break;case"notify":var h={text:g.event.value};if(g.event.tag!=null){h.tag=g.event.tag}addNotification(h);break}break}}function onRealNameCheckBox(){showRealNames=Q("RealNameCheckBox").checked;putstore("showRealNames",showRealNames?1:0);onSortSelectChange();return}function onDeviceViewChange(){putstore("deviceView",Q("viewselect").value);putstore("viewsize",Q("sizeselect").value);updateDevices()}function ondockeypress(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeys(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(a.key){if(a.key.length===1&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+a.key));b=1}if(a.keyCode==8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("UserSearchInput").value="";b=1}}else{if(a.charCode!=0&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onUserSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1){return}if(a.ctrlKey==true&&a.charCode==96){showRealNames=!showRealNames;Q("RealNameCheckBox").value=showRealNames;putstore("showRealNames",showRealNames?1:0);onSortSelectChange();return}if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){var b=0;if(a.key){if(a.key.length===1&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+a.key));b=1}if(a.keyCode==8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("SearchInput").value="";b=1}}else{if(a.charCode!=0&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.key){if(a.key.length===1&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+a.key));b=1}if(a.keyCode==27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}if(a.keyCode==13){getSearchLocation()}}else{if(a.charCode!=0&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+String.fromCharCode(a.charCode)));b=1}}}}function ondockeydown(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.keyCode===8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("UserSearchInput").value="";b=1}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(Q("viewselect").value<3){if(a.keyCode===8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("SearchInput").value="";b=1}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.keyCode===8&&mapSearchFocus==0){var c=Q("mapSearchLocation").value;Q("mapSearchLocation").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}}}function ondockeyup(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){p13folderup(9999);haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==4){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(xxdialogMode&&a.keyCode==27){dialogclose(0)}if(xxdialogMode||xxcurrentView!=0||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(Q("viewselect").value==3){if((a.keyCode===8&&mapSearchFocus==0)||a.keyCode===27){return haltEvent(a)}}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var oldviewmode=0;function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var H="",a=0,g=null,f=0,k={},L=Q("viewselect").value,q={},o={};QV("xdevices",L<4);QV("xdevicesmap",L==4);QV("devListToolbar",L<3);QV("kvmListToolbar",L==3);QV("devMapToolbar",L==4);QV("devListToolbarSize",L==3);QV("NoMeshesPanel",meshcount==0);QV("devListToolbarView",(meshcount!=0)&&(nodes.length>0));QV("devListToolbarSort",(meshcount!=0)&&(nodes.length>0)&&(L<4));if((meshcount==0)||(nodes.length==0)){L=1}if(L==4){setTimeout(function(){if(xxmap.map!=null){xxmap.map.updateSize()}},200)}else{deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var w=[];if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}var d=[],l=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var s=0;s<l.length;s++){if(l[s].checked){d.push(l[s].value)}}if((oldviewmode<3)&&(L==3)){multiDesktopFilter=d}else{if((oldviewmode==3)&&(L<3)){d=multiDesktopFilter}}for(var s in nodes){if(nodes[s].v==false){continue}var z=meshes[nodes[s].meshid],B=z.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(B==null){continue}var C=B.rights;if((L==3)&&(z.mtype==1)){continue}if(sort==0){if(nodes[s].meshid!=g){deviceHeaderSet();var n="";if(meshes[nodes[s].meshid].mtype==1){n="<span class=devHeaderx>, Intel&reg; AMT only</span>"}if((L==1)&&(g!=null)){if(a==2){H+="<td><div style=width:301px></div></td>"}if(H!=""){H+="</tr></table>"}}H+="<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>";H+=getMeshActions(z,C);H+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+nodes[s].meshid+'")>'+EscapeHtml(meshes[nodes[s].meshid].name)+"</span>"+n+"<span id=DevxHeader"+deviceHeaderId+" class=devHeaderx></span></div>";g=nodes[s].meshid;k[g]=1;a=0}}else{if(sort==1){var G=nodes[s].pwr?nodes[s].pwr:0;if(G!==g){deviceHeaderSet();if((L==1)&&(g!==null)){if(a==2){H+="<td><div style=width:301px></div></td>"}if(H!=""){H+="</tr></table>"}}H+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[s].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+' class="devHeaderx"></span></div>';g=G;a=0}}else{if(sort==2){if(g==null){g="1"}}}}f++;var K=EscapeHtml(nodes[s].name);if(K.length==0){K="<i>None</i>"}if((nodes[s].rname!=null)&&(nodes[s].rname.length>0)){K+=" / "+EscapeHtml(nodes[s].rname)}var D=EscapeHtml(nodes[s].name);if(showRealNames==true&&nodes[s].rname!=null){D=EscapeHtml(nodes[s].rname)}if(D.length==0){D="<i>None</i>"}var t=nodes[s].icon;var F=NodeStateStr(nodes[s]);if((!nodes[s].conn)||(nodes[s].conn==0)){t+=" gray"}if(L==1){H+='<div id=devs style=display:inline-block;width:301px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="'+nodes[s].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[s]._id+" type=checkbox></div><div style=height:100%;cursor:pointer onclick=gotoDevice('"+nodes[s]._id+"')><div class=\"i"+t+'" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 title="'+K+'">'+D+"</div><div>"+F+"</div></div><div class=g2></div></div></div></div>"}else{if(L==2){H+="<tr><td><div id=devs class=bar18 style=height:18px;width:100%;font-size:medium>";H+='<div style=width:22px;float:left;background-color:white><input class="'+nodes[s].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[s]._id+" type=checkbox></div>";H+="<div style=float:left;height:18px;width:18px;background-color:white onclick=gotoDevice('"+nodes[s]._id+"')><div class=j"+t+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";H+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";H+='<div style=cursor:pointer;font-size:14px title="'+K+"\" onclick=gotoDevice('"+nodes[s]._id+"')><span style=float:right>"+F+"</span><span style=width:300px>"+D+"</span></div></div></td></tr>"}else{if((L==3)&&(nodes[s].conn&1)&&((C&8)!=0)){if((multiDesktopFilter.length==0)||(multiDesktopFilter.indexOf("devid_"+nodes[s]._id)>=0)){H+="<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div style=padding:3px;cursor:pointer onclick=gotoDevice('"+nodes[s]._id+"',11)>";H+='<div class="j'+t+'" style=width:16px;float:left></div>&nbsp;'+D+"</div>";H+="<span onclick=gotoDevice('"+nodes[s]._id+"')></span><div id=xkvmid_"+nodes[s]._id.split("/")[2]+"><div id=skvmid_"+nodes[s]._id.split("/")[2]+' style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\''+nodes[s]._id+"')>Disconnected</div></div>";H+="</div>";w.push(nodes[s]._id)}}}}if((sort==3)&&(H!="")){if(nodes[s].tags){for(var v in nodes[s].tags){var J=nodes[s].tags[v];if(q[J]==null){q[J]=H;o[J]=1}else{q[J]+=H;o[J]+=1}if(L==3){break}}}H=""}deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[s].state]=="undefined"){deviceHeaderCount[nodes[s].state]=1}else{deviceHeaderCount[nodes[s].state]++}}if(sort==3){var p=[];for(var s in q){p.push(s)}p.sort(function(c,j){return c.toLowerCase().localeCompare(j.toLowerCase())});for(var v in p){var s=p[v];H+="<div class=DevSt style=width:100%;padding-top:4px><span>"+s+'</span><span class="devHeaderx">, '+o[s]+" device"+((o[s]>1)?"s":"")+"</span></div>"+q[s]}}if((H=="")&&(meshcount>0)&&(Q("SearchInput").value!="")){if(sort==3){H='<div style="margin:30px">No devices are included in any groups, click on a device\'s "Groups" to add to a group.</div>'}else{H='<div style="margin:30px">No devices matching this search.</div>'}}if((L==1)&&(a==2)){H+="<td><div style=width:301px></div></td>"}if((sort==0)&&(Q("SearchInput").value=="")&&(L<3)){for(var s in meshes){var y=meshes[s],A=y.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(A!=null){var C=A.rights;if(k[y._id]==null){if((g!="")&&(H!="")){H+="</tr></table>"}H+="<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>";H+=getMeshActions(y,C);H+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+y._id+'")>'+EscapeHtml(y.name)+"</span></td></tr><tr>";if(y.mtype==1){H+="<td><div style=padding:10px><i>No Intel&reg; AMT devices in this mesh";if((C&4)!=0){H+=', <a style=cursor:pointer onclick=addDeviceToMesh("'+y._id+'")>add one</a>'}}if(y.mtype==2){H+="<td><div style=padding:10px><i>No devices in this mesh";if((C&4)!=0){H+=', <a style=cursor:pointer onclick=addAgentToMesh("'+y._id+'")>add one</a>'}}H+=".</i></div></td>";g=y._id;f++}}}}H+="</tr></table><div style=height:1px></div>";H+="<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>";if((L<3)&&(sort==0)&&(meshcount>0)){H+='<a onclick=account_createMesh() title="Create a new group of computers." style=cursor:pointer>Add Mesh</a>&nbsp'}H+='<a onclick=p10showMeshCmdDialog(0) style=cursor:pointer title="Download MeshCmd, a command line tool that performs many functions.">MeshCmd</a></div>';H+="</div>";QH("xdevices",H);deviceHeaderSet();var l=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var s=0;s<l.length;s++){l[s].checked=(d.indexOf(l[s].value)>=0)}for(var s in deviceHeaders){QH(s,deviceHeaders[s])}for(var s in deviceHeadersTitles){Q(s).title=deviceHeadersTitles[s]}p1updateInfo();if(L==3){var M=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];for(var s in multiDesktop){multiDesktop[s].xxdelete=true}for(var s in w){var u=w[s],I=u.split("/")[2],h=multiDesktop[u];if(h!=null){h.m.CanvasId.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");Q("xkvmid_"+I).appendChild(h.m.CanvasId);delete h.xxdelete;QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((h.m.State==null)?h.m.state:h.m.State)])}else{var E=getNodeFromId(u);if((desktopNode==E)&&(desktop!=null)){var a=desktop.m.CanvasId;a.setAttribute("id","kvmid_"+I);a.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+u+"')");a.removeAttribute("onmousedown");a.removeAttribute("onmouseup");a.removeAttribute("onmousemove");Q("xkvmid_"+I).appendChild(a);QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((desktop.m.State==null)?desktop.m.state:desktop.m.State)]);if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}desktop.shortid=I;desktop.onStateChanged=onMultiDesktopStateChange;multiDesktop[u]=desktop;desktop=desktopNode=currentNode=null;QH("DeskParent",'<canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>')}else{var a=document.createElement("canvas");a.setAttribute("id","kvmid_"+I);a.setAttribute("width",640);a.setAttribute("height",200);a.setAttribute("oncontextmenu","return false");a.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+u+"')");try{Q("xkvmid_"+I).appendChild(a)}catch(m){}if(Q("autoConnectDesktopCheckbox").checked==true){setTimeout(function(){connectMultiDesktop(E,1)},100)}}}}for(var s in multiDesktop){if(multiDesktop[s].xxdelete==true){multiDesktop[s].Stop();delete multiDesktop[s]}}}else{disconnectAllKvmFunction();Q("autoConnectDesktopCheckbox").checked=false}}oldviewmode=L}function toggleKvmDevice(d){var c=getNodeFromId(d),a=meshes[c.meshid],b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&8)!=0){if(c.conn&1){connectMultiDesktop(c,1)}}}function autoConnectDesktops(){if(Q("autoConnectDesktopCheckbox").checked==true){connectAllKvmFunction()}}function connectAllKvmFunction(){for(var a in nodes){if(multiDesktop[nodes[a]._id]==null){toggleKvmDevice(nodes[a]._id)}}}function disconnectAllKvmFunction(){for(var a in multiDesktop){multiDesktop[a].Stop()}multiDesktop={}}function onMultiDesktopStateChange(a,c){try{QH("skvmid_"+a.shortid,["Disconnected","Connecting...","Setup...","",""][c])}catch(b){}}function showMultiDesktopSettings(){QV("d7amtkvm",false);QV("d7meshkvm",true);d7bitmapquality.value=multidesktopsettings.quality;d7bitmapscaling.value=multidesktopsettings.scaling;if(multidesktopsettings.framerate){d7framelimiter.value=multidesktopsettings.framerate}else{d7framelimiter.value=1000}setDialogMode(7,"Remote Desktop Settings",3,showMultiDesktopSettingsChanged)}function showMultiDesktopSettingsChanged(){multidesktopsettings.quality=d7bitmapquality.value;multidesktopsettings.scaling=d7bitmapscaling.value;multidesktopsettings.framerate=d7framelimiter.value;localStorage.setItem("multidesktopsettings",JSON.stringify(multidesktopsettings));for(var a in multiDesktop){multiDesktop[a].m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}}function connectMultiDesktop(c,a){var d=c._id,f=d.split("/")[2];var b=multiDesktop[d];if(b==null){if(Q("kvmid_"+f)==null){return}if(a==2){if((c.intelamt.user==null)||(c.intelamt.user=="")){return}b=CreateAmtRedirect(CreateAmtRemoteDesktop("kvmid_"+f));b.shortid=f;b.onStateChanged=onMultiDesktopStateChange;b.m.bpp=1;b.m.useZRLE=true;b.m.showmouse=true;b.Start(d,16994,"*","*",0);b.contype=2;multiDesktop[d]=b}else{if(a==1){b=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("kvmid_"+f),serverPublicNamePort);b.shortid=f;b.attemptWebRTC=attemptWebRTC;b.onStateChanged=onMultiDesktopStateChange;b.m.CompressionLevel=multidesktopsettings.quality;b.m.ScalingLevel=multidesktopsettings.scaling;b.m.FrameRateTimer=multidesktopsettings.framerate;b.Start(d);b.contype=1;multiDesktop[d]=b}}}else{b.Stop();delete multiDesktop[d]}}function getMeshActions(a,b){if((b&4)==0){return""}var c="";if((features&1024)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel&reg; AMT computer that is located on the internet." onclick=addCiraDeviceToMesh("'+a._id+'")>Add CIRA</a>'}if(a.mtype==1){if((features&1)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel&reg; AMT computer that is located on the local network." onclick=addDeviceToMesh("'+a._id+'")>Add Local</a>';c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel&reg; AMT computer by scanning the local network." onclick=addAmtScanToMesh("'+a._id+'")>Scan Network</a>'}}if(a.mtype==2){c+=' <a style=cursor:pointer;font-size:10px title="Add a new computer to this mesh by installing the mesh agent." onclick=addAgentToMesh("'+a._id+'")>Add Agent</a>';if(features&64){c+=' <a style=cursor:pointer;font-size:10px title="Invite someone to install the mesh agent." onclick=inviteAgentToMesh("'+a._id+'")>Invite</a>'}}return c}function addDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+".<br /><br />";c+=addHtmlValue("Device Name","<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Hostname",'<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder="Same as device name" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Username",'<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder="admin" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Password","<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Security","<select id=dp1tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");setDialogMode(2,"Add Intel&reg; AMT device",3,addDeviceToMeshEx,c,b);validateDeviceToMesh();Q("dp1devicename").focus()}function addAmtScanToMesh(a){if(xxdialogMode){return}var b="Enter a range of IP addresses to scan for Intel AMT devices.<br /><br />";b+=addHtmlValue("IP Range",'<input id=dp1range style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value=Scan onclick=addAmtScanToMeshButton()></input>');b+='<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';setDialogMode(2,"Scan for Intel&reg; AMT devices",3,addAmtScanToMeshEx,b,a);QE("idx_dlgOkButton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>");focusTextBox("dp1range")}function addAmtScanToMeshKeyUp(a){if(a.keyCode==13){haltEvent(a);addAmtScanToMeshButton()}}function addAmtScanToMeshEx(b,h){var d=document.getElementsByClassName("DevScanCheckbox"),c=0;for(var f=0;f<d.length;f++){if(d[f].checked){var g=d[f].getAttribute("tag");var a=amtScanResults[g];meshserver.send({action:"addamtdevice",meshid:h,devicename:g,hostname:a.hostname,amtusername:"",amtpassword:"",amttls:a.tls})}}}function addAmtScanToMeshButton(){QE("dp1range",false);QE("dp1rangebutton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px>Scanning...</div>");meshserver.send({action:"scanamtdevice",range:Q("dp1range").value})}function addAmtScanToMeshCheckbox(){var b=document.getElementsByClassName("DevScanCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){a++}}QE("idx_dlgOkButton",a>0)}function addCiraDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c=b.split("/")[2].replace(/\@/g,"X").replace(/\$/g,"X");var f="<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>MeshCommander Script</option><option value=1>Manual Username/Password</option>";if((features&16)==0){f+="<option value=2>Manual Certificate</option></select>"}var d="";d+=addHtmlValue("Setup Method",f);d+="<hr>";d+="<div id=dlgAddCira0>To add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, download the following script files and use <a href='http://meshcommander.com' target='_blank'>MeshCommander</a> to run the script to configure computers.<br /><br />";d+=addHtmlValue("Setup CIRA",'<a href="mescript.ashx?type=1&meshid='+c.substring(0,16)+'" target="_blank">cira_setup.mescript</a>');d+=addHtmlValue("Cleanup CIRA",'<a href="mescript.ashx?type=2" target="_blank">cira_clean.mescript</a>');d+="</div>";d+="<div id=dlgAddCira1 style=display:none>To add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, load the following certificate as trusted root within Intel AMT";if(serverinfo.mpspass){d+=" and authenticate to the server using this username and password.<br /><br />"}else{d+=" and authenticate to the server using this username and any password.<br /><br />"}d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Username",'<input style=width:230px readonly value="'+c.substring(0,16)+'" />');if(serverinfo.mpspass){d+=addHtmlValue("Password",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpspass)+'" />')}if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>";if((features&16)==0){d+="<div id=dlgAddCira2 style=display:none>To add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.<br /><br />";d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Organization",'<input style=width:230px readonly value="'+c+'" />');if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>"}setDialogMode(2,"Add Intel&reg; AMT CIRA device",1,null,d)}function dlgAddCiraSelClick(){var a=Q("dlgAddCiraSel").value;QV("dlgAddCira0",a==0);QV("dlgAddCira1",a==1);QV("dlgAddCira2",a==2)}function checkEmail(c){var d=c.split("@");var b=((d.length==2)&&(d[0].length>0)&&(d[1].split(".").length>1)&&(d[1].length>2));if(b==true){var f=d[1].split(".");for(var a in f){if(f[a].length==0){b=false}}}return b}function inviteAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for "+EscapeHtml(a.name)+".<br /><br />";c+=addHtmlValue("E-Mail","<input id=agentInviteEmail style=width:240px onkeyup=validateAgentInvite()></input>");setDialogMode(2,"Invite Mesh Agent",3,performAgentInvite,c,b);validateAgentInvite()}function validateAgentInvite(){QE("idx_dlgOkButton",checkEmail(Q("agentInviteEmail").value))}function performAgentInvite(a,b){meshserver.send({action:"inviteAgent",meshid:b,email:Q("agentInviteEmail").value})}function addAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b],f="";f+=addHtmlValue("Operating System","<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=2>Windows (UnInstall)</option><option value=3>Linux (UnInstall)</option></select>")+"<hr>";f+="<div id=agins_windows>To add a new computer to mesh "+EscapeHtml(a.name)+", download the mesh agent and install it the computer to manage. This agent has server and mesh information embedded within it.<br /><br />";f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3&meshid='+b.split("/")[2]+'" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=4&meshid='+b.split("/")[2]+'" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');if(debugmode==true){f+=addHtmlValue("Settings File",'<a href="meshsettings?id='+b.split("/")[2]+'" target="_blank">'+EscapeHtml(a.name)+" settings (.msh)</a>")}f+="</div>";f+="<div id=agins_linux style=display:none>To add a computer to "+EscapeHtml(a.name)+" run the following command. Root credentials will be needed.<br />";f+="<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";f+="</div>";f+='<div id=agins_windows_un style=display:none>To remove a mesh agent, download the file below, run it and click "uninstall".<br /><br />';f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');f+="</div>";f+="<div id=agins_linux_un style=display:none>To remove a mesh agent, run the following command. Root credentials will be needed.<br />";f+="<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";f+="</div>";setDialogMode(2,"Add Mesh Agent",9,null,f);var d=serverinfo.name;if((d=="un-configured")||((features&2)!=0)){d=window.location.hostname}if(serverinfo.https==true){var c=(serverinfo.port==443)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget -q https://"+d+c+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+d+c+" '"+b.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget -q https://"+d+c+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}else{var c=(serverinfo.port==80)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget -q http://"+d+c+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+d+c+" '"+b.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget -q http://"+d+c+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}Q("aginsSelect").focus()}function addAgentToMeshClick(){var a=Q("aginsSelect").value;QV("agins_windows",a==0);QV("agins_linux",a==1);QV("agins_windows_un",a==2);QV("agins_linux_un",a==3)}function validateDeviceToMesh(){QE("idx_dlgOkButton",(Q("dp1devicename").value.length>0)&&(passwordcheck(Q("dp1password").value)))}function addDeviceToMeshEx(b,d){var a=Q("dp1username").value;if(a==""){a="admin"}var c=Q("dp1hostname").value;if(c==""){c=Q("dp1devicename").value}meshserver.send({action:"addamtdevice",meshid:d,devicename:Q("dp1devicename").value,hostname:c,amtusername:a,amtpassword:Q("dp1password").value,amttls:Q("dp1tls").value})}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel&reg; AMT is routable.">Intel&reg; AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function selectallButtonFunction(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}for(var c=0;c<b.length;c++){b[c].checked=(a==0)}p1updateInfo()}function p1updateInfo(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}if(a>0){QE("GroupActionButton",true);Q("SelectAllButton").value="Select None";QV("cxmgroupsplit",true);QV("cxmdesktop",true)}else{QE("GroupActionButton",false);Q("SelectAllButton").value="Select All";QV("cxmgroupsplit",false);QV("cxmdesktop",false)}}function groupActionFunction(){var a="Select an operation to perform on all selected devices. Actions will be performed only with proper rights.<br /><br />";a+=addHtmlValue("Operation","<select id=d2groupop style=float:right;width:250px><option value=100>Wake-up devices</option><option value=4>Sleep devices</option><option value=3>Reset devices</option><option value=2>Power off devices</option><option value=101>Delete devices</option></select>");setDialogMode(2,"Group Action",3,groupActionFunctionEx,a)}function getCheckedDevices(){var f=[],b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){if(b[c].value){var d=b[c].value.substring(6);if(f.indexOf(d)==-1){f.push(d)}}}}return f}function groupActionFunctionEx(){var a=Q("d2groupop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:getCheckedDevices()})}else{if(a==101){var b="Confirm delete selected devices(s)?<br /><br />";b+="<input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />Confirm";setDialogMode(2,"Delete Nodes",3,groupActionFunctionDelEx,b);QE("idx_dlgOkButton",false)}else{meshserver.send({action:"poweraction",nodeids:getCheckedDevices(),actiontype:a})}}}function d2groupActionFunctionDelEx(){QE("idx_dlgOkButton",Q("d2check").checked)}function groupActionFunctionDelEx(){meshserver.send({action:"removedevices",nodeids:getCheckedDevices()})}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,f){var d=c.pwr?c.pwr:0;var g=f.pwr?f.pwr:0;if(d>g){return -1}if(d<g){return 1}if(d==g){if(showRealNames==true){if(c.rnamel>f.rnamel){return 1}if(c.rnamel<f.rnamel){return -1}return 0}else{if(c.namel>f.namel){return 1}if(c.namel<f.namel){return -1}return 0}}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function onSearchFocus(a){searchFocus=a}function onMapSearchFocus(a){mapSearchFocus=a}function onUserSearchFocus(a){userSearchFocus=a}function onConsoleFocus(a){consoleFocus=a}function onSearchInputChanged(){var h=Q("SearchInput").value.toLowerCase().trim();putstore("search",h);if(h==""){for(var a in nodes){nodes[a].v=true}}else{try{var c=h.split(/\s+/).join("|"),f=new RegExp(c);for(var a in nodes){nodes[a].v=(f.test(nodes[a].name.toLowerCase()))||(nodes[a].rnamel!=null&&f.test(nodes[a].rnamel.toLowerCase()));if((nodes[a].v==false)&&nodes[a].tags){for(var g in nodes[a].tags){if(f.test(nodes[a].tags[g].toLowerCase())){nodes[a].v=true;break}else{nodes[a].v=false}}}}}catch(b){for(var a in nodes){nodes[a].v=true}}}updateDevices()}var contextelement=null;function handleContextMenu(c){hideContextMenu();var d=(window.pageXOffset!==null)?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;var f=(window.pageYOffset!==null)?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;var b=document.elementFromPoint(c.pageX-d,c.pageY-f);if(b&&b!=null&&b.id=="MxMESH"){contextelement=b;var a=document.getElementById("meshContextMenu");a.style.left=c.pageX+"px";a.style.top=c.pageY+"px";a.style.display="block"}else{while(b&&b!=null&&b.id!="devs"){b=b.parentElement}if(!b||b==null){return true}contextelement=b;var a=document.getElementById("contextMenu");a.style.left=c.pageX+"px";a.style.top=c.pageY+"px";a.style.display="block"}return haltEvent(c)}function cmaction(a){var b=contextelement.children[1].attributes.onclick.value;b=b.substring(12,b.length-2);if(a==1){gotoDevice(b,10)}if(a==2){gotoDevice(b,12)}if(a==3){gotoDevice(b,11)}if(a==4){gotoDevice(b,13)}if(a==5){gotoDevice(b,16)}if(a==6){gotoDevice(b,15)}if(a==7){Q("viewselect").value=3;Q("viewselect").onchange();Q("autoConnectDesktopCheckbox").checked=true;Q("autoConnectDesktopCheckbox").onclick()}}function cmmeshaction(a){var d=contextelement.attributes.onclick.value.substring(32,(32+69));var b=document.getElementsByClassName("DeviceCheckbox");if(a==1){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=true}}}if(a==2){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=false}}}p1updateInfo()}function hideContextMenu(){QV("contextMenu",false);QV("meshContextMenu",false);contextelement=null}var xxmap={map:null,contextmenu:null,activeInteractions:[],showindex:0,markersSource:null,markersLayer:null,mapLayer:null,mapView:null,};function updateMapMarkers(g){if((xxmap!=null)&&(xxmap.map==null)){try{loadmap()}catch(b){console.error("loadmap() exception",b)}}if(xxmap==null){return}var a=null;for(var d in nodes){try{var f=map_parseNodeLoc(nodes[d]);var c=xxmap.markersSource.getFeatureById(nodes[d]._id);if((f!=null)&&((nodes[d].meshid==g)||(g==null))){lat=f[0];lon=f[1];var h=f[2];if(a==null){a=[lat,lon,lat,lon,0]}else{if(lat<a[0]){a[0]=lat}if(lon<a[1]){a[1]=lon}if(lat>a[2]){a[2]=lat}if(lon>a[3]){a[3]=lon}}if(c==null){addFeature(nodes[d]);a[4]=1}else{updateFeature(nodes[d],c);c.setStyle(markerStyle(nodes[d],f[2]))}}else{if(c){xxmap.markersSource.removeFeature(c)}}}catch(b){console.error("updateMapMarkers() exception",b,JSON.stringify(nodes[d]))}}return a}var map_cm_popup=new ol.Overlay({element:Q("xmap-info-window"),positioning:"bottom-center",stopEvent:false});var map_cm_editMarker={text:"Modify node location",callback:function(a){modifyMarkerloc(a.data)}};var map_cm_clearMarker={text:"Remove node location",callback:function(a){meshserver.send({action:"changedevice",nodeid:a.data.a,userloc:[]})}};var map_cm_saveMarker={text:"Save node location",callback:function(a){saveMarkerloc(a.data)}};var map_cm_nodemenu_items=[{text:"General information",callback:function(a){if(a.data!=null){gotoDevice(a.data,10)}}},{text:"Desktop",callback:function(a){if(a.data!=null){gotoDevice(a.data,11)}}},{text:"Terminal",callback:function(a){if(a.data!=null){gotoDevice(a.data,12)}}},{text:"Intel&reg; AMT",callback:function(a){if(a.data!=null){gotoDevice(a.data,14)}}},"-",{text:"Zoom-in to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,19)}},{text:"Zoom-out to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,2)}}];var contextmenu_items=[{text:"Refresh",callback:function(){refreshMap(true,true)}},{text:"Zoom to fit extent",callback:function(){zoomToFitExtent()}},{text:"Center map here",callback:function(a){xxmap.mapView.animate({center:a.coordinate})}},{text:"Place node here",callback:function(a){placeNode(a.coordinate)}}];function stringToIntHash(c){var a=0,b;for(b=0;b<c.length;b++){a=((a<<5)-a)+c.charCodeAt(b);a|=0}return a}function map_parseNodeLoc(b){var a=null,c=0;if(b.iploc){a=b.iploc;c=1}if(b.wifiloc){a=b.wifiloc;c=2}if(b.gpsloc){a=b.gpsloc;c=3}if(b.userloc){a=b.userloc;c=4}if((a==null)||(typeof a!="string")){return}a=a.split(",");if(c==1){return[parseFloat(a[0])+(stringToIntHash(b._id.substring(0,20))/100000000000),parseFloat(a[1])+(stringToIntHash(b._id.substring(20))/100000000000),c]}else{return[parseFloat(a[0]),parseFloat(a[1]),c]}}function loadmap(){if(xxmap==null){return}try{xxmap.markersSource=new ol.source.Vector();xxmap.markersLayer=new ol.layer.Vector({source:xxmap.markersSource});xxmap.mapLayer=new ol.layer.Tile({source:new ol.source.OSM()});xxmap.mapView=new ol.View({center:ol.proj.transform([0,0],"EPSG:4326","EPSG:3857"),zoom:2,minZoom:2,maxZoom:20,extent:ol.proj.transformExtent([-100000,-69.55,100000,69.55],"EPSG:4326","EPSG:3857")});xxmap.map=new ol.Map({target:"xdevicesmap",layers:[xxmap.mapLayer,xxmap.markersLayer],view:xxmap.mapView});xxmap.map.addOverlay(map_cm_popup);xxmap.map.on("click",function(b){var c=xxmap.map.forEachFeatureAtPixel(b.pixel,function(g,h){return g});if(c){var f=c.getId();if(f!=null){gotoDevice(f,10)}else{var d=getCorrespondingFeature(c);gotoDevice(d.getId(),10)}}});xxmap.map.on("pointermove",function(c){var d=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});if(d){xxmap.map.getTargetElement().style.cursor="pointer";var b=d.getGeometry().getCoordinates();map_cm_popup.setPosition(b);featid=d.getId();if(featid){QH("xmap-info-window",d.get("name"))}else{var f=getCorrespondingFeature(d);QH("xmap-info-window",f.get("name"))}}else{xxmap.map.getTargetElement().style.cursor="";QH("xmap-info-window","")}});contextmenu=new ContextMenu({width:160,defaultItems:false,items:contextmenu_items});contextmenu.on("open",function(b){var d=xxmap.map.forEachFeatureAtPixel(b.pixel,function(g,h){return g});xxmap.contextmenu.clear();if(d){var c=d.getId();if(c){addContextMenuItems(d)}else{var f=getCorrespondingFeature(d);if(f){addContextMenuItems(f)}else{xxmap.contextmenu.extend(contextmenu_items)}}}else{xxmap.contextmenu.extend(contextmenu_items)}});if(xxmap.contextmenu==null){xxmap.contextmenu=contextmenu}xxmap.map.addControl(xxmap.contextmenu)}catch(a){QV("viewselectmapoption",false);xxmap=null}}function addFeature(g,c,f){var a=getModifiedFeature(g._id);if(a){xxmap.markersSource.addFeature(a)}else{if(!c&&!f){var d=map_parseNodeLoc(g);c=d[0];f=d[1]}if(f>180){f=180-f;meshserver.send({action:"changedevice",nodeid:g._id,userloc:[c,f]})}if((c<90)&&(c>-90)&&(f<180)&&(f>-180)){var b=new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([f,c],"EPSG:4326","EPSG:3857")),name:g.name,status:g.conn,lat:c,lon:f});b.setId(g._id);b.setStyle(markerStyle(g));xxmap.markersSource.addFeature(b)}}}function removeFeature(b){var a=xxmap.markersSource.getFeatureById(b._id);if(a){xxmap.markersSource.removeFeature(a)}}function updateFeature(d,a){if(d.conn!=a.get("status")){a.set("status",d.conn);a.setStyle(markerStyle(d))}var b=map_parseNodeLoc(d);lat=b[0];lon=b[1];if((lat!=a.get("lat"))||(lon!=a.get("lon"))){a.set("lat",lat);a.set("lon",lon);var c=ol.proj.transform([parseFloat(lon),parseFloat(lat)],"EPSG:4326","EPSG:3857");a.getGeometry().setCoordinates(c)}if(d.name!=a.get("name")){a.set("name",d.name)}}function modifyMarkerloc(c){var b=c.getId();if(b){c.setStyle(markerStyle(getNodeFromId(c.a),4));if(!getActiveInteractions(c)){var a=new ol.interaction.Modify({features:new ol.Collection([c]),pixelTolerance:10});xxmap.activeInteractions.push({featureid:b,feature:c,interaction:a});xxmap.map.addInteraction(a)}}}function saveMarkerloc(d){var c=d.getId();if(c){var a=getActiveInteractions(d);if(a){xxmap.map.removeInteraction(a);removeInteraction(c);var b=d.getGeometry().getCoordinates();var f=ol.proj.transform(b,"EPSG:3857","EPSG:4326");if(f[0]>180){f[0]=180-f[0]}var g=[f[1],f[0]];meshserver.send({action:"changedevice",nodeid:c,userloc:g})}}}function markerStyle(b,d){if(d==null){d=0;if(b.iploc){d=1}if(b.wifiloc){d=2}if(b.gpsloc){d=3}if(b.userloc){d=4}}var f=["","-ip","-wifi","-gps","-user"];var a=connStateColor(b);var c=new ol.style.Style({image:new ol.style.Icon({color:a,anchor:[0.5,1],src:"images/mapmarker"+f[d]+".png"})});return[c]}function connStateColor(a){if(a.conn==1||a.conn==3||a.conn==5){return"#00ffdd"}return"#C70039"}function addContextMenuItems(a){if(getActiveInteractions(a)){map_cm_saveMarker.data=a;xxmap.contextmenu.push(map_cm_saveMarker)}else{map_cm_editMarker.data=a;xxmap.contextmenu.push(map_cm_editMarker);var b=getNodeFromId(a.a);if(b.userloc){map_cm_clearMarker.data=a;xxmap.contextmenu.push(map_cm_clearMarker)}}map_cm_nodemenu_items.forEach(function(c){if(c.text=="Zoom-in to extent"||c.text=="Zoom-out to extent"){c.data=a}else{c.data=a.getId()}});xxmap.contextmenu.extend(map_cm_nodemenu_items)}function getActiveInteractions(b){var a=b.getId();for(var c=0;c<xxmap.activeInteractions.length;c++){if(xxmap.activeInteractions[c].featureid==a){return xxmap.activeInteractions[c].interaction}}return false}function getModifiedFeature(a){if(a){for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid==a){return xxmap.activeInteractions[b].feature}}}return null}function removeInteraction(a){var c=-1;for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid===a){c=b;break}}if(c>=0){xxmap.activeInteractions.splice(c,1)}}function getCorrespondingFeature(f){var d=f.getGeometry().getCoordinates();for(var b=0;b<xxmap.activeInteractions.length;b++){var c=xxmap.activeInteractions[b].feature;var a=c.getGeometry().getCoordinates();if(a[0].toFixed(5)==d[0].toFixed(5)&&a[1].toFixed(5)==d[1].toFixed(5)){return c}}return null}function refreshMap(k,h){if(k){xxmap.map.setTarget(null);xxmap.map=null;xxmap.markersSource=null;xxmap.mapView=null;xxmap.mapLayer=null;xxmap.activeInteractions=[]}var a=updateMapMarkers();if((a!=null)&&(h||(a[4]==1))){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var l=xxmap.map.getView();l.setCenter(ol.proj.transform([c,b],"EPSG:4326","EPSG:3857"));var f=360,g=-2;while(f>d){g++;f=f/2}l.setZoom(g)}}function placeNode(a){if(xxdialogMode){return}var c='<div style=margin-bottom:6px><label for=selectnode-search>Search</label>&nbsp&nbsp<input type=text placeholder="Device name" id="selectnode-search" onchange=onPlaceNodeInputChange() onkeyup=onPlaceNodeInputChange() autocomplete=off style=width:120px></div><div id=placenode style="height:254px;overflow-y:auto;width:100%;margin:12px 1px 4px 1px;"><div id=noNodesMapPlace style=text-align:center;width:100%;display:none>No devices found.</div>';for(var b in nodes){c+="<div class=noselect id="+nodes[b]._id+"-rowid onclick=selectNodeToPlace(event,'"+nodes[b]._id+"') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id="+nodes[b]._id+"-checkid type=checkbox style=width:16px;display:inline />";c+="<div class=j"+nodes[b].icon+" style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>"+nodes[b].name+"</div></div>"}setDialogMode(2,"Select a node to place",3,placeNodeEx,c+"</div>",a);onPlaceNodeInputChange()}function placeNodeEx(b,c){var d=document.getElementsByName("PlaceMapDeviceCheckbox");for(var g in d){if(d[g].checked){var h=getNodeFromId(d[g].id.substring(0,d[g].id.length-8));if(h){var f=xxmap.markersSource.getFeatureById(g);var j=ol.proj.transform(c,"EPSG:3857","EPSG:4326");var k=[j[1],j[0]];if(f){f.getGeometry().setCoordinates(c);var a=getActiveInteractions(f);if(a){saveMarkerloc(f)}else{meshserver.send({action:"changedevice",nodeid:h._id,userloc:k})}}else{meshserver.send({action:"changedevice",nodeid:h._id,userloc:k})}}}}}function onPlaceNodeInputChange(){updatePlaceNodeTable(Q("selectnode-search").value.trim().toLowerCase())}function updatePlaceNodeTable(d){var b=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var c in nodes){var f=((nodes[c].namel.indexOf(d)>=0||d=="")||(nodes[c].rnamel!=null&&nodes[c].rnamel.indexOf(d)>=0));if(f){a++}QV(nodes[c]._id+"-rowid",f)}QV("noNodesMapPlace",a==0)}function selectNodeToPlace(b,f){if(b.target.name!="PlaceMapDeviceCheckbox"){var g=Q(f+"-checkid");g.checked=!g.checked}var c=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var d in c){if(c[d].checked){a++}}QE("idx_dlgOkButton",a>0)}function addMeshOptions(a,b){}function meshOptionRmvMod(a,b){}function meshExists(){for(var a in meshes){if(meshes[a]){return true}}return false}function setMeshView(a){var c=Q("select-mesh");var b=c.selectedIndex;if(c[b].value==a){c[0].selected=true;onSelectMeshChange()}}function clearMeshOptions(){}function getSearchLocation(){try{var b=Q("mapSearchLocation").value.trim();if(b.length>0){var c=new XMLHttpRequest();c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){formatSearchData(c.responseText)}};c.open("GET","https://nominatim.openstreetmap.org/search?q="+b+"&format=json",true);c.send()}}catch(a){}}function formatSearchData(c){try{QH("xmapSearchResults","");var d=JSON.parse(c),b=0,j='<div style="overflow-y:auto;width:100%;max-height:240px">';for(var h=0;h<d.length;h++){if(d[h].display_name&&d[h].boundingbox[0]&&d[h].boundingbox[1]&&d[h].boundingbox[2]&&d[h].boundingbox[3]){b++;var a=(h%2==0)?"F5F5F5":"EBEBEB";j+="<div style=cursor:pointer;padding:5px;background-color:#"+a+" onclick=mapGotoSelectedLocation(this)><div>"+d[h].display_name+"</div><div style=display:none>"+d[h].boundingbox[0]+"!#!"+d[h].boundingbox[1]+"!#!"+d[h].boundingbox[2]+"!#!"+d[h].boundingbox[3]+"</div></div>"}}j+="</div>";if(b==1){var g=[parseFloat(d[0].boundingbox[2]),parseFloat(d[0].boundingbox[0]),parseFloat(d[0].boundingbox[3]),parseFloat(d[0].boundingbox[1])];zoomToExtent(g)}else{if(b==0){j="<div style=width:200px>No location found.<div>"}QV("xmapSearchResultsDlg",true)}QH("xmapSearchResults",j)}catch(f){}}function mapGotoSelectedLocation(c){var d=c.children;var a=d[1].innerHTML.split("!#!");var b=[parseFloat(a[2]),parseFloat(a[0]),parseFloat(a[3]),parseFloat(a[1])];zoomToExtent(b);mapCloseSearchWindow()}function mapCloseSearchWindow(){QH("xmapSearchResults","");QV("xmapSearchResultsDlg",false)}function zoomToLocation(a,c){var b=xxmap.map.getView();b.setCenter(a);b.setZoom(c)}function zoomToFitExtent(){var b=xxmap.markersSource.getFeatures();if(b.length>0){var a=xxmap.markersSource.getExtent();xxmap.map.getView().fit(a,xxmap.map.getSize())}}function zoomToExtent(b){var a=ol.proj.transformExtent(b,ol.proj.get("EPSG:4326"),ol.proj.get("EPSG:3857"));xxmap.map.getView().fit(a,xxmap.map.getSize())}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(o,q,s){var n=getNodeFromId(o);var k=meshes[n.meshid];var l=k.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=n._id||s==true){currentNode=n;var m=EscapeHtml(n.name);if(m.length==0){m="<i>None</i>"}if((l&4)!=0){m='<span title="Click here to edit the server-side device name" onclick=showEditNodeValueDialog(0) style=cursor:pointer>'+m+' <img src="images/link5.png" /></span>'}QH("p10deviceName",m);QH("p11deviceName",m);QH("p12deviceName",m);QH("p13deviceName",m);QH("p14deviceName",m);QH("p15deviceName",m);QH("p16deviceName",m);var v="<table style=width:100%>";v+=addDeviceAttribute('<span title="The name of the administrative group this computer belong to">Mesh</span>','<a title="The name of the group this computer belong to" onclick=gotoMesh("'+n.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[n.meshid].name)+"</a>");if((n.rname!=null)&&(n.name!=n.rname)){v+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(n.rname)+"</span>")}if((features&1)==0){if((l&4)!=0){if(n.host){v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(n.host)+"</span>")}else{v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{v+=addDeviceAttribute("Hostname",EscapeHtml(n.host))}}var g=n.desc?EscapeHtml(n.desc):"<i>None</i>";if((l&4)!=0){v+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+g+"</span>")}else{v+=addDeviceAttribute("Description",g)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((n.agent!=null)&&(n.agent.id!=null)&&(n.agent.ver!=null)){var t="";if(n.agent.id<=a.length){t=a[n.agent.id]}else{t=a[0]}if(n.agent.ver!=0){t+=" v"+n.agent.ver}v+=addDeviceAttribute("Mesh Agent",t)}if(n.intelamt!=null){var t="";var r={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(n.intelamt.ver!=null&&n.intelamt.state==null){t+="<i>Unknown State</i>, v"+n.intelamt.ver}else{if((n.intelamt.ver==null)&&(n.intelamt.state==2)){t+="<i>Activated</i>"}else{if((n.intelamt.ver==null)||(n.intelamt.state==null)){t+="<i>Unknown Version & State</i>"}else{t+=r[n.intelamt.state];if(n.intelamt.flags){if(n.intelamt.flags&2){t+=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(n.intelamt.flags&4){t+=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}t+=(", v"+n.intelamt.ver)}}}if(n.intelamt.tls==1){t+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(n.intelamt.state==2){if(n.intelamt.user==null||n.intelamt.user==""){if((l&4)!=0){t+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel&reg; AMT credentials" onclick=editDeviceAmtSettings("'+n._id+'")>No Credentials</i>'}else{t+=", <i style=color:#FF0000>No Credentials</i>"}}t+=" ";if((l&4)!=0){t+='<img src=images/link4.png height=10 width=10 title="Edit Intel&reg; AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'}}v+=addDeviceAttribute("Intel&reg; AMT",t)}if((n.agent!=null)&&(n.agent.tag!=null)&&(n.agent.tag!="mailto:")){var u=EscapeHtml(n.agent.tag);if(u.startsWith("mailto:")){u='<a href="'+u+'">'+u.substring(7)+"</a>"}v+=addDeviceAttribute("Agent Tag",u)}var c=n.conn;if(c&&c>1){var f=[];if((n.conn&1)!=0){f.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>')}if((n.conn&2)!=0){f.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">Intel&reg; AMT CIRA</span>')}if((n.conn&4)!=0){f.push('<span title="Intel&reg; AMT is routable and ready for use.">Intel&reg; AMT</span>')}if((n.conn&8)!=0){f.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>')}v+=addDeviceAttribute("Connectivity",f.join(", "))}var h="<i>None</i>";if(n.tags!=null){h="";for(var j in n.tags){h+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+n.tags[j]+"</span>"}}v+=addDeviceAttribute("Groups","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+h+"</span>");v+="</table><br />";if((l&76)!=0){v+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}v+='<input type=button value=Notes title="View notes about this device" onclick=showNotes('+((l&128)==0)+',"'+encodeURIComponent(n._id)+'") />';QH("p10html",v);drawDeviceTimeline();v="<div style=float:right;font-size:x-small>";if((l&4)!=0){v+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+n._id+'") title="Remove this device">Delete Device</a>'}v+="</div><div style=font-size:x-small>";if(k.mtype==2){v+='<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("'+n._id+'") title="Show device network interface information">Interfaces</a>&nbsp;'}if(xxmap!=null){v+='<a style=cursor:pointer onclick=p10showNodeLocationDialog("'+n._id+'") title="Show device locations information">Location</a>&nbsp;'}if(((l&8)!=0)&&(k.mtype==2)){v+='<a style=cursor:pointer onclick=p10showMeshCmdDialog(1,"'+n._id+'") title="Traffic router used to connect to a device thru this server.">Router</a>&nbsp;'}if(((c&1)!=0)&&(clickOnce==true)&&(k.mtype==2)&&((l&8)!=0)){if((n.agent.id>0)&&(n.agent.id<5)){v+='<a style=cursor:pointer onclick=p10clickOnce("'+n._id+'","RDP2",3389) title="Requires Microsoft ClickOnce support in your browser.">RDP</a>&nbsp;'}if(n.agent.id>4){v+='<a style=cursor:pointer onclick=p10clickOnce("'+n._id+'","PSSH",22) title="Requires Microsoft ClickOnce support in your browser.">Putty</a>&nbsp;';v+='<a style=cursor:pointer onclick=p10clickOnce("'+n._id+'","WSCP",22) title="Requires Microsoft ClickOnce support in your browser.">WinSCP</a>&nbsp;'}}v+="</div><br>";QH("p10html3",v);powerstate=PowerStateStr(n.state);if((c&1)!=0){if(powerstate.length>0){powerstate+="<br/>"}powerstate+='<span style=font-size:12px title="Agent connected">Agent connected</span>'}if((c&2)!=0){if(powerstate.length>0){powerstate+="<br/>"}powerstate+='<span style=font-size:12px title="Intel&reg; AMT connected">Intel&reg; AMT connected</span>'}if((c&4)!=0){if(powerstate.length>0){powerstate+="<br/>"}powerstate+='<span style=font-size:12px title="Intel&reg; AMT detected">Intel&reg; AMT detected</span>'}QH("MainComputerState",powerstate);Q("MainComputerImage").setAttribute("src","images/icons200-"+n.icon+"-1.png");Q("MainComputerImage").className=((!n.conn)||(n.conn==0)?"gray":"");setupTerminal();setupFiles();var d=((l&16)!=0);if(d){setupConsole()}else{if(q==15){q=10}}QV("MainDevDesktop",((k.mtype==1)||(n.agent==null)||(n.agent.caps==null)||((n.agent.caps&1)!=0))&&(l&8));QV("MainDevTerminal",((k.mtype==1)||(n.agent==null)||(n.agent.caps==null)||((n.agent.caps&2)!=0))&&(l&8));QV("MainDevFiles",((k.mtype==2)&&((n.agent==null)||(n.agent.caps==null)||((n.agent.caps&4)!=0)))&&(l&8));QV("MainDevAmt",(n.intelamt!=null)&&((n.intelamt.state==2)||(n.conn&2))&&(l&8));QV("MainDevConsole",(d&&(k.mtype==2)&&((n.agent==null)||(n.agent.caps==null)||((n.agent.caps&8)!=0)))&&(l&8));QV("p15uploadCore",(n.agent!=null)&&(n.agent.caps!=null)&&((n.agent.caps&16)!=0)&&(userinfo.siteadmin==4294967295));QH("p15coreName",((n.agent!=null)&&(n.agent.core!=null))?n.agent.core:"");var b=Q("p14iframe").contentWindow.getCurrentMeshNode();if((b!=null)&&(b._id!=currentNode._id)){Q("p14iframe").contentWindow.disconnect()}var p=((n.conn&6)!=0)?true:false;Q("p14iframe").contentWindow.setConnectionState(p);Q("p14iframe").contentWindow.setFrameHeight("650px");Q("p14iframe").contentWindow.setAuthCallback(updateAmtCredentials);QV("deskActionsBtn",(l&72)!=0);QV("termActionsBtn",(l&72)!=0);QV("filesActionsBtn",(l&72)!=0);if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}QV("DeskTools",false);showDeskToolsProcesses();refreshDeviceEvents()}setupDesktop();if(!q){q=10}go(q)}function showNotes(b,a){if(xxdialogMode){return}setDialogMode(2,"Notes",2,showNotesEx,"<textarea id=d2devNotes ro="+b+" noteid="+a+" readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>Notes can be viewed and changed by other administrators.<span>",a);meshserver.send({action:"getNotes",id:decodeURIComponent(a)})}function showNotesEx(a,b){meshserver.send({action:"setNotes",id:decodeURIComponent(b),notes:encodeURIComponent(Q("d2devNotes").value)})}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:250px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateAmtCredentials(a){var b=getNodeFromId(currentNode._id);if((a==true)||(b.intelamt.user==null)||(b.intelamt.user=="")){editDeviceAmtSettings(currentNode._id,updateAmtCredentialsEx)}else{Q("p14iframe").contentWindow.connectButtonfunctionEx()}}function updateAmtCredentialsEx(a,b){Q("p14iframe").contentWindow.connectButtonfunctionEx()}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){if((currentNode==null)||(xxcurrentView<10)||(xxcurrentView>19)){return}var s=null,o=Date.now();if(currentNode._id==powerTimelineNode){s=powerTimeline}var f=new Date();f.setHours(0,0,0,0);f=new Date(f.getTime()-(1000*60*60*24*6));var u=f.getTime();var t=[];if(s!=null&&s.length>1){t.push([0,s[1],s[0]]);var c=s[1];for(var m=2;m<s.length;m+=2){var p=s[m],k=o;if(s.length>(m+1)){k=s[m+1]}t.push([c,c+k,p]);c=c+k}}var A="",b=1,h=new Date();var w=Q("masthead").offsetWidth-(160+9+9+14);h.setHours(0,0,0,0);for(var m=0;m<7;m++){var g="",q=h.getTime(),l=q+(1000*60*60*24);for(var n in t){var a=t[n];if(isTimeBlockInside(q,l,a[0],a[1])==true){var y=Math.max(q,a[0]);var r=Math.min(Math.min(l,a[1]),o);var z=Math.round(((r-y)*w)/86400000);if(z>0){var v=powerStateStrings2[a[2]]+" from "+new Date(y).toLocaleTimeString()+" to "+new Date(r).toLocaleTimeString()+".";g+='<div title="'+v+'" style=display:table-cell;width:'+z+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}A+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+h.toLocaleDateString()+"<div></div></div></td><td><div>"+g+"</div></td></tr>";++b;h=new Date(h.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Power State</th></tr>'+A+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td class=style7 style=width:180px>"+a+"</td><td class=style9 style=max-width:400px;overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(f,b){if(xxdialogMode){return}var g="",d=getNodeFromId(f),a=3,c=getNodeRights(f);if((c&4)==0){return}g+=addHtmlValue("Username",'<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');g+=addHtmlValue("Password","<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");g+=addHtmlValue("Security","<select id=dp10tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel&reg; AMT credentials",a,editDeviceAmtSettingsEx,g,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}var b='Are you sure you want to delete node "'+EscapeHtml(currentNode.name)+'"?<br /><br />';b+="<input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm";setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,b,a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10clickOnce(a,c,b){meshserver.send({action:"getcookie",nodeid:a,tcpport:b,tag:"clickonce",protocol:c})}var d2map=null;function p10showNodeLocationDialog(){if((xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){setDialogMode(0)}else{if(xxdialogMode){return}}var m=[],n=["iploc","wifiloc","gpsloc","userloc"],a=null;for(var k in n){if(currentNode[n[k]]!=null){var j=currentNode[n[k]].split(","),h=parseFloat(j[0]),l=parseFloat(j[1]);if((h<90)&&(h>-90)&&(l<180)&&(l>-180)){var f=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([l,h]))});f.setStyle(markerStyle(currentNode,parseInt(k)+1));m.push(f);if(a==null){a=[h,l,h,l,0]}else{if(h<a[0]){a[0]=h}if(l<a[1]){a[1]=l}if(h>a[2]){a[2]=h}if(l>a[3]){a[3]=l}}}}}var p=new ol.source.Vector({features:m});var o=new ol.layer.Vector({source:p});var q="<div id=d2map style=width:100%;height:300px></div>";setDialogMode(2,"Device Location",1,null,q,"@xxmap");var c=0,b=0,r=8;if(a!=null){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var g=360,r=-2;while(g>d){r++;g=g/2}}if(m.length==1){r=8}d2map=new ol.Map({target:"d2map",interactions:ol.interaction.defaults({dragPan:false,mouseWheelZoom:false}),layers:[new ol.layer.Tile({source:new ol.source.OSM()}),o],view:new ol.View({center:ol.proj.fromLonLat([c,b]),zoom:r})})}function p10showNodeNetInfoDialog(){if(xxdialogMode){return}setDialogMode(2,"Network Interfaces",1,null,"<div id=d2netinfo>Loading...</div>","if"+currentNode._id);meshserver.send({action:"getnetworkinfo",nodeid:currentNode._id})}function p10showMeshCmdDialog(a,b){if(xxdialogMode){return}var d="<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>";d+="<option value=3>Windows (32bit)</option>";d+="<option value=4>Windows (64bit)</option>";d+="<option value=5>Linux x86 (32bit)</option>";d+="<option value=6>Linux x86 (64bit)</option>";d+="<option value=25>Linux ARM, Raspberry Pi (32bit)</option>";d+="</select>";var c="";if(a==0){c+="<div>MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.<br /><br />"}if(a==1){c+='<div>Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />'}c+=addHtmlValue("Operating System",d);c+=addHtmlValue("MeshCmd",'<a id=meshcmddownloadid href="meshagents?meshcmd=3" target="_blank"></a>');if(a==0){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=generic" target="_blank">MeshAction (.txt)</a>')}if(a==1){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=route&nodeid='+b+'" target="_blank">MeshAction (.txt)</a>')}c+="</div>";setDialogMode(2,["Download MeshCmd","Network Router"][a],9,null,c);meshCmdOsClick()}function meshCmdOsClick(){var a=Q("aginsSelect").value,b="";Q("meshcmddownloadid").href="meshagents?meshcmd="+a;if(a==3){b="MeshCmd (Win32 executable)"}if(a==4){b="MeshCmd (Win64 executable)"}if(a==5){b="MeshCmd (Linux x86, 32bit)"}if(a==6){b="MeshCmd (Linux x86, 64bit)"}if(a==25){b="MeshCmd (Linux ARM, 32bit)"}QH("meshcmddownloadid",b)}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<br><div style=display:inline-block;width:40px></div>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div><br><br>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Groups"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:230px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktopNode;function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();delete desktop;desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){var b=multiDesktop[currentNode._id];if(b!=null){QH("DeskParent","");var a=b.m.CanvasId;a.setAttribute("id","Desk");a.setAttribute("style","width:100%;-ms-touch-action:none;margin-left:0px");a.setAttribute("onmousedown","dmousedown(event)");a.setAttribute("onmouseup","dmouseup(event)");a.setAttribute("onmousemove","dmousemove(event)");a.removeAttribute("onclick");Q("DeskParent").appendChild(a);desktop=b;if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}desktop.onStateChanged=onDesktopStateChange;desktopNode=currentNode;onDesktopStateChange(desktop,desktop.State);delete multiDesktop[currentNode._id]}else{QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode}Q("Desk").addEventListener("DOMMouseScroll",function(c){return dmousewheel(c)});Q("Desk").addEventListener("mousewheel",function(c){return dmousewheel(c)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}QV("disconnectbutton1span",(a!=0));QV("connectbutton1span",(a==0)&&(c.mtype==2));QV("connectbutton1hspan",(a==0)&&((currentNode.intelamt!=null)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var d=((currentNode.conn&1)!=0);QE("connectbutton1",d);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QE("deskSaveBtn",a==3);QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(a!=0)&&(desktopsettings.showfocus));QE("DeskCAD",a==3);QE("DeskWD",a==3);QE("deskkeys",a==3);QV("DeskWD",(currentNode.agent)&&(currentNode.agent.id<5));QV("deskkeys",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToolsButton",d);QV("DeskToastButton",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToastButton",d);if(d==false){QV("DeskTools",false)}}var autoConnectDesktopTimer=null;function autoConnectDesktop(a){if(autoConnectDesktopTimer==null){autoConnectDesktopTimer=setInterval(connectDesktop,100)}else{clearInterval(autoConnectDesktopTimer);autoConnectDesktopTimer=null}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();delete desktop;desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();delete desktop;desktopNode=desktop=null;QV("DeskFocus",false);QV("termdisplays",false);deskFocusBtn.value="All Focus";if(fullscreen==true){deskToggleFull()}break;case 2:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktopsettings.showfocus==false){desktop.m.focusmode=0;deskFocusBtn.value="All Focus"}if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(desktop.state!=0)&&(desktopsettings.showfocus))}var fullscreen=false;function deskToggleFull(){fullscreen=!fullscreen;QV("mastheadx",!fullscreen);QV("masthead",!fullscreen);QV("topbar",!fullscreen);QV("p11deviceNameHeader",!fullscreen);QV("footer",!fullscreen);QV("column_l_bottomgap",!fullscreen);QV("idx_deskFullBtn2",fullscreen);QV("deskFullBtn",!fullscreen);if(fullscreen){QS("container").width="100%";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("column_l").padding="0";QS("column_l").width="100%"}else{QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("column_l").padding="0 15px";QS("column_l").width="930px";toggleFullScreen()}deskAdjust()}function deskToggleFocus(){desktop.m.focusmode=(desktop.m.focusmode+64)%192;Q("deskFocusBtn").value=["All Focus","Small Focus","Large Focus"][desktop.m.focusmode/64]}function deskAdjust(){var c=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("Desk").clientHeight+Q("deskarea4").clientHeight+2))/2;if(fullscreen){document.documentElement.style.overflow="hidden";QS("deskarea3x").height=null;if(c<0){var a=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("deskarea4").clientHeight));var b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}else{document.documentElement.style.overflow="auto";QS("deskarea3x").height=(desktop)?"40px":"400px";QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null;QS("Desk")["margin-top"]="0";QS("Desk")["margin-bottom"]="0"}}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.sendCtrlMsg('{"action":"lock"}')}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}else{if(a==5){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]])}}}}}}}}function sendCAD(){if(xxdialogMode||desktop==null||desktop.State!=3){return}desktop.m.sendcad()}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function toggleKvmControl(){putstore("DeskControl",(Q("DeskControl").checked?1:0))}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(f,a,c,d){var g=Q("termdisplays").value;if(a.length>0){var b="";for(var h in a){b+="<option"+((g==a[h])?" selected":"")+">"+a[h]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){desktop.m.mousedown(a)}}function dmouseup(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){desktop.m.mouseup(a)}}function dmousemove(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){desktop.m.mousemove(a)}}function dmousewheel(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var terminalNode;function setupTerminal(){if((terminalNode!=currentNode)&&(terminal!=null)){terminal.Stop();delete terminal;terminal=null}terminalNode=currentNode;updateTerminalButtons()}function updateTerminalButtons(){var b=meshes[terminalNode.meshid];var d=((terminal!=null)&&(terminal.state!=0));QV("disconnectbutton2span",(d==true));QV("connectbutton2span",(d==false)&&(b.mtype==2));QV("connectbutton2hspan",(d==false)&&((terminalNode.intelamt!=null)&&(b.mtype==1||terminalNode.intelamt.state==2)&&((terminalNode.intelamt.ver!=null)||(b.mtype==1))));var c=((terminalNode.conn&1)!=0);QE("connectbutton2",c);var a=((terminalNode.conn&6)!=0);QE("connectbutton2h",a);QE("ctrlcbutton",d);QE("ctrlxbutton",d);QE("escbutton",d);QE("bsbutton",d);QE("pastebutton",d);QE("specialkeylist",d);QE("specialkeylistinput",d)}function onTerminalStateChange(d,a){var c=a;if((c==3)&&(d.contype==2)){c++}var b=StatusStrs[c];if(terminal.webRtcActive==true){b+=", WebRTC"}QH("termstatus",b);switch(a){case 0:d.m.TermResetScreen();d.m.TermDraw();if(terminal!=null){terminal.Stop();delete terminal;terminal=null}break;case 3:break}updateTerminalButtons()}var autoConnectTerminalTimer=null;function autoConnectTerminal(a){if(autoConnectTerminalTimer==null){autoConnectTerminalTimer=setInterval(connectTerminal,100)}else{clearInterval(autoConnectTerminalTimer);autoConnectTerminalTimer=null}}function connectTerminal(b,a){if(!terminal){if(a==2){if((terminalNode.intelamt.user==null)||(terminalNode.intelamt.user=="")){editDeviceAmtSettings(terminalNode._id,connectTerminal);return}terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.debugmode=debugmode;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id,16994,"*","*",0);terminal.contype=2;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation]}else{terminal=CreateAgentRedirect(meshserver,CreateAmtRemoteTerminal("Term"),serverPublicNamePort);terminal.debugmode=debugmode;terminal.m.debugmode=debugmode;terminal.m.lineFeed=([1,2,3,4,21,22].indexOf(currentNode.agent.id)>=0)?"\r\n":"\r";terminal.attemptWebRTC=attemptWebRTC;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id);terminal.contype=1;terminal.m.terminalEmulation=0;Q("id_ttypebutton").value=terminalEmulations[0]}}else{terminal.Stop();delete terminal;terminal=null}Q("connectbutton2").blur()}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];function termToggleType(){if(!terminal||xxdialogMode){return}terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation];Q("id_ttypebutton").blur()}var fxEmulations=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"];function termToggleFx(){if(!terminal||xxdialogMode){return}terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3;Q("id_tfxkeysbutton").value=fxEmulations[terminal.m.fxEmulation];Q("id_tfxkeysbutton").blur()}function termSendKey(b,a){if(!terminal||xxdialogMode){return}terminal.m.TermSendKey(b);Q(a).blur()}function showTermPasteDialog(){if(!terminal||xxdialogMode){return}Q("pastebutton").blur();setDialogMode(2,"Paste",3,showTermPasteDialogEx,'<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');Q("d2pasteText").focus()}function showTermPasteDialogEx(){if(!terminal){return}terminal.m.TermSendKeys(Q("d2pasteText").value)}function sendSpecialKey(){terminal.m.TermSendKey(Q("specialkeylist").value);Q("specialkeylist").blur();Q("specialkeylistinput").blur()}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();delete files;files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();delete files;files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();delete files;files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview();p13oldlinkpath=null}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var o="",p="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",m="Root";var y=p13filetree.path.split("\\");p13filetreelocation=[];for(var q in y){if(y[q]!=""){p13filetreelocation.push(y[q])}}for(var q in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(q)+1)+")>"+p13filetreelocation[q]+"</a>"}var t=p13filetreelocation.join("/");var k=p13sort_files(p13filetree.dir);for(var q in k){var d=k[q],s=d.n,v;v=s;if(s.length>70){v='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,70))+"...</span>"}else{v=EscapeHtml(s)}s=EscapeHtml(s);var j="";if(d.d!=null){var g=new Date(d.d),j=(g.getMonth()+1)+"/"+(g.getDate())+"/"+g.getFullYear()+" "+g.toLocaleTimeString()+"&nbsp;"}var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3){var u="",w="";n="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right title=\""+w+'">'+u+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+v+"</a></span></div>"}else{var r=v;if(d.s>0){r='<a target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(t+"/"+s)+"','"+encodeURIComponent(s)+"',"+d.s+')">'+v+"</a>"}n="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span class=fsize>"+j+"</span><span style=float:right>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+r+"</span></div>"}if(d.t<3){o+=n}else{p+=n}}QH("p13files",o+p);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var q=0;q<a.length;q++){if(b.indexOf(p13filetree.dir[a[q].value].n)>=0){a[q].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="Select All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"Select None":"Select All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function p13fileDragDrop(a){haltEvent(a);QV("p13bigfail",false);QV("p13bigok",false);if(a.dataTransfer==null||a.dataTransfer.files.length==0||p13filetree==null){return}p13doUploadFiles(a.dataTransfer.files)}var p13dragtimer=null;function p13fileDragOver(b){haltEvent(b);if(p13dragtimer!=null){clearTimeout(p13dragtimer);p13dragtimer=null}var a=(p13filetree!=null);QV("p13bigok",a);QV("p13bigfail",!a)}function p13fileDragLeave(a){haltEvent(a);if(a.target.id!="p13filetable"){QV("p13bigfail",false);QV("p13bigok",false)}else{p13dragtimer=setTimeout(function(){QV("p13bigfail",false);QV("p13bigok",false);p13dragtimer=null},10)}}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText(JSON.stringify({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength}))};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var f=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(f==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(f,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentDeviceEvents=null;function devevents_update(){var h="",a=null;for(var c in currentDeviceEvents){var b=currentDeviceEvents[c];var g=new Date(b.time);if(g.toLocaleDateString()!=a){if(a!=null){h+="</table>"}h+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+g.toLocaleDateString()+"</td></tr>";a=g.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var f=b.msg.split("(R)").join("&reg;");h+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";h+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";h+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";h+="<div style=font-size:14px><span style=width:300px>"+g.toLocaleTimeString()+" - "+f+"</span></div></div></td></tr>"}if(a!=null){h+="</table>"}if(h==""){h="<br><i>No Events Found</i><br><br>"}QH("p16events",h)}function refreshDeviceEvents(){meshserver.send({action:"events",nodeid:currentNode._id,limit:parseInt(p16limitdropdown.value)})}function agentConsoleHandleKeys(b){var d=0,a=Q("p15consoleText");if(b.key){if(b.keyCode==13&&consoleFocus==0){p15consoleSend(b);d=1}else{if(b.keyCode==8&&consoleFocus==0){var f=a.value;a.value=f.substring(0,f.length-1);d=1}else{if(b.keyCode==27){a.value="";d=1}else{if((b.keyCode==38)||(b.keyCode==40)){var c=consoleHistory.indexOf(a.value);if((b.keyCode==38)&&((consoleHistory.length-1)>c)){a.value=consoleHistory[c+1]}else{if((b.keyCode==40)&&(c>0)){a.value=consoleHistory[c-1]}else{if((b.keyCode==40)&&(c==0)){a.value=""}}}d=1}else{if(b.key.length===1){insertTextAtCursor(a,b.key);d=1}}}}}}else{if(b.charCode!=0&&consoleFocus==0){a.value=((a.value+String.fromCharCode(b.charCode)));d=1}}if(d>0){return haltEvent(b)}}function insertTextAtCursor(a,d){if(document.selection){a.focus();sel=document.selection.createRange();sel.text=d}else{if(a.selectionStart||a.selectionStart=="0"){var c=a.selectionStart,b=a.selectionEnd;a.value=a.value.substring(0,c)+d+a.value.substring(b,a.value.length);a.setSelectionRange(b+1,b+1)}else{a.value+=myValue}}}var consoleNode;function setupConsole(){var d=(consoleNode==currentNode);consoleNode=currentNode;var a=meshes[consoleNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&16)!=0){if(consoleNode.consoleText==null){consoleNode.consoleText=""}if(d==false){QH("p15agentConsoleText",consoleNode.consoleText);Q("p15agentConsole").scrollTop=Q("p15agentConsole").scrollHeight}var c=((consoleNode.conn&1)!=0)?true:false;QH("p15statetext",c?"Mesh Agent is online":"Mesh Agent is offline");QE("p15consoleText",c);QE("p15uploadCore",c)}else{QH("p15statetext","Access Denied");QE("p15consoleText",false);QE("p15uploadCore",false)}}function p15consoleClear(){QH("p15agentConsoleText","");Q("id_p15consoleClear").blur();consoleNode.consoleText=""}var consoleHistory=[];function p15consoleSend(a){if(a&&a.keyCode!=13){return}var d=Q("p15consoleText").value,c="<div style=color:green>&gt; "+EscapeHtml(Q("p15consoleText").value)+"<br/></div>";Q("p15agentConsoleText").innerHTML+=c;consoleNode.consoleText+=c;Q("p15agentConsole").scrollTop=Q("p15agentConsole").scrollHeight;Q("p15consoleText").value="";meshserver.send({action:"msg",type:"console",nodeid:consoleNode._id,value:d});if(d.length>0){var b=consoleHistory.indexOf(d);if(b>=0){consoleHistory.splice(b,1)}consoleHistory.unshift(d);consoleHistory.splice(10)}}function p15consoleReceive(b,a){a="<div>"+a+"</div>";if(b.consoleText==null){b.consoleText=a}else{b.consoleText+=a}if(consoleNode==b){Q("p15agentConsoleText").innerHTML+=a;Q("p15agentConsole").scrollTop=Q("p15agentConsole").scrollHeight}}function p15uploadCore(a){if(xxdialogMode){return}if(a.shiftKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(a.altKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(a.ctrlKey==true){p15uploadCore2()}else{setDialogMode(2,"Change Mesh Agent Core",3,p15uploadCoreEx,"<select id=d3coreMode style=float:right;width:260px><option value=1>Upload default server core</option><option value=2>Clear the core</option><option value=3>Upload a core file</option><option value=4>Soft disconnect agent</option><option value=5>Hard disconnect agent</option></select><div>Change Core</div>")}}}}function p15uploadCoreEx(){if(Q("d3coreMode").value==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(Q("d3coreMode").value==2){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(Q("d3coreMode").value==3){p15uploadCore2()}else{if(Q("d3coreMode").value==4){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:1})}else{if(Q("d3coreMode").value==5){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:2})}}}}}}function p15uploadCore2(){if(xxdialogMode){return}Q("d3localmodeform").action="uploadmeshcorefile.ashx";Q("d3attrib").value=currentNode._id;setDialogMode(3,"Upload Mesh Agent Core",3,p15uploadCoreEx2);d3init()}function p15uploadCoreEx2(){var b=Q("d3uploadMode").value;if(b==1){Q("d3submit").click()}else{var a=d3getFileSel();if(a.length==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:d3filetreelocation.join("/")+"/"+a[0]})}}}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a="Change your account e-mail address here.<br /><br />";a+=addHtmlValue("Email","<input id=dp2email style=width:230px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp2email").value=userinfo.email}account_validateEmail();Q("dp2email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp2email").value)&&(Q("dp2email").value!=userinfo.email));if((x==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp2email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="To delete this account, type in the account password in both boxes below and hit ok.<br /><br />";a+="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:80px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="Change your account password by entering the new password twice in the boxes below.<br /><br />";a+="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:60px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Password Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}var a="Create a new mesh computer group using the options below.<br /><br />";a+=addHtmlValue("Mesh Name","<input id=dp2meshname style=width:230px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Mesh Type","<div style=width:230px;margin:0;padding:0><select id=dp2meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Mesh Agent Policy</option><option value=1>Intel&reg; AMT Agent-less Policy</option></select></div>");a+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp2meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Mesh",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp2meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp2meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp2meshname").value,meshtype:Q("dp2meshtype").value,desc:Q("dp2meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value));var b="";if(Q("apassword1").value!=""){var a=checkPasswordStrength(Q("apassword1").value);if(a>=80){b="<span style=color:green>Strong<span>"}else{if(a>=60){b="<span style=color:blue>Good<span>"}else{b="<span style=color:red>Weak<span>"}}}QH("dxPassWarn",b)}function checkPasswordStrength(f){var g=0,d={},h=0,j={digits:/\d/.test(f),lower:/[a-z]/.test(f),upper:/[A-Z]/.test(f),nonWords:/\W/.test(f)};if(!f){return 0}for(var b=0;b<f.length;b++){d[f[b]]=(d[f[b]]||0)+1;g+=5/d[f[b]]}for(var a in j){h+=(j[a]==true)?1:0}return parseInt(g+(h-1)*10)}function updateMeshes(){var f="";var a=0,b=0;for(i in meshes){if(a>1){f+="</tr><tr>";a=0}a++;b++;var d=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var g="Partial Rights";if(d==4294967295){g="Full Administrator"}else{if(d==0){g="No Rights"}}f+="<div style=display:inline-block;width:431px;height:50px;padding-top:1px;padding-bottom:1px;float:left><div style=float:left;width:30px;height:100%></div><div style=height:100%;cursor:pointer onclick=gotoMesh('"+i+"')><div class=mi style=float:left;width:50px;height:50px></div><div style=height:100%><div class=g1></div><div class=e2 style=width:300px><div class=e1>"+EscapeHtml(meshes[i].name)+"</div><div>"+g+"</div></div><div class=g2 style=float:left></div></div></div></div>"}meshcount=b;QH("p2meshes",f);QV("p2noMeshFound",b==0)}function gotoMesh(a){currentMesh=meshes[a];p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var f="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){f="Intel&reg; AMT computer group (No Agent)"}if(currentMesh.mtype==2){f="Mesh agent computer group"}var l="";l+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));l+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&&currentMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));l+=addHtmlValue("Type",f);l+=addHtmlValue("Identifier",currentMesh._id.split("/")[2]);l+='<br><input type=button value=Notes title="View notes about this mesh" onclick=showNotes(false,"'+encodeURIComponent(currentMesh._id)+'") />';l+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){l+="<a onclick=p20showAddMeshUserDialog() style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a>"}if((d&4)!=0){if(currentMesh.mtype==1){l+='<a onclick=addCiraDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel&reg; AMT computer that is located on the internet."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install CIRA</a>';l+='<a onclick=addDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel&reg; AMT computer that is located on the local network."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install local</a>'}if(currentMesh.mtype==2){l+='<a onclick=addAgentToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new computer to this mesh by installing the mesh agent."><img src=images/icon-addnew.png border=0 height=12 width=12> Install</a>'}}l+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';var a=1,j=[];for(var c in currentMesh.links){j.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}j.sort(function(m,n){if(m.name>n.name){return 1}if(m.name<n.name){return -1}return 0});for(var c in j){var k="",h="Partial Rights",g=j[c].rights;if(g==4294967295){h="Full Administrator"}else{if(g==0){h="No Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){k='<a onclick=p20deleteUser(event,"'+encodeURIComponent(j[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}l+='<tr onclick=p20viewuser("'+encodeURIComponent(j[c].id)+'") style=cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+'><td><div title="Mesh User" class=m2></div><div>&nbsp;'+j[c].name+"<div></div></div></td><td><div style=float:right>"+k+"</div><div>"+h+"</div></td></tr>";++a}l+="</tbody></table>";if(d==4294967295){l+="<div style=font-size:x-small;text-align:right><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",l)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Mesh Name","<input id=dp20meshname style=width:230px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp20meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Edit Mesh",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a="Allow a user to manage the mesh and computers on this mesh<br /><br />";a+=addHtmlValue("User Name","<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+="<br><div>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Mesh<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Mesh Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Mesh Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(f){if(xxdialogMode){return}f=decodeURIComponent(f);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[f].rights;if(c==4294967295){d=", Full Administrator (all rights)"}else{if((c&1)!=0){d+=", Edit Mesh"}if((c&2)!=0){d+=", Manage Mesh Users"}if((c&4)!=0){d+=", Manage Mesh Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,g=addHtmlValue("User Name",f.split("/")[2]);g+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=f)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,g,f)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var filetreelinkpath;var filetreelocation=[];function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var r="",s="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",p="Root",A,l=filetree,n=1;var k=[],w=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var t=0;t<a.length;t++){if(a[t].checked){b.push(a[t].value)}}filetreelinkpath="";for(var t in filetreelocation){if((l.f!=null)&&(l.f[filetreelocation[t]]!=null)){k.push(filetreelocation[t]);p+=" / "+filetreelocation[t];if((n==1)){var D=filetreelocation[t].split("/");A=window.location+D[0]+"files/"+D[2];filetreelinkpath+=filetreelocation[t]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[t];if(n>2){A+="/"+filetreelocation[t]}}}l=l.f[filetreelocation[t]];c+=" / <a style=cursor:pointer onclick=p5folderup("+n+")>"+(l.n!=null?l.n:filetreelocation[t])+"</a>";n++}else{break}}filetreelocation=k;var y=p.toLowerCase().startsWith("root / "+userinfo._id+" / public");var m=p5sort_files(l.f);for(var t in m){var d=m[t],v=d.n,C;C=v;if(v.length>70){C='<span title="'+EscapeHtml(v)+'">'+EscapeHtml(v.substring(0,70))+"...</span>"}else{C=EscapeHtml(v)}v=EscapeHtml(v);var j="";if(d.d!=null){var g=new Date(d.d),j=(g.getMonth()+1)+"/"+(g.getDate())+"/"+g.getFullYear()+" "+g.toLocaleTimeString()+"&nbsp;"}var o="";if(d.s!=null){o=getFileSizeStr(d.s)}var q="";if(d.t<3||d.t==4){var B=(d.t==1||d.t==4)?p5getQuotabar(d):"",E="";q="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+v+"'>&nbsp;<span style=float:right title=\""+E+'">'+B+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+C+"</a></span></div>"}else{var u=C;var z="";if(y){z=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+A+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){u='<a target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+C+"</a>"+z}q="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'>&nbsp;<span class=fsize>"+j+"</span><span style=float:right>"+o+"</span><span><div class=fileIcon"+d.t+"></div>"+u+"</span></div>"}if(d.t<3){r+=q}else{s+=q}}QH("p5rightOfButtons",p5getQuotabar(l));QH("p5files",r+s);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",y);if(w==filetreelinkpath){a=document.getElementsByName("fc");for(var t=0;t<a.length;t++){a[t].checked=(b.indexOf(a[t].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"Select None":"Select All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(f){return b.test(f)&&!c.test(f)&&!d.test(f)&&(f[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(l){a.push(l.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout(function(){QV("bigfail",false);QV("bigok",false);p5dragtimer=null},10)}}function events_update(){var h="",a=null;for(var c in events){var b=events[c];var g=new Date(b.time);if(g.toLocaleDateString()!=a){if(a!=null){h+="</table>"}h+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+g.toLocaleDateString()+"</td></tr>";a=g.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var f=b.msg.split("(R)").join("&reg;");if(b.username&&b.username!=userinfo.name){f+=": "+b.username}h+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";h+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";h+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";h+="<div style=font-size:14px><span style=width:300px>"+g.toLocaleTimeString()+" - "+f+"</span></div></div></td></tr>"}if(a!=null){h+="</table>"}if(h==""){h="<br><i>No Events Found</i><br><br>"}QH("p3events",h)}function showDeleteAllEventsDialog(){if(xxdialogMode){return}var a="Delete all events in the server event log?<br /><br />";a+="<input id=p3check type=checkbox onchange=validateDeleteAllEventsDialog() />Confirm";setDialogMode(2,"Delete All Events",3,showDeleteAllEventsDialogEx,a);validateDeleteAllEventsDialog()}function validateDeleteAllEventsDialog(){QE("idx_dlgOkButton",Q("p3check").checked)}function showDeleteAllEventsDialogEx(a,b){meshserver.send({action:"clearevents"})}function refreshEvents(){meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)})}function updateUsers(){QV("MainMenuMyUsers",(users!=null)&&((features&4)==0));if((users==null)||((features&4)!=0)){QH("p3users","");return}var g=[],d=100,b=0;for(var c in users){g.push(c)}g.sort();var j=Q("UserSearchInput").value.toLowerCase();var k="<table style=width:100% cellpadding=0 cellspacing=0>",a=true;for(var c in g){var h=users[g[c]],f=null;if(wssessions!=null){f=wssessions[h._id]}if((f!=null)&&(h.name.toLowerCase().indexOf(j)>=0)){if(d>0){if(a){k+="<tr><td class=userTableHeader>Online Users";a=false}k+=addUserHtml(h,f);d--}else{b++}}}a=true;for(var c in g){var h=users[g[c]],f=null;if(wssessions!=null){f=wssessions[h._id]}if((f==null)&&(h.name.toLowerCase().indexOf(j)>=0)){if(d>0){if(a){k+="<tr><td class=userTableHeader>Offline Users";a=false}k+=addUserHtml(h,f);d--}else{b++}}}k+="</table>";if(b==1){k+="<br />1 more user not shown, use search box to look for users...<br />"}else{if(b>1){k+="<br />"+b+" more users not shown, use search box to look for users...<br />"}}if(d==100){k+="<br />No users found.<br />"}QH("p3users",k);if((currentUser!=null)&&(xxcurrentView==30)){gotoUser(encodeURIComponent(currentUser._id),true)}}function addUserHtml(h,g){var k="",b=" gray",c="m2",d="",f=(h.name!=userinfo.name);if(g!=null){b="";if(f){d+='<a onclick=showUserAlertDialog(event,"'+encodeURIComponent(h._id)+'")>'}if(g==1){d+="1 active session"}else{d+=g+" active sessions"}if(f){d+="</a>"}}else{if(h.login){d+='<span title="Last login: '+new Date(h.login).toLocaleString()+'">'+new Date(h.login).toLocaleDateString()+"</span>"}}if(d!=""){d+=", "}if(f){d+='<a onclick=showUserAdminDialog(event,"'+encodeURIComponent(h._id)+'")>'}if((h.siteadmin!=null)&&((h.siteadmin&32)!=0)&&(h.siteadmin!=4294967295)){d+="Locked, "}d+="<span title='Server Permissions'>";if((h.siteadmin==null)||(h.siteadmin==0)||(h.siteadmin==32)){d+="User"}else{if(h.siteadmin==8){d+="User with server files"}else{if(h.siteadmin==4294967295){d+="Administrator"}else{d+="Partial"}}}d+="</span>";if((h.quota!=null)&&((h.siteadmin&8)!=0)){d+=", "+(h.quota/1024)+" k"}if(f){d+="</a>"}var j=EscapeHtml(h.name),a="";if(serverinfo.emailcheck==true){a=((h.emailVerified!=true)?' <b style=color:red title="Email is not verified">&#x1F5F4</b>':' <b style=color:green title="Email is verified">&#x1F5F8</b>')}if(h.email!=null){j+=', <a onclick=doemail(event,"'+h.email+'")>'+h.email+"</a>"+a}k+='<tr><td style=cursor:pointer onclick=gotoUser("'+encodeURIComponent(h._id)+'")>';k+="<div class=bar style=height:24px;width:100%;font-size:medium>";k+='<div style=float:left;height:24px;width:24px;background-color:white><div class="'+c+b+'" style=width:16px;margin-top:4px;margin-left:2px;height:16px></div></div>';k+="<div class=g1 style=height:24px;float:left></div><div class=g2 style=height:24px;float:right></div>";k+="<div><span>"+j+"</span><span style=float:right>"+d+"</span></div></div>";return k}function showUserAlertDialog(a,b){if(xxdialogMode){return}haltEvent(a);setDialogMode(2,"Notify "+EscapeHtml(users[decodeURIComponent(b)].name),3,showUserAlertDialogEx,'Send a text notification to this user.<textarea id=d2notifyText maxlength=2048 style="width:100%;height:184px;resize:none"></textarea>',b);Q("d2notifyText").focus();return false}function showUserAlertDialogEx(a,b){meshserver.send({action:"notifyuser",userid:decodeURIComponent(b),msg:Q("d2notifyText").value})}function doemail(b,a){if(xxdialogMode){return}haltEvent(b);window.open("mailto:"+a);return false}function showCreateNewAccountDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Name","<input id=p4name style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Email","<input id=p4email style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Create Account",3,showCreateNewAccountDialogEx,a);showCreateNewAccountDialogValidate();Q("p4name").focus()}function showCreateNewAccountDialogValidate(){if((Q("p4email").value.length>0)&&(validateEmail(Q("p4email").value))==false){QE("idx_dlgOkButton",false);return}QE("idx_dlgOkButton",(!Q("p4name")||((Q("p4name").value.length>0)&&(Q("p4name").value.indexOf(" ")==-1)))&&Q("p4pass1").value.length>0&&Q("p4pass1").value==Q("p4pass2").value)}function showCreateNewAccountDialogEx(){meshserver.send({action:"adduser",username:Q("p4name").value,email:Q("p4email").value,pass:Q("p4pass1").value})}function showUserAdminDialog(a,c){if(xxdialogMode){return}haltEvent(a);c=decodeURIComponent(c);var d="<div>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 style=width:80px;text-align:right id=ua_fileaccessquota>k max, blank for default<br><hr/>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>";d+="<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>";d+="</div>";var b=users[c.toLowerCase()];setDialogMode(2,"Server Permissions",3,showUserAdminDialogEx,d,b);if(b.siteadmin&&b.siteadmin!=0){Q("ua_fulladmin").checked=(b.siteadmin==4294967295);Q("ua_serverbackup").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&1)!=0));Q("ua_manageusers").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&2)!=0));Q("ua_serverrestore").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&4)!=0));Q("ua_fileaccess").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&8)!=0));Q("ua_serverupdate").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&16)!=0));Q("ua_lockedaccount").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&32)!=0))}QE("ua_fulladmin",userinfo.siteadmin==4294967295);QE("ua_serverbackup",userinfo.siteadmin==4294967295);QE("ua_manageusers",userinfo.siteadmin==4294967295);QE("ua_serverrestore",userinfo.siteadmin==4294967295);QE("ua_fileaccess",userinfo.siteadmin==4294967295);QE("ua_serverupdate",userinfo.siteadmin==4294967295);Q("ua_fileaccessquota").value=(b.quota!=null)?(b.quota/1024):"";showUserAdminDialogValidate();return false}function showUserAdminDialogValidate(){if(userinfo.siteadmin==4294967295){QE("ua_serverbackup",!Q("ua_fulladmin").checked);QE("ua_manageusers",!Q("ua_fulladmin").checked);QE("ua_serverrestore",!Q("ua_fulladmin").checked);QE("ua_fileaccess",!Q("ua_fulladmin").checked);QE("ua_serverupdate",!Q("ua_fulladmin").checked);QE("ua_fileaccessquota",Q("ua_fileaccess").checked&&!Q("ua_fulladmin").checked)}}function showUserAdminDialogEx(a,d){var c=0,b=parseInt(Q("ua_fileaccessquota").value);if(Q("ua_fulladmin").checked==true){c=4294967295}else{if(Q("ua_serverbackup").checked==true){c+=1}if(Q("ua_manageusers").checked==true){c+=2}if(Q("ua_serverrestore").checked==true){c+=4}if(Q("ua_fileaccess").checked==true){c+=8}if(Q("ua_serverupdate").checked==true){c+=16}if(Q("ua_lockedaccount").checked==true){c+=32}}var f={action:"edituser",name:d.name,siteadmin:c};if(isNaN(b)==false){f.quota=(b*1024)}meshserver.send(f)}function onUserSearchInputChanged(){updateUsers()}var currentUser=null;function gotoUser(k,f){if(xxdialogMode&&!f){return}var j=currentUser=users[decodeURIComponent(k)];if(j==null){setDialogMode(0);go(4);return}QH("p30userName",j.name);QH("p31userName",j.name);var h=(j.name==userinfo.name),a=0;if(wssessions!=null&&wssessions[j._id]){a=wssessions[j._id]}Q("MainUserImage").classList.remove("gray");if(a==0){Q("MainUserImage").classList.add("gray")}var g="";if((j.siteadmin!=null)&&((j.siteadmin&32)!=0)&&(j.siteadmin!=4294967295)){g+="Locked account, "}if((j.siteadmin==null)||(j.siteadmin==0)||(j.siteadmin==32)){g+="No server rights"}else{if(j.siteadmin==8){g+="Access to server files"}else{if(j.siteadmin==4294967295){g+="Full administrator"}else{g+="Partial rights"}}}var l="<div style=min-height:80px><table style=width:100%>";var c=j.email?EscapeHtml(j.email):"<i>Not set</i>",d="";if(serverinfo.emailcheck){d=((j.emailVerified==true)?'<b style=color:green;cursor:pointer title="Email is verified">&#x1F5F8</b> ':'<b style=color:red;cursor:pointer title="Email not verified">&#x1F5F4</b> ')}l+=addDeviceAttribute("Email",d+'<a style=cursor:pointer onclick=p30showUserEmailChangeDialog(event,"'+k+'")>'+c+'</a> <a style=cursor:pointer onclick=doemail(event,"'+j.email+'")><img src="images/link1.png" /></a>');l+=addDeviceAttribute("Server Rights",'<a style=cursor:pointer onclick=showUserAdminDialog(event,"'+k+'")>'+g+"</a>");if(j.quota){l+=addDeviceAttribute("Server Quota",EscapeHtml(parseInt(j.quota)/1024)+" k")}l+=addDeviceAttribute("Creation",new Date(j.creation).toLocaleString());if(j.login){l+=addDeviceAttribute("Last Login",new Date(j.login).toLocaleString())}l+="</table></div><br />";l+='<input type=button value=Notes title="View notes about this user" onclick=showNotes(false,"'+k+'") />';if(!h&&(a>0)){l+='<input type=button value=Notify title="Send user notification" onclick=showUserAlertDialog(event,"'+k+'") />'}QH("p30html",l);drawUserTimeline();var b=true;if(j._id==userinfo._id){b=false}if(j.siteadmin&&j.siteadmin>0&&userinfo.siteadmin!=4294967295){b=false}l="<div style=float:right;font-size:x-small>";if(b){l+='<a style=cursor:pointer onclick=p30showDeleteUserDialog() title="Remove this user">Delete User</a>'}l+="</div><div style=font-size:x-small>";if(userinfo.siteadmin==4294967295){l+='<a style=cursor:pointer onclick=p30showUserChangePassDialog() title="Change the password for this user">Change Password</a>'}l+="</div><br>";QH("p30html3",l);l="";if(a==1){l="1 active session"}else{if(a>1){l=a+" active sessions"}}QH("MainUserState",l);go(30);QH("p31events","");refreshUsersEvents()}function p30showUserEmailChangeDialog(a){if(xxdialogMode){return}var b="";b+=addHtmlValue("Email","<input id=dp30email style=width:230px maxlength=32 onchange=p30validateEmail() onkeyup=p30validateEmail() />");if(serverinfo.emailcheck){b+=addHtmlValue("Status","<select id=dp30verified style=width:230px onchange=p30validateEmail()><option value=0>Not verified</option><option value=1>Verified</option></select>")}setDialogMode(2,"Change Email for "+EscapeHtml(currentUser.name),3,p30showUserEmailChangeDialogEx,b);Q("dp30email").focus();Q("dp30email").value=currentUser.email;if(serverinfo.emailcheck){Q("dp30verified").value=currentUser.emailVerified?1:0}p30validateEmail()}function p30validateEmail(){var a=Q("dp30email").value,b=a.split("@");b=(b.length==2)&&(b[0].length>0)&&(b[1].split(".").length>1)&&(b[1].length>2)&&(a.length<1024)&&((a!=userinfo.email)||((serverinfo.emailcheck==true)&&(Q("dp30verified").value!=(userinfo.emailVerified?1:0))));QE("idx_dlgOkButton",b)}function p30showUserEmailChangeDialogEx(){var a={action:"edituser",name:currentUser.name,email:Q("dp30email").value};if(serverinfo.emailcheck){a.emailVerified=(Q("dp30verified").value==1)}meshserver.send(a)}function p30showUserChangePassDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Change Password for "+EscapeHtml(currentUser.name),3,p30showUserChangePassDialogEx,a);showCreateNewAccountDialogValidate();Q("p4pass1").focus()}function p30showUserChangePassDialogEx(){if(Q("p4pass1").value==Q("p4pass2").value){meshserver.send({action:"changeuserpass",user:currentUser.name,pass:Q("p4pass1").value})}}function p30showDeleteUserDialog(){if(xxdialogMode){return}setDialogMode(2,"Delete User "+EscapeHtml(currentUser.name),3,p30showDeleteUserDialogEx,"Confirm deletion of user "+EscapeHtml(currentUser.name)+"?")}function p30showDeleteUserDialogEx(){meshserver.send({action:"deleteuser",userid:currentUser._id,username:currentUser.name})}function drawUserTimeline(){var s=null,o=Date.now();s=[];var f=new Date();f.setHours(0,0,0,0);f=new Date(f.getTime()-(1000*60*60*24*6));var u=f.getTime();var t=[];if(s!=null&&s.length>1){t.push([0,s[1],s[0]]);var c=s[1];for(var m=2;m<s.length;m+=2){var p=s[m],k=o;if(s.length>(m+1)){k=s[m+1]}t.push([c,c+k,p]);c=c+k}}var z="",b=1,h=new Date();h.setHours(0,0,0,0);for(var m=0;m<7;m++){var g="",q=h.getTime(),l=q+(1000*60*60*24);for(var n in t){var a=t[n];if(isTimeBlockInside(q,l,a[0],a[1])==true){var w=Math.max(q,a[0]);var r=Math.min(Math.min(l,a[1]),o);var y=Math.round((r-w)/112794);if(y>0){var v=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(r).toLocaleTimeString()+".";g+='<div title="'+v+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+h.toLocaleDateString()+"<div></div></div></td><td><div>"+g+"</div></td></tr>";++b;h=new Date(h.getTime()-(1000*60*60*24))}QH("p30html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Login State</th></tr>'+z+"</tbody></table>")}var currentUserEvents=null;function userEvents_update(){var h="",a=null;for(var c in currentUserEvents){var b=currentUserEvents[c];var g=new Date(b.time);if(g.toLocaleDateString()!=a){if(a!=null){h+="</table>"}h+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+g.toLocaleDateString()+"</td></tr>";a=g.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var f=b.msg.split("(R)").join("&reg;");if(b.username&&b.username!=userinfo.name){f+=": "+b.username}h+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";h+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";h+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";h+="<div style=font-size:14px><span style=width:300px>"+g.toLocaleTimeString()+" - "+f+"</span></div></div></td></tr>"}if(a!=null){h+="</table>"}if(h==""){h="<br><i>No Events Found</i><br><br>"}QH("p31events",h)}function refreshUsersEvents(){meshserver.send({action:"events",limit:parseInt(p31limitdropdown.value),user:currentUser.name})}function d3init(){Q("d3localFile").value="";d3modechange()}function d3modechange(){var a=Q("d3uploadMode").value;QV("d3localmode",a==1);QV("d3servermode",a==2);if(a==1){d3setActions()}else{d3updatefiles()}}var d3filetreelinkpath;var d3filetreelocation=[];function d3updatefiles(){if(Q("d3uploadMode").value==1){return}var n="",o="",g=filetree,k=1;var c=[],s=d3filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var p=0;p<a.length;p++){if(a[p].checked){b.push(a[p].value)}}d3filetreelinkpath="";for(var p in d3filetreelocation){if((g.f!=null)&&(g.f[d3filetreelocation[p]]!=null)){c.push(d3filetreelocation[p]);if((k==1)){var u=d3filetreelocation[p].split("/");publicPath=window.location+u[0]+"files/"+u[2];if(d3filetreelocation[p]===userinfo._id){d3filetreelinkpath+="self"}else{d3filetreelinkpath+=(u[0]+"/"+u[2])}}else{if(d3filetreelinkpath!=""){d3filetreelinkpath+="/"+d3filetreelocation[p];if(k>2){publicPath+="/"+d3filetreelocation[p]}}}g=g.f[d3filetreelocation[p]];k++}else{break}}d3filetreelocation=c;var j=p5sort_files(g.f);for(var p in j){var d=j[p],r=d.n,t;t=r;if(r.length>70){t='<span title="'+EscapeHtml(r)+'">'+EscapeHtml(r.substring(0,70))+"...</span>"}else{t=EscapeHtml(r)}r=EscapeHtml(r);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var m="";if(d.t<3){var v="";m='<div class=filelist file=999><span style=float:right title="'+v+'"></span><span><div class=fileIcon'+d.t+'></div>&nbsp;<a style=cursor:pointer onclick=d3folderset("'+encodeURIComponent(d.nx)+'")>'+t+"</a></span></div>"}else{var q=t;m="<div class=filelist file=3><input style=float:left name=fcx class=fcb type=checkbox onchange=d3setActions() value='"+d.nx+"'>&nbsp;<span style=float:right>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+q+"</span></div>"}if(d.t<3){n+=m}else{o+=m}}QH("d3serverfiles",n+o);QE("p3FolderUp",d3filetreelocation.length>0);d3setActions()}function d3folderset(a){d3filetreelocation.push(decodeURIComponent(a));d3updatefiles()}function d3folderup(a){if(a==null){d3filetreelocation.pop()}else{while(d3filetreelocation.length>a){d3filetreelocation.pop()}}d3updatefiles()}function d3getFileSel(){var a=[];var b=document.getElementsByName("fcx");for(var c=0;c<b.length;c++){if(b[c].checked){a.push(b[c].value)}}return a}function d3setActions(){var a=Q("d3uploadMode").value;if(a==1){QE("idx_dlgOkButton",Q("d3localFile").value.length>0)}else{QE("idx_dlgOkButton",d3getFileSel().length==1)}}var notifications=[];function clickNotificationIcon(a){if(a==true){QV("notifiyBox",true)}else{if(a==false){QV("notifiyBox",false)}else{QV("notifiyBox",QS("notifiyBox")["display"]=="none")}}drawNotifications()}function setNotificationCount(a){if(parseInt(Q("notificationCount").innerHTML)==a){return}QH("notificationCount",a);QS("notificationCount")["background-color"]=(a==0)?"lightblue":"orange";QV("notificationCount",a>0)}function drawNotifications(){var j="";if(notifications.length==0){j="<div style=margin:5px>There are currently no notifications</div>"}else{for(var c in notifications){var g=notifications[c];var k="";var a=new Date(g.time);var f=0;if(g.nodeid!=null){var h=getNodeFromId(g.nodeid);if(h!=null){f=h.icon;k="<b>"+h.name+"</b>: "}}j+='<div title="Occured at '+a.toLocaleString()+'" id="notifyx'+g.id+'" class=notification style="cursor:pointer;border-top:1px solid '+((j=="")?"transparent":"orange")+'"><div class=j'+f+' onclick="notificationSelected('+g.id+')" style=margin:5px;float:left></div><div onclick="notificationDelete('+g.id+')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected('+g.id+')" style=margin:5px>'+k+g.text+"</div></div>"}}var b="";if(notifications.length>1){b='<div id="notifyRemoveAll" onclick="deleteAllNotifications()" style="cursor:pointer;border-top:1px solid orange;margin:5px;color:orange;text-align:right;padding-right:3px">Clear all</div>'}QH("notifiyBox",'<div class=customScroll style="max-height:170px;overflow-y:auto;margin:5px">'+j+"</div>"+b)}function notificationSelected(b){var c=-1;for(var a in notifications){if(notifications[a].id==b){c=a}}if(c!=-1){var d=notifications[c];if(d.nodeid!=null){if(d.tag=="desktop"){gotoDevice(d.nodeid,12)}else{if(d.tag=="terminal"){gotoDevice(d.nodeid,11)}else{if(d.tag=="files"){gotoDevice(d.nodeid,13)}else{if(d.tag=="intelamt"){gotoDevice(d.nodeid,14)}else{if(d.tag=="console"){gotoDevice(d.nodeid,15)}else{gotoDevice(d.nodeid,10)}}}}}}}}function notificationDelete(b){var c=-1;e=Q("notifyx"+b);if(e!=null){for(var a in notifications){if(notifications[a].id==b){c=a}}if(c!=-1){notifications.splice(c,1);e.parentNode.removeChild(e);setNotificationCount(notifications.length);if(notifications.length==0){QV("notifiyBox",false)}if(notifications.length==1){QV("notifyRemoveAll",false)}if((notifications.length>0)&&(c==0)){var d=notifications[0];QS("notifyx"+d.id)["border-top"]="1px solid transparent"}}}}function addNotification(a){if(a.time==null){a.time=Date.now()}if(a.id==null){a.id=Math.random()}notifications.unshift(a);setNotificationCount(notifications.length);Q("chimes").play();clickNotificationIcon(true)}function deleteAllNotifications(){notifications=[];setNotificationCount(0);drawNotifications();QV("notifiyBox",false)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(k,l,a,g,d,j){xxdialogMode=k;xxdialogFunc=g;xxdialogButtons=a;xxdialogTag=j;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgDeleteButton",a&4);QV("idx_dlgButtonBar",a&7);if(l){QH("id_dialogtitle",l)}for(var h=1;h<24;h++){QV("dialog"+h,h==k)}QV("dialog",k);if(d){if(k==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(g){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||g)&&c){c(g,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px");deskAdjust();drawDeviceTimeline()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function go(b){if(xxdialogMode||xxcurrentView==b){return}for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b;QV("topbar",b!=0);if(b>=10&&b<20){QS("MainMenuMyDevices").backgroundColor="#606060"}else{QS("MainMenuMyDevices").backgroundColor=((b==1)?"#003366":"#808080")}if(b>=20&&b<30){QS("MainMenuMyAccount").backgroundColor="#606060"}else{QS("MainMenuMyAccount").backgroundColor=((b==2)?"#003366":"#808080")}QS("MainMenuMyEvents").backgroundColor=((b==3)?"#003366":"#808080");if(b>=30&&b<40){QS("MainMenuMyUsers").backgroundColor="#606060"}else{QS("MainMenuMyUsers").backgroundColor=((b==4)?"#003366":"#808080")}QS("MainMenuMyFiles").backgroundColor=((b==5)?"#003366":"#808080");QV("MainSubMenuSpan",b>=10&&b<20);QS("MainDev").backgroundColor=((b==10)?"#003366":"#808080");QS("MainDevDesktop").backgroundColor=((b==11)?"#003366":"#808080");QS("MainDevTerminal").backgroundColor=((b==12)?"#003366":"#808080");QS("MainDevFiles").backgroundColor=((b==13)?"#003366":"#808080");QS("MainDevEvents").backgroundColor=((b==16)?"#003366":"#808080");QS("MainDevAmt").backgroundColor=((b==14)?"#003366":"#808080");QS("MainDevConsole").backgroundColor=((b==15)?"#003366":"#808080");QV("MeshSubMenuSpan",b>=20&&b<30);QS("MeshGeneral").backgroundColor=((b==20)?"#003366":"#808080");QV("UserSubMenuSpan",b>=30&&b<40);QS("UserGeneral").backgroundColor=((b==30)?"#003366":"#808080");QS("UserEvents").backgroundColor=((b==31)?"#003366":"#808080");if(b==1){updateDevicesEx()}}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function putstore(b,c){try{if(typeof(localStorage)==="undefined"){return}localStorage.setItem(b,c)}catch(a){}}function getstore(b,d){try{if(typeof(localStorage)==="undefined"){return d}var c=localStorage.getItem(b);if((c==null)||(c==null)){return d}return c}catch(a){return d}}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>&diams; "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function addOption(c,d,a){var b=document.createElement("option");b.text=d;b.value=a;Q(c).add(b)}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function methodcheck(a){if(a&&a!=null&&a.Body&&a.Body.ReturnValueStr!="SUCCESS"){messagebox("Call Error",a.Header.Method+": "+a.Body.ReturnValueStr.replace("_"," "));return true}return false}function TableStart(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}function TableEntry(a,b){return"<tr><td><p>"+a+"<td>"+b}function FullTable(c,a){var b=TableStart();for(i in c){if(i&&c[i]){b+=TableEntry(i,c[i])}}return b+TableEnd(a)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(b,a){return"<input type=button value='"+b+"' onclick='"+a+"' style=margin:4px>"}function AddButton2(b,a){return"<input type=button value='"+b+"' onclick='"+a+"'>"}function AddRefreshButton(a){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+a+"' style=margin:4px "+(refreshButtonsState==false?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>&#x25BC; More</a><div id=morexxx2 style=display:none><br><hr>'}function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>&#x25B2; Less</a></div>'}function getSelectedOptions(f){var d=[],c;for(var a=0,b=f.options.length;a<b;a++){c=f.options[a];if(c.selected){d.push(c.value)}}return d}function getInstance(b,c){for(var a in b){if(b[a]["InstanceID"]==c){return b[a]}}return null}function getItem(b,c,d){for(var a in b){if(b[a][c]==d){return b[a]}}return null}function guidToStr(a){return a.substring(6,8)+a.substring(4,6)+a.substring(2,4)+a.substring(0,2)+"-"+a.substring(10,12)+a.substring(8,10)+"-"+a.substring(14,16)+a.substring(12,14)+"-"+a.substring(16,20)+"-"+a.substring(20)}function getUrlVars(){var d,a,f=[],b=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var c=0;c<b.length;c++){d=b[c].indexOf("=");if(d>0){f[b[c].substring(0,d)]=b[c].substring(d+1,b[c].length)}}return f}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=b[d];break;case 1:c[a]=b[d];var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break}}return c}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)};</script></body></html>
\ No newline at end of file
1 +<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;}#container{background-color:#fff;width:960px;min-width:960px;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}#masthead{width:auto;margin:0;padding:0;overflow:auto;text-align:right;background-color:#036;width:960px;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:center;background-color:#D3D9D6;}.style7{font-size:large;background-color:#FFFFFF;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;width:201px;background-color:#c9c9c9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}</style> <style>.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f;}.ol-mouse-position{top:8px;right:8px;position:absolute;}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute;}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;}.ol-overlay-container{will-change:left,right,top,bottom;}.ol-unsupported{display:none;}.ol-unselectable, .ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing;}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px;}.ol-control:hover{background-color:rgba(255,255,255,.6);}.ol-zoom{top:.5em;right:.5em;}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear;}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s;}.ol-zoom-extent{top:4.643em;left:.5em;}.ol-full-screen{right:.5em;top:.5em;}@media print{.ol-control{display:none;}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px;}.ol-control button::-moz-focus-inner{border:none;padding:0;}.ol-zoom-extent button{line-height:1.4em;}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform;}.ol-touch .ol-control button{font-size:1.5em;}.ol-touch .ol-zoom-extent{top:5.5em;}.ol-control button:focus, .ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7);}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0;}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px;}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff;}.ol-attribution li{display:inline;list-style:none;line-height:inherit;}.ol-attribution li:not(:last-child):after{content:" ";}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle;}.ol-attribution button, .ol-attribution ul{display:inline-block;}.ol-attribution.ol-collapsed ul{display:none;}.ol-attribution.ol-logo-only ul{display:block;}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em;}.ol-attribution.ol-logo-only{background:0 0;bottom:.4em;height:1.1em;line-height:1em;}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em;}.ol-attribution.ol-logo-only button, .ol-attribution.ol-uncollapsible button{display:none;}.ol-zoomslider{top:4.5em;left:.5em;height:200px;}.ol-zoomslider button{position:relative;height:10px;}.ol-touch .ol-zoomslider{top:5.5em;}.ol-overviewmap{left:.5em;bottom:.5em;}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0;}.ol-overviewmap .ol-overviewmap-map, .ol-overviewmap button{display:inline-block;}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px;}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute;}.ol-overviewmap.ol-collapsed .ol-overviewmap-map, .ol-overviewmap.ol-uncollapsible button{display:none;}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7);}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move;}</style> <style> .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,.2);box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :after,.ol-ctx-menu-container :before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(270deg,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:0}.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=")}.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC")}</style> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <script type="text/javascript" src="scripts/ol.js"></script> <script type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <title>MeshCentral</title> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)"> <div id="contextMenu" class="contextMenu" style="display:none"> <div id="cxinfo" class="cmtext" onclick="cmaction(1)"><b>Information</b></div> <div id="cxterminal" class="cmtext" onclick="cmaction(2)">Terminal</div> <div id="cxdesktop" class="cmtext" onclick="cmaction(3)">Desktop</div> <div id="cxfiles" class="cmtext" onclick="cmaction(4)">Files</div> <div id="cxevents" class="cmtext" onclick="cmaction(5)">Events</div> <div id="cxconsole" class="cmtext" onclick="cmaction(6)">Console</div> <hr id="cxmgroupsplit"> <div id="cxmdesktop" class="cmtext" onclick="cmaction(7)" style="display:none">Multi-Desktop</div> </div> <div id="meshContextMenu" class="contextMenu" style="display:none;min-width:0px"> <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1)">Select All</div> <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2)">Select None</div> <hr id="cxmgroupsplit2" style="display:none"> <div id="cxmmdesktop" class="cmtext" style="display:none" onclick="cmmeshaction(3)">Multi-Desktop</div> </div> <div id="container" style="max-height:100vh;position:relative"> <div id="notifiyBox" class="notifiyBox" style="display:none"></div> <div id="mastheadx"></div> <div id="masthead" class="noselect" style="background:url(images/logoback.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px"> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px"> <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> <div style="float:right"> <div id="notificationCount" onclick="clickNotificationIcon()" class="unselectable" style="display:none;min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px" title="Click to view current notifications">0</div> </div> <p id="logoutControl">{{{logoutControl}}}</p> </div> <div id="topbarmaster"> <div id="topbar" class="noselect" style="display:none"> <div> <div> <table style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainMenuMyDevices" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(1)">My Devices</td> <td id="MainMenuMyAccount" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(2)">My Account</td> <td id="MainMenuMyEvents" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(3)">My Events</td> <td id="MainMenuMyFiles" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(5)">My Files</td> <td id="MainMenuMyUsers" style="width:100px;height:24px;cursor:pointer;display:none" class="style3" onclick="go(4)">My Users</td> <td class="style3" style="text-align:right;height:24px"><span title="Toggle full width" style="cursor:pointer;opacity:0.2" onclick="toggleFullScreen(1)">&harr;</span>&nbsp;</td> </tr> </table> <div id="MainSubMenuSpan" style="display:none"> <table id="MainSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainDev" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(10)">General</td> <td id="MainDevDesktop" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(11)">Desktop</td> <td id="MainDevTerminal" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(12)">Terminal</td> <td id="MainDevFiles" style="width:100px;height:24px;cursor:pointer;display:none" class="style3" onclick="go(13)">Files</td> <td id="MainDevEvents" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(16)">Events</td> <td id="MainDevAmt" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(14)">Intel&reg; AMT</td> <td id="MainDevConsole" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(15)">Console</td> <td class="style3" style="height:24px">&nbsp;</td> </tr> </table> </div> <div id="MeshSubMenuSpan" style="display:none"> <table id="MeshSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MeshGeneral" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(20)">General</td> <td class="style3" style="height:24px">&nbsp;</td> </tr> </table> </div> <div id="UserSubMenuSpan" style="display:none"> <table id="UserSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="UserGeneral" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(30)">General</td> <td id="UserEvents" style="width:100px;height:24px;cursor:pointer" class="style3" onclick="go(31)">Events</td> <td class="style3" style="height:24px">&nbsp;</td> </tr> </table> </div> </div> </div> </div> </div> <div id="page_content" style="max-height:calc(100vh - 138px)"> <div id="column_l"> <div id="p0" style="display:none"> <div id="p0message" style="margin:50px;text-align:center">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> <div id="p1" style="display:none"> <h1>My Devices</h1> <div style="width:100%;height:24px;background-color:#d3d9d6"> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div id="devListToolbar" class="style14" style="height:100%;float:left"> &nbsp;&nbsp;<input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All">&nbsp; <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction()">&nbsp; <input id="SearchInput" type="text" style="width:120px" placeholder="Search" onchange="onSearchInputChanged()" onkeyup="onSearchInputChanged()" autocomplete="off" onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)">&nbsp; <input type="checkbox" id="RealNameCheckBox" onclick="onRealNameCheckBox()"><span title="Show devices operating system name">OS Name</span> </div> <div id="kvmListToolbar" class="style14" style="height:100%;float:left"> &nbsp;&nbsp;<input type="button" onclick="connectAllKvmFunction()" value="Connect All">&nbsp; <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All">&nbsp; <input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)">AutoConnect&nbsp; <input type="button" onclick="showMultiDesktopSettings()" value="Settings">&nbsp; </div> <div id="devMapToolbar" class="style14" style="height:100%;float:left"> &nbsp;&nbsp;<input type="text" id="mapSearchLocation" placeholder="Search Location" onfocus="onMapSearchFocus(1)" onblur="onMapSearchFocus(0)"> <input type="button" value="Search" title="Search for location" onclick="getSearchLocation()"> <input type="button" id="refreshmap" title="Reset map view" value="Reset" style="margin-left:5px" onclick="refreshMap(false,true)"> </div> <div class="auto-style1" style="height:100%;float:right"> <div style="height:100%;width:4px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right">&nbsp;</div> <div style="float:right" id="devListToolbarView"> View <select id="viewselect" onchange="onDeviceViewChange()"> <option value="1">Columns <option value="2">List <option value="3">Desktops <option id="viewselectmapoption" value="4">Map </select> </div> <div style="float:right" id="devListToolbarSort"> Sort <select id="sortselect" onchange="onSortSelectChange()"> <option>Mesh <option>Power <option>Device <option>Group </select> &nbsp; </div> <div style="float:right" id="devListToolbarSize"> Size <select id="sizeselect" onchange="onDeviceViewChange()"> <option value="0">Small <option value="1">Medium <option value="2">Large </select> &nbsp; </div> </div> </div> <div id="NoMeshesPanel" style="display:none"> <table style="width:100%;padding:20px"> <tr> <td valign="top" style="width:50px"> <img src="images/info.png" height="48" width="47"> </td> <td> To get started managing devices, <a onclick="account_createMesh()" style="cursor:pointer"><strong>click here to create a new group of devices called a Mesh</strong></a>. </td> </tr> </table> </div> <div id="xdevices" style="max-height:calc(100vh - 242px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch"></div> <div id="xdevicesmap" style="height:500px;width:100%;overflow:hidden;position:relative"> <div id="xmapSearchResultsDlg" style="position:absolute;display:none;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="xmapSearchClose" style="float:right;padding:5px;cursor:pointer" onclick="mapCloseSearchWindow()"><b>X</b></div> <div style="padding:5px">Location Results</div> <div style="width:100%;margin:6px"></div> </div> <div id="xmapSearchResults" style="margin:6px"></div> </div> </div> <div id="xmap-info-window" style="text-shadow:0px 0px 15px #FFF"></div> </div> <div id="p2" style="display:none"> <h1>My Account</h1> <div id="p2AccountActions"> <p><strong><img alt="" width="150" height="103" src="images/mainaccount.png" style="margin-bottom:10px;margin-right:20px;float:right">Account actions</strong></p> <p style="margin-left:40px"> <span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br></span> <a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br> <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br> <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br> </p> </div> <p id="p2ServerActions"><strong>Server actions</strong></p> <p style="margin-left:40px"> <a id="p2ServerActionsBackup" href="/backup.zip" target="_blank" style="cursor:pointer">Download server backup</a><br> <a id="p2ServerActionsRestore" onclick="server_showRestoreDlg()" style="cursor:pointer">Restore server with backup</a><br> <a id="p2ServerActionsVersion" onclick="server_showVersionDlg()" style="cursor:pointer">Check server version</a><br> </p> <br style="clear:both"> <strong>Administrative Meshes</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p2meshes"></div> <div id="p2noMeshFound" style="margin-left:40px;display:none">No meshes. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> <div id="p3" style="display:none"> <h1>My Events</h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left">&nbsp;&nbsp;<input id="p2deleteall" type="button" onclick="showDeleteAllEventsDialog()" style="display:none" value="Delete All...">&nbsp;</div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p3limitdropdown" onchange="refreshEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right;">&nbsp;</div> </div> </div> <div id="p3events" style="max-height:600px;overflow-y:scroll"></div> </div> <div id="p4" style="display:none"> <h1>My Users</h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left"> &nbsp;&nbsp; <input type="button" onclick="showCreateNewAccountDialog()" value="New Account...">&nbsp; <input id="UserSearchInput" type="text" style="width:120px" placeholder="Search" onchange="onUserSearchInputChanged()" onkeyup="onUserSearchInputChanged()" autocomplete="off" onfocus="onUserSearchFocus(1)" onblur="onUserSearchFocus(0)">&nbsp; </div> <div class="auto-style1" style="height:100%;float:right"> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right">&nbsp;</div> </div> </div> <div id="p3users" style="max-height:600px;overflow-y:auto"></div> </div> <div id="p5" style="display:none"> <h1>My Files</h1> <table id="p5toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p5rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p5FolderUp" disabled="disabled" onclick="p5folderup();" value="Up">&nbsp; <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Select All" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile();" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile();" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5NewFolderButton" disabled="disabled" value="New Folder" onclick="p5createfolder();" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false;" onkeydown="return false;">&nbsp; <input type="button" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false">&nbsp; </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div>&nbsp;&nbsp;<span id="p5currentpath"></span></div> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:500px;overflow:auto;-webkit-user-select:none;position:relative"> <div id="p5PublicShare" style="display:none;width:100%;padding:4px;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue">This files is shared publically, click "link" to get public url.</div> <div id="bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&checkmark;</b></div> <div id="bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&#10007;</b></div> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px">&nbsp;<span id="p5bottomstatus"></span></td></tr> </table> </div> <div id="p10" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p10title"> <h1>General - <span id="p10deviceName"></span></h1> </div> <div id="p10html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <a style="cursor:pointer" onclick="p10showiconselector()"><img id="MainComputerImage" style="border-width:0px;height:200px;width:200px"></a> <div style="width:100%;text-align:center"><strong><span id="MainComputerState"></span></strong></div> </td> </tr> </table><br> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p11" style="display:none"> <div id="p11title"> <h1 id="p11deviceNameHeader">Desktop - <span id="p11deviceName"></span></h1> </div> <div id="p14warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel&reg; AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p14warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr id="deskarea1"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span>&nbsp; <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Left" onclick="drotate(-1)">&olarr;</div> <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Right" onclick="drotate(1)">&orarr;</div> <input id="deskFullBtn" type="button" title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value="Full" onclick="deskToggleFull()" style="margin-right:3px"> <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none"> <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" style="margin-right:3px"> <input id="deskActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> <input type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none"> </div> <div> <div id="idx_deskFullBtn2" onclick="deskToggleFull()" style="float:left;font-size:large;cursor:pointer;display:none">&nbsp;X</div> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton1span">&nbsp;<input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan">&nbsp;<input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton1span">&nbsp;<input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> &nbsp;<span id="deskstatus">Disconnected</span> </div> </td> </tr> <tr id="deskarea2"> <td> <div style="background-color:gray"><div id="progressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr id="deskarea3"> <td id="deskarea3x" style="background:black;text-align:center;height:400px;position:relative"> <div id="DeskFocus" style="color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div> <div id="DeskParent"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </td> </tr> <tr id="deskarea4"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>&nbsp; <input id="DeskToastButton" type="button" value="Toast" title="Display a notification message on the remote computer" onkeypress="return false" onkeydown="return false" onclick="deviceToastFunction()">&nbsp; <input id="DeskToolsButton" type="button" value="Tools" title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">&nbsp; </div> <div> <select style="margin-left:6px" id="deskkeys"> <option value="5">Win <option value="0">Win+Down <option value="1">Win+Up <option value="2">Win+L <option value="3">Win+M <option value="4">Shift+Win+M </select> <input id="DeskWD" type="button" value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()"> <input id="DeskCAD" style="margin-left:6px" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> <span style="margin-left:6px" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Input</span>&nbsp; </div> </td> </tr> </table> </div> <div id="p12" style="display:none"> <div id="p12title"><h1>Terminal - <span id="p12deviceName"></span></h1></div> <div id="p12warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel&reg; AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p12warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <input id="termActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick="autoConnectTerminal(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton2span">&nbsp;<input type="button" id="connectbutton2" value="Connect" onclick="connectTerminal(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton2hspan">&nbsp;<input type="button" id="connectbutton2h" value="HW Connect" onclick="connectTerminal(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton2span">&nbsp;<input type="button" id="disconnectbutton2" value="Disconnect" onclick="connectTerminal(event,0)" onkeypress="return false" onkeydown="return false"></span> &nbsp;<span id="termstatus">Disconnected</span> </div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="termprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td style="background:black;text-align:center;height:500px;position:relative"> <pre id="Term" style="background:black;margin:0;padding:0"></pre> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()">&nbsp; <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()">&nbsp;&nbsp; <select id="specialkeylist" onkeypress="return false"></select> <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Send" title="Send the selected special key" onclick="sendSpecialKey()">&nbsp; </div> <div> &nbsp; <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Paste" title="Paste text into the terminal" onclick="showTermPasteDialog()"> </div> </td> </tr> </table> </div> <div id="p13" style="display:none"> <div id="p13title"><h1>Files - <span id="p13deviceName"></span></h1></div> <table id="p13toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p13rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up">&nbsp; <input type="button" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Select All" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13NewFolderButton" disabled="disabled" value="New Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false">&nbsp; <input type="button" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false">&nbsp; </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div>&nbsp;&nbsp;<span id="p13currentpath"></span></div> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:500px;overflow:auto;-webkit-user-select:none"> <div id="p13bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&checkmark;</b></div> <div id="p13bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>&#10007;</b></div> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px">&nbsp;<span id="p13bottomstatus"></span></td></tr> </table> </div> <div id="p14" style="display:none"> <div id="p14title"><h1>Intel&reg; AMT - <span id="p14deviceName"></span></h1></div> <iframe id="p14iframe" style="width:100%;height:650px;border:0;overflow:hidden" src="/commander.htm"></iframe> </div> <div id="p15" style="display:none"> <div id="p15title"><h1>Console - <span id="p15deviceName"></span></h1></div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="background:#C0C0C0"> <div style="float:right;padding-right:4px"> <div style="padding:4px;display:inline-block" id="p15coreName" title="Information about current core running on this agent"></div> <input type="button" id="p15uploadCore" value="Agent Action" onclick="p15uploadCore(event)" title="Change the agent Java Script code module"> </div> <div id="p15statetext" style="padding:4px"></div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="consoleprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td style="background:black;text-align:center;height:500px;position:relative"> <div id="p15agentConsole" style="background:black;margin:0;padding:0;color:lightgray;width:100%;max-width:930px;height:100%;text-align:left;overflow-y:scroll"><pre id="p15agentConsoleText"></pre></div> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <table style="width:100%"> <tr> <td style="width:99%"> <input id="p15consoleText" style="width:100%" onkeyup="p15consoleSend(event)" onfocus="onConsoleFocus(1)" onblur="onConsoleFocus(0)"> </td> <td>&nbsp;</td> <td style="width:1%"><input id="id_p15consoleClear" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td> </tr> </table> </td> </tr> </table> </div> <div id="p16" style="display:none"> <div id="p16title"><h1>Events - <span id="p16deviceName"></span></h1></div> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left">&nbsp;&nbsp;<input type="button" value="Refresh" onclick="refreshDeviceEvents()">&nbsp;</div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p16limitdropdown" onchange="refreshDeviceEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right">&nbsp;</div> </div> </div> <div id="p16events" style="max-height:600px;overflow-y:scroll"></div> </div> <div id="p20" style="display:none"> <img id="MainMeshImage" src="images/mesh-200.png" style="border-width:0px;height:200px;width:200px;float:right"> <h1><span id="p20meshName"></span> - General</h1> <p id="p20info"> </div> <div id="p30" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p30title"> <h1><span id="p30userName"></span> - General</h1> </div> <div id="p30html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <img id="MainUserImage" src="images/user-200.png" style="border-width:0px;height:200px;width:200px"> <div style="width:100%;text-align:center"><strong><span id="MainUserState"></span></strong></div> </td> </tr> </table><br> <div id="p30html2"></div> <div id="p30html3"></div> </div> <div id="p31" style="display:none"> <h1><span id="p31userName"></span> - Events</h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left">&nbsp;</div> <div class="h1" style="height:100%;float:left">&nbsp;</div> <div class="style14" style="height:100%;float:left">&nbsp;&nbsp;<input type="button" value="Refresh" onclick="refreshUsersEvents()">&nbsp;</div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p31limitdropdown" onchange="refreshUsersEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right;">&nbsp;</div> </div> </div> <div id="p31events" style="max-height:600px;overflow-y:scroll"></div> </div> <br id="column_l_bottomgap"> </div> <div id="footer" class="noselect"> <table cellpadding="0" cellspacing="10" style="width:100%"> <tr> <td style="text-align:left;color:white"> {{{footer}}} </td> <td style="text-align:right"> <a id="verifyEmailId2" style="color:yellow;margin-left:3px;cursor:pointer;display:none" onclick="account_showVerifyEmail()">Verify Email</a> <a style="margin-left:3px" href="terms">Terms &amp; Privacy</a> </td> </tr> </table> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:160px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog3" style="margin:auto;margin:3px"> <div style="height:26px"> <select id="d3uploadMode" style="float:right;width:260px" onchange="d3modechange()"> <option value="1">Local file upload <option value="2">Server file selection </select> <div>File Selection</div> </div> <div id="d3localmode" style="height:26px;display:none"> <form id="d3localmodeform" method="post" enctype="multipart/form-data" action="uploadfile.ashx" target="fileUploadFrame"> <input type="text" id="d3attrib" name="attrib" style="display:none"> <input type="file" id="d3localFile" name="files" style="float:right;width:260px" onchange="d3setActions()"> <input type="submit" id="d3submit" style="display:none"> </form> <div>Upload File</div> </div> <div id="d3servermode"> <div style="width:100%;background-color:#d3d9d6;text-align:left;padding:3px" valign="bottom"> <input type="button" id="p3FolderUp" disabled="disabled" onclick="d3folderup()" value="Up">&nbsp; </div> <div id="d3serverfiles" style="width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll"></div> </div> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Mesh Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Frame rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel&reg; AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Image Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <input type="checkbox" id='d7showfocus'>Show Focus Tool<br> <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br> </div> <div>Other Settings</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:4px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> <div style="height:25px"><input id="idx_dlgDeleteButton" type="button" value="Delete" style="width:80px;display:none" onclick="dialogclose(2)"></div> </div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <form style="display:none" method="post" action="uploadfile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p5fileDragName" name="name"><input id="p5fileDragSize" name="size"><input id="p5fileDragType" name="type"><input id="p5fileDragData" name="data"><input id="p5fileDragLink" name="link"><input type="submit" id="p5loginSubmit2" style="display:none"></form> <form style="display:none" method="post" action="uploadnodefile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p13fileDragName" name="name"><input id="p13fileDragSize" name="size"><input id="p13fileDragType" name="type"><input id="p13fileDragData" name="data"><input id="p13fileDragLink" name="link"><input type="submit" id="p13loginSubmit2" style="display:none"></form> <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></source></audio> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,C,t,B,z,A,w,D,y){r.wsman.ExecSubscribe(r.CompleteName(v),u,C,function(G,F,E,H){q();t(r,v,E,H,B)},0,z,A,w,D,y);q()};r.UnSubscribe=function(u,t,y,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(B,A,z,C){q();t(r,u,z,C,y)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,w)},0,v);q()};r.Put=function(u,w,t,z,v,y){r.wsman.ExecPut(r.CompleteName(u),w,function(C,B,A,D){q();t(r,u,A,D,z)},0,v,y);q()};r.Create=function(u,w,t,y,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v);q()};r.Delete=function(u,w,t,y,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v);q()};r.Exec=function(w,v,t,u,A,y,z){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(D,C,B,E){q();u(r,w,r.CompleteExecResponse(B),E,A)},0,y,z);q()};r.ExecWithXml=function(w,v,t,u,A,y,z){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(D,C,B,E){q();u(r,w,r.CompleteExecResponse(B),E,A)},0,y,z);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(B,z,y,C,A){q();d(u,y,t,z,C,A)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,y,t,z,A,B,w){if(A!=200){t(r,v,null,A,B);c(1);return}if(y==null||y.Header.Method!="EnumerateResponse"||!y.Body.EnumerationContext){t(r,v,null,603,B);c(1);return}var u=y.Body.EnumerationContext;r.wsman.ExecPull(z,u,function(E,D,C,F){b(v,C,t,D,[],F,B,w)})}function b(z,B,t,C,w,D,E,A){if(D!=200){t(r,z,null,D,E);c(1);return}if(B==null||B.Header.Method!="PullResponse"){t(r,z,null,604,E);c(1);return}for(var v in B.Body.Items){if(B.Body.Items[v] instanceof Array){for(var y in B.Body.Items[v]){w.push(B.Body.Items[v][y])}}else{w.push(B.Body.Items[v])}}if(B.Body.EnumerationContext){var u=B.Body.EnumerationContext;r.wsman.ExecPull(C,u,function(H,G,F,I){b(z,F,t,G,w,I,E,1)})}else{c(1);t(r,z,w,D,E);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,z,v,y){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,z,{},v,y);q()};function a(t,z,u,C,B,v,A){r.PendingBatchOperations-=2;var y=z.shift(),w=r.Enum;if(y[0]=="*"){w=r.Get;y=y.substring(1)}w(y,function(F,D,E,G,H){H[2][D]={response:(E==null?null:E.Body),responses:E,status:G};if(H[1].length==0||G==401||(v!=true&&G!=200&&G!=400)){r.PendingBatchOperations-=(z.length*2);q();u(r,t,H[2],G,C)}else{q();a(t,z,u,C,H[2],A)}},[t,z,B],A);q()}r.BatchGet=function(t,v,u,y,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:y,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,y){f(t,u,y)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(z,y,w,u,t,v,C,A,B){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:z,NewState:y,EventOnTransition:w,ActionSd:u,ActionEac:t},v,C,A,B)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(z,y,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:z,NewState:y,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(y,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:y,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,y,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:y},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,y,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:y},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(y,w,v,z,t,A,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:y,DigestUsername:w,DigestPassword:v,KerberosUserSid:z,AccessPermission:t,Realms:A},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,z,B,u,w,C,A,y,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:z,Port:B,AuthMethod:u,Certificate:w,Username:C,Password:A,CN:y},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,y,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:y,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,z,v,y){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,z,v,y)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,y,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:y},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(y,z,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:y,WiFiEndpointSettingsInput:z,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(y,z,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:y,WiFiEndpointSettingsInput:z,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,y,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:y},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(y,z,w,u,A,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:y,NetworkAdminPassword:z,McNonce:w,Certificate:u,SigningAlgorithm:A,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,y,v,z,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:y,McNonce:v,SigningAlgorithm:z,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,y){if(w!=200||u.Body.ReturnValue!="0"){y[0](r,null,y[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,y)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var WsmanStackCreateService=function(g,k,m,j,l,f){var h={};h.NextMessageId=1;h.Address="/wsman";h.comm=CreateWsmanComm(g,k,m,j,l,f);h.PerformAjax=function(p,n,r,q,o){if(o==undefined){o=""}h.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+o+"><Header><a:Action>"+p,function(s,t,u){if(t!=200){n(h,null,{Header:{HttpError:t}},t,u);return}var v=h.ParseWsman(s);if(!v||v==null){n(h,null,{Header:{HttpError:t}},601,u)}else{n(h,v.Header.ResourceURI,v,200,u)}},r,q)};h.CancelAllQueries=function(n){h.comm.CancelAllQueries(n)};h.GetNameFromUrl=function(n){var o=n.lastIndexOf("/");return(o==-1)?n:n.substring(o+1)};h.ExecSubscribe=function(v,p,z,n,y,u,w,s,A,t){var q="",r="";if(A!=undefined&&t!=undefined){q="<t:IssuedTokens><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>"+A+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+t+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>";r='<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'}if(s!=undefined&&s!=null){s="<a:ReferenceParameters>"+s+"</a:ReferenceParameters>"}else{s=""}var o="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+v+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(w)+q+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/'+p+'"><e:NotifyTo><a:Address>'+z+"</a:Address></e:NotifyTo>"+r+"</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>";h.PerformAjax(o+"</Body></Envelope>",n,y,u,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:m="http://x.com"')};h.ExecUnSubscribe=function(q,n,s,p,r){var o="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(r)+"</Header><Body><e:Unsubscribe/>";h.PerformAjax(o+"</Body></Envelope>",n,s,p,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};h.ExecPut=function(r,q,n,t,p,s){var o="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+d(s)+"</Header><Body>"+c(r,q);h.PerformAjax(o+"</Body></Envelope>",n,t,p)};h.ExecCreate=function(u,t,o,w,s,v){var r=h.GetNameFromUrl(u);var p="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+u+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(v)+"</Header><Body><g:"+r+' xmlns:g="'+u+'">';for(var q in t){p+="<g:"+q+">"+t[q]+"</g:"+q+">"}h.PerformAjax(p+"</g:"+r+"></Body></Envelope>",o,w,s)};h.ExecCreateXml=function(r,n,o,t,q){var p=h.GetNameFromUrl(r),s="";h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout></Header><Body><r:"+p+' xmlns:r="'+r+'">'+n+"</r:"+p+"></Body></Envelope>",o,t,q)};h.ExecDelete=function(r,q,n,s,p){var o="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(q)+"</Header><Body /></Envelope>";h.PerformAjax(o,n,s,p)};h.ExecGet=function(p,n,q,o){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+p+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",n,q,o)};h.ExecMethod=function(t,r,n,p,v,s,u){var o="";for(var q in n){if(n[q]!=null){if(Array.isArray(n[q])){for(var w in n[q]){o+="<r:"+q+">"+n[q][w]+"</r:"+q+">"}}else{o+="<r:"+q+">"+n[q]+"</r:"+q+">"}}}h.ExecMethodXml(t,r,o,p,v,s,u)};h.ExecMethodXml=function(r,p,n,o,t,q,s){h.PerformAjax(r+"/"+p+"</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(s)+"</Header><Body><r:"+p+'_INPUT xmlns:r="'+r+'">'+n+"</r:"+p+"_INPUT></Body></Envelope>",o,t,q)};h.ExecEnum=function(p,n,q,o){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+p+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',n,q,o)};h.ExecPull=function(q,o,n,r,p){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+o+"</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>",n,r,p)};h.ParseWsman=function(w){try{if(!w.childNodes){w=e(w)}var u={Header:{}},q=w.getElementsByTagName("Header")[0],v;if(!q){q=w.getElementsByTagName("a:Header")[0]}if(!q){return null}for(var s=0;s<q.childNodes.length;s++){var o=q.childNodes[s];u.Header[o.localName]=o.textContent}var n=w.getElementsByTagName("Body")[0];if(!n){n=w.getElementsByTagName("a:Body")[0]}if(!n){return null}if(n.childNodes.length>0){v=n.childNodes[0].localName;if(v.indexOf("_OUTPUT")==v.length-7){v=v.substring(0,v.length-7)}u.Header.Method=v;u.Body=b(n.childNodes[0])}return u}catch(p){console.log("Unable to parse XML: "+w);return null}};function b(t){var p,u={};for(var q=0;q<t.childNodes.length;q++){var n=t.childNodes[q];if(n.childElementCount==0){p=n.textContent}else{p=b(n)}if(p=="true"){p=true}if(p=="false"){p=false}var o=p;if(n.attributes.length>0){o={Value:p};for(var s=0;s<n.attributes.length;s++){o["@"+n.attributes[s].name]=n.attributes[s].value}}if(u[n.localName] instanceof Array){u[n.localName].push(o)}else{if(u[n.localName]==undefined){u[n.localName]=o}else{u[n.localName]=[u[n.localName],o]}}}return u}function c(s,q){if(!s||q===undefined||q===null){return""}var o=h.GetNameFromUrl(s);var r="<r:"+o+' xmlns:r="'+s+'">';for(var p in q){if(!q.hasOwnProperty(p)||p.indexOf("__")===0||p.indexOf("@")===0){continue}if(q[p]===undefined||q[p]===null||typeof q[p]==="function"){continue}if(typeof q[p]==="object"&&q[p]["ReferenceParameters"]){r+="<r:"+p+"><a:Address>"+q[p].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+q[p]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var t=q[p]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(t)){for(var n=0;n<t.length;n++){r+="<w:Selector"+a(t[n])+">"+t[n]["Value"]+"</w:Selector>"}}else{r+="<w:Selector"+a(t)+">"+t.Value+"</w:Selector>"}r+="</w:SelectorSet></a:ReferenceParameters></r:"+p+">"}else{if(Array.isArray(q[p])){for(var n=0;n<q[p].length;n++){r+="<r:"+p+">"+q[p][n].toString()+"</r:"+p+">"}}else{r+="<r:"+p+">"+q[p].toString()+"</r:"+p+">"}}}r+="</r:"+o+">";return r}function a(n){if(!n){return""}var p=" ";for(var o in n){if(!n.hasOwnProperty(o)||o.indexOf("@")!==0){continue}p+=o.substring(1)+'="'+n[o]+'" '}return p}function d(r){if(!r){return""}if(typeof r=="string"){return r}if(r.InstanceID){return'<w:SelectorSet><w:Selector Name="InstanceID">'+r.InstanceID+"</w:Selector></w:SelectorSet>"}var p="<w:SelectorSet>";for(var o in r){if(!r.hasOwnProperty(o)){continue}p+='<w:Selector Name="'+o+'">';if(r[o]["ReferenceParameters"]){p+="<a:EndpointReference>";p+="<a:Address>"+r[o]["Address"]+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+r[o]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var q=r[o]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(q)){for(var n=0;n<q.length;n++){p+="<w:Selector"+a(q[n])+">"+q[n]["Value"]+"</w:Selector>"}}else{p+="<w:Selector"+a(q)+">"+q.Value+"</w:Selector>"}p+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else{p+=r[o]}p+="</w:Selector>"}p+="</w:SelectorSet>";return p}function e(n){if(window.DOMParser){return new DOMParser().parseFromString(n,"text/xml")}else{var o=new ActiveXObject("Microsoft.XMLDOM");o.async=false;o.loadXML(n);return o}}return h};var CreateAmtRemoteDesktop=function(j,l){var k={};k.canvasid=j;k.CanvasId=Q(j);k.scrolldiv=l;k.canvas=Q(j).getContext("2d");k.protocol=2;k.state=0;k.acc="";k.ScreenWidth=960;k.ScreenHeight=700;k.width=0;k.height=0;k.rwidth=0;k.rheight=0;k.bpp=2;k.useZRLE=true;k.showmouse=true;k.buttonmask=0;k.spare=null;k.sparew=0;k.spareh=0;k.sparew2=0;k.spareh2=0;k.sparecache={};k.ZRLEfirst=1;k.onScreenSizeChange=null;k.frameRateDelay=0;k.Debug=function(m){console.log(m)};k.xxStateChange=function(m){if(m==0){k.canvas.fillStyle="#000000";k.canvas.fillRect(0,0,k.width,k.height);k.canvas.canvas.width=k.rwidth=k.width=640;k.canvas.canvas.height=k.rheight=k.height=400;QS(k.canvasid).cursor="auto"}else{if(!k.showmouse){QS(k.canvasid).cursor="none"}}};k.ProcessData=function(p){if(!p){return}k.acc+=p;while(k.acc.length>0){var n=0;if(k.state==0&&k.acc.length>=12){n=12;k.state=1;k.send("RFB 003.008\n")}else{if(k.state==1&&k.acc.length>=1){n=k.acc.charCodeAt(0)+1;k.send(String.fromCharCode(1));k.state=2}else{if(k.state==2&&k.acc.length>=4){n=4;if(ReadInt(k.acc,0)!=0){return k.Stop()}k.send(String.fromCharCode(1));k.state=3}else{if(k.state==3&&k.acc.length>=24){var z=ReadInt(k.acc,20);if(k.acc.length<24+z){return}n=24+z;k.canvas.canvas.width=k.rwidth=k.width=k.ScreenWidth=ReadShort(k.acc,0);k.canvas.canvas.height=k.rheight=k.height=k.ScreenHeight=ReadShort(k.acc,2);var C="";if(k.useZRLE){C+=IntToStr(16)}C+=IntToStr(0);k.send(String.fromCharCode(2,0)+ShortToStr((C.length/4)+1)+C+IntToStr(-223));if(k.bpp==1){k.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}k.state=4;k.parent.xxStateChange(3);g();if(k.onScreenSizeChange!=null){k.onScreenSizeChange(k,k.ScreenWidth,k.ScreenHeight)}}else{if(k.state==4){var m=k.acc.charCodeAt(0);if(m==2){n=1}else{if(m==0){if(k.acc.length<4){return}k.state=100+ReadShort(k.acc,2);n=4}}}else{if(k.state>100&&k.acc.length>=12){var E=ReadShort(k.acc,0),G=ReadShort(k.acc,2),D=ReadShort(k.acc,4),v=ReadShort(k.acc,6),B=D*v,u=ReadInt(k.acc,8);if(u<17){if(D<1||D>64||v<1||v>64){console.log("Invalid tile size ("+D+","+v+"), disconnecting.");return k.Stop()}if(k.sparew!=D||k.spareh!=v){k.sparew=k.sparew2=D;k.spareh=k.spareh2=v;var F=k.sparew2+"x"+k.spareh2;k.spare=k.sparecache[F];if(!k.spare){k.sparecache[F]=k.spare=k.canvas.createImageData(k.sparew2,k.spareh2)}}}if(u==4294967073){k.canvas.canvas.width=k.rwidth=k.width=D;k.canvas.canvas.height=k.rheight=k.height=v;k.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(k.width)+ShortToStr(k.height));n=12;if(k.onScreenSizeChange!=null){k.onScreenSizeChange(k,k.ScreenWidth,k.ScreenHeight)}}else{if(u==0){var A=12,o=12+(B*k.bpp);if(k.acc.length<o){return}n=o;for(var w=0;w<B;w++){h(k.acc.charCodeAt(A++)+((k.bpp==2)?(k.acc.charCodeAt(A++)<<8):0),w)}f(k.spare,E,G)}else{if(u==16){if(k.acc.length<16){return}var q=ReadInt(k.acc,12);if(k.acc.length<(16+q)){return}var A=16,r=5,t=0;if(q>5&&k.acc.charCodeAt(A)==0&&ReadShortX(k.acc,A+1)==(q-r)){a(k.acc,A+5,E,G,D,v,B,q)}n=16+q}else{k.Debug("Unknown Encoding: "+u);return k.Stop()}}}if(--k.state==100){k.state=4;if(k.frameRateDelay==0){g()}else{setTimeout(g,k.frameRateDelay)}}}}}}}}if(n==0){return}k.acc=k.acc.substring(n)}};function a(o,w,G,H,F,q,C,p){var D=o.charCodeAt(w++),t,E,B,u={},z=0,A=0,r;if(D==0){for(r=0;r<C;r++){h(o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0),r)}f(k.spare,G,H)}else{if(D==1){E=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0);k.canvas.fillStyle="rgb("+((k.bpp==1)?((E&224)+","+((E&28)<<3)+","+b((E&3)<<6)):(((E>>8)&248)+","+((E>>3)&252)+","+((E&31)<<3)))+")";k.canvas.fillRect(G,H,F,q)}else{if(D>1&&D<17){var n=4,m=15;for(r=0;r<D;r++){u[r]=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0)}if(D==2){n=1;m=1}else{if(D<=4){n=2;m=3}}while(z<C&&w<o.length){E=o.charCodeAt(w++);for(r=(8-n);r>=0;r-=n){h(u[(E>>r)&m],z++)}}f(k.spare,G,H)}else{if(D==128){while(z<C&&w<o.length){E=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0);A=1;do{A+=(B=o.charCodeAt(w++))}while(B==255);while(--A>=0){h(E,z++)}}f(k.spare,G,H)}else{if(D>129){for(r=0;r<(D-128);r++){u[r]=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0)}while(z<C&&w<o.length){A=1;t=o.charCodeAt(w++);E=u[t%128];if(t>127){do{A+=(B=o.charCodeAt(w++))}while(B==255)}while(--A>=0){h(E,z++)}}f(k.spare,G,H)}}}}}}function f(m,n,o){k.canvas.putImageData(m,n,o)}function h(o,m){var n=m*4;if(k.bpp==1){k.spare.data[n++]=o&224;k.spare.data[n++]=(o&28)<<3;k.spare.data[n++]=b((o&3)<<6)}else{k.spare.data[n++]=(o>>8)&248;k.spare.data[n++]=(o>>3)&252;k.spare.data[n++]=(o&31)<<3}k.spare.data[n]=255}function b(m){return(m>127)?(m+32):m}function g(){k.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(k.rwidth)+ShortToStr(k.rheight))}k.Start=function(){k.state=0;k.acc="";k.ZRLEfirst=1;for(var m in k.sparecache){delete k.sparecache[m]}};k.Stop=function(){k.UnGrabMouseInput();k.UnGrabKeyInput();k.parent.Stop()};k.send=function(m){k.parent.send(m)};function c(m,n){if(!n){n=window.event}var o=n.keyCode,p=o;if(n.shiftKey==false&&o>=65&&o<=90){p=o+32}if(o>=112&&o<=124){p=o+65358}if(o==8){p=65288}if(o==9){p=65289}if(o==13){p=65293}if(o==16){p=65505}if(o==17){p=65507}if(o==18){p=65513}if(o==27){p=65307}if(o==33){p=65365}if(o==34){p=65366}if(o==35){p=65367}if(o==36){p=65360}if(o==37){p=65361}if(o==38){p=65362}if(o==39){p=65363}if(o==40){p=65364}if(o==45){p=65379}if(o==46){p=65535}if(o>=96&&o<=105){p=o-48}if(o==106){p=42}if(o==107){p=43}if(o==109){p=45}if(o==110){p=46}if(o==111){p=47}if(o==186){p=59}if(o==187){p=61}if(o==188){p=44}if(o==189){p=45}if(o==190){p=46}if(o==191){p=47}if(o==192){p=96}if(o==219){p=91}if(o==220){p=92}if(o==221){p=93}if(o==222){p=39}k.sendkey(p,m);return k.haltEvent(n)}k.sendkey=function(o,m){if(typeof o=="object"){for(var n in o){k.sendkey(o[n][0],o[n][1])}}else{k.send(String.fromCharCode(4,m,0,0)+IntToStr(o))}};k.SendCtrlAltDelMsg=function(){k.sendcad()};k.sendcad=function(){k.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;k.GrabMouseInput=function(){if(e==true){return}var m=k.canvas.canvas;m.onmouseup=k.mouseup;m.onmousedown=k.mousedown;m.onmousemove=k.mousemove;e=true};k.UnGrabMouseInput=function(){if(e==false){return}var m=k.canvas.canvas;m.onmousemove=null;m.onmouseup=null;m.onmousedown=null;e=false};k.GrabKeyInput=function(){if(d==true){return}document.onkeyup=k.handleKeyUp;document.onkeydown=k.handleKeyDown;document.onkeypress=k.handleKeys;d=true};k.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};k.handleKeys=function(m){return k.haltEvent(m)};k.handleKeyUp=function(m){return c(0,m)};k.handleKeyDown=function(m){return c(1,m)};k.haltEvent=function(m){if(m.preventDefault){m.preventDefault()}if(m.stopPropagation){m.stopPropagation()}return false};k.mousedown=function(m){k.buttonmask|=(1<<m.button);return k.mousemove(m)};k.mouseup=function(m){k.buttonmask&=(65535-(1<<m.button));return k.mousemove(m)};k.mousemove=function(m){if(k.state!=4){return true}var n=k.getPositionOfControl(Q(k.canvasid));k.mx=(m.pageX-n[0])*(k.canvas.canvas.height/Q(k.canvasid).offsetHeight);k.my=((m.pageY-n[1]+(l?l.scrollTop:0))*(k.canvas.canvas.width/Q(k.canvasid).offsetWidth));k.send(String.fromCharCode(5,k.buttonmask)+ShortToStr(k.mx)+ShortToStr(k.my));return k.haltEvent(m)};k.getPositionOfControl=function(m){var n=Array(2);n[0]=n[1]=0;while(m){n[0]+=m.offsetLeft;n[1]+=m.offsetTop;m=m.offsetParent}return n};return k};var CreateAmtRemoteTerminal=function(B){var C={};C.DivId=B;C.DivElement=document.getElementById(B);C.protocol=1;C.fxEmulation=0;C.width=80;C.height=25;C.lineFeed="\r\n";var q=21;var r=13;var l=["000000","BB0000","00BB00","BBBB00","0000BB","BB00BB","00BBBB","BBBBBB","555555","FF5555","55FF55","FFFF55","5555FF","FF55FF","55FFFF","FFFFFF"];var o=0;var n=7;var m=0;var s=true;var v=0;var w=0;var u=0;var d=[];var e=0;var k=[];var y=[];var A=1;var z=2;C.Start=function(){};C.Init=function(E,D){C.width=E?E:80;C.height=D?D:25;for(var G=0;G<C.height;G++){y[G]=[];k[G]=[];for(var F=0;F<C.width;F++){y[G][F]=" ";k[G][F]=(7<<6)}}C.TermInit();C.TermDraw()};C.xxStateChange=function(D){};C.ProcessData=function(D){if(C.capture!=null){C.capture+=D}j(D);C.TermDraw()};function j(E){for(var D=0;D<E.length;D++){h(String.fromCharCode(E.charCodeAt(D)),E.charCodeAt(D))}}function h(D,E){switch(u){case 0:switch(E){case 27:u=1;break;default:g(D);break}break;case 1:switch(D){case"[":e=0;d=[];u=2;break;case"(":u=4;break;case")":u=5;break;default:u=0;break}break;case 2:if(D>="0"&&D<="9"){if(!d[e]){d[e]=(D-"0")}else{d[e]=((d[e]*10)+(D-"0"))}break}else{if(D==";"){e++;break}else{if(!d[0]){d[0]=0}f(D,d,e+1);u=0}}break;case 4:u=0;break;case 5:u=0;break}}function f(G,D,E){var H;switch(G){case"c":C.TermResetScreen();break;case"A":if(E==1){w-=D[0];if(w<0){w=0}}break;case"B":if(E==1){w+=D[0];if(w>C.height){w=C.height}}break;case"C":if(E==1){v+=D[0];if(v>C.width){v=C.width}}break;case"D":if(E==1){v-=D[0];if(v<0){v=0}}break;case"d":if(E==1){w=D[0]-1;if(w>C.height){w=C.height}if(w<0){w=0}}break;case"G":if(E==1){v=D[0]-1;if(v<0){v=0}if(v>79){v=79}}break;case"J":if(E==1&&D[0]==2){C.TermClear((m<<12)+(n<<6));v=0;w=0}else{if(E==0||E==1&&D[0]==0){b();for(H=w+1;H<C.height;H++){c(H)}}else{if(E==1&&D[0]==1){b();for(H=0;H<w-1;H++){c(H)}}}}break;case"H":if(E==2){if(D[0]<1){D[0]=1}if(D[1]<1){D[1]=1}if(D[0]>C.height){D[0]=C.height}if(D[1]>C.width){D[1]=C.width}w=D[0]-1;v=D[1]-1}else{w=0;v=0}break;case"m":for(H=0;H<E;H++){if(!D[H]||D[H]==0){m=0;n=7;o=0}else{if(D[H]==1){if(n<8){n+=8}}else{if(D[H]==2||D[H]==22){if(n>=8){n-=8}}else{if(D[H]==7){o=2}else{if(D[H]==27){o=0}else{if(D[H]>=30&&D[H]<=37){var F=(n>=8);n=(D[H]-30);if(F&&n<=8){n+=8}}else{if(D[H]>=40&&D[H]<=47){m=(D[H]-40)}else{if(D[H]>=90&&D[H]<=99){n=(D[H]-82)}else{if(D[H]>=100&&D[H]<=109){m=(D[H]-92)}}}}}}}}}}break;case"K":if(E==0||(E==1&&(!D[0]||D[0]==0))){b()}else{if(E==1){if(D[0]==1){a()}else{if(D[0]==2){c(w)}}}}break;case"h":s=true;break;case"l":s=false;break;default:break}}C.ProcessVt100String=function(E){for(var D=0;D<E.length;D++){g(String.fromCharCode(E.charCodeAt(D)))}};function g(D){if(D=="\0"||D.charCodeAt()==7){return}var E=D.charCodeAt();switch(E){case 16:D=" ";break;case 24:D="?";break;case 25:D="?";break}if(v>C.width){v=C.width}if(w>(C.height-1)){w=(C.height-1)}switch(D){case"\b":if(v>0){v=v-1;p(" ")}break;case"\t":var F=8-(v%8);for(var G=0;G<F;G++){g(" ")}break;case"\n":w++;if(w>(C.height-1)){t(1);w=(C.height-1)}break;case"\r":v=0;break;default:if(v>=C.width){v=0;if(s){w++}if(w>=(C.height-1)){t(1);w=(C.height-1)}}p(D);v++;break}}function p(D){y[w][v]=D;k[w][v]=(n<<6)+(m<<12)+o}C.TermClear=function(D){for(var F=0;F<C.height;F++){for(var E=0;E<C.width;E++){y[F][E]=" ";k[F][E]=D}}};C.TermResetScreen=function(){o=0;n=7;m=0;s=true;v=0;w=0;C.TermClear(7<<6)};function b(){var D=(m<<12);for(var E=v;E<C.width;E++){y[w][E]=" ";k[w][E]=D}}function a(){var D=(m<<12);for(var E=0;E<v;E++){y[w][E]=" ";k[w][E]=D}}function c(D){var E=(m<<12);for(var F=0;F<C.width;F++){y[D][F]=" ";k[D][F]=E}}C.TermSendKeys=function(D){C.parent.send(D)};C.TermSendKey=function(D){C.parent.send(String.fromCharCode(D))};function t(D){var E,F;for(F=0;F<C.height-D;F++){y[F]=y[F+D];k[F]=k[F+D]}for(F=C.height-D;F<C.height;F++){y[F]=[];k[F]=[];for(E=0;E<C.width;E++){y[F][E]=" ";k[F][E]=(7<<6)}}}C.TermHandleKeys=function(D){if(!D.ctrlKey){if(D.which==127){C.TermSendKey(8)}else{if(D.which==13){C.TermSendKeys(C.lineFeed)}else{if(D.which!=0){C.TermSendKey(D.which)}}}return false}if(D.preventDefault){D.preventDefault()}if(D.stopPropagation){D.stopPropagation()}};C.TermHandleKeyUp=function(D){if((D.which!=8)&&(D.which!=32)&&(D.which!=9)){return true}if(D.preventDefault){D.preventDefault()}if(D.stopPropagation){D.stopPropagation()}return false};C.TermHandleKeyDown=function(D){if((D.which>=65)&&(D.which<=90)&&(D.ctrlKey==true)){C.TermSendKey(D.which-64);if(D.preventDefault){D.preventDefault()}if(D.stopPropagation){D.stopPropagation()}return}if(D.which==27){C.TermSendKeys(String.fromCharCode(27));return true}if(D.which==37){C.TermSendKeys(String.fromCharCode(27,91,68));return true}if(D.which==38){C.TermSendKeys(String.fromCharCode(27,91,65));return true}if(D.which==39){C.TermSendKeys(String.fromCharCode(27,91,67));return true}if(D.which==40){C.TermSendKeys(String.fromCharCode(27,91,66));return true}if(D.which==9){C.TermSendKeys("\t");if(D.preventDefault){D.preventDefault()}if(D.stopPropagation){D.stopPropagation()}return true}if(D.which!=8&&D.which!=32&&D.which!=9){return true}C.TermSendKey(D.which);if(D.preventDefault){D.preventDefault()}if(D.stopPropagation){D.stopPropagation()}return false};C.TermDraw=function(){var E,D="",F="",G,H=1,J,K;for(var L=0;L<C.height;++L){for(var I=0;I<C.width;++I){G=k[L][I];if(v==I&&w==L){G|=z}if(G!=H){D+=F;F="";J=6;K=12;if(G&z){J=12;K=6}D+='<span style="color:#'+l[(G>>J)&63]+";background-color:#"+l[(G>>K)&63];if(G&A){D+=";text-decoration:underline"}D+=';">';F="</span>"+F;H=G}E=y[L][I];switch(E){case"&":D+="&amp;";break;case"<":D+="&lt;";break;case">":D+="&gt;";break;case" ":D+="&nbsp;";break;default:D+=E;break}}if(L!=(C.height-1)){D+="<br>"}}C.DivElement.innerHTML="<font size='4'><b>"+D+F+"</b></font>"};C.TermInit=function(){C.TermResetScreen()};C.Init();return C};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var G=0;var D=1;var am=2;var af=3;var A=4;var B=5;var ac=6;var h=7;var F=8;var p=9;var o=10;var an=11;var ao=12;var aj=13;var k=14;var j=15;var al=16;var W=17;var f=18;var S=19;var R=20;var T=21;var q=22;var r=23;var aa=24;var Y=25;var d=26;var V=27;var u=28;var a=29;var ab=30;var ak=31;var z=852;var y=592;var w=(z+y);var g=0;var X=1;var t=2;var N=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var O=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var L=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var M=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function K(aR,aV){var aM=15;var aU=aR.next;var at=(aV==t?aR.distbits:aR.lenbits);var aX=aR.work;var aH=aR.lens;var aI=(aV==t?aR.nlen:0);var aS=aR.codes;var au;if(aV==X){au=aR.nlen}else{if(aV==t){au=aR.ndist}else{au=19}}var aG;var aT;var aN,aL;var aQ;var aw;var ax;var aF;var aW;var aD;var aE;var aB;var aJ;var aK;var aC;var aO;var aq;var ar;var az;var aA;var ay;var av=new Array(aM+1);var aP=new Array(aM+1);for(aG=0;aG<=aM;aG++){av[aG]=0}for(aT=0;aT<au;aT++){av[aH[aI+aT]]++}aQ=at;for(aL=aM;aL>=1;aL--){if(av[aL]!=0){break}}if(aQ>aL){aQ=aL}if(aL==0){aC={op:64,bits:1,val:0};aS[aU++]=aC;aS[aU++]=aC;if(aV==t){aR.distbits=1}else{aR.lenbits=1}aR.next=aU;return 0}for(aN=1;aN<aL;aN++){if(av[aN]!=0){break}}if(aQ<aN){aQ=aN}aF=1;for(aG=1;aG<=aM;aG++){aF<<=1;aF-=av[aG];if(aF<0){return -1}}if(aF>0&&(aV==g||aL!=1)){aR.next=aU;return -1}aP[1]=0;for(aG=1;aG<aM;aG++){aP[aG+1]=aP[aG]+av[aG]}for(aT=0;aT<au;aT++){if(aH[aI+aT]!=0){aX[aP[aH[aI+aT]]++]=aT}}switch(aV){case g:aq=az=aX;ar=0;aA=0;ay=19;break;case X:aq=N;ar=-257;az=O;aA=-257;ay=256;break;default:aq=L;az=M;ar=0;aA=0;ay=-1}aD=0;aT=0;aG=aN;aO=aU;aw=aQ;ax=0;aJ=-1;aW=1<<aQ;aK=aW-1;if((aV==X&&aW>=z)||(aV==t&&aW>=y)){aR.next=aU;return 1}for(;;){aC={op:0,bits:aG-ax,val:0};if(aX[aT]<ay){aC.val=aX[aT]}else{if(aX[aT]>ay){aC.op=az[aA+aX[aT]];aC.val=aq[ar+aX[aT]]}else{aC.op=32+64}}aE=1<<(aG-ax);aB=1<<aw;aN=aB;do{aB-=aE;aS[aO+(aD>>>ax)+aB]=aC}while(aB!=0);aE=1<<(aG-1);while(aD&aE){aE>>>=1}if(aE!=0){aD&=aE-1;aD+=aE}else{aD=0}aT++;if(--(av[aG])==0){if(aG==aL){break}aG=aH[aI+aX[aT]]}if(aG>aQ&&(aD&aK)!=aJ){if(ax==0){ax=aQ}aO+=aN;aw=aG-ax;aF=(1<<aw);while(aw+ax<aL){aF-=av[aw+ax];if(aF<=0){break}aw++;aF<<=1}aW+=1<<aw;if((aV==X&&aW>=z)||(aV==t&&aW>=y)){aR.next=aU;return 1}aJ=aD&aK;aS[aU+aJ]={op:aw,bits:aQ,val:aO-aU}}}if(aD!=0){aS[aO+aD]={op:64,bits:aG-ax,val:0}}aR.next=aU+aW;if(aV==t){aR.distbits=aQ}else{aR.lenbits=aQ}return 0}function H(aN,aL){var aM;var aC;var aI;var aD;var aK;var aq;var ax;var aR;var aO;var aQ;var aP;var aB;var ar;var at;var aE;var au;var aH;var aw;var aA;var aJ;var aF;var av;var az=-1;var ay=-1;aM=aN.state;aC=aN.input_data;aI=aN.next_in;aD=aI+aN.avail_in-5;aK=aN.next_out;aq=aK-(aL-aN.avail_out);ax=aK+(aN.avail_out-257);aR=aM.wsize;aO=aM.whave;aQ=aM.wnext;aP=aM.window;aB=aM.hold;ar=aM.bits;at=aM.codes;aE=aM.lencode;au=aM.distcode;aH=(1<<aM.lenbits)-1;aw=(1<<aM.distbits)-1;loop:do{if(ar<15){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aA=at[aE+(aB&aH)];dolen:while(true){aJ=aA.bits;aB>>>=aJ;ar-=aJ;aJ=aA.op;if(aJ==0){aN.output_data+=String.fromCharCode(aA.val);aK++}else{if(aJ&16){aF=aA.val;aJ&=15;if(aJ){if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aF+=aB&((1<<aJ)-1);aB>>>=aJ;ar-=aJ}if(ar<15){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aA=at[au+(aB&aw)];dodist:while(true){aJ=aA.bits;aB>>>=aJ;ar-=aJ;aJ=aA.op;if(aJ&16){av=aA.val;aJ&=15;if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}}av+=aB&((1<<aJ)-1);aB>>>=aJ;ar-=aJ;aJ=aK-aq;if(av>aJ){aJ=av-aJ;if(aJ>aO){if(aM.sane){aN.msg="invalid distance too far back";aM.mode=a;break loop}}az=0;ay=-1;if(aQ==0){az+=aR-aJ;if(aJ<aF){aF-=aJ;aN.output_data+=aP.substring(az,az+aJ);aK+=aJ;aJ=0;az=-1;ay=aK-av}}else{az+=aQ-aJ;if(aJ<aF){aF-=aJ;aN.output_data+=aP.substring(az,az+aJ);aK+=aJ;az=-1;ay=aK-av}}}else{az=-1;ay=aK-av}if(az>=0){aN.output_data+=aP.substring(az,az+aF);aK+=aF;az+=aF}else{var aG=aF;if(aG>aK-ay){aG=aK-ay}aN.output_data+=aN.output_data.substring(ay,ay+aG);aK+=aG;aF-=aG;ay+=aG;aK+=aF;while(aF>2){aN.output_data+=aN.output_data.charAt(ay++);aN.output_data+=aN.output_data.charAt(ay++);aN.output_data+=aN.output_data.charAt(ay++);aF-=3}if(aF){aN.output_data+=aN.output_data.charAt(ay++);if(aF>1){aN.output_data+=aN.output_data.charAt(ay++)}}}}else{if((aJ&64)==0){aA=at[au+(aA.val+(aB&((1<<aJ)-1)))];continue dodist}else{aN.msg="invalid distance code";aM.mode=a;break loop}}break dodist}}else{if((aJ&64)==0){aA=at[aE+(aA.val+(aB&((1<<aJ)-1)))];continue dolen}else{if(aJ&32){aM.mode=an;break loop}else{aN.msg="invalid literal/length code";aM.mode=a;break loop}}}}break dolen}}while(aI<aD&&aK<ax);aF=ar>>>3;aI-=aF;ar-=aF<<3;aB&=(1<<ar)-1;aN.next_in=aI;aN.next_out=aK;aN.avail_in=(aI<aD?5+(aD-aI):5-(aI-aD));aN.avail_out=(aK<ax?257+(ax-aK):257-(aK-ax));aM.hold=aB;aM.bits=ar}function ae(at){var ar;var aq=new Array(at);for(ar=0;ar<at;ar++){aq[ar]=0}return aq}function E(at,ar,aq){return(at&&(ar in at))?at[ar]:aq}function e(){return 0}function J(){var ar;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ae(320);this.work=ae(288);this.codes=new Array(w);var aq={op:0,bits:0,val:0};for(ar=0;ar<w;ar++){this.codes[ar]=aq}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(ar){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;ar.total_in=ar.total_out=aq.total=0;ar.msg=null;if(aq.wrap){ar.adler=aq.wrap&1}aq.mode=G;aq.last=0;aq.havedict=0;aq.dmax=32768;aq.head=null;aq.hold=0;aq.bits=0;aq.lencode=0;aq.distcode=0;aq.next=0;aq.sane=1;aq.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(ar,at){var au;var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(typeof at==="undefined"){at=n}if(at<0){au=0;at=-at}else{au=(at>>>4)+1;if(at<48){at&=15}}if(au==1&&(typeof ZLIB.adler32==="function")){ar.checksum_function=ZLIB.adler32}else{if(au==2&&(typeof ZLIB.crc32==="function")){ar.checksum_function=ZLIB.crc32}else{ar.checksum_function=e}}if(at&&(at<8||at>15)){return ZLIB.Z_STREAM_ERROR}if(aq.window&&aq.wbits!=at){aq.window=null}aq.wrap=au;aq.wbits=at;aq.wsize=0;aq.whave=0;aq.wnext=0;return ZLIB.inflateResetKeep(ar)};ZLIB.inflateInit=function(ar){var aq=new ZLIB.z_stream();aq.state=new J();ZLIB.inflateReset(aq,ar);return aq};ZLIB.inflatePrime=function(at,aq,au){var ar;if(!at||!at.state){return ZLIB.Z_STREAM_ERROR}ar=at.state;if(aq<0){ar.hold=0;ar.bits=0;return ZLIB.Z_OK}if(aq>16||ar.bits+aq>32){return ZLIB.Z_STREAM_ERROR}au&=(1<<aq)-1;ar.hold+=au<<ar.bits;ar.bits+=aq;return ZLIB.Z_OK};var U=null;var s=null;function C(ar){var aq;if(!U){U=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}ar.lencode=0;ar.distcode=512;for(aq=0;aq<512;aq++){ar.codes[aq]=U[aq]}for(aq=0;aq<32;aq++){ar.codes[aq+512]=s[aq]}ar.lenbits=9;ar.distbits=5}function ap(at){var ar=at.state;var aq=at.output_data.length;if(ar.window===null){ar.window=""}if(ar.wsize==0){ar.wsize=1<<ar.wbits}if(aq>=ar.wsize){ar.window=at.output_data.substring(aq-ar.wsize)}else{if(ar.whave+aq<ar.wsize){ar.window+=at.output_data}else{ar.window=ar.window.substring(ar.whave-(ar.wsize-aq))+at.output_data}}ar.whave=ar.window.length;if(ar.whave<ar.wsize){ar.wnext=ar.whave}else{ar.wnext=0}return 0}function l(ar,at){var aq=[at&255,(at>>>8)&255];ar.state.check=ar.checksum_function(ar.state.check,aq,0,2)}function m(ar,at){var aq=[at&255,(at>>>8)&255,(at>>>16)&255,(at>>>24)&255];ar.state.check=ar.checksum_function(ar.state.check,aq,0,4)}function Z(ar,aq){aq.strm=ar;aq.left=ar.avail_out;aq.next=ar.next_in;aq.have=ar.avail_in;aq.hold=ar.state.hold;aq.bits=ar.state.bits;return aq}function ah(aq){var ar=aq.strm;ar.next_in=aq.next;ar.avail_out=aq.left;ar.avail_in=aq.have;ar.state.hold=aq.hold;ar.state.bits=aq.bits}function P(aq){aq.hold=0;aq.bits=0}function ag(aq){if(aq.have==0){return false}aq.have--;aq.hold+=(aq.strm.input_data.charCodeAt(aq.next++)&255)<<aq.bits;aq.bits+=8;return true}function ad(ar,aq){while(ar.bits<aq){if(!ag(ar)){return false}}return true}function b(ar,aq){return ar.hold&((1<<aq)-1)}function v(ar,aq){ar.hold>>>=aq;ar.bits-=aq}function c(aq){aq.hold>>>=aq.bits&7;aq.bits-=aq.bits&7}function ai(aq){return((aq>>>24)&255)+((aq>>>8)&65280)+((aq&65280)<<8)+((aq&255)<<24)}var I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aD,at){var aC;var aB;var aq,az;var ar;var av=-1;var au=-1;var aw;var ax;var ay;var aA;if(!aD||!aD.state||(!aD.input_data&&aD.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aC=aD.state;if(aC.mode==an){aC.mode=ao}aB={};Z(aD,aB);aq=aB.have;az=aB.left;aA=ZLIB.Z_OK;inf_leave:for(;;){switch(aC.mode){case G:if(aC.wrap==0){aC.mode=ao;break}if(!ad(aB,16)){break inf_leave}if((aC.wrap&2)&&aB.hold==35615){aC.check=aD.checksum_function(0,null,0,0);l(aD,aB.hold);P(aB);aC.mode=D;break}aC.flags=0;if(aC.head!==null){aC.head.done=-1}if(!(aC.wrap&1)||((b(aB,8)<<8)+(aB.hold>>>8))%31){aD.msg="incorrect header check";aC.mode=a;break}if(b(aB,4)!=ZLIB.Z_DEFLATED){aD.msg="unknown compression method";aC.mode=a;break}v(aB,4);ay=b(aB,4)+8;if(aC.wbits==0){aC.wbits=ay}else{if(ay>aC.wbits){aD.msg="invalid window size";aC.mode=a;break}}aC.dmax=1<<ay;aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=aB.hold&512?p:an;P(aB);break;case D:if(!ad(aB,16)){break inf_leave}aC.flags=aB.hold;if((aC.flags&255)!=ZLIB.Z_DEFLATED){aD.msg="unknown compression method";aC.mode=a;break}if(aC.flags&57344){aD.msg="unknown header flags set";aC.mode=a;break}if(aC.head!==null){aC.head.text=(aB.hold>>>8)&1}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.mode=am;case am:if(!ad(aB,32)){break inf_leave}if(aC.head!==null){aC.head.time=aB.hold}if(aC.flags&512){m(aD,aB.hold)}P(aB);aC.mode=af;case af:if(!ad(aB,16)){break inf_leave}if(aC.head!==null){aC.head.xflags=aB.hold&255;aC.head.os=aB.hold>>>8}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.mode=A;case A:if(aC.flags&1024){if(!ad(aB,16)){break inf_leave}aC.length=aB.hold;if(aC.head!==null){aC.head.extra_len=aB.hold}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.head.extra=""}else{if(aC.head!==null){aC.head.extra=null}}aC.mode=B;case B:if(aC.flags&1024){ar=aC.length;if(ar>aB.have){ar=aB.have}if(ar){if(aC.head!==null&&aC.head.extra!==null){ay=aC.head.extra_len-aC.length;aC.head.extra+=aD.input_data.substring(aB.next,aB.next+(ay+ar>aC.head.extra_max?aC.head.extra_max-ay:ar))}if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;aC.length-=ar}if(aC.length){break inf_leave}}aC.length=0;aC.mode=ac;case ac:if(aC.flags&2048){if(aB.have==0){break inf_leave}if(aC.head!==null&&aC.head.name===null){aC.head.name=""}ar=0;do{ay=aD.input_data.charAt(aB.next+ar);ar++;if(ay==="\0"){break}if(aC.head!==null&&aC.length<aC.head.name_max){aC.head.name+=ay;aC.length++}}while(ar<aB.have);if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;if(ay!=="\0"){break inf_leave}}else{if(aC.head!==null){aC.head.name=null}}aC.length=0;aC.mode=h;case h:if(aC.flags&4096){if(aB.have==0){break inf_leave}ar=0;if(aC.head!==null&&aC.head.comment===null){aC.head.comment=""}do{ay=aD.input_data.charAt(aB.next+ar);ar++;if(ay==="\0"){break}if(aC.head!==null&&aC.length<aC.head.comm_max){aC.head.comment+=ay;aC.length++}}while(ar<aB.have);if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;if(ay!=="\0"){break inf_leave}}else{if(aC.head!==null){aC.head.comment=null}}aC.mode=F;case F:if(aC.flags&512){if(!ad(aB,16)){break inf_leave}if(aB.hold!=(aC.check&65535)){aD.msg="header crc mismatch";aC.mode=a;break}P(aB)}if(aC.head!==null){aC.head.hcrc=(aC.flags>>>9)&1;aC.head.done=1}aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=an;break;case p:if(!ad(aB,32)){break inf_leave}aD.adler=aC.check=ai(aB.hold);P(aB);aC.mode=o;case o:if(aC.havedict==0){ah(aB);return ZLIB.Z_NEED_DICT}aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=an;case an:if(at==ZLIB.Z_BLOCK||at==ZLIB.Z_TREES){break inf_leave}case ao:if(aC.last){c(aB);aC.mode=d;break}if(!ad(aB,3)){break inf_leave}aC.last=b(aB,1);v(aB,1);switch(b(aB,2)){case 0:aC.mode=aj;break;case 1:C(aC);aC.mode=S;if(at==ZLIB.Z_TREES){v(aB,2);break inf_leave}break;case 2:aC.mode=al;break;case 3:aD.msg="invalid block type";aC.mode=a}v(aB,2);break;case aj:c(aB);if(!ad(aB,32)){break inf_leave}if((aB.hold&65535)!=(((aB.hold>>>16)&65535)^65535)){aD.msg="invalid stored block lengths";aC.mode=a;break}aC.length=aB.hold&65535;P(aB);aC.mode=k;if(at==ZLIB.Z_TREES){break inf_leave}case k:aC.mode=j;case j:ar=aC.length;if(ar){if(ar>aB.have){ar=aB.have}if(ar>aB.left){ar=aB.left}if(ar==0){break inf_leave}aD.output_data+=aD.input_data.substring(aB.next,aB.next+ar);aD.next_out+=ar;aB.have-=ar;aB.next+=ar;aB.left-=ar;aC.length-=ar;break}aC.mode=an;break;case al:if(!ad(aB,14)){break inf_leave}aC.nlen=b(aB,5)+257;v(aB,5);aC.ndist=b(aB,5)+1;v(aB,5);aC.ncode=b(aB,4)+4;v(aB,4);if(aC.nlen>286||aC.ndist>30){aD.msg="too many length or distance symbols";aC.mode=a;break}aC.have=0;aC.mode=W;case W:while(aC.have<aC.ncode){if(!ad(aB,3)){break inf_leave}var aE=b(aB,3);aC.lens[I[aC.have++]]=aE;v(aB,3)}while(aC.have<19){aC.lens[I[aC.have++]]=0}aC.next=0;aC.lencode=0;aC.lenbits=7;aA=K(aC,g);if(aA){aD.msg="invalid code lengths set";aC.mode=a;break}aC.have=0;aC.mode=f;case f:while(aC.have<aC.nlen+aC.ndist){for(;;){aw=aC.codes[aC.lencode+b(aB,aC.lenbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if(aw.val<16){v(aB,aw.bits);aC.lens[aC.have++]=aw.val}else{if(aw.val==16){if(!ad(aB,aw.bits+2)){break inf_leave}v(aB,aw.bits);if(aC.have==0){aD.msg="invalid bit length repeat";aC.mode=a;break}ay=aC.lens[aC.have-1];ar=3+b(aB,2);v(aB,2)}else{if(aw.val==17){if(!ad(aB,aw.bits+3)){break inf_leave}v(aB,aw.bits);ay=0;ar=3+b(aB,3);v(aB,3)}else{if(!ad(aB,aw.bits+7)){break inf_leave}v(aB,aw.bits);ay=0;ar=11+b(aB,7);v(aB,7)}}if(aC.have+ar>aC.nlen+aC.ndist){aD.msg="invalid bit length repeat";aC.mode=a;break}while(ar--){aC.lens[aC.have++]=ay}}}if(aC.mode==a){break}if(aC.lens[256]==0){aD.msg="invalid code -- missing end-of-block";aC.mode=a;break}aC.next=0;aC.lencode=aC.next;aC.lenbits=9;aA=K(aC,X);if(aA){aD.msg="invalid literal/lengths set";aC.mode=a;break}aC.distcode=aC.next;aC.distbits=6;aA=K(aC,t);if(aA){aD.msg="invalid distances set";aC.mode=a;break}aC.mode=S;if(at==ZLIB.Z_TREES){break inf_leave}case S:aC.mode=R;case R:if(aB.have>=6&&aB.left>=258){ah(aB);H(aD,az);Z(aD,aB);if(aC.mode==an){aC.back=-1}break}aC.back=0;for(;;){aw=aC.codes[aC.lencode+b(aB,aC.lenbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if(aw.op&&(aw.op&240)==0){ax=aw;for(;;){aw=aC.codes[aC.lencode+ax.val+(b(aB,ax.bits+ax.op)>>>ax.bits)];if(ax.bits+aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}v(aB,ax.bits);aC.back+=ax.bits}v(aB,aw.bits);aC.back+=aw.bits;aC.length=aw.val;if(aw.op==0){aC.mode=Y;break}if(aw.op&32){aC.back=-1;aC.mode=an;break}if(aw.op&64){aD.msg="invalid literal/length code";aC.mode=a;break}aC.extra=aw.op&15;aC.mode=T;case T:if(aC.extra){if(!ad(aB,aC.extra)){break inf_leave}aC.length+=b(aB,aC.extra);v(aB,aC.extra);aC.back+=aC.extra}aC.was=aC.length;aC.mode=q;case q:for(;;){aw=aC.codes[aC.distcode+b(aB,aC.distbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if((aw.op&240)==0){ax=aw;for(;;){aw=aC.codes[aC.distcode+ax.val+(b(aB,ax.bits+ax.op)>>>ax.bits)];if((ax.bits+aw.bits)<=aB.bits){break}if(!ag(aB)){break inf_leave}}v(aB,ax.bits);aC.back+=ax.bits}v(aB,aw.bits);aC.back+=aw.bits;if(aw.op&64){aD.msg="invalid distance code";aC.mode=a;break}aC.offset=aw.val;aC.extra=aw.op&15;aC.mode=r;case r:if(aC.extra){if(!ad(aB,aC.extra)){break inf_leave}aC.offset+=b(aB,aC.extra);v(aB,aC.extra);aC.back+=aC.extra}aC.mode=aa;case aa:if(aB.left==0){break inf_leave}ar=az-aB.left;if(aC.offset>ar){ar=aC.offset-ar;if(ar>aC.whave){if(aC.sane){aD.msg="invalid distance too far back";aC.mode=a;break}}if(ar>aC.wnext){ar-=aC.wnext;av=aC.wsize-ar;au=-1}else{av=aC.wnext-ar;au=-1}if(ar>aC.length){ar=aC.length}}else{av=-1;au=aD.next_out-aC.offset;ar=aC.length}if(ar>aB.left){ar=aB.left}aB.left-=ar;aC.length-=ar;if(av>=0){aD.output_data+=aC.window.substring(av,av+ar);aD.next_out+=ar;ar=0}else{aD.next_out+=ar;do{aD.output_data+=aD.output_data.charAt(au++)}while(--ar)}if(aC.length==0){aC.mode=R}break;case Y:if(aB.left==0){break inf_leave}aD.output_data+=String.fromCharCode(aC.length);aD.next_out++;aB.left--;aC.mode=R;break;case d:if(aC.wrap){if(!ad(aB,32)){break inf_leave}az-=aB.left;aD.total_out+=az;aC.total+=az;if(az){aD.adler=aC.check=aD.checksum_function(aC.check,aD.output_data,aD.output_data.length-az,az)}az=aB.left;if((aC.flags?aB.hold:ai(aB.hold))!=aC.check){aD.msg="incorrect data check";aC.mode=a;break}P(aB)}aC.mode=V;case V:if(aC.wrap&&aC.flags){if(!ad(aB,32)){break inf_leave}if(aB.hold!=(aC.total&4294967295)){aD.msg="incorrect length check";aC.mode=a;break}P(aB)}aC.mode=u;case u:aA=ZLIB.Z_STREAM_END;break inf_leave;case a:aA=ZLIB.Z_DATA_ERROR;break inf_leave;case ab:return ZLIB.Z_MEM_ERROR;case ak:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ah(aB);if(aC.wsize||(az!=aD.avail_out&&aC.mode<a&&(aC.mode<d||at!=ZLIB.Z_FINISH))){if(ap(aD)){aC.mode=ab;return ZLIB.Z_MEM_ERROR}}aq-=aD.avail_in;az-=aD.avail_out;aD.total_in+=aq;aD.total_out+=az;aC.total+=az;if(aC.wrap&&az){aD.adler=aC.check=aD.checksum_function(aC.check,aD.output_data,0,aD.output_data.length)}aD.data_type=aC.bits+(aC.last?64:0)+(aC.mode==an?128:0)+(aC.mode==S||aC.mode==k?256:0);if(((aq==0&&az==0)||at==ZLIB.Z_FINISH)&&aA==ZLIB.Z_OK){aA=ZLIB.Z_BUF_ERROR}return aA};ZLIB.inflateEnd=function(ar){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;aq.window=null;ar.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(au,av){var at;var aq;var ar=16384;this.input_data=au;this.next_in=E(av,"next_in",0);this.avail_in=E(av,"avail_in",au.length-this.next_in);at=E(av,"flush",ZLIB.Z_SYNC_FLUSH);aq=E(av,"avail_out",-1);var aw="";do{this.avail_out=(aq>=0?aq:ar);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,at);if(aq>=0){return this.output_data}aw+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return aw};ZLIB.z_stream.prototype.inflateReset=function(aq){return ZLIB.inflateReset(this,aq)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var H=b.amtaccumulator.charCodeAt(1);switch(H){case 0:if(b.amtaccumulator.length<13){return}var y=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+y){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+y);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var G=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&G==1){var n=0;var C=d.charCodeAt(n);var B=d.substring(n+1,n+1+C);n+=(C+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var A=0;var z=null;var l=b.xxRandomNonce(32);var F="00000002";var q="";if(f==4){A=d.charCodeAt(n);z=d.substring(n+1,n+1+A);n+=(A+1);q=F+":"+l+":"+z+":"}var p=hex_md5(hex_md5(b.user+":"+B+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var I=b.user.length+B.length+v.length+b.authuri.length+l.length+F.length+p.length+7;if(f==4){I+=(z.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(I)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(B.length)+B+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(F.length)+F+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(z.length)+z)}b.xxSend(h)}else{if(G==0){if(b.protocol==1){var u=10000;var K=100;var J=0;var E=10000;var D=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(K)+ShortToStrX(J)+ShortToStrX(E)+ShortToStrX(D)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateWsmanComm=function(g,k,m,j,l){var h={};h.PendingAjax=[];h.ActiveAjaxCount=0;h.MaxActiveAjaxCount=1;h.FailAllError=0;h.challengeParams=null;h.noncecounter=1;h.authcounter=0;h.socket=null;h.socketState=0;h.host=g;h.port=k;h.user=m;h.pass=j;h.tls=l;h.tlsv1only=1;h.cnonce=Math.random().toString(36).substring(7);h.PerformAjax=function(p,o,r,q,s,n){if(h.ActiveAjaxCount<h.MaxActiveAjaxCount&&h.PendingAjax.length==0){h.PerformAjaxEx(p,o,r,s,n)}else{if(q==1){h.PendingAjax.unshift([p,o,r,s,n])}else{h.PendingAjax.push([p,o,r,s,n])}}};h.PerformNextAjax=function(){if(h.ActiveAjaxCount>=h.MaxActiveAjaxCount||h.PendingAjax.length==0){return}var n=h.PendingAjax.shift();h.PerformAjaxEx(n[0],n[1],n[2],n[3],n[4]);h.PerformNextAjax()};h.PerformAjaxEx=function(p,o,q,r,n){if(h.FailAllError!=0){h.gotNextMessagesError({status:h.FailAllError},"error",null,[p,o,q,r,n]);return}if(!p){p=""}h.ActiveAjaxCount++;return h.PerformAjaxExNodeJS(p,o,q,r,n)};h.pendingAjaxCall=[];h.PerformAjaxExNodeJS=function(p,o,q,r,n){h.PerformAjaxExNodeJS2(p,o,q,r,n,3)};h.PerformAjaxExNodeJS2=function(p,o,r,s,n,q){if(q<=0||h.FailAllError!=0){h.ActiveAjaxCount--;if(h.FailAllError!=999){h.gotNextMessages(null,"error",{status:((h.FailAllError==0)?408:h.FailAllError)},[p,o,r,s,n])}h.PerformNextAjax();return}h.pendingAjaxCall.push([p,o,r,s,n,q]);if(h.socketState==0){h.xxConnectHttpSocket()}else{if(h.socketState==2){h.sendRequest(p,s,n)}}};h.sendRequest=function(p,r,n){r=r?r:"/wsman";n=n?n:"POST";var o=n+" "+r+" HTTP/1.1\r\n";if(h.challengeParams!=null){var q=hex_md5(hex_md5(h.user+":"+h.challengeParams.realm+":"+h.pass)+":"+h.challengeParams.nonce+":"+h.noncecounter+":"+h.cnonce+":"+h.challengeParams.qop+":"+hex_md5(n+":"+r));o+="Authorization: "+h.renderDigest({username:h.user,realm:h.challengeParams.realm,nonce:h.challengeParams.nonce,uri:r,qop:h.challengeParams.qop,response:q,nc:h.noncecounter++,cnonce:h.cnonce})+"\r\n"}o+="Host: "+h.host+":"+h.port+"\r\nTransfer-Encoding: chunked\r\n\r\n"+p.length.toString(16).toUpperCase()+"\r\n"+p+"\r\n0\r\n\r\n";f(o)};h.parseDigest=function(n){var o=n.substring(7).split(",");for(i in o){o[i]=o[i].trim()}return o.reduce(function(p,r){var q=r.split("=");p[q[0]]=q[1].replace(/"/g,"");return p},{})};h.renderDigest=function(n){var o=[];for(i in n){o.push(i)}return"Digest "+o.reduce(function(q,p){return q+","+p+'="'+n[p]+'"'},"").substring(1)};h.xxConnectHttpSocket=function(){h.socketParseState=0;h.socketAccumulator="";h.socketHeader=null;h.socketData="";h.socketState=1;console.log(h.tlsv1only);h.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+h.host+"&port="+h.port+"&tls="+h.tls+"&tlsv1only="+h.tlsv1only+((m=="*")?"&serverauth=1":"")+((typeof j==="undefined")?("&serverauth=1&user="+m):""));h.socket.onopen=c;h.socket.onmessage=a;h.socket.onclose=b};function c(){h.socketState=2;for(i in h.pendingAjaxCall){h.sendRequest(h.pendingAjaxCall[i][0],h.pendingAjaxCall[i][3],h.pendingAjaxCall[i][4])}}function a(p){if(typeof p.data=="object"){var q=new FileReader();if(q.readAsBinaryString){q.onload=function(t){d(t.target.result)};q.readAsBinaryString(new Blob([p.data]))}else{if(q.readAsArrayBuffer){q.onloadend=function(t){d(t.target.result)};q.readAsArrayBuffer(p.data)}else{var n="";var o=new Uint8Array(p.data);var s=o.byteLength;for(var r=0;r<s;r++){n+=String.fromCharCode(o[r])}d(n)}}}else{if(typeof p.data=="string"){d(p.data)}}}function d(r){if(typeof r==="object"){var n="",o=new Uint8Array(r),u=o.byteLength;for(var t=0;t<u;t++){n+=String.fromCharCode(o[t])}r=n}else{if(typeof r!=="string"){return}}h.socketAccumulator+=r;while(true){if(h.socketParseState==0){var s=h.socketAccumulator.indexOf("\r\n\r\n");if(s<0){return}h.socketHeader=h.socketAccumulator.substring(0,s).split("\r\n");h.socketAccumulator=h.socketAccumulator.substring(s+4);h.socketParseState=1;h.socketData="";h.socketXHeader={Directive:h.socketHeader[0].split(" ")};for(t in h.socketHeader){if(t!=0){var v=h.socketHeader[t].indexOf(":");h.socketXHeader[h.socketHeader[t].substring(0,v).toLowerCase()]=h.socketHeader[t].substring(v+2)}}}if(h.socketParseState==1){var q=-1;if((h.socketXHeader.connection!=undefined)&&(h.socketXHeader.connection.toLowerCase()=="close")&&((h.socketXHeader["transfer-encoding"]==undefined)||(h.socketXHeader["transfer-encoding"].toLowerCase()!="chunked"))){q=0}else{if(h.socketXHeader["content-length"]!=undefined){q=parseInt(h.socketXHeader["content-length"]);if(h.socketAccumulator.length<q){return}var r=h.socketAccumulator.substring(0,q);h.socketAccumulator=h.socketAccumulator.substring(q);h.socketData=r;q=0}else{var p=h.socketAccumulator.indexOf("\r\n");if(p<0){return}q=parseInt(h.socketAccumulator.substring(0,p),16);if(isNaN(q)){if(h.websocket){h.websocket.close()}return}if(h.socketAccumulator.length<p+2+q+2){return}var r=h.socketAccumulator.substring(p+2,p+2+q);h.socketAccumulator=h.socketAccumulator.substring(p+2+q+2);h.socketData+=r}}if(q==0){e(h.socketXHeader,h.socketData);h.socketParseState=0;h.socketHeader=null}}}}function e(o,n){var q=parseInt(o.Directive[1]);if(isNaN(q)){q=602}if(q==401&&++(h.authcounter)<3){h.challengeParams=h.parseDigest(o["www-authenticate"])}else{var p=h.pendingAjaxCall.shift();h.authcounter=0;h.ActiveAjaxCount--;h.gotNextMessages(n,"success",{status:q},p);h.PerformNextAjax()}}function b(n){h.socketState=0;if(h.socket!=null){h.socket.close();h.socket=null}if(h.pendingAjaxCall.length>0){var o=h.pendingAjaxCall.shift();var p=o[5];h.PerformAjaxExNodeJS2(o[0],o[1],o[2],o[3],o[4],--p)}}function f(q){if(h.socketState==2&&h.socket!=null&&h.socket.readyState==WebSocket.OPEN){var n=new Uint8Array(q.length);for(var p=0;p<q.length;++p){n[p]=q.charCodeAt(p)}try{h.socket.send(n.buffer)}catch(o){}}}h.gotNextMessages=function(o,q,p,n){if(h.FailAllError==999){return}if(h.FailAllError!=0){n[1](null,h.FailAllError,n[2]);return}if(p.status!=200){n[1](null,p.status,n[2]);return}n[1](o,200,n[2])};h.gotNextMessagesError=function(p,q,o,n){if(h.FailAllError==999){return}if(h.FailAllError!=0){n[1](null,h.FailAllError,n[2]);return}n[1](h,null,{Header:{HttpError:p.status}},p.status,n[2])};h.CancelAllQueries=function(n){while(h.PendingAjax.length>0){var o=h.PendingAjax.shift();o[1](null,n,o[2])}if(h.websocket!=null){h.websocket.close();h.websocket=null;h.socketState=0}};return h};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){c.Stop()}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateAgentRemoteDesktop=function(a,c){var b={};b.CanvasId=a;if(typeof a==="string"){b.CanvasId=Q(a)}b.Canvas=b.CanvasId.getContext("2d");b.scrolldiv=c;b.State=0;b.PendingOperations=[];b.tilesReceived=0;b.TilesDrawn=0;b.KillDraw=0;b.ipad=false;b.tabletKeyboardVisible=false;b.LastX=0;b.LastY=0;b.touchenabled=0;b.submenuoffset=0;b.touchtimer=null;b.TouchArray={};b.connectmode=0;b.connectioncount=0;b.rotation=0;b.protocol=2;b.debugmode=0;b.firstUpKeys=[];b.stopInput=false;b.sessionid=0;b.username;b.oldie=false;b.CompressionLevel=50;b.ScalingLevel=1024;b.FrameRateTimer=50;b.FirstDraw=false;b.ScreenWidth=960;b.ScreenHeight=700;b.width=960;b.height=960;b.onScreenSizeChange=null;b.onMessage=null;b.onConnectCountChanged=null;b.onDebugMessage=null;b.onTouchEnabledChanged=null;b.onDisplayinfo=null;b.Start=function(){b.State=0};b.Stop=function(){b.setRotation(0);b.UnGrabKeyInput();b.UnGrabMouseInput();b.touchenabled=0;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}b.Canvas.clearRect(0,0,b.CanvasId.width,b.CanvasId.height)};b.xxStateChange=function(d){if(b.State==d){return}b.State=d;switch(d){case 0:b.Stop();break;case 3:break}};b.send=function(d){b.parent.send(d)};b.ProcessPictureMsg=function(e,g,h){var f=new Image();f.xcount=b.tilesReceived++;var d=b.tilesReceived;f.src="data:image/jpeg;base64,"+btoa(e.substring(4,e.length));f.onload=function(){if(b.Canvas!=null&&b.KillDraw<d&&b.State!=0){b.PendingOperations.push([d,2,f,g,h]);while(b.DoPendingOperations()){}}};f.error=function(){console.log("DecodeTileError")}};b.DoPendingOperations=function(){if(b.PendingOperations.length==0){return false}for(var d=0;d<b.PendingOperations.length;d++){var e=b.PendingOperations[d];if(e[0]==(b.TilesDrawn+1)){if(e[1]==1){b.ProcessCopyRectMsg(e[2])}else{if(e[1]==2){b.Canvas.drawImage(e[2],b.rotX(e[3],e[4]),b.rotY(e[3],e[4]));delete e[2]}}b.PendingOperations.splice(d,1);delete e;b.TilesDrawn++;if(b.TilesDrawn==b.tilesReceived&&b.KillDraw<b.TilesDrawn){b.KillDraw=b.TilesDrawn=b.tilesReceived=0}return true}}if(b.oldie&&b.PendingOperations.length>0){b.TilesDrawn++}return false};b.ProcessCopyRectMsg=function(g){var h=((g.charCodeAt(0)&255)<<8)+(g.charCodeAt(1)&255);var j=((g.charCodeAt(2)&255)<<8)+(g.charCodeAt(3)&255);var d=((g.charCodeAt(4)&255)<<8)+(g.charCodeAt(5)&255);var e=((g.charCodeAt(6)&255)<<8)+(g.charCodeAt(7)&255);var k=((g.charCodeAt(8)&255)<<8)+(g.charCodeAt(9)&255);var f=((g.charCodeAt(10)&255)<<8)+(g.charCodeAt(11)&255);b.Canvas.drawImage(Canvas.canvas,h,j,k,f,d,e,k,f)};b.SendUnPause=function(){b.send(String.fromCharCode(0,8,0,5,0))};b.SendPause=function(){b.send(String.fromCharCode(0,8,0,5,1))};b.SendCompressionLevel=function(g,e,f,d){if(e){b.CompressionLevel=e}if(f){b.ScalingLevel=f}if(d){b.FrameRateTimer=d}b.send(String.fromCharCode(0,5,0,10,g,b.CompressionLevel)+b.shortToStr(b.ScalingLevel)+b.shortToStr(b.FrameRateTimer))};b.SendRefresh=function(){b.send(String.fromCharCode(0,6,0,4))};b.ProcessScreenMsg=function(e,d){if(b.debugmode==1){console.log("ScreenSize: "+e+" x "+d)}b.Canvas.setTransform(1,0,0,1,0,0);b.rotation=0;b.FirstDraw=true;b.ScreenWidth=b.width=e;b.ScreenHeight=b.height=d;b.KillDraw=b.tilesReceived;while(b.PendingOperations.length>0){b.PendingOperations.shift()}b.SendCompressionLevel(1);b.SendUnPause();if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}};b.ProcessData=function(e){var d=0;while(d<e.length){d+=b.ProcessDataEx(e.substring(d))}};b.ProcessDataEx=function(n){if(n.length<4){return}var d=null,o=0,p=0,f=ReadShort(n,0),e=ReadShort(n,2);if((e!=n.length)&&(b.debugmode==1)){console.log(e,n.length,e==n.length)}if(f>=18){console.error("Invalid KVM command "+f+" of size "+e);console.log("Invalid KVM data",n.length,n,rstr2hex(n));return}if(e>n.length){console.error("KVM invalid command size",e,n.length);return}if(f==3||f==4||f==7){d=n.substring(4,e);o=((d.charCodeAt(0)&255)<<8)+(d.charCodeAt(1)&255);p=((d.charCodeAt(2)&255)<<8)+(d.charCodeAt(3)&255);if(b.debugmode==1){console.log("CMD"+f+" at X="+o+" Y="+p)}}switch(f){case 3:if(b.FirstDraw){b.onResize()}b.ProcessPictureMsg(d,o,p);break;case 4:if(b.FirstDraw){b.onResize()}if(b.TilesDrawn==b.tilesReceived){b.ProcessCopyRectMsg(d)}else{b.PendingOperations.push([++tilesReceived,1,d])}break;case 7:b.ProcessScreenMsg(o,p);b.SendKeyMsgKC(b.KeyAction.UP,16);b.SendKeyMsgKC(b.KeyAction.UP,17);b.SendKeyMsgKC(b.KeyAction.UP,18);b.SendKeyMsgKC(b.KeyAction.UP,91);b.SendKeyMsgKC(b.KeyAction.UP,92);b.SendKeyMsgKC(b.KeyAction.UP,16);b.send(String.fromCharCode(0,14,0,4));break;case 11:var k=[],g=((n.charCodeAt(4)&255)<<8)+(n.charCodeAt(5)&255);if(g>0){var m=0,l=((n.charCodeAt(6+(g*2))&255)<<8)+(n.charCodeAt(7+(g*2))&255);for(var j=0;j<g;j++){var h=((n.charCodeAt(6+(j*2))&255)<<8)+(n.charCodeAt(7+(j*2))&255);if(h==65535){k.push("All Displays")}else{k.push("Display "+h)}if(h==l){m=j}}}if(b.onDisplayinfo!=null){b.onDisplayinfo(b,k,m)}break;case 12:break;case 14:b.touchenabled=1;b.TouchArray={};if(b.onTouchEnabledChanged!=null){b.onTouchEnabledChanged(b.touchenabled)}break;case 15:b.TouchArray={};break;case 16:b.connectioncount=ReadInt(n,4);if(b.onConnectCountChanged!=null){b.onConnectCountChanged(b.connectioncount,b)}break;case 17:if(b.onMessage!=null){b.onMessage(n.substring(4,e),b)}break}return e};b.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};b.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};b.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};b.Alternate=0;b.SendKeyMsg=function(d,e){if(d==null){return}if(!e){var e=window.event}var f=e.keyCode;if(f==59){f=186}b.SendKeyMsgKC(d,f)};b.SendMessage=function(d){if(b.State==3){b.send(String.fromCharCode(0,17)+b.shortToStr(4+d.length)+d)}};b.SendKeyMsgKC=function(d,f){if(b.State!=3){return}if(typeof d=="object"){for(var e in d){b.SendKeyMsgKC(d[e][0],d[e][1])}}else{b.send(String.fromCharCode(0,b.InputType.KEY,0,6,(d-1),f))}};b.sendcad=function(){b.SendCtrlAltDelMsg()};b.SendCtrlAltDelMsg=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.CTRLALTDEL,0,4))}};b.SendEscKey=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.KEY,0,6,0,27,0,b.InputType.KEY,0,6,1,27))}};b.SendStartMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendCharmsMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.DOWN,67);b.SendKeyMsgKC(b.KeyAction.UP,67);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendTouchMsg1=function(e,d,f,g){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(14)+String.fromCharCode(1,e)+b.intToStr(d)+b.shortToStr(f)+b.shortToStr(g))}};b.SendTouchMsg2=function(f,d){var h="";var e;var j="TOUCHSEND: ";for(var g in b.TouchArray){if(g==f){e=d}else{if(b.TouchArray[g].f==1){e=65536|2|4;b.TouchArray[g].f=3;j+="START"+g}else{if(b.TouchArray[g].f==2){e=262144;j+="STOP"+g}else{e=2|4|131072}}}h+=String.fromCharCode(g)+b.intToStr(e)+b.shortToStr(b.TouchArray[g].x)+b.shortToStr(b.TouchArray[g].y);if(b.TouchArray[g].f==2){delete b.TouchArray[g]}}if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(5+h.length)+String.fromCharCode(2)+h)}if(Object.keys(b.TouchArray).length==0&&b.touchtimer!=null){clearInterval(b.touchtimer);b.touchtimer=null}};b.SendMouseMsg=function(d,g){if(b.State!=3){return}if(d!=null&&b.Canvas!=null){if(!g){var g=window.event}var k=(b.Canvas.canvas.height/b.CanvasId.clientHeight);var l=(b.Canvas.canvas.width/b.CanvasId.clientWidth);var j=b.GetPositionOfControl(b.Canvas.canvas);var m=((g.pageX-j[0])*l);var n=((g.pageY-j[1])*k);if(m>=0&&m<=b.Canvas.canvas.width&&n>=0&&n<=b.Canvas.canvas.height){var e=0;var f=0;if(d==b.KeyAction.UP||d==b.KeyAction.DOWN){if(g.which){((g.which==1)?(e=b.MouseButton.LEFT):((g.which==2)?(e=b.MouseButton.MIDDLE):(e=b.MouseButton.RIGHT)))}else{if(g.button){((g.button==0)?(e=b.MouseButton.LEFT):((g.button==1)?(e=b.MouseButton.MIDDLE):(e=b.MouseButton.RIGHT)))}}}else{if(d==b.KeyAction.SCROLL){if(g.detail){f=(-1*(g.detail*120))}else{if(g.wheelDelta){f=(g.wheelDelta*3)}}}}var h="";if(d==b.KeyAction.SCROLL){h=String.fromCharCode(0,b.InputType.MOUSE,0,12,0,((d==b.KeyAction.DOWN)?e:((e*2)&255)),((m/256)&255),(m&255),((n/256)&255),(n&255),((f/256)&255),(f&255))}else{h=String.fromCharCode(0,b.InputType.MOUSE,0,10,0,((d==b.KeyAction.DOWN)?e:((e*2)&255)),((m/256)&255),(m&255),((n/256)&255),(n&255))}if(b.Action==b.KeyAction.NONE){if(b.Alternate==0||b.ipad){b.send(h);b.Alternate=1}else{b.Alternate=0}}else{b.send(h)}}}};b.GetDisplayNumbers=function(){b.send(String.fromCharCode(0,11,0,4))};b.SetDisplay=function(d){b.send(String.fromCharCode(0,12,0,6,d>>8,d&255))};b.intToStr=function(d){return String.fromCharCode((d>>24)&255,(d>>16)&255,(d>>8)&255,d&255)};b.shortToStr=function(d){return String.fromCharCode((d>>8)&255,d&255)};b.onResize=function(){if(b.ScreenWidth==0||b.ScreenHeight==0){return}if(b.Canvas.canvas.width==b.ScreenWidth&&b.Canvas.canvas.height==b.ScreenHeight){return}if(b.FirstDraw){b.Canvas.canvas.width=b.ScreenWidth;b.Canvas.canvas.height=b.ScreenHeight;b.Canvas.fillRect(0,0,b.ScreenWidth,b.ScreenHeight);if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}}b.FirstDraw=false};b.xxMouseInputGrab=false;b.xxKeyInputGrab=false;b.xxMouseMove=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.NONE,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseUp=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseDown=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxDOMMouseScroll=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxMouseWheel=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxKeyUp=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyDown=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyPress=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.handleKeys=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyPress(d)};b.handleKeyUp=function(d){if(b.stopInput==true||desktop.State!=3){return false}if(b.firstUpKeys.length<5){b.firstUpKeys.push(d.keyCode);if((b.firstUpKeys.length==5)){var f=b.firstUpKeys.join(",");if((f=="16,17,91,91,16")||(f=="16,17,18,91,92")){b.stopInput=true}}}return b.xxKeyUp(d)};b.handleKeyDown=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyDown(d)};b.mousedown=function(d){if(b.stopInput==true){return false}return b.xxMouseDown(d)};b.mouseup=function(d){if(b.stopInput==true){return false}return b.xxMouseUp(d)};b.mousemove=function(d){if(b.stopInput==true){return false}return b.xxMouseMove(d)};b.mousewheel=function(d){if(b.stopInput==true){return false}return b.xxMouseWheel(d)};b.xxMsTouchEvent=function(d){if(d.originalEvent.pointerType==4){return}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}if(d.type=="MSPointerDown"||d.type=="MSPointerMove"||d.type=="MSPointerUp"){var e=0;var f=d.originalEvent.pointerId%256;var g=d.offsetX*(Canvas.canvas.width/b.CanvasId.clientWidth);var h=d.offsetY*(Canvas.canvas.height/b.CanvasId.clientHeight);if(d.type=="MSPointerDown"){e=65536|2|4}else{if(d.type=="MSPointerMove"){e=131072|2|4}else{if(d.type=="MSPointerUp"){e=262144}}}if(!b.TouchArray[f]){b.TouchArray[f]={x:g,y:h}}b.SendTouchMsg2(f,e);if(d.type=="MSPointerUp"){delete b.TouchArray[f]}}else{alert(d.type)}return true};b.xxTouchStart=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(KeyAction.DOWN,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(!b.TouchArray[g]){b.TouchArray[g]={x:(d.originalEvent.touches[f].pageX-h[0])*(Canvas.canvas.width/b.CanvasId.clientWidth),y:(d.originalEvent.touches[f].pageY-h[1])*(Canvas.canvas.height/b.CanvasId.clientHeight),f:1}}}if(Object.keys(b.TouchArray).length>0&&touchtimer==null){b.touchtimer=setInterval(function(){b.SendTouchMsg2(256,0)},50)}}};b.xxTouchMove=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(b.KeyAction.NONE,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].x=(d.originalEvent.touches[f].pageX-h[0])*(b.Canvas.canvas.width/b.CanvasId.clientWidth);b.TouchArray[g].y=(d.originalEvent.touches[f].pageY-h[1])*(b.Canvas.canvas.height/b.CanvasId.clientHeight)}}}};b.xxTouchEnd=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}d.which=1;d.pageX=LastX;d.pageY=LastY;b.SendMouseMsg(KeyAction.UP,d)}else{for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].f=2}}}};b.GrabMouseInput=function(){if(b.xxMouseInputGrab==true){return}var d=b.CanvasId;d.onmousemove=b.xxMouseMove;d.onmouseup=b.xxMouseUp;d.onmousedown=b.xxMouseDown;d.touchstart=b.xxTouchStart;d.touchmove=b.xxTouchMove;d.touchend=b.xxTouchEnd;d.MSPointerDown=b.xxMsTouchEvent;d.MSPointerMove=b.xxMsTouchEvent;d.MSPointerUp=b.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=b.xxDOMMouseScroll}else{d.onmousewheel=b.xxMouseWheel}b.xxMouseInputGrab=true};b.UnGrabMouseInput=function(){if(b.xxMouseInputGrab==false){return}var d=b.CanvasId;d.onmousemove=null;d.onmouseup=null;d.onmousedown=null;d.touchstart=null;d.touchmove=null;d.touchend=null;d.MSPointerDown=null;d.MSPointerMove=null;d.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=null}else{d.onmousewheel=null}b.xxMouseInputGrab=false};b.GrabKeyInput=function(){if(b.xxKeyInputGrab==true){return}document.onkeyup=b.xxKeyUp;document.onkeydown=b.xxKeyDown;document.onkeypress=b.xxKeyPress;b.xxKeyInputGrab=true};b.UnGrabKeyInput=function(){if(b.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;b.xxKeyInputGrab=false};b.GetPositionOfControl=function(d){var e=Array(2);e[0]=e[1]=0;while(d){e[0]+=d.offsetLeft;e[1]+=d.offsetTop;d=d.offsetParent}return e};b.crotX=function(d,e){if(b.rotation==0){return d}if(b.rotation==1){return e}if(b.rotation==2){return b.Canvas.canvas.width-d}if(b.rotation==3){return b.Canvas.canvas.height-e}};b.crotY=function(d,e){if(b.rotation==0){return e}if(b.rotation==1){return b.Canvas.canvas.width-d}if(b.rotation==2){return b.Canvas.canvas.height-e}if(b.rotation==3){return d}};b.rotX=function(d,e){if(b.rotation==0||b.rotation==1){return d}if(b.rotation==2){return d-b.Canvas.canvas.width}if(b.rotation==3){return d-b.Canvas.canvas.height}};b.rotY=function(d,e){if(b.rotation==0||b.rotation==3){return e}if(b.rotation==1){return e-b.Canvas.canvas.width}if(b.rotation==2){return e-b.Canvas.canvas.height}};b.tcanvas=null;b.setRotation=function(h){while(h<0){h+=4}var d=h%4;if(d==b.rotation){return true}var f=b.Canvas.canvas.width;var e=b.Canvas.canvas.height;if(b.rotation==1||b.rotation==3){f=b.Canvas.canvas.height;e=b.Canvas.canvas.width}if(b.tcanvas==null){b.tcanvas=document.createElement("canvas")}var g=b.tcanvas.getContext("2d");g.setTransform(1,0,0,1,0,0);g.canvas.width=f;g.canvas.height=e;g.rotate((b.rotation*-90)*Math.PI/180);if(b.rotation==0){g.drawImage(b.Canvas.canvas,0,0)}if(b.rotation==1){g.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,0)}if(b.rotation==2){g.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,-b.Canvas.canvas.height)}if(b.rotation==3){g.drawImage(b.Canvas.canvas,0,-b.Canvas.canvas.height)}if(b.rotation==0||b.rotation==2){b.Canvas.canvas.height=f;b.Canvas.canvas.width=e}if(b.rotation==1||b.rotation==3){b.Canvas.canvas.height=e;b.Canvas.canvas.width=f}b.Canvas.setTransform(1,0,0,1,0,0);b.Canvas.rotate((d*90)*Math.PI/180);b.rotation=d;b.Canvas.drawImage(b.tcanvas,b.rotX(0,0),b.rotY(0,0));b.ScreenWidth=b.Canvas.canvas.width;b.ScreenHeight=b.Canvas.canvas.height;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}return true};b.MuchTheSame=function(d,e){return(Math.abs(d-e)<4)};b.Debug=function(d){console.log(d)};b.getIEVersion=function(){var d=-1;if(navigator.appName=="Microsoft Internet Explorer"){var f=navigator.userAgent;var e=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(e.exec(f)!=null){d=parseFloat(RegExp.$1)}}return d};b.haltEvent=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};return b};"use strict";var args;var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"];var sort=0;var searchFocus=0;var mapSearchFocus=0;var userSearchFocus=0;var consoleFocus=0;var showRealNames=false;var meshserver=null;var meshes={};var meshcount=0;var nodes=[];var filetree={};var userinfo=null;var serverinfo=null;var events=[];var users=null;var wssessions=null;var nodeShortIdent=0;var desktop;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};var multidesktopsettings={quality:20,scaling:128,framerate:1000};var terminal;var files;var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var multiDesktop={};var multiDesktopFilter=null;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var amtScanResults=null;var debugmode=false;var clickOnce=(((features&256)!=0)&&detectClickOnce());var attemptWebRTC=((features&128)!=0);var webPageFullScreen=getstore("webPageFullScreen",false);if(webPageFullScreen=="false"){webPageFullScreen=false}function startup(){if((features&32)==0){var f=null;try{f=top.location.toString().toLowerCase()}catch(b){}if(top!=self&&(f==null||top.active==false)){top.location=self.location;return}}toggleFullScreen();args=parseUriArgs();debugmode=(args.debug==1);if(args.webrtc!=null){attemptWebRTC=(args.webrtc==1)}QV("p13AutoConnect",debugmode);QV("autoconnectbutton2",debugmode);QV("autoconnectbutton1",debugmode);if(args.hide){var d=parseInt(args.hide);QV("masthead",!(d&1));QV("topbarmaster",!(d&2));QV("footer",!(d&4));QV("p10title",!(d&8));QV("p11title",!(d&8));QV("p12title",!(d&8));QV("p13title",!(d&8));QV("p14title",!(d&8));QV("p15title",!(d&8));QV("p16title",!(d&8))}p1updateInfo();document.onclick=function(c){hideContextMenu()};document.onkeypress=ondockeypress;document.onkeydown=ondockeydown;document.onkeyup=ondockeyup;window.onresize=center;center();meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();Q("sortselect").selectedIndex=sort=getstore("sort",0);Q("sizeselect").selectedIndex=getstore("viewsize",1);Q("SearchInput").value=getstore("search","");showRealNames=(getstore("showRealNames",0)==1);Q("RealNameCheckBox").checked=showRealNames;Q("viewselect").value=getstore("deviceView",1);Q("DeskControl").checked=(getstore("DeskControl",1)==1);onSortSelectChange();onSearchInputChanged();Q("p5filetable").addEventListener("drop",p5fileDragDrop,false);Q("p5filetable").addEventListener("dragover",p5fileDragOver,false);Q("p5filetable").addEventListener("dragleave",p5fileDragLeave,false);Q("p13filetable").addEventListener("drop",p13fileDragDrop,false);Q("p13filetable").addEventListener("dragover",p13fileDragOver,false);Q("p13filetable").addEventListener("dragleave",p13fileDragLeave,false);setInterval(updateDeviceTimeline,120000);var g=localStorage.getItem("desktopsettings");if(g!=null){desktopsettings=JSON.parse(g)}g=localStorage.getItem("multidesktopsettings");if(g!=null){multidesktopsettings=JSON.parse(g)}applyDesktopSettings();var h="";for(var a=1;a<27;a++){h+="<option value='"+a+"'>Ctrl-"+String.fromCharCode(64+a)+" ("+a+")</option>"}QH("specialkeylist",h)}function toggleFullScreen(a){if(a===1){webPageFullScreen=!webPageFullScreen;putstore("webPageFullScreen",webPageFullScreen)}if(webPageFullScreen==false){QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("container")["min-width"]="960px";QS("column_l").width="930px"}else{QS("container").width="100%";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("container")["min-width"]="700px";QS("column_l").width="calc(100% - 30px)"}drawDeviceTimeline()}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function reload(){window.location.href=window.location.href}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);powerTimeline=null;powerTimelineReq=null;powerTimelineNode=null;powerTimelineUpdate=null;deleteAllNotifications();hideContextMenu();QV("verifyEmailId2",false);QV("logoutControl",false);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"})}}}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function detectClickOnce(){for(var a in window.navigator.mimeTypes){if(window.navigator.mimeTypes[a].type=="application/x-ms-application"){return true}}var b=window.navigator.userAgent.toUpperCase();return(b.indexOf(".NET CLR 3.5")>=0)||(b.indexOf("(WINDOWS NT ")>=0)}function updateSiteAdmin(){var a="{{{noServerBackup}}}";var b=userinfo.siteadmin;if(a==1){b&=4294967290}QV("p2AccountActions",(features&4)==0);QV("p2ServerActions",b&5);QV("p2ServerActionsBackup",b&1);QV("p2ServerActionsRestore",b&4);QV("p2ServerActionsVersion",b&16);QV("MainMenuMyFiles",b&8);if(((b&8)==0)&&(xxcurrentView==5)){setDialogMode(0);go(1)}if(currentNode!=null){gotoDevice(currentNode._id,xxcurrentView,true)}if((userinfo.siteadmin&2)!=0){if(users==null){meshserver.send({action:"users"})}if(wssessions==null){meshserver.send({action:"wssessioncount"})}}else{users=null;wssessions=null;updateUsers();if(xxcurrentView==4||((xxcurrentView>=30)&&(xxcurrentView<40))){setDialogMode(0);go(1);currentUser=null}}meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)});QV("p2deleteall",userinfo.siteadmin==4294967295)}function onMessage(s,f){switch(f.action){case"serverinfo":serverinfo=f.serverinfo;break;case"userinfo":userinfo=f.userinfo;updateSiteAdmin();QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));break;case"users":users={};for(var e in f.users){users[f.users[e]._id]=f.users[e]}updateUsers();break;case"wssessioncount":wssessions=f.wssessions;updateUsers();break;case"meshes":meshes={};for(var e in f.meshes){meshes[f.meshes[e]._id]=f.meshes[e]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(f.filetree);updateFiles();d3updatefiles();break;case"nodes":nodes=[];for(var e in f.nodes){if(!meshes[e]){console.log("Invalid mesh (1): "+e);continue}for(var g in f.nodes[e]){if(f.nodes[e][g]._id==null){console.log("Invalid node ("+g+"): "+JSON.stringify(f.nodes));continue}f.nodes[e][g].namel=f.nodes[e][g].name.toLowerCase();if(f.nodes[e][g].rname){f.nodes[e][g].rnamel=f.nodes[e][g].rname.toLowerCase()}else{f.nodes[e][g].rnamel=f.nodes[e][g].namel}f.nodes[e][g].meshnamel=meshes[e].name.toLowerCase();f.nodes[e][g].meshid=e;f.nodes[e][g].state=(f.nodes[e][g].state)?(f.nodes[e][g].state):0;f.nodes[e][g].desc=f.nodes[e][g].desc;if(!f.nodes[e][g].icon){f.nodes[e][g].icon=1}f.nodes[e][g].ident=++nodeShortIdent;nodes.push(f.nodes[e][g])}}onSortSelectChange();onSearchInputChanged();updateDevices();refreshMap(false,true);if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(f.nodeid!=powerTimelineReq){break}powerTimelineNode=f.nodeid;powerTimeline=f.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==f.nodeid){drawDeviceTimeline()}break;case"msg":if(f.nodeid!=null){var d=-1;for(var c in nodes){if(nodes[c]._id==f.nodeid){d=c;break}}if(d!=-1){if(f.type=="console"){p15consoleReceive(nodes[d],f.value)}else{if(f.type=="notify"){var g={text:f.value};if(f.nodeid!=null){g.nodeid=f.nodeid}if(f.tag!=null){g.tag=f.tag}addNotification(g)}else{if(f.type=="ps"){showDeskToolsProcesses(f)}}}}}else{if(f.type=="notify"){var g={text:f.value};if(f.tag!=null){g.tag=f.tag}addNotification(g)}}break;case"getnetworkinfo":if((currentNode._id==f.nodeid)&&(xxdialogMode==2)&&(xxdialogTag=="if"+f.nodeid)){if(f.netif==null){QH("d2netinfo","No network interface information available for this device.")}else{var v="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";v+=addHtmlValue2("Last Updated",new Date(f.updateTime).toLocaleString());if(currentNode.publicip){v+=addHtmlValue2("Public IP address",currentNode.publicip)}for(var c in f.netif){var h=f.netif[c];v+="<hr />";if(h.name){v+=addHtmlValue2("Name","<b>"+EscapeHtml(h.name)+"</b>")}if(h.desc){v+=addHtmlValue2("Description",EscapeHtml(h.desc).replace("(R)","&reg;").replace("(r)","&reg;"))}if(h.dnssuffix){v+=addHtmlValue2("DNS suffix",EscapeHtml(h.dnssuffix))}if(h.mac){v+=addHtmlValue2("MAC address",EscapeHtml(h.mac.toUpperCase()))}if(h.v4addr){v+=addHtmlValue2("IPv4 address",EscapeHtml(h.v4addr))}if(h.v4mask){v+=addHtmlValue2("IPv4 mask",EscapeHtml(h.v4mask))}if(h.v4gateway){v+=addHtmlValue2("IPv4 gateway",EscapeHtml(h.v4gateway))}if(h.gatewaymac){v+=addHtmlValue2("Gateway MAC",EscapeHtml(h.gatewaymac))}}v+="</div>";QH("d2netinfo",v)}}break;case"serverversion":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerUpdate")){var v="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";if(!f.current){f.current="Unknown"}if(!f.latest){f.latest="Unknown"}v+=addHtmlValue2("Current Version","<b>"+EscapeHtml(f.current)+"</b>");v+=addHtmlValue2("Latest Version","<b>"+EscapeHtml(f.latest)+"</b>");v+="</div>";if(f.current==f.latest){setDialogMode(2,"MeshCentral Version",1,null,v)}else{setDialogMode(2,"MeshCentral Version",3,server_showVersionDlgEx,v+"<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to start server self-update.");server_showVersionDlgUpdate()}}break;case"events":if((f.nodeid!=null)&&(f.nodeid==currentNode._id)){currentDeviceEvents=f.events;devevents_update()}else{if((f.user!=null)&&(f.user==currentUser.name)){currentUserEvents=f.events;userEvents_update()}else{events=f.events;events_update()}}break;case"getcookie":if(f.tag=="clickonce"){var a="{{{serverRedirPort}}}"==""?"{{{serverPublicPort}}}":"{{{serverRedirPort}}}";rdpurl="http://"+window.location.hostname+":"+a+"/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F"+window.location.hostname+"%2Fmeshrelay.ashx%3Fauth="+f.cookie+"&CH={{{webcerthash}}}&AP="+f.protocol+"&HOL=1";window.open(rdpurl,"_blank")}break;case"getNotes":var g=Q("d2devNotes");if(g&&(f.id==decodeURIComponent(g.attributes.noteid.value))){if(f.notes){QH("d2devNotes",decodeURIComponent(f.notes))}else{QH("d2devNotes","")}var q=g.attributes.ro.value=="true";if(q==false){g.removeAttribute("readonly");QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",true);focusTextBox("d2devNotes")}}break;case"event":if(!f.event.nolog){events.unshift(f.event);var b=parseInt(p3limitdropdown.value);while(events.length>b){events.pop()}events_update()}switch(f.event.action){case"accountcreate":case"accountchange":if(userinfo.name==f.event.account.name){var k=f.event.account.siteadmin?f.event.account.siteadmin:0;var o=userinfo.siteadmin?userinfo.siteadmin:0;if((f.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((f.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=f.event.account;if(o!=k){updateSiteAdmin()}QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true))}if(users==null){break}users[f.event.account._id]=f.event.account;updateUsers();break;case"accountremove":if(users==null){break}delete users["user/"+domain+"/"+f.event.username.toLowerCase()];updateUsers();break;case"createmesh":if(f.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[f.event.meshid]={_id:f.event.meshid,name:f.event.name,mtype:f.event.mtype,desc:f.event.desc,links:f.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[f.event.meshid]==null){meshes[f.event.meshid]={_id:f.event.meshid,name:f.event.name,mtype:f.event.mtype,desc:f.event.desc,links:f.event.links};meshserver.send({action:"nodes"})}else{meshes[f.event.meshid].name=f.event.name;meshes[f.event.meshid].desc=f.event.desc;meshes[f.event.meshid].links=f.event.links;if(meshes[f.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[f.event.meshid])){go(2)}delete meshes[f.event.meshid];var j=[];for(var c in nodes){if(nodes[c].meshid!=f.event.meshid){j.push(nodes[c])}}nodes=j;if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==f.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&&currentMesh._id==f.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[f.event.meshid]){delete meshes[f.event.meshid];updateMeshes();meshserver.send({action:"files"})}var j=[];for(var c in nodes){if(nodes[c].meshid!=f.event.meshid){j.push(nodes[c])}}nodes=j;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&&currentMesh._id==f.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==f.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var l=f.event.node;if(!meshes[l.meshid]){break}l.namel=l.name.toLowerCase();if(l.rname){l.rnamel=l.rname.toLowerCase()}else{l.rnamel=l.namel}l.meshnamel=meshes[l.meshid].name.toLowerCase();l.state=0;if(!l.icon){l.icon=1}l.ident=++nodeShortIdent;nodes.push(l);onSortSelectChange();onSearchInputChanged();updateDevices();updateMapMarkers();break;case"removenode":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var l=nodes[d];if(currentNode==l){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(d,1);updateDevices();updateMapMarkers()}break;case"changenode":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var l=nodes[d];l.name=f.event.node.name;l.rname=f.event.node.rname;l.host=f.event.node.host;l.desc=f.event.node.desc;l.publicip=f.event.node.publicip;l.iploc=f.event.node.iploc;l.wifiloc=f.event.node.wifiloc;l.gpsloc=f.event.node.gpsloc;l.tags=f.event.node.tags;l.userloc=f.event.node.userloc;if(f.event.node.agent!=null){if(l.agent==null){l.agent={}}if(f.event.node.agent.ver!=null){l.agent.ver=f.event.node.agent.ver}if(f.event.node.agent.id!=null){l.agent.id=f.event.node.agent.id}if(f.event.node.agent.caps!=null){l.agent.caps=f.event.node.agent.caps}if(f.event.node.agent.core!=null){l.agent.core=f.event.node.agent.core}else{if(l.agent.core){delete l.agent.core}}l.agent.tag=f.event.node.agent.tag}if(f.event.node.intelamt!=null){if(l.intelamt==null){l.intelamt={}}if(f.event.node.intelamt.host!=null){l.intelamt.user=f.event.node.intelamt.host}if(f.event.node.intelamt.user!=null){l.intelamt.user=f.event.node.intelamt.user}if(f.event.node.intelamt.tls!=null){l.intelamt.tls=f.event.node.intelamt.tls}if(f.event.node.intelamt.ver!=null){l.intelamt.ver=f.event.node.intelamt.ver}if(f.event.node.intelamt.state!=null){l.intelamt.state=f.event.node.intelamt.state}}l.namel=l.name.toLowerCase();if(l.rname){l.rnamel=l.rname.toLowerCase()}else{l.rnamel=l.namel}if(f.event.node.icon){l.icon=f.event.node.icon}onSortSelectChange(true);drawNotifications();refreshDevice(l._id);updateMapMarkers();if((currentNode==l)&&(xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){p10showNodeLocationDialog()}}break;case"nodeconnect":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var l=nodes[d];l.conn=f.event.conn;l.pwr=f.event.pwr;updateDevices();updateMapMarkers();refreshDevice(l._id)}break;case"wssessioncount":if(wssessions!=null){if(f.event.count==0&&wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]){delete wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]}else{wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]=f.event.count}updateUsers()}break;case"clearevents":events=[];events_update();break;case"login":if(users!=null&&users["user/"+domain+"/"+f.event.username.toLowerCase()]){users["user/"+domain+"/"+f.event.username.toLowerCase()].login=f.event.time}break;case"scanamtdevice":if((xxdialogMode==null)||(!Q("dp1range"))||(Q("dp1range").value!=f.event.range)){return}var v="";if(f.event.results==null){v="<div style=width:100%;text-align:center;margin-top:12px>Unable to scan this address range.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}else{amtScanResults=f.event.results;for(var c in f.event.results){var p=f.event.results[c],t=p.hostname;if(t.length>20){t=t.substring(0,20)+"..."}var u='<b title="'+EscapeHtml(p.hostname)+'">'+EscapeHtml(t)+"</b> - v"+p.ver;if(p.state==2){if(p.tls==1){u+=" with TLS."}else{u+=" without TLS."}}else{u+=" not activated."}v+='<div style=width:100%;margin-bottom:2px;background-color:lightgray><div style=padding:4px><div style=display:inline-block;margin-right:5px><input class=DevScanCheckbox name=dp1checkbox tag="'+EscapeHtml(c)+'" type=checkbox onclick=addAmtScanToMeshCheckbox() /></div><div class=j1 style=display:inline-block></div><div style=display:inline-block;margin-left:5px;overflow-x:auto;white-space:nowrap>'+u+"</div></div></div>"}if(v==""){v="<div style=width:100%;text-align:center;margin-top:12px>Scan returned no results.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}}QH("dp1results",v);QE("dp1range",true);QE("dp1rangebutton",true);break;case"notify":var g={text:f.event.value};if(f.event.tag!=null){g.tag=f.event.tag}addNotification(g);break}break}}function onRealNameCheckBox(){showRealNames=Q("RealNameCheckBox").checked;putstore("showRealNames",showRealNames?1:0);onSortSelectChange();return}function onDeviceViewChange(){putstore("deviceView",Q("viewselect").value);putstore("viewsize",Q("sizeselect").value);updateDevices()}function ondockeypress(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeys(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(a.key){if(a.key.length===1&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+a.key));b=1}if(a.keyCode==8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("UserSearchInput").value="";b=1}}else{if(a.charCode!=0&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onUserSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1){return}if(a.ctrlKey==true&&a.charCode==96){showRealNames=!showRealNames;Q("RealNameCheckBox").value=showRealNames;putstore("showRealNames",showRealNames?1:0);onSortSelectChange();return}if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){var b=0;if(a.key){if(a.key.length===1&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+a.key));b=1}if(a.keyCode==8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("SearchInput").value="";b=1}}else{if(a.charCode!=0&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.key){if(a.key.length===1&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+a.key));b=1}if(a.keyCode==27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}if(a.keyCode==13){getSearchLocation()}}else{if(a.charCode!=0&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+String.fromCharCode(a.charCode)));b=1}}}}function ondockeydown(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.keyCode===8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("UserSearchInput").value="";b=1}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(Q("viewselect").value<3){if(a.keyCode===8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("SearchInput").value="";b=1}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.keyCode===8&&mapSearchFocus==0){var c=Q("mapSearchLocation").value;Q("mapSearchLocation").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}}}function ondockeyup(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){p13folderup(9999);haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==4){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(xxdialogMode&&a.keyCode==27){dialogclose(0)}if(xxdialogMode||xxcurrentView!=0||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(Q("viewselect").value==3){if((a.keyCode===8&&mapSearchFocus==0)||a.keyCode===27){return haltEvent(a)}}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var deviceHeaderId=0;var deviceHeaderTotal=0;var deviceHeadersTitles={};var deviceHeaderCount;var deviceHeaders={};var oldviewmode=0;function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var G="",a=0,f=null,e=0,h={},K=Q("viewselect").value,p={},n={};QV("xdevices",K<4);QV("xdevicesmap",K==4);QV("devListToolbar",K<3);QV("kvmListToolbar",K==3);QV("devMapToolbar",K==4);QV("devListToolbarSize",K==3);QV("NoMeshesPanel",meshcount==0);QV("devListToolbarView",(meshcount!=0)&&(nodes.length>0));QV("devListToolbarSort",(meshcount!=0)&&(nodes.length>0)&&(K<4));if((meshcount==0)||(nodes.length==0)){K=1}if(K==4){setTimeout(function(){if(xxmap.map!=null){xxmap.map.updateSize()}},200)}else{deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var v=[];if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}var d=[],k=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var q=0;q<k.length;q++){if(k[q].checked){d.push(k[q].value)}}if((oldviewmode<3)&&(K==3)){multiDesktopFilter=d}else{if((oldviewmode==3)&&(K<3)){d=multiDesktopFilter}}for(var q in nodes){if(nodes[q].v==false){continue}var y=meshes[nodes[q].meshid],A=y.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(A==null){continue}var B=A.rights;if((K==3)&&(y.mtype==1)){continue}if(sort==0){if(nodes[q].meshid!=f){deviceHeaderSet();var m="";if(meshes[nodes[q].meshid].mtype==1){m="<span class=devHeaderx>, Intel&reg; AMT only</span>"}if((K==1)&&(f!=null)){if(a==2){G+="<td><div style=width:301px></div></td>"}if(G!=""){G+="</tr></table>"}}G+="<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>";G+=getMeshActions(y,B);G+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+nodes[q].meshid+'")>'+EscapeHtml(meshes[nodes[q].meshid].name)+"</span>"+m+"<span id=DevxHeader"+deviceHeaderId+" class=devHeaderx></span></div>";f=nodes[q].meshid;h[f]=1;a=0}}else{if(sort==1){var F=nodes[q].pwr?nodes[q].pwr:0;if(F!==f){deviceHeaderSet();if((K==1)&&(f!==null)){if(a==2){G+="<td><div style=width:301px></div></td>"}if(G!=""){G+="</tr></table>"}}G+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[q].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+' class="devHeaderx"></span></div>';f=F;a=0}}else{if(sort==2){if(f==null){f="1"}}}}e++;var J=EscapeHtml(nodes[q].name);if(J.length==0){J="<i>None</i>"}if((nodes[q].rname!=null)&&(nodes[q].rname.length>0)){J+=" / "+EscapeHtml(nodes[q].rname)}var C=EscapeHtml(nodes[q].name);if(showRealNames==true&&nodes[q].rname!=null){C=EscapeHtml(nodes[q].rname)}if(C.length==0){C="<i>None</i>"}var s=nodes[q].icon;var E=NodeStateStr(nodes[q]);if((!nodes[q].conn)||(nodes[q].conn==0)){s+=" gray"}if(K==1){G+='<div id=devs style=display:inline-block;width:301px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="'+nodes[q].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[q]._id+" type=checkbox></div><div style=height:100%;cursor:pointer onclick=gotoDevice('"+nodes[q]._id+"')><div class=\"i"+s+'" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 title="'+J+'">'+C+"</div><div>"+E+"</div></div><div class=g2></div></div></div></div>"}else{if(K==2){G+="<tr><td><div id=devs class=bar18 style=height:18px;width:100%;font-size:medium>";G+='<div style=width:22px;float:left;background-color:white><input class="'+nodes[q].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[q]._id+" type=checkbox></div>";G+="<div style=float:left;height:18px;width:18px;background-color:white onclick=gotoDevice('"+nodes[q]._id+"')><div class=j"+s+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";G+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";G+='<div style=cursor:pointer;font-size:14px title="'+J+"\" onclick=gotoDevice('"+nodes[q]._id+"')><span style=float:right>"+E+"</span><span style=width:300px>"+C+"</span></div></div></td></tr>"}else{if((K==3)&&(nodes[q].conn&1)&&((B&8)!=0)){if((multiDesktopFilter.length==0)||(multiDesktopFilter.indexOf("devid_"+nodes[q]._id)>=0)){G+="<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div style=padding:3px;cursor:pointer onclick=gotoDevice('"+nodes[q]._id+"',11)>";G+='<div class="j'+s+'" style=width:16px;float:left></div>&nbsp;'+C+"</div>";G+="<span onclick=gotoDevice('"+nodes[q]._id+"')></span><div id=xkvmid_"+nodes[q]._id.split("/")[2]+"><div id=skvmid_"+nodes[q]._id.split("/")[2]+' style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\''+nodes[q]._id+"')>Disconnected</div></div>";G+="</div>";v.push(nodes[q]._id)}}}}if((sort==3)&&(G!="")){if(nodes[q].tags){for(var u in nodes[q].tags){var I=nodes[q].tags[u];if(p[I]==null){p[I]=G;n[I]=1}else{p[I]+=G;n[I]+=1}if(K==3){break}}}G=""}deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[q].state]=="undefined"){deviceHeaderCount[nodes[q].state]=1}else{deviceHeaderCount[nodes[q].state]++}}if(sort==3){var o=[];for(var q in p){o.push(q)}o.sort(function(c,j){return c.toLowerCase().localeCompare(j.toLowerCase())});for(var u in o){var q=o[u];G+="<div class=DevSt style=width:100%;padding-top:4px><span>"+q+'</span><span class="devHeaderx">, '+n[q]+" device"+((n[q]>1)?"s":"")+"</span></div>"+p[q]}}if((G=="")&&(meshcount>0)&&(Q("SearchInput").value!="")){if(sort==3){G='<div style="margin:30px">No devices are included in any groups, click on a device\'s "Groups" to add to a group.</div>'}else{G='<div style="margin:30px">No devices matching this search.</div>'}}if((K==1)&&(a==2)){G+="<td><div style=width:301px></div></td>"}if((sort==0)&&(Q("SearchInput").value=="")&&(K<3)){for(var q in meshes){var w=meshes[q],z=w.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(z!=null){var B=z.rights;if(h[w._id]==null){if((f!="")&&(G!="")){G+="</tr></table>"}G+="<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>";G+=getMeshActions(w,B);G+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+w._id+'")>'+EscapeHtml(w.name)+"</span></td></tr><tr>";if(w.mtype==1){G+="<td><div style=padding:10px><i>No Intel&reg; AMT devices in this mesh";if((B&4)!=0){G+=', <a style=cursor:pointer onclick=addDeviceToMesh("'+w._id+'")>add one</a>'}}if(w.mtype==2){G+="<td><div style=padding:10px><i>No devices in this mesh";if((B&4)!=0){G+=', <a style=cursor:pointer onclick=addAgentToMesh("'+w._id+'")>add one</a>'}}G+=".</i></div></td>";f=w._id;e++}}}}G+="</tr></table><div style=height:1px></div>";G+="<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>";if((K<3)&&(sort==0)&&(meshcount>0)){G+='<a onclick=account_createMesh() title="Create a new group of computers." style=cursor:pointer>Add Mesh</a>&nbsp'}G+='<a onclick=p10showMeshCmdDialog(0) style=cursor:pointer title="Download MeshCmd, a command line tool that performs many functions.">MeshCmd</a></div>';G+="</div>";QH("xdevices",G);deviceHeaderSet();var k=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var q=0;q<k.length;q++){k[q].checked=(d.indexOf(k[q].value)>=0)}for(var q in deviceHeaders){QH(q,deviceHeaders[q])}for(var q in deviceHeadersTitles){Q(q).title=deviceHeadersTitles[q]}p1updateInfo();if(K==3){var L=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];for(var q in multiDesktop){multiDesktop[q].xxdelete=true}for(var q in v){var t=v[q],H=t.split("/")[2],g=multiDesktop[t];if(g!=null){g.m.CanvasId.setAttribute("style","background-color:black;width:"+L.x+"px;height:"+L.y+"px");Q("xkvmid_"+H).appendChild(g.m.CanvasId);delete g.xxdelete;QH("skvmid_"+H,["Disconnected","Connecting...","Setup...","",""][((g.m.State==null)?g.m.state:g.m.State)])}else{var D=getNodeFromId(t);if((desktopNode==D)&&(desktop!=null)){var a=desktop.m.CanvasId;a.setAttribute("id","kvmid_"+H);a.setAttribute("style","background-color:black;width:"+L.x+"px;height:"+L.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+t+"')");a.removeAttribute("onmousedown");a.removeAttribute("onmouseup");a.removeAttribute("onmousemove");Q("xkvmid_"+H).appendChild(a);QH("skvmid_"+H,["Disconnected","Connecting...","Setup...","",""][((desktop.m.State==null)?desktop.m.state:desktop.m.State)]);if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}desktop.shortid=H;desktop.onStateChanged=onMultiDesktopStateChange;multiDesktop[t]=desktop;desktop=desktopNode=currentNode=null;QH("DeskParent",'<canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>')}else{var a=document.createElement("canvas");a.setAttribute("id","kvmid_"+H);a.setAttribute("width",640);a.setAttribute("height",200);a.setAttribute("oncontextmenu","return false");a.setAttribute("style","background-color:black;width:"+L.x+"px;height:"+L.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+t+"')");try{Q("xkvmid_"+H).appendChild(a)}catch(l){}if(Q("autoConnectDesktopCheckbox").checked==true){setTimeout(function(){connectMultiDesktop(D,1)},100)}}}}for(var q in multiDesktop){if(multiDesktop[q].xxdelete==true){multiDesktop[q].Stop();delete multiDesktop[q]}}}else{disconnectAllKvmFunction();Q("autoConnectDesktopCheckbox").checked=false}}oldviewmode=K}function toggleKvmDevice(d){var c=getNodeFromId(d),a=meshes[c.meshid],b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&8)!=0){if(c.conn&1){connectMultiDesktop(c,1)}}}function autoConnectDesktops(){if(Q("autoConnectDesktopCheckbox").checked==true){connectAllKvmFunction()}}function connectAllKvmFunction(){for(var a in nodes){if(multiDesktop[nodes[a]._id]==null){toggleKvmDevice(nodes[a]._id)}}}function disconnectAllKvmFunction(){for(var a in multiDesktop){multiDesktop[a].Stop()}multiDesktop={}}function onMultiDesktopStateChange(a,c){try{QH("skvmid_"+a.shortid,["Disconnected","Connecting...","Setup...","",""][c])}catch(b){}}function showMultiDesktopSettings(){QV("d7amtkvm",false);QV("d7meshkvm",true);d7bitmapquality.value=multidesktopsettings.quality;d7bitmapscaling.value=multidesktopsettings.scaling;if(multidesktopsettings.framerate){d7framelimiter.value=multidesktopsettings.framerate}else{d7framelimiter.value=1000}setDialogMode(7,"Remote Desktop Settings",3,showMultiDesktopSettingsChanged)}function showMultiDesktopSettingsChanged(){multidesktopsettings.quality=d7bitmapquality.value;multidesktopsettings.scaling=d7bitmapscaling.value;multidesktopsettings.framerate=d7framelimiter.value;localStorage.setItem("multidesktopsettings",JSON.stringify(multidesktopsettings));for(var a in multiDesktop){multiDesktop[a].m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}}function connectMultiDesktop(c,a){var d=c._id,e=d.split("/")[2];var b=multiDesktop[d];if(b==null){if(Q("kvmid_"+e)==null){return}if(a==2){if((c.intelamt.user==null)||(c.intelamt.user=="")){return}b=CreateAmtRedirect(CreateAmtRemoteDesktop("kvmid_"+e));b.shortid=e;b.onStateChanged=onMultiDesktopStateChange;b.m.bpp=1;b.m.useZRLE=true;b.m.showmouse=true;b.Start(d,16994,"*","*",0);b.contype=2;multiDesktop[d]=b}else{if(a==1){b=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("kvmid_"+e),serverPublicNamePort);b.shortid=e;b.attemptWebRTC=attemptWebRTC;b.onStateChanged=onMultiDesktopStateChange;b.m.CompressionLevel=multidesktopsettings.quality;b.m.ScalingLevel=multidesktopsettings.scaling;b.m.FrameRateTimer=multidesktopsettings.framerate;b.Start(d);b.contype=1;multiDesktop[d]=b}}}else{b.Stop();delete multiDesktop[d]}}function getMeshActions(a,b){if((b&4)==0){return""}var c="";if((features&1024)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel&reg; AMT computer that is located on the internet." onclick=addCiraDeviceToMesh("'+a._id+'")>Add CIRA</a>'}if(a.mtype==1){if((features&1)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel&reg; AMT computer that is located on the local network." onclick=addDeviceToMesh("'+a._id+'")>Add Local</a>';c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel&reg; AMT computer by scanning the local network." onclick=addAmtScanToMesh("'+a._id+'")>Scan Network</a>'}}if(a.mtype==2){c+=' <a style=cursor:pointer;font-size:10px title="Add a new computer to this mesh by installing the mesh agent." onclick=addAgentToMesh("'+a._id+'")>Add Agent</a>';if(features&64){c+=' <a style=cursor:pointer;font-size:10px title="Invite someone to install the mesh agent." onclick=inviteAgentToMesh("'+a._id+'")>Invite</a>'}}return c}function addDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+".<br /><br />";c+=addHtmlValue("Device Name","<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Hostname",'<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder="Same as device name" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Username",'<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder="admin" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Password","<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Security","<select id=dp1tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");setDialogMode(2,"Add Intel&reg; AMT device",3,addDeviceToMeshEx,c,b);validateDeviceToMesh();Q("dp1devicename").focus()}function addAmtScanToMesh(a){if(xxdialogMode){return}var b="Enter a range of IP addresses to scan for Intel AMT devices.<br /><br />";b+=addHtmlValue("IP Range",'<input id=dp1range style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value=Scan onclick=addAmtScanToMeshButton()></input>');b+='<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';setDialogMode(2,"Scan for Intel&reg; AMT devices",3,addAmtScanToMeshEx,b,a);QE("idx_dlgOkButton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>");focusTextBox("dp1range")}function addAmtScanToMeshKeyUp(a){if(a.keyCode==13){haltEvent(a);addAmtScanToMeshButton()}}function addAmtScanToMeshEx(b,g){var d=document.getElementsByClassName("DevScanCheckbox"),c=0;for(var e=0;e<d.length;e++){if(d[e].checked){var f=d[e].getAttribute("tag");var a=amtScanResults[f];meshserver.send({action:"addamtdevice",meshid:g,devicename:f,hostname:a.hostname,amtusername:"",amtpassword:"",amttls:a.tls})}}}function addAmtScanToMeshButton(){QE("dp1range",false);QE("dp1rangebutton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px>Scanning...</div>");meshserver.send({action:"scanamtdevice",range:Q("dp1range").value})}function addAmtScanToMeshCheckbox(){var b=document.getElementsByClassName("DevScanCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){a++}}QE("idx_dlgOkButton",a>0)}function addCiraDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c=b.split("/")[2].replace(/\@/g,"X").replace(/\$/g,"X");var e="<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>MeshCommander Script</option><option value=1>Manual Username/Password</option>";if((features&16)==0){e+="<option value=2>Manual Certificate</option></select>"}var d="";d+=addHtmlValue("Setup Method",e);d+="<hr>";d+="<div id=dlgAddCira0>To add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, download the following script files and use <a href='http://meshcommander.com' target='_blank'>MeshCommander</a> to run the script to configure computers.<br /><br />";d+=addHtmlValue("Setup CIRA",'<a href="mescript.ashx?type=1&meshid='+c.substring(0,16)+'" target="_blank">cira_setup.mescript</a>');d+=addHtmlValue("Cleanup CIRA",'<a href="mescript.ashx?type=2" target="_blank">cira_clean.mescript</a>');d+="</div>";d+="<div id=dlgAddCira1 style=display:none>To add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, load the following certificate as trusted root within Intel AMT";if(serverinfo.mpspass){d+=" and authenticate to the server using this username and password.<br /><br />"}else{d+=" and authenticate to the server using this username and any password.<br /><br />"}d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Username",'<input style=width:230px readonly value="'+c.substring(0,16)+'" />');if(serverinfo.mpspass){d+=addHtmlValue("Password",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpspass)+'" />')}if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>";if((features&16)==0){d+="<div id=dlgAddCira2 style=display:none>To add a new Intel&reg; AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.<br /><br />";d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Organization",'<input style=width:230px readonly value="'+c+'" />');if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>"}setDialogMode(2,"Add Intel&reg; AMT CIRA device",1,null,d)}function dlgAddCiraSelClick(){var a=Q("dlgAddCiraSel").value;QV("dlgAddCira0",a==0);QV("dlgAddCira1",a==1);QV("dlgAddCira2",a==2)}function checkEmail(c){var d=c.split("@");var b=((d.length==2)&&(d[0].length>0)&&(d[1].split(".").length>1)&&(d[1].length>2));if(b==true){var e=d[1].split(".");for(var a in e){if(e[a].length==0){b=false}}}return b}function inviteAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for "+EscapeHtml(a.name)+".<br /><br />";c+=addHtmlValue("E-Mail","<input id=agentInviteEmail style=width:240px onkeyup=validateAgentInvite()></input>");setDialogMode(2,"Invite Mesh Agent",3,performAgentInvite,c,b);validateAgentInvite()}function validateAgentInvite(){QE("idx_dlgOkButton",checkEmail(Q("agentInviteEmail").value))}function performAgentInvite(a,b){meshserver.send({action:"inviteAgent",meshid:b,email:Q("agentInviteEmail").value})}function addAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b],e="";e+=addHtmlValue("Operating System","<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=2>Windows (UnInstall)</option><option value=3>Linux (UnInstall)</option></select>")+"<hr>";e+="<div id=agins_windows>To add a new computer to mesh "+EscapeHtml(a.name)+", download the mesh agent and install it the computer to manage. This agent has server and mesh information embedded within it.<br /><br />";e+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3&meshid='+b.split("/")[2]+'" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');e+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=4&meshid='+b.split("/")[2]+'" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');if(debugmode==true){e+=addHtmlValue("Settings File",'<a href="meshsettings?id='+b.split("/")[2]+'" target="_blank">'+EscapeHtml(a.name)+" settings (.msh)</a>")}e+="</div>";e+="<div id=agins_linux style=display:none>To add a computer to "+EscapeHtml(a.name)+" run the following command. Root credentials will be needed.<br />";e+="<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";e+="</div>";e+='<div id=agins_windows_un style=display:none>To remove a mesh agent, download the file below, run it and click "uninstall".<br /><br />';e+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');e+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');e+="</div>";e+="<div id=agins_linux_un style=display:none>To remove a mesh agent, run the following command. Root credentials will be needed.<br />";e+="<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";e+="</div>";setDialogMode(2,"Add Mesh Agent",9,null,e);var d=serverinfo.name;if((d=="un-configured")||((features&2)!=0)){d=window.location.hostname}if(serverinfo.https==true){var c=(serverinfo.port==443)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget -q https://"+d+c+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+d+c+" '"+b.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget -q https://"+d+c+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}else{var c=(serverinfo.port==80)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget -q http://"+d+c+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+d+c+" '"+b.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget -q http://"+d+c+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}Q("aginsSelect").focus()}function addAgentToMeshClick(){var a=Q("aginsSelect").value;QV("agins_windows",a==0);QV("agins_linux",a==1);QV("agins_windows_un",a==2);QV("agins_linux_un",a==3)}function validateDeviceToMesh(){QE("idx_dlgOkButton",(Q("dp1devicename").value.length>0)&&(passwordcheck(Q("dp1password").value)))}function addDeviceToMeshEx(b,d){var a=Q("dp1username").value;if(a==""){a="admin"}var c=Q("dp1hostname").value;if(c==""){c=Q("dp1devicename").value}meshserver.send({action:"addamtdevice",meshid:d,devicename:Q("dp1devicename").value,hostname:c,amtusername:a,amtpassword:Q("dp1password").value,amttls:Q("dp1tls").value})}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel&reg; AMT is routable.">Intel&reg; AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function selectallButtonFunction(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}for(var c=0;c<b.length;c++){b[c].checked=(a==0)}p1updateInfo()}function p1updateInfo(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}if(a>0){QE("GroupActionButton",true);Q("SelectAllButton").value="Select None";QV("cxmgroupsplit",true);QV("cxmdesktop",true)}else{QE("GroupActionButton",false);Q("SelectAllButton").value="Select All";QV("cxmgroupsplit",false);QV("cxmdesktop",false)}}function groupActionFunction(){var a="Select an operation to perform on all selected devices. Actions will be performed only with proper rights.<br /><br />";a+=addHtmlValue("Operation","<select id=d2groupop style=float:right;width:250px><option value=100>Wake-up devices</option><option value=4>Sleep devices</option><option value=3>Reset devices</option><option value=2>Power off devices</option><option value=101>Delete devices</option></select>");setDialogMode(2,"Group Action",3,groupActionFunctionEx,a)}function getCheckedDevices(){var e=[],b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){if(b[c].value){var d=b[c].value.substring(6);if(e.indexOf(d)==-1){e.push(d)}}}}return e}function groupActionFunctionEx(){var a=Q("d2groupop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:getCheckedDevices()})}else{if(a==101){var b="Confirm delete selected devices(s)?<br /><br />";b+="<input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />Confirm";setDialogMode(2,"Delete Nodes",3,groupActionFunctionDelEx,b);QE("idx_dlgOkButton",false)}else{meshserver.send({action:"poweraction",nodeids:getCheckedDevices(),actiontype:a})}}}function d2groupActionFunctionDelEx(){QE("idx_dlgOkButton",Q("d2check").checked)}function groupActionFunctionDelEx(){meshserver.send({action:"removedevices",nodeids:getCheckedDevices()})}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d>f){return -1}if(d<f){return 1}if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function onSearchFocus(a){searchFocus=a}function onMapSearchFocus(a){mapSearchFocus=a}function onUserSearchFocus(a){userSearchFocus=a}function onConsoleFocus(a){consoleFocus=a}function onSearchInputChanged(){var g=Q("SearchInput").value.toLowerCase().trim();putstore("search",g);if(g==""){for(var a in nodes){nodes[a].v=true}}else{try{var c=g.split(/\s+/).join("|"),e=new RegExp(c);for(var a in nodes){nodes[a].v=(e.test(nodes[a].name.toLowerCase()))||(nodes[a].rnamel!=null&&e.test(nodes[a].rnamel.toLowerCase()));if((nodes[a].v==false)&&nodes[a].tags){for(var f in nodes[a].tags){if(e.test(nodes[a].tags[f].toLowerCase())){nodes[a].v=true;break}else{nodes[a].v=false}}}}}catch(b){for(var a in nodes){nodes[a].v=true}}}updateDevices()}var contextelement=null;function handleContextMenu(c){hideContextMenu();var d=(window.pageXOffset!==null)?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;var e=(window.pageYOffset!==null)?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;var b=document.elementFromPoint(c.pageX-d,c.pageY-e);if(b&&b!=null&&b.id=="MxMESH"){contextelement=b;var a=document.getElementById("meshContextMenu");a.style.left=c.pageX+"px";a.style.top=c.pageY+"px";a.style.display="block"}else{while(b&&b!=null&&b.id!="devs"){b=b.parentElement}if(!b||b==null){return true}contextelement=b;var a=document.getElementById("contextMenu");a.style.left=c.pageX+"px";a.style.top=c.pageY+"px";a.style.display="block"}return haltEvent(c)}function cmaction(a){var b=contextelement.children[1].attributes.onclick.value;b=b.substring(12,b.length-2);if(a==1){gotoDevice(b,10)}if(a==2){gotoDevice(b,12)}if(a==3){gotoDevice(b,11)}if(a==4){gotoDevice(b,13)}if(a==5){gotoDevice(b,16)}if(a==6){gotoDevice(b,15)}if(a==7){Q("viewselect").value=3;Q("viewselect").onchange();Q("autoConnectDesktopCheckbox").checked=true;Q("autoConnectDesktopCheckbox").onclick()}}function cmmeshaction(a){var d=contextelement.attributes.onclick.value.substring(32,(32+69));var b=document.getElementsByClassName("DeviceCheckbox");if(a==1){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=true}}}if(a==2){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=false}}}p1updateInfo()}function hideContextMenu(){QV("contextMenu",false);QV("meshContextMenu",false);contextelement=null}var xxmap={map:null,contextmenu:null,activeInteractions:[],showindex:0,markersSource:null,markersLayer:null,mapLayer:null,mapView:null,};function updateMapMarkers(h){if((xxmap!=null)&&(xxmap.map==null)){try{loadmap()}catch(b){console.error("loadmap() exception",b)}}if(xxmap==null){return}var a=null;for(var d in nodes){try{var f=map_parseNodeLoc(nodes[d]);var c=xxmap.markersSource.getFeatureById(nodes[d]._id);if((f!=null)&&((nodes[d].meshid==h)||(h==null))){var e=f[0],g=f[1],j=f[2];if(a==null){a=[e,g,e,g,0]}else{if(e<a[0]){a[0]=e}if(g<a[1]){a[1]=g}if(e>a[2]){a[2]=e}if(g>a[3]){a[3]=g}}if(c==null){addFeature(nodes[d]);a[4]=1}else{updateFeature(nodes[d],c);c.setStyle(markerStyle(nodes[d],f[2]))}}else{if(c){xxmap.markersSource.removeFeature(c)}}}catch(b){console.error("updateMapMarkers() exception",b,JSON.stringify(nodes[d]))}}return a}var map_cm_popup=new ol.Overlay({element:Q("xmap-info-window"),positioning:"bottom-center",stopEvent:false});var map_cm_editMarker={text:"Modify node location",callback:function(a){modifyMarkerloc(a.data)}};var map_cm_clearMarker={text:"Remove node location",callback:function(a){meshserver.send({action:"changedevice",nodeid:a.data.a,userloc:[]})}};var map_cm_saveMarker={text:"Save node location",callback:function(a){saveMarkerloc(a.data)}};var map_cm_nodemenu_items=[{text:"General information",callback:function(a){if(a.data!=null){gotoDevice(a.data,10)}}},{text:"Desktop",callback:function(a){if(a.data!=null){gotoDevice(a.data,11)}}},{text:"Terminal",callback:function(a){if(a.data!=null){gotoDevice(a.data,12)}}},{text:"Intel&reg; AMT",callback:function(a){if(a.data!=null){gotoDevice(a.data,14)}}},"-",{text:"Zoom-in to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,19)}},{text:"Zoom-out to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,2)}}];var contextmenu_items=[{text:"Refresh",callback:function(){refreshMap(true,true)}},{text:"Zoom to fit extent",callback:function(){zoomToFitExtent()}},{text:"Center map here",callback:function(a){xxmap.mapView.animate({center:a.coordinate})}},{text:"Place node here",callback:function(a){placeNode(a.coordinate)}}];function stringToIntHash(c){var a=0,b;for(b=0;b<c.length;b++){a=((a<<5)-a)+c.charCodeAt(b);a|=0}return a}function map_parseNodeLoc(b){var a=null,c=0;if(b.iploc){a=b.iploc;c=1}if(b.wifiloc){a=b.wifiloc;c=2}if(b.gpsloc){a=b.gpsloc;c=3}if(b.userloc){a=b.userloc;c=4}if((a==null)||(typeof a!="string")){return}a=a.split(",");if(c==1){return[parseFloat(a[0])+(stringToIntHash(b._id.substring(0,20))/100000000000),parseFloat(a[1])+(stringToIntHash(b._id.substring(20))/100000000000),c]}else{return[parseFloat(a[0]),parseFloat(a[1]),c]}}function loadmap(){if(xxmap==null){return}try{xxmap.markersSource=new ol.source.Vector();xxmap.markersLayer=new ol.layer.Vector({source:xxmap.markersSource});xxmap.mapLayer=new ol.layer.Tile({source:new ol.source.OSM()});xxmap.mapView=new ol.View({center:ol.proj.transform([0,0],"EPSG:4326","EPSG:3857"),zoom:2,minZoom:2,maxZoom:20,extent:ol.proj.transformExtent([-100000,-69.55,100000,69.55],"EPSG:4326","EPSG:3857")});xxmap.map=new ol.Map({target:"xdevicesmap",layers:[xxmap.mapLayer,xxmap.markersLayer],view:xxmap.mapView});xxmap.map.addOverlay(map_cm_popup);xxmap.map.on("click",function(c){var d=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});if(d){var f=d.getId();if(f!=null){gotoDevice(f,10)}else{var e=getCorrespondingFeature(d);gotoDevice(e.getId(),10)}}});xxmap.map.on("pointermove",function(d){var f=xxmap.map.forEachFeatureAtPixel(d.pixel,function(h,j){return h});if(f){xxmap.map.getTargetElement().style.cursor="pointer";var c=f.getGeometry().getCoordinates();map_cm_popup.setPosition(c);var e=f.getId();if(e){QH("xmap-info-window",f.get("name"))}else{var g=getCorrespondingFeature(f);QH("xmap-info-window",g.get("name"))}}else{xxmap.map.getTargetElement().style.cursor="";QH("xmap-info-window","")}});var a=new ContextMenu({width:160,defaultItems:false,items:contextmenu_items});a.on("open",function(c){var e=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});xxmap.contextmenu.clear();if(e){var d=e.getId();if(d){addContextMenuItems(e)}else{var f=getCorrespondingFeature(e);if(f){addContextMenuItems(f)}else{xxmap.contextmenu.extend(contextmenu_items)}}}else{xxmap.contextmenu.extend(contextmenu_items)}});if(xxmap.contextmenu==null){xxmap.contextmenu=a}xxmap.map.addControl(xxmap.contextmenu)}catch(b){console.log(b);QV("viewselectmapoption",false);xxmap=null}}function addFeature(f,c,e){var a=getModifiedFeature(f._id);if(a){xxmap.markersSource.addFeature(a)}else{if(!c&&!e){var d=map_parseNodeLoc(f);c=d[0];e=d[1]}if(e>180){e=180-e;meshserver.send({action:"changedevice",nodeid:f._id,userloc:[c,e]})}if((c<90)&&(c>-90)&&(e<180)&&(e>-180)){var b=new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([e,c],"EPSG:4326","EPSG:3857")),name:f.name,status:f.conn,lat:c,lon:e});b.setId(f._id);b.setStyle(markerStyle(f));xxmap.markersSource.addFeature(b)}}}function removeFeature(b){var a=xxmap.markersSource.getFeatureById(b._id);if(a){xxmap.markersSource.removeFeature(a)}}function updateFeature(d,a){if(d.conn!=a.get("status")){a.set("status",d.conn);a.setStyle(markerStyle(d))}var b=map_parseNodeLoc(d);lat=b[0];lon=b[1];if((lat!=a.get("lat"))||(lon!=a.get("lon"))){a.set("lat",lat);a.set("lon",lon);var c=ol.proj.transform([parseFloat(lon),parseFloat(lat)],"EPSG:4326","EPSG:3857");a.getGeometry().setCoordinates(c)}if(d.name!=a.get("name")){a.set("name",d.name)}}function modifyMarkerloc(c){var b=c.getId();if(b){c.setStyle(markerStyle(getNodeFromId(c.a),4));if(!getActiveInteractions(c)){var a=new ol.interaction.Modify({features:new ol.Collection([c]),pixelTolerance:10});xxmap.activeInteractions.push({featureid:b,feature:c,interaction:a});xxmap.map.addInteraction(a)}}}function saveMarkerloc(d){var c=d.getId();if(c){var a=getActiveInteractions(d);if(a){xxmap.map.removeInteraction(a);removeInteraction(c);var b=d.getGeometry().getCoordinates();var e=ol.proj.transform(b,"EPSG:3857","EPSG:4326");if(e[0]>180){e[0]=180-e[0]}var f=[e[1],e[0]];meshserver.send({action:"changedevice",nodeid:c,userloc:f})}}}function markerStyle(b,d){if(d==null){d=0;if(b.iploc){d=1}if(b.wifiloc){d=2}if(b.gpsloc){d=3}if(b.userloc){d=4}}var e=["","-ip","-wifi","-gps","-user"];var a=connStateColor(b);var c=new ol.style.Style({image:new ol.style.Icon({color:a,anchor:[0.5,1],src:"images/mapmarker"+e[d]+".png"})});return[c]}function connStateColor(a){if(a.conn==1||a.conn==3||a.conn==5){return"#00ffdd"}return"#C70039"}function addContextMenuItems(a){if(getActiveInteractions(a)){map_cm_saveMarker.data=a;xxmap.contextmenu.push(map_cm_saveMarker)}else{map_cm_editMarker.data=a;xxmap.contextmenu.push(map_cm_editMarker);var b=getNodeFromId(a.a);if(b.userloc){map_cm_clearMarker.data=a;xxmap.contextmenu.push(map_cm_clearMarker)}}map_cm_nodemenu_items.forEach(function(c){if(c.text=="Zoom-in to extent"||c.text=="Zoom-out to extent"){c.data=a}else{c.data=a.getId()}});xxmap.contextmenu.extend(map_cm_nodemenu_items)}function getActiveInteractions(b){var a=b.getId();for(var c=0;c<xxmap.activeInteractions.length;c++){if(xxmap.activeInteractions[c].featureid==a){return xxmap.activeInteractions[c].interaction}}return false}function getModifiedFeature(a){if(a){for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid==a){return xxmap.activeInteractions[b].feature}}}return null}function removeInteraction(a){var c=-1;for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid===a){c=b;break}}if(c>=0){xxmap.activeInteractions.splice(c,1)}}function getCorrespondingFeature(e){var d=e.getGeometry().getCoordinates();for(var b=0;b<xxmap.activeInteractions.length;b++){var c=xxmap.activeInteractions[b].feature;var a=c.getGeometry().getCoordinates();if(a[0].toFixed(5)==d[0].toFixed(5)&&a[1].toFixed(5)==d[1].toFixed(5)){return c}}return null}function refreshMap(h,g){if(h){xxmap.map.setTarget(null);xxmap.map=null;xxmap.markersSource=null;xxmap.mapView=null;xxmap.mapLayer=null;xxmap.activeInteractions=[]}var a=updateMapMarkers();if((a!=null)&&(g||(a[4]==1))){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var k=xxmap.map.getView();k.setCenter(ol.proj.transform([c,b],"EPSG:4326","EPSG:3857"));var e=360,f=-2;while(e>d){f++;e=e/2}k.setZoom(f)}}function placeNode(a){if(xxdialogMode){return}var c='<div style=margin-bottom:6px><label for=selectnode-search>Search</label>&nbsp&nbsp<input type=text placeholder="Device name" id="selectnode-search" onchange=onPlaceNodeInputChange() onkeyup=onPlaceNodeInputChange() autocomplete=off style=width:120px></div><div id=placenode style="height:254px;overflow-y:auto;width:100%;margin:12px 1px 4px 1px;"><div id=noNodesMapPlace style=text-align:center;width:100%;display:none>No devices found.</div>';for(var b in nodes){c+="<div class=noselect id="+nodes[b]._id+"-rowid onclick=selectNodeToPlace(event,'"+nodes[b]._id+"') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id="+nodes[b]._id+"-checkid type=checkbox style=width:16px;display:inline />";c+="<div class=j"+nodes[b].icon+" style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>"+nodes[b].name+"</div></div>"}setDialogMode(2,"Select a node to place",3,placeNodeEx,c+"</div>",a);onPlaceNodeInputChange()}function placeNodeEx(b,c){var d=document.getElementsByName("PlaceMapDeviceCheckbox");for(var f in d){if(d[f].checked){var g=getNodeFromId(d[f].id.substring(0,d[f].id.length-8));if(g){var e=xxmap.markersSource.getFeatureById(f);var h=ol.proj.transform(c,"EPSG:3857","EPSG:4326");var j=[h[1],h[0]];if(e){e.getGeometry().setCoordinates(c);var a=getActiveInteractions(e);if(a){saveMarkerloc(e)}else{meshserver.send({action:"changedevice",nodeid:g._id,userloc:j})}}else{meshserver.send({action:"changedevice",nodeid:g._id,userloc:j})}}}}}function onPlaceNodeInputChange(){updatePlaceNodeTable(Q("selectnode-search").value.trim().toLowerCase())}function updatePlaceNodeTable(d){var b=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var c in nodes){var e=((nodes[c].namel.indexOf(d)>=0||d=="")||(nodes[c].rnamel!=null&&nodes[c].rnamel.indexOf(d)>=0));if(e){a++}QV(nodes[c]._id+"-rowid",e)}QV("noNodesMapPlace",a==0)}function selectNodeToPlace(b,f){if(b.target.name!="PlaceMapDeviceCheckbox"){var g=Q(f+"-checkid");g.checked=!g.checked}var c=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var d in c){if(c[d].checked){a++}}QE("idx_dlgOkButton",a>0)}function addMeshOptions(a,b){}function meshOptionRmvMod(a,b){}function meshExists(){for(var a in meshes){if(meshes[a]){return true}}return false}function setMeshView(a){var c=Q("select-mesh");var b=c.selectedIndex;if(c[b].value==a){c[0].selected=true;onSelectMeshChange()}}function clearMeshOptions(){}function getSearchLocation(){try{var b=Q("mapSearchLocation").value.trim();if(b.length>0){var c=new XMLHttpRequest();c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){formatSearchData(c.responseText)}};c.open("GET","https://nominatim.openstreetmap.org/search?q="+b+"&format=json",true);c.send()}}catch(a){}}function formatSearchData(c){try{QH("xmapSearchResults","");var d=JSON.parse(c),b=0,j='<div style="overflow-y:auto;width:100%;max-height:240px">';for(var h=0;h<d.length;h++){if(d[h].display_name&&d[h].boundingbox[0]&&d[h].boundingbox[1]&&d[h].boundingbox[2]&&d[h].boundingbox[3]){b++;var a=(h%2==0)?"F5F5F5":"EBEBEB";j+="<div style=cursor:pointer;padding:5px;background-color:#"+a+" onclick=mapGotoSelectedLocation(this)><div>"+d[h].display_name+"</div><div style=display:none>"+d[h].boundingbox[0]+"!#!"+d[h].boundingbox[1]+"!#!"+d[h].boundingbox[2]+"!#!"+d[h].boundingbox[3]+"</div></div>"}}j+="</div>";if(b==1){var g=[parseFloat(d[0].boundingbox[2]),parseFloat(d[0].boundingbox[0]),parseFloat(d[0].boundingbox[3]),parseFloat(d[0].boundingbox[1])];zoomToExtent(g)}else{if(b==0){j="<div style=width:200px>No location found.<div>"}QV("xmapSearchResultsDlg",true)}QH("xmapSearchResults",j)}catch(f){}}function mapGotoSelectedLocation(c){var d=c.children;var a=d[1].innerHTML.split("!#!");var b=[parseFloat(a[2]),parseFloat(a[0]),parseFloat(a[3]),parseFloat(a[1])];zoomToExtent(b);mapCloseSearchWindow()}function mapCloseSearchWindow(){QH("xmapSearchResults","");QV("xmapSearchResultsDlg",false)}function zoomToLocation(a,c){var b=xxmap.map.getView();b.setCenter(a);b.setZoom(c)}function zoomToFitExtent(){var b=xxmap.markersSource.getFeatures();if(b.length>0){var a=xxmap.markersSource.getExtent();xxmap.map.getView().fit(a,xxmap.map.getSize())}}function zoomToExtent(b){var a=ol.proj.transformExtent(b,ol.proj.get("EPSG:4326"),ol.proj.get("EPSG:3857"));xxmap.map.getView().fit(a,xxmap.map.getSize())}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(n,p,s){var m=getNodeFromId(n);var j=meshes[m.meshid];var k=j.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=m._id||s==true){currentNode=m;var l=EscapeHtml(m.name);if(l.length==0){l="<i>None</i>"}if((k&4)!=0){l='<span title="Click here to edit the server-side device name" onclick=showEditNodeValueDialog(0) style=cursor:pointer>'+l+' <img src="images/link5.png" /></span>'}QH("p10deviceName",l);QH("p11deviceName",l);QH("p12deviceName",l);QH("p13deviceName",l);QH("p14deviceName",l);QH("p15deviceName",l);QH("p16deviceName",l);var v="<table style=width:100%>";v+=addDeviceAttribute('<span title="The name of the administrative group this computer belong to">Mesh</span>','<a title="The name of the group this computer belong to" onclick=gotoMesh("'+m.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[m.meshid].name)+"</a>");if((m.rname!=null)&&(m.name!=m.rname)){v+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(m.rname)+"</span>")}if((features&1)==0){if((k&4)!=0){if(m.host){v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(m.host)+"</span>")}else{v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{v+=addDeviceAttribute("Hostname",EscapeHtml(m.host))}}var f=m.desc?EscapeHtml(m.desc):"<i>None</i>";if((k&4)!=0){v+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+f+"</span>")}else{v+=addDeviceAttribute("Description",f)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((m.agent!=null)&&(m.agent.id!=null)&&(m.agent.ver!=null)){var t="";if(m.agent.id<=a.length){t=a[m.agent.id]}else{t=a[0]}if(m.agent.ver!=0){t+=" v"+m.agent.ver}v+=addDeviceAttribute("Mesh Agent",t)}if(m.intelamt!=null){var t="";var r={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(m.intelamt.ver!=null&&m.intelamt.state==null){t+="<i>Unknown State</i>, v"+m.intelamt.ver}else{if((m.intelamt.ver==null)&&(m.intelamt.state==2)){t+="<i>Activated</i>"}else{if((m.intelamt.ver==null)||(m.intelamt.state==null)){t+="<i>Unknown Version & State</i>"}else{t+=r[m.intelamt.state];if(m.intelamt.flags){if(m.intelamt.flags&2){t+=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(m.intelamt.flags&4){t+=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}t+=(", v"+m.intelamt.ver)}}}if(m.intelamt.tls==1){t+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(m.intelamt.state==2){if(m.intelamt.user==null||m.intelamt.user==""){if((k&4)!=0){t+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel&reg; AMT credentials" onclick=editDeviceAmtSettings("'+m._id+'")>No Credentials</i>'}else{t+=", <i style=color:#FF0000>No Credentials</i>"}}t+=" ";if((k&4)!=0){t+='<img src=images/link4.png height=10 width=10 title="Edit Intel&reg; AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+m._id+'")>'}}v+=addDeviceAttribute("Intel&reg; AMT",t)}if((m.agent!=null)&&(m.agent.tag!=null)&&(m.agent.tag!="mailto:")){var u=EscapeHtml(m.agent.tag);if(u.startsWith("mailto:")){u='<a href="'+u+'">'+u.substring(7)+"</a>"}v+=addDeviceAttribute("Agent Tag",u)}var c=m.conn;if(c&&c>1){var e=[];if((m.conn&1)!=0){e.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>')}if((m.conn&2)!=0){e.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">Intel&reg; AMT CIRA</span>')}if((m.conn&4)!=0){e.push('<span title="Intel&reg; AMT is routable and ready for use.">Intel&reg; AMT</span>')}if((m.conn&8)!=0){e.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>')}v+=addDeviceAttribute("Connectivity",e.join(", "))}var g="<i>None</i>";if(m.tags!=null){g="";for(var h in m.tags){g+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+m.tags[h]+"</span>"}}v+=addDeviceAttribute("Groups","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+g+"</span>");v+="</table><br />";if((k&76)!=0){v+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}v+='<input type=button value=Notes title="View notes about this device" onclick=showNotes('+((k&128)==0)+',"'+encodeURIComponent(m._id)+'") />';QH("p10html",v);drawDeviceTimeline();v="<div style=float:right;font-size:x-small>";if((k&4)!=0){v+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+m._id+'") title="Remove this device">Delete Device</a>'}v+="</div><div style=font-size:x-small>";if(j.mtype==2){v+='<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("'+m._id+'") title="Show device network interface information">Interfaces</a>&nbsp;'}if(xxmap!=null){v+='<a style=cursor:pointer onclick=p10showNodeLocationDialog("'+m._id+'") title="Show device locations information">Location</a>&nbsp;'}if(((k&8)!=0)&&(j.mtype==2)){v+='<a style=cursor:pointer onclick=p10showMeshCmdDialog(1,"'+m._id+'") title="Traffic router used to connect to a device thru this server.">Router</a>&nbsp;'}if(((c&1)!=0)&&(clickOnce==true)&&(j.mtype==2)&&((k&8)!=0)){if((m.agent.id>0)&&(m.agent.id<5)){v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","RDP2",3389) title="Requires Microsoft ClickOnce support in your browser.">RDP</a>&nbsp;'}if(m.agent.id>4){v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","PSSH",22) title="Requires Microsoft ClickOnce support in your browser.">Putty</a>&nbsp;';v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","WSCP",22) title="Requires Microsoft ClickOnce support in your browser.">WinSCP</a>&nbsp;'}}v+="</div><br>";QH("p10html3",v);var q=PowerStateStr(m.state);if((c&1)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Agent connected">Agent connected</span>'}if((c&2)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Intel&reg; AMT connected">Intel&reg; AMT connected</span>'}if((c&4)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Intel&reg; AMT detected">Intel&reg; AMT detected</span>'}QH("MainComputerState",q);Q("MainComputerImage").setAttribute("src","images/icons200-"+m.icon+"-1.png");Q("MainComputerImage").className=((!m.conn)||(m.conn==0)?"gray":"");setupTerminal();setupFiles();var d=((k&16)!=0);if(d){setupConsole()}else{if(p==15){p=10}}QV("MainDevDesktop",((j.mtype==1)||(m.agent==null)||(m.agent.caps==null)||((m.agent.caps&1)!=0))&&(k&8));QV("MainDevTerminal",((j.mtype==1)||(m.agent==null)||(m.agent.caps==null)||((m.agent.caps&2)!=0))&&(k&8));QV("MainDevFiles",((j.mtype==2)&&((m.agent==null)||(m.agent.caps==null)||((m.agent.caps&4)!=0)))&&(k&8));QV("MainDevAmt",(m.intelamt!=null)&&((m.intelamt.state==2)||(m.conn&2))&&(k&8));QV("MainDevConsole",(d&&(j.mtype==2)&&((m.agent==null)||(m.agent.caps==null)||((m.agent.caps&8)!=0)))&&(k&8));QV("p15uploadCore",(m.agent!=null)&&(m.agent.caps!=null)&&((m.agent.caps&16)!=0)&&(userinfo.siteadmin==4294967295));QH("p15coreName",((m.agent!=null)&&(m.agent.core!=null))?m.agent.core:"");var b=Q("p14iframe").contentWindow.getCurrentMeshNode();if((b!=null)&&(b._id!=currentNode._id)){Q("p14iframe").contentWindow.disconnect()}var o=((m.conn&6)!=0)?true:false;Q("p14iframe").contentWindow.setConnectionState(o);Q("p14iframe").contentWindow.setFrameHeight("650px");Q("p14iframe").contentWindow.setAuthCallback(updateAmtCredentials);QV("deskActionsBtn",(k&72)!=0);QV("termActionsBtn",(k&72)!=0);QV("filesActionsBtn",(k&72)!=0);if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}QV("DeskTools",false);showDeskToolsProcesses();refreshDeviceEvents()}setupDesktop();if(!p){p=10}go(p)}function showNotes(b,a){if(xxdialogMode){return}setDialogMode(2,"Notes",2,showNotesEx,"<textarea id=d2devNotes ro="+b+" noteid="+a+" readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>Notes can be viewed and changed by other administrators.<span>",a);meshserver.send({action:"getNotes",id:decodeURIComponent(a)})}function showNotesEx(a,b){meshserver.send({action:"setNotes",id:decodeURIComponent(b),notes:encodeURIComponent(Q("d2devNotes").value)})}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:250px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateAmtCredentials(a){var b=getNodeFromId(currentNode._id);if((a==true)||(b.intelamt.user==null)||(b.intelamt.user=="")){editDeviceAmtSettings(currentNode._id,updateAmtCredentialsEx)}else{Q("p14iframe").contentWindow.connectButtonfunctionEx()}}function updateAmtCredentialsEx(a,b){Q("p14iframe").contentWindow.connectButtonfunctionEx()}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){if((currentNode==null)||(xxcurrentView<10)||(xxcurrentView>19)){return}var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(160+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td class=style7 style=width:180px>"+a+"</td><td class=style9 style=max-width:400px;overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel&reg; AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}var b='Are you sure you want to delete node "'+EscapeHtml(currentNode.name)+'"?<br /><br />';b+="<input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm";setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,b,a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10clickOnce(a,c,b){meshserver.send({action:"getcookie",nodeid:a,tcpport:b,tag:"clickonce",protocol:c})}var d2map=null;function p10showNodeLocationDialog(){if((xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){setDialogMode(0)}else{if(xxdialogMode){return}}var l=[],m=["iploc","wifiloc","gpsloc","userloc"],a=null;for(var j in m){if(currentNode[m[j]]!=null){var h=currentNode[m[j]].split(","),g=parseFloat(h[0]),k=parseFloat(h[1]);if((g<90)&&(g>-90)&&(k<180)&&(k>-180)){var e=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([k,g]))});e.setStyle(markerStyle(currentNode,parseInt(j)+1));l.push(e);if(a==null){a=[g,k,g,k,0]}else{if(g<a[0]){a[0]=g}if(k<a[1]){a[1]=k}if(g>a[2]){a[2]=g}if(k>a[3]){a[3]=k}}}}}var o=new ol.source.Vector({features:l});var n=new ol.layer.Vector({source:o});var p="<div id=d2map style=width:100%;height:300px></div>";setDialogMode(2,"Device Location",1,null,p,"@xxmap");var c=0,b=0,q=8;if(a!=null){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var f=360,q=-2;while(f>d){q++;f=f/2}}if(l.length==1){q=8}d2map=new ol.Map({target:"d2map",interactions:ol.interaction.defaults({dragPan:false,mouseWheelZoom:false}),layers:[new ol.layer.Tile({source:new ol.source.OSM()}),n],view:new ol.View({center:ol.proj.fromLonLat([c,b]),zoom:q})})}function p10showNodeNetInfoDialog(){if(xxdialogMode){return}setDialogMode(2,"Network Interfaces",1,null,"<div id=d2netinfo>Loading...</div>","if"+currentNode._id);meshserver.send({action:"getnetworkinfo",nodeid:currentNode._id})}function p10showMeshCmdDialog(a,b){if(xxdialogMode){return}var d="<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>";d+="<option value=3>Windows (32bit)</option>";d+="<option value=4>Windows (64bit)</option>";d+="<option value=5>Linux x86 (32bit)</option>";d+="<option value=6>Linux x86 (64bit)</option>";d+="<option value=25>Linux ARM, Raspberry Pi (32bit)</option>";d+="</select>";var c="";if(a==0){c+="<div>MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.<br /><br />"}if(a==1){c+='<div>Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />'}c+=addHtmlValue("Operating System",d);c+=addHtmlValue("MeshCmd",'<a id=meshcmddownloadid href="meshagents?meshcmd=3" target="_blank"></a>');if(a==0){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=generic" target="_blank">MeshAction (.txt)</a>')}if(a==1){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=route&nodeid='+b+'" target="_blank">MeshAction (.txt)</a>')}c+="</div>";setDialogMode(2,["Download MeshCmd","Network Router"][a],9,null,c);meshCmdOsClick()}function meshCmdOsClick(){var a=Q("aginsSelect").value,b="";Q("meshcmddownloadid").href="meshagents?meshcmd="+a;if(a==3){b="MeshCmd (Win32 executable)"}if(a==4){b="MeshCmd (Win64 executable)"}if(a==5){b="MeshCmd (Linux x86, 32bit)"}if(a==6){b="MeshCmd (Linux x86, 64bit)"}if(a==25){b="MeshCmd (Linux ARM, 32bit)"}QH("meshcmddownloadid",b)}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<br><div style=display:inline-block;width:40px></div>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div><br><br>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Groups"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:230px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktopNode;function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){var b=multiDesktop[currentNode._id];if(b!=null){QH("DeskParent","");var a=b.m.CanvasId;a.setAttribute("id","Desk");a.setAttribute("style","width:100%;-ms-touch-action:none;margin-left:0px");a.setAttribute("onmousedown","dmousedown(event)");a.setAttribute("onmouseup","dmouseup(event)");a.setAttribute("onmousemove","dmousemove(event)");a.removeAttribute("onclick");Q("DeskParent").appendChild(a);desktop=b;if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}desktop.onStateChanged=onDesktopStateChange;desktopNode=currentNode;onDesktopStateChange(desktop,desktop.State);delete multiDesktop[currentNode._id]}else{QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode}Q("Desk").addEventListener("DOMMouseScroll",function(c){return dmousewheel(c)});Q("Desk").addEventListener("mousewheel",function(c){return dmousewheel(c)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}QV("disconnectbutton1span",(a!=0));QV("connectbutton1span",(a==0)&&(c.mtype==2));QV("connectbutton1hspan",(a==0)&&((currentNode.intelamt!=null)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var d=((currentNode.conn&1)!=0);QE("connectbutton1",d);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QE("deskSaveBtn",a==3);QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(a!=0)&&(desktopsettings.showfocus));QE("DeskCAD",a==3);QE("DeskWD",a==3);QE("deskkeys",a==3);QV("DeskWD",(currentNode.agent)&&(currentNode.agent.id<5));QV("deskkeys",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToolsButton",d);QV("DeskToastButton",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToastButton",d);if(d==false){QV("DeskTools",false)}}var autoConnectDesktopTimer=null;function autoConnectDesktop(a){if(autoConnectDesktopTimer==null){autoConnectDesktopTimer=setInterval(connectDesktop,100)}else{clearInterval(autoConnectDesktopTimer);autoConnectDesktopTimer=null}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("DeskFocus",false);QV("termdisplays",false);deskFocusBtn.value="All Focus";if(fullscreen==true){deskToggleFull()}break;case 2:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktopsettings.showfocus==false){desktop.m.focusmode=0;deskFocusBtn.value="All Focus"}if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(desktop.state!=0)&&(desktopsettings.showfocus))}var fullscreen=false;function deskToggleFull(){fullscreen=!fullscreen;QV("mastheadx",!fullscreen);QV("masthead",!fullscreen);QV("topbar",!fullscreen);QV("p11deviceNameHeader",!fullscreen);QV("footer",!fullscreen);QV("column_l_bottomgap",!fullscreen);QV("idx_deskFullBtn2",fullscreen);QV("deskFullBtn",!fullscreen);if(fullscreen){QS("container").width="100%";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("column_l").padding="0";QS("column_l").width="100%"}else{QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("column_l").padding="0 15px";QS("column_l").width="930px";toggleFullScreen()}deskAdjust()}function deskToggleFocus(){desktop.m.focusmode=(desktop.m.focusmode+64)%192;Q("deskFocusBtn").value=["All Focus","Small Focus","Large Focus"][desktop.m.focusmode/64]}function deskAdjust(){var c=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("Desk").clientHeight+Q("deskarea4").clientHeight+2))/2;if(fullscreen){document.documentElement.style.overflow="hidden";QS("deskarea3x").height=null;if(c<0){var a=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("deskarea4").clientHeight));var b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}else{document.documentElement.style.overflow="auto";QS("deskarea3x").height=(desktop)?"40px":"400px";QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null;QS("Desk")["margin-top"]="0";QS("Desk")["margin-bottom"]="0"}}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.sendCtrlMsg('{"action":"lock"}')}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}else{if(a==5){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]])}}}}}}}}function sendCAD(){if(xxdialogMode||desktop==null||desktop.State!=3){return}desktop.m.sendcad()}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function toggleKvmControl(){putstore("DeskControl",(Q("DeskControl").checked?1:0))}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){desktop.m.mousedown(a)}}function dmouseup(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){desktop.m.mouseup(a)}}function dmousemove(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){desktop.m.mousemove(a)}}function dmousewheel(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var terminalNode;function setupTerminal(){if((terminalNode!=currentNode)&&(terminal!=null)){terminal.Stop();terminal=null}terminalNode=currentNode;updateTerminalButtons()}function updateTerminalButtons(){var b=meshes[terminalNode.meshid];var d=((terminal!=null)&&(terminal.state!=0));QV("disconnectbutton2span",(d==true));QV("connectbutton2span",(d==false)&&(b.mtype==2));QV("connectbutton2hspan",(d==false)&&((terminalNode.intelamt!=null)&&(b.mtype==1||terminalNode.intelamt.state==2)&&((terminalNode.intelamt.ver!=null)||(b.mtype==1))));var c=((terminalNode.conn&1)!=0);QE("connectbutton2",c);var a=((terminalNode.conn&6)!=0);QE("connectbutton2h",a);QE("ctrlcbutton",d);QE("ctrlxbutton",d);QE("escbutton",d);QE("bsbutton",d);QE("pastebutton",d);QE("specialkeylist",d);QE("specialkeylistinput",d)}function onTerminalStateChange(d,a){var c=a;if((c==3)&&(d.contype==2)){c++}var b=StatusStrs[c];if(terminal.webRtcActive==true){b+=", WebRTC"}QH("termstatus",b);switch(a){case 0:d.m.TermResetScreen();d.m.TermDraw();if(terminal!=null){terminal.Stop();terminal=null}break;case 3:break}updateTerminalButtons()}var autoConnectTerminalTimer=null;function autoConnectTerminal(a){if(autoConnectTerminalTimer==null){autoConnectTerminalTimer=setInterval(connectTerminal,100)}else{clearInterval(autoConnectTerminalTimer);autoConnectTerminalTimer=null}}function connectTerminal(b,a){if(!terminal){if(a==2){if((terminalNode.intelamt.user==null)||(terminalNode.intelamt.user=="")){editDeviceAmtSettings(terminalNode._id,connectTerminal);return}terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.debugmode=debugmode;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id,16994,"*","*",0);terminal.contype=2;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation]}else{terminal=CreateAgentRedirect(meshserver,CreateAmtRemoteTerminal("Term"),serverPublicNamePort);terminal.debugmode=debugmode;terminal.m.debugmode=debugmode;terminal.m.lineFeed=([1,2,3,4,21,22].indexOf(currentNode.agent.id)>=0)?"\r\n":"\r";terminal.attemptWebRTC=attemptWebRTC;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id);terminal.contype=1;terminal.m.terminalEmulation=0;Q("id_ttypebutton").value=terminalEmulations[0]}}else{terminal.Stop();terminal=null}Q("connectbutton2").blur()}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];function termToggleType(){if(!terminal||xxdialogMode){return}terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation];Q("id_ttypebutton").blur()}var fxEmulations=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"];function termToggleFx(){if(!terminal||xxdialogMode){return}terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3;Q("id_tfxkeysbutton").value=fxEmulations[terminal.m.fxEmulation];Q("id_tfxkeysbutton").blur()}function termSendKey(b,a){if(!terminal||xxdialogMode){return}terminal.m.TermSendKey(b);Q(a).blur()}function showTermPasteDialog(){if(!terminal||xxdialogMode){return}Q("pastebutton").blur();setDialogMode(2,"Paste",3,showTermPasteDialogEx,'<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');Q("d2pasteText").focus()}function showTermPasteDialogEx(){if(!terminal){return}terminal.m.TermSendKeys(Q("d2pasteText").value)}function sendSpecialKey(){terminal.m.TermSendKey(Q("specialkeylist").value);Q("specialkeylist").blur();Q("specialkeylistinput").blur()}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var n="",o="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",l="Root";var w=p13filetree.path.split("\\");p13filetreelocation=[];for(var p in w){if(w[p]!=""){p13filetreelocation.push(w[p])}}for(var p in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(p)+1)+")>"+p13filetreelocation[p]+"</a>"}var s=p13filetreelocation.join("/");var j=p13sort_files(p13filetree.dir);for(var p in j){var d=j[p],r=d.n,u;u=r;if(r.length>70){u='<span title="'+EscapeHtml(r)+'">'+EscapeHtml(r.substring(0,70))+"...</span>"}else{u=EscapeHtml(r)}r=EscapeHtml(r);var g="";if(d.d!=null){var e=new Date(d.d),g=(e.getMonth()+1)+"/"+(e.getDate())+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+"&nbsp;"}var k="";if(d.s!=null){k=getFileSizeStr(d.s)}var m="";if(d.t<3){var t="",v="";m="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right title=\""+v+'">'+t+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+u+"</a></span></div>"}else{var q=u;if(d.s>0){q='<a target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(s+"/"+r)+"','"+encodeURIComponent(r)+"',"+d.s+')">'+u+"</a>"}m="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span class=fsize>"+g+"</span><span style=float:right>"+k+"</span><span><div class=fileIcon"+d.t+"></div>"+q+"</span></div>"}if(d.t<3){n+=m}else{o+=m}}QH("p13files",n+o);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var p=0;p<a.length;p++){if(b.indexOf(p13filetree.dir[a[p].value].n)>=0){a[p].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="Select All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"Select None":"Select All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function p13fileDragDrop(a){haltEvent(a);QV("p13bigfail",false);QV("p13bigok",false);if(a.dataTransfer==null||a.dataTransfer.files.length==0||p13filetree==null){return}p13doUploadFiles(a.dataTransfer.files)}var p13dragtimer=null;function p13fileDragOver(b){haltEvent(b);if(p13dragtimer!=null){clearTimeout(p13dragtimer);p13dragtimer=null}var a=(p13filetree!=null);QV("p13bigok",a);QV("p13bigfail",!a)}function p13fileDragLeave(a){haltEvent(a);if(a.target.id!="p13filetable"){QV("p13bigfail",false);QV("p13bigok",false)}else{p13dragtimer=setTimeout(function(){QV("p13bigfail",false);QV("p13bigok",false);p13dragtimer=null},10)}}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText(JSON.stringify({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength}))};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentDeviceEvents=null;function devevents_update(){var g="",a=null;for(var c in currentDeviceEvents){var b=currentDeviceEvents[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("&reg;");g+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";g+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";g+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";g+="<div style=font-size:14px><span style=width:300px>"+f.toLocaleTimeString()+" - "+e+"</span></div></div></td></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p16events",g)}function refreshDeviceEvents(){meshserver.send({action:"events",nodeid:currentNode._id,limit:parseInt(p16limitdropdown.value)})}function agentConsoleHandleKeys(b){var d=0,a=Q("p15consoleText");if(b.key){if(b.keyCode==13&&consoleFocus==0){p15consoleSend(b);d=1}else{if(b.keyCode==8&&consoleFocus==0){var f=a.value;a.value=f.substring(0,f.length-1);d=1}else{if(b.keyCode==27){a.value="";d=1}else{if((b.keyCode==38)||(b.keyCode==40)){var c=consoleHistory.indexOf(a.value);if((b.keyCode==38)&&((consoleHistory.length-1)>c)){a.value=consoleHistory[c+1]}else{if((b.keyCode==40)&&(c>0)){a.value=consoleHistory[c-1]}else{if((b.keyCode==40)&&(c==0)){a.value=""}}}d=1}else{if(b.key.length===1){insertTextAtCursor(a,b.key);d=1}}}}}}else{if(b.charCode!=0&&consoleFocus==0){a.value=((a.value+String.fromCharCode(b.charCode)));d=1}}if(d>0){return haltEvent(b)}}function insertTextAtCursor(a,d){if(document.selection){a.focus();sel=document.selection.createRange();sel.text=d}else{if(a.selectionStart||a.selectionStart=="0"){var c=a.selectionStart,b=a.selectionEnd;a.value=a.value.substring(0,c)+d+a.value.substring(b,a.value.length);a.setSelectionRange(b+1,b+1)}else{a.value+=myValue}}}var consoleNode;function setupConsole(){var d=(consoleNode==currentNode);consoleNode=currentNode;var a=meshes[consoleNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&16)!=0){if(consoleNode.consoleText==null){consoleNode.consoleText=""}if(d==false){QH("p15agentConsoleText",consoleNode.consoleText);Q("p15agentConsole").scrollTop=Q("p15agentConsole").scrollHeight}var c=((consoleNode.conn&1)!=0)?true:false;QH("p15statetext",c?"Mesh Agent is online":"Mesh Agent is offline");QE("p15consoleText",c);QE("p15uploadCore",c)}else{QH("p15statetext","Access Denied");QE("p15consoleText",false);QE("p15uploadCore",false)}}function p15consoleClear(){QH("p15agentConsoleText","");Q("id_p15consoleClear").blur();consoleNode.consoleText=""}var consoleHistory=[];function p15consoleSend(a){if(a&&a.keyCode!=13){return}var d=Q("p15consoleText").value,c="<div style=color:green>&gt; "+EscapeHtml(Q("p15consoleText").value)+"<br/></div>";Q("p15agentConsoleText").innerHTML+=c;consoleNode.consoleText+=c;Q("p15agentConsole").scrollTop=Q("p15agentConsole").scrollHeight;Q("p15consoleText").value="";meshserver.send({action:"msg",type:"console",nodeid:consoleNode._id,value:d});if(d.length>0){var b=consoleHistory.indexOf(d);if(b>=0){consoleHistory.splice(b,1)}consoleHistory.unshift(d);consoleHistory.splice(10)}}function p15consoleReceive(b,a){a="<div>"+a+"</div>";if(b.consoleText==null){b.consoleText=a}else{b.consoleText+=a}if(consoleNode==b){Q("p15agentConsoleText").innerHTML+=a;Q("p15agentConsole").scrollTop=Q("p15agentConsole").scrollHeight}}function p15uploadCore(a){if(xxdialogMode){return}if(a.shiftKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(a.altKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(a.ctrlKey==true){p15uploadCore2()}else{setDialogMode(2,"Change Mesh Agent Core",3,p15uploadCoreEx,"<select id=d3coreMode style=float:right;width:260px><option value=1>Upload default server core</option><option value=2>Clear the core</option><option value=3>Upload a core file</option><option value=4>Soft disconnect agent</option><option value=5>Hard disconnect agent</option></select><div>Change Core</div>")}}}}function p15uploadCoreEx(){if(Q("d3coreMode").value==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(Q("d3coreMode").value==2){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(Q("d3coreMode").value==3){p15uploadCore2()}else{if(Q("d3coreMode").value==4){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:1})}else{if(Q("d3coreMode").value==5){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:2})}}}}}}function p15uploadCore2(){if(xxdialogMode){return}Q("d3localmodeform").action="uploadmeshcorefile.ashx";Q("d3attrib").value=currentNode._id;setDialogMode(3,"Upload Mesh Agent Core",3,p15uploadCoreEx2);d3init()}function p15uploadCoreEx2(){var b=Q("d3uploadMode").value;if(b==1){Q("d3submit").click()}else{var a=d3getFileSel();if(a.length==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:d3filetreelocation.join("/")+"/"+a[0]})}}}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a="Change your account e-mail address here.<br /><br />";a+=addHtmlValue("Email","<input id=dp2email style=width:230px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp2email").value=userinfo.email}account_validateEmail();Q("dp2email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp2email").value)&&(Q("dp2email").value!=userinfo.email));if((x==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp2email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="To delete this account, type in the account password in both boxes below and hit ok.<br /><br />";a+="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:80px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="Change your account password by entering the new password twice in the boxes below.<br /><br />";a+="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:60px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Password Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}var a="Create a new mesh computer group using the options below.<br /><br />";a+=addHtmlValue("Mesh Name","<input id=dp2meshname style=width:230px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Mesh Type","<div style=width:230px;margin:0;padding:0><select id=dp2meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Mesh Agent Policy</option><option value=1>Intel&reg; AMT Agent-less Policy</option></select></div>");a+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp2meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Mesh",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp2meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp2meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp2meshname").value,meshtype:Q("dp2meshtype").value,desc:Q("dp2meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value));var b="";if(Q("apassword1").value!=""){var a=checkPasswordStrength(Q("apassword1").value);if(a>=80){b="<span style=color:green>Strong<span>"}else{if(a>=60){b="<span style=color:blue>Good<span>"}else{b="<span style=color:red>Weak<span>"}}}QH("dxPassWarn",b)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function updateMeshes(){var e="";var a=0,b=0;for(i in meshes){if(a>1){e+="</tr><tr>";a=0}a++;b++;var d=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var f="Partial Rights";if(d==4294967295){f="Full Administrator"}else{if(d==0){f="No Rights"}}e+="<div style=display:inline-block;width:431px;height:50px;padding-top:1px;padding-bottom:1px;float:left><div style=float:left;width:30px;height:100%></div><div style=height:100%;cursor:pointer onclick=gotoMesh('"+i+"')><div class=mi style=float:left;width:50px;height:50px></div><div style=height:100%><div class=g1></div><div class=e2 style=width:300px><div class=e1>"+EscapeHtml(meshes[i].name)+"</div><div>"+f+"</div></div><div class=g2 style=float:left></div></div></div></div>"}meshcount=b;QH("p2meshes",e);QV("p2noMeshFound",b==0)}function gotoMesh(a){currentMesh=meshes[a];p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){e="Intel&reg; AMT computer group (No Agent)"}if(currentMesh.mtype==2){e="Mesh agent computer group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&&currentMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+=addHtmlValue("Identifier",currentMesh._id.split("/")[2]);k+='<br><input type=button value=Notes title="View notes about this mesh" onclick=showNotes(false,"'+encodeURIComponent(currentMesh._id)+'") />';k+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){k+="<a onclick=p20showAddMeshUserDialog() style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a>"}if((d&4)!=0){if(currentMesh.mtype==1){k+='<a onclick=addCiraDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel&reg; AMT computer that is located on the internet."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install CIRA</a>';k+='<a onclick=addDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel&reg; AMT computer that is located on the local network."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install local</a>'}if(currentMesh.mtype==2){k+='<a onclick=addAgentToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new computer to this mesh by installing the mesh agent."><img src=images/icon-addnew.png border=0 height=12 width=12> Install</a>'}}k+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name<m.name){return -1}return 0});for(var c in h){var j="",g="Partial Rights",f=h[c].rights;if(f==4294967295){g="Full Administrator"}else{if(f==0){g="No Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){j='<a onclick=p20deleteUser(event,"'+encodeURIComponent(h[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}k+='<tr onclick=p20viewuser("'+encodeURIComponent(h[c].id)+'") style=cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+'><td><div title="Mesh User" class=m2></div><div>&nbsp;'+h[c].name+"<div></div></div></td><td><div style=float:right>"+j+"</div><div>"+g+"</div></td></tr>";++a}k+="</tbody></table>";if(d==4294967295){k+="<div style=font-size:x-small;text-align:right><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Mesh Name","<input id=dp20meshname style=width:230px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp20meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Edit Mesh",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a="Allow a user to manage the mesh and computers on this mesh<br /><br />";a+=addHtmlValue("User Name","<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+="<br><div>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Mesh<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Mesh Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Mesh Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator (all rights)"}else{if((c&1)!=0){d+=", Edit Mesh"}if((c&2)!=0){d+=", Manage Mesh Users"}if((c&4)!=0){d+=", Manage Mesh Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User Name",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var filetreelinkpath;var filetreelocation=[];function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var q="",r="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",o="Root",z,k=filetree,m=1;var j=[],v=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var s=0;s<a.length;s++){if(a[s].checked){b.push(a[s].value)}}filetreelinkpath="";for(var s in filetreelocation){if((k.f!=null)&&(k.f[filetreelocation[s]]!=null)){j.push(filetreelocation[s]);o+=" / "+filetreelocation[s];if((m==1)){var C=filetreelocation[s].split("/");z=window.location+C[0]+"files/"+C[2];filetreelinkpath+=filetreelocation[s]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[s];if(m>2){z+="/"+filetreelocation[s]}}}k=k.f[filetreelocation[s]];c+=" / <a style=cursor:pointer onclick=p5folderup("+m+")>"+(k.n!=null?k.n:filetreelocation[s])+"</a>";m++}else{break}}filetreelocation=j;var w=o.toLowerCase().startsWith("root / "+userinfo._id+" / public");var l=p5sort_files(k.f);for(var s in l){var d=l[s],u=d.n,B;B=u;if(u.length>70){B='<span title="'+EscapeHtml(u)+'">'+EscapeHtml(u.substring(0,70))+"...</span>"}else{B=EscapeHtml(u)}u=EscapeHtml(u);var g="";if(d.d!=null){var e=new Date(d.d),g=(e.getMonth()+1)+"/"+(e.getDate())+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+"&nbsp;"}var n="";if(d.s!=null){n=getFileSizeStr(d.s)}var p="";if(d.t<3||d.t==4){var A=(d.t==1||d.t==4)?p5getQuotabar(d):"",D="";p="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+u+"'>&nbsp;<span style=float:right title=\""+D+'">'+A+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+B+"</a></span></div>"}else{var t=B;var y="";if(w){y=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+z+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){t='<a target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+B+"</a>"+y}p="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'>&nbsp;<span class=fsize>"+g+"</span><span style=float:right>"+n+"</span><span><div class=fileIcon"+d.t+"></div>"+t+"</span></div>"}if(d.t<3){q+=p}else{r+=p}}QH("p5rightOfButtons",p5getQuotabar(k));QH("p5files",q+r);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",w);if(v==filetreelinkpath){a=document.getElementsByName("fc");for(var s=0;s<a.length;s++){a[s].checked=(b.indexOf(a[s].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"Select None":"Select All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(e){a.push(e.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout(function(){QV("bigfail",false);QV("bigok",false);p5dragtimer=null},10)}}function events_update(){var g="",a=null;for(var c in events){var b=events[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("&reg;");if(b.username&&b.username!=userinfo.name){e+=": "+b.username}g+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";g+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";g+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";g+="<div style=font-size:14px><span style=width:300px>"+f.toLocaleTimeString()+" - "+e+"</span></div></div></td></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p3events",g)}function showDeleteAllEventsDialog(){if(xxdialogMode){return}var a="Delete all events in the server event log?<br /><br />";a+="<input id=p3check type=checkbox onchange=validateDeleteAllEventsDialog() />Confirm";setDialogMode(2,"Delete All Events",3,showDeleteAllEventsDialogEx,a);validateDeleteAllEventsDialog()}function validateDeleteAllEventsDialog(){QE("idx_dlgOkButton",Q("p3check").checked)}function showDeleteAllEventsDialogEx(a,b){meshserver.send({action:"clearevents"})}function refreshEvents(){meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)})}function updateUsers(){QV("MainMenuMyUsers",(users!=null)&&((features&4)==0));if((users==null)||((features&4)!=0)){QH("p3users","");return}var f=[],d=100,b=0;for(var c in users){f.push(c)}f.sort();var h=Q("UserSearchInput").value.toLowerCase();var j="<table style=width:100% cellpadding=0 cellspacing=0>",a=true;for(var c in f){var g=users[f[c]],e=null;if(wssessions!=null){e=wssessions[g._id]}if((e!=null)&&(g.name.toLowerCase().indexOf(h)>=0)){if(d>0){if(a){j+="<tr><td class=userTableHeader>Online Users";a=false}j+=addUserHtml(g,e);d--}else{b++}}}a=true;for(var c in f){var g=users[f[c]],e=null;if(wssessions!=null){e=wssessions[g._id]}if((e==null)&&(g.name.toLowerCase().indexOf(h)>=0)){if(d>0){if(a){j+="<tr><td class=userTableHeader>Offline Users";a=false}j+=addUserHtml(g,e);d--}else{b++}}}j+="</table>";if(b==1){j+="<br />1 more user not shown, use search box to look for users...<br />"}else{if(b>1){j+="<br />"+b+" more users not shown, use search box to look for users...<br />"}}if(d==100){j+="<br />No users found.<br />"}QH("p3users",j);if((currentUser!=null)&&(xxcurrentView==30)){gotoUser(encodeURIComponent(currentUser._id),true)}}function addUserHtml(g,f){var j="",b=" gray",c="m2",d="",e=(g.name!=userinfo.name);if(f!=null){b="";if(e){d+='<a onclick=showUserAlertDialog(event,"'+encodeURIComponent(g._id)+'")>'}if(f==1){d+="1 active session"}else{d+=f+" active sessions"}if(e){d+="</a>"}}else{if(g.login){d+='<span title="Last login: '+new Date(g.login).toLocaleString()+'">'+new Date(g.login).toLocaleDateString()+"</span>"}}if(d!=""){d+=", "}if(e){d+='<a onclick=showUserAdminDialog(event,"'+encodeURIComponent(g._id)+'")>'}if((g.siteadmin!=null)&&((g.siteadmin&32)!=0)&&(g.siteadmin!=4294967295)){d+="Locked, "}d+="<span title='Server Permissions'>";if((g.siteadmin==null)||(g.siteadmin==0)||(g.siteadmin==32)){d+="User"}else{if(g.siteadmin==8){d+="User with server files"}else{if(g.siteadmin==4294967295){d+="Administrator"}else{d+="Partial"}}}d+="</span>";if((g.quota!=null)&&((g.siteadmin&8)!=0)){d+=", "+(g.quota/1024)+" k"}if(e){d+="</a>"}var h=EscapeHtml(g.name),a="";if(serverinfo.emailcheck==true){a=((g.emailVerified!=true)?' <b style=color:red title="Email is not verified">&#x1F5F4</b>':' <b style=color:green title="Email is verified">&#x1F5F8</b>')}if(g.email!=null){h+=', <a onclick=doemail(event,"'+g.email+'")>'+g.email+"</a>"+a}j+='<tr><td style=cursor:pointer onclick=gotoUser("'+encodeURIComponent(g._id)+'")>';j+="<div class=bar style=height:24px;width:100%;font-size:medium>";j+='<div style=float:left;height:24px;width:24px;background-color:white><div class="'+c+b+'" style=width:16px;margin-top:4px;margin-left:2px;height:16px></div></div>';j+="<div class=g1 style=height:24px;float:left></div><div class=g2 style=height:24px;float:right></div>";j+="<div><span>"+h+"</span><span style=float:right>"+d+"</span></div></div>";return j}function showUserAlertDialog(a,b){if(xxdialogMode){return}haltEvent(a);setDialogMode(2,"Notify "+EscapeHtml(users[decodeURIComponent(b)].name),3,showUserAlertDialogEx,'Send a text notification to this user.<textarea id=d2notifyText maxlength=2048 style="width:100%;height:184px;resize:none"></textarea>',b);Q("d2notifyText").focus();return false}function showUserAlertDialogEx(a,b){meshserver.send({action:"notifyuser",userid:decodeURIComponent(b),msg:Q("d2notifyText").value})}function doemail(b,a){if(xxdialogMode){return}haltEvent(b);window.open("mailto:"+a);return false}function showCreateNewAccountDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Name","<input id=p4name style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Email","<input id=p4email style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Create Account",3,showCreateNewAccountDialogEx,a);showCreateNewAccountDialogValidate();Q("p4name").focus()}function showCreateNewAccountDialogValidate(){if((Q("p4email").value.length>0)&&(validateEmail(Q("p4email").value))==false){QE("idx_dlgOkButton",false);return}QE("idx_dlgOkButton",(!Q("p4name")||((Q("p4name").value.length>0)&&(Q("p4name").value.indexOf(" ")==-1)))&&Q("p4pass1").value.length>0&&Q("p4pass1").value==Q("p4pass2").value)}function showCreateNewAccountDialogEx(){meshserver.send({action:"adduser",username:Q("p4name").value,email:Q("p4email").value,pass:Q("p4pass1").value})}function showUserAdminDialog(a,c){if(xxdialogMode){return}haltEvent(a);c=decodeURIComponent(c);var d="<div>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 style=width:80px;text-align:right id=ua_fileaccessquota>k max, blank for default<br><hr/>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>";d+="<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>";d+="</div>";var b=users[c.toLowerCase()];setDialogMode(2,"Server Permissions",3,showUserAdminDialogEx,d,b);if(b.siteadmin&&b.siteadmin!=0){Q("ua_fulladmin").checked=(b.siteadmin==4294967295);Q("ua_serverbackup").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&1)!=0));Q("ua_manageusers").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&2)!=0));Q("ua_serverrestore").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&4)!=0));Q("ua_fileaccess").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&8)!=0));Q("ua_serverupdate").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&16)!=0));Q("ua_lockedaccount").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&32)!=0))}QE("ua_fulladmin",userinfo.siteadmin==4294967295);QE("ua_serverbackup",userinfo.siteadmin==4294967295);QE("ua_manageusers",userinfo.siteadmin==4294967295);QE("ua_serverrestore",userinfo.siteadmin==4294967295);QE("ua_fileaccess",userinfo.siteadmin==4294967295);QE("ua_serverupdate",userinfo.siteadmin==4294967295);Q("ua_fileaccessquota").value=(b.quota!=null)?(b.quota/1024):"";showUserAdminDialogValidate();return false}function showUserAdminDialogValidate(){if(userinfo.siteadmin==4294967295){QE("ua_serverbackup",!Q("ua_fulladmin").checked);QE("ua_manageusers",!Q("ua_fulladmin").checked);QE("ua_serverrestore",!Q("ua_fulladmin").checked);QE("ua_fileaccess",!Q("ua_fulladmin").checked);QE("ua_serverupdate",!Q("ua_fulladmin").checked);QE("ua_fileaccessquota",Q("ua_fileaccess").checked&&!Q("ua_fulladmin").checked)}}function showUserAdminDialogEx(a,d){var c=0,b=parseInt(Q("ua_fileaccessquota").value);if(Q("ua_fulladmin").checked==true){c=4294967295}else{if(Q("ua_serverbackup").checked==true){c+=1}if(Q("ua_manageusers").checked==true){c+=2}if(Q("ua_serverrestore").checked==true){c+=4}if(Q("ua_fileaccess").checked==true){c+=8}if(Q("ua_serverupdate").checked==true){c+=16}if(Q("ua_lockedaccount").checked==true){c+=32}}var e={action:"edituser",name:d.name,siteadmin:c};if(isNaN(b)==false){e.quota=(b*1024)}meshserver.send(e)}function onUserSearchInputChanged(){updateUsers()}var currentUser=null;function gotoUser(j,e){if(xxdialogMode&&!e){return}var h=currentUser=users[decodeURIComponent(j)];if(h==null){setDialogMode(0);go(4);return}QH("p30userName",h.name);QH("p31userName",h.name);var g=(h.name==userinfo.name),a=0;if(wssessions!=null&&wssessions[h._id]){a=wssessions[h._id]}Q("MainUserImage").classList.remove("gray");if(a==0){Q("MainUserImage").classList.add("gray")}var f="";if((h.siteadmin!=null)&&((h.siteadmin&32)!=0)&&(h.siteadmin!=4294967295)){f+="Locked account, "}if((h.siteadmin==null)||(h.siteadmin==0)||(h.siteadmin==32)){f+="No server rights"}else{if(h.siteadmin==8){f+="Access to server files"}else{if(h.siteadmin==4294967295){f+="Full administrator"}else{f+="Partial rights"}}}var k="<div style=min-height:80px><table style=width:100%>";var c=h.email?EscapeHtml(h.email):"<i>Not set</i>",d="";if(serverinfo.emailcheck){d=((h.emailVerified==true)?'<b style=color:green;cursor:pointer title="Email is verified">&#x1F5F8</b> ':'<b style=color:red;cursor:pointer title="Email not verified">&#x1F5F4</b> ')}k+=addDeviceAttribute("Email",d+'<a style=cursor:pointer onclick=p30showUserEmailChangeDialog(event,"'+j+'")>'+c+'</a> <a style=cursor:pointer onclick=doemail(event,"'+h.email+'")><img src="images/link1.png" /></a>');k+=addDeviceAttribute("Server Rights",'<a style=cursor:pointer onclick=showUserAdminDialog(event,"'+j+'")>'+f+"</a>");if(h.quota){k+=addDeviceAttribute("Server Quota",EscapeHtml(parseInt(h.quota)/1024)+" k")}k+=addDeviceAttribute("Creation",new Date(h.creation).toLocaleString());if(h.login){k+=addDeviceAttribute("Last Login",new Date(h.login).toLocaleString())}k+="</table></div><br />";k+='<input type=button value=Notes title="View notes about this user" onclick=showNotes(false,"'+j+'") />';if(!g&&(a>0)){k+='<input type=button value=Notify title="Send user notification" onclick=showUserAlertDialog(event,"'+j+'") />'}QH("p30html",k);drawUserTimeline();var b=true;if(h._id==userinfo._id){b=false}if(h.siteadmin&&h.siteadmin>0&&userinfo.siteadmin!=4294967295){b=false}k="<div style=float:right;font-size:x-small>";if(b){k+='<a style=cursor:pointer onclick=p30showDeleteUserDialog() title="Remove this user">Delete User</a>'}k+="</div><div style=font-size:x-small>";if(userinfo.siteadmin==4294967295){k+='<a style=cursor:pointer onclick=p30showUserChangePassDialog() title="Change the password for this user">Change Password</a>'}k+="</div><br>";QH("p30html3",k);k="";if(a==1){k="1 active session"}else{if(a>1){k=a+" active sessions"}}QH("MainUserState",k);go(30);QH("p31events","");refreshUsersEvents()}function p30showUserEmailChangeDialog(a){if(xxdialogMode){return}var b="";b+=addHtmlValue("Email","<input id=dp30email style=width:230px maxlength=32 onchange=p30validateEmail() onkeyup=p30validateEmail() />");if(serverinfo.emailcheck){b+=addHtmlValue("Status","<select id=dp30verified style=width:230px onchange=p30validateEmail()><option value=0>Not verified</option><option value=1>Verified</option></select>")}setDialogMode(2,"Change Email for "+EscapeHtml(currentUser.name),3,p30showUserEmailChangeDialogEx,b);Q("dp30email").focus();Q("dp30email").value=currentUser.email;if(serverinfo.emailcheck){Q("dp30verified").value=currentUser.emailVerified?1:0}p30validateEmail()}function p30validateEmail(){var a=Q("dp30email").value,b=a.split("@");b=(b.length==2)&&(b[0].length>0)&&(b[1].split(".").length>1)&&(b[1].length>2)&&(a.length<1024)&&((a!=userinfo.email)||((serverinfo.emailcheck==true)&&(Q("dp30verified").value!=(userinfo.emailVerified?1:0))));QE("idx_dlgOkButton",b)}function p30showUserEmailChangeDialogEx(){var a={action:"edituser",name:currentUser.name,email:Q("dp30email").value};if(serverinfo.emailcheck){a.emailVerified=(Q("dp30verified").value==1)}meshserver.send(a)}function p30showUserChangePassDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Change Password for "+EscapeHtml(currentUser.name),3,p30showUserChangePassDialogEx,a);showCreateNewAccountDialogValidate();Q("p4pass1").focus()}function p30showUserChangePassDialogEx(){if(Q("p4pass1").value==Q("p4pass2").value){meshserver.send({action:"changeuserpass",user:currentUser.name,pass:Q("p4pass1").value})}}function p30showDeleteUserDialog(){if(xxdialogMode){return}setDialogMode(2,"Delete User "+EscapeHtml(currentUser.name),3,p30showDeleteUserDialogEx,"Confirm deletion of user "+EscapeHtml(currentUser.name)+"?")}function p30showDeleteUserDialogEx(){meshserver.send({action:"deleteuser",userid:currentUser._id,username:currentUser.name})}function drawUserTimeline(){var r=null,n=Date.now();r=[];var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var y="",b=1,g=new Date();g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var v=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var w=Math.round((q-v)/112794);if(w>0){var u=powerStateStrings2[a[2]]+" from "+new Date(v).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+w+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}y+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p30html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Login State</th></tr>'+y+"</tbody></table>")}var currentUserEvents=null;function userEvents_update(){var g="",a=null;for(var c in currentUserEvents){var b=currentUserEvents[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("&reg;");if(b.username&&b.username!=userinfo.name){e+=": "+b.username}g+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";g+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";g+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";g+="<div style=font-size:14px><span style=width:300px>"+f.toLocaleTimeString()+" - "+e+"</span></div></div></td></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p31events",g)}function refreshUsersEvents(){meshserver.send({action:"events",limit:parseInt(p31limitdropdown.value),user:currentUser.name})}function d3init(){Q("d3localFile").value="";d3modechange()}function d3modechange(){var a=Q("d3uploadMode").value;QV("d3localmode",a==1);QV("d3servermode",a==2);if(a==1){d3setActions()}else{d3updatefiles()}}var d3filetreelinkpath;var d3filetreelocation=[];function d3updatefiles(){if(Q("d3uploadMode").value==1){return}var m="",n="",e=filetree,j=1;var c=[],r=d3filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var o=0;o<a.length;o++){if(a[o].checked){b.push(a[o].value)}}d3filetreelinkpath="";for(var o in d3filetreelocation){if((e.f!=null)&&(e.f[d3filetreelocation[o]]!=null)){c.push(d3filetreelocation[o]);if((j==1)){var t=d3filetreelocation[o].split("/");publicPath=window.location+t[0]+"files/"+t[2];if(d3filetreelocation[o]===userinfo._id){d3filetreelinkpath+="self"}else{d3filetreelinkpath+=(t[0]+"/"+t[2])}}else{if(d3filetreelinkpath!=""){d3filetreelinkpath+="/"+d3filetreelocation[o];if(j>2){publicPath+="/"+d3filetreelocation[o]}}}e=e.f[d3filetreelocation[o]];j++}else{break}}d3filetreelocation=c;var g=p5sort_files(e.f);for(var o in g){var d=g[o],q=d.n,s;s=q;if(q.length>70){s='<span title="'+EscapeHtml(q)+'">'+EscapeHtml(q.substring(0,70))+"...</span>"}else{s=EscapeHtml(q)}q=EscapeHtml(q);var k="";if(d.s!=null){k=getFileSizeStr(d.s)}var l="";if(d.t<3){var u="";l='<div class=filelist file=999><span style=float:right title="'+u+'"></span><span><div class=fileIcon'+d.t+'></div>&nbsp;<a style=cursor:pointer onclick=d3folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var p=s;l="<div class=filelist file=3><input style=float:left name=fcx class=fcb type=checkbox onchange=d3setActions() value='"+d.nx+"'>&nbsp;<span style=float:right>"+k+"</span><span><div class=fileIcon"+d.t+"></div>"+p+"</span></div>"}if(d.t<3){m+=l}else{n+=l}}QH("d3serverfiles",m+n);QE("p3FolderUp",d3filetreelocation.length>0);d3setActions()}function d3folderset(a){d3filetreelocation.push(decodeURIComponent(a));d3updatefiles()}function d3folderup(a){if(a==null){d3filetreelocation.pop()}else{while(d3filetreelocation.length>a){d3filetreelocation.pop()}}d3updatefiles()}function d3getFileSel(){var a=[];var b=document.getElementsByName("fcx");for(var c=0;c<b.length;c++){if(b[c].checked){a.push(b[c].value)}}return a}function d3setActions(){var a=Q("d3uploadMode").value;if(a==1){QE("idx_dlgOkButton",Q("d3localFile").value.length>0)}else{QE("idx_dlgOkButton",d3getFileSel().length==1)}}var notifications=[];function clickNotificationIcon(a){if(a==true){QV("notifiyBox",true)}else{if(a==false){QV("notifiyBox",false)}else{QV("notifiyBox",QS("notifiyBox")["display"]=="none")}}drawNotifications()}function setNotificationCount(a){if(parseInt(Q("notificationCount").innerHTML)==a){return}QH("notificationCount",a);QS("notificationCount")["background-color"]=(a==0)?"lightblue":"orange";QV("notificationCount",a>0)}function drawNotifications(){var h="";if(notifications.length==0){h="<div style=margin:5px>There are currently no notifications</div>"}else{for(var c in notifications){var f=notifications[c];var j="";var a=new Date(f.time);var e=0;if(f.nodeid!=null){var g=getNodeFromId(f.nodeid);if(g!=null){e=g.icon;j="<b>"+g.name+"</b>: "}}h+='<div title="Occured at '+a.toLocaleString()+'" id="notifyx'+f.id+'" class=notification style="cursor:pointer;border-top:1px solid '+((h=="")?"transparent":"orange")+'"><div class=j'+e+' onclick="notificationSelected('+f.id+')" style=margin:5px;float:left></div><div onclick="notificationDelete('+f.id+')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected('+f.id+')" style=margin:5px>'+j+f.text+"</div></div>"}}var b="";if(notifications.length>1){b='<div id="notifyRemoveAll" onclick="deleteAllNotifications()" style="cursor:pointer;border-top:1px solid orange;margin:5px;color:orange;text-align:right;padding-right:3px">Clear all</div>'}QH("notifiyBox",'<div class=customScroll style="max-height:170px;overflow-y:auto;margin:5px">'+h+"</div>"+b)}function notificationSelected(b){var c=-1;for(var a in notifications){if(notifications[a].id==b){c=a}}if(c!=-1){var d=notifications[c];if(d.nodeid!=null){if(d.tag=="desktop"){gotoDevice(d.nodeid,12)}else{if(d.tag=="terminal"){gotoDevice(d.nodeid,11)}else{if(d.tag=="files"){gotoDevice(d.nodeid,13)}else{if(d.tag=="intelamt"){gotoDevice(d.nodeid,14)}else{if(d.tag=="console"){gotoDevice(d.nodeid,15)}else{gotoDevice(d.nodeid,10)}}}}}}}}function notificationDelete(c){var d=-1,a=Q("notifyx"+c);if(a!=null){for(var b in notifications){if(notifications[b].id==c){d=b}}if(d!=-1){notifications.splice(d,1);a.parentNode.removeChild(a);setNotificationCount(notifications.length);if(notifications.length==0){QV("notifiyBox",false)}if(notifications.length==1){QV("notifyRemoveAll",false)}if((notifications.length>0)&&(d==0)){var f=notifications[0];QS("notifyx"+f.id)["border-top"]="1px solid transparent"}}}}function addNotification(a){if(a.time==null){a.time=Date.now()}if(a.id==null){a.id=Math.random()}notifications.unshift(a);setNotificationCount(notifications.length);Q("chimes").play();clickNotificationIcon(true)}function deleteAllNotifications(){notifications=[];setNotificationCount(0);drawNotifications();QV("notifiyBox",false)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgDeleteButton",a&4);QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px");deskAdjust();drawDeviceTimeline()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function go(b){if(xxdialogMode||xxcurrentView==b){return}for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b;QV("topbar",b!=0);if(b>=10&&b<20){QS("MainMenuMyDevices").backgroundColor="#606060"}else{QS("MainMenuMyDevices").backgroundColor=((b==1)?"#003366":"#808080")}if(b>=20&&b<30){QS("MainMenuMyAccount").backgroundColor="#606060"}else{QS("MainMenuMyAccount").backgroundColor=((b==2)?"#003366":"#808080")}QS("MainMenuMyEvents").backgroundColor=((b==3)?"#003366":"#808080");if(b>=30&&b<40){QS("MainMenuMyUsers").backgroundColor="#606060"}else{QS("MainMenuMyUsers").backgroundColor=((b==4)?"#003366":"#808080")}QS("MainMenuMyFiles").backgroundColor=((b==5)?"#003366":"#808080");QV("MainSubMenuSpan",b>=10&&b<20);QS("MainDev").backgroundColor=((b==10)?"#003366":"#808080");QS("MainDevDesktop").backgroundColor=((b==11)?"#003366":"#808080");QS("MainDevTerminal").backgroundColor=((b==12)?"#003366":"#808080");QS("MainDevFiles").backgroundColor=((b==13)?"#003366":"#808080");QS("MainDevEvents").backgroundColor=((b==16)?"#003366":"#808080");QS("MainDevAmt").backgroundColor=((b==14)?"#003366":"#808080");QS("MainDevConsole").backgroundColor=((b==15)?"#003366":"#808080");QV("MeshSubMenuSpan",b>=20&&b<30);QS("MeshGeneral").backgroundColor=((b==20)?"#003366":"#808080");QV("UserSubMenuSpan",b>=30&&b<40);QS("UserGeneral").backgroundColor=((b==30)?"#003366":"#808080");QS("UserEvents").backgroundColor=((b==31)?"#003366":"#808080");if(b==1){updateDevicesEx()}}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function putstore(b,c){try{if(typeof(localStorage)==="undefined"){return}localStorage.setItem(b,c)}catch(a){}}function getstore(b,d){try{if(typeof(localStorage)==="undefined"){return d}var c=localStorage.getItem(b);if((c==null)||(c==null)){return d}return c}catch(a){return d}}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>&diams; "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function addOption(c,d,a){var b=document.createElement("option");b.text=d;b.value=a;Q(c).add(b)}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function methodcheck(a){if(a&&a!=null&&a.Body&&a.Body.ReturnValueStr!="SUCCESS"){messagebox("Call Error",a.Header.Method+": "+a.Body.ReturnValueStr.replace("_"," "));return true}return false}function TableStart(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}function TableEntry(a,b){return"<tr><td><p>"+a+"<td>"+b}function FullTable(c,a){var b=TableStart();for(i in c){if(i&&c[i]){b+=TableEntry(i,c[i])}}return b+TableEnd(a)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(b,a){return"<input type=button value='"+b+"' onclick='"+a+"' style=margin:4px>"}function AddButton2(b,a){return"<input type=button value='"+b+"' onclick='"+a+"'>"}function AddRefreshButton(a){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+a+"' style=margin:4px "+(refreshButtonsState==false?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>&#x25BC; More</a><div id=morexxx2 style=display:none><br><hr>'}function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>&#x25B2; Less</a></div>'}function getSelectedOptions(e){var d=[],c;for(var a=0,b=e.options.length;a<b;a++){c=e.options[a];if(c.selected){d.push(c.value)}}return d}function getInstance(b,c){for(var a in b){if(b[a]["InstanceID"]==c){return b[a]}}return null}function getItem(b,c,d){for(var a in b){if(b[a][c]==d){return b[a]}}return null}function guidToStr(a){return a.substring(6,8)+a.substring(4,6)+a.substring(2,4)+a.substring(0,2)+"-"+a.substring(10,12)+a.substring(8,10)+"-"+a.substring(14,16)+a.substring(12,14)+"-"+a.substring(16,20)+"-"+a.substring(20)}function getUrlVars(){var d,a,e=[],b=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var c=0;c<b.length;c++){d=b[c].indexOf("=");if(d>0){e[b[c].substring(0,d)]=b[c].substring(d+1,b[c].length)}}return e}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=b[d];break;case 1:c[a]=b[d];var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break}}return c}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)};</script></body></html>
\ No newline at end of file
views/default-mobile-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <title>MeshCentral - Login</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;border:none;}.m0{background:url(../images/images16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.m1{background:url(../images/images16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.m2{background:url(../images/images16.png) -96px 0px;height:16px;width:16px;border:none;float:left;}.m3{background:url(../images/images16.png) -112px 0px;height:16px;width:16px;border:none;float:left;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="width:calc(100% - 50px);overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <img class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer" onclick="topMenu()" src="/images/3bars-30.png" width="30" height="30"> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%"> <div id="column_l" style="width:100%;padding:0;position:absolute;bottom:0px;top:0px"> <div id="p0" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p0message" style="text-align:center;width:100%">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> </div> <div id="p1" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p1message" style="text-align:center;width:100%"></div> </div> </div> <div id="p2" style="display:none"> <div id="xdevices"></div> </div> <div id="p3" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p3userName"></span></strong><br> </div> </td> </tr> </table> <div id="p3info" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div style="margin-left:8px"> <div id="p3AccountActions"> <p><strong>Account actions</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div style="margin-top:5px"><span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a></span></div> <div style="margin-top:5px"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> </div> </div> <br style="clear:both"> <strong>Meshes</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p3meshes"></div> <div id="p3noMeshFound" style="margin-left:9px;display:none">No meshes. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> </div> </div> <div id="p5" style="display:none"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large">My Files</strong><br> </div> </td> </tr> </table> <div id="p5myfiles" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <table id="p5toolbar" style="width:100%;height:78px" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5FolderUp" disabled="disabled" onclick="p5folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5NewFolderButton" disabled="disabled" value="Folder" onclick="p5createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RefreshButton" value="Refresh" onclick="p5refreshFiles()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p5currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding="0" cellspacing="0"> <tr> <td style="text-align:left;padding:3px">&nbsp;<span id="p5bottomstatus"></span></td> <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td> </tr> </table> </div> </div> <div id="p10" style="display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <a id="MainComputerImage" style="cursor:pointer" onclick="p10showiconselector()"></a> </td> <td> <div style="margin-left:5px"> <strong><span id="p10deviceName"></span></strong><br> <span id="MainComputerState"></span> </div> </td> </tr> </table> <div id="p10general" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div id="p10html" style="margin-left:8px;margin-right:8px"></div> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p10desktop" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <div id="deskarea1" style="position:absolute;top:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span>&nbsp; </div> <div style="margin-left:3px"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"> <span id="deskstatus">Disconnected</span> </div> </div> </div> <div id="deskarea3" style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"> <div id="deskarea3x" style="background:black;text-align:center;height:100%;position:relative"> <div id="DeskParent" style="height:100%"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </div> </div> <div id="deskarea4" style="position:absolute;bottom:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>&nbsp; <input id="DeskToastButton" type="button" value="Toast" title="Display a notification message on the remote computer" onkeypress="return false" onkeydown="return false" onclick="deviceToastFunction()">&nbsp; </div> <div> <input id="deskActionsBtn" type="button" style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()"> <input type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none"> <input id="DeskCAD" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> </div> </div> </div> </div> <div id="p10files" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:2px"> </div> <div style="margin-left:2px"> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13NewFolderButton" disabled="disabled" value="Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p13currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding="0" cellspacing="0"> <tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6">&nbsp;<span id="p13bottomstatus"></span></td></tr> </table> </div> </div> <div id="p20" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td onclick="p20editmesh(1)"> <img src="/images/meshicon50.png" width="50" height="50"> </td> <td onclick="p20editmesh(1)"> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p20meshName"></span></strong><br> </div> </td> </tr> </table> <div id="p20info" style="margin-left:8px;margin-right:8px"></div> </div> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table id="footerMenu" cellpadding="0" cellspacing="0" style="height:32px;width:100%;color:white;cursor:pointer;table-layout:fixed"></table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <div id="topMenu" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0px 0px 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(2)">My Files</div> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(1)">My Account</div> <a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Logout</div></a> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){c.Stop()}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateAgentRemoteDesktop=function(a,c){var b={};b.CanvasId=a;if(typeof a==="string"){b.CanvasId=Q(a)}b.Canvas=b.CanvasId.getContext("2d");b.scrolldiv=c;b.State=0;b.PendingOperations=[];b.tilesReceived=0;b.TilesDrawn=0;b.KillDraw=0;b.ipad=false;b.tabletKeyboardVisible=false;b.LastX=0;b.LastY=0;b.touchenabled=0;b.submenuoffset=0;b.touchtimer=null;b.TouchArray={};b.connectmode=0;b.connectioncount=0;b.rotation=0;b.protocol=2;b.debugmode=0;b.firstUpKeys=[];b.stopInput=false;b.sessionid=0;b.username;b.oldie=false;b.CompressionLevel=50;b.ScalingLevel=1024;b.FrameRateTimer=50;b.FirstDraw=false;b.ScreenWidth=960;b.ScreenHeight=700;b.width=960;b.height=960;b.onScreenSizeChange=null;b.onMessage=null;b.onConnectCountChanged=null;b.onDebugMessage=null;b.onTouchEnabledChanged=null;b.onDisplayinfo=null;b.Start=function(){b.State=0};b.Stop=function(){b.setRotation(0);b.UnGrabKeyInput();b.UnGrabMouseInput();b.touchenabled=0;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}b.Canvas.clearRect(0,0,b.CanvasId.width,b.CanvasId.height)};b.xxStateChange=function(d){if(b.State==d){return}b.State=d;switch(d){case 0:b.Stop();break;case 3:break}};b.send=function(d){b.parent.send(d)};b.ProcessPictureMsg=function(e,g,h){var f=new Image();f.xcount=b.tilesReceived++;var d=b.tilesReceived;f.src="data:image/jpeg;base64,"+btoa(e.substring(4,e.length));f.onload=function(){if(b.Canvas!=null&&b.KillDraw<d&&b.State!=0){b.PendingOperations.push([d,2,f,g,h]);while(b.DoPendingOperations()){}}};f.error=function(){console.log("DecodeTileError")}};b.DoPendingOperations=function(){if(b.PendingOperations.length==0){return false}for(var d=0;d<b.PendingOperations.length;d++){var e=b.PendingOperations[d];if(e[0]==(b.TilesDrawn+1)){if(e[1]==1){b.ProcessCopyRectMsg(e[2])}else{if(e[1]==2){b.Canvas.drawImage(e[2],b.rotX(e[3],e[4]),b.rotY(e[3],e[4]));delete e[2]}}b.PendingOperations.splice(d,1);delete e;b.TilesDrawn++;if(b.TilesDrawn==b.tilesReceived&&b.KillDraw<b.TilesDrawn){b.KillDraw=b.TilesDrawn=b.tilesReceived=0}return true}}if(b.oldie&&b.PendingOperations.length>0){b.TilesDrawn++}return false};b.ProcessCopyRectMsg=function(g){var h=((g.charCodeAt(0)&255)<<8)+(g.charCodeAt(1)&255);var j=((g.charCodeAt(2)&255)<<8)+(g.charCodeAt(3)&255);var d=((g.charCodeAt(4)&255)<<8)+(g.charCodeAt(5)&255);var e=((g.charCodeAt(6)&255)<<8)+(g.charCodeAt(7)&255);var k=((g.charCodeAt(8)&255)<<8)+(g.charCodeAt(9)&255);var f=((g.charCodeAt(10)&255)<<8)+(g.charCodeAt(11)&255);b.Canvas.drawImage(Canvas.canvas,h,j,k,f,d,e,k,f)};b.SendUnPause=function(){b.send(String.fromCharCode(0,8,0,5,0))};b.SendPause=function(){b.send(String.fromCharCode(0,8,0,5,1))};b.SendCompressionLevel=function(g,e,f,d){if(e){b.CompressionLevel=e}if(f){b.ScalingLevel=f}if(d){b.FrameRateTimer=d}b.send(String.fromCharCode(0,5,0,10,g,b.CompressionLevel)+b.shortToStr(b.ScalingLevel)+b.shortToStr(b.FrameRateTimer))};b.SendRefresh=function(){b.send(String.fromCharCode(0,6,0,4))};b.ProcessScreenMsg=function(e,d){b.Canvas.setTransform(1,0,0,1,0,0);b.rotation=0;b.FirstDraw=true;b.ScreenWidth=b.width=e;b.ScreenHeight=b.height=d;b.KillDraw=b.tilesReceived;while(b.PendingOperations.length>0){b.PendingOperations.shift()}b.SendCompressionLevel(1);b.SendUnPause();if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}};b.ProcessData=function(e){var d=0;while(d<e.length){d+=b.ProcessDataEx(e.substring(d))}};b.ProcessDataEx=function(n){if(n.length<4){return}var d=null,o=0,p=0,f=ReadShort(n,0),e=ReadShort(n,2);if((e!=n.length)&&(b.debugmode==1)){console.log(e,n.length,e==n.length)}if(f>=18){console.error("Invalid KVM command "+f+" of size "+e);console.log("Invalid KVM data",n.length,n,rstr2hex(n));return}if(e>n.length){console.error("KVM invalid command size",e,n.length);return}if(f==3||f==4||f==7){d=n.substring(4,e);o=((d.charCodeAt(0)&255)<<8)+(d.charCodeAt(1)&255);p=((d.charCodeAt(2)&255)<<8)+(d.charCodeAt(3)&255)}switch(f){case 3:if(b.FirstDraw){b.onResize()}b.ProcessPictureMsg(d,o,p);break;case 4:if(b.FirstDraw){b.onResize()}if(b.TilesDrawn==b.tilesReceived){b.ProcessCopyRectMsg(d)}else{b.PendingOperations.push([++tilesReceived,1,d])}break;case 7:b.ProcessScreenMsg(o,p);b.SendKeyMsgKC(b.KeyAction.UP,16);b.SendKeyMsgKC(b.KeyAction.UP,17);b.SendKeyMsgKC(b.KeyAction.UP,18);b.SendKeyMsgKC(b.KeyAction.UP,91);b.SendKeyMsgKC(b.KeyAction.UP,92);b.SendKeyMsgKC(b.KeyAction.UP,16);b.send(String.fromCharCode(0,14,0,4));break;case 11:var k=[],g=((n.charCodeAt(4)&255)<<8)+(n.charCodeAt(5)&255);if(g>0){var m=0,l=((n.charCodeAt(6+(g*2))&255)<<8)+(n.charCodeAt(7+(g*2))&255);for(var j=0;j<g;j++){var h=((n.charCodeAt(6+(j*2))&255)<<8)+(n.charCodeAt(7+(j*2))&255);if(h==65535){k.push("All Displays")}else{k.push("Display "+h)}if(h==l){m=j}}}if(b.onDisplayinfo!=null){b.onDisplayinfo(b,k,m)}break;case 12:break;case 14:b.touchenabled=1;b.TouchArray={};if(b.onTouchEnabledChanged!=null){b.onTouchEnabledChanged(b.touchenabled)}break;case 15:b.TouchArray={};break;case 16:b.connectioncount=ReadInt(n,4);if(b.onConnectCountChanged!=null){b.onConnectCountChanged(b.connectioncount,b)}break;case 17:if(b.onMessage!=null){b.onMessage(n.substring(4,e),b)}break}return e};b.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};b.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};b.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};b.Alternate=0;b.SendKeyMsg=function(d,e){if(d==null){return}if(!e){var e=window.event}var f=e.keyCode;if(f==59){f=186}b.SendKeyMsgKC(d,f)};b.SendMessage=function(d){if(b.State==3){b.send(String.fromCharCode(0,17)+b.shortToStr(4+d.length)+d)}};b.SendKeyMsgKC=function(d,f){if(b.State!=3){return}if(typeof d=="object"){for(var e in d){b.SendKeyMsgKC(d[e][0],d[e][1])}}else{b.send(String.fromCharCode(0,b.InputType.KEY,0,6,(d-1),f))}};b.sendcad=function(){b.SendCtrlAltDelMsg()};b.SendCtrlAltDelMsg=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.CTRLALTDEL,0,4))}};b.SendEscKey=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.KEY,0,6,0,27,0,b.InputType.KEY,0,6,1,27))}};b.SendStartMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendCharmsMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.DOWN,67);b.SendKeyMsgKC(b.KeyAction.UP,67);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendTouchMsg1=function(e,d,f,g){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(14)+String.fromCharCode(1,e)+b.intToStr(d)+b.shortToStr(f)+b.shortToStr(g))}};b.SendTouchMsg2=function(f,d){var h="";var e;var j="TOUCHSEND: ";for(var g in b.TouchArray){if(g==f){e=d}else{if(b.TouchArray[g].f==1){e=65536|2|4;b.TouchArray[g].f=3;j+="START"+g}else{if(b.TouchArray[g].f==2){e=262144;j+="STOP"+g}else{e=2|4|131072}}}h+=String.fromCharCode(g)+b.intToStr(e)+b.shortToStr(b.TouchArray[g].x)+b.shortToStr(b.TouchArray[g].y);if(b.TouchArray[g].f==2){delete b.TouchArray[g]}}if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(5+h.length)+String.fromCharCode(2)+h)}if(Object.keys(b.TouchArray).length==0&&b.touchtimer!=null){clearInterval(b.touchtimer);b.touchtimer=null}};b.SendMouseMsg=function(d,g){if(b.State!=3){return}if(d!=null&&b.Canvas!=null){if(!g){var g=window.event}var k=(b.Canvas.canvas.height/b.CanvasId.clientHeight);var l=(b.Canvas.canvas.width/b.CanvasId.clientWidth);var j=b.GetPositionOfControl(b.Canvas.canvas);var m=((g.pageX-j[0])*l);var n=((g.pageY-j[1])*k);if(m>=0&&m<=b.Canvas.canvas.width&&n>=0&&n<=b.Canvas.canvas.height){var e=0;var f=0;if(d==b.KeyAction.UP||d==b.KeyAction.DOWN){if(g.which){((g.which==1)?(e=b.MouseButton.LEFT):((g.which==2)?(e=b.MouseButton.MIDDLE):(e=b.MouseButton.RIGHT)))}else{if(g.button){((g.button==0)?(e=b.MouseButton.LEFT):((g.button==1)?(e=b.MouseButton.MIDDLE):(e=b.MouseButton.RIGHT)))}}}else{if(d==b.KeyAction.SCROLL){if(g.detail){f=(-1*(g.detail*120))}else{if(g.wheelDelta){f=(g.wheelDelta*3)}}}}var h="";if(d==b.KeyAction.SCROLL){h=String.fromCharCode(0,b.InputType.MOUSE,0,12,0,((d==b.KeyAction.DOWN)?e:((e*2)&255)),((m/256)&255),(m&255),((n/256)&255),(n&255),((f/256)&255),(f&255))}else{h=String.fromCharCode(0,b.InputType.MOUSE,0,10,0,((d==b.KeyAction.DOWN)?e:((e*2)&255)),((m/256)&255),(m&255),((n/256)&255),(n&255))}if(b.Action==b.KeyAction.NONE){if(b.Alternate==0||b.ipad){b.send(h);b.Alternate=1}else{b.Alternate=0}}else{b.send(h)}}}};b.GetDisplayNumbers=function(){b.send(String.fromCharCode(0,11,0,4))};b.SetDisplay=function(d){b.send(String.fromCharCode(0,12,0,6,d>>8,d&255))};b.intToStr=function(d){return String.fromCharCode((d>>24)&255,(d>>16)&255,(d>>8)&255,d&255)};b.shortToStr=function(d){return String.fromCharCode((d>>8)&255,d&255)};b.onResize=function(){if(b.ScreenWidth==0||b.ScreenHeight==0){return}if(b.Canvas.canvas.width==b.ScreenWidth&&b.Canvas.canvas.height==b.ScreenHeight){return}if(b.FirstDraw){b.Canvas.canvas.width=b.ScreenWidth;b.Canvas.canvas.height=b.ScreenHeight;b.Canvas.fillRect(0,0,b.ScreenWidth,b.ScreenHeight);if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}}b.FirstDraw=false};b.xxMouseInputGrab=false;b.xxKeyInputGrab=false;b.xxMouseMove=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.NONE,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseUp=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseDown=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxDOMMouseScroll=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxMouseWheel=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxKeyUp=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyDown=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyPress=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.handleKeys=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyPress(d)};b.handleKeyUp=function(d){if(b.stopInput==true||desktop.State!=3){return false}if(b.firstUpKeys.length<5){b.firstUpKeys.push(d.keyCode);if((b.firstUpKeys.length==5)){var f=b.firstUpKeys.join(",");if((f=="16,17,91,91,16")||(f=="16,17,18,91,92")){b.stopInput=true}}}return b.xxKeyUp(d)};b.handleKeyDown=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyDown(d)};b.mousedown=function(d){if(b.stopInput==true){return false}return b.xxMouseDown(d)};b.mouseup=function(d){if(b.stopInput==true){return false}return b.xxMouseUp(d)};b.mousemove=function(d){if(b.stopInput==true){return false}return b.xxMouseMove(d)};b.mousewheel=function(d){if(b.stopInput==true){return false}return b.xxMouseWheel(d)};b.xxMsTouchEvent=function(d){if(d.originalEvent.pointerType==4){return}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}if(d.type=="MSPointerDown"||d.type=="MSPointerMove"||d.type=="MSPointerUp"){var e=0;var f=d.originalEvent.pointerId%256;var g=d.offsetX*(Canvas.canvas.width/b.CanvasId.clientWidth);var h=d.offsetY*(Canvas.canvas.height/b.CanvasId.clientHeight);if(d.type=="MSPointerDown"){e=65536|2|4}else{if(d.type=="MSPointerMove"){e=131072|2|4}else{if(d.type=="MSPointerUp"){e=262144}}}if(!b.TouchArray[f]){b.TouchArray[f]={x:g,y:h}}b.SendTouchMsg2(f,e);if(d.type=="MSPointerUp"){delete b.TouchArray[f]}}else{alert(d.type)}return true};b.xxTouchStart=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(KeyAction.DOWN,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(!b.TouchArray[g]){b.TouchArray[g]={x:(d.originalEvent.touches[f].pageX-h[0])*(Canvas.canvas.width/b.CanvasId.clientWidth),y:(d.originalEvent.touches[f].pageY-h[1])*(Canvas.canvas.height/b.CanvasId.clientHeight),f:1}}}if(Object.keys(b.TouchArray).length>0&&touchtimer==null){b.touchtimer=setInterval(function(){b.SendTouchMsg2(256,0)},50)}}};b.xxTouchMove=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(b.KeyAction.NONE,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].x=(d.originalEvent.touches[f].pageX-h[0])*(b.Canvas.canvas.width/b.CanvasId.clientWidth);b.TouchArray[g].y=(d.originalEvent.touches[f].pageY-h[1])*(b.Canvas.canvas.height/b.CanvasId.clientHeight)}}}};b.xxTouchEnd=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}d.which=1;d.pageX=LastX;d.pageY=LastY;b.SendMouseMsg(KeyAction.UP,d)}else{for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].f=2}}}};b.GrabMouseInput=function(){if(b.xxMouseInputGrab==true){return}var d=b.CanvasId;d.onmousemove=b.xxMouseMove;d.onmouseup=b.xxMouseUp;d.onmousedown=b.xxMouseDown;d.touchstart=b.xxTouchStart;d.touchmove=b.xxTouchMove;d.touchend=b.xxTouchEnd;d.MSPointerDown=b.xxMsTouchEvent;d.MSPointerMove=b.xxMsTouchEvent;d.MSPointerUp=b.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=b.xxDOMMouseScroll}else{d.onmousewheel=b.xxMouseWheel}b.xxMouseInputGrab=true};b.UnGrabMouseInput=function(){if(b.xxMouseInputGrab==false){return}var d=b.CanvasId;d.onmousemove=null;d.onmouseup=null;d.onmousedown=null;d.touchstart=null;d.touchmove=null;d.touchend=null;d.MSPointerDown=null;d.MSPointerMove=null;d.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=null}else{d.onmousewheel=null}b.xxMouseInputGrab=false};b.GrabKeyInput=function(){if(b.xxKeyInputGrab==true){return}document.onkeyup=b.xxKeyUp;document.onkeydown=b.xxKeyDown;document.onkeypress=b.xxKeyPress;b.xxKeyInputGrab=true};b.UnGrabKeyInput=function(){if(b.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;b.xxKeyInputGrab=false};b.GetPositionOfControl=function(d){var e=Array(2);e[0]=e[1]=0;while(d){e[0]+=d.offsetLeft;e[1]+=d.offsetTop;d=d.offsetParent}return e};b.crotX=function(d,e){if(b.rotation==0){return d}if(b.rotation==1){return e}if(b.rotation==2){return b.Canvas.canvas.width-d}if(b.rotation==3){return b.Canvas.canvas.height-e}};b.crotY=function(d,e){if(b.rotation==0){return e}if(b.rotation==1){return b.Canvas.canvas.width-d}if(b.rotation==2){return b.Canvas.canvas.height-e}if(b.rotation==3){return d}};b.rotX=function(d,e){if(b.rotation==0||b.rotation==1){return d}if(b.rotation==2){return d-b.Canvas.canvas.width}if(b.rotation==3){return d-b.Canvas.canvas.height}};b.rotY=function(d,e){if(b.rotation==0||b.rotation==3){return e}if(b.rotation==1){return e-b.Canvas.canvas.width}if(b.rotation==2){return e-b.Canvas.canvas.height}};b.tcanvas=null;b.setRotation=function(h){while(h<0){h+=4}var d=h%4;if(d==b.rotation){return true}var f=b.Canvas.canvas.width;var e=b.Canvas.canvas.height;if(b.rotation==1||b.rotation==3){f=b.Canvas.canvas.height;e=b.Canvas.canvas.width}if(b.tcanvas==null){b.tcanvas=document.createElement("canvas")}var g=b.tcanvas.getContext("2d");g.setTransform(1,0,0,1,0,0);g.canvas.width=f;g.canvas.height=e;g.rotate((b.rotation*-90)*Math.PI/180);if(b.rotation==0){g.drawImage(b.Canvas.canvas,0,0)}if(b.rotation==1){g.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,0)}if(b.rotation==2){g.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,-b.Canvas.canvas.height)}if(b.rotation==3){g.drawImage(b.Canvas.canvas,0,-b.Canvas.canvas.height)}if(b.rotation==0||b.rotation==2){b.Canvas.canvas.height=f;b.Canvas.canvas.width=e}if(b.rotation==1||b.rotation==3){b.Canvas.canvas.height=e;b.Canvas.canvas.width=f}b.Canvas.setTransform(1,0,0,1,0,0);b.Canvas.rotate((d*90)*Math.PI/180);b.rotation=d;b.Canvas.drawImage(b.tcanvas,b.rotX(0,0),b.rotY(0,0));b.ScreenWidth=b.Canvas.canvas.width;b.ScreenHeight=b.Canvas.canvas.height;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}return true};b.MuchTheSame=function(d,e){return(Math.abs(d-e)<4)};b.Debug=function(d){console.log(d)};b.getIEVersion=function(){var d=-1;if(navigator.appName=="Microsoft Internet Explorer"){var f=navigator.userAgent;var e=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(e.exec(f)!=null){d=parseFloat(RegExp.$1)}}return d};b.haltEvent=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};return b};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,C,t,B,z,A,w,D,y){r.wsman.ExecSubscribe(r.CompleteName(v),u,C,function(G,F,E,H){q();t(r,v,E,H,B)},0,z,A,w,D,y);q()};r.UnSubscribe=function(u,t,y,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(B,A,z,C){q();t(r,u,z,C,y)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,w)},0,v);q()};r.Put=function(u,w,t,z,v,y){r.wsman.ExecPut(r.CompleteName(u),w,function(C,B,A,D){q();t(r,u,A,D,z)},0,v,y);q()};r.Create=function(u,w,t,y,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v);q()};r.Delete=function(u,w,t,y,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v);q()};r.Exec=function(w,v,t,u,A,y,z){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(D,C,B,E){q();u(r,w,r.CompleteExecResponse(B),E,A)},0,y,z);q()};r.ExecWithXml=function(w,v,t,u,A,y,z){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(D,C,B,E){q();u(r,w,r.CompleteExecResponse(B),E,A)},0,y,z);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(B,z,y,C,A){q();d(u,y,t,z,C,A)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,y,t,z,A,B,w){if(A!=200){t(r,v,null,A,B);c(1);return}if(y==null||y.Header.Method!="EnumerateResponse"||!y.Body.EnumerationContext){t(r,v,null,603,B);c(1);return}var u=y.Body.EnumerationContext;r.wsman.ExecPull(z,u,function(E,D,C,F){b(v,C,t,D,[],F,B,w)})}function b(z,B,t,C,w,D,E,A){if(D!=200){t(r,z,null,D,E);c(1);return}if(B==null||B.Header.Method!="PullResponse"){t(r,z,null,604,E);c(1);return}for(var v in B.Body.Items){if(B.Body.Items[v] instanceof Array){for(var y in B.Body.Items[v]){w.push(B.Body.Items[v][y])}}else{w.push(B.Body.Items[v])}}if(B.Body.EnumerationContext){var u=B.Body.EnumerationContext;r.wsman.ExecPull(C,u,function(H,G,F,I){b(z,F,t,G,w,I,E,1)})}else{c(1);t(r,z,w,D,E);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,z,v,y){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,z,{},v,y);q()};function a(t,z,u,C,B,v,A){r.PendingBatchOperations-=2;var y=z.shift(),w=r.Enum;if(y[0]=="*"){w=r.Get;y=y.substring(1)}w(y,function(F,D,E,G,H){H[2][D]={response:(E==null?null:E.Body),responses:E,status:G};if(H[1].length==0||G==401||(v!=true&&G!=200&&G!=400)){r.PendingBatchOperations-=(z.length*2);q();u(r,t,H[2],G,C)}else{q();a(t,z,u,C,H[2],A)}},[t,z,B],A);q()}r.BatchGet=function(t,v,u,y,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:y,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,y){f(t,u,y)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(z,y,w,u,t,v,C,A,B){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:z,NewState:y,EventOnTransition:w,ActionSd:u,ActionEac:t},v,C,A,B)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(z,y,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:z,NewState:y,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(y,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:y,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,y,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:y},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,y,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:y},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(y,w,v,z,t,A,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:y,DigestUsername:w,DigestPassword:v,KerberosUserSid:z,AccessPermission:t,Realms:A},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,z,B,u,w,C,A,y,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:z,Port:B,AuthMethod:u,Certificate:w,Username:C,Password:A,CN:y},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,y,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:y,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,z,v,y){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,z,v,y)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,y,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:y},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(y,z,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:y,WiFiEndpointSettingsInput:z,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(y,z,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:y,WiFiEndpointSettingsInput:z,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,y,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:y},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(y,z,w,u,A,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:y,NetworkAdminPassword:z,McNonce:w,Certificate:u,SigningAlgorithm:A,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,y,v,z,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:y,McNonce:v,SigningAlgorithm:z,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,y){if(w!=200||u.Body.ReturnValue!="0"){y[0](r,null,y[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,y)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var H=b.amtaccumulator.charCodeAt(1);switch(H){case 0:if(b.amtaccumulator.length<13){return}var y=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+y){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+y);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var G=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&G==1){var n=0;var C=d.charCodeAt(n);var B=d.substring(n+1,n+1+C);n+=(C+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var A=0;var z=null;var l=b.xxRandomNonce(32);var F="00000002";var q="";if(f==4){A=d.charCodeAt(n);z=d.substring(n+1,n+1+A);n+=(A+1);q=F+":"+l+":"+z+":"}var p=hex_md5(hex_md5(b.user+":"+B+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var I=b.user.length+B.length+v.length+b.authuri.length+l.length+F.length+p.length+7;if(f==4){I+=(z.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(I)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(B.length)+B+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(F.length)+F+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(z.length)+z)}b.xxSend(h)}else{if(G==0){if(b.protocol==1){var u=10000;var K=100;var J=0;var E=10000;var D=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(K)+ShortToStrX(J)+ShortToStrX(E)+ShortToStrX(D)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateAmtRemoteDesktop=function(j,l){var k={};k.canvasid=j;k.CanvasId=Q(j);k.scrolldiv=l;k.canvas=Q(j).getContext("2d");k.protocol=2;k.state=0;k.acc="";k.ScreenWidth=960;k.ScreenHeight=700;k.width=0;k.height=0;k.rwidth=0;k.rheight=0;k.bpp=2;k.useZRLE=true;k.showmouse=true;k.buttonmask=0;k.spare=null;k.sparew=0;k.spareh=0;k.sparew2=0;k.spareh2=0;k.sparecache={};k.ZRLEfirst=1;k.onScreenSizeChange=null;k.frameRateDelay=0;k.Debug=function(m){console.log(m)};k.xxStateChange=function(m){if(m==0){k.canvas.fillStyle="#000000";k.canvas.fillRect(0,0,k.width,k.height);k.canvas.canvas.width=k.rwidth=k.width=640;k.canvas.canvas.height=k.rheight=k.height=400;QS(k.canvasid).cursor="auto"}else{if(!k.showmouse){QS(k.canvasid).cursor="none"}}};k.ProcessData=function(p){if(!p){return}k.acc+=p;while(k.acc.length>0){var n=0;if(k.state==0&&k.acc.length>=12){n=12;k.state=1;k.send("RFB 003.008\n")}else{if(k.state==1&&k.acc.length>=1){n=k.acc.charCodeAt(0)+1;k.send(String.fromCharCode(1));k.state=2}else{if(k.state==2&&k.acc.length>=4){n=4;if(ReadInt(k.acc,0)!=0){return k.Stop()}k.send(String.fromCharCode(1));k.state=3}else{if(k.state==3&&k.acc.length>=24){var z=ReadInt(k.acc,20);if(k.acc.length<24+z){return}n=24+z;k.canvas.canvas.width=k.rwidth=k.width=k.ScreenWidth=ReadShort(k.acc,0);k.canvas.canvas.height=k.rheight=k.height=k.ScreenHeight=ReadShort(k.acc,2);var C="";if(k.useZRLE){C+=IntToStr(16)}C+=IntToStr(0);k.send(String.fromCharCode(2,0)+ShortToStr((C.length/4)+1)+C+IntToStr(-223));if(k.bpp==1){k.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}k.state=4;k.parent.xxStateChange(3);g();if(k.onScreenSizeChange!=null){k.onScreenSizeChange(k,k.ScreenWidth,k.ScreenHeight)}}else{if(k.state==4){var m=k.acc.charCodeAt(0);if(m==2){n=1}else{if(m==0){if(k.acc.length<4){return}k.state=100+ReadShort(k.acc,2);n=4}}}else{if(k.state>100&&k.acc.length>=12){var E=ReadShort(k.acc,0),G=ReadShort(k.acc,2),D=ReadShort(k.acc,4),v=ReadShort(k.acc,6),B=D*v,u=ReadInt(k.acc,8);if(u<17){if(D<1||D>64||v<1||v>64){console.log("Invalid tile size ("+D+","+v+"), disconnecting.");return k.Stop()}if(k.sparew!=D||k.spareh!=v){k.sparew=k.sparew2=D;k.spareh=k.spareh2=v;var F=k.sparew2+"x"+k.spareh2;k.spare=k.sparecache[F];if(!k.spare){k.sparecache[F]=k.spare=k.canvas.createImageData(k.sparew2,k.spareh2)}}}if(u==4294967073){k.canvas.canvas.width=k.rwidth=k.width=D;k.canvas.canvas.height=k.rheight=k.height=v;k.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(k.width)+ShortToStr(k.height));n=12;if(k.onScreenSizeChange!=null){k.onScreenSizeChange(k,k.ScreenWidth,k.ScreenHeight)}}else{if(u==0){var A=12,o=12+(B*k.bpp);if(k.acc.length<o){return}n=o;for(var w=0;w<B;w++){h(k.acc.charCodeAt(A++)+((k.bpp==2)?(k.acc.charCodeAt(A++)<<8):0),w)}f(k.spare,E,G)}else{if(u==16){if(k.acc.length<16){return}var q=ReadInt(k.acc,12);if(k.acc.length<(16+q)){return}var A=16,r=5,t=0;if(q>5&&k.acc.charCodeAt(A)==0&&ReadShortX(k.acc,A+1)==(q-r)){a(k.acc,A+5,E,G,D,v,B,q)}n=16+q}else{k.Debug("Unknown Encoding: "+u);return k.Stop()}}}if(--k.state==100){k.state=4;if(k.frameRateDelay==0){g()}else{setTimeout(g,k.frameRateDelay)}}}}}}}}if(n==0){return}k.acc=k.acc.substring(n)}};function a(o,w,G,H,F,q,C,p){var D=o.charCodeAt(w++),t,E,B,u={},z=0,A=0,r;if(D==0){for(r=0;r<C;r++){h(o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0),r)}f(k.spare,G,H)}else{if(D==1){E=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0);k.canvas.fillStyle="rgb("+((k.bpp==1)?((E&224)+","+((E&28)<<3)+","+b((E&3)<<6)):(((E>>8)&248)+","+((E>>3)&252)+","+((E&31)<<3)))+")";k.canvas.fillRect(G,H,F,q)}else{if(D>1&&D<17){var n=4,m=15;for(r=0;r<D;r++){u[r]=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0)}if(D==2){n=1;m=1}else{if(D<=4){n=2;m=3}}while(z<C&&w<o.length){E=o.charCodeAt(w++);for(r=(8-n);r>=0;r-=n){h(u[(E>>r)&m],z++)}}f(k.spare,G,H)}else{if(D==128){while(z<C&&w<o.length){E=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0);A=1;do{A+=(B=o.charCodeAt(w++))}while(B==255);while(--A>=0){h(E,z++)}}f(k.spare,G,H)}else{if(D>129){for(r=0;r<(D-128);r++){u[r]=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0)}while(z<C&&w<o.length){A=1;t=o.charCodeAt(w++);E=u[t%128];if(t>127){do{A+=(B=o.charCodeAt(w++))}while(B==255)}while(--A>=0){h(E,z++)}}f(k.spare,G,H)}}}}}}function f(m,n,o){k.canvas.putImageData(m,n,o)}function h(o,m){var n=m*4;if(k.bpp==1){k.spare.data[n++]=o&224;k.spare.data[n++]=(o&28)<<3;k.spare.data[n++]=b((o&3)<<6)}else{k.spare.data[n++]=(o>>8)&248;k.spare.data[n++]=(o>>3)&252;k.spare.data[n++]=(o&31)<<3}k.spare.data[n]=255}function b(m){return(m>127)?(m+32):m}function g(){k.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(k.rwidth)+ShortToStr(k.rheight))}k.Start=function(){k.state=0;k.acc="";k.ZRLEfirst=1;for(var m in k.sparecache){delete k.sparecache[m]}};k.Stop=function(){k.UnGrabMouseInput();k.UnGrabKeyInput();k.parent.Stop()};k.send=function(m){k.parent.send(m)};function c(m,n){if(!n){n=window.event}var o=n.keyCode,p=o;if(n.shiftKey==false&&o>=65&&o<=90){p=o+32}if(o>=112&&o<=124){p=o+65358}if(o==8){p=65288}if(o==9){p=65289}if(o==13){p=65293}if(o==16){p=65505}if(o==17){p=65507}if(o==18){p=65513}if(o==27){p=65307}if(o==33){p=65365}if(o==34){p=65366}if(o==35){p=65367}if(o==36){p=65360}if(o==37){p=65361}if(o==38){p=65362}if(o==39){p=65363}if(o==40){p=65364}if(o==45){p=65379}if(o==46){p=65535}if(o>=96&&o<=105){p=o-48}if(o==106){p=42}if(o==107){p=43}if(o==109){p=45}if(o==110){p=46}if(o==111){p=47}if(o==186){p=59}if(o==187){p=61}if(o==188){p=44}if(o==189){p=45}if(o==190){p=46}if(o==191){p=47}if(o==192){p=96}if(o==219){p=91}if(o==220){p=92}if(o==221){p=93}if(o==222){p=39}k.sendkey(p,m);return k.haltEvent(n)}k.sendkey=function(o,m){if(typeof o=="object"){for(var n in o){k.sendkey(o[n][0],o[n][1])}}else{k.send(String.fromCharCode(4,m,0,0)+IntToStr(o))}};k.SendCtrlAltDelMsg=function(){k.sendcad()};k.sendcad=function(){k.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;k.GrabMouseInput=function(){if(e==true){return}var m=k.canvas.canvas;m.onmouseup=k.mouseup;m.onmousedown=k.mousedown;m.onmousemove=k.mousemove;e=true};k.UnGrabMouseInput=function(){if(e==false){return}var m=k.canvas.canvas;m.onmousemove=null;m.onmouseup=null;m.onmousedown=null;e=false};k.GrabKeyInput=function(){if(d==true){return}document.onkeyup=k.handleKeyUp;document.onkeydown=k.handleKeyDown;document.onkeypress=k.handleKeys;d=true};k.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};k.handleKeys=function(m){return k.haltEvent(m)};k.handleKeyUp=function(m){return c(0,m)};k.handleKeyDown=function(m){return c(1,m)};k.haltEvent=function(m){if(m.preventDefault){m.preventDefault()}if(m.stopPropagation){m.stopPropagation()}return false};k.mousedown=function(m){k.buttonmask|=(1<<m.button);return k.mousemove(m)};k.mouseup=function(m){k.buttonmask&=(65535-(1<<m.button));return k.mousemove(m)};k.mousemove=function(m){if(k.state!=4){return true}var n=k.getPositionOfControl(Q(k.canvasid));k.mx=(m.pageX-n[0])*(k.canvas.canvas.height/Q(k.canvasid).offsetHeight);k.my=((m.pageY-n[1]+(l?l.scrollTop:0))*(k.canvas.canvas.width/Q(k.canvasid).offsetWidth));k.send(String.fromCharCode(5,k.buttonmask)+ShortToStr(k.mx)+ShortToStr(k.my));return k.haltEvent(m)};k.getPositionOfControl=function(m){var n=Array(2);n[0]=n[1]=0;while(m){n[0]+=m.offsetLeft;n[1]+=m.offsetTop;m=m.offsetParent}return n};return k};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var G=0;var D=1;var am=2;var af=3;var A=4;var B=5;var ac=6;var h=7;var F=8;var p=9;var o=10;var an=11;var ao=12;var aj=13;var k=14;var j=15;var al=16;var W=17;var f=18;var S=19;var R=20;var T=21;var q=22;var r=23;var aa=24;var Y=25;var d=26;var V=27;var u=28;var a=29;var ab=30;var ak=31;var z=852;var y=592;var w=(z+y);var g=0;var X=1;var t=2;var N=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var O=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var L=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var M=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function K(aR,aV){var aM=15;var aU=aR.next;var at=(aV==t?aR.distbits:aR.lenbits);var aX=aR.work;var aH=aR.lens;var aI=(aV==t?aR.nlen:0);var aS=aR.codes;var au;if(aV==X){au=aR.nlen}else{if(aV==t){au=aR.ndist}else{au=19}}var aG;var aT;var aN,aL;var aQ;var aw;var ax;var aF;var aW;var aD;var aE;var aB;var aJ;var aK;var aC;var aO;var aq;var ar;var az;var aA;var ay;var av=new Array(aM+1);var aP=new Array(aM+1);for(aG=0;aG<=aM;aG++){av[aG]=0}for(aT=0;aT<au;aT++){av[aH[aI+aT]]++}aQ=at;for(aL=aM;aL>=1;aL--){if(av[aL]!=0){break}}if(aQ>aL){aQ=aL}if(aL==0){aC={op:64,bits:1,val:0};aS[aU++]=aC;aS[aU++]=aC;if(aV==t){aR.distbits=1}else{aR.lenbits=1}aR.next=aU;return 0}for(aN=1;aN<aL;aN++){if(av[aN]!=0){break}}if(aQ<aN){aQ=aN}aF=1;for(aG=1;aG<=aM;aG++){aF<<=1;aF-=av[aG];if(aF<0){return -1}}if(aF>0&&(aV==g||aL!=1)){aR.next=aU;return -1}aP[1]=0;for(aG=1;aG<aM;aG++){aP[aG+1]=aP[aG]+av[aG]}for(aT=0;aT<au;aT++){if(aH[aI+aT]!=0){aX[aP[aH[aI+aT]]++]=aT}}switch(aV){case g:aq=az=aX;ar=0;aA=0;ay=19;break;case X:aq=N;ar=-257;az=O;aA=-257;ay=256;break;default:aq=L;az=M;ar=0;aA=0;ay=-1}aD=0;aT=0;aG=aN;aO=aU;aw=aQ;ax=0;aJ=-1;aW=1<<aQ;aK=aW-1;if((aV==X&&aW>=z)||(aV==t&&aW>=y)){aR.next=aU;return 1}for(;;){aC={op:0,bits:aG-ax,val:0};if(aX[aT]<ay){aC.val=aX[aT]}else{if(aX[aT]>ay){aC.op=az[aA+aX[aT]];aC.val=aq[ar+aX[aT]]}else{aC.op=32+64}}aE=1<<(aG-ax);aB=1<<aw;aN=aB;do{aB-=aE;aS[aO+(aD>>>ax)+aB]=aC}while(aB!=0);aE=1<<(aG-1);while(aD&aE){aE>>>=1}if(aE!=0){aD&=aE-1;aD+=aE}else{aD=0}aT++;if(--(av[aG])==0){if(aG==aL){break}aG=aH[aI+aX[aT]]}if(aG>aQ&&(aD&aK)!=aJ){if(ax==0){ax=aQ}aO+=aN;aw=aG-ax;aF=(1<<aw);while(aw+ax<aL){aF-=av[aw+ax];if(aF<=0){break}aw++;aF<<=1}aW+=1<<aw;if((aV==X&&aW>=z)||(aV==t&&aW>=y)){aR.next=aU;return 1}aJ=aD&aK;aS[aU+aJ]={op:aw,bits:aQ,val:aO-aU}}}if(aD!=0){aS[aO+aD]={op:64,bits:aG-ax,val:0}}aR.next=aU+aW;if(aV==t){aR.distbits=aQ}else{aR.lenbits=aQ}return 0}function H(aN,aL){var aM;var aC;var aI;var aD;var aK;var aq;var ax;var aR;var aO;var aQ;var aP;var aB;var ar;var at;var aE;var au;var aH;var aw;var aA;var aJ;var aF;var av;var az=-1;var ay=-1;aM=aN.state;aC=aN.input_data;aI=aN.next_in;aD=aI+aN.avail_in-5;aK=aN.next_out;aq=aK-(aL-aN.avail_out);ax=aK+(aN.avail_out-257);aR=aM.wsize;aO=aM.whave;aQ=aM.wnext;aP=aM.window;aB=aM.hold;ar=aM.bits;at=aM.codes;aE=aM.lencode;au=aM.distcode;aH=(1<<aM.lenbits)-1;aw=(1<<aM.distbits)-1;loop:do{if(ar<15){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aA=at[aE+(aB&aH)];dolen:while(true){aJ=aA.bits;aB>>>=aJ;ar-=aJ;aJ=aA.op;if(aJ==0){aN.output_data+=String.fromCharCode(aA.val);aK++}else{if(aJ&16){aF=aA.val;aJ&=15;if(aJ){if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aF+=aB&((1<<aJ)-1);aB>>>=aJ;ar-=aJ}if(ar<15){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aA=at[au+(aB&aw)];dodist:while(true){aJ=aA.bits;aB>>>=aJ;ar-=aJ;aJ=aA.op;if(aJ&16){av=aA.val;aJ&=15;if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}}av+=aB&((1<<aJ)-1);aB>>>=aJ;ar-=aJ;aJ=aK-aq;if(av>aJ){aJ=av-aJ;if(aJ>aO){if(aM.sane){aN.msg="invalid distance too far back";aM.mode=a;break loop}}az=0;ay=-1;if(aQ==0){az+=aR-aJ;if(aJ<aF){aF-=aJ;aN.output_data+=aP.substring(az,az+aJ);aK+=aJ;aJ=0;az=-1;ay=aK-av}}else{az+=aQ-aJ;if(aJ<aF){aF-=aJ;aN.output_data+=aP.substring(az,az+aJ);aK+=aJ;az=-1;ay=aK-av}}}else{az=-1;ay=aK-av}if(az>=0){aN.output_data+=aP.substring(az,az+aF);aK+=aF;az+=aF}else{var aG=aF;if(aG>aK-ay){aG=aK-ay}aN.output_data+=aN.output_data.substring(ay,ay+aG);aK+=aG;aF-=aG;ay+=aG;aK+=aF;while(aF>2){aN.output_data+=aN.output_data.charAt(ay++);aN.output_data+=aN.output_data.charAt(ay++);aN.output_data+=aN.output_data.charAt(ay++);aF-=3}if(aF){aN.output_data+=aN.output_data.charAt(ay++);if(aF>1){aN.output_data+=aN.output_data.charAt(ay++)}}}}else{if((aJ&64)==0){aA=at[au+(aA.val+(aB&((1<<aJ)-1)))];continue dodist}else{aN.msg="invalid distance code";aM.mode=a;break loop}}break dodist}}else{if((aJ&64)==0){aA=at[aE+(aA.val+(aB&((1<<aJ)-1)))];continue dolen}else{if(aJ&32){aM.mode=an;break loop}else{aN.msg="invalid literal/length code";aM.mode=a;break loop}}}}break dolen}}while(aI<aD&&aK<ax);aF=ar>>>3;aI-=aF;ar-=aF<<3;aB&=(1<<ar)-1;aN.next_in=aI;aN.next_out=aK;aN.avail_in=(aI<aD?5+(aD-aI):5-(aI-aD));aN.avail_out=(aK<ax?257+(ax-aK):257-(aK-ax));aM.hold=aB;aM.bits=ar}function ae(at){var ar;var aq=new Array(at);for(ar=0;ar<at;ar++){aq[ar]=0}return aq}function E(at,ar,aq){return(at&&(ar in at))?at[ar]:aq}function e(){return 0}function J(){var ar;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ae(320);this.work=ae(288);this.codes=new Array(w);var aq={op:0,bits:0,val:0};for(ar=0;ar<w;ar++){this.codes[ar]=aq}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(ar){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;ar.total_in=ar.total_out=aq.total=0;ar.msg=null;if(aq.wrap){ar.adler=aq.wrap&1}aq.mode=G;aq.last=0;aq.havedict=0;aq.dmax=32768;aq.head=null;aq.hold=0;aq.bits=0;aq.lencode=0;aq.distcode=0;aq.next=0;aq.sane=1;aq.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(ar,at){var au;var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(typeof at==="undefined"){at=n}if(at<0){au=0;at=-at}else{au=(at>>>4)+1;if(at<48){at&=15}}if(au==1&&(typeof ZLIB.adler32==="function")){ar.checksum_function=ZLIB.adler32}else{if(au==2&&(typeof ZLIB.crc32==="function")){ar.checksum_function=ZLIB.crc32}else{ar.checksum_function=e}}if(at&&(at<8||at>15)){return ZLIB.Z_STREAM_ERROR}if(aq.window&&aq.wbits!=at){aq.window=null}aq.wrap=au;aq.wbits=at;aq.wsize=0;aq.whave=0;aq.wnext=0;return ZLIB.inflateResetKeep(ar)};ZLIB.inflateInit=function(ar){var aq=new ZLIB.z_stream();aq.state=new J();ZLIB.inflateReset(aq,ar);return aq};ZLIB.inflatePrime=function(at,aq,au){var ar;if(!at||!at.state){return ZLIB.Z_STREAM_ERROR}ar=at.state;if(aq<0){ar.hold=0;ar.bits=0;return ZLIB.Z_OK}if(aq>16||ar.bits+aq>32){return ZLIB.Z_STREAM_ERROR}au&=(1<<aq)-1;ar.hold+=au<<ar.bits;ar.bits+=aq;return ZLIB.Z_OK};var U=null;var s=null;function C(ar){var aq;if(!U){U=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}ar.lencode=0;ar.distcode=512;for(aq=0;aq<512;aq++){ar.codes[aq]=U[aq]}for(aq=0;aq<32;aq++){ar.codes[aq+512]=s[aq]}ar.lenbits=9;ar.distbits=5}function ap(at){var ar=at.state;var aq=at.output_data.length;if(ar.window===null){ar.window=""}if(ar.wsize==0){ar.wsize=1<<ar.wbits}if(aq>=ar.wsize){ar.window=at.output_data.substring(aq-ar.wsize)}else{if(ar.whave+aq<ar.wsize){ar.window+=at.output_data}else{ar.window=ar.window.substring(ar.whave-(ar.wsize-aq))+at.output_data}}ar.whave=ar.window.length;if(ar.whave<ar.wsize){ar.wnext=ar.whave}else{ar.wnext=0}return 0}function l(ar,at){var aq=[at&255,(at>>>8)&255];ar.state.check=ar.checksum_function(ar.state.check,aq,0,2)}function m(ar,at){var aq=[at&255,(at>>>8)&255,(at>>>16)&255,(at>>>24)&255];ar.state.check=ar.checksum_function(ar.state.check,aq,0,4)}function Z(ar,aq){aq.strm=ar;aq.left=ar.avail_out;aq.next=ar.next_in;aq.have=ar.avail_in;aq.hold=ar.state.hold;aq.bits=ar.state.bits;return aq}function ah(aq){var ar=aq.strm;ar.next_in=aq.next;ar.avail_out=aq.left;ar.avail_in=aq.have;ar.state.hold=aq.hold;ar.state.bits=aq.bits}function P(aq){aq.hold=0;aq.bits=0}function ag(aq){if(aq.have==0){return false}aq.have--;aq.hold+=(aq.strm.input_data.charCodeAt(aq.next++)&255)<<aq.bits;aq.bits+=8;return true}function ad(ar,aq){while(ar.bits<aq){if(!ag(ar)){return false}}return true}function b(ar,aq){return ar.hold&((1<<aq)-1)}function v(ar,aq){ar.hold>>>=aq;ar.bits-=aq}function c(aq){aq.hold>>>=aq.bits&7;aq.bits-=aq.bits&7}function ai(aq){return((aq>>>24)&255)+((aq>>>8)&65280)+((aq&65280)<<8)+((aq&255)<<24)}var I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aD,at){var aC;var aB;var aq,az;var ar;var av=-1;var au=-1;var aw;var ax;var ay;var aA;if(!aD||!aD.state||(!aD.input_data&&aD.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aC=aD.state;if(aC.mode==an){aC.mode=ao}aB={};Z(aD,aB);aq=aB.have;az=aB.left;aA=ZLIB.Z_OK;inf_leave:for(;;){switch(aC.mode){case G:if(aC.wrap==0){aC.mode=ao;break}if(!ad(aB,16)){break inf_leave}if((aC.wrap&2)&&aB.hold==35615){aC.check=aD.checksum_function(0,null,0,0);l(aD,aB.hold);P(aB);aC.mode=D;break}aC.flags=0;if(aC.head!==null){aC.head.done=-1}if(!(aC.wrap&1)||((b(aB,8)<<8)+(aB.hold>>>8))%31){aD.msg="incorrect header check";aC.mode=a;break}if(b(aB,4)!=ZLIB.Z_DEFLATED){aD.msg="unknown compression method";aC.mode=a;break}v(aB,4);ay=b(aB,4)+8;if(aC.wbits==0){aC.wbits=ay}else{if(ay>aC.wbits){aD.msg="invalid window size";aC.mode=a;break}}aC.dmax=1<<ay;aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=aB.hold&512?p:an;P(aB);break;case D:if(!ad(aB,16)){break inf_leave}aC.flags=aB.hold;if((aC.flags&255)!=ZLIB.Z_DEFLATED){aD.msg="unknown compression method";aC.mode=a;break}if(aC.flags&57344){aD.msg="unknown header flags set";aC.mode=a;break}if(aC.head!==null){aC.head.text=(aB.hold>>>8)&1}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.mode=am;case am:if(!ad(aB,32)){break inf_leave}if(aC.head!==null){aC.head.time=aB.hold}if(aC.flags&512){m(aD,aB.hold)}P(aB);aC.mode=af;case af:if(!ad(aB,16)){break inf_leave}if(aC.head!==null){aC.head.xflags=aB.hold&255;aC.head.os=aB.hold>>>8}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.mode=A;case A:if(aC.flags&1024){if(!ad(aB,16)){break inf_leave}aC.length=aB.hold;if(aC.head!==null){aC.head.extra_len=aB.hold}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.head.extra=""}else{if(aC.head!==null){aC.head.extra=null}}aC.mode=B;case B:if(aC.flags&1024){ar=aC.length;if(ar>aB.have){ar=aB.have}if(ar){if(aC.head!==null&&aC.head.extra!==null){ay=aC.head.extra_len-aC.length;aC.head.extra+=aD.input_data.substring(aB.next,aB.next+(ay+ar>aC.head.extra_max?aC.head.extra_max-ay:ar))}if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;aC.length-=ar}if(aC.length){break inf_leave}}aC.length=0;aC.mode=ac;case ac:if(aC.flags&2048){if(aB.have==0){break inf_leave}if(aC.head!==null&&aC.head.name===null){aC.head.name=""}ar=0;do{ay=aD.input_data.charAt(aB.next+ar);ar++;if(ay==="\0"){break}if(aC.head!==null&&aC.length<aC.head.name_max){aC.head.name+=ay;aC.length++}}while(ar<aB.have);if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;if(ay!=="\0"){break inf_leave}}else{if(aC.head!==null){aC.head.name=null}}aC.length=0;aC.mode=h;case h:if(aC.flags&4096){if(aB.have==0){break inf_leave}ar=0;if(aC.head!==null&&aC.head.comment===null){aC.head.comment=""}do{ay=aD.input_data.charAt(aB.next+ar);ar++;if(ay==="\0"){break}if(aC.head!==null&&aC.length<aC.head.comm_max){aC.head.comment+=ay;aC.length++}}while(ar<aB.have);if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;if(ay!=="\0"){break inf_leave}}else{if(aC.head!==null){aC.head.comment=null}}aC.mode=F;case F:if(aC.flags&512){if(!ad(aB,16)){break inf_leave}if(aB.hold!=(aC.check&65535)){aD.msg="header crc mismatch";aC.mode=a;break}P(aB)}if(aC.head!==null){aC.head.hcrc=(aC.flags>>>9)&1;aC.head.done=1}aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=an;break;case p:if(!ad(aB,32)){break inf_leave}aD.adler=aC.check=ai(aB.hold);P(aB);aC.mode=o;case o:if(aC.havedict==0){ah(aB);return ZLIB.Z_NEED_DICT}aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=an;case an:if(at==ZLIB.Z_BLOCK||at==ZLIB.Z_TREES){break inf_leave}case ao:if(aC.last){c(aB);aC.mode=d;break}if(!ad(aB,3)){break inf_leave}aC.last=b(aB,1);v(aB,1);switch(b(aB,2)){case 0:aC.mode=aj;break;case 1:C(aC);aC.mode=S;if(at==ZLIB.Z_TREES){v(aB,2);break inf_leave}break;case 2:aC.mode=al;break;case 3:aD.msg="invalid block type";aC.mode=a}v(aB,2);break;case aj:c(aB);if(!ad(aB,32)){break inf_leave}if((aB.hold&65535)!=(((aB.hold>>>16)&65535)^65535)){aD.msg="invalid stored block lengths";aC.mode=a;break}aC.length=aB.hold&65535;P(aB);aC.mode=k;if(at==ZLIB.Z_TREES){break inf_leave}case k:aC.mode=j;case j:ar=aC.length;if(ar){if(ar>aB.have){ar=aB.have}if(ar>aB.left){ar=aB.left}if(ar==0){break inf_leave}aD.output_data+=aD.input_data.substring(aB.next,aB.next+ar);aD.next_out+=ar;aB.have-=ar;aB.next+=ar;aB.left-=ar;aC.length-=ar;break}aC.mode=an;break;case al:if(!ad(aB,14)){break inf_leave}aC.nlen=b(aB,5)+257;v(aB,5);aC.ndist=b(aB,5)+1;v(aB,5);aC.ncode=b(aB,4)+4;v(aB,4);if(aC.nlen>286||aC.ndist>30){aD.msg="too many length or distance symbols";aC.mode=a;break}aC.have=0;aC.mode=W;case W:while(aC.have<aC.ncode){if(!ad(aB,3)){break inf_leave}var aE=b(aB,3);aC.lens[I[aC.have++]]=aE;v(aB,3)}while(aC.have<19){aC.lens[I[aC.have++]]=0}aC.next=0;aC.lencode=0;aC.lenbits=7;aA=K(aC,g);if(aA){aD.msg="invalid code lengths set";aC.mode=a;break}aC.have=0;aC.mode=f;case f:while(aC.have<aC.nlen+aC.ndist){for(;;){aw=aC.codes[aC.lencode+b(aB,aC.lenbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if(aw.val<16){v(aB,aw.bits);aC.lens[aC.have++]=aw.val}else{if(aw.val==16){if(!ad(aB,aw.bits+2)){break inf_leave}v(aB,aw.bits);if(aC.have==0){aD.msg="invalid bit length repeat";aC.mode=a;break}ay=aC.lens[aC.have-1];ar=3+b(aB,2);v(aB,2)}else{if(aw.val==17){if(!ad(aB,aw.bits+3)){break inf_leave}v(aB,aw.bits);ay=0;ar=3+b(aB,3);v(aB,3)}else{if(!ad(aB,aw.bits+7)){break inf_leave}v(aB,aw.bits);ay=0;ar=11+b(aB,7);v(aB,7)}}if(aC.have+ar>aC.nlen+aC.ndist){aD.msg="invalid bit length repeat";aC.mode=a;break}while(ar--){aC.lens[aC.have++]=ay}}}if(aC.mode==a){break}if(aC.lens[256]==0){aD.msg="invalid code -- missing end-of-block";aC.mode=a;break}aC.next=0;aC.lencode=aC.next;aC.lenbits=9;aA=K(aC,X);if(aA){aD.msg="invalid literal/lengths set";aC.mode=a;break}aC.distcode=aC.next;aC.distbits=6;aA=K(aC,t);if(aA){aD.msg="invalid distances set";aC.mode=a;break}aC.mode=S;if(at==ZLIB.Z_TREES){break inf_leave}case S:aC.mode=R;case R:if(aB.have>=6&&aB.left>=258){ah(aB);H(aD,az);Z(aD,aB);if(aC.mode==an){aC.back=-1}break}aC.back=0;for(;;){aw=aC.codes[aC.lencode+b(aB,aC.lenbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if(aw.op&&(aw.op&240)==0){ax=aw;for(;;){aw=aC.codes[aC.lencode+ax.val+(b(aB,ax.bits+ax.op)>>>ax.bits)];if(ax.bits+aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}v(aB,ax.bits);aC.back+=ax.bits}v(aB,aw.bits);aC.back+=aw.bits;aC.length=aw.val;if(aw.op==0){aC.mode=Y;break}if(aw.op&32){aC.back=-1;aC.mode=an;break}if(aw.op&64){aD.msg="invalid literal/length code";aC.mode=a;break}aC.extra=aw.op&15;aC.mode=T;case T:if(aC.extra){if(!ad(aB,aC.extra)){break inf_leave}aC.length+=b(aB,aC.extra);v(aB,aC.extra);aC.back+=aC.extra}aC.was=aC.length;aC.mode=q;case q:for(;;){aw=aC.codes[aC.distcode+b(aB,aC.distbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if((aw.op&240)==0){ax=aw;for(;;){aw=aC.codes[aC.distcode+ax.val+(b(aB,ax.bits+ax.op)>>>ax.bits)];if((ax.bits+aw.bits)<=aB.bits){break}if(!ag(aB)){break inf_leave}}v(aB,ax.bits);aC.back+=ax.bits}v(aB,aw.bits);aC.back+=aw.bits;if(aw.op&64){aD.msg="invalid distance code";aC.mode=a;break}aC.offset=aw.val;aC.extra=aw.op&15;aC.mode=r;case r:if(aC.extra){if(!ad(aB,aC.extra)){break inf_leave}aC.offset+=b(aB,aC.extra);v(aB,aC.extra);aC.back+=aC.extra}aC.mode=aa;case aa:if(aB.left==0){break inf_leave}ar=az-aB.left;if(aC.offset>ar){ar=aC.offset-ar;if(ar>aC.whave){if(aC.sane){aD.msg="invalid distance too far back";aC.mode=a;break}}if(ar>aC.wnext){ar-=aC.wnext;av=aC.wsize-ar;au=-1}else{av=aC.wnext-ar;au=-1}if(ar>aC.length){ar=aC.length}}else{av=-1;au=aD.next_out-aC.offset;ar=aC.length}if(ar>aB.left){ar=aB.left}aB.left-=ar;aC.length-=ar;if(av>=0){aD.output_data+=aC.window.substring(av,av+ar);aD.next_out+=ar;ar=0}else{aD.next_out+=ar;do{aD.output_data+=aD.output_data.charAt(au++)}while(--ar)}if(aC.length==0){aC.mode=R}break;case Y:if(aB.left==0){break inf_leave}aD.output_data+=String.fromCharCode(aC.length);aD.next_out++;aB.left--;aC.mode=R;break;case d:if(aC.wrap){if(!ad(aB,32)){break inf_leave}az-=aB.left;aD.total_out+=az;aC.total+=az;if(az){aD.adler=aC.check=aD.checksum_function(aC.check,aD.output_data,aD.output_data.length-az,az)}az=aB.left;if((aC.flags?aB.hold:ai(aB.hold))!=aC.check){aD.msg="incorrect data check";aC.mode=a;break}P(aB)}aC.mode=V;case V:if(aC.wrap&&aC.flags){if(!ad(aB,32)){break inf_leave}if(aB.hold!=(aC.total&4294967295)){aD.msg="incorrect length check";aC.mode=a;break}P(aB)}aC.mode=u;case u:aA=ZLIB.Z_STREAM_END;break inf_leave;case a:aA=ZLIB.Z_DATA_ERROR;break inf_leave;case ab:return ZLIB.Z_MEM_ERROR;case ak:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ah(aB);if(aC.wsize||(az!=aD.avail_out&&aC.mode<a&&(aC.mode<d||at!=ZLIB.Z_FINISH))){if(ap(aD)){aC.mode=ab;return ZLIB.Z_MEM_ERROR}}aq-=aD.avail_in;az-=aD.avail_out;aD.total_in+=aq;aD.total_out+=az;aC.total+=az;if(aC.wrap&&az){aD.adler=aC.check=aD.checksum_function(aC.check,aD.output_data,0,aD.output_data.length)}aD.data_type=aC.bits+(aC.last?64:0)+(aC.mode==an?128:0)+(aC.mode==S||aC.mode==k?256:0);if(((aq==0&&az==0)||at==ZLIB.Z_FINISH)&&aA==ZLIB.Z_OK){aA=ZLIB.Z_BUF_ERROR}return aA};ZLIB.inflateEnd=function(ar){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;aq.window=null;ar.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(au,av){var at;var aq;var ar=16384;this.input_data=au;this.next_in=E(av,"next_in",0);this.avail_in=E(av,"avail_in",au.length-this.next_in);at=E(av,"flush",ZLIB.Z_SYNC_FLUSH);aq=E(av,"avail_out",-1);var aw="";do{this.avail_out=(aq>=0?aq:ar);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,at);if(aq>=0){return this.output_data}aw+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return aw};ZLIB.z_stream.prototype.inflateReset=function(aq){return ZLIB.inflateReset(this,aq)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var meshserver=null;var xdr=null;var serverinfo=null;var nodes=[];var filetree={};var userinfo=null;var serverinfo=null;var users=null;var nodeShortIdent=0;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var debugmode=false;var attemptWebRTC=((features&128)!=0);var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"];var files;function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl("{{{domainurl}}}");meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}}}}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function onMessage(h,d){switch(d.action){case"serverinfo":serverinfo=d.serverinfo;break;case"userinfo":userinfo=d.userinfo;QH("p3userName",userinfo.name);break;case"users":users={};for(var c in d.users){users[d.users[c]._id]=d.users[c]}updateUsers();break;case"wssessioncount":wssessions=d.wssessions;updateUsers();break;case"meshes":meshes={};for(var c in d.meshes){meshes[d.meshes[c]._id]=d.meshes[c]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(d.filetree);updateFiles();break;case"nodes":nodes=[];for(var c in d.nodes){for(var e in d.nodes[c]){if(!meshes[c]){console.log("Invalid mesh (1): "+c);continue}d.nodes[c][e].namel=d.nodes[c][e].name.toLowerCase();if(d.nodes[c][e].rname){d.nodes[c][e].rnamel=d.nodes[c][e].rname.toLowerCase()}else{d.nodes[c][e].rnamel=d.nodes[c][e].namel}d.nodes[c][e].meshnamel=meshes[c].name.toLowerCase();d.nodes[c][e].meshid=c;d.nodes[c][e].state=(d.nodes[c][e].state)?(d.nodes[c][e].state):0;d.nodes[c][e].desc=d.nodes[c][e].desc;if(!d.nodes[c][e].icon){d.nodes[c][e].icon=1}d.nodes[c][e].ident=++nodeShortIdent;nodes.push(d.nodes[c][e])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(d.nodeid!=powerTimelineReq){break}powerTimelineNode=d.nodeid;powerTimeline=d.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==d.nodeid){drawDeviceTimeline()}break;case"event":switch(d.event.action){case"createmesh":if(d.event.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()]!=null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[d.event.meshid]==null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};meshserver.send({action:"nodes"})}else{meshes[d.event.meshid].name=d.event.name;meshes[d.event.meshid].desc=d.event.desc;meshes[d.event.meshid].links=d.event.links;if(meshes[d.event.meshid].links["user/{{{domain}}}/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[d.event.meshid])){go(2)}delete meshes[d.event.meshid];var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==d.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&&currentMesh._id==d.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[d.event.meshid]){delete meshes[d.event.meshid];updateMeshes();meshserver.send({action:"files"})}var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&&currentMesh._id==d.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==d.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var g=d.event.node;if(!meshes[g.meshid]){break}g.namel=g.name.toLowerCase();if(g.rname){g.rnamel=g.rname.toLowerCase()}else{g.rnamel=g.namel}g.meshnamel=meshes[g.meshid].name.toLowerCase();g.state=0;if(!g.icon){g.icon=1}g.ident=++nodeShortIdent;nodes.push(g);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var g=nodes[b];if(currentNode==g){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}delete currentNode}nodes.splice(b,1);updateDevices();updateMapMarkers()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var g=nodes[b];g.name=d.event.node.name;g.rname=d.event.node.rname;g.host=d.event.node.host;g.desc=d.event.node.desc;g.publicip=d.event.node.publicip;g.iploc=d.event.node.iploc;g.wifiloc=d.event.node.wifiloc;g.gpsloc=d.event.node.gpsloc;g.tags=d.event.node.tags;g.userloc=d.event.node.userloc;if(d.event.node.agent!=null){if(g.agent==null){g.agent={}}if(d.event.node.agent.ver!=null){g.agent.ver=d.event.node.agent.ver}if(d.event.node.agent.id!=null){g.agent.id=d.event.node.agent.id}if(d.event.node.agent.caps!=null){g.agent.caps=d.event.node.agent.caps}if(d.event.node.agent.core!=null){g.agent.core=d.event.node.agent.core}else{if(g.agent.core){delete g.agent.core}}g.agent.tag=d.event.node.agent.tag}if(d.event.node.intelamt!=null){if(g.intelamt==null){g.intelamt={}}if(d.event.node.intelamt.host!=null){g.intelamt.user=d.event.node.intelamt.host}if(d.event.node.intelamt.user!=null){g.intelamt.user=d.event.node.intelamt.user}if(d.event.node.intelamt.tls!=null){g.intelamt.tls=d.event.node.intelamt.tls}if(d.event.node.intelamt.ver!=null){g.intelamt.ver=d.event.node.intelamt.ver}if(d.event.node.intelamt.state!=null){g.intelamt.state=d.event.node.intelamt.state}}g.namel=g.name.toLowerCase();if(g.rname){g.rnamel=g.rname.toLowerCase()}else{g.rnamel=g.namel}if(d.event.node.icon){g.icon=d.event.node.icon}refreshDevice(g._id);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var g=nodes[b];g.conn=d.event.conn;g.pwr=d.event.pwr;updateDevices()}break;case"clearevents":break;case"login":if(users!=null&&users["user/{{{domain}}}/"+d.event.username.toLowerCase()]){users["user/{{{domain}}}/"+d.event.username.toLowerCase()].login=d.event.time}break;case"notify":break}break}}function topMenu(a){if((xxdialogMode!=null)&&(xxdialogMode!=0)&&(xxdialogMode!=999)){return}if(a===undefined){var b=(QS("topMenu").display=="none");if(b==true){if((xxdialogMode==0)||(xxdialogMode==null)){QV("topMenu",true);xxdialogMode=999}}else{QV("topMenu",false);xxdialogMode=0}}else{QV("topMenu",false);xxdialogMode=0;if((a==1)&&(xxcurrentView!=3)){goForward("account")}if((a==2)&&(xxcurrentView!=5)){goForward("files")}}}var backStack=[];function goBack(){if(xxdialogMode){return}if(backStack.length>0){backStack.pop()}goStack()}function goForward(a){if(xxdialogMode){return}backStack.push(a);goStack()}function goStack(){if(backStack.length==0){go(2);return}var a=backStack[backStack.length-1],b=a.split("/")[0];if(b=="node"){setupDeviceMenu(0);gotoDevice(a)}if(b=="mesh"){gotoMesh(a)}if(b=="account"){go(3)}if(b=="devices"){go(2)}if(b=="files"){go(5)}}function updateFooterMenu(b){while(b!=null&&b.length<3){b.push({n:""})}var d="",c="";if(b!=null){for(var a in b){d+='<td style="cursor:pointer'+((c=="")?"":";border-left:solid 1px white")+'" onclick="'+b[a].f+'">'+b[a].n;c=b[a].n}}QH("footerMenu","<tr>"+d)}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a=addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp3email").value=userinfo.email}account_validateEmail();Q("dp3email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&(Q("dp3email").value!=userinfo.email));if((x==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="<form action='{{{domainurl}}}deleteaccount' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="<form action='{{{domainurl}}}changepassword' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}var a=addHtmlValue("Name","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Mesh Agent Policy</option><option value=1>Intel&reg; AMT Agent-less Policy</option></select></div>");a+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Mesh",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp3meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp3meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value));var b="";if(Q("apassword1").value!=""){var a=checkPasswordStrength(Q("apassword1").value);if(a>=80){b="<span style=color:green>Strong<span>"}else{if(a>=60){b="<span style=color:blue>Good<span>"}else{b="<span style=color:red>Weak<span>"}}}QH("dxPassWarn",b)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function updateMeshes(){var c="",a=0;for(i in meshes){a++;var b=meshes[i].links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights;var d="Partial Rights";if(b==4294967295){d="Full Administrator"}else{if(b==0){d="No Rights"}}c+="<div style=cursor:pointer onclick=goForward('"+i+"')>";c+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>';c+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';c+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+d+"</div></div>";c+="</div></div>"}meshcount=a;QH("p3meshes",c);QV("p3noMeshFound",a==0)}function gotoMesh(a){currentMesh=meshes[a];if(currentMesh==null){goBack()}p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var filetreelinkpath;var filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var o="",p="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",m="Root",w,g=filetree,k=1;var e=[],t=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){if(a[q].checked){b.push(a[q].value)}}filetreelinkpath="";for(var q in filetreelocation){if((g.f!=null)&&(g.f[filetreelocation[q]]!=null)){e.push(filetreelocation[q]);m+=" / "+filetreelocation[q];if((k==1)){var A=filetreelocation[q].split("/");w=window.location+A[0]+"files/"+A[2];filetreelinkpath+=filetreelocation[q]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[q];if(k>2){w+="/"+filetreelocation[q]}}}g=g.f[filetreelocation[q]];c+=" / <a style=cursor:pointer onclick=p5folderup("+k+")>"+(g.n!=null?g.n:filetreelocation[q])+"</a>";k++}else{break}}filetreelocation=e;var u=m.toLowerCase().startsWith("root / "+userinfo._id+" / public");var j=p5sort_files(g.f);for(var q in j){var d=j[q],s=d.n,z;z=s;if(s.length>40){z='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,40))+"...</span>"}else{z=EscapeHtml(s)}s=EscapeHtml(s);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3||d.t==4){var y=(d.t==1||d.t==4)?p5getQuotabar(d):"",B="";n="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+s+"'>&nbsp;<span style=float:right;padding-right:4px title=\""+B+'">'+y+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+z+"</a></span></div>"}else{var r=z;var v="";if(u){v=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+w+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){r='<a target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+z+"</a>"+v}n="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+r+"</span></div>"}if(d.t<3){o+=n}else{p+=n}}QH("p5rightOfButtons",p5getQuotabar(g));QH("p5files",o+p);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",u);if(t==filetreelinkpath){a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){a[q].checked=(b.indexOf(a[q].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"None":"All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(e){a.push(e.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var sort=0;var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var showRealNames=false;var deviceHeaderTotal=0;var deviceHeaders={};var deviceHeadersTitles={};function updateDevicesEx(){var t="",a=0,d=null,b=0,e={},h={},g={};deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var d;if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}for(var j in nodes){if(nodes[j].v==false){continue}var m=meshes[nodes[j].meshid],o=m.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()];if(o==null){continue}var p=o.rights;if(sort==0){nodes.sort(meshSort);if(nodes[j].meshid!=d){deviceHeaderSet();var f="";if(meshes[nodes[j].meshid].mtype==1){f="<span style=color:lightgray>, Intel&reg; AMT only</span>"}if(d!=null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=padding-top:4px><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[j].meshid+'")>'+EscapeHtml(meshes[nodes[j].meshid].name)+"</span>"+f+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].meshid;e[d]=1;a=0}}else{if(sort==1){if(nodes[j].pwr!==d){deviceHeaderSet();if(d!==null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[j].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].pwr;a=0}}else{if(sort==2){if(d==null){d="1"}}}}b++;var u=EscapeHtml(nodes[j].name);if(u.length==0){u="<i>None</i>"}if((nodes[j].rname!=null)&&(nodes[j].rname.length>0)){u+=" / "+EscapeHtml(nodes[j].rname)}var q=EscapeHtml(nodes[j].name);if(showRealNames==true&&nodes[j].rname!=null){q=EscapeHtml(nodes[j].rname)}if(q.length==0){q="<i>None</i>"}var k=nodes[j].icon,s=NodeStateStr(nodes[j]);if((!nodes[j].conn)||(nodes[j].conn==0)){k+=" gray"}t+="<div style=cursor:pointer onclick=goForward('"+nodes[j]._id+"')>";t+='<div class="i'+k+'" style="float:left;margin-left:4px"></div>';t+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';t+="<div><div style=padding-left:12px;padding-top:2px><b>"+q+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+s+"</div></div>";t+="</div></div>";deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[j].state]=="undefined"){deviceHeaderCount[nodes[j].state]=1}else{deviceHeaderCount[nodes[j].state]++}}if(sort==0){for(var j in meshes){var l=meshes[j],n=l.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()];if(n!=null){var p=n.rights;if(e[l._id]==null){if((d!="")&&(t!="")){t+="</tr></table>"}t+="<div><div colspan=3 class=DevSt><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+l._id+'")>'+EscapeHtml(l.name)+"</span></div>";if(l.mtype==1){t+="<div style=padding:10px><i>No Intel&reg; AMT devices in this mesh"}if(l.mtype==2){t+="<div style=padding:10px><i>No devices in this mesh"}t+=".</i></div></div>";d=l._id;b++}}}}QH("xdevices",t);deviceHeaderSet();for(var j in deviceHeaders){QH(j,deviceHeaders[j])}for(var j in deviceHeadersTitles){Q(j).title=deviceHeadersTitles[j]}}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel&reg; AMT is routable.">Intel&reg; AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");var a="";for(x in deviceHeaderCount){if(a.length>0){a+=", "}a+=deviceHeaderCount[x]+" "+PowerStateStr2(x)}deviceHeadersTitles["DevxHeader"+deviceHeaderId]=a;deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}if(d>f){return 1}if(d<f){return -1}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights}var currentDevicePanel=0;var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(l,m,o){var k=getNodeFromId(l);if(k==null){goBack()}var g=meshes[k.meshid];if(g==null){goBack()}var h=g.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=k._id||o==true){currentNode=k;var j=EscapeHtml(k.name);if(j.length==0){j="<i>None</i>"}if((h&4)!=0){j="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+j+"</span>"}QH("p10deviceName",j);var r="<table style=width:100%>";r+=addDeviceAttribute('<span title="The name of the administrative group this computer belong to">Mesh</span>','<a title="The name of the group this computer belong to" onclick=goForward("'+k.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[k.meshid].name)+"</a>");if(k.rname!=null){r+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(k.rname)+"</span>")}if((g.mtype==1)||(k.name!=k.host)){if((h&4)!=0){if(k.host){r+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(k.host)+"</span>")}else{r+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{r+=addDeviceAttribute("Hostname",EscapeHtml(k.host))}}var d=k.desc?EscapeHtml(k.desc):"<i>None</i>";if((h&4)!=0){r+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+d+"</span>")}else{r+=addDeviceAttribute("Description",d)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((k.agent!=null)&&(k.agent.id!=null)&&(k.agent.ver!=null)){var p="";if(k.agent.id<=a.length){p=a[k.agent.id]}else{p=a[0]}if(k.agent.ver!=0){p+=" v"+k.agent.ver}r+=addDeviceAttribute("Mesh Agent",p)}if(k.intelamt!=null){var p="";var n={0:"Not&nbsp;Activated&nbsp;(Pre)",1:"Not&nbsp;Activated&nbsp;(In)",2:"Activated"};if(k.intelamt.ver!=null&&k.intelamt.state==null){p+="<i>Unknown&nbsp;State</i>, v"+k.intelamt.ver}else{if((k.intelamt.ver==null)&&(k.intelamt.state==2)){p+="<i>Activated</i>"}else{if((k.intelamt.ver==null)||(k.intelamt.state==null)){p+="<i>Unknown Version & State</i>"}else{p+=n[k.intelamt.state];if(k.intelamt.flags){if(k.intelamt.flags&2){p=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(k.intelamt.flags&4){p=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}p+=(", v"+k.intelamt.ver)}}}if(k.intelamt.tls==1){p+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(k.intelamt.state==2){if(k.intelamt.user==null||k.intelamt.user==""){if((h&4)!=0){p+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel&reg; AMT credentials" onclick=editDeviceAmtSettings("'+k._id+'")>No&nbsp;Credentials</i>'}else{p+=", <i style=color:#FF0000>No Credentials</i>"}}p+=" ";if((h&4)!=0){p+='<img src=images/link4.png height=10 width=10 title="Edit Intel&reg; AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+k._id+'")>'}}r+=addDeviceAttribute("Intel&reg; AMT",p)}if((k.agent!=null)&&(k.agent.tag!=null)&&(k.agent.tag!="mailto:")){var q=EscapeHtml(k.agent.tag);if(q.startsWith("mailto:")){q='<a href="'+q+'">'+q.substring(7)+"</a>"}r+=addDeviceAttribute("Agent Tag",q)}var b=k.conn;if(b&&b>1){var c=[];if((k.conn&1)!=0){c.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>')}if((k.conn&2)!=0){c.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">Intel&reg; AMT CIRA</span>')}if((k.conn&4)!=0){c.push('<span title="Intel&reg; AMT is routable and ready for use.">Intel&reg; AMT</span>')}if((k.conn&8)!=0){c.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>')}r+=addDeviceAttribute("Connectivity",c.join(", "))}var e="<i>None</i>";if(k.tags!=null){e="";for(var f in k.tags){e+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+k.tags[f]+"</span>"}}r+=addDeviceAttribute("Groups","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+e+"</span>");r+="</table><br />";if((h&76)!=0){r+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}QH("p10html",r);setupFiles();r="<div style=float:right;font-size:x-small;margin-right:10px>";if((h&4)!=0){r+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+k._id+'") title="Remove this device">Delete Device</a>'}r+="</div><div style=font-size:x-small>";r+="</div><br>";QH("p10html3",r);powerstate=PowerStateStr(k.state);if((b&1)!=0){if(powerstate.length>0){powerstate+=", "}powerstate+='<span style=font-size:10px title="Agent connected">Mesh Agent</span>'}if((b&2)!=0){if(powerstate.length>0){powerstate+=", "}powerstate+='<span style=font-size:10px title="Intel&reg; AMT connected">Intel&reg; AMT connected</span>'}else{if((b&4)!=0){if(powerstate.length>0){powerstate+=", "}powerstate+='<span style=font-size:10px title="Intel&reg; AMT detected">Intel&reg; AMT detected</span>'}}QH("MainComputerState",powerstate);QH("MainComputerImage",'<div class="i'+k.icon+'"></div>');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!m){m=10}go(m);setupDeviceMenu()}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(c,b){if(c!=null){currentDevicePanel=c}QV("p10general",currentDevicePanel==0);QV("p10desktop",currentDevicePanel==1);QV("p10files",currentDevicePanel==2);var a=[];if(currentDevicePanel!=0){a.push({n:"General",f:"setupDeviceMenu(0)"})}if(currentDevicePanel!=1){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&((currentNode!=null)&&(currentNode.mtype==2))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:170px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(90+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td style=width:100px;color:gray>"+a+"</td><td style=overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel&reg; AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,'Delete "'+EscapeHtml(currentNode.name)+'"?<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm',a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<table align=center><td>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Groups"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktop;var desktopNode;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();delete desktop;desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode;Q("Desk").addEventListener("DOMMouseScroll",function(a){return dmousewheel(a)});Q("Desk").addEventListener("mousewheel",function(a){return dmousewheel(a)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2));QV("connectbutton1h",(a==0)&&((currentNode.intelamt!=null)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var d=((currentNode.conn&1)!=0);QE("connectbutton1",d);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QE("DeskCAD",a==3);QE("DeskWD",a==3);QE("deskkeys",a==3);QV("DeskWD",(currentNode.agent)&&(currentNode.agent.id<5));QV("deskkeys",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToolsButton",d);QV("DeskToastButton",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToastButton",d);if(d==false){QV("DeskTools",false)}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();delete desktop;desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();delete desktop;desktopNode=desktop=null;QV("termdisplays",false);if(fullscreen==true){deskToggleFull()}break;case 2:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){}var fullscreen=false;function deskAdjust(){var c=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(c<0){var a=Q("DeskParent").clientHeight,b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,76],[desktop.m.KeyAction.UP,76],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}}}}}}function sendCAD(){if(xxdialogMode||desktop==null||desktop.State!=3){return}desktop.m.sendcad()}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if(!xxdialogMode&&desktop!=null){desktop.m.mousedown(a)}}function dmouseup(a){if(!xxdialogMode&&desktop!=null){desktop.m.mouseup(a)}}function dmousemove(a){if(!xxdialogMode&&desktop!=null){desktop.m.mousemove(a)}}function dmousewheel(a){if(!xxdialogMode&&desktop!=null&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();delete files;files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();delete files;files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();delete files;files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview();p13oldlinkpath=null}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var l="",m="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",j="Root";var u=p13filetree.path.split("\\");p13filetreelocation=[];for(var n in u){if(u[n]!=""){p13filetreelocation.push(u[n])}}for(var n in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(n)+1)+")>"+p13filetreelocation[n]+"</a>"}var q=p13filetreelocation.join("/");var e=p13sort_files(p13filetree.dir);for(var n in e){var d=e[n],p=d.n,s;s=p;if(p.length>70){s='<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,70))+"...</span>"}else{s=EscapeHtml(p)}p=EscapeHtml(p);var g="";if(d.s!=null){g=getFileSizeStr(d.s)}var k="";if(d.t<3){var r="",t="";k="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right title=\""+t+'">'+r+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var o=s;if(d.s>0){o='<a target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(q+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+s+"</a>"}k="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+g+"</span><span><div class=fileIcon"+d.t+"></div>"+o+"</span></div>"}if(d.t<3){l+=k}else{m+=k}}QH("p13files",l+m);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var n=0;n<a.length;n++){if(b.indexOf(p13filetree.dir[a[n].value].n)>=0){a[n].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"None":"All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength})};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){e="Intel&reg; AMT group"}if(currentMesh.mtype==2){e="Mesh agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&&currentMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+="<br style=clear:both><br>";var b=currentMesh.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){k+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>"}k+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name<m.name){return -1}return 0});for(var c in h){var j="",g="Partial&nbsp;Rights",f=h[c].rights;if(f==4294967295){g="Full&nbsp;Administrator"}else{if(f==0){g="No&nbsp;Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){j='<a onclick=p20deleteUser(event,"'+encodeURIComponent(h[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}k+='<tr onclick=p20viewuser("'+encodeURIComponent(h[c].id)+'") style=height:32px;cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+"><td>";k+="<div style=float:right>"+j+"</div><div style=float:right;padding-right:4px>"+g+"</div><div class=m2></div><div>&nbsp;"+h[c].name+"<div></div></div>";k+="</td></tr>";++a}k+="</tbody></table>";if(d==4294967295){k+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Mesh",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+='<div style="border:2px groove gray;background-color:white;max-height:80px;overflow-y:scroll">';a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Mesh<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Mesh Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Mesh Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/{{{domain}}}/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Mesh"}if((c&2)!=0){d+=", Manage Mesh Users"}if((c&4)!=0){d+=", Manage Mesh Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/{{{domain}}}/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var xxcurrentView=-1;function go(b){if(xxdialogMode||xxcurrentView==b){return}updateFooterMenu();setDialogMode(0);for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-300)/2))+"px");deskAdjust()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)}function reload(){window.location.href=window.location.href}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>&diams; "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();</script></body></html>
\ No newline at end of file
1 +<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <title>MeshCentral - Login</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;border:none;}.m0{background:url(../images/images16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.m1{background:url(../images/images16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.m2{background:url(../images/images16.png) -96px 0px;height:16px;width:16px;border:none;float:left;}.m3{background:url(../images/images16.png) -112px 0px;height:16px;width:16px;border:none;float:left;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="width:calc(100% - 50px);overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <img class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer" onclick="topMenu()" src="/images/3bars-30.png" width="30" height="30"> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%"> <div id="column_l" style="width:100%;padding:0;position:absolute;bottom:0px;top:0px"> <div id="p0" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p0message" style="text-align:center;width:100%">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> </div> <div id="p1" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p1message" style="text-align:center;width:100%"></div> </div> </div> <div id="p2" style="display:none"> <div id="xdevices"></div> </div> <div id="p3" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p3userName"></span></strong><br> </div> </td> </tr> </table> <div id="p3info" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div style="margin-left:8px"> <div id="p3AccountActions"> <p><strong>Account actions</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div style="margin-top:5px"><span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a></span></div> <div style="margin-top:5px"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> </div> </div> <br style="clear:both"> <strong>Meshes</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p3meshes"></div> <div id="p3noMeshFound" style="margin-left:9px;display:none">No meshes. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> </div> </div> <div id="p5" style="display:none"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large">My Files</strong><br> </div> </td> </tr> </table> <div id="p5myfiles" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <table id="p5toolbar" style="width:100%;height:78px" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5FolderUp" disabled="disabled" onclick="p5folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5NewFolderButton" disabled="disabled" value="Folder" onclick="p5createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RefreshButton" value="Refresh" onclick="p5refreshFiles()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p5currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding="0" cellspacing="0"> <tr> <td style="text-align:left;padding:3px">&nbsp;<span id="p5bottomstatus"></span></td> <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td> </tr> </table> </div> </div> <div id="p10" style="display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td> <a id="MainComputerImage" style="cursor:pointer" onclick="p10showiconselector()"></a> </td> <td> <div style="margin-left:5px"> <strong><span id="p10deviceName"></span></strong><br> <span id="MainComputerState"></span> </div> </td> </tr> </table> <div id="p10general" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div id="p10html" style="margin-left:8px;margin-right:8px"></div> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p10desktop" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <div id="deskarea1" style="position:absolute;top:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span>&nbsp; </div> <div style="margin-left:3px"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"> <span id="deskstatus">Disconnected</span> </div> </div> </div> <div id="deskarea3" style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"> <div id="deskarea3x" style="background:black;text-align:center;height:100%;position:relative"> <div id="DeskParent" style="height:100%"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </div> </div> <div id="deskarea4" style="position:absolute;bottom:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>&nbsp; <input id="DeskToastButton" type="button" value="Toast" title="Display a notification message on the remote computer" onkeypress="return false" onkeydown="return false" onclick="deviceToastFunction()">&nbsp; </div> <div> <input id="deskActionsBtn" type="button" style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()"> <input type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none"> <input id="DeskCAD" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> </div> </div> </div> </div> <div id="p10files" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:2px"> </div> <div style="margin-left:2px"> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13NewFolderButton" disabled="disabled" value="Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p13currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding="0" cellspacing="0"> <tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6">&nbsp;<span id="p13bottomstatus"></span></td></tr> </table> </div> </div> <div id="p20" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">&#9664;</div> </td> <td onclick="p20editmesh(1)"> <img src="/images/meshicon50.png" width="50" height="50"> </td> <td onclick="p20editmesh(1)"> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p20meshName"></span></strong><br> </div> </td> </tr> </table> <div id="p20info" style="margin-left:8px;margin-right:8px"></div> </div> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table id="footerMenu" cellpadding="0" cellspacing="0" style="height:32px;width:100%;color:white;cursor:pointer;table-layout:fixed"></table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <div id="topMenu" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0px 0px 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(2)">My Files</div> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(1)">My Account</div> <a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Logout</div></a> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){c.Stop()}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateAgentRemoteDesktop=function(a,c){var b={};b.CanvasId=a;if(typeof a==="string"){b.CanvasId=Q(a)}b.Canvas=b.CanvasId.getContext("2d");b.scrolldiv=c;b.State=0;b.PendingOperations=[];b.tilesReceived=0;b.TilesDrawn=0;b.KillDraw=0;b.ipad=false;b.tabletKeyboardVisible=false;b.LastX=0;b.LastY=0;b.touchenabled=0;b.submenuoffset=0;b.touchtimer=null;b.TouchArray={};b.connectmode=0;b.connectioncount=0;b.rotation=0;b.protocol=2;b.debugmode=0;b.firstUpKeys=[];b.stopInput=false;b.sessionid=0;b.username;b.oldie=false;b.CompressionLevel=50;b.ScalingLevel=1024;b.FrameRateTimer=50;b.FirstDraw=false;b.ScreenWidth=960;b.ScreenHeight=700;b.width=960;b.height=960;b.onScreenSizeChange=null;b.onMessage=null;b.onConnectCountChanged=null;b.onDebugMessage=null;b.onTouchEnabledChanged=null;b.onDisplayinfo=null;b.Start=function(){b.State=0};b.Stop=function(){b.setRotation(0);b.UnGrabKeyInput();b.UnGrabMouseInput();b.touchenabled=0;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}b.Canvas.clearRect(0,0,b.CanvasId.width,b.CanvasId.height)};b.xxStateChange=function(d){if(b.State==d){return}b.State=d;switch(d){case 0:b.Stop();break;case 3:break}};b.send=function(d){b.parent.send(d)};b.ProcessPictureMsg=function(e,g,h){var f=new Image();f.xcount=b.tilesReceived++;var d=b.tilesReceived;f.src="data:image/jpeg;base64,"+btoa(e.substring(4,e.length));f.onload=function(){if(b.Canvas!=null&&b.KillDraw<d&&b.State!=0){b.PendingOperations.push([d,2,f,g,h]);while(b.DoPendingOperations()){}}};f.error=function(){console.log("DecodeTileError")}};b.DoPendingOperations=function(){if(b.PendingOperations.length==0){return false}for(var d=0;d<b.PendingOperations.length;d++){var e=b.PendingOperations[d];if(e[0]==(b.TilesDrawn+1)){if(e[1]==1){b.ProcessCopyRectMsg(e[2])}else{if(e[1]==2){b.Canvas.drawImage(e[2],b.rotX(e[3],e[4]),b.rotY(e[3],e[4]));delete e[2]}}b.PendingOperations.splice(d,1);delete e;b.TilesDrawn++;if(b.TilesDrawn==b.tilesReceived&&b.KillDraw<b.TilesDrawn){b.KillDraw=b.TilesDrawn=b.tilesReceived=0}return true}}if(b.oldie&&b.PendingOperations.length>0){b.TilesDrawn++}return false};b.ProcessCopyRectMsg=function(g){var h=((g.charCodeAt(0)&255)<<8)+(g.charCodeAt(1)&255);var j=((g.charCodeAt(2)&255)<<8)+(g.charCodeAt(3)&255);var d=((g.charCodeAt(4)&255)<<8)+(g.charCodeAt(5)&255);var e=((g.charCodeAt(6)&255)<<8)+(g.charCodeAt(7)&255);var k=((g.charCodeAt(8)&255)<<8)+(g.charCodeAt(9)&255);var f=((g.charCodeAt(10)&255)<<8)+(g.charCodeAt(11)&255);b.Canvas.drawImage(Canvas.canvas,h,j,k,f,d,e,k,f)};b.SendUnPause=function(){b.send(String.fromCharCode(0,8,0,5,0))};b.SendPause=function(){b.send(String.fromCharCode(0,8,0,5,1))};b.SendCompressionLevel=function(g,e,f,d){if(e){b.CompressionLevel=e}if(f){b.ScalingLevel=f}if(d){b.FrameRateTimer=d}b.send(String.fromCharCode(0,5,0,10,g,b.CompressionLevel)+b.shortToStr(b.ScalingLevel)+b.shortToStr(b.FrameRateTimer))};b.SendRefresh=function(){b.send(String.fromCharCode(0,6,0,4))};b.ProcessScreenMsg=function(e,d){if(b.debugmode==1){console.log("ScreenSize: "+e+" x "+d)}b.Canvas.setTransform(1,0,0,1,0,0);b.rotation=0;b.FirstDraw=true;b.ScreenWidth=b.width=e;b.ScreenHeight=b.height=d;b.KillDraw=b.tilesReceived;while(b.PendingOperations.length>0){b.PendingOperations.shift()}b.SendCompressionLevel(1);b.SendUnPause();if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}};b.ProcessData=function(e){var d=0;while(d<e.length){d+=b.ProcessDataEx(e.substring(d))}};b.ProcessDataEx=function(n){if(n.length<4){return}var d=null,o=0,p=0,f=ReadShort(n,0),e=ReadShort(n,2);if((e!=n.length)&&(b.debugmode==1)){console.log(e,n.length,e==n.length)}if(f>=18){console.error("Invalid KVM command "+f+" of size "+e);console.log("Invalid KVM data",n.length,n,rstr2hex(n));return}if(e>n.length){console.error("KVM invalid command size",e,n.length);return}if(f==3||f==4||f==7){d=n.substring(4,e);o=((d.charCodeAt(0)&255)<<8)+(d.charCodeAt(1)&255);p=((d.charCodeAt(2)&255)<<8)+(d.charCodeAt(3)&255);if(b.debugmode==1){console.log("CMD"+f+" at X="+o+" Y="+p)}}switch(f){case 3:if(b.FirstDraw){b.onResize()}b.ProcessPictureMsg(d,o,p);break;case 4:if(b.FirstDraw){b.onResize()}if(b.TilesDrawn==b.tilesReceived){b.ProcessCopyRectMsg(d)}else{b.PendingOperations.push([++tilesReceived,1,d])}break;case 7:b.ProcessScreenMsg(o,p);b.SendKeyMsgKC(b.KeyAction.UP,16);b.SendKeyMsgKC(b.KeyAction.UP,17);b.SendKeyMsgKC(b.KeyAction.UP,18);b.SendKeyMsgKC(b.KeyAction.UP,91);b.SendKeyMsgKC(b.KeyAction.UP,92);b.SendKeyMsgKC(b.KeyAction.UP,16);b.send(String.fromCharCode(0,14,0,4));break;case 11:var k=[],g=((n.charCodeAt(4)&255)<<8)+(n.charCodeAt(5)&255);if(g>0){var m=0,l=((n.charCodeAt(6+(g*2))&255)<<8)+(n.charCodeAt(7+(g*2))&255);for(var j=0;j<g;j++){var h=((n.charCodeAt(6+(j*2))&255)<<8)+(n.charCodeAt(7+(j*2))&255);if(h==65535){k.push("All Displays")}else{k.push("Display "+h)}if(h==l){m=j}}}if(b.onDisplayinfo!=null){b.onDisplayinfo(b,k,m)}break;case 12:break;case 14:b.touchenabled=1;b.TouchArray={};if(b.onTouchEnabledChanged!=null){b.onTouchEnabledChanged(b.touchenabled)}break;case 15:b.TouchArray={};break;case 16:b.connectioncount=ReadInt(n,4);if(b.onConnectCountChanged!=null){b.onConnectCountChanged(b.connectioncount,b)}break;case 17:if(b.onMessage!=null){b.onMessage(n.substring(4,e),b)}break}return e};b.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};b.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};b.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};b.Alternate=0;b.SendKeyMsg=function(d,e){if(d==null){return}if(!e){var e=window.event}var f=e.keyCode;if(f==59){f=186}b.SendKeyMsgKC(d,f)};b.SendMessage=function(d){if(b.State==3){b.send(String.fromCharCode(0,17)+b.shortToStr(4+d.length)+d)}};b.SendKeyMsgKC=function(d,f){if(b.State!=3){return}if(typeof d=="object"){for(var e in d){b.SendKeyMsgKC(d[e][0],d[e][1])}}else{b.send(String.fromCharCode(0,b.InputType.KEY,0,6,(d-1),f))}};b.sendcad=function(){b.SendCtrlAltDelMsg()};b.SendCtrlAltDelMsg=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.CTRLALTDEL,0,4))}};b.SendEscKey=function(){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.KEY,0,6,0,27,0,b.InputType.KEY,0,6,1,27))}};b.SendStartMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendCharmsMsg=function(){b.SendKeyMsgKC(b.KeyAction.EXDOWN,91);b.SendKeyMsgKC(b.KeyAction.DOWN,67);b.SendKeyMsgKC(b.KeyAction.UP,67);b.SendKeyMsgKC(b.KeyAction.EXUP,91)};b.SendTouchMsg1=function(e,d,f,g){if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(14)+String.fromCharCode(1,e)+b.intToStr(d)+b.shortToStr(f)+b.shortToStr(g))}};b.SendTouchMsg2=function(f,d){var h="";var e;var j="TOUCHSEND: ";for(var g in b.TouchArray){if(g==f){e=d}else{if(b.TouchArray[g].f==1){e=65536|2|4;b.TouchArray[g].f=3;j+="START"+g}else{if(b.TouchArray[g].f==2){e=262144;j+="STOP"+g}else{e=2|4|131072}}}h+=String.fromCharCode(g)+b.intToStr(e)+b.shortToStr(b.TouchArray[g].x)+b.shortToStr(b.TouchArray[g].y);if(b.TouchArray[g].f==2){delete b.TouchArray[g]}}if(b.State==3){b.send(String.fromCharCode(0,b.InputType.TOUCH)+b.shortToStr(5+h.length)+String.fromCharCode(2)+h)}if(Object.keys(b.TouchArray).length==0&&b.touchtimer!=null){clearInterval(b.touchtimer);b.touchtimer=null}};b.SendMouseMsg=function(d,g){if(b.State!=3){return}if(d!=null&&b.Canvas!=null){if(!g){var g=window.event}var k=(b.Canvas.canvas.height/b.CanvasId.clientHeight);var l=(b.Canvas.canvas.width/b.CanvasId.clientWidth);var j=b.GetPositionOfControl(b.Canvas.canvas);var m=((g.pageX-j[0])*l);var n=((g.pageY-j[1])*k);if(m>=0&&m<=b.Canvas.canvas.width&&n>=0&&n<=b.Canvas.canvas.height){var e=0;var f=0;if(d==b.KeyAction.UP||d==b.KeyAction.DOWN){if(g.which){((g.which==1)?(e=b.MouseButton.LEFT):((g.which==2)?(e=b.MouseButton.MIDDLE):(e=b.MouseButton.RIGHT)))}else{if(g.button){((g.button==0)?(e=b.MouseButton.LEFT):((g.button==1)?(e=b.MouseButton.MIDDLE):(e=b.MouseButton.RIGHT)))}}}else{if(d==b.KeyAction.SCROLL){if(g.detail){f=(-1*(g.detail*120))}else{if(g.wheelDelta){f=(g.wheelDelta*3)}}}}var h="";if(d==b.KeyAction.SCROLL){h=String.fromCharCode(0,b.InputType.MOUSE,0,12,0,((d==b.KeyAction.DOWN)?e:((e*2)&255)),((m/256)&255),(m&255),((n/256)&255),(n&255),((f/256)&255),(f&255))}else{h=String.fromCharCode(0,b.InputType.MOUSE,0,10,0,((d==b.KeyAction.DOWN)?e:((e*2)&255)),((m/256)&255),(m&255),((n/256)&255),(n&255))}if(b.Action==b.KeyAction.NONE){if(b.Alternate==0||b.ipad){b.send(h);b.Alternate=1}else{b.Alternate=0}}else{b.send(h)}}}};b.GetDisplayNumbers=function(){b.send(String.fromCharCode(0,11,0,4))};b.SetDisplay=function(d){b.send(String.fromCharCode(0,12,0,6,d>>8,d&255))};b.intToStr=function(d){return String.fromCharCode((d>>24)&255,(d>>16)&255,(d>>8)&255,d&255)};b.shortToStr=function(d){return String.fromCharCode((d>>8)&255,d&255)};b.onResize=function(){if(b.ScreenWidth==0||b.ScreenHeight==0){return}if(b.Canvas.canvas.width==b.ScreenWidth&&b.Canvas.canvas.height==b.ScreenHeight){return}if(b.FirstDraw){b.Canvas.canvas.width=b.ScreenWidth;b.Canvas.canvas.height=b.ScreenHeight;b.Canvas.fillRect(0,0,b.ScreenWidth,b.ScreenHeight);if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}}b.FirstDraw=false};b.xxMouseInputGrab=false;b.xxKeyInputGrab=false;b.xxMouseMove=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.NONE,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseUp=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxMouseDown=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxDOMMouseScroll=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxMouseWheel=function(d){if(b.State==3){b.SendMouseMsg(b.KeyAction.SCROLL,d);return false}return true};b.xxKeyUp=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.UP,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyDown=function(d){if(b.State==3){b.SendKeyMsg(b.KeyAction.DOWN,d)}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.xxKeyPress=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};b.handleKeys=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyPress(d)};b.handleKeyUp=function(d){if(b.stopInput==true||desktop.State!=3){return false}if(b.firstUpKeys.length<5){b.firstUpKeys.push(d.keyCode);if((b.firstUpKeys.length==5)){var f=b.firstUpKeys.join(",");if((f=="16,17,91,91,16")||(f=="16,17,18,91,92")){b.stopInput=true}}}return b.xxKeyUp(d)};b.handleKeyDown=function(d){if(b.stopInput==true||desktop.State!=3){return false}return b.xxKeyDown(d)};b.mousedown=function(d){if(b.stopInput==true){return false}return b.xxMouseDown(d)};b.mouseup=function(d){if(b.stopInput==true){return false}return b.xxMouseUp(d)};b.mousemove=function(d){if(b.stopInput==true){return false}return b.xxMouseMove(d)};b.mousewheel=function(d){if(b.stopInput==true){return false}return b.xxMouseWheel(d)};b.xxMsTouchEvent=function(d){if(d.originalEvent.pointerType==4){return}if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}if(d.type=="MSPointerDown"||d.type=="MSPointerMove"||d.type=="MSPointerUp"){var e=0;var f=d.originalEvent.pointerId%256;var g=d.offsetX*(Canvas.canvas.width/b.CanvasId.clientWidth);var h=d.offsetY*(Canvas.canvas.height/b.CanvasId.clientHeight);if(d.type=="MSPointerDown"){e=65536|2|4}else{if(d.type=="MSPointerMove"){e=131072|2|4}else{if(d.type=="MSPointerUp"){e=262144}}}if(!b.TouchArray[f]){b.TouchArray[f]={x:g,y:h}}b.SendTouchMsg2(f,e);if(d.type=="MSPointerUp"){delete b.TouchArray[f]}}else{alert(d.type)}return true};b.xxTouchStart=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(KeyAction.DOWN,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(!b.TouchArray[g]){b.TouchArray[g]={x:(d.originalEvent.touches[f].pageX-h[0])*(Canvas.canvas.width/b.CanvasId.clientWidth),y:(d.originalEvent.touches[f].pageY-h[1])*(Canvas.canvas.height/b.CanvasId.clientHeight),f:1}}}if(Object.keys(b.TouchArray).length>0&&touchtimer==null){b.touchtimer=setInterval(function(){b.SendTouchMsg2(256,0)},50)}}};b.xxTouchMove=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}var j=d.originalEvent.touches[0];d.which=1;b.LastX=d.pageX=j.pageX;b.LastY=d.pageY=j.pageY;b.SendMouseMsg(b.KeyAction.NONE,d)}else{var h=b.GetPositionOfControl(Canvas.canvas);for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].x=(d.originalEvent.touches[f].pageX-h[0])*(b.Canvas.canvas.width/b.CanvasId.clientWidth);b.TouchArray[g].y=(d.originalEvent.touches[f].pageY-h[1])*(b.Canvas.canvas.height/b.CanvasId.clientHeight)}}}};b.xxTouchEnd=function(d){if(b.State!=3){return}if(d.preventDefault){d.preventDefault()}if(b.touchenabled==0||b.touchenabled==1){if(d.originalEvent.touches.length>1){return}d.which=1;d.pageX=LastX;d.pageY=LastY;b.SendMouseMsg(KeyAction.UP,d)}else{for(var f in d.originalEvent.changedTouches){if(!d.originalEvent.changedTouches[f].identifier){continue}var g=d.originalEvent.changedTouches[f].identifier%256;if(b.TouchArray[g]){b.TouchArray[g].f=2}}}};b.GrabMouseInput=function(){if(b.xxMouseInputGrab==true){return}var d=b.CanvasId;d.onmousemove=b.xxMouseMove;d.onmouseup=b.xxMouseUp;d.onmousedown=b.xxMouseDown;d.touchstart=b.xxTouchStart;d.touchmove=b.xxTouchMove;d.touchend=b.xxTouchEnd;d.MSPointerDown=b.xxMsTouchEvent;d.MSPointerMove=b.xxMsTouchEvent;d.MSPointerUp=b.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=b.xxDOMMouseScroll}else{d.onmousewheel=b.xxMouseWheel}b.xxMouseInputGrab=true};b.UnGrabMouseInput=function(){if(b.xxMouseInputGrab==false){return}var d=b.CanvasId;d.onmousemove=null;d.onmouseup=null;d.onmousedown=null;d.touchstart=null;d.touchmove=null;d.touchend=null;d.MSPointerDown=null;d.MSPointerMove=null;d.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){d.DOMMouseScroll=null}else{d.onmousewheel=null}b.xxMouseInputGrab=false};b.GrabKeyInput=function(){if(b.xxKeyInputGrab==true){return}document.onkeyup=b.xxKeyUp;document.onkeydown=b.xxKeyDown;document.onkeypress=b.xxKeyPress;b.xxKeyInputGrab=true};b.UnGrabKeyInput=function(){if(b.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;b.xxKeyInputGrab=false};b.GetPositionOfControl=function(d){var e=Array(2);e[0]=e[1]=0;while(d){e[0]+=d.offsetLeft;e[1]+=d.offsetTop;d=d.offsetParent}return e};b.crotX=function(d,e){if(b.rotation==0){return d}if(b.rotation==1){return e}if(b.rotation==2){return b.Canvas.canvas.width-d}if(b.rotation==3){return b.Canvas.canvas.height-e}};b.crotY=function(d,e){if(b.rotation==0){return e}if(b.rotation==1){return b.Canvas.canvas.width-d}if(b.rotation==2){return b.Canvas.canvas.height-e}if(b.rotation==3){return d}};b.rotX=function(d,e){if(b.rotation==0||b.rotation==1){return d}if(b.rotation==2){return d-b.Canvas.canvas.width}if(b.rotation==3){return d-b.Canvas.canvas.height}};b.rotY=function(d,e){if(b.rotation==0||b.rotation==3){return e}if(b.rotation==1){return e-b.Canvas.canvas.width}if(b.rotation==2){return e-b.Canvas.canvas.height}};b.tcanvas=null;b.setRotation=function(h){while(h<0){h+=4}var d=h%4;if(d==b.rotation){return true}var f=b.Canvas.canvas.width;var e=b.Canvas.canvas.height;if(b.rotation==1||b.rotation==3){f=b.Canvas.canvas.height;e=b.Canvas.canvas.width}if(b.tcanvas==null){b.tcanvas=document.createElement("canvas")}var g=b.tcanvas.getContext("2d");g.setTransform(1,0,0,1,0,0);g.canvas.width=f;g.canvas.height=e;g.rotate((b.rotation*-90)*Math.PI/180);if(b.rotation==0){g.drawImage(b.Canvas.canvas,0,0)}if(b.rotation==1){g.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,0)}if(b.rotation==2){g.drawImage(b.Canvas.canvas,-b.Canvas.canvas.width,-b.Canvas.canvas.height)}if(b.rotation==3){g.drawImage(b.Canvas.canvas,0,-b.Canvas.canvas.height)}if(b.rotation==0||b.rotation==2){b.Canvas.canvas.height=f;b.Canvas.canvas.width=e}if(b.rotation==1||b.rotation==3){b.Canvas.canvas.height=e;b.Canvas.canvas.width=f}b.Canvas.setTransform(1,0,0,1,0,0);b.Canvas.rotate((d*90)*Math.PI/180);b.rotation=d;b.Canvas.drawImage(b.tcanvas,b.rotX(0,0),b.rotY(0,0));b.ScreenWidth=b.Canvas.canvas.width;b.ScreenHeight=b.Canvas.canvas.height;if(b.onScreenSizeChange!=null){b.onScreenSizeChange(b,b.ScreenWidth,b.ScreenHeight,b.CanvasId)}return true};b.MuchTheSame=function(d,e){return(Math.abs(d-e)<4)};b.Debug=function(d){console.log(d)};b.getIEVersion=function(){var d=-1;if(navigator.appName=="Microsoft Internet Explorer"){var f=navigator.userAgent;var e=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(e.exec(f)!=null){d=parseFloat(RegExp.$1)}}return d};b.haltEvent=function(d){if(d.preventDefault){d.preventDefault()}if(d.stopPropagation){d.stopPropagation()}return false};return b};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,C,t,B,z,A,w,D,y){r.wsman.ExecSubscribe(r.CompleteName(v),u,C,function(G,F,E,H){q();t(r,v,E,H,B)},0,z,A,w,D,y);q()};r.UnSubscribe=function(u,t,y,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(B,A,z,C){q();t(r,u,z,C,y)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,w)},0,v);q()};r.Put=function(u,w,t,z,v,y){r.wsman.ExecPut(r.CompleteName(u),w,function(C,B,A,D){q();t(r,u,A,D,z)},0,v,y);q()};r.Create=function(u,w,t,y,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v);q()};r.Delete=function(u,w,t,y,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v);q()};r.Exec=function(w,v,t,u,A,y,z){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(D,C,B,E){q();u(r,w,r.CompleteExecResponse(B),E,A)},0,y,z);q()};r.ExecWithXml=function(w,v,t,u,A,y,z){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(D,C,B,E){q();u(r,w,r.CompleteExecResponse(B),E,A)},0,y,z);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(B,z,y,C,A){q();d(u,y,t,z,C,A)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,y,t,z,A,B,w){if(A!=200){t(r,v,null,A,B);c(1);return}if(y==null||y.Header.Method!="EnumerateResponse"||!y.Body.EnumerationContext){t(r,v,null,603,B);c(1);return}var u=y.Body.EnumerationContext;r.wsman.ExecPull(z,u,function(E,D,C,F){b(v,C,t,D,[],F,B,w)})}function b(z,B,t,C,w,D,E,A){if(D!=200){t(r,z,null,D,E);c(1);return}if(B==null||B.Header.Method!="PullResponse"){t(r,z,null,604,E);c(1);return}for(var v in B.Body.Items){if(B.Body.Items[v] instanceof Array){for(var y in B.Body.Items[v]){w.push(B.Body.Items[v][y])}}else{w.push(B.Body.Items[v])}}if(B.Body.EnumerationContext){var u=B.Body.EnumerationContext;r.wsman.ExecPull(C,u,function(H,G,F,I){b(z,F,t,G,w,I,E,1)})}else{c(1);t(r,z,w,D,E);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,z,v,y){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,z,{},v,y);q()};function a(t,z,u,C,B,v,A){r.PendingBatchOperations-=2;var y=z.shift(),w=r.Enum;if(y[0]=="*"){w=r.Get;y=y.substring(1)}w(y,function(F,D,E,G,H){H[2][D]={response:(E==null?null:E.Body),responses:E,status:G};if(H[1].length==0||G==401||(v!=true&&G!=200&&G!=400)){r.PendingBatchOperations-=(z.length*2);q();u(r,t,H[2],G,C)}else{q();a(t,z,u,C,H[2],A)}},[t,z,B],A);q()}r.BatchGet=function(t,v,u,y,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:y,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,y){f(t,u,y)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(z,y,w,u,t,v,C,A,B){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:z,NewState:y,EventOnTransition:w,ActionSd:u,ActionEac:t},v,C,A,B)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(z,y,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:z,NewState:y,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(y,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:y,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,y,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:y},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,y,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:y},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(y,w,v,z,t,A,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:y,DigestUsername:w,DigestPassword:v,KerberosUserSid:z,AccessPermission:t,Realms:A},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,z,B,u,w,C,A,y,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:z,Port:B,AuthMethod:u,Certificate:w,Username:C,Password:A,CN:y},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,y,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:y,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,z,v,y){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,z,v,y)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,y,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:y},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(y,z,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:y,WiFiEndpointSettingsInput:z,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(y,z,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:y,WiFiEndpointSettingsInput:z,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,y,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:y},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(y,z,w,u,A,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:y,NetworkAdminPassword:z,McNonce:w,Certificate:u,SigningAlgorithm:A,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,y,v,z,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:y,McNonce:v,SigningAlgorithm:z,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,y){if(w!=200||u.Body.ReturnValue!="0"){y[0](r,null,y[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,y)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var H=b.amtaccumulator.charCodeAt(1);switch(H){case 0:if(b.amtaccumulator.length<13){return}var y=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+y){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+y);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var G=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&G==1){var n=0;var C=d.charCodeAt(n);var B=d.substring(n+1,n+1+C);n+=(C+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var A=0;var z=null;var l=b.xxRandomNonce(32);var F="00000002";var q="";if(f==4){A=d.charCodeAt(n);z=d.substring(n+1,n+1+A);n+=(A+1);q=F+":"+l+":"+z+":"}var p=hex_md5(hex_md5(b.user+":"+B+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var I=b.user.length+B.length+v.length+b.authuri.length+l.length+F.length+p.length+7;if(f==4){I+=(z.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(I)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(B.length)+B+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(F.length)+F+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(z.length)+z)}b.xxSend(h)}else{if(G==0){if(b.protocol==1){var u=10000;var K=100;var J=0;var E=10000;var D=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(K)+ShortToStrX(J)+ShortToStrX(E)+ShortToStrX(D)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateAmtRemoteDesktop=function(j,l){var k={};k.canvasid=j;k.CanvasId=Q(j);k.scrolldiv=l;k.canvas=Q(j).getContext("2d");k.protocol=2;k.state=0;k.acc="";k.ScreenWidth=960;k.ScreenHeight=700;k.width=0;k.height=0;k.rwidth=0;k.rheight=0;k.bpp=2;k.useZRLE=true;k.showmouse=true;k.buttonmask=0;k.spare=null;k.sparew=0;k.spareh=0;k.sparew2=0;k.spareh2=0;k.sparecache={};k.ZRLEfirst=1;k.onScreenSizeChange=null;k.frameRateDelay=0;k.Debug=function(m){console.log(m)};k.xxStateChange=function(m){if(m==0){k.canvas.fillStyle="#000000";k.canvas.fillRect(0,0,k.width,k.height);k.canvas.canvas.width=k.rwidth=k.width=640;k.canvas.canvas.height=k.rheight=k.height=400;QS(k.canvasid).cursor="auto"}else{if(!k.showmouse){QS(k.canvasid).cursor="none"}}};k.ProcessData=function(p){if(!p){return}k.acc+=p;while(k.acc.length>0){var n=0;if(k.state==0&&k.acc.length>=12){n=12;k.state=1;k.send("RFB 003.008\n")}else{if(k.state==1&&k.acc.length>=1){n=k.acc.charCodeAt(0)+1;k.send(String.fromCharCode(1));k.state=2}else{if(k.state==2&&k.acc.length>=4){n=4;if(ReadInt(k.acc,0)!=0){return k.Stop()}k.send(String.fromCharCode(1));k.state=3}else{if(k.state==3&&k.acc.length>=24){var z=ReadInt(k.acc,20);if(k.acc.length<24+z){return}n=24+z;k.canvas.canvas.width=k.rwidth=k.width=k.ScreenWidth=ReadShort(k.acc,0);k.canvas.canvas.height=k.rheight=k.height=k.ScreenHeight=ReadShort(k.acc,2);var C="";if(k.useZRLE){C+=IntToStr(16)}C+=IntToStr(0);k.send(String.fromCharCode(2,0)+ShortToStr((C.length/4)+1)+C+IntToStr(-223));if(k.bpp==1){k.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}k.state=4;k.parent.xxStateChange(3);g();if(k.onScreenSizeChange!=null){k.onScreenSizeChange(k,k.ScreenWidth,k.ScreenHeight)}}else{if(k.state==4){var m=k.acc.charCodeAt(0);if(m==2){n=1}else{if(m==0){if(k.acc.length<4){return}k.state=100+ReadShort(k.acc,2);n=4}}}else{if(k.state>100&&k.acc.length>=12){var E=ReadShort(k.acc,0),G=ReadShort(k.acc,2),D=ReadShort(k.acc,4),v=ReadShort(k.acc,6),B=D*v,u=ReadInt(k.acc,8);if(u<17){if(D<1||D>64||v<1||v>64){console.log("Invalid tile size ("+D+","+v+"), disconnecting.");return k.Stop()}if(k.sparew!=D||k.spareh!=v){k.sparew=k.sparew2=D;k.spareh=k.spareh2=v;var F=k.sparew2+"x"+k.spareh2;k.spare=k.sparecache[F];if(!k.spare){k.sparecache[F]=k.spare=k.canvas.createImageData(k.sparew2,k.spareh2)}}}if(u==4294967073){k.canvas.canvas.width=k.rwidth=k.width=D;k.canvas.canvas.height=k.rheight=k.height=v;k.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(k.width)+ShortToStr(k.height));n=12;if(k.onScreenSizeChange!=null){k.onScreenSizeChange(k,k.ScreenWidth,k.ScreenHeight)}}else{if(u==0){var A=12,o=12+(B*k.bpp);if(k.acc.length<o){return}n=o;for(var w=0;w<B;w++){h(k.acc.charCodeAt(A++)+((k.bpp==2)?(k.acc.charCodeAt(A++)<<8):0),w)}f(k.spare,E,G)}else{if(u==16){if(k.acc.length<16){return}var q=ReadInt(k.acc,12);if(k.acc.length<(16+q)){return}var A=16,r=5,t=0;if(q>5&&k.acc.charCodeAt(A)==0&&ReadShortX(k.acc,A+1)==(q-r)){a(k.acc,A+5,E,G,D,v,B,q)}n=16+q}else{k.Debug("Unknown Encoding: "+u);return k.Stop()}}}if(--k.state==100){k.state=4;if(k.frameRateDelay==0){g()}else{setTimeout(g,k.frameRateDelay)}}}}}}}}if(n==0){return}k.acc=k.acc.substring(n)}};function a(o,w,G,H,F,q,C,p){var D=o.charCodeAt(w++),t,E,B,u={},z=0,A=0,r;if(D==0){for(r=0;r<C;r++){h(o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0),r)}f(k.spare,G,H)}else{if(D==1){E=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0);k.canvas.fillStyle="rgb("+((k.bpp==1)?((E&224)+","+((E&28)<<3)+","+b((E&3)<<6)):(((E>>8)&248)+","+((E>>3)&252)+","+((E&31)<<3)))+")";k.canvas.fillRect(G,H,F,q)}else{if(D>1&&D<17){var n=4,m=15;for(r=0;r<D;r++){u[r]=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0)}if(D==2){n=1;m=1}else{if(D<=4){n=2;m=3}}while(z<C&&w<o.length){E=o.charCodeAt(w++);for(r=(8-n);r>=0;r-=n){h(u[(E>>r)&m],z++)}}f(k.spare,G,H)}else{if(D==128){while(z<C&&w<o.length){E=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0);A=1;do{A+=(B=o.charCodeAt(w++))}while(B==255);while(--A>=0){h(E,z++)}}f(k.spare,G,H)}else{if(D>129){for(r=0;r<(D-128);r++){u[r]=o.charCodeAt(w++)+((k.bpp==2)?(o.charCodeAt(w++)<<8):0)}while(z<C&&w<o.length){A=1;t=o.charCodeAt(w++);E=u[t%128];if(t>127){do{A+=(B=o.charCodeAt(w++))}while(B==255)}while(--A>=0){h(E,z++)}}f(k.spare,G,H)}}}}}}function f(m,n,o){k.canvas.putImageData(m,n,o)}function h(o,m){var n=m*4;if(k.bpp==1){k.spare.data[n++]=o&224;k.spare.data[n++]=(o&28)<<3;k.spare.data[n++]=b((o&3)<<6)}else{k.spare.data[n++]=(o>>8)&248;k.spare.data[n++]=(o>>3)&252;k.spare.data[n++]=(o&31)<<3}k.spare.data[n]=255}function b(m){return(m>127)?(m+32):m}function g(){k.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(k.rwidth)+ShortToStr(k.rheight))}k.Start=function(){k.state=0;k.acc="";k.ZRLEfirst=1;for(var m in k.sparecache){delete k.sparecache[m]}};k.Stop=function(){k.UnGrabMouseInput();k.UnGrabKeyInput();k.parent.Stop()};k.send=function(m){k.parent.send(m)};function c(m,n){if(!n){n=window.event}var o=n.keyCode,p=o;if(n.shiftKey==false&&o>=65&&o<=90){p=o+32}if(o>=112&&o<=124){p=o+65358}if(o==8){p=65288}if(o==9){p=65289}if(o==13){p=65293}if(o==16){p=65505}if(o==17){p=65507}if(o==18){p=65513}if(o==27){p=65307}if(o==33){p=65365}if(o==34){p=65366}if(o==35){p=65367}if(o==36){p=65360}if(o==37){p=65361}if(o==38){p=65362}if(o==39){p=65363}if(o==40){p=65364}if(o==45){p=65379}if(o==46){p=65535}if(o>=96&&o<=105){p=o-48}if(o==106){p=42}if(o==107){p=43}if(o==109){p=45}if(o==110){p=46}if(o==111){p=47}if(o==186){p=59}if(o==187){p=61}if(o==188){p=44}if(o==189){p=45}if(o==190){p=46}if(o==191){p=47}if(o==192){p=96}if(o==219){p=91}if(o==220){p=92}if(o==221){p=93}if(o==222){p=39}k.sendkey(p,m);return k.haltEvent(n)}k.sendkey=function(o,m){if(typeof o=="object"){for(var n in o){k.sendkey(o[n][0],o[n][1])}}else{k.send(String.fromCharCode(4,m,0,0)+IntToStr(o))}};k.SendCtrlAltDelMsg=function(){k.sendcad()};k.sendcad=function(){k.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;k.GrabMouseInput=function(){if(e==true){return}var m=k.canvas.canvas;m.onmouseup=k.mouseup;m.onmousedown=k.mousedown;m.onmousemove=k.mousemove;e=true};k.UnGrabMouseInput=function(){if(e==false){return}var m=k.canvas.canvas;m.onmousemove=null;m.onmouseup=null;m.onmousedown=null;e=false};k.GrabKeyInput=function(){if(d==true){return}document.onkeyup=k.handleKeyUp;document.onkeydown=k.handleKeyDown;document.onkeypress=k.handleKeys;d=true};k.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};k.handleKeys=function(m){return k.haltEvent(m)};k.handleKeyUp=function(m){return c(0,m)};k.handleKeyDown=function(m){return c(1,m)};k.haltEvent=function(m){if(m.preventDefault){m.preventDefault()}if(m.stopPropagation){m.stopPropagation()}return false};k.mousedown=function(m){k.buttonmask|=(1<<m.button);return k.mousemove(m)};k.mouseup=function(m){k.buttonmask&=(65535-(1<<m.button));return k.mousemove(m)};k.mousemove=function(m){if(k.state!=4){return true}var n=k.getPositionOfControl(Q(k.canvasid));k.mx=(m.pageX-n[0])*(k.canvas.canvas.height/Q(k.canvasid).offsetHeight);k.my=((m.pageY-n[1]+(l?l.scrollTop:0))*(k.canvas.canvas.width/Q(k.canvasid).offsetWidth));k.send(String.fromCharCode(5,k.buttonmask)+ShortToStr(k.mx)+ShortToStr(k.my));return k.haltEvent(m)};k.getPositionOfControl=function(m){var n=Array(2);n[0]=n[1]=0;while(m){n[0]+=m.offsetLeft;n[1]+=m.offsetTop;m=m.offsetParent}return n};return k};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var G=0;var D=1;var am=2;var af=3;var A=4;var B=5;var ac=6;var h=7;var F=8;var p=9;var o=10;var an=11;var ao=12;var aj=13;var k=14;var j=15;var al=16;var W=17;var f=18;var S=19;var R=20;var T=21;var q=22;var r=23;var aa=24;var Y=25;var d=26;var V=27;var u=28;var a=29;var ab=30;var ak=31;var z=852;var y=592;var w=(z+y);var g=0;var X=1;var t=2;var N=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var O=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var L=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var M=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function K(aR,aV){var aM=15;var aU=aR.next;var at=(aV==t?aR.distbits:aR.lenbits);var aX=aR.work;var aH=aR.lens;var aI=(aV==t?aR.nlen:0);var aS=aR.codes;var au;if(aV==X){au=aR.nlen}else{if(aV==t){au=aR.ndist}else{au=19}}var aG;var aT;var aN,aL;var aQ;var aw;var ax;var aF;var aW;var aD;var aE;var aB;var aJ;var aK;var aC;var aO;var aq;var ar;var az;var aA;var ay;var av=new Array(aM+1);var aP=new Array(aM+1);for(aG=0;aG<=aM;aG++){av[aG]=0}for(aT=0;aT<au;aT++){av[aH[aI+aT]]++}aQ=at;for(aL=aM;aL>=1;aL--){if(av[aL]!=0){break}}if(aQ>aL){aQ=aL}if(aL==0){aC={op:64,bits:1,val:0};aS[aU++]=aC;aS[aU++]=aC;if(aV==t){aR.distbits=1}else{aR.lenbits=1}aR.next=aU;return 0}for(aN=1;aN<aL;aN++){if(av[aN]!=0){break}}if(aQ<aN){aQ=aN}aF=1;for(aG=1;aG<=aM;aG++){aF<<=1;aF-=av[aG];if(aF<0){return -1}}if(aF>0&&(aV==g||aL!=1)){aR.next=aU;return -1}aP[1]=0;for(aG=1;aG<aM;aG++){aP[aG+1]=aP[aG]+av[aG]}for(aT=0;aT<au;aT++){if(aH[aI+aT]!=0){aX[aP[aH[aI+aT]]++]=aT}}switch(aV){case g:aq=az=aX;ar=0;aA=0;ay=19;break;case X:aq=N;ar=-257;az=O;aA=-257;ay=256;break;default:aq=L;az=M;ar=0;aA=0;ay=-1}aD=0;aT=0;aG=aN;aO=aU;aw=aQ;ax=0;aJ=-1;aW=1<<aQ;aK=aW-1;if((aV==X&&aW>=z)||(aV==t&&aW>=y)){aR.next=aU;return 1}for(;;){aC={op:0,bits:aG-ax,val:0};if(aX[aT]<ay){aC.val=aX[aT]}else{if(aX[aT]>ay){aC.op=az[aA+aX[aT]];aC.val=aq[ar+aX[aT]]}else{aC.op=32+64}}aE=1<<(aG-ax);aB=1<<aw;aN=aB;do{aB-=aE;aS[aO+(aD>>>ax)+aB]=aC}while(aB!=0);aE=1<<(aG-1);while(aD&aE){aE>>>=1}if(aE!=0){aD&=aE-1;aD+=aE}else{aD=0}aT++;if(--(av[aG])==0){if(aG==aL){break}aG=aH[aI+aX[aT]]}if(aG>aQ&&(aD&aK)!=aJ){if(ax==0){ax=aQ}aO+=aN;aw=aG-ax;aF=(1<<aw);while(aw+ax<aL){aF-=av[aw+ax];if(aF<=0){break}aw++;aF<<=1}aW+=1<<aw;if((aV==X&&aW>=z)||(aV==t&&aW>=y)){aR.next=aU;return 1}aJ=aD&aK;aS[aU+aJ]={op:aw,bits:aQ,val:aO-aU}}}if(aD!=0){aS[aO+aD]={op:64,bits:aG-ax,val:0}}aR.next=aU+aW;if(aV==t){aR.distbits=aQ}else{aR.lenbits=aQ}return 0}function H(aN,aL){var aM;var aC;var aI;var aD;var aK;var aq;var ax;var aR;var aO;var aQ;var aP;var aB;var ar;var at;var aE;var au;var aH;var aw;var aA;var aJ;var aF;var av;var az=-1;var ay=-1;aM=aN.state;aC=aN.input_data;aI=aN.next_in;aD=aI+aN.avail_in-5;aK=aN.next_out;aq=aK-(aL-aN.avail_out);ax=aK+(aN.avail_out-257);aR=aM.wsize;aO=aM.whave;aQ=aM.wnext;aP=aM.window;aB=aM.hold;ar=aM.bits;at=aM.codes;aE=aM.lencode;au=aM.distcode;aH=(1<<aM.lenbits)-1;aw=(1<<aM.distbits)-1;loop:do{if(ar<15){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aA=at[aE+(aB&aH)];dolen:while(true){aJ=aA.bits;aB>>>=aJ;ar-=aJ;aJ=aA.op;if(aJ==0){aN.output_data+=String.fromCharCode(aA.val);aK++}else{if(aJ&16){aF=aA.val;aJ&=15;if(aJ){if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aF+=aB&((1<<aJ)-1);aB>>>=aJ;ar-=aJ}if(ar<15){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}aA=at[au+(aB&aw)];dodist:while(true){aJ=aA.bits;aB>>>=aJ;ar-=aJ;aJ=aA.op;if(aJ&16){av=aA.val;aJ&=15;if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8;if(ar<aJ){aB+=(aC.charCodeAt(aI++)&255)<<ar;ar+=8}}av+=aB&((1<<aJ)-1);aB>>>=aJ;ar-=aJ;aJ=aK-aq;if(av>aJ){aJ=av-aJ;if(aJ>aO){if(aM.sane){aN.msg="invalid distance too far back";aM.mode=a;break loop}}az=0;ay=-1;if(aQ==0){az+=aR-aJ;if(aJ<aF){aF-=aJ;aN.output_data+=aP.substring(az,az+aJ);aK+=aJ;aJ=0;az=-1;ay=aK-av}}else{az+=aQ-aJ;if(aJ<aF){aF-=aJ;aN.output_data+=aP.substring(az,az+aJ);aK+=aJ;az=-1;ay=aK-av}}}else{az=-1;ay=aK-av}if(az>=0){aN.output_data+=aP.substring(az,az+aF);aK+=aF;az+=aF}else{var aG=aF;if(aG>aK-ay){aG=aK-ay}aN.output_data+=aN.output_data.substring(ay,ay+aG);aK+=aG;aF-=aG;ay+=aG;aK+=aF;while(aF>2){aN.output_data+=aN.output_data.charAt(ay++);aN.output_data+=aN.output_data.charAt(ay++);aN.output_data+=aN.output_data.charAt(ay++);aF-=3}if(aF){aN.output_data+=aN.output_data.charAt(ay++);if(aF>1){aN.output_data+=aN.output_data.charAt(ay++)}}}}else{if((aJ&64)==0){aA=at[au+(aA.val+(aB&((1<<aJ)-1)))];continue dodist}else{aN.msg="invalid distance code";aM.mode=a;break loop}}break dodist}}else{if((aJ&64)==0){aA=at[aE+(aA.val+(aB&((1<<aJ)-1)))];continue dolen}else{if(aJ&32){aM.mode=an;break loop}else{aN.msg="invalid literal/length code";aM.mode=a;break loop}}}}break dolen}}while(aI<aD&&aK<ax);aF=ar>>>3;aI-=aF;ar-=aF<<3;aB&=(1<<ar)-1;aN.next_in=aI;aN.next_out=aK;aN.avail_in=(aI<aD?5+(aD-aI):5-(aI-aD));aN.avail_out=(aK<ax?257+(ax-aK):257-(aK-ax));aM.hold=aB;aM.bits=ar}function ae(at){var ar;var aq=new Array(at);for(ar=0;ar<at;ar++){aq[ar]=0}return aq}function E(at,ar,aq){return(at&&(ar in at))?at[ar]:aq}function e(){return 0}function J(){var ar;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ae(320);this.work=ae(288);this.codes=new Array(w);var aq={op:0,bits:0,val:0};for(ar=0;ar<w;ar++){this.codes[ar]=aq}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(ar){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;ar.total_in=ar.total_out=aq.total=0;ar.msg=null;if(aq.wrap){ar.adler=aq.wrap&1}aq.mode=G;aq.last=0;aq.havedict=0;aq.dmax=32768;aq.head=null;aq.hold=0;aq.bits=0;aq.lencode=0;aq.distcode=0;aq.next=0;aq.sane=1;aq.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(ar,at){var au;var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(typeof at==="undefined"){at=n}if(at<0){au=0;at=-at}else{au=(at>>>4)+1;if(at<48){at&=15}}if(au==1&&(typeof ZLIB.adler32==="function")){ar.checksum_function=ZLIB.adler32}else{if(au==2&&(typeof ZLIB.crc32==="function")){ar.checksum_function=ZLIB.crc32}else{ar.checksum_function=e}}if(at&&(at<8||at>15)){return ZLIB.Z_STREAM_ERROR}if(aq.window&&aq.wbits!=at){aq.window=null}aq.wrap=au;aq.wbits=at;aq.wsize=0;aq.whave=0;aq.wnext=0;return ZLIB.inflateResetKeep(ar)};ZLIB.inflateInit=function(ar){var aq=new ZLIB.z_stream();aq.state=new J();ZLIB.inflateReset(aq,ar);return aq};ZLIB.inflatePrime=function(at,aq,au){var ar;if(!at||!at.state){return ZLIB.Z_STREAM_ERROR}ar=at.state;if(aq<0){ar.hold=0;ar.bits=0;return ZLIB.Z_OK}if(aq>16||ar.bits+aq>32){return ZLIB.Z_STREAM_ERROR}au&=(1<<aq)-1;ar.hold+=au<<ar.bits;ar.bits+=aq;return ZLIB.Z_OK};var U=null;var s=null;function C(ar){var aq;if(!U){U=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}ar.lencode=0;ar.distcode=512;for(aq=0;aq<512;aq++){ar.codes[aq]=U[aq]}for(aq=0;aq<32;aq++){ar.codes[aq+512]=s[aq]}ar.lenbits=9;ar.distbits=5}function ap(at){var ar=at.state;var aq=at.output_data.length;if(ar.window===null){ar.window=""}if(ar.wsize==0){ar.wsize=1<<ar.wbits}if(aq>=ar.wsize){ar.window=at.output_data.substring(aq-ar.wsize)}else{if(ar.whave+aq<ar.wsize){ar.window+=at.output_data}else{ar.window=ar.window.substring(ar.whave-(ar.wsize-aq))+at.output_data}}ar.whave=ar.window.length;if(ar.whave<ar.wsize){ar.wnext=ar.whave}else{ar.wnext=0}return 0}function l(ar,at){var aq=[at&255,(at>>>8)&255];ar.state.check=ar.checksum_function(ar.state.check,aq,0,2)}function m(ar,at){var aq=[at&255,(at>>>8)&255,(at>>>16)&255,(at>>>24)&255];ar.state.check=ar.checksum_function(ar.state.check,aq,0,4)}function Z(ar,aq){aq.strm=ar;aq.left=ar.avail_out;aq.next=ar.next_in;aq.have=ar.avail_in;aq.hold=ar.state.hold;aq.bits=ar.state.bits;return aq}function ah(aq){var ar=aq.strm;ar.next_in=aq.next;ar.avail_out=aq.left;ar.avail_in=aq.have;ar.state.hold=aq.hold;ar.state.bits=aq.bits}function P(aq){aq.hold=0;aq.bits=0}function ag(aq){if(aq.have==0){return false}aq.have--;aq.hold+=(aq.strm.input_data.charCodeAt(aq.next++)&255)<<aq.bits;aq.bits+=8;return true}function ad(ar,aq){while(ar.bits<aq){if(!ag(ar)){return false}}return true}function b(ar,aq){return ar.hold&((1<<aq)-1)}function v(ar,aq){ar.hold>>>=aq;ar.bits-=aq}function c(aq){aq.hold>>>=aq.bits&7;aq.bits-=aq.bits&7}function ai(aq){return((aq>>>24)&255)+((aq>>>8)&65280)+((aq&65280)<<8)+((aq&255)<<24)}var I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aD,at){var aC;var aB;var aq,az;var ar;var av=-1;var au=-1;var aw;var ax;var ay;var aA;if(!aD||!aD.state||(!aD.input_data&&aD.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aC=aD.state;if(aC.mode==an){aC.mode=ao}aB={};Z(aD,aB);aq=aB.have;az=aB.left;aA=ZLIB.Z_OK;inf_leave:for(;;){switch(aC.mode){case G:if(aC.wrap==0){aC.mode=ao;break}if(!ad(aB,16)){break inf_leave}if((aC.wrap&2)&&aB.hold==35615){aC.check=aD.checksum_function(0,null,0,0);l(aD,aB.hold);P(aB);aC.mode=D;break}aC.flags=0;if(aC.head!==null){aC.head.done=-1}if(!(aC.wrap&1)||((b(aB,8)<<8)+(aB.hold>>>8))%31){aD.msg="incorrect header check";aC.mode=a;break}if(b(aB,4)!=ZLIB.Z_DEFLATED){aD.msg="unknown compression method";aC.mode=a;break}v(aB,4);ay=b(aB,4)+8;if(aC.wbits==0){aC.wbits=ay}else{if(ay>aC.wbits){aD.msg="invalid window size";aC.mode=a;break}}aC.dmax=1<<ay;aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=aB.hold&512?p:an;P(aB);break;case D:if(!ad(aB,16)){break inf_leave}aC.flags=aB.hold;if((aC.flags&255)!=ZLIB.Z_DEFLATED){aD.msg="unknown compression method";aC.mode=a;break}if(aC.flags&57344){aD.msg="unknown header flags set";aC.mode=a;break}if(aC.head!==null){aC.head.text=(aB.hold>>>8)&1}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.mode=am;case am:if(!ad(aB,32)){break inf_leave}if(aC.head!==null){aC.head.time=aB.hold}if(aC.flags&512){m(aD,aB.hold)}P(aB);aC.mode=af;case af:if(!ad(aB,16)){break inf_leave}if(aC.head!==null){aC.head.xflags=aB.hold&255;aC.head.os=aB.hold>>>8}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.mode=A;case A:if(aC.flags&1024){if(!ad(aB,16)){break inf_leave}aC.length=aB.hold;if(aC.head!==null){aC.head.extra_len=aB.hold}if(aC.flags&512){l(aD,aB.hold)}P(aB);aC.head.extra=""}else{if(aC.head!==null){aC.head.extra=null}}aC.mode=B;case B:if(aC.flags&1024){ar=aC.length;if(ar>aB.have){ar=aB.have}if(ar){if(aC.head!==null&&aC.head.extra!==null){ay=aC.head.extra_len-aC.length;aC.head.extra+=aD.input_data.substring(aB.next,aB.next+(ay+ar>aC.head.extra_max?aC.head.extra_max-ay:ar))}if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;aC.length-=ar}if(aC.length){break inf_leave}}aC.length=0;aC.mode=ac;case ac:if(aC.flags&2048){if(aB.have==0){break inf_leave}if(aC.head!==null&&aC.head.name===null){aC.head.name=""}ar=0;do{ay=aD.input_data.charAt(aB.next+ar);ar++;if(ay==="\0"){break}if(aC.head!==null&&aC.length<aC.head.name_max){aC.head.name+=ay;aC.length++}}while(ar<aB.have);if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;if(ay!=="\0"){break inf_leave}}else{if(aC.head!==null){aC.head.name=null}}aC.length=0;aC.mode=h;case h:if(aC.flags&4096){if(aB.have==0){break inf_leave}ar=0;if(aC.head!==null&&aC.head.comment===null){aC.head.comment=""}do{ay=aD.input_data.charAt(aB.next+ar);ar++;if(ay==="\0"){break}if(aC.head!==null&&aC.length<aC.head.comm_max){aC.head.comment+=ay;aC.length++}}while(ar<aB.have);if(aC.flags&512){aC.check=aD.checksum_function(aC.check,aD.input_data,aB.next,ar)}aB.have-=ar;aB.next+=ar;if(ay!=="\0"){break inf_leave}}else{if(aC.head!==null){aC.head.comment=null}}aC.mode=F;case F:if(aC.flags&512){if(!ad(aB,16)){break inf_leave}if(aB.hold!=(aC.check&65535)){aD.msg="header crc mismatch";aC.mode=a;break}P(aB)}if(aC.head!==null){aC.head.hcrc=(aC.flags>>>9)&1;aC.head.done=1}aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=an;break;case p:if(!ad(aB,32)){break inf_leave}aD.adler=aC.check=ai(aB.hold);P(aB);aC.mode=o;case o:if(aC.havedict==0){ah(aB);return ZLIB.Z_NEED_DICT}aD.adler=aC.check=aD.checksum_function(0,null,0,0);aC.mode=an;case an:if(at==ZLIB.Z_BLOCK||at==ZLIB.Z_TREES){break inf_leave}case ao:if(aC.last){c(aB);aC.mode=d;break}if(!ad(aB,3)){break inf_leave}aC.last=b(aB,1);v(aB,1);switch(b(aB,2)){case 0:aC.mode=aj;break;case 1:C(aC);aC.mode=S;if(at==ZLIB.Z_TREES){v(aB,2);break inf_leave}break;case 2:aC.mode=al;break;case 3:aD.msg="invalid block type";aC.mode=a}v(aB,2);break;case aj:c(aB);if(!ad(aB,32)){break inf_leave}if((aB.hold&65535)!=(((aB.hold>>>16)&65535)^65535)){aD.msg="invalid stored block lengths";aC.mode=a;break}aC.length=aB.hold&65535;P(aB);aC.mode=k;if(at==ZLIB.Z_TREES){break inf_leave}case k:aC.mode=j;case j:ar=aC.length;if(ar){if(ar>aB.have){ar=aB.have}if(ar>aB.left){ar=aB.left}if(ar==0){break inf_leave}aD.output_data+=aD.input_data.substring(aB.next,aB.next+ar);aD.next_out+=ar;aB.have-=ar;aB.next+=ar;aB.left-=ar;aC.length-=ar;break}aC.mode=an;break;case al:if(!ad(aB,14)){break inf_leave}aC.nlen=b(aB,5)+257;v(aB,5);aC.ndist=b(aB,5)+1;v(aB,5);aC.ncode=b(aB,4)+4;v(aB,4);if(aC.nlen>286||aC.ndist>30){aD.msg="too many length or distance symbols";aC.mode=a;break}aC.have=0;aC.mode=W;case W:while(aC.have<aC.ncode){if(!ad(aB,3)){break inf_leave}var aE=b(aB,3);aC.lens[I[aC.have++]]=aE;v(aB,3)}while(aC.have<19){aC.lens[I[aC.have++]]=0}aC.next=0;aC.lencode=0;aC.lenbits=7;aA=K(aC,g);if(aA){aD.msg="invalid code lengths set";aC.mode=a;break}aC.have=0;aC.mode=f;case f:while(aC.have<aC.nlen+aC.ndist){for(;;){aw=aC.codes[aC.lencode+b(aB,aC.lenbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if(aw.val<16){v(aB,aw.bits);aC.lens[aC.have++]=aw.val}else{if(aw.val==16){if(!ad(aB,aw.bits+2)){break inf_leave}v(aB,aw.bits);if(aC.have==0){aD.msg="invalid bit length repeat";aC.mode=a;break}ay=aC.lens[aC.have-1];ar=3+b(aB,2);v(aB,2)}else{if(aw.val==17){if(!ad(aB,aw.bits+3)){break inf_leave}v(aB,aw.bits);ay=0;ar=3+b(aB,3);v(aB,3)}else{if(!ad(aB,aw.bits+7)){break inf_leave}v(aB,aw.bits);ay=0;ar=11+b(aB,7);v(aB,7)}}if(aC.have+ar>aC.nlen+aC.ndist){aD.msg="invalid bit length repeat";aC.mode=a;break}while(ar--){aC.lens[aC.have++]=ay}}}if(aC.mode==a){break}if(aC.lens[256]==0){aD.msg="invalid code -- missing end-of-block";aC.mode=a;break}aC.next=0;aC.lencode=aC.next;aC.lenbits=9;aA=K(aC,X);if(aA){aD.msg="invalid literal/lengths set";aC.mode=a;break}aC.distcode=aC.next;aC.distbits=6;aA=K(aC,t);if(aA){aD.msg="invalid distances set";aC.mode=a;break}aC.mode=S;if(at==ZLIB.Z_TREES){break inf_leave}case S:aC.mode=R;case R:if(aB.have>=6&&aB.left>=258){ah(aB);H(aD,az);Z(aD,aB);if(aC.mode==an){aC.back=-1}break}aC.back=0;for(;;){aw=aC.codes[aC.lencode+b(aB,aC.lenbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if(aw.op&&(aw.op&240)==0){ax=aw;for(;;){aw=aC.codes[aC.lencode+ax.val+(b(aB,ax.bits+ax.op)>>>ax.bits)];if(ax.bits+aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}v(aB,ax.bits);aC.back+=ax.bits}v(aB,aw.bits);aC.back+=aw.bits;aC.length=aw.val;if(aw.op==0){aC.mode=Y;break}if(aw.op&32){aC.back=-1;aC.mode=an;break}if(aw.op&64){aD.msg="invalid literal/length code";aC.mode=a;break}aC.extra=aw.op&15;aC.mode=T;case T:if(aC.extra){if(!ad(aB,aC.extra)){break inf_leave}aC.length+=b(aB,aC.extra);v(aB,aC.extra);aC.back+=aC.extra}aC.was=aC.length;aC.mode=q;case q:for(;;){aw=aC.codes[aC.distcode+b(aB,aC.distbits)];if(aw.bits<=aB.bits){break}if(!ag(aB)){break inf_leave}}if((aw.op&240)==0){ax=aw;for(;;){aw=aC.codes[aC.distcode+ax.val+(b(aB,ax.bits+ax.op)>>>ax.bits)];if((ax.bits+aw.bits)<=aB.bits){break}if(!ag(aB)){break inf_leave}}v(aB,ax.bits);aC.back+=ax.bits}v(aB,aw.bits);aC.back+=aw.bits;if(aw.op&64){aD.msg="invalid distance code";aC.mode=a;break}aC.offset=aw.val;aC.extra=aw.op&15;aC.mode=r;case r:if(aC.extra){if(!ad(aB,aC.extra)){break inf_leave}aC.offset+=b(aB,aC.extra);v(aB,aC.extra);aC.back+=aC.extra}aC.mode=aa;case aa:if(aB.left==0){break inf_leave}ar=az-aB.left;if(aC.offset>ar){ar=aC.offset-ar;if(ar>aC.whave){if(aC.sane){aD.msg="invalid distance too far back";aC.mode=a;break}}if(ar>aC.wnext){ar-=aC.wnext;av=aC.wsize-ar;au=-1}else{av=aC.wnext-ar;au=-1}if(ar>aC.length){ar=aC.length}}else{av=-1;au=aD.next_out-aC.offset;ar=aC.length}if(ar>aB.left){ar=aB.left}aB.left-=ar;aC.length-=ar;if(av>=0){aD.output_data+=aC.window.substring(av,av+ar);aD.next_out+=ar;ar=0}else{aD.next_out+=ar;do{aD.output_data+=aD.output_data.charAt(au++)}while(--ar)}if(aC.length==0){aC.mode=R}break;case Y:if(aB.left==0){break inf_leave}aD.output_data+=String.fromCharCode(aC.length);aD.next_out++;aB.left--;aC.mode=R;break;case d:if(aC.wrap){if(!ad(aB,32)){break inf_leave}az-=aB.left;aD.total_out+=az;aC.total+=az;if(az){aD.adler=aC.check=aD.checksum_function(aC.check,aD.output_data,aD.output_data.length-az,az)}az=aB.left;if((aC.flags?aB.hold:ai(aB.hold))!=aC.check){aD.msg="incorrect data check";aC.mode=a;break}P(aB)}aC.mode=V;case V:if(aC.wrap&&aC.flags){if(!ad(aB,32)){break inf_leave}if(aB.hold!=(aC.total&4294967295)){aD.msg="incorrect length check";aC.mode=a;break}P(aB)}aC.mode=u;case u:aA=ZLIB.Z_STREAM_END;break inf_leave;case a:aA=ZLIB.Z_DATA_ERROR;break inf_leave;case ab:return ZLIB.Z_MEM_ERROR;case ak:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ah(aB);if(aC.wsize||(az!=aD.avail_out&&aC.mode<a&&(aC.mode<d||at!=ZLIB.Z_FINISH))){if(ap(aD)){aC.mode=ab;return ZLIB.Z_MEM_ERROR}}aq-=aD.avail_in;az-=aD.avail_out;aD.total_in+=aq;aD.total_out+=az;aC.total+=az;if(aC.wrap&&az){aD.adler=aC.check=aD.checksum_function(aC.check,aD.output_data,0,aD.output_data.length)}aD.data_type=aC.bits+(aC.last?64:0)+(aC.mode==an?128:0)+(aC.mode==S||aC.mode==k?256:0);if(((aq==0&&az==0)||at==ZLIB.Z_FINISH)&&aA==ZLIB.Z_OK){aA=ZLIB.Z_BUF_ERROR}return aA};ZLIB.inflateEnd=function(ar){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;aq.window=null;ar.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(au,av){var at;var aq;var ar=16384;this.input_data=au;this.next_in=E(av,"next_in",0);this.avail_in=E(av,"avail_in",au.length-this.next_in);at=E(av,"flush",ZLIB.Z_SYNC_FLUSH);aq=E(av,"avail_out",-1);var aw="";do{this.avail_out=(aq>=0?aq:ar);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,at);if(aq>=0){return this.output_data}aw+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return aw};ZLIB.z_stream.prototype.inflateReset=function(aq){return ZLIB.inflateReset(this,aq)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());"use strict";var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var meshserver=null;var xdr=null;var serverinfo=null;var nodes=[];var meshes={};var filetree={};var userinfo=null;var serverinfo=null;var users=null;var nodeShortIdent=0;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var debugmode=false;var attemptWebRTC=((features&128)!=0);var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel&reg; AMT Connected"];var files;function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}}}}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function onMessage(h,d){switch(d.action){case"serverinfo":serverinfo=d.serverinfo;break;case"userinfo":userinfo=d.userinfo;QH("p3userName",userinfo.name);break;case"users":users={};for(var c in d.users){users[d.users[c]._id]=d.users[c]}updateUsers();break;case"wssessioncount":wssessions=d.wssessions;updateUsers();break;case"meshes":meshes={};for(var c in d.meshes){meshes[d.meshes[c]._id]=d.meshes[c]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(d.filetree);updateFiles();break;case"nodes":nodes=[];for(var c in d.nodes){for(var e in d.nodes[c]){if(!meshes[c]){console.log("Invalid mesh (1): "+c);continue}d.nodes[c][e].namel=d.nodes[c][e].name.toLowerCase();if(d.nodes[c][e].rname){d.nodes[c][e].rnamel=d.nodes[c][e].rname.toLowerCase()}else{d.nodes[c][e].rnamel=d.nodes[c][e].namel}d.nodes[c][e].meshnamel=meshes[c].name.toLowerCase();d.nodes[c][e].meshid=c;d.nodes[c][e].state=(d.nodes[c][e].state)?(d.nodes[c][e].state):0;d.nodes[c][e].desc=d.nodes[c][e].desc;if(!d.nodes[c][e].icon){d.nodes[c][e].icon=1}d.nodes[c][e].ident=++nodeShortIdent;nodes.push(d.nodes[c][e])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(d.nodeid!=powerTimelineReq){break}powerTimelineNode=d.nodeid;powerTimeline=d.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==d.nodeid){drawDeviceTimeline()}break;case"event":switch(d.event.action){case"createmesh":if(d.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[d.event.meshid]==null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};meshserver.send({action:"nodes"})}else{meshes[d.event.meshid].name=d.event.name;meshes[d.event.meshid].desc=d.event.desc;meshes[d.event.meshid].links=d.event.links;if(meshes[d.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[d.event.meshid])){go(2)}delete meshes[d.event.meshid];var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==d.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&&currentMesh._id==d.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[d.event.meshid]){delete meshes[d.event.meshid];updateMeshes();meshserver.send({action:"files"})}var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&&currentMesh._id==d.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&&currentNode&&currentNode.meshid==d.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var g=d.event.node;if(!meshes[g.meshid]){break}g.namel=g.name.toLowerCase();if(g.rname){g.rnamel=g.rname.toLowerCase()}else{g.rnamel=g.namel}g.meshnamel=meshes[g.meshid].name.toLowerCase();g.state=0;if(!g.icon){g.icon=1}g.ident=++nodeShortIdent;nodes.push(g);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var g=nodes[b];if(currentNode==g){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(b,1);updateDevices();updateMapMarkers()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var g=nodes[b];g.name=d.event.node.name;g.rname=d.event.node.rname;g.host=d.event.node.host;g.desc=d.event.node.desc;g.publicip=d.event.node.publicip;g.iploc=d.event.node.iploc;g.wifiloc=d.event.node.wifiloc;g.gpsloc=d.event.node.gpsloc;g.tags=d.event.node.tags;g.userloc=d.event.node.userloc;if(d.event.node.agent!=null){if(g.agent==null){g.agent={}}if(d.event.node.agent.ver!=null){g.agent.ver=d.event.node.agent.ver}if(d.event.node.agent.id!=null){g.agent.id=d.event.node.agent.id}if(d.event.node.agent.caps!=null){g.agent.caps=d.event.node.agent.caps}if(d.event.node.agent.core!=null){g.agent.core=d.event.node.agent.core}else{if(g.agent.core){delete g.agent.core}}g.agent.tag=d.event.node.agent.tag}if(d.event.node.intelamt!=null){if(g.intelamt==null){g.intelamt={}}if(d.event.node.intelamt.host!=null){g.intelamt.user=d.event.node.intelamt.host}if(d.event.node.intelamt.user!=null){g.intelamt.user=d.event.node.intelamt.user}if(d.event.node.intelamt.tls!=null){g.intelamt.tls=d.event.node.intelamt.tls}if(d.event.node.intelamt.ver!=null){g.intelamt.ver=d.event.node.intelamt.ver}if(d.event.node.intelamt.state!=null){g.intelamt.state=d.event.node.intelamt.state}}g.namel=g.name.toLowerCase();if(g.rname){g.rnamel=g.rname.toLowerCase()}else{g.rnamel=g.namel}if(d.event.node.icon){g.icon=d.event.node.icon}refreshDevice(g._id);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var g=nodes[b];g.conn=d.event.conn;g.pwr=d.event.pwr;updateDevices()}break;case"clearevents":break;case"login":if(users!=null&&users["user/"+domain+"/"+d.event.username.toLowerCase()]){users["user/"+domain+"/"+d.event.username.toLowerCase()].login=d.event.time}break;case"notify":break}break}}function topMenu(a){if((xxdialogMode!=null)&&(xxdialogMode!=0)&&(xxdialogMode!=999)){return}if(a===undefined){var b=(QS("topMenu").display=="none");if(b==true){if((xxdialogMode==0)||(xxdialogMode==null)){QV("topMenu",true);xxdialogMode=999}}else{QV("topMenu",false);xxdialogMode=0}}else{QV("topMenu",false);xxdialogMode=0;if((a==1)&&(xxcurrentView!=3)){goForward("account")}if((a==2)&&(xxcurrentView!=5)){goForward("files")}}}var backStack=[];function goBack(){if(xxdialogMode){return}if(backStack.length>0){backStack.pop()}goStack()}function goForward(a){if(xxdialogMode){return}backStack.push(a);goStack()}function goStack(){if(backStack.length==0){go(2);return}var a=backStack[backStack.length-1],b=a.split("/")[0];if(b=="node"){setupDeviceMenu(0);gotoDevice(a)}if(b=="mesh"){gotoMesh(a)}if(b=="account"){go(3)}if(b=="devices"){go(2)}if(b=="files"){go(5)}}function updateFooterMenu(b){while(b!=null&&b.length<3){b.push({n:""})}var d="",c="";if(b!=null){for(var a in b){d+='<td style="cursor:pointer'+((c=="")?"":";border-left:solid 1px white")+'" onclick="'+b[a].f+'">'+b[a].n;c=b[a].n}}QH("footerMenu","<tr>"+d)}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a=addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp3email").value=userinfo.email}account_validateEmail();Q("dp3email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&(Q("dp3email").value!=userinfo.email));if((x==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}var a=addHtmlValue("Name","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Mesh Agent Policy</option><option value=1>Intel&reg; AMT Agent-less Policy</option></select></div>");a+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Mesh",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp3meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp3meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value));var b="";if(Q("apassword1").value!=""){var a=checkPasswordStrength(Q("apassword1").value);if(a>=80){b="<span style=color:green>Strong<span>"}else{if(a>=60){b="<span style=color:blue>Good<span>"}else{b="<span style=color:red>Weak<span>"}}}QH("dxPassWarn",b)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function updateMeshes(){var c="",a=0;for(i in meshes){a++;var b=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var d="Partial Rights";if(b==4294967295){d="Full Administrator"}else{if(b==0){d="No Rights"}}c+="<div style=cursor:pointer onclick=goForward('"+i+"')>";c+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>';c+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';c+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+d+"</div></div>";c+="</div></div>"}QH("p3meshes",c);QV("p3noMeshFound",a==0)}function gotoMesh(a){currentMesh=meshes[a];if(currentMesh==null){goBack()}p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var filetreelinkpath;var filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var o="",p="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",m="Root",w,g=filetree,k=1;var e=[],t=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){if(a[q].checked){b.push(a[q].value)}}filetreelinkpath="";for(var q in filetreelocation){if((g.f!=null)&&(g.f[filetreelocation[q]]!=null)){e.push(filetreelocation[q]);m+=" / "+filetreelocation[q];if((k==1)){var A=filetreelocation[q].split("/");w=window.location+A[0]+"files/"+A[2];filetreelinkpath+=filetreelocation[q]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[q];if(k>2){w+="/"+filetreelocation[q]}}}g=g.f[filetreelocation[q]];c+=" / <a style=cursor:pointer onclick=p5folderup("+k+")>"+(g.n!=null?g.n:filetreelocation[q])+"</a>";k++}else{break}}filetreelocation=e;var u=m.toLowerCase().startsWith("root / "+userinfo._id+" / public");var j=p5sort_files(g.f);for(var q in j){var d=j[q],s=d.n,z;z=s;if(s.length>40){z='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,40))+"...</span>"}else{z=EscapeHtml(s)}s=EscapeHtml(s);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3||d.t==4){var y=(d.t==1||d.t==4)?p5getQuotabar(d):"",B="";n="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+s+"'>&nbsp;<span style=float:right;padding-right:4px title=\""+B+'">'+y+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+z+"</a></span></div>"}else{var r=z;var v="";if(u){v=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+w+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){r='<a target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+z+"</a>"+v}n="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+r+"</span></div>"}if(d.t<3){o+=n}else{p+=n}}QH("p5rightOfButtons",p5getQuotabar(g));QH("p5files",o+p);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",u);if(t==filetreelinkpath){a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){a[q].checked=(b.indexOf(a[q].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"None":"All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(e){a.push(e.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var sort=0;var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var showRealNames=false;var deviceHeaderTotal=0;var deviceHeaders={};var deviceHeadersTitles={};function updateDevicesEx(){var t="",a=0,d=null,b=0,e={},h={},g={};deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var d;if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}for(var j in nodes){if(nodes[j].v==false){continue}var m=meshes[nodes[j].meshid],o=m.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(o==null){continue}var p=o.rights;if(sort==0){nodes.sort(meshSort);if(nodes[j].meshid!=d){deviceHeaderSet();var f="";if(meshes[nodes[j].meshid].mtype==1){f="<span style=color:lightgray>, Intel&reg; AMT only</span>"}if(d!=null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=padding-top:4px><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[j].meshid+'")>'+EscapeHtml(meshes[nodes[j].meshid].name)+"</span>"+f+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].meshid;e[d]=1;a=0}}else{if(sort==1){if(nodes[j].pwr!==d){deviceHeaderSet();if(d!==null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[j].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].pwr;a=0}}else{if(sort==2){if(d==null){d="1"}}}}b++;var u=EscapeHtml(nodes[j].name);if(u.length==0){u="<i>None</i>"}if((nodes[j].rname!=null)&&(nodes[j].rname.length>0)){u+=" / "+EscapeHtml(nodes[j].rname)}var q=EscapeHtml(nodes[j].name);if(showRealNames==true&&nodes[j].rname!=null){q=EscapeHtml(nodes[j].rname)}if(q.length==0){q="<i>None</i>"}var k=nodes[j].icon,s=NodeStateStr(nodes[j]);if((!nodes[j].conn)||(nodes[j].conn==0)){k+=" gray"}t+="<div style=cursor:pointer onclick=goForward('"+nodes[j]._id+"')>";t+='<div class="i'+k+'" style="float:left;margin-left:4px"></div>';t+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';t+="<div><div style=padding-left:12px;padding-top:2px><b>"+q+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+s+"</div></div>";t+="</div></div>";deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[j].state]=="undefined"){deviceHeaderCount[nodes[j].state]=1}else{deviceHeaderCount[nodes[j].state]++}}if(sort==0){for(var j in meshes){var l=meshes[j],n=l.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(n!=null){var p=n.rights;if(e[l._id]==null){if((d!="")&&(t!="")){t+="</tr></table>"}t+="<div><div colspan=3 class=DevSt><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+l._id+'")>'+EscapeHtml(l.name)+"</span></div>";if(l.mtype==1){t+="<div style=padding:10px><i>No Intel&reg; AMT devices in this mesh"}if(l.mtype==2){t+="<div style=padding:10px><i>No devices in this mesh"}t+=".</i></div></div>";d=l._id;b++}}}}QH("xdevices",t);deviceHeaderSet();for(var j in deviceHeaders){QH(j,deviceHeaders[j])}for(var j in deviceHeadersTitles){Q(j).title=deviceHeadersTitles[j]}}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel&reg; AMT is routable.">Intel&reg; AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");var a="";for(var b in deviceHeaderCount){if(a.length>0){a+=", "}a+=deviceHeaderCount[b]+" "+PowerStateStr2(b)}deviceHeadersTitles["DevxHeader"+deviceHeaderId]=a;deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}if(d>f){return 1}if(d<f){return -1}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentDevicePanel=0;var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(l,m,p){var k=getNodeFromId(l);if(k==null){goBack()}var g=meshes[k.meshid];if(g==null){goBack()}var h=g.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=k._id||p==true){currentNode=k;var j=EscapeHtml(k.name);if(j.length==0){j="<i>None</i>"}if((h&4)!=0){j="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+j+"</span>"}QH("p10deviceName",j);var s="<table style=width:100%>";s+=addDeviceAttribute('<span title="The name of the administrative group this computer belong to">Mesh</span>','<a title="The name of the group this computer belong to" onclick=goForward("'+k.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[k.meshid].name)+"</a>");if(k.rname!=null){s+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(k.rname)+"</span>")}if((g.mtype==1)||(k.name!=k.host)){if((h&4)!=0){if(k.host){s+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(k.host)+"</span>")}else{s+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{s+=addDeviceAttribute("Hostname",EscapeHtml(k.host))}}var d=k.desc?EscapeHtml(k.desc):"<i>None</i>";if((h&4)!=0){s+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+d+"</span>")}else{s+=addDeviceAttribute("Description",d)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((k.agent!=null)&&(k.agent.id!=null)&&(k.agent.ver!=null)){var q="";if(k.agent.id<=a.length){q=a[k.agent.id]}else{q=a[0]}if(k.agent.ver!=0){q+=" v"+k.agent.ver}s+=addDeviceAttribute("Mesh Agent",q)}if(k.intelamt!=null){var q="";var o={0:"Not&nbsp;Activated&nbsp;(Pre)",1:"Not&nbsp;Activated&nbsp;(In)",2:"Activated"};if(k.intelamt.ver!=null&&k.intelamt.state==null){q+="<i>Unknown&nbsp;State</i>, v"+k.intelamt.ver}else{if((k.intelamt.ver==null)&&(k.intelamt.state==2)){q+="<i>Activated</i>"}else{if((k.intelamt.ver==null)||(k.intelamt.state==null)){q+="<i>Unknown Version & State</i>"}else{q+=o[k.intelamt.state];if(k.intelamt.flags){if(k.intelamt.flags&2){q=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(k.intelamt.flags&4){q=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}q+=(", v"+k.intelamt.ver)}}}if(k.intelamt.tls==1){q+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(k.intelamt.state==2){if(k.intelamt.user==null||k.intelamt.user==""){if((h&4)!=0){q+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel&reg; AMT credentials" onclick=editDeviceAmtSettings("'+k._id+'")>No&nbsp;Credentials</i>'}else{q+=", <i style=color:#FF0000>No Credentials</i>"}}q+=" ";if((h&4)!=0){q+='<img src=images/link4.png height=10 width=10 title="Edit Intel&reg; AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+k._id+'")>'}}s+=addDeviceAttribute("Intel&reg; AMT",q)}if((k.agent!=null)&&(k.agent.tag!=null)&&(k.agent.tag!="mailto:")){var r=EscapeHtml(k.agent.tag);if(r.startsWith("mailto:")){r='<a href="'+r+'">'+r.substring(7)+"</a>"}s+=addDeviceAttribute("Agent Tag",r)}var b=k.conn;if(b&&b>1){var c=[];if((k.conn&1)!=0){c.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>')}if((k.conn&2)!=0){c.push('<span title="Intel&reg; AMT CIRA is connected and ready for use.">Intel&reg; AMT CIRA</span>')}if((k.conn&4)!=0){c.push('<span title="Intel&reg; AMT is routable and ready for use.">Intel&reg; AMT</span>')}if((k.conn&8)!=0){c.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>')}s+=addDeviceAttribute("Connectivity",c.join(", "))}var e="<i>None</i>";if(k.tags!=null){e="";for(var f in k.tags){e+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+k.tags[f]+"</span>"}}s+=addDeviceAttribute("Groups","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+e+"</span>");s+="</table><br />";if((h&76)!=0){s+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}QH("p10html",s);setupFiles();s="<div style=float:right;font-size:x-small;margin-right:10px>";if((h&4)!=0){s+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+k._id+'") title="Remove this device">Delete Device</a>'}s+="</div><div style=font-size:x-small>";s+="</div><br>";QH("p10html3",s);var n=PowerStateStr(k.state);if((b&1)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Agent connected">Mesh Agent</span>'}if((b&2)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Intel&reg; AMT connected">Intel&reg; AMT connected</span>'}else{if((b&4)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Intel&reg; AMT detected">Intel&reg; AMT detected</span>'}}QH("MainComputerState",n);QH("MainComputerImage",'<div class="i'+k.icon+'"></div>');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!m){m=10}go(m);setupDeviceMenu()}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(c,b){if(c!=null){currentDevicePanel=c}QV("p10general",currentDevicePanel==0);QV("p10desktop",currentDevicePanel==1);QV("p10files",currentDevicePanel==2);var a=[];if(currentDevicePanel!=0){a.push({n:"General",f:"setupDeviceMenu(0)"})}if(currentDevicePanel!=1){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&((currentNode!=null)&&(currentNode.mtype==2))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:170px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(90+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div>&nbsp;"+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td style=width:100px;color:gray>"+a+"</td><td style=overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel&reg; AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,'Delete "'+EscapeHtml(currentNode.name)+'"?<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm',a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<table align=center><td>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Groups"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktop;var desktopNode;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode;Q("Desk").addEventListener("DOMMouseScroll",function(a){return dmousewheel(a)});Q("Desk").addEventListener("mousewheel",function(a){return dmousewheel(a)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2));QV("connectbutton1h",(a==0)&&((currentNode.intelamt!=null)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var d=((currentNode.conn&1)!=0);QE("connectbutton1",d);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QE("DeskCAD",a==3);QE("DeskWD",a==3);QE("deskkeys",a==3);QV("DeskWD",(currentNode.agent)&&(currentNode.agent.id<5));QV("deskkeys",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToolsButton",d);QV("DeskToastButton",(currentNode.agent)&&(currentNode.agent.id<5));QE("DeskToastButton",d);if(d==false){QV("DeskTools",false)}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("termdisplays",false);if(fullscreen==true){deskToggleFull()}break;case 2:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){}var fullscreen=false;function deskAdjust(){var c=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(c<0){var a=Q("DeskParent").clientHeight,b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,76],[desktop.m.KeyAction.UP,76],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}}}}}}function sendCAD(){if(xxdialogMode||desktop==null||desktop.State!=3){return}desktop.m.sendcad()}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if(!xxdialogMode&&desktop!=null){desktop.m.mousedown(a)}}function dmouseup(a){if(!xxdialogMode&&desktop!=null){desktop.m.mouseup(a)}}function dmousemove(a){if(!xxdialogMode&&desktop!=null){desktop.m.mousemove(a)}}function dmousewheel(a){if(!xxdialogMode&&desktop!=null&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var l="",m="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",j="Root";var u=p13filetree.path.split("\\");p13filetreelocation=[];for(var n in u){if(u[n]!=""){p13filetreelocation.push(u[n])}}for(var n in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(n)+1)+")>"+p13filetreelocation[n]+"</a>"}var q=p13filetreelocation.join("/");var e=p13sort_files(p13filetree.dir);for(var n in e){var d=e[n],p=d.n,s;s=p;if(p.length>70){s='<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,70))+"...</span>"}else{s=EscapeHtml(p)}p=EscapeHtml(p);var g="";if(d.s!=null){g=getFileSizeStr(d.s)}var k="";if(d.t<3){var r="",t="";k="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right title=\""+t+'">'+r+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var o=s;if(d.s>0){o='<a target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(q+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+s+"</a>"}k="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'>&nbsp;<span style=float:right;padding-right:4px>"+g+"</span><span><div class=fileIcon"+d.t+"></div>"+o+"</span></div>"}if(d.t<3){l+=k}else{m+=k}}QH("p13files",l+m);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var n=0;n<a.length;n++){if(b.indexOf(p13filetree.dir[a[n].value].n)>=0){a[n].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"None":"All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength})};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){e="Intel&reg; AMT group"}if(currentMesh.mtype==2){e="Mesh agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&&currentMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){k+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>"}k+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name<m.name){return -1}return 0});for(var c in h){var j="",g="Partial&nbsp;Rights",f=h[c].rights;if(f==4294967295){g="Full&nbsp;Administrator"}else{if(f==0){g="No&nbsp;Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){j='<a onclick=p20deleteUser(event,"'+encodeURIComponent(h[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}k+='<tr onclick=p20viewuser("'+encodeURIComponent(h[c].id)+'") style=height:32px;cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+"><td>";k+="<div style=float:right>"+j+"</div><div style=float:right;padding-right:4px>"+g+"</div><div class=m2></div><div>&nbsp;"+h[c].name+"<div></div></div>";k+="</td></tr>";++a}k+="</tbody></table>";if(d==4294967295){k+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Mesh",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+='<div style="border:2px groove gray;background-color:white;max-height:80px;overflow-y:scroll">';a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Mesh<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Mesh Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Mesh Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Mesh"}if((c&2)!=0){d+=", Manage Mesh Users"}if((c&4)!=0){d+=", Manage Mesh Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var xxcurrentView=-1;function go(b){if(xxdialogMode||xxcurrentView==b){return}updateFooterMenu();setDialogMode(0);for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-300)/2))+"px");deskAdjust()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)}function reload(){window.location.href=window.location.href}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>&diams; "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();</script></body></html>
\ No newline at end of file
views/default.handlebars
+8 -8
@@ -1016,8 +1016,9 @@
1016 case 'nodes': {
1017 nodes = [];
1018 for (var m in message.nodes) {
1019 + if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
1020 for (var n in message.nodes[m]) {
1020 - if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
1021 + if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; }
1022 message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
1023 if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; }
1024 message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
@@ -2253,9 +2254,7 @@
2254 var loc = map_parseNodeLoc(nodes[i]);
2255 var feature = xxmap.markersSource.getFeatureById(nodes[i]._id);
2256 if ((loc != null) && ((nodes[i].meshid == selectedMesh) || (selectedMesh == null))) { // Draw markers for devices with locations
2256 - lat = loc[0];
2257 - lon = loc[1];
2258 - var type = loc[2];
2257 + var lat = loc[0], lon = loc[1], type = loc[2];
2258 if (boundingBox == null) { boundingBox = [ lat, lon, lat, lon, 0 ]; } else { if (lat < boundingBox[0]) { boundingBox[0] = lat; } if (lon < boundingBox[1]) { boundingBox[1] = lon; } if (lat > boundingBox[2]) { boundingBox[2] = lat; } if (lon > boundingBox[3]) { boundingBox[3] = lon; } }
2259 if (feature == null) { addFeature(nodes[i]); boundingBox[4] = 1; } else { updateFeature(nodes[i], feature); feature.setStyle(markerStyle(nodes[i], loc[2])); } // Update Feature
2260 } else {
@@ -2373,7 +2372,7 @@
2372 var coord = feature.getGeometry().getCoordinates();
2373 // map_cm_popup.setPosition(evt.coordinate);
2374 map_cm_popup.setPosition(coord);
2376 - featid = feature.getId();
2375 + var featid = feature.getId();
2376 if (featid) {
2377 QH('xmap-info-window', feature.get('name'));
2378 } else {
@@ -2387,7 +2386,7 @@
2386 });
2387
2388 // Initialize context menu for openlayers
2390 - contextmenu = new ContextMenu({
2389 + var contextmenu = new ContextMenu({
2390 width: 160,
2391 defaultItems: false, // defaultItems are Zoom In/Zoom Out
2392 items: contextmenu_items
@@ -2411,7 +2410,8 @@
2410 if (xxmap.contextmenu == null) { xxmap.contextmenu = contextmenu; }
2411 xxmap.map.addControl(xxmap.contextmenu);
2412 //addMeshOptions(); // Adds Mesh names to mesh dropdown
2414 - } catch (e) {
2413 + } catch (ex) {
2414 + console.log(ex);
2415 QV('viewselectmapoption', false);
2416 xxmap = null;
2417 }
@@ -5709,7 +5709,7 @@
5709
5710 // Remove one notification
5711 function notificationDelete(id) {
5712 - var j = -1; e = Q('notifyx' + id);
5712 + var j = -1, e = Q('notifyx' + id);
5713 if (e != null) {
5714 for (var i in notifications) { if (notifications[i].id == id) { j = i; } }
5715 if (j != -1) {
views/login-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;}#container{background-color:#fff;width:960px;min-width:960px;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}#masthead{width:auto;margin:0;padding:0;overflow:auto;text-align:right;background-color:#036;width:960px;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:center;background-color:#D3D9D6;}.style7{font-size:large;background-color:#FFFFFF;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;width:201px;background-color:#c9c9c9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}</style> <title>MeshCentral - Login</title> </head> <body onload="if (typeof(startup) !== 'undefined') startup();"> <div id="container" style="max-height:100vh"> <div id="mastheadx"></div> <div id="masthead" style="background:url(images/logoback.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px"> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px"> <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <div id="page_content" style="max-height:calc(100vh-138px)"> <div id="column_l"> <h1>Welcome</h1> <p>Connect to your home or office devices from anywhere in the world using MeshCentral, the remote monitoring and management web site. You will need to download and install a special management agent on your computers. Once installed, each mesh enabled computer will show up in the &quot;My Devices&quot; section of this web site and you will be able to monitor them, power them on and off and take control of them.</p> <table style="width:100%"> <tr> <td style="width:500px" valign="top"> <img alt="" height="310" src="images/mainwelcome.png" width="359" style="margin-left:70px"> </td> <td> <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form action="login" method="post"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> Forgot username/password? <a onclick="xgo(3)" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don&#39;t have an account? <a onclick="xgo(2)" style="cursor:pointer">Create one</a>. </div> </form> </div> <div id="createpanel" style="background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form action="createaccount" method="post"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <table> <tr> <td id="nuUser" align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td id="nuEmail" align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td id="nuPass1" align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td id="nuPass2" align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td> </tr> <tr> <td id="nuHint" align="right">Password Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td id="nuToken" align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form action="resetaccount" method="post"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> </td> </tr> </table> <br> </div> <div id="footer"> <table cellpadding="0" cellspacing="10" style="width:100%"> <tr> <td style="text-align:left;color:white"> {{{footer}}} </td> <td style="text-align:right"> {{{rootCertLink}}} &nbsp;<a href="terms">Terms &amp; Privacy</a> </td> </tr> </table> </div> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=parseInt("{{{emailcheck}}}");var features=parseInt("{{{features}}}");function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv","{{{newAccount}}}"!="0");if((passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1))}function showPassHint(){messagebox("Password Hint",passhint)}function xgo(a){QV("message1",false);QV("message2",false);go(a)}function go(a){setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);if(a==1){Q("username").focus()}if(a==2){Q("ausername").focus()}if(a==3){Q("remail").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("password").focus()}else{if(a==2){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var j=(Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1);var c=(validateEmail(Q("aemail").value)==true);var g=(Q("apassword1").value.length>0);var h=(Q("apassword2").value.length>0)&&(Q("apassword2").value==Q("apassword1").value);var d=(newAccountPass==0)||(Q("anewaccountpass").value.length>0);var f=(j&&c&&g&&h&&d);QS("nuUser").color=j?"black":"#7b241c";QS("nuEmail").color=c?"black":"#7b241c";QS("nuPass1").color=g?"black":"#7b241c";QS("nuPass2").color=h?"black":"#7b241c";QS("nuToken").color=d?"black":"#7b241c";QE("createButton",f);if(Q("apassword1").value==""){QH("passWarning","")}else{var i=checkPasswordStrength(Q("apassword1").value);if(i>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(i>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}if((b!=null)&&(b.keyCode==13)){if(a==1){Q("aemail").focus()}if(a==2){Q("apassword1").focus()}if(a==3){Q("apassword2").focus()}if(a==4){Q("apasswordhint").focus()}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{Q("createButton").click()}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px")}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)};</script></body></html>
\ No newline at end of file
1 +<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;}#container{background-color:#fff;width:960px;min-width:960px;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}#masthead{width:auto;margin:0;padding:0;overflow:auto;text-align:right;background-color:#036;width:960px;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:center;background-color:#D3D9D6;}.style7{font-size:large;background-color:#FFFFFF;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;width:201px;background-color:#c9c9c9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}</style> <title>MeshCentral - Login</title> </head> <body onload="if (typeof(startup) !== 'undefined') startup();"> <div id="container" style="max-height:100vh"> <div id="mastheadx"></div> <div id="masthead" style="background:url(images/logoback.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px"> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px"> <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <div id="page_content" style="max-height:calc(100vh-138px)"> <div id="column_l"> <h1>Welcome</h1> <p>Connect to your home or office devices from anywhere in the world using MeshCentral, the remote monitoring and management web site. You will need to download and install a special management agent on your computers. Once installed, each mesh enabled computer will show up in the &quot;My Devices&quot; section of this web site and you will be able to monitor them, power them on and off and take control of them.</p> <table style="width:100%"> <tr> <td style="width:500px" valign="top"> <img alt="" height="310" src="images/mainwelcome.png" width="359" style="margin-left:70px"> </td> <td> <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form action="login" method="post"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> Forgot username/password? <a onclick="xgo(3)" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don&#39;t have an account? <a onclick="xgo(2)" style="cursor:pointer">Create one</a>. </div> </form> </div> <div id="createpanel" style="background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form action="createaccount" method="post"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <table> <tr> <td id="nuUser" align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td id="nuEmail" align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td id="nuPass1" align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td id="nuPass2" align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td> </tr> <tr> <td id="nuHint" align="right">Password Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td id="nuToken" align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form action="resetaccount" method="post"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> </td> </tr> </table> <br> </div> <div id="footer"> <table cellpadding="0" cellspacing="10" style="width:100%"> <tr> <td style="text-align:left;color:white"> {{{footer}}} </td> <td style="text-align:right"> {{{rootCertLink}}} &nbsp;<a href="terms">Terms &amp; Privacy</a> </td> </tr> </table> </div> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}"use strict";var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=parseInt("{{{emailcheck}}}");var features=parseInt("{{{features}}}");function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv","{{{newAccount}}}"!="0");if((passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1))}function showPassHint(){messagebox("Password Hint",passhint)}function xgo(a){QV("message1",false);QV("message2",false);go(a)}function go(a){setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);if(a==1){Q("username").focus()}if(a==2){Q("ausername").focus()}if(a==3){Q("remail").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("password").focus()}else{if(a==2){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var j=(Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1);var c=(validateEmail(Q("aemail").value)==true);var g=(Q("apassword1").value.length>0);var h=(Q("apassword2").value.length>0)&&(Q("apassword2").value==Q("apassword1").value);var d=(newAccountPass==0)||(Q("anewaccountpass").value.length>0);var f=(j&&c&&g&&h&&d);QS("nuUser").color=j?"black":"#7b241c";QS("nuEmail").color=c?"black":"#7b241c";QS("nuPass1").color=g?"black":"#7b241c";QS("nuPass2").color=h?"black":"#7b241c";QS("nuToken").color=d?"black":"#7b241c";QE("createButton",f);if(Q("apassword1").value==""){QH("passWarning","")}else{var i=checkPasswordStrength(Q("apassword1").value);if(i>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(i>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}if((b!=null)&&(b.keyCode==13)){if(a==1){Q("aemail").focus()}if(a==2){Q("apassword1").focus()}if(a==3){Q("apassword2").focus()}if(a==4){Q("apasswordhint").focus()}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{Q("createButton").click()}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px")}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)};</script></body></html>
\ No newline at end of file
views/login-mobile-min.handlebars
+1 -1
@@ -1 +1 @@
1 -<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <title>MeshCentral - Login</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center"> <div id="column_l" style="padding:10px;width:100%"> <table style="width:100%"> <tr> <td align="center"> <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none"> <form action="login" method="post"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> Forgot user/password? <a onclick="xgo(3)" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don&#39;t have an account? <a onclick="xgo(2)" style="cursor:pointer">Create one</a>. </div> </form> </div> <div id="createpanel" style="display:none"> <div style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both"> <form action="createaccount" method="post"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <table> <tr> <td align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td> </tr> <tr> <td align="right">Pass Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> </div> <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form action="resetaccount" method="post"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> </td> </tr> </table> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table cellpadding="0" cellspacing="6" style="width:100%"> <tr> <td style="text-align:left;color:white">{{{footer}}}</td> <td style="text-align:right">{{{rootCertLink}}}&nbsp;<a href="terms">Terms &amp; Privacy</a></td> </tr> </table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=parseInt("{{{emailcheck}}}");var features=parseInt("{{{features}}}");function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv","{{{newAccount}}}"!="0");if((passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1))}function showPassHint(){messagebox("Password Hint",passhint)}function xgo(a){QV("message1",false);QV("message2",false);go(a)}function go(a){setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);if(a==1){Q("username").focus()}if(a==2){Q("ausername").focus()}if(a==3){Q("remail").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("password").focus()}else{if(a==2){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var c=((Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1)&&(validateEmail(Q("aemail").value)==true)&&(Q("apassword1").value.length>0)&&(Q("apassword2").value==Q("apassword1").value));if((newAccountPass==1)&&(Q("anewaccountpass").value.length==0)){c=false}QE("createButton",c);if(Q("apassword1").value==""){QH("passWarning","")}else{var d=checkPasswordStrength(Q("apassword1").value);if(d>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(d>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}if((b!=null)&&(b.keyCode==13)){if(a==1){Q("aemail").focus()}if(a==2){Q("apassword1").focus()}if(a==3){Q("apassword2").focus()}if(a==4){Q("apasswordhint").focus()}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{Q("createButton").click()}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px")}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)};</script></body></html>
\ No newline at end of file
1 +<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <title>MeshCentral - Login</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center"> <div id="column_l" style="padding:10px;width:100%"> <table style="width:100%"> <tr> <td align="center"> <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none"> <form action="login" method="post"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> Forgot user/password? <a onclick="xgo(3)" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don&#39;t have an account? <a onclick="xgo(2)" style="cursor:pointer">Create one</a>. </div> </form> </div> <div id="createpanel" style="display:none"> <div style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both"> <form action="createaccount" method="post"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <table> <tr> <td align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td> </tr> <tr> <td align="right">Pass Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> </div> <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form action="resetaccount" method="post"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> </form> </div> </td> </tr> </table> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table cellpadding="0" cellspacing="6" style="width:100%"> <tr> <td style="text-align:left;color:white">{{{footer}}}</td> <td style="text-align:right">{{{rootCertLink}}}&nbsp;<a href="terms">Terms &amp; Privacy</a></td> </tr> </table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}"use strict";var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=parseInt("{{{emailcheck}}}");var features=parseInt("{{{features}}}");function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv","{{{newAccount}}}"!="0");if((passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1))}function showPassHint(){messagebox("Password Hint",passhint)}function xgo(a){QV("message1",false);QV("message2",false);go(a)}function go(a){setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);if(a==1){Q("username").focus()}if(a==2){Q("ausername").focus()}if(a==3){Q("remail").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("password").focus()}else{if(a==2){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var c=((Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1)&&(validateEmail(Q("aemail").value)==true)&&(Q("apassword1").value.length>0)&&(Q("apassword2").value==Q("apassword1").value));if((newAccountPass==1)&&(Q("anewaccountpass").value.length==0)){c=false}QE("createButton",c);if(Q("apassword1").value==""){QH("passWarning","")}else{var d=checkPasswordStrength(Q("apassword1").value);if(d>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(d>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}if((b!=null)&&(b.keyCode==13)){if(a==1){Q("aemail").focus()}if(a==2){Q("apassword1").focus()}if(a==3){Q("apassword2").focus()}if(a==4){Q("apasswordhint").focus()}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{Q("createButton").click()}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px")}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)};</script></body></html>
\ No newline at end of file
webserver.js
+3 -2
@@ -776,8 +776,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
776
777 // Get the link to the root certificate if needed
778 function getRootCertLink() {
779 - // TODO: This is not quite right, we need to check if the HTTPS certificate is issued from MeshCentralRoot, if so, add this download link.
780 - if (obj.args.notls == null && obj.certificates.RootName.substring(0, 16) == 'MeshCentralRoot-') { return '<a href=/MeshServerRootCert.cer title="Download the root certificate for this server">Root Certificate</a>'; }
779 + // Check if the HTTPS certificate is issued from MeshCentralRoot, if so, add download link to root certificate.
780 + if ((obj.args.notls == null) && (obj.tlsSniCredentials == null) && (obj.certificates.WebIssuer.indexOf('MeshCentralRoot-') == 0) && (obj.certificates.CommonName != 'un-configured')) { return '<a href=/MeshServerRootCert.cer title="Download the root certificate for this server">Root Certificate</a>'; }
781 return '';
782 }
783
@@ -1938,6 +1938,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1938 function isMobileBrowser(req) {
1939 //var ua = req.headers['user-agent'].toLowerCase();
1940 //return (/(android|bb\d+|meego).+mobile|mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4)));
1941 + if (typeof req.headers['user-agent'] != 'string') return false;
1942 return (req.headers['user-agent'].toLowerCase().indexOf('mobile') >= 0);
1943 }
1944