2020-09-07 23:18:46 -04:00
|
|
|
var CreateAmtRemoteDesktop=function(a,t){var y={};function b(a){return String.fromCharCode.apply(null,a)}function C(a,t,e,n,o,r,s){var i,c,h,d,v=a[t++],f={},l=0,u=0;if(0==v){if(2==y.bpp)for(d=0;d<s;d++)K(a[t++]+(a[t++]<<8),d);else for(d=0;d<s;d++)k(a[t++],d);D(y.spare,e,n)}else if(1==v){c=a[t++]+(2==y.bpp?a[t++]<<8:0),y.canvas.fillStyle="rgb("+(1==y.bpp?(224&c)+","+((28&c)<<3)+","+x((3&c)<<6):(c>>8&248)+","+(c>>3&252)+","+((31&c)<<3))+")";var g=L(e);n=T(0,n),e=g,y.canvas.fillRect(e,n,o,r)}else if(1<v&&v<17){var p=4,m=15;if(2==y.bpp){for(d=0;d<v;d++)f[d]=a[t++]+(a[t++]<<8);for(2==v?m=p=1:v<=4&&(p=2,m=3);l<s&&t<a.byteLength;)for(c=a[t++],d=8-p;0<=d;d-=p)K(f[c>>d&m],l++)}else{for(d=0;d<v;d++)f[d]=a[t++];for(2==v?m=p=1:v<=4&&(p=2,m=3);l<s&&t<a.byteLength;)for(c=a[t++],d=8-p;0<=d;d-=p)k(f[c>>d&m],l++)}D(y.spare,e,n)}else if(128==v){if(2==y.bpp)for(;l<s&&t<a.byteLength;){for(c=a[t++]+(a[t++]<<8),u=1;u+=h=a[t++],255==h;);if(0==y.rotation)w(c,l,u),l+=u;else for(;0<=--u;)K(c,l++)}else for(;l<s&&t<a.byteLength;){for(c=a[t++],u=1;u+=h=a[t++],255==h;);if(0==y.rotation)S(c,l,u),l+=u;else for(;0<=--u;)k(c,l++)}D(y.spare,e,n)}else if(129<v){if(2==y.bpp)for(d=0;d<v-128;d++)f[d]=a[t++]+(a[t++]<<8);else for(d=0;d<v-128;d++)f[d]=a[t++];for(;l<s&&t<a.byteLength;){if(u=1,c=f[(i=a[t++])%128],127<i)for(;u+=h=a[t++],255==h;);if(0==y.rotation)(2==y.bpp?w:S)(c,l,u),l+=u;else if(2==y.bpp)for(;0<=--u;)K(c,l++);else for(;0<=--u;)k(c,l++)}D(y.spare,e,n)}}function D(a,t,e){var n,o,r,s,i;1!=y.holding&&(o=t,r=e,n=0==y.rotation?o:1==y.rotation?y.canvas.canvas.width-y.sparew2-r:2==y.rotation?y.canvas.canvas.width-y.sparew2-o:3==y.rotation?r:0,s=t,i=e,e=0==y.rotation?i:1==y.rotation?s:2==y.rotation?y.canvas.canvas.height-y.spareh2-i:3==y.rotation?y.canvas.canvas.height-y.spareh-s:0,t=n,y.canvas.putImageData(a,t,e))}function k(a,t){var e,n,o=t<<2;0<y.rotation&&(1==y.rotation?(e=t%y.sparew,n=Math.floor(t/y.sparew),o=(t=e*y.sparew2+(y.sparew2-1-n))<<2):2==y.rotation?o=y.sparew*y.spareh*4-4-o:3==y.rotation&&(e=t%y.sparew,n=Math.floor(t/y.sparew),o=(t=(y.sparew2-1-e)*y.sparew2+n)<<2)),y.spare.data[o]=224&a,y.spare.data[o+1]=(28&a)<<3,y.spare.data[o+2]=x((3&a)<<6)}function K(a,t){var e,n,o=t<<2;0<y.rotation&&(1==y.rotation?(e=t%y.sparew,n=Math.floor(t/y.sparew),o=(t=e*y.sparew2+(y.sparew2-1-n))<<2):2==y.rotation?o=y.sparew*y.spareh*4-4-o:3==y.rotation&&(e=t%y.sparew,n=Math.floor(t/y.sparew),o=(t=(y.sparew2-1-e)*y.sparew2+n)<<2)),y.spare.data[o]=a>>8&248,y.spare.data[o+1]=a>>3&252,y.spare.data[o+2]=(31&a)<<3}function S(a,t,e){for(var n=t<<2,o=224&a,r=(28&a)<<3,s=x((3&a)<<6);0<=--e;)y.spare.data[n]=o,y.spare.data[n+1]=r,y.spare.data[n+2]=s,n+=4}function w(a,t,e){for(var n=t<<2,o=a>>8&248,r=a>>3&252,s=(31&a)<<3;0<=--e;)y.spare.data[n]=o,y.spare.data[n+1]=r,y.spare.data[n+2]=s,n+=4}function L(a){return 0==y.rotation||1==y.rotation?a:2==y.rotation?a-y.canvas.canvas.width:3==y.rotation?a-y.canvas.canvas.height:0}function T(a,t){return 0==y.rotation?t:1==y.rotation?t-y.canvas.canvas.width:2==y.rotation?t-y.canvas.canvas.height:3==y.rotation?t:0}function x(a){return 127<a?a+32:a}function A(){var a;1!=y.holding&&(0<y.focusmode?(a=2*y.focusmode,y.send(String.fromCharCode(3,1)+ShortToStr(Math.max(Math.min(y.ox,y.mx)-y.focusmode,0))+ShortToStr(Math.max(Math.min(y.oy,y.my)-y.focusmode,0))+ShortToStr(a+Math.abs(y.ox-y.mx))+ShortToStr(a+Math.abs(y.oy-y.my))),y.ox=y.mx,y.oy=y.my):y.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(y.rwidth)+ShortToStr(y.rheight)))}y.canvasid=a,y.CanvasId=Q(a),y.scrolldiv=t,y.canvas=Q(a).getContext("2d"),y.protocol=2,y.state=0,y.acc=null,y.ScreenWidth=960,y.ScreenHeight=700,y.width=0,y.height=0,y.rwidth=0,y.rheight=0,y.bpp=2,y.useZRLE=!0,y.showmouse=!0,y.buttonmask=0,y.localKeyMap=!0,y.spare=null,y.sparew=0,y.spareh=0,y.sparew2=0,y.spareh2=0,y.sparecache={},y.ZRLEfirst=1,y.onScreenSizeChange=null,y.frameRateDelay=0,y.noMouseRotate=!1,y.rotation=0,y.kvmDataSupported=!1,y.onKvmData=null,y.onKvmDataPending=[],y.onKvmDataAck=-1,y.holding=!1,y.lastKeepAlive=Date.now(),y.mNagleTimer=null,y.mx=0,y.my=0,y.ox=-1,y.oy=-1,y.focusmode=0,y.inflate=ZLIB.infla
|