Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(e,t){return new Uint8Array(Array.prototype.slice.call(this,e,t))}});var CreateAgentRemoteDesktop=function(e,t){var l={};"string"==typeof(l.CanvasId=e)&&(l.CanvasId=Q(e)),l.Canvas=l.CanvasId.getContext("2d"),l.scrolldiv=t,l.State=0,l.PendingOperations=[],l.tilesReceived=0,l.TilesDrawn=0,l.KillDraw=0,l.ipad=!1,l.tabletKeyboardVisible=!1,l.LastX=0,l.LastY=0,l.touchenabled=0,l.submenuoffset=0,l.touchtimer=null,l.TouchArray={},l.connectmode=0,l.connectioncount=0,l.rotation=0,l.protocol=2,l.debugmode=0,l.firstUpKeys=[],l.stopInput=!1,l.localKeyMap=!0,l.remoteKeyMap=!1,l.pressedKeys=[],l.sessionid=0,l.username,l.oldie=!1,l.CompressionLevel=50,l.ScalingLevel=1024,l.FrameRateTimer=100,l.SwapMouse=!1,l.FirstDraw=!1,l.onRemoteInputLockChanged=null,l.RemoteInputLock=null,l.ScreenWidth=960,l.ScreenHeight=701,l.width=960,l.height=960,l.displays=null,l.selectedDisplay=null,l.onScreenSizeChange=null,l.onMessage=null,l.onConnectCountChanged=null,l.onDebugMessage=null,l.onTouchEnabledChanged=null,l.onDisplayinfo=null;var h=!(l.accumulator=null),g="default";l.mouseCursorActive=function(e){h!=e&&(h=e,l.CanvasId.style.cursor=1==e?g:"default")};var p=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"];l.Start=function(){l.State=0,l.accumulator=null},l.Stop=function(){l.setRotation(0),l.UnGrabKeyInput(),l.UnGrabMouseInput(),l.touchenabled=0,null!=l.onScreenSizeChange&&l.onScreenSizeChange(l,l.ScreenWidth,l.ScreenHeight,l.CanvasId),l.Canvas.clearRect(0,0,l.CanvasId.width,l.CanvasId.height)},l.xxStateChange=function(e){l.State!=e&&(l.State=e,l.CanvasId.style.cursor="default",0===e&&l.Stop())},l.send=function(e){2>32)+l.intToStr(32&o)):(l.recordedSize+=n.length,l.shortToStr(e)+l.shortToStr(t)+l.intToStr(n.length)+l.intToStr(o>>32)+l.intToStr(32&o)+n)}return l.SendKeyMsg=function(e,t){var n;null!=e&&((t=t||window.event).code&&0==l.localKeyMap?null!=(n=(n=t).code.startsWith("Key")&&4==n.code.length?n.code.charCodeAt(3):n.code.startsWith("Digit")&&6==n.code.length?n.code.charCodeAt(5):n.code.startsWith("Numpad")&&7==n.code.length?n.code.charCodeAt(6)+48:o[n.code])&&l.SendKeyMsgKC(e,n):(59==(n=t.keyCode)?n=186:173==n?n=189:61==n&&(n=187),l.SendKeyMsgKC(e,n)))},l.SendRemoteInputLock=function(e){l.send(String.fromCharCode(0,l.InputType.KEYUNICODE,0,5,e))},l.SendMessage=function(e){3==l.State&&l.send(String.fromCharCode(0,17)+l.shortToStr(4+e.length)+e)},l.SendKeyMsgKC=function(e,t){if(3==l.State)if("object"==typeof e)for(var n in e)l.SendKeyMsgKC(e[n][0],e[n][1]);else 1==e?-1==l.pressedKeys.indexOf(t)&&l.pressedKeys.unshift(t):2==e&&-1!=(n=l.pressedKeys.indexOf(t))&&l.pressedKeys.splice(n,1),0>8),255-(255&Math.abs(r))):(s=r>>8,255&r),String.fromCharCode(0,l.InputType.MOUSE,0,12,0,0,n/256&255,255&n,o/256&255,255&o,s,t)):String.fromCharCode(0,l.InputType.MOUSE,0,10,0,e==l.KeyAction.DOWN?a:2*a&255,n/256&255,255&n,o/256&255,255&o),l.Action==l.KeyAction.NONE?0==l.Alternate||l.ipad?(l.send(i),l.Alternate=1):l.Alternate=0:l.send(i)))},l.GetDisplayNumbers=function(){l.send(String.fromCharCode(0,11,0,4))},l.SetDisplay=function(e){l.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},l.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},l.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},l.onResize=function(){0!=l.ScreenWidth&&0!=l.ScreenHeight&&(l.Canvas.canvas.width==l.ScreenWidth&&l.Canvas.canvas.height==l.ScreenHeight||(l.FirstDraw&&(l.Canvas.canvas.width=l.ScreenWidth,l.Canvas.canvas.height=l.ScreenHeight,l.Canvas.fillRect(0,0,l.ScreenWidth,l.ScreenHeight),null!=l.onScreenSizeChange&&l.onScreenSizeChange(l,l.ScreenWidth,l.ScreenHeight,l.CanvasId)),l.FirstDraw=!1,1