var CreateAmtRemoteDesktop=function(t,e){var S={};function m(t){return String.fromCharCode.apply(null,t)}function p(t,e,a,n,r,o,i){var s,c,h,d,l=t[e++],v={},u=0,f=0;if(0==l){if(2==S.bpp)for(d=0;d>8&248)+","+(c>>3&252)+","+((31&c)<<3))+")");var g=k(a);n=x(0,n),a=g,S.canvas.fillRect(a,n,r,o)}else if(1>d&p],u++)}else{for(d=0;d>d&p],u++)}w(S.spare,a,n)}else if(128==l){if(2==S.bpp)for(;u>8&248,S.spare.data[r+1]=t>>3&252,S.spare.data[r+2]=(31&t)<<3}function b(t,e,a){if(S.graymode){var n=e<<2;for(S.lowcolor&&(t<<=4);0<=--a;)S.spare.data[n]=S.spare.data[n+1]=S.spare.data[n+2]=t,n+=4}else for(var n=e<<2,r=224&t,o=(28&t)<<3,i=T((3&t)<<6);0<=--a;)S.spare.data[n]=r,S.spare.data[n+1]=o,S.spare.data[n+2]=i,n+=4}function D(t,e,a){for(var n=e<<2,r=t>>8&248,o=t>>3&252,i=(31&t)<<3;0<=--a;)S.spare.data[n]=r,S.spare.data[n+1]=o,S.spare.data[n+2]=i,n+=4}function k(t){return 0==S.rotation||1==S.rotation?t:2==S.rotation?t-S.canvas.canvas.width:3==S.rotation?t-S.canvas.canvas.height:0}function x(t,e){return 0==S.rotation?e:1==S.rotation?e-S.canvas.canvas.width:2==S.rotation?e-S.canvas.canvas.height:3==S.rotation?e:0}function T(t){return 127>32)+IntToStr(32&n)):(S.recordedSize+=a.length,ShortToStr(t)+ShortToStr(e)+IntToStr(a.length)+IntToStr(n>>32)+IntToStr(32&n)+a)}return S.GrabMouseInput=function(){var t;1!=n&&((t=S.canvas.canvas).onmouseup=S.mouseup,t.onmousedown=S.mousedown,t.onmousemove=S.mousemove,n=!0)},S.UnGrabMouseInput=function(){var t;0!=n&&((t=S.canvas.canvas).onmousemove=null,t.onmouseup=null,t.onmousedown=null,n=!1)},S.GrabKeyInput=function(){1!=o&&(document.onkeyup=S.handleKeyUp,document.onkeydown=S.handleKeyDown,document.onkeypress=S.handleKeys,o=!0)},S.UnGrabKeyInput=function(){0!=o&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,o=!1)},S.handleKeys=function(t){return S.haltEvent(t)},S.handleKeyUp=function(t){return a(0,t)},S.handleKeyDown=function(t){return a(1,t)},S.haltEvent=function(t){return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),!1},S.mousedblclick=function(t){},S.mousedown=function(t){return S.buttonmask|=1<>8,255&S.width,S.height>>8,255&S.height)+S.DeskRecordServerInit.substring(4),S.recordedData.push(I(2,1,S.DeskRecordServerInit)),S.recordedData.push(I(3,0,atob(S.CanvasId.toDataURL("image/png").split(",")[1]))),!0)},S.StopRecording=function(){if(null!=S.recordedData){var t=S.recordedData;return t.push(I(3,0,"MeshCentralMCREC")),delete S.recordedData,delete S.recordedStart,delete S.recordedSize,t}},S}