functionAmtManager(d,q,v){varM=function(T){d.SendCommand({action:"msg",type:"console",value:T})};varr=function(T){if(v){M("amt-manager: "+T+"<br />")}};varh=null,i=0;varf=null,g=0;vare=null;varH=null;varG=null;vark=null;varF=this;varE;varO=null;F.state=0;F.lmsstate=0;F.onStateChange=null;F.setDebug=function(T){v=T};F.setPolicy=function(U,T){if(T||(JSON.stringify(k)!=JSON.stringify(U))){k=U;if(m==null){m=setTimeout(F.applyPolicy,8000)}}};varL=0;F.reset=function(){++L;h=null,i=0,f=null,g=0,F.state=0,F.lmsstate=0;try{varT=require("amt-mei");h=newT();h.on("error",function(V){r("MEI error");h=null;i=-1;F.state=-1;if(F.onStateChange!=null){F.onStateChange(i)}});h.getVersion(function(V){if(V==null){i=-1;F.state=-1;if(F.onStateChange!=null){F.onStateChange(i)}if(L<10){setTimeout(F.reset,10000)}}else{e=V;i=2;F.state=2;L=0;if(F.onStateChange!=null){F.onStateChange(i)}F.lmsreset()}})}catch(U){r("MEI exception: "+U);h=null;i=-1;F.state=-1}};varj=null;F.getAmtInfo=function(U){if((h==null)||(i<2)){if(U!=null){U(null)}return}try{j={Flags:0};h.getProtocolVersion(function(V){if(V!=null){j.MeiVersion=V}});h.getVersion(function(V){if(V){j.Versions={};for(varWinV.Versions){j.Versions[V.Versions[W].Description]=V.Versions[W].Version}}});h.getProvisioningMode(function(V){if(V){j.ProvisioningMode=V.mode}});h.getProvisioningState(function(V){if(V){j.ProvisioningState=V.state}});h.getEHBCState(function(V){if((V!=null)&&(V.EHBC==true)){j.Flags+=1}});h.getControlMode(function(V){if(V!=null){if(V.controlMode==1){j.Flags+=2}if(V.controlMode==2){j.Flags+=4}}});h.getLanInterfaceSettings(0,function(V){if(V){j.net0=V}});h.getLanInterfaceSettings(1,function(V){if(V){j.net1=V}});h.getUuid(function(V){if((V!=null)&&(V.uuid!=null)){j.UUID=V.uuid}});h.getDnsSuffix(function(V){if(V!=null){j.DNS=V}if(U!=null){U(j)}})}catch(T){if(U!=null){U(null)}return}};vart=function(W){if((W==null)||(W.Body==null)||(W.Body.MessageID==null)||(W.Body.MessageArguments==null)){returnnull}varT=W.Body.MessageID,U=W.Body.MessageArguments[0],V=null;switch(T){case"iAMT0050":if(U=="48"){V="Intel® AMT Serial-over-LAN connected"}else{if(U=="49"){V="Intel® AMT Serial-over-LAN disconnected"}}break;case"iAMT0052":if(U=="1"){V="Intel® AMT KVM connected"}else{if(U=="2"){V="Intel® AMT KVM disconnected"}}break;default:break}if(V!=null){d.SendCommand({action:"msg",type:"notify",value:V,tag:"general"})}};F.lmsreset=function(){varT=null,U=0;F.lmsstate=0;try{varW=require("amt-lme");U=1;F.lmsstate=1;T=newW();T.on("error",function(X){U=0;F.lmsstate=0;T=null;r("LMS error");N(1)});T.on("connect",function(){U=2;F.lmsstate=2;r("LMS connected");N(2)});T.on("notify",function(Y,Z,aa,X){if(X=="iAMT0052-3"){y()}else{t(Y)}})}catch(V){U=-1;F.lmsstate=-1;T=null}};varN=function(T){if((h==null)||(i<2)||(e==null)){return}h.getLocalSystemAccount(function(aa){if(aa==null){return}varY=require("amt-wsman-duk");varZ=require("amt-wsman");varU=require("amt");H=newZ(Y,"127.0.0.1",16992,aa.user,aa.pass,false);G=newU(H);i=3;F.state=3;if(F.onStateChange!=null){F.onStateChange(i)}if(m==null){F.applyPolicy()}varV=null;try{for(varXine.Versions){if(e.Versions[X].Description=="AMT"){V=parseInt(e.Versions[X].Version.split(".")[0])}}}catch(W){}if((V!=null)&&(V>=12)){y("skip");F.kvmTempTimer=setInterval(function(){y()},2000);A(JSON.stringify({action:"restart",ver:1}))}})};vary=function(T){G.IPS_KVMRedirectionSettingData_DataChannelRead(F.kvmDataGetResponse,T)};varx=function(W,U,V,X,Y){if((Y!="skip")&&(X==200)&&(V.Body.ReturnValue==0)){varZ=null;try{Z=Buffer.from(V.Body.DataMessage,"base64").toString()}catch(T){return}if(Z!=null){F.kvmProcessData(V.Body.RealmsBitmap,V.Body.MessageId,Z)}}};varQ=null;varz=function(W,V,Y){varT=null;try{T=JSON.parse(Y)}catch(U){}if((T!=null)&&(T.action)){if(T.action=="present"){A(JSON.stringify({action:"present",ver:1,platform:process.platform}))}if(T.action=="offer"){Q={};varX=require("ILibWebRTC");Q.webrtc=X.createConnection();Q.webrtc.on("connected",function(){});Q.webrtc.on("disconnected",function(){F.webRtcCleanUp()});Q.webrtc.on("dataChanne