MeshCentral/public/commander-pt.htm

1449 lines
735 KiB
HTML
Raw Normal View History

<!DOCTYPE html><html lang="pt" style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;} a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();$jscomp.global.Symbol.iterator||($jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
$jscomp.makeIterator=function(b){$jscomp.initSymbolIterator();if(b[$jscomp.global.Symbol.iterator])return b[$jscomp.global.Symbol.iterator]();if(!(b instanceof Array||"string"==typeof b||b instanceof String))throw new TypeError(b+" is not iterable");var c=0;return{next:function(){return c==b.length?{done:!0}:{done:!1,value:b[c++]}}}};$jscomp.arrayFromIterator=function(b){for(var c,a=[];!(c=b.next()).done;)a.push(c.value);return a};
$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$jscomp.arrayFromArguments=function(b){for(var c=[],a=0;a<b.length;a++)c.push(b[a]);return c};
2022-03-23 21:00:41 +03:00
$jscomp.inherits=function(b,c){function a(){}a.prototype=c.prototype;b.prototype=new a;b.prototype.constructor=b;for(var d in c)if($jscomp.global.Object.defineProperties){var g=$jscomp.global.Object.getOwnPropertyDescriptor(c,d);void 0!==g&&$jscomp.global.Object.defineProperty(b,d,g)}else b[d]=c[d]};String.prototype.startsWith||(String.prototype.startsWith=function(b){return 0===this.lastIndexOf(b,0)});
String.prototype.endsWith||(String.prototype.endsWith=function(b){return-1!==this.indexOf(b,this.length-b.length)});function Q(b){return document.getElementById(b)}function QS(b){try{return Q(b).style}catch(c){}}function QE(b,c){try{Q(b).disabled=!c}catch(a){}}function QV(b,c){try{QS(b).display=c?"":"none"}catch(a){}}function QA(b,c){Q(b).innerHTML+=c}function QH(b,c){Q(b).innerHTML=c}function inputBoxFocus(b){Q(b).focus();var c=Q(b).value;Q(b).value="";Q(b).value=c}
function ReadShort(b,c){return(b.charCodeAt(c)<<8)+b.charCodeAt(c+1)}function ReadShortX(b,c){return(b.charCodeAt(c+1)<<8)+b.charCodeAt(c)}function ReadInt(b,c){return 16777216*b.charCodeAt(c)+(b.charCodeAt(c+1)<<16)+(b.charCodeAt(c+2)<<8)+b.charCodeAt(c+3)}function ReadSInt(b,c){return(b.charCodeAt(c)<<24)+(b.charCodeAt(c+1)<<16)+(b.charCodeAt(c+2)<<8)+b.charCodeAt(c+3)}function ReadIntX(b,c){return 16777216*b.charCodeAt(c+3)+(b.charCodeAt(c+2)<<16)+(b.charCodeAt(c+1)<<8)+b.charCodeAt(c)}
function ShortToStr(b){return String.fromCharCode(b>>8&255,b&255)}function ShortToStrX(b){return String.fromCharCode(b&255,b>>8&255)}function IntToStr(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}function IntToStrX(b){return String.fromCharCode(b&255,b>>8&255,b>>16&255,b>>24&255)}function MakeToArray(b){return b&&null!=b&&"object"!=typeof b?[b]:b}function SplitArray(b){return b.split(",")}function Clone(b){return JSON.parse(JSON.stringify(b))}
function EscapeHtml(b){if("string"==typeof b)return b.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");if("boolean"==typeof b||"number"==typeof b)return b}function NoBreak(b){return b.split(" ").join("&nbsp;")}function ArrayElementMove(b,c,a){b.splice(a,0,b.splice(c,1)[0])}
function ObjectToStringEx(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if(b instanceof Array)for(var d in b)a+="<br />"+gap(c)+"Item #"+d+": "+ObjectToStringEx(b[d],c+1);else if(b instanceof Object)for(d in b)a+="<br />"+gap(c)+d+" = "+ObjectToStringEx(b[d],c+1);else a+=EscapeHtml(b);return a}
function ObjectToStringEx2(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if(b instanceof Array)for(var d in b)a+="\r\n"+gap2(c)+"Item #"+d+": "+ObjectToStringEx2(b[d],c+1);else if(b instanceof Object)for(d in b)a+="\r\n"+gap2(c)+d+" = "+ObjectToStringEx2(b[d],c+1);else a+=EscapeHtml(b);return a}function gap(b){for(var c="",a=0;a<4*b;a++)c+="&nbsp;";return c}function gap2(b){for(var c="",a=0;a<4*b;a++)c+=" ";return c}function ObjectToString(b){return ObjectToStringEx(b,0)}
function ObjectToString2(b){return ObjectToStringEx2(b,0)}function hex2rstr(b){if("string"!=typeof b||0==b.length)return"";var c="";b=(""+b).match(/../g);for(var a;a=b.shift();)c+=String.fromCharCode("0x"+a);return c}function char2hex(b){return(b+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(b){return unescape(encodeURIComponent(b))}
function decode_utf8(b){return decodeURIComponent(escape(b))}function data2blob(b){for(var c=Array(b.length),a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return new Blob([new Uint8Array(c)])}function random(b){return Math.floor(Math.random()*b)}function trademarks(b){return b.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function format(b){var c=Array.prototype.slice.call(arguments,1);return b.replace(/{(\d+)}/g,function(a,b){return"undefined"!=typeof c[b]?c[b]:a})}
2022-03-23 21:00:41 +03:00
function makeUefiBootParam(b,c,a,d){"number"==typeof c&&(1==a&&(c=String.fromCharCode(c&255)),2==a&&(c=ShortToStrX(c)),4==a&&(c=IntToStrX(c)));return ShortToStrX(d?d:32902)+ShortToStrX(b)+IntToStrX(c.length)+c}
var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,u,F){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.floppyReady)return g.floppyReady=!0,g.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;if(0==g.cdromReady)return g.cdromReady=!0,g.SendCommandEndResponse(1,6,c,40,
0),-1;break;default:return b("SCSI Internal error 3",c),-1}g.SendCommandEndResponse(1,0,c,0,0);break;case 8:F=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3);d=d.charCodeAt(4);0==d&&(d=256);b("SCSI: READ_6",c,F,d);a(c,F,d,u);break;case 10:return F=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3),d=d.charCodeAt(4),0==d&&(d=256),b("SCSI: WRITE_6",c,F,d),g.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){F=
d=0;switch(c){case 160:if(null==g.floppy)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=0;F=128;break;case 176:if(null==g.cdrom)return g.SendCommandEndResponse(1,2,c,58,0),-1;d=5;F=128;break;default:return b("SCSI Internal error 6",c),-1}g.SendDataToHost(c,!0,String.fromCharCode(0,d,F,0),u&1);return}g.SendCommandEndResponse(1,5,c,36,0);break;case 27:g.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==g.floppy||176==c&&null==g.cdrom)return g.SendCommandEndResponse(1,
2,c,58,0),-1;g.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);F=ReadShort(d,7);switch(c){case 160:if(null==g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}g.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),u&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null==
g.floppy||0==g.floppy.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.floppy&&(d=(g.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==g.cdrom||0==g.cdrom.size)return g.SendCommandEndResponse(0,2,c,58,0),-1;null!=g.cdrom&&(d=(g.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,F);g.SendDataToHost(F,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),u&1);break;case 40:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10",
c,F,d);a(c,F,d,u);break;case 42:case 46:F=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,F,d);g.SendGetDataFromHost(c,512*d);break;case 67:F=ReadShort(d,7);var H=d.charCodeAt(1)&2,N=d.charCodeAt(2)&7;0==N&&(N=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+F+", msf="+H+", format="+N);switch(c){case 160:return g.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==N?g.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0),
u&1):0==N&&(H?g.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,2,0,0,20,170,0,0,0,52,19),u&1):g.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,0,0,0,20,170,0,0,0,0,0),u&1));break;case 70:var N=2!=d.charCodeAt(1),v=ReadShort(d,2);F=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,N,v,F);if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;H=IntToStr(8);0==v&&(H+=m);if(1==v||N&&1>v)H+=k;if(2==v||N&&2>v)H+=h;if(3==v||N&&3>v)H+=r;if(16==v||N&&16>v)H+=K;if(30==
v||N&&30>v)H+=B;if(256==v||N&&256>v)H+=x;if(261==v||N&&261>v)H+=A;H=IntToStr(H.length)+H;H.length>F&&(H=H.substring(0,F));g.SendDataToHost(c,!0,H,u&1);return-1;case 74:b("SCSI: GET_EVENT_STATUS_NOTIFICATION",c,d.charCodeAt(1),d.charCodeAt(4),d.charCodeAt(9));if(1!=d.charCodeAt(1)&&16!=d.charCodeAt(4)){b("SCSI ERROR");g.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=g.floppy?d=2:176==c&&null!=g.cdrom&&(d=2);g.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),u&1);break;case 76:g.SendCommand(81,
IntToStrX(0)+IntToStrX(0)+IntToStrX(0)+String.fromCharCode(135,80,3,0,0,0,176,81,5,32,0),!0);break;case 81:return b("SCSI READ_DISC_INFO",c),g.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),g.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);F=ReadShort(d,7);H=null;if(0==F)return g.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),u&1),-1;F=0;160==c?null!=g.floppy&&(F=g.floppy.size>>9):null!=g.cdrom&&(F=g.cdrom.size>>11);
switch(d.charCodeAt(2)&63){case 1:H=160==c?2880>=F?y:R:z;break;case 5:160==c&&(H=2880>=F?p:n);break;case 63:H=160==c?2880>=F?q:l:D;break;case 26:176==c&&(H=e);break;case 29:176==c&&(H=C);break;case 42:176==c&&(H=w)}null==H?g.SendCommandEndResponse(0,5,c,32,0):g.SendDataToHost(c,!0,H,u&1);break;case 81:g.SendDataToHost(c,!0,E,u&1);break;case 172:g.SendDataToHost(c,!0,O,u&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),g.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,
b,x,e){var c=null,y=0;160==a&&(c=g.floppy,null!=g.floppy&&(y=g.floppy.size>>9));176==a&&(c=g.cdrom,null!=g.cdrom&&(y=g.cdrom.size>>11));if(0>x||b+x>y)return g.SendCommandEndResponse(1,5,a,33,0),0;if(0==x)return g.SendCommandEndResponse(1,0,a,0,0),0;null!=c&&(g.sectorStats&&g.sectorStats(1,160==a?0:1,y,b,x),160==a?(b<<=9,x<<=9):(b<<=11,x<<=11),null!==u?H.push({media:c,dev:a,lba:b,len:x,fr:e}):(u=c,T=a,P=b,F=x,d(e)))}function d(a){var b=F,x=P;F>g.iderinfo.readbfr&&(b=g.iderinfo.readbfr);F-=b;P+=b;var e=
new FileReader;e.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),b=String.fromCharCode.apply(null,b));g.SendDataToHost(T,0==F,b,a&1);0<F&&0==N?d(a):(u=null,N?(g.SendCommand(71),H=[],N=!1):0<H.length&&(b=H.shift(),u=b.media,T=b.dev,P=b.lba,F=b.len,d(b.fr)))};e.readAsBinaryString?e.readAsBinaryString(u.slice(x,x+b)):e.readAsArrayBuffer(u.slice(x,x+b))}var g={protocol:3,bytesToAmt:0,bytesFromAmt:0,rx_timeout:3E4,tx_timeout:0,heartbeat:2E4,version:1,acc:"",inSequence:0,outSequence:0,
iderinfo:null,enabled:!1,iderStart:0,floppy:null,cdrom:null,floppyReady:!1,cdromReady:!1,sectorStats:null},v=null;urlvars&&urlvars.iderlog&&(v=require("fs").createWriteStream(urlvars.iderlog,{flags:"w"}));var n=String.fromCharCode(0,38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),l=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,
0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),p=String.fromCharCode(0,38,36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),q=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),e=String.fromCharCode(0,18,1,128,0,0,0,0,26,10,0,0,0,0,0,0,0,0,0,0),C=String.fromCharCode(0,
18,1,128,0,0,0,0,29,10,0,0,0,0,0,0,0,0,0,0),w=String.fromCharCode(0,32,1,128,0,0,0,0,42,24,0,0,0,0,32,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),D=String.fromCharCode(0,40,1,128,0,0,0,0,1,6,0,255,0,0,0,0,42,24,0,0,0,0,2,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0);String.fromCharCode(0,0,0,40,0,0,0,8);var m=String.fromCharCode(0,0,3,4,0,8,1,0),k=String.fromCharCode(0,1,3,4,0,0,0,2),h=String.fromCharCode(0,2,3,4,0,0,0,0),r=String.fromCharCode(0,3,3,4,41,0,0,2),K=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,
0,0),B=String.fromCharCode(0,30,3,0),x=String.fromCharCode(1,0,3,0),A=String.fromCharCode(1,5,3,0),y=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),R=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),z=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,0,0,0),E=String.fromCharCode(0,32,14,1,1,1,1,32,255,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0),O=String.fromCharCode(0,0,0,4,2,0,0,0);g.xxStateChange=function(a){b("IDER-StateChange",a);
0==a&&g.Stop();3==a&&g.Start()};g.Start=function(){b("IDER-Start");b(g.floppy,g.cdrom);g.bytesToAmt=0;g.bytesFromAmt=0;g.inSequence=0;g.outSequence=0;H=[];g.SendCommand(64,ShortToStrX(g.rx_timeout)+ShortToStrX(g.tx_timeout)+ShortToStrX(g.heartbeat)+IntToStrX(g.version));g.sectorStats&&(g.sectorStats(0,0,g.floppy?g.floppy.size>>9:0),g.sectorStats(0,1,g.cdrom?g.cdrom.size>>11:0))};g.Stop=function(){b("IDER-Stop");g.parent.Stop()};g.ProcessData=function(a){g.bytesFromAmt+=a.length;g.acc+=a;null!=v&&
v.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",g.acc.length,rstr2hex(g.acc));;){a=g.ProcessDataEx();if(0==a)break;if(g.inSequence!=ReadIntX(g.acc,4)){b("ERROR: Out of sequence",g.inSequence,ReadIntX(g.acc,4));g.Stop();break}g.inSequence++;g.acc=g.acc.substring(a)}};g.SendCommand=function(a,x,e,c){null==x&&(x="");e=50<a&&1==e?2:0;c&&(e+=1);x=String.fromCharCode(a,0,0,e)+IntToStrX(g.outSequence++)+x;g.parent.xxSend(x);g.bytesToAmt+=x.length;null!=v&&v.write("IDERSEND: "+rstr2hex(x)+
"\r\n");75!=a&&b("IDER-SendData",x.length,rstr2hex(x))};g.SendCommandEndResponse=function(a,b,x,e,c){a?g.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,197,0,3,0,0,0,x,80,0,0,0),!0):g.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,b<<4,3,0,0,0,x,81,b,e,c),!0)};g.SendDataToHost=function(a,b,x,e){var c=e?0:x.length;1==b?g.SendCommand(84,String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+x,b,e):g.SendCommand(84,
String.fromCharCode(0,x.length&255,x.length>>8,0,e?180:181,0,2,0,c&255,c>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+x,b,e)};g.SendGetDataFromHost=function(a,b){g.SendCommand(82,String.fromCharCode(0,b&255,b>>8,0,181,0,0,0,b&255,b>>8,a,88,0,0,0,0,0,0,0,0,0,0,0),!1)};g.SendDisableEnableFeatures=function(a,b){null==b&&(b="");g.SendCommand(72,String.fromCharCode(a)+b)};g.ProcessDataEx=function(){if(8>g.acc.length)return 0;switch(g.acc.charCodeAt(0)){case 65:if(30>g.acc.length)break;var a=g.acc.charCodeAt(29);
if(g.acc.length<30+a)break;g.iderinfo={};g.iderinfo.major=g.acc.charCodeAt(8);g.iderinfo.minor=g.acc.charCodeAt(9);g.iderinfo.fwmajor=g.acc.charCodeAt(10);g.iderinfo.fwminor=g.acc.charCodeAt(11);g.iderinfo.readbfr=ReadShortX(g.acc,16);g.iderinfo.writebfr=ReadShortX(g.acc,18);g.iderinfo.proto=g.acc.charCodeAt(21);g.iderinfo.iana=ReadIntX(g.acc,25);b(g.iderinfo);0!=g.iderinfo.proto&&(b("Unknown proto",g.iderinfo.proto),g.Stop());8192<g.iderinfo.readbfr&&(b("Illegal read buffer size",g.iderinfo.readbfr),
g.Stop());8192<g.iderinfo.writebfr&&(b("Illegal write buffer size",g.iderinfo.writebfr),g.Stop());0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25));return 30+a;case 67:return b("CLOSE"),g.Stop(),8;case 68:return g.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>g.acc.length)break;a=g.acc.charCodeAt(8);null===u?(g.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2",
a));return 9;case 73:if(13>g.acc.length)break;var a=g.acc.charCodeAt(8),x=ReadIntX(g.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(9)):1==g.iderStart?g.SendDisableEnableFeatures(3,IntToStrX(17)):2==g.iderStart&&g.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:g.enabled=x&2?!0:!1;b("IDER Status: "+g.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>g.acc.length)break;b("IDER: ABORT",g.acc.charCodeAt(8));
return 11;case 75:return 8;case 80:if(28>g.acc.length)break;var a=g.acc.charCodeAt(14)&16?176:160,x=g.acc.charCodeAt(14),e=g.acc.substring(16,28),y=g.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(e),y,x);c(a,e,y,x);return 28;case 83:if(14>g.acc.length)break;a=ReadShortX(g.acc,9);if(g.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));g.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",g.acc[0]),g.Stop()}return 0};
var H=[],N=!1,u=null,T,P,F;return g},CreateAmtRemoteServerIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}var c={protocol:4,iderStart:0,floppy:null,cdrom:null,state:0,onStateChanged:null,m:{sectorStats:null,onDialogPrompt:null,dialogPrompt:function(a){c.socket.send(JSON.stringify({action:"dialogResponse",args:a}))},bytesToAmt:0,bytesFromAmt:0,server:!0,Stop:function(){c.Stop()}},xxStateChange:function(a){if(c.state!=
a&&(b("SIDER-StateChange",a),c.state=a,null!=c.onStateChanged))c.onStateChanged(c,c.state)},Start:function(a,d,g,v,n){b("SIDER-Start",a,d,g,v,n);c.host=a;c.port=d;c.user=g;c.pass=v;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webider.ashx?host="+a+"&port="+d+"&tls="+n+("*"==g?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+g:"")+"&tls1only="+
c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)},Stop:function(){b("SIDER-Stop");null!=c.socket&&(c.socket.close(),c.socket=null);c.xxStateChange(0)},xxOnSocketConnected:function(){c.xxStateChange(2);c.socket.send(JSON.stringify({action:"start"}))},xxOnMessage:function(a){var b=null;try{b=JSON.parse(a.data)}catch(g){}if(null!=b&&"string"==typeof b.action)switch(b.action){case "dialog":if(null!=c.m.onDialogPrompt)c.m.onDialogPrompt(c,
b.args,b.buttons);break;case "state":2==b.state&&c.xxStateChange(3);break;case "stats":c.m.bytesToAmt=b.toAmt;c.m.bytesFromAmt=b.fromAmt;c.m.sectorStats&&c.m.sectorStats(b.mode,b.dev,b.total,b.start,b.len);break;case "error":console.log("IDER Error: "+";Floppy disk image does not exist;Invalid floppy disk image;Unable to open floppy disk image;CDROM disk image does not exist;Invalid CDROM disk image;Unable to open CDROM disk image;Can't perform IDER with no disk images".split(";")[b.code]);break;
default:console.log("Unknown Server IDER action: "+b.action),breal}},xxOnSocketClosed:function(){c.Stop()}};return c},CreateWsmanComm=function(b,c,a,d,g){function v(a){return a.split(",").reduce(function(a,b){a.ic?a.st[a.st.length-1]+=","+b:a.st.push(b);0==b.split('"').length%2&&(a.ic=!a.ic);return a},{st:[],ic:!1}).st}function n(a){a="00000000"+a.toString(16);return a.substring(a.length-8)}function l(){e.socketState=2;e.socketParseState=0;e.socketAccumulator="";e.socketHeader=null;e.socketData="";
for(i in e.pendingAjaxCall)e.sendRequest(e.pendingAjaxCall[i][0],e.pendingAjaxCall[i][3],e.pendingAjaxCall[i][4])}function p(a){var b=e.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(e.socketAccumulator=b+a;;){if(0==e.socketParseState){b=e.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;e.socketHeader=e.socketAccumulator.substring(0,b).split("\r\n");if(null==e.amtVersion)for(var c in e.socketHeader)0==e.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&&
2022-03-23 21:00:41 +03:00
(e.amtVersion=e.socketHeader[c].substring(46));e.socketAccumulator=e.socketAccumulator.substring(b+4);e.socketParseState=1;e.socketData="";e.socketXHeader={Directive:e.socketHeader[0].split(" ")};for(c in e.socketHeader)0!=c&&(b=e.socketHeader[c].indexOf(":"),e.socketXHeader[e.socketHeader[c].substring(0,b).toLowerCase()]=e.socketHeader[c].substring(b+2))}if(1==e.socketParseState){b=-1;if(void 0==e.socketXHeader.connection||"close"!=e.socketXHeader.connection.toLowerCase()||void 0!=e.socketXHeader["transfer-encoding"]&&
"chunked"==e.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=e.socketXHeader["content-length"]){b=parseInt(e.socketXHeader["content-length"]);if(e.socketAccumulator.length<b)break;a=e.socketAccumulator.substring(0,b);e.socketAccumulator=e.socketAccumulator.substring(b);e.socketData=a;b=0}else{var p=e.socketAccumulator.indexOf("\r\n");if(0>p)break;b=parseInt(e.socketAccumulator.substring(0,p),16);if(isNaN(b)){e.websocket&&e.websocket.close();break}if(e.socketAccumulator.length<p+2+b+2)break;
a=e.socketAccumulator.substring(p+2,p+2+b);e.socketAccumulator=e.socketAccumulator.substring(p+2+b+2);e.socketData+=a}else b=0;if(0==b){p=e.socketXHeader;b=e.socketData;urlvars&&urlvars.wsmantrace&&console.log("WSMAN-RECV("+b.length+"): "+b);a=parseInt(p.Directive[1]);isNaN(a)&&(a=602);if(401==a&&3>++e.authcounter){if(e.challengeParams=e.parseDigest(p["www-authenticate"]),null!=e.challengeParams.qop){b=e.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")?
e.challengeParams.qop="auth-int":e.challengeParams.qop="auth"}}else p=e.pendingAjaxCall.shift(),e.authcounter=0,e.ActiveAjaxCount--,e.gotNextMessages(b,"success",{status:a},p),e.PerformNextAjax();e.socketParseState=0;e.socketHeader=null}}}}function q(a){0==e.inDataCount&&(e.tlsv1only=1-e.tlsv1only);e.socketState=0;null!=e.socket&&(e.socket.close(),e.socket=null);if(0<e.pendingAjaxCall.length){a=e.pendingAjaxCall.shift();var b=a[5];e.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var e={PendingAjax:[],
2022-03-23 21:00:41 +03:00
ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,authcounter:0,socket:null,socketState:0};e.host=b;e.port=c;e.user=a;e.pass=d;e.tls=g;e.tlsv1only=0;e.inDataCount=0;e.amtVersion=null;e.digestRealmMatch=null;e.digestRealm=null;e.PerformAjax=function(a,b,c,p,d,h){e.ActiveAjaxCount<e.MaxActiveAjaxCount&&0==e.PendingAjax.length?e.PerformAjaxEx(a,b,c,d,h):1==p?e.PendingAjax.unshift([a,b,c,d,h]):e.PendingAjax.push([a,b,c,d,h])};e.PerformNextAjax=function(){if(!(e.ActiveAjaxCount>=
e.MaxActiveAjaxCount||0==e.PendingAjax.length)){var a=e.PendingAjax.shift();e.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);e.PerformNextAjax()}};e.PerformAjaxEx=function(a,b,c,p,d){if(0!=e.FailAllError)e.gotNextMessagesError({status:e.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),e.ActiveAjaxCount++,e.PerformAjaxExNodeJS(a,b,c,p,d)};e.pendingAjaxCall=[];e.PerformAjaxExNodeJS=function(a,b,c,p,d){e.PerformAjaxExNodeJS2(a,
b,c,p,d,5)};e.PerformAjaxExNodeJS2=function(a,b,c,p,d,h){0>=h||0!=e.FailAllError?(e.ActiveAjaxCount--,999!=e.FailAllError&&e.gotNextMessages(null,"error",{status:0==e.FailAllError?408:e.FailAllError},[a,b,c,p,d]),e.PerformNextAjax()):(e.pendingAjaxCall.push([a,b,c,p,d,h]),0==e.socketState?e.xxConnectHttpSocket():2==e.socketState&&e.sendRequest(a,p,d))};e.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=e.challengeParams){e.digestRealm=e.challengeParams.realm;
if(e.digestRealmMatch&&e.digestRealm!=e.digestRealmMatch){e.FailAllError=997;e.CancelAllQueries(997);return}var d=Math.random().toString(36).substring(7);c=hex_md5(hex_md5(e.user+":"+e.challengeParams.realm+":"+e.pass)+":"+e.challengeParams.nonce+":"+n(e.noncecounter)+":"+d+":"+e.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==e.challengeParams.qop?":"+hex_md5(a):"")));p+="Authorization: "+e.renderDigest({username:e.user,realm:e.challengeParams.realm,nonce:e.challengeParams.nonce,uri:b,qop:e.challengeParams.qop,
response:c,nc:n(e.noncecounter++),cnonce:d})+"\r\n"}a=p+="Host: "+e.host+":"+e.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==e.socketState&&null!=e.socket&&e.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=0;p<a.length;++p)b[p]=a.charCodeAt(p);try{e.socket.send(b.buffer)}catch(h){}}};e.parseDigest=function(a){return v(a.substring(7)).reduce(function(a,b){var e=b.trim().split("=");a[e[0]]=e[1].replace(RegExp('"',"g"),"");return a},{})};e.renderDigest=function(a){var b=
2022-03-23 21:00:41 +03:00
[];for(i in a)b.push(i);return"Digest "+b.reduce(function(b,e){return b+","+("nc"==e||"qop"==e?e+"="+a[e]:e+'="'+a[e]+'"')},"").substring(1)};e.xxConnectHttpSocket=function(){e.inDataCount=0;e.socketState=1;e.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+e.host+"&port="+e.port+"&tls="+e.tls+"&tls1only="+e.tlsv1only+("*"==a?"&serverauth=1":"")+("undefined"===
typeof d?"&serverauth=1&user="+a:""));e.socket.binaryType="arraybuffer";e.socket.onopen=l;e.socket.onmessage=p;e.socket.onclose=q};e.gotNextMessages=function(a,b,c,p){if(999!=e.FailAllError)if(0!=e.FailAllError)p[1](null,e.FailAllError,p[2]);else p[1](a,c.status,p[2])};e.gotNextMessagesError=function(a,b,c,p){if(999!=e.FailAllError)if(0!=e.FailAllError)p[1](null,e.FailAllError,p[2]);else p[1](e,null,{Header:{HttpError:a.status}},a.status,p[2])};e.CancelAllQueries=function(a){for(;0<e.PendingAjax.length;){var b=
2022-03-23 21:00:41 +03:00
e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),e.websocket=null,e.socketState=0)};return e},CreateAmtRedirect=function(b,c){function a(a){return String.fromCharCode.apply(null,a)}var d={};d.m=b;b.parent=d;d.authCookie=c;d.State=0;d.socket=null;d.host=null;d.port=0;d.user=null;d.pass=null;d.authuri="/RedirectionService";d.tlsv1only=0;d.inDataCount=0;d.connectstate=0;d.protocol=b.protocol;d.acc=null;d.amtsequence=1;d.amtkeepalivetimer=null;d.onStateChanged=null;d.Start=
function(a,b,n,l,p){d.host=a;d.port=b;d.user=n;d.pass=l;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof l?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
2022-03-23 21:00:41 +03:00
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=l)if(0==l)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var q=0,p=n[q],l=a(new Uint8Array(n.buffer.slice(q+1,q+1+p))),q=q+(p+1),e=n[q],p=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),q=q+(e+
1),e=0,e=null,C;C="";for(var w=0;32>w;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[q],e=a(new Uint8Array(n.buffer.slice(q+1,q+1+e))),w="00000002:"+C+":"+e+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));q=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(q+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(q)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(l){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
2022-03-23 21:00:41 +03:00
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,v){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var k=b;if(null!=d.attributes&&0<d.attributes.length)for(k={Value:b},
b=0;b<d.attributes.length;b++)k["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(k):c[d.localName]=null==c[d.localName]?k:[c[d.localName],k]}return c}function l(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";
var b="<w:SelectorSet>",c;for(c in a)if(a.hasOwnProperty(c)){b+='<w:Selector Name="'+c+'">';if(a[c].ReferenceParameters){var b=b+"<a:EndpointReference>",b=b+("<a:Address>"+a[c].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[c].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d<p.length;d++)b+="<w:Selector"+l(p[d])+">"+p[d].Value+"</w:Selector>";else b+="<w:Selector"+l(p)+">"+p.Value+"</w:Selector>";
b+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else b+=a[c];b+="</w:Selector>"}return b+"</w:SelectorSet>"}var q={NextMessageId:1,Address:"/wsman"};q.comm=CreateWsmanComm(b,c,a,d,g,v);q.PerformAjax=function(a,b,c,p,d){null==d&&(d="");q.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+
d+"><Header><a:Action>"+a,function(a,c,e){var p=q.ParseWsman(a);if(null==a||p&&null!=p||200!=c){if(200!=c){null==p&&(p={Header:{}});p.Header.HttpError=c;try{p.Header.WsmanError=p.Body.Reason.Text.Value}catch(d){}}b(q,p.Header.ResourceURI,p,c,e)}else b(q,null,{Header:{HttpError:c}},601,e)},c,p)};q.CancelAllQueries=function(a){q.comm.CancelAllQueries(a)};q.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};q.ExecSubscribe=function(a,b,c,d,m,k,h,g,l,B){var x="",A="";
g="";null!=l&&null!=B&&(x='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+l+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+
B+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",A='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=g&&(g="<a:ReferenceParameters><m:arg>"+g+"</m:arg></a:ReferenceParameters>");"PushWithAck"==b?b="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==b&&(b="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+q.Address+
"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+p(h)+x+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+b+'"><e:NotifyTo><a:Address>'+c+"</a:Address>"+g+"</e:NotifyTo>"+A+"</e:Delivery></e:Subscribe>";q.PerformAjax(a+"</Body></Envelope>",d,m,k,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};q.ExecUnSubscribe=
function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+p(m)+"</Header><Body><e:Unsubscribe/>";q.PerformAjax(a+"</Body></Envelope>",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};q.ExecPut=function(a,b,c,d,m,k){k="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+
q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+p(k)+"</Header><Body>";if(a&&null!=b){var h=q.GetNameFromUrl(a);a="<r:"+h+' xmlns:r="'+a+'">';for(var g in b)if(b.hasOwnProperty(g)&&0!==g.indexOf("__")&&0!==g.indexOf("@")&&null!=b[g]&&"function"!==typeof b[g])if("object"===typeof b[g]&&
b[g].ReferenceParameters){a+="<r:"+g+"><a:Address>"+b[g].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+b[g].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var K=b[g].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(K))for(var B=0;B<K.length;B++)a+="<w:Selector"+l(K[B])+">"+K[B].Value+"</w:Selector>";else a+="<w:Selector"+l(K)+">"+K.Value+"</w:Selector>";a+="</w:SelectorSet></a:ReferenceParameters></r:"+g+">"}else if(Array.isArray(b[g]))for(B=0;B<b[g].length;B++)a+=
"<r:"+g+">"+b[g][B].toString()+"</r:"+g+">";else a+="<r:"+g+">"+b[g].toString()+"</r:"+g+">";b=a+("</r:"+h+">")}else b="";q.PerformAjax(k+b+"</Body></Envelope>",c,d,m)};q.ExecCreate=function(a,b,c,d,m,k){var h=q.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
p(k)+"</Header><Body><g:"+h+' xmlns:g="'+a+'">';for(var g in b)a+="<g:"+g+">"+b[g]+"</g:"+g+">";q.PerformAjax(a+"</g:"+h+"></Body></Envelope>",c,d,m)};q.ExecDelete=function(a,b,c,d,m){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
p(b)+"</Header><Body /></Envelope>";q.PerformAjax(a,c,d,m)};q.ExecGet=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",b,c,p)};q.ExecMethod=function(a,b,c,p,d,k,
h){var g="",l;for(l in c)if(null!=c[l])if(Array.isArray(c[l]))for(var B in c[l])g+="<r:"+l+">"+c[l][B]+"</r:"+l+">";else g+="<r:"+l+">"+c[l]+"</r:"+l+">";q.ExecMethodXml(a,b,g,p,d,k,h)};q.ExecMethodXml=function(a,b,c,d,m,k,h){q.PerformAjax(a+"/"+b+"</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
p(h)+"</Header><Body><r:"+b+'_INPUT xmlns:r="'+a+'">'+c+"</r:"+b+"_INPUT></Body></Envelope>",d,m,k)};q.ExecEnum=function(a,b,c,p){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',
b,c,p)};q.ExecPull=function(a,b,c,p,d){q.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+q.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+q.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+b+"</EnumerationContext></Pull></Body></Envelope>",
c,p,d)};q.ParseWsman=function(a){if(null==a)return null;var b={Header:{}};try{if(!a.childNodes){var c=a;if(window.DOMParser)a=(new DOMParser).parseFromString(c,"text/xml");else{var p=new ActiveXObject("Microsoft.XMLDOM");p.async=!1;p.loadXML(c);a=p}}var d=a.getElementsByTagName("Header")[0],k;d||(d=a.getElementsByTagName("a:Header")[0]);if(!d)return null;for(c=0;c<d.childNodes.length;c++){var h=d.childNodes[c];b.Header[h.localName]=h.textContent}var g=a.getElementsByTagName("Body")[0];g||(g=a.getElementsByTagName("a:Body")[0]);
if(!g)return null;if(0<g.childNodes.length){k=g.childNodes[0].localName;var q=k.indexOf("_OUTPUT");-1!=q&&q==k.length-7&&(k=k.substring(0,k.length-7));b.Header.Method=k;try{b.Body=n(g.childNodes[0])}catch(l){return console.log("_ParseWsmanRec failed",g,l),null}}}catch(l){return console.log("Unable to parse XML: "+a+", "+l),null}return b};return q};
function AmtStackCreateService(b){function c(){var a=e.GetPendingActions();C<a&&(C=a);null!=e.onProcessChanged&&w!=a&&(w=a,e.onProcessChanged(a,C));0==a&&(C=0)}function a(a,b,c,p,z,h,k){200!=z?(c(e,a,null,z,h),g(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?e.wsman.ExecPull(p,b.Body.EnumerationContext,function(b,e,p,z){d(a,p,c,e,[],z,h,k)}):(c(e,a,null,603,h),g(1))}function d(a,b,p,h,z,E,k,m){if(200!=E)p(e,a,null,E,k),g(1);else if(null==b||"PullResponse"!=b.Header.Method)p(e,
a,null,604,k),g(1);else{for(var r in b.Body.Items)if(b.Body.Items[r]instanceof Array)for(var q in b.Body.Items[r])"function"!=typeof b.Body.Items[r][q]&&z.push(b.Body.Items[r][q]);else"function"!=typeof b.Body.Items[r]&&z.push(b.Body.Items[r]);b.Body.EnumerationContext?e.wsman.ExecPull(h,b.Body.EnumerationContext,function(b,c,e,A){d(a,e,p,c,z,A,k,1)}):(g(1),p(e,a,z,E,k),c())}}function g(a){e.ActiveEnumsCount-=a;e.ActiveEnumsCount>=e.MaxActiveEnumsCount||0==e.PendingEnums.length?c():(a=e.PendingEnums.shift(),
e.Enum(a[0],a[1],a[2]),g(0))}function v(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),function(b,c,p,d){null==p||200!=d?a.callback(e,a.name,null,d,a.tag):(a.responses[p.Header.Method]=p,v(a))},a.pri),a.current++);c()}function n(a,b,c,p,d){if(200!=p||"0"!=c.Body.ReturnValue)d[0](e,null,d[2]);else e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,d)}function l(a,b,c,d,z){if(200!=d||"0"!=c.Body.ReturnValue)z[0](e,
null,z[2]);else{var h,m,g;b=z[2];d=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(h in r){a=null;try{a=window.atob(r[h])}catch(q){}if(null!=a&&(m=ReadIntX(a,0),0<m&&4294967295>m)){g={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),
EventData:[],Time:new Date(1E3*(m+60*d.getTimezoneOffset()))};for(m=13;21>m;m++)g.EventData.push(a.charCodeAt(m));g.EntityStr=k[g.Entity];g.Desc=p(g.EventSensorType,g.EventOffset,g.EventData,g.Entity);g.EntityStr||(g.EntityStr="Unknown");b.push(g)}}if(1!=c.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,l,[z[0],b,z[2]]);else z[0](e,b,z[2])}}function p(a,b,c,p){if(15==a){if(235==c[0])return"Dados inv\u00e1lidos";if(0==b)return D[c[1]];if(3==b){if(170==c[0]&&48==c[1])return format("AMT One Click Recovery: {0}",
r[c[2]]);if(170==c[0]&&64==c[1]){if(1==c[2])return"Got an error erasing Device SSD";if(2==c[2])return"Erasing Device TPM is not supported";if(3==c[2])return"Reached Max Counter"}else return"OEM Specific Firmware Error event"}else if(5==b){if(170==c[0]&&48==c[1])return 1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],K[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",h[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]);if(170==c[0]&&
64==c[1]){if(1==c[2]){if(2==c[3])return"Started erasing Device SSD";if(3==c[3])return"Started erasing Device TPM";if(5==c[3])return"Started erasing Device BIOS Reload of Golden Config"}if(2==c[2]){if(2==c[3])return"Erasing Device SSD ended successfully";if(3==c[3])return"Erasing Device TPM ended successfully";if(5==c[3])return"Erasing Device BIOS Reload of Golden Config ended successfully"}if(3==c[2])return"Beginning Platform Erase";if(4==c[2])return"Clear Reserved Parameters";if(5==c[2])return"All setting decremented"}else return"OEM Specific Firmware Progress event"}else return m[c[1]]}if(18==
2022-03-23 21:00:41 +03:00
a&&170==c[0])return"C\u00e3o de guarda do agente"+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... alterado para"+e.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Intrus\u00e3o de caso";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"Uma sess\u00e3o remota Serial Over LAN foi estabelecida.";if(1==c[2])return"Sess\u00e3o Remota Serial Over LAN conclu\u00edda. O controle do usu\u00e1rio foi restaurado.";if(2==c[2])return"Uma sess\u00e3o remota de redirecionamento de IDE foi estabelecida.";
if(3==c[2])return"Sess\u00e3o remota de redirecionamento de IDE conclu\u00edda. O controle do usu\u00e1rio foi restaurado."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="com fio"),4294967293==a?"Todos os filtros de pacotes recebidos foram correspondidos em"+b+" interface.":4294967292==a?"Todos os filtros de pacotes de sa\u00edda foram correspondidos em"+b+" interface.":4294967290==a?"O filtro de pacotes falsificados foi correspondido em"+b+" interface.":"Filtro"+
a+" foi combinado em"+b+" interface.";if(192==a)return 0==c[2]?"Pol\u00edtica de seguran\u00e7a invocada. Algum ou todo o tr\u00e1fego de rede (TX) foi interrompido.":2==c[2]?"Pol\u00edtica de seguran\u00e7a invocada. Algum ou todo o tr\u00e1fego de rede (RX) foi interrompido.":"Pol\u00edtica de seguran\u00e7a invocada.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"Solicita\u00e7\u00e3o do usu\u00e1rio para conex\u00e3o remota.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"Erro EAC: tentativa de obter postura enquanto o NAC no IntelTM AMT est\u00e1 desativado.";
if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Erro HWA: erro geral"}return 6==a?"Falha na autentica\u00e7\u00e3o"+(c[1]+(c[2]<<8))+" vezes. O sistema pode estar sob ataque.":30==a?"Nenhuma m\u00eddia inicializ\u00e1vel":32==a?"Bloqueio do sistema operacional ou interrup\u00e7\u00e3o de energia":35==a?64==c[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"Falha na inicializa\u00e7\u00e3o do sistema":37==a?"Firmware do sistema iniciado (pelo menos uma CPU est\u00e1 sendo executada corretamente).":
"Tipo de sensor desconhecido #"+a}function q(a,b,c,p,d){if(200!=p)d[0](e,[],p);else{var h,k,m=d[1],g=new Date,r;if(0<c.Body.RecordsReturned)for(k in c.Body.EventRecords=MakeToArray(c.Body.EventRecords),c.Body.EventRecords){a=null;try{a=window.atob(c.Body.EventRecords[k])}catch(w){console.log(w+" "+c.Body.EventRecords[k])}b={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};b.AuditApp=B[b.AuditAppID];b.Event=B[100*b.AuditAppID+b.EventID];b.Event||(b.Event="#"+b.EventID);
2022-03-23 21:00:41 +03:00
0==b.InitiatorType&&(h=a.charCodeAt(5),b.Initiator=a.substring(6,6+h),h=6+h);1==b.InitiatorType&&(b.KerberosUserInDomain=ReadInt(a,5),h=a.charCodeAt(9),b.Initiator=GetSidString(a.substring(10,10+h)),h=10+h);2==b.InitiatorType&&(b.Initiator="<i>Local</i>",h=5);3==b.InitiatorType&&(b.Initiator="<i>Porta padr\u00e3o KVM</i>",h=5);r=ReadInt(a,h);b.Time=new Date(1E3*(r+60*g.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);r=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+r);h+=r;r=a.charCodeAt(h++);
b.Ex=a.substring(h,h+r);b.ExStr=e.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);m.push(b)}if(c.Body.TotalRecordCount>m.length)e.AMT_AuditLog_ReadRecords(m.length+1,q,[d[0],m]);else d[0](e,m,p)}}var e={};e.wsman=b;e.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/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var C=0,
w=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,b,p,d,z,h,k,m,g,r){e.wsman.ExecSubscribe(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,y,A,z)},0,h,k,m,g,r);c()};e.UnSubscribe=function(a,b,p,d,z){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(d,z,h,k){c();b(e,a,h,k,p)},0,d,z);c()};e.Get=function(a,b,p,d){e.wsman.ExecGet(e.CompleteName(a),function(d,
h,k,m){c();b(e,a,k,m,p)},0,d);c()};e.Put=function(a,b,p,d,z,h){e.wsman.ExecPut(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z,h);c()};e.Create=function(a,b,p,d,z){e.wsman.ExecCreate(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Delete=function(a,b,p,d,z){e.wsman.ExecDelete(e.CompleteName(a),b,function(b,z,A,h){c();p(e,a,A,h,d)},0,z);c()};e.Exec=function(a,b,p,d,z,h,k){e.wsman.ExecMethod(e.CompleteName(a),b,p,function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),
A,z)},0,h,k);c()};e.ExecWithXml=function(a,b,p,d,z,h,k){e.wsman.ExecMethodXml(e.CompleteName(a),b,execArgumentsToXml(p),function(b,p,y,A){c();d(e,a,e.CompleteExecResponse(y),A,z)},0,h,k);c()};e.Enum=function(b,p,d,h){e.ActiveEnumsCount<e.MaxActiveEnumsCount?(e.ActiveEnumsCount++,e.wsman.ExecEnum(e.CompleteName(b),function(e,d,y,h,k){c();a(b,y,p,d,h,k)},d,h)):e.PendingEnums.push([b,p,d,h]);c()};e.BatchEnum=function(a,b,p,d,z,h){z={_pending:b.length};e.PendingBatchOperations+=b.length;for(var k in b){var m=
b[k],g=e.Enum;"*"==m[0]&&(g=e.Get,m=m.substring(1));g(m,function(b,z,A,h,k){e.PendingBatchOperations--;c();k[2][z]={response:null==A?null:A.Body,responses:A,status:h};0==--k[2]._pending&&(delete k[2]._pending,p.call(e,e,a,k[2],h,d))},[a,b,z,g==e.Get?"Get":"Enum"],h)}};e.BatchGet=function(a,b,p,e,d){v({name:a,names:b,callback:p,current:0,responses:{},tag:e,pri:d});c()};e.CompleteName=function(a){if(0==a.indexOf("AMT_"))return e.pfx[0]+a;if(0==a.indexOf("CIM_"))return e.pfx[1]+a;if(0==a.indexOf("IPS_"))return e.pfx[2]+
2022-03-23 21:00:41 +03:00
a};e.CompleteExecResponse=function(a){a&&null!=a&&a.Body&&void 0!=a.Body.ReturnValue&&(a.Body.ReturnValueStr=e.AmtStatusToStr(a.Body.ReturnValue));return a};e.RequestPowerStateChange=function(a,b){e.CIM_PowerManagementService_RequestPowerStateChange(a,'<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,b)};e.RequestOSPowerStateChange=function(a,b){e.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'<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,b)};e.SetBootConfigRole=function(a,b){e.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>',
a,b)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,p,d,h,
k,m,g){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h,k,m,g)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,p){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,p)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence=
2022-03-23 21:00:41 +03:00
function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,p,d,h){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:p,ActionEac:d},h)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){e.Exec("AMT_AgentPresenceWatchdogVA",
"DeleteAllActions",{_method_dummy:a},b)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,b,c){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_AuditLog_ReadRecords=function(a,b,c){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};e.AMT_AuditLog_SetAuditLock=function(a,b,c,p){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},p)};e.AMT_AuditLog_ExportAuditLogSignature=
function(a,b){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,p,d){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,p,d){e.Exec("AMT_AuditPolicyRule",
"SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:p},d)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,p,d,h){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:p,Realms:d},h)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService",
"GetUserAclEntryEx",{Handle:a},b,c)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,p,d,h,k){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:p,AccessPermission:d,Realms:h},k)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
2022-03-23 21:00:41 +03:00
{Username:a,DigestPassword:b},c)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,p){e.Exec("AMT_AuthorizationService",
"SetAclEnabledState",{Handle:a,Enabled:b},c,p)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_EndpointAccessControlService_GetPosture=function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};e.AMT_EndpointAccessControlService_GetPostureHash=
function(a,b){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a,
PostureHashAlgorithm:b},c)};e.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(a,b){e.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:a},b)};e.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(a,b){e.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:a},b)};e.AMT_EthernetPortSettings_SetLinkPreference=function(a,b,c){e.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:a,Timeout:b},c)};e.AMT_GeneralSettings_AMTAuthenticate=
function(a,b){e.Exec("AMT_GeneralSettings","AMTAuthenticate",{MC_Nonce:a},b)};e.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(a,b){e.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:a},b)};e.AMT_KerberosSettingData_GetCredentialCacheState=function(a){e.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},a)};e.AMT_KerberosSettingData_SetCredentialCacheState=function(a,b){e.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:a},
b)};e.AMT_MessageLog_CancelIteration=function(a,b){e.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:a},b)};e.AMT_MessageLog_RequestStateChange=function(a,b,c){e.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_MessageLog_ClearLog=function(a){e.Exec("AMT_MessageLog","ClearLog",{},a)};e.AMT_MessageLog_GetRecords=function(a,b,c,p){e.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:a,MaxReadRecords:b},c,p)};e.AMT_MessageLog_GetRecord=function(a,
b,c){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};e.AMT_MessageLog_PositionAtRecord=function(a,b,c,p){e.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},p)};e.AMT_MessageLog_PositionToFirstRecord=function(a,b){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};e.AMT_MessageLog_FreezeLog=function(a,b){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};e.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){e.Exec("AMT_PublicKeyManagementService",
"AddCRL",{Url:a,SerialNumbers:b},c)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){e.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};e.AMT_PublicKeyManagementService_AddKey=
function(a,b){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},p)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,p){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},p)};e.AMT_PublicKeyManagementService_GenerateKeyPair=
function(a,b,c){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};e.AMT_RedirectionService_RequestStateChange=function(a,b){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};e.AMT_RedirectionService_TerminateSession=function(a,b){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};e.AMT_RemoteAccessService_AddMpServer=function(a,b,c,p,d,h,k,m,g){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b,
Port:c,AuthMethod:p,Certificate:d,Username:h,Password:k,CN:m},g)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,p,d,h){e.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:p,InternalMpServer:d},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){e.Exec("AMT_SetupAndConfigurationService",
2022-03-23 21:00:41 +03:00
"CommitChanges",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)};
e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService",
"GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout=
function(a){e.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};e.AMT_SystemDefensePolicy_SetTimeout=function(a,b){e.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:a},b)};e.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,p,d,h){e.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,p,d,h)};e.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){e.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};e.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=
function(a,b){e.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};e.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(a,b,c,p,d){e.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},p,d)};e.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){e.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_WebUIService_RequestStateChange=function(a,b,c){e.Exec("AMT_WebUIService",
"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,p,d,h){e.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},h)};e.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,p,d,h){e.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,
IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},h)};e.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:a},b)};e.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,b){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},b)};e.CIM_Account_RequestStateChange=function(a,b,c){e.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},
c)};e.CIM_AccountManagementService_CreateAccount=function(a,b,c){e.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:b},c)};e.CIM_BootConfigSetting_ChangeBootOrder=function(a,b){e.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},b)};e.CIM_BootService_SetBootConfigRole=function(a,b,c){e.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:b},c,0,1)};e.CIM_BootService_RequestStateChange=function(a,b,c,p){e.Exec("CIM_BootService","RequestStateChange",
{RequestedState:a,TimeoutPeriod:b},c,p,1)};e.CIM_Card_ConnectorPower=function(a,b,c){e.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:b},c)};e.CIM_Card_IsCompatible=function(a,b){e.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},b)};e.CIM_Chassis_IsCompatible=function(a,b){e.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},b)};e.CIM_Fan_SetSpeed=function(a,b){e.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},b)};e.CIM_KVMRedirectionSAP_RequestStateChange=function(a,b,c){e.Exec("CIM_KVMRedirectionSAP",
"RequestStateChange",{RequestedState:a},c)};e.CIM_MediaAccessDevice_LockMedia=function(a,b){e.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},b)};e.CIM_MediaAccessDevice_SetPowerState=function(a,b,c){e.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_MediaAccessDevice_Reset=function(a){e.Exec("CIM_MediaAccessDevice","Reset",{},a)};e.CIM_MediaAccessDevice_EnableDevice=function(a,b){e.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:a},b)};e.CIM_MediaAccessDevice_OnlineDevice=
function(a,b){e.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:a},b)};e.CIM_MediaAccessDevice_QuiesceDevice=function(a,b){e.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:a},b)};e.CIM_MediaAccessDevice_SaveProperties=function(a){e.Exec("CIM_MediaAccessDevice","SaveProperties",{},a)};e.CIM_MediaAccessDevice_RestoreProperties=function(a){e.Exec("CIM_MediaAccessDevice","RestoreProperties",{},a)};e.CIM_MediaAccessDevice_RequestStateChange=function(a,b,c){e.Exec("CIM_MediaAccessDevice","RequestStateChange",
{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_PhysicalFrame_IsCompatible=function(a,b){e.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:a},b)};e.CIM_PhysicalPackage_IsCompatible=function(a,b){e.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:a},b)};e.CIM_PowerManagementService_RequestPowerStateChange=function(a,b,c,p,d){e.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.CIM_PowerSupply_SetPowerState=function(a,
b,c){e.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_PowerSupply_Reset=function(a){e.Exec("CIM_PowerSupply","Reset",{},a)};e.CIM_PowerSupply_EnableDevice=function(a,b){e.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},b)};e.CIM_PowerSupply_OnlineDevice=function(a,b){e.Exec("CIM_PowerSupply","OnlineDevice",{Online:a},b)};e.CIM_PowerSupply_QuiesceDevice=function(a,b){e.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:a},b)};e.CIM_PowerSupply_SaveProperties=function(a){e.Exec("CIM_PowerSupply",
"SaveProperties",{},a)};e.CIM_PowerSupply_RestoreProperties=function(a){e.Exec("CIM_PowerSupply","RestoreProperties",{},a)};e.CIM_PowerSupply_RequestStateChange=function(a,b,c){e.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_Processor_SetPowerState=function(a,b,c){e.Exec("CIM_Processor","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Processor_Reset=function(a){e.Exec("CIM_Processor","Reset",{},a)};e.CIM_Processor_EnableDevice=function(a,b){e.Exec("CIM_Processor",
"EnableDevice",{Enabled:a},b)};e.CIM_Processor_OnlineDevice=function(a,b){e.Exec("CIM_Processor","OnlineDevice",{Online:a},b)};e.CIM_Processor_QuiesceDevice=function(a,b){e.Exec("CIM_Processor","QuiesceDevice",{Quiesce:a},b)};e.CIM_Processor_SaveProperties=function(a){e.Exec("CIM_Processor","SaveProperties",{},a)};e.CIM_Processor_RestoreProperties=function(a){e.Exec("CIM_Processor","RestoreProperties",{},a)};e.CIM_Processor_RequestStateChange=function(a,b,c){e.Exec("CIM_Processor","RequestStateChange",
{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_RecordLog_ClearLog=function(a){e.Exec("CIM_RecordLog","ClearLog",{},a)};e.CIM_RecordLog_RequestStateChange=function(a,b,c){e.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_RedirectionService_RequestStateChange=function(a,b,c){e.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_Sensor_SetPowerState=function(a,b,c){e.Exec("CIM_Sensor","SetPowerState",{PowerState:a,Time:b},
c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sensor_EnableDevice=function(a,b){e.Exec("CIM_Sensor","EnableDevice",{Enabled:a},b)};e.CIM_Sensor_OnlineDevice=function(a,b){e.Exec("CIM_Sensor","OnlineDevice",{Online:a},b)};e.CIM_Sensor_QuiesceDevice=function(a,b){e.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:a},b)};e.CIM_Sensor_SaveProperties=function(a){e.Exec("CIM_Sensor","SaveProperties",{},a)};e.CIM_Sensor_RestoreProperties=function(a){e.Exec("CIM_Sensor","RestoreProperties",
{},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog",
"Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange=
function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a,
b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,k){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,
NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin=
2022-03-23 21:00:41 +03:00
function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData",
"DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService",
"StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange=
function(a,b,c){e.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_ProvisioningRecordLog_ClearLog=function(a,b){e.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};e.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){e.Exec("IPS_ScreenConfigurationService","SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};e.IPS_SecIOService_RequestStateChange=function(a,b,c){e.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,
TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p,d){e.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:b,Port:c,NetworkDnsSuffix:p},d)};e.AmtStatusToStr=function(a){return e.AmtStatusCodes[a]?e.AmtStatusCodes[a]:"UNKNOWN_ERROR"};e.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",
2022-03-23 21:00:41 +03:00
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"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n,
[a,b,[]])};var D="N\u00e3o especificado. ; Nenhuma mem\u00f3ria do sistema est\u00e1 fisicamente instalada no sistema. ; Nenhuma mem\u00f3ria utiliz\u00e1vel do sistema, toda a mem\u00f3ria instalada sofreu uma falha irrecuper\u00e1vel. ; Falha irrecuper\u00e1vel no disco r\u00edgido / dispositivo ATAPI / IDE. ; Falha irrecuper\u00e1vel na placa do sistema. ; Disquete irrecuper\u00e1vel falha no subsistema. ; Falha irrecuper\u00e1vel no controlador de disco r\u00edgido. ; Falha irrecuper\u00e1vel no teclado PS / 2 ou USB. ; M\u00eddia de inicializa\u00e7\u00e3o remov\u00edvel n\u00e3o encontrada. ; Falha irrecuper\u00e1vel no controlador de v\u00eddeo. ; Nenhum dispositivo de v\u00eddeo detectado. ; Detectada corrup\u00e7\u00e3o de ROM de firmware (BIOS). ; Incompatibilidade de tens\u00e3o da CPU (processadores que compartilham a mesma fonte t\u00eam requisitos de tens\u00e3o incompat\u00edveis) ; Falha na correspond\u00eancia da velocidade da CPU".split(";"),
m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"),
k="N\u00e3o especificado ; Outros ; Desconhecido ; Processador ; Disco ; Perif\u00e9rico ; M\u00f3dulo de gerenciamento do sistema ; Placa do sistema ; M\u00f3dulo de mem\u00f3ria ; M\u00f3dulo do processador ; Fonte de alimenta\u00e7\u00e3o ; Fonte de alimenta\u00e7\u00e3o ; Adicione um cart\u00e3o ; Placa do painel frontal ; Placa do painel traseiro ; Placa do painel traseiro ; Placa do sistema de energia ; Placa de acionamento ; Painel traseiro da unidade ; Expans\u00e3o interna do sistema placa ; Outra placa de sistema ; Placa processadora ; Unidade de pot\u00eancia ; M\u00f3dulo de pot\u00eancia ; Placa de gerenciamento de energia ; Placa do painel traseiro do chassi ; Chassis do sistema ; Sub-chassi ; Outra placa do chassi ; Compartimento de unidades de disco ; Compartimento de perif\u00e9ricos ; Compartimento de dispositivos ; Compartimento de refrigera\u00e7\u00e3o ; Ventilador ; Unidade de refrigera\u00e7\u00e3o ; Interconex\u00e3o por cabo ; Dispositivo de mem\u00f3ria ; Software de gerenciamento do sistema ; BIOS ; Intel (r) ME ; Barramento do sistema ; Grupo ; Intel (r) ME ; Ambiente externo ; Bateria ; L\u00e2mina de processamento ; Interruptor de conectividade ; Interruptor de conectividade ; Processador / m\u00f3dulo de mem\u00f3ria ; M\u00f3dulo de E / S ; M\u00f3dulo de E / S do processador ; Firmware do controlador de gerenciamento ; Canal IPMI ; Barramento PCI ; Barramento PCI Express ; Barramento SCSI ; Barramento SATA / SAS ; Barramento frontal do processador".split(";");
2022-03-23 21:00:41 +03:00
e.RealmNames=";; Redirecionamento ;; Ativo de hardware ; Controle remoto ; Armazenamento ; Gerenciador de eventos ; Administrador de armazenamento ; Presen\u00e7a local do agente ; Presen\u00e7a remota do agente ; Disjuntor ; Tempo de rede ; Informa\u00e7\u00f5es gerais ; Atualiza\u00e7\u00e3o de firmware ; EIT ; LocalUN ; Endpoint Access Control ; Endpoint Access Control Admin ; Leitor de log de eventos ; Log de auditoria ; Regi\u00e3o da ACL ;;; Sistema local".split(";");e.WatchdogCurrentStates=
{1:"n\u00e3o foi iniciado",2:"Parado",4:"Corrida",8:"Expirado",16:"Suspenso"};var h="Boot parameters received from CSME;CSME Boot Option % added successfully;HTTPS URI name resolved;HTTPS connected successfully;HTTPSBoot download is completed;Attempt to boot;Exit boot services".split(";"),r=";No network connection available;Name resolution of URI failed;Connect to URI failed;OEM app not found at local URI;HTTPS TLS Auth failed;HTTPS Digest Auth failed;Verified boot failed (bad image);HTTPS Boot File not found".split(";"),
K={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},B={16:"Admin de seguran\u00e7a",17:"RCO",18:"Gerenciador de redirecionamento",19:"Gerenciador de Atualiza\u00e7\u00e3o de Firmware",20:"Log de auditoria de seguran\u00e7a",21:"Hora da rede",22:"Administra\u00e7\u00e3o de rede",23:"Administra\u00e7\u00e3o de armazenamento",24:"Gerente de eventos",25:"Gerente do disjuntor",26:"Gerenciador de presen\u00e7a do agente",27:"Configura\u00e7\u00e3o sem fio",28:"EAC",29:"KVM",30:"Eventos de aceita\u00e7\u00e3o do usu\u00e1rio",
32:"Tela em branco",33:"Eventos Watchdog",1600:"Aprovisionamento iniciado",1601:"Aprovisionamento conclu\u00eddo",1602:"Entrada ACL adicionada",1603:"Entrada da ACL modificada",1604:"Entrada da ACL removida",1605:"Acesso ACL com credenciais inv\u00e1lidas",1606:"Estado de entrada da ACL",1607:"Estado do TLS alterado",1608:"Conjunto de certificados do servidor TLS",1609:"Remover certificado de servidor TLS",1610:"Adicionado certificado raiz confi\u00e1vel TLS",1611:"Certificado raiz confi\u00e1vel TLS removido",
1612:"Conjunto de chaves pr\u00e9-compartilhadas TLS",1613:"Configura\u00e7\u00f5es do Kerberos modificadas",1614:"Chave principal do Kerberos modificada",1615:"Redefini\u00e7\u00e3o de contadores de desgaste do flash",1616:"Pacote de energia modificado",1617:"Definir modo de autentica\u00e7\u00e3o de regi\u00e3o",1618:"Atualizar cliente para o modo de controle de administrador",1619:"Desprovisionamento iniciado",1700:"Power Up realizado",1701:"Desativa\u00e7\u00e3o realizada",1702:"Ciclo de energia realizado",
1703:"Reset realizado",1704:"Definir op\u00e7\u00f5es de inicializa\u00e7\u00e3o",1705:"Remote graceful power down initiated",1706:"Remote graceful reset initiated",1707:"Remote Standby initiated",1708:"Remote Hiberate initiated",1709:"Remote NMI initiated",1800:"Sess\u00e3o IDER aberta",1801:"Sess\u00e3o IDER encerrada",1802:"IDER ativado",1803:"IDER desativado",1804:"Sess\u00e3o SoL aberta",1805:"Sess\u00e3o SoL Encerrada",1806:"SoL ativado",1807:"SoL desativado",1808:"Sess\u00e3o KVM iniciada",
1809:"Sess\u00e3o KVM encerrada",1810:"KVM ativado",1811:"KVM desativado",1812:"Senha do VNC falhou 3 vezes",1900:"Firmware Atualizado",1901:"Falha na atualiza\u00e7\u00e3o do firmware",2E3:"Log de auditoria de seguran\u00e7a limpo",2001:"Diretiva de auditoria de seguran\u00e7a modificada",2002:"Log de auditoria de seguran\u00e7a desativado",2003:"Log de auditoria de seguran\u00e7a ativado",2004:"Log de auditoria de seguran\u00e7a exportado",2005:"Log de auditoria de seguran\u00e7a recuperado",2100:"Conjunto de horas do Intel&reg; ME",
2200:"Conjunto de par\u00e2metros TCPIP",2201:"Conjunto de nomes de host",2202:"Conjunto de nomes de dom\u00ednio",2203:"Conjunto de par\u00e2metros da VLAN",2204:"Conjunto de Pol\u00edticas de Link",2205:"Conjunto de par\u00e2metros IPv6",2300:"Conjunto de atributos de armazenamento global",2301:"EACL de armazenamento modificado",2302:"FPACL de armazenamento modificado",2303:"Opera\u00e7\u00e3o de grava\u00e7\u00e3o de armazenamento",2400:"Alerta Inscrito",2401:"Alerta cancelado",2402:"Log de eventos limpo",
2403:"Log de eventos congelado",2500:"CB Filter Added",2501:"Filtro CB removido",2502:"CB Policy Added",2503:"Pol\u00edtica de CB removida",2504:"Conjunto de pol\u00edticas padr\u00e3o do CB",2505:"Conjunto de op\u00e7\u00f5es de CB Heuristics",2506:"CB Heuristics State Cleared",2600:"Agent Watchdog Adicionado",2601:"C\u00e3o de guarda do agente removido",2602:"Conjunto de a\u00e7\u00f5es do agente de vigil\u00e2ncia",2700:"Wireless Profile Added",2701:"Perfil sem fio removido",2702:"Perfil sem fio atualizado",
2703:"An existing profile sync was modified",2704:"An existing profile link preference was changed",2705:"Wireless profile share with UEFI enabled setting was changed",2800:"EAC Posture Signer SET",2801:"EAC ativado",2802:"EAC desativado",2803:"Estado da postura da EAC",2804:"Op\u00e7\u00f5es de conjunto de EAC",2900:"Ativa\u00e7\u00e3o KVM ativada",2901:"Desativa\u00e7\u00e3o da KVM desativada",2902:"Senha KVM alterada",2903:"Consentimento da KVM com \u00eaxito",2904:"Falha no consentimento da KVM",
2022-03-23 21:00:41 +03:00
3E3:"Altera\u00e7\u00e3o da pol\u00edtica de aceita\u00e7\u00e3o",3001:"Enviar evento de c\u00f3digo de consentimento",3002:"Iniciar evento bloqueado de aceita\u00e7\u00e3o",3301:"A user has modified the Watchdog Action settings",3302:"A user has modified a Watchdog to add, remove, or alter the Watchdog Action connected to it"};e.GetAuditLogExtendedDataStr=function(a,b){if((1602==a||1604==a)&&0==b.charCodeAt(0))return b.substring(2,2+b.charCodeAt(1));if(1603==a)return 0==b.charCodeAt(1)?b.substring(3):
null;if(1605==a)return["Acesso ME inv\u00e1lido","Acesso MEBx inv\u00e1lido"][b.charCodeAt(0)];if(1606==a){var c=["Desativado","ativado"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=","+b.substring(3));return c}return 1607==a?"Controlo remoto"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Local"+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(b,0)]+","+["NoAuth","Auth","Desativado"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","MEI local","WSMAN local","WSAMN remoto"][b.charCodeAt(0)]:
1900==a?"De"+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" para"+ReadShort(b,8)+"."+ReadShort(b,10)+"."+ReadShort(b,12)+"."+ReadShort(b,14):2100==a?(c=new Date,c.setTime(1E3*ReadInt(b,0)+6E4*(new Date).getTimezoneOffset()),c.toLocaleString()):3E3==a?"De"+["Nenhum","KVM","Todos"][b.charCodeAt(0)]+" para"+["Nenhum","KVM","Todos"][b.charCodeAt(1)]:3001==a?["Sucesso","Falhou 3 vezes"][b.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,q,[a,[]])};
2022-03-23 21:00:41 +03:00
return e}function hex_md5(b){null==b&&(b="");return forge.md.md5.create().update(b).digest().toHex()}function rstr_md5(b){return hex2rstr(hex_md5(b))}function execArgumentsToXml(b){if(void 0===b||null===b)return null;var c="",a;for(a in b){var d=b[a];d&&(c="reference"===d.__parameterType?c+referenceToXml(a,d):c+instanceToXml(a,d))}return c}
function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__namespace,d=a?"<q:":"<",g=a?"</q:":"</",a="<r:"+b+(a?' xmlns:q="'+c.__namespace+'"':"")+">",v;for(v in c)c.hasOwnProperty(v)&&0!==v.indexOf("__")&&("function"===typeof c[v]||Array.isArray(c[v])||("object"===typeof c[v]?console.error("only convert one level down..."):a+=d+v+">"+c[v].toString()+g+v+">"));return a+("</r:"+b+">")}
function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+c.__resourceUri+"</w:ResourceURI><w:SelectorSet>",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+='<w:Selector Name="'+d+'">'+c[d].toString()+"</w:Selector>"));return a+("</w:SelectorSet></a:ReferenceParameters></r:"+b+">")}
function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;a<b.length/4;a++)c+="-"+ReadIntX(b,4*a);return c}
function GetSidByteArray(b){if(!b||null==b)return null;b=b.split("-");if(4>b.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;c<b.length;c++){var a=parseInt(b[c]);if(a!=b[c])return null;b[c]=a}a=String.fromCharCode(b[1])+String.fromCharCode(b.length-3)+ShortToStr(Math.floor(b[2]/Math.pow(2,32)))+IntToStr(b[2]&65535);for(c=3;c<b.length;c++)a+=IntToStrX(b[c]);return a}
(function(b,c){"function"===typeof define&&define.amd?define([],c):b.forge=c()})(this,function(){var b,c,a;(function(d){function g(a,b){var c,p,e,d,x,h,k,m,g,q=b&&b.split("/"),w=r.map,l=w&&w["*"]||{};if(a&&"."===a.charAt(0))if(b){q=q.slice(0,q.length-1);a=a.split("/");x=a.length-1;r.nodeIdCompat&&A.test(a[x])&&(a[x]=a[x].replace(A,""));a=q.concat(a);for(x=0;x<a.length;x+=1)if(c=a[x],"."===c)a.splice(x,1),--x;else if(".."===c)if(1!==x||".."!==a[2]&&".."!==a[0])0<x&&(a.splice(x-1,2),x-=2);else break;
a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((q||l)&&w){c=a.split("/");for(x=c.length;0<x;--x){p=c.slice(0,x).join("/");if(q)for(g=q.length;0<g;--g)if(e=w[q.slice(0,g).join("/")])if(e=e[p]){d=e;h=x;break}if(d)break;!k&&l&&l[p]&&(k=l[p],m=x)}!d&&k&&(d=k,h=m);d&&(c.splice(0,h,d),a=c.join("/"))}return a}function v(a,b){return function(){return w.apply(d,x.call(arguments,0).concat([a,b]))}}function n(a){return function(b){return g(b,a)}}function l(a){return function(b){k[a]=b}}function p(a){if(B.call(h,
a)){var b=h[a];delete h[a];K[a]=!0;C.apply(d,b)}if(!B.call(k,a)&&!B.call(K,a))throw Error("No "+a);return k[a]}function q(a){var b,c=a?a.indexOf("!"):-1;-1<c&&(b=a.substring(0,c),a=a.substring(c+1,a.length));return[b,a]}function e(a){return function(){return r&&r.config&&r.config[a]||{}}}var C,w,D,m,k={},h={},r={},K={},B=Object.prototype.hasOwnProperty,x=[].slice,A=/\.js$/;D=function(a,b){var c,d=q(a),e=d[0];a=d[1];e&&(e=g(e,b),c=p(e));e?a=c&&c.normalize?c.normalize(a,n(b)):g(a,b):(a=g(a,b),d=q(a),
e=d[0],a=d[1],e&&(c=p(e)));return{f:e?e+"!"+a:a,n:a,pr:e,p:c}};m={require:function(a){return v(a)},exports:function(a){var b=k[a];return"undefined"!==typeof b?b:k[a]={}},module:function(a){return{id:a,uri:"",exports:k[a],config:e(a)}}};C=function(a,b,c,e){var x,g,A,r,q=[];g=typeof c;var w;e=e||a;if("undefined"===g||"function"===g){b=!b.length&&c.length?["require","exports","module"]:b;for(r=0;r<b.length;r+=1)if(A=D(b[r],e),g=A.f,"require"===g)q[r]=m.require(a);else if("exports"===g)q[r]=m.exports(a),
w=!0;else if("module"===g)x=q[r]=m.module(a);else if(B.call(k,g)||B.call(h,g)||B.call(K,g))q[r]=p(g);else if(A.p)A.p.load(A.n,v(e,!0),l(g),{}),q[r]=k[g];else throw Error(a+" missing "+g);b=c?c.apply(k[a],q):void 0;a&&(x&&x.exports!==d&&x.exports!==k[a]?k[a]=x.exports:b===d&&w||(k[a]=b))}else a&&(k[a]=c)};b=c=w=function(a,b,c,e,x){if("string"===typeof a)return m[a]?m[a](b):p(D(a,b).f);if(!a.splice){r=a;r.deps&&w(r.deps,r.callback);if(!b)return;b.splice?(a=b,b=c,c=null):a=d}b=b||function(){};"function"===
typeof c&&(c=e,e=x);e?C(d,a,b,c):setTimeout(function(){C(d,a,b,c)},4);return w};w.config=function(a){return w(a)};b._defined=k;a=function(a,b,c){b.splice||(c=b,b=[]);B.call(k,a)||B.call(h,a)||(h[a]=[a,b,c])};a.amd={jQuery:!0}})();a("node_modules/almond/almond",function(){});(function(){function b(a){function c(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(e.isArrayBuffer(a)||e.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(b){for(var p=
2022-03-23 21:00:41 +03:00
0;p<a.length;++p)this.putByte(a[p])}}else if(a instanceof c||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var e=a.util=a.util||{};(function(){if("undefined"!==typeof process&&process.nextTick)e.nextTick=process.nextTick,e.setImmediate="function"===typeof setImmediate?setImmediate:e.nextTick;else if("function"===typeof setImmediate)e.setImmediate=setImmediate,e.nextTick=function(a){return setImmediate(a)};
else{e.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];e.setImmediate=function(b){a.push(b);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(b){b.source===window&&"forge.setImmediate"===b.data&&(b.stopPropagation(),b=a.slice(),a.length=0,b.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var b=Date.now(),c=!0,p=document.createElement("div"),a=[];
(new MutationObserver(function(){var b=a.slice();a.length=0;b.forEach(function(a){a()})})).observe(p,{attributes:!0});var d=e.setImmediate;e.setImmediate=function(e){15<Date.now()-b?(b=Date.now(),d(e)):(a.push(e),1===a.length&&p.setAttribute("a",c=!c))}}e.nextTick=e.setImmediate}})();e.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};e.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};e.isArrayBufferView=function(a){return a&&
e.isArrayBuffer(a.buffer)&&void 0!==a.byteLength};e.ByteBuffer=c;e.ByteStringBuffer=c;e.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a;4096<this._constructedStringLength&&(this.data.substr(0,1),this._constructedStringLength=0)};e.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};e.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()};e.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))};
e.ByteStringBuffer.prototype.fillWithByte=function(a,b){a=String.fromCharCode(a);for(var c=this.data;0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);this.data=c;this._optimizeConstructedString(b);return this};e.ByteStringBuffer.prototype.putBytes=function(a){this.data+=a;this._optimizeConstructedString(a.length);return this};e.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(e.encodeUtf8(a))};e.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&
255)+String.fromCharCode(a&255))};e.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};e.ByteStringBuffer.prototype.putInt32=function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};e.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>
8&255))};e.ByteStringBuffer.prototype.putInt24Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255))};e.ByteStringBuffer.prototype.putInt32Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>24&255))};e.ByteStringBuffer.prototype.putInt=function(a,b){var c="";do b-=8,c+=String.fromCharCode(a>>b&255);while(0<b);return this.putBytes(c)};
e.ByteStringBuffer.prototype.putSignedInt=function(a,b){0>a&&(a+=2<<b-1);return this.putInt(a,b)};e.ByteStringBuffer.prototype.putBuffer=function(a){return this.putBytes(a.getBytes())};e.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};e.ByteStringBuffer.prototype.getInt16=function(){var a=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);this.read+=2;return a};e.ByteStringBuffer.prototype.getInt24=function(){var a=this.data.charCodeAt(this.read)<<
16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);this.read+=3;return a};e.ByteStringBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);this.read+=4;return a};e.ByteStringBuffer.prototype.getInt16Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;this.read+=2;return a};e.ByteStringBuffer.prototype.getInt24Le=
function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;this.read+=3;return a};e.ByteStringBuffer.prototype.getInt32Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;this.read+=4;return a};e.ByteStringBuffer.prototype.getInt=function(a){var b=0;do b=(b<<8)+this.data.charCodeAt(this.read++),a-=8;while(0<a);return b};e.ByteStringBuffer.prototype.getSignedInt=
function(a){var b=this.getInt(a);a=2<<a-2;b>=a&&(b-=a<<1);return b};e.ByteStringBuffer.prototype.getBytes=function(a){var b;a?(a=Math.min(this.length(),a),b=this.data.slice(this.read,this.read+a),this.read+=a):0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear());return b};e.ByteStringBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};e.ByteStringBuffer.prototype.at=function(a){return this.data.charCodeAt(this.read+
a)};e.ByteStringBuffer.prototype.setAt=function(a,b){this.data=this.data.substr(0,this.read+a)+String.fromCharCode(b)+this.data.substr(this.read+a+1);return this};e.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};e.ByteStringBuffer.prototype.copy=function(){var a=e.createBuffer(this.data);a.read=this.read;return a};e.ByteStringBuffer.prototype.compact=function(){0<this.read&&(this.data=this.data.slice(this.read),this.read=0);return this};e.ByteStringBuffer.prototype.clear=
function(){this.data="";this.read=0;return this};e.ByteStringBuffer.prototype.truncate=function(a){a=Math.max(0,this.length()-a);this.data=this.data.substr(this.read,a);this.read=0;return this};e.ByteStringBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.length;++b){var c=this.data.charCodeAt(b);16>c&&(a+="0");a+=c.toString(16)}return a};e.ByteStringBuffer.prototype.toString=function(){return e.decodeUtf8(this.bytes())};e.DataBuffer=function(a,b){b=b||{};this.read=b.readOffset||
0;this.growSize=b.growSize||1024;var c=e.isArrayBuffer(a),p=e.isArrayBufferView(a);c||p?(this.data=c?new DataView(a):new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in b?b.writeOffset:this.data.byteLength):(this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==a&&void 0!==a&&this.putBytes(a),"writeOffset"in b&&(this.write=b.writeOffset))};e.DataBuffer.prototype.length=function(){return this.write-this.read};e.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()};
e.DataBuffer.prototype.accommodate=function(a,b){if(this.length()>=a)return this;b=Math.max(b||this.growSize,a);var c=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),p=new Uint8Array(this.length()+b);p.set(c);this.data=new DataView(p.buffer);return this};e.DataBuffer.prototype.putByte=function(a){this.accommodate(1);this.data.setUint8(this.write++,a);return this};e.DataBuffer.prototype.fillWithByte=function(a,b){this.accommodate(b);for(var c=0;c<b;++c)this.data.setUint8(a);
return this};e.DataBuffer.prototype.putBytes=function(a,b){if(e.isArrayBufferView(a)){var c=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),p=c.byteLength-c.byteOffset;this.accommodate(p);var d=new Uint8Array(this.data.buffer,this.write);d.set(c);this.write+=p;return this}if(e.isArrayBuffer(a))return c=new Uint8Array(a),this.accommodate(c.byteLength),d=new Uint8Array(this.data.buffer),d.set(c,this.write),this.write+=c.byteLength,this;if(a instanceof e.DataBuffer||"object"===typeof a&&"number"===
typeof a.read&&"number"===typeof a.write&&e.isArrayBufferView(a.data))return c=new Uint8Array(a.data.byteLength,a.read,a.length()),this.accommodate(c.byteLength),d=new Uint8Array(a.data.byteLength,this.write),d.set(c),this.write+=c.byteLength,this;a instanceof e.ByteStringBuffer&&(a=a.data,b="binary");b=b||"binary";if("string"===typeof a){if("hex"===b)return this.accommodate(Math.ceil(a.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=e.binary.hex.decode(a,c,this.write),this;if("base64"===
b)return this.accommodate(3*Math.ceil(a.length/4)),c=new Uint8Array(this.data.buffer,this.write),this.write+=e.binary.base64.decode(a,c,this.write),this;"utf8"===b&&(a=e.encodeUtf8(a),b="binary");if("binary"===b||"raw"===b)return this.accommodate(a.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=e.binary.raw.decode(c),this;if("utf16"===b)return this.accommodate(2*a.length),c=new Uint16Array(this.data.buffer,this.write),this.write+=e.text.utf16.encode(c),this;throw Error("Invalid encoding: "+
b);}throw Error("Invalid parameter: "+a);};e.DataBuffer.prototype.putBuffer=function(a){this.putBytes(a);a.clear();return this};e.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")};e.DataBuffer.prototype.putInt16=function(a){this.accommodate(2);this.data.setInt16(this.write,a);this.write+=2;return this};e.DataBuffer.prototype.putInt24=function(a){this.accommodate(3);this.data.setInt16(this.write,a>>8&65535);this.data.setInt8(this.write,a>>16&255);this.write+=3;return this};
e.DataBuffer.prototype.putInt32=function(a){this.accommodate(4);this.data.setInt32(this.write,a);this.write+=4;return this};e.DataBuffer.prototype.putInt16Le=function(a){this.accommodate(2);this.data.setInt16(this.write,a,!0);this.write+=2;return this};e.DataBuffer.prototype.putInt24Le=function(a){this.accommodate(3);this.data.setInt8(this.write,a>>16&255);this.data.setInt16(this.write,a>>8&65535,!0);this.write+=3;return this};e.DataBuffer.prototype.putInt32Le=function(a){this.accommodate(4);this.data.setInt32(this.write,
a,!0);this.write+=4;return this};e.DataBuffer.prototype.putInt=function(a,b){this.accommodate(b/8);do b-=8,this.data.setInt8(this.write++,a>>b&255);while(0<b);return this};e.DataBuffer.prototype.putSignedInt=function(a,b){this.accommodate(b/8);0>a&&(a+=2<<b-1);return this.putInt(a,b)};e.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};e.DataBuffer.prototype.getInt16=function(){var a=this.data.getInt16(this.read);this.read+=2;return a};e.DataBuffer.prototype.getInt24=
function(){var a=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);this.read+=3;return a};e.DataBuffer.prototype.getInt32=function(){var a=this.data.getInt32(this.read);this.read+=4;return a};e.DataBuffer.prototype.getInt16Le=function(){var a=this.data.getInt16(this.read,!0);this.read+=2;return a};e.DataBuffer.prototype.getInt24Le=function(){var a=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;this.read+=3;return a};e.DataBuffer.prototype.getInt32Le=function(){var a=
this.data.getInt32(this.read,!0);this.read+=4;return a};e.DataBuffer.prototype.getInt=function(a){var b=0;do b=(b<<8)+this.data.getInt8(this.read++),a-=8;while(0<a);return b};e.DataBuffer.prototype.getSignedInt=function(a){var b=this.getInt(a);a=2<<a-2;b>=a&&(b-=a<<1);return b};e.DataBuffer.prototype.getBytes=function(a){var b;a?(a=Math.min(this.length(),a),b=this.data.slice(this.read,this.read+a),this.read+=a):0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear());return b};
e.DataBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};e.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)};e.DataBuffer.prototype.setAt=function(a,b){this.data.setUint8(a,b);return this};e.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};e.DataBuffer.prototype.copy=function(){return new e.DataBuffer(this)};e.DataBuffer.prototype.compact=function(){if(0<this.read){var a=
new Uint8Array(this.data.buffer,this.read),b=new Uint8Array(a.byteLength);b.set(a);this.data=new DataView(b);this.write-=this.read;this.read=0}return this};e.DataBuffer.prototype.clear=function(){this.data=new DataView(new ArrayBuffer(0));this.read=this.write=0;return this};e.DataBuffer.prototype.truncate=function(a){this.write=Math.max(0,this.length()-a);this.read=Math.min(this.read,this.write);return this};e.DataBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.byteLength;++b){var c=
this.data.getUint8(b);16>c&&(a+="0");a+=c.toString(16)}return a};e.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return e.binary.raw.encode(b);if("hex"===a)return e.binary.hex.encode(b);if("base64"===a)return e.binary.base64.encode(b);if("utf8"===a)return e.text.utf8.decode(b);if("utf16"===a)return e.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};e.createBuffer=function(a,b){void 0!==a&&"utf8"===
(b||"raw")&&(a=e.encodeUtf8(a));return new e.ByteBuffer(a)};e.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};e.xorBytes=function(a,b,c){for(var p="",e="",d="",h=0,k=0;0<c;--c,++h)e=a.charCodeAt(h)^b.charCodeAt(h),10<=k&&(p+=d,d="",k=0),d+=String.fromCharCode(e),++k;return p+d};e.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};e.bytesToHex=
function(a){return e.createBuffer(a).toHex()};e.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var d=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];e.encode64=function(a,b){for(var c="",p="",e,d,h,k=0;k<a.length;)e=
a.charCodeAt(k++),d=a.charCodeAt(k++),h=a.charCodeAt(k++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,b)+"\r\n",c=c.substr(b));return p+
c};e.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,p,e,h,k=0;k<a.length;)c=d[a.charCodeAt(k++)-43],p=d[a.charCodeAt(k++)-43],e=d[a.charCodeAt(k++)-43],h=d[a.charCodeAt(k++)-43],b+=String.fromCharCode(c<<2|p>>4),64!==e&&(b+=String.fromCharCode((p&15)<<4|e>>2),64!==h&&(b+=String.fromCharCode((e&3)<<6|h)));return b};e.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};e.decodeUtf8=function(a){return decodeURIComponent(escape(a))};e.binary={raw:{},hex:{},base64:{}};
2022-03-23 21:00:41 +03:00
e.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};e.binary.raw.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(a.length));for(var e=c=c||0,d=0;d<a.length;++d)p[e++]=a.charCodeAt(d);return b?e-c:p};e.binary.hex.encode=e.bytesToHex;e.binary.hex.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var e=0,d=c;a.length&1&&(e=1,p[d++]=parseInt(a[0],16));for(;e<a.length;e+=2)p[d++]=parseInt(a.substr(e,2),16);return b?d-c:p};e.binary.base64.encode=
function(a,b){for(var c="",p="",e,d,h,k=0;k<a.byteLength;)e=a[k++],d=a[k++],h=a[k++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(p+=c.substr(0,
b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,k,m,g=0,r=c;g<a.length;)e=d[a.charCodeAt(g++)-43],h=d[a.charCodeAt(g++)-43],k=d[a.charCodeAt(g++)-43],m=d[a.charCodeAt(g++)-43],p[r++]=e<<2|h>>4,64!==k&&(p[r++]=(h&15)<<4|k>>2,64!==m&&(p[r++]=(k&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a);
var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h<a.length;++h)p[d++]=a.charCodeAt(h);return b?d-c:p};e.text.utf8.decode=function(a){return e.decodeUtf8(String.fromCharCode.apply(null,a))};e.text.utf16.encode=function(a,b,c){var p=b;p||(p=new Uint8Array(2*a.length));for(var e=new Uint16Array(p.buffer),d=c=c||0,h=c,k=0;k<a.length;++k)e[h++]=a.charCodeAt(k),d+=2;return b?d-c:p};e.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};e.deflate=function(a,
b,c){b=e.decode64(a.deflate(e.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};e.inflate=function(a,b,c){a=a.inflate(e.encode64(b)).rval;return null===a?null:e.decode64(a)};var g=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=e.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},l=function(a,b){if(!a)throw Error("WebStorage not available.");
var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var p=Error(c.error.message);p.id=c.error.id;p.name=c.error.name;throw p;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(e.decode64(c)));return c},m=function(a,b,c,p){var e=l(a,b);null===e&&(e={});e[c]=p;g(a,b,e)},k=function(a,b,c){a=l(a,b);null!==a&&(a=c in a?a[c]:null);return a},h=function(a,b,c){var p=l(a,b);if(null!==p&&c in p){delete p[c];c=!0;for(var e in p){c=!1;break}c&&(p=null);g(a,b,p)}},r=function(a,b){g(a,b,null)},K=function(a,b,
c){var p=null;"undefined"===typeof c&&(c=["web","flash"]);var e,d=!1,h=null,k;for(k in c){e=c[k];try{if("flash"===e||"both"===e){if(null===b[0])throw Error("Flash local storage not available.");p=a.apply(this,b);d="flash"===e}if("web"===e||"both"===e)b[0]=localStorage,p=a.apply(this,b),d=!0}catch(m){h=m}if(d)break}if(!d)throw h;return p};e.setItem=function(a,b,c,p,e){K(m,arguments,e)};e.getItem=function(a,b,c,p){return K(k,arguments,p)};e.removeItem=function(a,b,c,p){K(h,arguments,p)};e.clearItems=
function(a,b,c){K(r,arguments,c)};e.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var B=null;e.getQueryVariables=function(a){var b=function(a){var b=
{};a=a.split("&");for(var c=0;c<a.length;c++){var p=a[c].indexOf("="),e;0<p?(e=a[c].substring(0,p),p=a[c].substring(p+1)):(e=a[c],p=null);e in b||(b[e]=[]);e in Object.prototype||null===p||b[e].push(unescape(p))}return b};"undefined"===typeof a?(null===B&&(B="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=B):a=b(a);return a};e.parseFragment=function(a){var b=a,c="",p=a.indexOf("?");0<p&&(b=a.substring(0,p),c=a.substring(p+1));a=b.split("/");
2022-03-23 21:00:41 +03:00
0<a.length&&""===a[0]&&a.shift();p=""===c?{}:e.getQueryVariables(c);return{pathString:b,queryString:c,path:a,query:p}};e.makeRequest=function(a){var b=e.parseFragment(a),c={path:b.pathString,query:b.queryString,getPath:function(a){return"undefined"===typeof a?b.path:b.path[a]},getQuery:function(a,c){var p;"undefined"===typeof a?p=b.query:(p=b.query[a])&&"undefined"!==typeof c&&(p=p[c]);return p},getQueryLast:function(a,b){var p=c.getQuery(a);return p?p[p.length-1]:b}};return c};e.makeLink=function(a,
b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};e.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var p=0,e=b.length;p<e;){var d=b[p++];if(p==e)a[d]=c;else{var h=d in a;if(!h||h&&"object"!==typeof a[d]||h&&null===a[d])a[d]={};a=a[d]}}};e.getPath=function(a,b,c){for(var p=0,e=b.length,d=!0;d&&p<e&&"object"===typeof a&&null!==a;){var h=b[p++];(d=h in a)&&(a=a[h])}return d?a:c};e.deletePath=function(a,b){if("object"===
typeof a&&null!==a)for(var c=0,p=b.length;c<p;){var e=b[c++];if(c==p)delete a[e];else{if(!(e in a)||"object"!==typeof a[e]||null===a[e])break;a=a[e]}}};e.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};e.format=function(a){var b=/%./g,c,p,e=0,d=[];for(p=0;c=b.exec(a);)switch(p=a.substring(p,b.lastIndex-2),0<p.length&&d.push(p),p=b.lastIndex,c=c[0][1],c){case "s":case "o":e<arguments.length?d.push(arguments[e++ +1]):d.push("<?>");break;case "%":d.push("%");break;default:d.push("<#"+
c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3<d.length?d.length%3:0;return c+(h?d.substr(0,h)+p:"")+d.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+p)+(e?b+Math.abs(a-d).toFixed(e).slice(2):"")};e.formatSize=function(a){return a=1073741824<=a?e.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?e.formatNumber(a/1048576,2,".","")+
" MiB":1024<=a?e.formatNumber(a/1024,0)+" KiB":e.formatNumber(a,0)+" bytes"};e.bytesFromIP=function(a){return-1!==a.indexOf(".")?e.bytesFromIPv4(a):-1!==a.indexOf(":")?e.bytesFromIPv6(a):null};e.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var b=e.createBuffer(),c=0;c<a.length;++c){var p=parseInt(a[c],10);if(isNaN(p))return null;b.putByte(p)}return b.getBytes()};e.bytesFromIPv6=function(a){var b=0;a=a.split(":").filter(function(a){0===a.length&&++b;return!0});for(var c=
2*(8-a.length+b),p=e.createBuffer(),d=0;8>d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};e.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],p=0,d=0;d<a.length;d+=
2){for(var h=e.bytesToHex(a[d]+a[d+1]);"0"===h[0]&&"0"!==h;)h=h.substr(1);if("0"===h){var k=c[c.length-1],m=b.length;k&&m===k.end+1?(k.end=m,k.end-k.start>c[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0<c.length&&(a=c[p],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};e.estimateCores=function(a,b){function c(a,k,m){if(0===k){var g=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);e.cores=
Math.max(1,g);URL.revokeObjectURL(h);return b(null,e.cores)}p(m,function(b,p){a.push(d(m,p));c(a,k-1,m)})}function p(a,b){for(var c=[],d=[],e=0;e<a;++e){var z=new Worker(h);z.addEventListener("message",function(p){d.push(p.data);if(d.length===a){for(p=0;p<a;++p)c[p].terminate();b(null,d)}});c.push(z)}for(e=0;e<a;++e)c[e].postMessage(e)}function d(a,b){for(var c=[],p=0;p<a;++p)for(var e=b[p],h=c[p]=[],z=0;z<a;++z)if(p!==z){var k=b[z];(e.st>k.st&&e.st<k.et||k.st>e.st&&k.st<e.et)&&h.push(z)}return c.reduce(function(a,
2022-03-23 21:00:41 +03:00
b){return Math.max(a,b.length)},0)}"function"===typeof a&&(b=a,a={});a=a||{};if("cores"in e&&!a.update)return b(null,e.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&0<navigator.hardwareConcurrency)return e.cores=navigator.hardwareConcurrency,b(null,e.cores);if("undefined"===typeof Worker)return e.cores=1,b(null,e.cores);if("undefined"===typeof Blob)return e.cores=2,b(null,e.cores);var h=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){a=
Date.now();for(var b=a+4;Date.now()<b;);self.postMessage({st:a,et:b})})}.toString(),")()"],{type:"application/javascript"}));c([],5,16)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.util)return c.util;c.defined.util=!0;for(var q=0;q<g.length;++q)g[q](c);
return c.util}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/util",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.cipher=a.cipher||{};a.cipher.algorithms=a.cipher.algorithms||{};a.cipher.createCipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&
(d=d());if(!d)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:d,key:c,decrypt:!1})};a.cipher.createDecipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&(d=d());if(!d)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:d,key:c,decrypt:!0})};a.cipher.registerAlgorithm=function(b,c){b=b.toUpperCase();a.cipher.algorithms[b]=c};a.cipher.getAlgorithm=function(b){b=b.toUpperCase();return b in a.cipher.algorithms?
a.cipher.algorithms[b]:null};var c=a.cipher.BlockCipher=function(a){this.algorithm=a.algorithm;this.mode=this.algorithm.mode;this.blockSize=this.mode.blockSize;this._finish=!1;this.output=this._input=null;this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt;this._decrypt=a.decrypt;this.algorithm.initialize(a)};c.prototype.start=function(b){b=b||{};var c={},d;for(d in b)c[d]=b[d];c.decrypt=this._decrypt;this._finish=!1;this._input=a.util.createBuffer();this.output=b.output||a.util.createBuffer();
this.mode.start(c)};c.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};c.prototype.finish=function(a){!a||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,b,!0)});var b={};b.decrypt=this._decrypt;b.overflow=this._input.length()%this.blockSize;if(!this._decrypt&&this.mode.pad&&
!this.mode.pad(this._input,b))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b)?!1:!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipher)return c.cipher;
c.defined.cipher=!0;for(var q=0;q<g.length;++q)g[q](c);return c.cipher}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipher",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){"string"===typeof b&&(b=a.util.createBuffer(b));if(a.util.isArray(b)&&
2022-03-23 21:00:41 +03:00
4<b.length){var d=b;b=a.util.createBuffer();for(var e=0;e<d.length;++e)b.putByte(d[e])}a.util.isArray(b)||(b=[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);return b}function d(a){a[a.length-1]=a[a.length-1]+1&4294967295}function g(a){return[a/4294967296|0,a&4294967295]}a.cipher=a.cipher||{};var w=a.cipher.modes=a.cipher.modes||{};w.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
Array(this._ints)};w.ecb.prototype.start=function(a){};w.ecb.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};w.ecb.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,
this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};w.ecb.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};w.ecb.prototype.unpad=function(a,b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};w.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
this._outBlock=Array(this._ints)};w.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=c(a.iv),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};w.cbc.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c]);
this._prev=this._outBlock};w.cbc.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)};w.cbc.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};w.cbc.prototype.unpad=function(a,
b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};w.cfb=function(b){b=b||{};this.name="CFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};w.cfb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=
2022-03-23 21:00:41 +03:00
this._iv.slice(0);this._partialBytes=0};w.cfb.prototype.encrypt=function(a,b,c){var p=a.length();if(0===p)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&p>=this.blockSize)for(var d=0;d<this._ints;++d)this._inBlock[d]=a.getInt32()^this._outBlock[d],b.putInt32(this._inBlock[d]);else{var e=(this.blockSize-p)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(d=0;d<this._ints;++d)this._partialBlock[d]=a.getInt32()^this._outBlock[d],this._partialOutput.putInt32(this._partialBlock[d]);
if(0<e)a.read-=this.blockSize;else for(d=0;d<this._ints;++d)this._inBlock[d]=this._partialBlock[d];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));this._partialBytes=0}};w.cfb.prototype.decrypt=function(a,b,c){var p=a.length();if(0===p)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&
p>=this.blockSize)for(var d=0;d<this._ints;++d)this._inBlock[d]=a.getInt32(),b.putInt32(this._inBlock[d]^this._outBlock[d]);else{var e=(this.blockSize-p)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(d=0;d<this._ints;++d)this._partialBlock[d]=a.getInt32(),this._partialOutput.putInt32(this._partialBlock[d]^this._outBlock[d]);if(0<e)a.read-=this.blockSize;else for(d=0;d<this._ints;++d)this._inBlock[d]=this._partialBlock[d];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);
if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));this._partialBytes=0}};w.ofb=function(b){b=b||{};this.name="OFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};w.ofb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");
this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};w.ofb.prototype.encrypt=function(a,b,c){var p=a.length();if(0===a.length())return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&p>=this.blockSize)for(var d=0;d<this._ints;++d)b.putInt32(a.getInt32()^this._outBlock[d]),this._inBlock[d]=this._outBlock[d];else{var e=(this.blockSize-p)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(d=0;d<this._ints;++d)this._partialOutput.putInt32(a.getInt32()^
this._outBlock[d]);if(0<e)a.read-=this.blockSize;else for(d=0;d<this._ints;++d)this._inBlock[d]=this._outBlock[d];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));this._partialBytes=0}};w.ofb.prototype.decrypt=w.ofb.prototype.encrypt;w.ctr=function(b){b=b||{};this.name="CTR";this.cipher=b.cipher;this.blockSize=
b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};w.ctr.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};w.ctr.prototype.encrypt=function(a,b,c){var p=a.length();if(0===p)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&p>=this.blockSize)for(var g=0;g<
this._ints;++g)b.putInt32(a.getInt32()^this._outBlock[g]);else{var q=(this.blockSize-p)%this.blockSize;0<q&&(q=this.blockSize-q);this._partialOutput.clear();for(g=0;g<this._ints;++g)this._partialOutput.putInt32(a.getInt32()^this._outBlock[g]);0<q&&(a.read-=this.blockSize);0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<q&&!c)return b.putBytes(this._partialOutput.getBytes(q-this._partialBytes)),this._partialBytes=q,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));
this._partialBytes=0}d(this._inBlock)};w.ctr.prototype.decrypt=w.ctr.prototype.encrypt;w.gcm=function(b){b=b||{};this.name="GCM";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0;this._R=3774873600};w.gcm.prototype.start=function(b){if(!("iv"in b))throw Error("Invalid IV parameter.");var c=a.util.createBuffer(b.iv);this._cipherLength=0;var k;
k="additionalData"in b?a.util.createBuffer(b.additionalData):a.util.createBuffer();this._tagLength="tagLength"in b?b.tagLength:128;this._tag=null;if(b.decrypt&&(this._tag=a.util.createBuffer(b.tag).getBytes(),this._tag.length!==this._tagLength/8))throw Error("Authentication tag does not match tag length.");this._hashBlock=Array(this._ints);this.tag=null;this._hashSubkey=Array(this._ints);this.cipher.encrypt([0,0,0,0],this._hashSubkey);this.componentBits=4;this._m=this.generateHashTable(this._hashSubkey,
this.componentBits);b=c.length();if(12===b)this._j0=[c.getInt32(),c.getInt32(),c.getInt32(),1];else{for(this._j0=[0,0,0,0];0<c.length();)this._j0=this.ghash(this._hashSubkey,this._j0,[c.getInt32(),c.getInt32(),c.getInt32(),c.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(g(8*b)))}this._inBlock=this._j0.slice(0);d(this._inBlock);this._partialBytes=0;k=a.util.createBuffer(k);this._aDataLength=g(8*k.length());(c=k.length()%this.blockSize)&&k.fillWithByte(0,this.blockSize-c);
for(this._s=[0,0,0,0];0<k.length();)this._s=this.ghash(this._hashSubkey,this._s,[k.getInt32(),k.getInt32(),k.getInt32(),k.getInt32()])};w.gcm.prototype.encrypt=function(a,b,c){var p=a.length();if(0===p)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&p>=this.blockSize){for(var g=0;g<this._ints;++g)b.putInt32(this._outBlock[g]^=a.getInt32());this._cipherLength+=this.blockSize}else{var q=(this.blockSize-p)%this.blockSize;0<q&&(q=this.blockSize-q);this._partialOutput.clear();
for(g=0;g<this._ints;++g)this._partialOutput.putInt32(a.getInt32()^this._outBlock[g]);if(0===q||c){c?(g=p%this.blockSize,this._cipherLength+=g,this._partialOutput.truncate(this.blockSize-g)):this._cipherLength+=this.blockSize;for(g=0;g<this._ints;++g)this._outBlock[g]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<q&&!c)return a.read-=this.blockSize,b.putBytes(this._partialOutput.getBytes(q-this._partialBytes)),
this._partialBytes=q,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);d(this._inBlock)};w.gcm.prototype.decrypt=function(a,b,c){var p=a.length();if(p<this.blockSize&&!(c&&0<p))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);d(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,
this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=p<this.blockSize?this._cipherLength+p%this.blockSize:this._cipherLength+this.blockSize};w.gcm.prototype.afterFinish=function(b,c){var d=!0;c.decrypt&&c.overflow&&b.truncate(this.blockSize-c.overflow);this.tag=a.util.createBuffer();var e=this._aDataLength.concat(g(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,e);e=[];this.cipher.encrypt(this._j0,e);for(var q=0;q<
this._ints;++q)this.tag.putInt32(this._s[q]^e[q]);this.tag.truncate(this.tag.length()%(this._tagLength/8));c.decrypt&&this.tag.bytes()!==this._tag&&(d=!1);return d};w.gcm.prototype.multiply=function(a,b){for(var c=[0,0,0,0],p=b.slice(0),d=0;128>d;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=p[0],c[1]^=p[1],c[2]^=p[2],c[3]^=p[3]),this.pow(p,p);return c};w.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,p=3;0<p;--p)b[p]=a[p]>>>1|(a[p-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};w.gcm.prototype.tableMultiply=function(a){for(var b=
2022-03-23 21:00:41 +03:00
[0,0,0,0],c=0;32>c;++c){var p=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=p[0];b[1]^=p[1];b[2]^=p[2];b[3]^=p[3]}return b};w.gcm.prototype.ghash=function(a,b,c){b[0]^=c[0];b[1]^=c[1];b[2]^=c[2];b[3]^=c[3];return this.tableMultiply(b)};w.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,p=4*c,c=16*c,d=Array(c),e=0;e<c;++e){var g=[0,0,0,0];g[e/p|0]=1<<b-1<<(p-1-e%p)*b;d[e]=this.generateSubHashTable(this.multiply(g,a),b)}return d};w.gcm.prototype.generateSubHashTable=function(a,b){var c=1<<b,
p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0<e;)this.pow(d[2*e],d[e]=[]),e>>=1;for(e=2;e<p;){for(var g=1;g<e;++g){var q=d[e],w=d[g];d[e+g]=[q[0]^w[0],q[1]^w[1],q[2]^w[2],q[3]^w[3]]}e*=2}d[0]=[0,0,0,0];for(e=p+1;e<c;++e)g=d[e^p],d[e]=[a[0]^g[0],a[1]^g[1],a[2]^g[2],a[3]^g[3]];return d}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=
v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var q=0;q<g.length;++q)g[q](c);return c.cipherModes}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,
0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,d)})}function d(){m=!0;K=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);B=Array(4);x=Array(4);for(b=0;4>b;++b)B[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,g,k,q,u,b=0;256>b;++b){q=p^p<<1^p<<2^p<<3^p<<4;q=q>>8^q&255^99;h[c]=q;r[q]=c;u=a[q];e=a[c];g=a[e];k=a[g];u^=u<<24^q<<16^q<<8^q;g=(e^g^k)<<24^(c^
k)<<16^(c^g^k)<<8^c^e^k;for(var w=0;4>w;++w)B[w][c]=u,x[w][q]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=p=1:(c=e^a[a[a[e^k]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=k*(e+6+1),q=e;q<m;++q)p=c[q-1],0===q%e?(p=h[p>>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^K[d]<<24,d++):6<e&&4===q%e&&(p=h[p>>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[q]=c[q-e]^p;if(b){for(var d=x[0],e=x[1],r=x[2],w=x[3],l=c.slice(0),m=c.length,q=0,F=m-k;q<m;q+=k,F-=k)if(0===q||q===m-k)l[q]=
c[F],l[q+1]=c[F+3],l[q+2]=c[F+2],l[q+3]=c[F+1];else for(var B=0;B<k;++B)p=c[F+B],l[q+(3&-B)]=d[h[p>>>24]]^e[h[p>>>16&255]]^r[h[p>>>8&255]]^w[h[p&255]];c=l}return c}function w(a,b,c,p){var d=a.length/4-1,e,g,k,m,q;p?(e=x[0],g=x[1],k=x[2],m=x[3],q=r):(e=B[0],g=B[1],k=B[2],m=B[3],q=h);var w,l,C,L,D,K;w=b[0]^a[0];l=b[p?3:1]^a[1];C=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,v=1;v<d;++v)L=e[w>>>24]^g[l>>>16&255]^k[C>>>8&255]^m[b&255]^a[++n],D=e[l>>>24]^g[C>>>16&255]^k[b>>>8&255]^m[w&255]^a[++n],K=e[C>>>24]^
g[b>>>16&255]^k[w>>>8&255]^m[l&255]^a[++n],b=e[b>>>24]^g[w>>>16&255]^k[l>>>8&255]^m[C&255]^a[++n],w=L,l=D,C=K;c[0]=q[w>>>24]<<24^q[l>>>16&255]<<16^q[C>>>8&255]<<8^q[b&255]^a[++n];c[p?3:1]=q[l>>>24]<<24^q[C>>>16&255]<<16^q[b>>>8&255]<<8^q[w&255]^a[++n];c[2]=q[C>>>24]<<24^q[b>>>16&255]<<16^q[w>>>8&255]<<8^q[l&255]^a[++n];c[p?1:3]=q[b>>>24]<<24^q[w>>>16&255]<<16^q[l>>>8&255]<<8^q[C&255]^a[++n]}function l(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):
a.cipher.createCipher(c,b.key);var e=d.start;d.start=function(b,c){var h=null;c instanceof a.util.ByteBuffer&&(h=c,c={});c=c||{};c.output=h;c.iv=b;e.call(d,c)};return d}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=l({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher=
function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(c._w,a,b,!0)}}});c._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key,d;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){d=
2022-03-23 21:00:41 +03:00
c;for(var c=a.util.createBuffer(),e=0;e<d.length;++e)c.putByte(d[e])}if(!a.util.isArray(c)){d=c;var c=[],h=d.length();if(16===h||24===h||32===h)for(h>>>=2,e=0;e<h;++e)c.push(d.getInt32())}if(!a.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=g(c,b.decrypt&&!d);this._init=!0}};a.aes._expandKey=function(a,b){m||d();return g(a,b)};a.aes._updateBlock=w;c("AES-ECB",a.cipher.modes.ecb);c("AES-CBC",
a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var m=!1,k=4,h,r,K,B,x}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
!0;for(var q=0;q<g.length;++q)g[q](c);return c.aes}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.pki=a.pki||{};a=a.pki.oids=a.oids=a.oids||{};a["1.2.840.113549.1.1.1"]="rsaEncryption";
a.rsaEncryption="1.2.840.113549.1.1.1";a["1.2.840.113549.1.1.4"]="md5WithRSAEncryption";a.md5WithRSAEncryption="1.2.840.113549.1.1.4";a["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption";a.sha1WithRSAEncryption="1.2.840.113549.1.1.5";a["1.2.840.113549.1.1.7"]="RSAES-OAEP";a["RSAES-OAEP"]="1.2.840.113549.1.1.7";a["1.2.840.113549.1.1.8"]="mgf1";a.mgf1="1.2.840.113549.1.1.8";a["1.2.840.113549.1.1.9"]="pSpecified";a.pSpecified="1.2.840.113549.1.1.9";a["1.2.840.113549.1.1.10"]="RSASSA-PSS";a["RSASSA-PSS"]=
"1.2.840.113549.1.1.10";a["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption";a.sha256WithRSAEncryption="1.2.840.113549.1.1.11";a["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption";a.sha384WithRSAEncryption="1.2.840.113549.1.1.12";a["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption";a.sha512WithRSAEncryption="1.2.840.113549.1.1.13";a["1.3.14.3.2.7"]="desCBC";a.desCBC="1.3.14.3.2.7";a["1.3.14.3.2.26"]="sha1";a.sha1="1.3.14.3.2.26";a["2.16.840.1.101.3.4.2.1"]="sha256";a.sha256="2.16.840.1.101.3.4.2.1";
a["2.16.840.1.101.3.4.2.2"]="sha384";a.sha384="2.16.840.1.101.3.4.2.2";a["2.16.840.1.101.3.4.2.3"]="sha512";a.sha512="2.16.840.1.101.3.4.2.3";a["1.2.840.113549.2.5"]="md5";a.md5="1.2.840.113549.2.5";a["1.2.840.113549.1.7.1"]="data";a.data="1.2.840.113549.1.7.1";a["1.2.840.113549.1.7.2"]="signedData";a.signedData="1.2.840.113549.1.7.2";a["1.2.840.113549.1.7.3"]="envelopedData";a.envelopedData="1.2.840.113549.1.7.3";a["1.2.840.113549.1.7.4"]="signedAndEnvelopedData";a.signedAndEnvelopedData="1.2.840.113549.1.7.4";
a["1.2.840.113549.1.7.5"]="digestedData";a.digestedData="1.2.840.113549.1.7.5";a["1.2.840.113549.1.7.6"]="encryptedData";a.encryptedData="1.2.840.113549.1.7.6";a["1.2.840.113549.1.9.1"]="emailAddress";a.emailAddress="1.2.840.113549.1.9.1";a["1.2.840.113549.1.9.2"]="unstructuredName";a.unstructuredName="1.2.840.113549.1.9.2";a["1.2.840.113549.1.9.3"]="contentType";a.contentType="1.2.840.113549.1.9.3";a["1.2.840.113549.1.9.4"]="messageDigest";a.messageDigest="1.2.840.113549.1.9.4";a["1.2.840.113549.1.9.5"]=
"signingTime";a.signingTime="1.2.840.113549.1.9.5";a["1.2.840.113549.1.9.6"]="counterSignature";a.counterSignature="1.2.840.113549.1.9.6";a["1.2.840.113549.1.9.7"]="challengePassword";a.challengePassword="1.2.840.113549.1.9.7";a["1.2.840.113549.1.9.8"]="unstructuredAddress";a.unstructuredAddress="1.2.840.113549.1.9.8";a["1.2.840.113549.1.9.14"]="extensionRequest";a.extensionRequest="1.2.840.113549.1.9.14";a["1.2.840.113549.1.9.20"]="friendlyName";a.friendlyName="1.2.840.113549.1.9.20";a["1.2.840.113549.1.9.21"]=
"localKeyId";a.localKeyId="1.2.840.113549.1.9.21";a["1.2.840.113549.1.9.22.1"]="x509Certificate";a.x509Certificate="1.2.840.113549.1.9.22.1";a["1.2.840.113549.1.12.10.1.1"]="keyBag";a.keyBag="1.2.840.113549.1.12.10.1.1";a["1.2.840.113549.1.12.10.1.2"]="pkcs8ShroudedKeyBag";a.pkcs8ShroudedKeyBag="1.2.840.113549.1.12.10.1.2";a["1.2.840.113549.1.12.10.1.3"]="certBag";a.certBag="1.2.840.113549.1.12.10.1.3";a["1.2.840.113549.1.12.10.1.4"]="crlBag";a.crlBag="1.2.840.113549.1.12.10.1.4";a["1.2.840.113549.1.12.10.1.5"]=
"secretBag";a.secretBag="1.2.840.113549.1.12.10.1.5";a["1.2.840.113549.1.12.10.1.6"]="safeContentsBag";a.safeContentsBag="1.2.840.113549.1.12.10.1.6";a["1.2.840.113549.1.5.13"]="pkcs5PBES2";a.pkcs5PBES2="1.2.840.113549.1.5.13";a["1.2.840.113549.1.5.12"]="pkcs5PBKDF2";a.pkcs5PBKDF2="1.2.840.113549.1.5.12";a["1.2.840.113549.1.12.1.1"]="pbeWithSHAAnd128BitRC4";a.pbeWithSHAAnd128BitRC4="1.2.840.113549.1.12.1.1";a["1.2.840.113549.1.12.1.2"]="pbeWithSHAAnd40BitRC4";a.pbeWithSHAAnd40BitRC4="1.2.840.113549.1.12.1.2";
a["1.2.840.113549.1.12.1.3"]="pbeWithSHAAnd3-KeyTripleDES-CBC";a["pbeWithSHAAnd3-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.3";a["1.2.840.113549.1.12.1.4"]="pbeWithSHAAnd2-KeyTripleDES-CBC";a["pbeWithSHAAnd2-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.4";a["1.2.840.113549.1.12.1.5"]="pbeWithSHAAnd128BitRC2-CBC";a["pbeWithSHAAnd128BitRC2-CBC"]="1.2.840.113549.1.12.1.5";a["1.2.840.113549.1.12.1.6"]="pbewithSHAAnd40BitRC2-CBC";a["pbewithSHAAnd40BitRC2-CBC"]="1.2.840.113549.1.12.1.6";a["1.2.840.113549.3.7"]=
"des-EDE3-CBC";a["des-EDE3-CBC"]="1.2.840.113549.3.7";a["2.16.840.1.101.3.4.1.2"]="aes128-CBC";a["aes128-CBC"]="2.16.840.1.101.3.4.1.2";a["2.16.840.1.101.3.4.1.22"]="aes192-CBC";a["aes192-CBC"]="2.16.840.1.101.3.4.1.22";a["2.16.840.1.101.3.4.1.42"]="aes256-CBC";a["aes256-CBC"]="2.16.840.1.101.3.4.1.42";a["2.5.4.3"]="commonName";a.commonName="2.5.4.3";a["2.5.4.5"]="serialName";a.serialName="2.5.4.5";a["2.5.4.6"]="countryName";a.countryName="2.5.4.6";a["2.5.4.7"]="localityName";a.localityName="2.5.4.7";
a["2.5.4.8"]="stateOrProvinceName";a.stateOrProvinceName="2.5.4.8";a["2.5.4.10"]="organizationName";a.organizationName="2.5.4.10";a["2.5.4.11"]="organizationalUnitName";a.organizationalUnitName="2.5.4.11";a["2.16.840.1.113730.1.1"]="nsCertType";a.nsCertType="2.16.840.1.113730.1.1";a["2.5.29.1"]="authorityKeyIdentifier";a["2.5.29.2"]="keyAttributes";a["2.5.29.3"]="certificatePolicies";a["2.5.29.4"]="keyUsageRestriction";a["2.5.29.5"]="policyMapping";a["2.5.29.6"]="subtreesConstraint";a["2.5.29.7"]=
"subjectAltName";a["2.5.29.8"]="issuerAltName";a["2.5.29.9"]="subjectDirectoryAttributes";a["2.5.29.10"]="basicConstraints";a["2.5.29.11"]="nameConstraints";a["2.5.29.12"]="policyConstraints";a["2.5.29.13"]="basicConstraints";a["2.5.29.14"]="subjectKeyIdentifier";a.subjectKeyIdentifier="2.5.29.14";a["2.5.29.15"]="keyUsage";a.keyUsage="2.5.29.15";a["2.5.29.16"]="privateKeyUsagePeriod";a["2.5.29.17"]="subjectAltName";a.subjectAltName="2.5.29.17";a["2.5.29.18"]="issuerAltName";a.issuerAltName="2.5.29.18";
a["2.5.29.19"]="basicConstraints";a.basicConstraints="2.5.29.19";a["2.5.29.20"]="cRLNumber";a["2.5.29.21"]="cRLReason";a["2.5.29.22"]="expirationDate";a["2.5.29.23"]="instructionCode";a["2.5.29.24"]="invalidityDate";a["2.5.29.25"]="cRLDistributionPoints";a["2.5.29.26"]="issuingDistributionPoint";a["2.5.29.27"]="deltaCRLIndicator";a["2.5.29.28"]="issuingDistributionPoint";a["2.5.29.29"]="certificateIssuer";a["2.5.29.30"]="nameConstraints";a["2.5.29.31"]="cRLDistributionPoints";a["2.5.29.32"]="certificatePolicies";
a["2.5.29.33"]="policyMappings";a["2.5.29.34"]="policyConstraints";a["2.5.29.35"]="authorityKeyIdentifier";a["2.5.29.36"]="policyConstraints";a["2.5.29.37"]="extKeyUsage";a.extKeyUsage="2.5.29.37";a["2.5.29.46"]="freshestCRL";a["2.5.29.54"]="inhibitAnyPolicy";a["1.3.6.1.5.5.7.3.1"]="serverAuth";a.serverAuth="1.3.6.1.5.5.7.3.1";a["1.3.6.1.5.5.7.3.2"]="clientAuth";a.clientAuth="1.3.6.1.5.5.7.3.2";a["1.3.6.1.5.5.7.3.3"]="codeSigning";a.codeSigning="1.3.6.1.5.5.7.3.3";a["1.3.6.1.5.5.7.3.4"]="emailProtection";
a.emailProtection="1.3.6.1.5.5.7.3.4";a["1.3.6.1.5.5.7.3.8"]="timeStamping";a.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.oids)return c.oids;c.defined.oids=!0;for(var q=0;q<g.length;++q)g[q](c);return c.oids}},
l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/oids",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1=a.asn1||{};c.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};c.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
2022-03-23 21:00:41 +03:00
ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};c.create=function(b,c,d,e){if(a.util.isArray(e)){for(var h=[],g=0;g<e.length;++g)void 0!==e[g]&&h.push(e[g]);e=h}return{tagClass:b,type:c,constructed:d,composed:d||a.util.isArray(e),value:e}};var d=c.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return b&128?a.getInt((b&127)<<3):b};c.fromDer=function(b,g){void 0===g&&(g=!0);
"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var m=Error("Too few bytes to parse DER.");m.bytes=b.length();throw m;}var k=b.getByte(),m=k&192,h=k&31,r=d(b);if(b.length()<r){if(g)throw m=Error("Too few bytes to read ASN.1 value."),m.detail=b.length()+" < "+r,m;r=b.length()}var l,B=32===(k&32);l=B;if(!l&&m===c.Class.UNIVERSAL&&h===c.Type.BITSTRING&&1<r){var x=b.read;if(0===b.getByte()&&(k=b.getByte(),k&=192,k===c.Class.UNIVERSAL||k===c.Class.CONTEXT_SPECIFIC))try{if(l=d(b)===r-(b.read-
x))++x,--r}catch(A){}b.read=x}if(l)if(l=[],void 0===r)for(;;){if(b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2);break}l.push(c.fromDer(b,g))}else for(x=b.length();0<r;)l.push(c.fromDer(b,g)),r-=x-b.length(),x=b.length();else{if(void 0===r){if(g)throw Error("Non-constructed ASN.1 object of indefinite length.");r=b.length()}if(h===c.Type.BMPSTRING)for(l="",x=0;x<r;x+=2)l+=String.fromCharCode(b.getInt16());else l=b.getBytes(r)}return c.create(m,h,B,l)};c.toDer=function(b){var d=a.util.createBuffer(),
2022-03-23 21:00:41 +03:00
e=b.tagClass|b.type,g=a.util.createBuffer();if(b.composed){b.constructed?e|=32:g.putByte(0);for(var h=0;h<b.value.length;++h)void 0!==b.value[h]&&g.putBuffer(c.toDer(b.value[h]))}else if(b.type===c.Type.BMPSTRING)for(h=0;h<b.value.length;++h)g.putInt16(b.value.charCodeAt(h));else g.putBytes(b.value);d.putByte(e);if(127>=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0<h);d.putByte(b.length|128);for(h=b.length-1;0<=h;--h)d.putByte(b.charCodeAt(h))}d.putBuffer(g);
return d};c.oidToDer=function(b){b=b.split(".");var c=a.util.createBuffer();c.putByte(40*parseInt(b[0],10)+parseInt(b[1],10));for(var d,e,h,g,q=2;q<b.length;++q){d=!0;e=[];h=parseInt(b[q],10);do g=h&127,h>>>=7,d||(g|=128),e.push(g),d=!1;while(0<h);for(d=e.length-1;0<=d;--d)c.putByte(e[d])}return c};c.derToOid=function(b){var c;"string"===typeof b&&(b=a.util.createBuffer(b));var d=b.getByte();c=Math.floor(d/40)+"."+d%40;for(var e=0;0<b.length();)d=b.getByte(),e<<=7,d&128?e+=d&127:(c+="."+(e+d),e=0);
return c};c.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10),c=50<=c?1900+c:2E3+c,d=parseInt(a.substr(2,2),10)-1,e=parseInt(a.substr(4,2),10),p=parseInt(a.substr(6,2),10),g=parseInt(a.substr(8,2),10),q=0;if(11<a.length){var x=a.charAt(10),l=10;"+"!==x&&"-"!==x&&(q=parseInt(a.substr(10,2),10),l+=2)}b.setUTCFullYear(c,d,e);b.setUTCHours(p,g,q,0);l&&(x=a.charAt(l),"+"===x||"-"===x)&&(c=parseInt(a.substr(l+1,2),10),a=parseInt(a.substr(l+4,2),10),a=6E4*(60*c+a),"+"===x?b.setTime(+b-
a):b.setTime(+b+a));return b};c.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,e=parseInt(a.substr(6,2),10),p=parseInt(a.substr(8,2),10),g=parseInt(a.substr(10,2),10),q=parseInt(a.substr(12,2),10),x=0,l=0,y=!1;"Z"===a.charAt(a.length-1)&&(y=!0);var R=a.length-5,z=a.charAt(R);if("+"===z||"-"===z)l=parseInt(a.substr(R+1,2),10),R=parseInt(a.substr(R+4,2),10),l=6E4*(60*l+R),"+"===z&&(l*=-1),y=!0;"."===a.charAt(14)&&(x=1E3*parseFloat(a.substr(14),
10));y?(b.setUTCFullYear(c,d,e),b.setUTCHours(p,g,q,x),b.setTime(+b+l)):(b.setFullYear(c,d,e),b.setHours(p,g,q,x));return b};c.dateToUtcTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"===
typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear());c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.integerToDer=function(b){var c=a.util.createBuffer();if(-128<=b&&128>b)return c.putSignedInt(b,8);if(-32768<=b&&32768>b)return c.putSignedInt(b,16);if(-8388608<=b&&8388608>b)return c.putSignedInt(b,24);if(-2147483648<=b&&2147483648>
2022-03-23 21:00:41 +03:00
b)return c.putSignedInt(b,32);c=Error("Integer too large; max is 32-bits.");c.integer=b;throw c;};c.derToInteger=function(b){"string"===typeof b&&(b=a.util.createBuffer(b));var c=8*b.length();if(32<c)throw Error("Integer too large; max is 32-bits.");return b.getSignedInt(c)};c.validate=function(b,d,e,g){var h=!1;if(b.tagClass!==d.tagClass&&"undefined"!==typeof d.tagClass||b.type!==d.type&&"undefined"!==typeof d.type)g&&(b.tagClass!==d.tagClass&&g.push("["+d.name+'] Expected tag class "'+d.tagClass+
'", got "'+b.tagClass+'"'),b.type!==d.type&&g.push("["+d.name+'] Expected type "'+d.type+'", got "'+b.type+'"'));else if(b.constructed===d.constructed||"undefined"===typeof d.constructed){h=!0;if(d.value&&a.util.isArray(d.value))for(var r=0,l=0;h&&l<d.value.length;++l)h=d.value[l].optional||!1,b.value[r]&&((h=c.validate(b.value[r],d.value[l],e,g))?++r:d.value[l].optional&&(h=!0)),!h&&g&&g.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
b.value.length+'"');h&&e&&(d.capture&&(e[d.capture]=b.value),d.captureAsn1&&(e[d.captureAsn1]=b))}else g&&g.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+b.constructed+'"');return h};var g=/[^\\u0000-\\u00ff]/;c.prettyPrint=function(b,d,e){var k="";d=d||0;e=e||2;0<d&&(k+="\n");for(var h="",r=0;r<d*e;++r)h+=" ";k+=h+"Tag: ";switch(b.tagClass){case c.Class.UNIVERSAL:k+="Universal:";break;case c.Class.APPLICATION:k+="Application:";break;case c.Class.CONTEXT_SPECIFIC:k+="Context-Specific:";
break;case c.Class.PRIVATE:k+="Private:"}if(b.tagClass===c.Class.UNIVERSAL)switch(k+=b.type,b.type){case c.Type.NONE:k+=" (None)";break;case c.Type.BOOLEAN:k+=" (Boolean)";break;case c.Type.BITSTRING:k+=" (Bit string)";break;case c.Type.INTEGER:k+=" (Integer)";break;case c.Type.OCTETSTRING:k+=" (Octet string)";break;case c.Type.NULL:k+=" (Null)";break;case c.Type.OID:k+=" (Object Identifier)";break;case c.Type.ODESC:k+=" (Object Descriptor)";break;case c.Type.EXTERNAL:k+=" (External or Instance of)";
break;case c.Type.REAL:k+=" (Real)";break;case c.Type.ENUMERATED:k+=" (Enumerated)";break;case c.Type.EMBEDDED:k+=" (Embedded PDV)";break;case c.Type.UTF8:k+=" (UTF8)";break;case c.Type.ROID:k+=" (Relative Object Identifier)";break;case c.Type.SEQUENCE:k+=" (Sequence)";break;case c.Type.SET:k+=" (Set)";break;case c.Type.PRINTABLESTRING:k+=" (Printable String)";break;case c.Type.IA5String:k+=" (IA5String (ASCII))";break;case c.Type.UTCTIME:k+=" (UTC time)";break;case c.Type.GENERALIZEDTIME:k+=" (Generalized time)";
break;case c.Type.BMPSTRING:k+=" (BMP String)"}else k+=b.type;k=k+"\n"+(h+"Constructed: "+b.constructed+"\n");if(b.composed){for(var l=0,B="",r=0;r<b.value.length;++r)void 0!==b.value[r]&&(l+=1,B+=c.prettyPrint(b.value[r],d+1,e),r+1<b.value.length&&(B+=","));k+=h+"Sub values: "+l+B}else if(k+=h+"Value: ",b.type===c.Type.OID&&(d=c.derToOid(b.value),k+=d,a.pki&&a.pki.oids&&d in a.pki.oids&&(k+=" ("+a.pki.oids[d]+") ")),b.type===c.Type.INTEGER)try{k+=c.derToInteger(b.value)}catch(x){k+="0x"+a.util.bytesToHex(b.value)}else b.type===
c.Type.OCTETSTRING?(g.test(b.value)||(k+="("+b.value+") "),k+="0x"+a.util.bytesToHex(b.value)):k=b.type===c.Type.UTF8?k+a.util.decodeUtf8(b.value):b.type===c.Type.PRINTABLESTRING||b.type===c.Type.IA5String?k+b.value:g.test(b.value)?k+("0x"+a.util.bytesToHex(b.value)):0===b.value.length?k+"[null]":k+b.value;return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,
c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.asn1)return c.asn1;c.defined.asn1=!0;for(var q=0;q<g.length;++q)g[q](c);return c.asn1}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/asn1",["require","module","./util","./oids"],function(){n.apply(null,Array.prototype.slice.call(arguments,
0))})})();(function(){function b(a){function c(){l=String.fromCharCode(128);l+=a.util.fillString(String.fromCharCode(0),64);n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];m=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];k=Array(64);for(var b=0;64>b;++b)k[b]=Math.floor(4294967296*
Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var e,p,h,g,z,E,q,l=c.length();64<=l;){p=a.h0;h=a.h1;g=a.h2;z=a.h3;for(q=0;16>q;++q)b[q]=c.getInt32Le(),e=z^h&(g^z),e=p+e+k[q]+b[q],E=m[q],p=z,z=g,g=h,h+=e<<E|e>>>32-E;for(;32>q;++q)e=g^z&(h^g),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<<E|e>>>32-E;for(;48>q;++q)e=h^g^z,e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<<E|e>>>32-E;for(;64>q;++q)e=g^(h|~z),e=p+e+k[q]+b[n[q]],E=m[q],p=z,z=g,g=h,h+=e<<E|e>>>32-E;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+g|0;a.h3=
a.h3+z|0;l-=64}}var g=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=g;g.create=function(){h||c();var b=null,g=a.util.createBuffer(),k=Array(16),m={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var c=m.messageLengthSize/4,d=0;d<c;++d)m.fullMessageLength.push(0);g=a.util.createBuffer();b={h0:1732584193,h1:4023233417,
h2:2562383102,h3:271733878};return m}};m.start();m.update=function(c,h){"utf8"===h&&(c=a.util.encodeUtf8(c));var q=c.length;m.messageLength+=q;for(var q=[q/4294967296>>>0,q>>>0],z=m.fullMessageLength.length-1;0<=z;--z)m.fullMessageLength[z]+=q[1],q[1]=q[0]+(m.fullMessageLength[z]/4294967296>>>0),m.fullMessageLength[z]>>>=0,q[0]=q[1]/4294967296>>>0;g.putBytes(c);d(b,k,g);(2048<g.read||0===g.length())&&g.compact();return m};m.digest=function(){var c=a.util.createBuffer();c.putBytes(g.bytes());c.putBytes(l.substr(0,
m.blockLength-(m.fullMessageLength[m.fullMessageLength.length-1]+m.messageLengthSize&m.blockLength-1)));for(var h,q=0,z=m.fullMessageLength.length-1;0<=z;--z)h=8*m.fullMessageLength[z]+q,q=h/4294967296>>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,k,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return m};var l=null,n=null,m=null,k=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=
!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md5)return c.md5;c.defined.md5=!0;for(var q=0;q<g.length;++q)g[q](c);return c.md5}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,
0))};a("js/md5",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,p,g,q,l,A,y,w,z=d.length();64<=z;){p=a.h0;g=a.h1;q=a.h2;l=a.h3;A=a.h4;for(w=0;16>w;++w)e=d.getInt32(),b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;20>w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=l^g&(q^l),e=(p<<5|p>>>27)+y+A+1518500249+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;32>
w;++w)e=b[w-3]^b[w-8]^b[w-14]^b[w-16],e=e<<1|e>>>31,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;40>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>27)+y+A+1859775393+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;60>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g&q|l&(g^q),e=(p<<5|p>>>27)+y+A+2400959708+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;for(;80>w;++w)e=b[w-6]^b[w-16]^b[w-28]^b[w-32],e=e<<2|e>>>30,b[w]=e,y=g^q^l,e=(p<<5|p>>>
27)+y+A+3395469782+e,A=l,l=q,q=g<<30|g>>>2,g=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+g|0;a.h2=a.h2+q|0;a.h3=a.h3+l|0;a.h4=a.h4+A|0;z-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),e=Array(80),h={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){h.messageLength=
0;h.fullMessageLength=h.messageLength64=[];for(var c=h.messageLengthSize/4,e=0;e<c;++e)h.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return h}};h.start();h.update=function(g,l){"utf8"===l&&(g=a.util.encodeUtf8(g));var w=g.length;h.messageLength+=w;for(var w=[w/4294967296>>>0,w>>>0],x=h.fullMessageLength.length-1;0<=x;--x)h.fullMessageLength[x]+=w[1],w[1]=w[0]+(h.fullMessageLength[x]/4294967296>>>0),h.fullMessageLength[x]>>>=
0,w[0]=w[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048<d.read||0===d.length())&&d.compact();return h};h.digest=function(){var l=a.util.createBuffer();l.putBytes(d.bytes());l.putBytes(g.substr(0,h.blockLength-(h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1)));a.util.createBuffer();for(var w,B,x=8*h.fullMessageLength[0],A=0;A<h.fullMessageLength.length;++A)w=8*h.fullMessageLength[A+1],B=w/4294967296>>>0,x+=B,l.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,
h4:b.h4};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);return l};return h};var g=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha1)return c.sha1;c.defined.sha1=
!0;for(var q=0;q<g.length;++q)g[q](c);return c.sha1}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha1",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,p,g,q,l,y,w,z,E,O,H,C,u,v=d.length();64<=v;){for(l=0;16>l;++l)b[l]=d.getInt32();
for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;y=a.h0;w=a.h1;z=a.h2;E=a.h3;O=a.h4;H=a.h5;C=a.h6;u=a.h7;for(l=0;64>l;++l)e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),g=C^O&(H^C),p=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),q=y&w|z&(y^w),e=u+e+g+n[l]+b[l],p+=q,u=C,C=H,H=O,O=E+e|0,E=z,z=w,w=y,y=e+p|0;a.h0=a.h0+y|0;a.h1=a.h1+w|0;a.h2=a.h2+z|0;a.h3=a.h3+E|0;a.h4=a.h4+O|0;a.h5=a.h5+H|0;a.h6=a.h6+C|0;a.h7=a.h7+u|0;v-=
64}}var d=a.sha256=a.sha256||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha256=a.md.algorithms.sha256=d;d.create=function(){l||(g=String.fromCharCode(128),g+=a.util.fillString(String.fromCharCode(0),64),n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],l=!0);var b=null,d=a.util.createBuffer(),e=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,
messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,e=0;e<c;++e)r.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return r}};r.start();r.update=function(g,l){"utf8"===l&&(g=a.util.encodeUtf8(g));var x=g.length;r.messageLength+=x;for(var x=[x/4294967296>>>0,x>>>0],w=r.fullMessageLength.length-
1;0<=w;--w)r.fullMessageLength[w]+=x[1],x[1]=x[0]+(r.fullMessageLength[w]/4294967296>>>0),r.fullMessageLength[w]>>>=0,x[0]=x[1]/4294967296>>>0;d.putBytes(g);c(b,e,d);(2048<d.read||0===d.length())&&d.compact();return r};r.digest=function(){var l=a.util.createBuffer();l.putBytes(d.bytes());l.putBytes(g.substr(0,r.blockLength-(r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize&r.blockLength-1)));a.util.createBuffer();for(var w,x,A=8*r.fullMessageLength[0],y=0;y<r.fullMessageLength.length;++y)w=
8*r.fullMessageLength[y+1],x=w/4294967296>>>0,A+=x,l.putInt32(A>>>0),A=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};c(w,e,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return r};var g=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge=
{}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha256)return c.sha256;c.defined.sha256=!0;for(var q=0;q<g.length;++q)g[q](c);return c.sha256}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha256",["require","module","./util"],function(){n.apply(null,
Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,p,g,k,q,z,E,l,w,C,u,n,v,F,Y,L,D,V,J,aa,ba,W,I,G,S,Z=d.length();128<=Z;){for(S=0;16>S;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)q=b[S-2],w=q[0],q=q[1],e=((w>>>19|q<<13)^(q>>>29|w<<3)^w>>>6)>>>0,p=((w<<13|q>>>19)^(q<<3|w>>>29)^(w<<26|q>>>6))>>>0,q=b[S-15],w=q[0],q=q[1],g=((w>>>1|q<<31)^(w>>>8|q<<24)^w>>>7)>>>0,k=((w<<31|q>>>1)^(w<<24|q>>>8)^(w<<25|q>>>7))>>>0,w=b[S-7],C=b[S-
16],q=p+w[1]+k+C[1],b[S][0]=e+w[0]+g+C[0]+(q/4294967296>>>0)>>>0,b[S][1]=q>>>0;w=a[0][0];C=a[0][1];u=a[1][0];n=a[1][1];v=a[2][0];F=a[2][1];Y=a[3][0];L=a[3][1];D=a[4][0];V=a[4][1];J=a[5][0];aa=a[5][1];ba=a[6][0];W=a[6][1];I=a[7][0];G=a[7][1];for(S=0;80>S;++S)e=((D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23))>>>0,q=((D<<18|V>>>14)^(D<<14|V>>>18)^(V<<23|D>>>9))>>>0,p=(ba^D&(J^ba))>>>0,z=(W^V&(aa^W))>>>0,g=((w>>>28|C<<4)^(C>>>2|w<<30)^(C>>>7|w<<25))>>>0,k=((w<<4|C>>>28)^(C<<30|w>>>2)^(C<<25|w>>>7))>>>0,
E=(w&u|v&(w^u))>>>0,l=(C&n|F&(C^n))>>>0,q=G+q+z+m[S][1]+b[S][1],e=I+e+p+m[S][0]+b[S][0]+(q/4294967296>>>0)>>>0,p=q>>>0,q=k+l,g=g+E+(q/4294967296>>>0)>>>0,k=q>>>0,I=ba,G=W,ba=J,W=aa,J=D,aa=V,q=L+p,D=Y+e+(q/4294967296>>>0)>>>0,V=q>>>0,Y=v,L=F,v=u,F=n,u=w,n=C,q=p+k,w=e+g+(q/4294967296>>>0)>>>0,C=q>>>0;q=a[0][1]+C;a[0][0]=a[0][0]+w+(q/4294967296>>>0)>>>0;a[0][1]=q>>>0;q=a[1][1]+n;a[1][0]=a[1][0]+u+(q/4294967296>>>0)>>>0;a[1][1]=q>>>0;q=a[2][1]+F;a[2][0]=a[2][0]+v+(q/4294967296>>>0)>>>0;a[2][1]=q>>>0;
q=a[3][1]+L;a[3][0]=a[3][0]+Y+(q/4294967296>>>0)>>>0;a[3][1]=q>>>0;q=a[4][1]+V;a[4][0]=a[4][0]+D+(q/4294967296>>>0)>>>0;a[4][1]=q>>>0;q=a[5][1]+aa;a[5][0]=a[5][0]+J+(q/4294967296>>>0)>>>0;a[5][1]=q>>>0;q=a[6][1]+W;a[6][0]=a[6][0]+ba+(q/4294967296>>>0)>>>0;a[6][1]=q>>>0;q=a[7][1]+G;a[7][0]=a[7][0]+I+(q/4294967296>>>0)>>>0;a[7][1]=q>>>0;Z-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var g=a.sha384=a.sha512.sha384=a.sha512.sha384||
{};g.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=g;a.sha512.sha256=a.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256;a.sha512.sha224=a.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224;d.create=function(b){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),m=[[1116352408,
3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],
[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,
106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],
[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],k={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],
[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,
2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in k))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=k[b],e=null,g=a.util.createBuffer(),x=Array(80),A=0;80>A;++A)x[A]=Array(2);var y={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){y.messageLength=
0;y.fullMessageLength=y.messageLength128=[];for(var b=y.messageLengthSize/4,c=0;c<b;++c)y.fullMessageLength.push(0);g=a.util.createBuffer();e=Array(d.length);for(c=0;c<d.length;++c)e[c]=d[c].slice(0);return y}};y.start();y.update=function(b,d){"utf8"===d&&(b=a.util.encodeUtf8(b));var h=b.length;y.messageLength+=h;for(var h=[h/4294967296>>>0,h>>>0],k=y.fullMessageLength.length-1;0<=k;--k)y.fullMessageLength[k]+=h[1],h[1]=h[0]+(y.fullMessageLength[k]/4294967296>>>0),y.fullMessageLength[k]>>>=0,h[0]=
h[1]/4294967296>>>0;g.putBytes(b);c(e,x,g);(2048<g.read||0===g.length())&&g.compact();return y};y.digest=function(){var d=a.util.createBuffer();d.putBytes(g.bytes());d.putBytes(l.substr(0,y.blockLength-(y.fullMessageLength[y.fullMessageLength.length-1]+y.messageLengthSize&y.blockLength-1)));a.util.createBuffer();for(var z,k,m=8*y.fullMessageLength[0],r=0;r<y.fullMessageLength.length;++r)z=8*y.fullMessageLength[r+1],k=z/4294967296>>>0,m+=k,d.putInt32(m>>>0),m=z;z=Array(e.length);for(r=0;r<e.length;++r)z[r]=
e[r].slice(0);c(z,x,d);d=a.util.createBuffer();k="SHA-512"===b?z.length:"SHA-384"===b?z.length-2:z.length-4;for(r=0;r<k;++r)d.putInt32(z[r][0]),r===k-1&&"SHA-512/224"===b||d.putInt32(z[r][1]);return d};return y};var l=null,n=!1,m=null,k=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);
c=c||{};c.defined=c.defined||{};if(c.defined.sha512)return c.sha512;c.defined.sha512=!0;for(var q=0;q<g.length;++q)g[q](c);return c.sha512}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha512",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.md=a.md||{};
a.md.algorithms={md5:a.md5,sha1:a.sha1,sha256:a.sha256};a.md.md5=a.md5;a.md.sha1=a.sha1;a.md.sha256=a.sha256}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md)return c.md;c.defined.md=!0;for(var q=0;q<g.length;++q)g[q](c);return c.md}},l=a;a=function(b,
c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.hmac=a.hmac||{}).create=function(){var b=null,c=null,d=null,g={start:function(g,m){if(null!==g)if("string"===typeof g)if(g=g.toLowerCase(),g in a.md.algorithms)b=
a.md.algorithms[g].create();else throw Error('Unknown hash algorithm "'+g+'"');else b=g;if(null!==m){if("string"===typeof m)m=a.util.createBuffer(m);else if(a.util.isArray(m)){var k=m;m=a.util.createBuffer();for(var h=0;h<k.length;++h)m.putByte(k[h])}var l=m.length();l>b.blockLength&&(b.start(),b.update(m.bytes()),m=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();l=m.length();for(h=0;h<l;++h)k=m.at(h),c.putByte(54^k),d.putByte(92^k);if(l<b.blockLength)for(k=b.blockLength-l,h=0;h<k;++h)c.putByte(54),
d.putByte(92);c=c.bytes();d=d.bytes()}b.start();b.update(c)},update:function(a){b.update(a)},getMac:function(){var a=b.digest().bytes();b.start();b.update(d);b.update(a);return b.digest()}};g.digest=g.getMac;return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
{};if(c.defined.hmac)return c.hmac;c.defined.hmac=!0;for(var q=0;q<g.length;++q)g[q](c);return c.hmac}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/hmac",["require","module","./md","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a){for(var b=a.name+": ",d=[],e=function(a,
2022-03-23 21:00:41 +03:00
b){return" "+b},p=0;p<a.values.length;++p)d.push(a.values[p].replace(/^(\S+\r\n)/,e));b+=d.join(",")+"\r\n";d=0;a=-1;for(p=0;p<b.length;++p,++d)if(65<d&&-1!==a)d=b[a],","===d?(++a,b=b.substr(0,a)+"\r\n "+b.substr(a)):b=b.substr(0,a)+"\r\n"+d+b.substr(a+1),d=p-a-1,a=-1,++p;else if(" "===b[p]||"\t"===b[p]||","===b[p])a=p;return b}var d=a.pem=a.pem||{};d.encode=function(b,d){d=d||{};var e="-----BEGIN "+b.type+"-----\r\n",g;b.procType&&(g={name:"Proc-Type",values:[String(b.procType.version),b.procType.type]},
e+=c(g));b.contentDomain&&(g={name:"Content-Domain",values:[b.contentDomain]},e+=c(g));b.dekInfo&&(g={name:"DEK-Info",values:[b.dekInfo.algorithm]},b.dekInfo.parameters&&g.values.push(b.dekInfo.parameters),e+=c(g));if(b.headers)for(g=0;g<b.headers.length;++g)e+=c(b.headers[g]);b.procType&&(e+="\r\n");e+=a.util.encode64(b.body,d.maxline||64)+"\r\n";return e+="-----END "+b.type+"-----\r\n"};d.decode=function(b){for(var c=[],d=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,
e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var q={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(q);if(h[2]){for(var l=h[2].split(g),B=0;h&&B<l.length;){h=l[B].replace(/\s+$/,"");for(var x=B+1;x<l.length;++x){var A=l[x];if(!/\s/.test(A[0]))break;h+=A;B=x}if(h=h.match(e)){for(var x={name:h[1],values:[]},A=h[2].split(","),y=0;y<A.length;++y)x.values.push(A[y].replace(/^\s+/,""));if(q.procType)if(q.contentDomain||
"Content-Domain"!==x.name)if(q.dekInfo||"DEK-Info"!==x.name)q.headers.push(x);else{if(0===x.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');q.dekInfo={algorithm:A[0],parameters:A[1]||null}}else q.contentDomain=A[0]||"";else{if("Proc-Type"!==x.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==x.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');
q.procType={version:A[0],type:A[1]}}}++B}if("ENCRYPTED"===q.procType&&!q.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);
c=c||{};c.defined=c.defined||{};if(c.defined.pem)return c.pem;c.defined.pem=!0;for(var q=0;q<g.length;++q)g[q](c);return c.pem}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pem",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,
function(){return new a.des.Algorithm(b,d)})}function d(a,b,c,e){var p=32===a.length?3:9;e=3===p?e?[30,-2,-2]:[0,32,2]:e?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=b[0],q=b[1];b=(g>>>4^q)&252645135;q^=b;g^=b<<4;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(g>>>1^q)&1431655765;for(var q=q^b,g=g^b<<1,g=g<<1|g>>>31,q=q<<1|q>>>31,H=0;H<p;H+=3){for(var C=e[H+1],u=e[H+2],T=e[H];T!=C;T+=u){var P=q^a[T],F=(q>>>4|q<<28)^a[T+1];b=g;
g=q;q=b^(n[P>>>24&63]|k[P>>>16&63]|r[P>>>8&63]|B[P&63]|l[F>>>24&63]|m[F>>>16&63]|h[F>>>8&63]|v[F&63])}b=g;g=q;q=b}g=g>>>1|g<<31;q=q>>>1|q<<31;b=(g>>>1^q)&1431655765;q^=b;g^=b<<1;b=(q>>>8^g)&16711935;g^=b;q^=b<<8;b=(q>>>2^g)&858993459;g^=b;q^=b<<2;b=(g>>>16^q)&65535;q^=b;g^=b<<16;b=(g>>>4^q)&252645135;c[0]=g^b<<4;c[1]=q^b}function g(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var e=d.start;d.start=function(b,c){var g=
2022-03-23 21:00:41 +03:00
null;c instanceof a.util.ByteBuffer&&(g=c,c={});c=c||{};c.output=g;c.iv=b;e.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return g({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=g({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return g({key:a,
output:null,decrypt:!0,mode:b})};a.des.Algorithm=function(a,b){var c=this;c.name=a;c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return d(c._keys,a,b,!1)},decrypt:function(a,b){return d(c._keys,a,b,!0)}}});c._init=!1};a.des.Algorithm.prototype.initialize=function(b){if(!this._init){b=a.util.createBuffer(b.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());for(var c=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,
516,536871424,536871428,66048,66052,536936960,536936964],d=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],e=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],g=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],
k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],q=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[0,268435456,8,268435464,0,268435456,
8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],w=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],F=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],L=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],n=8<b.length()?3:
1,C=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],K=0,D,W=0;W<n;W++){var I=b.getInt32(),G=b.getInt32();D=(I>>>4^G)&252645135;G^=D;I^=D<<4;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>2^G)&858993459;G^=D;I^=D<<2;D=(G>>>-16^I)&65535;I^=D;G^=D<<-16;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=(G>>>8^I)&16711935;I^=D;G^=D<<8;D=(I>>>1^G)&1431655765;G^=D;I^=D<<1;D=I<<8|G>>>20&240;for(var I=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=D,S=0;S<v.length;++S){v[S]?(I=I<<2|I>>>26,G=G<<2|G>>>26):(I=I<<1|I>>>27,G=G<<1|G>>>27);
var I=I&-15,G=G&-15,Z=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|q[I>>>4&15],ca=m[G>>>28]|l[G>>>24&15]|r[G>>>20&15]|w[G>>>16&15]|F[G>>>12&15]|B[G>>>8&15]|L[G>>>4&15];D=(ca>>>16^Z)&65535;C[K++]=Z^D;C[K++]=ca^D<<16}}this._keys=C;this._init=!0}};c("DES-ECB",a.cipher.modes.ecb);c("DES-CBC",a.cipher.modes.cbc);c("DES-CFB",a.cipher.modes.cfb);c("DES-OFB",a.cipher.modes.ofb);c("DES-CTR",a.cipher.modes.ctr);c("3DES-ECB",a.cipher.modes.ecb);c("3DES-CBC",a.cipher.modes.cbc);c("3DES-CFB",
a.cipher.modes.cfb);c("3DES-OFB",a.cipher.modes.ofb);c("3DES-CTR",a.cipher.modes.ctr);var l=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,
0,65540,66560,0,16842756],n=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,
-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],m=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,
8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],k=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],h=[256,34078976,34078720,1107296512,
524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,
2022-03-23 21:00:41 +03:00
524288,0,1074266112,34078976,1073742080],r=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,
4194320,536887312,0,541081600,536870912,4194320,536887312],v=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,
67108866,67110912,2048,2097154],B=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,
268435456,268701696]}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.des)return c.des;c.defined.des=!0;for(var q=0;q<g.length;++q)g[q](c);return c.des}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,
Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/des",["require","module","./cipher","./cipherModes","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d=a.pkcs5=a.pkcs5||{},e="undefined"!==typeof process&&process.versions&&process.versions.node,g;e&&!a.disableNativeCode&&(g=c("crypto"));a.pbkdf2=d.pbkdf2=function(b,c,d,k,h,q){function l(){if(N>A)return q(null,z);n.start(null,
null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();u=2;B()}function B(){if(u<=d)return n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O,++u,a.util.setImmediate(B);z+=N<A?E:E.substr(0,y);++N;l()}"function"===typeof h&&(q=h,h=null);if(e&&!a.disableNativeCode&&g.pbkdf2&&(null===h||"object"!==typeof h)&&(4<g.pbkdf2Sync.length||!h||"sha1"===h))return"string"!==typeof h&&(h="sha1"),c=new Buffer(c,"binary"),q?4===g.pbkdf2Sync.length?g.pbkdf2(b,
c,d,k,function(a,b){if(a)return q(a);q(null,b.toString("binary"))}):g.pbkdf2(b,c,d,k,h,function(a,b){if(a)return q(a);q(null,b.toString("binary"))}):4===g.pbkdf2Sync.length?g.pbkdf2Sync(b,c,d,k).toString("binary"):g.pbkdf2Sync(b,c,d,k,h).toString("binary");if("undefined"===typeof h||null===h)h=a.md.sha1.create();if("string"===typeof h){if(!(h in a.md.algorithms))throw Error("Unknown hash algorithm: "+h);h=a.md[h].create()}var x=h.digestLength;if(k>4294967295*x){b=Error("Derived key is too long.");
if(q)return q(b);throw b;}var A=Math.ceil(k/x),y=k-(A-1)*x,n=a.hmac.create();n.start(h,b);var z="",E,O,H;if(!q){for(var N=1;N<=A;++N){n.start(null,null);n.update(c);n.update(a.util.int32ToBytes(N));E=H=n.digest().getBytes();for(var u=2;u<=d;++u)n.start(null,null),n.update(H),O=n.digest().getBytes(),E=a.util.xorBytes(E,O,x),H=O;z+=N<A?E:E.substr(0,y)}return z}N=1;l()}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===
typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbkdf2)return c.pbkdf2;c.defined.pbkdf2=!0;for(var q=0;q<g.length;++q)g[q](c);return c.pbkdf2}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbkdf2",["require","module",
"./hmac","./md","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d="undefined"!==typeof process&&process.versions&&process.versions.node,e=null;a.disableNativeCode||!d||process.versions["node-webkit"]||(e=c("crypto"));(a.prng=a.prng||{}).create=function(b){function c(a){if(32<=k.pools[0].messageLength)return d(),a();k.seedFile(32-k.pools[0].messageLength<<5,function(b,c){if(b)return a(b);k.collect(c);d();a()})}function d(){var a=k.plugin.md.create();
a.update(k.pools[0].digest().getBytes());k.pools[0].start();for(var b=1,c=1;32>c;++c)b=31===b?2147483648:b<<2,0===b%k.reseeds&&(a.update(k.pools[c].digest().getBytes()),k.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();k.key=k.plugin.formatKey(b);k.seed=k.plugin.formatSeed(a);k.reseeds=4294967295===k.reseeds?0:k.reseeds+1;k.generated=0}function g(b){var c=null;if("undefined"!==typeof window){var d=window.crypto||window.msCrypto;d&&d.getRandomValues&&(c=function(a){return d.getRandomValues(a)})}var e=
a.util.createBuffer();if(c)for(;e.length()<b;){var h=Math.max(1,Math.min(b-e.length(),65536)/4),k=new Uint32Array(Math.floor(h));try{for(c(k),h=0;h<k.length;++h)e.putInt32(k[h])}catch(z){if(!("undefined"!==typeof QuotaExceededError&&z instanceof QuotaExceededError))throw z;}}if(e.length()<b)for(c=Math.floor(65536*Math.random());e.length()<b;)for(h=16807*(c&65535),c=16807*(c>>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)k=c>>>(h<<3),k^=Math.floor(256*Math.random()),
e.putByte(String.fromCharCode(k&255));return e.getBytes(b)}var k={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),q=0;32>q;++q)h[q]=b.create();k.pools=h;k.pool=0;k.generate=function(b,d){function e(l){if(l)return d(l);if(m.length()>=b)return d(null,m.getBytes(b));1048575<k.generated&&(k.key=null);if(null===k.key)return a.util.nextTick(function(){c(e)});l=g(k.key,k.seed);k.generated+=l.length;m.putBytes(l);k.key=q(g(k.key,h(k.seed)));k.seed=z(g(k.key,k.seed));
a.util.setImmediate(e)}if(!d)return k.generateSync(b);var g=k.plugin.cipher,h=k.plugin.increment,q=k.plugin.formatKey,z=k.plugin.formatSeed,m=a.util.createBuffer();k.key=null;e()};k.generateSync=function(b){var c=k.plugin.cipher,e=k.plugin.increment,g=k.plugin.formatKey,h=k.plugin.formatSeed;k.key=null;for(var q=a.util.createBuffer();q.length()<b;){1048575<k.generated&&(k.key=null);null===k.key&&(32<=k.pools[0].messageLength||k.collect(k.seedFileSync(32-k.pools[0].messageLength<<5)),d());var z=c(k.key,
k.seed);k.generated+=z.length;q.putBytes(z);k.key=g(c(k.key,e(k.seed)));k.seed=h(c(k.key,k.seed))}return q.getBytes(b)};e?(k.seedFile=function(a,b){e.randomBytes(a,function(a,c){if(a)return b(a);b(null,c.toString())})},k.seedFileSync=function(a){return e.randomBytes(a).toString()}):(k.seedFile=function(a,b){try{b(null,g(a))}catch(c){b(c)}},k.seedFileSync=g);k.collect=function(a){for(var b=a.length,c=0;c<b;++c)k.pools[k.pool].update(a.substr(c,1)),k.pool=31===k.pool?0:k.pool+1};k.collectInt=function(a,
b){for(var c="",d=0;d<b;d+=8)c+=String.fromCharCode(a>>d&255);k.collect(c)};k.registerWorker=function(a){a===self?k.seedFile=function(a,b){function c(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",c),b(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",c);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(b){b=b.data;b.forge&&b.forge.prng&&k.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})};
return k}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prng)return c.prng;c.defined.prng=!0;for(var q=0;q<g.length;++q)g[q](c);return c.prng}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,
0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prng",["require","module","./md","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.random&&a.random.getBytes||function(b){function c(){var b=a.prng.create(d);b.getBytes=function(a,c){return b.generate(a,c)};b.getBytesSync=function(a){return b.generate(a)};return b}var d={},g=Array(4),l=a.util.createBuffer();d.formatKey=function(b){var c=a.util.createBuffer(b);b=Array(4);
b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return a.aes._expandKey(b,!1)};d.formatSeed=function(b){var c=a.util.createBuffer(b);b=Array(4);b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return b};d.cipher=function(b,c){a.aes._updateBlock(b,c,g,!1);l.putInt32(g[0]);l.putInt32(g[1]);l.putInt32(g[2]);l.putInt32(g[3]);return l.getBytes()};d.increment=function(a){++a[3];return a};d.md=a.md.sha256;var m=c(),k="undefined"!==typeof process&&process.versions&&
process.versions.node,h=null;if("undefined"!==typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(h=function(a){return r.getRandomValues(a)})}if(a.disableNativeCode||!k&&!h){m.collectInt(+new Date,32);if("undefined"!==typeof navigator){var k="",n;for(n in navigator)try{"string"==typeof navigator[n]&&(k+=navigator[n])}catch(B){}m.collect(k);k=null}b&&(b().mousemove(function(a){m.collectInt(a.clientX,16);m.collectInt(a.clientY,16)}),b().keypress(function(a){m.collectInt(a.charCode,
8)}))}if(a.random)for(n in m)a.random[n]=m[n];else a.random=m;a.random.createInstance=c}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.random)return c.random;c.defined.random=!0;for(var q=0;q<g.length;++q)g[q](c);
return c.random}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,
175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];a.rc2=a.rc2||{};a.rc2.expandKey=function(b,d){"string"===typeof b&&(b=a.util.createBuffer(b));d=d||128;var e=b,g=b.length(),h=d,l=Math.ceil(h/8),h=255>>(h&7),n;for(n=g;128>n;n++)e.putByte(c[e.at(n-
1)+e.at(n-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(n=127-l;0<=n;n--)e.setAt(n,c[e.at(n+1)^e.at(n+l)]);return e};var g=function(b,c,g){var k=!1,h=null,q=null,l=null,n,x,A,y,v=[];b=a.rc2.expandKey(b,c);for(A=0;64>A;A++)v.push(b.getInt16Le());g?(n=function(a){for(A=0;4>A;A++){a[A]+=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var b=a[A],c=d[A];a[A]=b<<c&65535|(b&65535)>>16-c;y++}},x=function(a){for(A=0;4>A;A++)a[A]+=v[a[(A+3)%4]&63]}):(n=function(a){for(A=3;0<=A;A--){var b=a[A],c=d[A];a[A]=
(b&65535)>>c|b<<16-c&65535;a[A]-=v[y]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);y--}},x=function(a){for(A=3;0<=A;A--)a[A]-=v[a[(A+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));k=!1;h=a.util.createBuffer();q=c||new a.util.createBuffer;l=b;z.output=q},update:function(a){for(k||h.putBuffer(a);8<=h.length();){a=[[5,n],[1,x],[6,n],[1,x],[5,n]];var b=[];for(A=0;4>A;A++){var c=h.getInt16Le();null!==l&&(g?c^=l.getInt16Le():l.putInt16Le(c));
b.push(c&65535)}y=g?0:63;for(c=0;c<a.length;c++)for(var d=0;d<a[c][0];d++)a[c][1](b);for(A=0;4>A;A++)null!==l&&(g?l.putInt16Le(b[A]):b[A]^=l.getInt16Le()),q.putInt16Le(b[A])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,h,!g);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(k=!0,z.update());!g&&(b=0===h.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.truncate(c)));return b}}};a.rc2.startEncrypting=function(b,c,d){b=a.rc2.createEncryptionCipher(b,128);b.start(c,d);return b};
a.rc2.createEncryptionCipher=function(a,b){return g(a,b,!0)};a.rc2.startDecrypting=function(b,c,d){b=a.rc2.createDecryptionCipher(b,128);b.start(c,d);return b};a.rc2.createDecryptionCipher=function(a,b){return g(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
{};if(c.defined.rc2)return c.rc2;c.defined.rc2=!0;for(var q=0;q<g.length;++q)g[q](c);return c.rc2}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rc2",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){this.data=[];null!=a&&("number"==typeof a?
this.fromNumber(a,b,d):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function d(){return new c(null)}function g(a,b,c,d,e,p){for(;0<=--p;){var h=b*this.data[a++]+c.data[d]+e;e=Math.floor(h/67108864);c.data[d++]=h&67108863}return e}function l(a,b,c,d,e,p){var g=b&32767;for(b>>=15;0<=--p;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*g,h=g*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function n(a,b,
c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function m(a,b){var c=N[a.charCodeAt(b)];return null==c?-1:c}function k(a){var b=d();b.fromInt(a);return b}function h(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function r(a){this.m=a}function v(a){this.m=a;this.mp=a.invDigit();
this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function B(a,b){return a&b}function x(a,b){return a|b}function A(a,b){return a^b}function y(a,b){return a&~b}function R(){}function z(a){return a}function E(a){this.r2=d();this.q3=d();c.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function O(){return{nextBytes:function(a){for(var b=0;b<a.length;++b)a[b]=Math.floor(256*Math.random())}}}var H;"undefined"===typeof navigator?(c.prototype.am=n,H=28):"Microsoft Internet Explorer"==
navigator.appName?(c.prototype.am=l,H=30):"Netscape"!=navigator.appName?(c.prototype.am=g,H=26):(c.prototype.am=n,H=28);c.prototype.DB=H;c.prototype.DM=(1<<H)-1;c.prototype.DV=1<<H;c.prototype.FV=Math.pow(2,52);c.prototype.F1=52-H;c.prototype.F2=2*H-52;var N=[],u;H=48;for(u=0;9>=u;++u)N[H++]=u;H=97;for(u=10;36>u;++u)N[H++]=u;H=65;for(u=10;36>u;++u)N[H++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce=
function(a){a.divRemTo(this.m,null,a)};r.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};r.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};v.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(c.ZERO)&&this.m.subTo(b,b);return b};v.prototype.revert=function(a){var b=d();a.copyTo(b);this.reduce(b);return b};v.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=
a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};v.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};v.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};c.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};
2022-03-23 21:00:41 +03:00
c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};c.prototype.fromString=function(a,b){var d;if(16==b)d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<<this.DB-g)-1)<<g,this.data[this.t++]=
h>>this.DB-g):this.data[this.t-1]|=h<<g,g+=d,g>=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<g&&(this.data[this.t-1]|=(1<<this.DB-g)-1<<g));this.clamp();p&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,g=Math.floor(a/this.DB),p=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+g+1]=this.data[h]>>d|p,p=(this.data[h]&e)<<c;for(h=g-1;0<=h;--h)b.data[h]=0;b.data[g]=p;b.t=this.t+g+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var p=
c+1;p<this.t;++p)b.data[p-c-1]|=(this.data[p]&g)<<e,b.data[p-c]=this.data[p]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&g)<<e);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),e=a.abs(),g=d.t;for(b.t=g+e.t;0<=--g;)b.data[g]=0;for(g=0;g<e.t;++g)b.data[g+d.t]=d.am(0,e.data[g],b,g,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,g){var p=a.abs();if(!(0>=p.t)){var z=this.abs();if(z.t<p.t)null!=b&&b.fromInt(0),null!=g&&this.copyTo(g);else{null==g&&(g=d());var k=d(),m=this.s;a=a.s;var l=this.DB-h(p.data[p.t-1]);0<l?(p.lShiftTo(l,k),z.lShiftTo(l,g)):(p.copyTo(k),z.copyTo(g));p=k.t;z=k.data[p-1];if(0!=z){var E=z*(1<<this.F1)+(1<p?k.data[p-2]>>this.F2:0),u=this.FV/E,E=(1<<this.F1)/E,y=1<<this.F2,r=g.t,x=r-p,w=null==b?d():b;k.dlShiftTo(x,w);0<=g.compareTo(w)&&
(g.data[g.t++]=1,g.subTo(w,g));c.ONE.dlShiftTo(p,w);for(w.subTo(k,k);k.t<p;)k.data[k.t++]=0;for(;0<=--x;){var O=g.data[--r]==z?this.DM:Math.floor(g.data[r]*u+(g.data[r-1]+y)*E);if((g.data[r]+=k.am(0,O,g,x,0,p))<O)for(k.dlShiftTo(x,w),g.subTo(w,g);g.data[r]<--O;)g.subTo(w,g)}null!=b&&(g.drShiftTo(p,b),m!=a&&c.ZERO.subTo(b,b));g.t=p;g.clamp();0<l&&g.rShiftTo(l,g);0>m&&c.ZERO.subTo(g,g)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var g=d(),p=d(),z=b.convert(this),k=h(a)-1;for(z.copyTo(g);0<=--k;)if(b.sqrTo(g,p),0<(a&1<<k))b.mulTo(p,z,g);else var m=g,g=p,p=m;return b.revert(g)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",g=this.t,p=this.DB-g*this.DB%a;if(0<g--)for(p<this.DB&&0<(c=this.data[g]>>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p<a?(c=(this.data[g]&(1<<p)-1)<<a-p,c|=this.data[--g]>>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+h(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new r(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=z;R.prototype.revert=z;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};E.prototype.revert=function(a){return a};E.prototype.reduce=function(a){a.drShiftTo(this.m.t-
1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],P=67108864/T[T.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
b),c=k(b),g=d(),p=d(),h="";for(this.divRemTo(c,g,p);0<g.signum();)h=(b+p.intValue()).toString(a).substr(1)+h,g.divRemTo(c,g,p);return p.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),g=!1,p=0,h=0,z=0;z<a.length;++z){var k=m(a,z);0>k?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0<p&&(this.dMultiply(Math.pow(b,p)),this.dAddOffset(h,0));g&&c.ZERO.subTo(this,
this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,g=Math.min(a.t,this.t);for(d=
0;d<g;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=g;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=g;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};c.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
2022-03-23 21:00:41 +03:00
0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h<a;++h){do p=new c(this.bitLength(),g);while(0>=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++<d&&0!=
p.compareTo(b);)if(p=p.modPowInt(2,this),0==p.compareTo(c.ONE))return!1;if(0!=p.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
2022-03-23 21:00:41 +03:00
function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&
(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,B,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,x,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,A,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
y,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
2022-03-23 21:00:41 +03:00
0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,x)};c.prototype.clearBit=function(a){return this.changeBit(a,
y)};c.prototype.flipBit=function(a){return this.changeBit(a,A)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),g,p=k(1),z;if(0>=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;z=8>c?new r(b):b.isEven()?new E(b):new v(b);var m=[],l=3,q=g-1,u=(1<<g)-1;m[1]=z.convert(this);if(1<g)for(c=d(),z.sqrTo(m[1],c);l<=u;)m[l]=d(),z.mulTo(c,m[l-2],m[l]),l+=2;for(var y=a.t-1,x,w=!0,O=d(),c=h(a.data[y])-1;0<=y;){c>=q?x=a.data[y]>>c-q&u:(x=(a.data[y]&(1<<c+1)-1)<<q-c,0<y&&(x|=a.data[y-1]>>this.DB+c-q));for(l=g;0==(x&1);)x>>=1,--l;0>(c-=l)&&(c+=this.DB,--y);
if(w)m[x].copyTo(p),w=!1;else{for(;1<l;)z.sqrTo(p,O),z.sqrTo(O,p),l-=2;0<l?z.sqrTo(p,O):(l=p,p=O,O=l);z.mulTo(O,m[x],p)}for(;0<=y&&0==(a.data[y]&1<<c);)z.sqrTo(p,O),l=p,p=O,O=l,0>--c&&(c=this.DB-1,--y)}return z.revert(p)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),g=k(1),p=k(0),h=k(0),z=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1,
g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&z.isEven()||(h.addTo(this,h),z.subTo(a,z)),h.rShiftTo(1,h)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(z,p)):(e.subTo(d,e),b&&h.subTo(g,h),z.subTo(p,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a,
new R)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=T[T.length-1]){for(b=0;b<T.length;++b)if(c.data[0]==T[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<T.length;){for(var d=T[b],e=b+1;e<T.length&&d<P;)d*=T[e++];for(d=c.modInt(d);b<e;)if(0==d%T[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,
n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var l=0;l<g.length;++l)g[l](c);return c.jsbn}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,
0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var g="",k=Math.ceil(d/e.digestLength),h=0;h<k;++h){var l=String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create();
v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;k<e;k++)g+="\x00";d=h.getBytes()+g+"\u0001"+d;if(!l)l=a.random.getBytes(n.digestLength);else if(l.length!==n.digestLength)throw v=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),v.seedLength=l.length,v.digestLength=n.digestLength,
v;b=c(l,b-n.digestLength-1,v);d=a.util.xorBytes(d,b,d.length);n=c(d,n.digestLength,v);return"\x00"+a.util.xorBytes(l,n,l.length)+d};d.decode_rsa_oaep=function(b,d,e,g){var k,h,l;"string"===typeof e?(k=e,h=g||void 0):e&&(k=e.label||void 0,h=e.md||void 0,e.mgf1&&e.mgf1.md&&(l=e.mgf1.md));e=Math.ceil(b.n.bitLength()/8);if(d.length!==e)throw l=Error("RSAES-OAEP encoded message length is invalid."),l.length=d.length,l.expectedLength=e,l;void 0===h?h=a.md.sha1.create():h.start();l||(l=h);if(e<2*h.digestLength+
2)throw Error("RSAES-OAEP key is too short for the hash function.");k||(k="");h.update(k,"raw");k=h.digest().getBytes();b=d.charAt(0);g=d.substring(1,h.digestLength+1);d=d.substring(1+h.digestLength);var n=c(d,h.digestLength,l);g=a.util.xorBytes(g,n,g.length);l=c(g,e-h.digestLength-1,l);d=a.util.xorBytes(d,l,d.length);e=d.substring(0,h.digestLength);l="\x00"!==b;for(b=0;b<h.digestLength;++b)l|=k.charAt(b)!==e.charAt(b);k=1;for(h=b=h.digestLength;h<d.length;h++)e=d.charCodeAt(h),g=e&1^1,l|=e&(k?65534:
0),k&=g,b+=k;if(l||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pkcs1}},
l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,p,h){return"workers"in p?g(a,b,p,h):d(a,b,p,h)}function d(b,c,g,k){var m=l(b,c),z=0,q=n(m.bitLength());"millerRabinTests"in
g&&(q=g.millerRabinTests);var r=10;"maxBlockTime"in g&&(r=g.maxBlockTime);var v=+new Date;do{m.bitLength()>b&&(m=l(b,c));if(m.isProbablePrime(q))return k(null,m);m.dAddOffset(h[z++%8],0)}while(0>r||+new Date-v<r);a.util.setImmediate(function(){d(b,c,g,k)})}function g(b,c,h,m){function q(){function a(e){if(!p){--g;var h=e.data;if(h.found){for(e=0;e<d.length;++e)d[e].terminate();p=!0;return m(null,new k(h.prime,16))}z.bitLength()>b&&(z=l(b,c));h=z.toString(16);e.target.postMessage({hex:h,workLoad:r});
z.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e<E;++e)d[e]=new Worker(v);for(var g=E,e=0;e<E;++e)d[e].addEventListener("message",a);var p=!1}if("undefined"===typeof Worker)return d(b,c,h,m);var z=l(b,c),E=h.workers,r=h.workLoad||100,n=30*r/8,v=h.workerScript||"forge/prime.worker.js";if(-1===E)return a.util.estimateCores(function(a,b){a&&(b=2);E=b-1;q()});q()}function l(a,b){var c=new k(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(k.ONE.shiftLeft(d),v,c);c.dAddOffset(31-c.mod(r).byteValue(),0);return c}
function n(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],r=new k(null);r.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length),
c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===g.name)return c(b,d,g.options,e);throw Error("Invalid prime generation algorithm: "+g.name);}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prime)return c.prime;c.defined.prime=!0;for(var l=
0;l<g.length;++l)g[l](c);return c.prime}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var g=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw g=
2022-03-23 21:00:41 +03:00
Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;h<d;++h)g.putByte(e)}else for(;0<d;){for(var k=0,l=a.random.getBytes(d),h=0;h<d;++h)e=l.charCodeAt(h),0===e?++k:g.putByte(e);d=k}g.putByte(0);g.putBytes(b);return g}function d(b,c,e,g){c=Math.ceil(c.n.bitLength()/8);b=a.util.createBuffer(b);var h=b.getByte(),k=b.getByte();if(0!==h||e&&0!==k&&1!==k||!e&&2!=k||e&&0===k&&"undefined"===
typeof g)throw Error("Encryption block is invalid.");e=0;if(0===k)for(e=c-3-g,g=0;g<e;++g){if(0!==b.getByte())throw Error("Encryption block is invalid.");}else if(1===k)for(e=0;1<b.length();){if(255!==b.getByte()){--b.read;break}++e}else if(2===k)for(e=0;1<b.length();){if(0===b.getByte()){--b.read;break}++e}if(0!==b.getByte()||e!==c-3-b.length())throw Error("Encryption block is invalid.");return b.getBytes()}function g(b,c,d){function e(){k(b.pBits,function(a,c){if(a)return d(a);b.p=c;if(null!==b.q)return l(a,
b.q);k(b.qBits,l)})}function k(b,c){a.prime.generateProbablePrime(b,q,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var g=b.p;b.p=b.q;b.q=g}0!==b.p.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.p=null,e()):0!==b.q.subtract(m.ONE).gcd(b.e).compareTo(m.ONE)?(b.q=null,k(b.qBits,l)):(b.p1=b.p.subtract(m.ONE),b.q1=b.q.subtract(m.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(m.ONE)?(b.p=b.q=null,e()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,k(b.qBits,l)):
(g=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,g,b.p,b.q,g.mod(b.p1),g.mod(b.q1),b.q.modInverse(b.p)),publicKey:h.rsa.setPublicKey(b.n,b.e)},d(null,b.keys))))}"function"===typeof c&&(d=c,c={});c=c||{};var q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);e()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function n(a){return 100>=a?27:
150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof m)var m=a.jsbn.BigInteger;var k=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,r=[6,4,2,4,2,4,6,2],v={name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:k.Class.UNIVERSAL,
type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",
tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},x={name:"RSAPublicKey",tagClass:k.Class.UNIVERSAL,
type:k.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,
type:k.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=function(a){var b;if(a.algorithm in h.oids)b=h.oids[a.algorithm];
else throw b=Error("Unknown message digest algorithm."),b.algorithm=a.algorithm,b;var c=k.oidToDer(b).getBytes();b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var d=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);d.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,c));d.value.push(k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,""));a=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return k.toDer(b).getBytes()},R=function(b,c,d){if(d)return b.modPow(c.e,
c.n);if(!c.p||!c.q)return b.modPow(c.d,c.n);c.dP||(c.dP=c.d.mod(c.p.subtract(m.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(m.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new m(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(m.ONE));b=b.multiply(d.modPow(c.e,c.n)).mod(c.n);var e=b.mod(c.p).modPow(c.dP,c.p);for(b=b.mod(c.q).modPow(c.dQ,c.q);0>e.compareTo(b);)e=e.add(c.p);b=e.subtract(b).multiply(c.qInv).mod(c.p).multiply(c.q).add(b);return b=
2022-03-23 21:00:41 +03:00
b.multiply(d.modInverse(c.n)).mod(c.n)};h.rsa.encrypt=function(b,d,e){var g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new m(e.toHex(),16);d=R(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0<h;)g.putByte(0),--h;g.putBytes(a.util.hexToBytes(d));return g.getBytes()};h.rsa.decrypt=function(b,c,g,h){var k=Math.ceil(c.n.bitLength()/8);if(b.length!==k)throw c=Error("Encrypted message length is invalid."),c.length=
b.length,c.expected=k,c;b=new m(a.util.createBuffer(b).toHex(),16);if(0<=b.compareTo(c.n))throw Error("Encrypted message is invalid.");b=R(b,c,g).toString(16);for(var l=a.util.createBuffer(),k=k-Math.ceil(b.length/2);0<k;)l.putByte(0),--k;l.putBytes(a.util.hexToBytes(b));return!1!==h?d(l.getBytes(),c,g):l.getBytes()};h.rsa.createKeyPairGenerationState=function(b,c,d){"string"===typeof b&&(b=parseInt(b,10));b=b||2048;d=d||{};var e=d.prng||a.random,g={nextBytes:function(a){for(var b=e.getBytesSync(a.length),
c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)b={algorithm:d,state:0,bits:b,rng:g,eInt:c||65537,e:new m(null),p:null,q:null,qBits:b>>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+d);return b};h.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new m(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},g=+new Date,p,k=0;null===a.keys&&
(0>=b||k<b);){if(0===a.state){p=null===a.p?a.pBits:a.qBits;var l=p-1;0===a.pqState?(a.num=new m(p,a.rng),a.num.testBit(l)||a.num.bitwiseTo(m.ONE.shiftLeft(l),e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>p?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(m.ONE).gcd(a.e).compareTo(m.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(m.ONE),a.q1=a.q.subtract(m.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(m.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(p=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q,
p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});p=+new Date;k+=p-g;g=p}return null!==a.keys};h.rsa.generateKeyPair=function(a,b,c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=
c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);var e=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(e,0),e.keys;g(e,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,g){var l={n:b,e:g,encrypt:function(b,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,b,d){return c(a,b,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
b,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');b=d.encode(b,l,!0);return h.rsa.encrypt(b,l,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,l,!0);var c=k.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
l,!0);return a===b}};b=h.rsa.decrypt(b,l,!0,!1);return c.verify(a,b,l.n.bitLength())}};return l};h.setRsaPrivateKey=h.rsa.setPrivateKey=function(b,c,g,k,l,m,q,r){var x={n:b,e:c,d:g,p:k,q:l,dP:m,dQ:q,qInv:r,decrypt:function(b,c,g){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,x,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,g)}};else if(-1!==["RAW","NONE",
"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,x,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:y},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,x.n.bitLength());return h.rsa.encrypt(d,x,c)}};return x};h.wrapRsaPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,
[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];k.validate(b,v,c,d)&&(b=k.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!k.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
c.errors=d,c;var e,g,l,q,y,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();y=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new m(d,16),new m(b,
16),new m(e,16),new m(g,16),new m(l,16),new m(q,16),new m(y,16),new m(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(0).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.d)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.p)),k.create(k.Class.UNIVERSAL,
k.Type.INTEGER,!1,l(a.q)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dP)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.dQ)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(k.validate(b,A,c,d)){d=k.derToOid(c.publicKeyOid);if(d!==h.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!k.validate(b,x,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
c.errors=d,c;d=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return h.setRsaPublicKey(new m(d,16),new m(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.rsaEncryption).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,
!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.n)),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||
{};c.defined=c.defined||{};if(c.defined.rsa)return c.rsa;c.defined.rsa=!0;for(var l=0;l<g.length;++l)g[l](c);return c.rsa}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,
b){return a.start().update(b).digest().getBytes()}if("undefined"===typeof d)var d=a.jsbn.BigInteger;var g=a.asn1,l=a.pki=a.pki||{};l.pbe=a.pbe=a.pbe||{};var n=l.oids,m={name:"EncryptedPrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"encryptionOid"},
{name:"AlgorithmIdentifier.parameters",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},k={name:"PBES2Algorithms",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",
2022-03-23 21:00:41 +03:00
tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,onstructed:!0,capture:"kdfIterationCount"}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:g.Class.UNIVERSAL,
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},h={name:"pkcs-12PbeParams",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"salt"},
{name:"pkcs-12PbeParams.iterations",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"iterations"}]};l.encryptPrivateKeyInfo=function(b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var e=a.random.getBytesSync(d.saltSize),h=d.count,k=g.integerToDer(h),m;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var z,q;switch(d.algorithm){case "aes128":z=m=16;d=n["aes128-CBC"];q=a.aes.createEncryptionCipher;break;case "aes192":m=24;
z=16;d=n["aes192-CBC"];q=a.aes.createEncryptionCipher;break;case "aes256":m=32;z=16;d=n["aes256-CBC"];q=a.aes.createEncryptionCipher;break;case "des":z=m=8;d=n.desCBC;q=a.des.createEncryptionCipher;break;default:throw e=Error("Cannot encrypt private key. Unknown encryption algorithm."),e.algorithm=d.algorithm,e;}var v=a.pkcs5.pbkdf2(c,e,h,m);c=a.random.getBytesSync(z);h=q(v);h.start(c);h.update(g.toDer(b));h.finish();b=h.output.getBytes();e=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,
g.Type.OID,!1,g.oidToDer(n.pkcs5PBES2).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(n.pkcs5PBKDF2).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,e),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k.getBytes())])]),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(d).getBytes()),g.create(g.Class.UNIVERSAL,
g.Type.OCTETSTRING,!1,c)])])])}else if("3des"===d.algorithm)m=24,d=new a.util.ByteBuffer(e),v=l.pbe.generatePkcs12Key(c,d,1,h,m),c=l.pbe.generatePkcs12Key(c,d,2,h,m),h=a.des.createEncryptionCipher(v),h.start(c),h.update(g.toDer(b)),h.finish(),b=h.output.getBytes(),e=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(n["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,
!1,e),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k.getBytes())])]);else throw e=Error("Cannot encrypt private key. Unknown encryption algorithm."),e.algorithm=d.algorithm,e;return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[e,g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,b)])};l.decryptPrivateKeyInfo=function(b,c){var d=null,e={},h=[];if(!g.validate(b,m,e,h))throw d=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=h,d;h=g.derToOid(e.encryptionOid);
h=l.pbe.getCipher(h,e.encryptionParams,c);e=a.util.createBuffer(e.encryptedData);h.update(e);h.finish()&&(d=g.fromDer(h.output));return d};l.encryptedPrivateKeyToPem=function(b,c){var d={type:"ENCRYPTED PRIVATE KEY",body:g.toDer(b).getBytes()};return a.pem.encode(d,{maxline:c})};l.encryptedPrivateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("ENCRYPTED PRIVATE KEY"!==b.type){var c=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');c.headerType=
b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return g.fromDer(b.body)};l.encryptRsaPrivateKey=function(b,c,d){d=d||{};if(!d.legacy)return b=l.wrapRsaPrivateKey(l.privateKeyToAsn1(b)),b=l.encryptPrivateKeyInfo(b,c,d),l.encryptedPrivateKeyToPem(b);var e,h,k;switch(d.algorithm){case "aes128":d="AES-128-CBC";h=16;e=a.random.getBytesSync(16);k=a.aes.createEncryptionCipher;break;case "aes192":d="AES-192-CBC";
h=24;e=a.random.getBytesSync(16);k=a.aes.createEncryptionCipher;break;case "aes256":d="AES-256-CBC";h=32;e=a.random.getBytesSync(16);k=a.aes.createEncryptionCipher;break;case "3des":d="DES-EDE3-CBC";h=24;e=a.random.getBytesSync(8);k=a.des.createEncryptionCipher;break;case "des":d="DES-CBC";h=8;e=a.random.getBytesSync(8);k=a.des.createEncryptionCipher;break;default:throw b=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+d.algorithm+'".'),b.algorithm=d.algorithm,b;}c=a.pbe.opensslDeriveBytes(c,
e.substr(0,8),h);c=k(c);c.start(e);c.update(g.toDer(l.privateKeyToAsn1(b)));c.finish();b={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:d,parameters:a.util.bytesToHex(e).toUpperCase()},body:c.output.getBytes()};return a.pem.encode(b)};l.decryptRsaPrivateKey=function(b,c){var d=null,e=a.pem.decode(b)[0];if("ENCRYPTED PRIVATE KEY"!==e.type&&"PRIVATE KEY"!==e.type&&"RSA PRIVATE KEY"!==e.type)throw d=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'),
d.headerType=d,d;if(e.procType&&"ENCRYPTED"===e.procType.type){var h,k;switch(e.dekInfo.algorithm){case "DES-CBC":h=8;k=a.des.createDecryptionCipher;break;case "DES-EDE3-CBC":h=24;k=a.des.createDecryptionCipher;break;case "AES-128-CBC":h=16;k=a.aes.createDecryptionCipher;break;case "AES-192-CBC":h=24;k=a.aes.createDecryptionCipher;break;case "AES-256-CBC":h=32;k=a.aes.createDecryptionCipher;break;case "RC2-40-CBC":h=5;k=function(b){return a.rc2.createDecryptionCipher(b,40)};break;case "RC2-64-CBC":h=
8;k=function(b){return a.rc2.createDecryptionCipher(b,64)};break;case "RC2-128-CBC":h=16;k=function(b){return a.rc2.createDecryptionCipher(b,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+e.dekInfo.algorithm+'".'),d.algorithm=e.dekInfo.algorithm,d;}var m=a.util.hexToBytes(e.dekInfo.parameters);h=a.pbe.opensslDeriveBytes(c,m.substr(0,8),h);k=k(h);k.start(m);k.update(a.util.createBuffer(e.body));if(k.finish())d=k.output.getBytes();else return d}else d=
e.body;d="ENCRYPTED PRIVATE KEY"===e.type?l.decryptPrivateKeyInfo(g.fromDer(d),c):g.fromDer(d);null!==d&&(d=l.privateKeyFromAsn1(d));return d};l.pbe.generatePkcs12Key=function(b,c,d,e,g,h){var k,l;if("undefined"===typeof h||null===h)h=a.md.sha1.create();var m=h.digestLength,q=h.blockLength,n=new a.util.ByteBuffer,v=new a.util.ByteBuffer;if(null!==b&&void 0!==b){for(l=0;l<b.length;l++)v.putInt16(b.charCodeAt(l));v.putInt16(0)}b=v.length();var u=c.length(),w=new a.util.ByteBuffer;w.fillWithByte(d,q);
var C=q*Math.ceil(u/q);d=new a.util.ByteBuffer;for(l=0;l<C;l++)d.putByte(c.at(l%u));C=q*Math.ceil(b/q);c=new a.util.ByteBuffer;for(l=0;l<C;l++)c.putByte(v.at(l%b));v=d;v.putBuffer(c);c=Math.ceil(g/m);for(d=1;d<=c;d++){C=new a.util.ByteBuffer;C.putBytes(w.bytes());C.putBytes(v.bytes());for(l=0;l<e;l++)h.start(),h.update(C.getBytes()),C=h.digest();var D=new a.util.ByteBuffer;for(l=0;l<q;l++)D.putByte(C.at(l%m));var Y=Math.ceil(u/q)+Math.ceil(b/q),L=new a.util.ByteBuffer;for(k=0;k<Y;k++){var ea=new a.util.ByteBuffer(v.getBytes(q)),
V=511;for(l=D.length()-1;0<=l;l--)V>>=8,V+=D.at(l)+ea.at(l),ea.setAt(l,V&255);L.putBuffer(ea)}v=L;n.putBuffer(C)}n.truncate(n.length()-g);return n};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
"pbewithSHAAnd40BitRC2-CBC"],b;}};l.pbe.getCipherForPBES2=function(b,c,d){var e={};b=[];if(!g.validate(c,k,e,b)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");h.errors=b;throw h;}b=g.derToOid(e.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw h=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),h.oid=b,h.supportedOids=["pkcs5PBKDF2"],h;b=g.derToOid(e.encOid);if(b!==l.oids["aes128-CBC"]&&
b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),h.oid=b,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h;c=e.kdfSalt;var m=a.util.createBuffer(e.kdfIterationCount),m=m.getInt(m.length()<<3),q;switch(l.oids[b]){case "aes128-CBC":q=16;h=a.aes.createDecryptionCipher;break;case "aes192-CBC":q=24;h=a.aes.createDecryptionCipher;break;
case "aes256-CBC":q=32;h=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":q=24;h=a.des.createDecryptionCipher;break;case "desCBC":q=8,h=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,m,q);e=e.encIv;h=h(b);h.start(e);return h};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var e={},k=[];if(!g.validate(c,h,e,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(e.salt),e=a.util.createBuffer(e.iterations),
e=e.getInt(e.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=5;c=8;b=function(b,c){var d=a.rc2.createDecryptionCipher(b,40);d.start(c,null);return d};break;default:throw d=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),d.oid=b,d;}m=l.pbe.generatePkcs12Key(d,k,1,e,m);d=l.pbe.generatePkcs12Key(d,k,2,e,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"===
typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k<e;++l,k+=16)h.push(c(g,h[l-1]+b+d));return h.join("").substr(0,e)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbe)return c.pbe;c.defined.pbe=!0;for(var l=
0;l<g.length;++l)g[l](c);return c.pbe}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=
2022-03-23 21:00:41 +03:00
a.pkcs7||{};a.pkcs7.asn1=d;a={name:"ContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};d.contentInfoValidator=a;var g={name:"EncryptedContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",
tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",
2022-03-23 21:00:41 +03:00
tagClass:c.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};d.envelopedDataValidator={name:"EnvelopedData",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(g)};d.encryptedDataValidator={name:"EncryptedData",
tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"}].concat(g)};d.signedDataValidator={name:"SignedData",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0,
captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,capture:"signerInfos",optional:!0,value:[{name:"SignerInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:c.Class.UNIVERSAL,
type:c.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,
value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,
constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]};d.recipientInfoValidator={name:"RecipientInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,
constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,
2022-03-23 21:00:41 +03:00
value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===
typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7asn1)return c.pkcs7asn1;c.defined.pkcs7asn1=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pkcs7asn1}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs7asn1",
["require","module","./asn1","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};(a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(b){return{generate:function(c,d){for(var g=new a.util.ByteBuffer,l=Math.ceil(d/b.digestLength),m=0;m<l;m++){var k=new a.util.ByteBuffer;k.putInt32(m);b.start();b.update(c+k.getBytes());g.putBuffer(b.digest())}g.truncate(g.length()-d);return g.getBytes()}}}}if("function"!==typeof a)if("object"===typeof module&&
module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.mgf1)return c.mgf1;c.defined.mgf1=!0;for(var l=0;l<g.length;++l)g[l](c);return c.mgf1}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,
Array.prototype.slice.call(arguments,0))};a("js/mgf1",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};a.mgf.mgf1=a.mgf1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
{};if(c.defined.mgf)return c.mgf;c.defined.mgf=!0;for(var l=0;l<g.length;++l)g[l](c);return c.mgf}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/mgf",["require","module","./mgf1"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.pss=a.pss||{}).create=function(b){3===arguments.length&&
(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,g=c.digestLength,l=b.salt||null;"string"===typeof l&&(l=a.util.createBuffer(l));var m;if("saltLength"in b)m=b.saltLength;else if(null!==l)m=l.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==l&&l.length()!==m)throw Error("Given salt length does not match length of given salt.");var k=b.prng||a.random;return{encode:function(b,q){var n,v=q-1,x=Math.ceil(v/8),A=b.digest().getBytes();
if(x<g+m+2)throw Error("Message is too long to encrypt.");var y;y=null===l?k.getBytesSync(m):l.bytes();n=new a.util.ByteBuffer;n.fillWithByte(0,8);n.putBytes(A);n.putBytes(y);c.start();c.update(n.getBytes());A=c.digest().getBytes();n=new a.util.ByteBuffer;n.fillWithByte(0,x-m-g-2);n.putByte(1);n.putBytes(y);var R=n.getBytes(),z=x-g-1,E=d.generate(A,z);y="";for(n=0;n<z;n++)y+=String.fromCharCode(R.charCodeAt(n)^E.charCodeAt(n));v=65280>>8*x-v&255;y=String.fromCharCode(y.charCodeAt(0)&~v)+y.substr(1);
return y+A+String.fromCharCode(188)},verify:function(b,k,l){var q;q=l-1;l=Math.ceil(q/8);k=k.substr(-l);if(l<g+m+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==k.charCodeAt(l-1))throw Error("Encoded message does not end in 0xBC.");var n=l-g-1,v=k.substr(0,n);k=k.substr(n,g);var y=65280>>8*l-q&255;if(0!==(v.charCodeAt(0)&y))throw Error("Bits beyond keysize not zero as expected.");var R=d.generate(k,n),z="";for(q=0;q<n;q++)z+=String.fromCharCode(v.charCodeAt(q)^R.charCodeAt(q));
z=String.fromCharCode(z.charCodeAt(0)&~y)+z.substr(1);l=l-g-m-2;for(q=0;q<l;q++)if(0!==z.charCodeAt(q))throw Error("Leftmost octets not zero as expected");if(1!==z.charCodeAt(l))throw Error("Inconsistent PSS signature, 0x01 marker not found");l=z.substr(-m);n=new a.util.ByteBuffer;n.fillWithByte(0,8);n.putBytes(b);n.putBytes(l);c.start();c.update(n.getBytes());b=c.digest().getBytes();return k===b}}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,
module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pss)return c.pss;c.defined.pss=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pss}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pss",
["require","module","./random","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b){"string"===typeof b&&(b={shortName:b});for(var d=null,e,g=0;null===d&&g<a.attributes.length;++g)e=a.attributes[g],b.type&&b.type===e.type?d=e:b.name&&b.name===e.name?d=e:b.shortName&&b.shortName===e.shortName&&(d=e);return d}function d(b){var c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),e;b=b.attributes;for(var g=0;g<b.length;++g){e=b[g];
var h=e.value,l=k.Type.PRINTABLESTRING;"valueTagClass"in e&&(l=e.valueTagClass,l===k.Type.UTF8&&(h=a.util.encodeUtf8(h)));e=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.type).getBytes()),k.create(k.Class.UNIVERSAL,l,!1,h)])]);c.value.push(e)}return c}function g(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in h.oids?b.name=h.oids[b.type]:b.shortName&&b.shortName in
v&&(b.name=h.oids[v[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in h.oids)b.type=h.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in v&&(b.shortName=v[b.name]);if(b.type===r.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=k.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(h.certificateExtensionToAsn1(l(b.extensions[d])))}if("undefined"===
typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function l(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in h.oids&&(b.name=h.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in h.oids)b.id=h.oids[b.name];else{var d=Error("Extension ID not specified.");d.extension=b;throw d;}if("undefined"!==typeof b.value)return b;if("keyUsage"===b.name){var e=d=0,g=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
(e|=16,d=4);b.keyAgreement&&(e|=8,d=3);b.keyCertSign&&(e|=4,d=2);b.cRLSign&&(e|=2,d=1);b.encipherOnly&&(e|=1,d=0);b.decipherOnly&&(g|=128,d=7);d=String.fromCharCode(d);0!==g?d+=String.fromCharCode(e)+String.fromCharCode(g):0!==e&&(d+=String.fromCharCode(e));b.value=k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,d)}else if("basicConstraints"===b.name)b.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),b.cA&&b.value.value.push(k.create(k.Class.UNIVERSAL,k.Type.BOOLEAN,!1,String.fromCharCode(255))),
"pathLenConstraint"in b&&b.value.value.push(k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(b.pathLenConstraint).getBytes()));else if("extKeyUsage"===b.name)for(e in b.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),d=b.value.value,b)!0===b[e]&&(e in r?d.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r[e]).getBytes())):-1!==e.indexOf(".")&&d.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e).getBytes())));else if("nsCertType"===b.name)e=d=0,b.client&&(e|=128,
d=7),b.server&&(e|=64,d=6),b.email&&(e|=32,d=5),b.objsign&&(e|=16,d=4),b.reserved&&(e|=8,d=3),b.sslCA&&(e|=4,d=2),b.emailCA&&(e|=2,d=1),b.objCA&&(e|=1,d=0),d=String.fromCharCode(d),0!==e&&(d+=String.fromCharCode(e)),b.value=k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,d);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),g=0;g<b.altNames.length;++g){e=b.altNames[g];d=e.value;if(7===e.type&&e.ip){if(d=a.util.bytesFromIP(e.ip),
null===d)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),d.extension=b,d;}else 8===e.type&&(d=e.oid?k.oidToDer(k.oidToDer(e.oid)):k.oidToDer(d));b.value.value.push(k.create(k.Class.CONTEXT_SPECIFIC,e.type,!1,d))}else"subjectKeyIdentifier"===b.name&&c.cert&&(d=c.cert.generateSubjectKeyIdentifier(),b.subjectKeyIdentifier=d.toHex(),b.value=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,d.getBytes()));if("undefined"===typeof b.value)throw d=Error("Extension value not specified."),
d.extension=b,d;return b}function n(a,b){switch(a){case r["RSASSA-PSS"]:var c=[];void 0!==b.hash.algorithmOid&&c.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(b.hash.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")])]));void 0!==b.mgf.algorithmOid&&c.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,
!1,k.oidToDer(b.mgf.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(b.mgf.hash.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")])])]));void 0!==b.saltLength&&c.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(b.saltLength).getBytes())]));return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,c);default:return k.create(k.Class.UNIVERSAL,k.Type.NULL,
!1,"")}}function m(b){var c=k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===b.attributes.length)return c;b=b.attributes;for(var d=0;d<b.length;++d){var e=b[d],g=e.value,h=k.Type.UTF8;"valueTagClass"in e&&(h=e.valueTagClass);h===k.Type.UTF8&&(g=a.util.encodeUtf8(g));var l=!1;"valueConstructed"in e&&(l=e.valueConstructed);e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.type).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,
h,l,g)])]);c.value.push(e)}return c}var k=a.asn1,h=a.pki=a.pki||{},r=h.oids,v={};v.CN=r.commonName;v.commonName="CN";v.C=r.countryName;v.countryName="C";v.L=r.localityName;v.localityName="L";v.ST=r.stateOrProvinceName;v.stateOrProvinceName="ST";v.O=r.organizationName;v.organizationName="O";v.OU=r.organizationalUnitName;v.organizationalUnitName="OU";v.E=r.emailAddress;v.emailAddress="E";var B=a.pki.rsa.publicKeyValidator,x={name:"Certificate",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,
value:[{name:"Certificate.TBSCertificate",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,
capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,
constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:k.Class.UNIVERSAL,type:k.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:k.Class.UNIVERSAL,type:k.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},
{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:k.Class.UNIVERSAL,type:k.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:k.Class.UNIVERSAL,type:k.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},B,{name:"Certificate.TBSCertificate.issuerUniqueID",
tagClass:k.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:k.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},
{name:"Certificate.TBSCertificate.extensions",tagClass:k.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},
{name:"Certificate.signatureValue",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},A={name:"rsapss",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,type:k.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,
type:k.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:k.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,type:k.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:k.Class.UNIVERSAL,
type:k.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:k.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:k.Class.UNIVERSAL,type:k.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:k.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",
tagClass:k.Class.UNIVERSAL,type:k.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},y={name:"CertificationRequest",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},B,{name:"CertificationRequestInfo.attributes",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:k.Class.UNIVERSAL,
type:k.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};h.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,g,h=0;h<a.value.length;++h){d=a.value[h];for(var p=0;p<d.value.length;++p)g={},e=d.value[p],g.type=k.derToOid(e.value[0].value),g.value=e.value[1].value,g.valueTagClass=e.value[1].type,g.type in r&&(g.name=r[g.type],g.name in v&&(g.shortName=v[g.name])),b&&(b.update(g.type),b.update(g.value)),c.push(g)}return c};h.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
a[c],e=k.derToOid(d.value[0].value),d=d.value[1].value,g=0;g<d.length;++g){var p={};p.type=e;p.value=d[g].value;p.valueTagClass=d[g].type;p.type in r&&(p.name=r[p.type],p.name in v&&(p.shortName=v[p.name]));if(p.type===r.extensionRequest){p.extensions=[];for(var l=0;l<p.value.length;++l)p.extensions.push(h.certificateExtensionFromAsn1(p.value[l]))}b.push(p)}return b};var R=function(a,b,c){var d={};if(a!==r["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:r.sha1},mgf:{algorithmOid:r.mgf1,hash:{algorithmOid:r.sha1}},
saltLength:20});c={};a=[];if(!k.validate(b,A,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=k.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=k.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=k.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};h.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=k.fromDer(b.body,d);return h.certificateFromAsn1(d,c)};h.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:k.toDer(h.certificateToAsn1(b)).getBytes()};
return a.pem.encode(d,{maxline:c})};h.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=k.fromDer(b.body);return h.publicKeyFromAsn1(b)};h.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
body:k.toDer(h.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};h.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:k.toDer(h.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};h.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=k.toDer(h.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=k.toDer(h.publicKeyToAsn1(b)).getBytes();
break;default:throw Error('Unknown fingerprint type "'+c.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===c.encoding)return d=d.toHex(),c.delimiter?d.match(/.{2}/g).join(c.delimiter):d;if("binary"===c.encoding)return d.getBytes();if(c.encoding)throw Error('Unknown encoding "'+c.encoding+'".');return d};h.certificationRequestFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE REQUEST"!==b.type)throw c=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=k.fromDer(b.body,d);return h.certificationRequestFromAsn1(d,c)};h.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:k.toDer(h.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};h.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
2022-03-23 21:00:41 +03:00
null;b.validity={};b.validity.notBefore=new Date;b.validity.notAfter=new Date;b.issuer={};b.issuer.getField=function(a){return c(b.issuer,a)};b.issuer.addField=function(a){g([a]);b.issuer.attributes.push(a)};b.issuer.attributes=[];b.issuer.hash=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){g([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.extensions=[];b.publicKey=null;b.md=null;b.setSubject=function(a,c){g(a);
b.subject.attributes=a;delete b.subject.uniqueId;c&&(b.subject.uniqueId=c);b.subject.hash=null};b.setIssuer=function(a,c){g(a);b.issuer.attributes=a;delete b.issuer.uniqueId;c&&(b.issuer.uniqueId=c);b.issuer.hash=null};b.setExtensions=function(a){for(var c=0;c<a.length;++c)l(a[c],{cert:b});b.extensions=a};b.getExtension=function(a){"string"===typeof a&&(a={name:a});for(var c=null,d,e=0;null===c&&e<b.extensions.length;++e)d=b.extensions[e],a.id&&d.id===a.id?c=d:a.name&&d.name===a.name&&(c=d);return c};
b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=r[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=e;b.tbsCertificate=h.getTBSCertificate(b);e=k.toDer(b.tbsCertificate);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(c){var d=!1;if(!b.issued(c)){var d=b.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
2022-03-23 21:00:41 +03:00
e.expectedIssuer=c.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=c.md;if(null===e){if(c.signatureOid in r)switch(r[c.signatureOid]){case "sha1WithRSAEncryption":e=a.md.sha1.create();break;case "md5WithRSAEncryption":e=a.md.md5.create();break;case "sha256WithRSAEncryption":e=a.md.sha256.create();break;case "sha512WithRSAEncryption":e=a.md.sha512.create();break;case "RSASSA-PSS":e=a.md.sha256.create()}if(null===e)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
e.signatureOid=c.signatureOid,e;var g=c.tbsCertificate||h.getTBSCertificate(c),g=k.toDer(g);e.update(g.getBytes())}if(null!==e){var l;switch(c.signatureOid){case r.sha1WithRSAEncryption:l=void 0;break;case r["RSASSA-PSS"]:d=r[c.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=c.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;l=r[c.signatureParameters.mgf.algorithmOid];if(void 0===l||void 0===a.mgf[l])throw e=Error("Unsupported MGF function."),
e.oid=c.signatureParameters.mgf.algorithmOid,e.name=l,e;l=a.mgf[l].create(a.md[d].create());d=r[c.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:c.signatureParameters.hash.algorithmOid,name:d};l=a.pss.create(a.md[d].create(),l,c.signatureParameters.saltLength)}d=b.publicKey.verify(e.digest().getBytes(),c.signature,l)}return d};b.isIssuer=function(a){var c=!1,d=b.issuer;a=a.subject;if(d.hash&&a.hash)c=d.hash===a.hash;
2022-03-23 21:00:41 +03:00
else if(d.attributes.length===a.attributes.length)for(var c=!0,e,g,h=0;c&&h<d.attributes.length;++h)if(e=d.attributes[h],g=a.attributes[h],e.type!==g.type||e.value!==g.value)c=!1;return c};b.issued=function(a){return a.isIssuer(b)};b.generateSubjectKeyIdentifier=function(){return h.getPublicKeyFingerprint(b.publicKey,{type:"RSAPublicKey"})};b.verifySubjectKeyIdentifier=function(){for(var c=r.subjectKeyIdentifier,d=0;d<b.extensions.length;++d){var e=b.extensions[d];if(e.id===c)return c=b.generateSubjectKeyIdentifier().getBytes(),
a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};h.certificateFromAsn1=function(b,d){var e={},l=[];if(!k.validate(b,x,e,l))throw e=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),e.errors=l,e;if("string"!==typeof e.certSignature){for(var l="\x00",m=0;m<e.certSignature.length;++m)l+=k.toDer(e.certSignature[m]).getBytes();e.certSignature=l}var l=k.derToOid(e.publicKeyOid),y=h.createCertificate();y.version=e.certVersion?e.certVersion.charCodeAt(0):
0;m=a.util.createBuffer(e.certSerialNumber);y.serialNumber=m.toHex();y.signatureOid=a.asn1.derToOid(e.certSignatureOid);y.signatureParameters=R(y.signatureOid,e.certSignatureParams,!0);y.siginfo.algorithmOid=a.asn1.derToOid(e.certinfoSignatureOid);y.siginfo.parameters=R(y.siginfo.algorithmOid,e.certinfoSignatureParams,!1);m=a.util.createBuffer(e.certSignature);++m.read;y.signature=m.getBytes();m=[];void 0!==e.certValidity1UTCTime&&m.push(k.utcTimeToDate(e.certValidity1UTCTime));void 0!==e.certValidity2GeneralizedTime&&
m.push(k.generalizedTimeToDate(e.certValidity2GeneralizedTime));void 0!==e.certValidity3UTCTime&&m.push(k.utcTimeToDate(e.certValidity3UTCTime));void 0!==e.certValidity4GeneralizedTime&&m.push(k.generalizedTimeToDate(e.certValidity4GeneralizedTime));if(2<m.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>m.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
y.validity.notBefore=m[0];y.validity.notAfter=m[1];y.tbsCertificate=e.tbsCertificate;if(d){y.md=null;if(y.signatureOid in r)switch(l=r[y.signatureOid],l){case "sha1WithRSAEncryption":y.md=a.md.sha1.create();break;case "md5WithRSAEncryption":y.md=a.md.md5.create();break;case "sha256WithRSAEncryption":y.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":y.md=a.md.sha512.create();break;case "RSASSA-PSS":y.md=a.md.sha256.create()}if(null===y.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
e.signatureOid=y.signatureOid,e;m=k.toDer(y.tbsCertificate);y.md.update(m.getBytes())}m=a.md.sha1.create();y.issuer.getField=function(a){return c(y.issuer,a)};y.issuer.addField=function(a){g([a]);y.issuer.attributes.push(a)};y.issuer.attributes=h.RDNAttributesAsArray(e.certIssuer,m);e.certIssuerUniqueId&&(y.issuer.uniqueId=e.certIssuerUniqueId);y.issuer.hash=m.digest().toHex();m=a.md.sha1.create();y.subject.getField=function(a){return c(y.subject,a)};y.subject.addField=function(a){g([a]);y.subject.attributes.push(a)};
y.subject.attributes=h.RDNAttributesAsArray(e.certSubject,m);e.certSubjectUniqueId&&(y.subject.uniqueId=e.certSubjectUniqueId);y.subject.hash=m.digest().toHex();y.extensions=e.certExtensions?h.certificateExtensionsFromAsn1(e.certExtensions):[];l===h.oids.rsaEncryption&&(y.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo));return y};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(h.certificateExtensionFromAsn1(d.value[e]));
return b};h.certificateExtensionFromAsn1=function(b){var c={};c.id=k.derToOid(b.value[0].value);c.critical=!1;b.value[1].type===k.Type.BOOLEAN?(c.critical=0!==b.value[1].value.charCodeAt(0),c.value=b.value[2].value):c.value=b.value[1].value;if(c.id in r)if(c.name=r[c.id],"keyUsage"===c.name){b=k.fromDer(c.value);var d=0,e=0;1<b.value.length&&(d=b.value.charCodeAt(1),e=2<b.value.length?b.value.charCodeAt(2):0);c.digitalSignature=128===(d&128);c.nonRepudiation=64===(d&64);c.keyEncipherment=32===(d&
32);c.dataEncipherment=16===(d&16);c.keyAgreement=8===(d&8);c.keyCertSign=4===(d&4);c.cRLSign=2===(d&2);c.encipherOnly=1===(d&1);c.decipherOnly=128===(e&128)}else if("basicConstraints"===c.name)b=k.fromDer(c.value),c.cA=0<b.value.length&&b.value[0].type===k.Type.BOOLEAN?0!==b.value[0].value.charCodeAt(0):!1,d=null,0<b.value.length&&b.value[0].type===k.Type.INTEGER?d=b.value[0].value:1<b.value.length&&(d=b.value[1].value),null!==d&&(c.pathLenConstraint=k.derToInteger(d));else if("extKeyUsage"===c.name)for(b=
k.fromDer(c.value),d=0;d<b.value.length;++d)e=k.derToOid(b.value[d].value),e in r?c[r[e]]=!0:c[e]=!0;else if("nsCertType"===c.name)b=k.fromDer(c.value),d=0,1<b.value.length&&(d=b.value.charCodeAt(1)),c.client=128===(d&128),c.server=64===(d&64),c.email=32===(d&32),c.objsign=16===(d&16),c.reserved=8===(d&8),c.sslCA=4===(d&4),c.emailCA=2===(d&2),c.objCA=1===(d&1);else if("subjectAltName"===c.name||"issuerAltName"===c.name)for(c.altNames=[],b=k.fromDer(c.value),e=0;e<b.value.length;++e){var d=b.value[e],
g={type:d.type,value:d.value};c.altNames.push(g);switch(d.type){case 7:g.ip=a.util.bytesToIP(d.value);break;case 8:g.oid=k.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=k.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};h.certificationRequestFromAsn1=function(b,d){var e={},l=[];if(!k.validate(b,y,e,l))throw e=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),e.errors=l,e;if("string"!==typeof e.csrSignature){for(var l=
"\x00",m=0;m<e.csrSignature.length;++m)l+=k.toDer(e.csrSignature[m]).getBytes();e.csrSignature=l}l=k.derToOid(e.publicKeyOid);if(l!==h.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var u=h.createCertificationRequest();u.version=e.csrVersion?e.csrVersion.charCodeAt(0):0;u.signatureOid=a.asn1.derToOid(e.csrSignatureOid);u.signatureParameters=R(u.signatureOid,e.csrSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(e.csrSignatureOid);u.siginfo.parameters=R(u.siginfo.algorithmOid,
e.csrSignatureParams,!1);l=a.util.createBuffer(e.csrSignature);++l.read;u.signature=l.getBytes();u.certificationRequestInfo=e.certificationRequestInfo;if(d){u.md=null;if(u.signatureOid in r)switch(l=r[u.signatureOid],l){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===
u.md)throw e=Error("Could not compute certification request digest. Unknown signature OID."),e.signatureOid=u.signatureOid,e;l=k.toDer(u.certificationRequestInfo);u.md.update(l.getBytes())}l=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){g([a]);u.subject.attributes.push(a)};u.subject.attributes=h.RDNAttributesAsArray(e.certificationRequestInfoSubject,l);u.subject.hash=l.digest().toHex();u.publicKey=h.publicKeyFromAsn1(e.subjectPublicKeyInfo);
u.getAttribute=function(a){return c(u,a)};u.addAttribute=function(a){g([a]);u.attributes.push(a)};u.attributes=h.CRIAttributesAsArray(e.certificationRequestInfoAttributes||[]);return u};h.createCertificationRequest=function(){var b={version:0,signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){g([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.publicKey=
2022-03-23 21:00:41 +03:00
null;b.attributes=[];b.getAttribute=function(a){return c(b,a)};b.addAttribute=function(a){g([a]);b.attributes.push(a)};b.md=null;b.setSubject=function(a){g(a);b.subject.attributes=a;b.subject.hash=null};b.setAttributes=function(a){g(a);b.attributes=a};b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=r[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=
e;b.certificationRequestInfo=h.getCertificationRequestInfo(b);e=k.toDer(b.certificationRequestInfo);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(){var c=!1,d=b.md;if(null===d){if(b.signatureOid in r)switch(r[b.signatureOid]){case "sha1WithRSAEncryption":d=a.md.sha1.create();break;case "md5WithRSAEncryption":d=a.md.md5.create();break;case "sha256WithRSAEncryption":d=a.md.sha256.create();break;case "sha512WithRSAEncryption":d=a.md.sha512.create();break;case "RSASSA-PSS":d=a.md.sha256.create()}if(null===
d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=b.signatureOid,d;var e=b.certificationRequestInfo||h.getCertificationRequestInfo(b),e=k.toDer(e);d.update(e.getBytes())}if(null!==d){var g;switch(b.signatureOid){case r["RSASSA-PSS"]:c=r[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;g=r[b.signatureParameters.mgf.algorithmOid];
2022-03-23 21:00:41 +03:00
if(void 0===g||void 0===a.mgf[g])throw d=Error("Unsupported MGF function."),d.oid=b.signatureParameters.mgf.algorithmOid,d.name=g,d;g=a.mgf[g].create(a.md[c].create());c=r[b.signatureParameters.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported RSASSA-PSS hash function."),d.oid=b.signatureParameters.hash.algorithmOid,d.name=c,d;g=a.pss.create(a.md[c].create(),g,b.signatureParameters.saltLength)}c=b.publicKey.verify(d.digest().getBytes(),b.signature,g)}return c};return b};
h.getTBSCertificate=function(b){var c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(b.version).getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber)),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(b.siginfo.algorithmOid).getBytes()),n(b.siginfo.algorithmOid,b.siginfo.parameters)]),d(b.issuer),k.create(k.Class.UNIVERSAL,
k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.UTCTIME,!1,k.dateToUtcTime(b.validity.notBefore)),k.create(k.Class.UNIVERSAL,k.Type.UTCTIME,!1,k.dateToUtcTime(b.validity.notAfter))]),d(b.subject),h.publicKeyToAsn1(b.publicKey)]);b.issuer.uniqueId&&c.value.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,[k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,String.fromCharCode(0)+b.issuer.uniqueId)]));b.subject.uniqueId&&c.value.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!0,[k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,
!1,String.fromCharCode(0)+b.subject.uniqueId)]));0<b.extensions.length&&c.value.push(h.certificateExtensionsToAsn1(b.extensions));return c};h.getCertificationRequestInfo=function(a){return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(a.version).getBytes()),d(a.subject),h.publicKeyToAsn1(a.publicKey),m(a)])};h.distinguishedNameToAsn1=function(a){return d(a)};h.certificateToAsn1=function(a){var b=a.tbsCertificate||h.getTBSCertificate(a);
return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[b,k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(a.signatureOid).getBytes()),n(a.signatureOid,a.signatureParameters)]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};h.certificateExtensionsToAsn1=function(a){var b=k.create(k.Class.CONTEXT_SPECIFIC,3,!0,[]),c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(h.certificateExtensionToAsn1(a[d]));
return b};h.certificateExtensionToAsn1=function(a){var b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);b.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(a.id).getBytes()));a.critical&&b.value.push(k.create(k.Class.UNIVERSAL,k.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=k.toDer(c).getBytes());b.value.push(k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,c));return b};h.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||
h.getCertificationRequestInfo(a);return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[b,k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(a.signatureOid).getBytes()),n(a.signatureOid,a.signatureParameters)]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};h.createCaStore=function(b){function c(b){if(!b.hash){var l=a.md.sha1.create();b.attributes=h.RDNAttributesAsArray(d(b),l);b.hash=l.digest().toHex()}return g.certs[b.hash]||
null}var g={certs:{},getIssuer:function(a){return c(a.issuer)},addCertificate:function(b){"string"===typeof b&&(b=a.pki.certificateFromPem(b));if(!b.subject.hash){var c=a.md.sha1.create();b.subject.attributes=h.RDNAttributesAsArray(d(b.subject),c);b.subject.hash=c.digest().toHex()}b.subject.hash in g.certs?(c=g.certs[b.subject.hash],a.util.isArray(c)||(c=[c]),c.push(b)):g.certs[b.subject.hash]=b},hasCertificate:function(b){var d=c(b.subject);if(!d)return!1;a.util.isArray(d)||(d=[d]);b=k.toDer(h.certificateToAsn1(b)).getBytes();
for(var e=0;e<d.length;++e){var g=k.toDer(h.certificateToAsn1(d[e])).getBytes();if(b===g)return!0}return!1}};if(b)for(var l=0;l<b.length;++l)g.addCertificate(b[l]);return g};h.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
h.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,l=!0,k=null,m=0;do{var q=c.shift(),y=null,r=!1;if(g<q.validity.notBefore||g>q.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:g};if(null===k){y=c[0]||b.getIssuer(q);null===y&&q.isIssuer(q)&&(r=!0,y=q);if(y){var n=y;a.util.isArray(n)||(n=[n]);for(var x=!1;!x&&0<n.length;){y=n.shift();
try{x=y.verify(q)}catch(v){}}x||(k={message:"Certificate signature is invalid.",error:h.certificateError.bad_certificate})}null!==k||y&&!r||b.hasCertificate(q)||(k={message:"Certificate is not trusted.",error:h.certificateError.unknown_ca})}null===k&&y&&!q.isIssuer(y)&&(k={message:"Certificate issuer is invalid.",error:h.certificateError.bad_certificate});if(null===k)for(n={keyUsage:!0,basicConstraints:!0},x=0;null===k&&x<q.extensions.length;++x){var w=q.extensions[x];!w.critical||w.name in n||(k=
{message:"Certificate has an unsupported critical extension.",error:h.certificateError.unsupported_certificate})}null!==k||l&&(0!==c.length||y&&!r)||(l=q.getExtension("basicConstraints"),q=q.getExtension("keyUsage"),null!==q&&(q.keyCertSign&&null!==l||(k={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:h.certificateError.bad_certificate})),
null!==k||null===l||l.cA||(k={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:h.certificateError.bad_certificate}),null===k&&null!==q&&"pathLenConstraint"in l&&m-1>l.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));q=null===k?!0:k.error;l=d?d(q,m,e):q;if(!0===l)k=null;else{!0===q&&(k={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate});
if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(k.error=l):(l.message&&(k.message=l.message),l.error&&(k.error=l.error));throw k;}l=!1;++m}while(0<c.length);return!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.x509)return c.x509;
c.defined.x509=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pki}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d,e){for(var g=
[],h=0;h<a.length;h++)for(var p=0;p<a[h].safeBags.length;p++){var l=a[h].safeBags[p];if(void 0===e||l.type===e)null===b?g.push(l):void 0!==l.attributes[b]&&0<=l.attributes[b].indexOf(d)&&g.push(l)}return g}function d(b){if(b.composed||b.constructed){for(var c=a.util.createBuffer(),e=0;e<b.value.length;++e)c.putBytes(b.value[e].value);b.composed=b.constructed=!1;b.value=c.getBytes()}return b}function g(b,c,h,q){c=m.fromDer(c,h);if(c.tagClass!==m.Class.UNIVERSAL||c.type!==m.Type.SEQUENCE||!0!==c.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
for(var n=0;n<c.value.length;n++){var x={},v=[];if(!m.validate(c.value[n],r,x,v))throw b=Error("Cannot read ContentInfo."),b.errors=v,b;var v={encrypted:!1},u=null,u=x.content.value[0];switch(m.derToOid(x.contentType)){case k.oids.data:if(u.tagClass!==m.Class.UNIVERSAL||u.type!==m.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");u=d(u).value;break;case k.oids.encryptedData:var A=q,x={},B=[];if(!m.validate(u,a.pkcs7.asn1.encryptedDataValidator,x,B))throw b=Error("Cannot read EncryptedContentInfo."),
b.errors=B,b;u=m.derToOid(x.contentType);if(u!==k.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=u,b;u=m.derToOid(x.encAlgorithm);u=k.pbe.getCipher(u,x.encParameter,A);x=d(x.encryptedContentAsn1);x=a.util.createBuffer(x.value);u.update(x);if(!u.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");u=u.output.getBytes();v.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=m.derToOid(x.contentType),b;}v.safeBags=
l(u,h,q);b.safeContents.push(v)}}function l(a,b,c){if(!b&&0===a.length)return[];a=m.fromDer(a,b);if(a.tagClass!==m.Class.UNIVERSAL||a.type!==m.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var g={},h=[];if(!m.validate(a.value[e],B,g,h))throw a=Error("Cannot read SafeBag."),a.errors=h,a;var p={type:m.derToOid(g.bagId),attributes:n(g.bagAttributes)};d.push(p);var q,r,x=g.bagValue.value[0];switch(p.type){case k.oids.pkcs8ShroudedKeyBag:if(x=
k.decryptPrivateKeyInfo(x,c),null===x)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case k.oids.keyBag:try{p.key=k.privateKeyFromAsn1(x)}catch(v){p.key=null,p.asn1=x}continue;case k.oids.certBag:q=A;r=function(){if(m.derToOid(g.certId)!==k.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=m.derToOid(g.certId);throw a;}a=m.fromDer(g.cert,b);try{p.cert=k.certificateFromAsn1(a,!0)}catch(c){p.cert=null,p.asn1=a}};break;default:throw a=
Error("Unsupported PKCS#12 SafeBag type."),a.oid=p.type,a;}if(void 0!==q&&!m.validate(x,q,g,h))throw a=Error("Cannot read PKCS#12 "+q.name),a.errors=h,a;r()}return d}function n(a){var b={};if(void 0!==a)for(var c=0;c<a.length;++c){var d={},e=[];if(!m.validate(a[c],x,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=m.derToOid(d.oid);if(void 0!==k.oids[e]){b[k.oids[e]]=[];for(var g=0;g<d.values.length;++g)b[k.oids[e]].push(d.values[g].value)}}return b}var m=a.asn1,k=a.pki,h=a.pkcs12=
a.pkcs12||{},r={name:"ContentInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},v={name:"PFX",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"version"},
2022-03-23 21:00:41 +03:00
r,{name:"PFX.macData",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
tagClass:m.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},B={name:"SafeBag",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,
value:[{name:"SafeBag.bagId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:m.Class.UNIVERSAL,type:m.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},x={name:"Attribute",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,
capture:"oid"},{name:"Attribute.attrValues",tagClass:m.Class.UNIVERSAL,type:m.Type.SET,constructed:!0,capture:"values"}]},A={name:"CertBag",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:m.Class.UNIVERSAL,type:m.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
h.pkcs12FromAsn1=function(b,l,n){"string"===typeof l?(n=l,l=!0):void 0===l&&(l=!0);var r={};if(!m.validate(b,v,r,[]))throw l=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),l.errors=l,l;var x={version:r.version.charCodeAt(0),safeContents:[],getBags:function(b){var d={},e;"localKeyId"in b?e=b.localKeyId:"localKeyIdHex"in b&&(e=a.util.hexToBytes(b.localKeyIdHex));void 0===e&&!("friendlyName"in b)&&"bagType"in b&&(d[b.bagType]=c(x.safeContents,null,null,b.bagType));void 0!==e&&
(d.localKeyId=c(x.safeContents,"localKeyId",e,b.bagType));"friendlyName"in b&&(d.friendlyName=c(x.safeContents,"friendlyName",b.friendlyName,b.bagType));return d},getBagsByFriendlyName:function(a,b){return c(x.safeContents,"friendlyName",a,b)},getBagsByLocalKeyId:function(a,b){return c(x.safeContents,"localKeyId",a,b)}};if(3!==r.version.charCodeAt(0))throw l=Error("PKCS#12 PFX of version other than 3 not supported."),l.version=r.version.charCodeAt(0),l;if(m.derToOid(r.contentType)!==k.oids.data)throw l=
Error("Only PKCS#12 PFX in password integrity mode supported."),l.oid=m.derToOid(r.contentType),l;b=r.content.value[0];if(b.tagClass!==m.Class.UNIVERSAL||b.type!==m.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(r.mac){var w=null,A=0,u=m.derToOid(r.macAlgorithm);switch(u){case k.oids.sha1:w=a.md.sha1.create();A=20;break;case k.oids.sha256:w=a.md.sha256.create();A=32;break;case k.oids.sha384:w=a.md.sha384.create();A=48;break;case k.oids.sha512:w=a.md.sha512.create();
A=64;break;case k.oids.md5:w=a.md.md5.create(),A=16}if(null===w)throw Error("PKCS#12 uses unsupported MAC algorithm: "+u);var u=new a.util.ByteBuffer(r.macSalt),B="macIterations"in r?parseInt(a.util.bytesToHex(r.macIterations),16):1,A=h.generateKey(n,u,3,B,A,w),u=a.hmac.create();u.start(w,A);u.update(b.value);if(u.getMac().getBytes()!==r.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}g(x,b.value,l,n);return x};h.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var g=e.localKeyId,l;if(null!==g)g=a.util.hexToBytes(g);else if(e.generateLocalKeyId)if(c){var q=a.util.isArray(c)?c[0]:c;"string"===typeof q&&(q=k.certificateFromPem(q));g=a.md.sha1.create();g.update(m.toDer(k.certificateToAsn1(q)).getBytes());g=g.digest().getBytes()}else g=a.random.getBytes(20);q=[];null!==
g&&q.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.localKeyId).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,g)])]));"friendlyName"in e&&q.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.friendlyName).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[m.create(m.Class.UNIVERSAL,m.Type.BMPSTRING,!1,e.friendlyName)])]));
0<q.length&&(l=m.create(m.Class.UNIVERSAL,m.Type.SET,!0,q));g=[];q=[];null!==c&&(q=a.util.isArray(c)?c:[c]);for(var r=[],n=0;n<q.length;++n){c=q[n];"string"===typeof c&&(c=k.certificateFromPem(c));var x=0===n?l:void 0;c=k.certificateToAsn1(c);c=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.certBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.x509Certificate).getBytes()),
m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(c).getBytes())])])]),x]);r.push(c)}0<r.length&&(c=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,r),c=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(c).getBytes())])]),g.push(c));c=null;null!==b&&(b=k.wrapRsaPrivateKey(k.privateKeyToAsn1(b)),
c=null===d?m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.keyBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[b]),l]):m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.pkcs8ShroudedKeyBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[k.encryptPrivateKeyInfo(b,d,e)]),l]),b=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[c]),b=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,
[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(b).getBytes())])]),g.push(b));l=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,g);var v;e.useMac&&(g=a.md.sha1.create(),v=new a.util.ByteBuffer(a.random.getBytes(e.saltSize)),e=e.count,b=h.generateKey(d,v,3,e,20),d=a.hmac.create(),d.start(g,b),d.update(m.toDer(l).getBytes()),d=d.getMac(),v=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,
!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.sha1).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,"")]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,d.getBytes())]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,v.getBytes()),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(e).getBytes())]));return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,
m.Type.INTEGER,!1,m.integerToDer(3).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(k.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(l).getBytes())])]),v])};h.generateKey=a.pbe.generatePkcs12Key}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,
n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs12)return c.pkcs12;c.defined.pkcs12=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pkcs12}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
2022-03-23 21:00:41 +03:00
function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pki=a.pki||{};d.pemToDer=function(b){b=a.pem.decode(b)[0];if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(b.body)};d.privateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PRIVATE KEY"!==b.type&&"RSA PRIVATE KEY"!==b.type){var g=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
g.headerType=b.type;throw g;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");b=c.fromDer(b.body);return d.privateKeyFromAsn1(b)};d.privateKeyToPem=function(b,g){var l={type:"RSA PRIVATE KEY",body:c.toDer(d.privateKeyToAsn1(b)).getBytes()};return a.pem.encode(l,{maxline:g})};d.privateKeyInfoToPem=function(b,d){var e={type:"PRIVATE KEY",body:c.toDer(b).getBytes()};return a.pem.encode(e,{maxline:d})}}if("function"!==typeof a)if("object"===
typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pki)return c.pki;c.defined.pki=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pki}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,
Array.prototype.slice.call(arguments,0))};a("js/pki","require module ./asn1 ./oids ./pbe ./pem ./pbkdf2 ./pkcs12 ./pss ./rsa ./util ./x509".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=function(b,c,d,e){var g=a.util.createBuffer(),h=b.length>>1,l=h+(b.length&1),k=b.substr(0,l),l=b.substr(h,l);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",k);k=a.util.createBuffer();b.putBytes(d);
for(var q=0;q<m;++q)h.start(null,null),h.update(b.getBytes()),b.putBuffer(h.digest()),h.start(null,null),h.update(b.bytes()+d),k.putBuffer(h.digest());h.start("SHA1",l);l=a.util.createBuffer();b.clear();b.putBytes(d);for(q=0;q<c;++q)h.start(null,null),h.update(b.getBytes()),b.putBuffer(h.digest()),h.start(null,null),h.update(b.bytes()+d),l.putBuffer(h.digest());g.putBytes(a.util.xorBytes(k.getBytes(),l.getBytes(),e));return g},d=function(b,c,d){d=!1;try{var e=b.deflate(c.fragment.getBytes());c.fragment=
a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},g=function(b,c,d){d=!1;try{var e=b.inflate(c.fragment.getBytes());c.fragment=a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},l=function(b,c){var d=0;switch(c){case 1:d=b.getByte();break;case 2:d=b.getInt16();break;case 3:d=b.getInt24();break;case 4:d=b.getInt32()}return a.util.createBuffer(b.getBytes(d))},n=function(a,b,c){a.putInt(c.length(),b<<3);a.putBuffer(c)},m={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,
minor:2},TLS_1_2:{major:3,minor:3}}};m.SupportedVersions=[m.Versions.TLS_1_1,m.Versions.TLS_1_0];m.Version=m.SupportedVersions[0];m.MaxFragment=15360;m.ConnectionEnd={server:0,client:1};m.PRFAlgorithm={tls_prf_sha256:0};m.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};m.CipherType={stream:0,block:1,aead:2};m.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};m.CompressionMethod={none:0,deflate:1};m.ContentType={change_cipher_spec:20,alert:21,handshake:22,
application_data:23,heartbeat:24};m.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};m.Alert={};m.Alert.Level={warning:1,fatal:2};m.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,
certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};m.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};m.CipherSuites={};m.getCipherSuite=function(a){var b=null,c;for(c in m.CipherSuites){var d=m.CipherSuites[c];if(d.id[0]===a.charCodeAt(0)&&d.id[1]===a.charCodeAt(1)){b=d;break}}return b};
2022-03-23 21:00:41 +03:00
m.handleUnexpected=function(a,b){(a.open||a.entity!==m.ConnectionEnd.client)&&a.error(a,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unexpected_message}})};m.handleHelloRequest=function(a,b,c){!a.handshaking&&0<a.handshakes&&(m.queue(a,m.createAlert(a,{level:m.Alert.Level.warning,description:m.Alert.Description.no_renegotiation})),m.flush(a));a.process()};m.parseHelloMessage=function(b,c,d){var e=null,g=b.entity===
m.ConnectionEnd.client;if(38>d)b.error(b,{message:g?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});else{c=c.fragment;var h=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:l(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=l(c,2),e.compression_methods=
l(c,1));h=d-(h-c.length());if(0<h){for(d=l(c,2);0<d.length();)e.extensions.push({type:[d.getByte(),d.getByte()],data:l(d,2)});if(!g)for(d=0;d<e.extensions.length;++d)if(c=e.extensions[d],0===c.type[0]&&0===c.type[1])for(c=l(c.data,2);0<c.length()&&0===c.getByte();)b.session.extensions.server_name.serverNameList.push(l(c,2).getBytes())}if(b.session.version&&(e.version.major!==b.session.version.major||e.version.minor!==b.session.version.minor))return b.error(b,{message:"TLS version change is disallowed during renegotiation.",
2022-03-23 21:00:41 +03:00
send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.protocol_version}});if(g)b.session.cipherSuite=m.getCipherSuite(e.cipher_suite);else for(d=a.util.createBuffer(e.cipher_suites.bytes());0<d.length()&&(b.session.cipherSuite=m.getCipherSuite(d.getBytes(2)),null===b.session.cipherSuite););if(null===b.session.cipherSuite)return b.error(b,{message:"No cipher suites in common.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(e.cipher_suite)});
b.session.compressionMethod=g?e.compression_method:m.CompressionMethod.none}return e};m.createSecurityParameters=function(a,b){var c=a.entity===m.ConnectionEnd.client,d=b.random.bytes(),e=c?a.session.sp.client_random:d,c=c?d:m.createRandom().getBytes();a.session.sp={entity:a.entity,prf_algorithm:m.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,
compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:e,server_random:c}};m.handleServerHello=function(a,b,c){b=m.parseHelloMessage(a,b,c);if(!a.fail){if(b.version.minor<=a.version.minor)a.version.minor=b.version.minor;else return a.error(a,{message:"Incompatible TLS version.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.protocol_version}});a.session.version=a.version;c=b.session_id.bytes();0<c.length&&c===a.session.id?
(a.expect=B,a.session.resuming=!0,a.session.sp.server_random=b.random.bytes()):(a.expect=k,a.session.resuming=!1,m.createSecurityParameters(a,b));a.session.id=c;a.process()}};m.handleClientHello=function(b,c,d){c=m.parseHelloMessage(b,c,d);if(!b.fail){var e=c.session_id.bytes();d=null;if(b.sessionCache)if(d=b.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==c.version.major||d.version.minor>c.version.minor)d=null,e="";0===e.length&&(e=a.random.getBytes(32));b.session.id=e;b.session.clientHelloVersion=
c.version;b.session.sp={};if(d)b.version=b.session.version=d.version,b.session.sp=d.sp;else{for(var g,e=1;e<m.SupportedVersions.length&&!(g=m.SupportedVersions[e],g.minor<=c.version.minor);++e);b.version={major:g.major,minor:g.minor};b.session.version=b.version}null!==d?(b.expect=O,b.session.resuming=!0,b.session.sp.client_random=c.random.bytes()):(b.expect=!1!==b.verifyClient?R:z,b.session.resuming=!1,m.createSecurityParameters(b,c));b.open=!0;m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,
data:m.createServerHello(b)}));b.session.resuming?(m.queue(b,m.createRecord(b,{type:m.ContentType.change_cipher_spec,data:m.createChangeCipherSpec()})),b.state.pending=m.createConnectionState(b),b.state.current.write=b.state.pending.write,m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,data:m.createFinished(b)}))):(m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,data:m.createCertificate(b)})),b.fail||(m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,data:m.createServerKeyExchange(b)})),
!1!==b.verifyClient&&m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,data:m.createCertificateRequest(b)})),m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,data:m.createServerHelloDone(b)}))));m.flush(b);b.process()}};m.handleCertificate=function(b,c,d){if(3>d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0<d.length();)e=
l(d,3),g=a.asn1.fromDer(e),e=a.pki.certificateFromAsn1(g,!0),c.push(e)}catch(k){return b.error(b,{message:"Could not parse certificate list.",cause:k,send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.bad_certificate}})}e=b.entity===m.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?h:z:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],m.verifyCertificateChain(b,c)&&(b.expect=e?h:z)):b.error(b,{message:e?"No server certificate provided.":
2022-03-23 21:00:41 +03:00
"No client certificate provided.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});b.process()};m.handleServerKeyExchange=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});a.expect=r;a.process()};m.handleClientKeyExchange=function(b,c,d){if(48>d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.",
send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unsupported_certificate}});c=l(c.fragment,2).getBytes();d=null;if(b.getPrivateKey)try{d=b.getPrivateKey(b,b.session.serverCertificate),d=a.pki.privateKeyFromPem(d)}catch(e){b.error(b,{message:"Could not get private key.",cause:e,send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}});
try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=O;null!==b.session.clientCertificate&&(b.expect=E);b.process()};m.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,
description:m.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=v;a.process()};m.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(d,2).getBytes();var e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
e.putBuffer(b.session.sha1.digest());e=e.getBytes();try{if(!b.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");b.session.md5.update(c);b.session.sha1.update(c)}catch(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.handshake_failure}})}b.expect=O;b.process()};m.handleServerHelloDone=function(b,c,d){if(0<d)return b.error(b,{message:"Invalid ServerHelloDone message. Invalid length.",
send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.record_overflow}});if(null===b.serverCertificate&&(c={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.insufficient_security}},d=b.verify(b,c.alert.description,0,[]),!0!==d)){if(d||0===d)"object"!==typeof d||a.util.isArray(d)?"number"===typeof d&&(c.alert.description=d):(d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert));
return b.error(b,c)}null!==b.session.certificateRequest&&(c=m.createRecord(b,{type:m.ContentType.handshake,data:m.createCertificate(b)}),m.queue(b,c));c=m.createRecord(b,{type:m.ContentType.handshake,data:m.createClientKeyExchange(b)});m.queue(b,c);b.expect=y;c=function(a,b){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&m.queue(a,m.createRecord(a,{type:m.ContentType.handshake,data:m.createCertificateVerify(a,b)}));m.queue(a,m.createRecord(a,{type:m.ContentType.change_cipher_spec,
data:m.createChangeCipherSpec()}));a.state.pending=m.createConnectionState(a);a.state.current.write=a.state.pending.write;m.queue(a,m.createRecord(a,{type:m.ContentType.handshake,data:m.createFinished(a)}));a.expect=B;m.flush(a);a.process()};if(null===b.session.certificateRequest||null===b.session.clientCertificate)return c(b,null);m.getClientSignature(b,c)};m.handleChangeCipherSpec=function(a,b){if(1!==b.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.illegal_parameter}});var c=a.entity===m.ConnectionEnd.client;if(a.session.resuming&&c||!a.session.resuming&&!c)a.state.pending=m.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&c||a.session.resuming&&!c)a.state.pending=null;a.expect=c?x:H;a.process()};m.handleFinished=function(b,d,e){e=d.fragment;e.read-=4;var g=e.bytes();e.read+=4;d=d.fragment.getBytes();e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
2022-03-23 21:00:41 +03:00
e.putBuffer(b.session.sha1.digest());var h=b.entity===m.ConnectionEnd.client;e=c(b.session.sp.master_secret,h?"server finished":"client finished",e.getBytes(),12);if(e.getBytes()!==d)return b.error(b,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.decrypt_error}});b.session.md5.update(g);b.session.sha1.update(g);if(b.session.resuming&&h||!b.session.resuming&&!h)m.queue(b,m.createRecord(b,{type:m.ContentType.change_cipher_spec,
data:m.createChangeCipherSpec()})),b.state.current.write=b.state.pending.write,b.state.pending=null,m.queue(b,m.createRecord(b,{type:m.ContentType.handshake,data:m.createFinished(b)}));b.expect=h?A:N;b.handshaking=!1;++b.handshakes;b.peerCertificate=h?b.session.serverCertificate:b.session.clientCertificate;m.flush(b);b.isConnected=!0;b.connected(b);b.process()};m.handleAlert=function(a,b){var c=b.fragment,c={level:c.getByte(),description:c.getByte()},d;switch(c.description){case m.Alert.Description.close_notify:d=
"Connection closed.";break;case m.Alert.Description.unexpected_message:d="Unexpected message.";break;case m.Alert.Description.bad_record_mac:d="Bad record MAC.";break;case m.Alert.Description.decryption_failed:d="Decryption failed.";break;case m.Alert.Description.record_overflow:d="Record overflow.";break;case m.Alert.Description.decompression_failure:d="Decompression failed.";break;case m.Alert.Description.handshake_failure:d="Handshake failure.";break;case m.Alert.Description.bad_certificate:d=
"Bad certificate.";break;case m.Alert.Description.unsupported_certificate:d="Unsupported certificate.";break;case m.Alert.Description.certificate_revoked:d="Certificate revoked.";break;case m.Alert.Description.certificate_expired:d="Certificate expired.";break;case m.Alert.Description.certificate_unknown:d="Certificate unknown.";break;case m.Alert.Description.illegal_parameter:d="Illegal parameter.";break;case m.Alert.Description.unknown_ca:d="Unknown certificate authority.";break;case m.Alert.Description.access_denied:d=
"Access denied.";break;case m.Alert.Description.decode_error:d="Decode error.";break;case m.Alert.Description.decrypt_error:d="Decrypt error.";break;case m.Alert.Description.export_restriction:d="Export restriction.";break;case m.Alert.Description.protocol_version:d="Unsupported protocol version.";break;case m.Alert.Description.insufficient_security:d="Insufficient security.";break;case m.Alert.Description.internal_error:d="Internal error.";break;case m.Alert.Description.user_canceled:d="User canceled.";
2022-03-23 21:00:41 +03:00
break;case m.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(c.description===m.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===m.ConnectionEnd.client?"server":"client",alert:c});a.process()};m.handleHandshake=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt24();if(g>d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+
4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==m.ConnectionEnd.server||b.open||b.fail||(b.handshaking=!0,b.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),e!==m.HandshakeType.hello_request&&e!==m.HandshakeType.certificate_verify&&e!==m.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),J[b.entity][b.expect][e](b,c,g)):
2022-03-23 21:00:41 +03:00
m.handleUnexpected(b,c)};m.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};m.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===m.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();m.queue(b,m.createRecord(b,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_response,d)}));m.flush(b)}else if(e===m.HeartbeatMessageType.heartbeat_response){if(d!==
b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var k=1,h=2,r=3,v=4,B=5,x=6,A=7,y=8,R=1,z=2,E=3,O=4,H=5,N=6,u=m.handleUnexpected,T=m.handleChangeCipherSpec,P=m.handleAlert,F=m.handleHandshake,Y=m.handleApplicationData,L=m.handleHeartbeat,ea=[];ea[m.ConnectionEnd.client]=[[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];ea[m.ConnectionEnd.server]=[[u,P,F,u,L],[u,
P,F,u,L],[u,P,F,u,L],[u,P,F,u,L],[T,P,u,u,L],[u,P,F,u,L],[u,P,F,Y,L],[u,P,F,u,L]];var T=m.handleHelloRequest,P=m.handleCertificate,F=m.handleServerKeyExchange,Y=m.handleCertificateRequest,L=m.handleServerHelloDone,V=m.handleFinished,J=[];J[m.ConnectionEnd.client]=[[u,u,m.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,P,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,F,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,Y,L,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u],
[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[T,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];J[m.ConnectionEnd.server]=[[u,m.handleClientHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,P,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,m.handleCertificateVerify,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,
u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];m.generateKeys=function(a,b){var d=b.client_random+b.server_random;a.session.resuming||(b.master_secret=c(b.pre_master_secret,"master secret",d,48).bytes(),b.pre_master_secret=null);var d=b.server_random+b.client_random,e=2*b.mac_key_length+2*b.enc_key_length,g=a.version.major===m.Versions.TLS_1_0.major&&a.version.minor===m.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);d=
2022-03-23 21:00:41 +03:00
c(b.master_secret,"key expansion",d,e);e={client_write_MAC_key:d.getBytes(b.mac_key_length),server_write_MAC_key:d.getBytes(b.mac_key_length),client_write_key:d.getBytes(b.enc_key_length),server_write_key:d.getBytes(b.enc_key_length)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};m.createConnectionState=function(a){var b=a.entity===m.ConnectionEnd.client,c=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,
cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){4294967295===a.sequenceNumber[1]?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};return a},h={read:c(),write:c()};h.read.update=function(a,b){h.read.cipherFunction(b,h.read)?h.read.compressFunction(a,b,h.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.decompression_failure}}):
a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.bad_record_mac}});return!a.fail};h.write.update=function(a,b){h.write.compressFunction(a,b,h.write)?h.write.cipherFunction(b,h.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}});
2022-03-23 21:00:41 +03:00
return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=m.generateKeys(a,c),h.read.macKey=b?c.keys.server_write_MAC_key:c.keys.client_write_MAC_key,h.write.macKey=b?c.keys.client_write_MAC_key:c.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(h,a,c),c.compression_algorithm){case m.CompressionMethod.none:break;case m.CompressionMethod.deflate:h.read.compressFunction=g;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm.");
}return h};m.createRandom=function(){var b=new Date,b=+b+6E4*b.getTimezoneOffset(),c=a.util.createBuffer();c.putInt32(b);c.putBytes(a.random.getBytes(28));return c};m.createRecord=function(a,b){return b.data?{type:b.type,version:{major:a.version.major,minor:a.version.minor},length:b.data.length(),fragment:b.data}:null};m.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return m.createRecord(b,{type:m.ContentType.alert,data:d})};m.createClientHello=
function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d<b.cipherSuites.length;++d){var e=b.cipherSuites[d];c.putByte(e.id[0]);c.putByte(e.id[1])}var g=c.length(),d=a.util.createBuffer();d.putByte(m.CompressionMethod.none);var h=d.length(),e=a.util.createBuffer();if(b.virtualHost){var l=a.util.createBuffer();l.putByte(0);l.putByte(0);var k=a.util.createBuffer();k.putByte(0);n(k,2,a.util.createBuffer(b.virtualHost));var q=a.util.createBuffer();
n(q,2,k);n(l,2,q);e.putBuffer(l)}l=e.length();0<l&&(l+=2);k=b.session.id;g=k.length+1+2+4+28+2+g+1+h+l;h=a.util.createBuffer();h.putByte(m.HandshakeType.client_hello);h.putInt24(g);h.putByte(b.version.major);h.putByte(b.version.minor);h.putBytes(b.session.sp.client_random);n(h,1,a.util.createBuffer(k));n(h,2,c);n(h,1,d);0<l&&n(h,2,e);return h};m.createServerHello=function(b){var c=b.session.id,d=c.length+1+2+4+28+2+1,e=a.util.createBuffer();e.putByte(m.HandshakeType.server_hello);e.putInt24(d);e.putByte(b.version.major);
2022-03-23 21:00:41 +03:00
e.putByte(b.version.minor);e.putBytes(b.session.sp.server_random);n(e,1,a.util.createBuffer(c));e.putByte(b.session.cipherSuite.id[0]);e.putByte(b.session.cipherSuite.id[1]);e.putByte(b.session.compressionMethod);return e};m.createCertificate=function(b){var c=b.entity===m.ConnectionEnd.client,d=null;b.getCertificate&&(d=b.getCertificate(b,c?b.session.certificateRequest:b.session.extensions.server_name.serverNameList));var e=a.util.createBuffer();if(null!==d)try{a.util.isArray(d)||(d=[d]);for(var g=
null,h=0;h<d.length;++h){var l=a.pem.decode(d[h])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var k=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');k.headerType=l.type;throw k;}if(l.procType&&"ENCRYPTED"===l.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var q=a.util.createBuffer(l.body);null===g&&(g=a.asn1.fromDer(q.bytes(),!1));
var y=a.util.createBuffer();n(y,3,q);e.putBuffer(y)}d=a.pki.certificateFromAsn1(g);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(r){return b.error(b,{message:"Could not send certificate list.",cause:r,send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(m.HandshakeType.certificate);c.putInt24(b);n(c,3,e);return c};m.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
c.putByte(b.session.clientHelloVersion.minor);c.putBytes(a.random.getBytes(46));var d=b.session.sp;d.pre_master_secret=c.getBytes();c=b.session.serverCertificate.publicKey.encrypt(d.pre_master_secret);b=c.length+2;d=a.util.createBuffer();d.putByte(m.HandshakeType.client_key_exchange);d.putInt24(b);d.putInt16(c.length);d.putBytes(c);return d};m.createServerKeyExchange=function(b){return a.util.createBuffer()};m.getClientSignature=function(b,c){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());
2022-03-23 21:00:41 +03:00
d.putBuffer(b.session.sha1.digest());d=d.getBytes();b.getSignature=b.getSignature||function(b,c,d){var e=null;if(b.getPrivateKey)try{e=b.getPrivateKey(b,b.session.clientCertificate),e=a.pki.privateKeyFromPem(e)}catch(g){b.error(b,{message:"Could not get private key.",cause:g,send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}})}null===e?b.error(b,{message:"No private key set.",send:!0,alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.internal_error}}):
c=e.sign(c,null);d(b,c)};b.getSignature(b,d,c)};m.createCertificateVerify=function(b,c){var d=c.length+2,e=a.util.createBuffer();e.putByte(m.HandshakeType.certificate_verify);e.putInt24(d);e.putInt16(c.length);e.putBytes(c);return e};m.createCertificateRequest=function(b){var c=a.util.createBuffer();c.putByte(1);var d=a.util.createBuffer(),e;for(e in b.caStore.certs){var g=a.pki.distinguishedNameToAsn1(b.caStore.certs[e].subject);d.putBuffer(a.asn1.toDer(g))}b=1+c.length()+2+d.length();e=a.util.createBuffer();
e.putByte(m.HandshakeType.certificate_request);e.putInt24(b);n(e,1,c);n(e,2,d);return e};m.createServerHelloDone=function(b){b=a.util.createBuffer();b.putByte(m.HandshakeType.server_hello_done);b.putInt24(0);return b};m.createChangeCipherSpec=function(){var b=a.util.createBuffer();b.putByte(1);return b};m.createFinished=function(b){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());d.putBuffer(b.session.sha1.digest());d=c(b.session.sp.master_secret,b.entity===m.ConnectionEnd.client?"client finished":
"server finished",d.getBytes(),12);b=a.util.createBuffer();b.putByte(m.HandshakeType.finished);b.putInt24(d.length());b.putBuffer(d);return b};m.createHeartbeat=function(b,c,d){"undefined"===typeof d&&(d=c.length);var e=a.util.createBuffer();e.putByte(b);e.putInt16(d);e.putBytes(c);b=e.length();e.putBytes(a.random.getBytes(Math.max(16,b-d-3)));return e};m.queue=function(b,c){if(c){if(c.type===m.ContentType.handshake){var d=c.fragment.bytes();b.session.md5.update(d);b.session.sha1.update(d)}if(c.fragment.length()<=
2022-03-23 21:00:41 +03:00
m.MaxFragment)d=[c];else{for(var d=[],e=c.fragment.bytes();e.length>m.MaxFragment;)d.push(m.createRecord(b,{type:c.type,data:a.util.createBuffer(e.slice(0,m.MaxFragment))})),e=e.slice(m.MaxFragment);0<e.length&&d.push(m.createRecord(b,{type:c.type,data:a.util.createBuffer(e)}))}for(e=0;e<d.length&&!b.fail;++e){var g=d[e];b.state.current.write.update(b,g)&&b.records.push(g)}}};m.flush=function(a){for(var b=0;b<a.records.length;++b){var c=a.records[b];a.tlsData.putByte(c.type);a.tlsData.putByte(c.version.major);
a.tlsData.putByte(c.version.minor);a.tlsData.putInt16(c.fragment.length());a.tlsData.putBuffer(a.records[b].fragment)}a.records=[];return a.tlsDataReady(a)};var aa=function(b){switch(b){case !0:return!0;case a.pki.certificateError.bad_certificate:return m.Alert.Description.bad_certificate;case a.pki.certificateError.unsupported_certificate:return m.Alert.Description.unsupported_certificate;case a.pki.certificateError.certificate_revoked:return m.Alert.Description.certificate_revoked;case a.pki.certificateError.certificate_expired:return m.Alert.Description.certificate_expired;
case a.pki.certificateError.certificate_unknown:return m.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return m.Alert.Description.unknown_ca;default:return m.Alert.Description.bad_certificate}},ba=function(b){switch(b){case !0:return!0;case m.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case m.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case m.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;
case m.Alert.Description.certificate_expired:return a.pki.certificateError.certificate_expired;case m.Alert.Description.certificate_unknown:return a.pki.certificateError.certificate_unknown;case m.Alert.Description.unknown_ca:return a.pki.certificateError.unknown_ca;default:return a.pki.certificateError.bad_certificate}};m.verifyCertificateChain=function(b,c){try{a.pki.verifyCertificateChain(b.caStore,c,function(c,d,e){aa(c);d=b.verify(b,c,d,e);if(!0!==d){if("object"===typeof d&&!a.util.isArray(d))throw c=
Error("The application rejected the certificate."),c.send=!0,c.alert={level:m.Alert.Level.fatal,description:m.Alert.Description.bad_certificate},d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert),c;d!==c&&(d=ba(d))}return d})}catch(d){var e=d;if("object"!==typeof e||a.util.isArray(e))e={send:!0,alert:{level:m.Alert.Level.fatal,description:aa(d)}};"send"in e||(e.send=!0);"alert"in e||(e.alert={level:m.Alert.Level.fatal,description:aa(e.error)});b.error(b,e)}return!b.fail};m.createSessionCache=
2022-03-23 21:00:41 +03:00
function(b,c){var d=null;if(b&&b.getSession&&b.setSession&&b.order)d=b;else{d={};d.cache=b||{};d.capacity=Math.max(c||100,1);d.order=[];for(var e in b)d.order.length<=c?d.order.push(e):delete b[e];d.getSession=function(b){var c=null,e=null;b?e=a.util.bytesToHex(b):0<d.order.length&&(e=d.order[0]);if(null!==e&&e in d.cache){c=d.cache[e];delete d.cache[e];for(var g in d.order)if(d.order[g]===e){d.order.splice(g,1);break}}return c};d.setSession=function(b,c){if(d.order.length===d.capacity){var e=d.order.shift();
delete d.cache[e]}e=a.util.bytesToHex(b);d.order.push(e);d.cache[e]=c}}return d};m.createConnection=function(b){var c=null,c=b.caStore?a.util.isArray(b.caStore)?a.pki.createCaStore(b.caStore):b.caStore:a.pki.createCaStore(),d=b.cipherSuites||null;if(null===d){var d=[],e;for(e in m.CipherSuites)d.push(m.CipherSuites[e])}e=b.server?m.ConnectionEnd.server:m.ConnectionEnd.client;var g=b.sessionCache?m.createSessionCache(b.sessionCache):null,h={version:{major:m.Version.major,minor:m.Version.minor},entity:e,
sessionId:b.sessionId,caStore:c,sessionCache:g,cipherSuites:d,connected:b.connected,virtualHost:b.virtualHost||null,verifyClient:b.verifyClient||!1,verify:b.verify||function(a,b,c,d){return b},getCertificate:b.getCertificate||null,getPrivateKey:b.getPrivateKey||null,getSignature:b.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:b.tlsDataReady,dataReady:b.dataReady,heartbeatReceived:b.heartbeatReceived,closed:b.closed,error:function(a,
c){c.origin=c.origin||(a.entity===m.ConnectionEnd.client?"client":"server");c.send&&(m.queue(a,m.createAlert(a,c.alert)),m.flush(a));var d=!1!==c.fatal;d&&(a.fail=!0);b.error(a,c);d&&a.close(!1)},deflate:b.deflate||null,inflate:b.inflate||null,reset:function(a){h.version={major:m.Version.major,minor:m.Version.minor};h.record=null;h.session=null;h.peerCertificate=null;h.state={pending:null,current:null};h.expect=0;h.fragmented=null;h.records=[];h.open=!1;h.handshakes=0;h.handshaking=!1;h.isConnected=
!1;h.fail=!(a||"undefined"===typeof a);h.input.clear();h.tlsData.clear();h.data.clear();h.state.current=m.createConnectionState(h)}};h.reset();h.handshake=function(b){if(h.entity!==m.ConnectionEnd.client)h.error(h,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(h.handshaking)h.error(h,{message:"Handshake already in progress.",fatal:!1});else{h.fail&&!h.open&&0===h.handshakes&&(h.fail=!1);h.handshaking=!0;b=b||"";var c=null;0<b.length&&(h.sessionCache&&(c=h.sessionCache.getSession(b)),
null===c&&(b=""));0===b.length&&h.sessionCache&&(c=h.sessionCache.getSession(),null!==c&&(b=c.id));h.session={id:b,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()};c&&(h.version=c.version,h.session.sp=c.sp);h.session.sp.client_random=m.createRandom().getBytes();h.open=!0;m.queue(h,m.createRecord(h,{type:m.ContentType.handshake,data:m.createClientHello(h)}));m.flush(h)}};h.process=
function(b){var c=0;b&&h.input.putBytes(b);if(!h.fail){null!==h.record&&h.record.ready&&h.record.fragment.isEmpty()&&(h.record=null);if(null===h.record){c=0;b=h.input;var d=b.length();5>d?c=5-d:(h.record={type:b.getByte(),version:{major:b.getByte(),minor:b.getByte()},length:b.getInt16(),fragment:a.util.createBuffer(),ready:!1},(b=h.record.version.major===h.version.major)&&h.session&&h.session.version&&(b=h.record.version.minor===h.version.minor),b||h.error(h,{message:"Incompatible TLS version.",send:!0,
alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.protocol_version}}))}if(!h.fail&&null!==h.record&&!h.record.ready){c=h;b=0;var d=c.input,e=d.length();e<c.record.length?b=c.record.length-e:(c.record.fragment.putBytes(d.getBytes(c.record.length)),d.compact(),c.state.current.read.update(c,c.record)&&(null!==c.fragmented&&(c.fragmented.type===c.record.type?(c.fragmented.fragment.putBuffer(c.record.fragment),c.record=c.fragmented):c.error(c,{message:"Invalid fragmented record.",send:!0,
alert:{level:m.Alert.Level.fatal,description:m.Alert.Description.unexpected_message}})),c.record.ready=!0));c=b}if(!h.fail&&null!==h.record&&h.record.ready)if(b=h.record,d=b.type-m.ContentType.change_cipher_spec,e=ea[h.entity][h.expect],d in e)e[d](h,b);else m.handleUnexpected(h,b)}return c};h.prepare=function(b){m.queue(h,m.createRecord(h,{type:m.ContentType.application_data,data:a.util.createBuffer(b)}));return m.flush(h)};h.prepareHeartbeatRequest=function(b,c){b instanceof a.util.ByteBuffer&&
(b=b.bytes());"undefined"===typeof c&&(c=b.length);h.expectedHeartbeatPayload=b;m.queue(h,m.createRecord(h,{type:m.ContentType.heartbeat,data:m.createHeartbeat(m.HeartbeatMessageType.heartbeat_request,b,c)}));return m.flush(h)};h.close=function(a){if(!h.fail&&h.sessionCache&&h.session){var b={id:h.session.id,version:h.session.version,sp:h.session.sp};b.sp.keys=null;h.sessionCache.setSession(b.id,b)}if(h.open){h.open=!1;h.input.clear();if(h.isConnected||h.handshaking)h.isConnected=h.handshaking=!1,
m.queue(h,m.createAlert(h,{level:m.Alert.Level.warning,description:m.Alert.Description.close_notify})),m.flush(h);h.closed(h)}h.reset(a)};return h};a.tls=a.tls||{};for(var W in m)"function"!==typeof m[W]&&(a.tls[W]=m[W]);a.tls.prf_tls1=c;a.tls.hmac_sha1=function(b,c,d){var e=a.hmac.create();e.start("SHA1",b);b=a.util.createBuffer();b.putInt32(c[0]);b.putInt32(c[1]);b.putByte(d.type);b.putByte(d.version.major);b.putByte(d.version.minor);b.putInt16(d.length);b.putBytes(d.fragment.bytes());e.update(b.getBytes());
return e.digest().getBytes()};a.tls.createSessionCache=m.createSessionCache;a.tls.createConnection=m.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.tls)return c.tls;c.defined.tls=!0;for(var l=0;l<g.length;++l)g[l](c);return c.tls}},
l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,g,l){g=g.entity===a.tls.ConnectionEnd.client;b.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",
g?l.keys.server_write_key:l.keys.client_write_key),iv:g?l.keys.server_write_IV:l.keys.client_write_IV};b.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",g?l.keys.client_write_key:l.keys.server_write_key),iv:g?l.keys.client_write_IV:l.keys.server_write_IV};b.read.cipherFunction=n;b.write.cipherFunction=d;b.read.macLength=b.write.macLength=l.mac_length;b.read.macFunction=b.write.macFunction=m.hmac_sha1}function d(b,c){var e=!1,l=c.macFunction(c.macKey,c.sequenceNumber,b);b.fragment.putBytes(l);
c.updateSequenceNumber();l=b.version.minor===m.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:a.random.getBytesSync(16);c.cipherState.init=!0;var k=c.cipherState.cipher;k.start({iv:l});b.version.minor>=m.Versions.TLS_1_1.minor&&k.output.putBytes(l);k.update(b.fragment);k.finish(g)&&(b.fragment=k.output,b.length=b.fragment.length(),e=!0);return e}function g(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1-
d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function n(b,c){var d=!1;++k;d=b.version.minor===m.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:b.fragment.getBytes(16);c.cipherState.init=!0;var e=c.cipherState.cipher;e.start({iv:d});e.update(b.fragment);var d=e.finish(l),g=c.macLength,q=a.random.getBytesSync(g),y=e.output.length();y>=g?(b.fragment=e.output.getBytes(y-g),q=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length=
b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;y=a.hmac.create();y.start("SHA1",e);y.update(q);q=y.digest().getBytes();y.start(null,null);y.update(g);g=y.digest().getBytes();return q===g&&d}var m=a.tls;m.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=16;a.block_length=16;
a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};m.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=m.BulkCipherAlgorithm.aes;a.cipher_type=m.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=m.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=
20},initConnectionState:c};var k=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aesCipherSuites)return c.aesCipherSuites;c.defined.aesCipherSuites=!0;for(var l=0;l<g.length;++l)g[l](c);return c.aesCipherSuites}},l=a;a=function(b,c){v="string"===
typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aesCipherSuites",["require","module","./aes","./tls"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.debug=a.debug||{};a.debug.storage={};a.debug.get=function(b,c){var d;"undefined"===typeof b?d=a.debug.storage:b in a.debug.storage&&(d="undefined"===typeof c?a.debug.storage[b]:
a.debug.storage[b][c]);return d};a.debug.set=function(b,c,d){b in a.debug.storage||(a.debug.storage[b]={});a.debug.storage[b][c]=d};a.debug.clear=function(b,c){"undefined"===typeof b?a.debug.storage={}:b in a.debug.storage&&("undefined"===typeof c?delete a.debug.storage[b]:delete a.debug.storage[b][c])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=
function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.debug)return c.debug;c.defined.debug=!0;for(var l=0;l<g.length;++l)g[l](c);return c.debug}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/debug",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();
(function(){function b(a){function c(b,d,e,g){b.generate=function(b,c){for(var l=new a.util.ByteBuffer,q=Math.ceil(c/g)+e,n=new a.util.ByteBuffer,x=e;x<q;++x){n.putInt32(x);d.start();d.update(b+n.getBytes());var v=d.digest();l.putBytes(v.getBytes(g))}l.truncate(l.length()-c);return l.getBytes()}}a.kem=a.kem||{};var d=a.jsbn.BigInteger;a.kem.rsa={};a.kem.rsa.create=function(b,c){c=c||{};var g=c.prng||a.random;return{encrypt:function(c,l){var h=Math.ceil(c.n.bitLength()/8),q;do q=(new d(a.util.bytesToHex(g.getBytesSync(h)),
16)).mod(c.n);while(q.equals(d.ZERO));q=a.util.hexToBytes(q.toString(16));h-=q.length;0<h&&(q=a.util.fillString(String.fromCharCode(0),h)+q);h=c.encrypt(q,"NONE");q=b.generate(q,l);return{encapsulation:h,key:q}},decrypt:function(a,c,d){a=a.decrypt(c,"NONE");return b.generate(a,d)}}};a.kem.kdf1=function(a,b){c(this,a,0,b||a.digestLength)};a.kem.kdf2=function(a,b){c(this,a,1,b||a.digestLength)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===
typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.kem)return c.kem;c.defined.kem=!0;for(var l=0;l<g.length;++l)g[l](c);return c.kem}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/kem",["require","module","./util","./random",
"./jsbn"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.log=a.log||{};a.log.levels="none error warning info debug verbose max".split(" ");var c={},d=[],g=null;a.log.LEVEL_LOCKED=2;a.log.NO_LEVEL_CHECK=4;a.log.INTERPOLATE=8;for(var l=0;l<a.log.levels.length;++l){var n=a.log.levels[l];c[n]={index:l,name:n.toUpperCase()}}a.log.logMessage=function(b){for(var g=c[b.level].index,l=0;l<d.length;++l){var m=d[l];m.flags&a.log.NO_LEVEL_CHECK?m.f(b):g<=c[m.level].index&&
m.f(m,b)}};a.log.prepareStandard=function(a){"standard"in a||(a.standard=c[a.level].name+" ["+a.category+"] "+a.message)};a.log.prepareFull=function(b){if(!("full"in b)){var c=[b.message],c=c.concat([]);b.full=a.util.format.apply(this,c)}};a.log.prepareStandardFull=function(b){"standardFull"in b||(a.log.prepareStandard(b),b.standardFull=b.standard)};n=["error","warning","info","debug","verbose"];for(l=0;l<n.length;++l)(function(b){a.log[b]=function(c,d){var e=Array.prototype.slice.call(arguments).slice(2);
a.log.logMessage({timestamp:new Date,level:b,category:c,message:d,arguments:e})}})(n[l]);a.log.makeLogger=function(b){b={flags:0,f:b};a.log.setLevel(b,"none");return b};a.log.setLevel=function(b,c){var d=!1;if(b&&!(b.flags&a.log.LEVEL_LOCKED))for(var e=0;e<a.log.levels.length;++e)if(c==a.log.levels[e]){b.level=c;d=!0;break}return d};a.log.lock=function(b,c){b.flags="undefined"===typeof c||c?b.flags|a.log.LEVEL_LOCKED:b.flags&~a.log.LEVEL_LOCKED};a.log.addLogger=function(a){d.push(a)};if("undefined"!==
2022-03-23 21:00:41 +03:00
typeof console&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)var m={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},g=function(b,c){a.log.prepareStandard(c);var d=m[c.level],e=[c.standard],e=e.concat(c.arguments.slice());d.apply(console,e)};else g=function(b,c){a.log.prepareStandardFull(c);console.log(c.standardFull)};g=a.log.makeLogger(g);a.log.setLevel(g,"debug");a.log.addLogger(g)}else console={log:function(){}};
null!==g&&(l=a.util.getQueryVariables(),"console.level"in l&&a.log.setLevel(g,l["console.level"].slice(-1)[0]),"console.lock"in l&&"true"==l["console.lock"].slice(-1)[0]&&a.log.lock(g));a.log.consoleLogger=g}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.log)return c.log;
c.defined.log=!0;for(var l=0;l<g.length;++l)g[l](c);return c.log}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/log",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){var d={},e=[];if(!r.validate(b,v.asn1.recipientInfoValidator,d,e))throw b=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
2022-03-23 21:00:41 +03:00
b.errors=e,b;return{version:d.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(d.issuer),serialNumber:a.util.createBuffer(d.serial).toHex(),encryptedContent:{algorithm:r.derToOid(d.encAlgorithm),parameter:d.encParameter.value,content:d.encKey}}}function d(b){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),
r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.encryptedContent.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.encryptedContent.content)])}function g(a){for(var b=[],c=0;c<a.length;++c)b.push(d(a[c]));return b}function l(b){var c=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,
2022-03-23 21:00:41 +03:00
r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.digestAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])]);b.authenticatedAttributesAsn1&&c.value.push(b.authenticatedAttributesAsn1);c.value.push(r.create(r.Class.UNIVERSAL,
r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.signatureAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));c.value.push(r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.signature));if(0<b.unauthenticatedAttributes.length){for(var d=r.create(r.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<b.unauthenticatedAttributes.length;++e)d.values.push(n(b.unauthenticatedAttributes[e]));c.value.push(d)}return c}function n(b){var c;if(b.type===a.pki.oids.contentType)c=
r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.value).getBytes());else if(b.type===a.pki.oids.messageDigest)c=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.value.bytes());else if(b.type===a.pki.oids.signingTime){c=new Date("Jan 1, 1950 00:00:00Z");var d=new Date("Jan 1, 2050 00:00:00Z"),e=b.value;if("string"===typeof e)var g=Date.parse(e),e=isNaN(g)?13===e.length?r.utcTimeToDate(e):r.generalizedTimeToDate(e):new Date(g);c=e>=c&&e<d?r.create(r.Class.UNIVERSAL,r.Type.UTCTIME,!1,r.dateToUtcTime(e)):
r.create(r.Class.UNIVERSAL,r.Type.GENERALIZEDTIME,!1,r.dateToGeneralizedTime(e))}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[c])])}function m(b){return[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pki.oids.data).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,
r.Type.OCTETSTRING,!1,b.parameter.getBytes())]),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.content.getBytes())])]}function k(b,c,d){var e={};if(!r.validate(c,d,e,[]))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),b.errors=b,b;if(r.derToOid(e.contentType)!==a.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(e.encryptedContent){c="";if(a.util.isArray(e.encryptedContent))for(d=
2022-03-23 21:00:41 +03:00
0;d<e.encryptedContent.length;++d){if(e.encryptedContent[d].type!==r.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=e.encryptedContent[d].value}else c=e.encryptedContent;b.encryptedContent={algorithm:r.derToOid(e.encAlgorithm),parameter:a.util.createBuffer(e.encParameter.value),content:a.util.createBuffer(c)}}if(e.content){c="";if(a.util.isArray(e.content))for(d=0;d<e.content.length;++d){if(e.content[d].type!==r.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
c+=e.content[d].value}else c=e.content;b.content=a.util.createBuffer(c)}b.version=e.version.charCodeAt(0);return b.rawCapture=e}function h(b){if(void 0===b.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===b.content){var c;switch(b.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:c=a.aes.createDecryptionCipher(b.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:c=a.des.createDecryptionCipher(b.encryptedContent.key);
break;default:throw Error("Unsupported symmetric cipher, OID "+b.encryptedContent.algorithm);}c.start(b.encryptedContent.parameter);c.update(b.encryptedContent.content);if(!c.finish())throw Error("Symmetric decryption failed.");b.content=c.output}}var r=a.asn1,v=a.pkcs7=a.pkcs7||{};v.messageFromPem=function(b){b=a.pem.decode(b)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===
b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");b=r.fromDer(b.body);return v.messageFromAsn1(b)};v.messageToPem=function(b,c){var d={type:"PKCS7",body:r.toDer(b.toAsn1()).getBytes()};return a.pem.encode(d,{maxline:c})};v.messageFromAsn1=function(b){var c={},d=[];if(!r.validate(b,v.asn1.contentInfoValidator,c,d))throw c=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),c.errors=d,c;d=r.derToOid(c.contentType);switch(d){case a.pki.oids.envelopedData:d=
v.createEnvelopedData();break;case a.pki.oids.encryptedData:d=v.createEncryptedData();break;case a.pki.oids.signedData:d=v.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+d+" is not (yet) supported.");}d.fromAsn1(c.content.value[0]);return d};v.createSignedData=function(){var b=null;return b={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(c){k(b,
c,v.asn1.signedDataValidator);b.certificates=[];b.crls=[];b.digestAlgorithmIdentifiers=[];b.contentInfo=null;b.signerInfos=[];c=b.rawCapture.certificates.value;for(var d=0;d<c.length;++d)b.certificates.push(a.pki.certificateFromAsn1(c[d]))},toAsn1:function(){b.contentInfo||b.sign();for(var c=[],d=0;d<b.certificates.length;++d)c.push(a.pki.certificateToAsn1(b.certificates[d]));var d=[],e=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,
2022-03-23 21:00:41 +03:00
r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,b.digestAlgorithmIdentifiers),b.contentInfo])]);0<c.length&&e.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,c));0<d.length&&e.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,d));e.value[0].value.push(r.create(r.Class.UNIVERSAL,r.Type.SET,!0,b.signerInfos));return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),
e])},addSigner:function(c){var d=c.issuer,e=c.serialNumber;c.certificate&&(e=c.certificate,"string"===typeof e&&(e=a.pki.certificateFromPem(e)),d=e.issuer.attributes,e=e.serialNumber);var g=c.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof g&&(g=a.pki.privateKeyFromPem(g));var h=c.digestAlgorithm||a.pki.oids.sha1;switch(h){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+
h);}c=c.authenticatedAttributes||[];if(0<c.length){for(var l=!1,k=!1,m=0;m<c.length;++m){var q=c[m];if(!l&&q.type===a.pki.oids.contentType){if(l=!0,k)break}else if(!k&&q.type===a.pki.oids.messageDigest&&(k=!0,l))break}if(!l||!k)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}b.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
2022-03-23 21:00:41 +03:00
signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof b.content||null===b.contentInfo)if(b.contentInfo=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pki.oids.data).getBytes())]),"content"in b){var c;b.content instanceof a.util.ByteBuffer?c=b.content.bytes():"string"===typeof b.content&&(c=a.util.encodeUtf8(b.content));b.contentInfo.value.push(r.create(r.Class.CONTEXT_SPECIFIC,
0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)]))}if(0!==b.signers.length){c={};for(var d=0;d<b.signers.length;++d){var e=b.signers[d],g=e.digestAlgorithm;g in c||(c[g]=a.md[a.pki.oids[g]].create());e.md=0===e.authenticatedAttributes.length?c[g]:a.md[a.pki.oids[g]].create()}b.digestAlgorithmIdentifiers=[];for(g in c)b.digestAlgorithmIdentifiers.push(r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(g).getBytes()),r.create(r.Class.UNIVERSAL,
r.Type.NULL,!1,"")]));if(2>b.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var g=r.derToOid(b.contentInfo.value[0].value),d=b.contentInfo.value[1],d=d.value[0],h=r.toDer(d);h.getByte();r.getBerValueLength(h);var h=h.getBytes(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;d<b.signers.length;++d){e=b.signers[d];if(0===e.authenticatedAttributes.length){if(g!==a.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
}else{e.authenticatedAttributesAsn1=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[]),m=0;m<e.authenticatedAttributes.length;++m){var q=e.authenticatedAttributes[m];q.type===a.pki.oids.messageDigest?q.value=c[e.digestAlgorithm].digest():q.type!==a.pki.oids.signingTime||q.value||(q.value=k);h.value.push(n(q));e.authenticatedAttributesAsn1.value.push(n(q))}h=r.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}c=
b;g=b.signers;k=[];for(d=0;d<g.length;++d)k.push(l(g[d]));c.signerInfos=k}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(c){"string"===typeof c&&(c=a.pki.certificateFromPem(c));b.certificates.push(c)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};v.createEncryptedData=function(){var b=null;return b={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},
fromAsn1:function(a){k(b,a,v.asn1.encryptedDataValidator)},decrypt:function(a){void 0!==a&&(b.encryptedContent.key=a);h(b)}}};v.createEnvelopedData=function(){var b=null;return b={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(a){var d=k(b,a,v.asn1.envelopedDataValidator);a=b;for(var d=d.recipientInfos.value,e=[],g=0;g<d.length;++g)e.push(c(d[g]));a.recipients=e},toAsn1:function(){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,
2022-03-23 21:00:41 +03:00
!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,g(b.recipients)),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,m(b.encryptedContent))])])])},findRecipient:function(a){for(var c=a.issuer.attributes,d=0;d<b.recipients.length;++d){var e=b.recipients[d],g=e.issuer;if(e.serialNumber===
a.serialNumber&&g.length===c.length){for(var h=!0,l=0;l<c.length;++l)if(g[l].type!==c[l].type||g[l].value!==c[l].value){h=!1;break}if(h)return e}}return null},decrypt:function(c,d){if(void 0===b.encryptedContent.key&&void 0!==c&&void 0!==d)switch(c.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var e=d.decrypt(c.encryptedContent.content);b.encryptedContent.key=a.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);
}h(b)},addRecipient:function(c){b.recipients.push({version:0,issuer:c.issuer.attributes,serialNumber:c.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:c.publicKey}})},encrypt:function(c,d){if(void 0===b.encryptedContent.content){d=d||b.encryptedContent.algorithm;c=c||b.encryptedContent.key;var e,g,h;switch(d){case a.pki.oids["aes128-CBC"]:g=e=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:e=24;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:e=
32;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:e=24;g=8;h=a.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+d);}if(void 0===c)c=a.util.createBuffer(a.random.getBytes(e));else if(c.length()!=e)throw Error("Symmetric key has wrong length; got "+c.length()+" bytes, expected "+e+".");b.encryptedContent.algorithm=d;b.encryptedContent.key=c;b.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(g));e=h(c);e.start(b.encryptedContent.parameter.copy());
e.update(b.content);if(!e.finish())throw Error("Symmetric encryption failed.");b.encryptedContent.content=e.output}for(e=0;e<b.recipients.length;++e)if(g=b.recipients[e],void 0===g.encryptedContent.content)switch(g.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:g.encryptedContent.content=g.encryptedContent.key.encrypt(b.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+g.encryptedContent.algorithm);}}}}}if("function"!==typeof a)if("object"===typeof module&&
module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7)return c.pkcs7;c.defined.pkcs7=!0;for(var l=0;l<g.length;++l)g[l](c);return c.pkcs7}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,
2022-03-23 21:00:41 +03:00
Array.prototype.slice.call(arguments,0))};a("js/pkcs7","require module ./aes ./asn1 ./des ./oids ./pem ./pkcs7asn1 ./random ./util ./x509".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){var e=d.toString(16);"8"<=e[0]&&(e="00"+e);e=a.util.hexToBytes(e);b.putInt32(e.length);b.putBytes(e)}function d(a,b){a.putInt32(b.length);a.putString(b)}function g(){for(var b=a.md.sha1.create(),c=arguments.length,d=0;d<c;++d)b.update(arguments[d]);
return b.digest()}var l=a.ssh=a.ssh||{};l.privateKeyToPutty=function(b,l,k){k=k||"";l=l||"";var h=""===l?"none":"aes256-cbc",n;n="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+h+"\r\n")+("Comment: "+k+"\r\n");var v=a.util.createBuffer();d(v,"ssh-rsa");c(v,b.e);c(v,b.n);var w=a.util.encode64(v.bytes(),64),x=Math.floor(w.length/66)+1;n+="Public-Lines: "+x+"\r\n";n+=w;w=a.util.createBuffer();c(w,b.d);c(w,b.p);c(w,b.q);c(w,b.qInv);l?(x=w.length()+16-1,x-=x%16,b=g(w.bytes()),b.truncate(b.length()-
x+w.length()),w.putBuffer(b),x=a.util.createBuffer(),x.putBuffer(g("\x00\x00\x00\x00",l)),x.putBuffer(g("\x00\x00\x00\u0001",l)),x=a.aes.createEncryptionCipher(x.truncate(8),"CBC"),x.start(a.util.createBuffer().fillWithByte(0,16)),x.update(w.copy()),x.finish(),x=x.output,x.truncate(16),b=a.util.encode64(x.bytes(),64)):b=a.util.encode64(w.bytes(),64);x=Math.floor(b.length/66)+1;n+="\r\nPrivate-Lines: "+x+"\r\n";n+=b;l=g("putty-private-key-file-mac-key",l);x=a.util.createBuffer();d(x,"ssh-rsa");d(x,
h);d(x,k);x.putInt32(v.length());x.putBuffer(v);x.putInt32(w.length());x.putBuffer(w);k=a.hmac.create();k.start("sha1",l);k.update(x.bytes());return n+="\r\nPrivate-MAC: "+k.digest().toHex()+"\r\n"};l.publicKeyToOpenSSH=function(b,g){g=g||"";var l=a.util.createBuffer();d(l,"ssh-rsa");c(l,b.e);c(l,b.n);return"ssh-rsa "+a.util.encode64(l.bytes())+" "+g};l.privateKeyToOpenSSH=function(b,c){return c?a.pki.encryptRsaPrivateKey(b,c,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(b)};l.getPublicKeyFingerprint=
function(b,g){g=g||{};var l=g.md||a.md.md5.create(),h=a.util.createBuffer();d(h,"ssh-rsa");c(h,b.e);c(h,b.n);l.start();l.update(h.getBytes());l=l.digest();if("hex"===g.encoding)return l=l.toHex(),g.delimiter?l.match(/.{2}/g).join(g.delimiter):l;if("binary"===g.encoding)return l.getBytes();if(g.encoding)throw Error('Unknown encoding "'+g.encoding+'".');return l}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&
(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.ssh)return c.ssh;c.defined.ssh=!0;for(var l=0;l<g.length;++l)g[l](c);return c.ssh}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c={},d=0;a.debug.set("forge.task","tasks",c);var g={};a.debug.set("forge.task","queues",g);var l={ready:{}};l.ready.stop="ready";l.ready.start="running";l.ready.cancel="done";l.ready.fail="error";l.running={};l.running.stop="ready";l.running.start="running";l.running.block="blocked";l.running.unblock="running";l.running.sleep="sleeping";l.running.wakeup="running";l.running.cancel="done";l.running.fail=
"error";l.blocked={};l.blocked.stop="blocked";l.blocked.start="blocked";l.blocked.block="blocked";l.blocked.unblock="blocked";l.blocked.sleep="blocked";l.blocked.wakeup="blocked";l.blocked.cancel="done";l.blocked.fail="error";l.sleeping={};l.sleeping.stop="sleeping";l.sleeping.start="sleeping";l.sleeping.block="sleeping";l.sleeping.unblock="sleeping";l.sleeping.sleep="sleeping";l.sleeping.wakeup="sleeping";l.sleeping.cancel="done";l.sleeping.fail="error";l.done={};l.done.stop="done";l.done.start=
"done";l.done.block="done";l.done.unblock="done";l.done.sleep="done";l.done.wakeup="done";l.done.cancel="done";l.done.fail="error";l.error={};l.error.stop="error";l.error.start="error";l.error.block="error";l.error.unblock="error";l.error.sleep="error";l.error.wakeup="error";l.error.cancel="error";l.error.fail="error";var n=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=
2022-03-23 21:00:41 +03:00
this.timeoutId=null;this.id=d++;c[this.id]=this};n.prototype.debug=function(b){a.log.debug("forge.task",b||"","[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",g)};n.prototype.next=function(a,b){"function"===typeof a&&(b=a,a=this.name);var c=new n({run:b,name:a,parent:this});c.state="running";c.type=this.type;c.successCallback=this.successCallback||null;c.failureCallback=this.failureCallback||null;this.subtasks.push(c);return this};n.prototype.parallel=function(b,c){a.util.isArray(b)&&
(c=b,b=this.name);return this.next(b,function(d){d.block(c.length);for(var e=function(b,e){a.task.start({type:b,run:function(a){c[e](a)},success:function(a){d.unblock()},failure:function(a){d.unblock()}})},g=0;g<c.length;g++)e(b+"__parallel-"+d.id+"-"+g,g)})};n.prototype.stop=function(){this.state=l[this.state].stop};n.prototype.start=function(){this.error=!1;this.state=l[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),k(this,0))};n.prototype.block=function(a){this.blocks+=
"undefined"===typeof a?1:a;0<this.blocks&&(this.state=l[this.state].block)};n.prototype.unblock=function(a){this.blocks-="undefined"===typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",k(this,0));return this.blocks};n.prototype.sleep=function(a){this.state=l[this.state].sleep;var b=this;this.timeoutId=setTimeout(function(){b.timeoutId=null;b.state="running";k(b,0)},"undefined"===typeof a?0:a)};n.prototype.wait=function(a){a.wait(this)};n.prototype.wakeup=function(){"sleeping"===
this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",k(this,0))};n.prototype.cancel=function(){this.state=l[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};n.prototype.fail=function(a){this.error=!0;h(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,k(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
a.userData=this.userData,a=a.parent;h(a,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(a){a.error=!1;a.state=l[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),k(a,0))},0)},k=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||k(d,b)}else h(a),a.error||
null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,k(a.parent,b))};c?setTimeout(d,0):d(b)},h=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in g?0===g[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):g[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(g[b.type].shift(),0===g[b.type].length?delete g[b.type]:g[b.type][0].start()):a.log.error("forge.task",
2022-03-23 21:00:41 +03:00
"[%s][%s] task queue missing [%s]",b.id,b.name,b.type),d||(b.error&&b.failureCallback?b.failureCallback(b):!b.error&&b.successCallback&&b.successCallback(b)))};a.task=a.task||{};a.task.start=function(a){var b=new n({run:a.run,name:a.name||"?"});b.type=a.type;b.successCallback=a.success||null;b.failureCallback=a.failure||null;b.type in g?g[a.type].push(b):(g[b.type]=[b],m(b))};a.task.cancel=function(a){a in g&&(g[a]=[g[a][0]])};a.task.createCondition=function(){var a={tasks:{},wait:function(b){b.id in
a.tasks||(b.block(),a.tasks[b.id]=b)},notify:function(){var b=a.tasks;a.tasks={};for(var c in b)b[c].unblock()}};return a}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var g=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.task)return c.task;c.defined.task=!0;for(var l=0;l<g.length;++l)g[l](c);return c.task}},
l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/task",["require","module","./debug","./log","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof a)if("object"===typeof module&&module.exports){var b=!0;a=function(a,b){b(c,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
return}var g,v=function(a,b){b.exports=function(b){var c=g.map(function(b){return a(b)});b=b||{};b.defined=b.defined||{};if(b.defined.forge)return b.forge;b.defined.forge=!0;for(var d=0;d<c.length;++d)c[d](b);return b};b.exports.disableNativeCode=!0;b.exports(b.exports)},n=a;a=function(c,p){g="string"===typeof c?p.slice(2):c.slice(2);if(b)return delete a,n.apply(null,Array.prototype.slice.call(arguments,0));a=n;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/forge","require module ./aes ./aesCipherSuites ./asn1 ./cipher ./cipherModes ./debug ./des ./hmac ./kem ./log ./md ./mgf1 ./pbkdf2 ./pem ./pkcs7 ./pkcs1 ./pkcs12 ./pki ./prime ./prng ./pss ./random ./rc2 ./ssh ./task ./tls ./util".split(" "),
function(){v.apply(null,Array.prototype.slice.call(arguments,0))})})();return c("js/forge")});
function amtcert_linkCertPrivateKey(b,c){if(null!=c&&0!=c.length)for(var a in b){var d=b[a];try{for(var g=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),g=g.substring(0,g.length-24),v=0;v<c.length;v++)if(g===c[v].DERKey||g==btoa(atob(c[v].DERKey).substring(24)))c[v].XCert=d,d.XPrivateKey=c[v]}catch(n){console.log(n)}}}
function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),g=window.forge.asn1.fromDer(d),v=window.forge.pkcs12.pkcs12FromAsn1(g,c),n=v.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(n[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<n[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var l=n[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,p=window.forge.pki.privateKeyToAsn1(l),q=window.forge.pki.wrapRsaPrivateKey(p);window.forge.asn1.toDer(q).getBytes();
var e=v.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,C=v.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(l,e,C);return!0}catch(w){}return!1}function amtcert_signWithCaKey(b,c,a,d,g){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,g)}
function amtcert_createCertificate(b,c,a,d,g){var v,n=forge.pki.createCertificate();a?n.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(v=forge.pki.rsa.generateKeyPair(2048),n.publicKey=v.publicKey);n.serialNumber=""+Math.floor(1E5*Math.random()+1);n.validity.notBefore=new Date(2018,0,1);n.validity.notAfter=new Date(2049,11,31);var l=[];b.CN&&l.push({name:"commonName",value:b.CN});b.C&&l.push({name:"countryName",value:b.C});b.ST&&l.push({shortName:"ST",
value:b.ST});b.O&&l.push({name:"organizationName",value:b.O});n.setSubject(l);c?(b=[],d.CN&&b.push({name:"commonName",value:d.CN}),d.C&&b.push({name:"countryName",value:d.C}),d.ST&&b.push({shortName:"ST",value:d.ST}),d.O&&b.push({name:"organizationName",value:d.O}),n.setIssuer(b)):n.setIssuer(l);null==c?n.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,emailCA:!0,objCA:!0},{name:"subjectKeyIdentifier"}]):(null==g?g={name:"extKeyUsage",serverAuth:!0}:g.name="extKeyUsage",
n.setExtensions([{name:"basicConstraints"},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},g,{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0},{name:"subjectKeyIdentifier"}]));c?n.sign(c,forge.md.sha256.create()):n.sign(v.privateKey,forge.md.sha256.create());return a?n:{cert:n,key:v.privateKey}}
2022-03-23 21:00:41 +03:00
function _stringToArrayBuffer(b){for(var c=new ArrayBuffer(b.length),a=new Uint8Array(c),d=0,g=b.length;d<g;d++)a[d]=b.charCodeAt(d);return c}function _arrayBufferToString(b){var c="";b=new Uint8Array(b);for(var a=b.byteLength,d=0;d<a;d++)c+=String.fromCharCode(b[d]);return c}function certCetAsn1Values(b,c){if("string"===typeof b&&0==b.indexOf("https://"))c.push(b);else if(Array.isArray(b))for(var a in b)certCetAsn1Values(b[a],c);else b&&"object"===typeof b&&certCetAsn1Values(b.value,c)}
function getExtensionUrls(b,c){var a=[],d=b.getExtension(c);null!=d&&certCetAsn1Values(forge.asn1.fromDer(d.value),a);return a}var certUrlCache=null,certUrlCacheFile=null;
function getCertUrl(b,c){null==certUrlCacheFile&&(certUrlCacheFile=null!=process.env.LOCALAPPDATA?require("path").join(process.env.LOCALAPPDATA,"mccache.json"):"mccache.json");if(null==certUrlCache)try{certUrlCache=JSON.parse(require("fs").readFileSync(certUrlCacheFile))}catch(d){certUrlCache={}}if(null!=certUrlCache[b]&&null!=certUrlCache[b].data){var a=0;b.endsWith(".crl")&&(a=Date.now()-12096E5);if(certUrlCache[b].time>a){c(b,atob(certUrlCache[b].data));return}}console.log("Loading: "+b);a=require("url").parse(b);
2022-03-23 21:00:41 +03:00
require("https").get({hostname:a.hostname,port:a.port?a.port:443,path:a.path,method:"GET",rejectUnauthorized:!1},function(a){var g="";a.on("data",function(a){null!=g&&(g+=a.toString("binary"));5E5<g.length&&(g=null)});a.on("end",function(){certUrlCache[b]={data:btoa(g),time:Date.now()};try{require("fs").writeFileSync(certUrlCacheFile,JSON.stringify(certUrlCache,null,2))}catch(a){}c(b,g)})}).on("error",function(a){console.log("Error: "+a.message);c(b,null)})}
var CreateAmtRemoteDesktop=function(b,c){function a(a){return String.fromCharCode.apply(null,a)}function d(a,b,c,d,e,k,m,q){var r=a[b++];q={};var u=0,B=0;if(0==r){if(2==h.bpp)for(e=0;e<m;e++)n(a[b++]+(a[b++]<<8),e);else for(e=0;e<m;e++)v(a[b++],e);g(h.spare,c,d)}else if(1==r)h.graymode?(r=a[b++],h.lowcolor&&(r<<=4),h.canvas.fillStyle="rgb("+r+","+r+","+r+")"):(r=a[b++]+(2==h.bpp?a[b++]<<8:0),h.canvas.fillStyle="rgb("+(1==h.bpp?(r&224)+","+((r&28)<<3)+","+D((r&3)<<6):(r>>8&248)+","+(r>>3&252)+","+
((r&31)<<3))+")"),a=C(c,d),d=w(c,d),h.canvas.fillRect(a,d,e,k);else if(1<r&&17>r){k=4;B=15;if(2==h.bpp){for(e=0;e<r;e++)q[e]=a[b++]+(a[b++]<<8);2==r?B=k=1:4>=r&&(k=2,B=3);for(;u<m&&b<a.byteLength;)for(r=a[b++],e=8-k;0<=e;e-=k)n(q[r>>e&B],u++)}else{for(e=0;e<r;e++)q[e]=a[b++];2==r?B=k=1:4>=r&&(k=2,B=3);for(;u<m&&b<a.byteLength;)for(r=a[b++],e=8-k;0<=e;e-=k)v(q[r>>e&B],u++)}g(h.spare,c,d)}else if(128==r){if(2==h.bpp)for(;u<m&&b<a.byteLength;){r=a[b++]+(a[b++]<<8);B=1;do B+=e=a[b++];while(255==e);if(0==
h.rotation)p(r,u,B),u+=B;else for(;0<=--B;)n(r,u++)}else for(;u<m&&b<a.byteLength;){r=a[b++];B=1;do B+=e=a[b++];while(255==e);if(0==h.rotation)l(r,u,B),u+=B;else for(;0<=--B;)v(r,u++)}g(h.spare,c,d)}else if(129<r){if(2==h.bpp)for(e=0;e<r-128;e++)q[e]=a[b++]+(a[b++]<<8);else for(e=0;e<r-128;e++)q[e]=a[b++];for(;u<m&&b<a.byteLength;){B=1;e=a[b++];r=q[e%128];if(127<e){do B+=e=a[b++];while(255==e)}if(0==h.rotation)2==h.bpp?p(r,u,B):l(r,u,B),u+=B;else if(2==h.bpp)for(;0<=--B;)n(r,u++);else for(;0<=--B;)v(r,
u++)}g(h.spare,c,d)}}function g(a,b,c){if(1!=h.holding){var d=0==h.rotation?b:1==h.rotation?h.canvas.canvas.width-h.sparew2-c:2==h.rotation?h.canvas.canvas.width-h.sparew2-b:3==h.rotation?c:0;c=0==h.rotation?c:1==h.rotation?b:2==h.rotation?h.canvas.canvas.height-h.spareh2-c:3==h.rotation?h.canvas.canvas.height-h.spareh-b:0;h.canvas.putImageData(a,d,c)}}function v(a,b){var c=b<<2;if(0<h.rotation)if(1==h.rotation){var c=b%h.sparew,d=Math.floor(b/h.sparew);b=c*h.sparew2+(h.sparew2-1-d);c=b<<2}else 2==
h.rotation?c=h.sparew*h.spareh*4-4-c:3==h.rotation&&(c=b%h.sparew,d=Math.floor(b/h.sparew),b=(h.sparew2-1-c)*h.sparew2+d,c=b<<2);h.graymode?(h.lowcolor&&(a<<=4),h.spare.data[c]=h.spare.data[c+1]=h.spare.data[c+2]=a):(h.spare.data[c]=a&224,h.spare.data[c+1]=(a&28)<<3,h.spare.data[c+2]=D((a&3)<<6))}function n(a,b){var c=b<<2;if(0<h.rotation)if(1==h.rotation){var c=b%h.sparew,d=Math.floor(b/h.sparew);b=c*h.sparew2+(h.sparew2-1-d);c=b<<2}else 2==h.rotation?c=h.sparew*h.spareh*4-4-c:3==h.rotation&&(c=
b%h.sparew,d=Math.floor(b/h.sparew),b=(h.sparew2-1-c)*h.sparew2+d,c=b<<2);h.spare.data[c]=a>>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function l(a,b,c){if(h.graymode)for(b<<=2,h.lowcolor&&(a<<=4);0<=--c;)h.spare.data[b]=h.spare.data[b+1]=h.spare.data[b+2]=a,b+=4;else{b<<=2;var d=a&224,e=(a&28)<<3;for(a=D((a&3)<<6);0<=--c;)h.spare.data[b]=d,h.spare.data[b+1]=e,h.spare.data[b+2]=a,b+=4}}function p(a,b,c){b<<=2;var d=a>>8&248,e=a>>3&252;for(a=(a&31)<<3;0<=--c;)h.spare.data[b]=d,h.spare.data[b+
1]=e,h.spare.data[b+2]=a,b+=4}function q(a,b){return 0==h.rotation?a:1==h.rotation?b:2==h.rotation?h.canvas.canvas.width-a:3==h.rotation?h.canvas.canvas.height-b:0}function e(a,b){return 0==h.rotation?b:1==h.rotation?h.canvas.canvas.width-a:2==h.rotation?h.canvas.canvas.height-b:3==h.rotation?a:0}function C(a,b){return 0==h.rotation||1==h.rotation?a:2==h.rotation?a-h.canvas.canvas.width:3==h.rotation?a-h.canvas.canvas.height:0}function w(a,b){return 0==h.rotation?b:1==h.rotation?b-h.canvas.canvas.width:
2==h.rotation?b-h.canvas.canvas.height:3==h.rotation?b:0}function D(a){return 127<a?a+32:a}function m(){1!=h.holding&&h.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(h.rwidth)+ShortToStr(h.rheight))}function k(a,b){b||(b=window.event);if(b.code&&0==h.localKeyMap){var c;c=b;c=c.code.startsWith("Key")&&4==c.code.length?c.code.charCodeAt(3)+(0==c.shiftKey?32:0):c.code.startsWith("Digit")&&6==c.code.length?c.code.charCodeAt(5):c.code.startsWith("Numpad")&&7==c.code.length?c.code.charCodeAt(6):r[c.code];
null!=c&&h.sendkey(c,a)}else{var d=c=b.keyCode;0==b.shiftKey&&65<=c&&90>=c&&(d=c+32);112<=c&&124>=c&&(d=c+65358);8==c&&(d=65288);9==c&&(d=65289);13==c&&(d=65293);16==c&&(d=65505);17==c&&(d=65507);18==c&&(d=65513);27==c&&(d=65307);33==c&&(d=65365);34==c&&(d=65366);35==c&&(d=65367);36==c&&(d=65360);37==c&&(d=65361);38==c&&(d=65362);39==c&&(d=65363);40==c&&(d=65364);45==c&&(d=65379);46==c&&(d=65535);96<=c&&105>=c&&(d=c-48);106==c&&(d=42);107==c&&(d=43);109==c&&(d=45);110==c&&(d=46);111==c&&(d=47);186==
c&&(d=59);187==c&&(d=61);188==c&&(d=44);189==c&&(d=45);190==c&&(d=46);191==c&&(d=47);192==c&&(d=96);219==c&&(d=91);220==c&&(d=92);221==c&&(d=93);222==c&&(d=39);h.sendkey(d,a)}return h.haltEvent(b)}var h={};h.canvasid=b;h.CanvasId=Q(b);h.scrolldiv=c;h.canvas=Q(b).getContext("2d");h.protocol=2;h.state=0;h.acc=null;h.ScreenWidth=960;h.ScreenHeight=700;h.width=0;h.height=0;h.rwidth=0;h.rheight=0;h.bpp=2;h.useRLE=!0;h.showmouse=!0;h.buttonmask=0;h.localKeyMap=!0;h.spare=null;h.sparew=0;h.spareh=0;h.sparew2=
0;h.spareh2=0;h.sparecache={};h.onScreenSizeChange=null;h.frameRateDelay=0;h.noMouseRotate=!1;h.rotation=0;h.kvmDataSupported=!1;h.onKvmData=null;h.onKvmDataPending=[];h.onKvmDataAck=-1;h.holding=!1;h.lastKeepAlive=Date.now();h.kvmExt={};h.kvmExtChanged=null;h.useZLib=!1;h.decimationMode=0;h.graymode=!1;h.lowcolor=!1;h.mNagleTimer=null;h.mx=0;h.my=0;h.inflate=ZLIB.inflateInit(-15);h.xxStateChange=function(a){0==a?(h.canvas.fillStyle="#000000",h.canvas.fillRect(0,0,h.width,h.height),h.canvas.canvas.width=
h.rwidth=h.width=640,h.canvas.canvas.height=h.rheight=h.height=400,QS(h.canvasid).cursor="default"):QS(h.canvasid).cursor=h.showmouse?"default":"none"};h.ProcessBinaryData=function(b){if(null==h.acc)h.acc=new Uint8Array(b);else{var c=new Uint8Array(h.acc.byteLength+b.byteLength);c.set(h.acc,0);c.set(new Uint8Array(b),h.acc.byteLength);h.acc=c}for(;null!=h.acc&&0<h.acc.byteLength;){var e=0,l=new DataView(h.acc.buffer);if(0==h.state&&12<=h.acc.byteLength)e=12,h.state=1,h.parent&&delete h.parent.connectTime,
h.send("RFB 003.008\n");else if(1==h.state&&1<=h.acc.byteLength)e=h.acc[0]+1,h.send(String.fromCharCode(1)),h.state=2;else if(2==h.state&&4<=h.acc.byteLength){e=4;if(0!=l.getUint32(0))return h.Stop();h.send(String.fromCharCode(1));h.state=3;h.parent&&(h.parent.disconnectCode=5E4)}else if(3==h.state&&24<=h.acc.byteLength){h.rotation=0;b=l.getUint32(20);if(h.acc.byteLength<24+b)break;e=24+b;h.canvas.canvas.width=h.rwidth=h.width=h.ScreenWidth=l.getUint16(0);h.canvas.canvas.height=h.rheight=h.height=
h.ScreenHeight=l.getUint16(2);b="";h.useRLE&&(b+=IntToStr(16));b+=IntToStr(0);b+=IntToStr(1092);h.send(String.fromCharCode(2,0)+ShortToStr(b.length/4+1)+b+IntToStr(-223));0==h.graymode?1==h.bpp&&h.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)):(2==h.bpp&&(h.bpp=1),0==h.lowcolor?h.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(255)+ShortToStr(0)+ShortToStr(0)+String.fromCharCode(0,0,0,0,0,0)):h.send(String.fromCharCode(0,
0,0,0,8,4,0,1)+ShortToStr(15)+ShortToStr(0)+ShortToStr(0)+String.fromCharCode(0,0,0,0,0,0)));h.state=4;h.parent&&(h.parent.connectTime=Date.now(),h.parent.disconnectCode=0,h.parent.xxStateChange(3));null!=h.kvmExtChanged&&(0<h.decimationMode&&h.sendKvmExtCmd(2,h.decimationMode),h.sendKvmExtCmd(4,!0===h.useZLib?1:0));m();if(null!=h.onScreenSizeChange)h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight);h.parent&&(h.parent.disconnectCode=50001,9216E3<h.bpp*h.width*h.height&&(h.parent.disconnectCode=
50002))}else if(4==h.state)switch(h.acc[0]){case 0:if(4>h.acc.byteLength)return;h.state=100+l.getUint16(2);e=4;break;case 2:e=1;break;case 3:if(8>h.acc.byteLength)return;b=l.getUint32(4)+8;if(h.acc.byteLength<b)return;c=h.acc;if(8>c.byteLength)e=0;else if(b=l.getUint32(4)+8,c.byteLength<b)e=0;else{if(null!=h.onKvmData)if(c=a(new Uint8Array(c.buffer.slice(8,b))),16<=c.length&&"\x00KvmDataChannel"==c.substring(0,15)){0==h.kvmDataSupported&&(h.kvmDataSupported=!0);if(-1==h.onKvmDataAck&&16==c.length||
0!=c.charCodeAt(15))h.onKvmDataAck=!0;try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Recv("+(c.length-16)+"): "+c.substring(16))}catch(k){}if(16<=c.length)h.onKvmData(c.substring(16));1==h.onKvmDataAck&&0<h.onKvmDataPending.length&&h.sendKvmData(h.onKvmDataPending.shift())}else if(13<=c.length&&"\x00KvmExtCmd\x00"==c.substring(0,11)){var p=c.charCodeAt(11),l=c.charCodeAt(12);1==p&&(h.kvmExt.decimationMode=l,13<c.length&&(h.kvmExt.decimationState=c.charCodeAt(13)),null!=h.kvmExtChanged&&
h.kvmExtChanged(1,h.kvmExt,h.kvmExt));2==p&&h.sendKvmExtCmd(1);3==p&&(h.kvmExt.compression=l,null!=h.kvmExtChanged&&h.kvmExtChanged(3,h.kvmExt));4==p&&h.sendKvmExtCmd(3)}else{console.log("Got KVM clipboard data:",c);try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-ClipBoard-Recv("+c.length+"): "+rstr2hex(c)+", "+c)}catch(k){}}e=b}}else if(100<h.state&&12<=h.acc.byteLength){b=l.getUint16(0);var c=l.getUint16(2),e=l.getUint16(4),q=l.getUint16(6),p=e*q,r=l.getUint32(8);if(17>r){if(1>e||64<e||1>q||
64<q)return console.log("Invalid tile size ("+e+","+q+"), disconnecting."),h.Stop();if(h.sparew!=e||h.spareh!=q){h.sparew=h.sparew2=e;h.spareh=h.spareh2=q;if(1==h.rotation||3==h.rotation)h.sparew2=q,h.spareh2=e;var w=h.sparew2+"x"+h.spareh2;h.spare=h.sparecache[w];if(!h.spare){h.sparecache[w]=h.spare=h.canvas.createImageData(h.sparew2,h.spareh2);for(var N=h.sparew2*h.spareh2<<2,w=3;w<N;w+=4)h.spare.data[w]=255}}}if(4294967073==r){h.canvas.canvas.width=h.rwidth=h.width=e;h.canvas.canvas.height=h.rheight=
h.height=q;h.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(h.width)+ShortToStr(h.height));e=12;if(null!=h.onScreenSizeChange)h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight);h.parent&&9216E3<h.bpp*h.width*h.height&&(h.parent.disconnectCode=50002)}else if(0==r){r=12;e=12+p*h.bpp;if(h.acc.byteLength<e)break;if(2==h.bpp)for(w=0;w<p;w++)n(l.getUint16(r,!0),w),r+=2;else for(w=0;w<p;w++)v(h.acc[r++],w);g(h.spare,b,c)}else if(16==r){if(16>h.acc.byteLength)break;w=l.getUint32(12);if(h.acc.byteLength<
16+w)break;r=16;if(5<w&&0==h.acc[r]&&l.getUint16(r+1,!0)==w-5)d(h.acc,r+5,b,c,e,q,p,w);else if(l=h.inflate.inflate(a(new Uint8Array(h.acc.buffer.slice(r,r+w-0)))),0<l.length){for(var r=l,N=new Uint8Array(r.length),u=0,C=r.length;u<C;++u)N[u]=r.charCodeAt(u);d(N,0,b,c,e,q,p,l.length)}else console.log("Invalid deflate data");e=16+w}else return h.Stop();100==--h.state&&(h.state=4,0==h.frameRateDelay?m():setTimeout(m,h.frameRateDelay))}if(0==e)break;h.acc=e!=h.acc.byteLength?new Uint8Array(h.acc.buffer.slice(e)):
null}};h.hold=function(a){if(h.holding!=a)if(h.holding=a,h.canvas.fillStyle="#000000",h.canvas.fillRect(0,0,h.width,h.height),0==h.holding){if(h.canvas.canvas.width!=h.width||h.canvas.canvas.height!=h.height)if(h.canvas.canvas.width=h.width,h.canvas.canvas.height=h.height,null!=h.onScreenSizeChange)h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight);h.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(h.width)+ShortToStr(h.height))}else h.UnGrabMouseInput(),h.UnGrabKeyInput()};h.tcanvas=null;h.setRotation=
function(a){for(;0>a;)a+=4;a%=4;if(1==h.holding)h.rotation=a;else{if(a==h.rotation)return!0;var b=h.canvas.canvas.width,c=h.canvas.canvas.height;if(1==h.rotation||3==h.rotation)b=h.canvas.canvas.height,c=h.canvas.canvas.width;null==h.tcanvas&&(h.tcanvas=document.createElement("canvas"));var d=h.tcanvas.getContext("2d");d.setTransform(1,0,0,1,0,0);d.canvas.width=b;d.canvas.height=c;d.rotate(-90*h.rotation*Math.PI/180);0==h.rotation&&d.drawImage(h.canvas.canvas,0,0);1==h.rotation&&d.drawImage(h.canvas.canvas,
-h.canvas.canvas.width,0);2==h.rotation&&d.drawImage(h.canvas.canvas,-h.canvas.canvas.width,-h.canvas.canvas.height);3==h.rotation&&d.drawImage(h.canvas.canvas,0,-h.canvas.canvas.height);if(0==h.rotation||2==h.rotation)h.canvas.canvas.height=b,h.canvas.canvas.width=c;if(1==h.rotation||3==h.rotation)h.canvas.canvas.height=c,h.canvas.canvas.width=b;h.canvas.setTransform(1,0,0,1,0,0);h.canvas.rotate(90*a*Math.PI/180);h.rotation=a;h.canvas.drawImage(h.tcanvas,C(0,0),w(0,0));h.width=h.canvas.canvas.width;
2022-03-23 21:00:41 +03:00
h.height=h.canvas.canvas.height;if(null!=h.onScreenResize)h.onScreenResize(h,h.width,h.height,h.CanvasId);return!0}};h.Start=function(){h.state=0;h.acc=null;h.inflate.inflateReset();h.onKvmDataPending=[];h.onKvmDataAck=-1;h.kvmDataSupported=!1;h.kvmExt={};for(var a in h.sparecache)delete h.sparecache[a]};h.Stop=function(){h.UnGrabMouseInput();h.UnGrabKeyInput();h.parent&&h.parent.Stop()};h.send=function(a){h.parent&&h.parent.send(a)};var r={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};h.sendkey=function(a,b){if("object"==typeof a){var c="",d;for(d in a)c+=String.fromCharCode(4,a[d][1],0,0)+IntToStr(a[d][0]);h.send(c)}else h.send(String.fromCharCode(4,b,0,0)+IntToStr(a))};h.sendKvmExtCmd=function(a,b){var c="\x00KvmExtCmd\x00"+String.fromCharCode(a)+(null!=b?String.fromCharCode(b):"");
h.send(String.fromCharCode(6,0,0,0)+IntToStr(c.length)+c)};h.sendKvmData=function(a){if(!0!==h.onKvmDataAck)h.onKvmDataPending.push(a);else{try{urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a)}catch(b){}a="\x00KvmDataChannel\x00"+a;h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a);h.onKvmDataAck=!1}};h.sendKeepAlive=function(){h.lastKeepAlive<Date.now()-5E3&&(h.lastKeepAlive=Date.now(),h.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\x00KvmDataChannel\x00"))};
h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var K=!1,B=!1;h.GrabMouseInput=function(){if(1!=K){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;a.onmousewheel=h.mousewheel;K=!0}};h.UnGrabMouseInput=function(){if(0!=K){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;a.onmousewheel=null;K=!1}};h.GrabKeyInput=function(){1!=B&&(document.onkeyup=
h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,B=!0)};h.UnGrabKeyInput=function(){0!=B&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,B=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return k(0,a)};h.handleKeyDown=function(a){return k(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousewheel=function(a){var b=
0;"number"==typeof a.deltaY?b=-1*a.deltaY:"number"==typeof a.detail?b=-1*a.detail:"number"==typeof a.wheelDelta&&(b=a.wheelDelta);if(0!=b){h.ReverseMouseWheel&&(b*=-1);var c=h.buttonmask;h.buttonmask|=1<<(0<b?3:4);h.mousemove(a,1);h.buttonmask=c;return h.mousemove(a,1)}};h.mousedown=function(a){h.buttonmask|=1<<a.button;return h.mousemove(a,1)};h.mouseup=function(a){h.buttonmask&=65535-(1<<a.button);return h.mousemove(a,1)};h.mousemove=function(a,b){if(4>h.state)return!0;var c=h.canvas.canvas.height/
Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,g=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-g[0])*d;h.my=(event.pageY-g[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);if(1==h.rotation||3==h.rotation)h.mx=h.mx*h.rwidth/h.width,h.my=h.my*h.rheight/h.height;1!=h.noMouseRotate&&(c=q(h.mx,h.my),h.my=e(h.mx,h.my),h.mx=c);1==b?(h.send(String.fromCharCode(5,h.buttonmask)+ShortToStr(h.mx)+ShortToStr(h.my)),null!=h.mNagleTimer&&(clearTimeout(h.mNagleTimer),
h.mNagleTimer=null)):null==h.mNagleTimer&&(h.mNagleTimer=setTimeout(function(){h.send(String.fromCharCode(5,h.buttonmask)+ShortToStr(h.mx)+ShortToStr(h.my));h.mNagleTimer=null},50));return h.haltEvent(a)};h.getPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};return h},CreateAgentRemoteDesktop=function(b,c){var a={};a.CanvasId=b;"string"===typeof b&&(a.CanvasId=Q(b));a.Canvas=a.CanvasId.getContext("2d");a.scrolldiv=c;a.State=
0;a.PendingOperations=[];a.tilesReceived=0;a.TilesDrawn=0;a.KillDraw=0;a.ipad=!1;a.tabletKeyboardVisible=!1;a.LastX=0;a.LastY=0;a.touchenabled=0;a.submenuoffset=0;a.touchtimer=null;a.TouchArray={};a.connectmode=0;a.connectioncount=0;a.rotation=0;a.protocol=2;a.debugmode=0;a.firstUpKeys=[];a.stopInput=!1;a.localKeyMap=!0;a.altPressed=!1;a.ctrlPressed=!1;a.shiftPressed=!1;a.sessionid=0;a.username;a.oldie=!1;a.CompressionLevel=50;a.ScalingLevel=1024;a.FrameRateTimer=10;a.FirstDraw=!1;a.ScreenWidth=960;
a.ScreenHeight=700;a.width=960;a.height=960;a.onScreenSizeChange=null;a.onMessage=null;a.onConnectCountChanged=null;a.onDebugMessage=null;a.onTouchEnabledChanged=null;a.onDisplayinfo=null;a.accumulator=null;var d=!0,g="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?g:"default")};var v="default progress crosshair pointer help text no-drop move nesw-resize ns-resize nwse-resize w-resize alias wait none not-allowed col-resize row-resize copy zoom-in zoom-out".split(" ");
a.Start=function(){a.State=0;a.accumulator=null};a.Stop=function(){a.setRotation(0);a.UnGrabKeyInput();a.UnGrabMouseInput();a.touchenabled=0;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.Canvas.clearRect(0,0,a.CanvasId.width,a.CanvasId.height)};a.xxStateChange=function(b){if(a.State!=b)switch(a.State=b,a.CanvasId.style.cursor="default",b){case 0:a.Stop()}};a.send=function(b){1<a.debugmode&&console.log("KSend("+b.length+"): "+rstr2hex(b));null!=a.parent&&
a.parent.send(b)};a.ProcessPictureMsg=function(b,c,d){var e=new Image;e.xcount=a.tilesReceived++;var g=a.tilesReceived;e.src="data:image/jpeg;base64,"+btoa(b.substring(4,b.length));e.onload=function(){if(null!=a.Canvas&&a.KillDraw<g&&0!=a.State)for(a.PendingOperations.push([g,2,e,c,d]);a.DoPendingOperations(););};e.error=function(){console.log("DecodeTileError")}};a.DoPendingOperations=function(){if(0==a.PendingOperations.length)return!1;for(var b=0;b<a.PendingOperations.length;b++){var c=a.PendingOperations[b];
if(c[0]==a.TilesDrawn+1)return 1==c[1]?a.ProcessCopyRectMsg(c[2]):2==c[1]&&(a.Canvas.drawImage(c[2],a.rotX(c[3],c[4]),a.rotY(c[3],c[4])),delete c[2]),a.PendingOperations.splice(b,1),delete c,a.TilesDrawn++,a.TilesDrawn==a.tilesReceived&&a.KillDraw<a.TilesDrawn&&(a.KillDraw=a.TilesDrawn=a.tilesReceived=0),!0}a.oldie&&0<a.PendingOperations.length&&a.TilesDrawn++;return!1};a.ProcessCopyRectMsg=function(b){var c=((b.charCodeAt(0)&255)<<8)+(b.charCodeAt(1)&255),d=((b.charCodeAt(2)&255)<<8)+(b.charCodeAt(3)&
255),e=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255),g=((b.charCodeAt(6)&255)<<8)+(b.charCodeAt(7)&255),n=((b.charCodeAt(8)&255)<<8)+(b.charCodeAt(9)&255);b=((b.charCodeAt(10)&255)<<8)+(b.charCodeAt(11)&255);a.Canvas.drawImage(Canvas.canvas,c,d,n,b,e,g,n,b)};a.SendUnPause=function(){a.send(String.fromCharCode(0,8,0,5,0))};a.SendPause=function(){a.send(String.fromCharCode(0,8,0,5,1))};a.SendCompressionLevel=function(b,c,d,e){c&&(a.CompressionLevel=c);d&&(a.ScalingLevel=d);e&&(a.FrameRateTimer=e);
a.send(String.fromCharCode(0,5,0,10,b,a.CompressionLevel)+a.shortToStr(a.ScalingLevel)+a.shortToStr(a.FrameRateTimer))};a.SendRefresh=function(){a.send(String.fromCharCode(0,6,0,4))};a.ProcessScreenMsg=function(b,c){0<a.debugmode&&console.log("ScreenSize: "+b+" x "+c);a.Canvas.setTransform(1,0,0,1,0,0);a.rotation=0;a.FirstDraw=!0;a.ScreenWidth=a.width=b;a.ScreenHeight=a.height=c;for(a.KillDraw=a.tilesReceived;0<a.PendingOperations.length;)a.PendingOperations.shift();a.SendCompressionLevel(1);a.SendUnPause();
if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId)};a.ProcessData=function(b){for(var c=0;c<b.length;)c+=a.ProcessDataEx(b.substring(c))};a.ProcessDataEx=function(b){null!=a.accumulator&&(b=a.accumulator+b,a.accumulator=null);1<a.debugmode&&console.log("KRecv("+b.length+"): "+rstr2hex(b.substring(0,Math.min(b.length,40))));if(!(4>b.length)){var c=null,q=0,e=0,n=ReadShort(b,0),w=ReadShort(b,2),D=0;if(27==n&&8==w){if(12>b.length)return;n=ReadShort(b,8);w=ReadInt(b,
4);if(w+8>b.length){a.accumulator=b;return}b=b.substring(8);D=8}w!=b.length&&0<a.debugmode&&console.log(w,b.length,w==b.length);if(18<=n&&65!=n&&88!=n)console.error("Invalid KVM command "+n+" of size "+w),console.log("Invalid KVM data",b.length,rstr2hex(b.substring(0,40))+"...");else if(w>b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,w),q=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),e=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0<a.debugmode&&console.log("CMD"+n+" at X="+
q+" Y="+e);switch(n){case 3:if(a.FirstDraw)a.onResize();a.ProcessPictureMsg(c,q,e);break;case 4:if(a.FirstDraw)a.onResize();a.TilesDrawn==a.tilesReceived?a.ProcessCopyRectMsg(c):a.PendingOperations.push([++tilesReceived,1,c]);break;case 7:a.ProcessScreenMsg(q,e);a.SendKeyMsgKC(a.KeyAction.UP,16);a.SendKeyMsgKC(a.KeyAction.UP,17);a.SendKeyMsgKC(a.KeyAction.UP,18);a.SendKeyMsgKC(a.KeyAction.UP,91);a.SendKeyMsgKC(a.KeyAction.UP,92);a.SendKeyMsgKC(a.KeyAction.UP,16);a.send(String.fromCharCode(0,14,0,
4));break;case 11:c=0;q={};e=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255);if(0<e)for(c=((b.charCodeAt(6+2*e)&255)<<8)+(b.charCodeAt(7+2*e)&255),n=0;n<e;n++){var m=((b.charCodeAt(6+2*n)&255)<<8)+(b.charCodeAt(7+2*n)&255);q[m]=65535==m?"All Displays":"Display "+m}if(null!=a.onDisplayinfo)a.onDisplayinfo(a,q,c);break;case 14:a.touchenabled=1;a.TouchArray={};if(null!=a.onTouchEnabledChanged)a.onTouchEnabledChanged(a.touchenabled);break;case 15:a.TouchArray={};break;case 16:a.connectioncount=ReadInt(b,
4);if(null!=a.onConnectCountChanged)a.onConnectCountChanged(a.connectioncount,a);break;case 17:if(null!=a.onMessage)a.onMessage(b.substring(4,w),a);break;case 65:b=b.substring(4);if("."!=b[0]){if(console.log(b),null!=a.parent&&(a.parent.consoleMessage=b,a.parent.onConsoleMessageChange))a.parent.onConsoleMessageChange(a.parent,b)}else console.log("KVM: "+b.substring(1));break;case 88:if(5!=w)break;b=b.charCodeAt(4);b>v.length&&(b=0);g=v[b];d&&(a.CanvasId.style.cursor=g)}return w+D}}};a.MouseButton=
{NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};a.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};a.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};a.Alternate=0;var n={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};a.SendKeyMsg=function(b,c){if(null!=b)if(c||(c=window.event),c.code&&0==a.localKeyMap){var d;d=c;d=d.code.startsWith("Key")&&4==d.code.length?
d.code.charCodeAt(3):d.code.startsWith("Digit")&&6==d.code.length?d.code.charCodeAt(5):d.code.startsWith("Numpad")&&7==d.code.length?d.code.charCodeAt(6)+48:n[d.code];null!=d&&a.SendKeyMsgKC(b,d)}else d=c.keyCode,59==d?d=186:173==d?d=189:61==d&&(d=187),a.SendKeyMsgKC(b,d)};a.SendMessage=function(b){3==a.State&&a.send(String.fromCharCode(0,17)+a.shortToStr(4+b.length)+b)};a.SendKeyMsgKC=function(b,c){if(3==a.State)if("object"==typeof b)for(var d in b)a.SendKeyMsgKC(b[d][0],b[d][1]);else a.send(String.fromCharCode(0,
a.InputType.KEY,0,6,b-1,c))};a.sendcad=function(){a.SendCtrlAltDelMsg()};a.SendCtrlAltDelMsg=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.CTRLALTDEL,0,4))};a.SendEscKey=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.KEY,0,6,0,27,0,a.InputType.KEY,0,6,1,27))};a.SendStartMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendCharmsMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.DOWN,67);a.SendKeyMsgKC(a.KeyAction.UP,
67);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendTouchMsg1=function(b,c,d,e){3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(14)+String.fromCharCode(1,b)+a.intToStr(c)+a.shortToStr(d)+a.shortToStr(e))};a.SendTouchMsg2=function(b,c){var d="",e,g;for(g in a.TouchArray)g==b?e=c:1==a.TouchArray[g].f?(e=65542,a.TouchArray[g].f=3):e=2==a.TouchArray[g].f?262144:131078,d+=String.fromCharCode(g)+a.intToStr(e)+a.shortToStr(a.TouchArray[g].x)+a.shortToStr(a.TouchArray[g].y),2==a.TouchArray[g].f&&
delete a.TouchArray[g];3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(5+d.length)+String.fromCharCode(2)+d);0==Object.keys(a.TouchArray).length&&null!=a.touchtimer&&(clearInterval(a.touchtimer),a.touchtimer=null)};a.SendMouseMsg=function(b,c){if(3==a.State&&null!=b&&null!=a.Canvas){c||(c=window.event);var d=a.Canvas.canvas.height/a.CanvasId.clientHeight,e=a.Canvas.canvas.width/a.CanvasId.clientWidth,g=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-g[0])*e,d=(c.pageY-
g[1])*d;c.addx&&(e+=c.addx);c.addy&&(d+=c.addy);if(0<=e&&e<=a.Canvas.canvas.width&&0<=d&&d<=a.Canvas.canvas.height){var n=g=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?g=a.MouseButton.LEFT:2==c.which?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT:c.button&&(0==c.button?g=a.MouseButton.LEFT:1==c.button?g=a.MouseButton.MIDDLE:g=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?n=-120*c.detail:c.wheelDelta&&(n=3*c.wheelDelta));var v="",v=b==a.KeyAction.DBLCLICK?String.fromCharCode(0,
a.InputType.MOUSE,0,10,0,136,e/256&255,e&255,d/256&255,d&255):b==a.KeyAction.SCROLL?String.fromCharCode(0,a.InputType.MOUSE,0,12,0,0,e/256&255,e&255,d/256&255,d&255,n/256&255,n&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?g:2*g&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};a.GetDisplayNumbers=function(){a.send(String.fromCharCode(0,11,0,4))};a.SetDisplay=function(b){console.log("Set display",
b);a.send(String.fromCharCode(0,12,0,6,b>>8,b&255))};a.intToStr=function(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)};a.shortToStr=function(a){return String.fromCharCode(a>>8&255,a&255)};a.onResize=function(){if(0!=a.ScreenWidth&&0!=a.ScreenHeight&&(a.Canvas.canvas.width!=a.ScreenWidth||a.Canvas.canvas.height!=a.ScreenHeight)){if(a.FirstDraw&&(a.Canvas.canvas.width=a.ScreenWidth,a.Canvas.canvas.height=a.ScreenHeight,a.Canvas.fillRect(0,0,a.ScreenWidth,a.ScreenHeight),null!=a.onScreenSizeChange))a.onScreenSizeChange(a,
a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.FirstDraw=!1}};a.xxMouseInputGrab=!1;a.xxKeyInputGrab=!1;a.xxMouseMove=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.NONE,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseUp=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.UP,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseDown=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DOWN,b);b.preventDefault&&
b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseDblClick=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DBLCLICK,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxDOMMouseScroll=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxMouseWheel=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxKeyUp=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.UP,b);b.preventDefault&&
b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyDown=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.DOWN,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyPress=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};a.handleKeys=function(b){return 1==a.stopInput||3!=desktop.State?!1:a.xxKeyPress(b)};a.handleKeyUp=function(b){if(1==a.stopInput||3!=desktop.State)return!1;if(5>a.firstUpKeys.length&&
(a.firstUpKeys.push(b.keyCode),5==a.firstUpKeys.length)){var c=a.firstUpKeys.join(",");if("16,17,91,91,16"==c||"16,17,18,91,92"==c)a.stopInput=!0}16==b.keyCode&&(a.shiftPressed=!1);17==b.keyCode&&(a.ctrlPressed=!1);18==b.keyCode&&(a.altPressed=!1);return a.xxKeyUp(b)};a.handleKeyDown=function(b){if(1==a.stopInput||3!=desktop.State)return!1;16==b.keyCode&&(a.shiftPressed=!0);17==b.keyCode&&(a.ctrlPressed=!0);18==b.keyCode&&(a.altPressed=!0);return a.xxKeyDown(b)};a.handleReleaseKeys=function(){a.shiftPressed&&
a.SendKeyMsgKC(a.KeyAction.UP,16);a.ctrlPressed&&a.SendKeyMsgKC(a.KeyAction.UP,17);a.altPressed&&a.SendKeyMsgKC(a.KeyAction.UP,18);a.shiftPressed=a.ctrlPressed=a.altPressed=!1};a.mousedblclick=function(b){return 1==a.stopInput?!1:a.xxMouseDblClick(b)};a.mousedown=function(b){return 1==a.stopInput?!1:a.xxMouseDown(b)};a.mouseup=function(b){return 1==a.stopInput?!1:a.xxMouseUp(b)};a.mousemove=function(b){return 1==a.stopInput?!1:a.xxMouseMove(b)};a.mousewheel=function(b){return 1==a.stopInput?!1:a.xxMouseWheel(b)};
a.xxMsTouchEvent=function(b){if(4!=b.originalEvent.pointerType){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();if("MSPointerDown"==b.type||"MSPointerMove"==b.type||"MSPointerUp"==b.type){var c=0,d=b.originalEvent.pointerId%256,e=Canvas.canvas.width/a.CanvasId.clientWidth*b.offsetX,g=Canvas.canvas.height/a.CanvasId.clientHeight*b.offsetY;"MSPointerDown"==b.type?c=65542:"MSPointerMove"==b.type?c=131078:"MSPointerUp"==b.type&&(c=262144);a.TouchArray[d]||(a.TouchArray[d]=
{x:e,y:g});a.SendTouchMsg2(d,c);"MSPointerUp"==b.type&&delete a.TouchArray[d]}else alert(b.type);return!0}};a.xxTouchStart=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(KeyAction.DOWN,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var e=
b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[e]||(a.TouchArray[e]={x:Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),y:Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]),f:1})}0<Object.keys(a.TouchArray).length&&null==touchtimer&&(a.touchtimer=setInterval(function(){a.SendTouchMsg2(256,0)},50))}};a.xxTouchMove=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<
b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(a.KeyAction.NONE,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var e=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[e]&&(a.TouchArray[e].x=a.Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),a.TouchArray[e].y=a.Canvas.canvas.height/
a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]))}}};a.xxTouchEnd=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled)1<b.originalEvent.touches.length||(b.which=1,b.pageX=LastX,b.pageY=LastY,a.SendMouseMsg(KeyAction.UP,b));else for(var c in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[c].identifier){var d=b.originalEvent.changedTouches[c].identifier%256;a.TouchArray[d]&&(a.TouchArray[d].f=2)}};a.GrabMouseInput=function(){if(1!=
a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=a.xxMouseMove;b.onmouseup=a.xxMouseUp;b.onmousedown=a.xxMouseDown;b.touchstart=a.xxTouchStart;b.touchmove=a.xxTouchMove;b.touchend=a.xxTouchEnd;b.MSPointerDown=a.xxMsTouchEvent;b.MSPointerMove=a.xxMsTouchEvent;b.MSPointerUp=a.xxMsTouchEvent;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=a.xxDOMMouseScroll:b.onmousewheel=a.xxMouseWheel;a.xxMouseInputGrab=!0}};a.UnGrabMouseInput=function(){if(0!=a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=
null;b.onmouseup=null;b.onmousedown=null;b.touchstart=null;b.touchmove=null;b.touchend=null;b.MSPointerDown=null;b.MSPointerMove=null;b.MSPointerUp=null;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=null:b.onmousewheel=null;a.xxMouseInputGrab=!1}};a.GrabKeyInput=function(){1!=a.xxKeyInputGrab&&(document.onkeyup=a.xxKeyUp,document.onkeydown=a.xxKeyDown,document.onkeypress=a.xxKeyPress,a.xxKeyInputGrab=!0)};a.UnGrabKeyInput=function(){0!=a.xxKeyInputGrab&&(document.onkeyup=null,document.onkeydown=
null,document.onkeypress=null,a.xxKeyInputGrab=!1)};a.GetPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};a.crotX=function(b,c){if(0==a.rotation)return b;if(1==a.rotation)return c;if(2==a.rotation)return a.Canvas.canvas.width-b;if(3==a.rotation)return a.Canvas.canvas.height-c};a.crotY=function(b,c){if(0==a.rotation)return c;if(1==a.rotation)return a.Canvas.canvas.width-b;if(2==a.rotation)return a.Canvas.canvas.height-c;
if(3==a.rotation)return b};a.rotX=function(b,c){if(0==a.rotation||1==a.rotation)return b;if(2==a.rotation)return b-a.Canvas.canvas.width;if(3==a.rotation)return b-a.Canvas.canvas.height};a.rotY=function(b,c){if(0==a.rotation||3==a.rotation)return c;if(1==a.rotation)return c-a.Canvas.canvas.width;if(2==a.rotation)return c-a.Canvas.canvas.height};a.tcanvas=null;a.setRotation=function(b){for(;0>b;)b+=4;b%=4;if(b==a.rotation)return!0;var c=a.Canvas.canvas.width,d=a.Canvas.canvas.height;if(1==a.rotation||
3==a.rotation)c=a.Canvas.canvas.height,d=a.Canvas.canvas.width;null==a.tcanvas&&(a.tcanvas=document.createElement("canvas"));var e=a.tcanvas.getContext("2d");e.setTransform(1,0,0,1,0,0);e.canvas.width=c;e.canvas.height=d;e.rotate(-90*a.rotation*Math.PI/180);0==a.rotation&&e.drawImage(a.Canvas.canvas,0,0);1==a.rotation&&e.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,0);2==a.rotation&&e.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,-a.Canvas.canvas.height);3==a.rotation&&e.drawImage(a.Canvas.canvas,
0,-a.Canvas.canvas.height);if(0==a.rotation||2==a.rotation)a.Canvas.canvas.height=c,a.Canvas.canvas.width=d;if(1==a.rotation||3==a.rotation)a.Canvas.canvas.height=d,a.Canvas.canvas.width=c;a.Canvas.setTransform(1,0,0,1,0,0);a.Canvas.rotate(90*b*Math.PI/180);a.rotation=b;a.Canvas.drawImage(a.tcanvas,a.rotX(0,0),a.rotY(0,0));a.ScreenWidth=a.Canvas.canvas.width;a.ScreenHeight=a.Canvas.canvas.height;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);return!0};
a.MuchTheSame=function(a,b){return 4>Math.abs(a-b)};a.Debug=function(a){console.log(a)};a.getIEVersion=function(){var a=-1;"Microsoft Internet Explorer"==navigator.appName&&null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(a=parseFloat(RegExp.$1));return a};a.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};return a},CreateKvmDataChannel=function(b,c,a){var d={};d.m=c;c.parent=d;d.webchannel=b;d.State=0;d.protocol=c.protocol;
d.onStateChanged=null;d.onControlMsg=null;d.debugmode=0;d.keepalive=a;d.rtcKeepAlive=null;d.Start=function(){1==d.debugmode&&console.log("start");d.xxStateChange(3);d.webchannel.onmessage=d.xxOnMessage;d.rtcKeepAlive=setInterval(d.xxSendRtcKeepAlive,3E4)};var g=new FileReader,v=!1,n=[];g.readAsBinaryString?g.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?v=!1:g.readAsBinaryString(new Blob([n.shift()]))}:g.readAsArrayBuffer&&(g.onloadend=function(a){d.xxOnSocketData(a.target.result);
0==n.length?v=!1:g.readAsArrayBuffer(n.shift())});d.xxOnMessage=function(a){if("string"==typeof a.data){if(null!=d.onControlMsg)d.onControlMsg(a.data)}else if("object"==typeof a.data)if(1==v)n.push(a.data);else if(g.readAsBinaryString)v=!0,g.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)v=!0,g.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,e=0;e<c;e++)b+=String.fromCharCode(a[e]);d.xxOnSocketData(b)}else d.xxOnSocketData(a.data)};d.xxOnSocketData=
function(a){if(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,e=0;e<c;e++)b+=String.fromCharCode(a[e]);a=b}else if("string"!==typeof a)return;return d.m.ProcessData(a)}};d.sendCtrlMsg=function(a){"string"==typeof a&&(d.webchannel.send(a),urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a),null!=d.keepalive&&d.keepalive.sendKeepAlive())};d.send=function(a){if("string"==typeof a){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=
a.charCodeAt(c);a=b}urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a);d.webchannel.send(a)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(){1==d.debugmode&&console.log("stop");null!=d.rtcKeepAlive&&(clearInterval(d.rtcKeepAlive),d.rtcKeepAlive=null);d.xxStateChange(0)};d.xxSendRtcKeepAlive=function(){urlvars&&urlvars.webrtctrace&&console.log("WebRTC-SendKeepAlive()");
d.sendCtrlMsg(JSON.stringify({action:"ping"}))};return d},CreateAmtRemoteTerminal=function(b,c){function a(b){if("\x00"!=b&&7!=b.charCodeAt()){var c=b.charCodeAt();1==l.terminalEmulation?0!=(c&128)&&(b=String.fromCharCode(u[c&127])):2==l.terminalEmulation&&0!=(c&128)&&(b=String.fromCharCode(T[c&127]));switch(c){case 16:b=" ";break;case 24:b="\u2191";break;case 25:b="\u2193"}D>l.width&&(D=l.width);m>l.height-1&&(m=l.height-1);switch(b){case "\b":0<D&&(D--,R&&d(" "));break;case "\t":b=8-D%8;for(c=0;c<
b;c++)a(" ");break;case "\n":m++;m>E[1]&&(l.recordLineTobackBuffer(0),n(1),m=E[1]);l.lineFeed="\r";D=0;break;case "\r":D=0;break;default:D>=l.width&&(D=0,w&&m++,m>=l.height-1&&(n(1),m=l.height-1)),d(b),D++}}}function d(a){y[m][D]=a;A[m][D]=(e<<6)+(C<<12)+q}function g(){for(var a=(e<<6)+(C<<12)+q,b=D;b<l.width;b++)y[m][b]=" ",A[m][b]=a}function v(a){for(var b=(e<<6)+(C<<12)+q,c=0;c<l.width;c++)y[a][c]=" ",A[a][c]=b}function n(a){var b;for(b=E[0];b<=E[1]-a;b++)y[b]=y[b+a],A[b]=A[b+a];for(b=E[1]-a+1;b<=
E[1];b++)for(y[b]=[],A[b]=[],a=0;a<l.width;a++)y[b][a]=" ",A[b][a]=448}var l={};l.DivId=b;l.DivElement=document.getElementById(b);l.protocol=1;c&&c.protocol&&(l.protocol=c.protocol);l.terminalEmulation=1;l.fxEmulation=0;l.lineFeed="\r\n";l.debugmode=0;l.width=80;l.height=25;l.heightLock=0;var p="000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF".split(" "),q=0,e=7,C=0,w=!0,D=0,m=0,k=0,h=0,r=0,K=[],B=0,x=0,A=[],y=[],R=!1,z=!0,E,O=!1,H=[],
N="";l.title=null;l.onTitleChange=null;l.Start=function(){};l.Init=function(a,b){l.width=a?a:80;l.height=b?b:25;for(var c=0;c<l.height;c++){y[c]=[];A[c]=[];for(var d=0;d<l.width;d++)y[c][d]=" ",A[c][d]=448}l.TermInit();l.TermDraw()};l.xxStateChange=function(a){3==a&&null!=c&&1==c.xterm&&l.TermSendKeys("stty rows "+l.height+" cols "+l.width+"\nclear\n")};l.ProcessData=function(b){2==l.debugmode&&console.log("TRecv("+b.length+"): "+rstr2hex(b));null!=l.capture&&(l.capture+=b);if(0==l.terminalEmulation)try{b=
decode_utf8(N+b)}catch(c){N+=b;return}N="";for(var d=0;d<b.length;d++){var p=String.fromCharCode(b.charCodeAt(d)),n=b.charCodeAt(d);switch(r){case 0:switch(n){case 27:r=1;K=[];x=B=0;break;default:a(p)}break;case 1:switch(p){case "[":r=2;break;case "(":r=4;break;case ")":r=5;break;case "]":r=6;break;case "=":O=!0;r=0;break;case ">":O=!1;r=0;break;case "7":k=D;h=m;r=0;break;case "8":D=k;m=h;r=0;break;case "M":for(n=E[1];n>=E[0]+1;n--)for(var u=0;u<l.width;u++)y[n][u]=y[n-1][u],A[n][u]=A[n-1][u];for(n=
E[0]+1-1;n>E[0]-1;n--)for(u=0;u<l.width;u++)y[n][u]=" ",A[n][u]=448;r=0;break;default:console.log("unknown terminal short code",p),r=0}break;case 2:if("0"<=p&&"9">=p){K[B]=K[B]?10*K[B]+(p-0):p-0;break}else if(";"==p){B++;break}else if("?"==p){x=1;break}else{K[0]||(K[0]=0);var n=K,u=B+1,R=x;if(1==R)switch(p){case "l":25==n[0]&&(z=!1);break;case "h":25==n[0]&&(z=!0)}else if(0==R){var J=void 0;switch(p){case "c":l.TermResetScreen();break;case "A":1==u&&(0==n[0]?m--:m-=n[0],0>m&&(m=0));break;case "B":1==
u&&(0==n[0]?m++:m+=n[0],m>l.height&&(m=l.height));break;case "C":1==u&&(0==n[0]?D++:D+=n[0],D>l.width&&(D=l.width));break;case "D":1==u&&(0==n[0]?D--:D-=n[0],0>D&&(D=0));break;case "d":1==u&&(m=n[0]-1,m>l.height&&(m=l.height),0>m&&(m=0));break;case "G":1==u&&(D=n[0]-1,0>D&&(D=0),D>l.width-1&&(D=l.width-1));break;case "P":p=1;1==u&&(p=n[0]);for(J=D;J<l.width-p;J++)y[m][J]=y[m][J+p],A[m][J]=A[m][J+p];for(J=l.width-p;J<l.width;J++)y[m][J]=" ",A[m][J]=448;break;case "L":J=1;1==u&&(J=n[0]);0==J&&(J=1);
for(n=E[1];n>=m+J;n--)y[n]=y[n-J],A[n]=A[n-J];for(n=m;n<m+J;n++)for(y[n]=[],A[n]=[],p=0;p<l.width;p++)y[n][p]=" ",A[n][p]=448;break;case "J":if(1==u&&2==n[0])l.TermClear((C<<12)+(e<<6)),m=D=0,H=[];else if(0==u||1==u&&0==n[0])for(g(),J=m+1;J<l.height;J++)v(J);else if(1==u&&1==n[0])for(g(),J=0;J<m-1;J++)v(J);break;case "H":2==u?(1>n[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>l.height&&(n[0]=l.height),n[1]>l.width&&(n[1]=l.width),m=n[0]-1,D=n[1]-1):D=m=0;break;case "m":for(J=0;J<u;J++)n[J]&&0!=n[J]?1==n[J]?
8>e&&(e+=8):2==n[J]||22==n[J]?8<=e&&(e-=8):7==n[J]?q=2:27==n[J]?q=0:30<=n[J]&&37>=n[J]?(p=8<=e,e=n[J]-30,p&&8>=e&&(e+=8)):40<=n[J]&&47>=n[J]?C=n[J]-40:90<=n[J]&&99>=n[J]?e=n[J]-82:100<=n[J]&&109>=n[J]&&(C=n[J]-92):(C=0,e=7,q=0);break;case "K":if(0!=u&&(1!=u||n[0]&&0!=n[0])){if(1==u)if(1==n[0])for(n=(e<<6)+(C<<12)+q,u=0;u<D;u++)y[m][u]=" ",A[m][u]=n;else 2==n[0]&&v(m)}else g();break;case "h":w=!0;break;case "l":w=!1;break;case "r":2==u&&(E=[n[0]-1,n[1]-1]);0>E[0]&&(E[0]=0);E[0]>l.height-1&&(E[0]=l.height-
1);0>E[1]&&(E[1]=0);E[1]>l.height-1&&(E[1]=l.height-1);E[0]>E[1]&&(E[0]=E[1]);break;case "S":p=1;1==u&&(p=n[0]);for(n=E[0];n<=E[1]-p;n++)for(u=0;u<l.width;u++)y[n][u]=y[n+p][u],A[n][u]=A[n+p][u];for(n=E[1]-p+1;n<E[1];n++)for(u=0;u<l.width;u++)y[n][u]=" ",A[n][u]=448;break;case "M":p=1;1==u&&(p=n[0]);for(n=m;n<=E[1]-p;n++)for(u=0;u<l.width;u++)y[n][u]=y[n+p][u],A[n][u]=A[n+p][u];for(n=E[1]-p+1;n<E[1];n++)for(u=0;u<l.width;u++)y[n][u]=" ",A[n][u]=448;break;case "T":p=1;1==u&&(p=n[0]);for(n=E[1];n>E[0]+
p;n--)for(u=0;u<l.width;u++)y[n][u]=y[n-p][u],A[n][u]=A[n-p][u];for(n=E[0]+p;n>E[0];n--)for(u=0;u<l.width;u++)y[n][u]=" ",A[n][u]=448;break;case "X":p=1;J=D;R=m;for(1==u&&(p=n[0]);0<p&&R<l.height;)y[R][J]=" ",J++,p--,J>=l.width&&(J=0,R++);break;default:console.log("unknown terminal code",p,n,R)}}r=0}break;case 4:r=0;break;case 5:r=0;break;case 6:if(n=p.charCodeAt(0),";"==p)B++;else if(7==n){n=K;if(0!=n.length&&(u=parseInt(n[0]),(0==u||2==u)&&1<n.length&&"?"!=n[1]&&l.onTitleChange))l.onTitleChange(l,
l.title=n[1]);r=0}else K[B]=K[B]?K[B]+p:p}}l.TermDraw()};l.ProcessVt100String=function(b){for(var c=0;c<b.length;c++)a(String.fromCharCode(b.charCodeAt(c)))};var u=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,171,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,
9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160],T=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,174,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,
9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160];l.TermClear=function(a){for(var b=0;b<l.height;b++)for(var c=0;c<l.width;c++)y[b][c]=" ",A[b][c]=a;H=[]};l.TermResetScreen=function(){q=0;e=7;C=0;w=z=!0;D=m=0;R=!1;E=[0,l.height-1];O=!1;l.TermClear(448);
N=""};l.TermSendKeys=function(a){2==l.debugmode&&console.log("TSend("+a.length+"): "+rstr2hex(a),a);l.parent&&l.parent.Send(a)};l.TermSendKey=function(a){2==l.debugmode&&console.log("TSend(1): "+rstr2hex(String.fromCharCode(a)),a);l.parent&&l.parent.Send(String.fromCharCode(a))};l.TermHandleKeys=function(a){if(!a.ctrlKey)return 127==a.which?l.TermSendKey(8):13==a.which?l.TermSendKeys(l.lineFeed):0!=a.which&&l.TermSendKey(a.which),!1;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation()};
l.TermHandleKeyUp=function(a){if(8!=a.which&&32!=a.which&&9!=a.which)return!0;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};l.TermHandleKeyDown=function(a){if(65<=a.which&&90>=a.which&&1==a.ctrlKey)l.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return l.TermSendKeys(String.fromCharCode(27)),!0;if(1==O){if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,
79,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return l.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return l.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return l.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return l.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return l.TermSendKeys(String.fromCharCode(27,
91,53,126)),!0;if(34==a.which)return l.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return l.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return l.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return l.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return l.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return l.TermSendKeys("\t"),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!0;
var b=[80,81,119,120,116,117,113,114,112,77],c=[49,50,51,52,53,54,55,56,57,48,33,64],d=[80,81,82,83,84,85,86,87,88,89,90,91];if(111<a.which&124>a.which&&0==a.repeat){if(0==l.fxEmulation&&122>a.which)return l.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==l.fxEmulation)return l.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;l.TermSendKey(a.which);
a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};l.recordLineTobackBuffer=function(a){var b;b=l.TermDrawLine("",a,"");a=b[0];b=b[1];H.push(a+b+"<br>")};l.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h<l.width;++h)switch(d=A[b][h],D==h&&m==b&&z&&(d|=2),d!=e&&(a+=c,c="",e=6,g=12,d&2&&(e=12,g=6),a+='<span style="color:#'+p[d>>e&63]+";background-color:#"+p[d>>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c="</span>"+c,e=d),d=y[b][h],d){case "&":a+="&amp;";
break;case "<":a+="&lt;";break;case ">":a+="&gt;";break;case " ":a+="&nbsp;";break;default:a+=d}return[a,c]};l.TermDraw=function(){for(var a="",b="",c=0;c<l.height;++c)a=l.TermDrawLine(b,c,a),b=a[0],a=a[1],c!=l.height-1&&(b+="<br>");800<H.length&&(H=H.slice(H.length-800));c=H.join("");l.DivElement.innerHTML='<font size="4"><b>'+c+b+a+"</b></font>";l.DivElement.scrollTop=l.DivElement.scrollHeight};l.TermInit=function(){l.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?l.Init(c.width,c.height):
l.Init();return l},ZLIB=ZLIB||{};
"undefined"===typeof ZLIB.common_initialized&&(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.total_out=this.avail_out=this.next_out=this.total_in=this.avail_in=this.next_in=0;this.state=this.msg=null;
this.adler=this.data_type=0;this.output_data=this.input_data="";this.error=0;this.checksum_function=null},ZLIB.gz_header=function(){this.xflags=this.time=this.text=0;this.os=255;this.extra=null;this.extra_max=this.extra_len=0;this.name=null;this.name_max=0;this.comment=null;this.done=this.hcrc=this.comm_max=0},ZLIB.common_initialized=!0);"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js");
(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,l=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,q,v,w,x,A,B,D,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(q=0;q<n;q++)M[g[l+q]]++;w=d;for(v=15;1<=v&&0==M[v];v--);w>v&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d<v&&0==M[d];d++);w<d&&(w=d);for(p=A=1;15>=p;p++)if(A<<=1,A-=M[p],0>A)return-1;if(0<A&&(0==
b||1!=v))return a.next=c,-1;x[1]=0;for(p=1;15>p;p++)x[p+1]=x[p]+M[p];for(q=0;q<n;q++)0!=g[l+q]&&(e[x[g[l+q]]++]=q);switch(b){case 0:Z=fa=e;ga=ca=0;U=19;break;case 1:Z=k;ca=-257;fa=h;ga=-257;U=256;break;default:Z=r,fa=K,ga=ca=0,U=-1}q=D=0;p=d;S=c;n=w;x=0;W=-1;B=1<<w;I=B-1;if(1==b&&852<=B||2==b&&592<=B)return a.next=c,1;for(;;){G={op:0,bits:p-x,val:0};e[q]<U?G.val=e[q]:e[q]>U?(G.op=fa[ga+e[q]],G.val=Z[ca+e[q]]):G.op=96;A=1<<p-x;d=C=1<<n;do C-=A,m[S+(D>>>x)+C]=G;while(0!=C);for(A=1<<p-1;D&A;)A>>>=1;
0!=A?(D&=A-1,D+=A):D=0;q++;if(0==--M[p]){if(p==v)break;p=g[l+e[q]]}if(p>w&&(D&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(A=1<<n;n+x<v;){A-=M[n+x];if(0>=A)break;n++;A<<=1}B+=1<<n;if(1==b&&852<=B||2==b&&592<=B)return a.next=c,1;W=D&I;m[c+W]={op:n,bits:w,val:S-c}}}0!=D&&(m[S+D]={op:64,bits:p-x,val:0});a.next=c+B;2==b?a.distbits=w:a.lenbits=w;return 0}function c(a){var b,c=Array(a);for(b=0;b<a;b++)c[b]=0;return c}function a(a,b,c){return a&&b in a?a[b]:c}function d(){return 0}function g(){var a;this.total=this.check=
this.dmax=this.flags=this.havedict=this.wrap=this.last=this.mode=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.next=this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=this.distcode=this.lencode=this.extra=this.offset=this.length=this.bits=this.hold=0;this.lens=c(320);this.work=c(288);this.codes=Array(1444);var b={op:0,bits:0,val:0};for(a=0;1444>a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check,
[b&255,b>>>8&255],0,2)}function n(a,b){b.strm=a;b.left=a.avail_out;b.next=a.next_in;b.have=a.avail_in;b.hold=a.state.hold;b.bits=a.state.bits;return b}function l(a){var b=a.strm;b.next_in=a.next;b.avail_out=a.left;b.avail_in=a.have;b.state.hold=a.hold;b.state.bits=a.bits}function p(a){a.hold=0;a.bits=0}function q(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<<a.bits;a.bits+=8;return!0}function e(a,b){for(;a.bits<b;)if(!q(a))return!1;return!0}function C(a,b){return a.hold&
(1<<b)-1}function w(a,b){a.hold>>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[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],h=[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],r=[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],K=[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 ";ZLIB.inflateResetKeep=function(a){var b;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;b=a.state;a.total_in=a.total_out=b.total=0;a.msg=null;b.wrap&&(a.adler=b.wrap&1);b.mode=0;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=0;b.distcode=0;b.next=0;b.sane=1;b.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(a,b){var c,
2022-03-23 21:00:41 +03:00
e;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;e=a.state;"undefined"===typeof b&&(b=15);0>b?(c=0,b=-b):(c=(b>>>4)+1,48>b&&(b&=15));a.checksum_function=1==c&&"function"===typeof ZLIB.adler32?ZLIB.adler32:2==c&&"function"===typeof ZLIB.crc32?ZLIB.crc32:d;if(b&&(8>b||15<b))return ZLIB.Z_STREAM_ERROR;e.window&&e.wbits!=b&&(e.window=null);e.wrap=c;e.wbits=b;e.wsize=0;e.whave=0;e.wnext=0;return ZLIB.inflateResetKeep(a)};ZLIB.inflateInit=function(a){var b=new ZLIB.z_stream;b.state=new g;ZLIB.inflateReset(b,
a);return b};ZLIB.inflatePrime=function(a,b,c){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a=a.state;if(0>b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16<b||32<a.bits+b)return ZLIB.Z_STREAM_ERROR;a.hold+=(c&(1<<b)-1)<<a.bits;a.bits+=b;return ZLIB.Z_OK};var B=null,x=null,A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(a,c){var d,g,h,k,r,u=-1,K=-1,P;if(!a||!a.state||!a.input_data&&0!=a.avail_in)return ZLIB.Z_STREAM_ERROR;d=a.state;11==d.mode&&(d.mode=12);g={};n(a,g);h=g.have;k=g.left;
P=ZLIB.Z_OK;a:for(;;)switch(d.mode){case 0:if(0==d.wrap){d.mode=12;break}if(!e(g,16))break a;if(d.wrap&2&&35615==g.hold){d.check=a.checksum_function(0,null,0,0);v(a,g.hold);p(g);d.mode=1;break}d.flags=0;null!==d.head&&(d.head.done=-1);if(!(d.wrap&1)||((C(g,8)<<8)+(g.hold>>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(C(g,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}w(g,4);u=C(g,4)+8;if(0==d.wbits)d.wbits=u;else if(u>d.wbits){a.msg="invalid window size";d.mode=
29;break}d.dmax=1<<u;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=g.hold&512?9:11;p(g);break;case 1:if(!e(g,16))break a;d.flags=g.hold;if((d.flags&255)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}if(d.flags&57344){a.msg="unknown header flags set";d.mode=29;break}null!==d.head&&(d.head.text=g.hold>>>8&1);d.flags&512&&v(a,g.hold);p(g);d.mode=2;case 2:if(!e(g,32))break a;null!==d.head&&(d.head.time=g.hold);d.flags&512&&(r=g.hold,a.state.check=a.checksum_function(a.state.check,
[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));p(g);d.mode=3;case 3:if(!e(g,16))break a;null!==d.head&&(d.head.xflags=g.hold&255,d.head.os=g.hold>>>8);d.flags&512&&v(a,g.hold);p(g);d.mode=4;case 4:if(d.flags&1024){if(!e(g,16))break a;d.length=g.hold;null!==d.head&&(d.head.extra_len=g.hold);d.flags&512&&v(a,g.hold);p(g);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>g.have&&(r=g.have),r&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len-
d.length,d.head.extra+=a.input_data.substring(g.next,g.next+(u+r>d.head.extra_max?d.head.extra_max-u:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r)),g.have-=r,g.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==g.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");r=0;do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length<d.head.name_max&&(d.head.name+=u,d.length++)}while(r<g.have);d.flags&
512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r));g.have-=r;g.next+=r;if("\x00"!==u)break a}else null!==d.head&&(d.head.name=null);d.length=0;d.mode=7;case 7:if(d.flags&4096){if(0==g.have)break a;r=0;null!==d.head&&null===d.head.comment&&(d.head.comment="");do{u=a.input_data.charAt(g.next+r);r++;if("\x00"===u)break;null!==d.head&&d.length<d.head.comm_max&&(d.head.comment+=u,d.length++)}while(r<g.have);d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,g.next,r));g.have-=
r;g.next+=r;if("\x00"!==u)break a}else null!==d.head&&(d.head.comment=null);d.mode=8;case 8:if(d.flags&512){if(!e(g,16))break a;if(g.hold!=(d.check&65535)){a.msg="header crc mismatch";d.mode=29;break}p(g)}null!==d.head&&(d.head.hcrc=d.flags>>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!e(g,32))break a;a.adler=d.check=m(g.hold);p(g);d.mode=10;case 10:if(0==d.havedict)return l(g),ZLIB.Z_NEED_DICT;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=
11;case 11:if(c==ZLIB.Z_BLOCK||c==ZLIB.Z_TREES)break a;case 12:if(d.last){D(g);d.mode=26;break}if(!e(g,3))break a;d.last=C(g,1);w(g,1);switch(C(g,2)){case 0:d.mode=13;break;case 1:r=d;u=void 0;B||(B=[{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}]);x||(x=[{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}]);r.lencode=0;r.distcode=512;for(u=0;512>u;u++)r.codes[u]=B[u];for(u=0;32>u;u++)r.codes[u+512]=x[u];r.lenbits=9;r.distbits=5;
d.mode=19;if(c==ZLIB.Z_TREES){w(g,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}w(g,2);break;case 13:D(g);if(!e(g,32))break a;if((g.hold&65535)!=(g.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=g.hold&65535;p(g);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>g.have&&(r=g.have);r>g.left&&(r=g.left);if(0==r)break a;a.output_data+=a.input_data.substring(g.next,g.next+r);a.next_out+=r;g.have-=
r;g.next+=r;g.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!e(g,14))break a;d.nlen=C(g,5)+257;w(g,5);d.ndist=C(g,5)+1;w(g,5);d.ncode=C(g,4)+4;w(g,4);if(286<d.nlen||30<d.ndist){a.msg="too many length or distance symbols";d.mode=29;break}d.have=0;d.mode=17;case 17:for(;d.have<d.ncode;){if(!e(g,3))break a;r=C(g,3);d.lens[A[d.have++]]=r;w(g,3)}for(;19>d.have;)d.lens[A[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(P=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18;
case 18:for(;d.have<d.nlen+d.ndist;){for(;;){r=d.codes[d.lencode+C(g,d.lenbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(16>r.val)w(g,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!e(g,r.bits+2))break a;w(g,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];r=3+C(g,2);w(g,2)}else if(17==r.val){if(!e(g,r.bits+3))break a;w(g,r.bits);u=0;r=3+C(g,3);w(g,3)}else{if(!e(g,r.bits+7))break a;w(g,r.bits);u=0;r=11+C(g,7);w(g,7)}if(d.have+r>d.nlen+d.ndist){a.msg=
"invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=u}}if(29==d.mode)break;if(0==d.lens[256]){a.msg="invalid code -- missing end-of-block";d.mode=29;break}d.next=0;d.lencode=d.next;d.lenbits=9;if(P=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(P=b(d,2)){a.msg="invalid distances set";d.mode=29;break}d.mode=19;if(c==ZLIB.Z_TREES)break a;case 19:d.mode=20;case 20:if(6<=g.have&&258<=g.left){l(g);r=a;var F=K=u=void 0,Y=void 0,L=void 0,
ea=void 0,V=void 0,J=void 0,aa=void 0,ba=void 0,W=void 0,I=void 0,G=void 0,S=void 0,Z=void 0,ca=void 0,fa=void 0,ga=void 0,U=void 0,M=void 0,X=void 0,ha=void 0,da=-1,U=-1,u=r.state,K=r.input_data,F=r.next_in,Y=F+r.avail_in-5,L=r.next_out,ea=L-(k-r.avail_out),V=L+(r.avail_out-257),J=u.wsize,aa=u.whave,ba=u.wnext,W=u.window,I=u.hold,G=u.bits,S=u.codes,Z=u.lencode,ca=u.distcode,fa=(1<<u.lenbits)-1,ga=(1<<u.distbits)-1;b:do c:for(15>G&&(I+=(K.charCodeAt(F++)&255)<<G,G+=8,I+=(K.charCodeAt(F++)&255)<<G,
G+=8),U=S[Z+(I&fa)];;){M=U.bits;I>>>=M;G-=M;M=U.op;if(0==M)r.output_data+=String.fromCharCode(U.val),L++;else if(M&16){X=U.val;if(M&=15)G<M&&(I+=(K.charCodeAt(F++)&255)<<G,G+=8),X+=I&(1<<M)-1,I>>>=M,G-=M;15>G&&(I+=(K.charCodeAt(F++)&255)<<G,G+=8,I+=(K.charCodeAt(F++)&255)<<G,G+=8);U=S[ca+(I&ga)];d:for(;;){M=U.bits;I>>>=M;G-=M;M=U.op;if(M&16){ha=U.val;M&=15;G<M&&(I+=(K.charCodeAt(F++)&255)<<G,G+=8,G<M&&(I+=(K.charCodeAt(F++)&255)<<G,G+=8));ha+=I&(1<<M)-1;I>>>=M;G-=M;M=L-ea;if(ha>M){M=ha-M;if(M>aa&&
u.sane){r.msg="invalid distance too far back";u.mode=29;break b}da=0;U=-1;da=0==ba?da+(J-M):da+(ba-M);M<X&&(X-=M,r.output_data+=W.substring(da,da+M),L+=M,da=-1,U=L-ha)}else da=-1,U=L-ha;if(0<=da)r.output_data+=W.substring(da,da+X),L+=X;else{M=X;M>L-U&&(M=L-U);r.output_data+=r.output_data.substring(U,U+M);L+=M;X-=M;U+=M;for(L+=X;2<X;)r.output_data+=r.output_data.charAt(U++),r.output_data+=r.output_data.charAt(U++),r.output_data+=r.output_data.charAt(U++),X-=3;X&&(r.output_data+=r.output_data.charAt(U++),
1<X&&(r.output_data+=r.output_data.charAt(U++)))}}else if(0==(M&64)){U=S[ca+(U.val+(I&(1<<M)-1))];continue d}else{r.msg="invalid distance code";u.mode=29;break b}break d}}else if(0==(M&64)){U=S[Z+(U.val+(I&(1<<M)-1))];continue c}else{M&32?u.mode=11:(r.msg="invalid literal/length code",u.mode=29);break b}break c}while(F<Y&&L<V);X=G>>>3;F-=X;G-=X<<3;I&=(1<<G)-1;r.next_in=F;r.next_out=L;r.avail_in=F<Y?5+(Y-F):5-(F-Y);r.avail_out=L<V?257+(V-L):257-(L-V);u.hold=I;u.bits=G;n(a,g);11==d.mode&&(d.back=-1);
break}for(d.back=0;;){r=d.codes[d.lencode+C(g,d.lenbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(r.op&&0==(r.op&240)){for(u=r;;){r=d.codes[d.lencode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!e(g,d.extra))break a;
d.length+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+C(g,d.distbits)];if(r.bits<=g.bits)break;if(!q(g))break a}if(0==(r.op&240)){for(u=r;;){r=d.codes[d.distcode+u.val+(C(g,u.bits+u.op)>>>u.bits)];if(u.bits+r.bits<=g.bits)break;if(!q(g))break a}w(g,u.bits);d.back+=u.bits}w(g,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!e(g,d.extra))break a;
d.offset+=C(g,d.extra);w(g,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==g.left)break a;r=k-g.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}r>d.wnext?(r-=d.wnext,u=d.wsize-r):u=d.wnext-r;K=-1;r>d.length&&(r=d.length)}else u=-1,K=a.next_out-d.offset,r=d.length;r>g.left&&(r=g.left);g.left-=r;d.length-=r;if(0<=u)a.output_data+=d.window.substring(u,u+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(K++);while(--r)}0==
d.length&&(d.mode=20);break;case 25:if(0==g.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;g.left--;d.mode=20;break;case 26:if(d.wrap){if(!e(g,32))break a;k-=g.left;a.total_out+=k;d.total+=k;k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-k,k));k=g.left;if((d.flags?g.hold:m(g.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}p(g)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!e(g,32))break a;if(g.hold!=(d.total&4294967295)){a.msg="incorrect length check";
d.mode=29;break}p(g)}d.mode=28;case 28:P=ZLIB.Z_STREAM_END;break a;case 29:P=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}l(g);if(d.wsize||k!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))g=a.state,r=a.output_data.length,null===g.window&&(g.window=""),0==g.wsize&&(g.wsize=1<<g.wbits),g.window=r>=g.wsize?a.output_data.substring(r-g.wsize):g.whave+r<g.wsize?g.window+a.output_data:g.window.substring(g.whave-(g.wsize-r))+a.output_data,g.whave=g.window.length,
g.wnext=g.whave<g.wsize?g.whave:0;h-=a.avail_in;k-=a.avail_out;a.total_in+=h;a.total_out+=k;d.total+=k;d.wrap&&k&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,0,a.output_data.length));a.data_type=d.bits+(d.last?64:0)+(11==d.mode?128:0)+(19==d.mode||14==d.mode?256:0);(0==h&&0==k||c==ZLIB.Z_FINISH)&&P==ZLIB.Z_OK&&(P=ZLIB.Z_BUF_ERROR);return P};ZLIB.inflateEnd=function(a){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a.state.window=null;a.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=
function(b,c){var d,e;this.input_data=b;this.next_in=a(c,"next_in",0);this.avail_in=a(c,"avail_in",b.length-this.next_in);d=a(c,"flush",ZLIB.Z_SYNC_FLUSH);e=a(c,"avail_out",-1);var g="";do{this.avail_out=0<=e?e:16384;this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,d);if(0<=e)return this.output_data;g+=this.output_data;if(0<this.avail_out)break}while(this.error==ZLIB.Z_OK);return g};ZLIB.z_stream.prototype.inflateReset=function(a){return ZLIB.inflateReset(this,a)}})();
"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js");
(function(){function b(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&
255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&
255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;v--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,v){var n,l;n=a>>>16&65535;a&=65535;if(1==v)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),
a|n<<16;if(null===b)return 1;if(16>v){for(;v--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=v;){v-=5552;l=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--l);a%=65521;n%=65521}if(v){for(;16<=v;)v-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=
a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;v--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,g,v){return"string"===typeof d?b(a,d,g,v):c(a,d,g,v)};ZLIB.adler32_combine=function(a,b,c){var v,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;v=n*c%65521;c+=(b&65535)+65521-1;v+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-=
65521);131042<=v&&(v-=131042);65521<=v&&(v-=65521);return c|v<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js");
(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var v;for(v=0;32>v;v++)a[v]=b(c,c[v])}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,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];ZLIB.crc32=function(b,c,v,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=
a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,b=a[(b^c.charCodeAt(v++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(v++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&
255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,b=a[(b^c[v++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[v++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,g,v){var n,l,p,q;if(0>=v)return a;p=Array(32);q=Array(32);q[0]=3988292384;for(n=l=1;32>n;n++)q[n]=l,l<<=1;c(p,q);c(q,p);do{c(p,q);v&1&&(a=b(p,a));v>>=1;if(0==v)break;c(q,p);v&1&&(a=b(q,a));v>>=1}while(0!=v);return a^g}})();
var saveAs=saveAs||function(b){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var c=b.document.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in c,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),g=b.webkitRequestFileSystem,v=b.requestFileSystem||g||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},l=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()};
b.chrome?c():setTimeout(c,500)},q=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(g){n(g)}}},e=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},C=function(n,m,k){k||(n=e(n));var h=this;k=n.type;var r=!1,w,B,x=function(){q(h,["writestart","progress","write","writeend"])},A=function(){if(B&&d&&"undefined"!==typeof FileReader){var a=
new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;x()};a.readAsDataURL(n);h.readyState=h.INIT}else{if(r||!w)w=(b.URL||b.webkitURL||b).createObjectURL(n);B?B.location.href=w:void 0==b.open(w,"_blank")&&d&&(b.location.href=w);h.readyState=h.DONE;x();p(w)}},y=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},C={create:!0,exclusive:!1},z;h.readyState=h.INIT;m||(m="download");if(a)w=
(b.URL||b.webkitURL||b).createObjectURL(n),c.href=w,c.download=m,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);x();p(w);h.readyState=h.DONE});else{b.chrome&&k&&"application/octet-stream"!==k&&(z=n.slice||n.webkitSlice,n=z.call(n,0,n.size,"application/octet-stream"),r=!0);g&&"download"!==m&&(m+=".download");if("application/octet-stream"===k||g)B=b;v?(l+=n.size,v(b.TEMPORARY,l,y(function(a){a.root.getDirectory("saved",C,y(function(a){var b=function(){a.getFile(m,C,y(function(a){a.createWriter(y(function(b){b.onwriteend=
function(b){B.location.href=a.toURL();h.readyState=h.DONE;q(h,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(n);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),A)}),A)};a.getFile(m,{create:!1},y(function(a){a.remove();b()}),y(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},w=C.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
b,c){c||(a=e(a));return navigator.msSaveOrOpenBlob(a,b||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(a,b,c){return new C(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content);
"undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
var version="0.9.3",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_Battery CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_Policy
2022-03-01 21:46:01 +03:00
null,terminal,currentView=0,LoadingHtml="<div style=text-align:center;padding-top:20px>Carregando...<div>",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1,decimationMode:2},currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar Desktop DesktopInband DesktopInbandFiles Desktop-Multi DesktopRotation Desktop-Settings DesktopType EventLog EventSubscriptions FileSaver HardwareInfo IDER IDERDebug IDERStats Inflate Look-MeshCentral Mode-MeshCentral2 NetAuth NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "),
StatusStrs=["Desconectado","A ligar ...","Configura\u00e7\u00e3o...","Conectado"],t,t2,rsepass=null;
function startup(){var b=document.getElementsByTagName("input");for(t=0;t<b.length;t++)b[t].id&&(window[b[t].id]=b[t]);urlvars=getUrlVars();for(var c in AllWsman)b=document.createElement("option"),b.text=AllWsman[c],b.id="WSB-"+AllWsman[c],Q(22).add(b);desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk",Q(8)));desktop.onStateChanged=onDesktopStateChange;QE("c10",!0);try{t=localStorage.getItem("desktopsettings")}catch(a){}t&&(desktopsettings=JSON.parse(t));
applyDesktopSettings();terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.onStateChanged=onTerminalStateChange;Q(33).value=terminalEmulations[terminal.m.terminalEmulation];Q(30).value="\r\n"==terminal.m.lineFeed?"CR + LF":"LF";QE("c4",!0);Q("p13").addEventListener("dragover",haltEvent,!1);Q("p13").addEventListener("dragleave",haltEvent,!1);Q("p13").addEventListener("drop",terminal_FileSelectHandler,!1);document.addEventListener("dragover",
haltEvent,!1);document.addEventListener("dragleave",haltEvent,!1);document.addEventListener("drop",documentFileSelectHandler,!1);Q("p16").addEventListener("dragover",haltEvent,!1);Q("p16").addEventListener("dragleave",haltEvent,!1);Q("p16").addEventListener("drop",cert_FileSelectHandler,!1);Q("Desk").toBlob||QV("c6",!1);document.onkeyup=handleKeyUp;document.onkeydown=handleKeyDown;document.onkeypress=handleKeyPress;window.onresize=center;center();Q("p24filetable").addEventListener("drop",
p24fileDragDrop,!1);Q("p24filetable").addEventListener("dragover",p24fileDragOver,!1);Q("p24filetable").addEventListener("dragleave",p24fileDragLeave,!1)}
function documentFileSelectHandler(b){haltEvent(b);for(var c=!0,a=0;a<b.dataTransfer.files.length;a++)0==b.dataTransfer.files[a].name.toLowerCase().endsWith(".img")&&0==b.dataTransfer.files[a].name.toLowerCase().endsWith(".iso")&&(c=!1);1==c&&null!=b.dataTransfer&&0<currentView&&100>currentView&&(1==b.dataTransfer.files.length||2==b.dataTransfer.files.length)?(a=c=null,b.dataTransfer.files[0].name.toLowerCase().endsWith(".iso")&&(a=b.dataTransfer.files[0]),b.dataTransfer.files[0].name.toLowerCase().endsWith(".img")&&
(c=b.dataTransfer.files[0]),2==b.dataTransfer.files.length&&(b.dataTransfer.files[1].name.toLowerCase().endsWith(".iso")&&(a=b.dataTransfer.files[1]),b.dataTransfer.files[1].name.toLowerCase().endsWith(".img")&&(c=b.dataTransfer.files[1])),null==c&&null==a||iderStart3(c,a,1)):null!=b.dataTransfer&&1==b.dataTransfer.files.length&&(c=b.dataTransfer.files[0].name.toLowerCase(),21==currentView&&UploadToStorage(b.dataTransfer.files[0],c))}
function connectButtonfunction(){wsstack&&0!=wsstack.socketState?disconnect():meshcentral2credCallback()}function connectButtonfunctionEx(){currentMeshNode=parent.getCurrentNode();connect(currentMeshNode._id,16992,null,null,0);Q("xconnectbutton1").value="desconectar"}function getCurrentMeshNode(){return currentMeshNode}function setConnectionState(b){QE("xconnectbutton1",b);0==b&&disconnect()}function setFrameHeight(b){}function setAuthCallback(b){meshcentral2credCallback=b}
function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3.value="Come\u00e7ar captura";terminal.m.capture&&delete terminal.m.capture;terminal.Stop();desktop.disconnectCode=0;desktop.Stop()}
function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyUp(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyUp(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyUp(b)}}
function handleKeyDown(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyDown(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyDown(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyDown(b)}}
function handleKeyPress(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(48).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeys(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeys(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeys(b)}}var connectFunc=null,connectFuncTag=null;
function connect(b,c,a,d,g,v,n){go(0);fullscreenonly=!1;connectFunc=v;connectFuncTag=n;1==urlvars.kvm&&go(14);if(1==urlvars.kvmfull||1==urlvars.kvmonly)go(14),deskToggleFull(1==urlvars.kvmonly);1==urlvars.sol&&go(13);wsstack=WsmanStackCreateService(b,c,a,d,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QE("TermWD",!1);QV("go12",!0);QH(28,"");QH(39,"");amtversion=amtversionmin=amtFirstPull=
0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(49,"");
QH(50,LoadingHtml);xxCertificates=null;QH(51,LoadingHtml);QH(24,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(52,LoadingHtml);QH(54,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive=
!1;QH(53,LoadingHtml);QE(43,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(48,!1),Q(48).checked=!0);QE(44,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1)}
function disconnect(){null!=desktopPollTimer&&(clearInterval(desktopPollTimer),desktopPollTimer=null);fullscreen&&deskToggleFull();iderStop();StopDefenseStatsTimer();dialogclose(0);amtstack&&(amtstack.onProcessChanged=null,amtstack.CancelAllQueries(999),amtstack=null);cleanup();wsstack=null;delete amtstack;onProcessChanged(0,1);go(101);Q("xconnectbutton1").value="Conectar";QH(5,"Desconectado");go(100)}
function onProcessChanged(b,c){QS(3).width=100*b/c+"%";0==b&&refreshButtons(!0);0==b&&amtstack&&(0<amtversion&&0==(amtFirstPull&64)?(amtFirstPull|=64,PullPowerPolicy(),subscriptionsFilters=null,PullEventSubscriptions(),PullWatchdog(),5<amtversion&&(PullCertificates(),PullRemoteAccess())):0==(amtFirstPull&1)?PullHardware():0==(amtFirstPull&16)?PullEventLog():0==(amtFirstPull&32)&&PullAuditLog())}
function checkAmtVersion(b){var c=b.split(".");b=parseInt(c[0]);var a=parseInt(c[1]),c=parseInt(c[2]),c=1E3*a+c,d=0;5>=b||12<=b?d=1:6==b&&2061<=c?d=1:7==b&&1091<=c?d=1:8==b&&1071<=c?d=1:9==b?5>a&&1041<=c?d=1:5061<=c&&(d=1):10==b&&55<=c?d=1:11==b&&(5>a&&25<=c?d=1:6027<=c&&(d=1));return 0==d}
function processSystemVersion(b,c,a,d){if(200==d||400==d){if(200==d){amtlogicalelements=[];null!=a&&null!=a.CIM_SoftwareIdentity&&null!=a.CIM_SoftwareIdentity.responses&&(amtlogicalelements=a.CIM_SoftwareIdentity.responses,null!=a.AMT_SetupAndConfigurationService&&null!=a.AMT_SetupAndConfigurationService.response&&amtlogicalelements.push(a.AMT_SetupAndConfigurationService.response));if(0==amtlogicalelements.length){console.error("ERROR: Could not get Intel AMT version.");disconnect();return}c=getInstance(amtlogicalelements,
"AMT").VersionString}else if(c=b.wsman.comm.amtVersion,!c){errcheck(400,b);return}amtversion=parseInt(c.split(".")[0]);amtversionmin=parseInt(c.split(".")[1]);QV(11,checkAmtVersion(c));PullSystemStatus();updateSystemStatus();1!=urlvars.kvmonly&&0==fullscreenonly&&(PullUserInfo(),8<=amtversion&&PullAlarms());connectFunc&&(connectFunc(connectFuncTag),connectFuncTag=connectFunc=null);1==urlvars.kvm&&(go(14),connectDesktop());if(1==urlvars.kvmfull||1==urlvars.kvmonly)go(14),connectDesktop();
1==urlvars.sol&&(go(13),connectTerminal())}else errcheck(d,b)}var refreshButtonsState=!0;function refreshButtons(b){if(refreshButtonsState!=b){refreshButtonsState=b;for(var c=0,a=document.getElementsByTagName("input");c<a.length;c++)"refreshbtn"==a[c].name&&(a[c].disabled=!b)}}
function PullPowerState(){amtstack&&0==amtstack.GetPendingActions()&&amtsysstate&&amtsysstate.CIM_ServiceAvailableToElement&&amtstack.Enum("CIM_ServiceAvailableToElement",function(b,c,a,d){200==d&&(amtsysstate.CIM_ServiceAvailableToElement.responses=a,9<amtversion&&null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&2==amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState?
amtstack.Get("IPS_PowerManagementService",function(a,b,c,d){200==d&&(amtsysstate.IPS_PowerManagementService.response=c.Body,updateSystemStatus())}):updateSystemStatus())})}
function PullSystemStatus(b){refreshButtons(!1);amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime);var c=["CIM_ServiceAvailableToElement","*AMT_GeneralSettings","AMT_EthernetPortSettings","*AMT_RedirectionService","CIM_ElementSettingData"];5<amtversion&&c.push("IPS_IPv6PortSettings","*CIM_KVMRedirectionSAP","*IPS_OptInService","*IPS_KVMRedirectionSettingData");9<amtversion&&c.push("*IPS_ScreenConfigurationService","*IPS_PowerManagementService");15<amtversion&&1==amtstack.wsman.comm.xtls&&
c.push("*CIM_BootService");amtstack.BatchEnum("",c,processSystemStatus,!0);1==b&&PullWireless()}function processSystemTime(b,c,a,d){errcheck(d,b)||200!=d||(b=new Date,c=new Date,b.setTime(1E3*a.Body.Ta0),amtdeltatime=b-c,updateSystemStatus())}var amtdeltatime,amtsysstate,amtlogicalelements,amtfeatures={};
function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationService||400==a.IPS_ScreenConfigurationService.status)a.IPS_ScreenConfigurationService=null;if(void 0==a.IPS_KVMRedirectionSettingData||400==a.IPS_KVMRedirectionSettingData.status)a.IPS_KVMRedirectionSettingData=null;if(void 0==a.CIM_KVMRedirectionSAP||400==a.CIM_KVMRedirectionSAP.status)a.CIM_KVMRedirectionSAP=null;if(void 0==a.IPS_OptInService||400==a.IPS_OptInService.status)a.IPS_OptInService=null;void 0!=a.AMT_RedirectionService&&
2022-03-23 21:00:41 +03:00
200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in a)null!=a[g]&&a[g].status>d&&(d=a[g].status);400!=d&&errcheck(d,b)||(amtsysstate=a,applyDesktopSettings(),updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Sincronizar rel\u00f3gio",3,syncClockEx,"Sincronizar o rel\u00f3gio Intel AMT com este computador?")}
function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Falha ao definir a hora, status ="+d):0!=a.Body.ReturnValue?messagebox("","Falha ao definir hora, erro: "+a.Body.ReturnValueStr):(b=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}var DMTFPowerStates=";;Ligar;Sono leve;Sono profundo;Ciclo de energia (desligamento suave);Desligado - Dif\u00edcil;Hiberna\u00e7\u00e3o (desativado suave);Soft off;Ciclo de energia (Off-hard);Redefini\u00e7\u00e3o do barramento principal;Interrup\u00e7\u00e3o de diagn\u00f3stico (MNI);N\u00e3o aplic\u00e1vel;Desligado - suave e gracioso;Desligado - Dif\u00edcil gracioso;Redefini\u00e7\u00e3o do barramento mestre graciosa;Ciclo de energia (desligado - suave suave);Ciclo de energia (desligado - com for\u00e7a);Interrup\u00e7\u00e3o de diagn\u00f3stico (INIT)".split(";");
function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){var b=0,c,a,d=TableStart(),g="",v=amtsysstate.AMT_GeneralSettings.response,n="<i>Desconhecido</i>";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&(n=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState],9<amtversion&&"Ligar"==n&&amtsysstate.IPS_PowerManagementService&&amtsysstate.IPS_PowerManagementService.response&&
3==amtsysstate.IPS_PowerManagementService.response.OSPowerSavingState&&(n="Standby (Connected)"),QH(28,n),QH(39,n));v.PowerSource&&(n+=[", Conectado",", Com bateria"][v.PowerSource]);d+=TableEntry("Poder",addLink(n,"showPowerActionDlg()"));c=v.HostName;a=v.DomainName;null!=a&&0<a.length&&(c+="."+a);c=0==c.length?"<i>Nenhum</i>":EscapeHtml(c);d+=TableEntry("Nome e dom\u00ednio",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?
d+=TableEntry("ID do sistema",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("ID do sistema",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var n="",l=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==l.ProvisioningState&&5<amtversion&&(n=" ativado no modo de controle de administrador (ACM)",4==l.ProvisioningMode&&(n=" ativado no modo de controle de cliente (CCM)",b=9));d+=TableEntry("Intel&reg; ME",
2022-03-23 21:00:41 +03:00
"v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+n)}null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&(QV(27,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState),QV(38,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState));if(200==amtsysstate.AMT_RedirectionService.status){var p=amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,
q=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),n=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),e=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(QV("go14",!0),e=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);
p&&(g+=", Porta de redirecionamento");q&&(g+=", Serial-over-LAN");n&&(g+=", Redirecionamento de IDE");e&&(g+=", KVM");""==g&&(g=" Nenhum");d+=TableEntry("Recursos ativos",addLinkConditional(g.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&(n=amtsysstate.IPS_KVMRedirectionSettingData.response,g="Visor principal",7<amtversion&&void 0!==n.DefaultScreen&&255>n.DefaultScreen&&(g=["Visor principal",
2022-03-23 21:00:41 +03:00
"Visor secund\u00e1rio","3\u00aa exibi\u00e7\u00e3o"][n.DefaultScreen]),g='<span title="'+format("O visor remoto padr\u00e3o \u00e9 {0}",g.toLowerCase())+'">'+g+"</span>",1==n.Is5900PortEnabled&&(g+="Porta 5900 ativada"),1==n.OptInPolicy&&(g+=","+n.OptInPolicyTimeout+" "+(0<n.OptInPolicyTimeout?"segundos de aceita\u00e7\u00e3o":"segunda inscri\u00e7\u00e3o")),g+=","+n.SessionTimeout+" minuto"+(0<n.SessionTimeout?"s":"")+" sess\u00e3o expirada",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?
((n=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&1))&&(g+=", Supress\u00e3o permitida"),QV(45,n),Q(46).checked=!1):QV(45,!1),d+=TableEntry("\u00c1rea de trabalho remota",addLinkConditional(g,"showDesktopSettingsDlg()",xxAccountAdminName)));QV(25,!p||!q);QV(26,xxAccountAdminName);QV(36,!p||!e);QV(37,xxAccountAdminName);5<amtversion&&null!=amtsysstate&&null!=amtsysstate.IPS_OptInService&&
2022-03-23 21:00:41 +03:00
void 0!=amtsysstate.IPS_OptInService.response&&(g="Estado desconhecido",p=amtsysstate.IPS_OptInService.response.OptInRequired,0==p&&(g="N\u00e3o requerido"),1==p&&(g="Necess\u00e1rio apenas para KVM"),4294967295==p&&(g="Sempre necess\u00e1rio"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&(g=addLinkConditional(g,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("Consentimento do Usu\u00e1rio",g));1==amtstack.wsman.comm.xtls&&null!=amtsysstate.CIM_BootService&&null!=amtsysstate.CIM_BootService.response.EnabledState&&
(g={0:"Desconhecido",1:"De outros",2:"ativado",3:"Desativado",4:"Desligando",5:"N\u00e3o aplic\u00e1vel",6:"Ativado, mas offline",7:"Em teste",8:"Diferido",9:"Quiesce",10:"Iniciando",32768:"OCR Disabled",32769:"OCR Enabled",32770:"OCR Disabled, RPE Enabled",32771:"RPE & OCR Enabled"},15<amtversion&&(g[32768]="OCR & RPE Disabled",g[32769]="OCR Enabled, RPE Disabled"),n=g[amtsysstate.CIM_BootService.response.EnabledState]?g[amtsysstate.CIM_BootService.response.EnabledState]:"Desconhecido",d+=TableEntry("Boot Features",
addLinkConditional(n,"showEnableBootServiceDlg()",xxAccountAdminName)));if(null!=AmtSystemPowerSchemes)for(var g=amtsysstate.CIM_ElementSettingData.responses,C=0;C<g.length;C++)if(g[C].SettingData&&1==g[C].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==g[C].SettingData.ReferenceParameters.ResourceURI)for(p=g[C].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,q=0;q<AmtSystemPowerSchemes.length;q++)AmtSystemPowerSchemes[q].SchemeGUID==p&&(d+=TableEntry("Pol\u00edtica de energia",
addLinkConditional(AmtSystemPowerSchemes[q].Description.split(":")[1],'showPowerPolicyDlg("'+p+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Data hora",addLinkConditional((new Date((new Date).getTime()+amtdeltatime)).toLocaleString(),"syncClock()",xxAccountAdminName)));g=AddRefreshButton("PullSystemStatus()")+" ";g+=AddButton("A\u00e7\u00f5es de poder ...","showPowerActionDlg()")+" ";g+=AddButton("Estado salvo...","saveEntireAmtState()")+" ";d+=TableEnd(g);amtstack.amtauth&&(d+="<div style=position:absolute;top:10px;right:20px;cursor:pointer onclick=showAuthCsme()><img src=authcsme.png width=100 height=100 /></div>");
QH(15,d);d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+TableEnd("<div>&nbsp;"+AddRefreshButton("PullSystemStatus(1)")+" Alterar as configura\u00e7\u00f5es de rede pode fazer com que esta p\u00e1gina fique indispon\u00edvel.");d=d+"<br><h2>Configura\u00e7\u00f5es Gerais</h2>"+TableStart();g="";"<i>Nenhum</i>"!=c&&(1==v.SharedFQDN&&(g=", compartilhado com o SO"),0==v.SharedFQDN&&(g=", diferente do SO"));d+=TableEntry("Nome e dom\u00ednio",addLinkConditional(c+
g,"showEditNameDlg(1)",xxAccountAdminName));c="Desativado";1==v.DDNSUpdateEnabled?c="Ativado cada"+v.DDNSPeriodicUpdateInterval+" minutos, TTL \u00e9"+v.DDNSTTL+" minutos":1==v.DDNSUpdateByDHCPServerEnabled&&(c="Atualiza\u00e7\u00e3o pelo servidor DHCP");d+=TableEntry("DNS din\u00e2mico",addLinkConditional(c,"showEditDnsDlg()",xxAccountAdminName));d+=TableEnd();for(a in amtsysstate.AMT_EthernetPortSettings.responses){c=amtsysstate.AMT_EthernetPortSettings.responses[a];if(c.WLANLinkProtectionLevel||
1==a)amtwirelessif=a;if(0!=a||amtwirelessif==a||"00-00-00-00-00-00"!=c.MACAddress){0==a&&b++;d+="<br><h2>"+(amtwirelessif==a?"Interface sem fio":"Interface com fio")+"</h2>";d+=TableStart();d+=TableEntry("Estado do link",1==c.LinkIsUp?"O link est\u00e1 ativo":"Link desativado");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);g=[];for(C in c.LinkPolicy)1==c.LinkPolicy[C]&&g.push("S0 / AC"),14==c.LinkPolicy[C]&&g.push("Sx / AC"),16==c.LinkPolicy[C]&&g.push("S0 / DC"),224==c.LinkPolicy[C]&&g.push("Sx / DC");
2022-03-23 21:00:41 +03:00
0==g.length&&g.push("");d+=TableEntry("Pol\u00edtica de links",addLinkConditional(0==g.length?"N\u00e3o dispon\u00edvel":"Dispon\u00edvel em: "+g.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("Endere\u00e7o MAC",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("Estado",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),
s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Estado da R\u00e1dio",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"<i>Nenhum</i>")),xxWireless.AMT_WiFiPortConfigurationService&&xxWireless.AMT_WiFiPortConfigurationService.response&&"number"==typeof xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled&&(d+=TableEntry("Local WIFI Profile Sync",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?
"ativado":"Desativado","showWifiSyncDlg("+a+")",xxAccountAdminName))),d=null!=xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&1==xxWireless.AMT_BootCapabilities.response.UEFIWiFiCoExistenceAndProfileShare&&null!=xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?d+TableEntry("UEFI WiFi CoEx Profile sharing",addLinkConditional(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"ativado":"Desativado","showUefiWifiCoExDlg()",
xxAccountAdminName)):d+TableEntry("UEFI WiFi CoEx Profile sharing","Unavailable"));amtwirelessif!=a&&(d+=TableEntry("Responder ao ping",addLinkConditional(["Desativado","Resposta ICMP","Resposta RMCP","Resposta ICMP e RMCP"][v.PingResponseEnabled+(v.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),g=1==c.DHCPEnabled?"Autom\u00e1tico usando servidor DHCP":"Endere\u00e7o IP est\u00e1tico",1==c.IpSyncEnabled&&(g+=", IP sync with OS"),d+=TableEntry("Estado IPv4",addLinkConditional(g,
2022-03-23 21:00:41 +03:00
"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("Endere\u00e7o IPv4",isIpAddress(c.IPAddress,"Nenhum"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("Gateway IPv4 / M\u00e1scara",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"Nenhum")));g=c.PrimaryDNS;isIpAddress(g)&&(c.SecondaryDNS&&(g+=" / "+c.SecondaryDNS),d+=TableEntry("Servidor de nomes de dom\u00ednio IPv4",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5<amtversion){c=amtsysstate.IPS_IPv6PortSettings.responses[a];for(var p=
"Desativado",w,g=amtsysstate.CIM_ElementSettingData.responses,C=0;C<g.length;C++)g[C].SettingData&&g[C].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+a&&(w=1==g[C].IsCurrent);1==w&&(p=(g=isIpAddress(c.IPv6Address)||isIpAddress(c.DefaultRouter)||isIpAddress(c.PrimaryDNS)||isIpAddress(c.SecondaryDNS))?"Endere\u00e7os ativados, autom\u00e1ticos e manuais":"Habilitado, Endere\u00e7os autom\u00e1ticos");d+=TableEntry("Estado IPv6",addLinkConditional(p,"showIPv6StateDlg("+
a+","+w+")",xxAccountAdminName));if(1==w){if(c.CurrentAddressInfo&&0<c.CurrentAddressInfo.length){c.CurrentAddressInfo=MakeToArray(c.CurrentAddressInfo);ipv6addr="";for(C=0;C<c.CurrentAddressInfo.length;C++)0<ipv6addr.length&&(ipv6addr+=","),ipv6addr+=c.CurrentAddressInfo[C].split(",")[0];d+=TableEntry("Endere\u00e7o IPv6",addLink(ipv6addr,"showIPv6AddrDlg("+a+',"'+c.CurrentAddressInfo+'")'))}else d+=TableEntry("Endere\u00e7o IPv6","Nenhum");isIpAddress(c.CurrentDefaultRouter)&&(d+=TableEntry("Roteador IPv6 padr\u00e3o",
2022-03-23 21:00:41 +03:00
c.CurrentDefaultRouter));isIpAddress(c.CurrentPrimaryDNS)&&(g=c.CurrentPrimaryDNS,isIpAddress(c.CurrentSecondaryDNS)&&(g+=" / "+c.CurrentSecondaryDNS),d+=TableEntry("Servidor de nomes de dom\u00ednio IPv6",g))}}d+=TableEnd()}}1!=urlvars.kvmonly&&0==fullscreenonly&&(-1!=amtwirelessif&&0==(amtFirstPull&2)&&PullWireless(),QH(19,d),1==b&&0==(amtFirstPull&4)&&PullSystemDefense(),0==(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage());0==currentView&&
go(1,1)}}function isIpAddress(b,c){return b&&null!=b&&0<b.length&&"::"!=b&&"::0"!=b?b:c}
function showLinkPolicyDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_EthernetPortSettings.responses[b],a;a=""+("<label><input type=checkbox id=d11p1 value=1 "+(0<=c.LinkPolicy.indexOf(1)?"checked":"")+">Available in S0/AC - Powered on & plugged in</label><br>");a+="<label><input type=checkbox id=d11p2 value=14 "+(0<=c.LinkPolicy.indexOf(14)?"checked":"")+">Available in Sx/AC - Sleeping & plugged in</label><br>";a+="<label><input type=checkbox id=d11p3 value=16 "+(0<=c.LinkPolicy.indexOf(16)?"checked":
"")+">Available in S0/DC - Powered on & on battery</label><br>";a+="<label><input type=checkbox id=d11p4 value=224 "+(0<=c.LinkPolicy.indexOf(224)?"checked":"")+">Available in Sx/DC - Sleeping & on battery</label><br>";setDialogMode(11,"Pol\u00edtica de Links",3,showLinkPolicyDlgEx,a,b)}}
function showLinkPolicyDlgEx(b,c){var a=Clone(amtsysstate.AMT_EthernetPortSettings.responses[c]);a.DHCPEnabled&&(delete a.IPAddress,delete a.SubnetMask,delete a.DefaultGateway,delete a.PrimaryDNS,delete a.SecondaryDNS);a.LinkPolicy=[];Q("d11p1").checked&&a.LinkPolicy.push(1);Q("d11p2").checked&&a.LinkPolicy.push(14);Q("d11p3").checked&&a.LinkPolicy.push(16);Q("d11p4").checked&&a.LinkPolicy.push(224);amtstack.Put("AMT_EthernetPortSettings",a,showLinkPolicyDlgExDone,0,1,a)}
function showLinkPolicyDlgExDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("Pol\u00edtica de Links",format("N\u00e3o foi poss\u00edvel definir a nova pol\u00edtica de link, erro {0}",d))}
function showAuthCsme(){if(!xxdialogMode){var b;b="<div style=margin-top:8px>Intel&reg; AMT supports authentic CSME feature, however MeshCommander cannot verify the authenticity yet.</div><hr style=margin-top:8px;margin-bottom:8px;height:2px;border-width:0;color:gray;background-color:gray />"+addHtmlValue("FW Version",amtstack.amtauth.FWVersion);b+=addHtmlValue("FQDN",amtstack.amtauth.FQDN?amtstack.amtauth.FQDN:"<i>Nenhum</i>");b+="<hr style=margin-top:8px;margin-bottom:8px;height:2px;border-width:0;color:gray;background-color:gray /><div style=max-height:200px;overflow-y:auto><table>";
for(var c in amtstack.amtauth.Certificates){var a=amtstack.amtauth.Certificates[c];b+="<tr><td style=width:32px;vertical-align:top><img src=images-commander/cert1.png height=32 width=32 />";b+="<td style=padding-bottom:6px><b>"+EscapeHtml(a.subject.getField("CN").value)+(!0===a.xTrusted?", <span style=color:#080>Confi\u00e1vel</span>":"")+"</b><br />";a.subject.getField("OU")&&(b+=EscapeHtml(a.subject.getField("OU").value)+"<br />");b+=amtstack.amtauth.CertificatesDer[c].length+" bytes,<a style=cursor:pointer;color:blue onclick=downloadAuthCert("+
c+")>Baixar</a>";a.xCrl&&(b+="<br />CRL "+a.xCrl.length+" bytes,<a style=cursor:pointer;color:blue onclick=downloadCertCrl("+c+")>Baixar</a>")}setDialogMode(11,"Authentic CSME",1,null,b+"</table><div>")}}function downloadCertCrl(b){b=parseInt(b);saveAs(data2blob(amtstack.amtauth.Certificates[b].xCrl),amtstack.amtauth.Certificates[b].subject.getField("CN").value+".crl")}
function downloadAuthCert(b){b=parseInt(b);saveAs(data2blob(amtstack.amtauth.CertificatesDer[b]),amtstack.amtauth.Certificates[b].subject.getField("CN").value+".cer")}var IntelAmtEntireState,IntelAmtEntireStateCalls;
function saveEntireAmtState(){if(!xxdialogMode){var b="",c=new Date;amtsysstate&&(b="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);c30.value="amtstate"+b+".json";setDialogMode(19,"Salvar todo o estado Intel&reg; AMT",3,saveEntireAmtStateOk)}}
function saveEntireAmtStateOk(){IntelAmtEntireState={webappversion:version,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()};QH(60,"Fetching entire state, please wait...");setDialogMode(1,"Salvar todo o estado Intel&reg; AMT",0,null);IntelAmtEntireStateCalls=3;amtstack.BatchEnum(null,AllWsman,saveEntireAmtStateOk2,null,!0);amtstack.GetAuditLog(saveEntireAmtStateOk3);amtstack.GetMessageLog(saveEntireAmtStateOk4)}
function saveEntireAmtStateOk2(b,c,a,d){IntelAmtEntireState.wsmanenums=a;saveEntireAmtStateDone()}function saveEntireAmtStateOk3(b,c){IntelAmtEntireState.auditlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateOk4(b,c){IntelAmtEntireState.eventlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateDone(){0==--IntelAmtEntireStateCalls&&(setDialogMode(),saveAs(data2blob(JSON.stringify(IntelAmtEntireState,null," ").replace(/\n/g,"\r\n")),c30.value))}
function showDesktopSettingsDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_KVMRedirectionSettingData.response,c;c="<div style=text-align:left><div style=height:26px;margin-top:4px><select id=subddisplay style=float:right;width:200px><option value=0>Visor principal</option><option value=1>Visor secund\u00e1rio</option>";9<amtversion&&(c+="<option value=2>3\u00aa exibi\u00e7\u00e3o</option>");c+='</select><div style=padding-top:4px>Exibi\u00e7\u00e3o padr\u00e3o</div></div><div style=height:26px;margin-top:4px><input id=subsessiontimeout style=float:right;width:200px maxlength=5 onkeypress="return numbersOnly(event)"><div style=padding-top:4px>Tempo limite da sess\u00e3o (minutos)</div></div>';
1==b.OptInPolicy&&(c+='<div style=height:26px;margin-top:4px><input id=suboptintimeout style=float:right;width:200px maxlength=5 onkeypress="return numbersOnly(event)"><div style=padding-top:4px>Tempo limite de ativa\u00e7\u00e3o (segundos)</div></div>');c+="<div style=height:26px;margin-top:4px><select id=subdlegacy style=float:right;width:200px onchange=showDesktopSettingsDlgUpdate()><option value=0>Desativado, Recomendado</option><option value=1>Habilitado, visualizadores KVM herdados</option></select><div style=padding-top:4px>Porta 5900</div></div>";
c+="<div style=height:26px;margin-top:4px id=subspassx><input id=subspass type=password autocomplete=off style=float:right;width:200px maxlength=8 onkeyup=showDesktopSettingsDlgUpdate()><div style=padding-top:4px>Senha do 5900 (8 caracteres)</div></div>";9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(c+='<div style=height:26px;margin-top:4px><select id=subsb style=float:right;width:200px onchange=showDesktopSettingsDlgUpdate()><option value=0>Desativado</option><option value=1>ativado</option></select><div style=padding-top:4px title="Esse recurso n\u00e3o \u00e9 frequentemente suportado">Tela em branco</div></div>');
c+="</div>";setDialogMode(11,"Configura\u00e7\u00f5es da \u00e1rea de trabalho remota",3,showDesktopSettingsDlgOk,c);Q("subddisplay").value=b.DefaultScreen;Q("subsessiontimeout").value=b.SessionTimeout;1==b.OptInPolicy&&(Q("suboptintimeout").value=b.OptInPolicyTimeout);Q("subdlegacy").value=1==b.Is5900PortEnabled?1:0;9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(Q("subsb").value=amtsysstate.IPS_ScreenConfigurationService.response.EnabledState);showDesktopSettingsDlgUpdate()}}
function showDesktopSettingsDlgUpdate(){QV("subspassx",1==Q("subdlegacy").value);var b=(0==Q("subdlegacy").value||8==Q("subspass").value.length||0==Q("subspass").value.length)&&0<Q("subsessiontimeout").value.length;1==amtsysstate.IPS_KVMRedirectionSettingData.response.OptInPolicy&&0==Q("suboptintimeout").value.length&&(b=!1);QE("c54",b)}
function showDesktopSettingsDlgOk(){var b=Clone(amtsysstate.IPS_KVMRedirectionSettingData.response);b.DefaultScreen=Q("subddisplay").value;b.SessionTimeout=Q("subsessiontimeout").value;b.Is5900PortEnabled=1==Q("subdlegacy").value;1==b.OptInPolicy&&(b.OptInPolicyTimeout=Q("suboptintimeout").value);1==b.Is5900PortEnabled&&(b.RFBPassword=Q("subspass").value);amtstack.Put("IPS_KVMRedirectionSettingData",b,showDesktopSettingsDlgOk2);b=Clone(amtsysstate.IPS_ScreenConfigurationService.response);b.EnabledState=
parseInt(Q("subsb").value);amtstack.Put("IPS_ScreenConfigurationService",b,showDesktopSettingsDlgOk3)}function showDesktopSettingsDlgOk2(b,c,a,d){200==d?PullSystemStatus():messagebox("Configura\u00e7\u00f5es da \u00e1rea de trabalho remota",format("Erro {0}, incapaz de definir valores.",d))}
function showDesktopSettingsDlgOk3(b,c,a,d){200!=d?messagebox("Erro",format("N\u00e3o foi poss\u00edvel definir o apagamento da tela; o apagamento pode n\u00e3o ser suportado neste sistema ({0}).",d)):amtstack.Get("IPS_ScreenConfigurationService",function(a,b,c,d){200==d&&(amtsysstate.IPS_ScreenConfigurationService.response=c.Body,updateSystemStatus())},0,1)}
function PullEventLog(b){1==b&&xxdialogMode||(amtFirstPull|=16,amtstack.Enum("AMT_MessageLog",processMessageLog0),amtstack.GetMessageLog(processMessageLog1))}var processMessageLog0responses=null;
function processMessageLog0(b,c,a,d){200==d&&(d&&QV("go6",!0),a&&(processMessageLog0responses=a),b="",c="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>",null!=processMessageLog0responses&&(b=1==processMessageLog0responses[0].IsFrozen?AddButton("Descongelar registro","FreezeLog(0)"):AddButton("Congelar log","FreezeLog(1)")),c+=TableEnd('<div style=float:right><input id=eventFilter placeholder="Filtro" style=margin:4px onkeyup=eventFilter()>&nbsp;</div><div>&nbsp;'+
AddRefreshButton("PullEventLog(1)")+AddButton("Log clara","ClearLog()")+AddButton("Salve \ue051...","SaveEventLog()")+b),QH(17,c+"<br>"))}function SaveEventLog(){xxdialogMode||null==eventmessages||SaveJsonFile("IntelAmtEventlog","events","Intel AMT Event Log",eventmessages)}var eventmessages=null;
function processMessageLog1(b,c){eventmessages=c;var a,d=0,g;g="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:90px><b>&nbsp;&nbsp;Event</b><td class=r1 style=width:110px><b>Time</b><td class=r1 style=width:160px><b>Fonte</b><td class=r1><b>Descri\u00e7\u00e3o</b>";for(a in c){d++;var v=1,n=c[a];8<=n.EventSeverity&&(v=2);16<=n.EventSeverity&&(v=3);g+="<tr id=xamtevent"+a+" class=r3 onclick=showEventDetails("+
a+")><td class=r1><p><div class=icon"+v+" style=display:block;float:left;margin-left:5px;margin-right:5px></div>"+(parseInt(a)+1)+'<td class=r1 title="'+n.Time.toLocaleString()+'">'+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>"+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+n.EntityStr.replace("(r)","&reg;")+"<td class=r1>"+n.Desc}g+=TableEnd(0==d?"&nbsp;":"");QH(18,g+"<br>");processMessageLog0()}
function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(60,"Limpar log de eventos?"),setDialogMode(1,"Registro de Eventos",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Registro de Eventos","N\u00e3o foi poss\u00edvel limpar, Erro: "+d):PullEventLog()})}
2022-03-23 21:00:41 +03:00
function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="<div style=text-align:left>"+addHtmlValue("Tempo",c.Time.toLocaleString());a+=addHtmlValue("Fonte",c.EntityStr.replace("(r)","&reg;"));a+=addHtmlValue("Descri\u00e7\u00e3o",c.Desc);a+=MoreStart();a+=addHtmlValue("Endere\u00e7o do dispositivo",c.DeviceAddress);a+=addHtmlValue("Entidade",c.Entity);a+=addHtmlValue("Inst\u00e2ncia da entidade",c.EntityInstance);var d="",g;for(g in c.EventData)0<d.length&&(d+=","),d+=c.EventData[g];
a+=addHtmlValue("Dados",d);a+=addHtmlValue("Deslocamento",c.EventOffset);a+=addHtmlValue("Tipo de sensor",c.EventSensorType);a+=addHtmlValue("Gravidade",c.EventSeverity);a+=addHtmlValue("Tipo de fonte",c.EventSourceType);a+=addHtmlValue("Tipo",c.EventType);a+=addHtmlValue("N\u00famero do sensor",c.SensorNumber);a+=MoreEnd();a+="</div>";messagebox(format("Detalhes do evento {{}}",b+1),a)}}
function eventFilter(){var b=Q("eventFilter").value.toLowerCase(),c;for(c in eventmessages)QV("xamtevent"+c,""==b||0<=eventmessages[c].Desc.toLowerCase().indexOf(b)||0<=eventmessages[c].EntityStr.toLowerCase().indexOf(b))}var subscriptionsFilters=null,subscriptionsListeners=null;
function PullEventSubscriptions(){null==subscriptionsFilters&&amtstack.Enum("CIM_FilterCollection",processEventSubscriptions0);amtstack.BatchEnum(null,["CIM_ListenerDestination","CIM_FilterCollectionSubscription"],processEventSubscriptions1)}function processEventSubscriptions0(b,c,a,d){408!=d&&400!=d&&(d&&errcheck(d,b)||(subscriptionsFilters=a))}
2022-03-23 21:00:41 +03:00
function processEventSubscriptions1(b,c,a,d){if(!(408==d||400==d||d&&errcheck(d,b))){d&&QV("go22",!0);a&&(subscriptionsListeners=a);c=0;b=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Gerenciar assinantes de eventos.<br><br>";for(var g in subscriptionsListeners.CIM_ListenerDestination.responses)a=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[g].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","&reg;"),d=subscriptionsListeners.CIM_ListenerDestination.responses[g],
b+='<div class=itemBar onclick="showSubscriptionDetails('+g+')"><div style=float:right></div><div style=padding-top:3px;overflow-x:hidden title="'+a+" - "+d.Destination+'"><b>'+a+"</b> - "+d.Destination+"</div><div style=padding-top:3px></div></div>",c++;0==c&&(b+="<div style=padding-left:15px><br><i>Nenhuma assinatura encontrada.</i></div><br>");g="<div>&nbsp;"+AddRefreshButton("PullEventSubscriptions()");xxAccountAdminName&&(g+=AddButton("Nova assinatura","newSubscriptionButton()"));b+="<br><td class=r1>"+
TableEnd(g+"</div>");QH(56,b)}}var subscriptionDeliveryModes={2:"Empurrar",3:"Empurre com ACK",4:"Eventos",5:"Puxar"};
function showSubscriptionDetails(b){if(!xxdialogMode){var c=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[b].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","&reg;"),a=subscriptionsListeners.CIM_ListenerDestination.responses[b],d;d="<div style=text-align:left>"+addHtmlValue("Destino",a.Destination);d+=addHtmlValue("Filtro",c);d+=addHtmlValue("Modo de entrega",subscriptionDeliveryModes[a.DeliveryMode]);setDialogMode(11,"Inscri\u00e7\u00e3o"+(b+1),xxAccountAdminName?
5:1,deleteSubscriptionButton,d+"</div>",b)}}
function deleteSubscriptionButton(b,c){2==b&&amtstack.UnSubscribe("CIM_FilterCollectionSubscription",PullEventSubscriptions,null,1,{Filter:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_FilterCollection</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+subscriptionsListeners.CIM_FilterCollectionSubscription.responses[c].Filter.ReferenceParameters.SelectorSet.Selector.Value+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>",
Handler:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ListenerDestinationWSManagement</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">CIM_ListenerDestinationWSMAN</w:Selector><w:Selector Name="Name">'+subscriptionsListeners.CIM_ListenerDestination.responses[c].Name+'</w:Selector><w:Selector Name="SystemCreationClassName">CIM_ComputerSystem</w:Selector><w:Selector Name="SystemName">Intel(r) AMT</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>'})}
function newSubscriptionButton(){if(!xxdialogMode&&null!=subscriptionsFilters){var b;b="<div style=height:26px;margin-top:4px><select id=subtype style=float:right;width:260px><option value=Push>Empurrar</option><option value=PushWithAck>Empurre com ACK</option></select><div style=padding-top:4px>Tipo</div></div><div style=height:26px;margin-top:4px><select id=subfilter style=float:right;width:260px>";for(var c in subscriptionsFilters)b+='<option value="'+subscriptionsFilters[c].InstanceID+'">'+subscriptionsFilters[c].CollectionName.substring(13)+
"</option>";b+="</select><div style=padding-top:4px>Filtro</div></div>";b+='<div style=height:26px;margin-top:4px><input id=suburl style=float:right;width:260px maxlength=253 onkeyup=newSubscriptionUpdate() value="http://"><div style=padding-top:4px>URL</div></div>';b+="<div style=height:26px;margin-top:4px><select id=subauth style=float:right;width:260px onchange=newSubscriptionUpdate()><option value=0>Nenhum</option><option value=1>Digerir</option></select><div style=padding-top:4px>Autentica\u00e7\u00e3o</div></div>";
b+="<div style=height:26px;margin-top:4px id=subxuser><input id=subuser style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Nome do usu\u00e1rio</div></div>";b+="<div style=height:26px;margin-top:4px id=subxpass><input id=subpass style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Senha</div></div>";b+="<div style=height:26px;margin-top:4px><input id=subargs style=float:right;width:260px maxlength=128><div style=padding-top:4px>Argumentos</div></div>";
setDialogMode(11,"Adicionar assinatura de evento",3,newSubscriptionButtonOk,b);newSubscriptionUpdate()}}function newSubscriptionUpdate(){QE("c54",0<Q("suburl").value.length&&Q("suburl").value.startsWith("http://")&&(0==Q("subauth").value||0<Q("subuser").value.length&&0<Q("subpass").value.length));QV("subxuser",1==Q("subauth").value);QV("subxpass",1==Q("subauth").value)}
function newSubscriptionButtonOk(){var b=0==Q("subuser").value.length?void 0:Q("subuser").value,c=0==Q("subpass").value.length?void 0:Q("subpass").value;amtstack.Subscribe("CIM_FilterCollection",Q("subtype").value,Q("suburl").value,newSubscriptionButtonOk2,null,1,{InstanceID:Q("subfilter").value},0<Q("subargs").value.length?Q("subargs").value:null,b,c)}function newSubscriptionButtonOk2(b,c,a,d){200==d&&PullEventSubscriptions()}
function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AMT_AuditLog",processAuditLog0))}var auditLog=null,auditLogEnabledStates="Desconhecido;De outros;ativado;Desativado;Desligando;N\u00e3o aplic\u00e1vel;Ativado, mas offline;Em teste;Diferido;Quiesce;Iniciando".split(";");
function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Desativado":"ativado",c&2&&(b+="Bloqueado"),c&4&&(b+=", Quase cheio"),c&8&&(b+=", Cheio"),c&16&&(b+=", NoKey"),c="<h1>Configura\u00e7\u00f5es do log de auditoria</h1>"+TableStart(),c+=TableEntry("Estado",b),c+=TableEntry("Armazenamento",a[0].CurrentNumberOfRecords+" registro (s),"+a[0].PercentageFree+"% livre"),c+=TableEntry("Pol\u00edtica de substitui\u00e7\u00e3o",2==a[0].OverwritePolicy?"Envolt\u00f3rios quando cheios":
"Nunca substitui"),c+=TableEnd(),QH(49,c),amtstack.GetAuditLog(processAuditLog1))}
2022-03-23 21:00:41 +03:00
function processAuditLog1(b,c){auditLog=c;var a,d;d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+(TableEnd('<div style=float:right><input id=auditFilter placeholder="Filtro" style=margin:4px onkeyup=auditFilter()>&nbsp;</div><div> '+AddRefreshButton("PullAuditLog(1)")+AddButton("Salve \ue051...","SaveAuditLog()")+AddButton("Log clara","ClearAuditLog()"))+"<br>");if(0==c.length)d="Nenhum evento de log de auditoria encontrado.";else{var g=0;d+="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:110px>&nbsp;&nbsp;<b>Tempo</b><td class=r1 style=width:260px><b>Iniciador</b><td class=r1><b>Action</b>";
for(a in c){var v=c[a],n=v.AuditApp,l=v.Initiator;g++;var p="";0<v.NetAddress.length&&(p=v.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));v.Event&&(n+=","+v.Event);null!=v.ExStr&&(n+=","+v.ExStr);""!=l&&""!=p&&(l+=",");d+="<tr id=xamtaudit"+a+" class=r3 onclick=showAuditDetails("+a+')><td class=r1 title="'+v.Time.toLocaleString()+'">&nbsp;&nbsp;'+v.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>&nbsp;&nbsp;"+v.Time.toLocaleTimeString("en",{hour:"2-digit",
minute:"2-digit",second:"2-digit"})+"<td class=r1>"+l+p+"<td class=r1>"+n}d+=TableEnd(0==g?"&nbsp;":"")+"<br>"}QH(50,d)}function auditFilter(){var b=Q("auditFilter").value.toLowerCase(),c;for(c in auditLog)QV("xamtaudit"+c,""==b||0<=JSON.stringify(auditLog[c]).toLowerCase().indexOf(b))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Registro de auditoria da Intel AMT",auditLog)}
function ClearAuditLog(b){QH(60,"Limpar log de auditoria?");setDialogMode(1,"Log de auditoria",3,ClearAuditLogEx)}function ClearAuditLogEx(){var b=amtstack.AMT_AuditLog_SetAuditLock(1,0,b,function(){amtstack.AMT_AuditLog_ClearLog(function(){amtstack.AMT_AuditLog_SetAuditLock(0,2,b,function(){setTimeout(PullAuditLog,1E3)})})})}function ShowAuditLogSettings(){xxdialogMode||amtstack.AMT_AuditLog_RequestStateChange(2,0,AuditLogSettingsCompleted)}
function AuditLogSettingsCompleted(b,c,a,d){200==d?PullAuditLog():messagebox("Log de auditoria","Erro: "+d)}
2022-03-23 21:00:41 +03:00
function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="<div style=text-align:left>"+addHtmlValue("Tempo",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Iniciador",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Endere\u00e7o",a.NetAddress));d+=addHtmlValue("Inscri\u00e7\u00e3o",a.AuditApp);d+=addHtmlValue("Evento",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Dados estendidos",a.ExStr);else if(0<a.Ex.length){var g="";for(c in a.Ex)0<g.length&&(g+=","),g+=a.Ex.charCodeAt(c);
""!=g&&(d+=addHtmlValue("Valores de dados",g));2<a.Ex.length&&ReadShort(a.Ex,0)==a.Ex.length-2&&(d+=addHtmlValue("Data String",a.Ex.substring(2)))}messagebox("Evento de auditoria #"+(b+1)+" Detalhes",d+"</div>")}}var xxCertificates=null,xxCertPrivateKeys=null,xxTlsSettings=null,xxTlsCurrentCert=null,xxTLSCredentialContext=null,xxCaPrivateKey=null,xxCaSubjectAttributes=null;
function PullCertificates(){amtstack.BatchEnum(null,["AMT_PublicKeyCertificate","AMT_PublicPrivateKeyPair","AMT_TLSSettingData","AMT_TLSCredentialContext"],processCerts1)}
2022-03-23 21:00:41 +03:00
function processCerts1(b,c,a,d){if(400!=d&&!errcheck(d,b)){QV("go16",!0);xxCertificates=a.AMT_PublicKeyCertificate.responses;xxCertPrivateKeys=a.AMT_PublicPrivateKeyPair.responses;xxTlsSettings=a.AMT_TLSSettingData.responses;xxTLSCredentialContext=a.AMT_TLSCredentialContext.responses;xxTlsCurrentCert=null;if(0<xxTLSCredentialContext.length){b=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value;for(var g in xxCertificates)xxCertificates[g].InstanceID==b&&(xxTlsCurrentCert=
g)}for(g in xxCertificates)xxCertificates[g].TrustedRootCertficate=1==xxCertificates[g].TrustedRootCertficate,xxCertificates[g].X509Certificate=window.atob(xxCertificates[g].X509Certificate),xxCertificates[g].XIssuer=parseCertName(xxCertificates[g].Issuer),xxCertificates[g].XSubject=parseCertName(xxCertificates[g].Subject);amtcert_linkCertPrivateKey(xxCertificates,xxCertPrivateKeys);updateCertificates()}}
function parseCertName(b){var c={},a=b.split(","),d;for(d in a)b=a[d].indexOf("="),c[a[d].substring(0,b)]=a[d].substring(b+1);return c}
function getTlsSecurityState(b){if(0==xxTlsSettings[b].Enabled)return"Desativado";var c=(1==xxTlsSettings[b].MutualAuthentication?"TLS de autentica\u00e7\u00e3o m\u00fatua":"TLS de autentica\u00e7\u00e3o do servidor")+(1==xxTlsSettings[b].AcceptNonSecureConnections?" e n\u00e3o TLS":"");1==xxTlsSettings[b].MutualAuthentication&&xxTlsSettings[b].TrustedCN&&(b=MakeToArray(xxTlsSettings[b].TrustedCN),0<b.length&&(c+=", "+(1<b.length?"Trusted names":"Trusted name")+": "+b.join(", ")+"."));return c}
function updateCertificates(){if(null!=xxCertificates){var b="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,c=1-b,a=TableStart(),a=a+TableEntry("Seguran\u00e7a TLS remota",addLinkConditional(getTlsSecurityState(c),"showSetTlsSecurityDlg()",xxAccountAdminName)),a=a+TableEntry("Seguran\u00e7a TLS local",addLinkConditional(getTlsSecurityState(b),"showSetTlsSecurityDlg()",xxAccountAdminName)),a=a+TableEnd(),a=a+("<br>"+TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Gerenciar certificados Intel&reg; AMT para este computador.<br><br>");
if(0==xxCertificates.length&&0==xxCertPrivateKeys.length)a+="<div style=padding-left:15px><br><i>Nenhum certificado encontrado.</i></div><br>";else{for(var d in xxCertificates)b="",xxCertificates[d].TrustedRootCertficate&&(b="Raiz confi\u00e1vel"),xxCertificates[d].XPrivateKey&&(b=", Chave privada"),d==xxTlsCurrentCert&&(b+=", Certificado TLS"),a+="<div class=itemBar onclick=showCertDetails("+d+")><div style=padding-top:3px><b>"+EscapeHtml(xxCertificates[d].XSubject.CN)+"</b><i>"+b+"</i></div></div>";
for(d in xxCertPrivateKeys)xxCertPrivateKeys[d].XCert||(a+="<div class=itemBar onclick=showKeyPairDetails("+d+")><div style=padding-top:3px><i>Par de chaves privadas n\u00e3o atribu\u00eddas #"+d+"</i></div></div>")}d=AddRefreshButton("PullCertificates()");xxAccountAdminName&&(d+=AddButton("Adicionar certificado ...","addCertButton()")+AddButton("Emitir certificado ...","issueCertButton()"));a+="<br><td class=r1>"+TableEnd(d);QH(51,a)}}
function showKeyPairDetails(b){setDialogMode(11,"Par de chaves #"+b,5,function(c){2==c&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertPrivateKeys[b].InstanceID},PullCertificates,0,1)},"Este \u00e9 um par de chaves de certificado p\u00fablico / privado que n\u00e3o pertence a nenhum certificado. Esta entrada deve ser tempor\u00e1ria.")}
var xxCertSubjectNames={CN:"Nome comum",O:"Organiza\u00e7\u00e3o",OU:"Unidade organizacional",S:"Estado / Prov\u00edncia",ST:"Estado / Prov\u00edncia",L:"Localidade",C:"Pa\u00eds",SN:"Sobrenome",GN:"Nome dado"};
function showCertDetails(b){if(!xxdialogMode){var c=xxCertificates[b],a;a="<br>"+addHtmlValue("Certificado",c.X509Certificate.length+" bytes,<a style=cursor:pointer;color:blue onclick=downloadCert("+b+")>Baixar</a>");a+=addHtmlValue("Raiz confi\u00e1vel",c.TrustedRootCertficate?"sim":"N\u00e3o");0==c.TrustedRootCertficate&&c.XPrivateKey&&(a+=addHtmlValue("Chave privada","Presente"));a+='<br><div style="border-bottom:1px solid gray"><i>Assunto do certificado</i></div><br>';for(var d in c.XSubject)c.XSubject[d]&&
(a+=addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XSubject[d])));a+='<br><div style="border-bottom:1px solid gray"><i>Certificado do emissor</i></div><br>';for(d in c.XIssuer)c.XIssuer[d]&&(a+=addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XIssuer[d])));setDialogMode(11,"Certificado -"+EscapeHtml(c.XSubject.CN),5,function(a){2==a&&(xxCertificates[b].XPrivateKey&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertificates[b].XPrivateKey.InstanceID},
function(){},0,1),amtstack.Delete("AMT_PublicKeyCertificate",xxCertificates[b],certificateRemoved,0,1))},a)}}function downloadCert(b){saveAs(data2blob(xxCertificates[b].X509Certificate),xxCertificates[b].XSubject.CN+".cer")}function cert_FileSelectHandler(b){haltEvent(b);1==b.dataTransfer.files.length&&(b.dataTransfer.files[0].name.toLowerCase().endsWith(".p12")?issueCertButton(b.dataTransfer.files):addCertButton(b.dataTransfer.files))}var xxDragDropCertFiles=null;
function addCertButton(b){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=b,b='<input id=certopen onchange=addCertButtonUpdate() type=file style=float:right;width:260px accept=".cer,.pem">',xxDragDropCertFiles&&(b='<input style=float:right;width:260px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),b="<div style=height:10px></div>"+("<div style=height:26px;margin-top:4px>"+b+"<div style=padding-top:4px>Arquivo de certificado</div></div>")+"<div style=height:26px;margin-top:4px><select id=certtype style=float:right;width:260px><option value=1>Certificado raiz confi\u00e1vel</option><option value=0>Certificado de cadeia</option></select><div style=padding-top:4px>Tipo de certificado</div></div>",
setDialogMode(11,"Adicionar certificado",3,addCertButtonOk,b),addCertButtonUpdate())}function addCertButtonUpdate(){var b=getInputElement("certopen");QE("c54",!b||1==b.files.length||2==Q("certoptype").value)}function addCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length&&(b=new FileReader,b.onload=addCertButtonOk2,b.readAsBinaryString(c[0]))}
function addCertButtonOk2(b){b=b.target.result;var c=b.indexOf("-----BEGIN CERTIFICATE-----");0<=c?(b=b.substring(c+27),c=b.indexOf("-----END CERTIFICATE-----"),0<=c&&(b=b.substring(0,c)),b=b.replace(/\r\n/g,"")):b=btoa(b);1==getSelectElement("certtype").value?amtstack.AMT_PublicKeyManagementService_AddTrustedRootCertificate(b,certificateAdded):amtstack.AMT_PublicKeyManagementService_AddCertificate(b,certificateAdded)}
function issueCertButton(b){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=b,b='<input id=certopen type=file style=float:right;width:230px onchange=issueCertButtonUpdate() accept=".p12">',xxDragDropCertFiles&&(b='<input style=float:right;width:230px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),b=""+("<div styleheight:26px;margin-top:14px>"+b+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certopenpass type=password autocomplete=off style=float:right;width:230px><div style=padding-top:4px>Senha do certificado</div></div>",
b+='<br><div style="border-bottom:1px solid gray"><i>Certificado Intel&reg; AMT</i></div>',b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certcn style=float:right;width:230px><div style=padding-top:4px>Nome comum</div></div>",b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certo style=float:right;width:230px><div style=padding-top:4px>Organiza\u00e7\u00e3o</div></div>",b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certst style=float:right;width:230px><div style=padding-top:4px>Estado / Prov\u00edncia</div></div>",
b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certc style=float:right;width:230px><div style=padding-top:4px>Pa\u00eds</div></div>",b+='<div>Usos do certificado</div><ul style="list-style-type:none;height:100px;overflow:auto;width:100%;border: 1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">',b+="<li><label><input type=checkbox id=d11_cu4 checked>Servidor TLS (HTTPS)</label></li>",b+="<li><label><input type=checkbox id=d11_cu5>Cliente TLS (HTTPS)</label></li>",
b+="<li><label><input type=checkbox id=d11_cu6>Prote\u00e7\u00e3o de Email</label></li>",b+="<li><label><input type=checkbox id=d11_cu7>Assinatura de c\u00f3digo</label></li>",b+="<li><label><input type=checkbox id=d11_cu8>Carimbo de hora</label></li>",b+="</ul>",setDialogMode(11,"Certificado de Emiss\u00e3o",3,issueCertButtonOk,b),issueCertButtonUpdate())}
function issueCertButtonUpdate(){var b=getInputElement("certopen");QE("certopenpass",!b||b&&1==b.files.length);var c=!b||2>b.files.length;1==(!b||b&&b.files.length)&&""==Q("certopenpass").value&&(c=!1);if(""==getInputElement("certcn").value||""==getInputElement("certo").value||""==getInputElement("certst").value||""==getInputElement("certc").value)c=!1;QE("c54",c)}
function issueCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length?(b=new FileReader,b.onload=issueCertButtonOk2,b.readAsBinaryString(c[0])):issueCertButtonOk3(null)}function issueCertButtonOk2(b){0==amtcert_loadP12File(b.target.result,Q("certopenpass").value,issueCertButtonOk3)&&messagebox("Certificado de Emiss\u00e3o","N\u00e3o foi poss\u00edvel descriptografar / decodificar o certificado.")}
function issueCertButtonOk3(b,c,a){xxCaPrivateKey=b;xxCaSubjectAttributes=c;amtstack.AMT_PublicKeyManagementService_GenerateKeyPair(0,2048,GenerateKeyPairResponse)}
function GenerateKeyPairResponse(b,c,a,d){200!=d?messagebox("Certificado de Emiss\u00e3o","Falha ao gerar o par de chaves. Estado: "+d):0!=a.Body.ReturnValue?messagebox("Certificado de Emiss\u00e3o","Falha ao gerar o par de chaves,"+a.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,a.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)}
function GenerateKeyPairResponse2(b,c,a,d,g){if(200!=d)messagebox("Certificado de Emiss\u00e3o","Falha ao gerar o par de chaves. Estado: "+d);else{b=null;for(var v in a)a[v].InstanceID==g&&(b=a[v].DERKey);a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};g={CN:"Certificado raiz n\u00e3o confi\u00e1vel"};if(null!=xxCaPrivateKey&&xxCaSubjectAttributes)for(v in g={},xxCaSubjectAttributes)g[xxCaSubjectAttributes[v].shortName]=
xxCaSubjectAttributes[v].value;v={name:"extKeyUsage"};Q("d11_cu4").checked&&(v.serverAuth=!0);Q("d11_cu5").checked&&(v.clientAuth=!0);Q("d11_cu6").checked&&(v.emailProtection=!0);Q("d11_cu7").checked&&(v.codeSigning=!0);Q("d11_cu8").checked&&(v.timeStamping=!0);v=amtcert_signWithCaKey(b,xxCaPrivateKey,a,g,v);null==v?messagebox("Certificado de Emiss\u00e3o","N\u00e3o foi poss\u00edvel assinar o certificado."):(v=forge.pki.certificateToPem(v).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(v.substring(27,
v.length-25),GenerateKeyPairResponse4))}}function GenerateKeyPairResponse4(b,c,a,d){200!=d?messagebox("Certificado de Emiss\u00e3o","Falha ao gerar o par de chaves. Estado: "+d):PullCertificates()}function certificateAdded(b,c,a,d){200!=d||0!=a.Body.ReturnValue?messagebox("Adicionar certificado","N\u00e3o foi poss\u00edvel adicionar o certificado, erro"+(200!=d?d:a.Body.ReturnValueStr)):PullCertificates()}
function certificateRemoved(b,c,a,d){200!=d?messagebox("Remover certificado","N\u00e3o foi poss\u00edvel remover o certificado, erro"+d):PullCertificates()}function getInputElement(b){var c=document.getElementsByTagName("input");for(t=0;t<c.length;t++)if(c[t].id==b)return c[t]}function getSelectElement(b){var c=document.getElementsByTagName("select");for(t=0;t<c.length;t++)if(c[t].id==b)return c[t]}
function showSetTlsSecurityDlg(b){if(!xxdialogMode){b="<div style=height:26px;margin-top:4px><select onchange=showSetTlsSecurityDlgUpdate() id=tlscert style=float:right;width:260px><option value=-1>Sem certificado, TLS desativado</option>";for(var c in xxCertificates)0!=xxCertificates[c].TrustedRootCertficate||!xxCertificates[c].XPrivateKey||null!=xxTlsCurrentCert&&xxTlsCurrentCert!=c||(b+="<option value="+c+">"+xxCertificates[c].XSubject.CN+"</option>");b+="</select><div style=padding-top:4px>Certificado</div></div><div style=height:26px;margin-top:4px><select id=tlsremote style=float:right;width:260px onchange=showSetTlsSecurityDlgUpdate()><option value=0>Server-auth TLS only</option><option value=1>Server-auth, non-TLS allowed</option>";
b+="<option value=2>Mutual-auth TLS only</option><option value=3>Mutual-auth, non-TLS allowed</option>";b+='</select><div style=padding-top:4px>Security</div></div><div style=height:26px id=d11rcn title="Lista separada por v\u00edrgulas de nomes comuns de certificados que ter\u00e3o permiss\u00e3o para se conectar remotamente."><input id=d11_rcn style=float:right;width:260px onkeyup=showSetTlsSecurityDlgUpdate() placeholder="nome1, nome2"><div style=padding-top:4px>CN remoto</div></div>';setDialogMode(11,
"Configura\u00e7\u00f5es TLS",3,showSetTlsSecurityDlgOk,b);if(0==xxTLSCredentialContext.length||0==xxTlsSettings[0].Enabled||0==xxTlsSettings[1].Enabled)getSelectElement("tlscert").value=-1;else for(c in b=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,xxCertificates)xxCertificates[c].InstanceID==b&&(getSelectElement("tlscert").value=c);c=1-("Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1);getSelectElement("tlsremote").value=(1==xxTlsSettings[c].MutualAuthentication?
2:0)+(1==xxTlsSettings[c].AcceptNonSecureConnections?1:0);xxTlsSettings[c].TrustedCN&&(Q("d11_rcn").value=MakeToArray(xxTlsSettings[c].TrustedCN).join(", "));showSetTlsSecurityDlgUpdate()}}function showSetTlsSecurityDlgUpdate(){var b=getSelectElement("tlscert").value;QE("tlsremote",-1!=b);QV("d11rcn",-1!=b&&1<getSelectElement("tlsremote").value);b=!0;1<getSelectElement("tlsremote").value&&!splitDomains(Q("d11_rcn").value)&&(b=!1);QE("c54",b)}var setTlsSecurityPendingCalls,setTlsSecurityDeleteCredentialContext;
function showSetTlsSecurityDlgOk(){var b=getSelectElement("tlscert").value,c=getSelectElement("tlsremote").value,a=Clone(xxTlsSettings);setTlsSecurityPendingCalls=0;setTlsSecurityDeleteCredentialContext=null;if(-1!=b){if(0<xxTLSCredentialContext.length){var d=Clone(xxTLSCredentialContext[0]);d.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value=xxCertificates[b].InstanceID;amtstack.Put("AMT_TLSCredentialContext",d,setTlsSecurityResponse,0,1)}else amtstack.Create("AMT_TLSCredentialContext",
{ElementInContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_PublicKeyCertificate")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+xxCertificates[b].InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",ElementProvidingContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_TLSProtocolEndpointCollection")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="ElementName">TLSProtocolEndpointInstances Collection</w:Selector></w:SelectorSet></a:ReferenceParameters>'},
2022-03-23 21:00:41 +03:00
setTlsSecurityResponse);setTlsSecurityPendingCalls++}else 0<xxTLSCredentialContext.length&&(setTlsSecurityDeleteCredentialContext=Clone(xxTLSCredentialContext[0]));var d="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,g=1-d;a[g].Enabled=-1!=b;a[g].MutualAuthentication=2<=c;a[g].AcceptNonSecureConnections=1==c%2;a[g].TrustedCN=splitDomains(Q("d11_rcn").value);a[d].Enabled=-1!=b;a[d].TrustedCN=splitDomains(Q("d11_rcn").value);2<=c&&(setTlsSecurityPendingCalls++,amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(a,
b,c,d){200!=d?messagebox("","Falha ao definir a hora, status ="+d):0!=c.Body.ReturnValue?messagebox("","Falha ao definir hora, erro: "+c.Body.ReturnValueStr):(a=Math.round((new Date).getTime()/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(c.Body.Ta0,a,a,function(){setTlsSecurityResponse()}))}));setTlsSecurityPendingCalls+=2;amtstack.Put("AMT_TLSSettingData",a[0],setTlsSecurityResponse,0,1,a[0]);amtstack.Put("AMT_TLSSettingData",a[1],setTlsSecurityResponse,0,1,a[1]);statusbox("Configura\u00e7\u00f5es TLS",
"Aplicando novas configura\u00e7\u00f5es de seguran\u00e7a ...")}function splitDomains(b){b=b.split(",");if(0!=b.length){for(var c in b)if(b[c]=b[c].trim(),0<=b[c].indexOf(" ")||0==b[c].length)return;if(!(4<b.length))return b}}
function setTlsSecurityResponse(b,c,a,d){if(b){if(200!=d){messagebox("","Falha ao definir a seguran\u00e7a TLS, status ="+d);return}if(a.Body.ReturnValueStr&&!methodcheck(a))return}0==--setTlsSecurityPendingCalls&&amtstack.AMT_SetupAndConfigurationService_CommitChanges(null,setTlsSecurityResponse2)}
function setTlsSecurityResponse2(b,c,a,d){200!=d?messagebox("","Falha ao definir a seguran\u00e7a TLS, status ="+d):0!=a.Body.ReturnValue?messagebox("","Falha ao definir a seguran\u00e7a TLS, erro: "+a.Body.ReturnValueStr):setTimeout(setTlsSecurityResponse3,2E3)}
function setTlsSecurityResponse3(){null!=setTlsSecurityDeleteCredentialContext&&amtstack.Delete("AMT_TLSCredentialContext",setTlsSecurityDeleteCredentialContext,function(){});PullCertificates();setDialogMode();amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}var xxWatchdog=null;
function PullWatchdog(){amtstack.BatchEnum(null,["*AMT_AgentPresenceCapabilities","AMT_AgentPresenceWatchdog","AMT_AgentPresenceWatchdogAction","AMT_StateTransitionCondition","CIM_ConcreteDependency"],PullWatchdogResponse)}
2022-03-23 21:00:41 +03:00
function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabilities.status){xxWatchdog=a;for(var g in xxWatchdog.CIM_ConcreteDependency.responses)b=xxWatchdog.CIM_ConcreteDependency.responses[g],(c=getItem(b.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","CreationClassName"))&&"AMT_AgentPresenceWatchdog"==c.Value&&(d=getItem(b.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value,a=getItem(b.Dependent.ReferenceParameters.SelectorSet.Selector,
"@Name","PolicyConditionName").Value,d=getItem(xxWatchdog.AMT_AgentPresenceWatchdog.responses,"DeviceID",d),a=getItem(xxWatchdog.AMT_StateTransitionCondition.responses,"PolicyConditionName",a),d.transitions||(d.transitions=[]),d.transitions.push(a)),c&&"AMT_StateTransitionCondition"==c.Value&&(a=getItem(b.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyConditionName").Value,b=getItem(b.Dependent.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyActionName").Value,a=getItem(xxWatchdog.AMT_StateTransitionCondition.responses,
"PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Desconhecido;De outros;ativado;Desativado;Desligando;N\u00e3o aplic\u00e1vel;Ativado, mas offline;Em teste;Diferido;Quiesce;Iniciando".split(";"),watchdogMonitoredEntity="Desconhecido;De outros;Sistema operacional;Processo de inicializa\u00e7\u00e3o do sistema operacional;Processo de desligamento do sistema operacional;Processo de inicializa\u00e7\u00e3o do firmware;Processo de inicializa\u00e7\u00e3o do BIOS;Inscri\u00e7\u00e3o;Processador de servi\u00e7o".split(";");
function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("C\u00e3es de guarda m\u00e1ximos",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" assistir cachorros");b+=TableEntry("Total de a\u00e7\u00f5es m\u00e1ximas",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" a\u00e7\u00f5es");b+=TableEnd()+"<br>";b+=TableStart2();b+="<tr><td class=r1 style=padding-left:15px><br>Gerenciar os c\u00e3es de guarda de presen\u00e7a do agente Intel&reg; AMT.<br><br>";
if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="<div style=padding-left:15px><i>Nenhum c\u00e3o de guarda de presen\u00e7a do agente encontrado.</i></div><br>";else for(var c in xxWatchdog.AMT_AgentPresenceWatchdog.responses){var a=xxWatchdog.AMT_AgentPresenceWatchdog.responses[c],d=guidToStr(rstr2hex(atob(a.DeviceID)));a.MonitoredEntityDescription&&""!=a.MonitoredEntityDescription&&(d=EscapeHtml(a.MonitoredEntityDescription));
b+="<div class=itemBar onclick=showWatchdogDetails("+c+')><input type=button style=float:right value="Adicionar a\u00e7\u00e3o ..." onclick=addWatchdogAction(event,'+c+")>";a.transitions&&(b+='<input type=button style=float:right value="Excluir a\u00e7\u00f5es ..." onclick=deleteWatchdogActions(event,'+c+")>");b+="<div style=padding-top:3px><b>"+d+"</b>, "+amtstack.WatchdogCurrentStates[a.CurrentState]+"</div>";var d="",g;for(g in a.transitions){var v=a.transitions[g];""!=d&&(d+="<br>");d+=getWatchdogTransitionStr(v.OldState)+
" &rarr; "+getWatchdogTransitionStr(v.NewState);v.actions&&1==v.actions[0].EventOnTransition&&(d+=" : Evento a ser registrado")}""!=d&&(b+="<div style=padding:12px>"+d+"</div>");b+="</div>"}b=b+"<br>"+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Adicionar c\u00e3o de guarda ...","AddWatchdog()"));b+="<br>";QH(54,b)}}
function getWatchdogTransitionStr(b){if(31==b)return"Qualquer Estado";var c="",a;for(a in amtstack.WatchdogCurrentStates)0!=(b&a)&&(c+=", "+amtstack.WatchdogCurrentStates[a]);return c.substring(2)}
function showWatchdogDetails(b){b=xxWatchdog.AMT_AgentPresenceWatchdog.responses[b];var c="";b.MonitoredEntityDescription&&""!=b.MonitoredEntityDescription&&(c+=addHtmlValue("Descri\u00e7\u00e3o",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Entidade monitorada",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Estado atual",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Estado ativado",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Intervalo de inicializa\u00e7\u00e3o",
b.StartupInterval+" segundo (s)");c+=addHtmlValue("Intervalo de tempo limite",b.TimeoutInterval+" segundo (s)");setDialogMode(11,format("C\u00e3o de guarda {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)}
function AddWatchdog(){var b;b="<div style=height:26px;margin-top:4px><input id=wgname style=float:right;width:240px maxlength=16 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Nome</div></div>"+('<div style=height:26px;margin-top:4px><input id=wgguid style=float:right;width:240px maxlength=36 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px title="Gere DeviceID aleat\u00f3rio">'+addLink("ID de dispositivo","GenerateWatchdogGuid()")+"</div></div>");b+="<div style=height:26px;margin-top:4px><input id=wgstart style=float:right;width:240px maxlength=8 placeholder=3600 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Inicializa\u00e7\u00e3o (segundos)</div></div>";
b+="<div style=height:26px;margin-top:4px><input id=wgtimeout style=float:right;width:240px maxlength=8 placeholder=60 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Tempo limite (segundos)</div></div>";setDialogMode(11,"Adicionar c\u00e3o de guarda",3,AddWatchdogOk,b);AddWatchdogUpdate()}function GenerateWatchdogGuid(){var b,c="";for(b=0;16>b;b++)c+=String.fromCharCode(random(255));Q("wgguid").value=guidToStr(rstr2hex(c));AddWatchdogUpdate()}
2022-03-23 21:00:41 +03:00
function AddWatchdogUpdate(){for(var b=(""==Q("wgstart").value||0<parseInt(Q("wgstart").value))&&(""==Q("wgtimeout").value||0<parseInt(Q("wgtimeout").value)),c=0,a=Q("wgguid").value.toLowerCase(),d=0;d<a.length;d++){var g=a.charCodeAt(d);45!=g&&(48<=g&&57>=g||97<=g&&102>=g?c++:b=!1)}32!=c&&(b=!1);QE("dlgOkButton",b)}
function AddWatchdogOk(){var b=Q("wgtimeout").value,c=Q("wgstart").value;""==b&&(b=60);""==c&&(c=3600);b={CreationClassName:0,DeviceID:btoa(hex2rstr(guidToStr(Q("wgguid").value.replace(/-/g,"")).replace(/-/g,""))),StartupInterval:c,SystemCreationClassName:0,SystemName:0,TimeoutInterval:b,MonitoredEntityDescription:Q("wgname").value};amtstack.Create("AMT_AgentPresenceWatchdog",b,AddWatchdogOk2)}
function AddWatchdogOk2(b,c,a,d){200!=d?messagebox("C\u00e3o de guarda","N\u00e3o foi poss\u00edvel adicionar o watchdog, erro #"+d):PullWatchdog()}
function addWatchdogAction(b,c){var a=xxWatchdog.AMT_AgentPresenceWatchdog.responses[c],d;d="<table><td style=width:180px>De<br>";for(c in amtstack.WatchdogCurrentStates)d+="<input id=wgsa"+c+" type=checkbox onclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[c]+"<br />";d+="<td>Para<br>";for(c in amtstack.WatchdogCurrentStates)d+="<input id=wgsb"+c+" type=checkbox onclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[c]+"<br />";setDialogMode(11,"Adicionar a\u00e7\u00e3o Watchdog",
3,addWatchdogActionOk,d+"</table><br>Executar a a\u00e7\u00e3o<br><input id=wgsevent type=checkbox checked onclick=addWatchdogActionUpdate()>Gravar no log de eventos<br />",a);addWatchdogActionUpdate();haltEvent(b)}function addWatchdogActionUpdate(){var b=0,c=0,a;for(a in amtstack.WatchdogCurrentStates)1==Q("wgsa"+a).checked&&(b+=parseInt(a)),1==Q("wgsb"+a).checked&&(c+=parseInt(a));QE("dlgOkButton",0<b&&0<c&&1==Q("wgsevent").checked)}
2022-03-23 21:00:41 +03:00
function addWatchdogActionOk(b,c){var a=0,d=0,g;for(g in amtstack.WatchdogCurrentStates)1==Q("wgsa"+g).checked&&(a+=parseInt(g)),1==Q("wgsb"+g).checked&&(d+=parseInt(g));amtstack.AMT_AgentPresenceWatchdog_AddAction(a,d,Q("wgsevent").checked,null,null,AddWatchdogActionResponse,null,0,{DeviceID:c.DeviceID})}function AddWatchdogActionResponse(b,c,a,d){200!=d?messagebox("A\u00e7\u00e3o de Watchdog","N\u00e3o foi poss\u00edvel adicionar a a\u00e7\u00e3o do watchdog, erro #"+d):PullWatchdog()}
function deleteWatchdogActions(b,c){setDialogMode(11,"Excluir a\u00e7\u00f5es do Watchdog",3,deleteWatchdogActionsOk,"Excluir todas as a\u00e7\u00f5es deste watchdog?",xxWatchdog.AMT_AgentPresenceWatchdog.responses[c]);haltEvent(b)}function deleteWatchdogActionsOk(b,c){amtstack.AMT_AgentPresenceWatchdog_DeleteAllActions(deleteWatchdogActionResponse,null,0,{DeviceID:c.DeviceID})}
function deleteWatchdogActionResponse(b,c,a,d){200!=d?messagebox("A\u00e7\u00e3o de Watchdog","N\u00e3o foi poss\u00edvel remover as a\u00e7\u00f5es do watchdog, erro #"+d):PullWatchdog()}
var xxSystemDefense=null,xxSystemDefenceLinkedPolicy={},xxUpdatingDefenseStats=!1,xxFilterStatistics=[{},{}],xxFilterStatisticsTimer=null,xxFilterStatisticsTimerActive=!1,xxSystemDefenceFilterEthernetTypes={2048:"Todos os pacotes IP",2054:"Todos os pacotes ARP"},xxSystemDefenceFilterIPTypes={4:"IPv4",6:"IPv6"},xxSystemDefenceFilterDesc={0:"Permitir, Contar",1:"Drop, Count",2:"Taxa limite",3:"Permitir",4:"Solta"},xxSystemDefenceFilters={HdrProtocolID:1,HdrDestAddress:2,HdrDestMask:2,HdrSrcAddress:2,
HdrSrcMask:2,HdrSrcPortStart:1,HdrSrcPortEnd:1,HdrDestPortStart:1,HdrDestPortEnd:1,HdrSrcAddressEndOfRange:2,"HdrDestAddressEndOfRange ":2,TCPFlagsOn:3,TCPFlagsOff:3};function PullSystemDefense(){amtFirstPull|=4;amtstack.BatchEnum(null,["AMT_SystemDefensePolicy","AMT_NetworkPortSystemDefensePolicy","AMT_Hdr8021Filter","AMT_IPHeadersFilter","AMT_NetworkFilter"],PullSystemDefenseResponse)}
function PullSystemDefenseResponse(b,c,a,d){200==d&&(xxSystemDefense=a,updateSystemDefense(),QV("go18",!0),urlvars.norefresh&&UpdateDefenseStats())}
function updateSystemDefense(){if(null!=xxSystemDefense){var b="";xxSystemDefenceLinkedPolicy={};for(var c in xxSystemDefense.AMT_NetworkPortSystemDefensePolicy.responses){var a=xxSystemDefense.AMT_NetworkPortSystemDefensePolicy.responses[c],d=+getItem(a.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value.substring(27),a=getItem(xxSystemDefense.AMT_SystemDefensePolicy.responses,"InstanceID",a.Dependent.ReferenceParameters.SelectorSet.Selector.Value);xxSystemDefenceLinkedPolicy[d]=
2022-03-23 21:00:41 +03:00
a}b+=TableStart();c="<i>Nenhum</i>";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemDefenceLinkedPolicy[0].PolicyName);b+=TableEntry("Pol\u00edtica com fio padr\u00e3o",addLink(c,"changeDefaultPolicy(0)"));for(c=0;2>c;c++){var a=xxFilterStatistics[c],g;for(g in a)d=a[g],d=1==d?d+" pacote":d+" pacotes",b+=TableEntry((0==c?"Com fio":"Sem fio")+g,d)}b+=TableEnd();b=b+"<br>"+TableStart2();b+="<tr><td class=r1 style=padding-left:15px;border:0><br>Gerenciar pol\u00edticas de defesa do sistema Intel&reg; AMT.<br><br>";
if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+="<div style=padding-left:15px><i>Nenhuma pol\u00edtica de defesa do sistema encontrada.</i></div><br>";else for(c in xxSystemDefense.AMT_SystemDefensePolicy.responses)a=xxSystemDefense.AMT_SystemDefensePolicy.responses[c],d="",a.FilterCreationHandles&&(a.FilterCreationHandles=MakeToArray(a.FilterCreationHandles),d=a.FilterCreationHandles.length,d=", "+d+" filter"+(1<d?"s":"")),b+="<div class=itemBar onclick=showPolicyDetails("+c+")><div style=padding-top:3px><b>"+
EscapeHtml(a.PolicyName)+"</b>"+d+"</div></div>";b+="<tr><td class=r1 style=padding-left:15px><br>Gerenciar filtros de defesa do sistema Intel&reg; AMT.<br><br>";if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="<div style=padding-left:15px><i>Nenhum filtro de defesa do sistema encontrado.</i></div><br>";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||
(d="All Ethernet Protocol"+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" \u00e0s"+a.FilterProfileData+" pacote / s"),1==a.ActionEventOnMatch&&(d+=", Evento em jogo"),b+="<div class=itemBar onclick=showFilterDetails(0,"+c+")><div style=padding-top:3px><b>"+(0==a.FilterDirection?"&#8592; ":"&#8594; ")+EscapeHtml(a.Name)+"</b>, "+d+"</div></div>";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];
(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="All Ethernet Protocol"+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==a.FilterProfile&&(d+=" \u00e0s"+a.FilterProfileData+" pacote / s");1==a.ActionEventOnMatch&&(d+=", Evento em jogo");var v=0;for(g in xxSystemDefenceFilters)a[g]&&v++;0<v&&(d+=", "+v+" filter"+(1<v?"s":""));b+="<div class=itemBar onclick=showFilterDetails(1,"+c+")><div style=padding-top:3px><b>"+(0==a.FilterDirection?"&#8592; ":"&#8594; ")+EscapeHtml(a.Name)+
"</b>, "+d+"</div></div>"}}b+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Adicionar filtro ...","AddDefenseFilter()")+AddButton("Adicionar pol\u00edtica ...","AddDefensePolicy()"));QH(53,b);null==xxFilterStatisticsTimer&&(xxFilterStatisticsTimerActive=!1,urlvars.norefresh||(UpdateDefenseStats(),xxFilterStatisticsTimer=setInterval(UpdateDefenseStats,5E3)))}}
function StopDefenseStatsTimer(){null!=xxFilterStatisticsTimer&&(clearInterval(xxFilterStatisticsTimer),xxFilterStatisticsTimer=null);xxFilterStatisticsTimerActive=!1}
function UpdateDefenseStats(b){if(b||1!=xxFilterStatisticsTimerActive)xxFilterStatisticsTimerActive=!0,b=b?b:0,xxSystemDefenceLinkedPolicy[b]?amtstack.AMT_SystemDefensePolicy_UpdateStatistics('<a:Address></a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</w:ResourceURI><w:SelectorSet><w:Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+b+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}):
2022-03-23 21:00:41 +03:00
(xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()}
function UpdateDefenseStats3(b,c,a,d,g){b=0;if(200==d){xxFilterStatistics[g]={};for(var v in a)d=a[v].ReadCount,c=getItem(a[v].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()}
function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="<div style=height:26px;margin-top:4px><select id=policySelection style=float:right;width:266px><option value=-1>Nenhum";for(var a in xxSystemDefense.AMT_SystemDefensePolicy.responses)c+="<option value="+a+(xxSystemDefenceLinkedPolicy[b]&&xxSystemDefense.AMT_SystemDefensePolicy.responses[a].InstanceID==xxSystemDefenceLinkedPolicy[b].InstanceID?" selected":"")+">"+xxSystemDefense.AMT_SystemDefensePolicy.responses[a].PolicyName;setDialogMode(11,
"Pol\u00edtica de Defesa do Sistema Padr\u00e3o",3,changeDefaultPolicyOk,c+"</select><div style=padding-top:4px>Pol\u00edtica padr\u00e3o</div></div>",b)}}
function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'<w:SelectorSet><w:Selector Name="Antecedent"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">CIM_EthernetPort</w:Selector><w:Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+c+
'</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector><w:Selector Name="Dependent"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemDefensePolicy</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+
d.InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector></w:SelectorSet>",-1==a?PullSystemDefense:function(){});0<=a&&amtstack.Create("AMT_NetworkPortSystemDefensePolicy",{Antecedent:'<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_EthernetPort</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="DeviceID">Porta Ethernet Intel (r) AMT '+
c+"</Selector></SelectorSet></ReferenceParameters>",Dependent:'<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://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemDefensePolicy</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">'+
xxSystemDefense.AMT_SystemDefensePolicy.responses[a].InstanceID+"</Selector></SelectorSet></ReferenceParameters>"},changeDefaultPolicyOk2)}function changeDefaultPolicyOk2(b,c,a,d){200!=d?messagebox("Pol\u00edtica de Defesa do Sistema Padr\u00e3o","N\u00e3o foi poss\u00edvel definir a pol\u00edtica, erro"+d):PullSystemDefense()}
function AddDefenseFilter(){if(!xxdialogMode){var b;b="<div style=height:26px;margin-top:4px><input id=filtername style=float:right;width:260px maxlength=16 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Nome</div></div><div style=height:26px;margin-top:4px><select id=filtertype style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Filtro de pacotes IP Ethernet<option value=1>Filtro de pacotes Ethernet ARP<option value=2>Filtro de pacotes IPv4<option value=3>Filtro de pacotes IPv6</select><div style=padding-top:4px>Tipo</div></div>";b+=
'<div style=height:26px;margin-top:4px id=ipfilterdiv><input id=ipfilter style=float:right;width:260px placeholder="Regras opcionais" onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Regras de Correspond\u00eancia</div></div>';b+="<div style=height:26px;margin-top:4px><select id=filterdir style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Sa\u00edda / transmiss\u00e3o<option value=1>Entrada / Recebimento</select><div style=padding-top:4px>Dire\u00e7\u00e3o</div></div>";
b+="<div style=height:26px;margin-top:4px><select id=filterprofile style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Permitir, Contar<option value=1>Drop, Count<option value=2>Taxa limite<option value=3>Permitir<option value=4>Solta</select><div style=padding-top:4px>A\u00e7ao</div></div>";b+="<div style=height:26px;margin-top:4px id=filterdatadiv><input id=filterdata style=float:right;width:260px maxlength=8 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Pacotes / segundo</div></div>";
b+="<div style=height:26px;margin-top:4px><select id=filteraction style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=false>Fazer nada<option value=1>Evento em jogo</select><div style=padding-top:4px>Registro de Eventos</div></div>";setDialogMode(11,"Adicionar filtro de defesa do sistema",3,AddDefenseFilterOk,b);AddDefenseFilterUpdate()}}
function AddDefenseFilterOk(){if(1>=Q("filtertype").value){var b=0==Q("filtertype").value?2048:2054,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrProtocolID8021:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value};2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_Hdr8021Filter",c,AddDefenseFilterOk2)}else{var b=2==Q("filtertype").value?
4:6,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrIPVersion:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value},a=Q("ipfilter").value.split(","),d;for(d in a){var g=a[d].indexOf("="),v=a[d].substring(0,g),g=a[d].substring(g+1),n=xxSystemDefenceFilters[v];n||(v="Hdr"+v,n=xxSystemDefenceFilters[v]);n&&(2==n&&4==b?(g=g.split("."),4==g.length&&(c[v]=rstr2hex(String.fromCharCode(parseInt(g[0]),
parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):c[v]=g)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0<Q("filtername").value.length;b&&2==Q("filterprofile").value&&(b=parseInt(Q("filterdata").value),b=0<b&&4294967295>b);QE("c54",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)}
function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Adicionar filtro de defesa do sistema","N\u00e3o foi poss\u00edvel adicionar o filtro, erro #"+d):PullSystemDefense()}
function showFilterDetails(b,c){if(!xxdialogMode){var a,d,g,v;0==b?(v="AMT_Hdr8021Filter",g="Tr\u00e1fego Ethernet",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol"+d.HdrProtocolID8021)):(v="AMT_IPHeadersFilter",g="Tr\u00e1fego IP",d=xxSystemDefense[v].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="Todo o protocolo IP"+d.HdrIPVersion));var n;n=""+addHtmlValue("Nome",EscapeHtml(d.Name));n+=addHtmlValue("Tipo",
g);n+=addHtmlValue("Tr\u00e1fego correspondente",a);n+=addHtmlValue("Dire\u00e7\u00e3o",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var l in xxSystemDefenceFilters)d[l]&&(a=l,g=d[l],b=xxSystemDefenceFilters[l],2==b&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filtro"+a,g));n+=addHtmlValue("Evento em jogo",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,
"Filtro Ethernet #"+d.InstanceID,5,showFilterDetailsOk,n,[v,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remover filtro","N\u00e3o foi poss\u00edvel remover o filtro, verifique se ele n\u00e3o est\u00e1 em uso."):PullSystemDefense()}var xxAddDefensePolicyFilters;
function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='<div style=height:26px;margin-top:4px><input id=policyname title="<policy name>:<policy precedence number>" style=float:right;width:260px maxlength=16 onkeyup=AddDefensePolicyUpdate()><div style=padding-top:4px>Nome</div></div><div style=height:26px;margin-top:4px><select id=policytx title="A\u00e7\u00e3o padr\u00e3o a ser tomada para o tr\u00e1fego de sa\u00edda" style=float:right;width:133px><option value=0>Allow<option value=1>Solta<option value=2>Permitir, Contar<option value=3>Drop, Count<option value=4>Permitir, Contar, Evento<option value=5>Drop, Count, Evento</select><select id=policyrx style=float:right;width:133px title="A\u00e7\u00e3o padr\u00e3o a ser tomada para o tr\u00e1fego de entrada"><option value=0>Permitir<option value=1>Solta<option value=2>Permitir, Contar<option value=3>Drop, Count<option value=4>Permitir, Contar, Evento<option value=5>Drop, Count, Evento</select><div style=padding-top:4px>TX / RX padr\u00e3o</div></div>';b+=
"<div id=policyFilters></div>";if(0<xxSystemDefense.AMT_Hdr8021Filter.responses.length||0<xxSystemDefense.AMT_IPHeadersFilter.responses.length){b+="<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>";for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];b+="<option value="+a.InstanceID+">"+a.Name}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],
b+="<option value="+a.InstanceID+">"+a.Name;b+="</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>Adicionar filtro</div></div>"}setDialogMode(11,"Adicionar diretiva de defesa do sistema",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())}
function removeFilterButton(b){xxAddDefensePolicyFilters.splice(b,1);AddDefensePolicyUpdate()}
function AddDefensePolicyUpdate(){var b=0<Q("policyname").value.split(":")[0].length;QE("c54",b);if(0==xxAddDefensePolicyFilters.length)QH("policyFilters","<br><i>Esta pol\u00edtica n\u00e3o cont\u00e9m filtros.</i><br><br>");else{var b="",c;for(c in xxAddDefensePolicyFilters)b+="<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Retirar","removeFilterButton("+c+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden><b>"+GetFilterById(xxAddDefensePolicyFilters[c]).Name+
"</b></div></div>";QH("policyFilters",b)}}function GetFilterById(b){for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];if(a.InstanceID==b)return a}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)if(a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],a.InstanceID==b)return a}
function AddDefensePolicyOk(){var b=Q("policytx").value,c=Q("policyrx").value,a=0,d=Q("policyname").value.split(":");2==d.length&&(a=parseInt(d[1]));b={"InstanceID ":0,PolicyName:d[0],PolicyPrecedence:a,TxDefaultCount:1<b,TxDefaultDrop:1==b%2,TxDefaultMatchEvent:3<b,RxDefaultCount:1<c,RxDefaultDrop:1==c%2,RxDefaultMatchEvent:3<c};0<xxAddDefensePolicyFilters.length&&(b.FilterCreationHandles=xxAddDefensePolicyFilters);amtstack.Create("AMT_SystemDefensePolicy",b,AddDefensePolicyOk2)}
function AddDefensePolicyOk2(b,c,a,d){200!=d?messagebox("Adicionar diretiva de defesa do sistema","N\u00e3o foi poss\u00edvel adicionar a pol\u00edtica, erro #"+d):PullSystemDefense()}
function showPolicyDetails(b){if(!xxdialogMode){var c=xxSystemDefense.AMT_SystemDefensePolicy.responses[b],a;a=""+addHtmlValue("Nome",EscapeHtml(c.PolicyName));0!=c.PolicyPrecedence&&(a+=addHtmlValue("Preced\u00eancia",c.PolicyPrecedence));var d=1==c.TxDefaultDrop?"Solta":"Permitir";1==c.TxDefaultCount&&(d+=", Contagem");1==c.TxDefaultMatchEvent&&(d+=", Evento");a+=addHtmlValue("A\u00e7\u00e3o TX padr\u00e3o",d);d=1==c.RxDefaultDrop?"Drop":"Allow";1==c.RxDefaultCount&&(d+=", Count");1==c.RxDefaultMatchEvent&&
(d+=", Event");a+=addHtmlValue("A\u00e7\u00e3o RX padr\u00e3o",d);if(c.FilterCreationHandles)for(b in c.FilterCreationHandles)a+=addHtmlValue("N\u00ba do filtro"+(+b+1),GetFilterById(c.FilterCreationHandles[b]).Name);setDialogMode(11,format("Pol\u00edtica #",c.InstanceID.substring(20)),5,showPolicyDetailsOk,a,c)}}function showPolicyDetailsOk(b,c){2==b&&amtstack.Delete("AMT_SystemDefensePolicy",c,deleteDefensePolicy)}
function deleteDefensePolicy(b,c,a,d){200!=d?messagebox("Remover pol\u00edtica","N\u00e3o foi poss\u00edvel remover a pol\u00edtica, verifique se ela n\u00e3o est\u00e1 em uso."):PullSystemDefense()}var xxWireless;function PullWireless(){amtFirstPull|=2;-1!=amtwirelessif&&amtstack.BatchEnum("","*CIM_WiFiPortCapabilities *CIM_WiFiPort *CIM_WiFiEndpoint CIM_WiFiEndpointSettings *AMT_WiFiPortConfigurationService *AMT_BootCapabilities".split(" "),processWireless)}
function wifiRefresh(){xxdialogMode||PullWireless()}var xxWifiState={3:"Desativado",32768:"Ativado em S0",32769:"Habilitado em S0, Sx / AC"},xxRadioState={2:"Ligado, conectado",3:"Fora",6:"Ativado, Desconectado"},xxWifiAuthenticationMethod={1:"De outros",2:"Aberto",3:"Chave compartilhada",4:"WPA PSK",5:"WPA IEEE 802.1x",6:"WPA2 PSK",7:"WPA2 IEEE 802.1x",32768:"WPA3 SAE"},xxWifiEncryptionMethod={1:"De outros",2:"WEP",3:"TKIP-RC4",4:"CCMP-AES",5:"Nenhum"};
function processWireless(b,c,a,d){xxWireless=200==d?a:void 0;updateSystemStatus();showWirelessInfo()}
2022-03-23 21:00:41 +03:00
function showWirelessInfo(){if(xxWireless){var b,c,a="",d,g;if(xxWireless.CIM_WiFiPortCapabilities.response){g="<br><h2>Perfis sem fio</h2>"+TableStart2();g+="<tr><td class=r2 style=padding-left:15px><br>Perfis sem fio que o Intel&reg; AMT usar\u00e1 para conectividade de rede.<br><br>";for(b=a=0;256>b;b++)for(c in xxWireless.CIM_WiFiEndpointSettings.responses)d=xxWireless.CIM_WiFiEndpointSettings.responses[c],1!=d.AuthenticationMethod&&d.Priority==b&&(g+="<div class=itemBar onclick=showWifiDetails("+
c+")><div style=float:right>"+EscapeHtml(d.SSID)+", "+xxWifiAuthenticationMethod[d.AuthenticationMethod]+", "+xxWifiEncryptionMethod[d.EncryptionMethod]+" &nbsp; ",xxAccountAdminName&&(g+=AddButton2("Retirar",'wifiRemoveButton("'+c+'")')),g+="</div><div style=padding-top:3px><b>"+EscapeHtml(d.ElementName)+"</b></div></div>",a++);0==a&&(g+="<i>N\u00e3o h\u00e1 perfis sem fio presentes</i><br>");g+="<br><td class=r2>";g=xxAccountAdminName?g+TableEnd(AddButton("Novo perfil","showWifiNewProfile()")):
g+TableEnd("");QH(20,g+"<br>")}}}function showWifiStateDlg(){if(!xxdialogMode){var b="",c;for(c in xxWifiState)b+="<label><input type=radio name=d11 id=wl"+c+" value="+c+" "+(xxWireless.CIM_WiFiPort.response.EnabledState==c?"checked":"")+">"+xxWifiState[c]+"</label><br>";setDialogMode(11,"Estado sem fio",3,wifiStateDlg,b)}}
function wifiStateDlg(){amtstack.CIM_WiFiPort_RequestStateChange(document.querySelector("input[name=d11]:checked").value,null,function(){amtstack.Get("CIM_WiFiPort",function(b,c,a,d){200==d&&(xxWireless.CIM_WiFiPort.response=a.Body,showWirelessInfo())})})}
function showWifiSyncDlg(){if(!xxdialogMode){var b;b=""+("<label><input type=radio name=d11 id=wl0 value=0 "+(0==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?"checked":"")+">Desativado</label><br>");b+="<label><input type=radio name=d11 id=wl0 value=1 "+(1==xxWireless.AMT_WiFiPortConfigurationService.response.localProfileSynchronizationEnabled?"checked":"")+">ativado</label><br>";setDialogMode(11,"Local Profile Sync",3,showWifiSyncDlgEx,b)}}
2022-03-23 21:00:41 +03:00
function showWifiSyncDlgEx(){var b=Clone(xxWireless.AMT_WiFiPortConfigurationService.response);b.localProfileSynchronizationEnabled=document.querySelector("input[name=d11]:checked").value;amtstack.Put("AMT_WiFiPortConfigurationService",b,function(){amtstack.Get("AMT_WiFiPortConfigurationService",function(b,a,d,g){200==g&&(xxWireless.AMT_WiFiPortConfigurationService.response=d.Body,showWirelessInfo())})})}
function showUefiWifiCoExDlg(){if(!xxdialogMode){var b;b=""+("<label><input type=radio name=d12 value=0 "+(0==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"checked":"")+">Disabled</label><br>");b+="<label><input type=radio name=d12 value=1 "+(1==xxWireless.AMT_WiFiPortConfigurationService.response.UEFIWiFiProfileShareEnabled?"checked":"")+">Enabled</label><br>";setDialogMode(11,"UEFI Wifi CoEx Profile Sharing",3,UefiWifiCoExDlg,b)}}
2022-03-23 21:00:41 +03:00
function UefiWifiCoExDlg(){var b=Clone(xxWireless.AMT_WiFiPortConfigurationService.response);b.UEFIWiFiProfileShareEnabled=document.querySelector("input[name=d12]:checked").value;amtstack.Put("AMT_WiFiPortConfigurationService",b,function(b,a,d,g){200==g&&PullWireless()})}
function showWifiDetails(b){if(!xxdialogMode){b=xxWireless.CIM_WiFiEndpointSettings.responses[b];var c;c="<div style=text-align:left>"+addHtmlValue("Nome do perfil",EscapeHtml(b.ElementName));c+=addHtmlValue("SSID",b.SSID);c+=addHtmlValue("Autentica\u00e7\u00e3o",xxWifiAuthenticationMethod[b.AuthenticationMethod]);c+=addHtmlValue("Criptografia",xxWifiEncryptionMethod[b.EncryptionMethod]);c+=addHtmlValue("Prioridade",b.Priority);messagebox("Perfil sem fio",c+"</div>")}}
function wifiRemoveButton(b){xxdialogMode||(QH(60,format('Remover perfil sem fio "{0}"?',xxWireless.CIM_WiFiEndpointSettings.responses[b].ElementName)),setDialogMode(1,"Perfil sem fio",3,function(){removeWifiButtonEx(b)}))}function removeWifiButtonEx(b){amtstack.Delete("CIM_WiFiEndpointSettings",{InstanceID:xxWireless.CIM_WiFiEndpointSettings.responses[b].InstanceID},removeWifiEntryResponse,0,1)}
2022-03-23 21:00:41 +03:00
function removeWifiEntryResponse(b,c,a,d,g){methodcheck(a)||amtstack.Enum("CIM_WiFiEndpointSettings",function(a,b,c,d){200==d&&(xxWireless.CIM_WiFiEndpointSettings.responses=c,showWirelessInfo())})}
function showWifiNewProfile(){if(!xxdialogMode){var b="";for(i=1;256>i;i++){var c=1;for(j in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[j].Priority==i&&(c=0);c&&(b+="<option value="+i+">"+i)}QH("c24",b);QV("c26",13<amtversion);c25.value=6;c27.value=4;c22.value=c23.value=c28.value=c29.value="";setDialogMode(12,"Adicionar perfil sem fio",3,function(){addWifiProfile()});updateWifiDialog()}}
function addWifiProfile(){amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings({__parameterType:"reference",__resourceUri:amtstack.CompleteName("CIM_WiFiEndpoint"),Name:"WiFi Endpoint 0"},{__parameterType:"instance",__namespace:amtstack.CompleteName("CIM_WiFiEndpointSettings"),ElementName:c22.value,InstanceID:"Intel(r) AMT:WiFi Endpoint Settings "+c22.value,AuthenticationMethod:c25.value,EncryptionMethod:c27.value,SSID:c23.value,Priority:c24.value,
PSKPassPhrase:c28.value},null,null,null,removeWifiEntryResponse)}
function updateWifiDialog(){var b=!0,c=c25.value,a=c27.value;QV(66,4>c);QV(65,3<c);QV(64,3<c);QV(67,4>c);4>c&&(3==a||4==a)&&(c27.value=2);3<c&&(2==a||5==a)&&(c27.value=3);32768==c&&(c27.value=4);for(var d in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[d].ElementName==c22.value&&(b=!1);QE("c54",1==b&&0<c22.value.length&&0<c23.value.length&&7<c28.value.length&&
c28.value==c29.value)}function PullHardware(){amtstack.BatchEnum("","*CIM_ComputerSystemPackage CIM_SystemPackaging *CIM_Chassis CIM_Chip *CIM_Card *CIM_BIOSElement CIM_Processor CIM_PhysicalMemory CIM_MediaAccessDevice CIM_PhysicalPackage *CIM_Battery".split(" "),processHardware);amtFirstPull|=1}
var DMTFCPUStatus="Desconhecido;ativado;Desativado pelo usu\u00e1rio;Desativado pelo BIOS (erro POST);Ocioso;De outros".split(";"),DMTFMemType="Desconhecido;De outros;DRAM;DRAM s\u00edncrona;DRAM de cache;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Instant\u00e2neo;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";De outros;Desconhecido;SIMM;trago;Lasca;MERGULHO;ZIP;Cart\u00e3o Propriet\u00e1rio;DIMM;TSOP;Linha de chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"),
DMTFProcFamilly={191:"Processador Intel&reg; Core &trade; 2 Duo",192:"Processador Intel&reg; Core &trade; 2 Solo",193:"Processador Intel&reg; Core &trade; 2 Extreme",194:"Processador Intel&reg; Core &trade; 2 Quad",195:"Processador m\u00f3vel Intel&reg; Core &trade; 2 Extreme",196:"Processador m\u00f3vel Intel&reg; Core &trade; 2 Duo",197:"Processador m\u00f3vel Intel&reg; Core &trade; 2 Solo",198:"Processador Intel&reg; Core &trade; i7",199:"Processador Intel&reg; Celeron&reg; de n\u00facleo duplo"},
HardwareInventory;
function processHardware(b,c,a,d){if(200==d){var g;b="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>";HardwareInventory=a;QV("go2",!0);b+=TableEnd("<div>&nbsp;"+AddRefreshButton("PullHardware(1)")+AddButton("Salve \ue051...","SaveHardwareLog()")+" As informa\u00e7\u00f5es de hardware s\u00e3o coletadas no momento da inicializa\u00e7\u00e3o do sistema.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var v=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"<br><h2>Plataforma</h2>"+
FullTable({"Modelo de computador":c.Model,Fabricante:c.Manufacturer,"Vers\u00e3o":c.Version,"N\u00famero de s\u00e9rie":c.SerialNumber,"ID do sistema":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="<br><h2>Rodap\u00e9</h2>";b+=FullTable({Fabricante:d.Manufacturer,"Nome do Produto":d.Model,"Vers\u00e3o":d.Version,"N\u00famero de s\u00e9rie":d.SerialNumber,"Etiqueta de recurso":d.Tag,"Substitu\u00edvel?":1==d.CanBeFRUed?"Yes":"No"},"");b+="<br><h2>BIOS</h2>";b+=FullTable({Fornecedor:a.CIM_BIOSElement.response.Manufacturer,
"Vers\u00e3o":v,"Data de lan\u00e7amento":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",{timeZone:"UTC"})},"");b+="<br>";for(g in a.CIM_Processor.responses)c=a.CIM_Processor.responses[g],d=a.CIM_Chip.responses[g],b+="<h2>Processador "+(parseInt(g)+1)+"</h2>",b+=FullTable({Fabricante:trademarks(d.Manufacturer),"Fam\u00edlia":DMTFProcFamilly[c.Family],"Vers\u00e3o":trademarks(d.Version),"Velocidade m\u00e1xima do soquete":c.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[c.CPUStatus]},
2022-03-23 21:00:41 +03:00
"");b+="<br>";for(g in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[g],b+="<h2>M\u00f3dulo de mem\u00f3ria "+(+g+1)+"</h2>",b+=FullTable({"R\u00f3tulo do banco":c.BankLabel,Fabricante:c.Manufacturer,"N\u00famero de s\u00e9rie":c.SerialNumber,Tamanho:parseInt(c.Capacity/1048576)+" MB","Fator de forma":DMTFMemFormFactor[c.FormFactor],Tipo:DMTFMemType[c.MemoryType],"Etiqueta de recurso":c.Tag,"N\u00famero da pe\u00e7a":c.PartNumber},"");b+="<br>";for(g in a.CIM_MediaAccessDevice.responses)c=
a.CIM_MediaAccessDevice.responses[g],d=a.CIM_PhysicalPackage.responses[+g+1],b+="<h2>M\u00eddia de armazenamento "+(parseInt(g)+1)+"</h2>",b+=FullTable({Modelo:d.Model,"N\u00famero de s\u00e9rie":""==d.SerialNumber?"Unknown":d.SerialNumber,Tamanho:parseInt(Math.round(1E3*c.MaxMediaSize/1048576))+" MB"},"");b+="<br>";if(null!=a.CIM_Battery.response){c=null;for(g in a.CIM_PhysicalPackage.responses)11==a.CIM_PhysicalPackage.responses[g].PackageType&&(c=a.CIM_PhysicalPackage.responses[g]);null!=c&&(b+=
"<h2>Battery</h2>",g=(new Date(c.ManufactureDate.Datetime)).toDateString(),a={"Device name":a.CIM_Battery.response.DeviceID,Fabricante:c.Manufacturer,"Manufacture date":g,"N\u00famero de s\u00e9rie":c.SerialNumber,Tipo:"De outros;Desconhecido;Lead Acid;Nickel Cadmium;Nickel Metal Hydride;Lithium-ion;Zinc air;Lithium Polymer".split(";")[a.CIM_Battery.response.Chemistry],"Design capacity":a.CIM_Battery.response.DesignCapacity+" mWatt-hours","Design voltage":a.CIM_Battery.response.DesignVoltage+" mVolts"},
c.OtherIdentifyingInfo&&(a["Other Info"]=c.OtherIdentifyingInfo),b+=FullTable(a,""))}b+="<br>";QH(16,b);updateSystemStatus()}}function SaveHardwareLog(){!xxdialogMode&&HardwareInventory&&SaveJsonFile("IntelAmtHardware","hardware","Informa\u00e7\u00f5es de hardware da Intel AMT",HardwareInventory)}var AmtSystemPowerSchemes=null;function PullPowerPolicy(){amtstack.Enum("AMT_SystemPowerScheme",powerPolicyResponse)}
function powerPolicyResponse(b,c,a,d){AmtSystemPowerSchemes=a;updateSystemStatus()}function showPowerPolicyDlg(b){if(!xxdialogMode){for(var c="",a=0;a<AmtSystemPowerSchemes.length;a++)c+='<input type=radio name=powerpolicy value="'+AmtSystemPowerSchemes[a].InstanceID+'" '+(AmtSystemPowerSchemes[a].SchemeGUID==b?" checked":"")+">"+AmtSystemPowerSchemes[a].Description+"<br>";setDialogMode(11,"Pol\u00edtica de energia Intel&reg; AMT",3,showPowerPolicyDlgOk,c)}}
function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagName("input");c<a.length;c++)"powerpolicy"==a[c].name&&a[c].checked&&(b=a[c].value);amtstack.AMT_SystemPowerScheme_SetPowerScheme(showPowerPolicyDlgOkDone,b)}function showPowerPolicyDlgOkDone(b,c,a,d){200==d&&PullSystemStatus()}var xxAccountAdminName,xxAccountRealmInfo,xxAccountEnabledInfo={},xxAccountFetch,showHiddenAccounts=!1;
function PullUserInfo(){xxAccountFetch=1;delete xxAccountAdminName;xxAccountRealmInfo={};amtstack.AMT_AuthorizationService_GetAdminAclEntry(getAdminAclEntryResponse);amtstack.AMT_AuthorizationService_EnumerateUserAclEntries(1,enumerateUserAclEntriesResponse)}function getAdminAclEntryResponse(b,c,a,d){200==d&&(xxAccountRealmInfo[-1]={AccessPermission:999,DigestUsername:a.Body.Username,Realms:null},xxAccountAdminName=a.Body.Username,updateAccounts())}
2022-03-23 21:00:41 +03:00
function enumerateUserAclEntriesResponse(b,c,a,d){if(200==d){methodcheck(a);QV("go11",!0);xxAccountFetch=a.Body.Handles.length;for(var g in a.Body.Handles)b=a.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}}
function getUserAclEntryExResponse(b,c,a,d,g){xxAccountFetch--;200==d&&(a.Body.Handle=g,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[g]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,g){200==d&&(xxAccountEnabledInfo[g]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,g){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))}
function updateAccounts(){if(!(0<xxAccountFetch)){var b=TableStart2(),b=b+"<tr><td class=r1 style=padding-left:15px><br>Gerencie as contas de usu\u00e1rio Intel&reg; AMT deste computador.<br><br>",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,g=!1,v=0;a.DigestUsername?(d=a.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(v=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!g){var n="";if(999!=a.AccessPermission){2==
v&&(n+="Desativado,");var l=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Reinos[c]]&&l++;0<=a.Realms.indexOf(20)&&(n+="Auditor,");n=0<=a.Realms.indexOf(3)?n+"Administrador":1==l?n+"1 regi\u00e3o":n+(l+" reinos")}else n+="Administrador",a.Handle=-1;b+="<div class=itemBar onclick=showUserDetails("+a.Handle+")><div style=float:right>";0<v&&xxAccountAdminName&&(b+=" "+AddButton2(1==v?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+v+")"));!g&&xxAccountAdminName&&(b+=" "+AddButton2("Editar...",
"changeAccountButton(event,"+a.Handle+")"));b+='</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title="'+d+'"><b>'+d+"</b></div><div style=padding-top:3px>"+n+"</div></div>"}}c='<div style=float:right;margin-right:8px><a title="Alternar contas ocultas" style=color:gray;cursor:pointer onclick=toggleAccountButton()>'+(showHiddenAccounts?"&#x25B2;":"&#x25BC;")+"</a></div><div>&nbsp;"+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("Nova conta",
2022-03-23 21:00:41 +03:00
"newAccountButton()"));b+="<br><td class=r1>"+TableEnd(c+"</div>");QH(21,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()}function changeAccountStateButton(b,c,a){haltEvent(b);xxdialogMode||amtstack.AMT_AuthorizationService_SetAclEnabledState(c,1==a?!1:!0,setAclEnabledStateResponse,c)}
function changeAccountButton(b,c){haltEvent(b);xxdialogMode||(updateRealms(xxAccountRealmInfo[c].Realms),d2username.value=xxAccountRealmInfo[c].DigestUsername?xxAccountRealmInfo[c].DigestUsername:GetSidString(atob(xxAccountRealmInfo[c].KerberosUserSid)),d2password1.value=d2password2.value="",d2permission.value=xxAccountRealmInfo[c].AccessPermission,setDialogMode(2,"Editar conta",-1==c?3:7,function(a){changeAccountButtonEx(c,a)}),updateAccountDialog())}
function newAccountButton(){xxdialogMode||(updateRealms([]),d2username.value=d2password1.value=d2password2.value="",d2permission.value=2,setDialogMode(2,"Nova conta",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())}
function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,g=d2permission.value,v=d2password1.value,n=GetSidByteArray(Q("d2username").value),l=null;if(0==d.length||v!=d2password2.value){messagebox("Erro na conta","Par\u00e2metros inv\u00e1lidos");return}null==n?l=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+v)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
l,n,g,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,l,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,l,n,g,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,g){methodcheck(a)||PullUserInfo()}
function updateRealms(b){QV(61,null!=b);if(null!=b){var c="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3"+(0<=b.indexOf(3)?" checked":"")+">Administrador</label></li><hr />",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx"+a+d+">"+amtstack.RealmNames[a]+"</label></li>")}QH(62,c)}}
function updateAccountDialog(){var b=!0;if("none"!=Q(61).style.display){var b=!1,c;for(c in amtstack.RealmNames)(amtstack.RealmNames[c]||3==c)&&Q("rx"+c).checked&&(b=!0)}b&&(b=0<d2username.value.length&&passwordcheck(d2password1.value)&&d2password1.value==d2password2.value);QE("c54",b)}var xxUserPermissions=["Apenas local","Apenas rede","Todos (Local e Rede)"];
function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="<div style=text-align:left>",d,g=c.DigestUsername;g||(g=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Nome",g);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("Estado",1==xxAccountEnabledInfo[b].Enabled?"ativado":"Desativado"));if(g==xxAccountAdminName)a+=addHtmlValue("Permiss\u00e3o","Administrador");else{var a=a+addHtmlValue("Permiss\u00e3o",xxUserPermissions[c.AccessPermission]),v="";if(0<=c.Realms.indexOf(3))v="Administrador",
0<=c.Realms.indexOf(20)&&(v+="Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0<v.length&&(v+=","),v+=amtstack.RealmNames[c.Realms[d]]);0==v.length&&(v="Nenhum");a+=addHtmlValue("Reinos","")+"<b>"+v+"</b>"}messagebox("Conta"+g,a+"</div>")}}
function wsmanQuery(){QH(24,"");var b=getSelectedOptions(Q(22)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(23,!1),c&&0<c.length&&amtstack.BatchEnum("Navegador",c,browserResponse,null,!0))}
2022-03-23 21:00:41 +03:00
function browserResponse(b,c,a,d){QE(23,!0);b="";for(var g in a)c=a[g],b+="<h2>"+g+"</h2><div style=margin-left:20px>",b=200==c.status?0==c.responses.length?b+"<br>(Esvaziar)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel&reg"):b+("<br><div style=color:red>Erro #"+c.status+"</div>"),b+="</div><br>";QH(24,b)}
function wsmanFilter(){var b=c0.value.toLowerCase(),c;for(c in AllWsman)QV("WSB-"+AllWsman[c],""==b||0<=AllWsman[c].toLowerCase().indexOf(b))}function connectTerminal(){terminal&&(0==terminal.State?(terminal.tlsv1only=amtstack.wsman.comm.tlsv1only,terminal.Start(currentMeshNode._id,16994,"*","*",0)):terminal.Stop())}
function onTerminalStateChange(b,c){c4.value=0==c?"Conectar":"desconectar";Q(29).textContent=StatusStrs[c];QE(34,3==c);QE("TermWD",3==c);switch(c){case 0:b.m.TermResetScreen();b.m.TermDraw();3==xxdialogMode&&setDialogMode();QV("termRecordIcon",!1);2==b.disconnectCode?messagebox("Remote Terminal","The remote device is busy, a session may already be open."):3==b.disconnectCode&&messagebox("Remote Terminal","The device indicated that this type of connection of not supported.");
break;case 3:1==b.serverIsRecording&&QV("termRecordIcon",!0)}}function termPaste(){terminal.m.TermSendKeys(d3pastetextarea.value);return!1}function termSendKey(b){terminal.m.TermSendKey(b);return!1}function termSendKeys(){var b=Q("termkeys").value;1E3>b?termSendKey(b):terminal.m.TermHandleKeyDown({which:b-889,repeat:!1})}function termToggleSize(){80==terminal.m.width?(Q(31).value="100x30",terminal.m.Init(100,30)):(Q(31).value="80x25",terminal.m.Init(80,25))}
var terminalEmulations=["Terminal UTF8","ASCII estendido","Intel ASCII"];function termToggleType(){terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q(33).value=terminalEmulations[terminal.m.terminalEmulation]}function termToggleFx(){Q(32).value=["Intel (F10 = ESC + [OM)","Alternativo (F10 = ESC + 0)","VT100 + (F10 = ESC + [OY)"][terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3]}
function termToggleCr(){"\r\n"==terminal.m.lineFeed?(Q(30).value="LF",terminal.m.lineFeed="\n"):(Q(30).value="CR + LF",terminal.m.lineFeed="\r\n")}
function terminalCaptureToggle(b){if(!xxdialogMode)if(void 0==terminal.m.capture)terminal.m.capture="",c3.value="Stop Capture";else{if(0<terminal.m.capture.length){b="TerminalCapture";var c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);saveAs(data2blob(terminal.m.capture),b+".txt")}delete terminal.m.capture;
c3.value="Come\u00e7ar captura"}}function terminal_FileSelectHandler(b){haltEvent(b);if(3==terminal.State&&null!=b.dataTransfer&&1==b.dataTransfer.files.length){var c=new FileReader;c.onload=terminal_onSetupBinRead;c.readAsText(b.dataTransfer.files[0])}}function terminal_onSetupBinRead(b){d3pastetextarea.value=b.target.result;setDialogMode(3,"Colar",3,termPaste)}var desktopScreenInfo=null,desktopPollTimer=null,webRtcDesktop=null;
function webRtcDesktopReset(){if(null!=webRtcDesktop){null!=webRtcDesktop.softdesktop&&(webRtcDesktop.softdesktop.Stop(),webRtcDesktop.softdesktop=null);if(null!=webRtcDesktop.webchannel){try{webRtcDesktop.webchannel.close()}catch(b){}webRtcDesktop.webchannel=null}if(null!=webRtcDesktop.webrtc){try{webRtcDesktop.webrtc.close()}catch(b){}webRtcDesktop.webrtc=null}webRtcDesktop=null;desktop.m.hold(!1);updateDesktopState();p24files=null;p24downloadFileCancel();p24uploadFileCancel();QV("go24",!1);24==
currentView&&go(14)}}function connectDesktopButton(b){desktop.disconnectCode=0;connectDesktop(b)}var connectDesktopConsent=!1;
function connectDesktop(b){desktop&&!xxdialogMode&&(connectDesktopConsent=!1,0==desktop.State?!0!==b&&5<amtversion&&null!=amtsysstate&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&4294967295==amtsysstate.IPS_OptInService.response.OptInRequired?(connectDesktopConsent=!0,amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)):(desktop.m.useRLE=0!=(desktopsettings.encflags&1),desktop.m.bpp=desktopsettings.encflags&2?2:1,15<amtversion&&null!=amtsysstate&&null!=
amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response?(desktop.m.lowcolor=amtsysstate.IPS_KVMRedirectionSettingData.response.GrayscalePixelFormatSupported&&0!=(desktopsettings.encflags&16),desktop.m.graymode=amtsysstate.IPS_KVMRedirectionSettingData.response.GrayscalePixelFormatSupported&&0!=(desktopsettings.encflags&4),desktop.m.useZLib=amtsysstate.IPS_KVMRedirectionSettingData.response.ZlibControlSupported&&0!=(desktopsettings.encflags&8),desktop.m.decimationMode=
0<amtsysstate.IPS_KVMRedirectionSettingData.response.InitialDecimationModeForLowRes?desktopsettings.decimationMode:0):(desktop.m.lowcolor=!1,desktop.m.graymode=!1,desktop.m.useZLib=!1,desktop.m.decimationMode=0),desktop.m.showmouse=desktopsettings.showmouse,desktop.m.onScreenSizeChange=center,desktop.m.onKvmData=function(b){var a=null;try{a=JSON.parse(b)}catch(d){}null!=a&&null!=a.action&&("restart"==a.action?(webRtcDesktopReset(),desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))):"present"==
a.action&&null==webRtcDesktop?(webRtcDesktop={platform:a.platform},"undefined"!==typeof RTCPeerConnection?webRtcDesktop.webrtc=new RTCPeerConnection(null):"undefined"!==typeof webkitRTCPeerConnection&&(webRtcDesktop.webrtc=new webkitRTCPeerConnection(null)),webRtcDesktop.webchannel=webRtcDesktop.webrtc.createDataChannel("DataChannel",{}),webRtcDesktop.webchannel.onopen=function(){urlvars&&urlvars.kvmdatatrace&&console.log("WebRTC Data Channel Open");desktop.m.hold(!0);webRtcDesktop.webRtcActive=!0;
webRtcDesktop.softdesktop=CreateKvmDataChannel(webRtcDesktop.webchannel,CreateAgentRemoteDesktop("Desk",Q(8)),desktop.m);webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);desktopsettings.quality&&(webRtcDesktop.softdesktop.m.CompressionLevel=desktopsettings.quality);desktopsettings.scaling&&(webRtcDesktop.softdesktop.m.ScalingLevel=desktopsettings.scaling);webRtcDesktop.softdesktop.Start();updateDesktopState();QV("go24",!0);downloadFile=null;p24files=webRtcDesktop.softdesktop;
p24targetpath="";webRtcDesktop.softdesktop.onControlMsg=onFilesControlData;webRtcDesktop.softdesktop.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:""}))},webRtcDesktop.webchannel.onclose=function(a){urlvars.kvmdatatrace&&console.log("WebRTC Data Channel Closed");webRtcDesktopReset()},webRtcDesktop.webrtc.onicecandidate=function(a){null==a.candidate?desktop.m.sendKvmData(JSON.stringify({action:"offer",ver:1,sdp:webRtcDesktop.webrtcoffer.sdp})):webRtcDesktop.webrtcoffer.sdp+="a="+a.candidate.candidate+
"\r\n"},webRtcDesktop.webrtc.oniceconnectionstatechange=function(){null==webRtcDesktop||null==webRtcDesktop.webrtc||"disconnected"!=webRtcDesktop.webrtc.iceConnectionState&&"failed"!=webRtcDesktop.webrtc.iceConnectionState||webRtcDesktopReset()},webRtcDesktop.webrtc.createOffer(function(a){webRtcDesktop.webrtcoffer=a;webRtcDesktop.webrtc.setLocalDescription(a,function(){},webRtcDesktopReset)},webRtcDesktopReset,{mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}})):"answer"==a.action&&null!=
webRtcDesktop&&webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:a.sdp}),function(){},webRtcDesktopReset))},desktop.m.kvmExtChanged=15<amtversion||urlvars.kvmext?updateDesktopState:null,desktop.m.frameRateDelay=1==desktopsettings.limitFrameRate?200:0,desktop.m.noMouseRotate=desktopsettings.noMouseRotate,desktop.tlsv1only=amtstack.wsman.comm.tlsv1only,desktop.Start(currentMeshNode._id,16994,"*","*",0),PullDesktopDisplayInfo(),urlvars.norefresh||(desktopPollTimer=
setInterval(PullDesktopDisplayInfo,5E3))):(desktop.Stop(),clearInterval(desktopPollTimer),desktopPollTimer=null,PullDesktopDisplayInfo(),webRtcDesktopReset()))}function PullDesktopDisplayInfo(){7<amtversion&&0<desktop.State?amtstack.BatchEnum("",["*IPS_ScreenSettingData","*IPS_KVMRedirectionSettingData"],ProcessDesktopDisplayInfo):(desktopScreenInfo=null,Q(42).innerHTML="")}
function ProcessDesktopDisplayInfo(b,c,a,d){200!=d?desktopScreenInfo=null:(desktopScreenInfo=a.IPS_ScreenSettingData.responses.Body,desktopScreenInfo.KVMRSD=a.IPS_KVMRedirectionSettingData.responses.Body,UpdateDesktopDisplayInfo())}
function UpdateDesktopDisplayInfo(){for(var b="",c=0,a=0;3>a;a++)1==desktopScreenInfo.IsActive[a]&&(c++,b+='<input type="button" '+(a==desktopScreenInfo.KVMRSD.DefaultScreen?'style="background-color:DodgerBlue"':"")+' value="'+(a+1)+'" title="Switch to screen '+(a+1)+'" onkeypress="return false" onkeydown="return false" onclick="desktopSwitchScreen('+a+')">&nbsp;');1<c?Q(42).innerHTML=b+"&nbsp;":Q(42).innerHTML=""}
function desktopSwitchScreen(b){var c=Clone(desktopScreenInfo.KVMRSD);c.DefaultScreen=b;amtstack.Put("IPS_KVMRedirectionSettingData",c,desktopSwitchScreenEx)}function desktopSwitchScreenEx(b,c,a,d){200==d&&(desktopScreenInfo.KVMRSD=a.Body,UpdateDesktopDisplayInfo())}
function onDesktopStateChange(b,c){var a=!1;c10.value=0==c?"Conectar":"desconectar";var d=3==c&&!urlvars.kvmviewonly;QE(43,d);QE("deskkeys",d);QE("DeskWD",d);QE(44,d);switch(c){case 0:webRtcDesktopReset();QV("deskRecordIcon",!1);2==b.disconnectCode?messagebox("\u00c1rea de trabalho remota","The remote device is busy, a session may already be open."):3==b.disconnectCode?messagebox("\u00c1rea de trabalho remota","The device indicated that this type of connection of not supported."):
5E4==b.disconnectCode?messagebox("\u00c1rea de trabalho remota","KVM disconnection, this may indicate that Intel AMT is unable to capture the display (Try RLE8 encoding), or unsupported GPU."):50001==b.disconnectCode?(a=null!=b.connectTime&&b.connectTime+5E3<Date.now(),console.log(b.disconnectCode,a)):50002==b.disconnectCode&&messagebox("\u00c1rea de trabalho remota","KVM disconnection that may be due to the display size and resolution being too large for the Intel AMT KVM buffer. Try RLE8 encoding or reducing the display resolution.");
break;case 3:12<=amtversion&&b.m.sendKvmData(JSON.stringify({action:"present",ver:1})),1==b.serverIsRecording&&QV("deskRecordIcon",!0)}center();updateDesktopState();a&&setTimeout(connectDesktop,200)}
function updateDesktopState(){var b="";3==desktop.State&&(webRtcDesktop&&1==webRtcDesktop.webRtcActive?b=", Soft-KVM":desktop.m&&desktop.m.kvmExt&&(1==desktop.m.kvmExt.decimationState&&(b+=", Downscaled"),1==desktop.m.kvmExt.compression&&(b+=", Compressed")));Q(40).textContent=StatusStrs[desktop.State]+b}function showDesktopSettings(){xxdialogMode||(applyDesktopSettings(),setDialogMode(7,"Configura\u00e7\u00f5es da \u00e1rea de trabalho remota",3,showDesktopSettingsChanged))}
function showDesktopSettingsChanged(){desktopsettings.encflags=parseInt(c11.value);desktopsettings.showmouse=d7showcursor.checked;desktopsettings.showcad=d7showcad.checked;desktopsettings.limitFrameRate=d7limitFrameRate.checked;desktopsettings.noMouseRotate=d7noMouseRotate.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;try{localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings))}catch(b){}applyDesktopSettings();desktop.m.frameRateDelay=
1==desktopsettings.limitFrameRate?200:0;0!=desktop.State&&(desktop.disconnectCode=0,desktop.Stop(),setTimeout(connectDesktop,800))}
function applyDesktopSettings(){d7decimation.value=desktopsettings.decimationMode;d7showcursor.checked=desktopsettings.showmouse;d7showcad.checked=desktopsettings.showcad;d7limitFrameRate.checked=desktopsettings.limitFrameRate;d7noMouseRotate.checked=desktopsettings.noMouseRotate;desktopsettings.quality&&(d7bitmapquality.value=desktopsettings.quality);desktopsettings.scaling&&(d7bitmapscaling.value=desktopsettings.scaling);QV("d7softkvmsettings",12<=amtversion);var b=desktopsettings.encflags,c="";
15<amtversion&&null!=amtsysstate&&null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response?(amtsysstate.IPS_KVMRedirectionSettingData.response.GrayscalePixelFormatSupported||(b&=11),amtsysstate.IPS_KVMRedirectionSettingData.response.ZlibControlSupported||(b&=23),amtsysstate.IPS_KVMRedirectionSettingData.response.GrayscalePixelFormatSupported&&(c+='<option id="d7exm1" value=21>RLE4G, 16 Grays</option><option id="d7exm2" value=5>RLE8G, 256 Grays</option>'),
c+="<option value=1>RLE8, 256 Colors</option>",c+="<option value=3>RLE16, 64k Colors</option>",amtsysstate.IPS_KVMRedirectionSettingData.response.ZlibControlSupported&&(amtsysstate.IPS_KVMRedirectionSettingData.response.GrayscalePixelFormatSupported&&(c+='<option id="d7exm3" value=29>ZRLE4G, Compressed Gray</option>',c+='<option id="d7exm4" value=13>ZRLE8G, Compressed Gray</option>'),c+='<option id="d7exm5" value=9>ZRLE8, Compressed Color</option>',c+='<option id="d7exm6" value=11>ZRLE16, Compressed Color</option>'),
QV("d7decimationspan",0<amtsysstate.IPS_KVMRedirectionSettingData.response.InitialDecimationModeForLowRes)):(b&=3,c+="<option value=1>RLE8, 256 Colors</option>",c+="<option value=3>RLE16, 64k Colors</option>",QV("d7decimationspan",!1));c+="<option value=0>RAW8, 256 Colors</option>";c+="<option value=2>RAW16, 16k Colors</option>";QH("c11",c);c11.value=b;QV(43,desktopsettings.showcad)}var fullscreen=!1,fullscreenonly=!1;
function deskToggleFull(b){xxdialogMode||(1==fullscreenonly?(console.log("deskToggleFull1",fullscreenonly,urlvars.kvmonly),fullscreenonly=!1,1==urlvars.kvmonly?console.log("deskToggleFull2"):disconnect()):(fullscreenonly=b,fullscreen=!fullscreen,QV(7,!fullscreen),QV(35,!fullscreen),QV("c5",!fullscreen),QV("c9",fullscreen),fullscreen?(QS(8).left=0,QS(14).padding=0):(QS(8).left="156px",QS(14).padding=
"8px"),center()))}
function deskShowTypeDialog(){xxdialogMode||3!=desktop.State||(Q(44).blur(),setDialogMode(11,"Entrada remota do teclado",3,showDeskTypeEx,'<div>Digite o texto e clique em OK para digit\u00e1-lo remotamente usando um teclado em ingl\u00eas dos EUA. Certifique-se de colocar o cursor remoto na posi\u00e7\u00e3o correta antes de continuar.<div><textarea id=d2typeText style="margin-top:5px;width:100%;height:184px;resize:none" maxlength=2000></textarea>'),Q("d2typeText").focus())}
var AmtDeskTypeTimer=null,AmtDeskTypeContent=null,DeskTypeTranslate={39:222,42:106,43:107,44:188,45:189,46:190,47:191,59:186,61:187,91:219,92:220,93:221,96:192,191:111},DeskTypeShiftTranslate={33:49,34:222,35:51,36:52,37:53,38:55,40:57,41:48,58:186,60:188,62:190,63:191,64:50,94:54,95:189,106:56,107:187,123:219,124:220,125:221,126:192};
function showDeskTypeEx(){var b=Q("d2typeText").value;Q("d2typeText").value.toUpperCase();var c=[],a;for(a in b){var d=b.charCodeAt(a);c.push([d,1],[d,0])}AmtDeskTypeContent=c;AmtDeskTypeTimer=setInterval(function(){var a=AmtDeskTypeContent.shift();desktop&&desktop.m.sendkey(a[0],a[1]);if(null==desktop||0==AmtDeskTypeContent.length)clearInterval(AmtDeskTypeTimer),AmtDeskTypeContent=null},10)}function sendCAD(){Q(48).checked||desktop.m.sendcad()}
var deskkeysset={0:[[65511,1],[65511,0]],1:[[65511,1],[65364,1],[65364,0],[65511,0]],2:[[65511,1],[65362,1],[65362,0],[65511,0]],3:[[65511,1],[108,1],[108,0],[65511,0]],4:[[65511,1],[109,1],[109,0],[65511,0]],5:[[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]],6:[[65470,1],[65470,0]],7:[[65471,1],[65471,0]],8:[[65472,1],[65472,0]],9:[[65473,1],[65473,0]],10:[[65474,1],[65474,0]],11:[[65475,1],[65475,0]],12:[[65476,1],[65476,0]],13:[[65477,1],[65477,0]],14:[[65478,1],[65478,0]],15:[[65479,
1],[65479,0]],16:[[65480,1],[65480,0]],17:[[65481,1],[65481,0]],19:[[65513,1],[65289,1],[65289,0],[65513,0]],20:[[65511,1],[114,1],[114,0],[65511,0]],21:[[65513,1],[65473,1],[65473,0],[65513,0]],22:[[65507,1],[119,1],[119,0],[65507,0]],23:[[65511,1],[65361,1],[65361,0],[65511,0]],24:[[65511,1],[65363,1],[65363,0],[65511,0]]};
function deskSendKeys(){if(!Q(48).checked){var b=Q("deskkeys").value;if(null!=b&&null!=deskkeysset[b]&&0!=desktop.State)for(var c=0;c<deskkeysset[b].length;c++)desktop.m.sendkey(deskkeysset[b][c][0],deskkeysset[b][c][1])}}
function deskSaveImage(){if(!(xxdialogMode||3!=desktop.State||urlvars&&urlvars.norecord)){var b="Desktop",c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);Q("Desk").toBlob(function(a){saveAs(a,b+".jpg")})}}
function dmousedown(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousedown(b),desktop.m.sendKeepAlive()):desktop.m.mousedown(b))}function dmouseup(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mouseup(b),desktop.m.sendKeepAlive()):desktop.m.mouseup(b))}
function dmousemove(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousemove(b),desktop.m.sendKeepAlive()):desktop.m.mousemove(b))}function dmousewheel(b){xxdialogMode||Q(48).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousewheel(b),desktop.m.sendKeepAlive()):desktop.m.mousewheel(b))}
function drotate(b){xxdialogMode||(b=desktop.m.rotation+b,desktop.m.setRotation(b),null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop&&null!=webRtcDesktop.softdesktop.m&&webRtcDesktop.softdesktop.m.setRotation(b),center())}var p24files=null,p24filetree=null,p24targetpath=null,p24filetreelocation=[];
function onFilesControlData(b){if(0<b.length&&123!=b.charCodeAt(0))p24gotDownloadBinaryData(b);else if(b=JSON.parse(b),"download"==b.action)p24gotDownloadCommand(b);else if("upload"==b.action)p24gotUploadData(b);else if("pong"!=b.action)if(b.path=b.path.replace(/\//g,"\\"),null!=p24filetree&&b.path==p24filetree.path){var c=p24getCheckedNames();p24filetree=b;p24updateFiles(c)}else{for(var c=b.path.split("/").join("\\"),a=p24targetpath.split("/").join("\\");0<c.length&&"\\"==c[0];)c=c.substring(1);
for(;0<a.length&&"\\"==a[0];)a=a.substring(1);if(c==a||"\\"==b.path&&""==p24targetpath)p24filetree=b,p24updateFiles()}}function p24getCheckedNames(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);return b}
function p24updateFiles(b){var c="",a="",d="<a style=cursor:pointer onclick=p24folderup(0)>Raiz</a>",g=p24filetree.path.split("\\");p24filetreelocation=[];for(var v in g)""!=g[v]&&p24filetreelocation.push(g[v]);for(v in p24filetreelocation)d+=" / <a style=cursor:pointer onclick=p24folderup("+(parseInt(v)+1)+")>"+p24filetreelocation[v]+"</a>";var g=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(v in n){var l=n[v],p=l.n,q;q=70<p.length?'<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,
70))+"...</span>":EscapeHtml(p);var p=EscapeHtml(p),e="";null!=l.d&&(e=new Date(l.d),e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+"&nbsp;");var C="";null!=l.s&&(C=getFileSizeStr(l.s));var w="";3>l.t?w='<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+l.nx+'">&nbsp;<span style=float:right title=""></span><span><div class=fileIcon'+l.t+'></div><a style=cursor:pointer onclick=p24folderset("'+
encodeURIComponent(l.nx)+'")>'+q+"</a></span></div>":(w=q,0<l.s&&(w='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick=\'p24downloadfile("'+encodeURIComponent(g+"/"+p)+'","'+encodeURIComponent(p)+'",'+l.s+")'>"+q+"</a>"),w='<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+l.nx+'">&nbsp;<span class=fsize>'+e+"</span><span style=float:right>"+C+"</span><span><div class=fileIcon"+l.t+"></div>"+w+"</span></div>");
3>l.t?c+=w:a+=w}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),v=0;v<c.length;v++)0<=b.indexOf(p24filetree.dir[c[v].value].n)&&(c[v].checked=!0);p24setActions()}function p24folderset(b){p24targetpath=joinPaths(p24filetree.path,p24filetree.dir[b].n).split("\\").join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}
function p24folderup(b){if(null==b)p24filetreelocation.pop();else for(;p24filetreelocation.length>b;)p24filetreelocation.pop();p24targetpath=p24filetreelocation.join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}var p24sortorder;function p24sort_filename(b,c){return b.ln>c.ln?1*p24sortorder:b.ln<c.ln?-1*p24sortorder:0}function p24sort_timestamp(b,c){return b.d>c.d?1*p24sortorder:b.d<c.d?-1*p24sortorder:0}
function p24sort_bysize(b,c){return b.s==c.s?p24sort_filename(b,c):(b.s-c.s)*p24sortorder}function p24sort_files(b){var c=[],a=Q("p24sortdropdown").value,d;for(d in b)b[d].nx=d,null==b[d].s&&(b[d].s=0),null==b[d].n&&(b[d].n=d),b[d].ln=b[d].n.toLowerCase(),c.push(b[d]);p24sortorder=1;3<a&&(p24sortorder=-1,a-=3);1==a?c.sort(p24sort_filename):2==a?c.sort(p24sort_bysize):3==a&&c.sort(p24sort_timestamp);return c}
function p24setActions(){if(null==p24filetree)QE("p24DeleteFileButton",!1),QE("p24NewFolderButton",!1),QE("p24UploadButton",!1),QE("p24RenameFileButton",!1),QE("p24SelectAllButton",!1),Q("p24SelectAllButton").value="Selecionar tudo",QE("p24RefreshButton",!1),QE("p24CutButton",!1),QE("p24CopyButton",!1),QE("p24PasteButton",!1);else{var b=p24getFileSelCount(),c=p24getFileCount(),a=p24getFileSelCount(!1),d="win32"==webRtcDesktop.platform;QE("p24DeleteFileButton",0<b&&(0<p24filetreelocation.length||0==
d));QE("p24NewFolderButton",0<p24filetreelocation.length||0==d);QE("p24UploadButton",0<p24filetreelocation.length||0==d);QE("p24RenameFileButton",1==b&&(0<p24filetreelocation.length||0==d));QE("p24SelectAllButton",0<c);Q("p24SelectAllButton").value=0<b?"Selecione nenhum":"Selecionar tudo";QE("p24RefreshButton",!0);QE("p24CutButton",0<b&&b==a&&(0<p24filetreelocation.length||0==d));QE("p24CopyButton",0<b&&b==a&&(0<p24filetreelocation.length||0==d));QE("p24PasteButton",(0<p24filetreelocation.length||
0==d)&&null!=p24clipboard&&0<p24clipboard.length)}}function p24getFileSelCount(b){for(var c=0,a=document.getElementsByName("fd"),d=0;d<a.length;d++)!a[d].checked||0==b&&"3"!=a[d].attributes.file.value||c++;return c}function p24getFileCount(){return document.getElementsByName("fd").length}function p24selectallfile(){for(var b=0==p24getFileSelCount(),c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked=b;p24setActions()}
function p24createfolder(){setDialogMode(11,"Nova pasta",3,p24createfolderEx,"<input type=text id=p24renameinput maxlength=64 onkeyup=p24fileNameCheck(event) style=width:100% />");focusTextBox("p24renameinput");p24fileNameCheck()}function p24createfolderEx(){p24files.sendCtrlMsg(JSON.stringify({action:"mkdir",reqid:1,path:p24filetreelocation.join("/")+"/"+Q("p24renameinput").value}));p24folderup(999)}
function p24deletefile(){var b=p24getFileSelCount();setDialogMode(11,"Excluir",3,p24deletefileEx,1<b?"Delete "+b+" selected items?":"Delete selected item?")}function p24deletefileEx(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);p24files.sendCtrlMsg(JSON.stringify({action:"rm",reqid:1,path:p24filetreelocation.join("/"),delfiles:b}));p24folderup(999)}
function p24renamefile(){for(var b,c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&(b=p24filetree.dir[c[a].value].n);setDialogMode(11,"Renomear",3,p24renamefileEx,'<input type=text id=p24renameinput maxlength=64 onkeyup=p24fileNameCheck(event) style=width:100% value="'+b+'" />',{action:"rename",path:p24filetreelocation.join("/"),oldname:b});focusTextBox("p24renameinput");p24fileNameCheck()}
function p24renamefileEx(b,c){c.newname=Q("p24renameinput").value;p24files.sendCtrlMsg(JSON.stringify(c));p24folderup(999)}function p24fileNameCheck(b){var c=isFilenameValid(Q("p24renameinput").value);QE("c54",c);1==c&&null!=b&&24==b.keyCode&&dialogclose(1)}
function p24uploadFile(){setDialogMode(11,"Subir arquivo",3,p24uploadFileEx,"<input type=file name=files id=p24uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p24uploadinput')\" />");updateUploadDialogOk("p24uploadinput")}function p24uploadFileEx(){p24doUploadFiles(Q("p24uploadinput").files)}function updateUploadDialogOk(b){QE("c54",""!=Q(b).value)}var p24clipboard=null,p24clipboardFolder=null,p24clipboardCut=0;
function p24copyFile(b){var c=document.getElementsByName("fd");p24clipboard=[];p24clipboardCut=b;p24clipboardFolder=p24targetpath;for(b=0;b<c.length;b++)c[b].checked&&"3"==c[b].attributes.file.value&&p24clipboard.push(p24filetree.dir[c[b].value].n);p24updateClipview()}
function p24pasteFile(){var b="";null!=p24clipboard&&0<p24clipboard.length&&(b="Confim "+(0==p24clipboardCut?"copy":"move")+" of "+p24clipboard.length+" entrie"+(1<p24clipboard.length?"s":"")+" to this location?");setDialogMode(11,"Colar",3,p24pasteFileEx,b)}
function p24pasteFileEx(){p24files.sendCtrlMsg(JSON.stringify({action:0==p24clipboardCut?"copy":"move",reqid:1,scpath:p24clipboardFolder,dspath:p24targetpath,names:p24clipboard}));p24folderup(999);1==p24clipboardCut&&(p24clipboardFolder=p24clipboard=null,p24clipboardCut=0,p24updateClipview())}
function p24updateClipview(){var b="";null!=p24clipboard&&0<p24clipboard.length&&(b="Holding "+p24clipboard.length+" entrie"+(1<p24clipboard.length?"s":"")+" for "+(0==p24clipboardCut?"copy":"move")+", <a onclick=p24clearClip() style=cursor:pointer>Clear</a>.");QH("p24bottomstatus",b);p24setActions()}function p24clearClip(){p24clipboardFolder=p24clipboard=null;p24clipboardCut=0;p24updateClipview()}
function p24fileDragDrop(b){haltEvent(b);QV("p24bigfail",!1);QV("p24bigok",!1);null!=b.dataTransfer&&0!=b.dataTransfer.files.length&&null!=p24filetree&&(0==p24filetreelocation.length&&"win32"==webRtcDesktop.platform||p24doUploadFiles(b.dataTransfer.files))}var p24dragtimer=null;
function p24fileDragOver(b){haltEvent(b);null!=p24dragtimer&&(clearTimeout(p24dragtimer),p24dragtimer=null);b=null!=p24filetree;0==p24filetreelocation.length&&"win32"==webRtcDesktop.platform&&(b=!1);QV("p24bigok",b);QV("p24bigfail",!b)}function p24fileDragLeave(b){haltEvent(b);"p24filetable"!=b.target.id?(QV("p24bigfail",!1),QV("p24bigok",!1)):p24dragtimer=setTimeout(function(){QV("p24bigfail",!1);QV("p24bigok",!1);p24dragtimer=null},200)}
function getFileSizeStr(b){return 1==b?"1 byte":format("{0} bytes",b)}function joinPaths(){var b=[],c;for(c in arguments){var a=arguments[c];if(null!=a&&""!=a){for(;a.endsWith("/")||a.endsWith("\\");)a=a.substring(0,a.length-1);for(;a.startsWith("/")||a.startsWith("\\");)a=a.substring(1);b.push(a)}}return b.join("/")}var isFilenameValid=function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,a=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(d){return b.test(d)&&!c.test(d)&&!a.test(d)&&"."!=d[0]}}();
function focusTextBox(b){setTimeout(function(){Q(b).selectionStart=Q(b).selectionEnd=65535;Q(b).focus()},0)}var downloadFile;
function p24downloadfile(b,c,a){xxdialogMode||downloadFile||!p24files||(downloadFile={path:decodeURIComponent(b),file:decodeURIComponent(c),size:a,tsize:0,data:"",state:0,id:Math.random()},p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path})),setDialogMode(11,"\u21ec Fazer download do arquivo",10,p24downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+a+" />"))}
function p24downloadFileCancel(){null!=downloadFile&&(setDialogMode(0),null!=p24files&&p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"cancel",id:downloadFile.id})),downloadFile=null)}function p24gotDownloadCommand(b){null!=downloadFile&&b.id==downloadFile.id&&("start"==b.sub?(downloadFile.state=1,p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"startack",id:downloadFile.id}))):"cancel"==b.sub&&(downloadFile=null,setDialogMode(0)))}
function p24gotDownloadBinaryData(b){if(downloadFile&&0!=downloadFile.state){try{b=atob(b)}catch(c){return}null==b||4>b.length||(4<b.length&&(downloadFile.tsize+=b.length-4,downloadFile.data+=b.substring(4),Q("d2progressBar").value=downloadFile.tsize),0!=(ReadInt(b,0)&1)?(saveAs(data2blob(downloadFile.data),downloadFile.file),downloadFile=null,setDialogMode(0)):p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"ack",id:downloadFile.id})))}}var uploadFile;
function p24doUploadFiles(b){xxdialogMode||(uploadFile={xpath:p24filetreelocation.join("/"),xfiles:b,xfilePtr:-1},setDialogMode(11,"Subir arquivo",10,p24uploadFileCancel,"<div id=p24dfileName>Configurando...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />",99),p24uploadNextFile())}
function p24uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var b=uploadFile.xfiles[uploadFile.xfilePtr];QH("p24dfileName",b.name);Q("d2progressBar").max=b.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader;uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;p24files.sendCtrlMsg(JSON.stringify({action:"upload",sub:"start",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:b.name,size:uploadFile.xdata.byteLength}))};
uploadFile.xreader.onerror=function(){p24uploadNextFile()};uploadFile.xreader.readAsArrayBuffer(b)}else p24uploadFileCancel(),p24folderup(9999)}function p24uploadFileCancel(b,c){null!=uploadFile&&(uploadFile=null,setDialogMode(0),99==c&&null!=p24files&&p24files.sendCtrlMsg(JSON.stringify({action:"upload",sub:"cancel"})))}
function p24gotUploadData(b){if(null!=uploadFile&&parseInt(uploadFile.xfilePtr)==parseInt(b.reqid))if("start"==b.sub)for(p24uploadNextPart(!1),b=0;8>b;b++)p24uploadNextPart(!0);else"ack"==b.sub?p24uploadNextPart(!1):"error"==b.sub&&p24uploadFileCancel()}function ab2str(b){return String.fromCharCode.apply(null,new Uint8Array(b))}
function p24uploadNextPart(b){var c=uploadFile.xdata,a=uploadFile.xptr,d=uploadFile.xptr+4096;if(d>c.byteLength){if(1==b)return;d=c.byteLength}a==c.byteLength?p24uploadNextFile():(p24files.sendCtrlMsg(btoa(IntToStr(d!=c.byteLength?16777216:16777217)+ab2str(c.slice(a,d)))),uploadFile.xptr=d,Q("d2progressBar").value=d)}var ider,iderCodeBlock,iderTimer;
function iderStart(b){if(!xxdialogMode){b="<div>Monte imagens de disco em um computador Intel&reg; AMT - Experimental.</div><br />"+('<div style=height:26px><input id=floppyImageInput type=file style=float:right;width:250px accept=".img"><div>'+NoBreak("Disquete (.img)")+"</div></div>");b+='<div style=height:26px><input id=cdromImageInput type=file style=float:right;width:250px accept=".iso"><div>'+NoBreak("CDROM (.iso)")+"</div></div>";setDialogMode(11,"Redirecionamento de armazenamento",3,iderStart2,
b+"<div style=height:26px><select id=iderStartType style=float:right;width:250px><option value=0>Na pr\u00f3xima inicializa\u00e7\u00e3o<option value=1>Gracioso<option value=2>Imediato</select><div>In\u00edcio da sess\u00e3o</div></div>");b=null;try{b=localStorage.getItem("iderurl")}catch(c){}b&&(Q("storageserverurl").value=b.substring(1,b.length-1))}}
function iderStart2(){if(1!=Q("floppyImageInput").files.length&&1!=Q("cdromImageInput").files.length)messagebox("Erro de redirecionamento de armazenamento","Pelo menos um arquivo de imagem de disco deve ser selecionado.");else if(1==Q("floppyImageInput").files.length&&0!=Q("floppyImageInput").files[0].size%512)messagebox("Erro de redirecionamento de armazenamento","Arquivo .img inv\u00e1lido.");else if(1==Q("cdromImageInput").files.length&&0!=Q("cdromImageInput").files[0].size%2048)messagebox("Erro de redirecionamento de armazenamento",
"Arquivo .iso inv\u00e1lido.");else{var b=null,c=null;1==Q("floppyImageInput").files.length&&(b=Q("floppyImageInput").files[0]);1==Q("cdromImageInput").files.length&&(c=Q("cdromImageInput").files[0]);null==b&&null==c||iderStart3(b,c,Q("iderStartType").value)}}
function iderStart3(b,c,a){iderStop();ider=CreateAmtRedirect(CreateAmtRemoteIder());ider.onStateChanged=onIderStateChange;ider.m.floppy=b;ider.m.cdrom=c;ider.m.iderStart=a;ider.m.sectorStats=iderSectorStats;ider.tlsv1only=amtstack.wsman.comm.tlsv1only;ider.Start(currentMeshNode._id,16994,"*","*",0);QV("IDERDiskMapButton",!0)}
function iderStop(){ider&&(ider.m.Stop(),ider.onStateChanged=null,ider.m.onDialogPrompt=null,delete ider);iderTimer&&(clearInterval(iderTimer),delete iderTimer);iderToggleDiskMap(!1)}function onIderStateChange(b,c){QE("c2",3!=c);QE("c8",3!=c);QE("c1",3!=c);QE("c7",3!=c);QV(9,3==c);center();3==c?(urlvars.norefresh||(iderTimer=setInterval(onIderTimer,500)),onIderTimer()):iderTimer&&(clearInterval(iderTimer),delete iderTimer)}
function onIderTimer(){ider.m.Update&&ider.m.Update();-1==ider.m.bytesFromAmt?iderStop():QH(10,"<b>"+(ider.m.server?"Servidor":"")+"Sess\u00e3o IDE-R </b>, conectada,"+ider.m.bytesFromAmt+" no,"+ider.m.bytesToAmt+" Fora.")}var heatMapWidth=600,heatMapDividor={};
function iderSectorStats(b,c,a,d,g){var v=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=v.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0<a)for(;8E3<a/heatMapDividor[c];)heatMapDividor[c]*=2;c?(QV("cdromHeatMap",a),QH("cdromHeatMapText",format("<b> CDROM </b>, os blocos s\u00e3o {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("<b> Disquete </b>, os blocos s\u00e3o {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;g/=c;if(0==b)v.height=
2022-03-23 21:00:41 +03:00
6*(Math.floor(a/(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b<d+g;b++)sectorHeat(n,b,6,c)}function sectorHeat(b,c,a,d){b.fillRect(c%(heatMapWidth/a)*a,Math.floor(c/(heatMapWidth/a))*a,a,a)}
function iderToggleDiskMap(b){var c="none"!=QS("iderHeatmap").display;null==b&&(b=!c);xxdialogMode&&(b=!1);QS("iderHeatmap").display=b?"":"none"}function onIderDialogPrompt(b,c,a){iderCodeBlock&&(document.body.removeChild(iderCodeBlock),delete iderCodeBlock);c.js&&(b=document.createElement("script"),b.text=c.js,iderCodeBlock=document.body.appendChild(b));setDialogMode(11,"Redirecionamento de armazenamento",a?a:3,onIderDialogPromptOk,c.html)}
function onIderDialogPromptOk(b){1==b?window.iderServerCall?ider.m.dialogPrompt(window.iderServerCall()):ider.m.dialogPrompt():iderStop()}function iderServerStart(){xxdialogMode||(iderStop(),ider=CreateAmtRemoteServerIder(),null!=ider&&(ider.onStateChanged=onIderStateChange,ider.m.sectorStats=iderSectorStats,ider.m.onDialogPrompt=onIderDialogPrompt,ider.tlsv1only=amtstack.wsman.comm.tlsv1only,ider.Start(currentMeshNode._id,16994,"*","*",0)))}
var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Desativado",32769:"BIOS ativado",32770:"Ativar sistema operacional",32771:"BIOS e SO ativado"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
function PullRemoteAccess(){var b="*AMT_EnvironmentDetectionSettingData AMT_ManagementPresenceRemoteSAP AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule *AMT_UserInitiatedConnectionService AMT_MPSUsernamePassword".split(" ");11<amtversion&&b.push("*IPS_HTTPProxyService","IPS_HTTPProxyAccessPoint");amtstack.BatchEnum(null,b,processRemote1)}
2022-03-23 21:00:41 +03:00
function processRemote1(b,c,a,d){if(11<amtversion&&400==d){d=200;400==a.IPS_HTTPProxyAccessPoint.status&&delete a.IPS_HTTPProxyAccessPoint;400==a.IPS_HTTPProxyService.status&&delete a.IPS_HTTPProxyService;for(var g in a)200!=a[g].status&&(d=a[g].status)}if(400!=d&&!errcheck(d,b)&&void 0!=a.AMT_UserInitiatedConnectionService&&void 0!=a.AMT_UserInitiatedConnectionService.response){QV("go17",!0);xxRemoteAccess=a;xxEnvironementDetection=a.AMT_EnvironmentDetectionSettingData.response;xxEnvironementDetection.DetectionStrings=
MakeToArray(xxEnvironementDetection.DetectionStrings);xxCiraServers=a.AMT_ManagementPresenceRemoteSAP.responses;xxUserInitiatedCira=a.AMT_UserInitiatedConnectionService.response;xxRemoteAccessCredentiaLinks=a.AMT_RemoteAccessCredentialContext.responses;xxMPSUserPass=a.AMT_MPSUsernamePassword.responses;xxPolicies={User:[],Alert:[],Periodic:[]};for(g in a.AMT_RemoteAccessPolicyAppliesToMPS.responses)c=a.AMT_RemoteAccessPolicyAppliesToMPS.responses[g],b=Clone(getItem(xxCiraServers,"Name",getItem(c.ManagedElement.ReferenceParameters.SelectorSet.Selector,
"@Name","Name").Value)),b.MpsType=c.MpsType,c=getItem(c.PolicySet.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyRuleName").Value.split(" ")[0],xxPolicies[c].push(b);updateRemoteAccess()}}
function updateRemoteAccess(){if(null!=xxEnvironementDetection){var b,c="Desativado",a=xxRemoteAccess.IPS_HTTPProxyService&&xxRemoteAccess.IPS_HTTPProxyAccessPoint;xxEnvironementDetection.DetectionStrings&&0<xxEnvironementDetection.DetectionStrings.length&&(c="Ativado,"+xxEnvironementDetection.DetectionStrings.length+" "+(1<xxEnvironementDetection.DetectionStrings.length?"domains":"domain"));b=""+TableStart();b+=TableEntry("Detec\u00e7\u00e3o do ambiente",addLink(c,"editEnvironmentDetection()"));
b+=TableEntry("Op\u00e7\u00f5es de inicia\u00e7\u00e3o do usu\u00e1rio",addLinkConditional(xxUserInitiatedEnabledState[xxUserInitiatedCira.EnabledState],"editUserInitiatedCira()",xxAccountAdminName));c="<i>Nenhum</i>";if(0<xxPolicies.User.length){var c="",d;for(d in xxPolicies.User)0<c.length&&(c+=", "),c+=xxPolicies.User[d].AccessInfo,1==xxPolicies.User[d].MpsType&&(c+=" (CILA)")}b+=TableEntry("Conex\u00e3o iniciada pelo usu\u00e1rio",addLinkConditional(c,'editMpsPolicy("User")',xxAccountAdminName));
2022-03-23 21:00:41 +03:00
c="<i>Nenhum</i>";if(0<xxPolicies.Alert.length)for(d in c="",xxPolicies.Alert)0<c.length&&(c+=", "),c+=xxPolicies.Alert[d].AccessInfo,1==xxPolicies.Alert[d].MpsType&&(c+=" (CILA)");b+=TableEntry("Conex\u00e3o iniciada por alerta",addLinkConditional(c,'editMpsPolicy("Alert")',xxAccountAdminName));c="<i>Nenhum</i>";if(0<xxPolicies.Periodic.length)for(d in c="",xxPolicies.Periodic)0<c.length&&(c+=", "),c+=xxPolicies.Periodic[d].AccessInfo,1==xxPolicies.Periodic[d].MpsType&&(c+=" (CILA)");var g=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,
"PolicyRuleName","Peri\u00f3dico");if(g){var v=atob(g.ExtendedData);0==ReadInt(v,0)&&(c+=format(", a cada {0} segundos",ReadInt(v,4)));1==ReadInt(v,0)&&(g=ReadInt(v,4),v=ReadInt(v,8),10>v&&(v="0"+v),c+=", at "+g+":"+v+" daily")}b+=TableEntry("Conex\u00e3o peri\u00f3dica",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"<br>"+TableStart2();b+="<tr><td class=r1 style=padding-left:15px><br>Gerenciar servidores de gerenciamento remoto Intel&reg; AMT.<br><br>";if(0==
xxCiraServers.length)b+="<div style=padding-left:15px><br><i>Nenhum servidor remoto encontrado.</i></div><br>";else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="<div class=itemBar onclick=showServerDetails("+d+")><div style=padding-top:3px><b>"+xxCiraServers[d].AccessInfo+"</b>"+EscapeHtml(c)+"</div></div>";if(a)if(b+="<br>Gerenciar proxies HTTP usados \u200b\u200bpara conex\u00f5es de gerenciamento.<br><br>",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,
0==c.length)b+="<div style=padding-left:15px><br><i>Nenhum proxy configurado.</i></div><br>";else for(d in c)b+="<div class=itemBar onclick=showProxyDetails("+d+")><div style=padding-top:3px><b>"+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+"</b> / "+EscapeHtml(c[d].NetworkDnsSuffix)+"</div></div>";d="";xxAccountAdminName&&(d=AddButton("Adicionar servidor...","AddRemoteAccessServer()"),a&&(d+=AddButton("Adicionar proxy ...","AddRemoteAccessProxy()")));b+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullRemoteAccess()")+
d);QH(52,b)}}var xxEditMpsPolicyType;
2022-03-23 21:00:41 +03:00
function editMpsPolicy(b){var c="",a=11<amtversion||11==amtversion&&6<=amtversionmin,d=xxEditMpsPolicyType=b;"User"==d&&(d="Iniciado pelo usu\u00e1rio");var d=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",d),c=c+"<div style=height:26px><select id=d2server1 style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=-1>(Nenhum)",g;for(g in xxCiraServers)c+="<option value="+g+""+(xxPolicies[b][0]&&xxPolicies[b][0].Name==xxCiraServers[g].Name?" selected":
"")+">"+xxCiraServers[g].AccessInfo;c+="</select><div>Servidor prim\u00e1rio</div></div>";a&&(c+="<div style=height:26px><select id=d2server1cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - Externo<option value=1"+(xxPolicies[b][0]&&1==xxPolicies[b][0].MpsType?" selected":"")+">CILA - Interno</select><div>Tipo MPS Prim\u00e1rio</div></div>");if(1<xxCiraServers.length){c+="<div style=height:26px><select id=d2server2 style=float:right;width:206px onchange=editMpsPolicyUpdate()>";
c+="<option value=-1>(Nenhum)";for(g in xxCiraServers)c+="<option value="+g+""+(xxPolicies[b][1]&&xxPolicies[b][1].Name==xxCiraServers[g].Name?" selected":"")+">"+xxCiraServers[g].AccessInfo;c+="</select><div>Servidor secund\u00e1rio</div></div>";a&&(c+="<div style=height:26px><select id=d2server2cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - Externo<option value=1"+(xxPolicies[b][1]&&1==xxPolicies[b][1].MpsType?" selected":"")+">CILA - Interno</select><div>Tipo MPS secund\u00e1rio</div></div>")}g=
0;d&&(g=d.TunnelLifeTime);c+="<div style=height:26px><input id=d2lifetime style=float:right;width:200px onchange=editMpsPolicyUpdate() value="+g+">";c+="<div>Vida \u00fatil do t\u00fanel (segundos)</div></div>";"Periodic"==b&&(a=0,g=3600,d&&(d=atob(d.ExtendedData),a=ReadInt(d,0),g=ReadInt(d,4),1==a&&(d=ReadInt(d,8),10>d&&(d="0"+d),g+=":"+d)),c+="<div style=height:26px><select id=d2ttype style=float:right;width:206px onchange=editMpsPolicyUpdate()>",c+="<option value=0"+(0==a?" selected":"")+">Peri\u00f3dico, intervalo de tempo<option value=1"+
(1==a?" selected":"")+">Hora do dia, uma vez ao dia",c+="</select><div>Tipo de gatilho</div></div><div style=height:26px><input id=d2timer style=float:right;width:200px onkeyup=editMpsPolicyUpdate() value="+g+"><div id=ttypelabel></div></div>");setDialogMode(11,format("Conex\u00e3o {0}",b),3,editMpsPolicyOk,c);editMpsPolicyUpdate()}
function editMpsPolicyUpdate(){var b=11<amtversion||11==amtversion&&6<=amtversionmin,c=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==c&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var a=Q("d2timer").value.split(":");if(2!=a.length)c=!1;else{var d=parseInt(a[0]),a=parseInt(a[1]);if(0>d||23<d||0>a||59<a)c=!1}}QE("c54",c);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
-1!=Q("d2server1").value),QH("ttypelabel",0==Q("d2ttype").value?"Intervalo de disparo (segundos)":"Hora do dia (HH: MM)"),QE("d2ttype",-1!=Q("d2server1").value));QE("d2lifetime",-1!=Q("d2server1").value);b&&(QE("d2server1cira",-1<Q("d2server1").value),1<xxCiraServers.length&&QE("d2server2cira",-1<Q("d2server1").value&&-1<Q("d2server2").value))}
function editMpsPolicyOk(){var b=xxEditMpsPolicyType;"User"==b&&(b="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",b)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:b},editMpsPolicyOk2):editMpsPolicyOk2()}
function editMpsPolicyOk2(b,c,a,d){b=11<amtversion||11==amtversion&&6<=amtversionmin;if(-1==Q("d2server1").value)PullRemoteAccess();else{c=0;"Alert"==xxEditMpsPolicyType&&(c=1);"Periodic"==xxEditMpsPolicyType&&(c=2);a=null;2==c&&(a=Q("d2ttype").value,d=IntToStr(Q("d2timer").value),1==a&&(d=Q("d2timer").value.split(":"),d=IntToStr(parseInt(d[0]))+IntToStr(parseInt(d[1]))),a=btoa(IntToStr(a)+d));var g,v;0<=Q("d2server1").value&&(g='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
xxCiraServers[Q("d2server1").value].Name+"</Selector></SelectorSet></ReferenceParameters>");0<=Q("d2server1").value&&1<xxCiraServers.length&&0<=Q("d2server2").value&&(v='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>");d=[];var n=[];b?g&&(0==Q("d2server1cira").value?d.push(g):n.push(g),v&&(0==Q("d2server2cira").value?d.push(v):n.push(v))):g&&(d.push(g),v&&d.push(v));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp;
function editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="Digite at\u00e9 5 sufixos de dom\u00ednio da intranet. Se o computador estiver fora desses dom\u00ednios, as portas locais Intel&reg; AMT ser\u00e3o fechadas e as conex\u00f5es do servidor remoto estar\u00e3o ativas.<br><br>");0==editEnvironmentDetectionTmp.length&&(c+="<i>Nenhum dom\u00ednio da intranet, detec\u00e7\u00e3o de ambiente desativada.</i><br>");
for(var a in editEnvironmentDetectionTmp)c+="<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Retirar","editEnvironmentDetectionRemove("+a+")")+'</div><div style=padding-top:3px;max-width:260px;overflow:hidden title="'+editEnvironmentDetectionTmp[a]+'"><b>'+editEnvironmentDetectionTmp[a]+"</b></div></div>";xxAccountAdminName&&5>editEnvironmentDetectionTmp.length&&(c+="<br><input id=edInput placeholder=intranet.org style=width:276px onkeyup=edInputChg() maxlength=63><input type=button id=edAdd value=Add style=width:80px;margin-left:5px onclick=editEnvironmentDetectionAdd()>");
1==b?QH(63,c):setDialogMode(11,"Detec\u00e7\u00e3o de ambiente",xxAccountAdminName?3:1,editEnvironmentDetectionDlg,c);edInputChg()}function editEnvironmentDetectionDlg(){if(xxAccountAdminName){var b=Clone(xxEnvironementDetection);b.DetectionStrings=editEnvironmentDetectionTmp;amtstack.Put("AMT_EnvironmentDetectionSettingData",b,editEnvironmentDetectionDlg2,0,1)}}
function editEnvironmentDetectionDlg2(b,c,a,d){200!=d?messagebox("Detec\u00e7\u00e3o de ambiente",format("Falha ao adicionar servidor, status {0}",d)):a.Body.ReturnValue&&0!=a.Body.ReturnValue?messagebox("Detec\u00e7\u00e3o de ambiente",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}function edInputChg(){5>editEnvironmentDetectionTmp.length&&QE("edAdd",0<Q("edInput").value.length)}
function editEnvironmentDetectionAdd(){editEnvironmentDetectionTmp.push(Q("edInput").value);editEnvironmentDetection(1)}function editEnvironmentDetectionRemove(b){editEnvironmentDetectionTmp.splice(b,1);editEnvironmentDetection(1)}
function editUserInitiatedCira(){if(!xxdialogMode){var b="",c;for(c in xxUserInitiatedEnabledState)b+="<input type=radio name=d11 id=wl"+c+" value="+c+" "+(xxUserInitiatedCira.EnabledState==c?"checked":"")+">"+xxUserInitiatedEnabledState[c]+"<br>";setDialogMode(11,"T\u00fanel iniciado pelo usu\u00e1rio",3,editUserInitiatedCiraDlg,b)}}
function editUserInitiatedCiraDlg(){amtstack.AMT_UserInitiatedConnectionService_RequestStateChange(document.querySelector("input[name=d11]:checked").value,null,editUserInitiatedCiraDlg2)}function editUserInitiatedCiraDlg2(b,c,a,d){200==d&&amtstack.Get("AMT_UserInitiatedConnectionService",editUserInitiatedCiraDlg3,0,1)}function editUserInitiatedCiraDlg3(b,c,a,d){200==d&&(xxUserInitiatedCira=a.Body,updateRemoteAccess())}var xxShowServerDetailsHandle;
function showServerDetails(b){xxShowServerDetailsHandle=b;var c=xxCiraServers[b],a;a=""+addHtmlValue("Nome de acesso",c.AccessInfo);c.Port&&(a+=addHtmlValue("Porta",c.Port));c.CN&&(a+=addHtmlValue("Nome comum",c.CN));if(c=getElementWithContextSelectorValue(xxRemoteAccessCredentiaLinks,c.Name))c=c.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,0<c.indexOf("Username")?(a+=addHtmlValue("Tipo de Autentica\u00e7\u00e3o","Usu\u00e1rio e Senha / TLS de Autentica\u00e7\u00e3o de Servidor"),
a+=addHtmlValue("ID Remoto",getInstance(xxMPSUserPass,c).RemoteID)):(a+=addHtmlValue("Tipo de Autentica\u00e7\u00e3o","TLS de certificado / autentica\u00e7\u00e3o m\u00fatua"),c=getInstance(xxCertificates,c),a+=addHtmlValue("nome v\u00e1lido",parseCertName(c.Subject).CN));c=1;xxAccountAdminName&&(c=5);setDialogMode(11,"Servidor remoto #"+(b+1),c,showServerDetailsOk,a)}
function getElementWithContextSelectorValue(b,c){for(var a in b){b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector=MakeToArray(b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector);for(var d in b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector)if(b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector[d].Value==c)return b[a]}return null}
function showServerDetailsOk(b){2==b&&amtstack.Delete("AMT_ManagementPresenceRemoteSAP",{Name:xxCiraServers[xxShowServerDetailsHandle].Name},showServerDetailsOk2)}function showServerDetailsOk2(b,c,a,d){408==d?messagebox("Remo\u00e7\u00e3o de servidor remoto","N\u00e3o foi poss\u00edvel remover o servidor, acesso negado."):PullRemoteAccess()}function parseCertName(b){var c={},a=b.split(","),d;for(d in a)b=a[d].indexOf("="),c[a[d].substring(0,b)]=a[d].substring(b+1);return c}
function showProxyDetails(b){var c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[b],a=addHtmlValue("Nome de acesso",c.AccessInfo+":"+c.ProxyPort),a=a+addHtmlValue("Sufixo DNS",c.NetworkDnsSuffix),a=a+addHtmlValue("Tipo de proxy",["Administrator","Operating system"][c.Type]),c=1;xxAccountAdminName&&(c=5);setDialogMode(11,"Proxy HTTP #"+(b+1),c,showProxyDetailsOk,a,b)}
function showProxyDetailsOk(b,c){var a=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[c];2==b&&amtstack.Delete("IPS_HTTPProxyAccessPoint",{Name:a.Name},showProxyDetailsOk2)}function showProxyDetailsOk2(b,c,a,d){408==d?messagebox("Remo\u00e7\u00e3o de Proxy HTTP","N\u00e3o foi poss\u00edvel remover o proxy HTTP, acesso negado."):PullRemoteAccess()}
function AddRemoteAccessProxy(){var b;b='<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessProxyUpdate()><option value=2>Nome do host FQDN<option value=3>Endere\u00e7o IPv4<option value=4>Endere\u00e7o IPv6</select><div>Tipo de conex\u00e3o</div></div><div style=height:26px><input id=d2host style=float:right;width:200px maxlength=255 onkeyup=AddRemoteAccessProxyUpdate()><div id=d2typespan></div></div><div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px onkeyup=AddRemoteAccessProxyUpdate()><div>Porta</div></div>';b+=
"<div style=height:26px><input id=d2domain style=float:right;width:200px maxlength=191 onkeyup=AddRemoteAccessProxyUpdate()><div>Sufixo DNS</div></div>";setDialogMode(11,"Adicionar proxy HTTP",3,AddRemoteAccessProxyOk,b);AddRemoteAccessProxyUpdate()}
function AddRemoteAccessProxyUpdate(){var b=0!=Q("d2host").value.length&&0!=Q("d2domain").value.length;if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;QE("c54",b);QH("d2typespan",["","","FQDN / nome do host","Endere\u00e7o IPv4","Endere\u00e7o IPv6"][Q("d2type").value])}function AddRemoteAccessProxyOk(){amtstack.IPS_HTTPProxyService_AddProxyAccessPoint(Q("d2host").value,Q("d2type").value,parseInt(Q("d2port").value),Q("d2domain").value,AddRemoteAccessProxyOk2)}
function AddRemoteAccessProxyOk2(b,c,a,d){200!=d?messagebox("Adicionar servidor proxy","Falha ao adicionar proxy, status"+d):0!=a.Body.ReturnValue?messagebox("Adicionar servidor proxy",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
function AddRemoteAccessServer(){var b=[],c;for(c in xxCertificates)xxCertificates[c].XPrivateKey&&b.push(xxCertificates[c]);var a;a="<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()><option value=201>Nome do host FQDN<option value=3>Endere\u00e7o IPv4</select><div>Tipo de conex\u00e3o</div></div><div style=height:26px><input id=d2name style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div id=d2lname></div></div>";a+='<div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px value=4433 onkeyup=AddRemoteAccessServerUpdate()><div>Porta do servidor</div></div>';
a+="<div style=height:26px id=d2ucn><input id=d2cn style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Nome comum do servidor</div></div>";a+="<div style=height:26px><select id=d2auth style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";0<b.length&&(a+="<option value=1>Certificado");a+="<option value=2>Usu\u00e1rio senha</select><div>Tipo de Autentica\u00e7\u00e3o</div></div>";a+="<span id=d2utype>";a+="<div style=height:26px><input id=d2user style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Nome do usu\u00e1rio</div></div>";
a+="<div style=height:26px><input id=d2pass style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Senha forte</div></div>";a+="</span>";a+="<span id=d2ctype>";a+="<div style=height:26px><select id=d2cert style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";for(c in b)a+="<option value="+b[c].InstanceID.substring(34)+">"+parseCertName(b[c].Subject).CN;a+="</select><div>Certificado</div></div></span>";setDialogMode(11,"Adicionar servidor remoto",3,AddRemoteAccessServerOk,
a);AddRemoteAccessServerUpdate()}
function AddRemoteAccessServerOk(){var b,c,a,d;1==Q("d2auth").value?b='<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://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT Certificate: Handle: '+Q("d2cert").value+
"</Selector></SelectorSet></ReferenceParameters>":(c=Q("d2user").value,a=Q("d2pass").value);0<Q("d2cn").value.length&&(d=Q("d2cn").value);amtstack.AMT_RemoteAccessService_AddMpServer(Q("d2name").value,Q("d2type").value,Q("d2port").value,Q("d2auth").value,b,c,a,d,AddRemoteAccessServerOk2)}
function AddRemoteAccessServerOk2(b,c,a,d){200!=d?messagebox("Adicionar servidor da Internet",format("Falha ao adicionar servidor, status {0}",d)):0!=a.Body.ReturnValue?messagebox("Adicionar servidor da Internet",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
function AddRemoteAccessServerUpdate(){var b=0!=Q("d2name").value.length;3==Q("d2type").value&&1==b&&(b=0!=Q("d2cn").value.length);2==Q("d2auth").value&&1==b&&(b=0!=Q("d2user").value.length&&passwordcheck(Q("d2pass").value));if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;if(-1!=Q("d2name").value.indexOf(":")||3==Q("d2type").value&&-1!=Q("d2cn").value.indexOf(":"))b=!1;QH("d2lname",201==Q("d2type").value?"nome de anfitri\u00e3o":"Endere\u00e7o IPv4");QV("d2utype",2==Q("d2auth").value);
QV("d2ucn",3==Q("d2type").value);QV("d2ctype",1==Q("d2auth").value);QE("c54",b)}
function showEditNameDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_GeneralSettings.response.HostName,a=amtsysstate.AMT_GeneralSettings.response.DomainName;null!=a&&0<a.length&&(c+="."+a);c='<br><div style=height:26px><input id=d11name value="'+c+'" style=float:right;width:200px><div>Nome e dom\u00ednio</div></div>';1==b&&(b=1==amtsysstate.AMT_GeneralSettings.response.SharedFQDN,c+="<div style=height:26px><select id=d11fqdn style=float:right;width:200px><option value=true "+(b?"selected":"")+'>Compartilhado, igual ao SO<option value="false" '+
(b?"":"selected")+">Dedicado, diferente do SO</select><div>Partilha de nomes</div></div>");setDialogMode(11,"Nome do computador",3,editNameDlgOk,c)}}function editNameDlgOk(){var b=Q("d11name").value,c=b.indexOf("."),a="";0<=c&&(a=b.substring(c+1),b=b.substring(0,c));c=Clone(amtsysstate.AMT_GeneralSettings.response);c.HostName=b;c.DomainName=a;Q("d11fqdn")&&(c.SharedFQDN=d11fqdn.value);amtstack.Put("AMT_GeneralSettings",c,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
function computerNameGet(b,c,a,d){200==d&&(amtsysstate.AMT_GeneralSettings.response=a.Body,updateSystemStatus())}function showEditDnsDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,c=0;1==b.DDNSUpdateByDHCPServerEnabled&&(c=1);1==b.DDNSUpdateEnabled&&(c=2);c36.value=c;c37.value=b.DDNSPeriodicUpdateInterval;c38.value=b.DDNSTTL;showEditDnsDlgChange();setDialogMode(23,"Cliente DNS din\u00e2mico",3,showEditDnsDlgOk)}}
function showEditDnsDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response);b.DDNSUpdateEnabled=2==c36.value?!0:!1;b.DDNSUpdateByDHCPServerEnabled=1==c36.value?!0:!1;2==c36.value&&(b.DDNSPeriodicUpdateInterval=c37.value,b.DDNSTTL=c38.value);amtstack.Put("AMT_GeneralSettings",b,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
function showEditDnsDlgChange(){QE("c37",2==c36.value);QE("c38",2==c36.value)}function showFeaturesDlg(){!xxdialogMode&&xxAccountAdminName&&(c14.checked=amtfeatures[0],c16.checked=amtfeatures[3],c17.checked=amtfeatures[2],c18.checked=amtfeatures[1],QV("c15",null!=amtfeatures[3]),setDialogMode(9,"Recursos da Intel&reg; AMT",3,featuresDlgOk))}
2022-03-23 21:00:41 +03:00
function featuresDlgOk(){var b=amtsysstate.AMT_RedirectionService.response;b.ListenerEnabled=c14.checked;b.EnabledState=32768+((c17.checked?1:0)+(c18.checked?2:0));amtstack.AMT_RedirectionService_RequestStateChange(b.EnabledState,function(c,a,d,g){200!=g?messagebox("Erro","Erro RedirectionService, RequestStateChange"+g):null!=amtfeatures[3]&&amtstack.CIM_KVMRedirectionSAP_RequestStateChange(c16.checked?2:3,0,function(a,c,d,g){200!=g?messagebox("Erro","Erro KVMRedirectionSAP, RequestStateChange"+
g):amtstack.Put("AMT_RedirectionService",b,function(a,b,c,d){200!=d?messagebox("Erro","Erro RedirectionService PUT"+d):(amtstack.Get("AMT_RedirectionService",featuresDlgGet1,0,1),amtstack.Get("CIM_KVMRedirectionSAP",featuresDlgGet2,0,1))},0,1)})})}function featuresDlgGet1(b,c,a,d){200==d&&(amtsysstate.AMT_RedirectionService.response=a.Body,updateSystemStatus())}function featuresDlgGet2(b,c,a,d){200==d&&(amtsysstate.CIM_KVMRedirectionSAP.response=a.Body,updateSystemStatus())}
function showEnableBootServiceDlg(){xxdialogMode||(null!=amtsysstate.CIM_BootService.response.EnabledState&&(QV("d26rpediv",15<amtversion),15<amtversion&&(c49.checked=amtsysstate.CIM_BootService.response.EnabledState&2,c50.checked=!c49.checked),c51.checked=amtsysstate.CIM_BootService.response.EnabledState&1,c52.checked=!c51.checked),setDialogMode(26,"Boot Features",3,showEnableBootServiceDlgOk))}
function showEnableBootServiceDlgOk(){var b=32768+parseInt(document.querySelector("input[name=d26a]:checked").value);15<amtversion&&(b+=parseInt(document.querySelector("input[name=d26b]:checked").value));amtstack.CIM_BootService_RequestStateChange(b,null,showEnableBootServiceDlgResponse,b)}
2022-03-23 21:00:41 +03:00
function showEnableBootServiceDlgResponse(b,c,a,d,g){200==d?("SUCCESS"!=a.Body.ReturnValueStr&&messagebox("Boot Features Error",a.Body.ReturnValueStr),amtstack.Get("CIM_BootService",showEnableBootServiceDlgResponse2,g),PullSystemStatus()):a.Header.WsmanError?messagebox("Boot Features Error",a.Header.WsmanError.replace(/_/g," ")):messagebox("Boot Features Error","Error, Status = "+d)}
function showEnableBootServiceDlgResponse2(b,c,a,d,g){200==d&&a.Body.EnabledState!=g&&messagebox("Boot Features Error","Unable to set OCR/RPE, check that these features are enabled in BIOS.")}function showConsentDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_OptInService.response.OptInRequired;c19.checked=0==b;c20.checked=1==b;c21.checked=4294967295==b;setDialogMode(10,"Consentimento do Usu\u00e1rio",3,consentDlgOk)}}
function consentDlgOk(){amtsysstate.IPS_OptInService.response.OptInRequired=document.querySelector("input[name=d10]:checked").value;amtstack.Put("IPS_OptInService",amtsysstate.IPS_OptInService.response,function(){amtstack.Get("IPS_OptInService",consentGet,0,1)},0,1)}function consentGet(b,c,a,d){200==d&&PullSystemStatus()}var ipv6addrtype="Endere\u00e7o local do link;Endere\u00e7o local da rede;Endere\u00e7o global;Usu\u00e1rio configurado;N\u00e3o permitido;DAD em andamento;v\u00e1lido;descontinuada;preferido / descontinuado;expirado;colis\u00e3o;n\u00e3o permitido".split(";");
function showIPv6AddrDlg(b,c){if(!xxdialogMode){var a=TableStart();t=c.split(",");for(var d=0;d<t.length;d+=3)a+=TableEntry("<b>"+t[d]+"</b><br><span style=font-size:10px>"+ipv6addrtype[t[d+1]]+","+ipv6addrtype[+t[d+2]+5]+"</span>","");setDialogMode(11,0==b?"Endere\u00e7os IPv6 para interface com fio":"Endere\u00e7os IPv6 para interface sem fio",1,null,a+TableEnd())}}
function showIPv6StateDlg(b,c){if(!xxdialogMode&&amtsysstate){var a=amtsysstate.IPS_IPv6PortSettings.responses[b];ipv6manual=0==b&&(isIpAddress(a.IPv6Address)||isIpAddress(a.DefaultRouter)||isIpAddress(a.PrimaryDNS)||isIpAddress(a.SecondaryDNS));QV(69,0==b);QV(70,!1);QV("d21o0",!0);QV("d21l0",!0);QH("d21l0","IPv6 desativado");QH("d21l1","IPv6 ativado, autom\u00e1tico");QH("d21l2","IPv6 ativado, endere\u00e7o autom\u00e1tico + manual");d21o0.checked=!c;d21o1.checked=c&&
!ipv6manual;d21o2.checked=c&&ipv6manual;c31.value=isIpAddress(a.IPv6Address,"");c33.value=isIpAddress(a.DefaultRouter,"");c34.value=isIpAddress(a.PrimaryDNS,"");c35.value=isIpAddress(a.SecondaryDNS,"");setDialogMode(21,0==b?"Suporte IPv6 para interface com fio":"Suporte IPv6 para interface sem fio",3,function(){showIPv6StateDlgOk(b)});updateIPSetupDlg()}}
function showIPv6StateDlgOk(b){var c='<w:SelectorSet><w:Selector Name="InstanceID">Intel(r) IPS IPv6 Settings '+b+"</w:Selector></w:SelectorSet>",a=amtsysstate.IPS_IPv6PortSettings.responses[b];0==b&&(d21o1.checked&&(a.IPv6Address=a.DefaultRouter=a.PrimaryDNS=a.SecondaryDNS="::",amtstack.Put("IPS_IPv6PortSettings",a,showIPv6StateDlgDone,null,0,c)),d21o2.checked&&(a.IPv6Address=""==c31.value?"::":c31.value.toLocaleLowerCase(),a.DefaultRouter=""==c33.value?"::":c33.value.toLocaleLowerCase(),
a.PrimaryDNS=""==c34.value?"::":c34.value.toLocaleLowerCase(),a.SecondaryDNS=""==c35.value?"::":c35.value.toLocaleLowerCase(),amtstack.Put("IPS_IPv6PortSettings",a,showIPv6StateDlgDone,null,0,c)));c=amtsysstate.CIM_ElementSettingData.responses;for(a=0;a<c.length;a++)if(c[a].SettingData&&c[a].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+b){var d=getItem(c[a].ManagedElement.ReferenceParameters.SelectorSet.Selector,"@Name",
2022-03-23 21:00:41 +03:00
"CreationClassName").Value,g=getItem(c[a].ManagedElement.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value,d='<w:SelectorSet><w:Selector Name="ManagedElement"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/'+d+'</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">'+
d+'</w:Selector><w:Selector Name="DeviceID">'+g+'</w:Selector><w:Selector Name="SystemCreationClassName">CIM_ComputerSystem</w:Selector><w:Selector Name="SystemName">Intel(r) AMT</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector><w:Selector Name="SettingData"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://intel.com/wbem/wscim/1/ips-schema/1/IPS_IPv6PortSettings</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">Intel(r) IPS IPv6 Settings '+
b+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector></w:SelectorSet>",g=Clone(c[a]);g.IsCurrent=d21o0.checked?2:1;amtstack.Put("CIM_ElementSettingData",g,showIPv6StateDlgDone,null,0,d)}}function showIPv6StateDlgDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("Suporte IPv6",format("N\u00e3o foi poss\u00edvel definir o estado IPv6, erro {0}",d))}
function showPingActionDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,b=(1==b.PingResponseEnabled)+((1==b.RmcpPingResponseEnabled)<<1);d20a.checked=0==b;d20b.checked=1==b;d20c.checked=2==b;d20d.checked=3==b;setDialogMode(20,"Resposta de ping Intel&reg; AMT",3,showPingActionDlgOk)}}
function showPingActionDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response),c=document.querySelector("input[name=d20]:checked").value;b.PingResponseEnabled=0!=(c&1);b.RmcpPingResponseEnabled=0!=(c&2);amtstack.Put("AMT_GeneralSettings",b,PullSystemStatus,0,1)}
function showIPSetupDlg(){if(!xxdialogMode&&null!=amtsysstate){var b=amtsysstate.AMT_EthernetPortSettings.responses[0];QV(68,6<amtversion);6<amtversion&&(Q("d21ipsync").checked=b.IpSyncEnabled);QV(69,!0);QV(70,!0);QV("d21o0",!1);QV("d21l0",!1);QH("d21l1","Configura\u00e7\u00e3o autom\u00e1tica usando o servidor DHCP");QH("d21l2","Configura\u00e7\u00e3o est\u00e1tica usando as configura\u00e7\u00f5es IPv4 abaixo");d21o1.checked=1==b.DHCPEnabled;d21o2.checked=
!d21o1.checked;c31.value=isIpAddress(b.IPAddress,"");c32.value=isIpAddress(b.SubnetMask,"");c33.value=isIpAddress(b.DefaultGateway,"");c34.value=isIpAddress(b.PrimaryDNS,"");c35.value=isIpAddress(b.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"Configura\u00e7\u00f5es IPv4",3,showIPSetupDlgOk)}}
function updateIPSetupDlg(){var b=!0;d21o2.checked&&"IPv6 ativado, endere\u00e7o autom\u00e1tico + manual"==Q("d21l2").innerHTML&&2>c31.value.split(":").length&&(b=!1);QE("c54",b);c31.disabled=c32.disabled=c33.disabled=c34.disabled=c35.disabled=!(d21o2.checked&&(7>amtversion||0==Q("d21ipsync").checked))}
function showIPSetupDlgOk(){var b=Clone(amtsysstate.AMT_EthernetPortSettings.responses[0]);b.DHCPEnabled=d21o1.checked;delete b.IPAddress;delete b.SubnetMask;delete b.DefaultGateway;delete b.PrimaryDNS;delete b.SecondaryDNS;6<amtversion&&(b.IpSyncEnabled=Q("d21ipsync").checked);0==d21o1.checked&&0==Q("d21ipsync").checked&&(b.IPAddress=c31.value,b.SubnetMask=c32.value,b.DefaultGateway=c33.value,""!=c34.value&&(b.PrimaryDNS=c34.value),""!=c35.value&&
(b.SecondaryDNS=c35.value));amtstack.Put("AMT_EthernetPortSettings",b,showIPSetupDlgDone,0,1,b)}function showIPSetupDlgDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("Configura\u00e7\u00f5es IPv4",format("N\u00e3o foi poss\u00edvel definir os par\u00e2metros de rede, erro {0}",d))}amtPowerBootCapabilities=null;
function showPowerActionDlg(){xxdialogMode||(statusbox("A\u00e7\u00f5es de poder","Verificando recursos ..."),amtstack.Get("AMT_BootCapabilities",powerActionResponse00,0,1))}
2022-03-23 21:00:41 +03:00
function powerActionResponse00(b,c,a,d){if(200==d){b=3;try{b=2==amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState?1:2}catch(g){}amtPowerBootCapabilities=a.Body;QH("d5actionSelect","");b&2&&addOption("d5actionSelect","Energizar",2);b&1&&(addOption("d5actionSelect","Redefinir",10),addOption("d5actionSelect","Ciclo de energia",5),addOption("d5actionSelect","Desligar",8));1==amtPowerBootCapabilities.ForceDiagnosticBoot&&(b&2&&addOption("d5actionSelect","Ligar ao diagn\u00f3stico",300),
b&1&&addOption("d5actionSelect","Redefinir para diagn\u00f3stico",301));9<amtversion&&b&1&&(addOption("d5actionSelect","Despertar do sistema operacional em modo de espera",500),addOption("d5actionSelect","Economia de energia do SO",501),addOption("d5actionSelect","Soft-off",12),addOption("d5actionSelect","Redefini\u00e7\u00e3o suave",14),addOption("d5actionSelect","Dormir",4),addOption("d5actionSelect","Hibernate",7));1==amtPowerBootCapabilities.BIOSSetup&&(b&2&&addOption("d5actionSelect","Ligue o BIOS",
100),b&1&&addOption("d5actionSelect","Redefinir para BIOS",101));1==amtPowerBootCapabilities.SecureErase&&(b&2&&addOption("d5actionSelect","Ligue para apagar com seguran\u00e7a",104),b&1&&addOption("d5actionSelect","Redefinir para exclus\u00e3o segura",105));null!=amtPowerBootCapabilities.PlatformErase&&null!=amtsysstate.CIM_BootService&&32768<=amtsysstate.CIM_BootService.response.EnabledState&&amtsysstate.CIM_BootService.response.EnabledState&2&&(b&2&&addOption("d5actionSelect","Power up to Platform Erase",
106),b&1&&addOption("d5actionSelect","Reset to Platform Erase",107));b&1&&addOption("d5actionSelect","Redefinir para disquete IDE-R",200);b&2&&addOption("d5actionSelect","Ligue o disquete IDE-R",201);b&1&&addOption("d5actionSelect","Redefinir para CD-ROM IDE-R",202);b&2&&addOption("d5actionSelect","Ligue o CD-ROM IDE-R",203);b&1&&addOption("d5actionSelect","Redefinir para PXE",400);b&2&&addOption("d5actionSelect","Ligue o PXE",401);addOption("d5actionSelect","A\u00e7\u00e3o personalizada ...",999);
5<amtversion&&addOption("d5actionSelect","Consentimento do usu\u00e1rio ...",998);setDialogMode(5,"A\u00e7\u00f5es de poder",3,powerActionDlgCheck)}else messagebox("A\u00e7\u00e3o de poder",format("N\u00e3o foi poss\u00edvel obter os recursos do sistema, erro {0}",d))}
2022-03-23 21:00:41 +03:00
function powerActionDlgCheck(){AmtOcrPba=null;AmtOcrPbaLength=0;var b=d5actionSelect.value;500==b||501==b?amtstack.RequestOSPowerStateChange(501==b?3:2,function(b,a,d,g){200==g?QH(60,"A\u00e7\u00e3o de energia conclu\u00edda."):QH(60,format("Erro de a\u00e7\u00e3o de energia # {0}.",g));setDialogMode(1,"A\u00e7\u00e3o de poder",0);setTimeout(function(){setDialogMode(0)},1300)}):104==b||105==b?(b="Confirmar a execu\u00e7\u00e3o do Intel&reg; Remote Secure Erase?<br>Digite a senha de Exclus\u00e3o segura, se necess\u00e1rio.<br><br><div style=height:16px><input type=password id=rsepass maxlength=32 style=float:right;width:240px><div>Senha</div></div><br><div style=color:red><b> AVISO: </b> Isso limpar\u00e1 os dados no sistema remoto.</div>",
rsepass=1,setDialogMode(11,"A\u00e7\u00f5es de poder",3,powerActionDlg,b)):106==b||107==b?powerActionDlgRPE():powerActionDlg()}
function powerActionDlgRPE(b){var c;c="Confirm execution of Intel&reg; Remote Platform Erase?<br><br><div style=color:red><b> AVISO: </b> Isso limpar\u00e1 os dados no sistema remoto.</div>";var a=[],d=amtPowerBootCapabilities.PlatformErase;d&4&&a.push("<label><input id=rpef2 type=checkbox onchange=powerActionDlgRPEValidate()>Secure Erase All SSDs</label>");d&64&&a.push("<label><input id=rpef6 type=checkbox onchange=powerActionDlgRPEValidate()>TPM Clear</label>");d&33554432&&a.push("<label><input id=rpef25 type=checkbox onchange=powerActionDlgRPEValidate()>Clear BIOS NVM Variables</label>");
d&67108864&&a.push("<label><input id=rpef26 type=checkbox onchange=powerActionDlgRPEValidate()>BIOS Reload of Golden Configuration</label>");d&-2147483648&&a.push("<label><input id=rpef31 type=checkbox onchange=powerActionDlgRPEValidate()>CSME Unconfigure</label>");1<a.length&&(c+=format("<br />Select the actions to take:<br /><br /><div style=margin-left:16px>{0}</div><br />",a.join("<br />")));c+="<div id=rpessdpass style=margin-top:4px;margin-bottom:4px;display:none>"+addHtmlValue("SSD Master Password",
"<input id=rpessdpassx style=width:210px maxlength=64 type=input>")+"</div>";setDialogMode(11,"A\u00e7\u00f5es de poder",3,powerActionDlgRPEEx,c,b);QE("c54",!1)}function powerActionDlgRPEValidate(){var b=0,c=amtPowerBootCapabilities.PlatformErase,a=[2,6,25,26,31],d;for(d in a)c&1<<a[d]&&Q("rpef"+a[d]).checked&&(b+=1<<a[d]);QV("rpessdpass",b&4);QE("c54",b)}var platfromEraseTLV=null;
function powerActionDlgRPEEx(b,c){var a=0,d=amtPowerBootCapabilities.PlatformErase,g=[1,2,6,25,26,31],v;for(v in g)d&1<<g[v]&&Q("rpef"+g[v]).checked&&(a+=1<<g[v]);d=makeUefiBootParam(1,a,4);g=1;a&2&&(d+=makeUefiBootParam(10,Q("rpepsidx").value),g++);a&4&&(d+=makeUefiBootParam(20,Q("rpessdpassx").value),g++);platfromEraseTLV={tlv:btoa(d),tlvlen:g};c?(statusbox("A\u00e7\u00e3o de poder","Verificando estado ..."),amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)):powerActionDlg()}
function powerActionDlg(){var b=d5actionSelect.value;if(999==b)showAdvPowerDlg();else if(998==b)amtstack.Get("IPS_OptInService",powerActionResponse0,0,1);else{10>b&&2<b&&null==urlvars.noredirdisconnect&&(3==desktop.State&&connectDesktop(),3==terminal.State&&connectTerminal(),void 0!=ider&&3==ider.state&&iderStop());statusbox("A\u00e7\u00e3o de poder","Verificando estado ...");null!=rsepass&&1===rsepass&&(rsepass=Q("rsepass").value);var c=!0;6>amtversion&&(c=!1);13==currentView&&8==b&&(c=!1);13!=currentView&&
10>=b&&(c=!1);c?amtstack.Get("IPS_OptInService",powerActionResponse0,0,1):amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1)}}var AvdPowerDlg;
function showAdvPowerDlg(){try{Q("c39").value=2==amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState?10:2}catch(b){}QV("d24dBiosPause",1==amtPowerBootCapabilities.BIOSPause);QV("d24dBiosSecureBoot",1==amtPowerBootCapabilities.BIOSSecureBoot);QV("d24dReflashBios",1==amtPowerBootCapabilities.BIOSReflash);QV("d24dBiosSetup",1==amtPowerBootCapabilities.BIOSSetup);QV("ForceDVDBootOption",1==amtPowerBootCapabilities.ForceCDorDVDBoot);QV("ForceDiagBootOption",1==amtPowerBootCapabilities.ForceDiagnosticBoot);
QV("ForceHDBootOption",1==amtPowerBootCapabilities.ForceHardDriveBoot);QV("ForcePXEBootOption",1==amtPowerBootCapabilities.ForcePXEBoot);QV("d24dForceProgressEvents",1==amtPowerBootCapabilities.ForcedProgressEvents);QV("d24dUseIDER",1==amtPowerBootCapabilities.IDER);QV("d24dLockKeyboard",1==amtPowerBootCapabilities.KeyboardLock);QV("d24dLockPowerButton",1==amtPowerBootCapabilities.PowerButtonLock);QV("d24dLockResetButton",1==amtPowerBootCapabilities.ResetButtonLock);QV("d24dSerialOverLan",1==amtPowerBootCapabilities.SOL);
QV("d24dSecureErase",1==amtPowerBootCapabilities.SecureErase);QV("d24dPlatformErase",null!=amtPowerBootCapabilities.PlatformErase&&null!=amtsysstate.CIM_BootService&&32768<=amtsysstate.CIM_BootService.response.EnabledState&&0!=(amtsysstate.CIM_BootService.response.EnabledState&2));QV("d24dFirmwareReset",1==amtPowerBootCapabilities.ConfigurationDataReset);QV("d24dLockSleepButton",1==amtPowerBootCapabilities.SleepButtonLock);QV("d24dUserPasswordBypass",1==amtPowerBootCapabilities.UserPasswordBypass);
QV("c46",1==amtPowerBootCapabilities.VerbosityQuiet);QV("c47",1==amtPowerBootCapabilities.VerbosityVerbose);QV("c48",1==amtPowerBootCapabilities.VerbosityScreenBlank);QV("d24p500",9<amtversion);QV("d24p501",9<amtversion);setDialogMode(24,"A\u00e7\u00e3o de energia personalizada",3,showAdvPowerDlgOk);showAdvPowerDlgChange()}
function showAdvPowerDlgChange(){QV("idd_d24IDERBootDevice",Q("d24UseIDER").checked);QV("idd_d24RSEPass",Q("d24SecureErase")?Q("d24SecureErase").checked:!1);var b=500<=Q("c39").value&&600>Q("c39").value;QE("c41",!b);QE("c43",!b);QE("idd_d24IDERBootDevice",!b);QE("c45",!b);QE("idd_d24RSEPass",!b);QE("c54",!0)}
2022-03-23 21:00:41 +03:00
function showAdvPowerDlgOk(){var b=Q("c39").value;500==b||501==b?amtstack.RequestOSPowerStateChange(501==b?3:2,function(b,a,d,g){200==g?QH(60,"A\u00e7\u00e3o de energia conclu\u00edda."):QH(60,format("Erro de a\u00e7\u00e3o de energia # {0}.",g));setDialogMode(1,"A\u00e7\u00e3o de poder",0);setTimeout(function(){setDialogMode(0)},1300)}):(AvdPowerDlg={},AvdPowerDlg.Action=Q("c39").value,AvdPowerDlg.BIOSPause=Q("d24BiosPause").checked,AvdPowerDlg.BIOSSecureBoot=
Q("d24BiosSecureBoot").checked,AvdPowerDlg.BIOSSetup=Q("d24BiosSetup").checked,AvdPowerDlg.BootMediaIndex=Q("c43").value,AvdPowerDlg.FirmwareVerbosity=Q("c45").value,AvdPowerDlg.ForcedProgressEvents=Q("d24ForceProgressEvents").checked,AvdPowerDlg.IDERBootDevice=Q("c44").value,AvdPowerDlg.LockKeyboard=Q("d24LockKeyboard").checked,AvdPowerDlg.LockPowerButton=Q("d24LockPowerButton").checked,AvdPowerDlg.LockResetButton=Q("d24LockResetButton").checked,AvdPowerDlg.LockSleepButton=
Q("d24LockSleepButton").checked,AvdPowerDlg.ReflashBIOS=Q("d24ReflashBios").checked,AvdPowerDlg.UseIDER=Q("d24UseIDER").checked,AvdPowerDlg.UseSOL=Q("d24SerialOverLan").checked,AvdPowerDlg.UseSafeMode=Q("d24SafeMode").checked,AvdPowerDlg.UserPasswordBypass=Q("d24UserPasswordBypass").checked,AvdPowerDlg.SecureErase=Q("d24SecureErase").checked,AvdPowerDlg.PlatformErase=Q("d24PlatformErase").checked,AvdPowerDlg.FirmwareReset=Q("d24FirmwareReset").checked,!0===AvdPowerDlg.SecureErase&&0<Q("d24rsepass").value.length&&
(AvdPowerDlg.RSEPassword=Q("d24rsepass").value),!0===AvdPowerDlg.PlatformErase?powerActionDlgRPE(!0):(statusbox("A\u00e7\u00e3o de poder","Verificando estado ..."),amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)))}
function powerActionResponse0(b,c,a,d){200!=d?connectDesktopConsent?connectDesktop(!0):messagebox("A\u00e7\u00e3o de poder",format("Erro # {0}",d)):4294967295==a.Body.OptInRequired&&3!=a.Body.OptInState&&4!=a.Body.OptInState?2==a.Body.OptInState?(d6ConsentText.value="",setDialogMode(6,"Consentimento do Usu\u00e1rio",11,powerActionSendConsent),checkConsentDisplay(),consentChanged()):(statusbox("A\u00e7\u00e3o de poder","Iniciando a inscri\u00e7\u00e3o ..."),amtstack.IPS_OptInService_StartOptIn(powerActionResponseC1,
0,1)):connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):998==d5actionSelect.value?messagebox("Consentimento do Usu\u00e1rio","N\u00e3o \u00e9 necess\u00e1rio o consentimento do usu\u00e1rio."):(statusbox("A\u00e7\u00e3o de poder","Obtendo configura\u00e7\u00f5es de inicializa\u00e7\u00e3o ..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
function powerActionResponseC1(b,c,a,d){200!=d?connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):messagebox("A\u00e7\u00e3o de poder",format("Erro #",d)):0!=a.Body.ReturnValue?connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):messagebox("Erro de consentimento do usu\u00e1rio",a.Body.ReturnValueStr.replace(/_/g," ")):(d6ConsentText.value="",setDialogMode(6,"Consentimento do Usu\u00e1rio",11,powerActionSendConsent),checkConsentDisplay(),consentChanged(),amtstack.Enum("CIM_ServiceAvailableToElement",
function(a,b,c,d){errcheck(d,a)||(amtsysstate.CIM_ServiceAvailableToElement.responses=c,updateSystemStatus(),null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState&&amtstack.RequestPowerStateChange(2,function(a,b,c,d){}))}))}
function powerActionSendConsent(b){0==b?amtstack.IPS_OptInService_CancelOptIn(function(){}):(statusbox("A\u00e7\u00e3o de poder","Enviando consentimento do usu\u00e1rio ..."),amtstack.IPS_OptInService_SendOptInCode(d6ConsentText.value,powerActionResponseC2,0,1))}
function powerActionResponseC2(b,c,a,d){200!=d?messagebox("A\u00e7\u00e3o de poder",format("Erro # {0}",d)):0!=a.Body.ReturnValue?amtstack.Get("IPS_OptInService",powerActionResponse0,0,1):connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):998==d5actionSelect.value?messagebox("Consentimento do Usu\u00e1rio","Consentimento do usu\u00e1rio bem-sucedido."):(statusbox("A\u00e7\u00e3o de poder","Verificando estado ..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
2022-03-23 21:00:41 +03:00
function powerActionResponse1(b,c,a,d){if(200!=d)messagebox("A\u00e7\u00e3o de poder",format("Erro # {0}",d));else{b=d5actionSelect.value;var g=a.Body;g.ConfigurationDataReset=!1;delete g.WinREBootEnabled;delete g.UEFILocalPBABootEnabled;delete g.UEFIHTTPSBootEnabled;delete g.SecureBootControlEnabled;delete g.BootguardStatus;delete g.OptionsCleared;delete g.BIOSLastStatus;delete g.UefiBootParametersArray;delete g.RPEEnabled;999==b?(g.BIOSPause=AvdPowerDlg.BIOSPause,g.EnforceSecureBoot=AvdPowerDlg.BIOSSecureBoot,
g.BIOSSetup=AvdPowerDlg.BIOSSetup,g.BootMediaIndex=AvdPowerDlg.BootMediaIndex,g.FirmwareVerbosity=AvdPowerDlg.FirmwareVerbosity,g.ForcedProgressEvents=AvdPowerDlg.ForcedProgressEvents,g.IDERBootDevice=AvdPowerDlg.IDERBootDevice,g.LockKeyboard=AvdPowerDlg.LockKeyboard,g.LockPowerButton=AvdPowerDlg.LockPowerButton,g.LockResetButton=AvdPowerDlg.LockResetButton,g.LockSleepButton=AvdPowerDlg.LockSleepButton,g.ReflashBIOS=AvdPowerDlg.ReflashBIOS,g.UseIDER=AvdPowerDlg.UseIDER,g.UseSOL=AvdPowerDlg.UseSOL,
g.UseSafeMode=AvdPowerDlg.UseSafeMode,g.UserPasswordBypass=AvdPowerDlg.UserPasswordBypass,null!=g.SecureErase&&(g.SecureErase=AvdPowerDlg.SecureErase&&1==amtPowerBootCapabilities.SecureErase,1==g.SecureErase&&AvdPowerDlg.RSEPassword&&(g.RSEPassword=AvdPowerDlg.RSEPassword)),null!=g.PlatformErase&&null!=amtsysstate.CIM_BootService&&32768<=amtsysstate.CIM_BootService.response.EnabledState&&amtsysstate.CIM_BootService.response.EnabledState&2&&AvdPowerDlg.PlatformErase&&null!=amtPowerBootCapabilities.PlatformErase&&
0!=(amtPowerBootCapabilities.PlatformErase&1)&&(g.PlatformErase=!0,g.UefiBootParametersArray=platfromEraseTLV.tlv,g.UefiBootNumberOfParams=platfromEraseTLV.tlvlen),null!=g.ConfigurationDataReset&&(g.ConfigurationDataReset=AvdPowerDlg.FirmwareReset)):(g.BIOSPause=!1,g.EnforceSecureBoot=!1,g.BIOSSetup=99<b&&104>b,g.BootMediaIndex=0,g.FirmwareVerbosity=0,g.ForcedProgressEvents=!1,g.IDERBootDevice=202==b||203==b?1:0,g.LockKeyboard=!1,g.LockPowerButton=!1,g.LockResetButton=!1,g.LockSleepButton=!1,g.ReflashBIOS=
!1,g.UseIDER=199<b&&300>b,g.UseSOL=13==currentView&&8!=b&&300>b,g.UseSafeMode=!1,g.UserPasswordBypass=!1,null!=g.SecureErase&&(g.SecureErase=(104==b||105==b)&&1==amtPowerBootCapabilities.SecureErase,!0===g.SecureErase&&0<rsepass.length&&(g.RSEPassword=rsepass)),null!=g.PlatformErase&&null!=amtsysstate.CIM_BootService&&32768<=amtsysstate.CIM_BootService.response.EnabledState&&amtsysstate.CIM_BootService.response.EnabledState&2&&(106==b||107==b)&&null!=amtPowerBootCapabilities.PlatformErase&&0!=(amtPowerBootCapabilities.PlatformErase&
1)&&(g.PlatformErase=!0,g.UefiBootParametersArray=platfromEraseTLV.tlv,g.UefiBootNumberOfParams=platfromEraseTLV.tlvlen),null!=g.ConfigurationDataReset&&(g.ConfigurationDataReset=!1),rsepass=null);console.log("A\u00e7\u00e3o de inicializa\u00e7\u00e3o: "+b);console.log("Definindo as configura\u00e7\u00f5es de inicializa\u00e7\u00e3o: "+ObjectToString2(g));statusbox("A\u00e7\u00e3o de poder","Definindo configura\u00e7\u00f5es de inicializa\u00e7\u00e3o ...");amtstack.CIM_BootConfigSetting_ChangeBootOrder(null,
function(a,b,c,d){200!=d?messagebox("A\u00e7\u00e3o de poder",format("PUT CIM_BootConfigSetting_ChangeBootOrder, Error #{0}",d)+(c.Header&&c.Header.WsmanError?", "+c.Header.WsmanError:"")):0!=c.Body.ReturnValue?messagebox("Change Boot Order","(1) Change Boot Order returns "+c.Body.ReturnValueStr):amtstack.Put("AMT_BootSettingData",g,powerActionResponse2,0,1)},0,1)}}
function powerActionResponse2(b,c,a,d,g){200!=d?messagebox("A\u00e7\u00e3o de poder",format("PUT AMT_BootSettingData, erro # {0}",d)+(a.Header&&a.Header.WsmanError?", "+a.Header.WsmanError:"")):(statusbox("A\u00e7\u00e3o de poder","Definindo a pr\u00f3xima inicializa\u00e7\u00e3o ..."),amtstack.SetBootConfigRole(1,powerActionResponse3x,0,1))}
function powerActionResponse3x(b,c,a,d){b=d5actionSelect.value;c=null;if(999==b)0<c41.value&&(c=["Force CD/DVD Boot","Force PXE Boot","Force Hard-drive Boot","Force Diagnostic Boot"][c41.value-1]);else{if(300==b||301==b)c="Force Diagnostic Boot";if(400==b||401==b)c="Force PXE Boot";if(600==b||601==b)c="Force OCR UEFI HTTPS Boot"}Q("c41").value=0;console.log("ChangeBootOrder: "+c);amtstack.CIM_BootConfigSetting_ChangeBootOrder(null==c?c:'<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_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: '+
c+"</Selector></SelectorSet></ReferenceParameters>",powerActionResponse3)}var targetPowerAction=0;
function powerActionResponse3(b,c,a,d){console.log("powerActionResponse3("+c+","+a+","+d+")");if(!errcheck(d,b))if(0!=a.Body.ReturnValue)messagebox("Change Boot Order","(2) Change Boot Order returns "+a.Body.ReturnValueStr);else{statusbox("A\u00e7\u00e3o de poder","Executando a\u00e7\u00e3o de poder ...");b=d5actionSelect.value;if(100==b||201==b||203==b||300==b||401==b||601==b)b=2;if(101==b||200==b||202==b||301==b||400==b||600==b)b=10;104==b&&(b=2);105==b&&(b=10);106==b&&(b=2);107==b&&(b=10);999==
b&&(b=AvdPowerDlg.Action);targetPowerAction=b;11==b&&(b=10);999>b?(console.log("RequestPowerStateChange("+b+")"),amtstack.RequestPowerStateChange(b,powerActionResponse4)):messagebox("A\u00e7\u00e3o de poder","Pr\u00f3ximo conjunto de a\u00e7\u00f5es de inicializa\u00e7\u00e3o.")}}
function powerActionResponse4(b,c,a,d){200==d&&(QH(60,"A\u00e7\u00e3o de energia conclu\u00edda."),setDialogMode(1,"A\u00e7\u00e3o de poder",0),setTimeout(function(){setDialogMode(0)},1300));amtstack.Get("CIM_AssociatedPowerManagementService",powerActionResponse5,0,1)}function powerActionResponse5(b,c,a,d){}function consentChanged(){QE("c54",6==d6ConsentText.value.length)}function changeConsentDisplay(){xxchangeConsentDisplay=!0;checkConsentDisplay()}
function checkConsentDisplay(){amtstack.Get("IPS_SecIOService",checkConsentDisplayResponse1)}var xxchangeConsentDisplay=!1;
function checkConsentDisplayResponse1(b,c,a,d){200==d&&(a.Body.DefaultScreen&&(a.Body.DefaultScreen=parseInt(a.Body.DefaultScreen)),a.Body.NumberOfScreens&&(a.Body.NumberOfScreens=parseInt(a.Body.NumberOfScreens)),1==xxchangeConsentDisplay?(xxchangeConsentDisplay=!1,a.Body.DefaultScreen=d6Display.value,amtstack.Put("IPS_SecIOService",a.Body,checkConsentDisplayResponse1)):(d6Display.value=a.Body.DefaultScreen,QV("d6ThirdDisplay",2<a.Body.NumberOfScreens)))}
var xxStorage=null,xxStorageVendors=[],xxStorageApplications=[];function PullStorage(){amtFirstPull|=8;wsstack.comm.PerformAjax("",PullStorageResponse,null,0,"/amt-storage/","GET")}
function PullStorageResponse(b,c,a){0==amtstack.PendingBatchOperations&&refreshButtons(!0);if(200==c){QV("go21",!0);for(c=0;32>c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(D){return}xxStorageVendors=[];xxStorageApplications=[];b=xxStorage.content;if(Array.isArray(b)){a={};for(c in b){var d=b[c].vendor?b[c].vendor:"";a[d]||(a[d]={});var g=b[c].app?b[c].app:"";a[d][g]||(a[d][g]={});b[c].name&&(a[d][g][b[c].name]=b[c])}xxStorage.content=
b=a}else{if(b["index.htm"]||b["logon.htm"])b[""]={"":{}};b["index.htm"]&&(b[""][""]["index.htm"]=b["index.htm"],delete b["index.htm"]);b["logon.htm"]&&(b[""][""]["logon.htm"]=b["logon.htm"],delete b["logon.htm"])}d=0;a=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Gerenciar o armazenamento Intel&reg; AMT para este computador.<br><br>";var v,n,g="";for(c in b){var l=0,p;for(p in b[c]){l++;var q=0,e;for(e in b[c][p]){q++;if(c!=v||p!=n)""!=g&&(a+=g,g="<br>"),v=c,n=p,g=""!=c?g+EscapeHtml(c+
" / "+p):g+"Raiz";var C='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+e+'"',g=g+('<div class=itemBar onclick=showStorageDetails("'+c+'","'+p+'","'+e+'",'+C+")><div style=float:right>"),g=g+(" "+AddButton2("Baixar","DownloadFromStorage("+C+',"'+e+'",event)')),g=g+("</div><div style=padding-top:3px><b>"+EscapeHtml(e)+"</b>, <i>"+b[c][p][e].size+" bytes</i></div></div>");d++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==q&&(wsstack.comm.PerformAjax("",
function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==l&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=g&&(a+=g);0==d&&(a+="<div style=padding-left:15px><br><i>Nenhum arquivo encontrado.</i></div><br>");v=!1;try{var w=new FileReader;v=null!=w&&null!=w.readAsBinaryString}catch(D){console.log(D)}a+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+(v?AddButton("Envio...","UploadToStorage()"):
""));QH(55,a)}else QH(55,"N\u00e3o foi poss\u00edvel carregar os dados de armazenamento ...<br/>"+AddButton("Atualizar","PullStorage()"))}
function showStorageDetails(b,c,a,d){if(!xxdialogMode){var g="",v=xxStorage.content[b][c][a];""!=b&&(g+=addHtmlValue("Fornecedor",b));""!=c&&(g+=addHtmlValue("Inscri\u00e7\u00e3o",c));g+=addHtmlValue("Nome",a);g+=addHtmlValue("Tamanho",v.size+" bytes");v.link&&(g+=addHtmlValue("Liga\u00e7\u00e3o",v.link));setDialogMode(11,"Item de armazenamento",5,showStorageDetailsEx,g,d)}}
function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Armazenamento",format("N\u00e3o foi poss\u00edvel excluir o arquivo (ERR {0}), verifique se o computador est\u00e1 ligado.",c)):PullStorage()}function DownloadFromStorage(b,c,a){xxdialogMode||(haltEvent(a),wsstack.comm.PerformAjax("",DownloadFromStorageEx,c,0,"/amt-storage/"+b,"GET"))}
function DownloadFromStorageEx(b,c,a){200!=c||null==b?console.log(c,"Data = null"):saveAs(data2blob(b),a)}function OpenFromStorage(b,c){if(!xxdialogMode){haltEvent(c);var a=window.open("http://"+wsstack.comm.host+":"+wsstack.comm.port+"/amt-storage/"+b,"_blank","noopener,noreferrer");a.opener=null;a.focus()}}
function PushToStorage(b,c,a){var d=null;7E3<c.length&&(d=[b,c.substring(7E3)],c=c.substring(0,7E3));wsstack.comm.PerformAjax(c,PushToStorageResponse,d,0,"/amt-storage/"+b+(1==a?"?append=":""),"PUT")}function PushToStorageResponse(b,c,a){200!=c?messagebox("Armazenamento",format("N\u00e3o foi poss\u00edvel enviar o arquivo por push (ERR {0}), verifique se o computador est\u00e1 ligado.",c)):null!=a?PushToStorage(a[0],a[1],!0):PullStorage()}
function UploadToStorage(b,c){if(!xxdialogMode){c||(c="");var a;a="<br>Selecione um arquivo pequeno para carregar no armazenamento e insira um fornecedor, aplicativo e nome do arquivo.<br>";a=(b?a+('<br><div style=height:20px><input id=mstoragefile style=float:right;width:240px readonly disabled=disabled value="'+c+'" ><div>Subir arquivo</div></div>'):a+"<br><div style=height:20px><input type=file id=mstoragefile style=float:right;width:240px onchange=SetStorageName()><div>Upload file</div></div>")+
'<br><div style=height:16px><input id=mstoragevendor placeholder="Fornecedor" list=mstoragevendorlist maxlength=11 style=float:right;width:240px><div>Nome do vendedor</div></div>';a+='<br><div style=height:16px><input id=mstorageapplication placeholder="Aplicativo" list=mstorageapplicationlist maxlength=11 style=float:right;width:240px><div>Nome da Aplica\u00e7\u00e3o</div></div>';a+='<br><div style=height:16px><input id=mstoragefilename placeholder="Nome do arquivo" maxlength=11 style=float:right;width:240px><div>Nome do arquivo</div></div>';
a+="<br><div style=height:16px><input id=mstoragetype placeholder=application/octet-stream list=mstoragetypelist style=float:right;width:240px><div>Tipo MIME</div></div>";a+='<br><div style=height:16px><input id=mstoragelink style=float:right;width:240px><div title="Se definido, cria um link para este conte\u00fado na p\u00e1gina principal da web">Liga\u00e7\u00e3o</div></div><br>';a+="<datalist id=mstoragevendorlist>";for(var d in xxStorageVendors)a+='<option value="'+xxStorageVendors[d]+'">';a+=
"</datalist>";a+="<datalist id=mstorageapplicationlist>";for(d in xxStorageApplications)a+='<option value="'+xxStorageApplications[d]+'">';a+='</datalist><datalist id=mstoragetypelist><option value="application/octet-stream"><option value="image/jpeg"><option value="text/html"><option value="text/plain"></datalist>';setDialogMode(11,"Upload de armazenamento",3,UploadToStorageEx,a,b);b&&SetStorageName(c)}}
function UploadToStorageEx(b,c){if(c)d=new FileReader,d.onload=UploadToStorageEx2,d.filename=Q("mstoragefile").value,d.readAsBinaryString(c);else{var a=Q("mstoragefile");if(1==a.files.length){var d=new FileReader;d.onload=UploadToStorageEx2;d.filename=a.files[0].name;d.readAsBinaryString(a.files[0])}}}
function SetStorageName(b){b||(b=Q("mstoragefile"),b=1==b.files.length?b.files[0].name:"");b=b.split(" ").join("");var c=b.split("-");3==c.length&&12>c[0].length&&12>c[1].length&&(Q("mstoragevendor").value=c[0],Q("mstorageapplication").value=c[1],b=c[2]);b=b.split("-").join("");b.endsWith(".gz")&&(b=b.substring(0,b.length-3));b.endsWith(".htm")||b.endsWith(".html")?Q("mstoragetype").value="text/html":b.endsWith(".txt")&&(Q("mstoragetype").value="text/plain");11<b.length&&(b=b.substring(0,11));Q("mstoragefilename").value=
b}
function UploadToStorageEx2(b){var c;c=Q("mstoragevendor").value;var a=Q("mstorageapplication").value,d=Q("mstoragefilename").value;""==d&&(d="Filename");var g=Q("mstoragetype").value;""==g&&(g="application/octet-stream");var v=Q("mstoragelink").value;""!=c||""!=a||"logon.htm"!=d.toLowerCase()&&"index.htm"!=d.toLowerCase()?(""==c&&(c="Vendor"),""==a&&(a="App"),c=c+"/"+a+"/"+d):c=d.toLowerCase();a="<metadata><headers>";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+=
"<h>Content-Encoding: gzip</h>");a+="<h>Content-Type: "+g+"</h></headers>";""!=v&&(a+="<link>"+v+"</link>");a+="</metadata>"+b.target.result;PushToStorage(c,a)}function _fmtdatetime(b){return b.replace("T"," ").replace("Z","")}
function _fmtinterval(b){b=b.replace("T","").substring(b.indexOf("P")+1);b=" "+b.replace("D"," dias").replace("H"," horas").replace("M"," minutos");b=b.replace(" 1 dia"," 1 dia").replace(" 1 hora"," 1 hora").replace(" 1 minuto "," 1 minuto ");return b.substring(0,b.length-1)}function _fmttimepad(b){for(b=""+b;2>b.length;)b="0"+b;return b}var xxAlarms=null;
2022-03-23 21:00:41 +03:00
function PullAlarms(){var b=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Gerenciar alarmes de ativa\u00e7\u00e3o.<br><br>";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,g){if(200==g){QV("go23",!0);if(0<d.length)for(xxAlarms=d,c=0;c<d.length;c++)a="<b>"+d[c].ElementName+"</b>, acordar em "+(new Date(d[c].StartTime.Datetime)).toLocaleString().replace(", "," \u00e0s"),void 0!=d[c].Interval&&(a+=" e cada"+_fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&&(a+=", exclua quando terminar"),
b+="<div class=itemBar onclick=showAlertDetails("+c+")><div style=float:right>",xxAccountAdminName&&(b+=" "+AddButton2("Editar...",'showAddAlarm(" + i + ")')),b+="</div><div style=padding-top:3px;width:auto;float:left;overflow-x:hidden>"+a+"</div></div>";else xxAlarms=null,b+="<div style=padding-left:15px><br><i>Nenhum alarme de ativa\u00e7\u00e3o registrado.</i></div><br>";d="<div>&nbsp;"+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Remova todos os alarmes","RemoveAllAlarms()")+
AddButton("Adicionar","showAddAlarm()"));b+="<br><td class=r1>"+TableEnd(d+"</div>");QH(57,b)}},null,!0)}
2022-03-23 21:00:41 +03:00
function prepareAlarmOccurenceTemplate(b,c,a,d,g){return'<d:AlarmTemplate xmlns:d="http://intel.com/wbem/wscim/1/amt-schema/1/AMT_AlarmClockService" xmlns:s="http://intel.com/wbem/wscim/1/ips-schema/1/IPS_AlarmClockOccurrence"><s:InstanceID>'+b+'</s:InstanceID><s:StartTime><p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+a+'</p:Datetime></s:StartTime><s:Interval><p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Interval></s:Interval><s:DeleteOnCompletion>"+
g+"</s:DeleteOnCompletion></d:AlarmTemplate>"}function RemoveAllAlarms(){setDialogMode(1,"Remova todos os alarmes de ativa\u00e7\u00e3o",3,RemoveAllAlarmsEx,"Confirmar a remo\u00e7\u00e3o de todos os alarmes de ativa\u00e7\u00e3o?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,g,v){0==--b&&PullAlarms()})}
function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(c.StartTime.Datetime);Q("d25alarm_name").value=c.ElementName;Q("d25alarm_sdate").value=a.getFullYear()+"-"+_fmttimepad(a.getMonth()+1)+"-"+_fmttimepad(a.getDate());Q("d25alarm_stime").value=a.getHours()+":"+_fmttimepad(a.getMinutes())+":"+_fmttimepad(a.getSeconds());if(c.Interval){var a=c.Interval.Interval.replace("P","").replace("T","").replace("D","D,").replace("H","H,").replace("M","M,").split(","),
d=[0,0,0],g;for(g in a){var v=a[g].length-1;"D"==a[g][v]&&(d[0]=parseInt(a[g].substring(0,v)));"H"==a[g][v]&&(d[1]=parseInt(a[g].substring(0,v)));"M"==a[g][v]&&(d[2]=parseInt(a[g].substring(0,v)))}Q("d25alarm_interval").value=d.join("-")}else Q("d25alarm_interval").value="";Q("d25alarm_doc").value=1==c.DeleteOnCompletion?1:0}else c=new Date,c.setDate((new Date).getDate()+1),Q("d25alarm_name").value="",Q("d25alarm_sdate").value=c.getFullYear()+"-"+_fmttimepad(c.getMonth()+1)+"-"+_fmttimepad(c.getDate()),
Q("d25alarm_stime").value=c.getHours()+":"+_fmttimepad(c.getMinutes())+":00",Q("d25alarm_interval").value="",Q("d25alarm_doc").value=0;setDialogMode(25,"Adicionar novo alarme",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0<Q("d25alarm_name").value.length&&3==Q("d25alarm_sdate").value.split("-").length&&3==Q("d25alarm_stime").value.split(":").length&&(1==b||3==b);QE("c54",b)}
2022-03-23 21:00:41 +03:00
function showAddAlarmOk(b,c){if(2==b)showAlertDetailsDelete(b,c);else{var a=Q("d25alarm_name").value,d=Q("d25alarm_sdate").value.split("-"),g=Q("d25alarm_stime").value.split(":"),d=new Date(d[0],d[1]-1,d[2],g[0],g[1],g[2],0),d=_fmttimepad(d.getUTCFullYear())+"-"+_fmttimepad(d.getUTCMonth()+1)+"-"+_fmttimepad(d.getUTCDate())+"T"+_fmttimepad(d.getUTCHours())+":"+_fmttimepad(d.getUTCMinutes())+":"+_fmttimepad(d.getUTCSeconds())+"Z",g=Q("d25alarm_interval").value.split("-");3!=g.length&&(g=[0,0,0]);var g=
"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",v=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,g,v);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Adicionar alarme",format("Falha ao adicionar alarme. Status: {0}. <br/> Verifique se o alarme \u00e9 para um tempo futuro.",d)):0!=c.Body.ReturnValue?messagebox("Adicionar alarme",format("Falha ao adicionar o alarme {0}. <br/> Verifique se o alarme \u00e9 para um tempo futuro.",
c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),a.StartTime='<p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Datetime>",a.Interval='<p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+g+"</p:Interval>",a.DeleteOnCompletion=v,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Editar alarme",format("Failed to change alarm. Status: {0}.<br/>Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}}
function showAlertDetails(b){if(!xxdialogMode){var c=xxAlarms[b],a=new Date(c.StartTime.Datetime),a="<div style=text-align:left>"+addHtmlValue("Nome",c.ElementName)+addHtmlValue("Tempo de vig\u00edlia",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("interno",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("Depois de acordar",1==c.DeleteOnCompletion?"Excluir alarme":"Manter Alarme")+"</div>";messagebox(format("Alarme {0}",c.ElementName),a);setDialogMode(11,"Alarme"+
c.ElementName,5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,v){PullAlarms()})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag;
function setDialogMode(b,c,a,d,g,v){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=v;QE("c54",!0);QV("c54",a&1);QV("c53",a&2);QV(58,a&2);QV("c55",a&4);c&&QH(59,c);for(c=1;27>c;c++)QV("dialog"+c,c==b);QV("dialog",b);g&&(11==b?QH(63,g):QH(60,g));0!=xxdialogMode&&iderToggleDiskMap(!1)}
function dialogclose(b){var c=xxdialogFunc,a=xxdialogButtons,d=xxdialogTag;setDialogMode();(a&8||b)&&c&&c(b,d)}
function center(){QS("dialog").left=(getDocWidth()-400)/2+"px";var b=0,c=Q(8).offsetHeight-(0==fullscreen?126:53);""==QS(9).display&&(b+=32);QS(14).height=Q(8).offsetHeight-b-(0==fullscreen?16:0)+"px";QS("Desk")["max-height"]=c-b+"px";QS("Desk")["max-width"]=Q(8).offsetWidth-(0==fullscreen?32:0)+"px";0!=Q(41).offsetWidth&&(QS("Desk")["max-width"]=Q(41).offsetWidth);fullscreen?(QS(14)["overflow-y"]=
"hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(14)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(60,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(60,c);setDialogMode(1,b)}
function SaveJsonFile(b,c,a,d){var g="",v={},n=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,v={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(v.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+
n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);v[c]=d;saveAs(data2blob(JSON.stringify(v,null," ").replace(/\n/g,"\r\n")),b+g+".json")}var httpErrorTable={200:"Est\u00e1 bem",401:"Erro de autentica\u00e7\u00e3o",408:"Erro de tempo limite",601:"Erro de an\u00e1lise do WSMAN",602:"N\u00e3o foi poss\u00edvel analisar o cabe\u00e7alho de resposta HTTP",603:"Resposta inesperada de enumera\u00e7\u00e3o HTTP",604:"Resposta inesperada de recebimento de HTTP",997:"Regi\u00e3o de resumo inv\u00e1lida"};
function errcheck(b,c){if(null==wsstack||amtstack!=c)return!0;200!=b&&9!=b&&(setDialogMode(),wsstack.comm.FailAllError=999,amtstack.CancelAllQueries(999),QH(5,httpErrorTable[b]?httpErrorTable[b]:format("Erro # {0}",b)),401==b&&QH(5,'Erro de autentica\u00e7\u00e3o<br /><br /><input type=button value="Set new credentials" onclick=meshcentral2credCallback(true)></input>'),go(100),QS(3).width=0);return 200!=b}
function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(13).src.endsWith(a))Q(13).src=a;QV(14,!1);QV(12,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(12,!1);QV(14,!0);QV(4,100==b);QV(6,100>b);for(var a=0;80>a;a++){QV("p"+a,a==b);var d=QS("go"+a);d&&(d["background-color"]=a==b?"#abcae1":"");d&&(d["background-color"]=a==b?"gray":"")}currentView=b;center()}}
function portsFromHost(b,c){b=decodeURIComponent(b);var a=b.split(":"),d=0==c?16992:16993,g=0==c?16994:16995;if(0==a[0].indexOf("[")){a=b.split("]:");if(1==a.length)return{host:b.substring(1,b.length-1),http:d,redir:g};if(1<a.length){var v=a[1].split(":");0<v.length&&(d=parseInt(v[0]));1<v.length&&(g=parseInt(v[1]))}return{host:a[0].substring(1),http:d,redir:g}}1<a.length&&(d=parseInt(a[1]));2<a.length&&(g=parseInt(a[2]));return{host:a[0],http:d,redir:g}}
function addLink(b,c){return"<a style=cursor:pointer;color:blue onclick='"+c+"'>&diams; "+b+"</a>"}function addLinkConditional(b,c,a){return a?addLink(b,c):b}function haltEvent(b){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1}function addOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;Q(b).add(d)}function addDisabledOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;d.disabled=1;Q(b).add(d)}
function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,g=0,v;for(v in b){var n=b.charCodeAt(v);64<n&&91>n?c=1:96<n&&123>n?a=1:47<n&&58>n?d=1:g=1}return 4==c+a+d+g}function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Erro de chamada",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}
function TableStart2(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}function TableEntry(b,c){return"<tr><td class=r1><p>"+b+"<td class=r1>"+c}function FullTable(b,c){var a=TableStart();for(i in b)i&&b[i]&&(a+=TableEntry(i,b[i]));return a+TableEnd(c)}function TableEnd(b){return"<tr><td colspan=2><p>"+(b?b:"")+"</table>"}function AddButton(b,c){return"<input type=button value='"+b+"' onclick='"+c+"' style=margin:4px>"}
function AddButton2(b,c,a){return"<input type=button value='"+b+"' onclick='"+c+"' "+a+">"}function AddRefreshButton(b){return'<input type=button name=refreshbtn value="Atualizar" onclick=\'refreshButtons(false);'+b+"' style=margin:4px "+(0==refreshButtonsState?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>&#x25BC; More</a><div id=morexxx2 style=display:none><br><hr>'}
2022-03-23 21:00:41 +03:00
function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>&#x25B2; Less</a></div>'}function getSelectedOptions(b){for(var c=[],a,d=0,g=b.options.length;d<g;d++)a=b.options[d],a.selected&&c.push(a.value);return c}function getInstance(b,c){for(var a in b)if(b[a].InstanceID==c)return b[a];return null}function getItem(b,c,a){for(var d in b)if(b[d][c]==a)return b[d];return null}
function guidToStr(b){return b.substring(6,8)+b.substring(4,6)+b.substring(2,4)+b.substring(0,2)+"-"+b.substring(10,12)+b.substring(8,10)+"-"+b.substring(14,16)+b.substring(12,14)+"-"+b.substring(16,20)+"-"+b.substring(20)}function getUrlVars(){for(var b,c=[],a=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;d<a.length;d++)b=a[d].indexOf("="),0<b&&(c[a[d].substring(0,b)]=a[d].substring(b+1,a[d].length));return c}
function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}
function getDocHeight(){return window.innerHeight?window.innerHeight:document.documentElement&&document.documentElement.clientHeight&&0!=document.documentElement.clientHeight?document.documentElement.clientHeight:document.getElementsByTagName("body")[0].clientHeight}function addHtmlValue(b,c){return'<div style=height:20px><div style=float:right;width:220px;overflow:hidden><b title="'+c+'">'+c+"</b></div><div>"+b+"</div></div>"}
function addHtmlValueNoTitle(b,c){return"<div style=height:20px><div style=float:right;width:220px;overflow:hidden>"+c+"</b></div><div>"+b+"</div></div>"}function numbersOnly(b,c){return 0==event.charCode||event.charCode==c||48<=event.charCode&&57>=event.charCode}function format(b){var c=Array.prototype.slice.call(arguments,1);return b.replace(/{(\d+)}/g,function(a,b){return"undefined"!=typeof c[b]?c[b]:a})}startup();
</script>