Files
platform/public/novnc/rfb.bundle.js
T
pastilhasandClaude Opus 5 51b249b90a desktop: load noVNC as one bundle instead of 42 modules
public/novnc is unbundled noVNC source. The dynamic import pointed at rfb.js, so the browser walked
the module graph natively: fetch a file, parse it, discover its imports, fetch those, repeat. The
graph is 42 modules and six levels deep, so opening the desktop cost six SEQUENTIAL round trips and
42 requests before the VNC handshake could even start — and a hard refresh pays it in full every
time. Over the tailnet that is the "takes a long time to load", not the pixels.

Bundled with bun: 52 modules to one 190 KB file, 56 KB gzipped, one request. The regeneration
command is in a comment next to the constant so a future noVNC bump does not silently keep serving
a stale bundle.

The source tree stays: it is what gets bundled, and keeping it makes the diff of a version bump
readable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 20:52:50 +00:00

6 lines
186 KiB
JavaScript

function i6(Q){return Q>>>0}function Q0(Q){return Q|0}var r6="warn",w=()=>{},r=()=>{},l=()=>{},p=()=>{};function l8(Q){if(typeof Q>"u")Q=r6;else r6=Q;if(w=r=l=p=()=>{},typeof window.console<"u")switch(Q){case"debug":w=console.debug.bind(window.console);case"info":r=console.info.bind(window.console);case"warn":l=console.warn.bind(window.console);case"error":p=console.error.bind(window.console);case"none":break;default:throw new window.Error("invalid logging type '"+Q+"'")}}l8();function B0(Q,$=!1){try{return decodeURIComponent(escape(Q))}catch(V){if(V instanceof URIError){if($)return Q}throw V}}function q1(Q){return unescape(encodeURIComponent(Q))}var f1={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),base64Pad:"=",encode(Q){let $="",V=Q.length,J=V%3;for(let G=0;G<V-2;G+=3)$+=this.toBase64Table[Q[G]>>2],$+=this.toBase64Table[((Q[G]&3)<<4)+(Q[G+1]>>4)],$+=this.toBase64Table[((Q[G+1]&15)<<2)+(Q[G+2]>>6)],$+=this.toBase64Table[Q[G+2]&63];let W=V-J;if(J===2)$+=this.toBase64Table[Q[W]>>2],$+=this.toBase64Table[((Q[W]&3)<<4)+(Q[W+1]>>4)],$+=this.toBase64Table[(Q[W+1]&15)<<2],$+=this.toBase64Table[64];else if(J===1)$+=this.toBase64Table[Q[W]>>2],$+=this.toBase64Table[(Q[W]&3)<<4],$+=this.toBase64Table[64],$+=this.toBase64Table[64];return $},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(Q,$=0){let V=Q.indexOf("=")-$;if(V<0)V=Q.length-$;let J=(V>>2)*3+Math.floor(V%4/1.5),W=Array(J),G=0,q=0;for(let U=0,Z=$;Z<Q.length;Z++){let Y=this.toBinaryTable[Q.charCodeAt(Z)&127],X=Q.charAt(Z)===this.base64Pad;if(Y===-1){p("Illegal character code "+Q.charCodeAt(Z)+" at position "+Z);continue}if(q=q<<6|Y,G+=6,G>=8){if(G-=8,!X)W[U++]=q>>G&255;q&=(1<<G)-1}}if(G){let U=Error("Corrupted base64 string");throw U.name="Base64-Error",U}return W}};var Y6="ontouchstart"in document.documentElement||document.ontouchstart!==void 0||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;window.addEventListener("touchstart",function Q(){Y6=!0,window.removeEventListener("touchstart",Q,!1)},!1);var V0=10*(window.devicePixelRatio||1),l6=!1;try{let Q=document.createElement("canvas");if(Q.style.cursor='url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default',Q.style.cursor.indexOf("url")===0)r("Data URI scheme cursor supported"),l6=!0;else l("Data URI scheme cursor not supported")}catch(Q){p("Data URI scheme cursor test exception: "+Q)}var o6=l6,o8=!0;try{let Q=document.createElement("div");Q.style.visibility="hidden",Q.style.overflow="scroll",document.body.appendChild(Q);let $=document.createElement("div");Q.appendChild($);let V=Q.offsetWidth-$.offsetWidth;Q.parentNode.removeChild(Q),o8=V!=0}catch(Q){p("Scrollbar test exception: "+Q)}var X6=!1;async function d8(){if(!("VideoDecoder"in window))return!1;let Q={codec:"avc1.42401f",codedWidth:1920,codedHeight:1080,optimizeForLatency:!0};if(!(await VideoDecoder.isConfigSupported(Q)).supported)return!1;let V=new Uint8Array(f1.decode("AAAAAWdCwBTZnpuAgICgAAADACAAAAZB4oVNAAAAAWjJYyyAAAABBgX//4HcRem95tlIt5Ys2CDZI+7veDI2NCAtIGNvcmUgMTY0IHIzMTA4IDMxZTE5ZjkgLSBILjI2NC9NUEVHLTQgQVZDIGNvZGVjIC0gQ29weWxlZnQgMjAwMy0yMDIzIC0gaHR0cDovL3d3dy52aWRlb2xhbi5vcmcveDI2NC5odG1sIC0gb3B0aW9uczogY2FiYWM9MCByZWY9NSBkZWJsb2NrPTE6MDowIGFuYWx5c2U9MHgxOjB4MTExIG1lPWhleCBzdWJtZT04IHBzeT0xIHBzeV9yZD0xLjAwOjAuMDAgbWl4ZWRfcmVmPTEgbWVfcmFuZ2U9MTYgY2hyb21hX21lPTEgdHJlbGxpcz0yIDh4OGRjdD0wIGNxbT0wIGRlYWR6b25lPTIxLDExIGZhc3RfcHNraXA9MSBjaHJvbWFfcXBfb2Zmc2V0PS0yIHRocmVhZHM9MSBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTAgd2VpZ2h0cD0wIGtleWludD1pbmZpbml0ZSBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NTAgcmM9YWJyIG1idHJlZT0xIGJpdHJhdGU9NDAwIHJhdGV0b2w9MS4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAABZYiEBrxmKAAPVccAAS044AA5DRJMnkycJk4TPw==")),J=!1,W=null,G=new VideoDecoder({output:(U)=>{J=!0},error:(U)=>{W=U}}),q=new EncodedVideoChunk({timestamp:0,type:"key",data:V});G.configure(Q),G.decode(q);try{await G.flush()}catch(U){W=U}if(!J)return!1;if(W!==null)return!1;return!0}X6=await d8();function I1(){return!!/mac/i.exec(navigator.platform)}function u1(){return!!/win/i.exec(navigator.platform)}function _1(){return!!/ipad/i.exec(navigator.platform)||!!/iphone/i.exec(navigator.platform)||!!/ipod/i.exec(navigator.platform)}function y1(Q,$,V){let J=V.getBoundingClientRect(),W={x:0,y:0};if(Q<J.left)W.x=0;else if(Q>=J.right)W.x=J.width-1;else W.x=Q-J.left;if($<J.top)W.y=0;else if($>=J.bottom)W.y=J.height-1;else W.y=$-J.top;return W}function K1(Q){Q.stopPropagation(),Q.preventDefault()}var Z6=!1,a6=null;document.captureElement=null;function R1(Q){if(Z6)return;let $=new Q.constructor(Q.type,Q);if(Z6=!0,document.captureElement)document.captureElement.dispatchEvent($);else a6.dispatchEvent($);if(Z6=!1,Q.stopPropagation(),$.defaultPrevented)Q.preventDefault();if(Q.type==="mouseup")Q2()}function t6(){let Q=document.getElementById("noVNC_mouse_capture_elem");Q.style.cursor=window.getComputedStyle(document.captureElement).cursor}var s6=new MutationObserver(t6);function e6(Q){if(Q.setCapture)Q.setCapture(),document.captureElement=Q;else{Q2();let $=document.getElementById("noVNC_mouse_capture_elem");if($===null)$=document.createElement("div"),$.id="noVNC_mouse_capture_elem",$.style.position="fixed",$.style.top="0px",$.style.left="0px",$.style.width="100%",$.style.height="100%",$.style.zIndex=1e4,$.style.display="none",document.body.appendChild($),$.addEventListener("contextmenu",R1),$.addEventListener("mousemove",R1),$.addEventListener("mouseup",R1);document.captureElement=Q,s6.observe(Q,{attributes:!0}),t6(),$.style.display="",window.addEventListener("mousemove",R1),window.addEventListener("mouseup",R1)}}function Q2(){if(document.releaseCapture)document.releaseCapture(),document.captureElement=null;else{if(!document.captureElement)return;a6=document.captureElement,document.captureElement=null,s6.disconnect();let Q=document.getElementById("noVNC_mouse_capture_elem");Q.style.display="none",window.removeEventListener("mousemove",R1),window.removeEventListener("mouseup",R1)}}class h1{constructor(){this._listeners=new Map}addEventListener(Q,$){if(!this._listeners.has(Q))this._listeners.set(Q,new Set);this._listeners.get(Q).add($)}removeEventListener(Q,$){if(this._listeners.has(Q))this._listeners.get(Q).delete($)}dispatchEvent(Q){if(!this._listeners.has(Q.type))return!0;return this._listeners.get(Q.type).forEach(($)=>$.call(this,Q)),!Q.defaultPrevented}}class N0{constructor(Q){if(this._drawCtx=null,this._renderQ=[],this._flushPromise=null,this._fbWidth=0,this._fbHeight=0,this._prevDrawStyle="",w(">> Display.constructor"),this._target=Q,!this._target)throw Error("Target must be set");if(typeof this._target==="string")throw Error("target must be a DOM element");if(!this._target.getContext)throw Error("no getContext method");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},w("User Agent: "+navigator.userAgent),w("<< Display.constructor"),this._scale=1,this._clipViewport=!1}get scale(){return this._scale}set scale(Q){this._rescale(Q)}get clipViewport(){return this._clipViewport}set clipViewport(Q){this._clipViewport=Q;let $=this._viewportLoc;this.viewportChangeSize($.w,$.h),this.viewportChangePos(0,0)}get width(){return this._fbWidth}get height(){return this._fbHeight}viewportChangePos(Q,$){let V=this._viewportLoc;if(Q=Math.floor(Q),$=Math.floor($),!this._clipViewport)Q=-V.w,$=-V.h;let J=V.x+V.w-1,W=V.y+V.h-1;if(Q<0&&V.x+Q<0)Q=-V.x;if(J+Q>=this._fbWidth)Q-=J+Q-this._fbWidth+1;if(V.y+$<0)$=-V.y;if(W+$>=this._fbHeight)$-=W+$-this._fbHeight+1;if(Q===0&&$===0)return;w("viewportChange deltaX: "+Q+", deltaY: "+$),V.x+=Q,V.y+=$,this._damage(V.x,V.y,V.w,V.h),this.flip()}viewportChangeSize(Q,$){if(!this._clipViewport||typeof Q>"u"||typeof $>"u")w("Setting viewport to full display region"),Q=this._fbWidth,$=this._fbHeight;if(Q=Math.floor(Q),$=Math.floor($),Q>this._fbWidth)Q=this._fbWidth;if($>this._fbHeight)$=this._fbHeight;let V=this._viewportLoc;if(V.w!==Q||V.h!==$){V.w=Q,V.h=$;let J=this._target;J.width=Q,J.height=$,this.viewportChangePos(0,0),this._damage(V.x,V.y,V.w,V.h),this.flip(),this._rescale(this._scale)}}absX(Q){if(this._scale===0)return 0;return Q0(Q/this._scale+this._viewportLoc.x)}absY(Q){if(this._scale===0)return 0;return Q0(Q/this._scale+this._viewportLoc.y)}resize(Q,$){this._prevDrawStyle="",this._fbWidth=Q,this._fbHeight=$;let V=this._backbuffer;if(V.width!==Q||V.height!==$){let W=null;if(V.width>0&&V.height>0)W=this._drawCtx.getImageData(0,0,V.width,V.height);if(V.width!==Q)V.width=Q;if(V.height!==$)V.height=$;if(W)this._drawCtx.putImageData(W,0,0)}let J=this._viewportLoc;this.viewportChangeSize(J.w,J.h),this.viewportChangePos(0,0)}getImageData(){return this._drawCtx.getImageData(0,0,this.width,this.height)}toDataURL(Q,$){return this._backbuffer.toDataURL(Q,$)}toBlob(Q,$,V){return this._backbuffer.toBlob(Q,$,V)}_damage(Q,$,V,J){if(Q<this._damageBounds.left)this._damageBounds.left=Q;if($<this._damageBounds.top)this._damageBounds.top=$;if(Q+V>this._damageBounds.right)this._damageBounds.right=Q+V;if($+J>this._damageBounds.bottom)this._damageBounds.bottom=$+J}flip(Q){if(this._renderQ.length!==0&&!Q)this._renderQPush({type:"flip"});else{let $=this._damageBounds.left,V=this._damageBounds.top,J=this._damageBounds.right-$,W=this._damageBounds.bottom-V,G=$-this._viewportLoc.x,q=V-this._viewportLoc.y;if(G<0)J+=G,$-=G,G=0;if(q<0)W+=q,V-=q,q=0;if(G+J>this._viewportLoc.w)J=this._viewportLoc.w-G;if(q+W>this._viewportLoc.h)W=this._viewportLoc.h-q;if(J>0&&W>0)this._targetCtx.drawImage(this._backbuffer,$,V,J,W,G,q,J,W);this._damageBounds.left=this._damageBounds.top=65535,this._damageBounds.right=this._damageBounds.bottom=0}}pending(){return this._renderQ.length>0}flush(){if(this._renderQ.length===0)return Promise.resolve();else{if(this._flushPromise===null)this._flushPromise=new Promise((Q)=>{this._flushResolve=Q});return this._flushPromise}}fillRect(Q,$,V,J,W,G){if(this._renderQ.length!==0&&!G)this._renderQPush({type:"fill",x:Q,y:$,width:V,height:J,color:W});else this._setFillColor(W),this._drawCtx.fillRect(Q,$,V,J),this._damage(Q,$,V,J)}copyImage(Q,$,V,J,W,G,q){if(this._renderQ.length!==0&&!q)this._renderQPush({type:"copy",oldX:Q,oldY:$,x:V,y:J,width:W,height:G});else this._drawCtx.mozImageSmoothingEnabled=!1,this._drawCtx.webkitImageSmoothingEnabled=!1,this._drawCtx.msImageSmoothingEnabled=!1,this._drawCtx.imageSmoothingEnabled=!1,this._drawCtx.drawImage(this._backbuffer,Q,$,W,G,V,J,W,G),this._damage(V,J,W,G)}imageRect(Q,$,V,J,W,G){if(V===0||J===0)return;let q=new Image;q.src="data: "+W+";base64,"+f1.encode(G),this._renderQPush({type:"img",img:q,x:Q,y:$,width:V,height:J})}videoFrame(Q,$,V,J,W){this._renderQPush({type:"frame",frame:W,x:Q,y:$,width:V,height:J})}blitImage(Q,$,V,J,W,G,q){if(this._renderQ.length!==0&&!q){let U=new Uint8Array(V*J*4);U.set(new Uint8Array(W.buffer,0,U.length)),this._renderQPush({type:"blit",data:U,x:Q,y:$,width:V,height:J})}else{let U=new Uint8ClampedArray(W.buffer,W.byteOffset+G,V*J*4),Z=new ImageData(U,V,J);this._drawCtx.putImageData(Z,Q,$),this._damage(Q,$,V,J)}}drawImage(Q,...$){if(this._drawCtx.drawImage(Q,...$),$.length<=4){let[V,J]=$;this._damage(V,J,Q.width,Q.height)}else{let[,,V,J,W,G]=$;this._damage(W,G,V,J)}}autoscale(Q,$){let V;if(Q===0||$===0)V=0;else{let J=this._viewportLoc,W=Q/$;if(J.w/J.h>=W)V=Q/J.w;else V=$/J.h}this._rescale(V)}_rescale(Q){this._scale=Q;let $=this._viewportLoc,V=Q*$.w+"px",J=Q*$.h+"px";if(this._target.style.width!==V||this._target.style.height!==J)this._target.style.width=V,this._target.style.height=J}_setFillColor(Q){let $="rgb("+Q[0]+","+Q[1]+","+Q[2]+")";if($!==this._prevDrawStyle)this._drawCtx.fillStyle=$,this._prevDrawStyle=$}_renderQPush(Q){if(this._renderQ.push(Q),this._renderQ.length===1)this._scanRenderQ()}_resumeRenderQ(){this.removeEventListener("load",this._noVNCDisplay._resumeRenderQ),this._noVNCDisplay._scanRenderQ()}_scanRenderQ(){let Q=!0;while(Q&&this._renderQ.length>0){let $=this._renderQ[0];switch($.type){case"flip":this.flip(!0);break;case"copy":this.copyImage($.oldX,$.oldY,$.x,$.y,$.width,$.height,!0);break;case"fill":this.fillRect($.x,$.y,$.width,$.height,$.color,!0);break;case"blit":this.blitImage($.x,$.y,$.width,$.height,$.data,0,!0);break;case"img":if($.img.complete){if($.img.width!==$.width||$.img.height!==$.height){p("Decoded image has incorrect dimensions. Got "+$.img.width+"x"+$.img.height+". Expected "+$.width+"x"+$.height+".");return}this.drawImage($.img,$.x,$.y)}else $.img._noVNCDisplay=this,$.img.addEventListener("load",this._resumeRenderQ),Q=!1;break;case"frame":if($.frame.ready){let V=$.frame.frame;if(V.codedWidth<$.width||V.codedHeight<$.height)l("Decoded video frame does not cover its full rectangle area. Expecting at least "+$.width+"x"+$.height+" but got "+V.codedWidth+"x"+V.codedHeight);let J=0,W=0,G=$.width,q=$.height,U=$.x,Z=$.y,Y=G,X=q;this.drawImage(V,J,W,G,q,U,Z,Y,X),V.close()}else{let V=this;$.frame.promise.then(()=>{V._scanRenderQ()}),Q=!1}break}if(Q)this._renderQ.shift()}if(this._renderQ.length===0&&this._flushPromise!==null)this._flushResolve(),this._flushPromise=null,this._flushResolve=null}}function G1(Q,$,V,J,W){if($.subarray&&Q.subarray){Q.set($.subarray(V,V+J),W);return}for(var G=0;G<J;G++)Q[W+G]=$[V+G]}var p1=Uint8Array,V1=Uint16Array,$0=Int32Array;function m1(Q,$,V,J){var W=Q&65535|0,G=Q>>>16&65535|0,q=0;while(V!==0){q=V>2000?2000:V,V-=q;do W=W+$[J++]|0,G=G+W|0;while(--q);W%=65521,G%=65521}return W|G<<16|0}function i(){var Q,$=[];for(var V=0;V<256;V++){Q=V;for(var J=0;J<8;J++)Q=Q&1?3988292384^Q>>>1:Q>>>1;$[V]=Q}return $}var v4=i();var O0=30,a8=12;function z6(Q,$){var V,J,W,G,q,U,Z,Y,X,I,j,P,O,k,E,D,S,R,A,v,b,K,x,f,g;V=Q.state,J=Q.next_in,f=Q.input,W=J+(Q.avail_in-5),G=Q.next_out,g=Q.output,q=G-($-Q.avail_out),U=G+(Q.avail_out-257),Z=V.dmax,Y=V.wsize,X=V.whave,I=V.wnext,j=V.window,P=V.hold,O=V.bits,k=V.lencode,E=V.distcode,D=(1<<V.lenbits)-1,S=(1<<V.distbits)-1;Q:do{if(O<15)P+=f[J++]<<O,O+=8,P+=f[J++]<<O,O+=8;R=k[P&D];V:for(;;){if(A=R>>>24,P>>>=A,O-=A,A=R>>>16&255,A===0)g[G++]=R&65535;else if(A&16){if(v=R&65535,A&=15,A){if(O<A)P+=f[J++]<<O,O+=8;v+=P&(1<<A)-1,P>>>=A,O-=A}if(O<15)P+=f[J++]<<O,O+=8,P+=f[J++]<<O,O+=8;R=E[P&S];$:for(;;){if(A=R>>>24,P>>>=A,O-=A,A=R>>>16&255,A&16){if(b=R&65535,A&=15,O<A){if(P+=f[J++]<<O,O+=8,O<A)P+=f[J++]<<O,O+=8}if(b+=P&(1<<A)-1,b>Z){Q.msg="invalid distance too far back",V.mode=O0;break Q}if(P>>>=A,O-=A,A=G-q,b>A){if(A=b-A,A>X){if(V.sane){Q.msg="invalid distance too far back",V.mode=O0;break Q}}if(K=0,x=j,I===0){if(K+=Y-A,A<v){v-=A;do g[G++]=j[K++];while(--A);K=G-b,x=g}}else if(I<A){if(K+=Y+I-A,A-=I,A<v){v-=A;do g[G++]=j[K++];while(--A);if(K=0,I<v){A=I,v-=A;do g[G++]=j[K++];while(--A);K=G-b,x=g}}}else if(K+=I-A,A<v){v-=A;do g[G++]=j[K++];while(--A);K=G-b,x=g}while(v>2)g[G++]=x[K++],g[G++]=x[K++],g[G++]=x[K++],v-=3;if(v){if(g[G++]=x[K++],v>1)g[G++]=x[K++]}}else{K=G-b;do g[G++]=g[K++],g[G++]=g[K++],g[G++]=g[K++],v-=3;while(v>2);if(v){if(g[G++]=g[K++],v>1)g[G++]=g[K++]}}}else if((A&64)===0){R=E[(R&65535)+(P&(1<<A)-1)];continue $}else{Q.msg="invalid distance code",V.mode=O0;break Q}break}}else if((A&64)===0){R=k[(R&65535)+(P&(1<<A)-1)];continue V}else if(A&32){V.mode=a8;break Q}else{Q.msg="invalid literal/length code",V.mode=O0;break Q}break}}while(J<W&&G<U);v=O>>3,J-=v,O-=v<<3,P&=(1<<O)-1,Q.next_in=J,Q.next_out=G,Q.avail_in=J<W?5+(W-J):5-(J-W),Q.avail_out=G<U?257+(U-G):257-(G-U),V.hold=P,V.bits=O;return}var b1=15,V2=852,$2=592,J2=0,P6=1,W2=2,t8=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s8=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],e8=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Q5=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function E1(Q,$,V,J,W,G,q,U){var Z=U.bits,Y=0,X=0,I=0,j=0,P=0,O=0,k=0,E=0,D=0,S=0,R,A,v,b,K,x=null,f=0,g,m=new V1(b1+1),P1=new V1(b1+1),J1=null,D1=0,C1,o,I0;for(Y=0;Y<=b1;Y++)m[Y]=0;for(X=0;X<J;X++)m[$[V+X]]++;P=Z;for(j=b1;j>=1;j--)if(m[j]!==0)break;if(P>j)P=j;if(j===0)return W[G++]=20971520,W[G++]=20971520,U.bits=1,0;for(I=1;I<j;I++)if(m[I]!==0)break;if(P<I)P=I;E=1;for(Y=1;Y<=b1;Y++)if(E<<=1,E-=m[Y],E<0)return-1;if(E>0&&(Q===J2||j!==1))return-1;P1[1]=0;for(Y=1;Y<b1;Y++)P1[Y+1]=P1[Y]+m[Y];for(X=0;X<J;X++)if($[V+X]!==0)q[P1[$[V+X]]++]=X;if(Q===J2)x=J1=q,g=19;else if(Q===P6)x=t8,f-=257,J1=s8,D1-=257,g=256;else x=e8,J1=Q5,g=-1;if(S=0,X=0,Y=I,K=G,O=P,k=0,v=-1,D=1<<P,b=D-1,Q===P6&&D>V2||Q===W2&&D>$2)return 1;for(;;){if(C1=Y-k,q[X]<g)o=0,I0=q[X];else if(q[X]>g)o=J1[D1+q[X]],I0=x[f+q[X]];else o=96,I0=0;R=1<<Y-k,A=1<<O,I=A;do A-=R,W[K+(S>>k)+A]=C1<<24|o<<16|I0|0;while(A!==0);R=1<<Y-1;while(S&R)R>>=1;if(R!==0)S&=R-1,S+=R;else S=0;if(X++,--m[Y]===0){if(Y===j)break;Y=$[V+q[X]]}if(Y>P&&(S&b)!==v){if(k===0)k=P;K+=I,O=Y-k,E=1<<O;while(O+k<j){if(E-=m[O+k],E<=0)break;O++,E<<=1}if(D+=1<<O,Q===P6&&D>V2||Q===W2&&D>$2)return 1;v=S&b,W[v]=P<<24|O<<16|K-G|0}}if(S!==0)W[K+S]=Y-k<<24|4194304|0;return U.bits=P,0}var V5=0,k2=1,x2=2,G2=4,$5=5,A0=6,K0=0,J5=1,W5=2,w1=-2,G5=-3,q2=-4,q5=-5,U2=8,f2=1,Y2=2,X2=3,Z2=4,z2=5,P2=6,j2=7,H2=8,L2=9,F2=10,C2=11,H1=12,j6=13,I2=14,H6=15,B2=16,N2=17,M2=18,O2=19,D0=20,R0=21,A2=22,D2=23,R2=24,K2=25,E2=26,L6=27,w2=28,S2=29,c=30,T2=31,U5=32,Y5=852,X5=592,Z5=15,z5=Z5;function v2(Q){return(Q>>>24&255)+(Q>>>8&65280)+((Q&65280)<<8)+((Q&255)<<24)}function P5(){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 V1(320),this.work=new V1(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function j5(Q){var $;if(!Q||!Q.state)return w1;if($=Q.state,Q.total_in=Q.total_out=$.total=0,Q.msg="",$.wrap)Q.adler=$.wrap&1;return $.mode=f2,$.last=0,$.havedict=0,$.dmax=32768,$.head=null,$.hold=0,$.bits=0,$.lencode=$.lendyn=new $0(Y5),$.distcode=$.distdyn=new $0(X5),$.sane=1,$.back=-1,K0}function I6(Q){var $;if(!Q||!Q.state)return w1;return $=Q.state,$.wsize=0,$.whave=0,$.wnext=0,j5(Q)}function H5(Q,$){var V,J;if(!Q||!Q.state)return w1;if(J=Q.state,$<0)V=0,$=-$;else if(V=($>>4)+1,$<48)$&=15;if($&&($<8||$>15))return w1;if(J.window!==null&&J.wbits!==$)J.window=null;return J.wrap=V,J.wbits=$,I6(Q)}function L5(Q,$){var V,J;if(!Q)return w1;if(J=new P5,Q.state=J,J.window=null,V=H5(Q,$),V!==K0)Q.state=null;return V}function u2(Q){return L5(Q,z5)}var g2=!0,F6,C6;function F5(Q){if(g2){var $;F6=new $0(512),C6=new $0(32),$=0;while($<144)Q.lens[$++]=8;while($<256)Q.lens[$++]=9;while($<280)Q.lens[$++]=7;while($<288)Q.lens[$++]=8;E1(k2,Q.lens,0,288,F6,0,Q.work,{bits:9}),$=0;while($<32)Q.lens[$++]=5;E1(x2,Q.lens,0,32,C6,0,Q.work,{bits:5}),g2=!1}Q.lencode=F6,Q.lenbits=9,Q.distcode=C6,Q.distbits=5}function C5(Q,$,V,J){var W,G=Q.state;if(G.window===null)G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new p1(G.wsize);if(J>=G.wsize)G1(G.window,$,V-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize;else{if(W=G.wsize-G.wnext,W>J)W=J;if(G1(G.window,$,V-J,W,G.wnext),J-=W,J)G1(G.window,$,V-J,J,0),G.wnext=J,G.whave=G.wsize;else{if(G.wnext+=W,G.wnext===G.wsize)G.wnext=0;if(G.whave<G.wsize)G.whave+=W}}return 0}function _2(Q,$){var V,J,W,G,q,U,Z,Y,X,I,j,P,O,k,E=0,D,S,R,A,v,b,K,x,f=new p1(4),g,m,P1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Q||!Q.state||!Q.output||!Q.input&&Q.avail_in!==0)return w1;if(V=Q.state,V.mode===H1)V.mode=j6;q=Q.next_out,W=Q.output,Z=Q.avail_out,G=Q.next_in,J=Q.input,U=Q.avail_in,Y=V.hold,X=V.bits,I=U,j=Z,x=K0;Q:for(;;)switch(V.mode){case f2:if(V.wrap===0){V.mode=j6;break}while(X<16){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(V.wrap&2&&Y===35615){V.check=0,f[0]=Y&255,f[1]=Y>>>8&255,V.check=i(V.check,f,2,0),Y=0,X=0,V.mode=Y2;break}if(V.flags=0,V.head)V.head.done=!1;if(!(V.wrap&1)||(((Y&255)<<8)+(Y>>8))%31){Q.msg="incorrect header check",V.mode=c;break}if((Y&15)!==U2){Q.msg="unknown compression method",V.mode=c;break}if(Y>>>=4,X-=4,K=(Y&15)+8,V.wbits===0)V.wbits=K;else if(K>V.wbits){Q.msg="invalid window size",V.mode=c;break}V.dmax=1<<K,Q.adler=V.check=1,V.mode=Y&512?F2:H1,Y=0,X=0;break;case Y2:while(X<16){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(V.flags=Y,(V.flags&255)!==U2){Q.msg="unknown compression method",V.mode=c;break}if(V.flags&57344){Q.msg="unknown header flags set",V.mode=c;break}if(V.head)V.head.text=Y>>8&1;if(V.flags&512)f[0]=Y&255,f[1]=Y>>>8&255,V.check=i(V.check,f,2,0);Y=0,X=0,V.mode=X2;case X2:while(X<32){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(V.head)V.head.time=Y;if(V.flags&512)f[0]=Y&255,f[1]=Y>>>8&255,f[2]=Y>>>16&255,f[3]=Y>>>24&255,V.check=i(V.check,f,4,0);Y=0,X=0,V.mode=Z2;case Z2:while(X<16){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(V.head)V.head.xflags=Y&255,V.head.os=Y>>8;if(V.flags&512)f[0]=Y&255,f[1]=Y>>>8&255,V.check=i(V.check,f,2,0);Y=0,X=0,V.mode=z2;case z2:if(V.flags&1024){while(X<16){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(V.length=Y,V.head)V.head.extra_len=Y;if(V.flags&512)f[0]=Y&255,f[1]=Y>>>8&255,V.check=i(V.check,f,2,0);Y=0,X=0}else if(V.head)V.head.extra=null;V.mode=P2;case P2:if(V.flags&1024){if(P=V.length,P>U)P=U;if(P){if(V.head){if(K=V.head.extra_len-V.length,!V.head.extra)V.head.extra=Array(V.head.extra_len);G1(V.head.extra,J,G,P,K)}if(V.flags&512)V.check=i(V.check,J,P,G);U-=P,G+=P,V.length-=P}if(V.length)break Q}V.length=0,V.mode=j2;case j2:if(V.flags&2048){if(U===0)break Q;P=0;do if(K=J[G+P++],V.head&&K&&V.length<65536)V.head.name+=String.fromCharCode(K);while(K&&P<U);if(V.flags&512)V.check=i(V.check,J,P,G);if(U-=P,G+=P,K)break Q}else if(V.head)V.head.name=null;V.length=0,V.mode=H2;case H2:if(V.flags&4096){if(U===0)break Q;P=0;do if(K=J[G+P++],V.head&&K&&V.length<65536)V.head.comment+=String.fromCharCode(K);while(K&&P<U);if(V.flags&512)V.check=i(V.check,J,P,G);if(U-=P,G+=P,K)break Q}else if(V.head)V.head.comment=null;V.mode=L2;case L2:if(V.flags&512){while(X<16){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(Y!==(V.check&65535)){Q.msg="header crc mismatch",V.mode=c;break}Y=0,X=0}if(V.head)V.head.hcrc=V.flags>>9&1,V.head.done=!0;Q.adler=V.check=0,V.mode=H1;break;case F2:while(X<32){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}Q.adler=V.check=v2(Y),Y=0,X=0,V.mode=C2;case C2:if(V.havedict===0)return Q.next_out=q,Q.avail_out=Z,Q.next_in=G,Q.avail_in=U,V.hold=Y,V.bits=X,W5;Q.adler=V.check=1,V.mode=H1;case H1:if($===$5||$===A0)break Q;case j6:if(V.last){Y>>>=X&7,X-=X&7,V.mode=L6;break}while(X<3){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}switch(V.last=Y&1,Y>>>=1,X-=1,Y&3){case 0:V.mode=I2;break;case 1:if(F5(V),V.mode=D0,$===A0){Y>>>=2,X-=2;break Q}break;case 2:V.mode=N2;break;case 3:Q.msg="invalid block type",V.mode=c}Y>>>=2,X-=2;break;case I2:Y>>>=X&7,X-=X&7;while(X<32){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if((Y&65535)!==(Y>>>16^65535)){Q.msg="invalid stored block lengths",V.mode=c;break}if(V.length=Y&65535,Y=0,X=0,V.mode=H6,$===A0)break Q;case H6:V.mode=B2;case B2:if(P=V.length,P){if(P>U)P=U;if(P>Z)P=Z;if(P===0)break Q;G1(W,J,G,P,q),U-=P,G+=P,Z-=P,q+=P,V.length-=P;break}V.mode=H1;break;case N2:while(X<14){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(V.nlen=(Y&31)+257,Y>>>=5,X-=5,V.ndist=(Y&31)+1,Y>>>=5,X-=5,V.ncode=(Y&15)+4,Y>>>=4,X-=4,V.nlen>286||V.ndist>30){Q.msg="too many length or distance symbols",V.mode=c;break}V.have=0,V.mode=M2;case M2:while(V.have<V.ncode){while(X<3){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}V.lens[P1[V.have++]]=Y&7,Y>>>=3,X-=3}while(V.have<19)V.lens[P1[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,g={bits:V.lenbits},x=E1(V5,V.lens,0,19,V.lencode,0,V.work,g),V.lenbits=g.bits,x){Q.msg="invalid code lengths set",V.mode=c;break}V.have=0,V.mode=O2;case O2:while(V.have<V.nlen+V.ndist){for(;;){if(E=V.lencode[Y&(1<<V.lenbits)-1],D=E>>>24,S=E>>>16&255,R=E&65535,D<=X)break;if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(R<16)Y>>>=D,X-=D,V.lens[V.have++]=R;else{if(R===16){m=D+2;while(X<m){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(Y>>>=D,X-=D,V.have===0){Q.msg="invalid bit length repeat",V.mode=c;break}K=V.lens[V.have-1],P=3+(Y&3),Y>>>=2,X-=2}else if(R===17){m=D+3;while(X<m){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}Y>>>=D,X-=D,K=0,P=3+(Y&7),Y>>>=3,X-=3}else{m=D+7;while(X<m){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}Y>>>=D,X-=D,K=0,P=11+(Y&127),Y>>>=7,X-=7}if(V.have+P>V.nlen+V.ndist){Q.msg="invalid bit length repeat",V.mode=c;break}while(P--)V.lens[V.have++]=K}}if(V.mode===c)break;if(V.lens[256]===0){Q.msg="invalid code -- missing end-of-block",V.mode=c;break}if(V.lenbits=9,g={bits:V.lenbits},x=E1(k2,V.lens,0,V.nlen,V.lencode,0,V.work,g),V.lenbits=g.bits,x){Q.msg="invalid literal/lengths set",V.mode=c;break}if(V.distbits=6,V.distcode=V.distdyn,g={bits:V.distbits},x=E1(x2,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,g),V.distbits=g.bits,x){Q.msg="invalid distances set",V.mode=c;break}if(V.mode=D0,$===A0)break Q;case D0:V.mode=R0;case R0:if(U>=6&&Z>=258){if(Q.next_out=q,Q.avail_out=Z,Q.next_in=G,Q.avail_in=U,V.hold=Y,V.bits=X,z6(Q,j),q=Q.next_out,W=Q.output,Z=Q.avail_out,G=Q.next_in,J=Q.input,U=Q.avail_in,Y=V.hold,X=V.bits,V.mode===H1)V.back=-1;break}V.back=0;for(;;){if(E=V.lencode[Y&(1<<V.lenbits)-1],D=E>>>24,S=E>>>16&255,R=E&65535,D<=X)break;if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(S&&(S&240)===0){A=D,v=S,b=R;for(;;){if(E=V.lencode[b+((Y&(1<<A+v)-1)>>A)],D=E>>>24,S=E>>>16&255,R=E&65535,A+D<=X)break;if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}Y>>>=A,X-=A,V.back+=A}if(Y>>>=D,X-=D,V.back+=D,V.length=R,S===0){V.mode=E2;break}if(S&32){V.back=-1,V.mode=H1;break}if(S&64){Q.msg="invalid literal/length code",V.mode=c;break}V.extra=S&15,V.mode=A2;case A2:if(V.extra){m=V.extra;while(X<m){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}V.length+=Y&(1<<V.extra)-1,Y>>>=V.extra,X-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=D2;case D2:for(;;){if(E=V.distcode[Y&(1<<V.distbits)-1],D=E>>>24,S=E>>>16&255,R=E&65535,D<=X)break;if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if((S&240)===0){A=D,v=S,b=R;for(;;){if(E=V.distcode[b+((Y&(1<<A+v)-1)>>A)],D=E>>>24,S=E>>>16&255,R=E&65535,A+D<=X)break;if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}Y>>>=A,X-=A,V.back+=A}if(Y>>>=D,X-=D,V.back+=D,S&64){Q.msg="invalid distance code",V.mode=c;break}V.offset=R,V.extra=S&15,V.mode=R2;case R2:if(V.extra){m=V.extra;while(X<m){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}V.offset+=Y&(1<<V.extra)-1,Y>>>=V.extra,X-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){Q.msg="invalid distance too far back",V.mode=c;break}V.mode=K2;case K2:if(Z===0)break Q;if(P=j-Z,V.offset>P){if(P=V.offset-P,P>V.whave){if(V.sane){Q.msg="invalid distance too far back",V.mode=c;break}}if(P>V.wnext)P-=V.wnext,O=V.wsize-P;else O=V.wnext-P;if(P>V.length)P=V.length;k=V.window}else k=W,O=q-V.offset,P=V.length;if(P>Z)P=Z;Z-=P,V.length-=P;do W[q++]=k[O++];while(--P);if(V.length===0)V.mode=R0;break;case E2:if(Z===0)break Q;W[q++]=V.length,Z--,V.mode=R0;break;case L6:if(V.wrap){while(X<32){if(U===0)break Q;U--,Y|=J[G++]<<X,X+=8}if(j-=Z,Q.total_out+=j,V.total+=j,j)Q.adler=V.check=V.flags?i(V.check,W,j,q-j):m1(V.check,W,j,q-j);if(j=Z,(V.flags?Y:v2(Y))!==V.check){Q.msg="incorrect data check",V.mode=c;break}Y=0,X=0}V.mode=w2;case w2:if(V.wrap&&V.flags){while(X<32){if(U===0)break Q;U--,Y+=J[G++]<<X,X+=8}if(Y!==(V.total&4294967295)){Q.msg="incorrect length check",V.mode=c;break}Y=0,X=0}V.mode=S2;case S2:x=J5;break Q;case c:x=G5;break Q;case T2:return q2;case U5:default:return w1}if(Q.next_out=q,Q.avail_out=Z,Q.next_in=G,Q.avail_in=U,V.hold=Y,V.bits=X,V.wsize||j!==Q.avail_out&&V.mode<c&&(V.mode<L6||$!==G2)){if(C5(Q,Q.output,Q.next_out,j-Q.avail_out))return V.mode=T2,q2}if(I-=Q.avail_in,j-=Q.avail_out,Q.total_in+=I,Q.total_out+=j,V.total+=j,V.wrap&&j)Q.adler=V.check=V.flags?i(V.check,W,j,Q.next_out-j):m1(V.check,W,j,Q.next_out-j);if(Q.data_type=V.bits+(V.last?64:0)+(V.mode===H1?128:0)+(V.mode===D0||V.mode===H6?256:0),(I===0&&j===0||$===G2)&&x===K0)x=q5;return x}function J0(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}class Y1{constructor(){this.strm=new J0,this.chunkSize=102400,this.strm.output=new Uint8Array(this.chunkSize),u2(this.strm)}setInput(Q){if(!Q)this.strm.input=null,this.strm.avail_in=0,this.strm.next_in=0;else this.strm.input=Q,this.strm.avail_in=this.strm.input.length,this.strm.next_in=0}inflate(Q){if(Q>this.chunkSize)this.chunkSize=Q,this.strm.output=new Uint8Array(this.chunkSize);if(this.strm.next_out=0,this.strm.avail_out=Q,_2(this.strm,0)<0)throw Error("zlib inflate failed");if(this.strm.next_out!=Q)throw Error("Incomplete zlib block");return new Uint8Array(this.strm.output.buffer,0,this.strm.next_out)}reset(){I6(this.strm)}}var I5=4,y2=0,h2=1,B5=2;function n1(Q){var $=Q.length;while(--$>=0)Q[$]=0}var N5=0,i2=1,M5=2,O5=3,A5=258,R6=29,X0=256,G0=X0+1+R6,c1=30,K6=19,r2=2*G0+1,S1=15,B6=16,D5=7,E6=256,l2=16,o2=17,d2=18,A6=[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],E0=[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],R5=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],a2=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K5=512,L1=Array((G0+2)*2);n1(L1);var W0=Array(c1*2);n1(W0);var q0=Array(K5);n1(q0);var U0=Array(A5-O5+1);n1(U0);var w6=Array(R6);n1(w6);var w0=Array(c1);n1(w0);function N6(Q,$,V,J,W){this.static_tree=Q,this.extra_bits=$,this.extra_base=V,this.elems=J,this.max_length=W,this.has_stree=Q&&Q.length}var t2,s2,e2;function M6(Q,$){this.dyn_tree=Q,this.max_code=0,this.stat_desc=$}function Q8(Q){return Q<256?q0[Q]:q0[256+(Q>>>7)]}function Y0(Q,$){Q.pending_buf[Q.pending++]=$&255,Q.pending_buf[Q.pending++]=$>>>8&255}function $1(Q,$,V){if(Q.bi_valid>B6-V)Q.bi_buf|=$<<Q.bi_valid&65535,Y0(Q,Q.bi_buf),Q.bi_buf=$>>B6-Q.bi_valid,Q.bi_valid+=V-B6;else Q.bi_buf|=$<<Q.bi_valid&65535,Q.bi_valid+=V}function X1(Q,$,V){$1(Q,V[$*2],V[$*2+1])}function V8(Q,$){var V=0;do V|=Q&1,Q>>>=1,V<<=1;while(--$>0);return V>>>1}function E5(Q){if(Q.bi_valid===16)Y0(Q,Q.bi_buf),Q.bi_buf=0,Q.bi_valid=0;else if(Q.bi_valid>=8)Q.pending_buf[Q.pending++]=Q.bi_buf&255,Q.bi_buf>>=8,Q.bi_valid-=8}function w5(Q,$){var{dyn_tree:V,max_code:J}=$,W=$.stat_desc.static_tree,G=$.stat_desc.has_stree,q=$.stat_desc.extra_bits,U=$.stat_desc.extra_base,Z=$.stat_desc.max_length,Y,X,I,j,P,O,k=0;for(j=0;j<=S1;j++)Q.bl_count[j]=0;V[Q.heap[Q.heap_max]*2+1]=0;for(Y=Q.heap_max+1;Y<r2;Y++){if(X=Q.heap[Y],j=V[V[X*2+1]*2+1]+1,j>Z)j=Z,k++;if(V[X*2+1]=j,X>J)continue;if(Q.bl_count[j]++,P=0,X>=U)P=q[X-U];if(O=V[X*2],Q.opt_len+=O*(j+P),G)Q.static_len+=O*(W[X*2+1]+P)}if(k===0)return;do{j=Z-1;while(Q.bl_count[j]===0)j--;Q.bl_count[j]--,Q.bl_count[j+1]+=2,Q.bl_count[Z]--,k-=2}while(k>0);for(j=Z;j!==0;j--){X=Q.bl_count[j];while(X!==0){if(I=Q.heap[--Y],I>J)continue;if(V[I*2+1]!==j)Q.opt_len+=(j-V[I*2+1])*V[I*2],V[I*2+1]=j;X--}}}function $8(Q,$,V){var J=Array(S1+1),W=0,G,q;for(G=1;G<=S1;G++)J[G]=W=W+V[G-1]<<1;for(q=0;q<=$;q++){var U=Q[q*2+1];if(U===0)continue;Q[q*2]=V8(J[U]++,U)}}function S5(){var Q,$,V,J,W,G=Array(S1+1);V=0;for(J=0;J<R6-1;J++){w6[J]=V;for(Q=0;Q<1<<A6[J];Q++)U0[V++]=J}U0[V-1]=J,W=0;for(J=0;J<16;J++){w0[J]=W;for(Q=0;Q<1<<E0[J];Q++)q0[W++]=J}W>>=7;for(;J<c1;J++){w0[J]=W<<7;for(Q=0;Q<1<<E0[J]-7;Q++)q0[256+W++]=J}for($=0;$<=S1;$++)G[$]=0;Q=0;while(Q<=143)L1[Q*2+1]=8,Q++,G[8]++;while(Q<=255)L1[Q*2+1]=9,Q++,G[9]++;while(Q<=279)L1[Q*2+1]=7,Q++,G[7]++;while(Q<=287)L1[Q*2+1]=8,Q++,G[8]++;$8(L1,G0+1,G);for(Q=0;Q<c1;Q++)W0[Q*2+1]=5,W0[Q*2]=V8(Q,5);t2=new N6(L1,A6,X0+1,G0,S1),s2=new N6(W0,E0,0,c1,S1),e2=new N6([],R5,0,K6,D5)}function J8(Q){var $;for($=0;$<G0;$++)Q.dyn_ltree[$*2]=0;for($=0;$<c1;$++)Q.dyn_dtree[$*2]=0;for($=0;$<K6;$++)Q.bl_tree[$*2]=0;Q.dyn_ltree[E6*2]=1,Q.opt_len=Q.static_len=0,Q.last_lit=Q.matches=0}function W8(Q){if(Q.bi_valid>8)Y0(Q,Q.bi_buf);else if(Q.bi_valid>0)Q.pending_buf[Q.pending++]=Q.bi_buf;Q.bi_buf=0,Q.bi_valid=0}function T5(Q,$,V,J){if(W8(Q),J)Y0(Q,V),Y0(Q,~V);G1(Q.pending_buf,Q.window,$,V,Q.pending),Q.pending+=V}function p2(Q,$,V,J){var W=$*2,G=V*2;return Q[W]<Q[G]||Q[W]===Q[G]&&J[$]<=J[V]}function O6(Q,$,V){var J=Q.heap[V],W=V<<1;while(W<=Q.heap_len){if(W<Q.heap_len&&p2($,Q.heap[W+1],Q.heap[W],Q.depth))W++;if(p2($,J,Q.heap[W],Q.depth))break;Q.heap[V]=Q.heap[W],V=W,W<<=1}Q.heap[V]=J}function m2(Q,$,V){var J,W,G=0,q,U;if(Q.last_lit!==0)do if(J=Q.pending_buf[Q.d_buf+G*2]<<8|Q.pending_buf[Q.d_buf+G*2+1],W=Q.pending_buf[Q.l_buf+G],G++,J===0)X1(Q,W,$);else{if(q=U0[W],X1(Q,q+X0+1,$),U=A6[q],U!==0)W-=w6[q],$1(Q,W,U);if(J--,q=Q8(J),X1(Q,q,V),U=E0[q],U!==0)J-=w0[q],$1(Q,J,U)}while(G<Q.last_lit);X1(Q,E6,$)}function D6(Q,$){var V=$.dyn_tree,J=$.stat_desc.static_tree,W=$.stat_desc.has_stree,G=$.stat_desc.elems,q,U,Z=-1,Y;Q.heap_len=0,Q.heap_max=r2;for(q=0;q<G;q++)if(V[q*2]!==0)Q.heap[++Q.heap_len]=Z=q,Q.depth[q]=0;else V[q*2+1]=0;while(Q.heap_len<2)if(Y=Q.heap[++Q.heap_len]=Z<2?++Z:0,V[Y*2]=1,Q.depth[Y]=0,Q.opt_len--,W)Q.static_len-=J[Y*2+1];$.max_code=Z;for(q=Q.heap_len>>1;q>=1;q--)O6(Q,V,q);Y=G;do q=Q.heap[1],Q.heap[1]=Q.heap[Q.heap_len--],O6(Q,V,1),U=Q.heap[1],Q.heap[--Q.heap_max]=q,Q.heap[--Q.heap_max]=U,V[Y*2]=V[q*2]+V[U*2],Q.depth[Y]=(Q.depth[q]>=Q.depth[U]?Q.depth[q]:Q.depth[U])+1,V[q*2+1]=V[U*2+1]=Y,Q.heap[1]=Y++,O6(Q,V,1);while(Q.heap_len>=2);Q.heap[--Q.heap_max]=Q.heap[1],w5(Q,$),$8(V,Z,Q.bl_count)}function b2(Q,$,V){var J,W=-1,G,q=$[1],U=0,Z=7,Y=4;if(q===0)Z=138,Y=3;$[(V+1)*2+1]=65535;for(J=0;J<=V;J++){if(G=q,q=$[(J+1)*2+1],++U<Z&&G===q)continue;else if(U<Y)Q.bl_tree[G*2]+=U;else if(G!==0){if(G!==W)Q.bl_tree[G*2]++;Q.bl_tree[l2*2]++}else if(U<=10)Q.bl_tree[o2*2]++;else Q.bl_tree[d2*2]++;if(U=0,W=G,q===0)Z=138,Y=3;else if(G===q)Z=6,Y=3;else Z=7,Y=4}}function c2(Q,$,V){var J,W=-1,G,q=$[1],U=0,Z=7,Y=4;if(q===0)Z=138,Y=3;for(J=0;J<=V;J++){if(G=q,q=$[(J+1)*2+1],++U<Z&&G===q)continue;else if(U<Y)do X1(Q,G,Q.bl_tree);while(--U!==0);else if(G!==0){if(G!==W)X1(Q,G,Q.bl_tree),U--;X1(Q,l2,Q.bl_tree),$1(Q,U-3,2)}else if(U<=10)X1(Q,o2,Q.bl_tree),$1(Q,U-3,3);else X1(Q,d2,Q.bl_tree),$1(Q,U-11,7);if(U=0,W=G,q===0)Z=138,Y=3;else if(G===q)Z=6,Y=3;else Z=7,Y=4}}function v5(Q){var $;b2(Q,Q.dyn_ltree,Q.l_desc.max_code),b2(Q,Q.dyn_dtree,Q.d_desc.max_code),D6(Q,Q.bl_desc);for($=K6-1;$>=3;$--)if(Q.bl_tree[a2[$]*2+1]!==0)break;return Q.opt_len+=3*($+1)+5+5+4,$}function g5(Q,$,V,J){var W;$1(Q,$-257,5),$1(Q,V-1,5),$1(Q,J-4,4);for(W=0;W<J;W++)$1(Q,Q.bl_tree[a2[W]*2+1],3);c2(Q,Q.dyn_ltree,$-1),c2(Q,Q.dyn_dtree,V-1)}function k5(Q){var $=4093624447,V;for(V=0;V<=31;V++,$>>>=1)if($&1&&Q.dyn_ltree[V*2]!==0)return y2;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return h2;for(V=32;V<X0;V++)if(Q.dyn_ltree[V*2]!==0)return h2;return y2}var n2=!1;function G8(Q){if(!n2)S5(),n2=!0;Q.l_desc=new M6(Q.dyn_ltree,t2),Q.d_desc=new M6(Q.dyn_dtree,s2),Q.bl_desc=new M6(Q.bl_tree,e2),Q.bi_buf=0,Q.bi_valid=0,J8(Q)}function S6(Q,$,V,J){$1(Q,(N5<<1)+(J?1:0),3),T5(Q,$,V,!0)}function q8(Q){$1(Q,i2<<1,3),X1(Q,E6,L1),E5(Q)}function U8(Q,$,V,J){var W,G,q=0;if(Q.level>0){if(Q.strm.data_type===B5)Q.strm.data_type=k5(Q);if(D6(Q,Q.l_desc),D6(Q,Q.d_desc),q=v5(Q),W=Q.opt_len+3+7>>>3,G=Q.static_len+3+7>>>3,G<=W)W=G}else W=G=V+5;if(V+4<=W&&$!==-1)S6(Q,$,V,J);else if(Q.strategy===I5||G===W)$1(Q,(i2<<1)+(J?1:0),3),m2(Q,L1,W0);else $1(Q,(M5<<1)+(J?1:0),3),g5(Q,Q.l_desc.max_code+1,Q.d_desc.max_code+1,q+1),m2(Q,Q.dyn_ltree,Q.dyn_dtree);if(J8(Q),J)W8(Q)}function F1(Q,$,V){if(Q.pending_buf[Q.d_buf+Q.last_lit*2]=$>>>8&255,Q.pending_buf[Q.d_buf+Q.last_lit*2+1]=$&255,Q.pending_buf[Q.l_buf+Q.last_lit]=V&255,Q.last_lit++,$===0)Q.dyn_ltree[V*2]++;else Q.matches++,$--,Q.dyn_ltree[(U0[V]+X0+1)*2]++,Q.dyn_dtree[Q8($)*2]++;return Q.last_lit===Q.lit_bufsize-1}var Y8={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"};var k1=0,f5=1,v0=3,M1=4,X8=5,T1=0,Z8=1,o1=-2;var T6=-5,u6=-1,u5=1,S0=2,_5=3,y5=4,h5=0,p5=2,g0=8,m5=9,b5=15,c5=8,n5=29,i5=256,f6=i5+1+n5,r5=30,l5=19,o5=2*f6+1,d5=15,y=3,N1=258,U1=N1+y+1,a5=32,j8=42,z8=69,v6=73,g6=91,k6=103,z0=113,T0=666,d=1,P0=2,g1=3,d1=4,t5=3;function r1(Q,$){return Q.msg=Y8[$],$}function P8(Q){return(Q<<1)-(Q>4?9:0)}function v1(Q){var $=Q.length;while(--$>=0)Q[$]=0}function B1(Q){var $=Q.state,V=$.pending;if(V>Q.avail_out)V=Q.avail_out;if(V===0)return;if(G1(Q.output,$.pending_buf,$.pending_out,V,Q.next_out),Q.next_out+=V,$.pending_out+=V,Q.total_out+=V,Q.avail_out-=V,$.pending-=V,$.pending===0)$.pending_out=0}function a(Q,$){U8(Q,Q.block_start>=0?Q.block_start:-1,Q.strstart-Q.block_start,$),Q.block_start=Q.strstart,B1(Q.strm)}function _(Q,$){Q.pending_buf[Q.pending++]=$}function Z0(Q,$){Q.pending_buf[Q.pending++]=$>>>8&255,Q.pending_buf[Q.pending++]=$&255}function s5(Q,$,V,J){var W=Q.avail_in;if(W>J)W=J;if(W===0)return 0;if(Q.avail_in-=W,G1($,Q.input,Q.next_in,W,V),Q.state.wrap===1)Q.adler=m1(Q.adler,$,W,V);else if(Q.state.wrap===2)Q.adler=i(Q.adler,$,W,V);return Q.next_in+=W,Q.total_in+=W,W}function H8(Q,$){var{max_chain_length:V,strstart:J}=Q,W,G,q=Q.prev_length,U=Q.nice_match,Z=Q.strstart>Q.w_size-U1?Q.strstart-(Q.w_size-U1):0,Y=Q.window,X=Q.w_mask,I=Q.prev,j=Q.strstart+N1,P=Y[J+q-1],O=Y[J+q];if(Q.prev_length>=Q.good_match)V>>=2;if(U>Q.lookahead)U=Q.lookahead;do{if(W=$,Y[W+q]!==O||Y[W+q-1]!==P||Y[W]!==Y[J]||Y[++W]!==Y[J+1])continue;J+=2,W++;do;while(Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&Y[++J]===Y[++W]&&J<j);if(G=N1-(j-J),J=j-N1,G>q){if(Q.match_start=$,q=G,G>=U)break;P=Y[J+q-1],O=Y[J+q]}}while(($=I[$&X])>Z&&--V!==0);if(q<=Q.lookahead)return q;return Q.lookahead}function j0(Q){var $=Q.w_size,V,J,W,G,q;do{if(G=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=$+($-U1)){G1(Q.window,Q.window,$,$,0),Q.match_start-=$,Q.strstart-=$,Q.block_start-=$,J=Q.hash_size,V=J;do W=Q.head[--V],Q.head[V]=W>=$?W-$:0;while(--J);J=$,V=J;do W=Q.prev[--V],Q.prev[V]=W>=$?W-$:0;while(--J);G+=$}if(Q.strm.avail_in===0)break;if(J=s5(Q.strm,Q.window,Q.strstart+Q.lookahead,G),Q.lookahead+=J,Q.lookahead+Q.insert>=y){q=Q.strstart-Q.insert,Q.ins_h=Q.window[q],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[q+1])&Q.hash_mask;while(Q.insert)if(Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[q+y-1])&Q.hash_mask,Q.prev[q&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=q,q++,Q.insert--,Q.lookahead+Q.insert<y)break}}while(Q.lookahead<U1&&Q.strm.avail_in!==0)}function e5(Q,$){var V=65535;if(V>Q.pending_buf_size-5)V=Q.pending_buf_size-5;for(;;){if(Q.lookahead<=1){if(j0(Q),Q.lookahead===0&&$===k1)return d;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var J=Q.block_start+V;if(Q.strstart===0||Q.strstart>=J){if(Q.lookahead=Q.strstart-J,Q.strstart=J,a(Q,!1),Q.strm.avail_out===0)return d}if(Q.strstart-Q.block_start>=Q.w_size-U1){if(a(Q,!1),Q.strm.avail_out===0)return d}}if(Q.insert=0,$===M1){if(a(Q,!0),Q.strm.avail_out===0)return g1;return d1}if(Q.strstart>Q.block_start){if(a(Q,!1),Q.strm.avail_out===0)return d}return d}function x6(Q,$){var V,J;for(;;){if(Q.lookahead<U1){if(j0(Q),Q.lookahead<U1&&$===k1)return d;if(Q.lookahead===0)break}if(V=0,Q.lookahead>=y)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+y-1])&Q.hash_mask,V=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(V!==0&&Q.strstart-V<=Q.w_size-U1)Q.match_length=H8(Q,V);if(Q.match_length>=y)if(J=F1(Q,Q.strstart-Q.match_start,Q.match_length-y),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=y){Q.match_length--;do Q.strstart++,Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+y-1])&Q.hash_mask,V=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.match_length!==0);Q.strstart++}else Q.strstart+=Q.match_length,Q.match_length=0,Q.ins_h=Q.window[Q.strstart],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+1])&Q.hash_mask;else J=F1(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(J){if(a(Q,!1),Q.strm.avail_out===0)return d}}if(Q.insert=Q.strstart<y-1?Q.strstart:y-1,$===M1){if(a(Q,!0),Q.strm.avail_out===0)return g1;return d1}if(Q.last_lit){if(a(Q,!1),Q.strm.avail_out===0)return d}return P0}function i1(Q,$){var V,J,W;for(;;){if(Q.lookahead<U1){if(j0(Q),Q.lookahead<U1&&$===k1)return d;if(Q.lookahead===0)break}if(V=0,Q.lookahead>=y)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+y-1])&Q.hash_mask,V=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(Q.prev_length=Q.match_length,Q.prev_match=Q.match_start,Q.match_length=y-1,V!==0&&Q.prev_length<Q.max_lazy_match&&Q.strstart-V<=Q.w_size-U1){if(Q.match_length=H8(Q,V),Q.match_length<=5&&(Q.strategy===u5||Q.match_length===y&&Q.strstart-Q.match_start>4096))Q.match_length=y-1}if(Q.prev_length>=y&&Q.match_length<=Q.prev_length){W=Q.strstart+Q.lookahead-y,J=F1(Q,Q.strstart-1-Q.prev_match,Q.prev_length-y),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;do if(++Q.strstart<=W)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+y-1])&Q.hash_mask,V=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.prev_length!==0);if(Q.match_available=0,Q.match_length=y-1,Q.strstart++,J){if(a(Q,!1),Q.strm.avail_out===0)return d}}else if(Q.match_available){if(J=F1(Q,0,Q.window[Q.strstart-1]),J)a(Q,!1);if(Q.strstart++,Q.lookahead--,Q.strm.avail_out===0)return d}else Q.match_available=1,Q.strstart++,Q.lookahead--}if(Q.match_available)J=F1(Q,0,Q.window[Q.strstart-1]),Q.match_available=0;if(Q.insert=Q.strstart<y-1?Q.strstart:y-1,$===M1){if(a(Q,!0),Q.strm.avail_out===0)return g1;return d1}if(Q.last_lit){if(a(Q,!1),Q.strm.avail_out===0)return d}return P0}function Q4(Q,$){var V,J,W,G,q=Q.window;for(;;){if(Q.lookahead<=N1){if(j0(Q),Q.lookahead<=N1&&$===k1)return d;if(Q.lookahead===0)break}if(Q.match_length=0,Q.lookahead>=y&&Q.strstart>0){if(W=Q.strstart-1,J=q[W],J===q[++W]&&J===q[++W]&&J===q[++W]){G=Q.strstart+N1;do;while(J===q[++W]&&J===q[++W]&&J===q[++W]&&J===q[++W]&&J===q[++W]&&J===q[++W]&&J===q[++W]&&J===q[++W]&&W<G);if(Q.match_length=N1-(G-W),Q.match_length>Q.lookahead)Q.match_length=Q.lookahead}}if(Q.match_length>=y)V=F1(Q,1,Q.match_length-y),Q.lookahead-=Q.match_length,Q.strstart+=Q.match_length,Q.match_length=0;else V=F1(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(V){if(a(Q,!1),Q.strm.avail_out===0)return d}}if(Q.insert=0,$===M1){if(a(Q,!0),Q.strm.avail_out===0)return g1;return d1}if(Q.last_lit){if(a(Q,!1),Q.strm.avail_out===0)return d}return P0}function V4(Q,$){var V;for(;;){if(Q.lookahead===0){if(j0(Q),Q.lookahead===0){if($===k1)return d;break}}if(Q.match_length=0,V=F1(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++,V){if(a(Q,!1),Q.strm.avail_out===0)return d}}if(Q.insert=0,$===M1){if(a(Q,!0),Q.strm.avail_out===0)return g1;return d1}if(Q.last_lit){if(a(Q,!1),Q.strm.avail_out===0)return d}return P0}function Z1(Q,$,V,J,W){this.good_length=Q,this.max_lazy=$,this.nice_length=V,this.max_chain=J,this.func=W}var l1;l1=[new Z1(0,0,0,0,e5),new Z1(4,4,8,4,x6),new Z1(4,5,16,8,x6),new Z1(4,6,32,32,x6),new Z1(4,4,16,16,i1),new Z1(8,16,32,32,i1),new Z1(8,16,128,128,i1),new Z1(8,32,128,256,i1),new Z1(32,128,258,1024,i1),new Z1(32,258,258,4096,i1)];function $4(Q){Q.window_size=2*Q.w_size,v1(Q.head),Q.max_lazy_match=l1[Q.level].max_lazy,Q.good_match=l1[Q.level].good_length,Q.nice_match=l1[Q.level].nice_length,Q.max_chain_length=l1[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=y-1,Q.match_available=0,Q.ins_h=0}function J4(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g0,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new V1(o5*2),this.dyn_dtree=new V1((2*r5+1)*2),this.bl_tree=new V1((2*l5+1)*2),v1(this.dyn_ltree),v1(this.dyn_dtree),v1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new V1(d5+1),this.heap=new V1(2*f6+1),v1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new V1(2*f6+1),v1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function W4(Q){var $;if(!Q||!Q.state)return r1(Q,o1);if(Q.total_in=Q.total_out=0,Q.data_type=p5,$=Q.state,$.pending=0,$.pending_out=0,$.wrap<0)$.wrap=-$.wrap;return $.status=$.wrap?j8:z0,Q.adler=$.wrap===2?0:1,$.last_flush=k1,G8($),T1}function G4(Q){var $=W4(Q);if($===T1)$4(Q.state);return $}function q4(Q,$,V,J,W,G){if(!Q)return o1;var q=1;if($===u6)$=6;if(J<0)q=0,J=-J;else if(J>15)q=2,J-=16;if(W<1||W>m5||V!==g0||J<8||J>15||$<0||$>9||G<0||G>y5)return r1(Q,o1);if(J===8)J=9;var U=new J4;return Q.state=U,U.strm=Q,U.wrap=q,U.gzhead=null,U.w_bits=J,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=W+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+y-1)/y),U.window=new p1(U.w_size*2),U.head=new V1(U.hash_size),U.prev=new V1(U.w_size),U.lit_bufsize=1<<W+6,U.pending_buf_size=U.lit_bufsize*4,U.pending_buf=new p1(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=$,U.strategy=G,U.method=V,G4(Q)}function L8(Q,$){return q4(Q,$,g0,b5,c5,h5)}function _6(Q,$){var V,J,W,G;if(!Q||!Q.state||$>X8||$<0)return Q?r1(Q,o1):o1;if(J=Q.state,!Q.output||!Q.input&&Q.avail_in!==0||J.status===T0&&$!==M1)return r1(Q,Q.avail_out===0?T6:o1);if(J.strm=Q,V=J.last_flush,J.last_flush=$,J.status===j8)if(J.wrap===2)if(Q.adler=0,_(J,31),_(J,139),_(J,8),!J.gzhead)_(J,0),_(J,0),_(J,0),_(J,0),_(J,0),_(J,J.level===9?2:J.strategy>=S0||J.level<2?4:0),_(J,t5),J.status=z0;else{if(_(J,(J.gzhead.text?1:0)+(J.gzhead.hcrc?2:0)+(!J.gzhead.extra?0:4)+(!J.gzhead.name?0:8)+(!J.gzhead.comment?0:16)),_(J,J.gzhead.time&255),_(J,J.gzhead.time>>8&255),_(J,J.gzhead.time>>16&255),_(J,J.gzhead.time>>24&255),_(J,J.level===9?2:J.strategy>=S0||J.level<2?4:0),_(J,J.gzhead.os&255),J.gzhead.extra&&J.gzhead.extra.length)_(J,J.gzhead.extra.length&255),_(J,J.gzhead.extra.length>>8&255);if(J.gzhead.hcrc)Q.adler=i(Q.adler,J.pending_buf,J.pending,0);J.gzindex=0,J.status=z8}else{var q=g0+(J.w_bits-8<<4)<<8,U=-1;if(J.strategy>=S0||J.level<2)U=0;else if(J.level<6)U=1;else if(J.level===6)U=2;else U=3;if(q|=U<<6,J.strstart!==0)q|=a5;if(q+=31-q%31,J.status=z0,Z0(J,q),J.strstart!==0)Z0(J,Q.adler>>>16),Z0(J,Q.adler&65535);Q.adler=1}if(J.status===z8)if(J.gzhead.extra){W=J.pending;while(J.gzindex<(J.gzhead.extra.length&65535)){if(J.pending===J.pending_buf_size){if(J.gzhead.hcrc&&J.pending>W)Q.adler=i(Q.adler,J.pending_buf,J.pending-W,W);if(B1(Q),W=J.pending,J.pending===J.pending_buf_size)break}_(J,J.gzhead.extra[J.gzindex]&255),J.gzindex++}if(J.gzhead.hcrc&&J.pending>W)Q.adler=i(Q.adler,J.pending_buf,J.pending-W,W);if(J.gzindex===J.gzhead.extra.length)J.gzindex=0,J.status=v6}else J.status=v6;if(J.status===v6)if(J.gzhead.name){W=J.pending;do{if(J.pending===J.pending_buf_size){if(J.gzhead.hcrc&&J.pending>W)Q.adler=i(Q.adler,J.pending_buf,J.pending-W,W);if(B1(Q),W=J.pending,J.pending===J.pending_buf_size){G=1;break}}if(J.gzindex<J.gzhead.name.length)G=J.gzhead.name.charCodeAt(J.gzindex++)&255;else G=0;_(J,G)}while(G!==0);if(J.gzhead.hcrc&&J.pending>W)Q.adler=i(Q.adler,J.pending_buf,J.pending-W,W);if(G===0)J.gzindex=0,J.status=g6}else J.status=g6;if(J.status===g6)if(J.gzhead.comment){W=J.pending;do{if(J.pending===J.pending_buf_size){if(J.gzhead.hcrc&&J.pending>W)Q.adler=i(Q.adler,J.pending_buf,J.pending-W,W);if(B1(Q),W=J.pending,J.pending===J.pending_buf_size){G=1;break}}if(J.gzindex<J.gzhead.comment.length)G=J.gzhead.comment.charCodeAt(J.gzindex++)&255;else G=0;_(J,G)}while(G!==0);if(J.gzhead.hcrc&&J.pending>W)Q.adler=i(Q.adler,J.pending_buf,J.pending-W,W);if(G===0)J.status=k6}else J.status=k6;if(J.status===k6)if(J.gzhead.hcrc){if(J.pending+2>J.pending_buf_size)B1(Q);if(J.pending+2<=J.pending_buf_size)_(J,Q.adler&255),_(J,Q.adler>>8&255),Q.adler=0,J.status=z0}else J.status=z0;if(J.pending!==0){if(B1(Q),Q.avail_out===0)return J.last_flush=-1,T1}else if(Q.avail_in===0&&P8($)<=P8(V)&&$!==M1)return r1(Q,T6);if(J.status===T0&&Q.avail_in!==0)return r1(Q,T6);if(Q.avail_in!==0||J.lookahead!==0||$!==k1&&J.status!==T0){var Z=J.strategy===S0?V4(J,$):J.strategy===_5?Q4(J,$):l1[J.level].func(J,$);if(Z===g1||Z===d1)J.status=T0;if(Z===d||Z===g1){if(Q.avail_out===0)J.last_flush=-1;return T1}if(Z===P0){if($===f5)q8(J);else if($!==X8){if(S6(J,0,0,!1),$===v0){if(v1(J.head),J.lookahead===0)J.strstart=0,J.block_start=0,J.insert=0}}if(B1(Q),Q.avail_out===0)return J.last_flush=-1,T1}}if($!==M1)return T1;if(J.wrap<=0)return Z8;if(J.wrap===2)_(J,Q.adler&255),_(J,Q.adler>>8&255),_(J,Q.adler>>16&255),_(J,Q.adler>>24&255),_(J,Q.total_in&255),_(J,Q.total_in>>8&255),_(J,Q.total_in>>16&255),_(J,Q.total_in>>24&255);else Z0(J,Q.adler>>>16),Z0(J,Q.adler&65535);if(B1(Q),J.wrap>0)J.wrap=-J.wrap;return J.pending!==0?T1:Z8}class k0{constructor(){this.strm=new J0,this.chunkSize=102400,this.outputBuffer=new Uint8Array(this.chunkSize),L8(this.strm,u6)}deflate(Q){this.strm.input=Q,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 $=_6(this.strm,v0),V=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);if($<0)throw Error("zlib deflate failed");if(this.strm.avail_in>0){let J=[V],W=V.length;do{if(this.strm.output=new Uint8Array(this.chunkSize),this.strm.next_out=0,this.strm.avail_out=this.chunkSize,$=_6(this.strm,v0),$<0)throw Error("zlib deflate failed");let U=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);W+=U.length,J.push(U)}while(this.strm.avail_in>0);let G=new Uint8Array(W),q=0;for(let U=0;U<J.length;U++)G.set(J[U],q),q+=J[U].length;V=G}return this.strm.input=null,this.strm.avail_in=0,this.strm.next_in=0,V}}var z={XK_VoidSymbol:16777215,XK_BackSpace:65288,XK_Tab:65289,XK_Linefeed:65290,XK_Clear:65291,XK_Return:65293,XK_Pause:65299,XK_Scroll_Lock:65300,XK_Sys_Req:65301,XK_Escape:65307,XK_Delete:65535,XK_Multi_key:65312,XK_Codeinput:65335,XK_SingleCandidate:65340,XK_MultipleCandidate:65341,XK_PreviousCandidate:65342,XK_Kanji:65313,XK_Muhenkan:65314,XK_Henkan_Mode:65315,XK_Henkan:65315,XK_Romaji:65316,XK_Hiragana:65317,XK_Katakana:65318,XK_Hiragana_Katakana:65319,XK_Zenkaku:65320,XK_Hankaku:65321,XK_Zenkaku_Hankaku:65322,XK_Touroku:65323,XK_Massyo:65324,XK_Kana_Lock:65325,XK_Kana_Shift:65326,XK_Eisu_Shift:65327,XK_Eisu_toggle:65328,XK_Kanji_Bangou:65335,XK_Zen_Koho:65341,XK_Mae_Koho:65342,XK_Home:65360,XK_Left:65361,XK_Up:65362,XK_Right:65363,XK_Down:65364,XK_Prior:65365,XK_Page_Up:65365,XK_Next:65366,XK_Page_Down:65366,XK_End:65367,XK_Begin:65368,XK_Select:65376,XK_Print:65377,XK_Execute:65378,XK_Insert:65379,XK_Undo:65381,XK_Redo:65382,XK_Menu:65383,XK_Find:65384,XK_Cancel:65385,XK_Help:65386,XK_Break:65387,XK_Mode_switch:65406,XK_script_switch:65406,XK_Num_Lock:65407,XK_KP_Space:65408,XK_KP_Tab:65417,XK_KP_Enter:65421,XK_KP_F1:65425,XK_KP_F2:65426,XK_KP_F3:65427,XK_KP_F4:65428,XK_KP_Home:65429,XK_KP_Left:65430,XK_KP_Up:65431,XK_KP_Right:65432,XK_KP_Down:65433,XK_KP_Prior:65434,XK_KP_Page_Up:65434,XK_KP_Next:65435,XK_KP_Page_Down:65435,XK_KP_End:65436,XK_KP_Begin:65437,XK_KP_Insert:65438,XK_KP_Delete:65439,XK_KP_Equal:65469,XK_KP_Multiply:65450,XK_KP_Add:65451,XK_KP_Separator:65452,XK_KP_Subtract:65453,XK_KP_Decimal:65454,XK_KP_Divide:65455,XK_KP_0:65456,XK_KP_1:65457,XK_KP_2:65458,XK_KP_3:65459,XK_KP_4:65460,XK_KP_5:65461,XK_KP_6:65462,XK_KP_7:65463,XK_KP_8:65464,XK_KP_9:65465,XK_F1:65470,XK_F2:65471,XK_F3:65472,XK_F4:65473,XK_F5:65474,XK_F6:65475,XK_F7:65476,XK_F8:65477,XK_F9:65478,XK_F10:65479,XK_F11:65480,XK_L1:65480,XK_F12:65481,XK_L2:65481,XK_F13:65482,XK_L3:65482,XK_F14:65483,XK_L4:65483,XK_F15:65484,XK_L5:65484,XK_F16:65485,XK_L6:65485,XK_F17:65486,XK_L7:65486,XK_F18:65487,XK_L8:65487,XK_F19:65488,XK_L9:65488,XK_F20:65489,XK_L10:65489,XK_F21:65490,XK_R1:65490,XK_F22:65491,XK_R2:65491,XK_F23:65492,XK_R3:65492,XK_F24:65493,XK_R4:65493,XK_F25:65494,XK_R5:65494,XK_F26:65495,XK_R6:65495,XK_F27:65496,XK_R7:65496,XK_F28:65497,XK_R8:65497,XK_F29:65498,XK_R9:65498,XK_F30:65499,XK_R10:65499,XK_F31:65500,XK_R11:65500,XK_F32:65501,XK_R12:65501,XK_F33:65502,XK_R13:65502,XK_F34:65503,XK_R14:65503,XK_F35:65504,XK_R15:65504,XK_Shift_L:65505,XK_Shift_R:65506,XK_Control_L:65507,XK_Control_R:65508,XK_Caps_Lock:65509,XK_Shift_Lock:65510,XK_Meta_L:65511,XK_Meta_R:65512,XK_Alt_L:65513,XK_Alt_R:65514,XK_Super_L:65515,XK_Super_R:65516,XK_Hyper_L:65517,XK_Hyper_R:65518,XK_ISO_Level3_Shift:65027,XK_ISO_Next_Group:65032,XK_ISO_Prev_Group:65034,XK_ISO_First_Group:65036,XK_ISO_Last_Group:65038,XK_space:32,XK_exclam:33,XK_quotedbl:34,XK_numbersign:35,XK_dollar:36,XK_percent:37,XK_ampersand:38,XK_apostrophe:39,XK_quoteright:39,XK_parenleft:40,XK_parenright:41,XK_asterisk:42,XK_plus:43,XK_comma:44,XK_minus:45,XK_period:46,XK_slash:47,XK_0:48,XK_1:49,XK_2:50,XK_3:51,XK_4:52,XK_5:53,XK_6:54,XK_7:55,XK_8:56,XK_9:57,XK_colon:58,XK_semicolon:59,XK_less:60,XK_equal:61,XK_greater:62,XK_question:63,XK_at:64,XK_A:65,XK_B:66,XK_C:67,XK_D:68,XK_E:69,XK_F:70,XK_G:71,XK_H:72,XK_I:73,XK_J:74,XK_K:75,XK_L:76,XK_M:77,XK_N:78,XK_O:79,XK_P:80,XK_Q:81,XK_R:82,XK_S:83,XK_T:84,XK_U:85,XK_V:86,XK_W:87,XK_X:88,XK_Y:89,XK_Z:90,XK_bracketleft:91,XK_backslash:92,XK_bracketright:93,XK_asciicircum:94,XK_underscore:95,XK_grave:96,XK_quoteleft:96,XK_a:97,XK_b:98,XK_c:99,XK_d:100,XK_e:101,XK_f:102,XK_g:103,XK_h:104,XK_i:105,XK_j:106,XK_k:107,XK_l:108,XK_m:109,XK_n:110,XK_o:111,XK_p:112,XK_q:113,XK_r:114,XK_s:115,XK_t:116,XK_u:117,XK_v:118,XK_w:119,XK_x:120,XK_y:121,XK_z:122,XK_braceleft:123,XK_bar:124,XK_braceright:125,XK_asciitilde:126,XK_nobreakspace:160,XK_exclamdown:161,XK_cent:162,XK_sterling:163,XK_currency:164,XK_yen:165,XK_brokenbar:166,XK_section:167,XK_diaeresis:168,XK_copyright:169,XK_ordfeminine:170,XK_guillemotleft:171,XK_notsign:172,XK_hyphen:173,XK_registered:174,XK_macron:175,XK_degree:176,XK_plusminus:177,XK_twosuperior:178,XK_threesuperior:179,XK_acute:180,XK_mu:181,XK_paragraph:182,XK_periodcentered:183,XK_cedilla:184,XK_onesuperior:185,XK_masculine:186,XK_guillemotright:187,XK_onequarter:188,XK_onehalf:189,XK_threequarters:190,XK_questiondown:191,XK_Agrave:192,XK_Aacute:193,XK_Acircumflex:194,XK_Atilde:195,XK_Adiaeresis:196,XK_Aring:197,XK_AE:198,XK_Ccedilla:199,XK_Egrave:200,XK_Eacute:201,XK_Ecircumflex:202,XK_Ediaeresis:203,XK_Igrave:204,XK_Iacute:205,XK_Icircumflex:206,XK_Idiaeresis:207,XK_ETH:208,XK_Eth:208,XK_Ntilde:209,XK_Ograve:210,XK_Oacute:211,XK_Ocircumflex:212,XK_Otilde:213,XK_Odiaeresis:214,XK_multiply:215,XK_Oslash:216,XK_Ooblique:216,XK_Ugrave:217,XK_Uacute:218,XK_Ucircumflex:219,XK_Udiaeresis:220,XK_Yacute:221,XK_THORN:222,XK_Thorn:222,XK_ssharp:223,XK_agrave:224,XK_aacute:225,XK_acircumflex:226,XK_atilde:227,XK_adiaeresis:228,XK_aring:229,XK_ae:230,XK_ccedilla:231,XK_egrave:232,XK_eacute:233,XK_ecircumflex:234,XK_ediaeresis:235,XK_igrave:236,XK_iacute:237,XK_icircumflex:238,XK_idiaeresis:239,XK_eth:240,XK_ntilde:241,XK_ograve:242,XK_oacute:243,XK_ocircumflex:244,XK_otilde:245,XK_odiaeresis:246,XK_division:247,XK_oslash:248,XK_ooblique:248,XK_ugrave:249,XK_uacute:250,XK_ucircumflex:251,XK_udiaeresis:252,XK_yacute:253,XK_thorn:254,XK_ydiaeresis:255,XK_Hangul:65329,XK_Hangul_Hanja:65332,XK_Hangul_Jeonja:65336,XF86XK_ModeLock:269025025,XF86XK_MonBrightnessUp:269025026,XF86XK_MonBrightnessDown:269025027,XF86XK_KbdLightOnOff:269025028,XF86XK_KbdBrightnessUp:269025029,XF86XK_KbdBrightnessDown:269025030,XF86XK_Standby:269025040,XF86XK_AudioLowerVolume:269025041,XF86XK_AudioMute:269025042,XF86XK_AudioRaiseVolume:269025043,XF86XK_AudioPlay:269025044,XF86XK_AudioStop:269025045,XF86XK_AudioPrev:269025046,XF86XK_AudioNext:269025047,XF86XK_HomePage:269025048,XF86XK_Mail:269025049,XF86XK_Start:269025050,XF86XK_Search:269025051,XF86XK_AudioRecord:269025052,XF86XK_Calculator:269025053,XF86XK_Memo:269025054,XF86XK_ToDoList:269025055,XF86XK_Calendar:269025056,XF86XK_PowerDown:269025057,XF86XK_ContrastAdjust:269025058,XF86XK_RockerUp:269025059,XF86XK_RockerDown:269025060,XF86XK_RockerEnter:269025061,XF86XK_Back:269025062,XF86XK_Forward:269025063,XF86XK_Stop:269025064,XF86XK_Refresh:269025065,XF86XK_PowerOff:269025066,XF86XK_WakeUp:269025067,XF86XK_Eject:269025068,XF86XK_ScreenSaver:269025069,XF86XK_WWW:269025070,XF86XK_Sleep:269025071,XF86XK_Favorites:269025072,XF86XK_AudioPause:269025073,XF86XK_AudioMedia:269025074,XF86XK_MyComputer:269025075,XF86XK_VendorHome:269025076,XF86XK_LightBulb:269025077,XF86XK_Shop:269025078,XF86XK_History:269025079,XF86XK_OpenURL:269025080,XF86XK_AddFavorite:269025081,XF86XK_HotLinks:269025082,XF86XK_BrightnessAdjust:269025083,XF86XK_Finance:269025084,XF86XK_Community:269025085,XF86XK_AudioRewind:269025086,XF86XK_BackForward:269025087,XF86XK_Launch0:269025088,XF86XK_Launch1:269025089,XF86XK_Launch2:269025090,XF86XK_Launch3:269025091,XF86XK_Launch4:269025092,XF86XK_Launch5:269025093,XF86XK_Launch6:269025094,XF86XK_Launch7:269025095,XF86XK_Launch8:269025096,XF86XK_Launch9:269025097,XF86XK_LaunchA:269025098,XF86XK_LaunchB:269025099,XF86XK_LaunchC:269025100,XF86XK_LaunchD:269025101,XF86XK_LaunchE:269025102,XF86XK_LaunchF:269025103,XF86XK_ApplicationLeft:269025104,XF86XK_ApplicationRight:269025105,XF86XK_Book:269025106,XF86XK_CD:269025107,XF86XK_Calculater:269025108,XF86XK_Clear:269025109,XF86XK_Close:269025110,XF86XK_Copy:269025111,XF86XK_Cut:269025112,XF86XK_Display:269025113,XF86XK_DOS:269025114,XF86XK_Documents:269025115,XF86XK_Excel:269025116,XF86XK_Explorer:269025117,XF86XK_Game:269025118,XF86XK_Go:269025119,XF86XK_iTouch:269025120,XF86XK_LogOff:269025121,XF86XK_Market:269025122,XF86XK_Meeting:269025123,XF86XK_MenuKB:269025125,XF86XK_MenuPB:269025126,XF86XK_MySites:269025127,XF86XK_New:269025128,XF86XK_News:269025129,XF86XK_OfficeHome:269025130,XF86XK_Open:269025131,XF86XK_Option:269025132,XF86XK_Paste:269025133,XF86XK_Phone:269025134,XF86XK_Q:269025136,XF86XK_Reply:269025138,XF86XK_Reload:269025139,XF86XK_RotateWindows:269025140,XF86XK_RotationPB:269025141,XF86XK_RotationKB:269025142,XF86XK_Save:269025143,XF86XK_ScrollUp:269025144,XF86XK_ScrollDown:269025145,XF86XK_ScrollClick:269025146,XF86XK_Send:269025147,XF86XK_Spell:269025148,XF86XK_SplitScreen:269025149,XF86XK_Support:269025150,XF86XK_TaskPane:269025151,XF86XK_Terminal:269025152,XF86XK_Tools:269025153,XF86XK_Travel:269025154,XF86XK_UserPB:269025156,XF86XK_User1KB:269025157,XF86XK_User2KB:269025158,XF86XK_Video:269025159,XF86XK_WheelButton:269025160,XF86XK_Word:269025161,XF86XK_Xfer:269025162,XF86XK_ZoomIn:269025163,XF86XK_ZoomOut:269025164,XF86XK_Away:269025165,XF86XK_Messenger:269025166,XF86XK_WebCam:269025167,XF86XK_MailForward:269025168,XF86XK_Pictures:269025169,XF86XK_Music:269025170,XF86XK_Battery:269025171,XF86XK_Bluetooth:269025172,XF86XK_WLAN:269025173,XF86XK_UWB:269025174,XF86XK_AudioForward:269025175,XF86XK_AudioRepeat:269025176,XF86XK_AudioRandomPlay:269025177,XF86XK_Subtitle:269025178,XF86XK_AudioCycleTrack:269025179,XF86XK_CycleAngle:269025180,XF86XK_FrameBack:269025181,XF86XK_FrameForward:269025182,XF86XK_Time:269025183,XF86XK_Select:269025184,XF86XK_View:269025185,XF86XK_TopMenu:269025186,XF86XK_Red:269025187,XF86XK_Green:269025188,XF86XK_Yellow:269025189,XF86XK_Blue:269025190,XF86XK_Suspend:269025191,XF86XK_Hibernate:269025192,XF86XK_TouchpadToggle:269025193,XF86XK_TouchpadOn:269025200,XF86XK_TouchpadOff:269025201,XF86XK_AudioMicMute:269025202,XF86XK_Switch_VT_1:269024769,XF86XK_Switch_VT_2:269024770,XF86XK_Switch_VT_3:269024771,XF86XK_Switch_VT_4:269024772,XF86XK_Switch_VT_5:269024773,XF86XK_Switch_VT_6:269024774,XF86XK_Switch_VT_7:269024775,XF86XK_Switch_VT_8:269024776,XF86XK_Switch_VT_9:269024777,XF86XK_Switch_VT_10:269024778,XF86XK_Switch_VT_11:269024779,XF86XK_Switch_VT_12:269024780,XF86XK_Ungrab:269024800,XF86XK_ClearGrab:269024801,XF86XK_Next_VMode:269024802,XF86XK_Prev_VMode:269024803,XF86XK_LogWindowTree:269024804,XF86XK_LogGrabInfo:269024805};var U4={256:960,257:992,258:451,259:483,260:417,261:433,262:454,263:486,264:710,265:742,266:709,267:741,268:456,269:488,270:463,271:495,272:464,273:496,274:938,275:954,278:972,279:1004,280:458,281:490,282:460,283:492,284:728,285:760,286:683,287:699,288:725,289:757,290:939,291:955,292:678,293:694,294:673,295:689,296:933,297:949,298:975,299:1007,302:967,303:999,304:681,305:697,308:684,309:700,310:979,311:1011,312:930,313:453,314:485,315:934,316:950,317:421,318:437,321:419,322:435,323:465,324:497,325:977,326:1009,327:466,328:498,330:957,331:959,332:978,333:1010,336:469,337:501,338:5052,339:5053,340:448,341:480,342:931,343:947,344:472,345:504,346:422,347:438,348:734,349:766,350:426,351:442,352:425,353:441,354:478,355:510,356:427,357:443,358:940,359:956,360:989,361:1021,362:990,363:1022,364:733,365:765,366:473,367:505,368:475,369:507,370:985,371:1017,376:5054,377:428,378:444,379:431,380:447,381:430,382:446,402:2294,466:16777681,711:439,728:418,729:511,731:434,733:445,901:1966,902:1953,904:1954,905:1955,906:1956,908:1959,910:1960,911:1963,912:1974,913:1985,914:1986,915:1987,916:1988,917:1989,918:1990,919:1991,920:1992,921:1993,922:1994,923:1995,924:1996,925:1997,926:1998,927:1999,928:2000,929:2001,931:2002,932:2004,933:2005,934:2006,935:2007,936:2008,937:2009,938:1957,939:1961,940:1969,941:1970,942:1971,943:1972,944:1978,945:2017,946:2018,947:2019,948:2020,949:2021,950:2022,951:2023,952:2024,953:2025,954:2026,955:2027,956:2028,957:2029,958:2030,959:2031,960:2032,961:2033,962:2035,963:2034,964:2036,965:2037,966:2038,967:2039,968:2040,969:2041,970:1973,971:1977,972:1975,973:1976,974:1979,1025:1715,1026:1713,1027:1714,1028:1716,1029:1717,1030:1718,1031:1719,1032:1720,1033:1721,1034:1722,1035:1723,1036:1724,1038:1726,1039:1727,1040:1761,1041:1762,1042:1783,1043:1767,1044:1764,1045:1765,1046:1782,1047:1786,1048:1769,1049:1770,1050:1771,1051:1772,1052:1773,1053:1774,1054:1775,1055:1776,1056:1778,1057:1779,1058:1780,1059:1781,1060:1766,1061:1768,1062:1763,1063:1790,1064:1787,1065:1789,1066:1791,1067:1785,1068:1784,1069:1788,1070:1760,1071:1777,1072:1729,1073:1730,1074:1751,1075:1735,1076:1732,1077:1733,1078:1750,1079:1754,1080:1737,1081:1738,1082:1739,1083:1740,1084:1741,1085:1742,1086:1743,1087:1744,1088:1746,1089:1747,1090:1748,1091:1749,1092:1734,1093:1736,1094:1731,1095:1758,1096:1755,1097:1757,1098:1759,1099:1753,1100:1752,1101:1756,1102:1728,1103:1745,1105:1699,1106:1697,1107:1698,1108:1700,1109:1701,1110:1702,1111:1703,1112:1704,1113:1705,1114:1706,1115:1707,1116:1708,1118:1710,1119:1711,1168:1725,1169:1709,1488:3296,1489:3297,1490:3298,1491:3299,1492:3300,1493:3301,1494:3302,1495:3303,1496:3304,1497:3305,1498:3306,1499:3307,1500:3308,1501:3309,1502:3310,1503:3311,1504:3312,1505:3313,1506:3314,1507:3315,1508:3316,1509:3317,1510:3318,1511:3319,1512:3320,1513:3321,1514:3322,1548:1452,1563:1467,1567:1471,1569:1473,1570:1474,1571:1475,1572:1476,1573:1477,1574:1478,1575:1479,1576:1480,1577:1481,1578:1482,1579:1483,1580:1484,1581:1485,1582:1486,1583:1487,1584:1488,1585:1489,1586:1490,1587:1491,1588:1492,1589:1493,1590:1494,1591:1495,1592:1496,1593:1497,1594:1498,1600:1504,1601:1505,1602:1506,1603:1507,1604:1508,1605:1509,1606:1510,1607:1511,1608:1512,1609:1513,1610:1514,1611:1515,1612:1516,1613:1517,1614:1518,1615:1519,1616:1520,1617:1521,1618:1522,3585:3489,3586:3490,3587:3491,3588:3492,3589:3493,3590:3494,3591:3495,3592:3496,3593:3497,3594:3498,3595:3499,3596:3500,3597:3501,3598:3502,3599:3503,3600:3504,3601:3505,3602:3506,3603:3507,3604:3508,3605:3509,3606:3510,3607:3511,3608:3512,3609:3513,3610:3514,3611:3515,3612:3516,3613:3517,3614:3518,3615:3519,3616:3520,3617:3521,3618:3522,3619:3523,3620:3524,3621:3525,3622:3526,3623:3527,3624:3528,3625:3529,3626:3530,3627:3531,3628:3532,3629:3533,3630:3534,3631:3535,3632:3536,3633:3537,3634:3538,3635:3539,3636:3540,3637:3541,3638:3542,3639:3543,3640:3544,3641:3545,3642:3546,3647:3551,3648:3552,3649:3553,3650:3554,3651:3555,3652:3556,3653:3557,3654:3558,3655:3559,3656:3560,3657:3561,3658:3562,3659:3563,3660:3564,3661:3565,3664:3568,3665:3569,3666:3570,3667:3571,3668:3572,3669:3573,3670:3574,3671:3575,3672:3576,3673:3577,8194:2722,8195:2721,8196:2723,8197:2724,8199:2725,8200:2726,8201:2727,8202:2728,8210:2747,8211:2730,8212:2729,8213:1967,8215:3295,8216:2768,8217:2769,8218:2813,8220:2770,8221:2771,8222:2814,8224:2801,8225:2802,8226:2790,8229:2735,8230:2734,8240:2773,8242:2774,8243:2775,8248:2812,8254:1150,8361:3839,8364:8364,8453:2744,8470:1712,8471:2811,8478:2772,8482:2761,8531:2736,8532:2737,8533:2738,8534:2739,8535:2740,8536:2741,8537:2742,8538:2743,8539:2755,8540:2756,8541:2757,8542:2758,8592:2299,8593:2300,8594:2301,8595:2302,8658:2254,8660:2253,8706:2287,8711:2245,8728:3018,8730:2262,8733:2241,8734:2242,8743:2270,8744:2271,8745:2268,8746:2269,8747:2239,8756:2240,8764:2248,8771:2249,8773:16785992,8800:2237,8801:2255,8804:2236,8805:2238,8834:2266,8835:2267,8866:3068,8867:3036,8868:3010,8869:3022,8968:3027,8970:3012,8981:2810,8992:2212,8993:2213,9109:3020,9115:2219,9117:2220,9118:2221,9120:2222,9121:2215,9123:2216,9124:2217,9126:2218,9128:2223,9132:2224,9143:2209,9146:2543,9147:2544,9148:2546,9149:2547,9225:2530,9226:2533,9227:2537,9228:2531,9229:2532,9251:2732,9252:2536,9472:2211,9474:2214,9484:2210,9488:2539,9492:2541,9496:2538,9500:2548,9508:2549,9516:2551,9524:2550,9532:2542,9618:2529,9642:2791,9643:2785,9644:2779,9645:2786,9646:2783,9647:2767,9650:2792,9651:2787,9654:2781,9655:2765,9660:2793,9661:2788,9664:2780,9665:2764,9670:2528,9675:2766,9679:2782,9702:2784,9734:2789,9742:2809,9747:2762,9756:2794,9758:2795,9792:2808,9794:2807,9827:2796,9829:2798,9830:2797,9837:2806,9839:2805,10003:2803,10007:2804,10013:2777,10016:2800,10216:2748,10217:2750,12289:1188,12290:1185,12300:1186,12301:1187,12443:1246,12444:1247,12449:1191,12450:1201,12451:1192,12452:1202,12453:1193,12454:1203,12455:1194,12456:1204,12457:1195,12458:1205,12459:1206,12461:1207,12463:1208,12465:1209,12467:1210,12469:1211,12471:1212,12473:1213,12475:1214,12477:1215,12479:1216,12481:1217,12483:1199,12484:1218,12486:1219,12488:1220,12490:1221,12491:1222,12492:1223,12493:1224,12494:1225,12495:1226,12498:1227,12501:1228,12504:1229,12507:1230,12510:1231,12511:1232,12512:1233,12513:1234,12514:1235,12515:1196,12516:1236,12517:1197,12518:1237,12519:1198,12520:1238,12521:1239,12522:1240,12523:1241,12524:1242,12525:1243,12527:1244,12530:1190,12531:1245,12539:1189,12540:1200},F8={lookup(Q){if(Q>=32&&Q<=255)return Q;let $=U4[Q];if($!==void 0)return $;return 16777216|Q}};var y6={8:"Backspace",9:"Tab",10:"NumpadClear",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"};var h6={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"};var x1={};function B(Q,$){if($===void 0)throw Error('Undefined keysym for key "'+Q+'"');if(Q in x1)throw Error('Duplicate entry for key "'+Q+'"');x1[Q]=[$,$,$,$]}function x0(Q,$,V){if($===void 0)throw Error('Undefined keysym for key "'+Q+'"');if(V===void 0)throw Error('Undefined keysym for key "'+Q+'"');if(Q in x1)throw Error('Duplicate entry for key "'+Q+'"');x1[Q]=[$,$,V,$]}function h(Q,$,V){if($===void 0)throw Error('Undefined keysym for key "'+Q+'"');if(V===void 0)throw Error('Undefined keysym for key "'+Q+'"');if(Q in x1)throw Error('Duplicate entry for key "'+Q+'"');x1[Q]=[$,$,$,V]}x0("Alt",z.XK_Alt_L,z.XK_Alt_R);B("AltGraph",z.XK_ISO_Level3_Shift);B("CapsLock",z.XK_Caps_Lock);x0("Control",z.XK_Control_L,z.XK_Control_R);x0("Meta",z.XK_Super_L,z.XK_Super_R);B("NumLock",z.XK_Num_Lock);B("ScrollLock",z.XK_Scroll_Lock);x0("Shift",z.XK_Shift_L,z.XK_Shift_R);h("Enter",z.XK_Return,z.XK_KP_Enter);B("Tab",z.XK_Tab);h(" ",z.XK_space,z.XK_KP_Space);h("ArrowDown",z.XK_Down,z.XK_KP_Down);h("ArrowLeft",z.XK_Left,z.XK_KP_Left);h("ArrowRight",z.XK_Right,z.XK_KP_Right);h("ArrowUp",z.XK_Up,z.XK_KP_Up);h("End",z.XK_End,z.XK_KP_End);h("Home",z.XK_Home,z.XK_KP_Home);h("PageDown",z.XK_Next,z.XK_KP_Next);h("PageUp",z.XK_Prior,z.XK_KP_Prior);B("Backspace",z.XK_BackSpace);h("Clear",z.XK_Clear,z.XK_KP_Begin);B("Copy",z.XF86XK_Copy);B("Cut",z.XF86XK_Cut);h("Delete",z.XK_Delete,z.XK_KP_Delete);h("Insert",z.XK_Insert,z.XK_KP_Insert);B("Paste",z.XF86XK_Paste);B("Redo",z.XK_Redo);B("Undo",z.XK_Undo);B("Cancel",z.XK_Cancel);B("ContextMenu",z.XK_Menu);B("Escape",z.XK_Escape);B("Execute",z.XK_Execute);B("Find",z.XK_Find);B("Help",z.XK_Help);B("Pause",z.XK_Pause);B("Select",z.XK_Select);B("ZoomIn",z.XF86XK_ZoomIn);B("ZoomOut",z.XF86XK_ZoomOut);B("BrightnessDown",z.XF86XK_MonBrightnessDown);B("BrightnessUp",z.XF86XK_MonBrightnessUp);B("Eject",z.XF86XK_Eject);B("LogOff",z.XF86XK_LogOff);B("Power",z.XF86XK_PowerOff);B("PowerOff",z.XF86XK_PowerDown);B("PrintScreen",z.XK_Print);B("Hibernate",z.XF86XK_Hibernate);B("Standby",z.XF86XK_Standby);B("WakeUp",z.XF86XK_WakeUp);B("AllCandidates",z.XK_MultipleCandidate);B("Alphanumeric",z.XK_Eisu_toggle);B("CodeInput",z.XK_Codeinput);B("Compose",z.XK_Multi_key);B("Convert",z.XK_Henkan);B("GroupFirst",z.XK_ISO_First_Group);B("GroupLast",z.XK_ISO_Last_Group);B("GroupNext",z.XK_ISO_Next_Group);B("GroupPrevious",z.XK_ISO_Prev_Group);B("NonConvert",z.XK_Muhenkan);B("PreviousCandidate",z.XK_PreviousCandidate);B("SingleCandidate",z.XK_SingleCandidate);B("HangulMode",z.XK_Hangul);B("HanjaMode",z.XK_Hangul_Hanja);B("JunjaMode",z.XK_Hangul_Jeonja);B("Eisu",z.XK_Eisu_toggle);B("Hankaku",z.XK_Hankaku);B("Hiragana",z.XK_Hiragana);B("HiraganaKatakana",z.XK_Hiragana_Katakana);B("KanaMode",z.XK_Kana_Shift);B("KanjiMode",z.XK_Kanji);B("Katakana",z.XK_Katakana);B("Romaji",z.XK_Romaji);B("Zenkaku",z.XK_Zenkaku);B("ZenkakuHankaku",z.XK_Zenkaku_Hankaku);B("F1",z.XK_F1);B("F2",z.XK_F2);B("F3",z.XK_F3);B("F4",z.XK_F4);B("F5",z.XK_F5);B("F6",z.XK_F6);B("F7",z.XK_F7);B("F8",z.XK_F8);B("F9",z.XK_F9);B("F10",z.XK_F10);B("F11",z.XK_F11);B("F12",z.XK_F12);B("F13",z.XK_F13);B("F14",z.XK_F14);B("F15",z.XK_F15);B("F16",z.XK_F16);B("F17",z.XK_F17);B("F18",z.XK_F18);B("F19",z.XK_F19);B("F20",z.XK_F20);B("F21",z.XK_F21);B("F22",z.XK_F22);B("F23",z.XK_F23);B("F24",z.XK_F24);B("F25",z.XK_F25);B("F26",z.XK_F26);B("F27",z.XK_F27);B("F28",z.XK_F28);B("F29",z.XK_F29);B("F30",z.XK_F30);B("F31",z.XK_F31);B("F32",z.XK_F32);B("F33",z.XK_F33);B("F34",z.XK_F34);B("F35",z.XK_F35);B("Close",z.XF86XK_Close);B("MailForward",z.XF86XK_MailForward);B("MailReply",z.XF86XK_Reply);B("MailSend",z.XF86XK_Send);B("MediaFastForward",z.XF86XK_AudioForward);B("MediaPause",z.XF86XK_AudioPause);B("MediaPlay",z.XF86XK_AudioPlay);B("MediaRecord",z.XF86XK_AudioRecord);B("MediaRewind",z.XF86XK_AudioRewind);B("MediaStop",z.XF86XK_AudioStop);B("MediaTrackNext",z.XF86XK_AudioNext);B("MediaTrackPrevious",z.XF86XK_AudioPrev);B("New",z.XF86XK_New);B("Open",z.XF86XK_Open);B("Print",z.XK_Print);B("Save",z.XF86XK_Save);B("SpellCheck",z.XF86XK_Spell);B("AudioVolumeDown",z.XF86XK_AudioLowerVolume);B("AudioVolumeUp",z.XF86XK_AudioRaiseVolume);B("AudioVolumeMute",z.XF86XK_AudioMute);B("MicrophoneVolumeMute",z.XF86XK_AudioMicMute);B("LaunchApplication1",z.XF86XK_MyComputer);B("LaunchApplication2",z.XF86XK_Calculator);B("LaunchCalendar",z.XF86XK_Calendar);B("LaunchMail",z.XF86XK_Mail);B("LaunchMediaPlayer",z.XF86XK_AudioMedia);B("LaunchMusicPlayer",z.XF86XK_Music);B("LaunchPhone",z.XF86XK_Phone);B("LaunchScreenSaver",z.XF86XK_ScreenSaver);B("LaunchSpreadsheet",z.XF86XK_Excel);B("LaunchWebBrowser",z.XF86XK_WWW);B("LaunchWebCam",z.XF86XK_WebCam);B("LaunchWordProcessor",z.XF86XK_Word);B("BrowserBack",z.XF86XK_Back);B("BrowserFavorites",z.XF86XK_Favorites);B("BrowserForward",z.XF86XK_Forward);B("BrowserHome",z.XF86XK_HomePage);B("BrowserRefresh",z.XF86XK_Refresh);B("BrowserSearch",z.XF86XK_Search);B("BrowserStop",z.XF86XK_Stop);B("Dimmer",z.XF86XK_BrightnessAdjust);B("MediaAudioTrack",z.XF86XK_AudioCycleTrack);B("RandomToggle",z.XF86XK_AudioRandomPlay);B("SplitScreenToggle",z.XF86XK_SplitScreen);B("Subtitle",z.XF86XK_Subtitle);B("VideoModeNext",z.XF86XK_Next_VMode);h("=",z.XK_equal,z.XK_KP_Equal);h("+",z.XK_plus,z.XK_KP_Add);h("-",z.XK_minus,z.XK_KP_Subtract);h("*",z.XK_asterisk,z.XK_KP_Multiply);h("/",z.XK_slash,z.XK_KP_Divide);h(".",z.XK_period,z.XK_KP_Decimal);h(",",z.XK_comma,z.XK_KP_Separator);h("0",z.XK_0,z.XK_KP_0);h("1",z.XK_1,z.XK_KP_1);h("2",z.XK_2,z.XK_KP_2);h("3",z.XK_3,z.XK_KP_3);h("4",z.XK_4,z.XK_KP_4);h("5",z.XK_5,z.XK_KP_5);h("6",z.XK_6,z.XK_KP_6);h("7",z.XK_7,z.XK_KP_7);h("8",z.XK_8,z.XK_KP_8);h("9",z.XK_9,z.XK_KP_9);var p6=x1;function a1(Q){if(Q.code){switch(Q.code){case"OSLeft":return"MetaLeft";case"OSRight":return"MetaRight"}return Q.code}if(Q.keyCode in y6){let $=y6[Q.keyCode];if(I1()&&$==="ContextMenu")$="MetaRight";if(Q.location===2)switch($){case"ShiftLeft":return"ShiftRight";case"ControlLeft":return"ControlRight";case"AltLeft":return"AltRight"}if(Q.location===3)switch($){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 $}return"Unidentified"}function Y4(Q){if(Q.key!==void 0&&Q.key!=="Unidentified"){switch(Q.key){case"OS":return"Meta";case"LaunchMyComputer":return"LaunchApplication1";case"LaunchCalculator":return"LaunchApplication2"}switch(Q.key){case"UIKeyInputUpArrow":return"ArrowUp";case"UIKeyInputDownArrow":return"ArrowDown";case"UIKeyInputLeftArrow":return"ArrowLeft";case"UIKeyInputRightArrow":return"ArrowRight";case"UIKeyInputEscape":return"Escape"}if(Q.key==="\x00"&&Q.code==="NumpadDecimal")return"Delete";return Q.key}let $=a1(Q);if($ in h6)return h6[$];if(Q.charCode)return String.fromCharCode(Q.charCode);return"Unidentified"}function C8(Q){let $=Y4(Q);if($==="Unidentified")return null;if($ in p6){let J=Q.location;if($==="Meta"&&J===0)J=2;if($==="Clear"&&J===3){if(a1(Q)==="NumLock")J=0}if(J===void 0||J>3)J=0;if($==="Meta"){let W=a1(Q);if(W==="AltLeft")return z.XK_Meta_L;else if(W==="AltRight")return z.XK_Meta_R}if($==="Clear"){if(a1(Q)==="NumLock")return z.XK_Num_Lock}if(u1())switch($){case"Zenkaku":case"Hankaku":return z.XK_Zenkaku_Hankaku;case"Romaji":case"KanaMode":return z.XK_Romaji}return p6[$][J]}if($.length!==1)return null;let V=$.charCodeAt();if(V)return F8.lookup(V);return null}class f0{constructor(Q){this._target=Q||null,this._keyDownList={},this._altGrArmed=!1,this._eventHandlers={keyup:this._handleKeyUp.bind(this),keydown:this._handleKeyDown.bind(this),blur:this._allKeysUp.bind(this)},this.onkeyevent=()=>{}}_sendKeyEvent(Q,$,V,J=null,W=null){if(V)this._keyDownList[$]=Q;else{if(!($ in this._keyDownList))return;delete this._keyDownList[$]}w("onkeyevent "+(V?"down":"up")+", keysym: "+Q,", code: "+$+", numlock: "+J+", capslock: "+W),this.onkeyevent(Q,$,V,J,W)}_getKeyCode(Q){let $=a1(Q);if($!=="Unidentified")return $;if(Q.keyCode){if(Q.keyCode!==229)return"Platform"+Q.keyCode}if(Q.keyIdentifier){if(Q.keyIdentifier.substr(0,2)!=="U+")return Q.keyIdentifier;let V=parseInt(Q.keyIdentifier.substr(2),16);return"Platform"+String.fromCharCode(V).toUpperCase().charCodeAt()}return"Unidentified"}_handleKeyDown(Q){let $=this._getKeyCode(Q),V=C8(Q),J=Q.getModifierState("NumLock"),W=Q.getModifierState("CapsLock");if(I1()||_1())J=null;if(this._altGrArmed)if(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),$==="AltRight"&&Q.timeStamp-this._altGrCtrlTime<50)V=z.XK_ISO_Level3_Shift;else this._sendKeyEvent(z.XK_Control_L,"ControlLeft",!0,J,W);if($==="Unidentified"){if(V)this._sendKeyEvent(V,$,!0,J,W),this._sendKeyEvent(V,$,!1,J,W);K1(Q);return}if(I1()||_1())switch(V){case z.XK_Super_L:V=z.XK_Alt_L;break;case z.XK_Super_R:V=z.XK_Super_L;break;case z.XK_Alt_L:V=z.XK_Mode_switch;break;case z.XK_Alt_R:V=z.XK_ISO_Level3_Shift;break}if($ in this._keyDownList)V=this._keyDownList[$];if((I1()||_1())&&(Q.metaKey&&$!=="MetaLeft"&&$!=="MetaRight")){this._sendKeyEvent(V,$,!0,J,W),this._sendKeyEvent(V,$,!1,J,W),K1(Q);return}if((I1()||_1())&&$==="CapsLock"){this._sendKeyEvent(z.XK_Caps_Lock,"CapsLock",!0,J,W),this._sendKeyEvent(z.XK_Caps_Lock,"CapsLock",!1,J,W),K1(Q);return}let G=[z.XK_Zenkaku_Hankaku,z.XK_Eisu_toggle,z.XK_Katakana,z.XK_Hiragana,z.XK_Romaji];if(u1()&&G.includes(V)){this._sendKeyEvent(V,$,!0,J,W),this._sendKeyEvent(V,$,!1,J,W),K1(Q);return}if(K1(Q),$==="ControlLeft"&&u1()&&!("ControlLeft"in this._keyDownList)){this._altGrArmed=!0,this._altGrTimeout=setTimeout(this._interruptAltGrSequence.bind(this),100),this._altGrCtrlTime=Q.timeStamp;return}this._sendKeyEvent(V,$,!0,J,W)}_handleKeyUp(Q){K1(Q);let $=this._getKeyCode(Q);if(this._interruptAltGrSequence(),(I1()||_1())&&$==="CapsLock"){this._sendKeyEvent(z.XK_Caps_Lock,"CapsLock",!0),this._sendKeyEvent(z.XK_Caps_Lock,"CapsLock",!1);return}if(this._sendKeyEvent(this._keyDownList[$],$,!1),u1()&&($==="ShiftLeft"||$==="ShiftRight")){if("ShiftRight"in this._keyDownList)this._sendKeyEvent(this._keyDownList.ShiftRight,"ShiftRight",!1);if("ShiftLeft"in this._keyDownList)this._sendKeyEvent(this._keyDownList.ShiftLeft,"ShiftLeft",!1)}}_interruptAltGrSequence(){if(this._altGrArmed)this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(z.XK_Control_L,"ControlLeft",!0)}_allKeysUp(){w(">> Keyboard.allKeysUp"),this._interruptAltGrSequence();for(let Q in this._keyDownList)this._sendKeyEvent(this._keyDownList[Q],Q,!1);w("<< Keyboard.allKeysUp")}grab(){this._target.addEventListener("keydown",this._eventHandlers.keydown),this._target.addEventListener("keyup",this._eventHandlers.keyup),window.addEventListener("blur",this._eventHandlers.blur)}ungrab(){this._target.removeEventListener("keydown",this._eventHandlers.keydown),this._target.removeEventListener("keyup",this._eventHandlers.keyup),window.removeEventListener("blur",this._eventHandlers.blur),this._allKeysUp()}}class u0{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(Q){this.detach(),this._target=Q,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(){if(!this._target)return;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(Q){let $;switch(Q.stopPropagation(),Q.preventDefault(),Q.type){case"touchstart":$=this._touchStart;break;case"touchmove":$=this._touchMove;break;case"touchend":case"touchcancel":$=this._touchEnd;break}for(let V=0;V<Q.changedTouches.length;V++){let J=Q.changedTouches[V];$.call(this,J.identifier,J.clientX,J.clientY)}}_touchStart(Q,$,V){if(this._hasDetectedGesture()||this._state===0){this._ignored.push(Q);return}if(this._tracked.length>0&&Date.now()-this._tracked[0].started>250){this._state=0,this._ignored.push(Q);return}if(this._waitingRelease){this._state=0,this._ignored.push(Q);return}switch(this._tracked.push({id:Q,started:Date.now(),active:!0,firstX:$,firstY:V,lastX:$,lastY:V,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(Q,$,V){let J=this._tracked.find((q)=>q.id===Q);if(J===void 0)return;J.lastX=$,J.lastY=V;let W=$-J.firstX,G=V-J.firstY;if(J.firstX!==J.lastX||J.firstY!==J.lastY)J.angle=Math.atan2(G,W)*180/Math.PI;if(!this._hasDetectedGesture()){if(Math.hypot(W,G)<50)return;if(this._state&=-24,this._stopLongpressTimeout(),this._tracked.length!==1)this._state&=-9;if(this._tracked.length!==2)this._state&=-97;if(this._tracked.length===2){let q=this._tracked.find((Z)=>Z.id!==Q);if(Math.hypot(q.firstX-q.lastX,q.firstY-q.lastY)>50){let Z=Math.abs(J.angle-q.angle);if(Z=Math.abs((Z+180)%360-180),Z>90)this._state&=-33;else this._state&=-65;if(this._isTwoTouchTimeoutRunning())this._stopTwoTouchTimeout()}else if(!this._isTwoTouchTimeoutRunning())this._startTwoTouchTimeout()}if(!this._hasDetectedGesture())return;this._pushEvent("gesturestart")}this._pushEvent("gesturemove")}_touchEnd(Q,$,V){if(this._ignored.indexOf(Q)!==-1){if(this._ignored.splice(this._ignored.indexOf(Q),1),this._ignored.length===0&&this._tracked.length===0)this._state=127,this._waitingRelease=!1;return}if(!this._hasDetectedGesture()&&this._isTwoTouchTimeoutRunning())this._stopTwoTouchTimeout(),this._state=0;if(!this._hasDetectedGesture()){if(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;break}}if(this._waitingRelease){if(Date.now()-this._releaseStart>250)this._state=0;if(this._tracked.some((W)=>Date.now()-W.started>1000))this._state=0;let J=this._tracked.find((W)=>W.id===Q);if(J.active=!1,this._hasDetectedGesture())this._pushEvent("gesturestart");else if(this._state!==0)return}if(this._hasDetectedGesture())this._pushEvent("gestureend");for(let J=0;J<this._tracked.length;J++)if(this._tracked[J].active)this._ignored.push(this._tracked[J].id);if(this._tracked=[],this._state=0,this._ignored.indexOf(Q)!==-1)this._ignored.splice(this._ignored.indexOf(Q),1);if(this._ignored.length===0)this._state=127,this._waitingRelease=!1}_hasDetectedGesture(){if(this._state===0)return!1;if(this._state&this._state-1)return!1;if(this._state&7){if(this._tracked.some((Q)=>Q.active))return!1}return!0}_startLongpressTimeout(){this._stopLongpressTimeout(),this._longpressTimeoutId=setTimeout(()=>this._longpressTimeout(),1000)}_stopLongpressTimeout(){clearTimeout(this._longpressTimeoutId),this._longpressTimeoutId=null}_longpressTimeout(){if(this._hasDetectedGesture())throw 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 this._twoTouchTimeoutId!==null}_twoTouchTimeout(){if(this._tracked.length===0)throw Error("A pinch or two drag gesture failed, no tracked touches");let Q=this._getAverageMovement(),$=Math.abs(Q.x),V=Math.abs(Q.y),J=this._getAverageDistance(),W=Math.abs(Math.hypot(J.first.x,J.first.y)-Math.hypot(J.last.x,J.last.y));if(V<W&&$<W)this._state=64;else this._state=32;this._pushEvent("gesturestart"),this._pushEvent("gesturemove")}_pushEvent(Q){let $={type:this._stateToGesture(this._state)},V=this._getPosition(),J=V.last;if(Q==="gesturestart")J=V.first;switch(this._state){case 32:case 64:J=V.first;break}if($.clientX=J.x,$.clientY=J.y,this._state===64){let G=this._getAverageDistance();if(Q==="gesturestart")$.magnitudeX=G.first.x,$.magnitudeY=G.first.y;else $.magnitudeX=G.last.x,$.magnitudeY=G.last.y}else if(this._state===32)if(Q==="gesturestart")$.magnitudeX=0,$.magnitudeY=0;else{let G=this._getAverageMovement();$.magnitudeX=G.x,$.magnitudeY=G.y}let W=new CustomEvent(Q,{detail:$});this._target.dispatchEvent(W)}_stateToGesture(Q){switch(Q){case 1:return"onetap";case 2:return"twotap";case 4:return"threetap";case 8:return"drag";case 16:return"longpress";case 32:return"twodrag";case 64:return"pinch"}throw Error("Unknown gesture state: "+Q)}_getPosition(){if(this._tracked.length===0)throw Error("Failed to get gesture position, no tracked touches");let Q=this._tracked.length,$=0,V=0,J=0,W=0;for(let G=0;G<this._tracked.length;G++)$+=this._tracked[G].firstX,V+=this._tracked[G].firstY,J+=this._tracked[G].lastX,W+=this._tracked[G].lastY;return{first:{x:$/Q,y:V/Q},last:{x:J/Q,y:W/Q}}}_getAverageMovement(){if(this._tracked.length===0)throw Error("Failed to get gesture movement, no tracked touches");let Q,$;Q=$=0;let V=this._tracked.length;for(let J=0;J<this._tracked.length;J++)Q+=this._tracked[J].lastX-this._tracked[J].firstX,$+=this._tracked[J].lastY-this._tracked[J].firstY;return{x:Q/V,y:$/V}}_getAverageDistance(){if(this._tracked.length===0)throw Error("Failed to get gesture distance, no tracked touches");let Q=this._tracked[0],$=this._tracked[this._tracked.length-1],V=Math.abs($.firstX-Q.firstX),J=Math.abs($.firstY-Q.firstY),W=Math.abs($.lastX-Q.lastX),G=Math.abs($.lastY-Q.lastY);return{first:{x:V,y:J},last:{x:W,y:G}}}}var H0=!o6||Y6;class _0{constructor(){if(this._target=null,this._canvas=document.createElement("canvas"),H0)this._canvas.style.position="fixed",this._canvas.style.zIndex="65535",this._canvas.style.pointerEvents="none",this._canvas.style.userSelect="none",this._canvas.style.WebkitUserSelect="none",this._canvas.style.visibility="hidden";this._position={x:0,y:0},this._hotSpot={x:0,y:0},this._eventHandlers={mouseover:this._handleMouseOver.bind(this),mouseleave:this._handleMouseLeave.bind(this),mousemove:this._handleMouseMove.bind(this),mouseup:this._handleMouseUp.bind(this)}}attach(Q){if(this._target)this.detach();if(this._target=Q,H0){document.body.appendChild(this._canvas);let $={capture:!0,passive:!0};this._target.addEventListener("mouseover",this._eventHandlers.mouseover,$),this._target.addEventListener("mouseleave",this._eventHandlers.mouseleave,$),this._target.addEventListener("mousemove",this._eventHandlers.mousemove,$),this._target.addEventListener("mouseup",this._eventHandlers.mouseup,$)}this.clear()}detach(){if(!this._target)return;if(H0){let Q={capture:!0,passive:!0};if(this._target.removeEventListener("mouseover",this._eventHandlers.mouseover,Q),this._target.removeEventListener("mouseleave",this._eventHandlers.mouseleave,Q),this._target.removeEventListener("mousemove",this._eventHandlers.mousemove,Q),this._target.removeEventListener("mouseup",this._eventHandlers.mouseup,Q),document.contains(this._canvas))document.body.removeChild(this._canvas)}this._target=null}change(Q,$,V,J,W){if(J===0||W===0){this.clear();return}this._position.x=this._position.x+this._hotSpot.x-$,this._position.y=this._position.y+this._hotSpot.y-V,this._hotSpot.x=$,this._hotSpot.y=V;let G=this._canvas.getContext("2d");this._canvas.width=J,this._canvas.height=W;let q=new ImageData(new Uint8ClampedArray(Q),J,W);if(G.clearRect(0,0,J,W),G.putImageData(q,0,0),H0)this._updatePosition();else{let U=this._canvas.toDataURL();this._target.style.cursor="url("+U+")"+$+" "+V+", default"}}clear(){this._target.style.cursor="none",this._canvas.width=0,this._canvas.height=0,this._position.x=this._position.x+this._hotSpot.x,this._position.y=this._position.y+this._hotSpot.y,this._hotSpot.x=0,this._hotSpot.y=0}move(Q,$){if(!H0)return;if(window.visualViewport)this._position.x=Q+window.visualViewport.offsetLeft,this._position.y=$+window.visualViewport.offsetTop;else this._position.x=Q,this._position.y=$;this._updatePosition();let V=document.elementFromPoint(Q,$);this._updateVisibility(V)}_handleMouseOver(Q){this._handleMouseMove(Q)}_handleMouseLeave(Q){this._updateVisibility(Q.relatedTarget)}_handleMouseMove(Q){this._updateVisibility(Q.target),this._position.x=Q.clientX-this._hotSpot.x,this._position.y=Q.clientY-this._hotSpot.y,this._updatePosition()}_handleMouseUp(Q){let $=document.elementFromPoint(Q.clientX,Q.clientY);if(this._updateVisibility($),this._captureIsActive())window.setTimeout(()=>{if(!this._target)return;$=document.elementFromPoint(Q.clientX,Q.clientY),this._updateVisibility($)},0)}_showCursor(){if(this._canvas.style.visibility==="hidden")this._canvas.style.visibility=""}_hideCursor(){if(this._canvas.style.visibility!=="hidden")this._canvas.style.visibility="hidden"}_shouldShowCursor(Q){if(!Q)return!1;if(Q===this._target)return!0;if(!this._target.contains(Q))return!1;if(window.getComputedStyle(Q).cursor!=="none")return!1;return!0}_updateVisibility(Q){if(this._captureIsActive())Q=document.captureElement;if(this._shouldShowCursor(Q))this._showCursor();else 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)}}var m6=41943040,y0={CONNECTING:"connecting",OPEN:"open",CLOSING:"closing",CLOSED:"closed"},h0={CONNECTING:[WebSocket.CONNECTING,y0.CONNECTING],OPEN:[WebSocket.OPEN,y0.OPEN],CLOSING:[WebSocket.CLOSING,y0.CLOSING],CLOSED:[WebSocket.CLOSED,y0.CLOSED]},I8=["send","close","binaryType","onerror","onmessage","onopen","protocol","readyState"];class p0{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 readyState(){let Q;if(this._websocket===null)return"unused";if(Q=this._websocket.readyState,h0.CONNECTING.includes(Q))return"connecting";else if(h0.OPEN.includes(Q))return"open";else if(h0.CLOSING.includes(Q))return"closing";else if(h0.CLOSED.includes(Q))return"closed";return"unknown"}rQpeek8(){return this._rQ[this._rQi]}rQskipBytes(Q){this._rQi+=Q}rQshift8(){return this._rQshift(1)}rQshift16(){return this._rQshift(2)}rQshift32(){return this._rQshift(4)}_rQshift(Q){let $=0;for(let V=Q-1;V>=0;V--)$+=this._rQ[this._rQi++]<<V*8;return $>>>0}rQshiftStr(Q){let $="";for(let V=0;V<Q;V+=4096){let J=this.rQshiftBytes(Math.min(4096,Q-V),!1);$+=String.fromCharCode.apply(null,J)}return $}rQshiftBytes(Q,$=!0){if(this._rQi+=Q,$)return this._rQ.slice(this._rQi-Q,this._rQi);else return this._rQ.subarray(this._rQi-Q,this._rQi)}rQshiftTo(Q,$){Q.set(new Uint8Array(this._rQ.buffer,this._rQi,$)),this._rQi+=$}rQpeekBytes(Q,$=!0){if($)return this._rQ.slice(this._rQi,this._rQi+Q);else return this._rQ.subarray(this._rQi,this._rQi+Q)}rQwait(Q,$,V){if(this._rQlen-this._rQi<$){if(V){if(this._rQi<V)throw Error("rQwait cannot backup "+V+" bytes");this._rQi-=V}return!0}return!1}sQpush8(Q){this._sQensureSpace(1),this._sQ[this._sQlen++]=Q}sQpush16(Q){this._sQensureSpace(2),this._sQ[this._sQlen++]=Q>>8&255,this._sQ[this._sQlen++]=Q>>0&255}sQpush32(Q){this._sQensureSpace(4),this._sQ[this._sQlen++]=Q>>24&255,this._sQ[this._sQlen++]=Q>>16&255,this._sQ[this._sQlen++]=Q>>8&255,this._sQ[this._sQlen++]=Q>>0&255}sQpushString(Q){let $=Q.split("").map((V)=>V.charCodeAt(0));this.sQpushBytes(new Uint8Array($))}sQpushBytes(Q){for(let $=0;$<Q.length;){this._sQensureSpace(1);let V=this._sQbufferSize-this._sQlen;if(V>Q.length-$)V=Q.length-$;this._sQ.set(Q.subarray($,$+V),this._sQlen),this._sQlen+=V,$+=V}}flush(){if(this._sQlen>0&&this.readyState==="open")this._websocket.send(new Uint8Array(this._sQ.buffer,0,this._sQlen)),this._sQlen=0}_sQensureSpace(Q){if(this._sQbufferSize-this._sQlen<Q)this.flush()}off(Q){this._eventHandlers[Q]=()=>{}}on(Q,$){this._eventHandlers[Q]=$}_allocateBuffers(){this._rQ=new Uint8Array(this._rQbufferSize),this._sQ=new Uint8Array(this._sQbufferSize)}init(){this._allocateBuffers(),this._rQi=0,this._websocket=null}open(Q,$){this.attach(new WebSocket(Q,$))}attach(Q){this.init();let $=[...Object.keys(Q),...Object.getOwnPropertyNames(Object.getPrototypeOf(Q))];for(let V=0;V<I8.length;V++){let J=I8[V];if($.indexOf(J)<0)throw Error("Raw channel missing property: "+J)}this._websocket=Q,this._websocket.binaryType="arraybuffer",this._websocket.onmessage=this._recvMessage.bind(this),this._websocket.onopen=()=>{if(w(">> WebSock.onopen"),this._websocket.protocol)r("Server choose sub-protocol: "+this._websocket.protocol);this._eventHandlers.open(),w("<< WebSock.onopen")},this._websocket.onclose=(V)=>{w(">> WebSock.onclose"),this._eventHandlers.close(V),w("<< WebSock.onclose")},this._websocket.onerror=(V)=>{w(">> WebSock.onerror: "+V),this._eventHandlers.error(V),w("<< WebSock.onerror: "+V)}}close(){if(this._websocket){if(this.readyState==="connecting"||this.readyState==="open")r("Closing WebSocket connection"),this._websocket.close();this._websocket.onmessage=()=>{}}}_expandCompactRQ(Q){let $=(this._rQlen-this._rQi+Q)*8,V=this._rQbufferSize<$;if(V)this._rQbufferSize=Math.max(this._rQbufferSize*2,$);if(this._rQbufferSize>m6){if(this._rQbufferSize=m6,this._rQbufferSize-(this._rQlen-this._rQi)<Q)throw Error("Receive queue buffer exceeded "+m6+" bytes, and the new message could not fit")}if(V){let J=this._rQ.buffer;this._rQ=new Uint8Array(this._rQbufferSize),this._rQ.set(new Uint8Array(J,this._rQi,this._rQlen-this._rQi))}else this._rQ.copyWithin(0,this._rQi,this._rQlen);this._rQlen=this._rQlen-this._rQi,this._rQi=0}_recvMessage(Q){if(this._rQlen==this._rQi)this._rQlen=0,this._rQi=0;let $=new Uint8Array(Q.data);if($.length>this._rQbufferSize-this._rQlen)this._expandCompactRQ($.length);if(this._rQ.set($,this._rQlen),this._rQlen+=$.length,this._rQlen-this._rQi>0)this._eventHandlers.message();else w("Ignoring empty message")}}var B8={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,Lang1:114,Lang2:113,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};var T={encodingRaw:0,encodingCopyRect:1,encodingRRE:2,encodingHextile:5,encodingZlib:6,encodingTight:7,encodingZRLE:16,encodingTightPNG:-260,encodingJPEG:21,encodingH264:50,pseudoEncodingQualityLevel9:-23,pseudoEncodingQualityLevel0:-32,pseudoEncodingDesktopSize:-223,pseudoEncodingLastRect:-224,pseudoEncodingCursor:-239,pseudoEncodingQEMUExtendedKeyEvent:-258,pseudoEncodingQEMULedEvent:-261,pseudoEncodingDesktopName:-307,pseudoEncodingExtendedDesktopSize:-308,pseudoEncodingXvp:-309,pseudoEncodingFence:-312,pseudoEncodingContinuousUpdates:-313,pseudoEncodingExtendedMouseButtons:-316,pseudoEncodingCompressLevel9:-247,pseudoEncodingCompressLevel0:-256,pseudoEncodingVMwareCursor:1464686180,pseudoEncodingExtendedClipboard:3231835598};class m0{constructor(){this._key=null}get algorithm(){return{name:"AES-ECB"}}static async importKey(Q,$,V,J){let W=new m0;return await W._importKey(Q,V,J),W}async _importKey(Q,$,V){this._key=await window.crypto.subtle.importKey("raw",Q,{name:"AES-CBC"},$,V)}async encrypt(Q,$){let V=new Uint8Array($);if(V.length%16!==0||this._key===null)return null;let J=V.length/16;for(let W=0;W<J;W++){let G=new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-CBC",iv:new Uint8Array(16)},this._key,V.slice(W*16,W*16+16))).slice(0,16);V.set(G,W*16)}return V}}class b0{constructor(){this._rawKey=null,this._ctrKey=null,this._cbcKey=null,this._zeroBlock=new Uint8Array(16),this._prefixBlock0=this._zeroBlock,this._prefixBlock1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]),this._prefixBlock2=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2])}get algorithm(){return{name:"AES-EAX"}}async _encryptBlock(Q){let $=await window.crypto.subtle.encrypt({name:"AES-CBC",iv:this._zeroBlock},this._cbcKey,Q);return new Uint8Array($).slice(0,16)}async _initCMAC(){let Q=await this._encryptBlock(this._zeroBlock),$=new Uint8Array(16),V=Q[0]>>>6;for(let W=0;W<15;W++)$[W]=Q[W+1]>>6|Q[W]<<2,Q[W]=Q[W+1]>>7|Q[W]<<1;let J=[0,135,14,137];$[14]^=V>>>1,$[15]=Q[15]<<2^J[V],Q[15]=Q[15]<<1^J[V>>1],this._k1=Q,this._k2=$}async _encryptCTR(Q,$){let V=await window.crypto.subtle.encrypt({name:"AES-CTR",counter:$,length:128},this._ctrKey,Q);return new Uint8Array(V)}async _decryptCTR(Q,$){let V=await window.crypto.subtle.decrypt({name:"AES-CTR",counter:$,length:128},this._ctrKey,Q);return new Uint8Array(V)}async _computeCMAC(Q,$){if($.length!==16)return null;let V=Math.floor(Q.length/16),J=Math.ceil(Q.length/16),W=Q.length-V*16,G=new Uint8Array((J+1)*16);if(G.set($),G.set(Q,16),W===0)for(let Z=0;Z<16;Z++)G[V*16+Z]^=this._k1[Z];else{G[(V+1)*16+W]=128;for(let Z=0;Z<16;Z++)G[(V+1)*16+Z]^=this._k2[Z]}let q=await window.crypto.subtle.encrypt({name:"AES-CBC",iv:this._zeroBlock},this._cbcKey,G);return q=new Uint8Array(q),q.slice(q.length-32,q.length-16)}static async importKey(Q,$,V,J){let W=new b0;return await W._importKey(Q),W}async _importKey(Q){this._rawKey=Q,this._ctrKey=await window.crypto.subtle.importKey("raw",Q,{name:"AES-CTR"},!1,["encrypt","decrypt"]),this._cbcKey=await window.crypto.subtle.importKey("raw",Q,{name:"AES-CBC"},!1,["encrypt"]),await this._initCMAC()}async encrypt(Q,$){let{additionalData:V,iv:J}=Q,W=await this._computeCMAC(J,this._prefixBlock0),G=await this._encryptCTR($,W),q=await this._computeCMAC(V,this._prefixBlock1),U=await this._computeCMAC(G,this._prefixBlock2);for(let Y=0;Y<16;Y++)U[Y]^=W[Y]^q[Y];let Z=new Uint8Array(16+G.length);return Z.set(G),Z.set(U,G.length),Z}async decrypt(Q,$){let V=$.slice(0,$.length-16),J=Q.additionalData,W=Q.iv,G=$.slice($.length-16),q=await this._computeCMAC(W,this._prefixBlock0),U=await this._computeCMAC(J,this._prefixBlock1),Z=await this._computeCMAC(V,this._prefixBlock2);for(let X=0;X<16;X++)Z[X]^=q[X]^U[X];if(Z.length!==G.length)return null;for(let X=0;X<G.length;X++)if(Z[X]!==G[X])return null;return await this._decryptCTR(V,q)}}var N8=[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],Z4=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28];var H,L,N,F,C,M;H=65536;L=16777216;N=H|L;F=4;C=1024;M=F|C;var M8=[N|C,0,H|0,N|M,N|F,H|M,0|F,H|0,0|C,N|C,N|M,0|C,L|M,N|F,L|0,0|F,0|M,L|C,L|C,H|C,H|C,N|0,N|0,L|M,H|F,L|F,L|F,H|F,0,0|M,H|M,L|0,H|0,N|M,0|F,N|0,N|C,L|0,L|0,0|C,N|F,H|0,H|C,L|F,0|C,0|F,L|M,H|M,N|M,H|F,N|0,L|M,L|F,0|M,H|M,N|C,0|M,L|C,L|C,0,H|F,H|C,0,N|F];H=1048576;L=-2147483648;N=H|L;F=32;C=32768;M=F|C;var O8=[N|M,L|C,0|C,H|M,H|0,0|F,N|F,L|M,L|F,N|M,N|C,L|0,L|C,H|0,0|F,N|F,H|C,H|F,L|M,0,L|0,0|C,H|M,N|0,H|F,L|F,0,H|C,0|M,N|C,N|0,0|M,0,H|M,N|F,H|0,L|M,N|0,N|C,0|C,N|0,L|C,0|F,N|M,H|M,0|F,0|C,L|0,0|M,N|C,H|0,L|F,H|F,L|M,L|F,H|F,H|C,0,L|C,0|M,L|0,N|F,N|M,H|C];H=131072;L=134217728;N=H|L;F=8;C=512;M=F|C;var A8=[0|M,N|C,0,N|F,L|C,0,H|M,L|C,H|F,L|F,L|F,H|0,N|M,H|F,N|0,0|M,L|0,0|F,N|C,0|C,H|C,N|0,N|F,H|M,L|M,H|C,H|0,L|M,0|F,N|M,0|C,L|0,N|C,L|0,H|F,0|M,H|0,N|C,L|C,0,0|C,H|F,N|M,L|C,L|F,0|C,0,N|F,L|M,H|0,L|0,N|M,0|F,H|M,H|C,L|F,N|0,L|M,0|M,N|0,H|M,0|F,N|F,H|C];H=8192;L=8388608;N=H|L;F=1;C=128;M=F|C;var D8=[N|F,H|M,H|M,0|C,N|C,L|M,L|F,H|F,0,N|0,N|0,N|M,0|M,0,L|C,L|F,0|F,H|0,L|0,N|F,0|C,L|0,H|F,H|C,L|M,0|F,H|C,L|C,H|0,N|C,N|M,0|M,L|C,L|F,N|0,N|M,0|M,0,0,N|0,H|C,L|C,L|M,0|F,N|F,H|M,H|M,0|C,N|M,0|M,0|F,H|0,L|F,H|F,N|C,L|M,H|F,H|C,L|0,N|F,0|C,L|0,H|0,N|C];H=33554432;L=1073741824;N=H|L;F=256;C=524288;M=F|C;var R8=[0|F,H|M,H|C,N|F,0|C,0|F,L|0,H|C,L|M,0|C,H|F,L|M,N|F,N|C,0|M,L|0,H|0,L|C,L|C,0,L|F,N|M,N|M,H|F,N|C,L|F,0,N|0,H|M,H|0,N|0,0|M,0|C,N|F,0|F,H|0,L|0,H|C,N|F,L|M,H|F,L|0,N|C,H|M,L|M,0|F,H|0,N|C,N|M,0|M,N|0,N|M,H|C,0,L|C,N|0,0|M,H|F,L|F,0|C,0,L|C,H|M,L|F];H=4194304;L=536870912;N=H|L;F=16;C=16384;M=F|C;var K8=[L|F,N|0,0|C,N|M,N|0,0|F,N|M,H|0,L|C,H|M,H|0,L|F,H|F,L|C,L|0,0|M,0,H|F,L|M,0|C,H|C,L|M,0|F,N|F,N|F,0,H|M,N|C,0|M,H|C,N|C,L|0,L|C,0|F,N|F,H|C,N|M,H|0,0|M,L|F,H|0,L|C,L|0,0|M,L|F,N|M,H|C,N|0,H|M,N|C,0,N|F,0|F,0|C,N|0,H|M,0|C,H|F,L|M,0,N|C,L|0,H|F,L|M];H=2097152;L=67108864;N=H|L;F=2;C=2048;M=F|C;var E8=[H|0,N|F,L|M,0,0|C,L|M,H|M,N|C,N|M,H|0,0,L|F,0|F,L|0,N|F,0|M,L|C,H|M,H|F,L|C,L|F,N|0,N|C,H|F,N|0,0|C,0|M,N|M,H|C,0|F,L|0,H|C,L|0,H|C,H|0,L|M,L|M,N|F,N|F,0|F,H|F,L|0,L|C,H|0,N|C,0|M,H|M,N|C,0|M,L|F,N|M,N|0,H|C,0,0|F,N|M,0,H|M,N|0,0|C,L|F,L|C,0|C,H|F];H=262144;L=268435456;N=H|L;F=64;C=4096;M=F|C;var w8=[L|M,0|C,H|0,N|M,L|0,L|M,0|F,L|0,H|F,N|0,N|M,H|C,N|C,H|M,0|C,0|F,N|0,L|F,L|C,0|M,H|C,H|F,N|F,N|C,0|M,0,0,N|F,L|F,L|C,H|M,H|0,H|M,H|0,N|C,0|C,0|F,N|F,0|C,H|M,L|C,0|F,L|F,N|0,N|F,L|0,H|0,L|M,0,N|M,H|F,L|F,N|0,L|C,L|M,0,N|M,H|C,H|C,0|M,0|M,H|F,L|0,N|C];class b6{constructor(Q){this.keys=[];let $=[],V=[],J=[];for(let W=0,G=56;W<56;++W,G-=8){G+=G<-5?65:G<-3?31:G<-1?63:G===27?35:0;let q=G&7;$[W]=(Q[G>>>3]&1<<q)!==0?1:0}for(let W=0;W<16;++W){let G=W<<1,q=G+1;J[G]=J[q]=0;for(let U=28;U<59;U+=28)for(let Z=U-28;Z<U;++Z){let Y=Z+Z4[W];V[Z]=Y<U?$[Y]:$[Y-28]}for(let U=0;U<24;++U){if(V[N8[U]]!==0)J[G]|=1<<23-U;if(V[N8[U+24]]!==0)J[q]|=1<<23-U}}for(let W=0,G=0,q=0;W<16;++W){let U=J[G++],Z=J[G++];this.keys[q]=(U&16515072)<<6,this.keys[q]|=(U&4032)<<10,this.keys[q]|=(Z&16515072)>>>10,this.keys[q]|=(Z&4032)>>>6,++q,this.keys[q]=(U&258048)<<12,this.keys[q]|=(U&63)<<16,this.keys[q]|=(Z&258048)>>>4,this.keys[q]|=Z&63,++q}}enc8(Q){let $=Q.slice(),V=0,J,W,G;J=$[V++]<<24|$[V++]<<16|$[V++]<<8|$[V++],W=$[V++]<<24|$[V++]<<16|$[V++]<<8|$[V++],G=(J>>>4^W)&252645135,W^=G,J^=G<<4,G=(J>>>16^W)&65535,W^=G,J^=G<<16,G=(W>>>2^J)&858993459,J^=G,W^=G<<2,G=(W>>>8^J)&16711935,J^=G,W^=G<<8,W=W<<1|W>>>31&1,G=(J^W)&2863311530,J^=G,W^=G,J=J<<1|J>>>31&1;for(let q=0,U=0;q<8;++q){G=W<<28|W>>>4,G^=this.keys[U++];let Z=E8[G&63];Z|=R8[G>>>8&63],Z|=A8[G>>>16&63],Z|=M8[G>>>24&63],G=W^this.keys[U++],Z|=w8[G&63],Z|=K8[G>>>8&63],Z|=D8[G>>>16&63],Z|=O8[G>>>24&63],J^=Z,G=J<<28|J>>>4,G^=this.keys[U++],Z=E8[G&63],Z|=R8[G>>>8&63],Z|=A8[G>>>16&63],Z|=M8[G>>>24&63],G=J^this.keys[U++],Z|=w8[G&63],Z|=K8[G>>>8&63],Z|=D8[G>>>16&63],Z|=O8[G>>>24&63],W^=Z}W=W<<31|W>>>1,G=(J^W)&2863311530,J^=G,W^=G,J=J<<31|J>>>1,G=(J>>>8^W)&16711935,W^=G,J^=G<<8,G=(J>>>2^W)&858993459,W^=G,J^=G<<2,G=(W>>>16^J)&65535,J^=G,W^=G<<16,G=(W>>>4^J)&252645135,J^=G,W^=G<<4,G=[W,J];for(V=0;V<8;V++)if($[V]=(G[V>>>2]>>>8*(3-V%4))%256,$[V]<0)$[V]+=256;return $}}class c0{constructor(){this._cipher=null}get algorithm(){return{name:"DES-ECB"}}static importKey(Q,$,V,J){let W=new c0;return W._importKey(Q),W}_importKey(Q,$,V){this._cipher=new b6(Q)}encrypt(Q,$){let V=new Uint8Array($);if(V.length%8!==0||this._cipher===null)return null;let J=V.length/8;for(let W=0;W<J;W++)V.set(this._cipher.enc8(V.slice(W*8,W*8+8)),W*8);return V}}class n0{constructor(){this._cipher=null}get algorithm(){return{name:"DES-CBC"}}static importKey(Q,$,V,J){let W=new n0;return W._importKey(Q),W}_importKey(Q){this._cipher=new b6(Q)}encrypt(Q,$){let V=new Uint8Array($),J=new Uint8Array(Q.iv);if(V.length%8!==0||this._cipher===null)return null;let W=V.length/8;for(let G=0;G<W;G++){for(let q=0;q<8;q++)J[q]^=$[G*8+q];J=this._cipher.enc8(J),V.set(J,G*8)}return V}}function t1(Q,$,V){let J=1n;Q=Q%V;while($>0n){if(($&1n)===1n)J=J*Q%V;$=$>>1n,Q=Q*Q%V}return J}function s1(Q,$=0){let V=Q.toString(16);if($===0)$=Math.ceil(V.length/2);V=V.padStart($*2,"0");let J=V.length/2,W=new Uint8Array(J);for(let G=0;G<J;G++)W[G]=parseInt(V.slice(G*2,G*2+2),16);return W}function W1(Q){let $="0x";for(let V=0;V<Q.length;V++)$+=Q[V].toString(16).padStart(2,"0");return BigInt($)}class L0{constructor(){this._keyLength=0,this._keyBytes=0,this._n=null,this._e=null,this._d=null,this._nBigInt=null,this._eBigInt=null,this._dBigInt=null,this._extractable=!1}get algorithm(){return{name:"RSA-PKCS1-v1_5"}}_base64urlDecode(Q){return Q=Q.replace(/-/g,"+").replace(/_/g,"/"),Q=Q.padEnd(Math.ceil(Q.length/4)*4,"="),f1.decode(Q)}_padArray(Q,$){let V=new Uint8Array($);return V.set(Q,$-Q.length),V}static async generateKey(Q,$,V){let J=new L0;return await J._generateKey(Q,$),{privateKey:J}}async _generateKey(Q,$){this._keyLength=Q.modulusLength,this._keyBytes=Math.ceil(this._keyLength/8);let V=await window.crypto.subtle.generateKey({name:"RSA-OAEP",modulusLength:Q.modulusLength,publicExponent:Q.publicExponent,hash:{name:"SHA-256"}},!0,["encrypt","decrypt"]),J=await window.crypto.subtle.exportKey("jwk",V.privateKey);this._n=this._padArray(this._base64urlDecode(J.n),this._keyBytes),this._nBigInt=W1(this._n),this._e=this._padArray(this._base64urlDecode(J.e),this._keyBytes),this._eBigInt=W1(this._e),this._d=this._padArray(this._base64urlDecode(J.d),this._keyBytes),this._dBigInt=W1(this._d),this._extractable=$}static async importKey(Q,$,V,J){if(J.length!==1||J[0]!=="encrypt")throw Error("only support importing RSA public key");let W=new L0;return await W._importKey(Q,V),W}async _importKey(Q,$){let{n:V,e:J}=Q;if(V.length!==J.length)throw Error("the sizes of modulus and public exponent do not match");this._keyBytes=V.length,this._keyLength=this._keyBytes*8,this._n=new Uint8Array(this._keyBytes),this._e=new Uint8Array(this._keyBytes),this._n.set(V),this._e.set(J),this._nBigInt=W1(this._n),this._eBigInt=W1(this._e),this._extractable=$}async encrypt(Q,$){if($.length>this._keyBytes-11)return null;let V=new Uint8Array(this._keyBytes-$.length-3);window.crypto.getRandomValues(V);for(let q=0;q<V.length;q++)V[q]=Math.floor(V[q]*254/255+1);let J=new Uint8Array(this._keyBytes);J[1]=2,J.set(V,2),J.set($,V.length+3);let W=W1(J),G=t1(W,this._eBigInt,this._nBigInt);return s1(G,this._keyBytes)}async decrypt(Q,$){if($.length!==this._keyBytes)return null;let V=W1($),J=t1(V,this._dBigInt,this._nBigInt),W=s1(J,this._keyBytes);if(W[0]!==0||W[1]!==2)return null;let G=2;for(;G<W.length;G++)if(W[G]===0)break;if(G===W.length)return null;return W.slice(G+1,W.length)}async exportKey(){if(!this._extractable)throw Error("key is not extractable");return{n:this._n,e:this._e,d:this._d}}}class S8{constructor(Q){this._key=Q}get algorithm(){return{name:"DH"}}exportKey(){return this._key}}class i0{constructor(){this._g=null,this._p=null,this._gBigInt=null,this._pBigInt=null,this._privateKey=null}get algorithm(){return{name:"DH"}}static generateKey(Q,$){let V=new i0;return V._generateKey(Q),{privateKey:V,publicKey:new S8(V._publicKey)}}_generateKey(Q){let{g:$,p:V}=Q;this._keyBytes=V.length,this._gBigInt=W1($),this._pBigInt=W1(V),this._privateKey=window.crypto.getRandomValues(new Uint8Array(this._keyBytes)),this._privateKeyBigInt=W1(this._privateKey),this._publicKey=s1(t1(this._gBigInt,this._privateKeyBigInt,this._pBigInt),this._keyBytes)}deriveBits(Q,$){let V=Math.ceil($/8),J=new Uint8Array(Q.public),W=V>this._keyBytes?V:this._keyBytes,G=t1(W1(J),this._privateKeyBigInt,this._pBigInt);return s1(G,W).slice(0,W)}}async function T8(Q){let $="";for(let V=0;V<Q.length;V++)$+=String.fromCharCode(Q[V]);return z4(j4(H4(P4($),8*$.length)))}function z4(Q){let $=new Uint8Array(Q.length);for(let V=0;V<Q.length;V++)$[V]=Q.charCodeAt(V);return $}function P4(Q){let $=Array(Q.length>>2);for(let V=0;V<$.length;V++)$[V]=0;for(let V=0;V<8*Q.length;V+=8)$[V>>5]|=(255&Q.charCodeAt(V/8))<<V%32;return $}function j4(Q){let $="";for(let V=0;V<32*Q.length;V+=8)$+=String.fromCharCode(Q[V>>5]>>>V%32&255);return $}function H4(Q,$){Q[$>>5]|=128<<$%32,Q[14+($+64>>>9<<4)]=$;let V=1732584193,J=-271733879,W=-1732584194,G=271733878;for(let q=0;q<Q.length;q+=16){let U=V,Z=J,Y=W,X=G;J=Q1(J=Q1(J=Q1(J=Q1(J=e(J=e(J=e(J=e(J=s(J=s(J=s(J=s(J=t(J=t(J=t(J=t(J,W=t(W,G=t(G,V=t(V,J,W,G,Q[q+0],7,-680876936),J,W,Q[q+1],12,-389564586),V,J,Q[q+2],17,606105819),G,V,Q[q+3],22,-1044525330),W=t(W,G=t(G,V=t(V,J,W,G,Q[q+4],7,-176418897),J,W,Q[q+5],12,1200080426),V,J,Q[q+6],17,-1473231341),G,V,Q[q+7],22,-45705983),W=t(W,G=t(G,V=t(V,J,W,G,Q[q+8],7,1770035416),J,W,Q[q+9],12,-1958414417),V,J,Q[q+10],17,-42063),G,V,Q[q+11],22,-1990404162),W=t(W,G=t(G,V=t(V,J,W,G,Q[q+12],7,1804603682),J,W,Q[q+13],12,-40341101),V,J,Q[q+14],17,-1502002290),G,V,Q[q+15],22,1236535329),W=s(W,G=s(G,V=s(V,J,W,G,Q[q+1],5,-165796510),J,W,Q[q+6],9,-1069501632),V,J,Q[q+11],14,643717713),G,V,Q[q+0],20,-373897302),W=s(W,G=s(G,V=s(V,J,W,G,Q[q+5],5,-701558691),J,W,Q[q+10],9,38016083),V,J,Q[q+15],14,-660478335),G,V,Q[q+4],20,-405537848),W=s(W,G=s(G,V=s(V,J,W,G,Q[q+9],5,568446438),J,W,Q[q+14],9,-1019803690),V,J,Q[q+3],14,-187363961),G,V,Q[q+8],20,1163531501),W=s(W,G=s(G,V=s(V,J,W,G,Q[q+13],5,-1444681467),J,W,Q[q+2],9,-51403784),V,J,Q[q+7],14,1735328473),G,V,Q[q+12],20,-1926607734),W=e(W,G=e(G,V=e(V,J,W,G,Q[q+5],4,-378558),J,W,Q[q+8],11,-2022574463),V,J,Q[q+11],16,1839030562),G,V,Q[q+14],23,-35309556),W=e(W,G=e(G,V=e(V,J,W,G,Q[q+1],4,-1530992060),J,W,Q[q+4],11,1272893353),V,J,Q[q+7],16,-155497632),G,V,Q[q+10],23,-1094730640),W=e(W,G=e(G,V=e(V,J,W,G,Q[q+13],4,681279174),J,W,Q[q+0],11,-358537222),V,J,Q[q+3],16,-722521979),G,V,Q[q+6],23,76029189),W=e(W,G=e(G,V=e(V,J,W,G,Q[q+9],4,-640364487),J,W,Q[q+12],11,-421815835),V,J,Q[q+15],16,530742520),G,V,Q[q+2],23,-995338651),W=Q1(W,G=Q1(G,V=Q1(V,J,W,G,Q[q+0],6,-198630844),J,W,Q[q+7],10,1126891415),V,J,Q[q+14],15,-1416354905),G,V,Q[q+5],21,-57434055),W=Q1(W,G=Q1(G,V=Q1(V,J,W,G,Q[q+12],6,1700485571),J,W,Q[q+3],10,-1894986606),V,J,Q[q+10],15,-1051523),G,V,Q[q+1],21,-2054922799),W=Q1(W,G=Q1(G,V=Q1(V,J,W,G,Q[q+8],6,1873313359),J,W,Q[q+15],10,-30611744),V,J,Q[q+6],15,-1560198380),G,V,Q[q+13],21,1309151649),W=Q1(W,G=Q1(G,V=Q1(V,J,W,G,Q[q+4],6,-145523070),J,W,Q[q+11],10,-1120210379),V,J,Q[q+2],15,718787259),G,V,Q[q+9],21,-343485551),V=O1(V,U),J=O1(J,Z),W=O1(W,Y),G=O1(G,X)}return Array(V,J,W,G)}function r0(Q,$,V,J,W,G){return O1(L4(O1(O1($,Q),O1(J,G)),W),V)}function t(Q,$,V,J,W,G,q){return r0($&V|~$&J,Q,$,W,G,q)}function s(Q,$,V,J,W,G,q){return r0($&J|V&~J,Q,$,W,G,q)}function e(Q,$,V,J,W,G,q){return r0($^V^J,Q,$,W,G,q)}function Q1(Q,$,V,J,W,G,q){return r0(V^($|~J),Q,$,W,G,q)}function O1(Q,$){let V=(65535&Q)+(65535&$);return(Q>>16)+($>>16)+(V>>16)<<16|65535&V}function L4(Q,$){return Q<<$|Q>>>32-$}class v8{constructor(){this._algorithms={"AES-ECB":m0,"AES-EAX":b0,"DES-ECB":c0,"DES-CBC":n0,"RSA-PKCS1-v1_5":L0,DH:i0,MD5:T8}}encrypt(Q,$,V){if($.algorithm.name!==Q.name)throw Error("algorithm does not match");if(typeof $.encrypt!=="function")throw Error("key does not support encryption");return $.encrypt(Q,V)}decrypt(Q,$,V){if($.algorithm.name!==Q.name)throw Error("algorithm does not match");if(typeof $.decrypt!=="function")throw Error("key does not support encryption");return $.decrypt(Q,V)}importKey(Q,$,V,J,W){if(Q!=="raw")throw Error("key format is not supported");let G=this._algorithms[V.name];if(typeof G>"u"||typeof G.importKey!=="function")throw Error("algorithm is not supported");return G.importKey($,V,J,W)}generateKey(Q,$,V){let J=this._algorithms[Q.name];if(typeof J>"u"||typeof J.generateKey!=="function")throw Error("algorithm is not supported");return J.generateKey(Q,$,V)}exportKey(Q,$){if(Q!=="raw")throw Error("key format is not supported");if(typeof $.exportKey!=="function")throw Error("key does not support exportKey");return $.exportKey()}digest(Q,$){let V=this._algorithms[Q];if(typeof V!=="function")throw Error("algorithm is not supported");return V($)}deriveBits(Q,$,V){if($.algorithm.name!==Q.name)throw Error("algorithm does not match");if(typeof $.deriveBits!=="function")throw Error("key does not support deriveBits");return $.deriveBits(Q,V)}}var n=new v8;class c6{constructor(){this._cipher=null,this._counter=new Uint8Array(16)}async setKey(Q){this._cipher=await n.importKey("raw",Q,{name:"AES-EAX"},!1,["encrypt, decrypt"])}async makeMessage(Q){let $=new Uint8Array([(Q.length&65280)>>>8,Q.length&255]),V=await n.encrypt({name:"AES-EAX",iv:this._counter,additionalData:$},this._cipher,Q);for(let W=0;W<16&&this._counter[W]++===255;W++);let J=new Uint8Array(Q.length+2+16);return J.set($),J.set(V,2),J}async receiveMessage(Q,$){let V=new Uint8Array([(Q&65280)>>>8,Q&255]),J=await n.decrypt({name:"AES-EAX",iv:this._counter,additionalData:V},this._cipher,$);for(let W=0;W<16&&this._counter[W]++===255;W++);return J}}class l0 extends h1{constructor(Q,$){super();this._hasStarted=!1,this._checkSock=null,this._checkCredentials=null,this._approveServerResolve=null,this._sockReject=null,this._credentialsReject=null,this._approveServerReject=null,this._sock=Q,this._getCredentials=$}_waitSockAsync(Q){return new Promise(($,V)=>{let J=()=>!this._sock.rQwait("RA2",Q);if(J())$();else this._checkSock=()=>{if(J())$(),this._checkSock=null,this._sockReject=null},this._sockReject=V})}_waitApproveKeyAsync(){return new Promise((Q,$)=>{this._approveServerResolve=Q,this._approveServerReject=$})}_waitCredentialsAsync(Q){let $=()=>{if(Q===1&&this._getCredentials().username!==void 0&&this._getCredentials().password!==void 0)return!0;else if(Q===2&&this._getCredentials().password!==void 0)return!0;return!1};return new Promise((V,J)=>{if($())V();else this._checkCredentials=()=>{if($())V(),this._checkCredentials=null,this._credentialsReject=null},this._credentialsReject=J})}checkInternalEvents(){if(this._checkSock!==null)this._checkSock();if(this._checkCredentials!==null)this._checkCredentials()}approveServer(){if(this._approveServerResolve!==null)this._approveServerResolve(),this._approveServerResolve=null}disconnect(){if(this._sockReject!==null)this._sockReject(Error("disconnect normally")),this._sockReject=null;if(this._credentialsReject!==null)this._credentialsReject(Error("disconnect normally")),this._credentialsReject=null;if(this._approveServerReject!==null)this._approveServerReject(Error("disconnect normally")),this._approveServerReject=null}async negotiateRA2neAuthAsync(){this._hasStarted=!0,await this._waitSockAsync(4);let Q=this._sock.rQpeekBytes(4),$=this._sock.rQshift32();if($<1024)throw Error("RA2: server public key is too short: "+$);else if($>8192)throw Error("RA2: server public key is too long: "+$);let V=Math.ceil($/8);await this._waitSockAsync(V*2);let J=this._sock.rQshiftBytes(V),W=this._sock.rQshiftBytes(V),G=await n.importKey("raw",{n:J,e:W},{name:"RSA-PKCS1-v1_5"},!1,["encrypt"]),q=new Uint8Array(4+V*2);q.set(Q),q.set(J,4),q.set(W,4+V);let U=this._waitApproveKeyAsync();this.dispatchEvent(new CustomEvent("serververification",{detail:{type:"RSA",publickey:q}})),await U;let Z=2048,Y=Math.ceil(Z/8),X=(await n.generateKey({name:"RSA-PKCS1-v1_5",modulusLength:Z,publicExponent:new Uint8Array([1,0,1])},!0,["encrypt"])).privateKey,I=await n.exportKey("raw",X),j=I.n,P=I.e,O=new Uint8Array(4+Y*2);O[0]=(Z&4278190080)>>>24,O[1]=(Z&16711680)>>>16,O[2]=(Z&65280)>>>8,O[3]=Z&255,O.set(j,4),O.set(P,4+Y),this._sock.sQpushBytes(O),this._sock.flush();let k=new Uint8Array(16);window.crypto.getRandomValues(k);let E=await n.encrypt({name:"RSA-PKCS1-v1_5"},G,k),D=new Uint8Array(2+V);if(D[0]=(V&65280)>>>8,D[1]=V&255,D.set(E,2),this._sock.sQpushBytes(D),this._sock.flush(),await this._waitSockAsync(2),this._sock.rQshift16()!==Y)throw Error("RA2: wrong encrypted message length");let S=this._sock.rQshiftBytes(Y),R=await n.decrypt({name:"RSA-PKCS1-v1_5"},X,S);if(R===null||R.length!==16)throw Error("RA2: corrupted server encrypted random");let A=new Uint8Array(32),v=new Uint8Array(32);A.set(R),A.set(k,16),v.set(k),v.set(R,16),A=await window.crypto.subtle.digest("SHA-1",A),A=new Uint8Array(A).slice(0,16),v=await window.crypto.subtle.digest("SHA-1",v),v=new Uint8Array(v).slice(0,16);let b=new c6;await b.setKey(A);let K=new c6;await K.setKey(v);let x=new Uint8Array(8+V*2+Y*2),f=new Uint8Array(8+V*2+Y*2);if(x.set(q),x.set(O,4+V*2),f.set(O),f.set(q,4+Y*2),x=await window.crypto.subtle.digest("SHA-1",x),f=await window.crypto.subtle.digest("SHA-1",f),x=new Uint8Array(x),f=new Uint8Array(f),this._sock.sQpushBytes(await b.makeMessage(f)),this._sock.flush(),await this._waitSockAsync(38),this._sock.rQshift16()!==20)throw Error("RA2: wrong server hash");let g=await K.receiveMessage(20,this._sock.rQshiftBytes(36));if(g===null)throw Error("RA2: failed to authenticate the message");for(let o=0;o<20;o++)if(g[o]!==x[o])throw Error("RA2: wrong server hash");if(await this._waitSockAsync(19),this._sock.rQshift16()!==1)throw Error("RA2: wrong subtype");let m=await K.receiveMessage(1,this._sock.rQshiftBytes(17));if(m===null)throw Error("RA2: failed to authenticate the message");m=m[0];let P1=this._waitCredentialsAsync(m);if(m===1){if(this._getCredentials().username===void 0||this._getCredentials().password===void 0)this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}}))}else if(m===2){if(this._getCredentials().password===void 0)this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["password"]}}))}else throw Error("RA2: wrong subtype");await P1;let J1;if(m===1)J1=q1(this._getCredentials().username).slice(0,255);else J1="";let D1=q1(this._getCredentials().password).slice(0,255),C1=new Uint8Array(J1.length+D1.length+2);C1[0]=J1.length,C1[J1.length+1]=D1.length;for(let o=0;o<J1.length;o++)C1[o+1]=J1.charCodeAt(o);for(let o=0;o<D1.length;o++)C1[J1.length+2+o]=D1.charCodeAt(o);this._sock.sQpushBytes(await b.makeMessage(C1)),this._sock.flush()}get hasStarted(){return this._hasStarted}set hasStarted(Q){this._hasStarted=Q}}class o0{constructor(){this._lines=0}decodeRect(Q,$,V,J,W,G,q){if(V===0||J===0)return!0;if(this._lines===0)this._lines=J;let U=q==8?1:4,Z=V*U;while(this._lines>0){if(W.rQwait("RAW",Z))return!1;let Y=$+(J-this._lines),X=W.rQshiftBytes(Z,!1);if(q==8){let I=new Uint8Array(V*4);for(let j=0;j<V;j++)I[j*4+0]=(X[j]>>0&3)*255/3,I[j*4+1]=(X[j]>>2&3)*255/3,I[j*4+2]=(X[j]>>4&3)*255/3,I[j*4+3]=255;X=I}for(let I=0;I<V;I++)X[I*4+3]=255;G.blitImage(Q,Y,V,1,X,0),this._lines--}return!0}}class d0{decodeRect(Q,$,V,J,W,G,q){if(W.rQwait("COPYRECT",4))return!1;let U=W.rQshift16(),Z=W.rQshift16();if(V===0||J===0)return!0;return G.copyImage(U,Z,Q,$,V,J),!0}}class a0{constructor(){this._subrects=0}decodeRect(Q,$,V,J,W,G,q){if(this._subrects===0){if(W.rQwait("RRE",8))return!1;this._subrects=W.rQshift32();let U=W.rQshiftBytes(4);G.fillRect(Q,$,V,J,U)}while(this._subrects>0){if(W.rQwait("RRE",12))return!1;let U=W.rQshiftBytes(4),Z=W.rQshift16(),Y=W.rQshift16(),X=W.rQshift16(),I=W.rQshift16();G.fillRect(Q+Z,$+Y,X,I,U),this._subrects--}return!0}}class t0{constructor(){this._tiles=0,this._lastsubencoding=0,this._tileBuffer=new Uint8Array(1024)}decodeRect(Q,$,V,J,W,G,q){if(this._tiles===0)this._tilesX=Math.ceil(V/16),this._tilesY=Math.ceil(J/16),this._totalTiles=this._tilesX*this._tilesY,this._tiles=this._totalTiles;while(this._tiles>0){let U=1;if(W.rQwait("HEXTILE",U))return!1;let Z=W.rQpeek8();if(Z>30)throw Error("Illegal hextile subencoding (subencoding: "+Z+")");let Y=this._totalTiles-this._tiles,X=Y%this._tilesX,I=Math.floor(Y/this._tilesX),j=Q+X*16,P=$+I*16,O=Math.min(16,Q+V-j),k=Math.min(16,$+J-P);if(Z&1)U+=O*k*4;else{if(Z&2)U+=4;if(Z&4)U+=4;if(Z&8){if(U++,W.rQwait("HEXTILE",U))return!1;let E=W.rQpeekBytes(U).at(-1);if(Z&16)U+=E*6;else U+=E*2}}if(W.rQwait("HEXTILE",U))return!1;if(W.rQshift8(),Z===0)if(this._lastsubencoding&1)w(" Ignoring blank after RAW");else G.fillRect(j,P,O,k,this._background);else if(Z&1){let E=O*k,D=W.rQshiftBytes(E*4,!1);for(let S=0;S<E;S++)D[S*4+3]=255;G.blitImage(j,P,O,k,D,0)}else{if(Z&2)this._background=new Uint8Array(W.rQshiftBytes(4));if(Z&4)this._foreground=new Uint8Array(W.rQshiftBytes(4));if(this._startTile(j,P,O,k,this._background),Z&8){let E=W.rQshift8();for(let D=0;D<E;D++){let S;if(Z&16)S=W.rQshiftBytes(4);else S=this._foreground;let R=W.rQshift8(),A=R>>4,v=R&15,b=W.rQshift8(),K=(b>>4)+1,x=(b&15)+1;this._subTile(A,v,K,x,S)}}this._finishTile(G)}this._lastsubencoding=Z,this._tiles--}return!0}_startTile(Q,$,V,J,W){this._tileX=Q,this._tileY=$,this._tileW=V,this._tileH=J;let G=W[0],q=W[1],U=W[2],Z=this._tileBuffer;for(let Y=0;Y<V*J*4;Y+=4)Z[Y]=G,Z[Y+1]=q,Z[Y+2]=U,Z[Y+3]=255}_subTile(Q,$,V,J,W){let G=W[0],q=W[1],U=W[2],Z=Q+V,Y=$+J,X=this._tileBuffer,I=this._tileW;for(let j=$;j<Y;j++)for(let P=Q;P<Z;P++){let O=(P+j*I)*4;X[O]=G,X[O+1]=q,X[O+2]=U,X[O+3]=255}}_finishTile(Q){Q.blitImage(this._tileX,this._tileY,this._tileW,this._tileH,this._tileBuffer,0)}}class s0{constructor(){this._zlib=new Y1,this._length=0}decodeRect(Q,$,V,J,W,G,q){if(V===0||J===0)return!0;if(this._length===0){if(W.rQwait("ZLIB",4))return!1;this._length=W.rQshift32()}if(W.rQwait("ZLIB",this._length))return!1;let U=new Uint8Array(W.rQshiftBytes(this._length,!1));this._length=0,this._zlib.setInput(U),U=this._zlib.inflate(V*J*4),this._zlib.setInput(null);for(let Z=0;Z<V*J;Z++)U[Z*4+3]=255;return G.blitImage(Q,$,V,J,U,0),!0}}class e1{constructor(){this._ctl=null,this._filter=null,this._numColors=0,this._palette=new Uint8Array(1024),this._len=0,this._zlibs=[];for(let Q=0;Q<4;Q++)this._zlibs[Q]=new Y1}decodeRect(Q,$,V,J,W,G,q){if(this._ctl===null){if(W.rQwait("TIGHT compression-control",1))return!1;this._ctl=W.rQshift8();for(let Z=0;Z<4;Z++)if(this._ctl>>Z&1)this._zlibs[Z].reset(),r("Reset zlib stream "+Z);this._ctl=this._ctl>>4}let U;if(this._ctl===8)U=this._fillRect(Q,$,V,J,W,G,q);else if(this._ctl===9)U=this._jpegRect(Q,$,V,J,W,G,q);else if(this._ctl===10)U=this._pngRect(Q,$,V,J,W,G,q);else if((this._ctl&8)==0)U=this._basicRect(this._ctl,Q,$,V,J,W,G,q);else throw Error("Illegal tight compression received (ctl: "+this._ctl+")");if(U)this._ctl=null;return U}_fillRect(Q,$,V,J,W,G,q){if(W.rQwait("TIGHT",3))return!1;let U=W.rQshiftBytes(3);return G.fillRect(Q,$,V,J,U,!1),!0}_jpegRect(Q,$,V,J,W,G,q){let U=this._readData(W);if(U===null)return!1;return G.imageRect(Q,$,V,J,"image/jpeg",U),!0}_pngRect(Q,$,V,J,W,G,q){throw Error("PNG received in standard Tight rect")}_basicRect(Q,$,V,J,W,G,q,U){if(this._filter===null)if(Q&4){if(G.rQwait("TIGHT",1))return!1;this._filter=G.rQshift8()}else this._filter=0;let Z=Q&3,Y;switch(this._filter){case 0:Y=this._copyFilter(Z,$,V,J,W,G,q,U);break;case 1:Y=this._paletteFilter(Z,$,V,J,W,G,q,U);break;case 2:Y=this._gradientFilter(Z,$,V,J,W,G,q,U);break;default:throw Error("Illegal tight filter received (ctl: "+this._filter+")")}if(Y)this._filter=null;return Y}_copyFilter(Q,$,V,J,W,G,q,U){let Z=J*W*3,Y;if(Z===0)return!0;if(Z<12){if(G.rQwait("TIGHT",Z))return!1;Y=G.rQshiftBytes(Z)}else{if(Y=this._readData(G),Y===null)return!1;this._zlibs[Q].setInput(Y),Y=this._zlibs[Q].inflate(Z),this._zlibs[Q].setInput(null)}let X=new Uint8Array(J*W*4);for(let I=0,j=0;I<J*W*4;I+=4,j+=3)X[I]=Y[j],X[I+1]=Y[j+1],X[I+2]=Y[j+2],X[I+3]=255;return q.blitImage($,V,J,W,X,0,!1),!0}_paletteFilter(Q,$,V,J,W,G,q,U){if(this._numColors===0){if(G.rQwait("TIGHT palette",1))return!1;let j=G.rQpeek8()+1,P=j*3;if(G.rQwait("TIGHT palette",1+P))return!1;this._numColors=j,G.rQskipBytes(1),G.rQshiftTo(this._palette,P)}let Z=this._numColors<=2?1:8,X=Math.floor((J*Z+7)/8)*W,I;if(X===0)return!0;if(X<12){if(G.rQwait("TIGHT",X))return!1;I=G.rQshiftBytes(X)}else{if(I=this._readData(G),I===null)return!1;this._zlibs[Q].setInput(I),I=this._zlibs[Q].inflate(X),this._zlibs[Q].setInput(null)}if(this._numColors==2)this._monoRect($,V,J,W,I,this._palette,q);else this._paletteRect($,V,J,W,I,this._palette,q);return this._numColors=0,!0}_monoRect(Q,$,V,J,W,G,q){let U=this._getScratchBuffer(V*J*4),Z=Math.floor((V+7)/8),Y=Math.floor(V/8);for(let X=0;X<J;X++){let I,j,P;for(P=0;P<Y;P++)for(let O=7;O>=0;O--)I=(X*V+P*8+7-O)*4,j=(W[X*Z+P]>>O&1)*3,U[I]=G[j],U[I+1]=G[j+1],U[I+2]=G[j+2],U[I+3]=255;for(let O=7;O>=8-V%8;O--)I=(X*V+P*8+7-O)*4,j=(W[X*Z+P]>>O&1)*3,U[I]=G[j],U[I+1]=G[j+1],U[I+2]=G[j+2],U[I+3]=255}q.blitImage(Q,$,V,J,U,0,!1)}_paletteRect(Q,$,V,J,W,G,q){let U=this._getScratchBuffer(V*J*4),Z=V*J*4;for(let Y=0,X=0;Y<Z;Y+=4,X++){let I=W[X]*3;U[Y]=G[I],U[Y+1]=G[I+1],U[Y+2]=G[I+2],U[Y+3]=255}q.blitImage(Q,$,V,J,U,0,!1)}_gradientFilter(Q,$,V,J,W,G,q,U){let Z=J*W*3,Y;if(Z===0)return!0;if(Z<12){if(G.rQwait("TIGHT",Z))return!1;Y=G.rQshiftBytes(Z)}else{if(Y=this._readData(G),Y===null)return!1;this._zlibs[Q].setInput(Y),Y=this._zlibs[Q].inflate(Z),this._zlibs[Q].setInput(null)}let X=new Uint8Array(4*J*W),I=0,j=0,P=new Uint8Array(3);for(let D=0;D<J;D++){for(let S=0;S<3;S++){let R=P[S],A=Y[j++]+R;X[I++]=A,P[S]=A}X[I++]=255}let O=0,k=new Uint8Array(3),E=new Uint8Array(3);for(let D=1;D<W;D++){P.fill(0),E.fill(0);for(let S=0;S<J;S++){for(let R=0;R<3;R++){k[R]=X[O++];let A=P[R]+k[R]-E[R];if(A<0)A=0;else if(A>255)A=255;let v=Y[j++]+A;X[I++]=v,E[R]=k[R],P[R]=v}X[I++]=255,O++}}return q.blitImage($,V,J,W,X,0,!1),!0}_readData(Q){if(this._len===0){if(Q.rQwait("TIGHT",3))return null;let V;if(V=Q.rQshift8(),this._len=V&127,V&128){if(V=Q.rQshift8(),this._len|=(V&127)<<7,V&128)V=Q.rQshift8(),this._len|=V<<14}}if(Q.rQwait("TIGHT",this._len))return null;let $=Q.rQshiftBytes(this._len,!1);return this._len=0,$}_getScratchBuffer(Q){if(!this._scratchBuffer||this._scratchBuffer.length<Q)this._scratchBuffer=new Uint8Array(Q);return this._scratchBuffer}}class e0 extends e1{_pngRect(Q,$,V,J,W,G,q){let U=this._readData(W);if(U===null)return!1;return G.imageRect(Q,$,V,J,"image/png",U),!0}_basicRect(Q,$,V,J,W,G,q,U){throw Error("BasicCompression received in TightPNG rect")}}var Q6=64,V6=64;class $6{constructor(){this._length=0,this._inflator=new Y1,this._pixelBuffer=new Uint8Array(Q6*V6*4),this._tileBuffer=new Uint8Array(Q6*V6*4)}decodeRect(Q,$,V,J,W,G,q){if(this._length===0){if(W.rQwait("ZLib data length",4))return!1;this._length=W.rQshift32()}if(W.rQwait("Zlib data",this._length))return!1;let U=W.rQshiftBytes(this._length,!1);this._inflator.setInput(U);for(let Z=$;Z<$+J;Z+=V6){let Y=Math.min(V6,$+J-Z);for(let X=Q;X<Q+V;X+=Q6){let I=Math.min(Q6,Q+V-X),j=I*Y,P=this._inflator.inflate(1)[0];if(P===0){let O=this._readPixels(j);G.blitImage(X,Z,I,Y,O,0,!1)}else if(P===1){let O=this._readPixels(1);G.fillRect(X,Z,I,Y,[O[0],O[1],O[2]])}else if(P>=2&&P<=16){let O=this._decodePaletteTile(P,j,I,Y);G.blitImage(X,Z,I,Y,O,0,!1)}else if(P===128){let O=this._decodeRLETile(j);G.blitImage(X,Z,I,Y,O,0,!1)}else if(P>=130&&P<=255){let O=this._decodeRLEPaletteTile(P-128,j);G.blitImage(X,Z,I,Y,O,0,!1)}else throw Error("Unknown subencoding: "+P)}}return this._length=0,!0}_getBitsPerPixelInPalette(Q){if(Q<=2)return 1;else if(Q<=4)return 2;else if(Q<=16)return 4}_readPixels(Q){let $=this._pixelBuffer,V=this._inflator.inflate(3*Q);for(let J=0,W=0;J<Q*4;J+=4,W+=3)$[J]=V[W],$[J+1]=V[W+1],$[J+2]=V[W+2],$[J+3]=255;return $}_decodePaletteTile(Q,$,V,J){let W=this._tileBuffer,G=this._readPixels(Q),q=this._getBitsPerPixelInPalette(Q),U=(1<<q)-1,Z=0,Y=this._inflator.inflate(1)[0];for(let X=0;X<J;X++){let I=8-q;for(let j=0;j<V;j++){if(I<0)I=8-q,Y=this._inflator.inflate(1)[0];let P=Y>>I&U;W[Z]=G[P*4],W[Z+1]=G[P*4+1],W[Z+2]=G[P*4+2],W[Z+3]=G[P*4+3],Z+=4,I-=q}if(I<8-q&&X<J-1)Y=this._inflator.inflate(1)[0]}return W}_decodeRLETile(Q){let $=this._tileBuffer,V=0;while(V<Q){let J=this._readPixels(1),W=this._readRLELength();for(let G=0;G<W;G++)$[V*4]=J[0],$[V*4+1]=J[1],$[V*4+2]=J[2],$[V*4+3]=J[3],V++}return $}_decodeRLEPaletteTile(Q,$){let V=this._tileBuffer,J=this._readPixels(Q),W=0;while(W<$){let G=this._inflator.inflate(1)[0],q=1;if(G>=128)G-=128,q=this._readRLELength();if(G>Q)throw Error("Too big index in palette: "+G+", palette size: "+Q);if(W+q>$)throw Error("Too big rle length in palette mode: "+q+", allowed length is: "+($-W));for(let U=0;U<q;U++)V[W*4]=J[G*4],V[W*4+1]=J[G*4+1],V[W*4+2]=J[G*4+2],V[W*4+3]=J[G*4+3],W++}return V}_readRLELength(){let Q=0,$=0;do $=this._inflator.inflate(1)[0],Q+=$;while($===255);return Q+1}}class J6{constructor(){this._cachedQuantTables=[],this._cachedHuffmanTables=[],this._segments=[]}decodeRect(Q,$,V,J,W,G,q){while(!0){let j=this._readSegment(W);if(j===null)return!1;if(this._segments.push(j),j[1]===217)break}let U=[],Z=[];for(let j of this._segments){let P=j[1];if(P===196)U.push(j);else if(P===219)Z.push(j)}let Y=this._segments.findIndex((j)=>j[1]==192||j[1]==194);if(Y==-1)throw Error("Illegal JPEG image without SOF");if(Z.length===0)this._segments.splice(Y+1,0,...this._cachedQuantTables);if(U.length===0)this._segments.splice(Y+1,0,...this._cachedHuffmanTables);let X=0;for(let j of this._segments)X+=j.length;let I=new Uint8Array(X);X=0;for(let j of this._segments)I.set(j,X),X+=j.length;if(G.imageRect(Q,$,V,J,"image/jpeg",I),U.length!==0)this._cachedHuffmanTables=U;if(Z.length!==0)this._cachedQuantTables=Z;return this._segments=[],!0}_readSegment(Q){if(Q.rQwait("JPEG",2))return null;let $=Q.rQshift8();if($!=255)throw Error("Illegal JPEG marker received (byte: "+$+")");let V=Q.rQshift8();if(V>=208&&V<=217||V==1)return new Uint8Array([$,V]);if(Q.rQwait("JPEG",2,2))return null;let J=Q.rQshift16();if(J<2)throw Error("Illegal JPEG length received (length: "+J+")");if(Q.rQwait("JPEG",J-2,4))return null;let W=0;if(V===218){W+=2;while(!0){if(Q.rQwait("JPEG",J-2+W,4))return null;let q=Q.rQpeekBytes(J-2+W,!1);if(q.at(-2)===255&&q.at(-1)!==0&&!(q.at(-1)>=208&&q.at(-1)<=215)){W-=2;break}W++}}let G=new Uint8Array(2+J+W);return G[0]=$,G[1]=V,G[2]=J>>8,G[3]=J,G.set(Q.rQshiftBytes(J-2+W,!1),4),G}}class g8{constructor(Q){this._data=Q,this._index=0,this.profileIdc=null,this.constraintSet=null,this.levelIdc=null}_getStartSequenceLen(Q){let $=this._data;if($[Q+0]==0&&$[Q+1]==0&&$[Q+2]==0&&$[Q+3]==1)return 4;if($[Q+0]==0&&$[Q+1]==0&&$[Q+2]==1)return 3;return 0}_indexOfNextNalUnit(Q){let $=this._data;for(let V=Q;V<$.length;++V)if(this._getStartSequenceLen(V)!=0)return V;return-1}_parseSps(Q){this.profileIdc=this._data[Q],this.constraintSet=this._data[Q+1],this.levelIdc=this._data[Q+2]}_parseNalUnit(Q){let $=this._data[Q];if($&128)throw Error("H264 parsing sanity check failed, forbidden zero bit is set");let V=$&31;switch(V){case 1:return{slice:!0};case 5:return{slice:!0,key:!0};case 6:return{};case 7:return this._parseSps(Q+1),{};case 8:return{};default:l("Unhandled unit type: ",V);break}return{}}parse(){let Q=this._index,$=!1;while(this._index<this._data.length){let V=this._getStartSequenceLen(this._index);if(V==0)throw Error("Invalid start sequence in bit stream");let{slice:J,key:W}=this._parseNalUnit(this._index+V),G=this._indexOfNextNalUnit(this._index+V);if(G==-1)this._index=this._data.length;else this._index=G;if(W)$=!0;if(J)break}if(Q===this._index)return null;return{frame:this._data.subarray(Q,this._index),key:$}}}class k8{constructor(Q,$){this.lastUsed=0,this._width=Q,this._height=$,this._profileIdc=null,this._constraintSet=null,this._levelIdc=null,this._decoder=null,this._pendingFrames=[]}_handleFrame(Q){let $=this._pendingFrames.shift();if($===void 0)throw Error("Pending frame queue empty when receiving frame from decoder");if($.timestamp!=Q.timestamp)throw Error("Video frame timestamp mismatch. Expected "+Q.timestamp+" but but got "+$.timestamp);if($.frame=Q,$.ready=!0,$.resolve(),!$.keep)Q.close()}_handleError(Q){throw Error("Failed to decode frame: "+Q.message)}_configureDecoder(Q,$,V){if(this._decoder===null||this._decoder.state==="closed")this._decoder=new VideoDecoder({output:(W)=>this._handleFrame(W),error:(W)=>this._handleError(W)});let J="avc1."+Q.toString(16).padStart(2,"0")+$.toString(16).padStart(2,"0")+V.toString(16).padStart(2,"0");this._decoder.configure({codec:J,codedWidth:this._width,codedHeight:this._height,optimizeForLatency:!0})}_preparePendingFrame(Q){let $={timestamp:Q,promise:null,resolve:null,frame:null,ready:!1,keep:!1};return $.promise=new Promise((V)=>{$.resolve=V}),this._pendingFrames.push($),$}decode(Q){let $=new g8(Q),V=null,J=Math.round(window.performance.now()*1000);while(!0){let W=$.parse();if(W===null)break;if($.profileIdc!==null)self._profileIdc=$.profileIdc,self._constraintSet=$.constraintSet,self._levelIdc=$.levelIdc;if(this._decoder===null||this._decoder.state!=="configured"){if(!W.key){l("Missing key frame. Can't decode until one arrives");continue}if(self._profileIdc===null){l("Cannot config decoder. Have not received SPS and PPS yet.");continue}this._configureDecoder(self._profileIdc,self._constraintSet,self._levelIdc)}V=this._preparePendingFrame(J);let G=new EncodedVideoChunk({timestamp:J,type:W.key?"key":"delta",data:W.frame});try{this._decoder.decode(G)}catch(q){l("Failed to decode:",q)}}if(V!==null)V.keep=!0;return V}}class W6{constructor(){this._tick=0,this._contexts={}}_contextId(Q,$,V,J){return[Q,$,V,J].join(",")}_findOldestContextId(){let Q=Number.MAX_VALUE,$=void 0;for(let[V,J]of Object.entries(this._contexts))if(J.lastUsed<Q)Q=J.lastUsed,$=V;return $}_createContext(Q,$,V,J){if(Object.keys(this._contexts).length>=64){let q=this._findOldestContextId();delete this._contexts[q]}let G=new k8(V,J);return this._contexts[this._contextId(Q,$,V,J)]=G,G}_getContext(Q,$,V,J){let W=this._contexts[this._contextId(Q,$,V,J)];return W!==void 0?W:this._createContext(Q,$,V,J)}_resetContext(Q,$,V,J){delete this._contexts[this._contextId(Q,$,V,J)]}_resetAllContexts(){this._contexts={}}decodeRect(Q,$,V,J,W,G,q){if(W.rQwait("h264 header",8))return!1;let Y=W.rQshift32(),X=W.rQshift32();if(W.rQwait("h264 payload",Y,8))return!1;if(X&2)this._resetAllContexts();else if(X&1)this._resetContext(Q,$,V,J);let I=this._getContext(Q,$,V,J);if(I.lastUsed=this._tick++,Y!==0){let j=W.rQshiftBytes(Y,!1),P=I.decode(j);if(P!==null)G.videoFrame(Q,$,V,J,P)}return!0}}var F4=3,C4="rgb(40, 40, 40)",x8=17,f8=50,u8=19,F0=75,A1=50,I4=1000,B4=50,_8=1,G6=2,y8=6,h8=16,n6=19,p8=22,m8=30,b8=113,c8=129,n8=256,z1=1;var i8=16777216,q6=33554432,r8=67108864,C0=134217728,U6=268435456;class u extends h1{constructor(Q,$,V){if(!Q)throw Error("Must specify target");if(!$)throw Error("Must specify URL, WebSocket or RTCDataChannel");if(!window.isSecureContext)p("noVNC requires a secure context (TLS). Expect crashes!");super();if(this._target=Q,typeof $==="string")this._url=$;else this._url=null,this._rawChannel=$;V=V||{},this._rfbCredentials=V.credentials||{},this._shared="shared"in V?!!V.shared:!0,this._repeaterID=V.repeaterID||"",this._wsProtocols=V.wsProtocols||[],this._rfbConnectionState="",this._rfbInitState="",this._rfbAuthScheme=-1,this._rfbCleanDisconnect=!0,this._rfbRSAAESAuthenticationState=null,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._pendingRemoteResize=!1,this._lastResize=0,this._qemuExtKeyEventSupported=!1,this._extendedPointerEventSupported=!1,this._clipboardText=null,this._clipboardServerCapabilitiesActions={},this._clipboardServerCapabilitiesFormats={},this._sock=null,this._display=null,this._flushing=!1,this._keyboard=null,this._gestures=null,this._resizeObserver=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),handleResize:this._handleResize.bind(this),handleMouse:this._handleMouse.bind(this),handleWheel:this._handleWheel.bind(this),handleGesture:this._handleGesture.bind(this),handleRSAAESCredentialsRequired:this._handleRSAAESCredentialsRequired.bind(this),handleRSAAESServerVerification:this._handleRSAAESServerVerification.bind(this)},w(">> 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=C4,this._canvas=document.createElement("canvas"),this._canvas.style.margin="auto",this._canvas.style.outline="none",this._canvas.width=0,this._canvas.height=0,this._canvas.tabIndex=-1,this._screen.appendChild(this._canvas),this._cursor=new _0,this._cursorImage=u.cursors.none,this._decoders[T.encodingRaw]=new o0,this._decoders[T.encodingCopyRect]=new d0,this._decoders[T.encodingRRE]=new a0,this._decoders[T.encodingHextile]=new t0,this._decoders[T.encodingZlib]=new s0,this._decoders[T.encodingTight]=new e1,this._decoders[T.encodingTightPNG]=new e0,this._decoders[T.encodingZRLE]=new $6,this._decoders[T.encodingJPEG]=new J6,this._decoders[T.encodingH264]=new W6;try{this._display=new N0(this._canvas)}catch(J){throw p("Display exception: "+J),J}if(this._keyboard=new f0(this._canvas),this._keyboard.onkeyevent=this._handleKeyEvent.bind(this),this._remoteCapsLock=null,this._remoteNumLock=null,this._gestures=new u0,this._sock=new p0,this._sock.on("open",this._socketOpen.bind(this)),this._sock.on("close",this._socketClose.bind(this)),this._sock.on("message",this._handleMessage.bind(this)),this._sock.on("error",this._socketError.bind(this)),this._expectedClientWidth=null,this._expectedClientHeight=null,this._resizeObserver=new ResizeObserver(this._eventHandlers.handleResize),this._updateConnectionState("connecting"),w("<< RFB.constructor"),this.dragViewport=!1,this.focusOnClick=!0,this._viewOnly=!1,this._clipViewport=!1,this._clippingViewport=!1,this._scaleViewport=!1,this._resizeSession=!1,this._showDotCursor=!1,V.showDotCursor!==void 0)l("Specifying showDotCursor as a RFB constructor argument is deprecated"),this._showDotCursor=V.showDotCursor;this._qualityLevel=6,this._compressionLevel=2}get viewOnly(){return this._viewOnly}set viewOnly(Q){if(this._viewOnly=Q,this._rfbConnectionState==="connecting"||this._rfbConnectionState==="connected")if(Q)this._keyboard.ungrab();else this._keyboard.grab()}get capabilities(){return this._capabilities}get clippingViewport(){return this._clippingViewport}_setClippingViewport(Q){if(Q===this._clippingViewport)return;this._clippingViewport=Q,this.dispatchEvent(new CustomEvent("clippingviewport",{detail:this._clippingViewport}))}get touchButton(){return 0}set touchButton(Q){l("Using old API!")}get clipViewport(){return this._clipViewport}set clipViewport(Q){this._clipViewport=Q,this._updateClip()}get scaleViewport(){return this._scaleViewport}set scaleViewport(Q){if(this._scaleViewport=Q,Q&&this._clipViewport)this._updateClip();if(this._updateScale(),!Q&&this._clipViewport)this._updateClip()}get resizeSession(){return this._resizeSession}set resizeSession(Q){if(this._resizeSession=Q,Q)this._requestRemoteResize()}get showDotCursor(){return this._showDotCursor}set showDotCursor(Q){this._showDotCursor=Q,this._refreshCursor()}get background(){return this._screen.style.background}set background(Q){this._screen.style.background=Q}get qualityLevel(){return this._qualityLevel}set qualityLevel(Q){if(!Number.isInteger(Q)||Q<0||Q>9){p("qualityLevel must be an integer between 0 and 9");return}if(this._qualityLevel===Q)return;if(this._qualityLevel=Q,this._rfbConnectionState==="connected")this._sendEncodings()}get compressionLevel(){return this._compressionLevel}set compressionLevel(Q){if(!Number.isInteger(Q)||Q<0||Q>9){p("compressionLevel must be an integer between 0 and 9");return}if(this._compressionLevel===Q)return;if(this._compressionLevel=Q,this._rfbConnectionState==="connected")this._sendEncodings()}disconnect(){if(this._updateConnectionState("disconnecting"),this._sock.off("error"),this._sock.off("message"),this._sock.off("open"),this._rfbRSAAESAuthenticationState!==null)this._rfbRSAAESAuthenticationState.disconnect()}approveServer(){if(this._rfbRSAAESAuthenticationState!==null)this._rfbRSAAESAuthenticationState.approveServer()}sendCredentials(Q){this._rfbCredentials=Q,this._resumeAuthentication()}sendCtrlAltDel(){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;r("Sending Ctrl-Alt-Del"),this.sendKey(z.XK_Control_L,"ControlLeft",!0),this.sendKey(z.XK_Alt_L,"AltLeft",!0),this.sendKey(z.XK_Delete,"Delete",!0),this.sendKey(z.XK_Delete,"Delete",!1),this.sendKey(z.XK_Alt_L,"AltLeft",!1),this.sendKey(z.XK_Control_L,"ControlLeft",!1)}machineShutdown(){this._xvpOp(1,2)}machineReboot(){this._xvpOp(1,3)}machineReset(){this._xvpOp(1,4)}sendKey(Q,$,V){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;if(V===void 0){this.sendKey(Q,$,!0),this.sendKey(Q,$,!1);return}let J=B8[$];if(this._qemuExtKeyEventSupported&&J)Q=Q||0,r("Sending key ("+(V?"down":"up")+"): keysym "+Q+", scancode "+J),u.messages.QEMUExtendedKeyEvent(this._sock,Q,V,J);else{if(!Q)return;r("Sending keysym ("+(V?"down":"up")+"): "+Q),u.messages.keyEvent(this._sock,Q,V?1:0)}}focus(Q){this._canvas.focus(Q)}blur(){this._canvas.blur()}clipboardPasteFrom(Q){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;if(this._clipboardServerCapabilitiesFormats[z1]&&this._clipboardServerCapabilitiesActions[C0])this._clipboardText=Q,u.messages.extendedClipboardNotify(this._sock,[z1]);else{let $,V,J;$=0;for(let W of Q)$++;J=new Uint8Array($),V=0;for(let W of Q){let G=W.codePointAt(0);if(G>255)G=63;J[V++]=G}u.messages.clientCutText(this._sock,J)}}getImageData(){return this._display.getImageData()}toDataURL(Q,$){return this._display.toDataURL(Q,$)}toBlob(Q,$,V){return this._display.toBlob(Q,$,V)}_connect(){if(w(">> RFB.connect"),this._url)r(`connecting to ${this._url}`),this._sock.open(this._url,this._wsProtocols);else{if(r(`attaching ${this._rawChannel} to Websock`),this._sock.attach(this._rawChannel),this._sock.readyState==="closed")throw Error("Cannot use already closed WebSocket/RTCDataChannel");if(this._sock.readyState==="open")this._socketOpen()}this._target.appendChild(this._screen),this._gestures.attach(this._canvas),this._cursor.attach(this._canvas),this._refreshCursor(),this._resizeObserver.observe(this._screen),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),w("<< RFB.connect")}_disconnect(){w(">> 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),this._resizeObserver.disconnect(),this._keyboard.ungrab(),this._gestures.detach(),this._sock.close();try{this._target.removeChild(this._screen)}catch(Q){if(Q.name==="NotFoundError");else throw Q}clearTimeout(this._resizeTimeout),clearTimeout(this._mouseMoveTimer),w("<< RFB.disconnect")}_socketOpen(){if(this._rfbConnectionState==="connecting"&&this._rfbInitState==="")this._rfbInitState="ProtocolVersion",w("Starting VNC handshake");else this._fail("Unexpected server connection while "+this._rfbConnectionState)}_socketClose(Q){w("WebSocket on-close event");let $="";if(Q.code){if($="(code: "+Q.code,Q.reason)$+=", reason: "+Q.reason;$+=")"}switch(this._rfbConnectionState){case"connecting":this._fail("Connection closed "+$);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 "+$);break;default:this._fail("Unexpected server disconnect before connecting "+$);break}this._sock.off("close"),this._rawChannel=null}_socketError(Q){l("WebSocket on-error event")}_focusCanvas(Q){if(!this.focusOnClick)return;this.focus({preventScroll:!0})}_setDesktopName(Q){this._fbName=Q,this.dispatchEvent(new CustomEvent("desktopname",{detail:{name:this._fbName}}))}_saveExpectedClientSize(){this._expectedClientWidth=this._screen.clientWidth,this._expectedClientHeight=this._screen.clientHeight}_currentClientSize(){return[this._screen.clientWidth,this._screen.clientHeight]}_clientHasExpectedSize(){let[Q,$]=this._currentClientSize();return Q==this._expectedClientWidth&&$==this._expectedClientHeight}_handleResize(){if(this._clientHasExpectedSize())return;window.requestAnimationFrame(()=>{this._updateClip(),this._updateScale(),this._saveExpectedClientSize()}),this._requestRemoteResize()}_updateClip(){let Q=this._display.clipViewport,$=this._clipViewport;if(this._scaleViewport)$=!1;if(Q!==$)this._display.clipViewport=$;if($){let V=this._screenSize();this._display.viewportChangeSize(V.w,V.h),this._fixScrollbars(),this._setClippingViewport(V.w<this._display.width||V.h<this._display.height)}else this._setClippingViewport(!1);if(Q!==$)this._saveExpectedClientSize()}_updateScale(){if(!this._scaleViewport)this._display.scale=1;else{let Q=this._screenSize();this._display.autoscale(Q.w,Q.h)}this._fixScrollbars()}_requestRemoteResize(){if(!this._resizeSession)return;if(this._viewOnly)return;if(!this._supportsSetDesktopSize)return;if(this._pendingRemoteResize)return;if(Date.now()-this._lastResize<100){clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(this._requestRemoteResize.bind(this),100-(Date.now()-this._lastResize));return}this._resizeTimeout=null;let Q=this._screenSize();if(Q.w===this._fbWidth&&Q.h===this._fbHeight)return;this._pendingRemoteResize=!0,this._lastResize=Date.now(),u.messages.setDesktopSize(this._sock,Math.floor(Q.w),Math.floor(Q.h),this._screenID,this._screenFlags),w("Requested new desktop size: "+Q.w+"x"+Q.h)}_screenSize(){let Q=this._screen.getBoundingClientRect();return{w:Q.width,h:Q.height}}_fixScrollbars(){let Q=this._screen.style.overflow;this._screen.style.overflow="hidden",this._screen.getBoundingClientRect(),this._screen.style.overflow=Q}_updateConnectionState(Q){let $=this._rfbConnectionState;if(Q===$){w("Already in state '"+Q+"', ignoring");return}if($==="disconnected"){p("Tried changing state of a disconnected RFB object");return}switch(Q){case"connected":if($!=="connecting"){p("Bad transition to connected state, previous connection state: "+$);return}break;case"disconnected":if($!=="disconnecting"){p("Bad transition to disconnected state, previous connection state: "+$);return}break;case"connecting":if($!==""){p("Bad transition to connecting state, previous connection state: "+$);return}break;case"disconnecting":if($!=="connected"&&$!=="connecting"){p("Bad transition to disconnecting state, previous connection state: "+$);return}break;default:p("Unknown connection state: "+Q);return}if(this._rfbConnectionState=Q,w("New state '"+Q+"', was '"+$+"'."),this._disconnTimer&&Q!=="disconnecting")w("Clearing disconnect timer"),clearTimeout(this._disconnTimer),this._disconnTimer=null,this._sock.off("close");switch(Q){case"connecting":this._connect();break;case"connected":this.dispatchEvent(new CustomEvent("connect",{detail:{}}));break;case"disconnecting":this._disconnect(),this._disconnTimer=setTimeout(()=>{p("Disconnection timed out."),this._updateConnectionState("disconnected")},F4*1000);break;case"disconnected":this.dispatchEvent(new CustomEvent("disconnect",{detail:{clean:this._rfbCleanDisconnect}}));break}}_fail(Q){switch(this._rfbConnectionState){case"disconnecting":p("Failed when disconnecting: "+Q);break;case"connected":p("Failed while connected: "+Q);break;case"connecting":p("Failed when connecting: "+Q);break;default:p("RFB failure: "+Q);break}return this._rfbCleanDisconnect=!1,this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected"),!1}_setCapability(Q,$){this._capabilities[Q]=$,this.dispatchEvent(new CustomEvent("capabilities",{detail:{capabilities:this._capabilities}}))}_handleMessage(){if(this._sock.rQwait("message",1)){l("handleMessage called on an empty receive queue");return}switch(this._rfbConnectionState){case"disconnected":p("Got data while disconnected");break;case"connected":while(!0){if(this._flushing)break;if(!this._normalMsg())break;if(this._sock.rQwait("message",1))break}break;case"connecting":while(this._rfbConnectionState==="connecting")if(!this._initMsg())break;break;default:p("Got data while in an invalid state");break}}_handleKeyEvent(Q,$,V,J,W){if($=="CapsLock"&&V)this._remoteCapsLock=null;if(this._remoteCapsLock!==null&&W!==null&&this._remoteCapsLock!==W&&V)w("Fixing remote caps lock"),this.sendKey(z.XK_Caps_Lock,"CapsLock",!0),this.sendKey(z.XK_Caps_Lock,"CapsLock",!1),this._remoteCapsLock=null;if($=="NumLock"&&V)this._remoteNumLock=null;if(this._remoteNumLock!==null&&J!==null&&this._remoteNumLock!==J&&V)w("Fixing remote num lock"),this.sendKey(z.XK_Num_Lock,"NumLock",!0),this.sendKey(z.XK_Num_Lock,"NumLock",!1),this._remoteNumLock=null;this.sendKey(Q,$,V)}static _convertButtonMask(Q){let $={0:1,1:4,2:2,3:128,4:256},V=0;for(let J=0;J<5;J++)if(Q&1<<J)V|=$[J];return V}_handleMouse(Q){if(Q.type==="click"){if(Q.target!==this._canvas)return}if(Q.stopPropagation(),Q.preventDefault(),Q.type==="click"||Q.type==="contextmenu")return;let $=y1(Q.clientX,Q.clientY,this._canvas),V=u._convertButtonMask(Q.buttons),J=Q.type=="mousedown";switch(Q.type){case"mousedown":case"mouseup":if(this.dragViewport)if(J&&!this._viewportDragging){this._viewportDragging=!0,this._viewportDragPos={x:$.x,y:$.y},this._viewportHasMoved=!1,this._flushMouseMoveTimer($.x,$.y),this._mouseButtonMask=V;break}else{if(this._viewportDragging=!1,this._viewportHasMoved){this._mouseButtonMask=V;break}this._sendMouse($.x,$.y,this._mouseButtonMask)}if(J)e6(this._canvas);this._handleMouseButton($.x,$.y,V);break;case"mousemove":if(this._viewportDragging){let W=this._viewportDragPos.x-$.x,G=this._viewportDragPos.y-$.y;if(this._viewportHasMoved||(Math.abs(W)>V0||Math.abs(G)>V0))this._viewportHasMoved=!0,this._viewportDragPos={x:$.x,y:$.y},this._display.viewportChangePos(W,G);break}this._handleMouseMove($.x,$.y);break}}_handleMouseButton(Q,$,V){this._flushMouseMoveTimer(Q,$),this._mouseButtonMask=V,this._sendMouse(Q,$,this._mouseButtonMask)}_handleMouseMove(Q,$){if(this._mousePos={x:Q,y:$},this._mouseMoveTimer==null){let V=Date.now()-this._mouseLastMoveTime;if(V>x8)this._sendMouse(Q,$,this._mouseButtonMask),this._mouseLastMoveTime=Date.now();else this._mouseMoveTimer=setTimeout(()=>{this._handleDelayedMouseMove()},x8-V)}}_handleDelayedMouseMove(){this._mouseMoveTimer=null,this._sendMouse(this._mousePos.x,this._mousePos.y,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()}_sendMouse(Q,$,V){if(this._rfbConnectionState!=="connected")return;if(this._viewOnly)return;if(V&32768)throw Error("Illegal mouse button mask (mask: "+V+")");let J=V&32640;if(this._extendedPointerEventSupported&&J)u.messages.extendedPointerEvent(this._sock,this._display.absX(Q),this._display.absY($),V);else u.messages.pointerEvent(this._sock,this._display.absX(Q),this._display.absY($),V)}_handleWheel(Q){if(this._rfbConnectionState!=="connected")return;if(this._viewOnly)return;Q.stopPropagation(),Q.preventDefault();let $=y1(Q.clientX,Q.clientY,this._canvas),V=u._convertButtonMask(Q.buttons),J=Q.deltaX,W=Q.deltaY;if(Q.deltaMode!==0)J*=u8,W*=u8;if(this._accumulatedWheelDeltaX+=J,this._accumulatedWheelDeltaY+=W,Math.abs(this._accumulatedWheelDeltaX)>=f8){if(this._accumulatedWheelDeltaX<0)this._handleMouseButton($.x,$.y,V|32),this._handleMouseButton($.x,$.y,V);else if(this._accumulatedWheelDeltaX>0)this._handleMouseButton($.x,$.y,V|64),this._handleMouseButton($.x,$.y,V);this._accumulatedWheelDeltaX=0}if(Math.abs(this._accumulatedWheelDeltaY)>=f8){if(this._accumulatedWheelDeltaY<0)this._handleMouseButton($.x,$.y,V|8),this._handleMouseButton($.x,$.y,V);else if(this._accumulatedWheelDeltaY>0)this._handleMouseButton($.x,$.y,V|16),this._handleMouseButton($.x,$.y,V);this._accumulatedWheelDeltaY=0}}_fakeMouseMove(Q,$,V){this._handleMouseMove($,V),this._cursor.move(Q.detail.clientX,Q.detail.clientY)}_handleTapEvent(Q,$){let V=y1(Q.detail.clientX,Q.detail.clientY,this._canvas);if(this._gestureLastTapTime!==null&&Date.now()-this._gestureLastTapTime<I4&&this._gestureFirstDoubleTapEv.detail.type===Q.detail.type){let J=this._gestureFirstDoubleTapEv.detail.clientX-Q.detail.clientX,W=this._gestureFirstDoubleTapEv.detail.clientY-Q.detail.clientY;if(Math.hypot(J,W)<B4)V=y1(this._gestureFirstDoubleTapEv.detail.clientX,this._gestureFirstDoubleTapEv.detail.clientY,this._canvas);else this._gestureFirstDoubleTapEv=Q}else this._gestureFirstDoubleTapEv=Q;this._gestureLastTapTime=Date.now(),this._fakeMouseMove(this._gestureFirstDoubleTapEv,V.x,V.y),this._handleMouseButton(V.x,V.y,$),this._handleMouseButton(V.x,V.y,0)}_handleGesture(Q){let $,V=y1(Q.detail.clientX,Q.detail.clientY,this._canvas);switch(Q.type){case"gesturestart":switch(Q.detail.type){case"onetap":this._handleTapEvent(Q,1);break;case"twotap":this._handleTapEvent(Q,4);break;case"threetap":this._handleTapEvent(Q,2);break;case"drag":if(this.dragViewport)this._viewportHasMoved=!1,this._viewportDragging=!0,this._viewportDragPos={x:V.x,y:V.y};else this._fakeMouseMove(Q,V.x,V.y),this._handleMouseButton(V.x,V.y,1);break;case"longpress":if(this.dragViewport)this._viewportHasMoved=!1,this._viewportDragPos={x:V.x,y:V.y};else this._fakeMouseMove(Q,V.x,V.y),this._handleMouseButton(V.x,V.y,4);break;case"twodrag":this._gestureLastMagnitudeX=Q.detail.magnitudeX,this._gestureLastMagnitudeY=Q.detail.magnitudeY,this._fakeMouseMove(Q,V.x,V.y);break;case"pinch":this._gestureLastMagnitudeX=Math.hypot(Q.detail.magnitudeX,Q.detail.magnitudeY),this._fakeMouseMove(Q,V.x,V.y);break}break;case"gesturemove":switch(Q.detail.type){case"onetap":case"twotap":case"threetap":break;case"drag":case"longpress":if(this.dragViewport){this._viewportDragging=!0;let J=this._viewportDragPos.x-V.x,W=this._viewportDragPos.y-V.y;if(this._viewportHasMoved||(Math.abs(J)>V0||Math.abs(W)>V0))this._viewportHasMoved=!0,this._viewportDragPos={x:V.x,y:V.y},this._display.viewportChangePos(J,W)}else this._fakeMouseMove(Q,V.x,V.y);break;case"twodrag":this._fakeMouseMove(Q,V.x,V.y);while(Q.detail.magnitudeY-this._gestureLastMagnitudeY>A1)this._handleMouseButton(V.x,V.y,8),this._handleMouseButton(V.x,V.y,0),this._gestureLastMagnitudeY+=A1;while(Q.detail.magnitudeY-this._gestureLastMagnitudeY<-A1)this._handleMouseButton(V.x,V.y,16),this._handleMouseButton(V.x,V.y,0),this._gestureLastMagnitudeY-=A1;while(Q.detail.magnitudeX-this._gestureLastMagnitudeX>A1)this._handleMouseButton(V.x,V.y,32),this._handleMouseButton(V.x,V.y,0),this._gestureLastMagnitudeX+=A1;while(Q.detail.magnitudeX-this._gestureLastMagnitudeX<-A1)this._handleMouseButton(V.x,V.y,64),this._handleMouseButton(V.x,V.y,0),this._gestureLastMagnitudeX-=A1;break;case"pinch":if(this._fakeMouseMove(Q,V.x,V.y),$=Math.hypot(Q.detail.magnitudeX,Q.detail.magnitudeY),Math.abs($-this._gestureLastMagnitudeX)>F0){this._handleKeyEvent(z.XK_Control_L,"ControlLeft",!0);while($-this._gestureLastMagnitudeX>F0)this._handleMouseButton(V.x,V.y,8),this._handleMouseButton(V.x,V.y,0),this._gestureLastMagnitudeX+=F0;while($-this._gestureLastMagnitudeX<-F0)this._handleMouseButton(V.x,V.y,16),this._handleMouseButton(V.x,V.y,0),this._gestureLastMagnitudeX-=F0}this._handleKeyEvent(z.XK_Control_L,"ControlLeft",!1);break}break;case"gestureend":switch(Q.detail.type){case"onetap":case"twotap":case"threetap":case"pinch":case"twodrag":break;case"drag":if(this.dragViewport)this._viewportDragging=!1;else this._fakeMouseMove(Q,V.x,V.y),this._handleMouseButton(V.x,V.y,0);break;case"longpress":if(this._viewportHasMoved)break;if(this.dragViewport&&!this._viewportHasMoved)this._fakeMouseMove(Q,V.x,V.y),this._handleMouseButton(V.x,V.y,4),this._handleMouseButton(V.x,V.y,0),this._viewportDragging=!1;else this._fakeMouseMove(Q,V.x,V.y),this._handleMouseButton(V.x,V.y,0);break}break}}_flushMouseMoveTimer(Q,$){if(this._mouseMoveTimer!==null)clearTimeout(this._mouseMoveTimer),this._mouseMoveTimer=null,this._sendMouse(Q,$,this._mouseButtonMask)}_negotiateProtocolVersion(){if(this._sock.rQwait("version",12))return!1;let Q=this._sock.rQshiftStr(12).substr(4,7);r("Server ProtocolVersion: "+Q);let $=0;switch(Q){case"000.000":$=1;break;case"003.003":case"003.006":this._rfbVersion=3.3;break;case"003.007":this._rfbVersion=3.7;break;case"003.008":case"003.889":case"004.000":case"004.001":case"005.000":this._rfbVersion=3.8;break;default:return this._fail("Invalid server version "+Q)}if($){let J="ID:"+this._repeaterID;while(J.length<250)J+="\x00";return this._sock.sQpushString(J),this._sock.flush(),!0}if(this._rfbVersion>this._rfbMaxVersion)this._rfbVersion=this._rfbMaxVersion;let V="00"+parseInt(this._rfbVersion,10)+".00"+this._rfbVersion*10%10;this._sock.sQpushString("RFB "+V+`
`),this._sock.flush(),w("Sent ProtocolVersion: "+V),this._rfbInitState="Security"}_isSupportedSecurityType(Q){return[_8,G6,y8,h8,n6,p8,m8,b8,n8].includes(Q)}_negotiateSecurity(){if(this._rfbVersion>=3.7){let Q=this._sock.rQshift8();if(this._sock.rQwait("security type",Q,1))return!1;if(Q===0)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,!0;let $=this._sock.rQshiftBytes(Q);w("Server security types: "+$),this._rfbAuthScheme=-1;for(let V of $)if(this._isSupportedSecurityType(V)){this._rfbAuthScheme=V;break}if(this._rfbAuthScheme===-1)return this._fail("Unsupported security types (types: "+$+")");this._sock.sQpush8(this._rfbAuthScheme),this._sock.flush()}else{if(this._sock.rQwait("security scheme",4))return!1;if(this._rfbAuthScheme=this._sock.rQshift32(),this._rfbAuthScheme==0)return this._rfbInitState="SecurityReason",this._securityContext="authentication scheme",this._securityStatus=1,!0}return this._rfbInitState="Authentication",w("Authenticating using scheme: "+this._rfbAuthScheme),!0}_handleSecurityReason(){if(this._sock.rQwait("reason length",4))return!1;let Q=this._sock.rQshift32(),$="";if(Q>0){if(this._sock.rQwait("reason",Q,4))return!1;$=this._sock.rQshiftStr(Q)}if($!=="")return this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:$}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+$+")");else return this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus}})),this._fail("Security negotiation failed on "+this._securityContext)}_negotiateXvpAuth(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0||this._rfbCredentials.target===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password","target"]}})),!1;return this._sock.sQpush8(this._rfbCredentials.username.length),this._sock.sQpush8(this._rfbCredentials.target.length),this._sock.sQpushString(this._rfbCredentials.username),this._sock.sQpushString(this._rfbCredentials.target),this._sock.flush(),this._rfbAuthScheme=G6,this._negotiateAuthentication()}_negotiateVeNCryptAuth(){if(this._rfbVeNCryptState==0){if(this._sock.rQwait("vencrypt version",2))return!1;let Q=this._sock.rQshift8(),$=this._sock.rQshift8();if(!(Q==0&&$==2))return this._fail("Unsupported VeNCrypt version "+Q+"."+$);this._sock.sQpush8(0),this._sock.sQpush8(2),this._sock.flush(),this._rfbVeNCryptState=1}if(this._rfbVeNCryptState==1){if(this._sock.rQwait("vencrypt ack",1))return!1;let Q=this._sock.rQshift8();if(Q!=0)return this._fail("VeNCrypt failure "+Q);this._rfbVeNCryptState=2}if(this._rfbVeNCryptState==2){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;let Q=this._sock.rQshift8();if(Q<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=Q,this._rfbVeNCryptState=3}if(this._rfbVeNCryptState==3){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;let Q=[];for(let $=0;$<this._rfbVeNCryptSubtypesLength;$++)Q.push(this._sock.rQshift32());this._rfbAuthScheme=-1;for(let $ of Q){if($===n6)continue;if(this._isSupportedSecurityType($)){this._rfbAuthScheme=$;break}}if(this._rfbAuthScheme===-1)return this._fail("Unsupported security types (types: "+Q+")");return this._sock.sQpush32(this._rfbAuthScheme),this._sock.flush(),this._rfbVeNCryptState=4,!0}}_negotiatePlainAuth(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;let Q=q1(this._rfbCredentials.username),$=q1(this._rfbCredentials.password);return this._sock.sQpush32(Q.length),this._sock.sQpush32($.length),this._sock.sQpushString(Q),this._sock.sQpushString($),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateStdVNCAuth(){if(this._sock.rQwait("auth challenge",16))return!1;if(this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["password"]}})),!1;let Q=Array.prototype.slice.call(this._sock.rQshiftBytes(16)),$=u.genDES(this._rfbCredentials.password,Q);return this._sock.sQpushBytes($),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateARDAuth(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;if(this._rfbCredentials.ardPublicKey!=null&&this._rfbCredentials.ardCredentials!=null)return this._sock.sQpushBytes(this._rfbCredentials.ardCredentials),this._sock.sQpushBytes(this._rfbCredentials.ardPublicKey),this._sock.flush(),this._rfbCredentials.ardCredentials=null,this._rfbCredentials.ardPublicKey=null,this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("read ard",4))return!1;let Q=this._sock.rQshiftBytes(2),$=this._sock.rQshift16();if(this._sock.rQwait("read ard keylength",$*2,4))return!1;let V=this._sock.rQshiftBytes($),J=this._sock.rQshiftBytes($),W=n.generateKey({name:"DH",g:Q,p:V},!1,["deriveBits"]);return this._negotiateARDAuthAsync($,J,W),!1}async _negotiateARDAuthAsync(Q,$,V){let J=n.exportKey("raw",V.publicKey),W=n.deriveBits({name:"DH",public:$},V.privateKey,Q*8),G=q1(this._rfbCredentials.username).substring(0,63),q=q1(this._rfbCredentials.password).substring(0,63),U=window.crypto.getRandomValues(new Uint8Array(128));for(let I=0;I<G.length;I++)U[I]=G.charCodeAt(I);U[G.length]=0;for(let I=0;I<q.length;I++)U[64+I]=q.charCodeAt(I);U[64+q.length]=0;let Z=await n.digest("MD5",W),Y=await n.importKey("raw",Z,{name:"AES-ECB"},!1,["encrypt"]),X=await n.encrypt({name:"AES-ECB"},Y,U);this._rfbCredentials.ardCredentials=X,this._rfbCredentials.ardPublicKey=J,this._resumeAuthentication()}_negotiateTightUnixAuth(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;return this._sock.sQpush32(this._rfbCredentials.username.length),this._sock.sQpush32(this._rfbCredentials.password.length),this._sock.sQpushString(this._rfbCredentials.username),this._sock.sQpushString(this._rfbCredentials.password),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateTightTunnels(Q){let $={0:{vendor:"TGHT",signature:"NOTUNNEL"}},V={};for(let J=0;J<Q;J++){let W=this._sock.rQshift32(),G=this._sock.rQshiftStr(4),q=this._sock.rQshiftStr(8);V[W]={vendor:G,signature:q}}if(w("Server Tight tunnel types: "+V),V[1]&&V[1].vendor==="SICR"&&V[1].signature==="SCHANNEL")w("Detected Siemens server. Assuming NOTUNNEL support."),V[0]={vendor:"TGHT",signature:"NOTUNNEL"};if(V[0]){if(V[0].vendor!=$[0].vendor||V[0].signature!=$[0].signature)return this._fail("Client's tunnel type had the incorrect vendor or signature");return w("Selected tunnel type: "+$[0]),this._sock.sQpush32(0),this._sock.flush(),!1}else return this._fail("Server wanted tunnels, but doesn't support the notunnel type")}_negotiateTightAuth(){if(!this._rfbTightVNC){if(this._sock.rQwait("num tunnels",4))return!1;let J=this._sock.rQshift32();if(J>0&&this._sock.rQwait("tunnel capabilities",16*J,4))return!1;if(this._rfbTightVNC=!0,J>0)return this._negotiateTightTunnels(J),!1}if(this._sock.rQwait("sub auth count",4))return!1;let Q=this._sock.rQshift32();if(Q===0)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*Q,4))return!1;let $={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},V=[];for(let J=0;J<Q;J++){this._sock.rQshift32();let W=this._sock.rQshiftStr(12);V.push(W)}w("Server Tight authentication types: "+V);for(let J in $)if(V.indexOf(J)!=-1)switch(this._sock.sQpush32($[J]),this._sock.flush(),w("Selected authentication type: "+J),J){case"STDVNOAUTH__":return this._rfbInitState="SecurityResult",!0;case"STDVVNCAUTH_":return this._rfbAuthScheme=G6,!0;case"TGHTULGNAUTH":return this._rfbAuthScheme=c8,!0;default:return this._fail("Unsupported tiny auth scheme (scheme: "+J+")")}return this._fail("No supported sub-auth types!")}_handleRSAAESCredentialsRequired(Q){this.dispatchEvent(Q)}_handleRSAAESServerVerification(Q){this.dispatchEvent(Q)}_negotiateRA2neAuth(){if(this._rfbRSAAESAuthenticationState===null)this._rfbRSAAESAuthenticationState=new l0(this._sock,()=>this._rfbCredentials),this._rfbRSAAESAuthenticationState.addEventListener("serververification",this._eventHandlers.handleRSAAESServerVerification),this._rfbRSAAESAuthenticationState.addEventListener("credentialsrequired",this._eventHandlers.handleRSAAESCredentialsRequired);if(this._rfbRSAAESAuthenticationState.checkInternalEvents(),!this._rfbRSAAESAuthenticationState.hasStarted)this._rfbRSAAESAuthenticationState.negotiateRA2neAuthAsync().catch((Q)=>{if(Q.message!=="disconnect normally")this._fail(Q.message)}).then(()=>{return this._rfbInitState="SecurityResult",!0}).finally(()=>{this._rfbRSAAESAuthenticationState.removeEventListener("serververification",this._eventHandlers.handleRSAAESServerVerification),this._rfbRSAAESAuthenticationState.removeEventListener("credentialsrequired",this._eventHandlers.handleRSAAESCredentialsRequired),this._rfbRSAAESAuthenticationState=null});return!1}_negotiateMSLogonIIAuth(){if(this._sock.rQwait("mslogonii dh param",24))return!1;if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;let Q=this._sock.rQshiftBytes(8),$=this._sock.rQshiftBytes(8),V=this._sock.rQshiftBytes(8),J=n.generateKey({name:"DH",g:Q,p:$},!0,["deriveBits"]),W=n.exportKey("raw",J.publicKey),G=n.deriveBits({name:"DH",public:V},J.privateKey,64),q=n.importKey("raw",G,{name:"DES-CBC"},!1,["encrypt"]),U=q1(this._rfbCredentials.username).substring(0,255),Z=q1(this._rfbCredentials.password).substring(0,63),Y=new Uint8Array(256),X=new Uint8Array(64);window.crypto.getRandomValues(Y),window.crypto.getRandomValues(X);for(let I=0;I<U.length;I++)Y[I]=U.charCodeAt(I);Y[U.length]=0;for(let I=0;I<Z.length;I++)X[I]=Z.charCodeAt(I);return X[Z.length]=0,Y=n.encrypt({name:"DES-CBC",iv:G},q,Y),X=n.encrypt({name:"DES-CBC",iv:G},q,X),this._sock.sQpushBytes(W),this._sock.sQpushBytes(Y),this._sock.sQpushBytes(X),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateAuthentication(){switch(this._rfbAuthScheme){case _8:if(this._rfbVersion>=3.8)this._rfbInitState="SecurityResult";else this._rfbInitState="ClientInitialisation";return!0;case p8:return this._negotiateXvpAuth();case m8:return this._negotiateARDAuth();case G6:return this._negotiateStdVNCAuth();case h8:return this._negotiateTightAuth();case n6:return this._negotiateVeNCryptAuth();case n8:return this._negotiatePlainAuth();case c8:return this._negotiateTightUnixAuth();case y8:return this._negotiateRA2neAuth();case b8:return this._negotiateMSLogonIIAuth();default:return this._fail("Unsupported auth scheme (scheme: "+this._rfbAuthScheme+")")}}_handleSecurityResult(){if(this._sock.rQwait("VNC auth response ",4))return!1;let Q=this._sock.rQshift32();if(Q===0)return this._rfbInitState="ClientInitialisation",w("Authentication OK"),!0;else if(this._rfbVersion>=3.8)return this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=Q,!0;else return this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:Q}})),this._fail("Security handshake failed")}_negotiateServerInit(){if(this._sock.rQwait("server initialization",24))return!1;let Q=this._sock.rQshift16(),$=this._sock.rQshift16(),V=this._sock.rQshift8(),J=this._sock.rQshift8(),W=this._sock.rQshift8(),G=this._sock.rQshift8(),q=this._sock.rQshift16(),U=this._sock.rQshift16(),Z=this._sock.rQshift16(),Y=this._sock.rQshift8(),X=this._sock.rQshift8(),I=this._sock.rQshift8();this._sock.rQskipBytes(3);let j=this._sock.rQshift32();if(this._sock.rQwait("server init name",j,24))return!1;let P=this._sock.rQshiftStr(j);if(P=B0(P,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+j))return!1;let O=this._sock.rQshift16(),k=this._sock.rQshift16(),E=this._sock.rQshift16();this._sock.rQskipBytes(2);let D=(O+k+E)*16;if(this._sock.rQwait("TightVNC extended server init header",D,32+j))return!1;this._sock.rQskipBytes(16*O),this._sock.rQskipBytes(16*k),this._sock.rQskipBytes(16*E)}if(r("Screen: "+Q+"x"+$+", bpp: "+V+", depth: "+J+", bigEndian: "+W+", trueColor: "+G+", redMax: "+q+", greenMax: "+U+", blueMax: "+Z+", redShift: "+Y+", greenShift: "+X+", blueShift: "+I),this._setDesktopName(P),this._resize(Q,$),!this._viewOnly)this._keyboard.grab();if(this._fbDepth=24,this._fbName==="Intel(r) AMT KVM")l("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8;return u.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),u.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}_sendEncodings(){let Q=[];if(Q.push(T.encodingCopyRect),this._fbDepth==24){if(X6)Q.push(T.encodingH264);Q.push(T.encodingTight),Q.push(T.encodingTightPNG),Q.push(T.encodingZRLE),Q.push(T.encodingJPEG),Q.push(T.encodingHextile),Q.push(T.encodingRRE),Q.push(T.encodingZlib)}if(Q.push(T.encodingRaw),Q.push(T.pseudoEncodingQualityLevel0+this._qualityLevel),Q.push(T.pseudoEncodingCompressLevel0+this._compressionLevel),Q.push(T.pseudoEncodingDesktopSize),Q.push(T.pseudoEncodingLastRect),Q.push(T.pseudoEncodingQEMUExtendedKeyEvent),Q.push(T.pseudoEncodingQEMULedEvent),Q.push(T.pseudoEncodingExtendedDesktopSize),Q.push(T.pseudoEncodingXvp),Q.push(T.pseudoEncodingFence),Q.push(T.pseudoEncodingContinuousUpdates),Q.push(T.pseudoEncodingDesktopName),Q.push(T.pseudoEncodingExtendedClipboard),Q.push(T.pseudoEncodingExtendedMouseButtons),this._fbDepth==24)Q.push(T.pseudoEncodingVMwareCursor),Q.push(T.pseudoEncodingCursor);u.messages.clientEncodings(this._sock,Q)}_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.sQpush8(this._shared?1:0),this._sock.flush(),this._rfbInitState="ServerInitialisation",!0;case"ServerInitialisation":return this._negotiateServerInit();default:return this._fail("Unknown init state (state: "+this._rfbInitState+")")}}_resumeAuthentication(){setTimeout(this._initMsg.bind(this),0)}_handleSetColourMapMsg(){return w("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}_handleServerCutText(){if(w("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);let Q=this._sock.rQshift32();if(Q=Q0(Q),this._sock.rQwait("ServerCutText content",Math.abs(Q),8))return!1;if(Q>=0){let $=this._sock.rQshiftStr(Q);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:$}}))}else{Q=Math.abs(Q);let $=this._sock.rQshift32(),V=$&65535,J=$&4278190080;if(!!(J&i8)){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(let q=0;q<=15;q++){let U=1<<q;if(V&U)this._clipboardServerCapabilitiesFormats[U]=!0,this._sock.rQshift32()}for(let q=24;q<=31;q++){let U=1<<q;this._clipboardServerCapabilitiesActions[U]=!!(J&U)}let G=[i8,q6,r8,C0,U6];u.messages.extendedClipboardCaps(this._sock,G,{extendedClipboardFormatText:0})}else if(J===q6){if(this._viewOnly)return!0;if(this._clipboardText!=null&&this._clipboardServerCapabilitiesActions[U6]){if(V&z1)u.messages.extendedClipboardProvide(this._sock,[z1],[this._clipboardText])}}else if(J===r8){if(this._viewOnly)return!0;if(this._clipboardServerCapabilitiesActions[C0])if(this._clipboardText!=null)u.messages.extendedClipboardNotify(this._sock,[z1]);else u.messages.extendedClipboardNotify(this._sock,[])}else if(J===C0){if(this._viewOnly)return!0;if(this._clipboardServerCapabilitiesActions[q6]){if(V&z1)u.messages.extendedClipboardRequest(this._sock,[z1])}}else if(J===U6){if(this._viewOnly)return!0;if(!(V&z1))return!0;this._clipboardText=null;let G=this._sock.rQshiftBytes(Q-4),q=new Y1,U=null;q.setInput(G);for(let Z=0;Z<=15;Z++){let Y=1<<Z;if(V&Y){let X=0,I=q.inflate(4);X|=I[0]<<24,X|=I[1]<<16,X|=I[2]<<8,X|=I[3];let j=q.inflate(X);if(Y===z1)U=j}}if(q.setInput(null),U!==null){let Z="";for(let Y=0;Y<U.length;Y++)Z+=String.fromCharCode(U[Y]);if(U=Z,U=B0(U),U.length>0&&U.charAt(U.length-1)==="\x00")U=U.slice(0,-1);U=U.replaceAll(`\r
`,`
`),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:U}}))}}else return this._fail("Unexpected action in extended clipboard message: "+J)}return!0}_handleServerFenceMsg(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);let Q=this._sock.rQshift32(),$=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",$,9))return!1;if($>64)l("Bad payload length ("+$+") in fence response"),$=64;let V=this._sock.rQshiftStr($);if(this._supportsFence=!0,!(Q&-2147483648))return this._fail("Unexpected fence response");return Q&=3,u.messages.clientFence(this._sock,Q,V),!0}_handleXvpMsg(){if(this._sock.rQwait("XVP version and message",3,1))return!1;this._sock.rQskipBytes(1);let Q=this._sock.rQshift8(),$=this._sock.rQshift8();switch($){case 0:p("XVP operation failed");break;case 1:this._rfbXvpVer=Q,r("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+$+")");break}return!0}_normalMsg(){let Q;if(this._FBU.rects>0)Q=0;else Q=this._sock.rQshift8();let $,V;switch(Q){case 0:if(V=this._framebufferUpdate(),V&&!this._enabledContinuousUpdates)u.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight);return V;case 1:return this._handleSetColourMapMsg();case 2:return w("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:if($=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,$)this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),r("Enabling continuous updates.");return!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+Q+")"),w("sock.rQpeekBytes(30): "+this._sock.rQpeekBytes(30)),!0}}_framebufferUpdate(){if(this._FBU.rects===0){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().then(()=>{if(this._flushing=!1,!this._sock.rQwait("message",1))this._handleMessage()}),!1}while(this._FBU.rects>0){if(this._FBU.encoding===null){if(this._sock.rQwait("rect header",12))return!1;this._FBU.x=this._sock.rQshift16(),this._FBU.y=this._sock.rQshift16(),this._FBU.width=this._sock.rQshift16(),this._FBU.height=this._sock.rQshift16(),this._FBU.encoding=this._sock.rQshift32(),this._FBU.encoding>>=0}if(!this._handleRect())return!1;this._FBU.rects--,this._FBU.encoding=null}return this._display.flip(),!0}_handleRect(){switch(this._FBU.encoding){case T.pseudoEncodingLastRect:return this._FBU.rects=1,!0;case T.pseudoEncodingVMwareCursor:return this._handleVMwareCursor();case T.pseudoEncodingCursor:return this._handleCursor();case T.pseudoEncodingQEMUExtendedKeyEvent:return this._qemuExtKeyEventSupported=!0,!0;case T.pseudoEncodingDesktopName:return this._handleDesktopName();case T.pseudoEncodingDesktopSize:return this._resize(this._FBU.width,this._FBU.height),!0;case T.pseudoEncodingExtendedDesktopSize:return this._handleExtendedDesktopSize();case T.pseudoEncodingExtendedMouseButtons:return this._extendedPointerEventSupported=!0,!0;case T.pseudoEncodingQEMULedEvent:return this._handleLedEvent();default:return this._handleDataRect()}}_handleVMwareCursor(){let Q=this._FBU.x,$=this._FBU.y,V=this._FBU.width,J=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;let W=this._sock.rQshift8();this._sock.rQshift8();let G,q=4;if(W==0){if(G=Array(V*J*q),this._sock.rQwait("VMware cursor classic encoding",V*J*q*2,2))return!1;let Z=Array(V*J);for(let X=0;X<V*J;X++)Z[X]=this._sock.rQshift32();let Y=Array(V*J);for(let X=0;X<V*J;X++)Y[X]=this._sock.rQshift32();for(let X=0;X<V*J;X++)if(Z[X]==0){let I=Y[X],j=I>>8&255,P=I>>16&255,O=I>>24&255;G[X*q]=j,G[X*q+1]=P,G[X*q+2]=O,G[X*q+3]=255}else if((Z[X]&-256)==-256)if(Y[X]==0)G[X*q]=0,G[X*q+1]=0,G[X*q+2]=0,G[X*q+3]=0;else if((Y[X]&-256)==-256)G[X*q]=0,G[X*q+1]=0,G[X*q+2]=0,G[X*q+3]=255;else G[X*q]=0,G[X*q+1]=0,G[X*q+2]=0,G[X*q+3]=255;else G[X*q]=0,G[X*q+1]=0,G[X*q+2]=0,G[X*q+3]=255}else if(W==1){if(this._sock.rQwait("VMware cursor alpha encoding",V*J*4,2))return!1;G=Array(V*J*q);for(let U=0;U<V*J;U++){let Z=this._sock.rQshift32();G[U*4]=Z>>24&255,G[U*4+1]=Z>>16&255,G[U*4+2]=Z>>8&255,G[U*4+3]=Z&255}}else return l("The given cursor type is not supported: "+W+" given."),!1;return this._updateCursor(G,Q,$,V,J),!0}_handleCursor(){let Q=this._FBU.x,$=this._FBU.y,V=this._FBU.width,J=this._FBU.height,W=V*J*4,G=Math.ceil(V/8)*J,q=W+G;if(this._sock.rQwait("cursor encoding",q))return!1;let U=this._sock.rQshiftBytes(W),Z=this._sock.rQshiftBytes(G),Y=new Uint8Array(V*J*4),X=0;for(let I=0;I<J;I++)for(let j=0;j<V;j++){let P=I*Math.ceil(V/8)+Math.floor(j/8),O=Z[P]<<j%8&128?255:0;Y[X]=U[X+2],Y[X+1]=U[X+1],Y[X+2]=U[X],Y[X+3]=O,X+=4}return this._updateCursor(Y,Q,$,V,J),!0}_handleDesktopName(){if(this._sock.rQwait("DesktopName",4))return!1;let Q=this._sock.rQshift32();if(this._sock.rQwait("DesktopName",Q,4))return!1;let $=this._sock.rQshiftStr(Q);return $=B0($,!0),this._setDesktopName($),!0}_handleLedEvent(){if(this._sock.rQwait("LED status",1))return!1;let Q=this._sock.rQshift8(),$=Q&2?!0:!1,V=Q&4?!0:!1;return this._remoteCapsLock=V,this._remoteNumLock=$,!0}_handleExtendedDesktopSize(){if(this._sock.rQwait("ExtendedDesktopSize",4))return!1;let Q=this._sock.rQpeek8(),$=4+Q*16;if(this._sock.rQwait("ExtendedDesktopSize",$))return!1;let V=!this._supportsSetDesktopSize;this._supportsSetDesktopSize=!0,this._sock.rQskipBytes(1),this._sock.rQskipBytes(3);for(let J=0;J<Q;J+=1)if(J===0)this._screenID=this._sock.rQshift32(),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._screenFlags=this._sock.rQshift32();else this._sock.rQskipBytes(16);if(this._FBU.x===1)this._pendingRemoteResize=!1;if(this._FBU.x===1&&this._FBU.y!==0){let J="";switch(this._FBU.y){case 1:J="Resize is administratively prohibited";break;case 2:J="Out of resources";break;case 3:J="Invalid screen layout";break;default:J="Unknown reason";break}l("Server did not accept the resize request: "+J)}else this._resize(this._FBU.width,this._FBU.height);if(V)this._requestRemoteResize();if(this._FBU.x===1&&this._FBU.y===0)this._requestRemoteResize();return!0}_handleDataRect(){let Q=this._decoders[this._FBU.encoding];if(!Q)return this._fail("Unsupported encoding (encoding: "+this._FBU.encoding+")"),!1;try{return Q.decodeRect(this._FBU.x,this._FBU.y,this._FBU.width,this._FBU.height,this._sock,this._display,this._fbDepth)}catch($){return this._fail("Error decoding rect: "+$),!1}}_updateContinuousUpdates(){if(!this._enabledContinuousUpdates)return;u.messages.enableContinuousUpdates(this._sock,!0,0,0,this._fbWidth,this._fbHeight)}_resize(Q,$){this._fbWidth=Q,this._fbHeight=$,this._display.resize(this._fbWidth,this._fbHeight),this._updateClip(),this._updateScale(),this._updateContinuousUpdates(),this._saveExpectedClientSize()}_xvpOp(Q,$){if(this._rfbXvpVer<Q)return;r("Sending XVP operation "+$+" (version "+Q+")"),u.messages.xvpOp(this._sock,Q,$)}_updateCursor(Q,$,V,J,W){this._cursorImage={rgbaPixels:Q,hotx:$,hoty:V,w:J,h:W},this._refreshCursor()}_shouldShowDotCursor(){if(!this._showDotCursor)return!1;for(let Q=3;Q<this._cursorImage.rgbaPixels.length;Q+=4)if(this._cursorImage.rgbaPixels[Q])return!1;return!0}_refreshCursor(){if(this._rfbConnectionState!=="connecting"&&this._rfbConnectionState!=="connected")return;let Q=this._shouldShowDotCursor()?u.cursors.dot:this._cursorImage;this._cursor.change(Q.rgbaPixels,Q.hotx,Q.hoty,Q.w,Q.h)}static genDES(Q,$){let V=Q.split("").map((W)=>W.charCodeAt(0)),J=n.importKey("raw",V,{name:"DES-ECB"},!1,["encrypt"]);return n.encrypt({name:"DES-ECB"},J,$)}}u.messages={keyEvent(Q,$,V){Q.sQpush8(4),Q.sQpush8(V),Q.sQpush16(0),Q.sQpush32($),Q.flush()},QEMUExtendedKeyEvent(Q,$,V,J){function W(q){let U=J>>8,Z=J&255;if(U===224&&Z<127)return Z|128;return q}Q.sQpush8(255),Q.sQpush8(0),Q.sQpush16(V),Q.sQpush32($);let G=W(J);Q.sQpush32(G),Q.flush()},pointerEvent(Q,$,V,J){Q.sQpush8(5),J=J&127,Q.sQpush8(J),Q.sQpush16($),Q.sQpush16(V),Q.flush()},extendedPointerEvent(Q,$,V,J){Q.sQpush8(5);let W=J>>7&255;if(W&252)throw Error("Invalid mouse button mask: "+J);let G=J&127;G|=128,Q.sQpush8(G),Q.sQpush16($),Q.sQpush16(V),Q.sQpush8(W),Q.flush()},_buildExtendedClipboardFlags(Q,$){let V=new Uint8Array(4),J=0,W=0;for(let G=0;G<Q.length;G++)W|=Q[G];for(let G=0;G<$.length;G++)J|=$[G];return V[0]=W>>24,V[1]=0,V[2]=0,V[3]=J,V},extendedClipboardProvide(Q,$,V){let J=new k0,W=[];for(let U=0;U<$.length;U++){if($[U]!=z1)throw Error("Unsupported extended clipboard format for Provide message.");V[U]=V[U].replace(/\r\n|\r|\n/gm,`\r
`);let Z=q1(V[U]+"\x00");W.push(Z.length>>24&255,Z.length>>16&255,Z.length>>8&255,Z.length&255);for(let Y=0;Y<Z.length;Y++)W.push(Z.charCodeAt(Y))}let G=J.deflate(new Uint8Array(W)),q=new Uint8Array(4+G.length);q.set(u.messages._buildExtendedClipboardFlags([U6],$)),q.set(G,4),u.messages.clientCutText(Q,q,!0)},extendedClipboardNotify(Q,$){let V=u.messages._buildExtendedClipboardFlags([C0],$);u.messages.clientCutText(Q,V,!0)},extendedClipboardRequest(Q,$){let V=u.messages._buildExtendedClipboardFlags([q6],$);u.messages.clientCutText(Q,V,!0)},extendedClipboardCaps(Q,$,V){let J=Object.keys(V),W=new Uint8Array(4+4*J.length);J.map((q)=>parseInt(q)),J.sort((q,U)=>q-U),W.set(u.messages._buildExtendedClipboardFlags($,[]));let G=4;for(let q=0;q<J.length;q++)W[G]=V[J[q]]>>24,W[G+1]=V[J[q]]>>16,W[G+2]=V[J[q]]>>8,W[G+3]=V[J[q]]>>0,G+=4,W[3]|=1<<J[q];u.messages.clientCutText(Q,W,!0)},clientCutText(Q,$,V=!1){Q.sQpush8(6),Q.sQpush8(0),Q.sQpush8(0),Q.sQpush8(0);let J;if(V)J=i6(-$.length);else J=$.length;Q.sQpush32(J),Q.sQpushBytes($),Q.flush()},setDesktopSize(Q,$,V,J,W){Q.sQpush8(251),Q.sQpush8(0),Q.sQpush16($),Q.sQpush16(V),Q.sQpush8(1),Q.sQpush8(0),Q.sQpush32(J),Q.sQpush16(0),Q.sQpush16(0),Q.sQpush16($),Q.sQpush16(V),Q.sQpush32(W),Q.flush()},clientFence(Q,$,V){Q.sQpush8(248),Q.sQpush8(0),Q.sQpush8(0),Q.sQpush8(0),Q.sQpush32($),Q.sQpush8(V.length),Q.sQpushString(V),Q.flush()},enableContinuousUpdates(Q,$,V,J,W,G){Q.sQpush8(150),Q.sQpush8($),Q.sQpush16(V),Q.sQpush16(J),Q.sQpush16(W),Q.sQpush16(G),Q.flush()},pixelFormat(Q,$,V){let J;if($>16)J=32;else if($>8)J=16;else J=8;let W=Math.floor($/3);Q.sQpush8(0),Q.sQpush8(0),Q.sQpush8(0),Q.sQpush8(0),Q.sQpush8(J),Q.sQpush8($),Q.sQpush8(0),Q.sQpush8(V?1:0),Q.sQpush16((1<<W)-1),Q.sQpush16((1<<W)-1),Q.sQpush16((1<<W)-1),Q.sQpush8(W*0),Q.sQpush8(W*1),Q.sQpush8(W*2),Q.sQpush8(0),Q.sQpush8(0),Q.sQpush8(0),Q.flush()},clientEncodings(Q,$){Q.sQpush8(2),Q.sQpush8(0),Q.sQpush16($.length);for(let V=0;V<$.length;V++)Q.sQpush32($[V]);Q.flush()},fbUpdateRequest(Q,$,V,J,W,G){if(typeof V>"u")V=0;if(typeof J>"u")J=0;Q.sQpush8(3),Q.sQpush8($?1:0),Q.sQpush16(V),Q.sQpush16(J),Q.sQpush16(W),Q.sQpush16(G),Q.flush()},xvpOp(Q,$,V){Q.sQpush8(250),Q.sQpush8(0),Q.sQpush8($),Q.sQpush8(V),Q.flush()}};u.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}};export{u as default};