(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204],{8753:function(t,e,s){"use strict";function i(t){return 0|t}s.d(e,{Z:function(){return Sa}});let n="warn",r=()=>{},a=()=>{},h=()=>{},o=()=>{};function l(t,e=!1){try{return decodeURIComponent(escape(t))}catch(Ur){if(Ur instanceof URIError&&e)return t;throw Ur}}function c(t){return unescape(encodeURIComponent(t))}!function(t){if("undefined"===typeof t?t=n:n=t,r=a=h=o=()=>{},"undefined"!==typeof window.console)switch(t){case"debug":r=console.debug.bind(window.console);case"info":a=console.info.bind(window.console);case"warn":h=console.warn.bind(window.console);case"error":o=console.error.bind(window.console);case"none":break;default:throw new window.Error("invalid logging type '"+t+"'")}}();let d="ontouchstart"in document.documentElement||void 0!==document.ontouchstart||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;window.addEventListener("touchstart",(function t(){d=!0,window.removeEventListener("touchstart",t,!1)}),!1);let u=10*(window.devicePixelRatio||1),_=!1;try{const t=document.createElement("canvas");t.style.cursor='url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default',0===t.style.cursor.indexOf("url")?(a("Data URI scheme cursor supported"),_=!0):h("Data URI scheme cursor not supported")}catch(Qa){o("Data URI scheme cursor test exception: "+Qa)}const f=_;let p=!1;try{new ImageData(new Uint8ClampedArray(4),1,1),p=!0}catch(Aa){}const g=p;let m=!0;try{const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t);const e=document.createElement("div");t.appendChild(e);const s=t.offsetWidth-e.offsetWidth;t.parentNode.removeChild(t),m=0!=s}catch(Qa){o("Scrollbar test exception: "+Qa)}function w(){return navigator&&!!/mac/i.exec(navigator.platform)}function b(){return navigator&&!!/win/i.exec(navigator.platform)}function v(){return navigator&&(!!/ipad/i.exec(navigator.platform)||!!/iphone/i.exec(navigator.platform)||!!/ipod/i.exec(navigator.platform))}function k(){return navigator&&!!/trident/i.exec(navigator.userAgent)}function y(){return navigator&&!!/edge/i.exec(navigator.userAgent)}function C(){return navigator&&!!/firefox/i.exec(navigator.userAgent)}function x(t,e,s){const i=s.getBoundingClientRect();let n={x:0,y:0};return t=i.right?n.x=i.width-1:n.x=t-i.left,e=i.bottom?n.y=i.height-1:n.y=e-i.top,n}function S(t){t.stopPropagation(),t.preventDefault()}let Q=!1,A=null;function E(t){if(Q)return;const e=new t.constructor(t.type,t);Q=!0,document.captureElement?document.captureElement.dispatchEvent(e):A.dispatchEvent(e),Q=!1,t.stopPropagation(),e.defaultPrevented&&t.preventDefault(),"mouseup"===t.type&&F()}function M(){document.getElementById("noVNC_mouse_capture_elem").style.cursor=window.getComputedStyle(document.captureElement).cursor}document.captureElement=null;const T=new MutationObserver(M);function F(){if(document.releaseCapture)document.releaseCapture(),document.captureElement=null;else{if(!document.captureElement)return;A=document.captureElement,document.captureElement=null,T.disconnect();document.getElementById("noVNC_mouse_capture_elem").style.display="none",window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",E)}}var L={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),base64Pad:"=",encode(t){let e="";const s=t.length,i=s%3;for(let r=0;r>2],e+=this.toBase64Table[((3&t[r])<<4)+(t[r+1]>>4)],e+=this.toBase64Table[((15&t[r+1])<<2)+(t[r+2]>>6)],e+=this.toBase64Table[63&t[r+2]];const n=s-i;return 2===i?(e+=this.toBase64Table[t[n]>>2],e+=this.toBase64Table[((3&t[n])<<4)+(t[n+1]>>4)],e+=this.toBase64Table[(15&t[n+1])<<2],e+=this.toBase64Table[64]):1===i&&(e+=this.toBase64Table[t[n]>>2],e+=this.toBase64Table[(3&t[n])<<4],e+=this.toBase64Table[64],e+=this.toBase64Table[64]),e},toBinaryTable:[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],decode(t,e=0){let s=t.indexOf("=")-e;s<0&&(s=t.length-e);const i=3*(s>>2)+Math.floor(s%4/1.5),n=new Array(i);let r=0,a=0;for(let h=0,l=e;l=8&&(r-=8,s||(n[h++]=a>>r&255),a&=(1<> Display.constructor"),this._target=t,!this._target)throw new Error("Target must be set");if("string"===typeof this._target)throw new Error("target must be a DOM element");if(!this._target.getContext)throw new Error("no getContext method");if(this._targetCtx=this._target.getContext("2d"),this._viewportLoc={x:0,y:0,w:this._target.width,h:this._target.height},this._backbuffer=document.createElement("canvas"),this._drawCtx=this._backbuffer.getContext("2d"),this._damageBounds={left:0,top:0,right:this._backbuffer.width,bottom:this._backbuffer.height},r("User Agent: "+navigator.userAgent),!("createImageData"in this._drawCtx))throw new Error("Canvas does not support createImageData");this._tile16x16=this._drawCtx.createImageData(16,16),r("<< Display.constructor"),this._scale=1,this._clipViewport=!1,this.onflush=()=>{}}get scale(){return this._scale}set scale(t){this._rescale(t)}get clipViewport(){return this._clipViewport}set clipViewport(t){this._clipViewport=t;const e=this._viewportLoc;this.viewportChangeSize(e.w,e.h),this.viewportChangePos(0,0)}get width(){return this._fbWidth}get height(){return this._fbHeight}viewportChangePos(t,e){const s=this._viewportLoc;t=Math.floor(t),e=Math.floor(e),this._clipViewport||(t=-s.w,e=-s.h);const i=s.x+s.w-1,n=s.y+s.h-1;t<0&&s.x+t<0&&(t=-s.x),i+t>=this._fbWidth&&(t-=i+t-this._fbWidth+1),s.y+e<0&&(e=-s.y),n+e>=this._fbHeight&&(e-=n+e-this._fbHeight+1),0===t&&0===e||(r("viewportChange deltaX: "+t+", deltaY: "+e),s.x+=t,s.y+=e,this._damage(s.x,s.y,s.w,s.h),this.flip())}viewportChangeSize(t,e){this._clipViewport&&"undefined"!==typeof t&&"undefined"!==typeof e||(r("Setting viewport to full display region"),t=this._fbWidth,e=this._fbHeight),t=Math.floor(t),e=Math.floor(e),t>this._fbWidth&&(t=this._fbWidth),e>this._fbHeight&&(e=this._fbHeight);const s=this._viewportLoc;if(s.w!==t||s.h!==e){s.w=t,s.h=e;const i=this._target;i.width=t,i.height=e,this.viewportChangePos(0,0),this._damage(s.x,s.y,s.w,s.h),this.flip(),this._rescale(this._scale)}}absX(t){return 0===this._scale?0:i(t/this._scale+this._viewportLoc.x)}absY(t){return 0===this._scale?0:i(t/this._scale+this._viewportLoc.y)}resize(t,e){this._prevDrawStyle="",this._fbWidth=t,this._fbHeight=e;const s=this._backbuffer;if(s.width!==t||s.height!==e){let i=null;s.width>0&&s.height>0&&(i=this._drawCtx.getImageData(0,0,s.width,s.height)),s.width!==t&&(s.width=t),s.height!==e&&(s.height=e),i&&this._drawCtx.putImageData(i,0,0)}const i=this._viewportLoc;this.viewportChangeSize(i.w,i.h),this.viewportChangePos(0,0)}_damage(t,e,s,i){tthis._damageBounds.right&&(this._damageBounds.right=t+s),e+i>this._damageBounds.bottom&&(this._damageBounds.bottom=e+i)}flip(t){if(0===this._renderQ.length||t){let t=this._damageBounds.left,e=this._damageBounds.top,s=this._damageBounds.right-t,i=this._damageBounds.bottom-e,n=t-this._viewportLoc.x,r=e-this._viewportLoc.y;n<0&&(s+=n,t-=n,n=0),r<0&&(i+=r,e-=r,r=0),n+s>this._viewportLoc.w&&(s=this._viewportLoc.w-n),r+i>this._viewportLoc.h&&(i=this._viewportLoc.h-r),s>0&&i>0&&this._targetCtx.drawImage(this._backbuffer,t,e,s,i,n,r,s,i),this._damageBounds.left=this._damageBounds.top=65535,this._damageBounds.right=this._damageBounds.bottom=0}else this._renderQPush({type:"flip"})}pending(){return this._renderQ.length>0}flush(){0===this._renderQ.length?this.onflush():this._flushing=!0}fillRect(t,e,s,i,n,r){0===this._renderQ.length||r?(this._setFillColor(n),this._drawCtx.fillRect(t,e,s,i),this._damage(t,e,s,i)):this._renderQPush({type:"fill",x:t,y:e,width:s,height:i,color:n})}copyImage(t,e,s,i,n,r,a){0===this._renderQ.length||a?(this._drawCtx.mozImageSmoothingEnabled=!1,this._drawCtx.webkitImageSmoothingEnabled=!1,this._drawCtx.msImageSmoothingEnabled=!1,this._drawCtx.imageSmoothingEnabled=!1,this._drawCtx.drawImage(this._backbuffer,t,e,n,r,s,i,n,r),this._damage(s,i,n,r)):this._renderQPush({type:"copy",oldX:t,oldY:e,x:s,y:i,width:n,height:r})}imageRect(t,e,s,i,n,r){if(0===s||0===i)return;const a=new Image;a.src="data: "+n+";base64,"+L.encode(r),this._renderQPush({type:"img",img:a,x:t,y:e,width:s,height:i})}startTile(t,e,s,i,n){this._tileX=t,this._tileY=e,this._tile=16===s&&16===i?this._tile16x16:this._drawCtx.createImageData(s,i);const r=n[2],a=n[1],h=n[0],o=this._tile.data;for(let l=0;l=n?t/i.w:e/i.h}this._rescale(s)}_rescale(t){this._scale=t;const e=this._viewportLoc,s=t*e.w+"px",i=t*e.h+"px";this._target.style.width===s&&this._target.style.height===i||(this._target.style.width=s,this._target.style.height=i)}_setFillColor(t){const e="rgb("+t[2]+","+t[1]+","+t[0]+")";e!==this._prevDrawStyle&&(this._drawCtx.fillStyle=e,this._prevDrawStyle=e)}_rgbImageData(t,e,s,i,n,r){const a=this._drawCtx.createImageData(s,i),h=a.data;for(let o=0,l=r;o0;){const e=this._renderQ[0];switch(e.type){case"flip":this.flip(!0);break;case"copy":this.copyImage(e.oldX,e.oldY,e.x,e.y,e.width,e.height,!0);break;case"fill":this.fillRect(e.x,e.y,e.width,e.height,e.color,!0);break;case"blit":this.blitImage(e.x,e.y,e.width,e.height,e.data,0,!0);break;case"blitRgb":this.blitRgbImage(e.x,e.y,e.width,e.height,e.data,0,!0);break;case"blitRgbx":this.blitRgbxImage(e.x,e.y,e.width,e.height,e.data,0,!0);break;case"img":if(e.img.complete&&0!==e.img.width&&0!==e.img.height){if(e.img.width!==e.width||e.img.height!==e.height)return void o("Decoded image has incorrect dimensions. Got "+e.img.width+"x"+e.img.height+". Expected "+e.width+"x"+e.height+".");this.drawImage(e.img,e.x,e.y)}else e.img._noVNCDisplay=this,e.img.addEventListener("load",this._resumeRenderQ),t=!1}t&&this._renderQ.shift()}0===this._renderQ.length&&this._flushing&&(this._flushing=!1,this.onflush())}}function B(t,e,s,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(s,s+i),n);else for(var r=0;r>>16&65535|0,a=0;0!==s;){s-=a=s>2e3?2e3:s;do{r=r+(n=n+e[i++]|0)|0}while(--a);n%=65521,r%=65521}return n|r<<16|0}function N(){for(var t,e=[],s=0;s<256;s++){t=s;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[s]=t}return e}N();function P(t,e){var s,i,n,r,a,h,o,l,c,d,u,_,f,p,g,m,w,b,v,k,y,C,x,S,Q;s=t.state,i=t.next_in,S=t.input,n=i+(t.avail_in-5),r=t.next_out,Q=t.output,a=r-(e-t.avail_out),h=r+(t.avail_out-257),o=s.dmax,l=s.wsize,c=s.whave,d=s.wnext,u=s.window,_=s.hold,f=s.bits,p=s.lencode,g=s.distcode,m=(1<>>=v=b>>>24,f-=v,0===(v=b>>>16&255))Q[r++]=65535&b;else{if(!(16&v)){if(0===(64&v)){b=p[(65535&b)+(_&(1<>>=v,f-=v),f<15&&(_+=S[i++]<>>=v=b>>>24,f-=v,!(16&(v=b>>>16&255))){if(0===(64&v)){b=g[(65535&b)+(_&(1<o){t.msg="invalid distance too far back",s.mode=30;break t}if(_>>>=v,f-=v,y>(v=r-a)){if((v=y-v)>c&&s.sane){t.msg="invalid distance too far back",s.mode=30;break t}if(C=0,x=u,0===d){if(C+=l-v,v2;)Q[r++]=x[C++],Q[r++]=x[C++],Q[r++]=x[C++],k-=3;k&&(Q[r++]=x[C++],k>1&&(Q[r++]=x[C++]))}else{C=r-y;do{Q[r++]=Q[C++],Q[r++]=Q[C++],Q[r++]=Q[C++],k-=3}while(k>2);k&&(Q[r++]=Q[C++],k>1&&(Q[r++]=Q[C++]))}break}}break}}while(i>3,_&=(1<<(f-=k<<3))-1,t.next_in=i,t.next_out=r,t.avail_in=i=1&&0===T[k];k--);if(y>k&&(y=k),0===k)return n[r++]=20971520,n[r++]=20971520,h.bits=1,0;for(v=1;v0&&(0===t||1!==k))return-1;for(F[1]=0,w=1;w852||2===t&&Q>592)return 1;for(;;){f=w-x,a[b]<_?(p=0,g=a[b]):a[b]>_?(p=L[D+a[b]],g=E[M+a[b]]):(p=96,g=0),o=1<>x)+(l-=o)]=f<<24|p<<16|g|0}while(0!==l);for(o=1<>=1;if(0!==o?(A&=o-1,A+=o):A=0,b++,0===--T[w]){if(w===k)break;w=e[s+a[b]]}if(w>y&&(A&d)!==c){for(0===x&&(x=y),u+=v,S=1<<(C=w-x);C+x852||2===t&&Q>592)return 1;n[c=A&d]=y<<24|C<<16|u-r|0}}return 0!==A&&(n[u+A]=w-x<<24|64<<16|0),h.bits=y,0}const G=-2;var W=12,q=30;function j(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function Z(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U(320),this.work=new U(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function J(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new I(852),e.distcode=e.distdyn=new I(592),e.sane=1,e.back=-1,0):G}(t)):G}function $(t,e){var s,i;return t?(i=new Z,t.state=i,i.window=null,0!==(s=function(t,e){var s,i;return t&&t.state?(i=t.state,e<0?(s=0,e=-e):(s=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?G:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=s,i.wbits=e,J(t))):G}(t,e))&&(t.state=null),s):G}var tt,et,st=!0;function it(t){if(st){var e;for(tt=new I(512),et=new I(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Y(1,t.lens,0,288,tt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Y(2,t.lens,0,32,et,0,t.work,{bits:5}),st=!1}t.lencode=tt,t.lenbits=9,t.distcode=et,t.distbits=5}function nt(t,e,s,i){var n,r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(B(r.window,e,s-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((n=r.wsize-r.wnext)>i&&(n=i),B(r.window,e,s-i,n,r.wnext),(i-=n)?(B(r.window,e,s-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whavethis.chunkSize&&(this.chunkSize=t,this.strm.output=new Uint8Array(this.chunkSize)),this.strm.next_out=0,this.strm.avail_out=t,function(t,e){var s,i,n,r,a,h,o,l,c,d,u,_,f,p,g,m,w,b,v,k,y,C,x,S,Q=0,A=new z(4),E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return G;(s=t.state).mode===W&&(s.mode=13),a=t.next_out,n=t.output,o=t.avail_out,r=t.next_in,i=t.input,h=t.avail_in,l=s.hold,c=s.bits,d=h,u=o,C=0;t:for(;;)switch(s.mode){case 1:if(0===s.wrap){s.mode=13;break}for(;c<16;){if(0===h)break t;h--,l+=i[r++]<>>8&255,s.check=N(s.check),l=0,c=0,s.mode=2;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",s.mode=q;break}if(8!==(15&l)){t.msg="unknown compression method",s.mode=q;break}if(c-=4,y=8+(15&(l>>>=4)),0===s.wbits)s.wbits=y;else if(y>s.wbits){t.msg="invalid window size",s.mode=q;break}s.dmax=1<>8&1),512&s.flags&&(A[0]=255&l,A[1]=l>>>8&255,s.check=N(s.check)),l=0,c=0,s.mode=3;case 3:for(;c<32;){if(0===h)break t;h--,l+=i[r++]<>>8&255,A[2]=l>>>16&255,A[3]=l>>>24&255,s.check=N(s.check)),l=0,c=0,s.mode=4;case 4:for(;c<16;){if(0===h)break t;h--,l+=i[r++]<>8),512&s.flags&&(A[0]=255&l,A[1]=l>>>8&255,s.check=N(s.check)),l=0,c=0,s.mode=5;case 5:if(1024&s.flags){for(;c<16;){if(0===h)break t;h--,l+=i[r++]<>>8&255,s.check=N(s.check)),l=0,c=0}else s.head&&(s.head.extra=null);s.mode=6;case 6:if(1024&s.flags&&((_=s.length)>h&&(_=h),_&&(s.head&&(y=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),B(s.head.extra,i,r,_,y)),512&s.flags&&(s.check=N(s.check)),h-=_,r+=_,s.length-=_),s.length))break t;s.length=0,s.mode=7;case 7:if(2048&s.flags){if(0===h)break t;_=0;do{y=i[r+_++],s.head&&y&&s.length<65536&&(s.head.name+=String.fromCharCode(y))}while(y&&_>9&1,s.head.done=!0),t.adler=s.check=0,s.mode=W;break;case 10:for(;c<32;){if(0===h)break t;h--,l+=i[r++]<>>=7&c,c-=7&c,s.mode=27;break}for(;c<3;){if(0===h)break t;h--,l+=i[r++]<>>=1)){case 0:s.mode=14;break;case 1:if(it(s),s.mode=20,6===e){l>>>=2,c-=2;break t}break;case 2:s.mode=17;break;case 3:t.msg="invalid block type",s.mode=q}l>>>=2,c-=2;break;case 14:for(l>>>=7&c,c-=7&c;c<32;){if(0===h)break t;h--,l+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",s.mode=q;break}if(s.length=65535&l,l=0,c=0,s.mode=15,6===e)break t;case 15:s.mode=16;case 16:if(_=s.length){if(_>h&&(_=h),_>o&&(_=o),0===_)break t;B(n,i,r,_,a),h-=_,r+=_,o-=_,a+=_,s.length-=_;break}s.mode=W;break;case 17:for(;c<14;){if(0===h)break t;h--,l+=i[r++]<>>=5,c-=5,s.ndist=1+(31&l),l>>>=5,c-=5,s.ncode=4+(15&l),l>>>=4,c-=4,s.nlen>286||s.ndist>30){t.msg="too many length or distance symbols",s.mode=q;break}s.have=0,s.mode=18;case 18:for(;s.have>>=3,c-=3}for(;s.have<19;)s.lens[E[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,x={bits:s.lenbits},C=Y(0,s.lens,0,19,s.lencode,0,s.work,x),s.lenbits=x.bits,C){t.msg="invalid code lengths set",s.mode=q;break}s.have=0,s.mode=19;case 19:for(;s.have>>16&255,w=65535&Q,!((g=Q>>>24)<=c);){if(0===h)break t;h--,l+=i[r++]<>>=g,c-=g,s.lens[s.have++]=w;else{if(16===w){for(S=g+2;c>>=g,c-=g,0===s.have){t.msg="invalid bit length repeat",s.mode=q;break}y=s.lens[s.have-1],_=3+(3&l),l>>>=2,c-=2}else if(17===w){for(S=g+3;c>>=g)),l>>>=3,c-=3}else{for(S=g+7;c>>=g)),l>>>=7,c-=7}if(s.have+_>s.nlen+s.ndist){t.msg="invalid bit length repeat",s.mode=q;break}for(;_--;)s.lens[s.have++]=y}}if(s.mode===q)break;if(0===s.lens[256]){t.msg="invalid code -- missing end-of-block",s.mode=q;break}if(s.lenbits=9,x={bits:s.lenbits},C=Y(1,s.lens,0,s.nlen,s.lencode,0,s.work,x),s.lenbits=x.bits,C){t.msg="invalid literal/lengths set",s.mode=q;break}if(s.distbits=6,s.distcode=s.distdyn,x={bits:s.distbits},C=Y(2,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,x),s.distbits=x.bits,C){t.msg="invalid distances set",s.mode=q;break}if(s.mode=20,6===e)break t;case 20:s.mode=21;case 21:if(h>=6&&o>=258){t.next_out=a,t.avail_out=o,t.next_in=r,t.avail_in=h,s.hold=l,s.bits=c,P(t,u),a=t.next_out,n=t.output,o=t.avail_out,r=t.next_in,i=t.input,h=t.avail_in,l=s.hold,c=s.bits,s.mode===W&&(s.back=-1);break}for(s.back=0;m=(Q=s.lencode[l&(1<>>16&255,w=65535&Q,!((g=Q>>>24)<=c);){if(0===h)break t;h--,l+=i[r++]<>b)])>>>16&255,w=65535&Q,!(b+(g=Q>>>24)<=c);){if(0===h)break t;h--,l+=i[r++]<>>=b,c-=b,s.back+=b}if(l>>>=g,c-=g,s.back+=g,s.length=w,0===m){s.mode=26;break}if(32&m){s.back=-1,s.mode=W;break}if(64&m){t.msg="invalid literal/length code",s.mode=q;break}s.extra=15&m,s.mode=22;case 22:if(s.extra){for(S=s.extra;c>>=s.extra,c-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=23;case 23:for(;m=(Q=s.distcode[l&(1<>>16&255,w=65535&Q,!((g=Q>>>24)<=c);){if(0===h)break t;h--,l+=i[r++]<>b)])>>>16&255,w=65535&Q,!(b+(g=Q>>>24)<=c);){if(0===h)break t;h--,l+=i[r++]<>>=b,c-=b,s.back+=b}if(l>>>=g,c-=g,s.back+=g,64&m){t.msg="invalid distance code",s.mode=q;break}s.offset=w,s.extra=15&m,s.mode=24;case 24:if(s.extra){for(S=s.extra;c>>=s.extra,c-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){t.msg="invalid distance too far back",s.mode=q;break}s.mode=25;case 25:if(0===o)break t;if(_=u-o,s.offset>_){if((_=s.offset-_)>s.whave&&s.sane){t.msg="invalid distance too far back",s.mode=q;break}_>s.wnext?(_-=s.wnext,f=s.wsize-_):f=s.wnext-_,_>s.length&&(_=s.length),p=s.window}else p=n,f=a-s.offset,_=s.length;_>o&&(_=o),o-=_,s.length-=_;do{n[a++]=p[f++]}while(--_);0===s.length&&(s.mode=21);break;case 26:if(0===o)break t;n[a++]=s.length,o--,s.mode=21;break;case 27:if(s.wrap){for(;c<32;){if(0===h)break t;h--,l|=i[r++]<=0;)t[e]=0}var ot=256,lt=286,ct=30,dt=15,ut=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],_t=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ft=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],pt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],gt=new Array(576);ht(gt);var mt=new Array(60);ht(mt);var wt=new Array(512);ht(wt);var bt=new Array(256);ht(bt);var vt=new Array(29);ht(vt);var kt,yt,Ct,xt=new Array(ct);function St(t,e,s,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=s,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function Qt(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function At(t){return t<256?wt[t]:wt[256+(t>>>7)]}function Et(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function Mt(t,e,s){t.bi_valid>16-s?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=s-16):(t.bi_buf|=e<>>=1,s<<=1}while(--e>0);return s>>>1}function Lt(t,e,s){var i,n,r=new Array(16),a=0;for(i=1;i<=dt;i++)r[i]=a=a+s[i-1]<<1;for(n=0;n<=e;n++){var h=t[2*n+1];0!==h&&(t[2*n]=Ft(r[h]++,h))}}function Dt(t){var e;for(e=0;e8?Et(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function zt(t,e,s,i){var n=2*e,r=2*s;return t[n]>1;s>=1;s--)Ut(t,r,s);n=o;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Ut(t,r,1),i=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=i,r[2*n]=r[2*s]+r[2*i],t.depth[n]=(t.depth[s]>=t.depth[i]?t.depth[s]:t.depth[i])+1,r[2*s+1]=r[2*i+1]=n,t.heap[1]=n++,Ut(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var s,i,n,r,a,h,o=e.dyn_tree,l=e.max_code,c=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,_=e.stat_desc.extra_base,f=e.stat_desc.max_length,p=0;for(r=0;r<=dt;r++)t.bl_count[r]=0;for(o[2*t.heap[t.heap_max]+1]=0,s=t.heap_max+1;s<573;s++)(r=o[2*o[2*(i=t.heap[s])+1]+1]+1)>f&&(r=f,p++),o[2*i+1]=r,i>l||(t.bl_count[r]++,a=0,i>=_&&(a=u[i-_]),h=o[2*i],t.opt_len+=h*(r+a),d&&(t.static_len+=h*(c[2*i+1]+a)));if(0!==p){do{for(r=f-1;0===t.bl_count[r];)r--;t.bl_count[r]--,t.bl_count[r+1]+=2,t.bl_count[f]--,p-=2}while(p>0);for(r=f;0!==r;r--)for(i=t.bl_count[r];0!==i;)(n=t.heap[--s])>l||(o[2*n+1]!==r&&(t.opt_len+=(r-o[2*n+1])*o[2*n],o[2*n+1]=r),i--)}}(t,e),Lt(r,l,t.bl_count)}function Nt(t,e,s){var i,n,r=-1,a=e[1],h=0,o=7,l=4;for(0===a&&(o=138,l=3),e[2*(s+1)+1]=65535,i=0;i<=s;i++)n=a,a=e[2*(i+1)+1],++h>=7;i=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}function Ot(t,e,s,i){var n,r,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,s=4093624447;for(e=0;e<=31;e++,s>>>=1)if(1&s&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e=3&&0===t.bl_tree[2*pt[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(r=t.static_len+3+7>>>3)<=n&&(n=r)):n=r=s+5,s+4<=n&&-1!==e?Kt(t,e,s,i):4===t.strategy||r===n?(Mt(t,2+(i?1:0),3),It(t,gt,mt)):(Mt(t,4+(i?1:0),3),function(t,e,s,i){var n;for(Mt(t,e-257,5),Mt(t,s-1,5),Mt(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&s,t.last_lit++,0===e?t.dyn_ltree[2*s]++:(t.matches++,e--,t.dyn_ltree[2*(bt[s]+ot+1)]++,t.dyn_dtree[2*At(e)]++),t.last_lit===t.lit_bufsize-1}var Gt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};const Wt=-2;var qt,jt=258,Zt=262,Jt=103,$t=113,te=666;function ee(t,e){return t.msg=Gt[e],e}function se(t){return(t<<1)-(t>4?9:0)}function ie(t){for(var e=t.length;--e>=0;)t[e]=0}function ne(t){var e=t.state,s=e.pending;s>t.avail_out&&(s=t.avail_out),0!==s&&(B(t.output,e.pending_buf,e.pending_out,s,t.next_out),t.next_out+=s,e.pending_out+=s,t.total_out+=s,t.avail_out-=s,e.pending-=s,0===e.pending&&(e.pending_out=0))}function re(t,e){Ot(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ne(t.strm)}function ae(t,e){t.pending_buf[t.pending++]=e}function he(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function oe(t,e,s,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,B(e,t.input,t.next_in,n,s),1===t.state.wrap?t.adler=R(t.adler,e,n,s):2===t.state.wrap&&(t.adler=N(t.adler)),t.next_in+=n,t.total_in+=n,n)}function le(t,e){var s,i,n=t.max_chain_length,r=t.strstart,a=t.prev_length,h=t.nice_match,o=t.strstart>t.w_size-Zt?t.strstart-(t.w_size-Zt):0,l=t.window,c=t.w_mask,d=t.prev,u=t.strstart+jt,_=l[r+a-1],f=l[r+a];t.prev_length>=t.good_match&&(n>>=2),h>t.lookahead&&(h=t.lookahead);do{if(l[(s=e)+a]===f&&l[s+a-1]===_&&l[s]===l[r]&&l[++s]===l[r+1]){r+=2,s++;do{}while(l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&l[++r]===l[++s]&&ra){if(t.match_start=e,a=i,i>=h)break;_=l[r+a-1],f=l[r+a]}}}while((e=d[e&c])>o&&0!==--n);return a<=t.lookahead?a:t.lookahead}function ce(t){var e,s,i,n,r,a=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=a+(a-Zt)){B(t.window,t.window,a,a,0),t.match_start-=a,t.strstart-=a,t.block_start-=a,e=s=t.hash_size;do{i=t.head[--e],t.head[e]=i>=a?i-a:0}while(--s);e=s=a;do{i=t.prev[--e],t.prev[e]=i>=a?i-a:0}while(--s);n+=a}if(0===t.strm.avail_in)break;if(s=oe(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=s,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(i=Yt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=Yt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(a=2,i-=16),n<1||n>9||8!==s||i<8||i>15||e<0||e>9||r<0||r>4)return ee(t,Wt);8===i&&(i=9);var h=new fe;return t.state=h,h.strm=t,h.wrap=a,h.gzhead=null,h.w_bits=i,h.w_size=1<5||e<0)return t?ee(t,Wt):Wt;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===te&&4!==e)return ee(t,0===t.avail_out?-5:Wt);if(i.strm=t,s=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,ae(i,31),ae(i,139),ae(i,8),i.gzhead?(ae(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ae(i,255&i.gzhead.time),ae(i,i.gzhead.time>>8&255),ae(i,i.gzhead.time>>16&255),ae(i,i.gzhead.time>>24&255),ae(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),ae(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(ae(i,255&i.gzhead.extra.length),ae(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=N(t.adler,i.pending_buf,i.pending)),i.gzindex=0,i.status=69):(ae(i,0),ae(i,0),ae(i,0),ae(i,0),ae(i,0),ae(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),ae(i,3),i.status=$t);else{var a=8+(i.w_bits-8<<4)<<8;a|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=$t,he(i,a),0!==i.strstart&&(he(i,t.adler>>>16),he(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(t.adler=N(t.adler,i.pending_buf,i.pending)),ne(t),n=i.pending,i.pending!==i.pending_buf_size));)ae(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=N(t.adler,i.pending_buf,i.pending)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=N(t.adler,i.pending_buf,i.pending)),ne(t),n=i.pending,i.pending===i.pending_buf_size)){r=1;break}r=i.gzindexn&&(t.adler=N(t.adler,i.pending_buf,i.pending)),0===r&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=N(t.adler,i.pending_buf,i.pending)),ne(t),n=i.pending,i.pending===i.pending_buf_size)){r=1;break}r=i.gzindexn&&(t.adler=N(t.adler,i.pending_buf,i.pending)),0===r&&(i.status=Jt)}else i.status=Jt;if(i.status===Jt&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ne(t),i.pending+2<=i.pending_buf_size&&(ae(i,255&t.adler),ae(i,t.adler>>8&255),t.adler=0,i.status=$t)):i.status=$t),0!==i.pending){if(ne(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&se(e)<=se(s)&&4!==e)return ee(t,-5);if(i.status===te&&0!==t.avail_in)return ee(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&i.status!==te){var h=2===i.strategy?function(t,e){for(var s;;){if(0===t.lookahead&&(ce(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,s=Yt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,s&&(re(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(re(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(re(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var s,i,n,r,a=t.window;;){if(t.lookahead<=jt){if(ce(t),t.lookahead<=jt&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=a[n=t.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){r=t.strstart+jt;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(s=Yt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(s=Yt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),s&&(re(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(re(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(re(t,!1),0===t.strm.avail_out)?1:2}(i,e):qt[i.level].func(i,e);if(3!==h&&4!==h||(i.status=te),1===h||3===h)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===h&&(1===e?Xt(i):5!==e&&(Kt(i,0,0,!1),3===e&&(ie(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ne(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(ae(i,255&t.adler),ae(i,t.adler>>8&255),ae(i,t.adler>>16&255),ae(i,t.adler>>24&255),ae(i,255&t.total_in),ae(i,t.total_in>>8&255),ae(i,t.total_in>>16&255),ae(i,t.total_in>>24&255)):(he(i,t.adler>>>16),he(i,65535&t.adler)),ne(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)}qt=[new _e(0,0,0,0,(function(t,e){var s=65535;for(s>t.pending_buf_size-5&&(s=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ce(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+s;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,re(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-Zt&&(re(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(re(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(re(t,!1),t.strm.avail_out),1)})),new _e(4,4,8,4,de),new _e(4,5,16,8,de),new _e(4,6,32,32,de),new _e(4,4,16,16,ue),new _e(8,16,32,32,ue),new _e(8,16,128,128,ue),new _e(8,32,128,256,ue),new _e(32,128,258,1024,ue),new _e(32,258,258,4096,ue)];class we{constructor(){this.strm=new rt,this.chunkSize=102400,this.outputBuffer=new Uint8Array(this.chunkSize),this.windowBits=5,ge(this.strm,this.windowBits)}deflate(t){this.strm.input=t,this.strm.avail_in=this.strm.input.length,this.strm.next_in=0,this.strm.output=this.outputBuffer,this.strm.avail_out=this.chunkSize,this.strm.next_out=0;let e=me(this.strm,3),s=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);if(e<0)throw new Error("zlib deflate failed");if(this.strm.avail_in>0){let t=[s],i=s.length;do{if(this.strm.output=new Uint8Array(this.chunkSize),this.strm.next_out=0,this.strm.avail_out=this.chunkSize,e=me(this.strm,3),e<0)throw new Error("zlib deflate failed");let s=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);i+=s.length,t.push(s)}while(this.strm.avail_in>0);let n=new Uint8Array(i),r=0;for(let e=0;e=32&&t<=255)return t;const e=dr[t];return void 0!==e?e:16777216|t}},_r={8:"Backspace",9:"Tab",10:"NumpadClear",12:"Numpad5",13:"Enter",16:"ShiftLeft",17:"ControlLeft",18:"AltLeft",19:"Pause",20:"CapsLock",21:"Lang1",25:"Lang2",27:"Escape",28:"Convert",29:"NonConvert",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",44:"PrintScreen",45:"Insert",46:"Delete",47:"Help",48:"Digit0",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",91:"MetaLeft",92:"MetaRight",93:"ContextMenu",95:"Sleep",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",108:"NumpadDecimal",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",124:"F13",125:"F14",126:"F15",127:"F16",128:"F17",129:"F18",130:"F19",131:"F20",132:"F21",133:"F22",134:"F23",135:"F24",144:"NumLock",145:"ScrollLock",166:"BrowserBack",167:"BrowserForward",168:"BrowserRefresh",169:"BrowserStop",170:"BrowserSearch",171:"BrowserFavorites",172:"BrowserHome",173:"AudioVolumeMute",174:"AudioVolumeDown",175:"AudioVolumeUp",176:"MediaTrackNext",177:"MediaTrackPrevious",178:"MediaStop",179:"MediaPlayPause",180:"LaunchMail",181:"MediaSelect",182:"LaunchApp1",183:"LaunchApp2",225:"AltRight"},fr={Backspace:"Backspace",AltLeft:"Alt",AltRight:"Alt",CapsLock:"CapsLock",ContextMenu:"ContextMenu",ControlLeft:"Control",ControlRight:"Control",Enter:"Enter",MetaLeft:"Meta",MetaRight:"Meta",ShiftLeft:"Shift",ShiftRight:"Shift",Tab:"Tab",Delete:"Delete",End:"End",Help:"Help",Home:"Home",Insert:"Insert",PageDown:"PageDown",PageUp:"PageUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",ArrowUp:"ArrowUp",NumLock:"NumLock",NumpadBackspace:"Backspace",NumpadClear:"Clear",Escape:"Escape",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F20:"F20",F21:"F21",F22:"F22",F23:"F23",F24:"F24",F25:"F25",F26:"F26",F27:"F27",F28:"F28",F29:"F29",F30:"F30",F31:"F31",F32:"F32",F33:"F33",F34:"F34",F35:"F35",PrintScreen:"PrintScreen",ScrollLock:"ScrollLock",Pause:"Pause",BrowserBack:"BrowserBack",BrowserFavorites:"BrowserFavorites",BrowserForward:"BrowserForward",BrowserHome:"BrowserHome",BrowserRefresh:"BrowserRefresh",BrowserSearch:"BrowserSearch",BrowserStop:"BrowserStop",Eject:"Eject",LaunchApp1:"LaunchMyComputer",LaunchApp2:"LaunchCalendar",LaunchMail:"LaunchMail",MediaPlayPause:"MediaPlay",MediaStop:"MediaStop",MediaTrackNext:"MediaTrackNext",MediaTrackPrevious:"MediaTrackPrevious",Power:"Power",Sleep:"Sleep",AudioVolumeDown:"AudioVolumeDown",AudioVolumeMute:"AudioVolumeMute",AudioVolumeUp:"AudioVolumeUp",WakeUp:"WakeUp"};const pr={};function gr(t,e){if(void 0===e)throw new Error('Undefined keysym for key "'+t+'"');if(t in pr)throw new Error('Duplicate entry for key "'+t+'"');pr[t]=[e,e,e,e]}function mr(t,e,s){if(void 0===e)throw new Error('Undefined keysym for key "'+t+'"');if(void 0===s)throw new Error('Undefined keysym for key "'+t+'"');if(t in pr)throw new Error('Duplicate entry for key "'+t+'"');pr[t]=[e,e,s,e]}function wr(t,e,s){if(void 0===e)throw new Error('Undefined keysym for key "'+t+'"');if(void 0===s)throw new Error('Undefined keysym for key "'+t+'"');if(t in pr)throw new Error('Duplicate entry for key "'+t+'"');pr[t]=[e,e,e,s]}mr("Alt",Mi,Ti),gr("AltGraph",Di),gr("CapsLock",Qi),mr("Control",xi,Si),mr("Meta",Fi,Li),gr("NumLock",cs),gr("ScrollLock",xe),mr("Shift",yi,Ci),wr("Enter",ye,us),gr("Tab",ve),wr(" ",Ri,ds),wr("ArrowDown",qe,ms),wr("ArrowUp",Ge,ps),wr("ArrowLeft",Ye,fs),wr("ArrowRight",We,gs),wr("End",Je,vs),wr("Home",Oe,_s),wr("PageDown",Ze,bs),wr("PageUp",je,ws),gr("Backspace",be),wr("Clear",ke,ks),gr("Copy",Nn),gr("Cut",Pn),wr("Delete",Qe,Cs),wr("Insert",ss,ys),gr("Paste",On),gr("Redo",ns),gr("Undo",is),gr("Cancel",hs),gr("ContextMenu",rs),gr("Escape",Se),gr("Execute",es),gr("Find",as),gr("Help",os),gr("Pause",Ce),gr("Select",$e),gr("ZoomIn",$n),gr("ZoomOut",tr),gr("BrightnessDown",hn),gr("BrightnessUp",an),gr("Eject",Mn),gr("LogOff",Hn),gr("Power",An),gr("PowerOff",yn),gr("PrintScreen",ts),gr("Hibernate",or),gr("Standby",on),gr("WakeUp",En),gr("AllCandidates",Te),gr("Alphanumeric",Ke),gr("CodeInput",Ee),gr("Compose",Ae),gr("Convert",Be),gr("GroupFirst",Ui),gr("GroupLast",Ii),gr("GroupNext",Bi),gr("GroupPrevious",zi),gr("NonConvert",De),gr("PreviousCandidate",Fe),gr("SingleCandidate",Me),gr("HangulMode",sn),gr("HanjaMode",nn),gr("JunjuaMode",rn),gr("Eisu",Xe),gr("Hankaku",Pe),gr("Hiragana",Ue),gr("HiraganaKatakana",Re),gr("KanaMode",He),gr("KanjiMode",Le),gr("Katakana",Ie),gr("Romaji",ze),gr("Zenkaku",Ne),gr("ZenkakuHanaku",Ve),gr("F1",Vs),gr("F2",Hs),gr("F3",Ks),gr("F4",Xs),gr("F5",Os),gr("F6",Ys),gr("F7",Gs),gr("F8",Ws),gr("F9",qs),gr("F10",js),gr("F11",Zs),gr("F12",Js),gr("F13",$s),gr("F14",ti),gr("F15",ei),gr("F16",si),gr("F17",ii),gr("F18",ni),gr("F19",ri),gr("F20",ai),gr("F21",hi),gr("F22",oi),gr("F23",li),gr("F24",ci),gr("F25",di),gr("F26",ui),gr("F27",_i),gr("F28",fi),gr("F29",pi),gr("F30",gi),gr("F31",mi),gr("F32",wi),gr("F33",bi),gr("F34",vi),gr("F35",ki),gr("Close",Rn),gr("MailForward",sr),gr("MailReply",Gn),gr("MailSend",qn),gr("MediaFastForward",nr),gr("MediaPause",Dn),gr("MediaPlay",un),gr("MediaRecord",bn),gr("MediaRewind",In),gr("MediaStop",_n),gr("MediaTrackNext",pn),gr("MediaTrackPrevious",fn),gr("New",Kn),gr("Open",Xn),gr("Print",ts),gr("Save",Wn),gr("SpellCheck",jn),gr("AudioVolumeDown",ln),gr("AudioVolumeUp",dn),gr("AudioVolumeMute",cn),gr("MicrophoneVolumeMute",lr),gr("LaunchApplication1",zn),gr("LaunchApplication2",vn),gr("LaunchCalendar",kn),gr("LaunchMail",mn),gr("LaunchMediaPlayer",Bn),gr("LaunchMusicPlayer",ir),gr("LaunchPhone",Yn),gr("LaunchScreenSaver",Tn),gr("LaunchSpreadsheet",Vn),gr("LaunchWebBrowser",Fn),gr("LaunchWebCam",er),gr("LaunchWordProcessor",Jn),gr("BrowserBack",Cn),gr("BrowserFavorites",Ln),gr("BrowserForward",xn),gr("BrowserHome",gn),gr("BrowserRefresh",Qn),gr("BrowserSearch",wn),gr("BrowserStop",Sn),gr("Dimmer",Un),gr("MediaAudioTrack",hr),gr("RandomToggle",rr),gr("SplitScreenToggle",Zn),gr("Subtitle",ar),gr("VideoModeNext",cr),wr("=",en,xs),wr("+",Pi,Qs),wr("-",Hi,Es),wr("*",Ni,Ss),wr("/",Xi,Ts),wr(".",Ki,Ms),wr(",",Vi,As),wr("0",Oi,Fs),wr("1",Yi,Ls),wr("2",Gi,Ds),wr("3",Wi,Bs),wr("4",qi,zs),wr("5",ji,Us),wr("6",Zi,Is),wr("7",Ji,Rs),wr("8",$i,Ns),wr("9",tn,Ps);var br=pr;function vr(t){if(t.code){switch(t.code){case"OSLeft":return"MetaLeft";case"OSRight":return"MetaRight"}return t.code}if("keypress"!==t.type&&t.keyCode in _r){let e=_r[t.keyCode];if(w()&&"ContextMenu"===e&&(e="MetaRight"),2===t.location)switch(e){case"ShiftLeft":return"ShiftRight";case"ControlLeft":return"ControlRight";case"AltLeft":return"AltRight"}if(3===t.location)switch(e){case"Delete":return"NumpadDecimal";case"Insert":return"Numpad0";case"End":return"Numpad1";case"ArrowDown":return"Numpad2";case"PageDown":return"Numpad3";case"ArrowLeft":return"Numpad4";case"ArrowRight":return"Numpad6";case"Home":return"Numpad7";case"ArrowUp":return"Numpad8";case"PageUp":return"Numpad9";case"Enter":return"NumpadEnter"}return e}return"Unidentified"}function kr(t){const e=function(t){if(void 0!==t.key){switch(t.key){case"Spacebar":return" ";case"Esc":return"Escape";case"Scroll":return"ScrollLock";case"Win":return"Meta";case"Apps":return"ContextMenu";case"Up":return"ArrowUp";case"Left":return"ArrowLeft";case"Right":return"ArrowRight";case"Down":return"ArrowDown";case"Del":return"Delete";case"Divide":return"/";case"Multiply":return"*";case"Subtract":return"-";case"Add":return"+";case"Decimal":return t.char}switch(t.key){case"OS":return"Meta";case"LaunchMyComputer":return"LaunchApplication1";case"LaunchCalculator":return"LaunchApplication2"}switch(t.key){case"UIKeyInputUpArrow":return"ArrowUp";case"UIKeyInputDownArrow":return"ArrowDown";case"UIKeyInputLeftArrow":return"ArrowLeft";case"UIKeyInputRightArrow":return"ArrowRight";case"UIKeyInputEscape":return"Escape"}if("\0"===t.key&&"NumpadDecimal"===t.code)return"Delete";if(!k()&&!y())return t.key;if(1!==t.key.length&&"Unidentified"!==t.key)return t.key}const e=vr(t);return e in fr?fr[e]:t.charCode?String.fromCharCode(t.charCode):"Unidentified"}(t);if("Unidentified"===e)return null;if(e in br){let s=t.location;if("Meta"===e&&0===s&&(s=2),"Clear"===e&&3===s){"NumLock"===vr(t)&&(s=0)}if((void 0===s||s>3)&&(s=0),"Meta"===e){let e=vr(t);if("AltLeft"===e)return Ai;if("AltRight"===e)return Ei}if("Clear"===e){if("NumLock"===vr(t))return cs}return br[e][s]}if(1!==e.length)return null;const s=e.charCodeAt();return s?ur.lookup(s):null}class yr{constructor(t){this._target=t||null,this._keyDownList={},this._pendingKey=null,this._altGrArmed=!1,this._eventHandlers={keyup:this._handleKeyUp.bind(this),keydown:this._handleKeyDown.bind(this),keypress:this._handleKeyPress.bind(this),blur:this._allKeysUp.bind(this),checkalt:this._checkAlt.bind(this)},this.onkeyevent=()=>{}}_sendKeyEvent(t,e,s){if(s)this._keyDownList[e]=t;else{if(!(e in this._keyDownList))return;delete this._keyDownList[e]}r("onkeyevent "+(s?"down":"up")+", keysym: "+t,", code: "+e),this.onkeyevent(t,e,s)}_getKeyCode(t){const e=vr(t);if("Unidentified"!==e)return e;if(t.keyCode&&"keypress"!==t.type&&229!==t.keyCode)return"Platform"+t.keyCode;if(t.keyIdentifier){if("U+"!==t.keyIdentifier.substr(0,2))return t.keyIdentifier;const e=parseInt(t.keyIdentifier.substr(2),16);return"Platform"+String.fromCharCode(e).toUpperCase().charCodeAt()}return"Unidentified"}_handleKeyDown(t){const e=this._getKeyCode(t);let s=kr(t);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),"AltRight"===e&&t.timeStamp-this._altGrCtrlTime<50?s=Di:this._sendKeyEvent(xi,"ControlLeft",!0)),"Unidentified"===e)return s&&(this._sendKeyEvent(s,e,!0),this._sendKeyEvent(s,e,!1)),void S(t);if(w()||v())switch(s){case Fi:s=Mi;break;case Li:s=Fi;break;case Mi:s=ls;break;case Ti:s=Di}return e in this._keyDownList&&(s=this._keyDownList[e]),(w()||v())&&"CapsLock"===e?(this._sendKeyEvent(Qi,"CapsLock",!0),this._sendKeyEvent(Qi,"CapsLock",!1),void S(t)):s||t.key&&!k()&&!y()?(this._pendingKey=null,S(t),"ControlLeft"===e&&b()&&!("ControlLeft"in this._keyDownList)?(this._altGrArmed=!0,this._altGrTimeout=setTimeout(this._handleAltGrTimeout.bind(this),100),void(this._altGrCtrlTime=t.timeStamp)):void this._sendKeyEvent(s,e,!0)):(this._pendingKey=e,void setTimeout(this._handleKeyPressTimeout.bind(this),10,t))}_handleKeyPress(t){if(S(t),null===this._pendingKey)return;let e=this._getKeyCode(t);const s=kr(t);"Unidentified"!==e&&e!=this._pendingKey||(e=this._pendingKey,this._pendingKey=null,s?this._sendKeyEvent(s,e,!0):a("keypress with no keysym:",t))}_handleKeyPressTimeout(t){if(null===this._pendingKey)return;let e;const s=this._pendingKey;if(this._pendingKey=null,t.keyCode>=48&&t.keyCode<=57)e=t.keyCode;else if(t.keyCode>=65&&t.keyCode<=90){let s=String.fromCharCode(t.keyCode);s=t.shiftKey?s.toUpperCase():s.toLowerCase(),e=s.charCodeAt()}else e=0;this._sendKeyEvent(e,s,!0)}_handleKeyUp(t){S(t);const e=this._getKeyCode(t);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(xi,"ControlLeft",!0)),(w()||v())&&"CapsLock"===e)return this._sendKeyEvent(Qi,"CapsLock",!0),void this._sendKeyEvent(Qi,"CapsLock",!1);this._sendKeyEvent(this._keyDownList[e],e,!1),!b()||"ShiftLeft"!==e&&"ShiftRight"!==e||("ShiftRight"in this._keyDownList&&this._sendKeyEvent(this._keyDownList.ShiftRight,"ShiftRight",!1),"ShiftLeft"in this._keyDownList&&this._sendKeyEvent(this._keyDownList.ShiftLeft,"ShiftLeft",!1))}_handleAltGrTimeout(){this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(xi,"ControlLeft",!0)}_allKeysUp(){r(">> Keyboard.allKeysUp");for(let t in this._keyDownList)this._sendKeyEvent(this._keyDownList[t],t,!1);r("<< Keyboard.allKeysUp")}_checkAlt(t){if(t.skipCheckAlt)return;if(t.altKey)return;const e=this._target,s=this._keyDownList;["AltLeft","AltRight"].forEach((t=>{if(!(t in s))return;const i=new KeyboardEvent("keyup",{key:s[t],code:t});i.skipCheckAlt=!0,e.dispatchEvent(i)}))}grab(){if(this._target.addEventListener("keydown",this._eventHandlers.keydown),this._target.addEventListener("keyup",this._eventHandlers.keyup),this._target.addEventListener("keypress",this._eventHandlers.keypress),window.addEventListener("blur",this._eventHandlers.blur),b()&&C()){const t=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach((e=>document.addEventListener(e,t,{capture:!0,passive:!0})))}}ungrab(){if(b()&&C()){const t=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach((e=>document.removeEventListener(e,t)))}this._target.removeEventListener("keydown",this._eventHandlers.keydown),this._target.removeEventListener("keyup",this._eventHandlers.keyup),this._target.removeEventListener("keypress",this._eventHandlers.keypress),window.removeEventListener("blur",this._eventHandlers.blur),this._allKeysUp()}}const Cr=32,xr=64;class Sr{constructor(){this._target=null,this._state=127,this._tracked=[],this._ignored=[],this._waitingRelease=!1,this._releaseStart=0,this._longpressTimeoutId=null,this._twoTouchTimeoutId=null,this._boundEventHandler=this._eventHandler.bind(this)}attach(t){this.detach(),this._target=t,this._target.addEventListener("touchstart",this._boundEventHandler),this._target.addEventListener("touchmove",this._boundEventHandler),this._target.addEventListener("touchend",this._boundEventHandler),this._target.addEventListener("touchcancel",this._boundEventHandler)}detach(){this._target&&(this._stopLongpressTimeout(),this._stopTwoTouchTimeout(),this._target.removeEventListener("touchstart",this._boundEventHandler),this._target.removeEventListener("touchmove",this._boundEventHandler),this._target.removeEventListener("touchend",this._boundEventHandler),this._target.removeEventListener("touchcancel",this._boundEventHandler),this._target=null)}_eventHandler(t){let e;switch(t.stopPropagation(),t.preventDefault(),t.type){case"touchstart":e=this._touchStart;break;case"touchmove":e=this._touchMove;break;case"touchend":case"touchcancel":e=this._touchEnd}for(let s=0;s0&&Date.now()-this._tracked[0].started>250)return this._state=0,void this._ignored.push(t);if(this._waitingRelease)return this._state=0,void this._ignored.push(t);switch(this._tracked.push({id:t,started:Date.now(),active:!0,firstX:e,firstY:s,lastX:e,lastY:s,angle:0}),this._tracked.length){case 1:this._startLongpressTimeout();break;case 2:this._state&=-26,this._stopLongpressTimeout();break;case 3:this._state&=-99;break;default:this._state=0}}}_touchMove(t,e,s){let i=this._tracked.find((e=>e.id===t));if(void 0===i)return;i.lastX=e,i.lastY=s;let n=e-i.firstX,r=s-i.firstY;if(i.firstX===i.lastX&&i.firstY===i.lastY||(i.angle=180*Math.atan2(r,n)/Math.PI),!this._hasDetectedGesture()){if(Math.hypot(n,r)<50)return;if(this._state&=-24,this._stopLongpressTimeout(),1!==this._tracked.length&&(this._state&=-9),2!==this._tracked.length&&(this._state&=-97),2===this._tracked.length){let e=this._tracked.find((e=>e.id!==t));if(Math.hypot(e.firstX-e.lastX,e.firstY-e.lastY)>50){let t=Math.abs(i.angle-e.angle);t=Math.abs((t+180)%360-180),this._state&=t>90?-33:-65,this._isTwoTouchTimeoutRunning()&&this._stopTwoTouchTimeout()}else this._isTwoTouchTimeoutRunning()||this._startTwoTouchTimeout()}if(!this._hasDetectedGesture())return;this._pushEvent("gesturestart")}this._pushEvent("gesturemove")}_touchEnd(t,e,s){if(-1!==this._ignored.indexOf(t))return this._ignored.splice(this._ignored.indexOf(t),1),void(0===this._ignored.length&&0===this._tracked.length&&(this._state=127,this._waitingRelease=!1));if(!this._hasDetectedGesture()&&this._isTwoTouchTimeoutRunning()&&(this._stopTwoTouchTimeout(),this._state=0),!this._hasDetectedGesture()&&(this._state&=-105,this._state&=-17,this._stopLongpressTimeout(),!this._waitingRelease))switch(this._releaseStart=Date.now(),this._waitingRelease=!0,this._tracked.length){case 1:this._state&=-7;break;case 2:this._state&=-6}if(this._waitingRelease){if(Date.now()-this._releaseStart>250&&(this._state=0),this._tracked.some((t=>Date.now()-t.started>1e3))&&(this._state=0),this._tracked.find((e=>e.id===t)).active=!1,this._hasDetectedGesture())this._pushEvent("gesturestart");else if(0!==this._state)return}this._hasDetectedGesture()&&this._pushEvent("gestureend");for(let i=0;it.active))))}_startLongpressTimeout(){this._stopLongpressTimeout(),this._longpressTimeoutId=setTimeout((()=>this._longpressTimeout()),1e3)}_stopLongpressTimeout(){clearTimeout(this._longpressTimeoutId),this._longpressTimeoutId=null}_longpressTimeout(){if(this._hasDetectedGesture())throw new Error("A longpress gesture failed, conflict with a different gesture");this._state=16,this._pushEvent("gesturestart")}_startTwoTouchTimeout(){this._stopTwoTouchTimeout(),this._twoTouchTimeoutId=setTimeout((()=>this._twoTouchTimeout()),50)}_stopTwoTouchTimeout(){clearTimeout(this._twoTouchTimeoutId),this._twoTouchTimeoutId=null}_isTwoTouchTimeoutRunning(){return null!==this._twoTouchTimeoutId}_twoTouchTimeout(){if(0===this._tracked.length)throw new Error("A pinch or two drag gesture failed, no tracked touches");let t=this._getAverageMovement(),e=Math.abs(t.x),s=Math.abs(t.y),i=this._getAverageDistance(),n=Math.abs(Math.hypot(i.first.x,i.first.y)-Math.hypot(i.last.x,i.last.y));this._state=s{this._target&&(e=document.elementFromPoint(t.clientX,t.clientY),this._updateVisibility(e))}),0)}_showCursor(){"hidden"===this._canvas.style.visibility&&(this._canvas.style.visibility="")}_hideCursor(){"hidden"!==this._canvas.style.visibility&&(this._canvas.style.visibility="hidden")}_shouldShowCursor(t){return!!t&&(t===this._target||!!this._target.contains(t)&&"none"===window.getComputedStyle(t).cursor)}_updateVisibility(t){this._captureIsActive()&&(t=document.captureElement),this._shouldShowCursor(t)?this._showCursor():this._hideCursor()}_updatePosition(){this._canvas.style.left=this._position.x+"px",this._canvas.style.top=this._position.y+"px"}_captureIsActive(){return document.captureElement&&document.documentElement.contains(document.captureElement)}}const Er=41943040;class Mr{constructor(){this._websocket=null,this._rQi=0,this._rQlen=0,this._rQbufferSize=4194304,this._rQ=null,this._sQbufferSize=10240,this._sQlen=0,this._sQ=null,this._eventHandlers={message:()=>{},open:()=>{},close:()=>{},error:()=>{}}}get sQ(){return this._sQ}get rQ(){return this._rQ}get rQi(){return this._rQi}set rQi(t){this._rQi=t}get rQlen(){return this._rQlen-this._rQi}rQpeek8(){return this._rQ[this._rQi]}rQskipBytes(t){this._rQi+=t}rQshift8(){return this._rQshift(1)}rQshift16(){return this._rQshift(2)}rQshift32(){return this._rQshift(4)}_rQshift(t){let e=0;for(let s=t-1;s>=0;s--)e+=this._rQ[this._rQi++]<<8*s;return e}rQshiftStr(t){"undefined"===typeof t&&(t=this.rQlen);let e="";for(let s=0;s0&&this._websocket.readyState===WebSocket.OPEN&&(this._websocket.send(this._encodeMessage()),this._sQlen=0)}send(t){this._sQ.set(t,this._sQlen),this._sQlen+=t.length,this.flush()}sendString(t){this.send(t.split("").map((t=>t.charCodeAt(0))))}off(t){this._eventHandlers[t]=()=>{}}on(t,e){this._eventHandlers[t]=e}_allocateBuffers(){this._rQ=new Uint8Array(this._rQbufferSize),this._sQ=new Uint8Array(this._sQbufferSize)}init(){this._allocateBuffers(),this._rQi=0,this._websocket=null}open(t,e){this.init(),this._websocket=new WebSocket(t,e),this._websocket.binaryType="arraybuffer",this._websocket.onmessage=this._recvMessage.bind(this),this._websocket.onopen=()=>{r(">> WebSock.onopen"),this._websocket.protocol&&a("Server choose sub-protocol: "+this._websocket.protocol),this._eventHandlers.open(),r("<< WebSock.onopen")},this._websocket.onclose=t=>{r(">> WebSock.onclose"),this._eventHandlers.close(t),r("<< WebSock.onclose")},this._websocket.onerror=t=>{r(">> WebSock.onerror: "+t),this._eventHandlers.error(t),r("<< WebSock.onerror: "+t)}}close(){this._websocket&&(this._websocket.readyState!==WebSocket.OPEN&&this._websocket.readyState!==WebSocket.CONNECTING||(a("Closing WebSocket connection"),this._websocket.close()),this._websocket.onmessage=()=>{})}_encodeMessage(){return new Uint8Array(this._sQ.buffer,0,this._sQlen)}_expandCompactRQ(t){const e=8*(this._rQlen-this._rQi+t),s=this._rQbufferSizeEr&&(this._rQbufferSize=Er,this._rQbufferSize-this.rQlenthis._rQbufferSize-this._rQlen&&this._expandCompactRQ(e.length),this._rQ.set(e,this._rQlen),this._rQlen+=e.length}_recvMessage(t){this._DecodeMessage(t.data),this.rQlen>0?(this._eventHandlers.message(),this._rQlen==this._rQi&&(this._rQlen=0,this._rQi=0)):r("Ignoring empty message")}}const Tr=[13,16,10,23,0,4,2,27,14,5,20,9,22,18,11,3,25,7,15,6,26,19,12,1,40,51,30,36,46,54,29,39,50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31],Fr=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28];let Lr,Dr,Br,zr,Ur,Ir;Lr=65536,Dr=1<<24,Br=Lr|Dr,zr=4,Ur=1024,Ir=zr|Ur;const Rr=[Br|Ur,0,0|Lr,Br|Ir,Br|zr,Lr|Ir,0|zr,0|Lr,0|Ur,Br|Ur,Br|Ir,0|Ur,Dr|Ir,Br|zr,0|Dr,0|zr,0|Ir,Dr|Ur,Dr|Ur,Lr|Ur,Lr|Ur,0|Br,0|Br,Dr|Ir,Lr|zr,Dr|zr,Dr|zr,Lr|zr,0,0|Ir,Lr|Ir,0|Dr,0|Lr,Br|Ir,0|zr,0|Br,Br|Ur,0|Dr,0|Dr,0|Ur,Br|zr,0|Lr,Lr|Ur,Dr|zr,0|Ur,0|zr,Dr|Ir,Lr|Ir,Br|Ir,Lr|zr,0|Br,Dr|Ir,Dr|zr,0|Ir,Lr|Ir,Br|Ur,0|Ir,Dr|Ur,Dr|Ur,0,Lr|zr,Lr|Ur,0,Br|zr];Lr=1<<20,Dr=1<<31,Br=Lr|Dr,zr=32,Ur=32768,Ir=zr|Ur;const Nr=[Br|Ir,Dr|Ur,0|Ur,Lr|Ir,0|Lr,0|zr,Br|zr,Dr|Ir,Dr|zr,Br|Ir,Br|Ur,0|Dr,Dr|Ur,0|Lr,0|zr,Br|zr,Lr|Ur,Lr|zr,Dr|Ir,0,0|Dr,0|Ur,Lr|Ir,0|Br,Lr|zr,Dr|zr,0,Lr|Ur,0|Ir,Br|Ur,0|Br,0|Ir,0,Lr|Ir,Br|zr,0|Lr,Dr|Ir,0|Br,Br|Ur,0|Ur,0|Br,Dr|Ur,0|zr,Br|Ir,Lr|Ir,0|zr,0|Ur,0|Dr,0|Ir,Br|Ur,0|Lr,Dr|zr,Lr|zr,Dr|Ir,Dr|zr,Lr|zr,Lr|Ur,0,Dr|Ur,0|Ir,0|Dr,Br|zr,Br|Ir,Lr|Ur];Lr=1<<17,Dr=1<<27,Br=Lr|Dr,zr=8,Ur=512,Ir=zr|Ur;const Pr=[0|Ir,Br|Ur,0,Br|zr,Dr|Ur,0,Lr|Ir,Dr|Ur,Lr|zr,Dr|zr,Dr|zr,0|Lr,Br|Ir,Lr|zr,0|Br,0|Ir,0|Dr,0|zr,Br|Ur,0|Ur,Lr|Ur,0|Br,Br|zr,Lr|Ir,Dr|Ir,Lr|Ur,0|Lr,Dr|Ir,0|zr,Br|Ir,0|Ur,0|Dr,Br|Ur,0|Dr,Lr|zr,0|Ir,0|Lr,Br|Ur,Dr|Ur,0,0|Ur,Lr|zr,Br|Ir,Dr|Ur,Dr|zr,0|Ur,0,Br|zr,Dr|Ir,0|Lr,0|Dr,Br|Ir,0|zr,Lr|Ir,Lr|Ur,Dr|zr,0|Br,Dr|Ir,0|Ir,0|Br,Lr|Ir,0|zr,Br|zr,Lr|Ur];Lr=8192,Dr=1<<23,Br=Lr|Dr,zr=1,Ur=128,Ir=zr|Ur;const Vr=[Br|zr,Lr|Ir,Lr|Ir,0|Ur,Br|Ur,Dr|Ir,Dr|zr,Lr|zr,0,0|Br,0|Br,Br|Ir,0|Ir,0,Dr|Ur,Dr|zr,0|zr,0|Lr,0|Dr,Br|zr,0|Ur,0|Dr,Lr|zr,Lr|Ur,Dr|Ir,0|zr,Lr|Ur,Dr|Ur,0|Lr,Br|Ur,Br|Ir,0|Ir,Dr|Ur,Dr|zr,0|Br,Br|Ir,0|Ir,0,0,0|Br,Lr|Ur,Dr|Ur,Dr|Ir,0|zr,Br|zr,Lr|Ir,Lr|Ir,0|Ur,Br|Ir,0|Ir,0|zr,0|Lr,Dr|zr,Lr|zr,Br|Ur,Dr|Ir,Lr|zr,Lr|Ur,0|Dr,Br|zr,0|Ur,0|Dr,0|Lr,Br|Ur];Lr=1<<25,Dr=1<<30,Br=Lr|Dr,zr=256,Ur=1<<19,Ir=zr|Ur;const Hr=[0|zr,Lr|Ir,Lr|Ur,Br|zr,0|Ur,0|zr,0|Dr,Lr|Ur,Dr|Ir,0|Ur,Lr|zr,Dr|Ir,Br|zr,Br|Ur,0|Ir,0|Dr,0|Lr,Dr|Ur,Dr|Ur,0,Dr|zr,Br|Ir,Br|Ir,Lr|zr,Br|Ur,Dr|zr,0,0|Br,Lr|Ir,0|Lr,0|Br,0|Ir,0|Ur,Br|zr,0|zr,0|Lr,0|Dr,Lr|Ur,Br|zr,Dr|Ir,Lr|zr,0|Dr,Br|Ur,Lr|Ir,Dr|Ir,0|zr,0|Lr,Br|Ur,Br|Ir,0|Ir,0|Br,Br|Ir,Lr|Ur,0,Dr|Ur,0|Br,0|Ir,Lr|zr,Dr|zr,0|Ur,0,Dr|Ur,Lr|Ir,Dr|zr];Lr=1<<22,Dr=1<<29,Br=Lr|Dr,zr=16,Ur=16384,Ir=zr|Ur;const Kr=[Dr|zr,0|Br,0|Ur,Br|Ir,0|Br,0|zr,Br|Ir,0|Lr,Dr|Ur,Lr|Ir,0|Lr,Dr|zr,Lr|zr,Dr|Ur,0|Dr,0|Ir,0,Lr|zr,Dr|Ir,0|Ur,Lr|Ur,Dr|Ir,0|zr,Br|zr,Br|zr,0,Lr|Ir,Br|Ur,0|Ir,Lr|Ur,Br|Ur,0|Dr,Dr|Ur,0|zr,Br|zr,Lr|Ur,Br|Ir,0|Lr,0|Ir,Dr|zr,0|Lr,Dr|Ur,0|Dr,0|Ir,Dr|zr,Br|Ir,Lr|Ur,0|Br,Lr|Ir,Br|Ur,0,Br|zr,0|zr,0|Ur,0|Br,Lr|Ir,0|Ur,Lr|zr,Dr|Ir,0,Br|Ur,0|Dr,Lr|zr,Dr|Ir];Lr=1<<21,Dr=1<<26,Br=Lr|Dr,zr=2,Ur=2048,Ir=zr|Ur;const Xr=[0|Lr,Br|zr,Dr|Ir,0,0|Ur,Dr|Ir,Lr|Ir,Br|Ur,Br|Ir,0|Lr,0,Dr|zr,0|zr,0|Dr,Br|zr,0|Ir,Dr|Ur,Lr|Ir,Lr|zr,Dr|Ur,Dr|zr,0|Br,Br|Ur,Lr|zr,0|Br,0|Ur,0|Ir,Br|Ir,Lr|Ur,0|zr,0|Dr,Lr|Ur,0|Dr,Lr|Ur,0|Lr,Dr|Ir,Dr|Ir,Br|zr,Br|zr,0|zr,Lr|zr,0|Dr,Dr|Ur,0|Lr,Br|Ur,0|Ir,Lr|Ir,Br|Ur,0|Ir,Dr|zr,Br|Ir,0|Br,Lr|Ur,0,0|zr,Br|Ir,0,Lr|Ir,0|Br,0|Ur,Dr|zr,Dr|Ur,0|Ur,Lr|zr];Lr=1<<18,Dr=1<<28,Br=Lr|Dr,zr=64,Ur=4096,Ir=zr|Ur;const Or=[Dr|Ir,0|Ur,0|Lr,Br|Ir,0|Dr,Dr|Ir,0|zr,0|Dr,Lr|zr,0|Br,Br|Ir,Lr|Ur,Br|Ur,Lr|Ir,0|Ur,0|zr,0|Br,Dr|zr,Dr|Ur,0|Ir,Lr|Ur,Lr|zr,Br|zr,Br|Ur,0|Ir,0,0,Br|zr,Dr|zr,Dr|Ur,Lr|Ir,0|Lr,Lr|Ir,0|Lr,Br|Ur,0|Ur,0|zr,Br|zr,0|Ur,Lr|Ir,Dr|Ur,0|zr,Dr|zr,0|Br,Br|zr,0|Dr,0|Lr,Dr|Ir,0,Br|Ir,Lr|zr,Dr|zr,0|Br,Dr|Ur,Dr|Ir,0,Br|Ir,Lr|Ur,Lr|Ur,0|Ir,0|Ir,Lr|zr,0|Dr,Br|Ur];class Yr{constructor(t){this.keys=[];const e=[],s=[],i=[];for(let n=0,r=56;n<56;++n,r-=8){r+=r<-5?65:r<-3?31:r<-1?63:27===r?35:0;const s=7&r;e[n]=0!==(t[r>>>3]&1<>>10,this.keys[a]|=(4032&e)>>>6,++a,this.keys[a]=(258048&t)<<12,this.keys[a]|=(63&t)<<16,this.keys[a]|=(258048&e)>>>4,this.keys[a]|=63&e,++a}}enc8(t){const e=t.slice();let s,i,n,r=0;s=e[r++]<<24|e[r++]<<16|e[r++]<<8|e[r++],i=e[r++]<<24|e[r++]<<16|e[r++]<<8|e[r++],n=252645135&(s>>>4^i),i^=n,s^=n<<4,n=65535&(s>>>16^i),i^=n,s^=n<<16,n=858993459&(i>>>2^s),s^=n,i^=n<<2,n=16711935&(i>>>8^s),s^=n,i^=n<<8,i=i<<1|i>>>31&1,n=2863311530&(s^i),s^=n,i^=n,s=s<<1|s>>>31&1;for(let a=0,h=0;a<8;++a){n=i<<28|i>>>4,n^=this.keys[h++];let t=Xr[63&n];t|=Hr[n>>>8&63],t|=Pr[n>>>16&63],t|=Rr[n>>>24&63],n=i^this.keys[h++],t|=Or[63&n],t|=Kr[n>>>8&63],t|=Vr[n>>>16&63],t|=Nr[n>>>24&63],s^=t,n=s<<28|s>>>4,n^=this.keys[h++],t=Xr[63&n],t|=Hr[n>>>8&63],t|=Pr[n>>>16&63],t|=Rr[n>>>24&63],n=s^this.keys[h++],t|=Or[63&n],t|=Kr[n>>>8&63],t|=Vr[n>>>16&63],t|=Nr[n>>>24&63],i^=t}for(i=i<<31|i>>>1,n=2863311530&(s^i),s^=n,i^=n,s=s<<31|s>>>1,n=16711935&(s>>>8^i),i^=n,s^=n<<8,n=858993459&(s>>>2^i),i^=n,s^=n<<2,n=65535&(i>>>16^s),s^=n,i^=n<<16,n=252645135&(i>>>4^s),s^=n,i^=n<<4,n=[i,s],r=0;r<8;r++)e[r]=(n[r>>>2]>>>8*(3-r%4))%256,e[r]<0&&(e[r]+=256);return e}encrypt(t){return this.enc8(t.slice(0,8)).concat(this.enc8(t.slice(8,16)))}}var Gr={Again:57349,AltLeft:56,AltRight:57400,ArrowDown:57424,ArrowLeft:57419,ArrowRight:57421,ArrowUp:57416,AudioVolumeDown:57390,AudioVolumeMute:57376,AudioVolumeUp:57392,Backquote:41,Backslash:43,Backspace:14,BracketLeft:26,BracketRight:27,BrowserBack:57450,BrowserFavorites:57446,BrowserForward:57449,BrowserHome:57394,BrowserRefresh:57447,BrowserSearch:57445,BrowserStop:57448,CapsLock:58,Comma:51,ContextMenu:57437,ControlLeft:29,ControlRight:57373,Convert:121,Copy:57464,Cut:57404,Delete:57427,Digit0:11,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Eject:57469,End:57423,Enter:28,Equal:13,Escape:1,F1:59,F10:68,F11:87,F12:88,F13:93,F14:94,F15:95,F16:85,F17:57347,F18:57463,F19:57348,F2:60,F20:90,F21:116,F22:57465,F23:109,F24:111,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,Find:57409,Help:57461,Hiragana:119,Home:57415,Insert:57426,IntlBackslash:86,IntlRo:115,IntlYen:125,KanaMode:112,Katakana:120,KeyA:30,KeyB:48,KeyC:46,KeyD:32,KeyE:18,KeyF:33,KeyG:34,KeyH:35,KeyI:23,KeyJ:36,KeyK:37,KeyL:38,KeyM:50,KeyN:49,KeyO:24,KeyP:25,KeyQ:16,KeyR:19,KeyS:31,KeyT:20,KeyU:22,KeyV:47,KeyW:17,KeyX:45,KeyY:21,KeyZ:44,Lang3:120,Lang4:119,Lang5:118,LaunchApp1:57451,LaunchApp2:57377,LaunchMail:57452,MediaPlayPause:57378,MediaSelect:57453,MediaStop:57380,MediaTrackNext:57369,MediaTrackPrevious:57360,MetaLeft:57435,MetaRight:57436,Minus:12,NonConvert:123,NumLock:69,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadAdd:78,NumpadComma:126,NumpadDecimal:83,NumpadDivide:57397,NumpadEnter:57372,NumpadEqual:89,NumpadMultiply:55,NumpadParenLeft:57462,NumpadParenRight:57467,NumpadSubtract:74,Open:100,PageDown:57425,PageUp:57417,Paste:101,Pause:57414,Period:52,Power:57438,PrintScreen:84,Props:57350,Quote:40,ScrollLock:70,Semicolon:39,ShiftLeft:42,ShiftRight:54,Slash:53,Sleep:57439,Space:57,Suspend:57381,Tab:15,Undo:57351,WakeUp:57443};const Wr=0,qr=1,jr=2,Zr=5,Jr=7,$r=-260,ta=-32,ea=-223,sa=-224,ia=-239,na=-258,ra=-307,aa=-308,ha=-309,oa=-312,la=-313,ca=-256,da=1464686180,ua=3231835598;s(2203);class _a{constructor(){this._lines=0}decodeRect(t,e,s,i,n,r,a){0===this._lines&&(this._lines=i);const h=s*(8==a?1:4);if(n.rQwait("RAW",h))return!1;const o=e+(i-this._lines),l=Math.min(this._lines,Math.floor(n.rQlen/h));let c=n.rQ,d=n.rQi;if(8==a){const t=s*l,e=new Uint8Array(4*t);for(let s=0;s>0&3)/3,e[4*s+1]=255*(c[d+s]>>2&3)/3,e[4*s+2]=255*(c[d+s]>>4&3)/3,e[4*s+4]=0;c=e,d=0}return r.blitImage(t,o,s,l,c,d),n.rQskipBytes(l*h),this._lines-=l,!(this._lines>0)}}class fa{decodeRect(t,e,s,i,n,r,a){if(n.rQwait("COPYRECT",4))return!1;let h=n.rQshift16(),o=n.rQshift16();return r.copyImage(h,o,t,e,s,i),!0}}class pa{constructor(){this._subrects=0}decodeRect(t,e,s,i,n,r,a){if(0===this._subrects){if(n.rQwait("RRE",8))return!1;this._subrects=n.rQshift32();let a=n.rQshiftBytes(4);r.fillRect(t,e,s,i,a)}for(;this._subrects>0;){if(n.rQwait("RRE",12))return!1;let s=n.rQshiftBytes(4),i=n.rQshift16(),a=n.rQshift16(),h=n.rQshift16(),o=n.rQshift16();r.fillRect(t+i,e+a,h,o,s),this._subrects--}return!0}}class ga{constructor(){this._tiles=0,this._lastsubencoding=0}decodeRect(t,e,s,i,n,a,h){for(0===this._tiles&&(this._tilesX=Math.ceil(s/16),this._tilesY=Math.ceil(i/16),this._totalTiles=this._tilesX*this._tilesY,this._tiles=this._totalTiles);this._tiles>0;){let h=1;if(n.rQwait("HEXTILE",h))return!1;let o=n.rQ,l=n.rQi,c=o[l];if(c>30)throw new Error("Illegal hextile subencoding (subencoding: "+c+")");const d=this._totalTiles-this._tiles,u=t+16*(d%this._tilesX),_=e+16*Math.floor(d/this._tilesX),f=Math.min(16,t+s-u),p=Math.min(16,e+i-_);if(1&c)h+=f*p*4;else if(2&c&&(h+=4),4&c&&(h+=4),8&c){if(h++,n.rQwait("HEXTILE",h))return!1;let t=o[l+h-1];h+=16&c?6*t:2*t}if(n.rQwait("HEXTILE",h))return!1;if(l++,0===c)1&this._lastsubencoding?r(" Ignoring blank after RAW"):a.fillRect(u,_,f,p,this._background);else if(1&c)a.blitImage(u,_,f,p,o,l),l+=h-1;else{if(2&c&&(this._background=[o[l],o[l+1],o[l+2],o[l+3]],l+=4),4&c&&(this._foreground=[o[l],o[l+1],o[l+2],o[l+3]],l+=4),a.startTile(u,_,f,p,this._background),8&c){let t=o[l];l++;for(let e=0;e>4,i=15&e,n=o[l];l++;const r=1+(n>>4),h=1+(15&n);a.subTile(s,i,r,h,t)}}a.finishTile()}n.rQi=l,this._lastsubencoding=c,this._tiles--}return!0}}class ma{constructor(){this._ctl=null,this._filter=null,this._numColors=0,this._palette=new Uint8Array(1024),this._len=0,this._zlibs=[];for(let t=0;t<4;t++)this._zlibs[t]=new at}decodeRect(t,e,s,i,n,r,h){if(null===this._ctl){if(n.rQwait("TIGHT compression-control",1))return!1;this._ctl=n.rQshift8();for(let t=0;t<4;t++)this._ctl>>t&1&&(this._zlibs[t].reset(),a("Reset zlib stream "+t));this._ctl=this._ctl>>4}let o;if(8===this._ctl)o=this._fillRect(t,e,s,i,n,r,h);else if(9===this._ctl)o=this._jpegRect(t,e,s,i,n,r,h);else if(10===this._ctl)o=this._pngRect(t,e,s,i,n,r,h);else{if(0!=(128&this._ctl))throw new Error("Illegal tight compression received (ctl: "+this._ctl+")");o=this._basicRect(this._ctl,t,e,s,i,n,r,h)}return o&&(this._ctl=null),o}_fillRect(t,e,s,i,n,r,a){if(n.rQwait("TIGHT",3))return!1;const h=n.rQi,o=n.rQ;return r.fillRect(t,e,s,i,[o[h+2],o[h+1],o[h]],!1),n.rQskipBytes(3),!0}_jpegRect(t,e,s,i,n,r,a){let h=this._readData(n);return null!==h&&(r.imageRect(t,e,s,i,"image/jpeg",h),!0)}_pngRect(t,e,s,i,n,r,a){throw new Error("PNG received in standard Tight rect")}_basicRect(t,e,s,i,n,r,a,h){if(null===this._filter)if(4&t){if(r.rQwait("TIGHT",1))return!1;this._filter=r.rQshift8()}else this._filter=0;let o,l=3&t;switch(this._filter){case 0:o=this._copyFilter(l,e,s,i,n,r,a,h);break;case 1:o=this._paletteFilter(l,e,s,i,n,r,a,h);break;case 2:o=this._gradientFilter(l,e,s,i,n,r,a,h);break;default:throw new Error("Illegal tight filter received (ctl: "+this._filter+")")}return o&&(this._filter=null),o}_copyFilter(t,e,s,i,n,r,a,h){const o=i*n*3;let l;if(o<12){if(r.rQwait("TIGHT",o))return!1;l=r.rQshiftBytes(o)}else{if(l=this._readData(r),null===l)return!1;this._zlibs[t].setInput(l),l=this._zlibs[t].inflate(o),this._zlibs[t].setInput(null)}return a.blitRgbImage(e,s,i,n,l,0,!1),!0}_paletteFilter(t,e,s,i,n,r,a,h){if(0===this._numColors){if(r.rQwait("TIGHT palette",1))return!1;const t=r.rQpeek8()+1,e=3*t;if(r.rQwait("TIGHT palette",1+e))return!1;this._numColors=t,r.rQskipBytes(1),r.rQshiftTo(this._palette,e)}const o=this._numColors<=2?1:8,l=Math.floor((i*o+7)/8)*n;let c;if(l<12){if(r.rQwait("TIGHT",l))return!1;c=r.rQshiftBytes(l)}else{if(c=this._readData(r),null===c)return!1;this._zlibs[t].setInput(c),c=this._zlibs[t].inflate(l),this._zlibs[t].setInput(null)}return 2==this._numColors?this._monoRect(e,s,i,n,c,this._palette,a):this._paletteRect(e,s,i,n,c,this._palette,a),this._numColors=0,!0}_monoRect(t,e,s,i,n,r,a){const h=this._getScratchBuffer(s*i*4),o=Math.floor((s+7)/8),l=Math.floor(s/8);for(let c=0;c=0;a--)t=4*(c*s+8*i+7-a),e=3*(n[c*o+i]>>a&1),h[t]=r[e],h[t+1]=r[e+1],h[t+2]=r[e+2],h[t+3]=255;for(let a=7;a>=8-s%8;a--)t=4*(c*s+8*i+7-a),e=3*(n[c*o+i]>>a&1),h[t]=r[e],h[t+1]=r[e+1],h[t+2]=r[e+2],h[t+3]=255}a.blitRgbxImage(t,e,s,i,h,0,!1)}_paletteRect(t,e,s,i,n,r,a){const h=this._getScratchBuffer(s*i*4),o=s*i*4;for(let l=0,c=0;le.call(this,t))),!t.defaultPrevented)}}{constructor(t,e,s){if(!t)throw new Error("Must specify target");if(!e)throw new Error("Must specify URL");super(),this._target=t,this._url=e,s=s||{},this._rfbCredentials=s.credentials||{},this._shared=!("shared"in s)||!!s.shared,this._repeaterID=s.repeaterID||"",this._wsProtocols=s.wsProtocols||[],this._rfbConnectionState="",this._rfbInitState="",this._rfbAuthScheme=-1,this._rfbCleanDisconnect=!0,this._rfbVersion=0,this._rfbMaxVersion=3.8,this._rfbTightVNC=!1,this._rfbVeNCryptState=0,this._rfbXvpVer=0,this._fbWidth=0,this._fbHeight=0,this._fbName="",this._capabilities={power:!1},this._supportsFence=!1,this._supportsContinuousUpdates=!1,this._enabledContinuousUpdates=!1,this._supportsSetDesktopSize=!1,this._screenID=0,this._screenFlags=0,this._qemuExtKeyEventSupported=!1,this._clipboardText=null,this._clipboardServerCapabilitiesActions={},this._clipboardServerCapabilitiesFormats={},this._sock=null,this._display=null,this._flushing=!1,this._keyboard=null,this._gestures=null,this._disconnTimer=null,this._resizeTimeout=null,this._mouseMoveTimer=null,this._decoders={},this._FBU={rects:0,x:0,y:0,width:0,height:0,encoding:null},this._mousePos={},this._mouseButtonMask=0,this._mouseLastMoveTime=0,this._viewportDragging=!1,this._viewportDragPos={},this._viewportHasMoved=!1,this._accumulatedWheelDeltaX=0,this._accumulatedWheelDeltaY=0,this._gestureLastTapTime=null,this._gestureFirstDoubleTapEv=null,this._gestureLastMagnitudeX=0,this._gestureLastMagnitudeY=0,this._eventHandlers={focusCanvas:this._focusCanvas.bind(this),windowResize:this._windowResize.bind(this),handleMouse:this._handleMouse.bind(this),handleWheel:this._handleWheel.bind(this),handleGesture:this._handleGesture.bind(this)},r(">> RFB.constructor"),this._screen=document.createElement("div"),this._screen.style.display="flex",this._screen.style.width="100%",this._screen.style.height="100%",this._screen.style.overflow="auto",this._screen.style.background="rgb(40, 40, 40)",this._canvas=document.createElement("canvas"),this._canvas.style.margin="auto",this._canvas.style.outline="none",this._canvas.style.flexShrink="0",this._canvas.width=0,this._canvas.height=0,this._canvas.tabIndex=-1,this._screen.appendChild(this._canvas),this._cursor=new Ar,this._cursorImage=Sa.cursors.none,this._decoders[Wr]=new _a,this._decoders[qr]=new fa,this._decoders[jr]=new pa,this._decoders[Zr]=new ga,this._decoders[Jr]=new ma,this._decoders[$r]=new wa;try{this._display=new D(this._canvas)}catch(Qa){throw o("Display exception: "+Qa),Qa}this._display.onflush=this._onFlush.bind(this),this._keyboard=new yr(this._canvas),this._keyboard.onkeyevent=this._handleKeyEvent.bind(this),this._gestures=new Sr,this._sock=new Mr,this._sock.on("message",(()=>{this._handleMessage()})),this._sock.on("open",(()=>{"connecting"===this._rfbConnectionState&&""===this._rfbInitState?(this._rfbInitState="ProtocolVersion",r("Starting VNC handshake")):this._fail("Unexpected server connection while "+this._rfbConnectionState)})),this._sock.on("close",(t=>{r("WebSocket on-close event");let e="";switch(t.code&&(e="(code: "+t.code,t.reason&&(e+=", reason: "+t.reason),e+=")"),this._rfbConnectionState){case"connecting":this._fail("Connection closed "+e);break;case"connected":this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected");break;case"disconnecting":this._updateConnectionState("disconnected");break;case"disconnected":this._fail("Unexpected server disconnect when already disconnected "+e);break;default:this._fail("Unexpected server disconnect before connecting "+e)}this._sock.off("close")})),this._sock.on("error",(t=>h("WebSocket on-error event"))),setTimeout(this._updateConnectionState.bind(this,"connecting")),r("<< RFB.constructor"),this.dragViewport=!1,this.focusOnClick=!0,this._viewOnly=!1,this._clipViewport=!1,this._scaleViewport=!1,this._resizeSession=!1,this._showDotCursor=!1,void 0!==s.showDotCursor&&(h("Specifying showDotCursor as a RFB constructor argument is deprecated"),this._showDotCursor=s.showDotCursor),this._qualityLevel=6,this._compressionLevel=2}get viewOnly(){return this._viewOnly}set viewOnly(t){this._viewOnly=t,"connecting"!==this._rfbConnectionState&&"connected"!==this._rfbConnectionState||(t?this._keyboard.ungrab():this._keyboard.grab())}get capabilities(){return this._capabilities}get touchButton(){return 0}set touchButton(t){h("Using old API!")}get clipViewport(){return this._clipViewport}set clipViewport(t){this._clipViewport=t,this._updateClip()}get scaleViewport(){return this._scaleViewport}set scaleViewport(t){this._scaleViewport=t,t&&this._clipViewport&&this._updateClip(),this._updateScale(),!t&&this._clipViewport&&this._updateClip()}get resizeSession(){return this._resizeSession}set resizeSession(t){this._resizeSession=t,t&&this._requestRemoteResize()}get showDotCursor(){return this._showDotCursor}set showDotCursor(t){this._showDotCursor=t,this._refreshCursor()}get background(){return this._screen.style.background}set background(t){this._screen.style.background=t}get qualityLevel(){return this._qualityLevel}set qualityLevel(t){!Number.isInteger(t)||t<0||t>9?o("qualityLevel must be an integer between 0 and 9"):this._qualityLevel!==t&&(this._qualityLevel=t,"connected"===this._rfbConnectionState&&this._sendEncodings())}get compressionLevel(){return this._compressionLevel}set compressionLevel(t){!Number.isInteger(t)||t<0||t>9?o("compressionLevel must be an integer between 0 and 9"):this._compressionLevel!==t&&(this._compressionLevel=t,"connected"===this._rfbConnectionState&&this._sendEncodings())}disconnect(){this._updateConnectionState("disconnecting"),this._sock.off("error"),this._sock.off("message"),this._sock.off("open")}sendCredentials(t){this._rfbCredentials=t,setTimeout(this._initMsg.bind(this),0)}sendCtrlAltDel(){"connected"!==this._rfbConnectionState||this._viewOnly||(a("Sending Ctrl-Alt-Del"),this.sendKey(xi,"ControlLeft",!0),this.sendKey(Mi,"AltLeft",!0),this.sendKey(Qe,"Delete",!0),this.sendKey(Qe,"Delete",!1),this.sendKey(Mi,"AltLeft",!1),this.sendKey(xi,"ControlLeft",!1))}machineShutdown(){this._xvpOp(1,2)}machineReboot(){this._xvpOp(1,3)}machineReset(){this._xvpOp(1,4)}sendKey(t,e,s){if("connected"!==this._rfbConnectionState||this._viewOnly)return;if(void 0===s)return this.sendKey(t,e,!0),void this.sendKey(t,e,!1);const i=Gr[e];if(this._qemuExtKeyEventSupported&&i)a("Sending key ("+(s?"down":"up")+"): keysym "+(t=t||0)+", scancode "+i),Sa.messages.QEMUExtendedKeyEvent(this._sock,t,s,i);else{if(!t)return;a("Sending keysym ("+(s?"down":"up")+"): "+t),Sa.messages.keyEvent(this._sock,t,s?1:0)}}focus(){this._canvas.focus()}blur(){this._canvas.blur()}clipboardPasteFrom(t){if("connected"===this._rfbConnectionState&&!this._viewOnly)if(this._clipboardServerCapabilitiesFormats[1]&&this._clipboardServerCapabilitiesActions[134217728])this._clipboardText=t,Sa.messages.extendedClipboardNotify(this._sock,[1]);else{let e=new Uint8Array(t.length);for(let s=0;s> RFB.connect"),a("connecting to "+this._url);try{this._sock.open(this._url,this._wsProtocols)}catch(Ur){"SyntaxError"===Ur.name?this._fail("Invalid host or port ("+Ur+")"):this._fail("Error when opening socket ("+Ur+")")}this._target.appendChild(this._screen),this._gestures.attach(this._canvas),this._cursor.attach(this._canvas),this._refreshCursor(),window.addEventListener("resize",this._eventHandlers.windowResize),this._canvas.addEventListener("mousedown",this._eventHandlers.focusCanvas),this._canvas.addEventListener("touchstart",this._eventHandlers.focusCanvas),this._canvas.addEventListener("mousedown",this._eventHandlers.handleMouse),this._canvas.addEventListener("mouseup",this._eventHandlers.handleMouse),this._canvas.addEventListener("mousemove",this._eventHandlers.handleMouse),this._canvas.addEventListener("click",this._eventHandlers.handleMouse),this._canvas.addEventListener("contextmenu",this._eventHandlers.handleMouse),this._canvas.addEventListener("wheel",this._eventHandlers.handleWheel),this._canvas.addEventListener("gesturestart",this._eventHandlers.handleGesture),this._canvas.addEventListener("gesturemove",this._eventHandlers.handleGesture),this._canvas.addEventListener("gestureend",this._eventHandlers.handleGesture),r("<< RFB.connect")}_disconnect(){r(">> RFB.disconnect"),this._cursor.detach(),this._canvas.removeEventListener("gesturestart",this._eventHandlers.handleGesture),this._canvas.removeEventListener("gesturemove",this._eventHandlers.handleGesture),this._canvas.removeEventListener("gestureend",this._eventHandlers.handleGesture),this._canvas.removeEventListener("wheel",this._eventHandlers.handleWheel),this._canvas.removeEventListener("mousedown",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mouseup",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mousemove",this._eventHandlers.handleMouse),this._canvas.removeEventListener("click",this._eventHandlers.handleMouse),this._canvas.removeEventListener("contextmenu",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mousedown",this._eventHandlers.focusCanvas),this._canvas.removeEventListener("touchstart",this._eventHandlers.focusCanvas),window.removeEventListener("resize",this._eventHandlers.windowResize),this._keyboard.ungrab(),this._gestures.detach(),this._sock.close();try{this._target.removeChild(this._screen)}catch(Ur){if("NotFoundError"!==Ur.name)throw Ur}clearTimeout(this._resizeTimeout),clearTimeout(this._mouseMoveTimer),r("<< RFB.disconnect")}_focusCanvas(t){this.focusOnClick&&this.focus()}_setDesktopName(t){this._fbName=t,this.dispatchEvent(new CustomEvent("desktopname",{detail:{name:this._fbName}}))}_windowResize(t){window.requestAnimationFrame((()=>{this._updateClip(),this._updateScale()})),this._resizeSession&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(this._requestRemoteResize.bind(this),500))}_updateClip(){const t=this._display.clipViewport;let e=this._clipViewport;if(this._scaleViewport&&(e=!1),t!==e&&(this._display.clipViewport=e),e){const t=this._screenSize();this._display.viewportChangeSize(t.w,t.h),this._fixScrollbars()}}_updateScale(){if(this._scaleViewport){const t=this._screenSize();this._display.autoscale(t.w,t.h)}else this._display.scale=1;this._fixScrollbars()}_requestRemoteResize(){if(clearTimeout(this._resizeTimeout),this._resizeTimeout=null,!this._resizeSession||this._viewOnly||!this._supportsSetDesktopSize)return;const t=this._screenSize();Sa.messages.setDesktopSize(this._sock,Math.floor(t.w),Math.floor(t.h),this._screenID,this._screenFlags),r("Requested new desktop size: "+t.w+"x"+t.h)}_screenSize(){let t=this._screen.getBoundingClientRect();return{w:t.width,h:t.height}}_fixScrollbars(){const t=this._screen.style.overflow;this._screen.style.overflow="hidden",this._screen.getBoundingClientRect(),this._screen.style.overflow=t}_updateConnectionState(t){const e=this._rfbConnectionState;if(t!==e)if("disconnected"!==e){switch(t){case"connected":if("connecting"!==e)return void o("Bad transition to connected state, previous connection state: "+e);break;case"disconnected":if("disconnecting"!==e)return void o("Bad transition to disconnected state, previous connection state: "+e);break;case"connecting":if(""!==e)return void o("Bad transition to connecting state, previous connection state: "+e);break;case"disconnecting":if("connected"!==e&&"connecting"!==e)return void o("Bad transition to disconnecting state, previous connection state: "+e);break;default:return void o("Unknown connection state: "+t)}switch(this._rfbConnectionState=t,r("New state '"+t+"', was '"+e+"'."),this._disconnTimer&&"disconnecting"!==t&&(r("Clearing disconnect timer"),clearTimeout(this._disconnTimer),this._disconnTimer=null,this._sock.off("close")),t){case"connecting":this._connect();break;case"connected":this.dispatchEvent(new CustomEvent("connect",{detail:{}}));break;case"disconnecting":this._disconnect(),this._disconnTimer=setTimeout((()=>{o("Disconnection timed out."),this._updateConnectionState("disconnected")}),3e3);break;case"disconnected":this.dispatchEvent(new CustomEvent("disconnect",{detail:{clean:this._rfbCleanDisconnect}}))}}else o("Tried changing state of a disconnected RFB object");else r("Already in state '"+t+"', ignoring")}_fail(t){switch(this._rfbConnectionState){case"disconnecting":o("Failed when disconnecting: "+t);break;case"connected":o("Failed while connected: "+t);break;case"connecting":o("Failed when connecting: "+t);break;default:o("RFB failure: "+t)}return this._rfbCleanDisconnect=!1,this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected"),!1}_setCapability(t,e){this._capabilities[t]=e,this.dispatchEvent(new CustomEvent("capabilities",{detail:{capabilities:this._capabilities}}))}_handleMessage(){if(0!==this._sock.rQlen)switch(this._rfbConnectionState){case"disconnected":o("Got data while disconnected");break;case"connected":for(;!this._flushing&&this._normalMsg()&&0!==this._sock.rQlen;);break;default:this._initMsg()}else h("handleMessage called on an empty receive queue")}_handleKeyEvent(t,e,s){this.sendKey(t,e,s)}_handleMouse(t){if("click"===t.type&&t.target!==this._canvas)return;if(t.stopPropagation(),t.preventDefault(),"click"===t.type||"contextmenu"===t.type)return;let e=x(t.clientX,t.clientY,this._canvas);switch(t.type){case"mousedown":!function(t){if(t.setCapture)t.setCapture(),document.captureElement=t,t.addEventListener("mouseup",F);else{F();let e=document.getElementById("noVNC_mouse_capture_elem");null===e&&(e=document.createElement("div"),e.id="noVNC_mouse_capture_elem",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.width="100%",e.style.height="100%",e.style.zIndex=1e4,e.style.display="none",document.body.appendChild(e),e.addEventListener("contextmenu",E),e.addEventListener("mousemove",E),e.addEventListener("mouseup",E)),document.captureElement=t,T.observe(t,{attributes:!0}),M(),e.style.display="",window.addEventListener("mousemove",E),window.addEventListener("mouseup",E)}}(this._canvas),this._handleMouseButton(e.x,e.y,!0,1<u||Math.abs(i)>u)&&(this._viewportHasMoved=!0,this._viewportDragPos={x:t,y:e},this._display.viewportChangePos(s,i))}else if(this._mousePos={x:t,y:e},null==this._mouseMoveTimer){const s=Date.now()-this._mouseLastMoveTime;s>17?(this._sendMouse(t,e,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()):this._mouseMoveTimer=setTimeout((()=>{this._handleDelayedMouseMove()}),17-s)}}_handleDelayedMouseMove(){this._mouseMoveTimer=null,this._sendMouse(this._mousePos.x,this._mousePos.y,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()}_sendMouse(t,e,s){"connected"===this._rfbConnectionState&&(this._viewOnly||Sa.messages.pointerEvent(this._sock,this._display.absX(t),this._display.absY(e),s))}_handleWheel(t){if("connected"!==this._rfbConnectionState)return;if(this._viewOnly)return;t.stopPropagation(),t.preventDefault();let e=x(t.clientX,t.clientY,this._canvas),s=t.deltaX,i=t.deltaY;0!==t.deltaMode&&(s*=19,i*=19),this._accumulatedWheelDeltaX+=s,this._accumulatedWheelDeltaY+=i,Math.abs(this._accumulatedWheelDeltaX)>=50&&(this._accumulatedWheelDeltaX<0?(this._handleMouseButton(e.x,e.y,!0,32),this._handleMouseButton(e.x,e.y,!1,32)):this._accumulatedWheelDeltaX>0&&(this._handleMouseButton(e.x,e.y,!0,64),this._handleMouseButton(e.x,e.y,!1,64)),this._accumulatedWheelDeltaX=0),Math.abs(this._accumulatedWheelDeltaY)>=50&&(this._accumulatedWheelDeltaY<0?(this._handleMouseButton(e.x,e.y,!0,8),this._handleMouseButton(e.x,e.y,!1,8)):this._accumulatedWheelDeltaY>0&&(this._handleMouseButton(e.x,e.y,!0,16),this._handleMouseButton(e.x,e.y,!1,16)),this._accumulatedWheelDeltaY=0)}_fakeMouseMove(t,e,s){this._handleMouseMove(e,s),this._cursor.move(t.detail.clientX,t.detail.clientY)}_handleTapEvent(t,e){let s=x(t.detail.clientX,t.detail.clientY,this._canvas);if(null!==this._gestureLastTapTime&&Date.now()-this._gestureLastTapTime<1e3&&this._gestureFirstDoubleTapEv.detail.type===t.detail.type){let e=this._gestureFirstDoubleTapEv.detail.clientX-t.detail.clientX,i=this._gestureFirstDoubleTapEv.detail.clientY-t.detail.clientY;Math.hypot(e,i)<50?s=x(this._gestureFirstDoubleTapEv.detail.clientX,this._gestureFirstDoubleTapEv.detail.clientY,this._canvas):this._gestureFirstDoubleTapEv=t}else this._gestureFirstDoubleTapEv=t;this._gestureLastTapTime=Date.now(),this._fakeMouseMove(this._gestureFirstDoubleTapEv,s.x,s.y),this._handleMouseButton(s.x,s.y,!0,e),this._handleMouseButton(s.x,s.y,!1,e)}_handleGesture(t){let e,s=x(t.detail.clientX,t.detail.clientY,this._canvas);switch(t.type){case"gesturestart":switch(t.detail.type){case"onetap":this._handleTapEvent(t,1);break;case"twotap":this._handleTapEvent(t,4);break;case"threetap":this._handleTapEvent(t,2);break;case"drag":this._fakeMouseMove(t,s.x,s.y),this._handleMouseButton(s.x,s.y,!0,1);break;case"longpress":this._fakeMouseMove(t,s.x,s.y),this._handleMouseButton(s.x,s.y,!0,4);break;case"twodrag":this._gestureLastMagnitudeX=t.detail.magnitudeX,this._gestureLastMagnitudeY=t.detail.magnitudeY,this._fakeMouseMove(t,s.x,s.y);break;case"pinch":this._gestureLastMagnitudeX=Math.hypot(t.detail.magnitudeX,t.detail.magnitudeY),this._fakeMouseMove(t,s.x,s.y)}break;case"gesturemove":switch(t.detail.type){case"onetap":case"twotap":case"threetap":break;case"drag":case"longpress":this._fakeMouseMove(t,s.x,s.y);break;case"twodrag":for(this._fakeMouseMove(t,s.x,s.y);t.detail.magnitudeY-this._gestureLastMagnitudeY>ba;)this._handleMouseButton(s.x,s.y,!0,8),this._handleMouseButton(s.x,s.y,!1,8),this._gestureLastMagnitudeY+=ba;for(;t.detail.magnitudeY-this._gestureLastMagnitudeY<-50;)this._handleMouseButton(s.x,s.y,!0,16),this._handleMouseButton(s.x,s.y,!1,16),this._gestureLastMagnitudeY-=ba;for(;t.detail.magnitudeX-this._gestureLastMagnitudeX>ba;)this._handleMouseButton(s.x,s.y,!0,32),this._handleMouseButton(s.x,s.y,!1,32),this._gestureLastMagnitudeX+=ba;for(;t.detail.magnitudeX-this._gestureLastMagnitudeX<-50;)this._handleMouseButton(s.x,s.y,!0,64),this._handleMouseButton(s.x,s.y,!1,64),this._gestureLastMagnitudeX-=ba;break;case"pinch":if(this._fakeMouseMove(t,s.x,s.y),e=Math.hypot(t.detail.magnitudeX,t.detail.magnitudeY),Math.abs(e-this._gestureLastMagnitudeX)>75){for(this._handleKeyEvent(xi,"ControlLeft",!0);e-this._gestureLastMagnitudeX>75;)this._handleMouseButton(s.x,s.y,!0,8),this._handleMouseButton(s.x,s.y,!1,8),this._gestureLastMagnitudeX+=75;for(;e-this._gestureLastMagnitudeX<-75;)this._handleMouseButton(s.x,s.y,!0,16),this._handleMouseButton(s.x,s.y,!1,16),this._gestureLastMagnitudeX-=75}this._handleKeyEvent(xi,"ControlLeft",!1)}break;case"gestureend":switch(t.detail.type){case"onetap":case"twotap":case"threetap":case"pinch":case"twodrag":break;case"drag":this._fakeMouseMove(t,s.x,s.y),this._handleMouseButton(s.x,s.y,!1,1);break;case"longpress":this._fakeMouseMove(t,s.x,s.y),this._handleMouseButton(s.x,s.y,!1,4)}}}_negotiateProtocolVersion(){if(this._sock.rQwait("version",12))return!1;const t=this._sock.rQshiftStr(12).substr(4,7);a("Server ProtocolVersion: "+t);let e=0;switch(t){case"000.000":e=1;break;case"003.003":case"003.006":case"003.889":this._rfbVersion=3.3;break;case"003.007":this._rfbVersion=3.7;break;case"003.008":case"004.000":case"004.001":case"005.000":this._rfbVersion=3.8;break;default:return this._fail("Invalid server version "+t)}if(e){let t="ID:"+this._repeaterID;for(;t.length<250;)t+="\0";return this._sock.sendString(t),!0}this._rfbVersion>this._rfbMaxVersion&&(this._rfbVersion=this._rfbMaxVersion);const s="00"+parseInt(this._rfbVersion,10)+".00"+10*this._rfbVersion%10;this._sock.sendString("RFB "+s+"\n"),r("Sent ProtocolVersion: "+s),this._rfbInitState="Security"}_negotiateSecurity(){function t(t,e){for(let s=0;s=3.7){const e=this._sock.rQshift8();if(this._sock.rQwait("security type",e,1))return!1;if(0===e)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,this._initMsg();const s=this._sock.rQshiftBytes(e);if(r("Server security types: "+s),t(1,s))this._rfbAuthScheme=1;else if(t(22,s))this._rfbAuthScheme=22;else if(t(16,s))this._rfbAuthScheme=16;else if(t(2,s))this._rfbAuthScheme=2;else{if(!t(19,s))return this._fail("Unsupported security types (types: "+s+")");this._rfbAuthScheme=19}this._sock.send([this._rfbAuthScheme])}else{if(this._sock.rQwait("security scheme",4))return!1;if(this._rfbAuthScheme=this._sock.rQshift32(),0==this._rfbAuthScheme)return this._rfbInitState="SecurityReason",this._securityContext="authentication scheme",this._securityStatus=1,this._initMsg()}return this._rfbInitState="Authentication",r("Authenticating using scheme: "+this._rfbAuthScheme),this._initMsg()}_handleSecurityReason(){if(this._sock.rQwait("reason length",4))return!1;const t=this._sock.rQshift32();let e="";if(t>0){if(this._sock.rQwait("reason",t,4))return!1;e=this._sock.rQshiftStr(t)}return""!==e?(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:e}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+e+")")):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus}})),this._fail("Security negotiation failed on "+this._securityContext))}_negotiateXvpAuth(){if(void 0===this._rfbCredentials.username||void 0===this._rfbCredentials.password||void 0===this._rfbCredentials.target)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password","target"]}})),!1;const t=String.fromCharCode(this._rfbCredentials.username.length)+String.fromCharCode(this._rfbCredentials.target.length)+this._rfbCredentials.username+this._rfbCredentials.target;return this._sock.sendString(t),this._rfbAuthScheme=2,this._negotiateAuthentication()}_negotiateVeNCryptAuth(){if(0==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt version",2))return!1;const t=this._sock.rQshift8(),e=this._sock.rQshift8();if(0!=t||2!=e)return this._fail("Unsupported VeNCrypt version "+t+"."+e);this._sock.send([0,2]),this._rfbVeNCryptState=1}if(1==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt ack",1))return!1;const t=this._sock.rQshift8();if(0!=t)return this._fail("VeNCrypt failure "+t);this._rfbVeNCryptState=2}if(2==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;const t=this._sock.rQshift8();if(t<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=t,this._rfbVeNCryptState=3}if(3==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;const t=[];for(let e=0;e0&&this._sock.rQwait("tunnel capabilities",16*t,4))return!1;if(this._rfbTightVNC=!0,t>0)return this._negotiateTightTunnels(t),!1}if(this._sock.rQwait("sub auth count",4))return!1;const t=this._sock.rQshift32();if(0===t)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*t,4))return!1;const e={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},s=[];for(let i=0;i=3.8?(this._rfbInitState="SecurityResult",!0):(this._rfbInitState="ClientInitialisation",this._initMsg());case 22:return this._negotiateXvpAuth();case 2:return this._negotiateStdVNCAuth();case 16:return this._negotiateTightAuth();case 19:return this._negotiateVeNCryptAuth();case 129:return this._negotiateTightUnixAuth();default:return this._fail("Unsupported auth scheme (scheme: "+this._rfbAuthScheme+")")}}_handleSecurityResult(){if(this._sock.rQwait("VNC auth response ",4))return!1;const t=this._sock.rQshift32();return 0===t?(this._rfbInitState="ClientInitialisation",r("Authentication OK"),this._initMsg()):this._rfbVersion>=3.8?(this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=t,this._initMsg()):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:t}})),this._fail("Security handshake failed"))}_negotiateServerInit(){if(this._sock.rQwait("server initialization",24))return!1;const t=this._sock.rQshift16(),e=this._sock.rQshift16(),s=this._sock.rQshift8(),i=this._sock.rQshift8(),n=this._sock.rQshift8(),r=this._sock.rQshift8(),o=this._sock.rQshift16(),c=this._sock.rQshift16(),d=this._sock.rQshift16(),u=this._sock.rQshift8(),_=this._sock.rQshift8(),f=this._sock.rQshift8();this._sock.rQskipBytes(3);const p=this._sock.rQshift32();if(this._sock.rQwait("server init name",p,24))return!1;let g=this._sock.rQshiftStr(p);if(g=l(g,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+p))return!1;const t=this._sock.rQshift16(),e=this._sock.rQshift16(),s=this._sock.rQshift16();this._sock.rQskipBytes(2);const i=16*(t+e+s);if(this._sock.rQwait("TightVNC extended server init header",i,32+p))return!1;this._sock.rQskipBytes(16*t),this._sock.rQskipBytes(16*e),this._sock.rQskipBytes(16*s)}return a("Screen: "+t+"x"+e+", bpp: "+s+", depth: "+i+", bigEndian: "+n+", trueColor: "+r+", redMax: "+o+", greenMax: "+c+", blueMax: "+d+", redShift: "+u+", greenShift: "+_+", blueShift: "+f),this._setDesktopName(g),this._resize(t,e),this._viewOnly||this._keyboard.grab(),this._fbDepth=24,"Intel(r) AMT KVM"===this._fbName&&(h("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8),Sa.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),Sa.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}_sendEncodings(){const t=[];t.push(qr),24==this._fbDepth&&(t.push(Jr),t.push($r),t.push(Zr),t.push(jr)),t.push(Wr),t.push(ta+this._qualityLevel),t.push(ca+this._compressionLevel),t.push(ea),t.push(sa),t.push(na),t.push(aa),t.push(ha),t.push(oa),t.push(la),t.push(ra),t.push(ua),24==this._fbDepth&&(t.push(da),t.push(ia)),Sa.messages.clientEncodings(this._sock,t)}_initMsg(){switch(this._rfbInitState){case"ProtocolVersion":return this._negotiateProtocolVersion();case"Security":return this._negotiateSecurity();case"Authentication":return this._negotiateAuthentication();case"SecurityResult":return this._handleSecurityResult();case"SecurityReason":return this._handleSecurityReason();case"ClientInitialisation":return this._sock.send([this._shared?1:0]),this._rfbInitState="ServerInitialisation",!0;case"ServerInitialisation":return this._negotiateServerInit();default:return this._fail("Unknown init state (state: "+this._rfbInitState+")")}}_handleSetColourMapMsg(){return r("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}_handleServerCutText(){if(r("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);let t=this._sock.rQshift32();if(t=i(t),this._sock.rQwait("ServerCutText content",Math.abs(t),8))return!1;if(t>=0){const e=this._sock.rQshiftStr(t);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:e}}))}else{t=Math.abs(t);const e=this._sock.rQshift32();let s=65535&e,i=4278190080&e;if(!!(i&va)){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(let e=0;e<=15;e++){let t=1<0&&"\0"===n.charAt(n.length-1)&&(n=n.slice(0,-1)),n=n.replace("\r\n","\n"),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:n}}))}}}}return!0}_handleServerFenceMsg(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);let t=this._sock.rQshift32(),e=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",e,9))return!1;e>64&&(h("Bad payload length ("+e+") in fence response"),e=64);const s=this._sock.rQshiftStr(e);return this._supportsFence=!0,t&1<<31?(t&=3,Sa.messages.clientFence(this._sock,t,s),!0):this._fail("Unexpected fence response")}_handleXvpMsg(){if(this._sock.rQwait("XVP version and message",3,1))return!1;this._sock.rQskipBytes(1);const t=this._sock.rQshift8(),e=this._sock.rQshift8();switch(e){case 0:o("XVP Operation Failed");break;case 1:this._rfbXvpVer=t,a("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+e+")")}return!0}_normalMsg(){let t,e,s;switch(t=this._FBU.rects>0?0:this._sock.rQshift8(),t){case 0:return s=this._framebufferUpdate(),s&&!this._enabledContinuousUpdates&&Sa.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight),s;case 1:return this._handleSetColourMapMsg();case 2:return r("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:return e=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,e&&(this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),a("Enabling continuous updates.")),!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+t+")"),r("sock.rQslice(0, 30): "+this._sock.rQslice(0,30)),!0}}_onFlush(){this._flushing=!1,this._sock.rQlen>0&&this._handleMessage()}_framebufferUpdate(){if(0===this._FBU.rects){if(this._sock.rQwait("FBU header",3,1))return!1;if(this._sock.rQskipBytes(1),this._FBU.rects=this._sock.rQshift16(),this._display.pending())return this._flushing=!0,this._display.flush(),!1}for(;this._FBU.rects>0;){if(null===this._FBU.encoding){if(this._sock.rQwait("rect header",12))return!1;const t=this._sock.rQshiftBytes(12);this._FBU.x=(t[0]<<8)+t[1],this._FBU.y=(t[2]<<8)+t[3],this._FBU.width=(t[4]<<8)+t[5],this._FBU.height=(t[6]<<8)+t[7],this._FBU.encoding=parseInt((t[8]<<24)+(t[9]<<16)+(t[10]<<8)+t[11],10)}if(!this._handleRect())return!1;this._FBU.rects--,this._FBU.encoding=null}return this._display.flip(),!0}_handleRect(){switch(this._FBU.encoding){case sa:return this._FBU.rects=1,!0;case da:return this._handleVMwareCursor();case ia:return this._handleCursor();case na:try{void 0!==document.createEvent("keyboardEvent").code&&(this._qemuExtKeyEventSupported=!0)}catch(ee){}return!0;case ra:return this._handleDesktopName();case ea:return this._resize(this._FBU.width,this._FBU.height),!0;case aa:return this._handleExtendedDesktopSize();default:return this._handleDataRect()}}_handleVMwareCursor(){const t=this._FBU.x,e=this._FBU.y,s=this._FBU.width,i=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;const n=this._sock.rQshift8();let r;this._sock.rQshift8();if(0==n){const t=-256;if(r=new Array(s*i*4),this._sock.rQwait("VMware cursor classic encoding",s*i*4*2,2))return!1;let e=new Array(s*i);for(let r=0;r>8&255,s=t>>16&255,i=t>>24&255;r[4*a]=e,r[4*a+1]=s,r[4*a+2]=i,r[4*a+3]=255}else(e[a]&t)==t?0==n[a]?(r[4*a]=0,r[4*a+1]=0,r[4*a+2]=0,r[4*a+3]=0):(n[a],r[4*a]=0,r[4*a+1]=0,r[4*a+2]=0,r[4*a+3]=255):(r[4*a]=0,r[4*a+1]=0,r[4*a+2]=0,r[4*a+3]=255)}else{if(1!=n)return h("The given cursor type is not supported: "+n+" given."),!1;if(this._sock.rQwait("VMware cursor alpha encoding",s*i*4,2))return!1;r=new Array(s*i*4);for(let t=0;t>24&255,r[4*t+1]=e>>16&255,r[4*t+2]=e>>8&255,r[4*t+3]=255&e}}return this._updateCursor(r,t,e,s,i),!0}_handleCursor(){const t=this._FBU.x,e=this._FBU.y,s=this._FBU.width,i=this._FBU.height,n=s*i*4,r=Math.ceil(s/8)*i;let a=n+r;if(this._sock.rQwait("cursor encoding",a))return!1;const h=this._sock.rQshiftBytes(n),o=this._sock.rQshiftBytes(r);let l=new Uint8Array(s*i*4),c=0;for(let d=0;dt.charCodeAt(0)));return new Yr(s).encrypt(e)}}Sa.messages={keyEvent(t,e,s){const i=t._sQ,n=t._sQlen;i[n]=4,i[n+1]=s,i[n+2]=0,i[n+3]=0,i[n+4]=e>>24,i[n+5]=e>>16,i[n+6]=e>>8,i[n+7]=e,t._sQlen+=8,t.flush()},QEMUExtendedKeyEvent(t,e,s,i){const n=t._sQ,r=t._sQlen;n[r]=255,n[r+1]=0,n[r+2]=s>>8,n[r+3]=s,n[r+4]=e>>24,n[r+5]=e>>16,n[r+6]=e>>8,n[r+7]=e;const a=function(t){const e=255&i;return 224===i>>8&&e<127?128|e:t}(i);n[r+8]=a>>24,n[r+9]=a>>16,n[r+10]=a>>8,n[r+11]=a,t._sQlen+=12,t.flush()},pointerEvent(t,e,s,i){const n=t._sQ,r=t._sQlen;n[r]=5,n[r+1]=i,n[r+2]=e>>8,n[r+3]=e,n[r+4]=s>>8,n[r+5]=s,t._sQlen+=6,t.flush()},_buildExtendedClipboardFlags(t,e){let s=new Uint8Array(4),i=0,n=0;for(let r=0;r>24,s[1]=0,s[2]=0,s[3]=i,s},extendedClipboardProvide(t,e,s){let i=new we,n=[];for(let h=0;h>24&255,t.length>>16&255,t.length>>8&255,255&t.length);for(let e=0;eparseInt(t))),i.sort(((t,e)=>t-e)),n.set(Sa.messages._buildExtendedClipboardFlags(e,[]));let r=4;for(let a=0;a>24,n[r+1]=s[i[a]]>>16,n[r+2]=s[i[a]]>>8,n[r+3]=s[i[a]]>>0,r+=4,n[3]|=1<>>0:e.length,i[n+4]=r>>24,i[n+5]=r>>16,i[n+6]=r>>8,i[n+7]=r,t._sQlen+=8;let a=0,h=e.length;for(;h>0;){let s=Math.min(h,t._sQbufferSize-t._sQlen);for(let n=0;n>8,r[a+3]=e,r[a+4]=s>>8,r[a+5]=s,r[a+6]=1,r[a+7]=0,r[a+8]=i>>24,r[a+9]=i>>16,r[a+10]=i>>8,r[a+11]=i,r[a+12]=0,r[a+13]=0,r[a+14]=0,r[a+15]=0,r[a+16]=e>>8,r[a+17]=e,r[a+18]=s>>8,r[a+19]=s,r[a+20]=n>>24,r[a+21]=n>>16,r[a+22]=n>>8,r[a+23]=n,t._sQlen+=24,t.flush()},clientFence(t,e,s){const i=t._sQ,n=t._sQlen;i[n]=248,i[n+1]=0,i[n+2]=0,i[n+3]=0,i[n+4]=e>>24,i[n+5]=e>>16,i[n+6]=e>>8,i[n+7]=e;const r=s.length;i[n+8]=r;for(let a=0;a>8,a[h+3]=s,a[h+4]=i>>8,a[h+5]=i,a[h+6]=n>>8,a[h+7]=n,a[h+8]=r>>8,a[h+9]=r,t._sQlen+=10,t.flush()},pixelFormat(t,e,s){const i=t._sQ,n=t._sQlen;let r;r=e>16?32:e>8?16:8;const a=Math.floor(e/3);i[n]=0,i[n+1]=0,i[n+2]=0,i[n+3]=0,i[n+4]=r,i[n+5]=e,i[n+6]=0,i[n+7]=s?1:0,i[n+8]=0,i[n+9]=(1<>8,s[i+3]=e.length;let n=i+4;for(let r=0;r>24,s[n+1]=t>>16,s[n+2]=t>>8,s[n+3]=t,n+=4}t._sQlen+=n-i,t.flush()},fbUpdateRequest(t,e,s,i,n,r){const a=t._sQ,h=t._sQlen;"undefined"===typeof s&&(s=0),"undefined"===typeof i&&(i=0),a[h]=3,a[h+1]=e?1:0,a[h+2]=s>>8&255,a[h+3]=255&s,a[h+4]=i>>8&255,a[h+5]=255&i,a[h+6]=n>>8&255,a[h+7]=255&n,a[h+8]=r>>8&255,a[h+9]=255&r,t._sQlen+=10,t.flush()},xvpOp(t,e,s){const i=t._sQ,n=t._sQlen;i[n]=250,i[n+1]=0,i[n+2]=e,i[n+3]=s,t._sQlen+=4,t.flush()}},Sa.cursors={none:{rgbaPixels:new Uint8Array,w:0,h:0,hotx:0,hoty:0},dot:{rgbaPixels:new Uint8Array([255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255]),w:3,h:3,hotx:1,hoty:1}}},2203:function(){"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");const s=Object(t);for(let i=1;i{function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("CustomEvent");return s.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),s}t.prototype=window.Event.prototype,"function"!==typeof window.CustomEvent&&(window.CustomEvent=t)})(),Number.isInteger=Number.isInteger||function(t){return"number"===typeof t&&isFinite(t)&&Math.floor(t)===t}}}]);