$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]);returnc};
$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 e=$jscomp.global.Object.getOwnPropertyDescriptor(c,d);void 0!==e&&$jscomp.global.Object.defineProperty(b,d,e)}else b[d]=c[d]};String.prototype.startsWith||(String.prototype.startsWith=function(b){return 0===this.lastIndexOf(b,0)});
function ReadShort(b,c){return(b.charCodeAt(c)<<8)+b.charCodeAt(c+1)}functionReadShortX(b,c){return(b.charCodeAt(c+1)<<8)+b.charCodeAt(c)}functionReadInt(b,c){return16777216*b.charCodeAt(c)+(b.charCodeAt(c+1)<<16)+(b.charCodeAt(c+2)<<8)+b.charCodeAt(c+3)}functionReadSInt(b,c){return(b.charCodeAt(c)<<24)+(b.charCodeAt(c+1)<<16)+(b.charCodeAt(c+2)<<8)+b.charCodeAt(c+3)}functionReadIntX(b,c){return16777216*b.charCodeAt(c+3)+(b.charCodeAt(c+2)<<16)+(b.charCodeAt(c+1)<<8)+b.charCodeAt(c)}
function EscapeHtml(b){if("string"==typeof b)return b.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'");if("boolean"==typeof b||"number"==typeof b)return b}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+=" ";returnc}functiongap2(b){for(varc="",a=0;a<4*b;a++)c+="";returnc}functionObjectToString(b){returnObjectToStringEx(b,0)}
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);returnnewBlob([newUint8Array(c)])}functionrandom(b){returnMath.floor(Math.random()*b)}functiontrademarks(b){returnb.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}
new FileReader;g.onload=function(){e.SendDataToHost(N,0==r,this.result,a&1);if(0<r&&0==C)d(a);elseif(G=null,C)e.SendCommand(71),w=[],C=!1;elseif(0<w.length){varb=w.shift();G=b.media;N=b.dev;z=b.lba;r=b.len;d(b.fr)}};g.readAsBinaryString(G.slice(c,c+b))}vare={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},m=String.fromCharCode(0,
function(){b("IDER-Stop");e.parent.Stop()};e.ProcessData=function(a){e.bytesFromAmt+=a.length;e.acc+=a;for(b("IDER-ProcessData",e.acc.length,rstr2hex(e.acc));;){a=e.ProcessDataEx();if(0==a)break;if(e.inSequence!=ReadIntX(e.acc,4)){b("ERROR: Out of sequence",e.inSequence,ReadIntX(e.acc,4));e.Stop();break}e.inSequence++;e.acc=e.acc.substring(a)}};e.SendCommand=function(a,c,g,w){null==c&&(c="");g=50<a&&1==g?2:0;w&&(g+=1);c=String.fromCharCode(a,0,0,g)+IntToStrX(e.outSequence++)+c;e.parent.xxSend(c);
var w=[],C=!1,G=null,N,z,r;return e},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!=
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;
a).split("\r\n");if(null==l.amtVersion)for(p in l.socketHeader)0==l.socketHeader[p].indexOf("Server: Intel(R) Active Management Technology ")&&(l.amtVersion=l.socketHeader[p].substring(46));l.socketAccumulator=l.socketAccumulator.substring(a+4);l.socketParseState=1;l.socketData="";l.socketXHeader={Directive:l.socketHeader[0].split(" ")};for(p in l.socketHeader)0!=p&&(a=l.socketHeader[p].indexOf(":"),l.socketXHeader[l.socketHeader[p].substring(0,a).toLowerCase()]=l.socketHeader[p].substring(a+2))}if(1==
l.ExecPut=function(a,b,c,d,e,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.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(g)+"</Header><Body>";if(a&&null!=b){var K=l.GetNameFromUrl(a);a="<r:"+K+'xmlns:r="'+a+'">';for(var u in b)if(b.hasOwnProperty(u)&&
"</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(g)+"</Header><Body><g:"+K+'xmlns:g="'+a+'">';for(var u in b)a+="<g:"+u+">"+b[u]+"</g:"+u+">";l.PerformAjax(a+"</g:"+K+"></Body></Envelope>",c,d,e)};l.ExecDelete=function(a,b,c,d,e){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +
b,c,p)};l.ExecMethod=function(a,b,c,p,d,g,e){var u="",D;for(D in c)if(null!=c[D])if(Array.isArray(c[D]))for(var y in c[D])u+="<r:"+D+">"+c[D][y]+"</r:"+D+">";else u+="<r:"+D+">"+c[D]+"</r:"+D+">";l.ExecMethodXml(a,b,u,p,d,g,e)};l.ExecMethodXml=function(a,b,c,d,e,g,K){l.PerformAjax(a+"/"+b+"</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.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>"+
function AmtStackCreateService(b){function c(){var a=k.GetPendingActions();x<a&&(x=a);null!=k.onProcessChanged&&F!=a&&(F=a,k.onProcessChanged(a,x));0==a&&(x=0)}functiona(a,b,c,g,p,h,w){200!=p?(c(k,a,null,p,h),e(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?k.wsman.ExecPull(g,b.Body.EnumerationContext,function(b,g,p,e){d(a,p,c,g,[],e,h,w)}):(c(k,a,null,603,h),e(1))}functiond(a,b,g,p,B,h,w,C){if(200!=h)g(k,a,null,h,w),e(1);elseif(null==b||"PullResponse"!=b.Header.Method)g(k,
a,null,604,w),e(1);else{for(var l in b.Body.Items)if(b.Body.Items[l]instanceof Array)for(var u in b.Body.Items[l])"function"!=typeof b.Body.Items[l][u]&&B.push(b.Body.Items[l][u]);else"function"!=typeof b.Body.Items[l]&&B.push(b.Body.Items[l]);b.Body.EnumerationContext?k.wsman.ExecPull(p,b.Body.EnumerationContext,function(b,c,p,e){d(a,p,g,c,B,e,w,1)}):(e(1),g(k,a,B,h,w),c())}}function e(a){k.ActiveEnumsCount-=a;k.ActiveEnumsCount>=k.MaxActiveEnumsCount||0==k.PendingEnums.length?c():(a=k.PendingEnums.shift(),
48==c[1]){if(0==c[2])return"A remote Serial Over LAN session was established.";if(1==c[2])return"Remote Serial Over LAN session finished. User control was restored.";if(2==c[2])return"A remote IDE-Redirection session was established.";if(3==c[2])return"Remote IDE-Redirection session finished. User control was restored."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="wired"),4294967293==a?"Allreceivedpacketfilterwasmatchedon"+b+"interface.":4294967292==a?"Alloutboundpacketfilterwasmatchedon"+
b+" interface.":4294967290==a?"Spoofed packet filter was matched on "+b+" interface.":"Filter "+a+" was matched on "+b+" interface.";if(192==a)return 0==c[2]?"Security policy invoked. Some or all network traffic (TX) was stopped.":2==c[2]?"Security policy invoked. Some or all network traffic (RX) was stopped.":"Security policy invoked.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"User request for remote connection.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC error: attempt to get posture while NAC in Intel\ufffd AMT is disabled.";
4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};k.GetMessageLog=function(a,b){k.AMT_MessageLog_PositionToFirstRecord(q,[a,b,[]])};var h="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
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:":"<",e=a?"</q:":"</",a="<r:"+b+(a?'xmlns:q="'+c.__namespace+'"':"")+">",m;for(m in c)c.hasOwnProperty(m)&&0!==m.indexOf("__")&&("function"===typeof c[m]||Array.isArray(c[m])||("object"===typeof c[m]?console.error("only convert one level down..."):a+=d+m+">"+c[m].toString()+e+m+">"));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:SelectorName="'+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);returnc}
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++){vara=parseInt(b[c]);if(a!=b[c])returnnull;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]);returna}
(new MutationObserver(function(){var b=a.slice();a.length=0;b.forEach(function(a){a()})})).observe(g,{attributes:!0});var p=d.setImmediate;d.setImmediate=function(d){15<Date.now()-b?(b=Date.now(),p(d)):(a.push(d),1===a.length&&g.setAttribute("a",c=!c))}}d.nextTick=d.setImmediate}})();d.isArray=Array.isArray||function(a){return"[objectArray]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeofArrayBuffer&&ainstanceofArrayBuffer};d.isArrayBufferView=function(a){returna&&
(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);returnc};d.xorBytes=function(a,b,c){for(varg="",d="",p="",e=0,h=0;0<c;--c,++e)d=a.charCodeAt(e)^b.charCodeAt(e),10<=h&&(g+=p,p="",h=0),p+=String.fromCharCode(d),++h;returng+p};d.hexToBytes=function(a){varb="",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));returnb};d.bytesToHex=
var g=b;g||(g=new Uint8Array(a.length));for(var p=c=c||0,e=0;e<a.length;++e)g[p++]=a.charCodeAt(e);returnb?p-c:g};d.text.utf8.decode=function(a){returnd.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){varg=b;g||(g=newUint8Array(2*a.length));for(vard=newUint16Array(g.buffer),p=c=c||0,e=c,h=0;h<a.length;++h)d[e++]=a.charCodeAt(h),p+=2;returnb?p-c:g};d.text.utf16.decode=function(a){returnString.fromCharCode.apply(null,newUint16Array(a.buffer))};d.deflate=function(a,
b,c){b=d.decode64(a.deflate(d.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};d.inflate=function(a,b,c){a=a.inflate(d.encode64(b)).rval;return null===a?null:d.decode64(a)};var x=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=d.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;},F=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 g=Error(c.error.message);g.id=c.error.id;g.name=c.error.name;throw g;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(d.decode64(c)));return c},h=function(a,b,c,g){var d=F(a,b);null===d&&(d={});d[c]=g;x(a,b,d)},g=function(a,b,c){a=F(a,b);null!==a&&(a=c in a?a[c]:null);return a},K=function(a,b,c){var g=F(a,b);if(null!==g&&c in g){delete g[c];c=!0;for(var d in g){c=!1;break}c&&(g=null);x(a,b,g)}},u=function(a,b){x(a,b,null)},m=function(a,b,
c){var g=null;"undefined"===typeof c&&(c=["web","flash"]);var d,p=!1,e=null,h;for(h in c){d=c[h];try{if("flash"===d||"both"===d){if(null===b[0])throw Error("Flash local storage not available.");g=a.apply(this,b);p="flash"===d}if("web"===d||"both"===d)b[0]=localStorage,g=a.apply(this,b),p=!0}catch(k){e=k}if(p)break}if(!p)throw e;return g};d.setItem=function(a,b,c,g,d){m(h,arguments,d)};d.getItem=function(a,b,c,d){return m(g,arguments,d)};d.removeItem=function(a,b,c,g){m(K,arguments,g)};d.clearItems=
(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._outBlock=Array(this._ints)};x.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.");};x.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]);
g="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,
"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var h=Error("Too few bytes to parse DER.");h.bytes=b.length();throw h;}var g=b.getByte(),h=g&192,k=g&31,u=d(b);if(b.length()<u){if(e)throwh=Error("ToofewbytestoreadASN.1value."),h.detail=b.length()+"<"+u,h;u=b.length()}varm,y=32===(g&32);m=y;if(!m&&h===c.Class.UNIVERSAL&&k===c.Type.BITSTRING&&1<u){varA=b.read;if(0===b.getByte()&&(g=b.getByte(),g&=192,g===c.Class.UNIVERSAL||g===c.Class.CONTEXT_SPECIFIC))try{if(m=d(b)===u-(b.read-
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)throwError("Integertoolarge;maxis32-bits.");returnb.getSignedInt(c)};c.validate=function(b,d,e,g){vark=!1;if(b.tagClass!==d.tagClass&&"undefined"!==typeofd.tagClass||b.type!==d.type&&"undefined"!==typeofd.type)g&&(b.tagClass!==d.tagClass&&g.push("["+d.name+']Expectedtagclass"'+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){k=!0;if(d.value&&a.util.isArray(d.value))for(var u=0,v=0;k&&v<d.value.length;++v)k=d.value[v].optional||!1,b.value[u]&&((k=c.validate(b.value[u],d.value[v],e,g))?++u:d.value[v].optional&&(k=!0)),!k&&g&&g.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
"Content-Domain"!==v.name)if(u.dekInfo||"DEK-Info"!==v.name)u.headers.push(v);else{if(0===v.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:E[0],parameters:E[1]||null}}else u.contentDomain=E[0]||"";else{if("Proc-Type"!==v.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==v.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');
u.procType={version:E[0],type:E[1]}}}++y}if("ENCRYPTED"===u.procType&&!u.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 e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var m,n=function(a,c){c.exports=function(c){var e=m.map(function(b){return a(b)}).concat(b);
var I=I&-15,H=H&-15,aa=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|g[I>>>16&15]|k[I>>>12&15]|l[I>>>8&15]|h[I>>>4&15],ca=u[H>>>28]|r[H>>>24&15]|m[H>>>20&15]|y[H>>>16&15]|v[H>>>12&15]|n[H>>>8&15]|x[H>>>4&15];R=(ca>>>16^aa)&65535;K[D++]=aa^R;K[D++]=ca^R<<16}}this._keys=K;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);
y||(y=q);b=Math.ceil(b.n.bitLength()/8);e=b-2*q.digestLength-2;if(d.length>e)throw y=Error("RSAES-OAEP input message length is too long."),y.length=d.length,y.maxLength=e,y;m||(m="");q.update(m,"raw");m=q.digest();h="";e-=d.length;for(g=0;g<e;g++)h+="\x00";d=m.getBytes()+h+"\u0001"+d;if(!u)u=a.random.getBytes(q.digestLength);elseif(u.length!==q.digestLength)throwy=Error("InvalidRSAES-OAEPseed.Theseedlengthmustmatchthedigestlength."),y.seedLength=u.length,y.digestLength=q.digestLength,
2)throw Error("RSAES-OAEP key is too short for the hash function.");g||(g="");m.update(g,"raw");g=m.digest().getBytes();b=d.charAt(0);h=d.substring(1,m.digestLength+1);d=d.substring(1+m.digestLength);var q=c(d,m.digestLength,u);h=a.util.xorBytes(h,q,h.length);u=c(h,e-m.digestLength-1,u);d=a.util.xorBytes(d,u,d.length);e=d.substring(0,m.digestLength);u="\x00"!==b;for(b=0;b<m.digestLength;++b)u|=g.charAt(b)!==e.charAt(b);g=1;for(m=b=m.digestLength;m<d.length;m++)e=d.charCodeAt(m),h=e&1^1,u|=e&(g?65534:
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 k=0;k<d;++k)g.putByte(e)}elsefor(;0<d;){for(varl=0,h=a.random.getBytes(d),k=0;k<d;++k)e=h.charCodeAt(k),0===e?++l:g.putByte(e);d=l}g.putByte(0);g.putBytes(b);returng}functiond(b,c,e,g){c=Math.ceil(c.n.bitLength()/8);b=a.util.createBuffer(b);vark=b.getByte(),l=b.getByte();if(0!==k||e&&0!==l&&1!==l||!e&&2!=l||e&&0===l&&"undefined"===
typeof g)throw Error("Encryption block is invalid.");e=0;if(0===l)for(e=c-3-g,g=0;g<e;++g){if(0!==b.getByte())throwError("Encryptionblockisinvalid.");}elseif(1===l)for(e=0;1<b.length();){if(255!==b.getByte()){--b.read;break}++e}elseif(2===l)for(e=0;1<b.length();){if(0===b.getByte()){--b.read;break}++e}if(0!==b.getByte()||e!==c-3-b.length())throwError("Encryptionblockisinvalid.");returnb.getBytes()}functione(b,c,d){functiong(){k(b.pBits,function(a,c){if(a)returnd(a);b.p=c;if(null!==b.q)returnl(a,
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},B=function(a){var b;if(a.algorithm in n.oids)b=n.oids[a.algorithm];
[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(n.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(a).getBytes())])};n.privateKeyFromAsn1=function(b){var c={},d=[];g.validate(b,D,c,d)&&(b=g.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!g.validate(b,y,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
g.Type.INTEGER,!1,m(a.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,m(a.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,m(a.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,m(a.qInv))])};n.publicKeyFromAsn1=function(b){var c={},d=[];if(g.validate(b,E,c,d)){d=g.derToOid(c.publicKeyOid);if(d!==n.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!g.validate(b,A,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
var x=m*Math.ceil(r/m);d=new a.util.ByteBuffer;for(w=0;w<x;w++)d.putByte(c.at(w%r));x=m*Math.ceil(b/m);c=newa.util.ByteBuffer;for(w=0;w<x;w++)c.putByte(q.at(w%b));q=d;q.putBuffer(c);c=Math.ceil(g/h);for(d=1;d<=c;d++){x=newa.util.ByteBuffer;x.putBytes(v.bytes());x.putBytes(q.bytes());for(w=0;w<e;w++)l.start(),l.update(x.getBytes()),x=l.digest();varK=newa.util.ByteBuffer;for(w=0;w<m;w++)K.putByte(x.at(w%h));varF=Math.ceil(r/m)+Math.ceil(b/m),L=newa.util.ByteBuffer;for(k=0;k<F;k++){varea=newa.util.ByteBuffer(q.getBytes(m)),
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,n,q);l=l.encIv;h=h(b);h.start(l);return h};m.pbe.getCipherForPKCS12PBE=function(b,c,d){var g={},l=[];if(!e.validate(c,q,g,l))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;var l=a.util.createBuffer(g.salt),g=a.util.createBuffer(g.iterations),
(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,e=c.digestLength,m=b.salt||null;"string"===typeof m&&(m=a.util.createBuffer(m));var h;if("saltLength"in b)h=b.saltLength;else if(null!==m)h=m.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==m&&m.length()!==h)throw Error("Given salt length does not match length of given salt.");var g=b.prng||a.random;return{encode:function(b,l){var q,n=l-1,A=Math.ceil(n/8),E=b.digest().getBytes();
return B+E+String.fromCharCode(188)},verify:function(b,g,l){var m;m=l-1;l=Math.ceil(m/8);g=g.substr(-l);if(l<e+h+2)throwError("InconsistentparameterstoPSSsignatureverification.");if(188!==g.charCodeAt(l-1))throwError("Encodedmessagedoesnotendin0xBC.");varq=l-e-1,n=g.substr(0,q);g=g.substr(q,e);varB=65280>>8*l-m&255;if(0!==(n.charCodeAt(0)&B))throw Error("Bits beyond keysize not zero as expected.");var P=d.generate(g,q),w="";for(m=0;m<q;m++)w+=String.fromCharCode(n.charCodeAt(m)^P.charCodeAt(m));
var k=e.value,l=g.Type.PRINTABLESTRING;"valueTagClass"in e&&(l=e.valueTagClass,l===g.Type.UTF8&&(k=a.util.encodeUtf8(k)));e=g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,l,!1,k)])]);c.value.push(e)}return c}function e(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeofb.name&&(b.type&&b.typeinn.oids?b.name=n.oids[b.type]:b.shortName&&b.shortNamein
D&&(b.name=n.oids[D[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in n.oids)b.type=n.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in D&&(b.shortName=D[b.name]);if(b.type===u.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=g.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(n.certificateExtensionToAsn1(m(b.extensions[d])))}if("undefined"===
typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function m(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in n.oids&&(b.name=n.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in n.oids)b.id=n.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,h=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
"pathLenConstraint"in b&&b.value.value.push(g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.pathLenConstraint).getBytes()));else if("extKeyUsage"===b.name)for(e in b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),d=b.value.value,b)!0===b[e]&&(e in u?d.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(u[e]).getBytes())):-1!==e.indexOf(".")&&d.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e).getBytes())));else if("nsCertType"===b.name)e=d=0,b.client&&(e|=128,
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?g.oidToDer(g.oidToDer(e.oid)):g.oidToDer(d));b.value.value.push(g.create(g.Class.CONTEXT_SPECIFIC,e.type,!1,d))}else"subjectKeyIdentifier"===b.name&&c.cert&&(d=c.cert.generateSubjectKeyIdentifier(),b.subjectKeyIdentifier=d.toHex(),b.value=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,d.getBytes()));if("undefined"===typeof b.value)throw d=Error("Extension value not specified."),
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=g.fromDer(b.body,d);return n.certificateFromAsn1(d,c)};n.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:g.toDer(n.certificateToAsn1(b)).getBytes()};
return a.pem.encode(d,{maxline:c})};n.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=g.fromDer(b.body);return n.publicKeyFromAsn1(b)};n.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
body:g.toDer(n.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};n.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:g.toDer(n.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};n.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=g.toDer(n.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=g.toDer(n.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};n.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=g.fromDer(b.body,d);return n.certificationRequestFromAsn1(d,c)};n.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:g.toDer(n.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};n.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=u[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=n.getTBSCertificate(b);e=g.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.");
a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};n.certificateFromAsn1=function(b,d){var h={},m=[];if(!g.validate(b,A,h,m))throw h=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),h.errors=m,h;if("string"!==typeof h.certSignature){for(var m="\x00",q=0;q<h.certSignature.length;++q)m+=g.toDer(h.certSignature[q]).getBytes();h.certSignature=m}m=g.derToOid(h.publicKeyOid);if(m!==n.oids.rsaEncryption)throwError("Cannotreadpublickey.OIDisnotRSA.");
var r=n.createCertificate();r.version=h.certVersion?h.certVersion.charCodeAt(0):0;m=a.util.createBuffer(h.certSerialNumber);r.serialNumber=m.toHex();r.signatureOid=a.asn1.derToOid(h.certSignatureOid);r.signatureParameters=P(r.signatureOid,h.certSignatureParams,!0);r.siginfo.algorithmOid=a.asn1.derToOid(h.certinfoSignatureOid);r.siginfo.parameters=P(r.siginfo.algorithmOid,h.certinfoSignatureParams,!1);m=a.util.createBuffer(h.certSignature);++m.read;r.signature=m.getBytes();m=[];void 0!==h.certValidity1UTCTime&&
m.push(g.utcTimeToDate(h.certValidity1UTCTime));void 0!==h.certValidity2GeneralizedTime&&m.push(g.generalizedTimeToDate(h.certValidity2GeneralizedTime));void 0!==h.certValidity3UTCTime&&m.push(g.utcTimeToDate(h.certValidity3UTCTime));void 0!==h.certValidity4GeneralizedTime&&m.push(g.generalizedTimeToDate(h.certValidity4GeneralizedTime));if(2<m.length)throwError("CannotreadnotBefore/notAftervaliditytimes;morethantwotimeswereprovidedinthecertificate.");if(2>m.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
r.validity.notBefore=m[0];r.validity.notAfter=m[1];r.tbsCertificate=h.tbsCertificate;if(d){r.md=null;if(r.signatureOid in u)switch(m=u[r.signatureOid],m){case "sha1WithRSAEncryption":r.md=a.md.sha1.create();break;case "md5WithRSAEncryption":r.md=a.md.md5.create();break;case "sha256WithRSAEncryption":r.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":r.md=a.md.sha512.create();break;case "RSASSA-PSS":r.md=a.md.sha256.create()}if(null===r.md)throw h=Error("Could not compute certificate digest. Unknown signature OID."),
function(b){var c={};c.id=g.derToOid(b.value[0].value);c.critical=!1;b.value[1].type===g.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 u)if(c.name=u[c.id],"keyUsage"===c.name){b=g.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=
g.derToOid(b.value[d].value),e in u?c[u[e]]=!0:c[e]=!0;else if("nsCertType"===c.name)b=g.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);elseif("subjectAltName"===c.name||"issuerAltName"===c.name)for(c.altNames=[],b=g.fromDer(c.value),e=0;e<b.value.length;++e){vard=b.value[e],h={type:d.type,value:d.value};c.altNames.push(h);
switch(d.type){case 7:h.ip=a.util.bytesToIP(d.value);break;case 8:h.oid=g.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=g.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};n.certificationRequestFromAsn1=function(b,d){var h={},m=[];if(!g.validate(b,B,h,m))throw h=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),h.errors=m,h;if("string"!==typeof h.csrSignature){for(var m="\x00",q=0;q<h.csrSignature.length;++q)m+=
g.toDer(h.csrSignature[q]).getBytes();h.csrSignature=m}m=g.derToOid(h.publicKeyOid);if(m!==n.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var r=n.createCertificationRequest();r.version=h.csrVersion?h.csrVersion.charCodeAt(0):0;r.signatureOid=a.asn1.derToOid(h.csrSignatureOid);r.signatureParameters=P(r.signatureOid,h.csrSignatureParams,!0);r.siginfo.algorithmOid=a.asn1.derToOid(h.csrSignatureOid);r.siginfo.parameters=P(r.siginfo.algorithmOid,h.csrSignatureParams,!1);m=
a.util.createBuffer(h.csrSignature);++m.read;r.signature=m.getBytes();r.certificationRequestInfo=h.certificationRequestInfo;if(d){r.md=null;if(r.signatureOid in u)switch(m=u[r.signatureOid],m){case "sha1WithRSAEncryption":r.md=a.md.sha1.create();break;case "md5WithRSAEncryption":r.md=a.md.md5.create();break;case "sha256WithRSAEncryption":r.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":r.md=a.md.sha512.create();break;case "RSASSA-PSS":r.md=a.md.sha256.create()}if(null===r.md)throw h=
Error("Could not compute certification request digest. Unknown signature OID."),h.signatureOid=r.signatureOid,h;m=g.toDer(r.certificationRequestInfo);r.md.update(m.getBytes())}m=a.md.sha1.create();r.subject.getField=function(a){return c(r.subject,a)};r.subject.addField=function(a){e([a]);r.subject.attributes.push(a)};r.subject.attributes=n.RDNAttributesAsArray(h.certificationRequestInfoSubject,m);r.subject.hash=m.digest().toHex();r.publicKey=n.publicKeyFromAsn1(h.subjectPublicKeyInfo);r.getAttribute=
n.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,h=!0,k=null,l=0;do{var m=c.shift(),u=null,q=!1;if(g<m.validity.notBefore||g>m.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:n.certificateError.certificate_expired,notBefore:m.validity.notBefore,notAfter:m.validity.notAfter,now:g};if(null===k){u=c[0]||b.getIssuer(m);null===u&&m.isIssuer(m)&&(q=!0,u=m);if(u){var B=u;a.util.isArray(B)||(B=[B]);for(var y=!1;!y&&0<B.length;){u=B.shift();
try{y=u.verify(m)}catch(v){}}y||(k={message:"Certificate signature is invalid.",error:n.certificateError.bad_certificate})}null!==k||u&&!q||b.hasCertificate(m)||(k={message:"Certificate is not trusted.",error:n.certificateError.unknown_ca})}null===k&&u&&!m.isIssuer(u)&&(k={message:"Certificate issuer is invalid.",error:n.certificateError.bad_certificate});if(null===k)for(B={keyUsage:!0,basicConstraints:!0},y=0;null===k&&y<m.extensions.length;++y){var A=m.extensions[y];!A.critical||A.name in B||(k=
{message:"Certificate has an unsupported critical extension.",error:n.certificateError.unsupported_certificate})}null!==k||h&&(0!==c.length||u&&!q)||(h=m.getExtension("basicConstraints"),m=m.getExtension("keyUsage"),null!==m&&(m.keyCertSign&&null!==h||(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:n.certificateError.bad_certificate})),
null!==k||null===h||h.cA||(k={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:n.certificateError.bad_certificate}),null===k&&null!==m&&"pathLenConstraint"in h&&l-1>h.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:n.certificateError.bad_certificate}));m=null===k?!0:k.error;h=d?d(m,l,e):m;if(!0===h)k=null;else{!0===m&&(k={message:"The application rejected the certificate.",error:n.certificateError.bad_certificate});
b.errors=E,b;r=h.derToOid(q.contentType);if(r!==g.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=r,b;r=h.derToOid(q.encAlgorithm);r=g.pbe.getCipher(r,q.encParameter,A);q=d(q.encryptedContentAsn1);q=a.util.createBuffer(q.value);r.update(q);if(!r.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");r=r.output.getBytes();y.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=h.derToOid(q.contentType),b;}y.safeBags=
m(r,k,l);b.safeContents.push(y)}}function m(a,b,c){if(!b&&0===a.length)return[];a=h.fromDer(a,b);if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.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++){varp={},k=[];if(!h.validate(a.value[e],y,p,k))throwa=Error("CannotreadSafeBag."),a.errors=k,a;varl={type:h.derToOid(p.bagId),attributes:n(p.bagAttributes)};d.push(l);varu,q,v=p.bagValue.value[0];switch(l.type){caseg.oids.pkcs8ShroudedKeyBag:if(v=
g.decryptPrivateKeyInfo(v,c),null===v)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case g.oids.keyBag:try{l.key=g.privateKeyFromAsn1(v)}catch(A){l.key=null,l.asn1=v}continue;case g.oids.certBag:u=E;q=function(){if(h.derToOid(p.certId)!==g.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=h.derToOid(p.certId);throw a;}a=h.fromDer(p.cert,b);try{l.cert=g.certificateFromAsn1(a,!0)}catch(c){l.cert=null,l.asn1=a}};break;default:throw a=
q.pkcs12FromAsn1=function(b,m,n){"string"===typeof m?(n=m,m=!0):void 0===m&&(m=!0);var u={};if(!h.validate(b,D,u,[]))throw m=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),m.errors=m,m;var y={version:u.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(y.safeContents,null,null,b.bagType));void 0!==e&&
(d.localKeyId=c(y.safeContents,"localKeyId",e,b.bagType));"friendlyName"in b&&(d.friendlyName=c(y.safeContents,"friendlyName",b.friendlyName,b.bagType));return d},getBagsByFriendlyName:function(a,b){return c(y.safeContents,"friendlyName",a,b)},getBagsByLocalKeyId:function(a,b){return c(y.safeContents,"localKeyId",a,b)}};if(3!==u.version.charCodeAt(0))throw m=Error("PKCS#12 PFX of version other than 3 not supported."),m.version=u.version.charCodeAt(0),m;if(h.derToOid(u.contentType)!==g.oids.data)throw m=
Error("Only PKCS#12 PFX in password integrity mode supported."),m.oid=h.derToOid(u.contentType),m;b=u.content.value[0];if(b.tagClass!==h.Class.UNIVERSAL||b.type!==h.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(u.mac){var A=null,x=0,r=h.derToOid(u.macAlgorithm);switch(r){case g.oids.sha1:A=a.md.sha1.create();x=20;break;case g.oids.sha256:A=a.md.sha256.create();x=32;break;case g.oids.sha384:A=a.md.sha384.create();x=48;break;case g.oids.sha512:A=a.md.sha512.create();
x=64;break;case g.oids.md5:A=a.md.md5.create(),x=16}if(null===A)throw Error("PKCS#12 uses unsupported MAC algorithm: "+r);var r=new a.util.ByteBuffer(u.macSalt),E="macIterations"in u?parseInt(a.util.bytesToHex(u.macIterations),16):1,x=q.generateKey(n,r,3,E,x,A),r=a.hmac.create();r.start(A,x);r.update(b.value);if(r.getMac().getBytes()!==u.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(y,b.value,m,n);return y};q.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
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 e=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
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};h.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};h.CipherSuites={};h.getCipherSuite=function(a){var b=null,c;for(c in h.CipherSuites){var d=h.CipherSuites[c];if(d.id[0]===a.charCodeAt(0)&&d.id[1]===a.charCodeAt(1)){b=d;break}}return b};
h.handleUnexpected=function(a,b){(a.open||a.entity!==h.ConnectionEnd.client)&&a.error(a,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unexpected_message}})};h.handleHelloRequest=function(a,b,c){!a.handshaking&&0<a.handshakes&&(h.queue(a,h.createAlert(a,{level:h.Alert.Level.warning,description:h.Alert.Description.no_renegotiation})),h.flush(a));a.process()};h.parseHelloMessage=function(b,c,d){var e=null,g=b.entity===
h.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:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});else{c=c.fragment;var k=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:m(c,1),extensions:[]};g?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=m(c,2),e.compression_methods=
!1!==b.verifyClient&&h.queue(b,h.createRecord(b,{type:h.ContentType.handshake,data:h.createCertificateRequest(b)})),h.queue(b,h.createRecord(b,{type:h.ContentType.handshake,data:h.createServerHelloDone(b)}))));h.flush(b);b.process()}};h.handleCertificate=function(b,c,d){if(3>d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});d=m(c.fragment,3);var e,g;c=[];try{for(;0<d.length();)e=
m(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:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate}})}e=b.entity===h.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?q:w:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],h.verifyCertificateChain(b,c)&&(b.expect=e?q:w)):b.error(b,{message:e?"No server certificate provided.":
"No client certificate provided.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});b.process()};h.handleServerKeyExchange=function(a,b,c){if(0<c)returna.error(a,{message:"Invalidkeyparameters.OnlyRSAissupported.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unsupported_certificate}});a.expect=u;a.process()};h.handleClientKeyExchange=function(b,c,d){if(48>d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.",
send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unsupported_certificate}});c=m(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:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}});
try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var k=b.session.clientHelloVersion;if(k.major!==g.pre_master_secret.charCodeAt(0)||k.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=G;null!==b.session.clientCertificate&&(b.expect=C);b.process()};h.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,
description:h.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:m(b,1),certificate_authorities:m(b,2)};a.session.certificateRequest=b;a.expect=D;a.process()};h.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=m(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:h.Alert.Level.fatal,description:h.Alert.Description.handshake_failure}})}b.expect=G;b.process()};h.handleServerHelloDone=function(b,c,d){if(0<d)returnb.error(b,{message:"InvalidServerHelloDonemessage.Invalidlength.",
send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.record_overflow}});if(null===b.serverCertificate&&(c={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.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));
break;case h.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(c.description===h.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===h.ConnectionEnd.client?"server":"client",alert:c});a.process()};h.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 k=d.bytes(g+
4);d.read+=4;e in J[b.entity][b.expect]?(b.entity!==h.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!==h.HandshakeType.hello_request&&e!==h.HandshakeType.certificate_verify&&e!==h.HandshakeType.finished&&(b.session.md5.update(k),b.session.sha1.update(k)),J[b.entity][b.expect][e](b,c,g)):
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},g={read:c(),write:c()};g.read.update=function(a,b){g.read.cipherFunction(b,g.read)?g.read.compressFunction(a,b,g.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.decompression_failure}}):
a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_record_mac}});return!a.fail};g.write.update=function(a,b){g.write.compressFunction(a,b,g.write)?g.write.cipherFunction(b,g.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}});
var q=a.util.createBuffer();n(q,3,u);e.putBuffer(q)}d=a.pki.certificateFromAsn1(g);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(w){return b.error(b,{message:"Could not send certificate list.",cause:w,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(h.HandshakeType.certificate);c.putInt24(b);n(c,3,e);return c};h.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
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:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}})}null===e?b.error(b,{message:"No private key set.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}}):
c=e.sign(c,null);d(b,c)};b.getSignature(b,d,c)};h.createCertificateVerify=function(b,c){var d=c.length+2,e=a.util.createBuffer();e.putByte(h.HandshakeType.certificate_verify);e.putInt24(d);e.putInt16(c.length);e.putBytes(c);return e};h.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();
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&&eind.cache){c=d.cache[e];deleted.cache[e];for(vargind.order)if(d.order[g]===e){d.order.splice(g,1);break}}returnc};d.setSession=function(b,c){if(d.order.length===d.capacity){vare=d.order.shift();
!1;k.fail=!(a||"undefined"===typeof a);k.input.clear();k.tlsData.clear();k.data.clear();k.state.current=h.createConnectionState(k)}};k.reset();k.handshake=function(b){if(k.entity!==h.ConnectionEnd.client)k.error(k,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(k.handshaking)k.error(k,{message:"Handshake already in progress.",fatal:!1});else{k.fail&&!k.open&&0===k.handshakes&&(k.fail=!1);k.handshaking=!0;b=b||"";var c=null;0<b.length&&(k.sessionCache&&(c=k.sessionCache.getSession(b)),
h.queue(k,h.createAlert(k,{level:h.Alert.Level.warning,description:h.Alert.Description.close_notify})),h.flush(k);k.closed(k)}k.reset(a)};return k};a.tls=a.tls||{};for(var X in h)"function"!==typeof h[X]&&(a.tls[X]=h[X]);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());
u.Type.OCTETSTRING,!1,b.parameter.getBytes())]),u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,b.content.getBytes())])]}function g(b,c,d){var e={};if(!u.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(u.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=
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 u=a.asn1,D=a.pkcs7=a.pkcs7||{};D.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=u.fromDer(b.body);return D.messageFromAsn1(b)};D.messageToPem=function(b,c){var d={type:"PKCS7",body:u.toDer(b.toAsn1()).getBytes()};return a.pem.encode(d,{maxline:c})};D.messageFromAsn1=function(b){var c={},d=[];if(!u.validate(b,D.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=u.derToOid(c.contentType);switch(d){case a.pki.oids.envelopedData:d=
D.createEnvelopedData();break;case a.pki.oids.encryptedData:d=D.createEncryptedData();break;case a.pki.oids.signedData:d=D.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};D.createSignedData=function(){var b=null;return b={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(c){g(b,
u.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=u.derToOid(b.contentInfo.value[0].value),d=b.contentInfo.value[1],d=d.value[0],h=u.toDer(d);h.getByte();u.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)throwError("Invalidsigner;authenticatedAttributesmustbepresentwhentheContentInfocontenttypeisnotPKCS#7Data.");
null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,g(a.parent,b))};c?setTimeout(d,0):d(b)},q=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in e?0===e[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):e[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(e[b.type].shift(),0===e[b.type].length?delete e[b.type]:e[b.type][0].start()):a.log.error("forge.task",
"[%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 e?e[a.type].push(b):(e[b.type]=[b],h(b))};a.task.cancel=function(a){a in e&&(e[a]=[e[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 e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var m,n=function(a,c){c.exports=function(c){var e=m.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<e.length;++l)e[l](c);returnc.task}},
function(){m.apply(null,Array.prototype.slice.call(arguments,0))})})();return c("js/forge")});function amtcert_linkCertPrivateKey(b,c){for(var a in b){var d=b[a];try{if(0==xxCertPrivateKeys.length)break;for(var e=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),m=0;m<c.length;m++)e===c[m].DERKey+"-----ENDPUBLICKEY-----"&&(c[m].XCert=d,d.XPrivateKey=c[m])}catch(n){console.log(n)}}}
function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),e=window.forge.asn1.fromDer(d),m=window.forge.pkcs12.pkcs12FromAsn1(e,c),n=m.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(n[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<n[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var q=n[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,p=window.forge.pki.privateKeyToAsn1(q),l=window.forge.pki.wrapRsaPrivateKey(p);window.forge.asn1.toDer(l).getBytes();
var v=m.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,k=m.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(q,v,k);return!0}catch(x){}return!1}function amtcert_signWithCaKey(b,c,a,d,e){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,e)}
function amtcert_createCertificate(b,c,a,d,e){var m,n=forge.pki.createCertificate();a?n.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(m=forge.pki.rsa.generateKeyPair(2048),n.publicKey=m.publicKey);n.serialNumber=""+Math.floor(1E5*Math.random()+1);n.validity.notBefore=new Date;n.validity.notBefore.setFullYear(n.validity.notBefore.getFullYear()-1);n.validity.notAfter=new Date;n.validity.notAfter.setFullYear(n.validity.notAfter.getFullYear()+30);var q=
a.ip+4),n=a.ip+6,q=[],p;for(p in a.variables)p.startsWith("__")&&delete a.variables[p];for(p=0;p<m;p++){varl=ReadShort(a.script,n),v=a.script.substring(n+2,n+2+l),k=v.charCodeAt(0),v=v.substring(1);if(2>k){for(;1<v.split("{").length;)varx=v.split("{").pop().split("}").shift(),v=v.replace("{"+x+"}",a.getVar(x));1==k&&(a.variables["__"+p]=decodeURI(v),v="__"+p);q.push(v)}if(2==k||3==k)a.variables["__"+p]=ReadSInt(v,0),q.push("__"+p);n+=2+l}a.ip+=c;c=[];for(p=0;10>p;p++)c.push(a.getVar(q[p]));var F;
function script_compile(b,c){var a="",d=b.split("\n"),e={},m=[],n=[],q;for(q in d){var p=d[q];if(p.startsWith("##SWAP ")){var l=p.split(" ");3==l.length&&(n[l[1]]=l[2])}if("#"!=p[0]&&0!=p.length){for(l in n)p=p.split(l).join(n[l]);var v=p.match(/"[^"]*"|[^\s"]+/g);if(0!=v.length)if(":"==p[0])e[v[0].toUpperCase()]=a.length;else{p=script_functionTable1.indexOf(v[0].toLowerCase());-1==p&&(p=script_functionTable2.indexOf(v[0].toLowerCase()),0<=p&&(p+=1E4));-1==p&&(p=script_functionTable3.indexOf(v[0].toLowerCase()),
0<=p&&(p+=2E4));if(-1==p)return c&&c("Unabled to compile, unknown command: "+v[0]),"";var k=ShortToStr(v.length-1),x;for(x in v)if(0!=x)if(":"==v[x][0])m.push([v[x],a.length+k.length+7]),k+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295);else var F=parseInt(v[x]),k=F==v[x]?k+(ShortToStr(5)+String.fromCharCode(2)+IntToStr(F)):'"'==v[x][0]&&'"'==v[x][v[x].length-1]?k+(ShortToStr(v[x].length-1)+String.fromCharCode(1)+v[x].substring(1,v[x].length-1)):k+(ShortToStr(v[x].length+1)+String.fromCharCode(0)+
v[x]);k=ShortToStr(p)+ShortToStr(k.length+4)+k;a+=k}}}for(q in m){d=m[q][0].toUpperCase();n=m[q][1];l=e[d];if(void 0==l)return c&&c("Unabled to compile, unknown label: "+d),"";a=a.substr(0,n)+IntToStr(l)+a.substr(n+4)}return IntToStr(612182341)+ShortToStr(1)+a}
c,g.canvas.canvas.width=b;g.canvas.setTransform(1,0,0,1,0,0);g.canvas.rotate(90*a*Math.PI/180);g.rotation=a;g.canvas.drawImage(g.tcanvas,v(0,0),k(0,0));g.width=g.canvas.canvas.width;g.height=g.canvas.canvas.height;if(null!=g.onScreenResize)g.onScreenResize(g,g.width,g.height,g.CanvasId);return!0}};g.Start=function(){g.state=0;g.acc="";g.ZRLEfirst=1;g.inflate.inflateReset();g.onKvmDataPending=[];g.onKvmDataAck=-1;g.kvmDataSupported=!1;for(var a in g.sparecache)delete g.sparecache[a]};g.Stop=function(){g.UnGrabMouseInput();
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};g.sendkey=function(a,b){if("object"==typeof a)for(var c in a)g.sendkey(a[c][0],a[c][1]);else g.Send(String.fromCharCode(4,b,0,0)+IntToStr(a))};g.sendKvmData=
6==n.code.length?n.code.charCodeAt(5):n.code.startsWith("Numpad")&&7==n.code.length?n.code.charCodeAt(6)+48:d[n.code];null!=n&&a.SendKeyMsgKC(b,n)}else n=c.keyCode,59==n?n=186:173==n?n=189:61==n&&(n=187),a.SendKeyMsgKC(b,n)};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=
91)};a.SendTouchMsg1=function(b,c,d,q){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(q))};a.SendTouchMsg2=function(b,c){var d="",q,p;for(p in a.TouchArray)p==b?q=c:1==a.TouchArray[p].f?(q=65542,a.TouchArray[p].f=3):q=2==a.TouchArray[p].f?262144:131078,d+=String.fromCharCode(p)+a.intToStr(q)+a.shortToStr(a.TouchArray[p].x)+a.shortToStr(a.TouchArray[p].y),2==a.TouchArray[p].f&&delete a.TouchArray[p];3==
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!=
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==q.fxEmulation&&122>a.which)return q.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==q.fxEmulation)return q.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==q.fxEmulation)return q.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;q.TermSendKey(a.which);
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");
z;e.next+=z;e.left-=z;d.length-=z;break}d.mode=11;break;case 16:if(!v(e,14))break a;d.nlen=k(e,5)+257;x(e,5);d.ndist=k(e,5)+1;x(e,5);d.ncode=k(e,4)+4;x(e,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;case17:for(;d.have<d.ncode;){if(!v(e,3))breaka;z=k(e,3);d.lens[E[d.have++]]=z;x(e,3)}for(;19>d.have;)d.lens[E[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(K=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(;;){z=d.codes[d.lencode+k(e,d.lenbits)];if(z.bits<=e.bits)break;if(!l(e))breaka}if(16>z.val)x(e,z.bits),d.lens[d.have++]=z.val;else{if(16==z.val){if(!v(e,z.bits+2))break a;x(e,z.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}r=d.lens[d.have-1];z=3+k(e,2);x(e,2)}else if(17==z.val){if(!v(e,z.bits+3))break a;x(e,z.bits);r=0;z=3+k(e,3);x(e,3)}else{if(!v(e,z.bits+7))break a;x(e,z.bits);r=0;z=11+k(e,7);x(e,7)}if(d.have+z>d.nlen+d.ndist){a.msg=
r.sane){z.msg="invalid distance too far back";r.mode=29;break b}da=0;U=-1;da=0==R?da+(J-M):da+(R-M);M<Y&&(Y-=M,z.output_data+=X.substring(da,da+M),L+=M,da=-1,U=L-ha)}elseda=-1,U=L-ha;if(0<=da)z.output_data+=X.substring(da,da+Y),L+=Y;else{M=Y;M>L-U&&(M=L-U);z.output_data+=z.output_data.substring(U,U+M);L+=M;Y-=M;U+=M;for(L+=Y;2<Y;)z.output_data+=z.output_data.charAt(U++),z.output_data+=z.output_data.charAt(U++),z.output_data+=z.output_data.charAt(U++),Y-=3;Y&&(z.output_data+=z.output_data.charAt(U++),
d.offset+=k(e,d.extra);x(e,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==e.left)break a;z=u-e.left;if(d.offset>z){z=d.offset-z;if(z>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}z>d.wnext?(z-=d.wnext,r=d.wsize-z):r=d.wnext-z;D=-1;z>d.length&&(z=d.length)}else r=-1,D=a.next_out-d.offset,z=d.length;z>e.left&&(z=e.left);e.left-=z;d.length-=z;if(0<=r)a.output_data+=d.window.substring(r,r+z),a.next_out+=z;else{a.next_out+=z;do a.output_data+=a.output_data.charAt(D++);while(--z)}0==
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(varcinAllWsman)b=document.createElement("option"),b.text=AllWsman[c],b.id="WSB-"+AllWsman[c],Q(24).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));
function documentFileSelectHandler(b){haltEvent(b);var c=!0;console.log(b.dataTransfer.files);for(var a=0;a<b.dataTransfer.files.length;a++)console.log(a,b.dataTransfer.files[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")&&
function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(50).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(50).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(50).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,e,m,n){go(0);fullscreenonly=!1;connectFunc=m;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,e);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QV("go12",!0);QV("go20",!0);QH(30,"");QH(41,"");amtversion=amtversionmin=amtFirstPull=
function disconnect(){null!=desktopPollTimer&&(clearInterval(desktopPollTimer),desktopPollTimer=null);fullscreen&&deskToggleFull();iderStop();StopDefenseStatsTimer();script_Stop();breakScriptButton();dialogclose(0);amtstack&&(amtstack.onProcessChanged=null,amtstack.CancelAllQueries(999),amtstack=null);cleanup();wsstack=null;delete amtstack;onProcessChanged(0,1);go(101);Q("xconnectbutton1").value="Connect";QH(5,"Disconnected");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(),scriptViewButton(script_BuildingBlocks?1:0),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,
function PullPowerState(){amtstack&&0==amtstack.GetPendingActions()&&amtsysstate&&amtsysstate.CIM_ServiceAvailableToElement&&amtstack.Enum("CIM_ServiceAvailableToElement",function(b,c,a,d){errcheck(d,b)||(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?
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","CIM_EnabledLogicalElement");amtstack.BatchEnum("",
200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var e in a)null!=a[e]&&a[e].status>d&&(d=a[e].status);400!=d&&errcheck(d,b)||(amtsysstate=a,updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Synchronize Clock",3,syncClockEx,"Synchronize Intel AMT clock with this computer?")}
function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Failed to set time, status = "+d):0!=a.Body.ReturnValue?messagebox("","Failed to set time, error: "+a.Body.ReturnValueStr):(b=new Date,b=Math.round((b.getTime()-6E4*b.getTimezoneOffset())/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}
var DMTFPowerStates=";;Power on;Light sleep;Deep sleep;Power cycle (Soft off);Off - Hard;Hibernate (Off soft);Soft off;Power cycle (Off-hard);Master bus reset;Diagnostic interrupt (NMI);Not applicable;Off - Soft graceful;Off - Hard graceful;Master bus reset graceful;Power cycle (Off - Soft graceful);Power cycle (Off - Hard graceful);Diagnostic interrupt (INIT)".split(";");
function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){varb=0,c,a,d=TableStart(),e="",m=amtsysstate.AMT_GeneralSettings.response;a="<i>Unknown</i>";if(null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length){a=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState];if(9<amtversion&&"Poweron"==a&&amtsysstate.CIM_EnabledLogicalElement&&amtsysstate.CIM_EnabledLogicalElement.responses&&
q.DefaultScreen&&(e=["Primary display","Secondary display","3rd display"][q.DefaultScreen]),e='<spantitle="The default remote display is the '+e.toLowerCase()+'">'+e+"</span>",1==q.Is5900PortEnabled&&(e+=", Port 5900 enabled"),1==q.OptInPolicy&&(e+=", "+q.OptInPolicyTimeout+" second"+(0<q.OptInPolicyTimeout?"s":"")+"opt-in"),e+=","+q.SessionTimeout+"minute"+(0<q.SessionTimeout?"s":"")+"sessiontimeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?((q=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&
e+=AddButton("Power Actions...","showPowerActionDlg()")+" ";e+=AddButton("Save State...","saveEntireAmtState()")+" ";e+=AddButton("Run Script...","script_runScriptDlg()")+" ";d+=TableEnd(e);QH(17,d);d="<tableclass=log1cellpadding=0cellspacing=0style=width:100%;border-radius:8px>"+TableEnd("<div> "+AddRefreshButton("PullSystemStatus(1)")+" Changing network settings may cause this page to becaume unavailable.");d=d+"<br><h2>General Settings</h2>"+TableStart();e="";"<i>None</i>"!=
c&&(1==m.SharedFQDN&&(e=", shared with OS"),0==m.SharedFQDN&&(e=", different from OS"));d+=TableEntry("Name & Domain",addLinkConditional(c+e,"showEditNameDlg(1)",xxAccountAdminName));c="Disabled";1==m.DDNSUpdateEnabled?c="Enabled each "+m.DDNSPeriodicUpdateInterval+" minutes, TTL is "+m.DDNSTTL+" minutes":1==m.DDNSUpdateByDHCPServerEnabled&&(c="Update by DHCP server");d+=TableEntry("Dynamic DNS",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?"Wireless":"Wired")+" Interface</h2>";d+=TableStart();d+=TableEntry("Link state",1==c.LinkIsUp?"Link is up":"Link is down");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);e=[];for(n in c.LinkPolicy)1==c.LinkPolicy[n]&&e.push("S0/AC"),14==c.LinkPolicy[n]&&e.push("Sx/AC"),16==c.LinkPolicy[n]&&
var l="Disabled",x,e=amtsysstate.CIM_ElementSettingData.responses;for(n=0;n<e.length;n++)e[n].SettingData&&e[n].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r)IPSIPv6Settings"+a&&(x=1==e[n].IsCurrent);1==x&&(e=isIpAddress(c.IPv6Address)||isIpAddress(c.DefaultRouter)||isIpAddress(c.PrimaryDNS)||isIpAddress(c.SecondaryDNS),l="Enabled,Automatic"+(e?"&manual":"")+"addresses");d+=TableEntry("IPv6state",addLinkConditional(l,"showIPv6StateDlg("+a+","+x+")",xxAccountAdminName));
function showLinkPolicyDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_EthernetPortSettings.responses[b],a;a=""+("<label><inputtype=checkboxid=d11p1value=1"+(0<=c.LinkPolicy.indexOf(1)?"checked":"")+">Available in S0/AC - Powered on & plugged in</label><br>");a+="<label><inputtype=checkboxid=d11p2value=14"+(0<=c.LinkPolicy.indexOf(14)?"checked":"")+">Available in Sx/AC - Sleeping & plugged in</label><br>";a+="<label><inputtype=checkboxid=d11p3value=16"+(0<=c.LinkPolicy.indexOf(16)?"checked":
"")+">Available in S0/DC - Powered on & on battery</label><br>";a+="<label><inputtype=checkboxid=d11p4value=224"+(0<=c.LinkPolicy.indexOf(224)?"checked":"")+">Available in Sx/DC - Sleeping & on battery</label><br>";setDialogMode(11,"Link Policy",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("Link Policy",format("Unable to set new link policy, error {0}",d))}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);c29.value="amtstate"+b+".json";setDialogMode(19,"Save Entire Intel® AMT State",3,saveEntireAmtStateOk)}}
c+="<divstyle=height:26px;margin-top:4pxid=subspassx><inputid=subspasstype=passwordautocomplete=offstyle=float:right;width:200pxmaxlength=8onkeyup=showDesktopSettingsDlgUpdate()><divstyle=padding-top:4px>5900 password (8 chars)</div></div>";9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(c+='<divstyle=height:26px;margin-top:4px><selectid=subsbstyle=float:right;width:200pxonchange=showDesktopSettingsDlgUpdate()><optionvalue=0>Disabled</option><optionvalue=1>Enabled</option></select><divstyle=padding-top:4pxtitle="This feature is not often supported">Screen Blanking</div></div>');
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("c48",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("Remote Desktop Settings",format("Error {0}, unable to set values.",d))}
function showDesktopSettingsDlgOk3(b,c,a,d){200!=d?messagebox("Error","Screen Blanking could not be set, blanking may not be supported on this system ("+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="<tableclass=log1cellpadding=0cellspacing=0style=width:100%;border-radius:8px>",null!=processMessageLog0responses&&(b=1==processMessageLog0responses[0].IsFrozen?AddButton("Un-freeze Log","FreezeLog(0)"):AddButton("Freeze Log","FreezeLog(1)")),c+=TableEnd("<divstyle=float:right><inputid=eventFilterplaceholder=Filterstyle=margin:4pxonkeyup=eventFilter()> </div><div> "+AddRefreshButton("PullEventLog(1)")+
AddButton("Clear Log","ClearLog()")+AddButton("Save...","SaveEventLog()")+b),QH(19,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,e;e="<tableclass=log1cellpadding=0cellspacing=0style=width:100%;border-radius:8px><tr><tdwidth=80px><p><td><td><td><tr><tdclass=r1style=width:90px><b> Event</b><tdclass=r1style=width:110px><b>Time</b><tdclass=r1style=width:160px><b>Source</b><tdclass=r1><b>Description</b>";for(a in c){d++;var m=1,n=c[a];8<=n.EventSeverity&&(m=2);16<=n.EventSeverity&&(m=3);e+="<trid=xamtevent"+a+"class=r3onclick=showEventDetails("+
function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="<divstyle=text-align:left>"+addHtmlValue("Time",c.Time.toLocaleString());a+=addHtmlValue("Source",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Description",c.Desc);a+=MoreStart();a+=addHtmlValue("Device Address",c.DeviceAddress);a+=addHtmlValue("Entity",c.Entity);a+=addHtmlValue("Entity Instance",c.EntityInstance);var d="",e;for(e in c.EventData)0<d.length&&(d+=","),d+=c.EventData[e];a+=addHtmlValue("Data",d);a+=addHtmlValue("Offset",
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))}
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><tdclass=r1style=padding-left:15px><br>Manage event subscribers.<br><br>";for(var e in subscriptionsListeners.CIM_ListenerDestination.responses)a=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[e].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","®"),d=subscriptionsListeners.CIM_ListenerDestination.responses[e],
function showSubscriptionDetails(b){if(!xxdialogMode){var c=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[b].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","®"),a=subscriptionsListeners.CIM_ListenerDestination.responses[b],d;d="<divstyle=text-align:left>"+addHtmlValue("Destination",a.Destination);d+=addHtmlValue("Filter",c);d+=addHtmlValue("Delivery Mode",subscriptionDeliveryModes[a.DeliveryMode]);setDialogMode(11,"Subscription "+(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:SelectorName="InstanceID">'+subscriptionsListeners.CIM_FilterCollectionSubscription.responses[c].Filter.ReferenceParameters.SelectorSet.Selector.Value+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>",
function newSubscriptionButton(){if(!xxdialogMode&&null!=subscriptionsFilters){var b;b="<divstyle=height:26px;margin-top:4px><selectid=subtypestyle=float:right;width:260px><optionvalue=Push>Push</option><optionvalue=PushWithAck>Push with ACK</option></select><divstyle=padding-top:4px>Type</div></div><divstyle=height:26px;margin-top:4px><selectid=subfilterstyle=float:right;width:260px>";for(var c in subscriptionsFilters)b+='<optionvalue="'+subscriptionsFilters[c].InstanceID+'">'+subscriptionsFilters[c].CollectionName.substring(13)+
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)}functionnewSubscriptionButtonOk2(b,c,a,d){200==d&&PullEventSubscriptions()}
function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AMT_AuditLog",processAuditLog0))}var auditLog=null,auditLogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";");
for(a in c){var m=c[a],n=m.AuditApp,q=m.Initiator;e++;var p="";0<m.NetAddress.length&&(p=m.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));m.Event&&(n+=","+m.Event);null!=m.ExStr&&(n+=","+m.ExStr);""!=q&&""!=p&&(q+=",");d+="<trid=xamtaudit"+a+"class=r3onclick=showAuditDetails("+a+')><tdclass=r1title="'+m.Time.toLocaleString()+'"> '+m.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br> "+m.Time.toLocaleTimeString("en",
{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<tdclass=r1>"+q+p+"<tdclass=r1>"+n}d+=TableEnd(0==e?" ":"")+"<br>"}QH(52,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","Intel AMT Audit Log",auditLog)}
function AuditLogSettingsCompleted(b,c,a,d){200==d?PullAuditLog():messagebox("Audit Log","Error: "+d)}
function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="<divstyle=text-align:left>"+addHtmlValue("Time",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiator",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Address",a.NetAddress));d+=addHtmlValue("Application",a.AuditApp);d+=addHtmlValue("Event",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Extended Data",a.ExStr);else if(0<a.Ex.length){vare="";for(cina.Ex)0<e.length&&(e+=","),e+=a.Ex.charCodeAt(c);""!=e&&(d+=addHtmlValue("DataValues",
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(vareinxxCertificates)xxCertificates[e].InstanceID==b&&(xxTlsCurrentCert=
e)}for(e in xxCertificates)xxCertificates[e].TrustedRootCertficate=1==xxCertificates[e].TrustedRootCertficate,xxCertificates[e].X509Certificate=window.atob(xxCertificates[e].X509Certificate),xxCertificates[e].XIssuer=parseCertName(xxCertificates[e].Issuer),xxCertificates[e].XSubject=parseCertName(xxCertificates[e].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"Disabled";var c=(1==xxTlsSettings[b].MutualAuthentication?"Mutual-auth TLS":"Server-auth TLS")+(1==xxTlsSettings[b].AcceptNonSecureConnections?" and non-TLS":"");1==xxTlsSettings[b].MutualAuthentication&&xxTlsSettings[b].TrustedCN&&(b=MakeToArray(xxTlsSettings[b].TrustedCN),0<b.length&&(c+=",Trustedname"+(1<b.length?"s":"")+":"+b.join(",")+"."));returnc}
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("Remote TLS security",addLinkConditional(getTlsSecurityState(c),"showSetTlsSecurityDlg()",xxAccountAdminName)),a=a+TableEntry("Local TLS security",addLinkConditional(getTlsSecurityState(b),"showSetTlsSecurityDlg()",xxAccountAdminName)),a=a+TableEnd(),a=a+("<br>"+TableStart2()+"<tr><tdclass=r1style=padding-left:15px><br>Manage Intel® AMT certificates for this computer.<br><br>");
if(0==xxCertificates.length&&0==xxCertPrivateKeys.length)a+="<divstyle=padding-left:15px><br><i>No certificates found.</i></div><br>";else{for(var d in xxCertificates)b="",xxCertificates[d].TrustedRootCertficate&&(b=", Trusted Root"),xxCertificates[d].XPrivateKey&&(b=", Private Key"),d==xxTlsCurrentCert&&(b+=", TLS cert"),a+="<divclass=itemBaronclick=showCertDetails("+d+")><divstyle=padding-top:3px><b>"+EscapeHtml(xxCertificates[d].XSubject.CN)+"</b><i>"+b+"</i></div></div>";for(d in xxCertPrivateKeys)xxCertPrivateKeys[d].XCert||
function showKeyPairDetails(b){setDialogMode(11,"Key Pair #"+b,5,function(c){2==c&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertPrivateKeys[b].InstanceID},PullCertificates,0,1)},"This is a public/private certificate key pair that does not belong to any certificates. This entry should be temporary.")}var xxCertSubjectNames={CN:"Common Name",O:"Organization",OU:"Org Unit",S:"State/Province",ST:"State/Province",L:"Locality",C:"Country",SN:"Surname",GN:"Given name"};
function showCertDetails(b){if(!xxdialogMode){var c=xxCertificates[b],a;a="<br>"+addHtmlValue("Certificate",c.X509Certificate.length+" bytes, <astyle=cursor:pointer;color:blueonclick=downloadCert("+b+")>Download</a>");a+=addHtmlValue("Trusted root",c.TrustedRootCertficate?"Yes":"No");0==c.TrustedRootCertficate&&c.XPrivateKey&&(a+=addHtmlValue("Private key","Present"));a+='<br><divstyle="border-bottom:1px solid gray"><i>Certificate Subject</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><divstyle="border-bottom:1px solid gray"><i>Issuer Certificate</i></div><br>';for(d in c.XIssuer)c.XIssuer[d]&&(a+=addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XIssuer[d])));setDialogMode(11,"Certificate - "+EscapeHtml(c.XSubject.CN),5,function(a){2==a&&(xxCertificates[b].XPrivateKey&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertificates[b].XPrivateKey.InstanceID},
function addCertButtonOk2(b){b=b.target.result;var c=b.indexOf("-----BEGIN CERTIFICATE-----");0<c?(b=b.substring(c+27),c=b.indexOf("-----ENDCERTIFICATE-----"),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='<inputid=certopentype=filestyle=float:right;width:230pxonchange=issueCertButtonUpdate()accept=".p12">',xxDragDropCertFiles&&(b='<inputstyle=float:right;width:230pxreadonlydisabledvalue="'+xxDragDropCertFiles[0].name+'">'),b=""+("<divstyleheight:26px;margin-top:14px>"+b+"<divstyle=padding-top:4px>Certificate file</div></div>")+"<divstyle=height:26px;margin-top:4px><inputonkeyup=issueCertButtonUpdate()id=certopenpasstype=passwordautocomplete=offstyle=float:right;width:230px><divstyle=padding-top:4px>Certificate password</div></div>",
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("c48",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("Issue Certificate","Unable to decrypt/decode certificate.")}
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("Issue Certificate","Failed to generate key pair. Status: "+d):0!=a.Body.ReturnValue?messagebox("Issue Certificate","Failed to generate key pair, "+a.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,a.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)}
function GenerateKeyPairResponse2(b,c,a,d,e){if(200!=d)messagebox("Issue Certificate","Failed to generate key pair. Status: "+d);else{b=null;for(var m in a)a[m].InstanceID==e&&(b=a[m].DERKey);a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};e={CN:"Untrusted Root Certificate"};if(null!=xxCaPrivateKey&&xxCaSubjectAttributes)for(m in e={},xxCaSubjectAttributes)e[xxCaSubjectAttributes[m].shortName]=xxCaSubjectAttributes[m].value;
m={name:"extKeyUsage"};Q("d11_cu4").checked&&(m.serverAuth=!0);Q("d11_cu5").checked&&(m.clientAuth=!0);Q("d11_cu6").checked&&(m.emailProtection=!0);Q("d11_cu7").checked&&(m.codeSigning=!0);Q("d11_cu8").checked&&(m.timeStamping=!0);m=amtcert_signWithCaKey(b,xxCaPrivateKey,a,e,m);null==m?messagebox("Issue Certificate","Unable to sign certificate."):(m=forge.pki.certificateToPem(m).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(m.substring(27,m.length-25),GenerateKeyPairResponse4))}}
function GenerateKeyPairResponse4(b,c,a,d){200!=d?messagebox("Issue Certificate","Failed to generate key pair. Status: "+d):PullCertificates()}function certificateAdded(b,c,a,d){200!=d||0!=a.Body.ReturnValue?messagebox("Add Certificate","Unable to add certificate, error "+(200!=d?d:a.Body.ReturnValueStr)):PullCertificates()}function certificateRemoved(b,c,a,d){200!=d?messagebox("Remove Certificate","Unable to remove certificate, error "+d):PullCertificates()}
function getInputElement(b){var c=document.getElementsByTagName("input");for(t=0;t<c.length;t++)if(c[t].id==b)returnc[t]}functiongetSelectElement(b){varc=document.getElementsByTagName("select");for(t=0;t<c.length;t++)if(c[t].id==b)returnc[t]}
function showSetTlsSecurityDlg(b){if(!xxdialogMode){b="<divstyle=height:26px;margin-top:4px><selectonchange=showSetTlsSecurityDlgUpdate()id=tlscertstyle=float:right;width:260px><optionvalue=-1>No Certificate, TLS Disabled</option>";for(var c in xxCertificates)0!=xxCertificates[c].TrustedRootCertficate||!xxCertificates[c].XPrivateKey||null!=xxTlsCurrentCert&&xxTlsCurrentCert!=c||(b+="<optionvalue="+c+">"+xxCertificates[c].XSubject.CN+"</option>");b+="</select><divstyle=padding-top:4px>Certificate</div></div><divstyle=height:26px;margin-top:4px><selectid=tlsremotestyle=float:right;width:260pxonchange=showSetTlsSecurityDlgUpdate()><optionvalue=0>Server-auth TLS only</option><optionvalue=1>Server-auth, non-TLS allowed</option>";
b+="<optionvalue=2>Mutual-auth TLS only</option><optionvalue=3>Mutual-auth, non-TLS allowed</option>";b+='</select><divstyle=padding-top:4px>Security</div></div><divstyle=height:26pxid=d11rcntitle="Comma seperated list of certificate common names that will be allowed to connect remotely."><inputid=d11_rcnstyle=float:right;width:260pxonkeyup=showSetTlsSecurityDlgUpdate()placeholder="name1, name2"><divstyle=padding-top:4px>Remote CN\'s</div></div>';setDialogMode(11,"TLS Settings",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?
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){vard=Clone(xxTLSCredentialContext[0]);d.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value=xxCertificates[b].InstanceID;amtstack.Put("AMT_TLSCredentialContext",d,setTlsSecurityResponse,0,1)}elseamtstack.Create("AMT_TLSCredentialContext",
setTlsSecurityResponse);setTlsSecurityPendingCalls++}else 0<xxTLSCredentialContext.length&&(setTlsSecurityDeleteCredentialContext=Clone(xxTLSCredentialContext[0]));vard="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,e=1-d;a[e].Enabled=-1!=b;a[e].MutualAuthentication=2<=c;a[e].AcceptNonSecureConnections=1==c%2;a[e].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("","Failed to set time, status = "+d):0!=c.Body.ReturnValue?messagebox("","Failed to set time, error: "+c.Body.ReturnValueStr):(a=new Date,a=Math.round((a.getTime()-6E4*a.getTimezoneOffset())/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("TLS Settings","Applying new security settings...")}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))returnb}}
function setTlsSecurityResponse(b,c,a,d){if(b){if(200!=d){messagebox("","Failed to set TLS security, 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("","Failed to set TLS security, status = "+d):0!=a.Body.ReturnValue?messagebox("","Failed to set TLS security, error: "+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)}
function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabilities.status){xxWatchdog=a;for(var e in xxWatchdog.CIM_ConcreteDependency.responses)b=xxWatchdog.CIM_ConcreteDependency.responses[e],(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,
"PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";"),watchdogMonitoredEntity="Unknown;Other;Operating System;Operating System Boot Process;Operating System Shutdown Process;Firmware Boot Process;BIOS Boot Process;Application;Service Processor".split(";");
function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Maximum Watchdogs",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" watchdogs");b+=TableEntry("Maximum Total Actions",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" actions");b+=TableEnd()+"<br>";b+=TableStart2();b+="<tr><tdclass=r1style=padding-left:15px><br>Manage Intel® AMT agent presence watchdogs.<br><br>";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||
function AddWatchdog(){var b;b="<divstyle=height:26px;margin-top:4px><inputid=wgnamestyle=float:right;width:240pxmaxlength=16onkeyup=AddWatchdogUpdate()><divstyle=padding-top:4px>Name</div></div>"+('<divstyle=height:26px;margin-top:4px><inputid=wgguidstyle=float:right;width:240pxmaxlength=36onkeyup=AddWatchdogUpdate()><divstyle=padding-top:4pxtitle="Generate random DeviceID">'+addLink("DeviceID","GenerateWatchdogGuid()")+"</div></div>");b+="<divstyle=height:26px;margin-top:4px><inputid=wgstartstyle=float:right;width:240pxmaxlength=8placeholder=3600onkeyup=AddWatchdogUpdate()><divstyle=padding-top:4px>Startup (seconds)</div></div>";
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++){vare=a.charCodeAt(d);45!=e&&(48<=e&&57>=e||97<=e&&102>=e?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("Watchdog","Unable to add watchdog, error #"+d):PullWatchdog()}
function addWatchdogAction(b,c){var a=xxWatchdog.AMT_AgentPresenceWatchdog.responses[c],d;d="<table><tdstyle=width:180px>From<br>";for(c in amtstack.WatchdogCurrentStates)d+="<inputid=wgsa"+c+"type=checkboxonclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[c]+"<br/>";d+="<td>To<br>";for(c in amtstack.WatchdogCurrentStates)d+="<inputid=wgsb"+c+"type=checkboxonclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[c]+"<br/>";setDialogMode(11,"Add Watchdog Action",
3,addWatchdogActionOk,d+"</table><br>Perform Action<br><inputid=wgseventtype=checkboxcheckedonclick=addWatchdogActionUpdate()>Write to event log<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)}
function addWatchdogActionOk(b,c){var a=0,d=0,e;for(e in amtstack.WatchdogCurrentStates)1==Q("wgsa"+e).checked&&(a+=parseInt(e)),1==Q("wgsb"+e).checked&&(d+=parseInt(e));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("Watchdog Action","Unable to add watchdog action, error #"+d):PullWatchdog()}
function deleteWatchdogActions(b,c){setDialogMode(11,"Delete Watchdog Actions",3,deleteWatchdogActionsOk,"Delete all actions for this 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("Watchdog Action","Unable to remove watchdog actions, error #"+d):PullWatchdog()}
var xxSystemDefense=null,xxSystemDefenceLinkedPolicy={},xxUpdatingDefenseStats=!1,xxFilterStatistics=[{},{}],xxFilterStatisticsTimer=null,xxFilterStatisticsTimerActive=!1,xxSystemDefenceFilterEthernetTypes={2048:"All IP Packets",2054:"All ARP Packets"},xxSystemDefenceFilterIPTypes={4:"IPv4",6:"IPv6"},xxSystemDefenceFilterDesc={0:"Allow, Count",1:"Drop, Count",2:"Rate limit",3:"Allow",4:"Drop"},xxSystemDefenceFilters={HdrProtocolID:1,HdrDestAddress:2,HdrDestMask:2,HdrSrcAddress:2,HdrSrcMask:2,HdrSrcPortStart:1,
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]=
a}b+=TableStart();c="<i>None</i>";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemDefenceLinkedPolicy[0].PolicyName);b+=TableEntry("Default Wired Policy",addLink(c,"changeDefaultPolicy(0)"));for(c=0;2>c;c++){var a=xxFilterStatistics[c],e;for(e in a)d=a[e],d=1==d?d+" packet":d+" packets",b+=TableEntry((0==c?"Wired ":"Wireless ")+e,d)}b+=TableEnd();b=b+"<br>"+TableStart2();b+="<tr><tdclass=r1style=padding-left:15px;border:0><br>Manage Intel® AMT system defense policies.<br><br>";if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+=
"<divstyle=padding-left:15px><i>No system defense policies found.</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+="<divclass=itemBaronclick=showPolicyDetails("+c+")><divstyle=padding-top:3px><b>"+EscapeHtml(a.PolicyName)+"</b>"+d+"</div></div>";b+="<tr><tdclass=r1style=padding-left:15px><br>Manage Intel® AMT system defense filters.<br><br>";
if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="<divstyle=padding-left:15px><i>No system defense filters found.</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+=" at "+a.FilterProfileData+
" packet / sec"),1==a.ActionEventOnMatch&&(d+=", Event on match"),b+="<divclass=itemBaronclick=showFilterDetails(0,"+c+")><divstyle=padding-top:3px><b>"+(0==a.FilterDirection?"← ":"→ ")+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==
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:SelectorName="DeviceID">Intel(r) AMT Ethernet Port '+b+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}):
function UpdateDefenseStats3(b,c,a,d,e){b=0;if(200==d){xxFilterStatistics[e]={};for(var m in a)d=a[m].ReadCount,c=getItem(a[m].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[e][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()}
function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="<divstyle=height:26px;margin-top:4px><selectid=policySelectionstyle=float:right;width:266px><optionvalue=-1>None";for(var a in xxSystemDefense.AMT_SystemDefensePolicy.responses)c+="<optionvalue="+a+(xxSystemDefenceLinkedPolicy[b]&&xxSystemDefense.AMT_SystemDefensePolicy.responses[a].InstanceID==xxSystemDefenceLinkedPolicy[b].InstanceID?"selected":"")+">"+xxSystemDefense.AMT_SystemDefensePolicy.responses[a].PolicyName;setDialogMode(11,
"Default System Defense Policy",3,changeDefaultPolicyOk,c+"</select><divstyle=padding-top:4px>Default Policy</div></div>",b)}}
function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'<w:SelectorSet><w:SelectorName="Antecedent"><a:EndpointReferencexmlns: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:SelectorName="CreationClassName">CIM_EthernetPort</w:Selector><w:SelectorName="DeviceID">Intel(r) AMT Ethernet Port '+c+
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:'<Addressxmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParametersxmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURIxmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</ResourceURI><SelectorSetxmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><SelectorName="DeviceID">Intel(r) AMT Ethernet Port '+
xxSystemDefense.AMT_SystemDefensePolicy.responses[a].InstanceID+"</Selector></SelectorSet></ReferenceParameters>"},changeDefaultPolicyOk2)}function changeDefaultPolicyOk2(b,c,a,d){200!=d?messagebox("Default System Defense Policy","Unable to set policy, error "+d):PullSystemDefense()}
function AddDefenseFilter(){if(!xxdialogMode){var b;b="<divstyle=height:26px;margin-top:4px><inputid=filternamestyle=float:right;width:260pxmaxlength=16onkeyup=AddDefenseFilterUpdate()><divstyle=padding-top:4px>Name</div></div><divstyle=height:26px;margin-top:4px><selectid=filtertypestyle=float:right;width:266pxonchange=AddDefenseFilterUpdate()><optionvalue=0>Ethernet IP Packet Filter<optionvalue=1>Ethernet ARP Packet Filter<optionvalue=2>IPv4 Packet Filter<optionvalue=3>IPv6 Packet Filter</select><divstyle=padding-top:4px>Type</div></div>";b+=
b+="<divstyle=height:26px;margin-top:4pxid=filterdatadiv><inputid=filterdatastyle=float:right;width:260pxmaxlength=8onkeyup=AddDefenseFilterUpdate()><divstyle=padding-top:4px>Packets / second</div></div>";b+="<divstyle=height:26px;margin-top:4px><selectid=filteractionstyle=float:right;width:266pxonchange=AddDefenseFilterUpdate()><optionvalue=false>Do Nothing<optionvalue=1>Event on match</select><divstyle=padding-top:4px>Event Log</div></div>";setDialogMode(11,"Add System Defense Filter",
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 e=a[d].indexOf("="),m=a[d].substring(0,e),e=a[d].substring(e+1),n=xxSystemDefenceFilters[m];n||(m="Hdr"+m,n=xxSystemDefenceFilters[m]);n&&(2==n&&4==b?(e=e.split("."),4==e.length&&(c[m]=rstr2hex(String.fromCharCode(parseInt(e[0]),
function showFilterDetails(b,c){if(!xxdialogMode){var a,d,e,m;0==b?(m="AMT_Hdr8021Filter",e="Ethernet Traffic",d=xxSystemDefense[m].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol "+d.HdrProtocolID8021)):(m="AMT_IPHeadersFilter",e="IP Traffic",d=xxSystemDefense[m].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="All IP Protocol "+d.HdrIPVersion));var n;n=""+addHtmlValue("Name",EscapeHtml(d.Name));n+=addHtmlValue("Type",e);n+=addHtmlValue("Matching Traffic",
a);n+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var q in xxSystemDefenceFilters)d[q]&&(a=q,e=d[q],b=xxSystemDefenceFilters[q],2==b&&4==e.length&&(e=hex2rstr(e),e=e.charCodeAt(0)+"."+e.charCodeAt(1)+"."+e.charCodeAt(2)+"."+e.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filter "+a,e));n+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
n,[m,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remove Filter","Unable to remove filter, make sure it's not in use."):PullSystemDefense()}var xxAddDefensePolicyFilters;
function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='<divstyle=height:26px;margin-top:4px><inputid=policynametitle="<policy name>:<policy precedence number>"style=float:right;width:260pxmaxlength=16onkeyup=AddDefensePolicyUpdate()><divstyle=padding-top:4px>Name</div></div><divstyle=height:26px;margin-top:4px><selectid=policytxtitle="Default action to take for outbound traffic"style=float:right;width:133px><optionvalue=0>Allow<optionvalue=1>Drop<optionvalue=2>Allow,Count<optionvalue=3>Drop,Count<optionvalue=4>Allow,Count,Event<optionvalue=5>Drop,Count,Event</select><selectid=policyrxstyle=float:right;width:133pxtitle="Default action to take for inbound traffic"><optionvalue=0>Allow<optionvalue=1>Drop<optionvalue=2>Allow,Count<optionvalue=3>Drop,Count<optionvalue=4>Allow,Count,Event<optionvalue=5>Drop,Count,Event</select><divstyle=padding-top:4px>Default TX / RX</div></div>';b+=
"<divid=policyFilters></div>";if(0<xxSystemDefense.AMT_Hdr8021Filter.responses.length||0<xxSystemDefense.AMT_IPHeadersFilter.responses.length){b+="<divstyle=height:26px;margin-top:4px><divstyle=float:right><selectid=xfilterstyle=width:186px>";for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];b+="<optionvalue="+a.InstanceID+">"+a.Name}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],
b+="<optionvalue="+a.InstanceID+">"+a.Name;b+="</select><inputid=addFilterButtontype=buttonvalue=Addstyle=width:80pxonclick=addFilterButton()></div><divstyle=padding-top:4px>Add Filter</div></div>"}setDialogMode(11,"Add System Defense Policy",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("c48",b);if(0==xxAddDefensePolicyFilters.length)QH("policyFilters","<br><i>This policy contains no filters.</i><br><br>");else{var b="",c;for(c in xxAddDefensePolicyFilters)b+="<divclass=itemBarstyle=margin-right:0><divstyle=float:right>"+AddButton2("Remove","removeFilterButton("+c+")")+"</div><divstyle=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("Add System Defense Policy","Unable to add policy, error #"+d):PullSystemDefense()}
function showPolicyDetails(b){if(!xxdialogMode){var c=xxSystemDefense.AMT_SystemDefensePolicy.responses[b],a;a=""+addHtmlValue("Name",EscapeHtml(c.PolicyName));0!=c.PolicyPrecedence&&(a+=addHtmlValue("Precedence",c.PolicyPrecedence));var d=1==c.TxDefaultDrop?"Drop":"Allow";1==c.TxDefaultCount&&(d+=", Count");1==c.TxDefaultMatchEvent&&(d+=", Event");a+=addHtmlValue("Default TX Action",d);d=1==c.RxDefaultDrop?"Drop":"Allow";1==c.RxDefaultCount&&(d+=", Count");1==c.RxDefaultMatchEvent&&(d+=", Event");
function deleteDefensePolicy(b,c,a,d){200!=d?messagebox("Remove Policy","Unable to remove policy, make sure it's not in use."):PullSystemDefense()}var xxWireless;function PullWireless(){amtFirstPull|=2;-1!=amtwirelessif&&amtstack.BatchEnum("",["*CIM_WiFiPortCapabilities","*CIM_WiFiPort","*CIM_WiFiEndpoint","CIM_WiFiEndpointSettings"],processWireless)}function wifiRefresh(){xxdialogMode||PullWireless()}
var xxWifiState={3:"Disabled",32768:"Enabled in S0",32769:"Enabled in S0, Sx/AC"},xxRadioState={2:"On, Connected",3:"Off",6:"On, Disconnected"},xxWifiAuthenticationMethod={1:"Other",2:"Open",3:"Shared Key",4:"WPA PSK",5:"WPA IEEE 802.1x",6:"WPA2 PSK",7:"WPA2 IEEE 802.1x"},xxWifiEncryptionMethod={1:"Other",2:"WEP",3:"TKIP-RC4",4:"CCMP-AES",5:"None"};function processWireless(b,c,a,d){xxWireless=200==d?a:void 0;updateSystemStatus();showWirelessInfo()}
function showWirelessInfo(){if(xxWireless){var b,c,a="",d,e;if(xxWireless.CIM_WiFiPortCapabilities.response){e="<br><h2>Wireless Profiles</h2>"+TableStart2();e+="<tr><tdclass=r2style=padding-left:15px><br>Wireless profiles that Intel® AMT will use for network connectivity.<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&&(e+="<divclass=itemBaronclick=showWifiDetails("+
QH(22,e+"<br>")}}}function showWifiStateDlg(){if(!xxdialogMode){var b="",c;for(c in xxWifiState)b+="<inputtype=radioname=d11id=wl"+c+"value="+c+""+(xxWireless.CIM_WiFiPort.response.EnabledState==c?"checked":"")+">"+xxWifiState[c]+"<br>";setDialogMode(11,"Wireless State",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 showWifiDetails(b){if(!xxdialogMode){b=xxWireless.CIM_WiFiEndpointSettings.responses[b];var c;c="<divstyle=text-align:left>"+addHtmlValue("Profile Name",EscapeHtml(b.ElementName));c+=addHtmlValue("SSID",b.SSID);c+=addHtmlValue("Authentication",xxWifiAuthenticationMethod[b.AuthenticationMethod]);c+=addHtmlValue("Encryption",xxWifiEncryptionMethod[b.EncryptionMethod]);c+=addHtmlValue("Priority",b.Priority);messagebox("Wireless Profile",c+"</div>")}}
function removeWifiEntryResponse(b,c,a,d,e){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+="<optionvalue="+i+">"+i)}QH("c24",b);c25.value=6;c26.value=4;c22.value=c23.value=c27.value=c28.value="";setDialogMode(12,"Add Wireless Profile",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:c26.value,SSID:c23.value,Priority:c24.value,
function updateWifiDialog(){var b=!0,c=c25.value,a=c26.value;QV(68,4>c);QV(67,3<c);QV(66,3<c);QV(69,4>c);4>c&&(3==a||4==a)&&(c26.value=2);3<c&&(2==a||5==a)&&(c26.value=3);for(vardinxxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[d].ElementName==c22.value&&(b=!1);QE("c48",1==b&&0<c22.value.length&&0<c23.value.length&&7<c27.value.length&&c27.value==
var DMTFCPUStatus="Unknown;Enabled;Disabled by User;Disabled By BIOS (POST Error);Idle;Other".split(";"),DMTFMemType="Unknown;Other;DRAM;Synchronous DRAM;Cache DRAM;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Flash;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Other;Unknown;SIMM;SIP;Chip;DIP;ZIP;Proprietary Card;DIMM;TSOP;Row of chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"),DMTFProcFamilly={191:"Intel® Core™ 2 Duo Processor",
192:"Intel® Core™ 2 Solo processor",193:"Intel® Core™ 2 Extreme processor",194:"Intel® Core™ 2 Quad processor",195:"Intel® Core™ 2 Extreme mobile processor",196:"Intel® Core™ 2 Duo mobile processor",197:"Intel® Core™ 2 Solo mobile processor",198:"Intel® Core™ i7 processor",199:"Dual-Core Intel® Celeron® processor"},HardwareInventory;
function processHardware(b,c,a,d){if(200==d){var e;b="<tableclass=log1cellpadding=0cellspacing=0style=width:100%;border-radius:8px>";HardwareInventory=a;QV("go2",!0);b+=TableEnd("<div> "+AddRefreshButton("PullHardware(1)")+AddButton("Save...","SaveHardwareLog()")+" Hardware information is gathered at system boot time.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var m=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"<br><h2>Platform</h2>"+FullTable({"Computer model":c.Model,Manufacturer:c.Manufacturer,
{timeZone:"UTC"})},"");b+="<br>";for(e in a.CIM_Processor.responses)c=a.CIM_Processor.responses[e],d=a.CIM_Chip.responses[e],b+="<h2>Processor "+(parseInt(e)+1)+"</h2>",b+=FullTable({Manufacturer:trademarks(d.Manufacturer),Family:DMTFProcFamilly[c.Family],Version:trademarks(d.Version),"Maximum socket speed":c.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[c.CPUStatus]},"");b+="<br>";for(e in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[e],b+="<h2>Memory Module "+(+e+1)+"</h2>",b+=FullTable({"Bank Label":c.BankLabel,
Manufacturer:c.Manufacturer,"Serial Number":c.SerialNumber,Size:parseInt(c.Capacity/1048576)+" MB","Form factor":DMTFMemFormFactor[c.FormFactor],Type:DMTFMemType[c.MemoryType],"Asset tag":c.Tag,"Part number":c.PartNumber},"");b+="<br>";for(e in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[e],d=a.CIM_PhysicalPackage.responses[+e+1],b+="<h2>Storage Media "+(parseInt(e)+1)+"</h2>",b+=FullTable({Model:d.Model,"Serial number":""==d.SerialNumber?"Unknown":d.SerialNumber,Size:parseInt(Math.round(1E3*
c.MaxMediaSize/1048576))+" MB"},"");b+="<br>";QH(18,b);updateSystemStatus()}}function SaveHardwareLog(){!xxdialogMode&&HardwareInventory&&SaveJsonFile("IntelAmtHardware","hardware","Intel AMT Hardware Information",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+='<inputtype=radioname=powerpolicyvalue="'+AmtSystemPowerSchemes[a].InstanceID+'"'+(AmtSystemPowerSchemes[a].SchemeGUID==b?"checked":"")+">"+AmtSystemPowerSchemes[a].Description+"<br>";setDialogMode(11,"Intel® AMT Power Policy",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)}functionshowPowerPolicyDlgOkDone(b,c,a,d){200==d&&PullSystemStatus()}varxxAccountAdminName,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())}
function enumerateUserAclEntriesResponse(b,c,a,d){if(200==d){methodcheck(a);QV("go11",!0);xxAccountFetch=a.Body.Handles.length;for(var e in a.Body.Handles)b=a.Body.Handles[e],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}}
function getUserAclEntryExResponse(b,c,a,d,e){xxAccountFetch--;200==d&&(a.Body.Handle=e,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[e]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,e){200==d&&(xxAccountEnabledInfo[e]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,e){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(e,getAclEnabledStateResponse,e))}
function updateAccounts(){if(!(0<xxAccountFetch)){varb=TableStart2(),b=b+"<tr><tdclass=r1style=padding-left:15px><br>Manage the Intel® AMT user accounts for this computer.<br><br>",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,e=!1,m=0;a.DigestUsername?(d=a.DigestUsername,e="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(m=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!e){var n="";if(999!=a.AccessPermission){2==
m&&(n+="Disabled, ");var q=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&q++;0<=a.Realms.indexOf(20)&&(n+="Auditor, ");n=0<=a.Realms.indexOf(3)?n+"Administrator":1==q?n+"1 realm":n+(q+" realms")}else n+="Administrator",a.Handle=-1;b+="<divclass=itemBaronclick=showUserDetails("+a.Handle+")><divstyle=float:right>";0<m&&xxAccountAdminName&&(b+=""+AddButton2(1==m?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+m+")"));!e&&xxAccountAdminName&&(b+=""+AddButton2("Edit...",
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,"Edit Account",-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,"New Account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())}
function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,e=d2permission.value,m=d2password1.value,n=GetSidByteArray(Q("d2username").value),q=null;if(0==d.length||m!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==n?q=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+m)):(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,
function updateRealms(b){QV(63,null!=b);if(null!=b){var c="<li><label><inputtype=checkboxonchange=updateAccountDialog()id=rx3"+(0<=b.indexOf(3)?"checked":"")+">Administrator</label></li><hr/>",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="<li><label><inputtype=checkboxonchange=updateAccountDialog()id=rx"+a+d+">"+amtstack.RealmNames[a]+"</label></li>")}QH(64,c)}}
function updateAccountDialog(){var b=!0;if("none"!=Q(63).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("c48",b)}var xxUserPermissions=["Local only","Network only","All (Local & Network)"];
function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="<divstyle=text-align:left>",d,e=c.DigestUsername;e||(e=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Name",e);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("State",1==xxAccountEnabledInfo[b].Enabled?"Enabled":"Disabled"));if(e==xxAccountAdminName)a+=addHtmlValue("Permission","Administrator");else{var a=a+addHtmlValue("Permission",xxUserPermissions[c.AccessPermission]),m="";if(0<=c.Realms.indexOf(3))m="Administrator",
0<=c.Realms.indexOf(20)&&(m+=", Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0<m.length&&(m+=","),m+=amtstack.RealmNames[c.Realms[d]]);0==m.length&&(m="None");a+=addHtmlValue("Realms","")+"<b>"+m+"</b>"}messagebox("Account "+e,a+"</div>")}}
function wsmanQuery(){QH(26,"");var b=getSelectedOptions(Q(24)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(25,!1),c&&0<c.length&&amtstack.BatchEnum("Browser",c,browserResponse,null,!0))}
function browserResponse(b,c,a,d){QE(25,!0);b="";for(var e in a)c=a[e],b+="<h2>"+e+"</h2><divstyle=margin-left:20px>",b=200==c.status?0==c.responses.length?b+"<br>(Empty)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("<br><divstyle=color:red>Error #"+c.status+"</div>"),b+="</div><br>";QH(26,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 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";varc=newDate;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")}deleteterminal.m.capture;
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);Q(42).textContent=StatusStrs[desktop.State];p24files=null;p24downloadFileCancel();p24uploadFileCancel();
function connectDesktop(b){desktop&&!xxdialogMode&&(connectDesktopConsent=!1,0==desktop.State?!0!==b&&5<amtversion&&null!=amtsysstate.IPS_OptInService&&void0!=amtsysstate.IPS_OptInService.response&&4294967295==amtsysstate.IPS_OptInService.response.OptInRequired?(connectDesktopConsent=!0,amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)):(desktop.m.bpp=2==desktopsettings.encoding||4==desktopsettings.encoding?2:1,desktop.m.graymode=0,6==desktopsettings.encoding&&(desktop.m.graymode=1),5==desktopsettings.encoding&&
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"!=
function PullDesktopDisplayInfo(){7<amtversion&&0<desktop.State?amtstack.BatchEnum("",["*IPS_ScreenSettingData","*IPS_KVMRedirectionSettingData"],ProcessDesktopDisplayInfo):(desktopScreenInfo=null,Q(44).innerHTML="")}functionProcessDesktopDisplayInfo(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+='<inputtype="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+')"> ');1<c?Q(44).innerHTML=b+" ":Q(44).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){c10.value=0==c?"Connect":"Disconnect";Q(42).textContent=StatusStrs[c];var a=3==c&&!urlvars.kvmviewonly;QE(45,a);QE("deskkeys",a);QE("DeskWD",a);QE(46,a);switch(c){case 0:webRtcDesktopReset();QV("deskRecordIcon",!1);break;case 3:12<=amtversion&&b.m.sendKvmData(JSON.stringify({action:"present",ver:1})),1==b.serverIsRecording&&QV("deskRecordIcon",!0)}center()}
function showDesktopSettingsChanged(){desktopsettings.encoding=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=
function applyDesktopSettings(){c11.value=desktopsettings.encoding;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);QV(45,desktopsettings.showcad);
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(37,!fullscreen),QV("c5",!fullscreen),QV("c9",fullscreen),fullscreen?(QS(8).left=0,QS(16).padding=0):(QS(8).left="156px",QS(16).padding=
"8px"),center()))}function deskShowTypeDialog(){xxdialogMode||3!=desktop.State||(Q(46).blur(),setDialogMode(11,"Remote Keyboard Entry",3,showDeskTypeEx,'<div>Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding.<div><textareaid=d2typeTextstyle="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(50).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,
function deskSendKeys(){if(!Q(50).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){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(50).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousedown(b),desktop.m.sendKeepAlive()):desktop.m.mousedown(b))}function dmouseup(b){xxdialogMode||Q(50).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mouseup(b),desktop.m.sendKeepAlive()):desktop.m.mouseup(b))}
function dmousemove(b){xxdialogMode||Q(50).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousemove(b),desktop.m.sendKeepAlive()):desktop.m.mousemove(b))}function dmousewheel(b){xxdialogMode||Q(50).checked||null==webRtcDesktop||null==webRtcDesktop.softdesktop||(webRtcDesktop.softdesktop.m.mousewheel(b),desktop.m.sendKeepAlive())}
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);elseif(b=JSON.parse(b),"download"==b.action)p24gotDownloadCommand(b);elseif("upload"==b.action)p24gotUploadData(b);elseif("pong"!=b.action)if(b.path=b.path.replace(/\//g,"\\"),null!=p24filetree&&b.path==p24filetree.path){varc=p24getCheckedNames();p24filetree=b;p24updateFiles(c)}else{for(varc=b.path.split("/").join("\\"),a=p24targetpath.split("/").join("\\");0<c.length&&"\\"==c[0];)c=c.substring(1);
function p24updateFiles(b){var c="",a="",d="<astyle=cursor:pointeronclick=p24folderup(0)>Root</a>",e=p24filetree.path.split("\\");p24filetreelocation=[];for(var m in e)""!=e[m]&&p24filetreelocation.push(e[m]);for(m in p24filetreelocation)d+=" / <astyle=cursor:pointeronclick=p24folderup("+(parseInt(m)+1)+")>"+p24filetreelocation[m]+"</a>";var e=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(m in n){var q=n[m],p=q.n,l;l=70<p.length?'<spantitle="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,
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}functionp24sort_timestamp(b,c){returnb.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);returnc}
function p24setActions(){if(null==p24filetree)QE("p24DeleteFileButton",!1),QE("p24NewFolderButton",!1),QE("p24UploadButton",!1),QE("p24RenameFileButton",!1),QE("p24SelectAllButton",!1),Q("p24SelectAllButton").value="Select All",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));
function p24createfolder(){setDialogMode(11,"New Folder",3,p24createfolderEx,"<inputtype=textid=p24renameinputmaxlength=64onkeyup=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,"Delete",3,p24deletefileEx,1<b?"Delete"+b+"selecteditems?":"Deleteselecteditem?")}functionp24deletefileEx(){for(varb=[],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,"Rename",3,p24renamefileEx,'<inputtype=textid=p24renameinputmaxlength=64onkeyup=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("c48",c);1==c&&null!=b&&24==b.keyCode&&dialogclose(1)}
function p24uploadFile(){setDialogMode(11,"Upload File",3,p24uploadFileEx,"<inputtype=filename=filesid=p24uploadinputstyle=width:100%multiple=multipleonchange=\"updateUploadDialogOk('p24uploadinput')\"/>");updateUploadDialogOk("p24uploadinput")}function p24uploadFileEx(){p24doUploadFiles(Q("p24uploadinput").files)}function updateUploadDialogOk(b){QE("c48",""!=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":"")+"tothislocation?");setDialogMode(11,"Paste",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")+",<aonclick=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 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,"Download File",10,p24downloadFileCancel,"<div>"+downloadFile.file+"</div><br/><progressid=d2progressBarstyle=width:100%value=0max="+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})))}}varuploadFile;
function p24doUploadFiles(b){xxdialogMode||(uploadFile={xpath:p24filetreelocation.join("/"),xfiles:b,xfilePtr:-1},setDialogMode(11,"Upload File",10,p24uploadFileCancel,"<divid=p24dfileName>Setting up...</div><br/><progressid=d2progressBarstyle=width:100%value=0max=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}))};
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>Mount disk images on a Intel® AMT computer - Experimental.</div><br/><divstyle=height:26px><inputid=floppyImageInputtype=filestyle=float:right;width:250pxaccept=".img"><div>Floppy (.img)</div></div><divstyle=height:26px><inputid=cdromImageInputtype=filestyle=float:right;width:250pxaccept=".iso"><div>CDROM (.iso)</div></div>';b+="<divstyle=height:26px><selectid=iderStartTypestyle=float:right;width:250px><optionvalue=0>On next boot<optionvalue=1>Graceful<optionvalue=2>Immediate</select><div>Session Start</div></div>";
function iderStart2(){if(1!=Q("floppyImageInput").files.length&&1!=Q("cdromImageInput").files.length)messagebox("Storage Redirection Error","At least one disk image file must be selected.");else if(1==Q("floppyImageInput").files.length&&0!=Q("floppyImageInput").files[0].size%512)messagebox("Storage Redirection Error","Invalid .img file.");else if(1==Q("cdromImageInput").files.length&&0!=Q("cdromImageInput").files[0].size%2048)messagebox("Storage Redirection Error","Invalid .iso file.");else{var b=
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?"Server ":"")+"IDE-R Session</b>, Connected, "+ider.m.bytesFromAmt+" in, "+ider.m.bytesToAmt+" out.")}var heatMapWidth=600,heatMapDividor={};
function iderSectorStats(b,c,a,d,e){var m=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=m.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>, blocks are {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("<b>Floppy</b>, blocks are {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;e/=c;if(0==b)m.height=6*(Math.floor(a/
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:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
function processRemote1(b,c,a,d){if(11<amtversion&&400==d){d=200;400==a.IPS_HTTPProxyAccessPoint.status&&deletea.IPS_HTTPProxyAccessPoint;400==a.IPS_HTTPProxyService.status&&deletea.IPS_HTTPProxyService;for(vareina)200!=a[e].status&&(d=a[e].status)}if(400!=d&&!errcheck(d,b)&&void0!=a.AMT_UserInitiatedConnectionService&&void0!=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(e in a.AMT_RemoteAccessPolicyAppliesToMPS.responses)c=a.AMT_RemoteAccessPolicyAppliesToMPS.responses[e],b=Clone(getItem(xxCiraServers,"Name",getItem(c.ManagedElement.ReferenceParameters.SelectorSet.Selector,
function updateRemoteAccess(){if(null!=xxEnvironementDetection){var b,c="Disabled",a=xxRemoteAccess.IPS_HTTPProxyService&&xxRemoteAccess.IPS_HTTPProxyAccessPoint;xxEnvironementDetection.DetectionStrings&&0<xxEnvironementDetection.DetectionStrings.length&&(c="Enabled, "+xxEnvironementDetection.DetectionStrings.length+"domain"+(1<xxEnvironementDetection.DetectionStrings.length?"s":""));b=""+TableStart();b+=TableEntry("Environmentdetection",addLink(c,"editEnvironmentDetection()"));b+=TableEntry("Userinitiationoptions",
else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="<divclass=itemBaronclick=showServerDetails("+d+")><divstyle=padding-top:3px><b>"+xxCiraServers[d].AccessInfo+"</b>"+EscapeHtml(c)+"</div></div>";if(a)if(b+="<br>Manage HTTP proxies used for management connections.<br><br>",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="<divstyle=padding-left:15px><br><i>No proxies configured.</i></div><br>";else for(d in c)b+="<divclass=itemBaronclick=showProxyDetails("+
function editMpsPolicy(b){var c="",a=11<amtversion||11==amtversion&&6<=amtversion,d=xxEditMpsPolicyType=b;"User"==d&&(d="UserInitiated");vard=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",d),c=c+"<divstyle=height:26px><selectid=d2server1style=float:right;width:206pxonchange=editMpsPolicyUpdate()><optionvalue=-1>(None)",e;for(e in xxCiraServers)c+="<optionvalue="+e+""+(xxPolicies[b][0]&&xxPolicies[b][0].Name==xxCiraServers[e].Name?"selected":"")+">"+xxCiraServers[e].AccessInfo;
for(e in xxCiraServers)c+="<optionvalue="+e+""+(xxPolicies[b][1]&&xxPolicies[b][1].Name==xxCiraServers[e].Name?"selected":"")+">"+xxCiraServers[e].AccessInfo;c+="</select><div>Secondary server</div></div>";a&&(c+="<divstyle=height:26px><selectid=d2server2cirastyle=float:right;width:206pxonchange=editMpsPolicyUpdate()><optionvalue=0>CIRA - External<optionvalue=1"+(xxPolicies[b][1]&&1==xxPolicies[b][1].MpsType?"selected":"")+">CILA - Internal</select><div>Secondary MPS Type</div></div>")}e=
0;d&&(e=d.TunnelLifeTime);c+="<divstyle=height:26px><inputid=d2lifetimestyle=float:right;width:200pxonchange=editMpsPolicyUpdate()value="+e+">";c+="<div>Tunnel lifetime (Seconds)</div></div>";"Periodic"==b&&(a=0,e=3600,d&&(d=atob(d.ExtendedData),a=ReadInt(d,0),e=ReadInt(d,4),1==a&&(d=ReadInt(d,8),10>d&&(d="0"+d),e+=":"+d)),c+="<divstyle=height:26px><selectid=d2ttypestyle=float:right;width:206pxonchange=editMpsPolicyUpdate()>",c+="<optionvalue=0"+(0==a?"selected":"")+">Periodic, time interval<optionvalue=1"+
(1==a?" selected":"")+">Time of day, once a day",c+="</select><div>Trigger type</div></div><divstyle=height:26px><inputid=d2timerstyle=float:right;width:200pxonkeyup=editMpsPolicyUpdate()value="+e+"><divid=ttypelabel></div></div>");setDialogMode(11,format("{0} Connection",b),3,editMpsPolicyOk,c);editMpsPolicyUpdate()}
function editMpsPolicyUpdate(){var b=11<amtversion||11==amtversion&&6<=amtversion,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("c48",c);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
-1!=Q("d2server1").value),QH("ttypelabel",0==Q("d2ttype").value?"Trigger interval (Seconds)":"Time of day (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 editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="Enter up to 5 intranet domain suffix. If the computer is outside these domains, Intel® AMT local ports will be closed and remote server connections will be active.<br><br>");0==editEnvironmentDetectionTmp.length&&(c+="<i>No intranet domains, Environement detection disabled.</i><br>");for(var a in editEnvironmentDetectionTmp)c+=
function editEnvironmentDetectionDlg2(b,c,a,d){200!=d?messagebox("Environment Detection",format("Failed to add server, status {0}",d)):a.Body.ReturnValue&&0!=a.Body.ReturnValue?messagebox("Environment Detection",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}function edInputChg(){5>editEnvironmentDetectionTmp.length&&QE("edAdd",0<Q("edInput").value.length)}functioneditEnvironmentDetectionAdd(){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+="<inputtype=radioname=d11id=wl"+c+"value="+c+""+(xxUserInitiatedCira.EnabledState==c?"checked":"")+">"+xxUserInitiatedEnabledState[c]+"<br>";setDialogMode(11,"User Initiated Tunnel",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("Access Name",c.AccessInfo);c.Port&&(a+=addHtmlValue("Port",c.Port));c.CN&&(a+=addHtmlValue("Common Name",c.CN));if(c=getElementWithContextSelectorValue(xxRemoteAccessCredentiaLinks,c.Name))c=c.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,0<c.indexOf("Username")?(a+=addHtmlValue("AuthenticationType","User&Pass/Server-AuthTLS"),a+=addHtmlValue("RemoteID",getInstance(xxMPSUserPass,
c).RemoteID)):(a+=addHtmlValue("Authentication Type","Certificate / Mutual-Auth TLS"),c=getInstance(xxCertificates,c),a+=addHtmlValue("Certificate Name",parseCertName(c.Subject).CN));c=1;xxAccountAdminName&&(c=5);setDialogMode(11,"Remote Server #"+(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("Remote Server Removal","Unable to remove server, access denied."):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("Access name",c.AccessInfo+":"+c.ProxyPort),a=a+addHtmlValue("DNS suffex",c.NetworkDnsSuffix),a=a+addHtmlValue("Proxy type",["Administrator","Operating system"][c.Type]),c=1;xxAccountAdminName&&(c=5);setDialogMode(11,"HTTP Proxy #"+(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("HTTP Proxy Removal","Unable to remove HTTP proxy, access denied."):PullRemoteAccess()}
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("c48",b);QH("d2typespan",["","","FQDN/hostname","IPv4address","IPv6address"][Q("d2type").value])}functionAddRemoteAccessProxyOk(){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("Add Proxy Server","Failed to add proxy, status "+d):0!=a.Body.ReturnValue?messagebox("Add Proxy Server",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
a+="<divstyle=height:26pxid=d2ucn><inputid=d2cnstyle=float:right;width:200pxonkeyup=AddRemoteAccessServerUpdate()><div>Server Common Name</div></div>";a+="<divstyle=height:26px><selectid=d2authstyle=float:right;width:206pxonchange=AddRemoteAccessServerUpdate()>";0<b.length&&(a+="<optionvalue=1>Certificate");a+="<optionvalue=2>Username/Password</select><div>Authentication type</div></div>";a+="<spanid=d2utype>";a+="<divstyle=height:26px><inputid=d2userstyle=float:right;width:200pxonkeyup=AddRemoteAccessServerUpdate()><div>Username</div></div>";
a+="<divstyle=height:26px><inputid=d2passstyle=float:right;width:200pxonkeyup=AddRemoteAccessServerUpdate()><div>Strong Password</div></div>";a+="</span>";a+="<spanid=d2ctype>";a+="<divstyle=height:26px><selectid=d2certstyle=float:right;width:206pxonchange=AddRemoteAccessServerUpdate()>";for(c in b)a+="<optionvalue="+b[c].InstanceID.substring(34)+">"+parseCertName(b[c].Subject).CN;a+="</select><div>Certificate</div></div></span>";setDialogMode(11,"Add Remote Server",3,AddRemoteAccessServerOk,
a);AddRemoteAccessServerUpdate()}
function AddRemoteAccessServerOk(){var b,c,a,d;1==Q("d2auth").value?b='<Addressxmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParametersxmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURIxmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate</ResourceURI><SelectorSetxmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><SelectorName="InstanceID">Intel(r) AMT Certificate: Handle: '+Q("d2cert").value+
function AddRemoteAccessServerOk2(b,c,a,d){200!=d?messagebox("Add Internet Server",format("Failed to add server, status {0}",d)):0!=a.Body.ReturnValue?messagebox("Add Internet Server",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?"Hostname":"IPv4Address");QV("d2utype",2==Q("d2auth").value);QV("d2ucn",
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><divstyle=height:26px><inputid=d11namevalue="'+c+'"style=float:right;width:200px><div>Name & Domain</div></div>';1==b&&(b=1==amtsysstate.AMT_GeneralSettings.response.SharedFQDN,c+="<divstyle=height:26px><selectid=d11fqdnstyle=float:right;width:200px><optionvalue=true"+(b?"selected":"")+'>Shared, same as OS<optionvalue="false"'+
(b?"":"selected")+">Dedicated, different from OS</select><div>Name Sharing</div></div>");setDialogMode(11,"Computer Name",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);c35.value=c;c36.value=b.DDNSPeriodicUpdateInterval;c37.value=b.DDNSTTL;showEditDnsDlgChange();setDialogMode(23,"Dynamic DNS client",3,showEditDnsDlgOk)}}
function showEditDnsDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response);b.DDNSUpdateEnabled=2==c35.value?!0:!1;b.DDNSUpdateByDHCPServerEnabled=1==c35.value?!0:!1;2==c35.value&&(b.DDNSPeriodicUpdateInterval=c36.value,b.DDNSTTL=c37.value);amtstack.Put("AMT_GeneralSettings",b,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
function showEditDnsDlgChange(){QE("c36",2==c35.value);QE("c37",2==c35.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,"Intel® AMT Features",3,featuresDlgOk))}
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,e){200!=e?messagebox("Error","RedirectionService, RequestStateChange Error "+e):null!=amtfeatures[3]&&amtstack.CIM_KVMRedirectionSAP_RequestStateChange(c16.checked?2:3,0,function(a,c,d,e){200!=e?messagebox("Error","KVMRedirectionSAP, RequestStateChange Error "+
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,"User Consent",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="Link local address;Network local address;Global address;User configured;Not allowed;DAD in progress;valid;deprecated;preferred/deprecated;expired;collision;not allowed".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><spanstyle=font-size:10px>"+ipv6addrtype[t[d+1]]+", "+ipv6addrtype[+t[d+2]+5]+"</span>","");setDialogMode(11,0==b?"IPv6 addresses for wired interface":"IPv6 addresses for wireless interface",1,null,a+TableEnd())}}
c&&ipv6manual;c30.value=isIpAddress(a.IPv6Address,"");c32.value=isIpAddress(a.DefaultRouter,"");c33.value=isIpAddress(a.PrimaryDNS,"");c34.value=isIpAddress(a.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,0==b?"IPv6 support for wired interface":"IPv6 support for wireless interface",3,function(){showIPv6StateDlgOk(b)})}}
function showIPv6StateDlgOk(b){var c=amtsysstate.IPS_IPv6PortSettings.responses[b];0==b&&(d21o1.checked&&(c.IPv6Address=c.DefaultRouter=c.PrimaryDNS=c.SecondaryDNS="::",amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)),d21o2.checked&&(c.IPv6Address=c30.value,c.DefaultRouter=c32.value,c.PrimaryDNS=c33.value,c.SecondaryDNS=c34.value,amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)));for(var c=amtsysstate.CIM_ElementSettingData.responses,a=
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,"Intel®AMTPingResponse",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){var b=amtsysstate.AMT_EthernetPortSettings.responses[0];QV(70,6<amtversion);6<amtversion&&(Q("d21ipsync").checked=b.IpSyncEnabled);QV(71,!0);QV(72,!0);QV("d21o0",!1);QV("d21l0",!1);QH("d21l1","AutomaticconfigurationusingDHCPserver");QH("d21l2","StaticconfigurationusingIPv4settingsbelow");d21o1.checked=1==b.DHCPEnabled;d21o2.checked=!d21o1.checked;c30.value=isIpAddress(b.IPAddress,"");c31.value=
function powerActionResponse00(b,c,a,d){200==d?(amtPowerBootCapabilities=a.Body,QH("d5actionSelect",""),addOption("d5actionSelect","Power up",2),addOption("d5actionSelect","Power cycle",5),addOption("d5actionSelect","Power down",8),addOption("d5actionSelect","Reset",10),1==amtPowerBootCapabilities.ForceDiagnosticBoot&&(addOption("d5actionSelect","Power on to diagnostic",300),addOption("d5actionSelect","Reset to diagnostic",301)),9<amtversion&&(addOption("d5actionSelect","OSWakefromStandby",500),
addOption("d5actionSelect","OS Power Saving",501),addOption("d5actionSelect","Soft-off",12),addOption("d5actionSelect","Soft-reset",14),addOption("d5actionSelect","Sleep",4),addOption("d5actionSelect","Hibernate",7)),1==amtPowerBootCapabilities.BIOSSetup&&(addOption("d5actionSelect","Power up to BIOS",100),addOption("d5actionSelect","Reset to BIOS",101)),1==amtPowerBootCapabilities.SecureErase&&(addOption("d5actionSelect","Power up to Secure Erase",104),addOption("d5actionSelect","Reset to Secure Erase",
105)),addOption("d5actionSelect","Reset to IDE-R Floppy",200),addOption("d5actionSelect","Power on to IDE-R Floppy",201),addOption("d5actionSelect","Reset to IDE-R CDROM",202),addOption("d5actionSelect","Power on to IDE-R CDROM",203),addOption("d5actionSelect","Reset to PXE",400),addOption("d5actionSelect","Power on to PXE",401),addOption("d5actionSelect","Custom action...",999),5<amtversion&&addOption("d5actionSelect","Userconsent...",998),setDialogMode(5,"PowerActions",3,powerActionDlgCheck)):
messagebox("Power Action",format("Unable to get system capabilities, error {0}",d))}
function powerActionDlgCheck(){var b=d5actionSelect.value;500==b||501==b?amtstack.RequestOSPowerStateChange(501==b?3:2,function(b,a,d,e){200==e?QH(62,"Power action completed."):QH(62,format("Power action error #{0}.",e));setDialogMode(1,"Power Action",0);setTimeout(function(){setDialogMode(0)},1300)}):104==b||105==b?(b="Confirm execution of Intel® Remote Secure Erase?<br>Enter Secure Erase password if required.<br><br><divstyle=height:16px><inputtype=passwordid=rsepassmaxlength=32style=float:right;width:240px><div>Password</div></div><br><divstyle=color:red><b>WARNING:</b> This will wipe data on the remote system.</div>",rsepass=
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&&(3==desktop.State&&connectDesktop(),3==terminal.State&&connectTerminal(),void0!=ider&&3==ider.state&&iderStop());statusbox("PowerAction","Checkingstate...");null!=rsepass&&1===rsepass&&(rsepass=Q("rsepass").value);varc=!0;6>amtversion&&(c=!1);13==currentView&&8==b&&(c=!1);13!=currentView&&10>=b&&(c=!1);c?amtstack.Get("IPS_OptInService",
function showAdvPowerDlg(){QV("d24dBiosPause",1==amtPowerBootCapabilities.BIOSPause);QV("d24dBiosSecureBoot",1==amtPowerBootCapabilities.BIOSSecureBoot);QV("d24dReflashBios",1==amtPowerBootCapabilities.BIOSReflash);QV("d24dBiosSetup",1==amtPowerBootCapabilities.BIOSSetup);QV("d24dForceProgressEvents",1==amtPowerBootCapabilities.ForcedProgressEvents);QV("d24dUseIDER",1==amtPowerBootCapabilities.IDER);QV("d24dLockKeyboard",1==amtPowerBootCapabilities.KeyboardLock);QV("d24dLockPowerButton",1==amtPowerBootCapabilities.PowerButtonLock);
function powerActionSendConsent(b){0==b?amtstack.IPS_OptInService_CancelOptIn(function(){}):(statusbox("Power Action","Sending user consent..."),amtstack.IPS_OptInService_SendOptInCode(d6ConsentText.value,powerActionResponseC2,0,1))}
function powerActionResponseC2(b,c,a,d){200!=d?messagebox("Power Action",format("Error #{0}",d)):0!=a.Body.ReturnValue?amtstack.Get("IPS_OptInService",powerActionResponse0,0,1):connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):998==d5actionSelect.value?messagebox("User Consent","User consent succesful."):(statusbox("Power Action","Checking state..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
function powerActionResponse1(b,c,a,d){200!=d?messagebox("Power Action",format("Error #{0}",d)):(b=d5actionSelect.value,a=a.Body,a.ConfigurationDataReset=!1,999==b?(a.BIOSPause=AvdPowerDlg.BIOSPause,a.EnforceSecureBoot=AvdPowerDlg.BIOSSecureBoot,a.BIOSSetup=AvdPowerDlg.BIOSSetup,a.BootMediaIndex=AvdPowerDlg.BootMediaIndex,a.FirmwareVerbosity=AvdPowerDlg.FirmwareVerbosity,a.ForcedProgressEvents=AvdPowerDlg.ForcedProgressEvents,a.IDERBootDevice=AvdPowerDlg.IDERBootDevice,a.LockKeyboard=AvdPowerDlg.LockKeyboard,
function powerActionResponse3x(b,c,a,d){b=d5actionSelect.value;c=null;if(999==b)0<c40.value&&(c=["ForceCD/DVDBoot","ForcePXEBoot","ForceHard-driveBoot","ForceDiagnosticBoot"][c40.value-1]);else{if(300==b||301==b)c="ForceDiagnosticBoot";if(400==b||401==b)c="ForcePXEBoot"}console.log("ChangeBootOrder:"+c);amtstack.CIM_BootConfigSetting_ChangeBootOrder(null==c?c:'<Addressxmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParametersxmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURIxmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSetxmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><SelectorName="InstanceID">Intel(r) AMT: '+
function powerActionResponse3(b,c,a,d){console.log("powerActionResponse3("+c+","+a+","+d+")");if(!errcheck(d,b)){statusbox("Power Action","Performing power action...");b=d5actionSelect.value;if(100==b||201==b||203==b||300==b||401==b)b=2;if(101==b||200==b||202==b||301==b||400==b)b=10;104==b&&(b=2);105==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("Power Action",
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(x){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 e=b[c].app?b[c].app:"";a[d][e]||(a[d][e]={});b[c].name&&(a[d][e][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"])}a=0;var d=TableStart2()+"<tr><tdclass=r1style=padding-left:15px><br>Manage Intel® AMT storage for this computer.<br><br>",m,n,e="";for(c in b){var q=0,p;for(p in b[c]){q++;var l=0,v;for(v in b[c][p]){l++;if(c!=m||p!=n)""!=e&&(d+=e,e="<br>"),m=c,n=p,e=""!=c?e+EscapeHtml(c+" / "+p):e+
function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Storage",format("Unable to delete file (ERR{0}), check that the computer is powered on.",c)):PullStorage()}function DownloadFromStorage(b,c,a){xxdialogMode||(haltEvent(a),wsstack.comm.PerformAjax("",DownloadFromStorageEx,c,0,"/amt-storage/"+b,"GET"))}
function PushToStorageResponse(b,c,a){200!=c?messagebox("Storage",format("Unable to push file (ERR{0}), check that the computer is powered on.",c)):null!=a?PushToStorage(a[0],a[1],!0):PullStorage()}
function UploadToStorage(b,c){if(!xxdialogMode){c||(c="");var a;a="<br>Select a small file to upload to storage and enter a vendor, application and filename.<br>";a=(b?a+('<br><divstyle=height:20px><inputid=mstoragefilestyle=float:right;width:240pxreadonlydisabled=disabledvalue="'+c+'"><div>Upload file</div></div>'):a+"<br><divstyle=height:20px><inputtype=fileid=mstoragefilestyle=float:right;width:240pxonchange=SetStorageName()><div>Upload file</div></div>")+"<br><divstyle=height:16px><inputid=mstoragevendorplaceholder=Vendorlist=mstoragevendorlistmaxlength=11style=float:right;width:240px><div>Vendor name</div></div>";
a+='<br><divstyle=height:16px><inputid=mstoragelinkstyle=float:right;width:240px><divtitle="If set, creates a link to this content from the main web page">Link</div></div><br>';a+="<datalistid=mstoragevendorlist>";for(var d in xxStorageVendors)a+='<optionvalue="'+xxStorageVendors[d]+'">';a+="</datalist>";a+="<datalistid=mstorageapplicationlist>";for(d in xxStorageApplications)a+='<optionvalue="'+xxStorageApplications[d]+'">';a+='</datalist><datalistid=mstoragetypelist><optionvalue="application/octet-stream"><optionvalue="image/jpeg"><optionvalue="text/html"><optionvalue="text/plain"></datalist>';
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=
function convertAmtDataStr(b){b=b.split("Z").join("").split("T").join("-").split(":").join("-").split("-");return new Date(b[0],b[1]-1,b[2],b[3],b[4],b[5])}var xxAlarms=null;
function PullAlarms(){var b=TableStart2()+"<tr><tdclass=r1style=padding-left:15px><br>Manage wake alarms.<br><br>";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,e){if(200==e){QV("go23",!0);if(0<d.length)for(xxAlarms=d,c=0;c<d.length;c++)a=convertAmtDataStr(d[c].StartTime.Datetime),a="<b>"+d[c].ElementName+"</b>, wake on "+a.toLocaleString().replace(", "," at "),void 0!=d[c].Interval&&(a+=" and each"+_fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&&(a+=", delete when done"),
b+="<divclass=itemBaronclick=showAlertDetails("+c+")><divstyle=float:right>",xxAccountAdminName&&(b+=" "+AddButton2("Edit...",'showAddAlarm(" + i + ")')),b+="</div><divstyle=padding-top:3px;width:auto;float:left;overflow-x:hidden>"+a+"</div></div>";else xxAlarms=null,b+="<divstyle=padding-left:15px><br><i>No wake alarms registered.</i></div><br>";d="<div> "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Remove all alarms","RemoveAllAlarms()")+AddButton("Add","showAddAlarm()"));
function prepareAlarmOccurenceTemplate(b,c,a,d,e){return'<d:AlarmTemplatexmlns: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:Datetimexmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+a+'</p:Datetime></s:StartTime><s:Interval><p:Intervalxmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Interval></s:Interval><s:DeleteOnCompletion>"+
e+"</s:DeleteOnCompletion></d:AlarmTemplate>"}function RemoveAllAlarms(){setDialogMode(1,"Remove all wake alarms",3,RemoveAllAlarmsEx,"Confirm removal of all wake alarms?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,e,m){0==--b&&PullAlarms()})}
function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=convertAmtDataStr(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",
function showAddAlarmOk(b,c){if(2==b)showAlertDetailsDelete(b,c);else{var a=Q("d25alarm_name").value,d=Q("d25alarm_sdate").value.split("-"),e=Q("d25alarm_stime").value.split(":"),d=new Date(d[0],d[1]-1,d[2],e[0],e[1],e[2],0),d=_fmttimepad(d.getFullYear())+"-"+_fmttimepad(d.getMonth()+1)+"-"+_fmttimepad(d.getDate())+"T"+_fmttimepad(d.getHours())+":"+_fmttimepad(d.getMinutes())+":"+_fmttimepad(d.getSeconds())+"Z",e=Q("d25alarm_interval").value.split("-");3!=e.length&&(e=[0,0,0]);var e="P"+e[0]+"DT"+
e[1]+"H"+e[2]+"M",m=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,e,m);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Add alarm",format("Failed to add alarm. Status: {0}.<br/>Verify the alarm is for a future time.",d)):0!=c.Body.ReturnValue?messagebox("Add alarm",format("Failed to add alarm {0}.<br/>Verify the alarm is for a future time.",c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),
a.StartTime='<p:Datetimexmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Datetime>",a.Interval='<p:Intervalxmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+e+"</p:Interval>",a.DeleteOnCompletion=m,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Edit alarm",format("Failed to change alarm. Status: {0}.<br/>Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}}
function script_runScriptDlgOk(b){if(1==b&&(b=Q("scriptopen"),1==b.files.length)){var c=new FileReader;c.onload=script_onScriptRead;c.readAsBinaryString(b.files[0])}}
function script_onScriptRead(b){var c;try{c=JSON.parse(b.target.result)}catch(e){}if(20==currentView){c.scriptText&&(Q("scriptarea").value=c.scriptText);c.mescript&&(Q("compiledarea").value=rstr2hex(atob(c.mescript)));c.blocks?(script_setBuildBlocks(c.blocks),scriptViewButton(1)):(script_setBuildBlocks(),scriptViewButton(0));c.scriptBlocks?script_BlockScript=c.scriptBlocks:script_BuildingBlocks||(script_BlockScript=[]);for(var a in script_BlockScript)if(c=script_BlockScript[a],b=script_BuildingBlocks[c.xname]){b=
Clone(b);b.id=c.id;b.xname=c.xname;for(var d in b.vars)c.vars[d]&&(b.vars[d].value=c.vars[d].value);script_BlockScript[a]=b}fupdatescript();delete scriptstate;resetScriptButton()}else a={_interactive:1,_certificates:1,_mode:"Firmware"},c&&c.mescript&&(scriptstate=script_setup(atob(c.mescript),a)),scriptstate?(scriptstate.wsstack=wsstack,scriptstate.amtstack=amtstack,scriptstate.onStep=script_updateScriptState,scriptstate.onConsole=script_console,scriptstate.start(100)):messagebox("Run Script","Invalid script file.")}
function script_updateScriptState(){scriptstate&&(QV(11,0<scriptstate.state),center(),0==scriptstate.state&&(scriptstate=void0))}functionscript_console(b){0==b.indexOf("INFO:")&&(b=b.substring(6));0==b.indexOf("SUCCESS:")&&(b=b.substring(9));0==b.indexOf("ERROR:")&&(b=b.substring(7));QH(12,","+b)}functionscript_Stop(){scriptstate&&(1==scriptstate.dialog&&setDialogMode(0),scriptstate.stop(),scriptstate.state=0,script_updateScriptState())}
function scriptLoadStartingBlocks(){var b=new XMLHttpRequest;b.onload=function(){if(200<=b.status&&400>b.status){var c;try{c=JSON.parse(b.responseText)}catch(a){}c&&c.blocks&&(script_StartingBuildingBlocks=c.blocks,script_setBuildBlocks(script_StartingBuildingBlocks))}};b.onerror=function(){console.log("Failed to get script blocks")};b.open("GET","scriptblocks.txt",!0);b.send()}
function scriptViewButton(b){script_BuilderView=b;QV("scripteditor",0==b);QV("scriptbuilder",1==b);QV("viewEditorButton",script_BuildingBlocks&&1==b);QV("viewBuilderButton",script_BuildingBlocks&&0==b)}
function script_setBuildBlocks(b){script_BuildingBlocks=b;var c="";if(b)for(var a in b)95!=a.charCodeAt(0)&&(c+="<divid=sblock_"+a+'style=cursor:pointer;background-color:#ccc;width:auto;padding:5px;margin:2pxondblclick=script_faddblock("'+a+'")draggable=trueondragstart=script_fondragstart(event,this)ondragend=script_fondragend(event,this)title="'+b[a].desc+'"',c+=">"+b[a].name+"</div>");QH("blocks",c);script_fonfilterchanged();scriptViewButton(script_BuildingBlocks?1:0)}
function script_faddblock(b){var c=Clone(script_BuildingBlocks[b]);c.id=Math.random();c.xname=b;script_BlockScript.push(c);script_BlockScriptSelectedId=script_BlockScript.length-1;fupdatescript()}function script_feditblock(b){xxdialogMode||setDialogMode(11,format("Edit {0}",script_BuildingBlocks[b].name),3,script_feditblockEx,"Edit this block? This operation will reset the block editor and load the block code into the code editor.",b)}
function script_feditblockEx(b,c){script_newScriptDlgOk();scriptViewButton(0);var a,d=script_BuildingBlocks[c];a=""+("##!BLOCK!##\r\n#id="+c+"\r\n#name="+d.name+"\r\n#desc="+d.desc+"\r\n##!BLOCK!##\r\n");for(var e in d.vars){var m=d.vars[e];a+="##!VAR!##\r\n#id="+e+"\r\n#name="+m.name+"\r\n#desc="+m.desc+"\r\n#type="+m.type+"\r\n";m.maxlength&&(a+="#maxlength="+m.maxlength+"\r\n");if(m.values)for(var n in m.values)a+="#values-"+n+"="+m.values[n]+"\r\n";a+="#value="+m.value+"\r\n##SWAP %%%"+e+"%%% "+
function script_fConvertScriptToJsonBlock(b){var c={};b=b.split("##!BLOCK!##\n");var a=b[1].split("\n"),d;for(d in a){var e=a[d].split("=");2==e.length&&(c[e[0].substring(1)]=e[1])}c.vars={};scriptvariables=b[2].split("##!VAR!##\n");for(d in scriptvariables){var a=scriptvariables[d].split("\n"),m={},n={},q=0,p;for(p in a)e=a[p].split("="),2==e.length&&e[1]&&e[0]&&0<e[0].length&&("#values-"==e[0].substring(0,8)?(n[e[0].substring(8)]=e[1],q++):m[e[0].substring(1)]=e[1]);m.id&&(0<q&&(m.values=n),a=m.id,
delete m.id,c.vars[a]=m)}c.code=b[3];a=c.id;delete c.id;d={};d[a]=c;return JSON.stringify(d,null," ")}function script_fonfilterchanged(){var b=Q("blockfilter").value.toLowerCase(),c;for(c in script_BuildingBlocks)95!=c.charCodeAt(0)&&QV("sblock_"+c,0<=script_BuildingBlocks[c].name.toLowerCase().indexOf(b)||0<=script_BuildingBlocks[c].desc.toLowerCase().indexOf(b))}var script_fonclickDblClickDetectIndex=null,script_fonclickDblClickDetectTime=null;
function script_fonclick(b,c){if(!xxdialogMode){script_BlockScriptSelectedId=null;c&&(c=fgetParentWithId(c),c.id.startsWith("xblock_")&&(script_BlockScriptSelectedId=c.id.substring(7)));fupdatescript();haltEvent(b);if(script_fonclickDblClickDetectIndex==script_BlockScriptSelectedId&&250>(new Date).getTime()-script_fonclickDblClickDetectTime)return script_foneditclick(script_BlockScriptSelectedId);script_fonclickDblClickDetectIndex=script_BlockScriptSelectedId;script_fonclickDblClickDetectTime=(new Date).getTime()}}
function script_fondragstart(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="0.4",b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("scriptbuilder/block",c.id))}function script_fondragend(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="1.0")}function script_fondragenter(b,c){xxdialogMode||(fgetParentWithId(c).style["border-top"]="solid 2px black")}
function script_fondragleave(b,c){if(!xxdialogMode){b=b.originalEvent||b;var a=document.elementFromPoint(b.pageX,b.pageY);c.contains(a)||(fgetParentWithId(c).style["border-top"]="none")}}
function script_fondrop(b,c){if(!xxdialogMode){c=fgetParentWithId(c);var a,d=b.dataTransfer.getData("scriptbuilder/block"),e=parseInt(c.id.substring(7));""==d?documentFileSelectHandler(b):(d.startsWith("sblock_")?(a=Clone(script_BuildingBlocks[d.substring(7)]),a.id=Math.random(),a.xname=d.substring(7)):(d=parseInt(d.substring(7)),a=script_BlockScript[d],script_BlockScript.splice(d,1),e>d&&e--),"scriptblocks"==c.id?(a&&script_BlockScript.push(a),script_BlockScriptSelectedId=script_BlockScript.length-
function script_foneditclick(b){if(!xxdialogMode){var c=script_BlockScript[b];script_BlockScriptSelectedId=b;fupdatescript();if(null!=c){var a=c.vars?7:5,d=c.desc+"<br><br>";if(c.vars)for(var e in c.vars){var m=c.vars[e].value,n="";c.vars[e].maxlength&&(n+=" maxlength="+c.vars[e].maxlength);2==c.vars[e].type&&(n+=" onkeypress='return numbersOnly(event)'");if(1==c.vars[e].type||2==c.vars[e].type)m='<inputtitle="'+c.vars[e].desc+'"id=scriptXvalue_'+e+'value="'+c.vars[e].value+'"'+n+"style=width:100%></input>";
if(3==c.vars[e].type){var m="<selecttitle='"+c.vars[e].desc+"'id=scriptXvalue_"+e+"style=width:100%;padding:0;margin:0>",q;for(q in c.vars[e].values)m+="<optionvalue="+q+(q==c.vars[e].value?"selected":"")+">"+c.vars[e].values[q]+"</option>";m+="</select>"}4==c.vars[e].type&&(m='<inputtype=passwordautocomplete=offtitle="'+c.vars[e].desc+'"id=scriptXvalue_'+e+'value="'+c.vars[e].value+'"'+n+"style=width:100%></input>");5==c.vars[e].type&&(m="");6==c.vars[e].type&&(m='<inputtype=filetitle="'+
c.vars[e].desc+'" id=scriptXvalue_'+e+" "+n+" style=width:100%></input>");d+='<tablestyle=width:100%title="'+c.vars[e].desc+'"><tdstyle=width:120px>'+c.vars[e].name+"<td><b>"+m+"</b></table>";if(5==c.vars[e].type){var d=d+("<ulid=scriptXvalue_"+e+'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">'),p;for(p in c.vars[e].values)m="",0<=c.vars[e].value.indexOf(p)&&(m=" checked"),d+="<li><label><inputtype=checkboxid=scriptXvaluex_"+
function script_foneditclickEx(b,c){if(!xxdialogMode){if(2==b)script_BlockScript.splice(c,1),script_BlockScriptSelectedId==c&&(script_BlockScriptSelectedId=null);else{var a=script_BlockScript[c];if(a.vars)for(var d in a.vars)if(5==a.vars[d].type){a.vars[d].value=[];for(var e in a.vars[d].values)Q("scriptXvaluex_"+d+"-"+e).checked&&a.vars[d].value.push(e)}else if(6==a.vars[d].type){var m=Q("scriptXvalue_"+d);if(1==m.files.length){var n=new FileReader;n.onload=function(b){a.vars[d].value=btoa(b.target.result);
function fupdatescript(){var b="",c;for(c in script_BlockScript){b+="<divid=xblock_"+c+"style=cursor:pointer;min-height:24px;background-color:#"+(script_BlockScriptSelectedId==c?"aaa":"ccc")+';width:auto;padding:5px;margin:2pxdraggable=trueonclick=script_fonclick(event,this)ondragenter=script_fondragenter(event,this)ondragleave=script_fondragleave(event,this)ondragstart=script_fondragstart(event,this)ondragend=script_fondragend(event,this)ondrop=script_fondrop(event,this)title="'+script_BlockScript[c].desc+
"</div></div>"}""==b&&(b='<divstyle="padding:15px;color:gray">Start your script by drag & dropping blocks from the left side into this scripting box.<div>');QH("scriptblocks",b+"<divstyle=height:80px></div>");for(c in script_BlockScript)QS("xblock_"+c).borderLeft=script_CurrentHighlightBlock==c?"3px solid black":"";script_blocksToScript()}
function script_blocksToScript(){var b="";if(script_BuildingBlocks){script_BuildingBlocks._start&&(b+="##### Starting Block #####\r\n"+script_BuildingBlocks._start.code+"\r\n\r\n");for(var c in script_BlockScript){var a=script_BlockScript[c].code,a=a.split("%%%~%%%").join(c),d;for(d in script_BlockScript[c].vars)a=a.split("%%%"+d+"%%%").join(script_BlockScript[c].vars[d].value);b+="##### Block: "+script_BlockScript[c].name+" #####\r\nHighlightBlock __t "+c+"\r\n"+a+"\r\n\r\n"}script_BuildingBlocks._end&&
(b+="##### Ending Block #####\r\n"+script_BuildingBlocks._end.code+"\r\nHighlightBlock\r\n")}Q("scriptarea").value=b}var script_CurrentHighlightBlock;function script_HighlightBlock(b,c){if(b==editscriptstate){script_CurrentHighlightBlock=c;for(var a in script_BlockScript)QS("xblock_"+a).borderLeft=script_CurrentHighlightBlock==a?"3px solid black":""}}function script_newScriptDlg(){xxdialogMode||setDialogMode(11,"New Script",3,script_newScriptDlgOk,"<br>Reset & clear the script editor?")}
function script_newScriptDlgOk(){script_setBuildBlocks(script_StartingBuildingBlocks);script_BlockScript=[];script_BlockScriptSelectedId=null;delete editscriptstate;scriptViewButton(script_BuildingBlocks?1:0);QH("variables","");Q("scriptarea").value="";resetScriptButton()}
function resetScriptButton(){breakScriptButton();Q("compiledarea").value=rstr2hex(script_compile(Q("scriptarea").value,function(b){messagebox("Script Compile Error",b)}));delete editscriptstate;Q("console").value="";QH("variables","");QH("EditScriptStatus","Stopped");1==script_BuilderView&&fupdatescript();0!=Q("compiledarea").value.length&&(editscriptstate=script_setup(hex2rstr(Q("compiledarea").value),{_interactive:1,_certificates:1,_mode:"Firmware"}),editscriptstate.wsstack=wsstack,editscriptstate.amtstack=
function editscript_console(b){Q("console").value+=b+"\n"}var script_states=["Stopped","Running","Paused"];
function editscript_updateScriptState(b){var c="";if(b&&null!=b){var a=[],d;for(d in b.variables)d.startsWith("__")||a.push(d);a.sort();for(d in a)c="object"==typeof b.variables[a[d]]?c+("<b>"+a[d]+"</b> = "+ObjectToStringEx(b.variables[a[d]],2)+"<br>"):c+("<b>"+a[d]+"</b> = "+EscapeHtml(script_toString(b.variables[a[d]]))+"<br>")}QH("variables",c);c="Stopped, No Script";b&&null!=b&&(c=script_states[b.state],0<b.state&&(c+=","+b.ip+":"+script_decompile(b.script,b.ip)));50<c.length&&(c=c.substring(0,
function script_saveScript(b){xxdialogMode||scriptstate||(b&&1==b.shiftKey?(setDialogMode(11,"Script Block",1,null,"<br><textareaid=scriptSaveScriptJsonBlockstyle=width:100%;height:200px;resize:vertical/>"),QH("scriptSaveScriptJsonBlock",script_fConvertScriptToJsonBlock(Q("scriptarea").value))):setDialogMode(11,"Save Script",3,script_saveScriptOk,"<br><inputid=scriptsavenamestyle=width:100%value=test.mescript>"))}
function script_saveScriptOk(){if(!xxdialogMode){var b=JSON.stringify({scriptText:Q("scriptarea").value,mescript:btoa(script_compile(Q("scriptarea").value)),blocks:script_StartingBuildingBlocks,scriptBlocks:script_BlockScript},null," ");saveAs(data2blob(b),Q("scriptsavename").value)}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag;
function setDialogMode(b,c,a,d,e,m){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=m;QE("c48",!0);QV("c48",a&1);QV("c47",a&2);QV(60,a&2);QV("c49",a&4);c&&QH(61,c);for(c=1;26>c;c++)QV("dialog"+c,c==b);QV("dialog",b);e&&(11==b?QH(65,e):QH(62,e));0!=xxdialogMode&&iderToggleDiskMap(!1)}
function center(){QS("dialog").left=(getDocWidth()-400)/2+"px";var b=0,c=Q(8).offsetHeight-(0==fullscreen?126:53);""==QS(11).display&&(b+=32);""==QS(9).display&&(b+=32);QS(16).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(43).offsetWidth&&(QS("Desk")["max-width"]=Q(43).offsetWidth);
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("Error #{0}",b)),401==b&&QH(5,'Authentication Error<br/><br/><inputtype=buttonvalue="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(15).src.endsWith(a))Q(15).src=a;QV(16,!1);QV(14,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(14,!1);QV(16,!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){var a=decodeURIComponent(b).split(":"),d=0==c?16992:16993,e=0==c?16994:16995;1<a.length&&(d=parseInt(a[1]));2<a.length&&(e=parseInt(a[2]));return{host:a[0],http:d,redir:e}}functionaddLink(b,c){return"<astyle=cursor:pointer;color:blueonclick='"+c+"'>♦ "+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 methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Call Error",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"<tableclass='log1 us'cellpadding=0cellspacing=0style=width:100%;border-radius:8px><tr><tdwidth=200px><p><td>"}function TableStart2(){return"<tableclass='log1 us'cellpadding=0cellspacing=0style=width:100%;border-radius:8px><tr><td><p><td>"}
function TableEntry(b,c){return"<tr><tdclass=r1><p>"+b+"<tdclass=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><tdcolspan=2><p>"+(b?b:"")+"</table>"}function AddButton(b,c){return"<inputtype=buttonvalue='"+b+"'onclick='"+c+"'style=margin:4px>"}function AddButton2(b,c,a){return"<inputtype=buttonvalue='"+b+"'onclick='"+c+"'"+a+">"}
function AddRefreshButton(b){return"<inputtype=buttonname=refreshbtnvalue=Refreshonclick='refreshButtons(false);"+b+"'style=margin:4px"+(0==refreshButtonsState?"disabled":"")+">"}function MoreStart(){return'<astyle=cursor:pointer;color:blueid=morexxx1onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ More</a><divid=morexxx2style=display:none><br><hr>'}
function MoreEnd(){return'<astyle=cursor:pointer;color:blueonclick=QV("morexxx2",false);QV("morexxx1",true)>▲ Less</a></div>'}function getSelectedOptions(b){for(var c=[],a,d=0,e=b.options.length;d<e;d++)a=b.options[d],a.selected&&c.push(a.value);returnc}functiongetInstance(b,c){for(varainb)if(b[a].InstanceID==c)returnb[a];returnnull}functiongetItem(b,c,a){for(vardinb)if(b[d][c]==a)returnb[d];returnnull}
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));returnc}
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'<divstyle=height:20px><divstyle=float:right;width:220px;overflow:hidden><btitle="'+c+'">'+c+"</b></div><div>"+b+"</div></div>"}