8){f.m.ProcessData(f.amtaccumulator.substring(8))}o=f.amtaccumulator.length;break;case 240:f.serverIsRecording=true;o=1;break;default:console.log("Unknown Intel AMT command: "+f.amtaccumulator.charCodeAt(0)+" acclen="+f.amtaccumulator.length);f.Stop(4);return}if(o==0){return}f.amtaccumulator=f.amtaccumulator.substring(o)}};f.xxSend=function(k){if(f.socket!=null&&f.socket.readyState==WebSocket.OPEN){if(f.debugmode==1){console.log("Send",k)}var g=new Uint8Array(k.length);for(var j=0;j0){var t=0;if(q.state==0&&q.acc.length>=12){t=12;q.state=1;q.send("RFB 003.008\n")}else{if(q.state==1&&q.acc.length>=1){t=q.acc.charCodeAt(0)+1;q.send(String.fromCharCode(1));q.state=2}else{if(q.state==2&&q.acc.length>=4){t=4;if(ReadInt(q.acc,0)!=0){return q.Stop()}q.send(String.fromCharCode(1));q.state=3}else{if(q.state==3&&q.acc.length>=24){var G=ReadInt(q.acc,20);if(q.acc.length<24+G){return}t=24+G;q.canvas.canvas.width=q.rwidth=q.width=q.ScreenWidth=ReadShort(q.acc,0);q.canvas.canvas.height=q.rheight=q.height=q.ScreenHeight=ReadShort(q.acc,2);var J="";if(q.useZRLE){J+=IntToStr(16)}J+=IntToStr(0);J+=IntToStr(1092);q.send(String.fromCharCode(2,0)+ShortToStr((J.length/4)+1)+J+IntToStr(-223));if(q.bpp==1){q.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}q.state=4;if(q.parent){q.parent.xxStateChange(3)}g();if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}else{if(q.state==4){switch(q.acc.charCodeAt(0)){case 0:if(q.acc.length<4){return}q.state=100+ReadShort(q.acc,2);t=4;break;case 2:t=1;break;case 3:if(q.acc.length<8){return}var F=ReadInt(q.acc,4)+8;if(q.acc.length 100&&q.acc.length>=12){var L=ReadShort(q.acc,0),N=ReadShort(q.acc,2),K=ReadShort(q.acc,4),C=ReadShort(q.acc,6),I=K*C,B=ReadInt(q.acc,8);if(B<17){if(K<1||K>64||C<1||C>64){console.log("Invalid tile size ("+K+","+C+"), disconnecting.");return q.Stop()}if(q.sparew!=K||q.spareh!=C){q.sparew=q.sparew2=K;q.spareh=q.spareh2=C;var M=q.sparew2+"x"+q.spareh2;q.spare=q.sparecache[M];if(!q.spare){q.sparecache[M]=q.spare=q.canvas.createImageData(q.sparew2,q.spareh2);var E=(q.sparew2*q.spareh2)<<2;for(var D=3;D 5&&q.acc.charCodeAt(H)==0&&ReadShortX(q.acc,H+1)==(w-z)){a(q.acc,H+5,L,N,K,C,I,w)}t=16+w}else{q.Debug("Unknown Encoding: "+B);return q.Stop()}}}if(--q.state==100){q.state=4;if(q.frameRateDelay==0){g()}else{setTimeout(g,q.frameRateDelay)}}}}}}}}if(t==0){return}q.acc=q.acc.substring(t)}};function a(w,E,M,N,L,A,I,z){var J=w.charCodeAt(E++),C,K,H,D={},F=0,G=0,B;if(J==0){if(q.bpp==2){for(B=0;B>8)&248)+","+((K>>3)&252)+","+((K&31)<<3)))+")";q.canvas.fillRect(M,N,L,A)}else{if(J>1&&J<17){var u=4,t=15;if(q.bpp==2){for(B=0;B =0;B-=u){h(D[(K>>B)&t],F++)}}}else{for(B=0;B =0;B-=u){k(D[(K>>B)&t],F++)}}}f(q.spare,M,N)}else{if(J==128){if(q.bpp==2){while(F=0){h(K,F++)}}}}else{while(F=0){k(K,F++)}}}}f(q.spare,M,N)}else{if(J>129){if(q.bpp==2){for(B=0;B<(J-128);B++){D[B]=w.charCodeAt(E++)+(w.charCodeAt(E++)<<8)}}else{for(B=0;B<(J-128);B++){D[B]=w.charCodeAt(E++)}}while(F127){do{G+=(H=w.charCodeAt(E++))}while(H==255)}if(q.rotation==0){if(q.bpp==2){j(K,F,G);F+=G}else{l(K,F,G);F+=G}}else{if(q.bpp==2){while(--G>=0){h(K,F++)}}else{while(--G>=0){k(K,F++)}}}}f(q.spare,M,N)}}}}}}q.hold=function(s){if(q.holding==s){return}q.holding=s;q.canvas.fillStyle="#000000";q.canvas.fillRect(0,0,q.width,q.height);if(q.holding==false){if((q.canvas.canvas.width!=q.width)||(q.canvas.canvas.height!=q.height)){q.canvas.canvas.width=q.width;q.canvas.canvas.height=q.height;if(q.onScreenSizeChange!=null){q.onScreenSizeChange(q,q.ScreenWidth,q.ScreenHeight)}}q.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(q.width)+ShortToStr(q.height))}else{q.UnGrabMouseInput();q.UnGrabKeyInput()}};function f(s,t,u){if(q.holding==true){return}q.canvas.putImageData(s,t,u)}function k(u,s){var t=s<<2;q.spare.data[t]=u&224;q.spare.data[t+1]=(u&28)<<3;q.spare.data[t+2]=b((u&3)<<6)}function h(u,s){var t=s<<2;q.spare.data[t]=(u>>8)&248;q.spare.data[t+1]=(u>>3)&252;q.spare.data[t+2]=(u&31)<<3}function l(z,u,y){var w=(u<<2),x=(z&224),t=((z&28)<<3),s=(b((z&3)<<6));while(--y>=0){q.spare.data[w]=x;q.spare.data[w+1]=t;q.spare.data[w+2]=s;w+=4}}function j(z,u,y){var w=(u<<2),x=((z>>8)&248),t=((z>>3)&252),s=((z&31)<<3);while(--y>=0){q.spare.data[w]=x;q.spare.data[w+1]=t;q.spare.data[w+2]=s;w+=4}}function b(s){return(s>127)?(s+32):s}function g(){if(q.holding==true){return}q.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(q.rwidth)+ShortToStr(q.rheight))}q.Start=function(){q.state=0;q.acc="";q.ZRLEfirst=1;q.onKvmDataPending=[];q.onKvmDataAck=-1;q.kvmDataSupported=false;for(var s in q.sparecache){delete q.sparecache[s]}};q.Stop=function(){q.UnGrabMouseInput();q.UnGrabKeyInput();if(q.parent){q.parent.Stop()}};q.send=function(s){if(q.parent){q.parent.send(s)}};var n={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function m(s){if(s.code.startsWith("Key")&&s.code.length==4){return s.code.charCodeAt(3)+((s.shiftKey==false)?32:0)}if(s.code.startsWith("Digit")&&s.code.length==6){return s.code.charCodeAt(5)}if(s.code.startsWith("Numpad")&&s.code.length==7){return s.code.charCodeAt(6)}return n[s.code]}function c(s,t){if(!t){t=window.event}if(t.code&&(q.localKeyMap==false)){var u=m(t);if(u!=null){q.sendkey(u,s)}}else{var u=t.keyCode,v=u;if(t.shiftKey==false&&u>=65&&u<=90){v=u+32}if(u>=112&&u<=124){v=u+65358}if(u==8){v=65288}if(u==9){v=65289}if(u==13){v=65293}if(u==16){v=65505}if(u==17){v=65507}if(u==18){v=65513}if(u==27){v=65307}if(u==33){v=65365}if(u==34){v=65366}if(u==35){v=65367}if(u==36){v=65360}if(u==37){v=65361}if(u==38){v=65362}if(u==39){v=65363}if(u==40){v=65364}if(u==45){v=65379}if(u==46){v=65535}if(u>=96&&u<=105){v=u-48}if(u==106){v=42}if(u==107){v=43}if(u==109){v=45}if(u==110){v=46}if(u==111){v=47}if(u==186){v=59}if(u==187){v=61}if(u==188){v=44}if(u==189){v=45}if(u==190){v=46}if(u==191){v=47}if(u==192){v=96}if(u==219){v=91}if(u==220){v=92}if(u==221){v=93}if(u==222){v=39}q.sendkey(v,s)}return q.haltEvent(t)}q.sendkey=function(v,t){if(typeof v=="object"){var s="";for(var u in v){s+=(String.fromCharCode(4,v[u][1],0,0)+IntToStr(v[u][0]))}q.send(s)}else{q.send(String.fromCharCode(4,t,0,0)+IntToStr(v))}};function p(s){if(s.length<8){return 0}var u=ReadInt(q.acc,4)+8;if(s.length=16)&&(t.substring(0,15)=="\0KvmDataChannel")){if(q.kvmDataSupported==false){q.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((q.onKvmDataAck==-1)&&(t.length==16))||(t.charCodeAt(15)!=0)){q.onKvmDataAck=true}if(t.length>=16){q.onKvmData(t.substring(16))}if((q.onKvmDataAck==true)&&(q.onKvmDataPending.length>0)){q.sendKvmData(q.onKvmDataPending.shift())}}}return u}q.sendKvmData=function(s){if(q.onKvmDataAck!==true){q.onKvmDataPending.push(s)}else{s="\0KvmDataChannel\0"+s;q.send(String.fromCharCode(6,0,0,0)+IntToStr(s.length)+s);q.onKvmDataAck=false}};q.sendKeepAlive=function(){if(q.lastKeepAlive =1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM 0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF =y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS] ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1< >>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1< =y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1< >>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq >>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)< >>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq >>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI =0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1< >>3;aH-=aE;aq-=aE<<3;aA&=(1< >>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1< =aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap >>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)< >>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1< >>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length >>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h >=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());"use strict";var webState="{{{webstate}}}";if(webState!=""){webState=JSON.parse(decodeURIComponent(webState))}for(var i in webState){localStorage.setItem(i,webState[i])}if(!webState.loctag){delete localStorage.removeItem("loctag")}var args=parseUriArgs();var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var authCookie="{{{authCookie}}}";var authRelayCookie="{{{authRelayCookie}}}";var authCookieRenewTimer=null;var meshserver=null;var xdr=null;var serverinfo=null;var nodes=[];var meshes={};var filetree={};var userinfo=null;var serverinfo=null;var users=null;var nodeShortIdent=0;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var debugmode=false;var attemptWebRTC=((features&128)!=0);var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel® AMT Connected"];var files;var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}var sessionActivity=Date.now();function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}if(!args.locale){var d=getstore("loctag",0);if((d!=null)&&(d!="*")){args.locale=d}}window.onresize=center;center();QV("changeEmailId",(features&2097152)==0);QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl(domainUrl,authCookie);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(c,d,b,a){if(d==0){setDialogMode(0);go(0);if(a=="noauth"){QH("p0span","Unable to perform authentication");return}if(b==2){setTimeout(serverPoll,5000)}else{QH("p0span","Unable to connect web socket")}if(authCookieRenewTimer!=null){clearInterval(authCookieRenewTimer);authCookieRenewTimer=null}}else{if(d==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}authCookieRenewTimer=setInterval(function(){meshserver.send({action:"authcookie"})},1800000)}}QV("topMenuIcon",d==2)}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function updateSelf(){QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("manageAuthApp",features&4096);QV("manageOtp",((features&4096)!=0)&&((userinfo.otpsecret==1)||(userinfo.otphkeys>0)));QV("p3createMeshLink1",false);QV("p3createMeshLink2",false);if(typeof userinfo.passchange=="number"){if(userinfo.passchange==-1){QH("p2nextPasswordUpdateTime"," - Reset on next login.")}else{if((passRequirements!=null)&&(typeof passRequirements.reset=="number")){var a=(userinfo.passchange)+(passRequirements.reset*86400)-Math.floor(Date.now()/1000);if(a<0){QH("p2nextPasswordUpdateTime"," - Reset on next login.")}else{if(a<3600){QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/60)+" minute"+addLetterS(Math.floor(a/60))+".")}else{if(a<86400){QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/3600)+" hour"+addLetterS(Math.floor(a/3600))+".")}else{QH("p2nextPasswordUpdateTime"," - Reset in "+Math.floor(a/86400)+" day"+addLetterS(Math.floor(a/86400))+".")}}}}}}}function addLetterS(a){return(a>1)?"s":""}function setSessionActivity(){sessionActivity=Date.now()}function checkIdleSessionTimeout(){var a=(Date.now()-sessionActivity);if(a>serverinfo.timeout){window.location.href="logout"}}function onMessage(r,e){switch(e.action){case"serverinfo":serverinfo=e.serverinfo;if(serverinfo.timeout){setInterval(checkIdleSessionTimeout,10000);checkIdleSessionTimeout()}QV("p3AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("logoutMenuOption",((features&4)==0)&&(serverinfo.domainauth==false));break;case"authcookie":authCookie=e.cookie;authRelayCookie=e.rcookie;break;case"userinfo":userinfo=e.userinfo;QH("p3userName",userinfo.name);updateSelf();break;case"users":users={};for(var d in e.users){users[e.users[d]._id]=e.users[d]}updateUsers();break;case"wssessioncount":wssessions=e.wssessions;updateUsers();break;case"meshes":meshes={};for(var d in e.meshes){meshes[e.meshes[d]._id]=e.meshes[d]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(e.filetree);updateFiles();break;case"nodes":nodes=[];for(var d in e.nodes){for(var f in e.nodes[d]){if(!meshes[d]){console.log("Invalid mesh (1): "+d);continue}e.nodes[d][f].namel=e.nodes[d][f].name.toLowerCase();if(e.nodes[d][f].rname){e.nodes[d][f].rnamel=e.nodes[d][f].rname.toLowerCase()}else{e.nodes[d][f].rnamel=e.nodes[d][f].namel}e.nodes[d][f].meshnamel=meshes[d].name.toLowerCase();e.nodes[d][f].meshid=d;e.nodes[d][f].state=(e.nodes[d][f].state)?(e.nodes[d][f].state):0;e.nodes[d][f].desc=e.nodes[d][f].desc;if(!e.nodes[d][f].icon){e.nodes[d][f].icon=1}e.nodes[d][f].ident=++nodeShortIdent;nodes.push(e.nodes[d][f])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(2)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(e.nodeid!=powerTimelineReq){break}powerTimelineNode=e.nodeid;powerTimeline=e.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==e.nodeid){drawDeviceTimeline()}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var q=e.secret;if(q.length==52){q=q.split(/(.............)/).filter(Boolean).join(" ")}else{if(q.length==32){q=q.split(/(....)/).filter(Boolean).join(" ");q=q.substring(0,20)+" ",j="Root";var u=p13filetree.path.split("\\");p13filetreelocation=[];for(var n in u){if(u[n]!=""){p13filetreelocation.push(u[n])}}for(var n in p13filetreelocation){c+=" / "+p13filetreelocation[n]+""}var q=p13filetreelocation.join("/");var e=p13sort_files(p13filetree.dir);for(var n in e){var d=e[n],p=d.n,s;s=p;if(p.length>70){s=''+EscapeHtml(p.substring(0,70))+"..."}else{s=EscapeHtml(p)}p=EscapeHtml(p);var g="";if(d.s!=null){g=getFileSizeStr(d.s)}var k="";if(d.t<3){var r="",t="";k="
"+q.substring(20)}}QH("d2optinfo",'Install Google Authenticator or a compatible application, use this link or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.'+q+'');QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,e.success?"2-step login activation successful. You will now need a valid token to login again.":"2-step login activation failed. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Authenticator App",1,null,e.success?"2-step login activation removed. You can reactivate this feature at any time.":"2-step login activation removal failed. Try again.");break;case"otpauth-getpasswords":if(xxdialogMode){return}var t="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";t+="
Token:";if(e.passwords){var c=0;for(var a in e.passwords){if(++c%2){t+="
"}var o=""+e.passwords[a].p;while(o.length<8){o="0"+o}if(e.passwords[a].u===true){t+=" "+o.substring(0,4)+" "+o.substring(4)}else{t+=" "+o.substring(0,4)+" "+o.substring(4);+""}}}else{t+="No Active Tokens"}t+="
";t+="";t+="";if(e.passwords!=null){t+=""}t+="
";setDialogMode(2,"Manage Backup Codes",8,null,t,"otpauth-manage");break;case"event":if(e.event.noact){break}switch(e.event.action){case"userWebState":if(localStorage!=null){var s=JSON.parse(e.event.state);for(var a in s){localStorage.setItem(a,s[a])}if((s.loctag!=null)&&(s.loctag!=oldLoctag)){if(s.loctag!=null){args.locale=s.loctag}else{delete args.locale}updateDevices();updateMeshes()}}break;case"accountchange":if(userinfo.name==e.event.account.name){var h=e.event.account.siteadmin?e.event.account.siteadmin:0;var l=userinfo.siteadmin?userinfo.siteadmin:0;if((e.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((e.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=e.event.account;if(l!=h){updateSiteAdmin()}updateSelf()}break;case"createmesh":if(e.event.links[userinfo._id]!=null){meshes[e.event.meshid]={_id:e.event.meshid,name:e.event.name,mtype:e.event.mtype,desc:e.event.desc,links:e.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[e.event.meshid]==null){meshes[e.event.meshid]={_id:e.event.meshid,name:e.event.name,mtype:e.event.mtype,desc:e.event.desc,links:e.event.links};meshserver.send({action:"nodes"})}else{if(meshes[e.event.meshid].name!=e.event.name){meshes[e.event.meshid].name=e.event.name;for(var a in nodes){if(nodes[a].meshid==e.event.meshid){nodes[a].meshnamel=e.event.name.toLowerCase()}}}meshes[e.event.meshid].desc=e.event.desc;meshes[e.event.meshid].links=e.event.links;if(meshes[e.event.meshid].links[userinfo._id]==null){if((xxcurrentView==20)&&(currentMesh==meshes[e.event.meshid])){go(2)}delete meshes[e.event.meshid];var g=[];for(var a in nodes){if(nodes[a].meshid!=e.event.meshid){g.push(nodes[a])}}nodes=g;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==e.event.meshid){setDialogMode(0);go(2)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&¤tMesh._id==e.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[e.event.meshid]){delete meshes[e.event.meshid];updateMeshes();meshserver.send({action:"files"})}var g=[];for(var a in nodes){if(nodes[a].meshid!=e.event.meshid){g.push(nodes[a])}}nodes=g;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==e.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==e.event.meshid){setDialogMode(0);go(2)}break;case"addnode":var k=e.event.node;if(!meshes[k.meshid]){break}if(getNodeFromId(k._id)!=null){break}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}k.meshnamel=meshes[k.meshid].name.toLowerCase();k.state=0;if(!k.icon){k.icon=1}k.ident=++nodeShortIdent;nodes.push(k);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];if(currentNode==k){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(2)}currentNode=null}nodes.splice(b,1);updateDevices()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];k.name=e.event.node.name;k.rname=e.event.node.rname;k.host=e.event.node.host;k.desc=e.event.node.desc;k.publicip=e.event.node.publicip;k.iploc=e.event.node.iploc;k.wifiloc=e.event.node.wifiloc;k.gpsloc=e.event.node.gpsloc;k.tags=e.event.node.tags;k.userloc=e.event.node.userloc;if(e.event.node.agent!=null){if(k.agent==null){k.agent={}}if(e.event.node.agent.ver!=null){k.agent.ver=e.event.node.agent.ver}if(e.event.node.agent.id!=null){k.agent.id=e.event.node.agent.id}if(e.event.node.agent.caps!=null){k.agent.caps=e.event.node.agent.caps}if(e.event.node.agent.core!=null){k.agent.core=e.event.node.agent.core}else{if(k.agent.core){delete k.agent.core}}k.agent.tag=e.event.node.agent.tag}if(e.event.node.intelamt!=null){if(k.intelamt==null){k.intelamt={}}if(e.event.node.intelamt.state!=null){k.intelamt.state=e.event.node.intelamt.state}if(e.event.node.intelamt.host!=null){k.intelamt.user=e.event.node.intelamt.host}if(e.event.node.intelamt.user!=null){k.intelamt.user=e.event.node.intelamt.user}if(e.event.node.intelamt.tls!=null){k.intelamt.tls=e.event.node.intelamt.tls}if(e.event.node.intelamt.ver!=null){k.intelamt.ver=e.event.node.intelamt.ver}if(e.event.node.intelamt.tag!=null){k.intelamt.tag=e.event.node.intelamt.tag}if(e.event.node.intelamt.uuid!=null){k.intelamt.uuid=e.event.node.intelamt.uuid}if(e.event.node.intelamt.realm!=null){k.intelamt.realm=e.event.node.intelamt.realm}}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}if(e.event.node.icon){k.icon=e.event.node.icon}refreshDevice(k._id);updateDevices()}break;case"nodemeshchange":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];if(meshes[e.event.newMeshId]==null){if(currentNode==k){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(2)}currentNode=null}nodes.splice(b,1)}else{k.meshid=e.event.newMeshId;k.meshnamel=meshes[e.event.newMeshId].name.toLowerCase()}updateDevices();refreshDevice(e.event.nodeid)}else{var k=e.event.node;if(!meshes[k.meshid]){break}k.namel=k.name.toLowerCase();if(k.rname){k.rnamel=k.rname.toLowerCase()}else{k.rnamel=k.namel}k.meshnamel=meshes[k.meshid].name.toLowerCase();k.state=0;if(!k.icon){k.icon=1}k.ident=++nodeShortIdent;if(nodes==null){}nodes.push(k);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==e.event.nodeid){b=a;break}}if(b!=-1){var k=nodes[b];k.conn=e.event.conn;k.pwr=e.event.pwr;updateDevices()}break;case"login":if(users!=null&&users["user/"+domain+"/"+e.event.username.toLowerCase()]){users["user/"+domain+"/"+e.event.username.toLowerCase()].login=e.event.time}break;case"notify":break;case"stopped":break;default:break}break;default:break}}function topMenu(a){if((xxdialogMode!=null)&&(xxdialogMode!=0)&&(xxdialogMode!=999)){return}if(a===undefined){var b=(QS("topMenu").display=="none");if(b==true){if((xxdialogMode==0)||(xxdialogMode==null)){QV("topMenu",true);xxdialogMode=999}}else{QV("topMenu",false);xxdialogMode=0}}else{QV("topMenu",false);xxdialogMode=0;if((a==1)&&(xxcurrentView!=3)){goForward("account")}if((a==2)&&(xxcurrentView!=5)){goForward("files")}}}var backStack=[];function goBack(){if(xxdialogMode){return}if(backStack.length>0){backStack.pop()}goStack()}function goForward(a){if(xxdialogMode){return}backStack.push(a);goStack()}function goStack(){if(backStack.length==0){go(2);return}var a=backStack[backStack.length-1],b=a.split("/")[0];if(b=="node"){setupDeviceMenu(0);gotoDevice(a)}if(b=="mesh"){gotoMesh(a)}if(b=="account"){go(3)}if(b=="devices"){go(2)}if(b=="files"){go(5)}}function updateFooterMenu(b){while(b!=null&&b.length<3){b.push({n:""})}var d="",c="";if(b!=null){for(var a in b){d+=''+b[a].n;c=b[a].n}}QH("footerMenu"," "+d)}function account_manageAuthApp(){if(xxdialogMode||((features&4096)==0)){return}if(userinfo.otpsecret==1){account_removeOtp()}else{account_addOtp()}}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Authenticator App",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})}," "}}t+="Loading...","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Authenticator App",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of authenticator application 2-step login?")}function account_manageOtp(a){if((xxdialogMode==2)&&(xxdialogTag=="otpauth-manage")){dialogclose(0)}if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}meshserver.send({action:"otpauth-getpasswords",subaction:a})}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:"+EscapeHtml(userinfo.email)+"Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a=addHtmlValue("Email","");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp3email").value=userinfo.email}account_validateEmail();Q("dp3email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&(Q("dp3email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return false}var d="";d+="
";if(passRequirements){var b=[],c=0;for(var a in passRequirements){if((a!="reset")&&(a!="hint")){b.push(a+":"+passRequirements[a]);c++}}if(c>0){d+="";d+=" Old password: ";d+=" New password: ";if(features&65536){d+=" New password: "}d+=" Password hint:
Requirements: "+b.join(", ")+"."}}d+="
";setDialogMode(2,"Change Password",3,account_showChangePasswordEx,d);Q("apassword0").focus();account_validateNewPassword();return false}function account_showChangePasswordEx(){if(Q("apassword1").value==Q("apassword2").value){var a={action:"changepassword",oldpass:Q("apassword0").value,newpass:Q("apassword1").value};if(features&65536){a.hint=Q("apasswordhint").value}meshserver.send(a)}}function account_createMesh(){if(xxdialogMode){return}if((userinfo.siteadmin!=4294967295)&&((userinfo.siteadmin&64)!=0)){setDialogMode(2,"New Device Group",1,null,"This account does not have the rights to create a new device group.");return}if((userinfo.emailVerified!==true)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');return}if((features&262144)&&!((userinfo.otpsecret==1)||(userinfo.otphkeys>0)||(userinfo.otpkeys>0))){setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');return}var a=addHtmlValue("Name","");a+=addHtmlValue("Type","");a+=addHtmlValue("Description","");setDialogMode(2,"Create Device Group",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp3meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp3meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){var d="",a=(Q("apassword0").value.length>0)&&(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value)&&(Q("apassword0").value!=Q("apassword1").value);if((features&65536)&&(Q("apasswordhint").value==Q("apassword1").value)){a=false}if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="Strong"}else{if(c>=60){d="●"}else{d="●"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="Policy"}}}QH("dxPassWarn",d);QE("idx_dlgOkButton",a)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;bf.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a ";c+='';c+=' ';c+=""}QH("p3meshes",c);QV("p3noMeshFound",a==0)}function gotoMesh(a){currentMesh=meshes[a];if(currentMesh==null){goBack()}p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing.";c+=""+EscapeHtml(meshes[i].name)+""+d+"
";a+='";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var filetreelinkpath;var filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var o="",p="",c="Root",m="Root",w,g=filetree,k=1;var e=[],t=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var q=0;q2){w+="/"+filetreelocation[q]}}}g=g.f[filetreelocation[q]];c+=" / "+(g.n!=null?g.n:filetreelocation[q])+"";k++}else{break}}filetreelocation=e;var u=m.toLowerCase().startsWith("root / "+userinfo._id+" / public");var j=p5sort_files(g.f);for(var q in j){var d=j[q],s=d.n,y;y=s;if(s.length>40){y=''+EscapeHtml(s.substring(0,40))+"..."}else{y=EscapeHtml(s)}s=EscapeHtml(s);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3||d.t==4){var x=(d.t==1||d.t==4)?p5getQuotabar(d):"",A="";n=" '+x+"'+y+""}else{var r=y;var v="";if(u){v=' (Link)"}if(d.s>0){r=''+y+""+v}n=""+l+""+r+""}if(d.t<3){o+=n}else{p+=n}}QH("p5rightOfButtons",p5getQuotabar(g));QH("p5files",o+p);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",u);if(t==filetreelinkpath){a=document.getElementsByName("fc");for(var q=0;q=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" "}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln d.d){return(1*sortorder)}if(c.d 3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"None":"All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c ',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c 0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", Clear."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d 90)){return false}}}return desktop.m.handleKeys(a)}}function ondeskkeydown(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeyDown(a)}}function ondeskkeyup(a){toggleSoftKeys(0);Q("DeskSoftInput").value="";setSessionActivity();if(desktop&&!xxdialogMode&&xxcurrentView==10){if(currentNode!=null){var d=meshes[currentNode.meshid];var f=d.links[userinfo._id].rights;var b=((f==4294967295)||(((f&8)!=0)&&((f&256)==0)));if(b==false){return false}var c=((f!=4294967295)&&(((f&8)!=0)&&((f&256)==0)&&((f&4096)!=0)));if(c==true){if((a.altKey==true)||(a.ctrlKey==true)||((a.keyCode<32)&&(a.keyCode!=8)&&(a.keyCode!=13))||(a.keyCode>90)){return false}}}return desktop.m.handleKeyUp(a)}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var sort=0;var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var showRealNames=false;var deviceHeaderTotal=0;var deviceHeaders={};var deviceHeadersTitles={};function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var t="",a=0,d=null,b=0,e={},h={},g={};deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var d;if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}for(var j in nodes){if(nodes[j].v==false){continue}var m=meshes[nodes[j].meshid],o=m.links[userinfo._id];if(o==null){continue}var p=o.rights;if(sort==0){nodes.sort(meshSort);if(nodes[j].meshid!=d){deviceHeaderSet();var f="";if(meshes[nodes[j].meshid].mtype==1){f=", Intel® AMT only"}if(d!=null){if(a==2){t+=" "}if(t!=""){t+=" ";t+=''+EscapeHtml(meshes[nodes[j].meshid].name)+""+f+"";d=nodes[j].meshid;e[d]=1;a=0}}else{if(sort==1){if(nodes[j].pwr!==d){deviceHeaderSet();if(d!==null){if(a==2){t+=""}if(t!=""){t+=""}}t+=" "+PowerStateStr2(nodes[j].pwr)+"";d=nodes[j].pwr;a=0}}else{if(sort==2){if(d==null){d="1"}}}}b++;var u=EscapeHtml(nodes[j].name);if(u.length==0){u="None"}if((nodes[j].rname!=null)&&(nodes[j].rname.length>0)){u+=" / "+EscapeHtml(nodes[j].rname)}var q=EscapeHtml(nodes[j].name);if(showRealNames==true&&nodes[j].rname!=null){q=EscapeHtml(nodes[j].rname)}if(q.length==0){q="None"}var k=nodes[j].icon,s=NodeStateStr(nodes[j]);if((!nodes[j].conn)||(nodes[j].conn==0)){k+=" gray"}t+="";t+='';t+='";deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[j].state]=="undefined"){deviceHeaderCount[nodes[j].state]=1}else{deviceHeaderCount[nodes[j].state]++}}if(sort==0){for(var j in meshes){var l=meshes[j],n=l.links[userinfo._id];if(n!=null){var p=n.rights;if(e[l._id]==null){if((d!="")&&(t!="")){t+=""}t+="';t+="";t+=""+q+""+s+""}}QH("DeskToolsProcesses",h)}}function deskSaveImage(){setSessionActivity();if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+=""}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){setSessionActivity();var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mousedown(a)}}function dmouseup(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mouseup(a)}}function dmousemove(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)){desktop.m.mousemove(a)}}function dmousewheel(a){setSessionActivity();if((!xxdialogMode&&desktop!=null)&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){setSessionActivity();p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break;default:break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){setSessionActivity();if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c";t+=''+EscapeHtml(l.name)+"";if(l.mtype==1){t+="No Intel® AMT devices in this group"}if(l.mtype==2){t+="";d=l._id;b++}}}}if(b==0){QH("xdevices",'No devices in this group"}t+=".No devices')}else{QH("xdevices",t)}deviceHeaderSet();for(var j in deviceHeaders){QH(j,deviceHeaders[j])}for(var j in deviceHeadersTitles){Q(j).title=deviceHeadersTitles[j]}}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var powerStateStrings=["",'Powered','Sleeping','Sleeping','Deep Sleep','Hibernating','Soft-Off','Present'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state
Use the desktop version of this website to add devices.Agent')}if((a.conn&2)!=0){b.push('CIRA')}else{if((a.conn&4)!=0){b.push('Intel® AMT')}}if((a.conn&8)!=0){b.push('Relay')}if((a.conn&16)!=0){b.push('MQTT')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a 0){a+=", "}a+=deviceHeaderCount[b]+" "+PowerStateStr2(b)}deviceHeadersTitles["DevxHeader"+deviceHeaderId]=a;deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel d.rnamel){return 1}if(c.rnamel d.namel){return 1}if(c.namel e.rnamel){return 1}if(c.rnamel e.namel){return 1}if(c.namel f){return 1}if(d d.namel){return 1}if(c.namel d.rnamel){return 1}if(c.rnamel 0)||(userinfo.otpkeys>0))){setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');return}var l=getNodeFromId(m);if(l==null){goBack();return}var h=meshes[l.meshid];if(h==null){goBack();return}var j=h.links[userinfo._id].rights;if(!currentNode||currentNode._id!=l._id||q==true){currentNode=l;var k=EscapeHtml(l.name);if(k.length==0){k="None"}if((j&4)!=0){k=""+k+""}QH("p10deviceName",k);var t=" ";t+=addDeviceAttribute('Group',''+EscapeHtml(meshes[l.meshid].name)+"");if(l.rname!=null){t+=addDeviceAttribute('Name',''+EscapeHtml(l.rname)+"")}if((h.mtype==1)||(l.name!=l.host)){if((j&4)!=0){if(l.host){t+=addDeviceAttribute("Hostname",""+EscapeHtml(l.host)+"")}else{t+=addDeviceAttribute("Hostname","None")}}else{t+=addDeviceAttribute("Hostname",EscapeHtml(l.host))}}var d=l.desc?EscapeHtml(l.desc):"None";if((j&4)!=0){t+=addDeviceAttribute("Description",""+d+"")}else{t+=addDeviceAttribute("Description",d)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","MacOS 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","MacOS 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l","ARMv8 64bit","ARMv6l / ARMv7l / NoKVM","Unknown","Unknown","FreeBSD x86-64"];if((l.agent!=null)&&(l.agent.id!=null)&&(l.agent.ver!=null)){var r="";if(l.agent.id<=a.length){r=a[l.agent.id]}else{r=a[0]}if(l.agent.ver!=0){r+=" v"+l.agent.ver}t+=addDeviceAttribute("Agent",r)}if(l.intelamt!=null){var r="";var p={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(l.intelamt.ver!=null&&l.intelamt.state==null){r+="Unknown State, v"+l.intelamt.ver}else{if((l.intelamt.ver==null)&&(l.intelamt.state==2)){r+="Activated"}else{if((l.intelamt.ver==null)||(l.intelamt.state==null)){r+="Unknown Version & State"}else{r+=p[l.intelamt.state];if(l.intelamt.flags){if(l.intelamt.flags&2){r=' CCM'}else{if(l.intelamt.flags&4){r=' ACM'}}}r+=(", v"+l.intelamt.ver)}}}if(l.intelamt.tls==1){r+=', TLS'}if(l.intelamt.state==2){if(l.intelamt.user==null||l.intelamt.user==""){if((j&4)!=0){r+=', No Credentials'}else{r+=", No Credentials"}}r+=" ";if((j&4)!=0){r+=''}}var g="Intel® ME";if(typeof l.intelamt.sku=="number"){if((l.intelamt.sku&8)!=0){g="Intel® AMT"}else{if((l.intelamt.sku&16)!=0){g="Intel® SM"}}}t+=addDeviceAttribute(g,r)}if((l.agent!=null)&&(l.agent.tag!=null)&&(l.agent.tag!="mailto:")){var s=EscapeHtml(l.agent.tag);if(s.startsWith("mailto:")){s=''+s.substring(7)+""}t+=addDeviceAttribute("Agent Tag",s)}var b=l.conn;if(b&&b>1){var c=[];if((l.conn&1)!=0){c.push('Agent')}if((l.conn&2)!=0){c.push('Intel® AMT CIRA')}else{if((l.conn&4)!=0){c.push('Intel® AMT')}}if((l.conn&8)!=0){c.push('Agent Relay')}if((l.conn&16)!=0){c.push('MQTT')}t+=addDeviceAttribute("Connectivity",c.join(", "))}var e="None";if(l.tags!=null){e="";for(var f in l.tags){e+=''+l.tags[f]+""}}if((j&4)!=0){t+=addDeviceAttribute("Tags",""+e+"")}else{t+=addDeviceAttribute("Tags",e)}t+="
";if((j&76)!=0){t+=''}QH("p10html",t);setupFiles();t="";if((j&4)!=0){t+='Delete Device'}t+="";t+="
";QH("p10html3",t);var o=PowerStateStr(l.state);if((b&1)!=0){if(o.length>0){o+=", "}o+='Mesh Agent'}if((b&2)!=0){if(o.length>0){o+=", "}o+='Intel® AMT connected'}else{if((b&4)!=0){if(o.length>0){o+=", "}o+='Intel® AMT detected'}}if((b&16)!=0){if(o.length>0){o+="
"}o+='MQTT channel connected'}QH("MainComputerState",o);QH("MainComputerImage",'');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!n){n=10}go(n);setupDeviceMenu()}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(d,c){var b=0;if(currentNode){b=meshes[currentNode.meshid].links[userinfo._id].rights}if(d!=null){currentDevicePanel=d}QV("p10general",currentDevicePanel==0);QV("p10desktop",currentDevicePanel==1);QV("p10files",currentDevicePanel==2);var a=[];if(currentDevicePanel!=0){a.push({n:"General",f:"setupDeviceMenu(0)"})}if((currentDevicePanel!=1)&&(currentNode!=null)&&((b&8)||(b&256))&&(((meshes[currentNode.meshid].mtype==1)&&((typeof currentNode.intelamt.sku!=="number")||((currentNode.intelamt.sku&8)!=0)))||(currentNode.agent&&(currentNode.agent.caps&1)))){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&(currentNode!=null)&&(b&8)&&((b==4294967295)||((b&1024)==0))&&((currentNode.mtype==2)&&(currentNode.agent.caps&4))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links[userinfo._id].rights;var b="Select an operation to perform on this device.
";var c="";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l (l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(90+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+printTime(new Date(w))+" to "+printTime(new Date(q))+".";f+='"}}}z+=" ";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",' "+printDate(g)+" "+f+"")}function powerColor(a){if(a
'+z+" Day Power State c)){return true}if((b>d)&&(b d)&&(a "+a+" "}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'');f+=addHtmlValue("Password","");f+=addHtmlValue("Security","");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel® AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,'Delete "'+EscapeHtml(currentNode.name)+'"?
Confirm',a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links[userinfo._id].rights;if((b&4)==0){return}var c="";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktop;var desktopNode;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){QH("DeskParent",'');desktopNode=currentNode;Q("Desk").addEventListener("DOMMouseScroll",function(a){return dmousewheel(a)});Q("Desk").addEventListener("mousewheel",function(a){return dmousewheel(a)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}var d=c.links[userinfo._id].rights;QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2)&&((d&8)||(d&256)));QV("connectbutton1h",(a==0)&&(d&8)&&((c.mtype==1)||(currentNode.intelamt!=null)&&((currentNode.intelamt.state==2)&&(currentNode.intelamt.ver!=null)&&(typeof currentNode.intelamt.sku=="number")&&((currentNode.intelamt.sku&8)!=0))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QV("DeskToastButton",((d&16384)!=0)&&(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QV("deskActionsBtn",d&8);Q("DeskControl").checked=((d&8)!=0);if(e==false){QV("DeskTools",false)}}function connectDesktop(b,a){setSessionActivity();if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"),authCookie);desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("termdisplays",false);if(fullscreen==true){deskToggleFull()}break;case 2:break;default:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+=""}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}}var fullscreen=false;function deskAdjust(){var c=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(c<0){var a=Q("DeskParent").clientHeight,b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.sendCtrlMsg('{"action":"lock"}')}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}else{if(a==5){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==6){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==7){if(desktop.contype==2){desktop.m.sendkey([[65513,1],[65473,1],[65473,0],[65513,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,115],[desktop.m.KeyAction.UP,115],[desktop.m.KeyAction.EXUP,18]])}}else{if(a==8){if(desktop.contype==2){desktop.m.sendkey([[65507,1],[119,1],[119,0],[65507,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,17],[desktop.m.KeyAction.DOWN,87],[desktop.m.KeyAction.UP,87],[desktop.m.KeyAction.EXUP,17]])}}else{if(a==9){if(desktop.contype==2){desktop.m.sendkey([[65513,1],[65289,1],[65289,0],[65513,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9],[desktop.m.KeyAction.EXUP,18]])}}else{if(a==10){desktop.m.sendcad()}else{if(a==11){if(desktop.contype==2){desktop.m.sendkey([[65289,1],[65289,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9]])}}}}}}}}}}}}}}function sendSpecialKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}setDialogMode(3,"Special Keys",3,deskSendKeys)}function toggleSoftKeys(a){QV("DeskSoftInput",a==1);if(a==1){Q("DeskSoftInput").focus()}}function toggleDeskTools(){setSessionActivity();if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){setSessionActivity();QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p
";c+="";c+="";c+="
";c+="";c+="";c+="d.d){return 1}if(c.d "+d[b].p+''+(d[b].u?d[b].u:"")+""+d[b].c+"Root '+r+"'+s+""}else{var o=s;if(d.s>0){o=''+s+""}k=""+g+""+o+""}if(d.t<3){l+=k}else{m+=k}}QH("p13files",l+m);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var n=0;n=0){a[n].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln d.d){return(1*p13sortorder)}if(c.d 3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"None":"All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c ");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c ',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c 0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", Clear."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c "+downloadFile.file+"
")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"Connecting...
");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort,authCookie,authRelayCookie,domainUrl);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength})};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links[userinfo._id].rights;if(currentMesh.mtype==1){e="Intel® AMT group"}if(currentMesh.mtype==2){e="Software agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.desc!="")?EscapeHtml(currentMesh.desc):"None"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+="
";var b=currentMesh.links[userinfo._id];if(b&&((b.rights&2)!=0)){k+=""}k+='";if(d==4294967295){k+=""}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.
';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name User Authorizations '}k+=' ";++a}k+=" ";k+=" "+j+""+g+""+EscapeHtml(decodeURIComponent(h[c].name))+"";k+="
';a+="Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","");b+=addHtmlValue("Description","");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a=addHtmlValue("User","");a+='';a+="Full Administrator";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links[userinfo._id].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20noterminal",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20nofiles",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked);QE("p20noamt",!Q("p20fulladmin").checked&&Q("p20remotecontrol").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}if(Q("p20remoteview").checked==true){a+=256}if(Q("p20noterminal").checked==true){a+=512}if(Q("p20nofiles").checked==true){a+=1024}if(Q("p20noamt").checked==true){a+=2048}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links[userinfo._id].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}if((c&256)!=0){d+=", Remote View Only"}if((c&512)!=0){d+=", No Terminal"}if((c&1024)!=0){d+=", No Files"}if((c&2048)!=0){d+=", No Intel® AMT"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",EscapeHtml(decodeURIComponent(e.split("/")[2])));f+=addHtmlValue("Permissions",d);if(((userinfo._id)!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var xxcurrentView=-1;function go(b){setSessionActivity();if(xxdialogMode||xxcurrentView==b){return}updateFooterMenu();setDialogMode(0);for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;function setDialogMode(j,k,a,e,d,h){setSessionActivity();xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){setSessionActivity();var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function putstore(f,h){try{if((typeof(localStorage)==="undefined")||(localStorage.getItem(f)==h)){return}if(h==null){localStorage.removeItem(f)}else{localStorage.setItem(f,h)}}catch(a){}if(f[0]!="_"){var g={};for(var b=0,d=localStorage.length;b
";a+="Edit Device Group
";a+="Manage Device Group Users
";a+="Manage Device Group Computers
";a+="Remote Control
";a+="Remote View Only
";a+="No Terminal Access
";a+="No File Access
";a+="No Intel® AMT
";a+="Mesh Agent Console
";a+="Server Files
";a+="Wake Devices
";a+="Edit Device Notes
";a+="()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)}function reload(){window.location.href=window.location.href}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function addHtmlValue(a,b){return" "}function addHtmlValue2(a,b){return"
"+a+" "+b+" "}function addLink(b,a){return"♦ "+b+""}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=decodeURIComponent(b[d]);break;case 1:c[a]=decodeURIComponent(b[d]);var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function printDate(a){return a.toLocaleDateString(args.locale)}function printTime(a){return a.toLocaleTimeString(args.locale)}function printDateTime(a){return a.toLocaleString(args.locale)};"+b+""+a+"