mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 23:15:01 +03:00
1 line
245 KiB
Handlebars
1 line
245 KiB
Handlebars
<!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"> <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico"> <script type="text/javascript" src="scripts/filesaver.js"></script> <title>{{{title}}}</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:url(logo.png) 0px 0px;background-size:341px 50px;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 id="topMenuIcon" class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer;display:none" 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%"><span id="p0span">Server disconnected</span>, <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">◀</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 Security</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div id="manageAuthApp" style="margin-top:5px;display:none"><a onclick="account_manageAuthApp()" style="cursor:pointer">Manage authenticator app</a></div> <div id="manageOtp" style="margin-top:5px;display:none"><a onclick="account_manageOtp(0)" style="cursor:pointer">Manage backup codes</a></div> </div> <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"><span id="changeEmailId" style="display:none"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></span></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><span id="p2nextPasswordUpdateTime"></span></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> </div> <br style="clear:both"> </div> <strong>Device Groups</strong> <span id="p3createMeshLink1">( <a onclick="account_createMesh()" style="cursor:pointer"><img src="images/icon-addnew.png" width="12" height="12" border="0"> New</a> )</span> <br><br> <div id="p3meshes"></div> <div id="p3noMeshFound" style="margin-left:9px;display:none">No device groups.<span id="p3createMeshLink2"> <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></span></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">◀</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"> <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">◀</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:hidden;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> <input id="DeskSoftInput" type="text" style="width:25px;display:none;opacity:.2" onblur="toggleSoftKeys(0)" onkeypress="return ondeskkeypress(event)" onkeydown="return ondeskkeydown(event)" onkeyup="return ondeskkeyup(event)"> </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> <span id="DeskToastButton" title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick="deviceToastFunction()" height="16" width="16" style="padding-top:2px"></span> </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="DeskSpecialKeys" type="button" value="Special Keys" onkeypress="return false" onkeydown="return false" onclick="sendSpecialKeys()"> <input id="DeskSoftKeys" type="button" value="Keyboard" onkeypress="return false" onkeydown="return false" onclick="toggleSoftKeys(1)"> <label><span id="DeskControlSpan" style="display:none" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Input</span></label> </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"> <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">◀</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 id="dialog3" style="margin:auto;margin:3px"> <select id="deskkeys" style="width:100%"> <option value="10">Ctrl+Alt+Del <option value="11">Tab <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 <option value="6">Win+R <option value="7">Alt-F4 <option value="8">Ctrl-W <option value="9">Alt-Tab </select> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">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">Rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel® 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>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"> <label><input type="checkbox" id='d7showfocus'>Show Focus Tool<br></label> <label><input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<></label>> </div> <div>Other</div> </div> </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> <div id="logoutMenuOption"><a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Logout</div></a></div> </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 QC(a){try{return Q(a).classList}catch(a){}}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,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g," ")}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+=" "}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,"®").replace(/\(TM\)/g,"™")}function zeroPad(b,a){if(a==null){a=2}var d="00000000"+b;return d.substr(d.length-a)}var MeshServerCreateControl=function(b,a){var c={};c.State=0;c.connectstate=0;c.pingTimer=null;c.authCookie=a;c.trace=false;c.xxStateChange=function(e,d){if(c.State==e){return}var f=c.State;c.State=e;if(c.onStateChanged){c.onStateChanged(c,c.State,f,d)}};c.Start=function(){if(c.connectstate!=0){return}c.connectstate=0;var d=window.location.protocol.replace("http","ws")+"//"+window.location.host+b+"control.ashx";if(c.authCookie&&(c.authCookie!="")){d+="?auth="+c.authCookie}c.socket=new WebSocket(d);c.socket.onopen=function(f){c.connectstate=1};c.socket.onmessage=c.xxOnMessage;c.socket.onclose=function(f){c.Stop(f.code)};c.xxStateChange(1,0);if(c.pingTimer!=null){clearInterval(c.pingTimer)}c.pingTimer=setInterval(function(){c.send({action:"ping"})},29000)};c.Stop=function(d){c.connectstate=0;if(c.socket){c.socket.close();delete c.socket}if(c.pingTimer!=null){clearInterval(c.pingTimer);c.pingTimer=null}c.xxStateChange(0,d)};c.xxOnMessage=function(d){if(c.State==1){c.xxStateChange(2)}var f;try{f=JSON.parse(d.data)}catch(d){return}if((typeof f!="object")||(f.action=="pong")){return}if(f.action=="close"){if(f.msg){console.log(f.msg)}c.Stop(f.cause);return}if(c.trace){console.log("RECV",f)}if(c.onMessage){c.onMessage(c,f)}};c.send=function(d){if(c.socket!=null&&c.connectstate==1){if(c.trace){console.log("SEND",d)}c.socket.send(JSON.stringify(d))}};return c};var CreateAgentRedirect=function(f,g,l,a,k,b){var h={};h.m=g;g.parent=h;h.meshserver=f;h.authCookie=a;h.rauthCookie=k;h.State=0;h.nodeid=null;h.socket=null;h.connectstate=-1;h.tunnelid=Math.random().toString(36).substring(2);h.protocol=g.protocol;h.onStateChanged=null;h.ctrlMsgAllowed=true;h.attemptWebRTC=false;h.webRtcActive=false;h.webSwitchOk=false;h.webchannel=null;h.webrtc=null;h.debugmode=0;h.serverIsRecording=false;if(b==null){b="/"}h.consoleMessage=null;h.onConsoleMessageChange=null;h.Start=function(m){var p,o=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?browser=1&p="+h.protocol+"&nodeid="+m+"&id="+h.tunnelid;if((a!=null)&&(a!="")){o+="&auth="+a}h.nodeid=m;h.connectstate=0;h.socket=new WebSocket(o);h.socket.onopen=h.xxOnSocketConnected;h.socket.onmessage=h.xxOnMessage;h.socket.onerror=function(q){};h.socket.onclose=h.xxOnSocketClosed;h.xxStateChange(1);var n="*"+b+"meshrelay.ashx?p="+h.protocol+"&nodeid="+m+"&id="+h.tunnelid;if((k!=null)&&(k!="")){n+=("&rauth="+k)}h.meshserver.send({action:"msg",type:"tunnel",nodeid:h.nodeid,value:n,usage:h.protocol})};h.xxOnSocketConnected=function(){if(h.debugmode==1){console.log("onSocketConnected")}h.xxStateChange(2)};h.xxOnControlCommand=function(o){var m;try{m=JSON.parse(o)}catch(n){return}if(m.ctrlChannel!="102938"){h.xxOnSocketData(o);return}if(m.type=="console"){h.consoleMessage=m.msg;if(h.onConsoleMessageChange){h.onConsoleMessageChange(h,h.consoleMessage)}}else{if(h.webrtc!=null){if(m.type=="answer"){h.webrtc.setRemoteDescription(new RTCSessionDescription(m),function(){},h.xxCloseWebRTC)}else{if(m.type=="webrtc0"){h.webSwitchOk=true;j()}else{if(m.type=="webrtc1"){h.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(m.type=="webrtc2"){}}}}}}};h.sendCtrlMsg=function(n){if(h.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof n,n)}try{h.socket.send(n)}catch(m){}}};function j(){if((h.webSwitchOk==true)&&(h.webRtcActive==true)){h.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');h.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(h.onStateChanged!=null){h.onStateChanged(h,h.State)}}}h.xxOnMessage=function(p){if(h.State<3){if((p.data=="c")||(p.data=="cr")){if(p.data=="cr"){h.serverIsRecording=true}try{h.socket.send(h.protocol)}catch(q){}h.xxStateChange(3);if(h.attemptWebRTC==true){var o=null;if(typeof RTCPeerConnection!=="undefined"){h.webrtc=new RTCPeerConnection(o)}else{if(typeof webkitRTCPeerConnection!=="undefined"){h.webrtc=new webkitRTCPeerConnection(o)}}if(h.webrtc!=null){h.webchannel=h.webrtc.createDataChannel("DataChannel",{});h.webchannel.onmessage=h.xxOnMessage;h.webchannel.onopen=function(){h.webRtcActive=true;j()};h.webchannel.onclose=function(t){if(h.webRtcActive){h.Stop()}};h.webrtc.onicecandidate=function(t){if(t.candidate==null){try{h.socket.send(JSON.stringify(h.webrtcoffer))}catch(u){}}else{h.webrtcoffer.sdp+=("a="+t.candidate.candidate+"\r\n")}};h.webrtc.oniceconnectionstatechange=function(){if(h.webrtc!=null){if(h.webrtc.iceConnectionState=="disconnected"){if(h.webRtcActive==true){h.Stop()}else{h.xxCloseWebRTC()}}else{if(h.webrtc.iceConnectionState=="failed"){h.xxCloseWebRTC()}}}};h.webrtc.createOffer(function(t){h.webrtcoffer=t;h.webrtc.setLocalDescription(t,function(){},h.xxCloseWebRTC)},h.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof p.data=="string"){h.xxOnControlCommand(p.data);return}if(typeof p.data=="object"){if(e==true){d.push(p.data);return}if(c.readAsBinaryString){e=true;c.readAsBinaryString(new Blob([p.data]))}else{if(c.readAsArrayBuffer){e=true;c.readAsArrayBuffer(p.data)}else{var m="",n=new Uint8Array(p.data),s=n.byteLength;for(var r=0;r<s;r++){m+=String.fromCharCode(n[r])}h.xxOnSocketData(m)}}}else{h.xxOnSocketData(p.data)}};var c=new FileReader();var e=false,d=[];if(c.readAsBinaryString){c.onload=function(m){h.xxOnSocketData(m.target.result);if(d.length==0){e=false}else{c.readAsBinaryString(new Blob([d.shift()]))}}}else{if(c.readAsArrayBuffer){c.onloadend=function(m){h.xxOnSocketData(m.target.result);if(d.length==0){e=false}else{c.readAsArrayBuffer(d.shift())}}}}h.xxOnSocketData=function(o){if(!o||h.connectstate==-1){return}if(typeof o==="object"){var m="",n=new Uint8Array(o),q=n.byteLength;for(var p=0;p<q;p++){m+=String.fromCharCode(n[p])}o=m}else{if(typeof o!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof o,o.length,o)}return h.m.ProcessData(o)};h.sendText=function(m){if(typeof m!="string"){m=JSON.stringify(m)}h.send(encode_utf8(m))};h.send=function(q){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof q,q.length,q)}try{if(h.socket!=null&&h.socket.readyState==WebSocket.OPEN){if(typeof q=="string"){if(h.debugmode==1){var m=new Uint8Array(q.length),n=[];for(var p=0;p<q.length;++p){m[p]=q.charCodeAt(p);n.push(q.charCodeAt(p))}if(h.webRtcActive==true){h.webchannel.send(m.buffer)}else{h.socket.send(m.buffer)}}else{var m=new Uint8Array(q.length);for(var p=0;p<q.length;++p){m[p]=q.charCodeAt(p)}if(h.webRtcActive==true){h.webchannel.send(m.buffer)}else{h.socket.send(m.buffer)}}}else{if(h.webRtcActive==true){h.webchannel.send(q)}else{h.socket.send(q)}}}}catch(o){}};h.xxOnSocketClosed=function(){h.Stop(1)};h.xxStateChange=function(m){if(h.State==m){return}h.State=m;h.m.xxStateChange(h.State);if(h.onStateChanged!=null){h.onStateChanged(h,h.State)}};h.xxCloseWebRTC=function(){if(h.webchannel!=null){try{h.webchannel.close()}catch(m){}h.webchannel=null}if(h.webrtc!=null){try{h.webrtc.close()}catch(m){}h.webrtc=null}h.webRtcActive=false};h.Stop=function(n){if(h.debugmode==1){console.log("stop",n)}h.xxCloseWebRTC();h.connectstate=-1;if(h.socket!=null){try{if(h.socket.readyState==1){h.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');h.socket.close()}}catch(m){}h.socket=null}h.xxStateChange(0)};return h};var CreateAgentRemoteDesktop=function(a,f){var e={};e.CanvasId=a;if(typeof a==="string"){e.CanvasId=Q(a)}e.Canvas=e.CanvasId.getContext("2d");e.scrolldiv=f;e.State=0;e.PendingOperations=[];e.tilesReceived=0;e.TilesDrawn=0;e.KillDraw=0;e.ipad=false;e.tabletKeyboardVisible=false;e.LastX=0;e.LastY=0;e.touchenabled=0;e.submenuoffset=0;e.touchtimer=null;e.TouchArray={};e.connectmode=0;e.connectioncount=0;e.rotation=0;e.protocol=2;e.debugmode=0;e.firstUpKeys=[];e.stopInput=false;e.localKeyMap=true;e.altPressed=false;e.ctrlPressed=false;e.shiftPressed=false;e.sessionid=0;e.username;e.oldie=false;e.CompressionLevel=50;e.ScalingLevel=1024;e.FrameRateTimer=50;e.FirstDraw=false;e.ScreenWidth=960;e.ScreenHeight=700;e.width=960;e.height=960;e.onScreenSizeChange=null;e.onMessage=null;e.onConnectCountChanged=null;e.onDebugMessage=null;e.onTouchEnabledChanged=null;e.onDisplayinfo=null;e.accumulator=null;var d=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none"];e.Start=function(){e.State=0;e.accumulator=null};e.Stop=function(){e.setRotation(0);e.UnGrabKeyInput();e.UnGrabMouseInput();e.touchenabled=0;if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}e.Canvas.clearRect(0,0,e.CanvasId.width,e.CanvasId.height)};e.xxStateChange=function(g){if(e.State==g){return}e.State=g;e.CanvasId.style.cursor="default";switch(g){case 0:e.Stop();break;case 3:break}};e.send=function(g){if(e.debugmode>1){console.log("KSend("+g.length+"): "+rstr2hex(g))}if(e.parent!=null){e.parent.send(g)}};e.ProcessPictureMsg=function(h,k,l){var j=new Image();j.xcount=e.tilesReceived++;var g=e.tilesReceived;j.src="data:image/jpeg;base64,"+btoa(h.substring(4,h.length));j.onload=function(){if(e.Canvas!=null&&e.KillDraw<g&&e.State!=0){e.PendingOperations.push([g,2,j,k,l]);while(e.DoPendingOperations()){}}};j.error=function(){console.log("DecodeTileError")}};e.DoPendingOperations=function(){if(e.PendingOperations.length==0){return false}for(var g=0;g<e.PendingOperations.length;g++){var h=e.PendingOperations[g];if(h[0]==(e.TilesDrawn+1)){if(h[1]==1){e.ProcessCopyRectMsg(h[2])}else{if(h[1]==2){e.Canvas.drawImage(h[2],e.rotX(h[3],h[4]),e.rotY(h[3],h[4]));delete h[2]}}e.PendingOperations.splice(g,1);delete h;e.TilesDrawn++;if(e.TilesDrawn==e.tilesReceived&&e.KillDraw<e.TilesDrawn){e.KillDraw=e.TilesDrawn=e.tilesReceived=0}return true}}if(e.oldie&&e.PendingOperations.length>0){e.TilesDrawn++}return false};e.ProcessCopyRectMsg=function(k){var l=((k.charCodeAt(0)&255)<<8)+(k.charCodeAt(1)&255);var m=((k.charCodeAt(2)&255)<<8)+(k.charCodeAt(3)&255);var g=((k.charCodeAt(4)&255)<<8)+(k.charCodeAt(5)&255);var h=((k.charCodeAt(6)&255)<<8)+(k.charCodeAt(7)&255);var n=((k.charCodeAt(8)&255)<<8)+(k.charCodeAt(9)&255);var j=((k.charCodeAt(10)&255)<<8)+(k.charCodeAt(11)&255);e.Canvas.drawImage(Canvas.canvas,l,m,n,j,g,h,n,j)};e.SendUnPause=function(){e.send(String.fromCharCode(0,8,0,5,0))};e.SendPause=function(){e.send(String.fromCharCode(0,8,0,5,1))};e.SendCompressionLevel=function(k,h,j,g){if(h){e.CompressionLevel=h}if(j){e.ScalingLevel=j}if(g){e.FrameRateTimer=g}e.send(String.fromCharCode(0,5,0,10,k,e.CompressionLevel)+e.shortToStr(e.ScalingLevel)+e.shortToStr(e.FrameRateTimer))};e.SendRefresh=function(){e.send(String.fromCharCode(0,6,0,4))};e.ProcessScreenMsg=function(h,g){if(e.debugmode>0){console.log("ScreenSize: "+h+" x "+g)}e.Canvas.setTransform(1,0,0,1,0,0);e.rotation=0;e.FirstDraw=true;e.ScreenWidth=e.width=h;e.ScreenHeight=e.height=g;e.KillDraw=e.tilesReceived;while(e.PendingOperations.length>0){e.PendingOperations.shift()}e.SendCompressionLevel(1);e.SendUnPause();if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}};e.ProcessData=function(h){var g=0;while(g<h.length){g+=e.ProcessDataEx(h.substring(g))}};e.ProcessDataEx=function(r){if(e.accumulator!=null){r=e.accumulator+r;e.accumulator=null}if(e.debugmode>1){console.log("KRecv("+r.length+"): "+rstr2hex(r.substring(0,Math.min(r.length,40))))}if(r.length<4){return}var g=null,s=0,t=0,j=ReadShort(r,0),h=ReadShort(r,2),p=0;if((j==27)&&(h==8)){if(r.length<12){return}j=ReadShort(r,8);h=ReadInt(r,4);if((h+8)>r.length){e.accumulator=r;return}r=r.substring(8);p=8}if((h!=r.length)&&(e.debugmode>0)){console.log(h,r.length,h==r.length)}if((j>=18)&&(j!=65)&&(j!=88)){console.error("Invalid KVM command "+j+" of size "+h);console.log("Invalid KVM data",r.length,rstr2hex(r.substring(0,40))+"...");return}if(h>r.length){e.accumulator=r;return}if(j==3||j==4||j==7){g=r.substring(4,h);s=((g.charCodeAt(0)&255)<<8)+(g.charCodeAt(1)&255);t=((g.charCodeAt(2)&255)<<8)+(g.charCodeAt(3)&255);if(e.debugmode>0){console.log("CMD"+j+" at X="+s+" Y="+t)}}switch(j){case 3:if(e.FirstDraw){e.onResize()}e.ProcessPictureMsg(g,s,t);break;case 4:if(e.FirstDraw){e.onResize()}if(e.TilesDrawn==e.tilesReceived){e.ProcessCopyRectMsg(g)}else{e.PendingOperations.push([++tilesReceived,1,g])}break;case 7:e.ProcessScreenMsg(s,t);e.SendKeyMsgKC(e.KeyAction.UP,16);e.SendKeyMsgKC(e.KeyAction.UP,17);e.SendKeyMsgKC(e.KeyAction.UP,18);e.SendKeyMsgKC(e.KeyAction.UP,91);e.SendKeyMsgKC(e.KeyAction.UP,92);e.SendKeyMsgKC(e.KeyAction.UP,16);e.send(String.fromCharCode(0,14,0,4));break;case 11:var q=0,n={},l=((r.charCodeAt(4)&255)<<8)+(r.charCodeAt(5)&255);if(l>0){q=((r.charCodeAt(6+(l*2))&255)<<8)+(r.charCodeAt(7+(l*2))&255);for(var o=0;o<l;o++){var m=((r.charCodeAt(6+(o*2))&255)<<8)+(r.charCodeAt(7+(o*2))&255);if(m==65535){n[m]="All Displays"}else{n[m]="Display "+m}}}if(e.onDisplayinfo!=null){e.onDisplayinfo(e,n,q)}break;case 12:break;case 14:e.touchenabled=1;e.TouchArray={};if(e.onTouchEnabledChanged!=null){e.onTouchEnabledChanged(e.touchenabled)}break;case 15:e.TouchArray={};break;case 16:e.connectioncount=ReadInt(r,4);if(e.onConnectCountChanged!=null){e.onConnectCountChanged(e.connectioncount,e)}break;case 17:if(e.onMessage!=null){e.onMessage(r.substring(4,h),e)}break;case 65:r=r.substring(4);if(r[0]!="."){console.log(r);if(e.parent!=null){e.parent.consoleMessage=r;if(e.parent.onConsoleMessageChange){e.parent.onConsoleMessageChange(e.parent,r)}}}else{console.log("KVM: "+r.substring(1))}break;case 88:if(h!=5){break}var k=r.charCodeAt(4);if(k>d.length){k=0}e.CanvasId.style.cursor=d[k];break}return h+p};e.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};e.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};e.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};e.Alternate=0;var c={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};function b(g){if(g.code.startsWith("Key")&&g.code.length==4){return g.code.charCodeAt(3)}if(g.code.startsWith("Digit")&&g.code.length==6){return g.code.charCodeAt(5)}if(g.code.startsWith("Numpad")&&g.code.length==7){return g.code.charCodeAt(6)+48}return c[g.code]}e.SendKeyMsg=function(g,h){if(g==null){return}if(!h){h=window.event}if(h.code&&(e.localKeyMap==false)){var j=b(h);if(j!=null){e.SendKeyMsgKC(g,j)}}else{var j=h.keyCode;if(j==59){j=186}else{if(j==173){j=189}else{if(j==61){j=187}}}e.SendKeyMsgKC(g,j)}};e.SendMessage=function(g){if(e.State==3){e.send(String.fromCharCode(0,17)+e.shortToStr(4+g.length)+g)}};e.SendKeyMsgKC=function(g,j){if(e.State!=3){return}if(typeof g=="object"){for(var h in g){e.SendKeyMsgKC(g[h][0],g[h][1])}}else{e.send(String.fromCharCode(0,e.InputType.KEY,0,6,(g-1),j))}};e.sendcad=function(){e.SendCtrlAltDelMsg()};e.SendCtrlAltDelMsg=function(){if(e.State==3){e.send(String.fromCharCode(0,e.InputType.CTRLALTDEL,0,4))}};e.SendEscKey=function(){if(e.State==3){e.send(String.fromCharCode(0,e.InputType.KEY,0,6,0,27,0,e.InputType.KEY,0,6,1,27))}};e.SendStartMsg=function(){e.SendKeyMsgKC(e.KeyAction.EXDOWN,91);e.SendKeyMsgKC(e.KeyAction.EXUP,91)};e.SendCharmsMsg=function(){e.SendKeyMsgKC(e.KeyAction.EXDOWN,91);e.SendKeyMsgKC(e.KeyAction.DOWN,67);e.SendKeyMsgKC(e.KeyAction.UP,67);e.SendKeyMsgKC(e.KeyAction.EXUP,91)};e.SendTouchMsg1=function(h,g,j,k){if(e.State==3){e.send(String.fromCharCode(0,e.InputType.TOUCH)+e.shortToStr(14)+String.fromCharCode(1,h)+e.intToStr(g)+e.shortToStr(j)+e.shortToStr(k))}};e.SendTouchMsg2=function(j,g){var m="";var h;var n="TOUCHSEND: ";for(var l in e.TouchArray){if(l==j){h=g}else{if(e.TouchArray[l].f==1){h=65536|2|4;e.TouchArray[l].f=3;n+="START"+l}else{if(e.TouchArray[l].f==2){h=262144;n+="STOP"+l}else{h=2|4|131072}}}m+=String.fromCharCode(l)+e.intToStr(h)+e.shortToStr(e.TouchArray[l].x)+e.shortToStr(e.TouchArray[l].y);if(e.TouchArray[l].f==2){delete e.TouchArray[l]}}if(e.State==3){e.send(String.fromCharCode(0,e.InputType.TOUCH)+e.shortToStr(5+m.length)+String.fromCharCode(2)+m)}if(Object.keys(e.TouchArray).length==0&&e.touchtimer!=null){clearInterval(e.touchtimer);e.touchtimer=null}};e.SendMouseMsg=function(g,k){if(e.State!=3){return}if(g!=null&&e.Canvas!=null){if(!k){var k=window.event}var n=(e.Canvas.canvas.height/e.CanvasId.clientHeight);var o=(e.Canvas.canvas.width/e.CanvasId.clientWidth);var m=e.GetPositionOfControl(e.Canvas.canvas);var p=((k.pageX-m[0])*o);var q=((k.pageY-m[1])*n);if(k.addx){p+=k.addx}if(k.addy){q+=k.addy}if(p>=0&&p<=e.Canvas.canvas.width&&q>=0&&q<=e.Canvas.canvas.height){var h=0;var j=0;if(g==e.KeyAction.UP||g==e.KeyAction.DOWN){if(k.which){((k.which==1)?(h=e.MouseButton.LEFT):((k.which==2)?(h=e.MouseButton.MIDDLE):(h=e.MouseButton.RIGHT)))}else{if(k.button){((k.button==0)?(h=e.MouseButton.LEFT):((k.button==1)?(h=e.MouseButton.MIDDLE):(h=e.MouseButton.RIGHT)))}}}else{if(g==e.KeyAction.SCROLL){if(k.detail){j=(-1*(k.detail*120))}else{if(k.wheelDelta){j=(k.wheelDelta*3)}}}}var l="";if(g==e.KeyAction.DBLCLICK){l=String.fromCharCode(0,e.InputType.MOUSE,0,10,0,136,((p/256)&255),(p&255),((q/256)&255),(q&255))}else{if(g==e.KeyAction.SCROLL){l=String.fromCharCode(0,e.InputType.MOUSE,0,12,0,0,((p/256)&255),(p&255),((q/256)&255),(q&255),((j/256)&255),(j&255))}else{l=String.fromCharCode(0,e.InputType.MOUSE,0,10,0,((g==e.KeyAction.DOWN)?h:((h*2)&255)),((p/256)&255),(p&255),((q/256)&255),(q&255))}}if(e.Action==e.KeyAction.NONE){if(e.Alternate==0||e.ipad){e.send(l);e.Alternate=1}else{e.Alternate=0}}else{e.send(l)}}}};e.GetDisplayNumbers=function(){e.send(String.fromCharCode(0,11,0,4))};e.SetDisplay=function(g){console.log("Set display",g);e.send(String.fromCharCode(0,12,0,6,g>>8,g&255))};e.intToStr=function(g){return String.fromCharCode((g>>24)&255,(g>>16)&255,(g>>8)&255,g&255)};e.shortToStr=function(g){return String.fromCharCode((g>>8)&255,g&255)};e.onResize=function(){if(e.ScreenWidth==0||e.ScreenHeight==0){return}if(e.Canvas.canvas.width==e.ScreenWidth&&e.Canvas.canvas.height==e.ScreenHeight){return}if(e.FirstDraw){e.Canvas.canvas.width=e.ScreenWidth;e.Canvas.canvas.height=e.ScreenHeight;e.Canvas.fillRect(0,0,e.ScreenWidth,e.ScreenHeight);if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}}e.FirstDraw=false};e.xxMouseInputGrab=false;e.xxKeyInputGrab=false;e.xxMouseMove=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.NONE,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxMouseUp=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.UP,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxMouseDown=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.DOWN,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxMouseDblClick=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.DBLCLICK,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxDOMMouseScroll=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.SCROLL,g);return false}return true};e.xxMouseWheel=function(g){if(e.State==3){e.SendMouseMsg(e.KeyAction.SCROLL,g);return false}return true};e.xxKeyUp=function(g){if(e.State==3){e.SendKeyMsg(e.KeyAction.UP,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxKeyDown=function(g){if(e.State==3){e.SendKeyMsg(e.KeyAction.DOWN,g)}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.xxKeyPress=function(g){if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};e.handleKeys=function(g){if(e.stopInput==true||desktop.State!=3){return false}return e.xxKeyPress(g)};e.handleKeyUp=function(g){if(e.stopInput==true||desktop.State!=3){return false}if(e.firstUpKeys.length<5){e.firstUpKeys.push(g.keyCode);if((e.firstUpKeys.length==5)){var h=e.firstUpKeys.join(",");if((h=="16,17,91,91,16")||(h=="16,17,18,91,92")){e.stopInput=true}}}if(g.keyCode==16){e.shiftPressed=false}if(g.keyCode==17){e.ctrlPressed=false}if(g.keyCode==18){e.altPressed=false}return e.xxKeyUp(g)};e.handleKeyDown=function(g){if(e.stopInput==true||desktop.State!=3){return false}if(g.keyCode==16){e.shiftPressed=true}if(g.keyCode==17){e.ctrlPressed=true}if(g.keyCode==18){e.altPressed=true}return e.xxKeyDown(g)};e.handleReleaseKeys=function(){if(e.shiftPressed){e.SendKeyMsgKC(e.KeyAction.UP,16)}if(e.ctrlPressed){e.SendKeyMsgKC(e.KeyAction.UP,17)}if(e.altPressed){e.SendKeyMsgKC(e.KeyAction.UP,18)}e.shiftPressed=e.ctrlPressed=e.altPressed=false};e.mousedblclick=function(g){if(e.stopInput==true){return false}return e.xxMouseDblClick(g)};e.mousedown=function(g){if(e.stopInput==true){return false}return e.xxMouseDown(g)};e.mouseup=function(g){if(e.stopInput==true){return false}return e.xxMouseUp(g)};e.mousemove=function(g){if(e.stopInput==true){return false}return e.xxMouseMove(g)};e.mousewheel=function(g){if(e.stopInput==true){return false}return e.xxMouseWheel(g)};e.xxMsTouchEvent=function(g){if(g.originalEvent.pointerType==4){return}if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}if(g.type=="MSPointerDown"||g.type=="MSPointerMove"||g.type=="MSPointerUp"){var h=0;var j=g.originalEvent.pointerId%256;var k=g.offsetX*(Canvas.canvas.width/e.CanvasId.clientWidth);var l=g.offsetY*(Canvas.canvas.height/e.CanvasId.clientHeight);if(g.type=="MSPointerDown"){h=65536|2|4}else{if(g.type=="MSPointerMove"){h=131072|2|4}else{if(g.type=="MSPointerUp"){h=262144}}}if(!e.TouchArray[j]){e.TouchArray[j]={x:k,y:l}}e.SendTouchMsg2(j,h);if(g.type=="MSPointerUp"){delete e.TouchArray[j]}}else{alert(g.type)}return true};e.xxTouchStart=function(g){if(e.State!=3){return}if(g.preventDefault){g.preventDefault()}if(e.touchenabled==0||e.touchenabled==1){if(g.originalEvent.touches.length>1){return}var l=g.originalEvent.touches[0];g.which=1;e.LastX=g.pageX=l.pageX;e.LastY=g.pageY=l.pageY;e.SendMouseMsg(KeyAction.DOWN,g)}else{var k=e.GetPositionOfControl(Canvas.canvas);for(var h in g.originalEvent.changedTouches){if(!g.originalEvent.changedTouches[h].identifier){continue}var j=g.originalEvent.changedTouches[h].identifier%256;if(!e.TouchArray[j]){e.TouchArray[j]={x:(g.originalEvent.touches[h].pageX-k[0])*(Canvas.canvas.width/e.CanvasId.clientWidth),y:(g.originalEvent.touches[h].pageY-k[1])*(Canvas.canvas.height/e.CanvasId.clientHeight),f:1}}}if(Object.keys(e.TouchArray).length>0&&touchtimer==null){e.touchtimer=setInterval(function(){e.SendTouchMsg2(256,0)},50)}}};e.xxTouchMove=function(g){if(e.State!=3){return}if(g.preventDefault){g.preventDefault()}if(e.touchenabled==0||e.touchenabled==1){if(g.originalEvent.touches.length>1){return}var l=g.originalEvent.touches[0];g.which=1;e.LastX=g.pageX=l.pageX;e.LastY=g.pageY=l.pageY;e.SendMouseMsg(e.KeyAction.NONE,g)}else{var k=e.GetPositionOfControl(Canvas.canvas);for(var h in g.originalEvent.changedTouches){if(!g.originalEvent.changedTouches[h].identifier){continue}var j=g.originalEvent.changedTouches[h].identifier%256;if(e.TouchArray[j]){e.TouchArray[j].x=(g.originalEvent.touches[h].pageX-k[0])*(e.Canvas.canvas.width/e.CanvasId.clientWidth);e.TouchArray[j].y=(g.originalEvent.touches[h].pageY-k[1])*(e.Canvas.canvas.height/e.CanvasId.clientHeight)}}}};e.xxTouchEnd=function(g){if(e.State!=3){return}if(g.preventDefault){g.preventDefault()}if(e.touchenabled==0||e.touchenabled==1){if(g.originalEvent.touches.length>1){return}g.which=1;g.pageX=LastX;g.pageY=LastY;e.SendMouseMsg(KeyAction.UP,g)}else{for(var h in g.originalEvent.changedTouches){if(!g.originalEvent.changedTouches[h].identifier){continue}var j=g.originalEvent.changedTouches[h].identifier%256;if(e.TouchArray[j]){e.TouchArray[j].f=2}}}};e.GrabMouseInput=function(){if(e.xxMouseInputGrab==true){return}var g=e.CanvasId;g.onmousemove=e.xxMouseMove;g.onmouseup=e.xxMouseUp;g.onmousedown=e.xxMouseDown;g.touchstart=e.xxTouchStart;g.touchmove=e.xxTouchMove;g.touchend=e.xxTouchEnd;g.MSPointerDown=e.xxMsTouchEvent;g.MSPointerMove=e.xxMsTouchEvent;g.MSPointerUp=e.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){g.DOMMouseScroll=e.xxDOMMouseScroll}else{g.onmousewheel=e.xxMouseWheel}e.xxMouseInputGrab=true};e.UnGrabMouseInput=function(){if(e.xxMouseInputGrab==false){return}var g=e.CanvasId;g.onmousemove=null;g.onmouseup=null;g.onmousedown=null;g.touchstart=null;g.touchmove=null;g.touchend=null;g.MSPointerDown=null;g.MSPointerMove=null;g.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){g.DOMMouseScroll=null}else{g.onmousewheel=null}e.xxMouseInputGrab=false};e.GrabKeyInput=function(){if(e.xxKeyInputGrab==true){return}document.onkeyup=e.xxKeyUp;document.onkeydown=e.xxKeyDown;document.onkeypress=e.xxKeyPress;e.xxKeyInputGrab=true};e.UnGrabKeyInput=function(){if(e.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;e.xxKeyInputGrab=false};e.GetPositionOfControl=function(g){var h=Array(2);h[0]=h[1]=0;while(g){h[0]+=g.offsetLeft;h[1]+=g.offsetTop;g=g.offsetParent}return h};e.crotX=function(g,h){if(e.rotation==0){return g}if(e.rotation==1){return h}if(e.rotation==2){return e.Canvas.canvas.width-g}if(e.rotation==3){return e.Canvas.canvas.height-h}};e.crotY=function(g,h){if(e.rotation==0){return h}if(e.rotation==1){return e.Canvas.canvas.width-g}if(e.rotation==2){return e.Canvas.canvas.height-h}if(e.rotation==3){return g}};e.rotX=function(g,h){if(e.rotation==0||e.rotation==1){return g}if(e.rotation==2){return g-e.Canvas.canvas.width}if(e.rotation==3){return g-e.Canvas.canvas.height}};e.rotY=function(g,h){if(e.rotation==0||e.rotation==3){return h}if(e.rotation==1){return h-e.Canvas.canvas.width}if(e.rotation==2){return h-e.Canvas.canvas.height}};e.tcanvas=null;e.setRotation=function(l){while(l<0){l+=4}var g=l%4;if(g==e.rotation){return true}var j=e.Canvas.canvas.width;var h=e.Canvas.canvas.height;if(e.rotation==1||e.rotation==3){j=e.Canvas.canvas.height;h=e.Canvas.canvas.width}if(e.tcanvas==null){e.tcanvas=document.createElement("canvas")}var k=e.tcanvas.getContext("2d");k.setTransform(1,0,0,1,0,0);k.canvas.width=j;k.canvas.height=h;k.rotate((e.rotation*-90)*Math.PI/180);if(e.rotation==0){k.drawImage(e.Canvas.canvas,0,0)}if(e.rotation==1){k.drawImage(e.Canvas.canvas,-e.Canvas.canvas.width,0)}if(e.rotation==2){k.drawImage(e.Canvas.canvas,-e.Canvas.canvas.width,-e.Canvas.canvas.height)}if(e.rotation==3){k.drawImage(e.Canvas.canvas,0,-e.Canvas.canvas.height)}if(e.rotation==0||e.rotation==2){e.Canvas.canvas.height=j;e.Canvas.canvas.width=h}if(e.rotation==1||e.rotation==3){e.Canvas.canvas.height=h;e.Canvas.canvas.width=j}e.Canvas.setTransform(1,0,0,1,0,0);e.Canvas.rotate((g*90)*Math.PI/180);e.rotation=g;e.Canvas.drawImage(e.tcanvas,e.rotX(0,0),e.rotY(0,0));e.ScreenWidth=e.Canvas.canvas.width;e.ScreenHeight=e.Canvas.canvas.height;if(e.onScreenSizeChange!=null){e.onScreenSizeChange(e,e.ScreenWidth,e.ScreenHeight,e.CanvasId)}return true};e.MuchTheSame=function(g,h){return(Math.abs(g-h)<4)};e.Debug=function(g){console.log(g)};e.getIEVersion=function(){var g=-1;if(navigator.appName=="Microsoft Internet Explorer"){var j=navigator.userAgent;var h=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(h.exec(j)!=null){g=parseFloat(RegExp.$1)}}return g};e.haltEvent=function(g){if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false};return e};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,B,t,A,y,z,w,C,x){r.wsman.ExecSubscribe(r.CompleteName(v),u,B,function(F,E,D,G){q();t(r,v,D,G,A)},0,y,z,w,C,x);q()};r.UnSubscribe=function(u,t,x,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,x)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(z,y,x,A){q();t(r,u,x,A,w)},0,v);q()};r.Put=function(u,w,t,y,v,x){r.wsman.ExecPut(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v,x);q()};r.Create=function(u,w,t,x,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Delete=function(u,w,t,x,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Exec=function(w,v,t,u,z,x,y){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.ExecWithXml=function(w,v,t,u,z,x,y){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(A,y,x,B,z){q();d(u,x,t,y,B,z)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,x,t,y,z,A,w){if(z!=200){t(r,v,null,z,A);c(1);return}if(x==null||x.Header.Method!="EnumerateResponse"||!x.Body.EnumerationContext){t(r,v,null,603,A);c(1);return}var u=x.Body.EnumerationContext;r.wsman.ExecPull(y,u,function(D,C,B,E){b(v,B,t,C,[],E,A,w)})}function b(y,A,t,B,w,C,D,z){if(C!=200){t(r,y,null,C,D);c(1);return}if(A==null||A.Header.Method!="PullResponse"){t(r,y,null,604,D);c(1);return}for(var v in A.Body.Items){if(A.Body.Items[v] instanceof Array){for(var x in A.Body.Items[v]){w.push(A.Body.Items[v][x])}}else{w.push(A.Body.Items[v])}}if(A.Body.EnumerationContext){var u=A.Body.EnumerationContext;r.wsman.ExecPull(B,u,function(G,F,E,H){b(y,E,t,F,w,H,D,1)})}else{c(1);t(r,y,w,C,D);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,y,v,x){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,y,{},v,x);q()};function a(t,y,u,B,A,v,z){r.PendingBatchOperations-=2;var x=y.shift(),w=r.Enum;if(x[0]=="*"){w=r.Get;x=x.substring(1)}w(x,function(E,C,D,F,G){G[2][C]={response:(D==null?null:D.Body),responses:D,status:F};if(G[1].length==0||F==401||(v!=true&&F!=200&&F!=400)){r.PendingBatchOperations-=(y.length*2);q();u(r,t,G[2],F,B)}else{q();a(t,y,u,B,G[2],z)}},[t,y,A],z);q()}r.BatchGet=function(t,v,u,x,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:x,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,x){f(t,u,x)},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(y,x,w,u,t,v,B,z,A){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v,B,z,A)};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(y,x,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:y,NewState:x,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(x,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:x,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,x,t,y,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:x,AccessPermission:t,Realms:y},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(x,w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:x,DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},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,y,A,u,w,B,z,x,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:y,Port:A,AuthMethod:u,Certificate:w,Username:B,Password:z,CN:x},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,x,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:x,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,y,v,x){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,y,v,x)};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,x,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:x},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(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:x,WiFiEndpointSettingsInput:y,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,x,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:x},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(x,y,w,u,z,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:x,NetworkAdminPassword:y,McNonce:w,Certificate:u,SigningAlgorithm:z,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,x,v,y,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:x,McNonce:v,SigningAlgorithm:y,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,x){if(w!=200||u.Body.ReturnValue!="0"){x[0](r,null,x[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,x)}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(e,a){var f={};f.m=e;e.parent=f;f.authCookie=a;f.State=0;f.socket=null;f.host=null;f.port=0;f.user=null;f.pass=null;f.authuri="/RedirectionService";f.tlsv1only=0;f.inDataCount=0;f.connectstate=0;f.protocol=e.protocol;f.debugmode=0;f.amtaccumulator="";f.amtsequence=1;f.amtkeepalivetimer=null;f.onStateChanged=null;f.Start=function(g,j,m,h,k){f.host=g;f.port=j;f.user=m;f.pass=h;f.connectstate=0;f.inDataCount=0;var l=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+g+"&port="+j+"&tls="+k+((m=="*")?"&serverauth=1":"")+((typeof h==="undefined")?("&serverauth=1&user="+m):"");if((a!=null)&&(a!="")){l+="&auth="+a}f.socket=new WebSocket(l);f.socket.onopen=f.xxOnSocketConnected;f.socket.onmessage=f.xxOnMessage;f.socket.onclose=f.xxOnSocketClosed;f.xxStateChange(1)};f.xxOnSocketConnected=function(){if(f.debugmode==1){console.log("onSocketConnected")}f.xxStateChange(2);if(f.protocol==1){f.xxSend(f.RedirectStartSol)}if(f.protocol==2){f.xxSend(f.RedirectStartKvm)}if(f.protocol==3){f.xxSend(f.RedirectStartIder)}};var b=new FileReader();var d=false,c=[];if(b.readAsBinaryString){b.onload=function(g){f.xxOnSocketData(g.target.result);if(c.length==0){d=false}else{b.readAsBinaryString(new Blob([c.shift()]))}}}else{if(b.readAsArrayBuffer){b.onloadend=function(g){f.xxOnSocketData(g.target.result);if(c.length==0){d=false}else{b.readAsArrayBuffer(c.shift())}}}}f.xxOnMessage=function(j){f.inDataCount++;if(typeof j.data=="object"){if(d==true){c.push(j.data);return}if(b.readAsBinaryString){d=true;b.readAsBinaryString(new Blob([j.data]))}else{if(b.readAsArrayBuffer){d=true;b.readAsArrayBuffer(j.data)}else{var g="",h=new Uint8Array(j.data),l=h.byteLength;for(var k=0;k<l;k++){g+=String.fromCharCode(h[k])}f.xxOnSocketData(g)}}}else{f.xxOnSocketData(j.data)}};f.xxOnSocketData=function(s){if(!s||f.connectstate==-1){return}if(typeof s==="object"){var l="";var n=new Uint8Array(s);var x=n.byteLength;for(var w=0;w<x;w++){l+=String.fromCharCode(n[w])}s=l}else{if(typeof s!=="string"){return}}if((f.protocol==2||f.protocol==3)&&f.connectstate==1){return f.m.ProcessData(s)}f.amtaccumulator+=s;while(f.amtaccumulator.length>=1){var o=0;switch(f.amtaccumulator.charCodeAt(0)){case 17:if(f.amtaccumulator.length<4){return}var K=f.amtaccumulator.charCodeAt(1);switch(K){case 0:if(f.amtaccumulator.length<13){return}var B=f.amtaccumulator.charCodeAt(12);if(f.amtaccumulator.length<13+B){return}f.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));o=(13+B);break;default:f.Stop(1);break}break;case 20:if(f.amtaccumulator.length<9){return}var j=ReadIntX(f.amtaccumulator,5);if(f.amtaccumulator.length<9+j){return}var J=f.amtaccumulator.charCodeAt(1);var k=f.amtaccumulator.charCodeAt(4);var g=[];for(w=0;w<j;w++){g.push(f.amtaccumulator.charCodeAt(9+w))}var h=f.amtaccumulator.substring(9,9+j);o=9+j;if(k==0){if(g.indexOf(4)>=0){f.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(f.user.length+f.authuri.length+8)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(0,0)+String.fromCharCode(f.authuri.length)+f.authuri+String.fromCharCode(0,0,0,0))}else{if(g.indexOf(3)>=0){f.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(f.user.length+f.authuri.length+7)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(0,0)+String.fromCharCode(f.authuri.length)+f.authuri+String.fromCharCode(0,0,0))}else{if(g.indexOf(1)>=0){f.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(f.user.length+f.pass.length+2)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(f.pass.length)+f.pass)}else{f.Stop(2)}}}}else{if((k==3||k==4)&&J==1){var r=0;var F=h.charCodeAt(r);var E=h.substring(r+1,r+1+F);r+=(F+1);var A=h.charCodeAt(r);var z=h.substring(r+1,r+1+A);r+=(A+1);var D=0;var C=null;var p=f.xxRandomNonce(32);var I="00000002";var u="";if(k==4){D=h.charCodeAt(r);C=h.substring(r+1,r+1+D);r+=(D+1);u=I+":"+p+":"+C+":"}var t=hex_md5(hex_md5(f.user+":"+E+":"+f.pass)+":"+z+":"+u+hex_md5("POST:"+f.authuri));var L=f.user.length+E.length+z.length+f.authuri.length+p.length+I.length+t.length+7;if(k==4){L+=(C.length+1)}var m=String.fromCharCode(19,0,0,0,k)+IntToStrX(L)+String.fromCharCode(f.user.length)+f.user+String.fromCharCode(E.length)+E+String.fromCharCode(z.length)+z+String.fromCharCode(f.authuri.length)+f.authuri+String.fromCharCode(p.length)+p+String.fromCharCode(I.length)+I+String.fromCharCode(t.length)+t;if(k==4){m+=(String.fromCharCode(C.length)+C)}f.xxSend(m)}else{if(J==0){if(f.protocol==1){var y=10000;var N=100;var M=0;var H=10000;var G=100;var v=0;f.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(f.amtsequence++)+ShortToStrX(y)+ShortToStrX(N)+ShortToStrX(M)+ShortToStrX(H)+ShortToStrX(G)+ShortToStrX(v)+IntToStrX(0))}if(f.protocol==2){f.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(f.protocol==3){f.connectstate=1;f.xxStateChange(3)}}else{f.Stop(3)}}}break;case 33:if(f.amtaccumulator.length<23){break}o=23;f.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(f.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(f.protocol==1){f.amtkeepalivetimer=setInterval(f.xxSendAmtKeepAlive,2000)}f.connectstate=1;f.xxStateChange(3);break;case 41:if(f.amtaccumulator.length<10){break}o=10;break;case 42:if(f.amtaccumulator.length<10){break}var q=(10+((f.amtaccumulator.charCodeAt(9)&255)<<8)+(f.amtaccumulator.charCodeAt(8)&255));if(f.amtaccumulator.length<q){break}f.m.ProcessData(f.amtaccumulator.substring(10,q));o=q;break;case 43:if(f.amtaccumulator.length<8){break}o=8;break;case 65:if(f.amtaccumulator.length<8){break}f.connectstate=1;f.m.Start();if(f.amtaccumulator.length>8){f.m.ProcessData(f.amtaccumulator.substring(8))}o=f.amtaccumulator.length;break;case 240:f.serverIsRecording=true;o=1;break;default:console.log("Unknown Intel AMT command: "+f.amtaccumulator.charCodeAt(0)+" acclen="+f.amtaccumulator.length);f.Stop(4);return}if(o==0){return}f.amtaccumulator=f.amtaccumulator.substring(o)}};f.xxSend=function(k){if(f.socket!=null&&f.socket.readyState==WebSocket.OPEN){if(f.debugmode==1){console.log("Send",k)}var g=new Uint8Array(k.length);for(var j=0;j<k.length;++j){g[j]=k.charCodeAt(j)}try{f.socket.send(g.buffer)}catch(h){}}};f.send=function(g){if(f.socket==null||f.connectstate!=1){return}if(f.protocol==1){f.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(f.amtsequence++)+ShortToStrX(g.length)+g)}else{f.xxSend(g)}};f.xxSendAmtKeepAlive=function(){if(f.socket==null){return}f.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(f.amtsequence++))};f.xxRandomNonceX="abcdef0123456789";f.xxRandomNonce=function(h){var j="";for(var g=0;g<h;g++){j+=f.xxRandomNonceX.charAt(Math.floor(Math.random()*f.xxRandomNonceX.length))}return j};f.xxOnSocketClosed=function(){if(f.debugmode==1){console.log("onSocketClosed")}if((f.inDataCount==0)&&(f.tlsv1only==0)){f.tlsv1only=1;f.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="+f.host+"&port="+f.port+"&tls="+f.tls+"&tls1only=1"+((f.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+f.user):""));f.socket.onopen=f.xxOnSocketConnected;f.socket.onmessage=f.xxOnMessage;f.socket.onclose=f.xxOnSocketClosed}else{f.Stop(5)}};f.xxStateChange=function(g){if(f.State==g){return}f.State=g;f.m.xxStateChange(f.State);if(f.onStateChanged!=null){f.onStateChanged(f,f.State)}};f.Stop=function(g){if(f.debugmode==1){console.log("onSocketStop",g)}f.xxStateChange(0);f.connectstate=-1;f.amtaccumulator="";if(f.socket!=null){f.socket.close();f.socket=null}if(f.amtkeepalivetimer!=null){clearInterval(f.amtkeepalivetimer);f.amtkeepalivetimer=null}};f.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);f.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);f.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return f};var CreateAmtRemoteDesktop=function(o,r){var q={};q.canvasid=o;q.CanvasId=Q(o);q.scrolldiv=r;q.canvas=Q(o).getContext("2d");q.protocol=2;q.state=0;q.acc="";q.ScreenWidth=960;q.ScreenHeight=700;q.width=0;q.height=0;q.rwidth=0;q.rheight=0;q.bpp=2;q.useZRLE=true;q.showmouse=true;q.buttonmask=0;q.localKeyMap=true;q.spare=null;q.sparew=0;q.spareh=0;q.sparew2=0;q.spareh2=0;q.sparecache={};q.ZRLEfirst=1;q.onScreenSizeChange=null;q.frameRateDelay=0;q.kvmDataSupported=false;q.onKvmData=null;q.onKvmDataPending=[];q.onKvmDataAck=-1;q.holding=false;q.lastKeepAlive=Date.now();q.mNagleTimer=null;q.mx=0;q.my=0;q.Debug=function(s){console.log(s)};q.xxStateChange=function(s){if(s==0){q.canvas.fillStyle="#000000";q.canvas.fillRect(0,0,q.width,q.height);q.canvas.canvas.width=q.rwidth=q.width=640;q.canvas.canvas.height=q.rheight=q.height=400;QS(q.canvasid).cursor="default"}else{QS(q.canvasid).cursor=q.showmouse?"default":"none"}};q.ProcessData=function(v){if(!v){return}q.acc+=v;while(q.acc.length>0){var t=0;if(q.state==0&&q.acc.length>=12){t=12;q.state=1;q.send("RFB 003.008\n")}else{if(q.state==1&&q.acc.length>=1){t=q.acc.charCodeAt(0)+1;q.send(String.fromCharCode(1));q.state=2}else{if(q.state==2&&q.acc.length>=4){t=4;if(ReadInt(q.acc,0)!=0){return q.Stop()}q.send(String.fromCharCode(1));q.state=3}else{if(q.state==3&&q.acc.length>=24){var G=ReadInt(q.acc,20);if(q.acc.length<24+G){return}t=24+G;q.canvas.canvas.width=q.rwidth=q.width=q.ScreenWidth=ReadShort(q.acc,0);q.canvas.canvas.height=q.rheight=q.height=q.ScreenHeight=ReadShort(q.acc,2);var J="";if(q.useZRLE){J+=IntToStr(16)}J+=IntToStr(0);J+=IntToStr(1092);q.send(String.fromCharCode(2,0)+ShortToStr((J.length/4)+1)+J+IntToStr(-223));if(q.bpp==1){q.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))}q.state=4;if(q.parent){q.parent.xxStateChange(3)}g();if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}else{if(q.state==4){switch(q.acc.charCodeAt(0)){case 0:if(q.acc.length<4){return}q.state=100+ReadShort(q.acc,2);t=4;break;case 2:t=1;break;case 3:if(q.acc.length<8){return}var F=ReadInt(q.acc,4)+8;if(q.acc.length<F){return}t=p(q.acc);break}}else{if(q.state>100&&q.acc.length>=12){var L=ReadShort(q.acc,0),N=ReadShort(q.acc,2),K=ReadShort(q.acc,4),C=ReadShort(q.acc,6),I=K*C,B=ReadInt(q.acc,8);if(B<17){if(K<1||K>64||C<1||C>64){console.log("Invalid tile size ("+K+","+C+"), disconnecting.");return q.Stop()}if(q.sparew!=K||q.spareh!=C){q.sparew=q.sparew2=K;q.spareh=q.spareh2=C;var M=q.sparew2+"x"+q.spareh2;q.spare=q.sparecache[M];if(!q.spare){q.sparecache[M]=q.spare=q.canvas.createImageData(q.sparew2,q.spareh2);var E=(q.sparew2*q.spareh2)<<2;for(var D=3;D<E;D+=4){q.spare.data[D]=255}}}}if(B==4294967073){q.canvas.canvas.width=q.rwidth=q.width=K;q.canvas.canvas.height=q.rheight=q.height=C;q.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(q.width)+ShortToStr(q.height));t=12;if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}else{if(B==0){var H=12,u=12+(I*q.bpp);if(q.acc.length<u){return}t=u;if(q.bpp==2){for(var D=0;D<I;D++){h(q.acc.charCodeAt(H++)+(q.acc.charCodeAt(H++)<<8),D)}}else{for(var D=0;D<I;D++){k(q.acc.charCodeAt(H++),D)}}f(q.spare,L,N)}else{if(B==16){if(q.acc.length<16){return}var w=ReadInt(q.acc,12);if(q.acc.length<(16+w)){return}var H=16,z=5,A=0;if(w>5&&q.acc.charCodeAt(H)==0&&ReadShortX(q.acc,H+1)==(w-z)){a(q.acc,H+5,L,N,K,C,I,w)}t=16+w}else{q.Debug("Unknown Encoding: "+B);return q.Stop()}}}if(--q.state==100){q.state=4;if(q.frameRateDelay==0){g()}else{setTimeout(g,q.frameRateDelay)}}}}}}}}if(t==0){return}q.acc=q.acc.substring(t)}};function a(w,E,M,N,L,A,I,z){var J=w.charCodeAt(E++),C,K,H,D={},F=0,G=0,B;if(J==0){if(q.bpp==2){for(B=0;B<I;B++){h(w.charCodeAt(E++)+(w.charCodeAt(E++)<<8),B)}}else{for(B=0;B<I;B++){k(w.charCodeAt(E++),B)}}f(q.spare,M,N)}else{if(J==1){K=w.charCodeAt(E++)+((q.bpp==2)?(w.charCodeAt(E++)<<8):0);q.canvas.fillStyle="rgb("+((q.bpp==1)?((K&224)+","+((K&28)<<3)+","+b((K&3)<<6)):(((K>>8)&248)+","+((K>>3)&252)+","+((K&31)<<3)))+")";q.canvas.fillRect(M,N,L,A)}else{if(J>1&&J<17){var u=4,t=15;if(q.bpp==2){for(B=0;B<J;B++){D[B]=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8)}if(J==2){u=1;t=1}else{if(J<=4){u=2;t=3}}while(F<I&&E<w.length){K=w.charCodeAt(E++);for(B=(8-u);B>=0;B-=u){h(D[(K>>B)&t],F++)}}}else{for(B=0;B<J;B++){D[B]=w.charCodeAt(E++)}if(J==2){u=1;t=1}else{if(J<=4){u=2;t=3}}while(F<I&&E<w.length){K=w.charCodeAt(E++);for(B=(8-u);B>=0;B-=u){k(D[(K>>B)&t],F++)}}}f(q.spare,M,N)}else{if(J==128){if(q.bpp==2){while(F<I&&E<w.length){K=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8);G=1;do{G+=(H=w.charCodeAt(E++))}while(H==255);if(q.rotation==0){j(K,F,G);F+=G}else{while(--G>=0){h(K,F++)}}}}else{while(F<I&&E<w.length){K=w.charCodeAt(E++);G=1;do{G+=(H=w.charCodeAt(E++))}while(H==255);if(q.rotation==0){l(K,F,G);F+=G}else{while(--G>=0){k(K,F++)}}}}f(q.spare,M,N)}else{if(J>129){if(q.bpp==2){for(B=0;B<(J-128);B++){D[B]=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8)}}else{for(B=0;B<(J-128);B++){D[B]=w.charCodeAt(E++)}}while(F<I&&E<w.length){G=1;C=w.charCodeAt(E++);K=D[C%128];if(C>127){do{G+=(H=w.charCodeAt(E++))}while(H==255)}if(q.rotation==0){if(q.bpp==2){j(K,F,G);F+=G}else{l(K,F,G);F+=G}}else{if(q.bpp==2){while(--G>=0){h(K,F++)}}else{while(--G>=0){k(K,F++)}}}}f(q.spare,M,N)}}}}}}q.hold=function(s){if(q.holding==s){return}q.holding=s;q.canvas.fillStyle="#000000";q.canvas.fillRect(0,0,q.width,q.height);if(q.holding==false){if((q.canvas.canvas.width!=q.width)||(q.canvas.canvas.height!=q.height)){q.canvas.canvas.width=q.width;q.canvas.canvas.height=q.height;if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}q.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(q.width)+ShortToStr(q.height))}else{q.UnGrabMouseInput();q.UnGrabKeyInput()}};function f(s,t,u){if(q.holding==true){return}q.canvas.putImageData(s,t,u)}function k(u,s){var t=s<<2;q.spare.data[t]=u&224;q.spare.data[t+1]=(u&28)<<3;q.spare.data[t+2]=b((u&3)<<6)}function h(u,s){var t=s<<2;q.spare.data[t]=(u>>8)&248;q.spare.data[t+1]=(u>>3)&252;q.spare.data[t+2]=(u&31)<<3}function l(z,u,y){var w=(u<<2),x=(z&224),t=((z&28)<<3),s=(b((z&3)<<6));while(--y>=0){q.spare.data[w]=x;q.spare.data[w+1]=t;q.spare.data[w+2]=s;w+=4}}function j(z,u,y){var w=(u<<2),x=((z>>8)&248),t=((z>>3)&252),s=((z&31)<<3);while(--y>=0){q.spare.data[w]=x;q.spare.data[w+1]=t;q.spare.data[w+2]=s;w+=4}}function b(s){return(s>127)?(s+32):s}function g(){if(q.holding==true){return}q.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(q.rwidth)+ShortToStr(q.rheight))}q.Start=function(){q.state=0;q.acc="";q.ZRLEfirst=1;q.onKvmDataPending=[];q.onKvmDataAck=-1;q.kvmDataSupported=false;for(var s in q.sparecache){delete q.sparecache[s]}};q.Stop=function(){q.UnGrabMouseInput();q.UnGrabKeyInput();if(q.parent){q.parent.Stop()}};q.send=function(s){if(q.parent){q.parent.send(s)}};var n={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function m(s){if(s.code.startsWith("Key")&&s.code.length==4){return s.code.charCodeAt(3)+((s.shiftKey==false)?32:0)}if(s.code.startsWith("Digit")&&s.code.length==6){return s.code.charCodeAt(5)}if(s.code.startsWith("Numpad")&&s.code.length==7){return s.code.charCodeAt(6)}return n[s.code]}function c(s,t){if(!t){t=window.event}if(t.code&&(q.localKeyMap==false)){var u=m(t);if(u!=null){q.sendkey(u,s)}}else{var u=t.keyCode,v=u;if(t.shiftKey==false&&u>=65&&u<=90){v=u+32}if(u>=112&&u<=124){v=u+65358}if(u==8){v=65288}if(u==9){v=65289}if(u==13){v=65293}if(u==16){v=65505}if(u==17){v=65507}if(u==18){v=65513}if(u==27){v=65307}if(u==33){v=65365}if(u==34){v=65366}if(u==35){v=65367}if(u==36){v=65360}if(u==37){v=65361}if(u==38){v=65362}if(u==39){v=65363}if(u==40){v=65364}if(u==45){v=65379}if(u==46){v=65535}if(u>=96&&u<=105){v=u-48}if(u==106){v=42}if(u==107){v=43}if(u==109){v=45}if(u==110){v=46}if(u==111){v=47}if(u==186){v=59}if(u==187){v=61}if(u==188){v=44}if(u==189){v=45}if(u==190){v=46}if(u==191){v=47}if(u==192){v=96}if(u==219){v=91}if(u==220){v=92}if(u==221){v=93}if(u==222){v=39}q.sendkey(v,s)}return q.haltEvent(t)}q.sendkey=function(v,t){if(typeof v=="object"){var s="";for(var u in v){s+=(String.fromCharCode(4,v[u][1],0,0)+IntToStr(v[u][0]))}q.send(s)}else{q.send(String.fromCharCode(4,t,0,0)+IntToStr(v))}};function p(s){if(s.length<8){return 0}var u=ReadInt(q.acc,4)+8;if(s.length<u){return 0}if(q.onKvmData!=null){var t=s.substring(8,u);if((t.length>=16)&&(t.substring(0,15)=="\0KvmDataChannel")){if(q.kvmDataSupported==false){q.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((q.onKvmDataAck==-1)&&(t.length==16))||(t.charCodeAt(15)!=0)){q.onKvmDataAck=true}if(t.length>=16){q.onKvmData(t.substring(16))}if((q.onKvmDataAck==true)&&(q.onKvmDataPending.length>0)){q.sendKvmData(q.onKvmDataPending.shift())}}}return u}q.sendKvmData=function(s){if(q.onKvmDataAck!==true){q.onKvmDataPending.push(s)}else{s="\0KvmDataChannel\0"+s;q.send(String.fromCharCode(6,0,0,0)+IntToStr(s.length)+s);q.onKvmDataAck=false}};q.sendKeepAlive=function(){if(q.lastKeepAlive<Date.now()-5000){q.lastKeepAlive=Date.now();q.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\0KvmDataChannel\0")}};q.SendCtrlAltDelMsg=function(){q.sendcad()};q.sendcad=function(){q.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;q.GrabMouseInput=function(){if(e==true){return}var s=q.canvas.canvas;s.onmouseup=q.mouseup;s.onmousedown=q.mousedown;s.onmousemove=q.mousemove;e=true};q.UnGrabMouseInput=function(){if(e==false){return}var s=q.canvas.canvas;s.onmousemove=null;s.onmouseup=null;s.onmousedown=null;e=false};q.GrabKeyInput=function(){if(d==true){return}document.onkeyup=q.handleKeyUp;document.onkeydown=q.handleKeyDown;document.onkeypress=q.handleKeys;d=true};q.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};q.handleKeys=function(s){return q.haltEvent(s)};q.handleKeyUp=function(s){return c(0,s)};q.handleKeyDown=function(s){return c(1,s)};q.haltEvent=function(s){if(s.preventDefault){s.preventDefault()}if(s.stopPropagation){s.stopPropagation()}return false};q.mousedblclick=function(s){};q.mousedown=function(s){q.buttonmask|=(1<<s.button);return q.mousemove(s,1)};q.mouseup=function(s){q.buttonmask&=(65535-(1<<s.button));return q.mousemove(s,1)};q.mousemove=function(s,t){if(q.state<4){return true}var v=(q.canvas.canvas.height/Q(q.canvasid).offsetHeight);var w=(q.canvas.canvas.width/Q(q.canvasid).offsetWidth);var u=q.getPositionOfControl(Q(q.canvasid));q.mx=((event.pageX-u[0])*w);q.my=((event.pageY-u[1])*v);if(event.addx){q.mx+=event.addx}if(event.addy){q.my+=event.addy}if(t==1){q.send(String.fromCharCode(5,q.buttonmask)+ShortToStr(q.mx)+ShortToStr(q.my));if(q.mNagleTimer!=null){clearTimeout(q.mNagleTimer);q.mNagleTimer=null}}else{if(q.mNagleTimer==null){q.mNagleTimer=setTimeout(function(){q.send(String.fromCharCode(5,q.buttonmask)+ShortToStr(q.mx)+ShortToStr(q.my));q.mNagleTimer=null},50)}}return q.haltEvent(s)};q.getPositionOfControl=function(s){var t=Array(2);t[0]=t[1]=0;while(s){t[0]+=s.offsetLeft;t[1]+=s.offsetTop;s=s.offsetParent}return t};return q};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 F=0;var C=1;var al=2;var ae=3;var z=4;var A=5;var ab=6;var h=7;var E=8;var p=9;var o=10;var am=11;var an=12;var ai=13;var k=14;var j=15;var ak=16;var V=17;var f=18;var R=19;var P=20;var S=21;var q=22;var r=23;var Z=24;var X=25;var d=26;var U=27;var u=28;var a=29;var aa=30;var aj=31;var y=852;var x=592;var w=(y+x);var g=0;var W=1;var t=2;var M=[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 N=[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 K=[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 L=[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 J(aQ,aU){var aL=15;var aT=aQ.next;var ar=(aU==t?aQ.distbits:aQ.lenbits);var aW=aQ.work;var aG=aQ.lens;var aH=(aU==t?aQ.nlen:0);var aR=aQ.codes;var at;if(aU==W){at=aQ.nlen}else{if(aU==t){at=aQ.ndist}else{at=19}}var aF;var aS;var aM,aK;var aP;var av;var aw;var aE;var aV;var aC;var aD;var aA;var aI;var aJ;var aB;var aN;var ap;var aq;var ay;var az;var ax;var au=new Array(aL+1);var aO=new Array(aL+1);for(aF=0;aF<=aL;aF++){au[aF]=0}for(aS=0;aS<at;aS++){au[aG[aH+aS]]++}aP=ar;for(aK=aL;aK>=1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM<aK;aM++){if(au[aM]!=0){break}}if(aP<aM){aP=aM}aE=1;for(aF=1;aF<=aL;aF++){aE<<=1;aE-=au[aF];if(aE<0){return -1}}if(aE>0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF<aL;aF++){aO[aF+1]=aO[aF]+au[aF]}for(aS=0;aS<at;aS++){if(aG[aH+aS]!=0){aW[aO[aG[aH+aS]]++]=aS}}switch(aU){case g:ap=ay=aW;aq=0;az=0;ax=19;break;case W:ap=M;aq=-257;ay=N;az=-257;ax=256;break;default:ap=K;ay=L;aq=0;az=0;ax=-1}aC=0;aS=0;aF=aM;aN=aT;av=aP;aw=0;aI=-1;aV=1<<aP;aJ=aV-1;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS]<ax){aB.val=aW[aS]}else{if(aW[aS]>ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1<<av;aM=aA;do{aA-=aD;aR[aN+(aC>>>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1<<av);while(av+aw<aK){aE-=au[av+aw];if(aE<=0){break}av++;aE<<=1}aV+=1<<av;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1<<aL.lenbits)-1;av=(1<<aL.distbits)-1;loop:do{if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[aD+(aA&aG)];dolen:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}aE+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[at+(aA&av)];dodist:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}}au+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;aI=0;ay=-1;ax=aJ-au}}else{ay+=aP-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;ay=-1;ax=aJ-au}}}else{ay=-1;ax=aJ-au}if(ay>=0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1<<aI)-1)))];continue dodist}else{aM.msg="invalid distance code";aL.mode=a;break loop}}break dodist}}else{if((aI&64)==0){az=ar[aD+(az.val+(aA&((1<<aI)-1)))];continue dolen}else{if(aI&32){aL.mode=am;break loop}else{aM.msg="invalid literal/length code";aL.mode=a;break loop}}}}break dolen}}while(aH<aC&&aJ<aw);aE=aq>>>3;aH-=aE;aq-=aE<<3;aA&=(1<<aq)-1;aM.next_in=aH;aM.next_out=aJ;aM.avail_in=(aH<aC?5+(aC-aH):5-(aH-aC));aM.avail_out=(aJ<aw?257+(aw-aJ):257-(aJ-aw));aL.hold=aA;aL.bits=aq}function ad(ar){var aq;var ap=new Array(ar);for(aq=0;aq<ar;aq++){ap[aq]=0}return ap}function D(ar,aq,ap){return(ar&&(aq in ar))?ar[aq]:ap}function e(){return 0}function I(){var aq;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=ad(320);this.work=ad(288);this.codes=new Array(w);var ap={op:0,bits:0,val:0};for(aq=0;aq<w;aq++){this.codes[aq]=ap}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;aq.total_in=aq.total_out=ap.total=0;aq.msg=null;if(ap.wrap){aq.adler=ap.wrap&1}ap.mode=F;ap.last=0;ap.havedict=0;ap.dmax=32768;ap.head=null;ap.hold=0;ap.bits=0;ap.lencode=0;ap.distcode=0;ap.next=0;ap.sane=1;ap.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(aq,ar){var at;var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;if(typeof ar==="undefined"){ar=n}if(ar<0){at=0;ar=-ar}else{at=(ar>>>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1<<ap)-1;aq.hold+=at<<aq.bits;aq.bits+=ap;return ZLIB.Z_OK};var T=null;var s=null;function B(aq){var ap;if(!T){T=[{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}]}aq.lencode=0;aq.distcode=512;for(ap=0;ap<512;ap++){aq.codes[ap]=T[ap]}for(ap=0;ap<32;ap++){aq.codes[ap+512]=s[ap]}aq.lenbits=9;aq.distbits=5}function ao(ar){var aq=ar.state;var ap=ar.output_data.length;if(aq.window===null){aq.window=""}if(aq.wsize==0){aq.wsize=1<<aq.wbits}if(ap>=aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap<aq.wsize){aq.window+=ar.output_data}else{aq.window=aq.window.substring(aq.whave-(aq.wsize-ap))+ar.output_data}}aq.whave=aq.window.length;if(aq.whave<aq.wsize){aq.wnext=aq.whave}else{aq.wnext=0}return 0}function l(aq,ar){var ap=[ar&255,(ar>>>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)<<ap.bits;ap.bits+=8;return true}function ac(aq,ap){while(aq.bits<ap){if(!af(aq)){return false}}return true}function b(aq,ap){return aq.hold&((1<<ap)-1)}function v(aq,ap){aq.hold>>>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1<<ax;aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=aA.hold&512?p:am;O(aA);break;case C:if(!ac(aA,16)){break inf_leave}aB.flags=aA.hold;if((aB.flags&255)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}if(aB.flags&57344){aC.msg="unknown header flags set";aB.mode=a;break}if(aB.head!==null){aB.head.text=(aA.hold>>>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.name_max){aB.head.name+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.name=null}}aB.length=0;aB.mode=h;case h:if(aB.flags&4096){if(aA.have==0){break inf_leave}aq=0;if(aB.head!==null&&aB.head.comment===null){aB.head.comment=""}do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.comm_max){aB.head.comment+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.comment=null}}aB.mode=E;case E:if(aB.flags&512){if(!ac(aA,16)){break inf_leave}if(aA.hold!=(aB.check&65535)){aC.msg="header crc mismatch";aB.mode=a;break}O(aA)}if(aB.head!==null){aB.head.hcrc=(aB.flags>>>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have<aB.ncode){if(!ac(aA,3)){break inf_leave}var aD=b(aA,3);aB.lens[H[aB.have++]]=aD;v(aA,3)}while(aB.have<19){aB.lens[H[aB.have++]]=0}aB.next=0;aB.lencode=0;aB.lenbits=7;az=J(aB,g);if(az){aC.msg="invalid code lengths set";aB.mode=a;break}aB.have=0;aB.mode=f;case f:while(aB.have<aB.nlen+aB.ndist){for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.val<16){v(aA,av.bits);aB.lens[aB.have++]=av.val}else{if(av.val==16){if(!ac(aA,av.bits+2)){break inf_leave}v(aA,av.bits);if(aB.have==0){aC.msg="invalid bit length repeat";aB.mode=a;break}ax=aB.lens[aB.have-1];aq=3+b(aA,2);v(aA,2)}else{if(av.val==17){if(!ac(aA,av.bits+3)){break inf_leave}v(aA,av.bits);ax=0;aq=3+b(aA,3);v(aA,3)}else{if(!ac(aA,av.bits+7)){break inf_leave}v(aA,av.bits);ax=0;aq=11+b(aA,7);v(aA,7)}}if(aB.have+aq>aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode<a&&(aB.mode<d||ar!=ZLIB.Z_FINISH))){if(ao(aC)){aB.mode=aa;return ZLIB.Z_MEM_ERROR}}ap-=aC.avail_in;ay-=aC.avail_out;aC.total_in+=ap;aC.total_out+=ay;aB.total+=ay;if(aB.wrap&&ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,0,aC.output_data.length)}aC.data_type=aB.bits+(aB.last?64:0)+(aB.mode==am?128:0)+(aB.mode==R||aB.mode==k?256:0);if(((ap==0&&ay==0)||ar==ZLIB.Z_FINISH)&&az==ZLIB.Z_OK){az=ZLIB.Z_BUF_ERROR}return az};ZLIB.inflateEnd=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;ap.window=null;aq.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(at,au){var ar;var ap;var aq=16384;this.input_data=at;this.next_in=D(au,"next_in",0);this.avail_in=D(au,"avail_in",at.length-this.next_in);ar=D(au,"flush",ZLIB.Z_SYNC_FLUSH);ap=D(au,"avail_out",-1);var av="";do{this.avail_out=(ap>=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());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 webState="{{{webstate}}}";if(webState!=""){webState=JSON.parse(decodeURIComponent(webState))}for(var i in webState){localStorage.setItem(i,webState[i])}if(!webState.loctag){delete localStorage.removeItem("loctag")}var args=parseUriArgs();var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var authCookie="{{{authCookie}}}";var authRelayCookie="{{{authRelayCookie}}}";var authCookieRenewTimer=null;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® AMT Connected"];var files;var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}var sessionActivity=Date.now();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}}if(!args.locale){var d=getstore("loctag",0);if((d!=null)&&(d!="*")){args.locale=d}}window.onresize=center;center();QV("changeEmailId",(features&2097152)==0);QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl(domainUrl,authCookie);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(c,d,b,a){if(d==0){setDialogMode(0);go(0);if(a=="noauth"){QH("p0span","Unable to perform authentication");return}if(b==2){setTimeout(serverPoll,5000)}else{QH("p0span","Unable to connect web socket")}if(authCookieRenewTimer!=null){clearInterval(authCookieRenewTimer);authCookieRenewTimer=null}}else{if(d==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}authCookieRenewTimer=setInterval(function(){meshserver.send({action:"authcookie"})},1800000)}}QV("topMenuIcon",d==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 updateSelf(){QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("manageAuthApp",features&4096);QV("manageOtp",((features&4096)!=0)&&((userinfo.otpsecret==1)||(userinfo.otphkeys>0)));QV("p3createMeshLink1",false);QV("p3createMeshLink2",false);if(typeof userinfo.passchange=="number"){if(userinfo.passchange==-1){QH("p2nextPasswordUpdateTime"," - Reset on next login.")}else{if((passRequirements!=null)&&(typeof passRequirements.reset=="number")){var a=(userinfo.passchange)+(passRequirements.reset*86400)-Math.floor(Date.now()/1000);if(a<0){QH("p2nextPasswordUpdateTime"," - Reset on next login.")}else{if(a<3600){QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/60)+" minute"+addLetterS(Math.floor(a/60))+".")}else{if(a<86400){QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/3600)+" hour"+addLetterS(Math.floor(a/3600))+".")}else{QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/86400)+" day"+addLetterS(Math.floor(a/86400))+".")}}}}}}}function addLetterS(a){return(a>1)?"s":""}function setSessionActivity(){sessionActivity=Date.now()}function checkIdleSessionTimeout(){var a=(Date.now()-sessionActivity);if(a>serverinfo.timeout){window.location.href="logout"}}function onMessage(r,e){switch(e.action){case"serverinfo":serverinfo=e.serverinfo;if(serverinfo.timeout){setInterval(checkIdleSessionTimeout,10000);checkIdleSessionTimeout()}QV("p3AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("logoutMenuOption",((features&4)==0)&&(serverinfo.domainauth==false));break;case"authcookie":authCookie=e.cookie;authRelayCookie=e.rcookie;break;case"userinfo":userinfo=e.userinfo;QH("p3userName",userinfo.name);updateSelf();break;case"users":users={};for(var d in e.users){users[e.users[d]._id]=e.users[d]}updateUsers();break;case"wssessioncount":wssessions=e.wssessions;updateUsers();break;case"meshes":meshes={};for(var d in e.meshes){meshes[e.meshes[d]._id]=e.meshes[d]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(e.filetree);updateFiles();break;case"nodes":nodes=[];for(var d in e.nodes){for(var f in e.nodes[d]){if(!meshes[d]){console.log("Invalid mesh (1): "+d);continue}e.nodes[d][f].namel=e.nodes[d][f].name.toLowerCase();if(e.nodes[d][f].rname){e.nodes[d][f].rnamel=e.nodes[d][f].rname.toLowerCase()}else{e.nodes[d][f].rnamel=e.nodes[d][f].namel}e.nodes[d][f].meshnamel=meshes[d].name.toLowerCase();e.nodes[d][f].meshid=d;e.nodes[d][f].state=(e.nodes[d][f].state)?(e.nodes[d][f].state):0;e.nodes[d][f].desc=e.nodes[d][f].desc;if(!e.nodes[d][f].icon){e.nodes[d][f].icon=1}e.nodes[d][f].ident=++nodeShortIdent;nodes.push(e.nodes[d][f])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(2)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(e.nodeid!=powerTimelineReq){break}powerTimelineNode=e.nodeid;powerTimeline=e.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==e.nodeid){drawDeviceTimeline()}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var q=e.secret;if(q.length==52){q=q.split(/(.............)/).filter(Boolean).join(" ")}else{if(q.length==32){q=q.split(/(....)/).filter(Boolean).join(" ");q=q.substring(0,20)+"<br/>"+q.substring(20)}}QH("d2optinfo",'Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application, use <a href="'+e.url+'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.<br /><br /><div style=width:100%;text-align:center><tt id=d2optsecret secret="'+e.secret+'" style=font-size:15px>'+q+'</tt><br /><br />Token: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></div>');QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,e.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,e.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"otpauth-getpasswords":if(xxdialogMode){return}var t="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";t+="<div style='border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px'><div style='padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold'><table style=width:100%;text-align:center>";if(e.passwords){var c=0;for(var a in e.passwords){if(++c%2){t+="<tr>"}var o=""+e.passwords[a].p;while(o.length<8){o="0"+o}if(e.passwords[a].u===true){t+="<td>"+o.substring(0,4)+" "+o.substring(4)}else{t+="<td><strike style=color:#BBB>"+o.substring(0,4)+" "+o.substring(4);+"</strike>"}}}else{t+="<tr><td>No Active Tokens"}t+="</table></div></div><br />";t+="<div><input type=button value='Close' onclick=setDialogMode(0) style=float:right></input>";t+="<input type=button value='New Tokens' onclick='account_manageOtp(1);'></input>";if(e.passwords!=null){t+="<input type=button value='Clear' onclick='account_manageOtp(2);'></input>"}t+="</div><br />";setDialogMode(2,"Manage Backup Codes",8,null,t,"otpauth-manage");break;case"event":if(e.event.noact){break}switch(e.event.action){case"userWebState":if(localStorage!=null){var s=JSON.parse(e.event.state);for(var a in s){localStorage.setItem(a,s[a])}if((s.loctag!=null)&&(s.loctag!=oldLoctag)){if(s.loctag!=null){args.locale=s.loctag}else{delete args.locale}updateDevices();updateMeshes()}}break;case"accountchange":if(userinfo.name==e.event.account.name){var h=e.event.account.siteadmin?e.event.account.siteadmin:0;var l=userinfo.siteadmin?userinfo.siteadmin:0;if((e.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((e.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=e.event.account;if(l!=h){updateSiteAdmin()}updateSelf()}break;case"createmesh":if(e.event.links[userinfo._id]!=null){meshes[e.event.meshid]={_id:e.event.meshid,name:e.event.name,mtype:e.event.mtype,desc:e.event.desc,links:e.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[e.event.meshid]==null){meshes[e.event.meshid]={_id:e.event.meshid,name:e.event.name,mtype:e.event.mtype,desc:e.event.desc,links:e.event.links};meshserver.send({action:"nodes"})}else{if(meshes[e.event.meshid].name!=e.event.name){meshes[e.event.meshid].name=e.event.name;for(var a in nodes){if(nodes[a].meshid==e.event.meshid){nodes[a].meshnamel=e.event.name.toLowerCase()}}}meshes[e.event.meshid].desc=e.event.desc;meshes[e.event.meshid].links=e.event.links;if(meshes[e.event.meshid].links[userinfo._id]==null){if((xxcurrentView==20)&&(currentMesh==meshes[e.event.meshid])){go(2)}delete meshes[e.event.meshid];var g=[];for(var a in nodes){if(nodes[a].meshid!=e.event.meshid){g.push(nodes[a])}}nodes=g;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==e.event.meshid){setDialogMode(0);go(2)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&¤tMesh._id==e.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[e.event.meshid]){delete meshes[e.event.meshid];updateMeshes();meshserver.send({action:"files"})}var g=[];for(var a in nodes){if(nodes[a].meshid!=e.event.meshid){g.push(nodes[a])}}nodes=g;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==e.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==e.event.meshid){setDialogMode(0);go(2)}break;case"addnode":var k=e.event.node;if(!meshes[k.meshid]){break}if(getNodeFromId(k._id)!=null){break}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}k.meshnamel=meshes[k.meshid].name.toLowerCase();k.state=0;if(!k.icon){k.icon=1}k.ident=++nodeShortIdent;nodes.push(k);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];if(currentNode==k){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(2)}currentNode=null}nodes.splice(b,1);updateDevices()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];k.name=e.event.node.name;k.rname=e.event.node.rname;k.host=e.event.node.host;k.desc=e.event.node.desc;k.publicip=e.event.node.publicip;k.iploc=e.event.node.iploc;k.wifiloc=e.event.node.wifiloc;k.gpsloc=e.event.node.gpsloc;k.tags=e.event.node.tags;k.userloc=e.event.node.userloc;if(e.event.node.agent!=null){if(k.agent==null){k.agent={}}if(e.event.node.agent.ver!=null){k.agent.ver=e.event.node.agent.ver}if(e.event.node.agent.id!=null){k.agent.id=e.event.node.agent.id}if(e.event.node.agent.caps!=null){k.agent.caps=e.event.node.agent.caps}if(e.event.node.agent.core!=null){k.agent.core=e.event.node.agent.core}else{if(k.agent.core){delete k.agent.core}}k.agent.tag=e.event.node.agent.tag}if(e.event.node.intelamt!=null){if(k.intelamt==null){k.intelamt={}}if(e.event.node.intelamt.state!=null){k.intelamt.state=e.event.node.intelamt.state}if(e.event.node.intelamt.host!=null){k.intelamt.user=e.event.node.intelamt.host}if(e.event.node.intelamt.user!=null){k.intelamt.user=e.event.node.intelamt.user}if(e.event.node.intelamt.tls!=null){k.intelamt.tls=e.event.node.intelamt.tls}if(e.event.node.intelamt.ver!=null){k.intelamt.ver=e.event.node.intelamt.ver}if(e.event.node.intelamt.tag!=null){k.intelamt.tag=e.event.node.intelamt.tag}if(e.event.node.intelamt.uuid!=null){k.intelamt.uuid=e.event.node.intelamt.uuid}if(e.event.node.intelamt.realm!=null){k.intelamt.realm=e.event.node.intelamt.realm}}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}if(e.event.node.icon){k.icon=e.event.node.icon}refreshDevice(k._id);updateDevices()}break;case"nodemeshchange":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];if(meshes[e.event.newMeshId]==null){if(currentNode==k){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(2)}currentNode=null}nodes.splice(b,1)}else{k.meshid=e.event.newMeshId;k.meshnamel=meshes[e.event.newMeshId].name.toLowerCase()}updateDevices();refreshDevice(e.event.nodeid)}else{var k=e.event.node;if(!meshes[k.meshid]){break}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}k.meshnamel=meshes[k.meshid].name.toLowerCase();k.state=0;if(!k.icon){k.icon=1}k.ident=++nodeShortIdent;if(nodes==null){}nodes.push(k);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];k.conn=e.event.conn;k.pwr=e.event.pwr;updateDevices()}break;case"login":if(users!=null&&users["user/"+domain+"/"+e.event.username.toLowerCase()]){users["user/"+domain+"/"+e.event.username.toLowerCase()].login=e.event.time}break;case"notify":break;case"stopped":break;default:break}break;default: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_manageAuthApp(){if(xxdialogMode||((features&4096)==0)){return}if(userinfo.otpsecret==1){account_removeOtp()}else{account_addOtp()}}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Authenticator App",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Authenticator App",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of authenticator application 2-step login?")}function account_manageOtp(a){if((xxdialogMode==2)&&(xxdialogTag=="otpauth-manage")){dialogclose(0)}if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}meshserver.send({action:"otpauth-getpasswords",subaction:a})}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((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 method=post><table style=margin-left:10px><input type=hidden name=action value=deleteaccount /><input type=hidden name=authcookie value="+authCookie+" /><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 false}var d="<table style=margin-left:10px>";d+="<tr><td align=right>Old password:</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>";d+="<tr><td align=right>New password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td></tr>";d+="<tr><td align=right>New password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>";if(features&65536){d+="<tr><td align=right>Password hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>"}d+="</table>";if(passRequirements){var b=[],c=0;for(var a in passRequirements){if((a!="reset")&&(a!="hint")){b.push(a+":"+passRequirements[a]);c++}}if(c>0){d+="<br /><span style=font-size:x-small>Requirements: "+b.join(", ")+".</span>"}}d+="<br />";setDialogMode(2,"Change Password",3,account_showChangePasswordEx,d);Q("apassword0").focus();account_validateNewPassword();return false}function account_showChangePasswordEx(){if(Q("apassword1").value==Q("apassword2").value){var a={action:"changepassword",oldpass:Q("apassword0").value,newpass:Q("apassword1").value};if(features&65536){a.hint=Q("apasswordhint").value}meshserver.send(a)}}function account_createMesh(){if(xxdialogMode){return}if((userinfo.siteadmin!=4294967295)&&((userinfo.siteadmin&64)!=0)){setDialogMode(2,"New Device Group",1,null,"This account does not have the rights to create a new device group.");return}if((userinfo.emailVerified!==true)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');return}if((features&262144)&&!((userinfo.otpsecret==1)||(userinfo.otphkeys>0)||(userinfo.otpkeys>0))){setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');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>Software Agent Group</option><option value=1>Intel® AMT only</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 Device Group",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(){var d="",a=(Q("apassword0").value.length>0)&&(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value)&&(Q("apassword0").value!=Q("apassword1").value);if((features&65536)&&(Q("apasswordhint").value==Q("apassword1").value)){a=false}if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="<span style=color:green>Strong<span>"}else{if(c>=60){d="<span style=color:blue>●<span>"}else{d="<span style=color:red>●<span>"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="<span style=color:red>Policy<span>"}}}QH("dxPassWarn",d);QE("idx_dlgOkButton",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)}function checkPasswordRequirements(e,f){if((f==null)||(f=="")||(typeof f!="object")){return true}if(f.min){if(e.length<f.min){return false}}if(f.max){if(e.length>f.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a<e.length;a++){if(/\d/.test(e[a])){d++}if(/[a-z]/.test(e[a])){b++}if(/[A-Z]/.test(e[a])){g++}if(/\W/.test(e[a])){c++}}if(f.num&&(d<f.num)){return false}if(f.lower&&(b<f.lower)){return false}if(f.upper&&(g<f.upper)){return false}if(f.nonalpha&&(c<f.nonalpha)){return false}return true}function updateMeshes(){var c="",a=0;for(i in meshes){a++;var b=meshes[i].links[userinfo._id].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 z=filetreelocation[q].split("/");w=window.location+z[0]+"files/"+z[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,y;y=s;if(s.length>40){y='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,40))+"...</span>"}else{y=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 x=(d.t==1||d.t==4)?p5getQuotabar(d):"",A="";n="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+s+"'> <span style=float:right;padding-right:4px title=\""+A+'">'+x+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+y+"</a></span></div>"}else{var r=y;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 rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+y+"</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+"'> <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)}}function ondeskkeypress(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeys(a)}}function ondeskkeydown(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeyDown(a)}}function ondeskkeyup(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeyUp(a)}}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(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}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[userinfo._id];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® 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[userinfo._id];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® AMT devices in this group"}if(l.mtype==2){t+="<div style=padding:10px><i>No devices in this group"}t+=".</i></div></div>";d=l._id;b++}}}}if(b==0){QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">No devices</span><br /><br />Use the desktop version of this website to add devices.</div>')}else{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® AMT CIRA is connected and ready for use.">CIRA</span>')}else{if((a.conn&4)!=0){b.push('<span title="Intel® AMT is routable.">Intel® AMT</span>')}}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}if((a.conn&16)!=0){b.push('<span title="MQTT connection to the device is active.">MQTT</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[userinfo._id].rights}var currentDevicePanel=0;var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(m,n,q){if((userinfo.emailVerified!==true)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');return}if((features&262144)&&!((userinfo.otpsecret==1)||(userinfo.otphkeys>0)||(userinfo.otpkeys>0))){setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');return}var l=getNodeFromId(m);if(l==null){goBack();return}var h=meshes[l.meshid];if(h==null){goBack();return}var j=h.links[userinfo._id].rights;if(!currentNode||currentNode._id!=l._id||q==true){currentNode=l;var k=EscapeHtml(l.name);if(k.length==0){k="<i>None</i>"}if((j&4)!=0){k="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+k+"</span>"}QH("p10deviceName",k);var t="<table style=width:100%>";t+=addDeviceAttribute('<span title="The name of the device group this computer belong to">Group</span>','<a title="The name of the device group this computer belong to" onclick=goForward("'+l.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[l.meshid].name)+"</a>");if(l.rname!=null){t+=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(l.rname)+"</span>")}if((h.mtype==1)||(l.name!=l.host)){if((j&4)!=0){if(l.host){t+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(l.host)+"</span>")}else{t+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{t+=addDeviceAttribute("Hostname",EscapeHtml(l.host))}}var d=l.desc?EscapeHtml(l.desc):"<i>None</i>";if((j&4)!=0){t+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+d+"</span>")}else{t+=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","MacOS 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","MacOS 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","ARMv8 64bit","ARMv6l / ARMv7l / NoKVM","Unknown","Unknown","FreeBSD x86-64"];if((l.agent!=null)&&(l.agent.id!=null)&&(l.agent.ver!=null)){var r="";if(l.agent.id<=a.length){r=a[l.agent.id]}else{r=a[0]}if(l.agent.ver!=0){r+=" v"+l.agent.ver}t+=addDeviceAttribute("Agent",r)}if(l.intelamt!=null){var r="";var p={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(l.intelamt.ver!=null&&l.intelamt.state==null){r+="<i>Unknown State</i>, v"+l.intelamt.ver}else{if((l.intelamt.ver==null)&&(l.intelamt.state==2)){r+="<i>Activated</i>"}else{if((l.intelamt.ver==null)||(l.intelamt.state==null)){r+="<i>Unknown Version & State</i>"}else{r+=p[l.intelamt.state];if(l.intelamt.flags){if(l.intelamt.flags&2){r=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(l.intelamt.flags&4){r=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}r+=(", v"+l.intelamt.ver)}}}if(l.intelamt.tls==1){r+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(l.intelamt.state==2){if(l.intelamt.user==null||l.intelamt.user==""){if((j&4)!=0){r+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("'+l._id+'")>No Credentials</i>'}else{r+=", <i style=color:#FF0000>No Credentials</i>"}}r+=" ";if((j&4)!=0){r+='<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+l._id+'")>'}}var g="Intel® ME";if(typeof l.intelamt.sku=="number"){if((l.intelamt.sku&8)!=0){g="Intel® AMT"}else{if((l.intelamt.sku&16)!=0){g="Intel® SM"}}}t+=addDeviceAttribute(g,r)}if((l.agent!=null)&&(l.agent.tag!=null)&&(l.agent.tag!="mailto:")){var s=EscapeHtml(l.agent.tag);if(s.startsWith("mailto:")){s='<a href="'+s+'">'+s.substring(7)+"</a>"}t+=addDeviceAttribute("Agent Tag",s)}var b=l.conn;if(b&&b>1){var c=[];if((l.conn&1)!=0){c.push('<span title="Software agent is connected and ready for use.">Agent</span>')}if((l.conn&2)!=0){c.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>')}else{if((l.conn&4)!=0){c.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>')}}if((l.conn&8)!=0){c.push('<span title="Software agent is reachable using another agent as relay.">Agent Relay</span>')}if((l.conn&16)!=0){c.push('<span title="MQTT connection to the device is active.">MQTT</span>')}t+=addDeviceAttribute("Connectivity",c.join(", "))}var e="<i>None</i>";if(l.tags!=null){e="";for(var f in l.tags){e+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+l.tags[f]+"</span>"}}if((j&4)!=0){t+=addDeviceAttribute("Tags","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+e+"</span>")}else{t+=addDeviceAttribute("Tags",e)}t+="</table><br />";if((j&76)!=0){t+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}QH("p10html",t);setupFiles();t="<div style=float:right;font-size:x-small;margin-right:10px>";if((j&4)!=0){t+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+l._id+'") title="Remove this device">Delete Device</a>'}t+="</div><div style=font-size:x-small>";t+="</div><br>";QH("p10html3",t);var o=PowerStateStr(l.state);if((b&1)!=0){if(o.length>0){o+=", "}o+='<span style=font-size:10px title="Agent connected">Mesh Agent</span>'}if((b&2)!=0){if(o.length>0){o+=", "}o+='<span style=font-size:10px title="Intel® AMT connected">Intel® AMT connected</span>'}else{if((b&4)!=0){if(o.length>0){o+=", "}o+='<span style=font-size:10px title="Intel® AMT detected">Intel® AMT detected</span>'}}if((b&16)!=0){if(o.length>0){o+="<br/>"}o+='<span style=font-size:12px title="MQTT connected">MQTT channel connected</span>'}QH("MainComputerState",o);QH("MainComputerImage",'<div class="i'+l.icon+'"></div>');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!n){n=10}go(n);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(d,c){var b=0;if(currentNode){b=meshes[currentNode.meshid].links[userinfo._id].rights}if(d!=null){currentDevicePanel=d}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)&&(currentNode!=null)&&((b&8)||(b&256))&&(((meshes[currentNode.meshid].mtype==1)&&((typeof currentNode.intelamt.sku!=="number")||((currentNode.intelamt.sku&8)!=0)))||(currentNode.agent&&(currentNode.agent.caps&1)))){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&(currentNode!=null)&&(b&8)&&((b==4294967295)||((b&1024)==0))&&((currentNode.mtype==2)&&(currentNode.agent.caps&4))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links[userinfo._id].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 "+printTime(new Date(w))+" to "+printTime(new Date(q))+".";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> "+printDate(g)+"<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® 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[userinfo._id].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","Tags"];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}var d=c.links[userinfo._id].rights;QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2)&&((d&8)||(d&256)));QV("connectbutton1h",(a==0)&&(d&8)&&((c.mtype==1)||(currentNode.intelamt!=null)&&((currentNode.intelamt.state==2)&&(currentNode.intelamt.ver!=null)&&(typeof currentNode.intelamt.sku=="number")&&((currentNode.intelamt.sku&8)!=0))));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 e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QV("DeskToastButton",((d&16384)!=0)&&(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QV("deskActionsBtn",d&8);Q("DeskControl").checked=((d&8)!=0);if(e==false){QV("DeskTools",false)}}function connectDesktop(b,a){setSessionActivity();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"),authCookie);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,authCookie,authRelayCookie,domainUrl);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;default: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 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}}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.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]])}}else{if(a==6){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==7){if(desktop.contype==2){desktop.m.sendkey([[65513,1],[65473,1],[65473,0],[65513,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,115],[desktop.m.KeyAction.UP,115],[desktop.m.KeyAction.EXUP,18]])}}else{if(a==8){if(desktop.contype==2){desktop.m.sendkey([[65507,1],[119,1],[119,0],[65507,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,17],[desktop.m.KeyAction.DOWN,87],[desktop.m.KeyAction.UP,87],[desktop.m.KeyAction.EXUP,17]])}}else{if(a==9){if(desktop.contype==2){desktop.m.sendkey([[65513,1],[65289,1],[65289,0],[65513,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9],[desktop.m.KeyAction.EXUP,18]])}}else{if(a==10){desktop.m.sendcad()}else{if(a==11){if(desktop.contype==2){desktop.m.sendkey([[65289,1],[65289,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9]])}}}}}}}}}}}}}}function sendSpecialKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}setDialogMode(3,"Special Keys",3,deskSendKeys)}function toggleSoftKeys(a){QV("DeskSoftInput",a==1);if(a==1){Q("DeskSoftInput").focus()}}function toggleDeskTools(){setSessionActivity();if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){setSessionActivity();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(){setSessionActivity();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){setSessionActivity();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){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mousedown(a)}}function dmouseup(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mouseup(a)}}function dmousemove(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mousemove(a)}}function dmousewheel(a){setSessionActivity();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){setSessionActivity();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;default: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,authCookie,authRelayCookie,domainUrl);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){setSessionActivity();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+"'> <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 rel="noreferrer noopener" 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+"'> <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;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);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[userinfo._id].rights;if(currentMesh.mtype==1){e="Intel® AMT group"}if(currentMesh.mtype==2){e="Software agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.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[userinfo._id];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></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=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> "+EscapeHtml(decodeURIComponent(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 Device Group",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:120px;overflow-y:scroll">';a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview style=margin-left:12px>Remote View Only<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noterminal style=margin-left:12px>No Terminal Access<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20nofiles style=margin-left:12px>No File Access<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noamt style=margin-left:12px>No Intel® AMT<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[userinfo._id].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);QE("p20remoteview",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20noterminal",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20nofiles",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20noamt",!Q("p20fulladmin").checked&&Q("p20remotecontrol").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}if(Q("p20remoteview").checked==true){a+=256}if(Q("p20noterminal").checked==true){a+=512}if(Q("p20nofiles").checked==true){a+=1024}if(Q("p20noamt").checked==true){a+=2048}}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[userinfo._id].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group 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"}if((c&256)!=0){d+=", Remote View Only"}if((c&512)!=0){d+=", No Terminal"}if((c&1024)!=0){d+=", No Files"}if((c&2048)!=0){d+=", No Intel® AMT"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",EscapeHtml(decodeURIComponent(e.split("/")[2])));f+=addHtmlValue("Permissions",d);if(((userinfo._id)!=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){setSessionActivity();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){setSessionActivity();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){setSessionActivity();var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function putstore(f,h){try{if((typeof(localStorage)==="undefined")||(localStorage.getItem(f)==h)){return}if(h==null){localStorage.removeItem(f)}else{localStorage.setItem(f,h)}}catch(a){}if(f[0]!="_"){var g={};for(var b=0,d=localStorage.length;b<d;++b){var c=localStorage.key(b);if(c[0]!="_"){g[c]=localStorage.getItem(c)}}meshserver.send({action:"userWebState",state:JSON.stringify(g)})}}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 center(){QS("dialog").left=((((getDocWidth()-300)/2))+"px");deskAdjust();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=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;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+"'>♦ "+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]!=".")}})();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=decodeURIComponent(b[d]);break;case 1:c[a]=decodeURIComponent(b[d]);var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function printDate(a){return a.toLocaleDateString(args.locale)}function printTime(a){return a.toLocaleTimeString(args.locale)}function printDateTime(a){return a.toLocaleString(args.locale)};</script></body></html> |