securityos/node_modules/@wasmer/wasm-terminal/lib/unoptimized/wasm-terminal.esm.js

1083 lines
753 KiB
JavaScript

/*
*****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
*****************************************************************************/
function aa(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b["default"]:b}function ba(b,a){return a={exports:{}},b(a,a.exports),a.exports}
var ca=ba(function(b){!function(a,c){b.exports=c()}(window,function(){return function(a){function b(c){if(d[c])return d[c].exports;var e=d[c]={i:c,l:!1,exports:{}};return a[c].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var d={};return b.m=a,b.c=d,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})},
b.t=function(a,c){if((1&c&&(a=b(a)),8&c)||4&c&&"object"==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:a}),2&c&&"string"!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a.default}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s=33)}([function(a,b,d){Object.defineProperty(b,
"__esModule",{value:!0});a=d(14);b.IBufferService=a.createDecorator("BufferService");b.ICoreMouseService=a.createDecorator("CoreMouseService");b.ICoreService=a.createDecorator("CoreService");b.IDirtyRowService=a.createDecorator("DirtyRowService");b.IInstantiationService=a.createDecorator("InstantiationService");b.ILogService=a.createDecorator("LogService");b.IOptionsService=a.createDecorator("OptionsService")},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this._listeners=
[];this._disposed=!1}return Object.defineProperty(a.prototype,"event",{get:function(){var a=this;return this._event||(this._event=function(b){return a._listeners.push(b),{dispose:function(){if(!a._disposed)for(var c=0;c<a._listeners.length;c++)if(a._listeners[c]===b)return void a._listeners.splice(c,1)}}}),this._event},enumerable:!0,configurable:!0}),a.prototype.fire=function(a){for(var b=[],c=0;c<this._listeners.length;c++)b.push(this._listeners[c]);for(c=0;c<b.length;c++)b[c].call(void 0,a)},a.prototype.dispose=
function(){this._listeners&&(this._listeners.length=0);this._disposed=!0},a}();b.EventEmitter=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this._disposables=[];this._isDisposed=!1}return a.prototype.dispose=function(){this._isDisposed=!0;this._disposables.forEach(function(a){return a.dispose()});this._disposables.length=0},a.prototype.register=function(a){this._disposables.push(a)},a.prototype.unregister=function(a){a=this._disposables.indexOf(a);-1!==
a&&this._disposables.splice(a,1)},a}();b.Disposable=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.DEFAULT_COLOR=256;b.DEFAULT_ATTR=256|b.DEFAULT_COLOR<<9;b.CHAR_DATA_ATTR_INDEX=0;b.CHAR_DATA_CHAR_INDEX=1;b.CHAR_DATA_WIDTH_INDEX=2;b.CHAR_DATA_CODE_INDEX=3;b.NULL_CELL_CHAR="";b.NULL_CELL_WIDTH=1;b.NULL_CELL_CODE=0;b.WHITESPACE_CELL_CHAR=" ";b.WHITESPACE_CELL_WIDTH=1;b.WHITESPACE_CELL_CODE=32},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});a=d(14);b.ICharSizeService=
a.createDecorator("CharSizeService");b.ICoreBrowserService=a.createDecorator("CoreBrowserService");b.IMouseService=a.createDecorator("MouseService");b.IRenderService=a.createDecorator("RenderService");b.ISelectionService=a.createDecorator("SelectionService");b.ISoundService=a.createDecorator("SoundService")},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&
(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});var f=d(8),h=d(3);a=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.content=0,b.fg=0,b.bg=0,b.combinedData="",b}return g(b,a),b.fromCharData=function(a){var c=new b;return c.setFromCharData(a),c},b.prototype.isCombined=function(){return 2097152&this.content},b.prototype.getWidth=
function(){return this.content>>22},b.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?f.stringFromCodePoint(2097151&this.content):""},b.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},b.prototype.setFromCharData=function(a){this.fg=a[h.CHAR_DATA_ATTR_INDEX];this.bg=0;var b=!1;if(2<a[h.CHAR_DATA_CHAR_INDEX].length)b=!0;else if(2===a[h.CHAR_DATA_CHAR_INDEX].length){var c=
a[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&56319>=c){var d=a[h.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&57343>=d?this.content=1024*(c-55296)+d-56320+65536|a[h.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=a[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|a[h.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=a[h.CHAR_DATA_CHAR_INDEX],this.content=2097152|a[h.CHAR_DATA_WIDTH_INDEX]<<22)},b.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},
b}(d(6).AttributeData);b.CellData=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this.bg=this.fg=0}return a.toColorRGB=function(a){return[a>>>16&255,a>>>8&255,255&a]},a.fromColorRGB=function(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]},a.prototype.clone=function(){var b=new a;return b.fg=this.fg,b.bg=this.bg,b},a.prototype.isInverse=function(){return 67108864&this.fg},a.prototype.isBold=function(){return 134217728&this.fg},a.prototype.isUnderline=function(){return 268435456&
this.fg},a.prototype.isBlink=function(){return 536870912&this.fg},a.prototype.isInvisible=function(){return 1073741824&this.fg},a.prototype.isItalic=function(){return 67108864&this.bg},a.prototype.isDim=function(){return 134217728&this.bg},a.prototype.getFgColorMode=function(){return 50331648&this.fg},a.prototype.getBgColorMode=function(){return 50331648&this.bg},a.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},a.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},
a.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},a.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},a.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},a.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},a.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},a.prototype.getBgColor=
function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},a}();b.AttributeData=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.addDisposableDomListener=function(a,b,c,f){return a.addEventListener(b,c,f),{dispose:function(){c&&a.removeEventListener(b,c,f)}}}},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.stringFromCodePoint=function(a){return 65535<a?(a-=65536,String.fromCharCode(55296+
(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)};b.utf32ToString=function(a,b,c){void 0===b&&(b=0);void 0===c&&(c=a.length);for(var d="";b<c;++b){var e=a[b];65535<e?(e-=65536,d+=String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):d+=String.fromCharCode(e)}return d};a=function(){function a(){this._interim=0}return a.prototype.clear=function(){this._interim=0},a.prototype.decode=function(a,b){var c=a.length;if(!c)return 0;var d=0,e=0;for(this._interim&&(56320<=(q=
a.charCodeAt(e++))&&57343>=q?b[d++]=1024*(this._interim-55296)+q-56320+65536:(b[d++]=this._interim,b[d++]=q),this._interim=0);e<c;++e){var g=a.charCodeAt(e);if(55296<=g&&56319>=g){if(++e>=c)return this._interim=g,d;var q;56320<=(q=a.charCodeAt(e))&&57343>=q?b[d++]=1024*(g-55296)+q-56320+65536:(b[d++]=g,b[d++]=q)}else b[d++]=g}return d},a}();b.StringToUtf32=a;a=function(){function a(){this.interim=new Uint8Array(3)}return a.prototype.clear=function(){this.interim.fill(0)},a.prototype.decode=function(a,
b){var c=a.length;if(!c)return 0;var d,e,g,q,t=0,v=0,l=0;if(this.interim[0]){var n=!1,y=this.interim[0];y&=192==(224&y)?31:224==(240&y)?15:7;for(var B=0,O;(O=63&this.interim[++B])&&4>B;)y<<=6,y|=O;for(var X=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,M=X-B;l<M;){if(l>=c)return 0;if(128!=(192&(O=a[l++]))){l--;n=!0;break}this.interim[B++]=O;y<<=6;y|=63&O}n||(2===X?128>y?l--:b[t++]=y:3===X?2048>y||55296<=y&&57343>=y||(b[t++]=y):65536>y||1114111<y||(b[t++]=y));this.interim.fill(0)}for(n=
c-4;l<c;){for(;!(!(l<n)||128&(d=a[l])||128&(e=a[l+1])||128&(g=a[l+2])||128&(q=a[l+3]));)b[t++]=d,b[t++]=e,b[t++]=g,b[t++]=q,l+=4;if(128>(d=a[l++]))b[t++]=d;else if(192==(224&d)){if(l>=c)return this.interim[0]=d,t;128!=(192&(e=a[l++]))?l--:128>(v=(31&d)<<6|63&e)?l--:b[t++]=v}else if(224==(240&d)){if(l>=c)return this.interim[0]=d,t;if(128!=(192&(e=a[l++])))l--;else{if(l>=c)return this.interim[0]=d,this.interim[1]=e,t;128!=(192&(g=a[l++]))?l--:2048>(v=(15&d)<<12|(63&e)<<6|63&g)||55296<=v&&57343>=v||
(b[t++]=v)}}else if(240==(248&d)){if(l>=c)return this.interim[0]=d,t;if(128!=(192&(e=a[l++])))l--;else{if(l>=c)return this.interim[0]=d,this.interim[1]=e,t;if(128!=(192&(g=a[l++])))l--;else{if(l>=c)return this.interim[0]=d,this.interim[1]=e,this.interim[2]=g,t;128!=(192&(q=a[l++]))?l--:65536>(v=(7&d)<<18|(63&e)<<12|(63&g)<<6|63&q)||1114111<v||(b[t++]=v)}}}}return t},a}();b.Utf8ToUtf32=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.INVERTED_DEFAULT_COLOR=257;b.DIM_OPACITY=.5;b.CHAR_ATLAS_CELL_SPACING=
1},function(a,b){function c(a){a=a.toString(16);return 2>a.length?"0"+a:a}function e(a,b,d,e){return void 0!==e?"#"+c(a)+c(b)+c(d)+c(e):"#"+c(a)+c(b)+c(d)}function g(a,b,c,d){return void 0===d&&(d=255),(a<<24|b<<16|c<<8|d)>>>0}function f(a){return[a>>24&255,a>>16&255,a>>8&255,255&a]}function h(a){return k(a>>16&255,a>>8&255,255&a)}function k(a,b,c){a/=255;b/=255;c/=255;return.2126*(.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4))+.7152*(.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4))+.0722*(.03928>=
c?c/12.92:Math.pow((c+.055)/1.055,2.4))}function r(a,b){return a<b?(b+.05)/(a+.05):(a+.05)/(b+.05)}function q(a,b,c){return{css:e(a,b,c),rgba:g(a,b,c)}}function t(a,b,c){var d=h(a>>8),e=h(b>>8);if(r(d,e)<c)return e<d?v(a,b,c):l(a,b,c)}function v(a,b,c){var d=a>>24&255,e=a>>16&255;a=a>>8&255;var g=b>>24&255,f=b>>16&255;b=b>>8&255;for(var l=r(k(g,b,f),k(d,e,a));l<c&&(0<g||0<f||0<b);)g-=Math.max(0,Math.ceil(.1*g)),f-=Math.max(0,Math.ceil(.1*f)),l=r(k(g,b-=Math.max(0,Math.ceil(.1*b)),f),k(d,e,a));return(g<<
24|f<<16|b<<8|255)>>>0}function l(a,b,c){var d=a>>24&255,e=a>>16&255;a=a>>8&255;var g=b>>24&255,f=b>>16&255;b=b>>8&255;for(var l=r(k(g,b,f),k(d,e,a));l<c&&(255>g||255>f||255>b);)g=Math.min(255,g+Math.ceil(.1*(255-g))),f=Math.min(255,f+Math.ceil(.1*(255-f))),l=r(k(g,b=Math.min(255,b+Math.ceil(.1*(255-b))),f),k(d,e,a));return(g<<24|f<<16|b<<8|255)>>>0}Object.defineProperty(b,"__esModule",{value:!0});b.blend=function(a,b){var c=(255&b.rgba)/255;if(1===c)return{css:b.css,rgba:b.rgba};var d=a.rgba>>24&
255,f=a.rgba>>16&255;a=a.rgba>>8&255;d+=Math.round(((b.rgba>>24&255)-d)*c);f+=Math.round(((b.rgba>>16&255)-f)*c);b=a+Math.round(((b.rgba>>8&255)-a)*c);return{css:e(d,f,b),rgba:g(d,f,b)}};b.fromCss=function(a){return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0}};b.toPaddedHex=c;b.toCss=e;b.toRgba=g;b.fromRgba=f;b.opaque=function(a){a=(255|a.rgba)>>>0;var b=f(a);return{css:e(b[0],b[1],b[2]),rgba:a}};b.rgbRelativeLuminance=h;b.rgbRelativeLuminance2=k;b.contrastRatio=r;b.rgbaToColor=q;b.ensureContrastRatioRgba=
t;b.ensureContrastRatio=function(a,b,c){if(a=t(a.rgba,b.rgba,c))return q(a>>24&255,a>>16&255,a>>8&255)};b.reduceLuminance=v;b.increaseLuminance=l},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=(a="undefined"==typeof navigator)?"node":navigator.userAgent;a=a?"node":navigator.platform;b.isFirefox=!!~c.indexOf("Firefox");b.isSafari=/^((?!chrome|android).)*safari/i.test(c);c=0<=["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(a);b.isMac=c;b.isIpad="iPad"===a;b.isIphone="iPhone"===
a;c=0<=["Windows","Win16","Win32","WinCE"].indexOf(a);b.isWindows=c;b.isLinux=0<=a.indexOf("Linux")},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});(function(a){a.NUL="\x00";a.SOH="\u0001";a.STX="\u0002";a.ETX="\u0003";a.EOT="\u0004";a.ENQ="\u0005";a.ACK="\u0006";a.BEL="\u0007";a.BS="\b";a.HT="\t";a.LF="\n";a.VT="\v";a.FF="\f";a.CR="\r";a.SO="\u000e";a.SI="\u000f";a.DLE="\u0010";a.DC1="\u0011";a.DC2="\u0012";a.DC3="\u0013";a.DC4="\u0014";a.NAK="\u0015";a.SYN="\u0016";a.ETB="\u0017";
a.CAN="\u0018";a.EM="\u0019";a.SUB="\u001a";a.ESC="\u001b";a.FS="\u001c";a.GS="\u001d";a.RS="\u001e";a.US="\u001f";a.SP=" ";a.DEL="\u007f"})(b.C0||(b.C0={}));(function(a){a.PAD="\u0080";a.HOP="\u0081";a.BPH="\u0082";a.NBH="\u0083";a.IND="\u0084";a.NEL="\u0085";a.SSA="\u0086";a.ESA="\u0087";a.HTS="\u0088";a.HTJ="\u0089";a.VTS="\u008a";a.PLD="\u008b";a.PLU="\u008c";a.RI="\u008d";a.SS2="\u008e";a.SS3="\u008f";a.DCS="\u0090";a.PU1="\u0091";a.PU2="\u0092";a.STS="\u0093";a.CCH="\u0094";a.MW="\u0095";a.SPA=
"\u0096";a.EPA="\u0097";a.SOS="\u0098";a.SGCI="\u0099";a.SCI="\u009a";a.CSI="\u009b";a.ST="\u009c";a.OSC="\u009d";a.PM="\u009e";a.APC="\u009f"})(b.C1||(b.C1={}))},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(3),g=d(9),f=d(24),h=d(6),k=d(27),r=d(10);a=function(){function a(a,b,c,d,e,g,f,k){this._container=a;this._alpha=d;this._colors=e;this._rendererId=g;this._bufferService=f;this._optionsService=k;this._scaledCharTop=this._scaledCharLeft=this._scaledCellHeight=this._scaledCellWidth=
this._scaledCharHeight=this._scaledCharWidth=0;this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1};this._canvas=document.createElement("canvas");this._canvas.classList.add("xterm-"+b+"-layer");this._canvas.style.zIndex=c.toString();this._initCanvas();this._container.appendChild(this._canvas)}return a.prototype.dispose=function(){var a;this._container.removeChild(this._canvas);null===(a=this._charAtlas)||void 0===a||a.dispose()},a.prototype._initCanvas=function(){this._ctx=
k.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha}));this._alpha||this._clearAll()},a.prototype.onOptionsChanged=function(){},a.prototype.onBlur=function(){},a.prototype.onFocus=function(){},a.prototype.onCursorMove=function(){},a.prototype.onGridChanged=function(){},a.prototype.onSelectionChanged=function(){},a.prototype.setColors=function(a){this._refreshCharAtlas(a)},a.prototype._setTransparency=function(a){if(a!==this._alpha){var b=this._canvas;this._alpha=a;this._canvas=this._canvas.cloneNode();
this._initCanvas();this._container.replaceChild(this._canvas,b);this._refreshCharAtlas(this._colors);this.onGridChanged(0,this._bufferService.rows-1)}},a.prototype._refreshCharAtlas=function(a){0>=this._scaledCharWidth&&0>=this._scaledCharHeight||(this._charAtlas=f.acquireCharAtlas(this._optionsService.options,this._rendererId,a,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},a.prototype.resize=function(a){this._scaledCellWidth=a.scaledCellWidth;this._scaledCellHeight=a.scaledCellHeight;
this._scaledCharWidth=a.scaledCharWidth;this._scaledCharHeight=a.scaledCharHeight;this._scaledCharLeft=a.scaledCharLeft;this._scaledCharTop=a.scaledCharTop;this._canvas.width=a.scaledCanvasWidth;this._canvas.height=a.scaledCanvasHeight;this._canvas.style.width=a.canvasWidth+"px";this._canvas.style.height=a.canvasHeight+"px";this._alpha||this._clearAll();this._refreshCharAtlas(this._colors)},a.prototype._fillCells=function(a,b,c,d){this._ctx.fillRect(a*this._scaledCellWidth,b*this._scaledCellHeight,
c*this._scaledCellWidth,d*this._scaledCellHeight)},a.prototype._fillBottomLineAtCells=function(a,b,c){void 0===c&&(c=1);this._ctx.fillRect(a*this._scaledCellWidth,(b+1)*this._scaledCellHeight-window.devicePixelRatio-1,c*this._scaledCellWidth,window.devicePixelRatio)},a.prototype._fillLeftLineAtCell=function(a,b){this._ctx.fillRect(a*this._scaledCellWidth,b*this._scaledCellHeight,window.devicePixelRatio,this._scaledCellHeight)},a.prototype._strokeRectAtCell=function(a,b,c,d){this._ctx.lineWidth=window.devicePixelRatio;
this._ctx.strokeRect(a*this._scaledCellWidth+window.devicePixelRatio/2,b*this._scaledCellHeight+window.devicePixelRatio/2,c*this._scaledCellWidth-window.devicePixelRatio,d*this._scaledCellHeight-window.devicePixelRatio)},a.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},a.prototype._clearCells=function(a,b,c,d){this._alpha?this._ctx.clearRect(a*
this._scaledCellWidth,b*this._scaledCellHeight,c*this._scaledCellWidth,d*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(a*this._scaledCellWidth,b*this._scaledCellHeight,c*this._scaledCellWidth,d*this._scaledCellHeight))},a.prototype._fillCharTrueColor=function(a,b,c){this._ctx.font=this._getFont(!1,!1);this._ctx.textBaseline="middle";this._clipRow(c);this._ctx.fillText(a.getChars(),b*this._scaledCellWidth+this._scaledCharLeft,c*this._scaledCellHeight+this._scaledCharTop+
this._scaledCharHeight/2)},a.prototype._drawChars=function(a,b,d){var e,f,l=this._getContrastColor(a);l||a.isFgRGB()||a.isBgRGB()?this._drawUncachedChars(a,b,d,l):(a.isInverse()?(e=a.isBgDefault()?g.INVERTED_DEFAULT_COLOR:a.getBgColor(),f=a.isFgDefault()?g.INVERTED_DEFAULT_COLOR:a.getFgColor()):(f=a.isBgDefault()?c.DEFAULT_COLOR:a.getBgColor(),e=a.isFgDefault()?c.DEFAULT_COLOR:a.getFgColor()),e+=this._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&8>e?8:0,this._currentGlyphIdentifier.chars=
a.getChars()||c.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=a.getCode()||c.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=f,this._currentGlyphIdentifier.fg=e,this._currentGlyphIdentifier.bold=!!a.isBold(),this._currentGlyphIdentifier.dim=!!a.isDim(),this._currentGlyphIdentifier.italic=!!a.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,b*this._scaledCellWidth+this._scaledCharLeft,d*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(a,
b,d))},a.prototype._drawUncachedChars=function(a,b,c,d){(this._ctx.save(),this._ctx.font=this._getFont(!!a.isBold(),!!a.isItalic()),this._ctx.textBaseline="middle",a.isInverse())?d?this._ctx.fillStyle=d.css:a.isBgDefault()?this._ctx.fillStyle=r.opaque(this._colors.background).css:a.isBgRGB()?this._ctx.fillStyle="rgb("+h.AttributeData.toColorRGB(a.getBgColor()).join(",")+")":(d=a.getBgColor(),this._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&8>d&&(d+=8),this._ctx.fillStyle=this._colors.ansi[d].css):
d?this._ctx.fillStyle=d.css:a.isFgDefault()?this._ctx.fillStyle=this._colors.foreground.css:a.isFgRGB()?this._ctx.fillStyle="rgb("+h.AttributeData.toColorRGB(a.getFgColor()).join(",")+")":(d=a.getFgColor(),this._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&8>d&&(d+=8),this._ctx.fillStyle=this._colors.ansi[d].css);this._clipRow(c);a.isDim()&&(this._ctx.globalAlpha=g.DIM_OPACITY);this._ctx.fillText(a.getChars(),b*this._scaledCellWidth+this._scaledCharLeft,c*this._scaledCellHeight+
this._scaledCharTop+this._scaledCharHeight/2);this._ctx.restore()},a.prototype._clipRow=function(a){this._ctx.beginPath();this._ctx.rect(0,a*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight);this._ctx.clip()},a.prototype._getFont=function(a,b){return(b?"italic":"")+" "+(a?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},
a.prototype._getContrastColor=function(a){if(1!==this._optionsService.options.minimumContrastRatio){var b=this._colors.contrastCache.getColor(a.bg,a.fg);if(void 0!==b)return b||void 0;b=a.getFgColor();var c=a.getFgColorMode(),d=a.getBgColor(),e=a.getBgColorMode(),g=!!a.isInverse(),f=!!a.isInverse();if(g){var k=b;b=d;d=k;k=c;c=e;e=k}d=this._resolveBackgroundRgba(e,d,g);b=this._resolveForegroundRgba(c,b,g,f);if(b=r.ensureContrastRatioRgba(d,b,this._optionsService.options.minimumContrastRatio))return b=
{css:r.toCss(b>>24&255,b>>16&255,b>>8&255),rgba:b},this._colors.contrastCache.setColor(a.bg,a.fg,b),b;this._colors.contrastCache.setColor(a.bg,a.fg,null)}},a.prototype._resolveBackgroundRgba=function(a,b,c){switch(a){case 16777216:case 33554432:return this._colors.ansi[b].rgba;case 50331648:return b<<8;default:return c?this._colors.foreground.rgba:this._colors.background.rgba}},a.prototype._resolveForegroundRgba=function(a,b,c,d){switch(a){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&
d&&8>b&&(b+=8),this._colors.ansi[b].rgba;case 50331648:return b<<8;default:return c?this._colors.background.rgba:this._colors.foreground.rgba}},a}();b.BaseRenderLayer=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.serviceRegistry=new Map;b.getServiceDependencies=function(a){return a.di$dependencies||[]};b.createDecorator=function(a){function c(a,b,d){if(3!==arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");var e=c;a.di$target===a?
a.di$dependencies.push({id:e,index:d}):(a.di$dependencies=[{id:e,index:d}],a.di$target=a)}return b.serviceRegistry.has(a)?b.serviceRegistry.get(a):(c.toString=function(){return a},b.serviceRegistry.set(a,c),c)}},function(a,b){function c(a,b,c,d){if(void 0===c&&(c=0),void 0===d&&(d=a.length),c>=a.length)return a;c=(a.length+c)%a.length;for(d=d>=a.length?a.length:(a.length+d)%a.length;c<d;++c)a[c]=b;return a}Object.defineProperty(b,"__esModule",{value:!0});b.fill=function(a,b,d,h){return a.fill?a.fill(b,
d,h):c(a,b,d,h)};b.fillFallback=c;b.concat=function(a,b){var c=new a.constructor(a.length+b.length);return c.set(a),c.set(b,a.length),c}},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(8),g=d(3),f=d(5);a=d(6);b.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);a=function(){function a(a,b,c){void 0===c&&(c=!1);this.isWrapped=c;this._combined={};this._data=new Uint32Array(3*a);b=b||f.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]);for(c=0;c<
a;++c)this.setCell(c,b);this.length=a}return a.prototype.get=function(a){var b=this._data[3*a],d=2097151&b;return[this._data[3*a+1],2097152&b?this._combined[a]:d?c.stringFromCodePoint(d):"",b>>22,2097152&b?this._combined[a].charCodeAt(this._combined[a].length-1):d]},a.prototype.set=function(a,b){this._data[3*a+1]=b[g.CHAR_DATA_ATTR_INDEX];1<b[g.CHAR_DATA_CHAR_INDEX].length?(this._combined[a]=b[1],this._data[3*a]=2097152|a|b[g.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a]=b[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|
b[g.CHAR_DATA_WIDTH_INDEX]<<22},a.prototype.getWidth=function(a){return this._data[3*a]>>22},a.prototype.hasWidth=function(a){return 12582912&this._data[3*a]},a.prototype.getFg=function(a){return this._data[3*a+1]},a.prototype.getBg=function(a){return this._data[3*a+2]},a.prototype.hasContent=function(a){return 4194303&this._data[3*a]},a.prototype.getCodePoint=function(a){var b=this._data[3*a];return 2097152&b?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&b},a.prototype.isCombined=
function(a){return 2097152&this._data[3*a]},a.prototype.getString=function(a){var b=this._data[3*a];return 2097152&b?this._combined[a]:2097151&b?c.stringFromCodePoint(2097151&b):""},a.prototype.loadCell=function(a,b){var c=3*a;return b.content=this._data[c+0],b.fg=this._data[c+1],b.bg=this._data[c+2],2097152&b.content&&(b.combinedData=this._combined[a]),b},a.prototype.setCell=function(a,b){2097152&b.content&&(this._combined[a]=b.combinedData);this._data[3*a]=b.content;this._data[3*a+1]=b.fg;this._data[3*
a+2]=b.bg},a.prototype.setCellFromCodePoint=function(a,b,c,d,e){this._data[3*a]=b|c<<22;this._data[3*a+1]=d;this._data[3*a+2]=e},a.prototype.addCodepointToCell=function(a,b){var d=this._data[3*a];2097152&d?this._combined[a]+=c.stringFromCodePoint(b):(2097151&d?(this._combined[a]=c.stringFromCodePoint(2097151&d)+c.stringFromCodePoint(b),d&=-2097152,d|=2097152):d=b|4194304,this._data[3*a]=d)},a.prototype.insertCells=function(a,b,c){if(a%=this.length,b<this.length-a){for(var d=new f.CellData,e=this.length-
a-b-1;0<=e;--e)this.setCell(a+b+e,this.loadCell(a+e,d));for(e=0;e<b;++e)this.setCell(a+e,c)}else for(e=a;e<this.length;++e)this.setCell(e,c)},a.prototype.deleteCells=function(a,b,c){if(a%=this.length,b<this.length-a){for(var d=new f.CellData,e=0;e<this.length-a-b;++e)this.setCell(a+e,this.loadCell(a+b+e,d));e=this.length-b}else e=a;for(;e<this.length;++e)this.setCell(e,c)},a.prototype.replaceCells=function(a,b,c){for(;a<b&&a<this.length;)this.setCell(a++,c)},a.prototype.resize=function(a,b){if(a!==
this.length){if(a>this.length){var c=new Uint32Array(3*a);this.length&&(3*a<this._data.length?c.set(this._data.subarray(0,3*a)):c.set(this._data));this._data=c;for(c=this.length;c<a;++c)this.setCell(c,b)}else if(a)for((c=new Uint32Array(3*a)).set(this._data.subarray(0,3*a)),this._data=c,b=Object.keys(this._combined),c=0;c<b.length;c++){var d=parseInt(b[c],10);d>=a&&delete this._combined[d]}else this._data=new Uint32Array(0),this._combined={};this.length=a}},a.prototype.fill=function(a){this._combined=
{};for(var b=0;b<this.length;++b)this.setCell(b,a)},a.prototype.copyFrom=function(a){for(var b in this.length!==a.length?this._data=new Uint32Array(a._data):this._data.set(a._data),this.length=a.length,this._combined={},a._combined)this._combined[b]=a._combined[b];this.isWrapped=a.isWrapped},a.prototype.clone=function(){var b=new a(0),c;for(c in b._data=new Uint32Array(this._data),b.length=this.length,this._combined)b._combined[c]=this._combined[c];return b.isWrapped=this.isWrapped,b},a.prototype.getTrimmedLength=
function(){for(var a=this.length-1;0<=a;--a)if(4194303&this._data[3*a])return a+(this._data[3*a]>>22);return 0},a.prototype.copyCellsFrom=function(a,b,c,d,e){var g=a._data;if(e)for(var f=d-1;0<=f;f--)for(e=0;3>e;e++)this._data[3*(c+f)+e]=g[3*(b+f)+e];else for(f=0;f<d;f++)for(e=0;3>e;e++)this._data[3*(c+f)+e]=g[3*(b+f)+e];d=Object.keys(a._combined);for(e=0;e<d.length;e++)g=parseInt(d[e],10),g>=b&&(this._combined[g-b+c]=a._combined[g])},a.prototype.translateToString=function(a,b,d){void 0===a&&(a=!1);
void 0===b&&(b=0);void 0===d&&(d=this.length);a&&(d=Math.min(d,this.getTrimmedLength()));for(a="";b<d;){var e=this._data[3*b],f=2097151&e;a+=2097152&e?this._combined[b]:f?c.stringFromCodePoint(f):g.WHITESPACE_CELL_CHAR;b+=e>>22||1}return a},a}();b.BufferLine=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.promptLabel="Terminal input";b.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});
b.CHARSETS={};b.DEFAULT_CHARSET=b.CHARSETS.B;b.CHARSETS[0]={"`":"\u25c6",a:"\u2592",b:"\t",c:"\f",d:"\r",e:"\n",f:"\u00b0",g:"\u00b1",h:"\u2424",i:"\v",j:"\u2518",k:"\u2510",l:"\u250c",m:"\u2514",n:"\u253c",o:"\u23ba",p:"\u23bb",q:"\u2500",r:"\u23bc",s:"\u23bd",t:"\u251c",u:"\u2524",v:"\u2534",w:"\u252c",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03c0","|":"\u2260","}":"\u00a3","~":"\u00b7"};b.CHARSETS.A={"#":"\u00a3"};b.CHARSETS.B=null;b.CHARSETS[4]={"#":"\u00a3","@":"\u00be","[":"ij","\\":"\u00bd",
"]":"|","{":"\u00a8","|":"f","}":"\u00bc","~":"\u00b4"};b.CHARSETS.C=b.CHARSETS[5]={"[":"\u00c4","\\":"\u00d6","]":"\u00c5","^":"\u00dc","`":"\u00e9","{":"\u00e4","|":"\u00f6","}":"\u00e5","~":"\u00fc"};b.CHARSETS.R={"#":"\u00a3","@":"\u00e0","[":"\u00b0","\\":"\u00e7","]":"\u00a7","{":"\u00e9","|":"\u00f9","}":"\u00e8","~":"\u00a8"};b.CHARSETS.Q={"@":"\u00e0","[":"\u00e2","\\":"\u00e7","]":"\u00ea","^":"\u00ee","`":"\u00f4","{":"\u00e9","|":"\u00f9","}":"\u00e8","~":"\u00fb"};b.CHARSETS.K={"@":"\u00a7",
"[":"\u00c4","\\":"\u00d6","]":"\u00dc","{":"\u00e4","|":"\u00f6","}":"\u00fc","~":"\u00df"};b.CHARSETS.Y={"#":"\u00a3","@":"\u00a7","[":"\u00b0","\\":"\u00e7","]":"\u00e9","`":"\u00f9","{":"\u00e0","|":"\u00f2","}":"\u00e8","~":"\u00ec"};b.CHARSETS.E=b.CHARSETS[6]={"@":"\u00c4","[":"\u00c6","\\":"\u00d8","]":"\u00c5","^":"\u00dc","`":"\u00e4","{":"\u00e6","|":"\u00f8","}":"\u00e5","~":"\u00fc"};b.CHARSETS.Z={"#":"\u00a3","@":"\u00a7","[":"\u00a1","\\":"\u00d1","]":"\u00bf","{":"\u00b0","|":"\u00f1",
"}":"\u00e7"};b.CHARSETS.H=b.CHARSETS[7]={"@":"\u00c9","[":"\u00c4","\\":"\u00d6","]":"\u00c5","^":"\u00dc","`":"\u00e9","{":"\u00e4","|":"\u00f6","}":"\u00e5","~":"\u00fc"};b.CHARSETS["="]={"#":"\u00f9","@":"\u00e0","[":"\u00e9","\\":"\u00e7","]":"\u00ea","^":"\u00ee",_:"\u00e8","`":"\u00f4","{":"\u00e4","|":"\u00f6","}":"\u00fc","~":"\u00fb"}},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(15);b.wcwidth=function(a){var b=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,
1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,
2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,
4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],
d=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],e=0|a.control,g=new Uint8Array(65536);c.fill(g,1);g[0]=a.nul;c.fill(g,a.control,1,32);c.fill(g,a.control,127,160);c.fill(g,2,4352,4448);g[9001]=2;g[9002]=2;c.fill(g,2,11904,42192);g[12351]=1;c.fill(g,2,44032,55204);c.fill(g,2,63744,64256);c.fill(g,2,65040,65050);c.fill(g,2,65072,65136);c.fill(g,2,65280,
65377);c.fill(g,2,65504,65511);for(a=0;a<b.length;++a)c.fill(g,0,b[a][0],b[a][1]+1);return function(a){if(32>a)a=0|e;else if(127>a)a=1;else if(65536>a)a=g[a];else{a:{var b=a;var c,f=0,q=d.length-1;if(!(b<d[0][0]||b>d[q][1]))for(;q>=f;)if(b>d[c=f+q>>1][1])f=c+1;else{if(!(b<d[c][0])){b=!0;break a}q=c-1}b=!1}a=b?0:131072<=a&&196605>=a||196608<=a&&262141>=a?2:1}return a}}({nul:0,control:0});b.getStringCellWidth=function(a){for(var c=0,d=a.length,e=0;e<d;++e){var g=a.charCodeAt(e);if(55296<=g&&56319>=
g){if(++e>=d)return c+b.wcwidth(g);var q=a.charCodeAt(e);56320<=q&&57343>=q?g=1024*(g-55296)+q-56320+65536:c+=b.wcwidth(q)}c+=b.wcwidth(g)}return c}},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(a,b){if(void 0===a&&(a=32),void 0===b&&(b=32),this.maxLength=a,this.maxSubParamsLength=b,256<b)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a);this.length=0;this._subParams=new Int32Array(b);this._subParamsLength=0;this._subParamsIdx=
new Uint16Array(a);this._digitIsSub=this._rejectSubDigits=this._rejectDigits=!1}return a.fromArray=function(b){var c=new a;if(!b.length)return c;for(var d=b[0]instanceof Array?1:0;d<b.length;++d){var e=b[d];if(e instanceof Array)for(var k=0;k<e.length;++k)c.addSubParam(e[k]);else c.addParam(e)}return c},a.prototype.clone=function(){var b=new a(this.maxLength,this.maxSubParamsLength);return b.params.set(this.params),b.length=this.length,b._subParams.set(this._subParams),b._subParamsLength=this._subParamsLength,
b._subParamsIdx.set(this._subParamsIdx),b._rejectDigits=this._rejectDigits,b._rejectSubDigits=this._rejectSubDigits,b._digitIsSub=this._digitIsSub,b},a.prototype.toArray=function(){for(var a=[],b=0;b<this.length;++b){a.push(this.params[b]);var c=this._subParamsIdx[b]>>8,d=255&this._subParamsIdx[b];0<d-c&&a.push(Array.prototype.slice.call(this._subParams,c,d))}return a},a.prototype.reset=function(){this._subParamsLength=this.length=0;this._digitIsSub=this._rejectSubDigits=this._rejectDigits=!1},a.prototype.addParam=
function(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(-1>a)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength;this.params[this.length++]=2147483647<a?2147483647:a}},a.prototype.addSubParam=function(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(-1>a)throw Error("values lesser than -1 are not allowed");
this._subParams[this._subParamsLength++]=2147483647<a?2147483647:a;this._subParamsIdx[this.length-1]++}},a.prototype.hasSubParams=function(a){return 0<(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)},a.prototype.getSubParams=function(a){var b=this._subParamsIdx[a]>>8;a=255&this._subParamsIdx[a];return 0<a-b?this._subParams.subarray(b,a):null},a.prototype.getSubParamsAll=function(){for(var a={},b=0;b<this.length;++b){var c=this._subParamsIdx[b]>>8,d=255&this._subParamsIdx[b];0<d-c&&(a[b]=this._subParams.slice(c,
d))}return a},a.prototype.addDigit=function(a){var b;if(!(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var c=this._digitIsSub?this._subParams:this.params,d=c[b-1];c[b-1]=~d?Math.min(10*d+a,2147483647):a}},a}();b.Params=a},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(22),g=d(8);a=function(){function a(){this._state=0;this._id=-1;this._handlers=Object.create(null);this._handlerFb=function(){}}return a.prototype.addHandler=
function(a,b){void 0===this._handlers[a]&&(this._handlers[a]=[]);var c=this._handlers[a];return c.push(b),{dispose:function(){var a=c.indexOf(b);-1!==a&&c.splice(a,1)}}},a.prototype.setHandler=function(a,b){this._handlers[a]=[b]},a.prototype.clearHandler=function(a){this._handlers[a]&&delete this._handlers[a]},a.prototype.setHandlerFallback=function(a){this._handlerFb=a},a.prototype.dispose=function(){this._handlers=Object.create(null);this._handlerFb=function(){}},a.prototype.reset=function(){2===
this._state&&this.end(!1);this._id=-1;this._state=0},a.prototype._start=function(){var a=this._handlers[this._id];if(a)for(var b=a.length-1;0<=b;b--)a[b].start();else this._handlerFb(this._id,"START")},a.prototype._put=function(a,b,c){var d=this._handlers[this._id];if(d)for(var e=d.length-1;0<=e;e--)d[e].put(a,b,c);else this._handlerFb(this._id,"PUT",g.utf32ToString(a,b,c))},a.prototype._end=function(a){var b=this._handlers[this._id];if(b){for(var c=b.length-1;0<=c&&!1===b[c].end(a);c--);for(c--;0<=
c;c--)b[c].end(!1)}else this._handlerFb(this._id,"END",a)},a.prototype.start=function(){this.reset();this._id=-1;this._state=1},a.prototype.put=function(a,b,c){if(3!==this._state){if(1===this._state)for(;b<c;){var d=a[b++];if(59===d){this._state=2;this._start();break}if(48>d||57<d)return void(this._state=3);-1===this._id&&(this._id=0);this._id=10*this._id+d-48}2===this._state&&0<c-b&&this._put(a,b,c)}},a.prototype.end=function(a){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),
this._end(a)),this._id=-1,this._state=0)},a}();b.OscParser=a;a=function(){function a(a){this._handler=a;this._data="";this._hitLimit=!1}return a.prototype.start=function(){this._data="";this._hitLimit=!1},a.prototype.put=function(a,b,d){this._hitLimit||(this._data+=g.utf32ToString(a,b,d),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},a.prototype.end=function(a){var b;return this._hitLimit?b=!1:a&&(b=this._handler(this._data)),this._data="",this._hitLimit=!1,b},a}();b.OscHandler=
a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.PAYLOAD_LIMIT=1E7},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(8),g=d(20),f=d(22),h=[];a=function(){function a(){this._handlers=Object.create(null);this._active=h;this._ident=0;this._handlerFb=function(){}}return a.prototype.dispose=function(){this._handlers=Object.create(null);this._handlerFb=function(){}},a.prototype.addHandler=function(a,b){void 0===this._handlers[a]&&(this._handlers[a]=[]);var c=this._handlers[a];
return c.push(b),{dispose:function(){var a=c.indexOf(b);-1!==a&&c.splice(a,1)}}},a.prototype.setHandler=function(a,b){this._handlers[a]=[b]},a.prototype.clearHandler=function(a){this._handlers[a]&&delete this._handlers[a]},a.prototype.setHandlerFallback=function(a){this._handlerFb=a},a.prototype.reset=function(){this._active.length&&this.unhook(!1);this._active=h;this._ident=0},a.prototype.hook=function(a,b){if(this.reset(),this._ident=a,this._active=this._handlers[a]||h,this._active.length)for(a=
this._active.length-1;0<=a;a--)this._active[a].hook(b);else this._handlerFb(this._ident,"HOOK",b)},a.prototype.put=function(a,b,d){if(this._active.length)for(var e=this._active.length-1;0<=e;e--)this._active[e].put(a,b,d);else this._handlerFb(this._ident,"PUT",c.utf32ToString(a,b,d))},a.prototype.unhook=function(a){if(this._active.length){for(var b=this._active.length-1;0<=b&&!1===this._active[b].unhook(a);b--);for(b--;0<=b;b--)this._active[b].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",
a);this._active=h;this._ident=0},a}();b.DcsParser=a;a=function(){function a(a){this._handler=a;this._data="";this._hitLimit=!1}return a.prototype.hook=function(a){this._params=a.clone();this._data="";this._hitLimit=!1},a.prototype.put=function(a,b,d){this._hitLimit||(this._data+=c.utf32ToString(a,b,d),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},a.prototype.unhook=function(a){var b;return this._hitLimit?b=!1:a&&(b=this._handler(this._data,this._params?this._params:new g.Params)),
this._params=void 0,this._data="",this._hitLimit=!1,b},a}();b.DcsHandler=a},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(25),g=d(43),f=[];b.acquireCharAtlas=function(a,b,d,e,t){a=c.generateConfig(e,t,a,d);for(d=0;d<f.length;d++)if(e=(t=f[d]).ownedBy.indexOf(b),0<=e){if(c.configEquals(t.config,a))return t.atlas;1===t.ownedBy.length?(t.atlas.dispose(),f.splice(d,1)):t.ownedBy.splice(e,1);break}for(d=0;d<f.length;d++)if(t=f[d],c.configEquals(t.config,a))return t.ownedBy.push(b),
t.atlas;b={atlas:new g.DynamicCharAtlas(document,a),config:a,ownedBy:[b]};return f.push(b),b.atlas};b.removeTerminalFromCache=function(a){for(var b=0;b<f.length;b++){var c=f[b].ownedBy.indexOf(a);if(-1!==c){1===f[b].ownedBy.length?(f[b].atlas.dispose(),f.splice(b,1)):f[b].ownedBy.splice(c,1);break}}}},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(3);b.generateConfig=function(a,b,c,d){d={foreground:d.foreground,background:d.background,cursor:void 0,cursorAccent:void 0,selection:void 0,
ansi:d.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:a,scaledCharHeight:b,fontFamily:c.fontFamily,fontSize:c.fontSize,fontWeight:c.fontWeight,fontWeightBold:c.fontWeightBold,allowTransparency:c.allowTransparency,colors:d}};b.configEquals=function(a,b){for(var c=0;c<a.colors.ansi.length;c++)if(a.colors.ansi[c].rgba!==b.colors.ansi[c].rgba)return!1;return a.devicePixelRatio===b.devicePixelRatio&&a.fontFamily===b.fontFamily&&a.fontSize===b.fontSize&&a.fontWeight===
b.fontWeight&&a.fontWeightBold===b.fontWeightBold&&a.allowTransparency===b.allowTransparency&&a.scaledCharWidth===b.scaledCharWidth&&a.scaledCharHeight===b.scaledCharHeight&&a.colors.foreground===b.colors.foreground&&a.colors.background===b.colors.background};b.is256Color=function(a){return a<c.DEFAULT_COLOR}},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(10),g=d(45),f=c.fromCss("#ffffff"),h=c.fromCss("#000000"),k=c.fromCss("#ffffff"),r=c.fromCss("#000000"),q={css:"rgba(255, 255, 255, 0.3)",
rgba:4294967117};b.DEFAULT_ANSI_COLORS=function(){for(var a=[c.fromCss("#2e3436"),c.fromCss("#cc0000"),c.fromCss("#4e9a06"),c.fromCss("#c4a000"),c.fromCss("#3465a4"),c.fromCss("#75507b"),c.fromCss("#06989a"),c.fromCss("#d3d7cf"),c.fromCss("#555753"),c.fromCss("#ef2929"),c.fromCss("#8ae234"),c.fromCss("#fce94f"),c.fromCss("#729fcf"),c.fromCss("#ad7fa8"),c.fromCss("#34e2e2"),c.fromCss("#eeeeec")],b=[0,95,135,175,215,255],d=0;216>d;d++){var e=b[d/36%6|0],g=b[d/6%6|0],f=b[d%6];a.push({css:c.toCss(e,g,
f),rgba:c.toRgba(e,g,f)})}for(d=0;24>d;d++)b=8+10*d,a.push({css:c.toCss(b,b,b),rgba:c.toRgba(b,b,b)});return a}();a=function(){function a(a,d){this.allowTransparency=d;a=a.createElement("canvas");a.width=1;a.height=1;a=a.getContext("2d");if(!a)throw Error("Could not get rendering context");this._ctx=a;this._ctx.globalCompositeOperation="copy";this._litmusColor=this._ctx.createLinearGradient(0,0,1,1);this._contrastCache=new g.ColorContrastCache;this.colors={foreground:f,background:h,cursor:k,cursorAccent:r,
selection:q,selectionOpaque:c.blend(h,q),ansi:b.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return a.prototype.onOptionsChange=function(a){"minimumContrastRatio"===a&&this._contrastCache.clear()},a.prototype.setTheme=function(a){void 0===a&&(a={});this.colors.foreground=this._parseColor(a.foreground,f);this.colors.background=this._parseColor(a.background,h);this.colors.cursor=this._parseColor(a.cursor,k,!0);this.colors.cursorAccent=this._parseColor(a.cursorAccent,r,!0);this.colors.selection=
this._parseColor(a.selection,q,!0);this.colors.selectionOpaque=c.blend(this.colors.background,this.colors.selection);this.colors.ansi[0]=this._parseColor(a.black,b.DEFAULT_ANSI_COLORS[0]);this.colors.ansi[1]=this._parseColor(a.red,b.DEFAULT_ANSI_COLORS[1]);this.colors.ansi[2]=this._parseColor(a.green,b.DEFAULT_ANSI_COLORS[2]);this.colors.ansi[3]=this._parseColor(a.yellow,b.DEFAULT_ANSI_COLORS[3]);this.colors.ansi[4]=this._parseColor(a.blue,b.DEFAULT_ANSI_COLORS[4]);this.colors.ansi[5]=this._parseColor(a.magenta,
b.DEFAULT_ANSI_COLORS[5]);this.colors.ansi[6]=this._parseColor(a.cyan,b.DEFAULT_ANSI_COLORS[6]);this.colors.ansi[7]=this._parseColor(a.white,b.DEFAULT_ANSI_COLORS[7]);this.colors.ansi[8]=this._parseColor(a.brightBlack,b.DEFAULT_ANSI_COLORS[8]);this.colors.ansi[9]=this._parseColor(a.brightRed,b.DEFAULT_ANSI_COLORS[9]);this.colors.ansi[10]=this._parseColor(a.brightGreen,b.DEFAULT_ANSI_COLORS[10]);this.colors.ansi[11]=this._parseColor(a.brightYellow,b.DEFAULT_ANSI_COLORS[11]);this.colors.ansi[12]=this._parseColor(a.brightBlue,
b.DEFAULT_ANSI_COLORS[12]);this.colors.ansi[13]=this._parseColor(a.brightMagenta,b.DEFAULT_ANSI_COLORS[13]);this.colors.ansi[14]=this._parseColor(a.brightCyan,b.DEFAULT_ANSI_COLORS[14]);this.colors.ansi[15]=this._parseColor(a.brightWhite,b.DEFAULT_ANSI_COLORS[15]);this._contrastCache.clear()},a.prototype._parseColor=function(a,b,d){if(void 0===d&&(d=this.allowTransparency),void 0===a)return b;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=a,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+
a+" is invalid using fallback "+b.css),b;this._ctx.fillRect(0,0,1,1);var e=this._ctx.getImageData(0,0,1,1).data;if(255!==e[3]){if(!d)return console.warn("Color: "+a+" is using transparency, but allowTransparency is false. Using fallback "+b.css+"."),b;if(5===a.length){e=parseInt(a.substr(1),16);a=16*(e>>12&15);b=16*(e>>8&15);d=16*(e>>4&15);e=16*(15&e);var g=c.toRgba(a,b,d,e)}else a=(g=parseInt(a.substr(1),16))>>24&255,b=g>>16&255,d=g>>8&255,e=255&g;return{rgba:g,css:c.toCss(a,b,d,e)}}return{css:a,
rgba:c.toRgba(e[0],e[1],e[2],e[3])}},a}();b.ColorManager=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.throwIfFalsy=function(a){if(!a)throw Error("value must not be falsy");return a}},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===
b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});a=d(6);var f=d(3),h=d(5);d=function(a){function b(b,c,d){var e=a.call(this)||this;return e.content=0,e.fg=b.fg,e.bg=b.bg,e.combinedData=c,e._width=d,e}return g(b,a),b.prototype.isCombined=function(){return 2097152},b.prototype.getWidth=function(){return this._width},b.prototype.getChars=function(){return this.combinedData},b.prototype.getCode=function(){return 2097151},b.prototype.setFromCharData=
function(){throw Error("not implemented");},b.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},b}(a.AttributeData);b.JoinedCellData=d;d=function(){function a(a){this._bufferService=a;this._characterJoiners=[];this._nextCharacterJoinerId=0;this._workCell=new h.CellData}return a.prototype.registerCharacterJoiner=function(a){a={id:this._nextCharacterJoinerId++,handler:a};return this._characterJoiners.push(a),a.id},a.prototype.deregisterCharacterJoiner=
function(a){for(var b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===a)return this._characterJoiners.splice(b,1),!0;return!1},a.prototype.getJoinedCharacters=function(a){if(0===this._characterJoiners.length)return[];a=this._bufferService.buffer.lines.get(a);if(!a||0===a.length)return[];for(var b=[],c=a.translateToString(!0),d=0,e=0,g=0,k=a.getFg(0),h=a.getBg(0),r=0;r<a.getTrimmedLength();r++)if(a.loadCell(r,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==
k||this._workCell.bg!==h){if(1<r-d)for(d=this._getJoinedRanges(c,g,e,a,d),g=0;g<d.length;g++)b.push(d[g]);d=r;g=e;k=this._workCell.fg;h=this._workCell.bg}e+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(1<this._bufferService.cols-d)for(d=this._getJoinedRanges(c,g,e,a,d),g=0;g<d.length;g++)b.push(d[g]);return b},a.prototype._getJoinedRanges=function(b,c,d,e,g){b=b.substring(c,d);c=this._characterJoiners[0].handler(b);for(d=1;d<this._characterJoiners.length;d++)for(var f=this._characterJoiners[d].handler(b),
l=0;l<f.length;l++)a._mergeRanges(c,f[l]);return this._stringRangesToCellRanges(c,e,g),c},a.prototype._stringRangesToCellRanges=function(a,b,c){var d=0,e=!1,g=0,q=a[d];if(q){for(;c<this._bufferService.cols;c++){var t=b.getWidth(c),k=b.getString(c).length||f.WHITESPACE_CELL_CHAR.length;if(0!==t){if(!e&&q[0]<=g&&(q[0]=c,e=!0),q[1]<=g){if(q[1]=c,!(q=a[++d]))break;q[0]<=g?(q[0]=c,e=!0):e=!1}g+=k}}q&&(q[1]=this._bufferService.cols)}},a._mergeRanges=function(a,b){for(var c=!1,d=0;d<a.length;d++){var e=
a[d];if(c){if(b[1]<=e[0])return a[d-1][1]=b[1],a;if(b[1]<=e[1])return a[d-1][1]=Math.max(b[1],e[1]),a.splice(d,1),a;a.splice(d,1);d--}else{if(b[1]<=e[0])return a.splice(d,0,b),a;if(b[1]<=e[1])return e[0]=Math.min(b[0],e[0]),a;b[0]<e[1]&&(e[0]=Math.min(b[0],e[0]),c=!0)}}return c?a[a.length-1][1]=b[1]:a.push(b),a},a}();b.CharacterJoinerRegistry=d},function(a,b){function c(a,b){b=b.getBoundingClientRect();return[a.clientX-b.left,a.clientY-b.top]}Object.defineProperty(b,"__esModule",{value:!0});b.getCoordsRelativeToElement=
c;b.getCoords=function(a,b,d,h,k,r,q,t){if(k&&(a=c(a,b)))return a[0]=Math.ceil((a[0]+(t?r/2:0))/r),a[1]=Math.ceil(a[1]/q),a[0]=Math.min(Math.max(a[0],1),d+(t?1:0)),a[1]=Math.min(Math.max(a[1],1),h),a};b.getRawByteCoords=function(a){if(a)return{x:a[0]+32,y:a[1]+32}}},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(a){this._renderCallback=a}return a.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=
void 0)},a.prototype.refresh=function(a,b,c){var d=this;this._rowCount=c;a=void 0!==a?a:0;b=void 0!==b?b:this._rowCount-1;this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,a):a;this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,b):b;this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return d._innerRefresh()}))},a.prototype._innerRefresh=function(){void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount&&(this._rowStart=Math.max(this._rowStart,
0),this._rowEnd=Math.min(this._rowEnd,this._rowCount-1),this._renderCallback(this._rowStart,this._rowEnd),this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0)},a}();b.RenderDebouncer=a},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===
b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});a=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b._currentDevicePixelRatio=window.devicePixelRatio,b}return g(b,a),b.prototype.setListener=function(a){var b=this;this._listener&&this.clearListener();this._listener=a;this._outerListener=function(){b._listener&&(b._listener(window.devicePixelRatio,b._currentDevicePixelRatio),b._updateDpr())};this._updateDpr()},b.prototype.dispose=
function(){a.prototype.dispose.call(this);this.clearListener()},b.prototype._updateDpr=function(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},b.prototype.clearListener=function(){this._resolutionMediaMatchList&&
this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},b}(d(2).Disposable);b.ScreenDprMonitor=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});b.clone=function f(a,b){if(void 0===b&&(b=5),"object"!=typeof a)return a;var c=Array.isArray(a)?[]:{},e;for(e in a)c[e]=1>=b?a[e]:a[e]?f(a[e],b-1):a[e];return c}},function(a,b,d){Object.defineProperty(b,
"__esModule",{value:!0});var c=d(34),g=d(17),f=d(78);a=function(){function a(a){this._core=new c.Terminal(a);this._addonManager=new f.AddonManager}return Object.defineProperty(a.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},
enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onData",{get:function(){return this._core.onData},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!0,
configurable:!0}),Object.defineProperty(a.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"element",{get:function(){return this._core.element},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,
"parser",{get:function(){return this._parser||(this._parser=new q(this._core)),this._parser},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"rows",{get:function(){return this._core.rows},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"cols",{get:function(){return this._core.cols},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,
"buffer",{get:function(){return new h(this._core.buffer)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"markers",{get:function(){return this._core.markers},enumerable:!0,configurable:!0}),a.prototype.blur=function(){this._core.blur()},a.prototype.focus=function(){this._core.focus()},a.prototype.resize=function(a,b){this._verifyIntegers(a,b);this._core.resize(a,b)},a.prototype.open=function(a){this._core.open(a)},a.prototype.attachCustomKeyEventHandler=function(a){this._core.attachCustomKeyEventHandler(a)},
a.prototype.registerLinkMatcher=function(a,b,c){return this._core.registerLinkMatcher(a,b,c)},a.prototype.deregisterLinkMatcher=function(a){this._core.deregisterLinkMatcher(a)},a.prototype.registerCharacterJoiner=function(a){return this._core.registerCharacterJoiner(a)},a.prototype.deregisterCharacterJoiner=function(a){this._core.deregisterCharacterJoiner(a)},a.prototype.addMarker=function(a){return this._verifyIntegers(a),this._core.addMarker(a)},a.prototype.hasSelection=function(){return this._core.hasSelection()},
a.prototype.select=function(a,b,c){this._verifyIntegers(a,b,c);this._core.select(a,b,c)},a.prototype.getSelection=function(){return this._core.getSelection()},a.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},a.prototype.clearSelection=function(){this._core.clearSelection()},a.prototype.selectAll=function(){this._core.selectAll()},a.prototype.selectLines=function(a,b){this._verifyIntegers(a,b);this._core.selectLines(a,b)},a.prototype.dispose=function(){this._addonManager.dispose();
this._core.dispose()},a.prototype.scrollLines=function(a){this._verifyIntegers(a);this._core.scrollLines(a)},a.prototype.scrollPages=function(a){this._verifyIntegers(a);this._core.scrollPages(a)},a.prototype.scrollToTop=function(){this._core.scrollToTop()},a.prototype.scrollToBottom=function(){this._core.scrollToBottom()},a.prototype.scrollToLine=function(a){this._verifyIntegers(a);this._core.scrollToLine(a)},a.prototype.clear=function(){this._core.clear()},a.prototype.write=function(a,b){this._core.write(a,
b)},a.prototype.writeUtf8=function(a,b){this._core.write(a,b)},a.prototype.writeln=function(a,b){this._core.write(a);this._core.write("\r\n",b)},a.prototype.paste=function(a){this._core.paste(a)},a.prototype.getOption=function(a){return this._core.optionsService.getOption(a)},a.prototype.setOption=function(a,b){this._core.optionsService.setOption(a,b)},a.prototype.refresh=function(a,b){this._verifyIntegers(a,b);this._core.refresh(a,b)},a.prototype.reset=function(){this._core.reset()},a.prototype.loadAddon=
function(a){return this._addonManager.loadAddon(this,a)},Object.defineProperty(a,"strings",{get:function(){return g},enumerable:!0,configurable:!0}),a.prototype._verifyIntegers=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];a.forEach(function(a){if(a===1/0||isNaN(a)||0!=a%1)throw Error("This API only accepts integers");})},a}();b.Terminal=a;var h=function(){function a(a){this._buffer=a}return Object.defineProperty(a.prototype,"cursorY",{get:function(){return this._buffer.y},
enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!0,configurable:!0}),
a.prototype.getLine=function(a){if(a=this._buffer.lines.get(a))return new k(a)},a}(),k=function(){function a(a){this._line=a}return Object.defineProperty(a.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!0,configurable:!0}),a.prototype.getCell=function(a){if(!(0>a||a>=this._line.length))return new r(this._line,a)},a.prototype.translateToString=function(a,b,c){return this._line.translateToString(a,b,c)},a}(),r=function(){function a(a,b){this._line=a;this._x=b}return Object.defineProperty(a.prototype,
"char",{get:function(){return this._line.getString(this._x)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"width",{get:function(){return this._line.getWidth(this._x)},enumerable:!0,configurable:!0}),a}(),q=function(){function a(a){this._core=a}return a.prototype.addCsiHandler=function(a,b){return this._core.addCsiHandler(a,function(a){return b(a.toArray())})},a.prototype.addDcsHandler=function(a,b){return this._core.addDcsHandler(a,function(a,c){return b(a,c.toArray())})},a.prototype.addEscHandler=
function(a,b){return this._core.addEscHandler(a,b)},a.prototype.addOscHandler=function(a,b){return this._core.addOscHandler(a,b)},a}()},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,
"__esModule",{value:!0});var f=d(35),h=d(36),k=d(37),r=d(12),q=d(38),t=d(40),v=d(50),l=d(51),n=d(11),y=d(7),B=d(17),O=d(54),X=d(55),M=d(56),ha=d(57),R=d(59),C=d(1),H=d(16),qa=d(60),V=d(26),ra=d(61),I=d(0),sa=d(62),ta=d(4),ja=d(63),Fa=d(64);a=d(2);var Sa=d(70),xa=d(71),ma=d(72),P=d(73),ya=d(74),ua=d(75),J=d(76),G=d(77),da="undefined"!=typeof window?window.document:null;d=function(a){function b(b){void 0===b&&(b={});var c=a.call(this)||this;return c.browser=n,c.mouseEvents=0,c._keyDownHandled=!1,c._blankLine=
null,c._onCursorMove=new C.EventEmitter,c._onData=new C.EventEmitter,c._onBinary=new C.EventEmitter,c._onKey=new C.EventEmitter,c._onLineFeed=new C.EventEmitter,c._onRender=new C.EventEmitter,c._onResize=new C.EventEmitter,c._onScroll=new C.EventEmitter,c._onSelectionChange=new C.EventEmitter,c._onTitleChange=new C.EventEmitter,c._onFocus=new C.EventEmitter,c._onBlur=new C.EventEmitter,c.onA11yCharEmitter=new C.EventEmitter,c.onA11yTabEmitter=new C.EventEmitter,c._instantiationService=new ya.InstantiationService,
c.optionsService=new sa.OptionsService(b),c._instantiationService.setService(I.IOptionsService,c.optionsService),c._bufferService=c._instantiationService.createInstance(Fa.BufferService),c._instantiationService.setService(I.IBufferService,c._bufferService),c._logService=c._instantiationService.createInstance(ma.LogService),c._instantiationService.setService(I.ILogService,c._logService),c._coreService=c._instantiationService.createInstance(xa.CoreService,function(){return c.scrollToBottom()}),c._instantiationService.setService(I.ICoreService,
c._coreService),c._coreService.onData(function(a){return c._onData.fire(a)}),c._coreService.onBinary(function(a){return c._onBinary.fire(a)}),c._coreMouseService=c._instantiationService.createInstance(ua.CoreMouseService),c._instantiationService.setService(I.ICoreMouseService,c._coreMouseService),c._dirtyRowService=c._instantiationService.createInstance(P.DirtyRowService),c._instantiationService.setService(I.IDirtyRowService,c._dirtyRowService),c._setupOptionsListeners(),c._setup(),c._writeBuffer=
new J.WriteBuffer(function(a){return c._inputHandler.parse(a)}),c}return g(b,a),Object.defineProperty(b.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onCursorMove",
{get:function(){return this._onCursorMove.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onData",{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},
enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},
enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onA11yChar",{get:function(){return this.onA11yCharEmitter.event},
enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onA11yTab",{get:function(){return this.onA11yTabEmitter.event},enumerable:!0,configurable:!0}),b.prototype.dispose=function(){var b,c,d,e;this._isDisposed||(a.prototype.dispose.call(this),null===(b=this._windowsMode)||void 0===b||b.dispose(),this._windowsMode=void 0,null===(c=this._renderService)||void 0===c||c.dispose(),this._customKeyEventHandler=null,this.write=function(){},null===(e=null===(d=this.element)||void 0===d?void 0:d.parentNode)||
void 0===e||e.removeChild(this.element))},b.prototype._setup=function(){var a=this;this._parent=da?da.body:null;this._customKeyEventHandler=null;this.insertMode=this.originMode=this.applicationKeypad=!1;this.wraparoundMode=!0;this.bracketedPasteMode=!1;this.gcharset=this.charset=null;this.glevel=0;this.charsets=[null];this.curAttrData=H.DEFAULT_ATTR_DATA.clone();this._eraseAttrData=H.DEFAULT_ATTR_DATA.clone();this.params=[];this.currentParam=0;this._userScrolling=!1;this._inputHandler=new q.InputHandler(this,
this._bufferService,this._coreService,this._dirtyRowService,this._logService,this.optionsService,this._coreMouseService);this._inputHandler.onCursorMove(function(){return a._onCursorMove.fire()});this._inputHandler.onLineFeed(function(){return a._onLineFeed.fire()});this.register(this._inputHandler);this.linkifier=this.linkifier||new v.Linkifier(this._bufferService,this._logService);this.options.windowsMode&&this._enableWindowsMode()},b.prototype._enableWindowsMode=function(){this._windowsMode||(this._windowsMode=
this.onLineFeed(qa.handleWindowsModeLineFeed.bind(null,this._bufferService)))},Object.defineProperty(b.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!0,configurable:!0}),b.prototype.eraseAttrData=function(){return this._eraseAttrData.bg&=-67108864,this._eraseAttrData.bg|=67108863&this.curAttrData.bg,this._eraseAttrData},b.prototype.focus=function(){this.textarea&&
this.textarea.focus({preventScroll:!0})},b.prototype._setupOptionsListeners=function(){var a=this;this.optionsService.onOptionChange(function(b){var c,d,e,g,f;switch(b){case "fontFamily":case "fontSize":null===(c=a._renderService)||void 0===c||c.clear();null===(d=a._charSizeService)||void 0===d||d.measure();break;case "drawBoldTextInBrightColors":case "letterSpacing":case "lineHeight":case "fontWeight":case "fontWeightBold":case "minimumContrastRatio":a._renderService&&(a._renderService.clear(),a._renderService.onResize(a.cols,
a.rows),a.refresh(0,a.rows-1));break;case "rendererType":a._renderService&&(a._renderService.setRenderer(a._createRenderer()),a._renderService.onResize(a.cols,a.rows));break;case "scrollback":a.buffers.resize(a.cols,a.rows);null===(e=a.viewport)||void 0===e||e.syncScrollArea();break;case "screenReaderMode":a.optionsService.options.screenReaderMode?!a._accessibilityManager&&a._renderService&&(a._accessibilityManager=new M.AccessibilityManager(a,a._renderService)):(null===(g=a._accessibilityManager)||
void 0===g||g.dispose(),a._accessibilityManager=null);break;case "tabStopWidth":a.buffers.setupTabStops();break;case "theme":a._setTheme(a.optionsService.options.theme);break;case "windowsMode":a.optionsService.options.windowsMode?a._enableWindowsMode():(null===(f=a._windowsMode)||void 0===f||f.dispose(),a._windowsMode=void 0)}})},b.prototype._onTextAreaFocus=function(a){this.sendFocus&&this._coreService.triggerDataEvent(r.C0.ESC+"[I");this.updateCursorStyle(a);this.element.classList.add("focus");
this.showCursor();this._onFocus.fire()},b.prototype.blur=function(){return this.textarea.blur()},b.prototype._onTextAreaBlur=function(){this.textarea.value="";this.refresh(this.buffer.y,this.buffer.y);this.sendFocus&&this._coreService.triggerDataEvent(r.C0.ESC+"[O");this.element.classList.remove("focus");this._onBlur.fire()},b.prototype._initGlobal=function(){function a(a){return k.handlePasteEvent(a,b.textarea,b.bracketedPasteMode,b._coreService)}var b=this;this._bindKeys();this.register(y.addDisposableDomListener(this.element,
"copy",function(a){b.hasSelection()&&k.copyHandler(a,b._selectionService)}));this.register(y.addDisposableDomListener(this.textarea,"paste",a));this.register(y.addDisposableDomListener(this.element,"paste",a));n.isFirefox?this.register(y.addDisposableDomListener(this.element,"mousedown",function(a){2===a.button&&k.rightClickHandler(a,b.textarea,b.screenElement,b._selectionService,b.options.rightClickSelectsWord)})):this.register(y.addDisposableDomListener(this.element,"contextmenu",function(a){k.rightClickHandler(a,
b.textarea,b.screenElement,b._selectionService,b.options.rightClickSelectsWord)}));n.isLinux&&this.register(y.addDisposableDomListener(this.element,"auxclick",function(a){1===a.button&&k.moveTextAreaUnderMouseCursor(a,b.textarea,b.screenElement)}))},b.prototype._bindKeys=function(){var a=this;this.register(y.addDisposableDomListener(this.textarea,"keyup",function(b){return a._keyUp(b)},!0));this.register(y.addDisposableDomListener(this.textarea,"keydown",function(b){return a._keyDown(b)},!0));this.register(y.addDisposableDomListener(this.textarea,
"keypress",function(b){return a._keyPress(b)},!0));this.register(y.addDisposableDomListener(this.textarea,"compositionstart",function(){return a._compositionHelper.compositionstart()}));this.register(y.addDisposableDomListener(this.textarea,"compositionupdate",function(b){return a._compositionHelper.compositionupdate(b)}));this.register(y.addDisposableDomListener(this.textarea,"compositionend",function(){return a._compositionHelper.compositionend()}));this.register(this.onRender(function(){return a._compositionHelper.updateCompositionElements()}));
this.register(this.onRender(function(b){return a._queueLinkification(b.start,b.end)}))},b.prototype.open=function(a){var b=this;if(this._parent=a||this._parent,!this._parent)throw Error("Terminal requires a parent element.");da.body.contains(a)||this._logService.warn("Terminal.open was called on an element that was not attached to the DOM");this._document=this._parent.ownerDocument;this.element=this._document.createElement("div");this.element.dir="ltr";this.element.classList.add("terminal");this.element.classList.add("xterm");
this.element.setAttribute("tabindex","0");this._parent.appendChild(this.element);a=da.createDocumentFragment();this._viewportElement=da.createElement("div");this._viewportElement.classList.add("xterm-viewport");a.appendChild(this._viewportElement);this._viewportScrollArea=da.createElement("div");this._viewportScrollArea.classList.add("xterm-scroll-area");this._viewportElement.appendChild(this._viewportScrollArea);this.screenElement=da.createElement("div");this.screenElement.classList.add("xterm-screen");
this._helperContainer=da.createElement("div");this._helperContainer.classList.add("xterm-helpers");this.screenElement.appendChild(this._helperContainer);a.appendChild(this.screenElement);this.textarea=da.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea");this.textarea.setAttribute("aria-label",B.promptLabel);this.textarea.setAttribute("aria-multiline","false");this.textarea.setAttribute("autocorrect","off");this.textarea.setAttribute("autocapitalize","off");this.textarea.setAttribute("spellcheck",
"false");this.textarea.tabIndex=0;this.register(y.addDisposableDomListener(this.textarea,"focus",function(a){return b._onTextAreaFocus(a)}));this.register(y.addDisposableDomListener(this.textarea,"blur",function(){return b._onTextAreaBlur()}));this._helperContainer.appendChild(this.textarea);var c=this._instantiationService.createInstance(G.CoreBrowserService,this.textarea);this._instantiationService.setService(ta.ICoreBrowserService,c);this._charSizeService=this._instantiationService.createInstance(ja.CharSizeService,
this._document,this._helperContainer);this._instantiationService.setService(ta.ICharSizeService,this._charSizeService);this._compositionView=da.createElement("div");this._compositionView.classList.add("composition-view");this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView);this._helperContainer.appendChild(this._compositionView);this.element.appendChild(a);this._theme=this.options.theme||this._theme;this.options.theme=void 0;this._colorManager=
new V.ColorManager(da,this.options.allowTransparency);this.optionsService.onOptionChange(function(a){return b._colorManager.onOptionsChange(a)});this._colorManager.setTheme(this._theme);a=this._createRenderer();this._renderService=this._instantiationService.createInstance(ra.RenderService,a,this.rows,this.screenElement);this._instantiationService.setService(ta.IRenderService,this._renderService);this._renderService.onRender(function(a){return b._onRender.fire(a)});this.onResize(function(a){return b._renderService.resize(a.cols,
a.rows)});this._soundService=this._instantiationService.createInstance(O.SoundService);this._instantiationService.setService(ta.ISoundService,this._soundService);this._mouseService=this._instantiationService.createInstance(Sa.MouseService);this._instantiationService.setService(ta.IMouseService,this._mouseService);this.viewport=this._instantiationService.createInstance(h.Viewport,function(a,c){return b.scrollLines(a,c)},this._viewportElement,this._viewportScrollArea);this.viewport.onThemeChange(this._colorManager.colors);
this.register(this.viewport);this.register(this.onCursorMove(function(){return b._renderService.onCursorMove()}));this.register(this.onResize(function(){return b._renderService.onResize(b.cols,b.rows)}));this.register(this.onBlur(function(){return b._renderService.onBlur()}));this.register(this.onFocus(function(){return b._renderService.onFocus()}));this.register(this._renderService.onDimensionsChange(function(){return b.viewport.syncScrollArea()}));this._selectionService=this._instantiationService.createInstance(l.SelectionService,
function(a,c){return b.scrollLines(a,c)},this.element,this.screenElement);this._instantiationService.setService(ta.ISelectionService,this._selectionService);this.register(this._selectionService.onSelectionChange(function(){return b._onSelectionChange.fire()}));this.register(this._selectionService.onRedrawRequest(function(a){return b._renderService.onSelectionChanged(a.start,a.end,a.columnSelectMode)}));this.register(this._selectionService.onLinuxMouseSelection(function(a){b.textarea.value=a;b.textarea.focus();
b.textarea.select()}));this.register(this.onScroll(function(){b.viewport.syncScrollArea();b._selectionService.refresh()}));this.register(y.addDisposableDomListener(this._viewportElement,"scroll",function(){return b._selectionService.refresh()}));this._mouseZoneManager=this._instantiationService.createInstance(X.MouseZoneManager,this.element,this.screenElement);this.register(this._mouseZoneManager);this.register(this.onScroll(function(){return b._mouseZoneManager.clearAll()}));this.linkifier.attachToDom(this.element,
this._mouseZoneManager);this.register(y.addDisposableDomListener(this.element,"mousedown",function(a){return b._selectionService.onMouseDown(a)}));this.mouseEvents?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable();this.options.screenReaderMode&&(this._accessibilityManager=new M.AccessibilityManager(this,this._renderService));this._charSizeService.measure();this.refresh(0,this.rows-1);this._initGlobal();this.bindMouse()},b.prototype._createRenderer=
function(){switch(this.options.rendererType){case "canvas":return this._instantiationService.createInstance(t.Renderer,this._colorManager.colors,this.screenElement,this.linkifier);case "dom":return this._instantiationService.createInstance(ha.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier);default:throw Error('Unrecognized rendererType "'+this.options.rendererType+'"');}},b.prototype._setTheme=function(a){var b,c,d;this._theme=a;null===(b=
this._colorManager)||void 0===b||b.setTheme(a);null===(c=this._renderService)||void 0===c||c.setColors(this._colorManager.colors);null===(d=this.viewport)||void 0===d||d.onThemeChange(this._colorManager.colors)},b.prototype.bindMouse=function(){function a(a){a.buttons||e(a)}function b(a){a.buttons&&e(a)}function c(a){return e(a),a.preventDefault(),g.cancel(a)}function d(a){return e(a),a.buttons||(g._document.removeEventListener("mouseup",q),h&&g._document.removeEventListener("mousemove",h)),g.cancel(a)}
function e(a){var b,c;if(!(b=f._mouseService.getRawByteCoords(a,f.screenElement,f.cols,f.rows)))return!1;switch(a.overrideType||a.type){case "mousemove":var d=32;void 0===a.buttons?(c=3,void 0!==a.button&&(c=3>a.button?a.button:3)):c=1&a.buttons?0:4&a.buttons?1:2&a.buttons?2:3;break;case "mouseup":d=0;c=3>a.button?a.button:3;break;case "mousedown":d=1;c=3>a.button?a.button:3;break;case "wheel":0!==a.deltaY&&(d=0>a.deltaY?0:1);c=4;break;default:return!1}return!(void 0===d||void 0===c||4<c)&&f._coreMouseService.triggerMouseEvent({col:b.x-
33,row:b.y-33,button:c,action:d,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}var g=this,f=this,l=this.element,q=null,k=null,h=null,v=null;this._coreMouseService.onProtocolChange(function(e){(g.mouseEvents=e)?("debug"===g.optionsService.options.logLevel&&g._logService.debug("Binding to mouse events:",g._coreMouseService.explainEvents(e)),g.element.classList.add("enable-mouse-events"),g._selectionService.disable()):(g._logService.debug("Unbinding from mouse events."),g.element.classList.remove("enable-mouse-events"),
g._selectionService.enable());8&e?v||(l.addEventListener("mousemove",a),v=a):(l.removeEventListener("mousemove",v),v=null);16&e?k||(l.addEventListener("wheel",c),k=c):(l.removeEventListener("wheel",k),k=null);2&e?q||(q=d):(g._document.removeEventListener("mouseup",q),q=null);4&e?h||(h=b):(g._document.removeEventListener("mousemove",h),h=null)});this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol;this.register(y.addDisposableDomListener(l,"mousedown",function(a){if(a.preventDefault(),
g.focus(),g.mouseEvents&&!g._selectionService.shouldForceSelection(a))return e(a),q&&g._document.addEventListener("mouseup",q),h&&g._document.addEventListener("mousemove",h),g.cancel(a)}));this.register(y.addDisposableDomListener(l,"wheel",function(a){if(!k&&!g.buffer.hasScrollback){var b=g.viewport.getLinesScrolled(a);if(0!==b){a=r.C0.ESC+(g._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(0>a.deltaY?"A":"B");for(var c="",d=0;d<Math.abs(b);d++)c+=a;g._coreService.triggerDataEvent(c,!0)}}}));
this.register(y.addDisposableDomListener(l,"wheel",function(a){if(!k)return g.viewport.onWheel(a)?void 0:g.cancel(a)}));this.register(y.addDisposableDomListener(l,"touchstart",function(a){if(!g.mouseEvents)return g.viewport.onTouchStart(a),g.cancel(a)}));this.register(y.addDisposableDomListener(l,"touchmove",function(a){if(!g.mouseEvents)return g.viewport.onTouchMove(a)?void 0:g.cancel(a)}))},b.prototype.refresh=function(a,b){var c;null===(c=this._renderService)||void 0===c||c.refreshRows(a,b)},b.prototype._queueLinkification=
function(a,b){var c;null===(c=this.linkifier)||void 0===c||c.linkifyRows(a,b)},b.prototype.updateCursorStyle=function(a){this._selectionService&&this._selectionService.shouldColumnSelect(a)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},b.prototype.showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},b.prototype.scroll=function(a){void 0===a&&(a=!1);var b=this._blankLine;
var c=this.eraseAttrData();b&&b.length===this.cols&&b.getFg(0)===c.fg&&b.getBg(0)===c.bg||(b=this.buffer.getBlankLine(c,a),this._blankLine=b);b.isWrapped=a;c=this.buffer.ybase+this.buffer.scrollTop;a=this.buffer.ybase+this.buffer.scrollBottom;0===this.buffer.scrollTop?(c=this.buffer.lines.isFull,a===this.buffer.lines.length-1?c?this.buffer.lines.recycle().copyFrom(b):this.buffer.lines.push(b.clone()):this.buffer.lines.splice(a+1,0,b.clone()),c?this._userScrolling&&(this.buffer.ydisp=Math.max(this.buffer.ydisp-
1,0)):(this.buffer.ybase++,this._userScrolling||this.buffer.ydisp++)):(this.buffer.lines.shiftElements(c+1,a-c+1-1,-1),this.buffer.lines.set(a,b.clone()));this._userScrolling||(this.buffer.ydisp=this.buffer.ybase);this._dirtyRowService.markRangeDirty(this.buffer.scrollTop,this.buffer.scrollBottom);this._onScroll.fire(this.buffer.ydisp)},b.prototype.scrollLines=function(a,b){if(0>a){if(0===this.buffer.ydisp)return;this._userScrolling=!0}else a+this.buffer.ydisp>=this.buffer.ybase&&(this._userScrolling=
!1);var c=this.buffer.ydisp;this.buffer.ydisp=Math.max(Math.min(this.buffer.ydisp+a,this.buffer.ybase),0);c!==this.buffer.ydisp&&(b||this._onScroll.fire(this.buffer.ydisp),this.refresh(0,this.rows-1))},b.prototype.scrollPages=function(a){this.scrollLines(a*(this.rows-1))},b.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},b.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},b.prototype.scrollToLine=function(a){a-=this.buffer.ydisp;0!==
a&&this.scrollLines(a)},b.prototype.paste=function(a){k.paste(a,this.textarea,this.bracketedPasteMode,this._coreService)},b.prototype.attachCustomKeyEventHandler=function(a){this._customKeyEventHandler=a},b.prototype.addEscHandler=function(a,b){return this._inputHandler.addEscHandler(a,b)},b.prototype.addDcsHandler=function(a,b){return this._inputHandler.addDcsHandler(a,b)},b.prototype.addCsiHandler=function(a,b){return this._inputHandler.addCsiHandler(a,b)},b.prototype.addOscHandler=function(a,b){return this._inputHandler.addOscHandler(a,
b)},b.prototype.registerLinkMatcher=function(a,b,c){a=this.linkifier.registerLinkMatcher(a,b,c);return this.refresh(0,this.rows-1),a},b.prototype.deregisterLinkMatcher=function(a){this.linkifier.deregisterLinkMatcher(a)&&this.refresh(0,this.rows-1)},b.prototype.registerCharacterJoiner=function(a){a=this._renderService.registerCharacterJoiner(a);return this.refresh(0,this.rows-1),a},b.prototype.deregisterCharacterJoiner=function(a){this._renderService.deregisterCharacterJoiner(a)&&this.refresh(0,this.rows-
1)},Object.defineProperty(b.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!0,configurable:!0}),b.prototype.addMarker=function(a){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+a)},b.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},b.prototype.select=function(a,b,c){this._selectionService.setSelection(a,b,c)},b.prototype.getSelection=function(){return this._selectionService?
this._selectionService.selectionText:""},b.prototype.getSelectionPosition=function(){if(this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},b.prototype.clearSelection=function(){var a;null===(a=this._selectionService)||void 0===a||a.clearSelection()},b.prototype.selectAll=function(){var a;null===(a=this._selectionService)||
void 0===a||a.selectAll()},b.prototype.selectLines=function(a,b){var c;null===(c=this._selectionService)||void 0===c||c.selectLines(a,b)},b.prototype._keyDown=function(a){if(this._keyDownHandled=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(a))return!1;if(!this._compositionHelper.keydown(a))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var b=R.evaluateKeyboardEvent(a,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);
if(this.updateCursorStyle(a),3===b.type||2===b.type){var c=this.rows-1;return this.scrollLines(2===b.type?-c:c),this.cancel(a,!0)}return 1===b.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,a)||(b.cancel&&this.cancel(a,!0),!b.key||(b.key!==r.C0.ETX&&b.key!==r.C0.CR||(this.textarea.value=""),this._onKey.fire({key:b.key,domEvent:a}),this.showCursor(),this._coreService.triggerDataEvent(b.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(a,!0)))},
b.prototype._isThirdLevelShift=function(a,b){a=a.isMac&&!this.options.macOptionIsMeta&&b.altKey&&!b.ctrlKey&&!b.metaKey||a.isWindows&&b.altKey&&b.ctrlKey&&!b.metaKey;return"keypress"===b.type?a:a&&(!b.keyCode||47<b.keyCode)},b.prototype.setgLevel=function(a){this.glevel=a;this.charset=this.charsets[a]},b.prototype.setgCharset=function(a,b){this.charsets[a]=b;this.glevel===a&&(this.charset=b)},b.prototype._keyUp=function(a){this._customKeyEventHandler&&!1===this._customKeyEventHandler(a)||(16===a.keyCode||
17===a.keyCode||18===a.keyCode||this.focus(),this.updateCursorStyle(a))},b.prototype._keyPress=function(a){if(this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(a))return!1;if(this.cancel(a),a.charCode)var b=a.charCode;else if(null===a.which||void 0===a.which)b=a.keyCode;else{if(0===a.which||0===a.charCode)return!1;b=a.which}return!(!b||(a.altKey||a.ctrlKey||a.metaKey)&&!this._isThirdLevelShift(this.browser,a))&&(b=String.fromCharCode(b),this._onKey.fire({key:b,domEvent:a}),
this.showCursor(),this._coreService.triggerDataEvent(b,!0),!0)},b.prototype.bell=function(){var a=this;this._soundBell()&&this._soundService.playBellSound();this._visualBell()&&(this.element.classList.add("visual-bell-active"),clearTimeout(this._visualBellTimer),this._visualBellTimer=window.setTimeout(function(){a.element.classList.remove("visual-bell-active")},200))},b.prototype.resize=function(a,b){var c;isNaN(a)||isNaN(b)||(a!==this.cols||b!==this.rows?(a<Fa.MINIMUM_COLS&&(a=Fa.MINIMUM_COLS),b<
Fa.MINIMUM_ROWS&&(b=Fa.MINIMUM_ROWS),this.buffers.resize(a,b),this._bufferService.resize(a,b),this.buffers.setupTabStops(this.cols),null===(c=this._charSizeService)||void 0===c||c.measure(),this.viewport.syncScrollArea(!0),this.refresh(0,this.rows-1),this._onResize.fire({cols:a,rows:b})):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure())},b.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+
this.buffer.y));this.buffer.lines.length=1;this.buffer.ydisp=0;this.buffer.ybase=0;this.buffer.y=0;for(var a=1;a<this.rows;a++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1);this._onScroll.fire(this.buffer.ydisp)}},b.prototype.is=function(a){return 0===(this.options.termName+"").indexOf(a)},b.prototype.handleTitle=function(a){this._onTitleChange.fire(a)},b.prototype.reset=function(){var a,b;this.options.rows=this.rows;this.options.cols=this.cols;
var c=this._customKeyEventHandler,d=this._inputHandler,e=this._userScrolling;this._setup();this._bufferService.reset();this._coreService.reset();this._coreMouseService.reset();null===(a=this._selectionService)||void 0===a||a.reset();this._customKeyEventHandler=c;this._inputHandler=d;this._userScrolling=e;this.refresh(0,this.rows-1);null===(b=this.viewport)||void 0===b||b.syncScrollArea()},b.prototype.cancel=function(a,b){if(this.options.cancelEvents||b)return a.preventDefault(),a.stopPropagation(),
!1},b.prototype._visualBell=function(){return!1},b.prototype._soundBell=function(){return"sound"===this.options.bellStyle},b.prototype.write=function(a,b){this._writeBuffer.write(a,b)},b.prototype.writeSync=function(a){this._writeBuffer.writeSync(a)},b}(a.Disposable);b.Terminal=d},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,
b,c,d);else for(var q=a.length-1;0<=q;q--)(e=a[q])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(4),h=d(0);a=function(){function a(a,b,c,d,e,g){this._textarea=a;this._compositionView=b;this._bufferService=c;this._optionsService=d;this._charSizeService=e;this._coreService=g;this._isSendingComposition=this._isComposing=!1;this._compositionPosition=
{start:0,end:0}}return a.prototype.compositionstart=function(){this._isComposing=!0;this._compositionPosition.start=this._textarea.value.length;this._compositionView.textContent="";this._compositionView.classList.add("active")},a.prototype.compositionupdate=function(a){var b=this;this._compositionView.textContent=a.data;this.updateCompositionElements();setTimeout(function(){b._compositionPosition.end=b._textarea.value.length},0)},a.prototype.compositionend=function(){this._finalizeComposition(!0)},
a.prototype.keydown=function(a){if(this._isComposing||this._isSendingComposition){if(229===a.keyCode||16===a.keyCode||17===a.keyCode||18===a.keyCode)return!1;this._finalizeComposition(!1)}return 229!==a.keyCode||(this._handleAnyTextareaChanges(),!1)},a.prototype._finalizeComposition=function(a){var b=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,this._clearTextareaPosition(),a){var c=this._compositionPosition.start,d=this._compositionPosition.end;this._isSendingComposition=
!0;setTimeout(function(){if(b._isSendingComposition){b._isSendingComposition=!1;var a=b._isComposing?b._textarea.value.substring(c,d):b._textarea.value.substring(c);b._coreService.triggerDataEvent(a,!0)}},0)}else this._isSendingComposition=!1,a=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end),this._coreService.triggerDataEvent(a,!0)},a.prototype._handleAnyTextareaChanges=function(){var a=this,b=this._textarea.value;setTimeout(function(){if(!a._isComposing){var c=
a._textarea.value.replace(b,"");0<c.length&&a._coreService.triggerDataEvent(c,!0)}},0)},a.prototype.updateCompositionElements=function(a){var b=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var c=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),d=this._bufferService.buffer.y*c,e=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=e+"px";this._compositionView.style.top=d+"px";this._compositionView.style.height=
c+"px";this._compositionView.style.lineHeight=c+"px";this._compositionView.style.fontFamily=this._optionsService.options.fontFamily;this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";c=this._compositionView.getBoundingClientRect();this._textarea.style.left=e+"px";this._textarea.style.top=d+"px";this._textarea.style.width=c.width+"px";this._textarea.style.height=c.height+"px";this._textarea.style.lineHeight=c.height+"px"}a||setTimeout(function(){return b.updateCompositionElements(!0)},
0)}},a.prototype._clearTextareaPosition=function(){this._textarea.style.left="";this._textarea.style.top=""},a=c([g(2,h.IBufferService),g(3,h.IOptionsService),g(4,f.ICharSizeService),g(5,h.ICoreService)],a)}();b.CompositionHelper=a},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=
a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)}),f=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)(e=a[l])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},h=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,
"__esModule",{value:!0});a=d(2);var k=d(7),r=d(4),q=d(0);d=function(a){function b(b,c,d,e,g,f,q){var l=a.call(this)||this;return l._scrollLines=b,l._viewportElement=c,l._scrollArea=d,l._bufferService=e,l._optionsService=g,l._charSizeService=f,l._renderService=q,l.scrollBarWidth=0,l._currentRowHeight=0,l._lastRecordedBufferLength=0,l._lastRecordedViewportHeight=0,l._lastRecordedBufferHeight=0,l._lastTouchY=0,l._lastScrollTop=0,l._wheelPartialScroll=0,l._refreshAnimationFrame=null,l._ignoreNextScrollEvent=
!1,l.scrollBarWidth=l._viewportElement.offsetWidth-l._scrollArea.offsetWidth||15,l.register(k.addDisposableDomListener(l._viewportElement,"scroll",l._onScroll.bind(l))),setTimeout(function(){return l.syncScrollArea()},0),l}return g(b,a),b.prototype.onThemeChange=function(a){this._viewportElement.style.backgroundColor=a.background.css},b.prototype._refresh=function(a){var b=this;if(a)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));
null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return b._innerRefresh()}))},b.prototype._innerRefresh=function(){if(0<this._charSizeService.height){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio;this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var a=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);
this._lastRecordedBufferHeight!==a&&(this._lastRecordedBufferHeight=a,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}a=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==a&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=a);this._refreshAnimationFrame=null},b.prototype.syncScrollArea=function(a){if(void 0===a&&(a=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=
this._bufferService.buffer.lines.length,void this._refresh(a);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight?this._lastScrollTop===this._bufferService.buffer.ydisp*this._currentRowHeight&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(a):this._refresh(a)},b.prototype._onScroll=function(){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)this._ignoreNextScrollEvent?
this._ignoreNextScrollEvent=!1:this._scrollLines(Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp,!0)},b.prototype._bubbleScroll=function(a,b){var c=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(0>b&&0!==this._viewportElement.scrollTop||0<b&&c<this._lastRecordedBufferHeight)||(a.cancelable&&a.preventDefault(),!1)},b.prototype.onWheel=function(a){var b=this._getPixelsScrolled(a);return 0!==b&&(this._viewportElement.scrollTop+=b,this._bubbleScroll(a,
b))},b.prototype._getPixelsScrolled=function(a){if(0===a.deltaY)return 0;var b=this._applyScrollModifier(a.deltaY,a);return a.deltaMode===WheelEvent.DOM_DELTA_LINE?b*=this._currentRowHeight:a.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(b*=this._currentRowHeight*this._bufferService.rows),b},b.prototype.getLinesScrolled=function(a){if(0===a.deltaY)return 0;var b=this._applyScrollModifier(a.deltaY,a);return a.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(b/=this._currentRowHeight+0,this._wheelPartialScroll+=b,
b=Math.floor(Math.abs(this._wheelPartialScroll))*(0<this._wheelPartialScroll?1:-1),this._wheelPartialScroll%=1):a.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(b*=this._bufferService.rows),b},b.prototype._applyScrollModifier=function(a,b){var c=this._optionsService.options.fastScrollModifier;return"alt"===c&&b.altKey||"ctrl"===c&&b.ctrlKey||"shift"===c&&b.shiftKey?a*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:a*this._optionsService.options.scrollSensitivity},
b.prototype.onTouchStart=function(a){this._lastTouchY=a.touches[0].pageY},b.prototype.onTouchMove=function(a){var b=this._lastTouchY-a.touches[0].pageY;return this._lastTouchY=a.touches[0].pageY,0!==b&&(this._viewportElement.scrollTop+=b,this._bubbleScroll(a,b))},b=f([h(3,q.IBufferService),h(4,q.IOptionsService),h(5,r.ICharSizeService),h(6,r.IRenderService)],b)}(a.Disposable);b.Viewport=d},function(a,b){function c(a){return a.replace(/\r?\n/g,"\r")}function e(a,b){return b?"\u001b[200~"+a+"\u001b[201~":
a}function g(a,b,d,g){a=e(a=c(a),d);g.triggerDataEvent(a,!0);b.value=""}function f(a,b,c){var d=c.getBoundingClientRect();c=a.clientX-d.left-10;a=a.clientY-d.top-10;b.style.position="absolute";b.style.width="20px";b.style.height="20px";b.style.left=c+"px";b.style.top=a+"px";b.style.zIndex="1000";b.focus();setTimeout(function(){b.style.position="";b.style.width="";b.style.height="";b.style.left="";b.style.top="";b.style.zIndex=""},200)}Object.defineProperty(b,"__esModule",{value:!0});b.prepareTextForTerminal=
c;b.bracketTextForPaste=e;b.copyHandler=function(a,b){a.clipboardData&&a.clipboardData.setData("text/plain",b.selectionText);a.preventDefault()};b.handlePasteEvent=function(a,b,c,d){a.stopPropagation();a.clipboardData&&g(a.clipboardData.getData("text/plain"),b,c,d)};b.paste=g;b.moveTextAreaUnderMouseCursor=f;b.rightClickHandler=function(a,b,c,d,e){f(a,b,c);e&&!d.isClickInSelection(a)&&d.selectWordAtCursor(a);b.value=d.selectionText;b.select()}},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,
b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});var f=d(12),h=d(18),k=d(19),r=d(39);a=d(2);var q=d(15),t=d(8),v=d(16),l=d(1),n=d(3),y=d(5),B=d(6),O=d(21),X=d(23),M={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ha=function(){function a(a,
b,c,d){this._bufferService=a;this._coreService=b;this._logService=c;this._optionsService=d;this._data=new Uint32Array(0)}return a.prototype.hook=function(){this._data=new Uint32Array(0)},a.prototype.put=function(a,b,c){this._data=q.concat(this._data,a.subarray(b,c))},a.prototype.unhook=function(a){if(a)switch(a=t.utf32ToString(this._data),this._data=new Uint32Array(0),a){case '"q':return this._coreService.triggerDataEvent(f.C0.ESC+'P1$r0"q'+f.C0.ESC+"\\");case '"p':return this._coreService.triggerDataEvent(f.C0.ESC+
'P1$r61"p'+f.C0.ESC+"\\");case "r":return this._coreService.triggerDataEvent(f.C0.ESC+"P1$r"+(this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r")+f.C0.ESC+"\\");case "m":return this._coreService.triggerDataEvent(f.C0.ESC+"P1$r0m"+f.C0.ESC+"\\");case " q":return a={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle],a-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(f.C0.ESC+"P1$r"+a+" q"+f.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",
a),this._coreService.triggerDataEvent(f.C0.ESC+"P0$r"+f.C0.ESC+"\\")}else this._data=new Uint32Array(0)},a}();d=function(a){function b(b,c,d,e,g,q,k,v){function B(a){H._parser.setEscHandler({intermediates:"(",final:a},function(){return n.selectCharset("("+a)});H._parser.setEscHandler({intermediates:")",final:a},function(){return n.selectCharset(")"+a)});H._parser.setEscHandler({intermediates:"*",final:a},function(){return n.selectCharset("*"+a)});H._parser.setEscHandler({intermediates:"+",final:a},
function(){return n.selectCharset("+"+a)});H._parser.setEscHandler({intermediates:"-",final:a},function(){return n.selectCharset("-"+a)});H._parser.setEscHandler({intermediates:".",final:a},function(){return n.selectCharset("."+a)});H._parser.setEscHandler({intermediates:"/",final:a},function(){return n.selectCharset("/"+a)})}void 0===v&&(v=new r.EscapeSequenceParser);var n=a.call(this)||this;n._terminal=b;n._bufferService=c;n._coreService=d;n._dirtyRowService=e;n._logService=g;n._optionsService=
q;n._coreMouseService=k;n._parser=v;n._parseBuffer=new Uint32Array(4096);n._stringDecoder=new t.StringToUtf32;n._utf8Decoder=new t.Utf8ToUtf32;n._workCell=new y.CellData;n._onCursorMove=new l.EventEmitter;n._onLineFeed=new l.EventEmitter;n._onScroll=new l.EventEmitter;n.register(n._parser);n._parser.setCsiHandlerFallback(function(a,b){n._logService.debug("Unknown CSI code: ",{identifier:n._parser.identToString(a),params:b.toArray()})});n._parser.setEscHandlerFallback(function(a){n._logService.debug("Unknown ESC code: ",
{identifier:n._parser.identToString(a)})});n._parser.setExecuteHandlerFallback(function(a){n._logService.debug("Unknown EXECUTE code: ",{code:a})});n._parser.setOscHandlerFallback(function(a,b,c){n._logService.debug("Unknown OSC code: ",{identifier:a,action:b,data:c})});n._parser.setDcsHandlerFallback(function(a,b,c){"HOOK"===b&&(c=c.toArray());n._logService.debug("Unknown DCS code: ",{identifier:n._parser.identToString(a),action:b,payload:c})});n._parser.setPrintHandler(function(a,b,c){return n.print(a,
b,c)});n._parser.setCsiHandler({final:"@"},function(a){return n.insertChars(a)});n._parser.setCsiHandler({intermediates:" ",final:"@"},function(a){return n.scrollLeft(a)});n._parser.setCsiHandler({final:"A"},function(a){return n.cursorUp(a)});n._parser.setCsiHandler({intermediates:" ",final:"A"},function(a){return n.scrollRight(a)});n._parser.setCsiHandler({final:"B"},function(a){return n.cursorDown(a)});n._parser.setCsiHandler({final:"C"},function(a){return n.cursorForward(a)});n._parser.setCsiHandler({final:"D"},
function(a){return n.cursorBackward(a)});n._parser.setCsiHandler({final:"E"},function(a){return n.cursorNextLine(a)});n._parser.setCsiHandler({final:"F"},function(a){return n.cursorPrecedingLine(a)});n._parser.setCsiHandler({final:"G"},function(a){return n.cursorCharAbsolute(a)});n._parser.setCsiHandler({final:"H"},function(a){return n.cursorPosition(a)});n._parser.setCsiHandler({final:"I"},function(a){return n.cursorForwardTab(a)});n._parser.setCsiHandler({final:"J"},function(a){return n.eraseInDisplay(a)});
n._parser.setCsiHandler({prefix:"?",final:"J"},function(a){return n.eraseInDisplay(a)});n._parser.setCsiHandler({final:"K"},function(a){return n.eraseInLine(a)});n._parser.setCsiHandler({prefix:"?",final:"K"},function(a){return n.eraseInLine(a)});n._parser.setCsiHandler({final:"L"},function(a){return n.insertLines(a)});n._parser.setCsiHandler({final:"M"},function(a){return n.deleteLines(a)});n._parser.setCsiHandler({final:"P"},function(a){return n.deleteChars(a)});n._parser.setCsiHandler({final:"S"},
function(a){return n.scrollUp(a)});n._parser.setCsiHandler({final:"T"},function(a){return n.scrollDown(a)});n._parser.setCsiHandler({final:"X"},function(a){return n.eraseChars(a)});n._parser.setCsiHandler({final:"Z"},function(a){return n.cursorBackwardTab(a)});n._parser.setCsiHandler({final:"`"},function(a){return n.charPosAbsolute(a)});n._parser.setCsiHandler({final:"a"},function(a){return n.hPositionRelative(a)});n._parser.setCsiHandler({final:"b"},function(a){return n.repeatPrecedingCharacter(a)});
n._parser.setCsiHandler({final:"c"},function(a){return n.sendDeviceAttributesPrimary(a)});n._parser.setCsiHandler({prefix:">",final:"c"},function(a){return n.sendDeviceAttributesSecondary(a)});n._parser.setCsiHandler({final:"d"},function(a){return n.linePosAbsolute(a)});n._parser.setCsiHandler({final:"e"},function(a){return n.vPositionRelative(a)});n._parser.setCsiHandler({final:"f"},function(a){return n.hVPosition(a)});n._parser.setCsiHandler({final:"g"},function(a){return n.tabClear(a)});n._parser.setCsiHandler({final:"h"},
function(a){return n.setMode(a)});n._parser.setCsiHandler({prefix:"?",final:"h"},function(a){return n.setModePrivate(a)});n._parser.setCsiHandler({final:"l"},function(a){return n.resetMode(a)});n._parser.setCsiHandler({prefix:"?",final:"l"},function(a){return n.resetModePrivate(a)});n._parser.setCsiHandler({final:"m"},function(a){return n.charAttributes(a)});n._parser.setCsiHandler({final:"n"},function(a){return n.deviceStatus(a)});n._parser.setCsiHandler({prefix:"?",final:"n"},function(a){return n.deviceStatusPrivate(a)});
n._parser.setCsiHandler({intermediates:"!",final:"p"},function(a){return n.softReset(a)});n._parser.setCsiHandler({intermediates:" ",final:"q"},function(a){return n.setCursorStyle(a)});n._parser.setCsiHandler({final:"r"},function(a){return n.setScrollRegion(a)});n._parser.setCsiHandler({final:"s"},function(a){return n.saveCursor(a)});n._parser.setCsiHandler({final:"u"},function(a){return n.restoreCursor(a)});n._parser.setCsiHandler({intermediates:"'",final:"}"},function(a){return n.insertColumns(a)});
n._parser.setCsiHandler({intermediates:"'",final:"~"},function(a){return n.deleteColumns(a)});n._parser.setExecuteHandler(f.C0.BEL,function(){return n.bell()});n._parser.setExecuteHandler(f.C0.LF,function(){return n.lineFeed()});n._parser.setExecuteHandler(f.C0.VT,function(){return n.lineFeed()});n._parser.setExecuteHandler(f.C0.FF,function(){return n.lineFeed()});n._parser.setExecuteHandler(f.C0.CR,function(){return n.carriageReturn()});n._parser.setExecuteHandler(f.C0.BS,function(){return n.backspace()});
n._parser.setExecuteHandler(f.C0.HT,function(){return n.tab()});n._parser.setExecuteHandler(f.C0.SO,function(){return n.shiftOut()});n._parser.setExecuteHandler(f.C0.SI,function(){return n.shiftIn()});n._parser.setExecuteHandler(f.C1.IND,function(){return n.index()});n._parser.setExecuteHandler(f.C1.NEL,function(){return n.nextLine()});n._parser.setExecuteHandler(f.C1.HTS,function(){return n.tabSet()});n._parser.setOscHandler(0,new O.OscHandler(function(a){return n.setTitle(a)}));n._parser.setOscHandler(2,
new O.OscHandler(function(a){return n.setTitle(a)}));n._parser.setEscHandler({final:"7"},function(){return n.saveCursor()});n._parser.setEscHandler({final:"8"},function(){return n.restoreCursor()});n._parser.setEscHandler({final:"D"},function(){return n.index()});n._parser.setEscHandler({final:"E"},function(){return n.nextLine()});n._parser.setEscHandler({final:"H"},function(){return n.tabSet()});n._parser.setEscHandler({final:"M"},function(){return n.reverseIndex()});n._parser.setEscHandler({final:"="},
function(){return n.keypadApplicationMode()});n._parser.setEscHandler({final:">"},function(){return n.keypadNumericMode()});n._parser.setEscHandler({final:"c"},function(){return n.reset()});n._parser.setEscHandler({final:"n"},function(){return n.setgLevel(2)});n._parser.setEscHandler({final:"o"},function(){return n.setgLevel(3)});n._parser.setEscHandler({final:"|"},function(){return n.setgLevel(3)});n._parser.setEscHandler({final:"}"},function(){return n.setgLevel(2)});n._parser.setEscHandler({final:"~"},
function(){return n.setgLevel(1)});n._parser.setEscHandler({intermediates:"%",final:"@"},function(){return n.selectDefaultCharset()});n._parser.setEscHandler({intermediates:"%",final:"G"},function(){return n.selectDefaultCharset()});var H=this,qa;for(qa in h.CHARSETS)B(qa);return n._parser.setEscHandler({intermediates:"#",final:"8"},function(){return n.screenAlignmentPattern()}),n._parser.setErrorHandler(function(a){return n._logService.error("Parsing error: ",a),a}),n._parser.setDcsHandler({intermediates:"$",
final:"q"},new ha(n._bufferService,n._coreService,n._logService,n._optionsService)),n}return g(b,a),Object.defineProperty(b.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!0,configurable:!0}),b.prototype.dispose=function(){a.prototype.dispose.call(this)},
b.prototype.parse=function(a){var b=this._bufferService.buffer,c=b.x,d=b.y;if(this._logService.debug("parsing data",a),this._parseBuffer.length<a.length&&131072>this._parseBuffer.length&&(this._parseBuffer=new Uint32Array(Math.min(a.length,131072))),this._dirtyRowService.clearRange(),131072<a.length)for(var e=0;e<a.length;e+=131072){var g=e+131072<a.length?e+131072:a.length;g="string"==typeof a?this._stringDecoder.decode(a.substring(e,g),this._parseBuffer):this._utf8Decoder.decode(a.subarray(e,g),
this._parseBuffer);this._parser.parse(this._parseBuffer,g)}else g="string"==typeof a?this._stringDecoder.decode(a,this._parseBuffer):this._utf8Decoder.decode(a,this._parseBuffer),this._parser.parse(this._parseBuffer,g);(b=this._bufferService.buffer).x===c&&b.y===d||this._onCursorMove.fire();this._terminal.refresh(this._dirtyRowService.start,this._dirtyRowService.end)},b.prototype.print=function(a,b,c){var d,e=this._bufferService.buffer,g=this._terminal.charset,f=this._optionsService.options.screenReaderMode,
l=this._bufferService.cols,q=this._terminal.wraparoundMode,h=this._terminal.insertMode,v=this._terminal.curAttrData,r=e.lines.get(e.y+e.ybase);this._dirtyRowService.markDirty(e.y);for(var y=b;y<c;++y){if(d=a[y],b=k.wcwidth(d),127>d&&g){var B=g[String.fromCharCode(d)];B&&(d=B.charCodeAt(0))}if(f&&this._terminal.onA11yCharEmitter.fire(t.stringFromCodePoint(d)),b||!e.x){if(e.x+b-1>=l)if(q)e.x=0,e.y++,e.y===e.scrollBottom+1?(e.y--,this._terminal.scroll(!0)):(e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-
1),e.lines.get(e.y).isWrapped=!0),r=e.lines.get(e.y+e.ybase);else if(e.x=l-1,2===b)continue;if(h&&(r.insertCells(e.x,b,e.getNullCell(v)),2===r.getWidth(l-1)&&r.setCellFromCodePoint(l-1,n.NULL_CELL_CODE,n.NULL_CELL_WIDTH,v.fg,v.bg)),r.setCellFromCodePoint(e.x++,d,b,v.fg,v.bg),0<b)for(;--b;)r.setCellFromCodePoint(e.x++,0,0,v.fg,v.bg)}else r.getWidth(e.x-1)?r.addCodepointToCell(e.x-1,d):r.addCodepointToCell(e.x-2,d)}c&&(r.loadCell(e.x-1,this._workCell),2===this._workCell.getWidth()||65535<this._workCell.getCode()?
this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content);this._dirtyRowService.markDirty(e.y)},b.prototype.addCsiHandler=function(a,b){return this._parser.addCsiHandler(a,b)},b.prototype.addDcsHandler=function(a,b){return this._parser.addDcsHandler(a,new X.DcsHandler(b))},b.prototype.addEscHandler=function(a,b){return this._parser.addEscHandler(a,b)},b.prototype.addOscHandler=
function(a,b){return this._parser.addOscHandler(a,new O.OscHandler(b))},b.prototype.bell=function(){this._terminal.bell()},b.prototype.lineFeed=function(){var a=this._bufferService.buffer;this._dirtyRowService.markDirty(a.y);this._optionsService.options.convertEol&&(a.x=0);a.y++;a.y===a.scrollBottom+1?(a.y--,this._terminal.scroll()):a.y>=this._bufferService.rows&&(a.y=this._bufferService.rows-1);a.x>=this._bufferService.cols&&a.x--;this._dirtyRowService.markDirty(a.y);this._onLineFeed.fire()},b.prototype.carriageReturn=
function(){this._bufferService.buffer.x=0},b.prototype.backspace=function(){this._restrictCursor();0<this._bufferService.buffer.x&&this._bufferService.buffer.x--},b.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var a=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop();this._optionsService.options.screenReaderMode&&this._terminal.onA11yTabEmitter.fire(this._bufferService.buffer.x-a)}},b.prototype.shiftOut=function(){this._terminal.setgLevel(1)},
b.prototype.shiftIn=function(){this._terminal.setgLevel(0)},b.prototype._restrictCursor=function(){this._bufferService.buffer.x=Math.min(this._bufferService.cols-1,Math.max(0,this._bufferService.buffer.x));this._bufferService.buffer.y=this._terminal.originMode?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y));this._dirtyRowService.markDirty(this._bufferService.buffer.y)},
b.prototype._setCursor=function(a,b){this._dirtyRowService.markDirty(this._bufferService.buffer.y);this._terminal.originMode?(this._bufferService.buffer.x=a,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+b):(this._bufferService.buffer.x=a,this._bufferService.buffer.y=b);this._restrictCursor();this._dirtyRowService.markDirty(this._bufferService.buffer.y)},b.prototype._moveCursor=function(a,b){this._restrictCursor();this._setCursor(this._bufferService.buffer.x+a,this._bufferService.buffer.y+
b)},b.prototype.cursorUp=function(a){var b=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;0<=b?this._moveCursor(0,-Math.min(b,a.params[0]||1)):this._moveCursor(0,-(a.params[0]||1))},b.prototype.cursorDown=function(a){var b=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;0<=b?this._moveCursor(0,Math.min(b,a.params[0]||1)):this._moveCursor(0,a.params[0]||1)},b.prototype.cursorForward=function(a){this._moveCursor(a.params[0]||1,0)},b.prototype.cursorBackward=function(a){this._moveCursor(-(a.params[0]||
1),0)},b.prototype.cursorNextLine=function(a){this.cursorDown(a);this._bufferService.buffer.x=0},b.prototype.cursorPrecedingLine=function(a){this.cursorUp(a);this._bufferService.buffer.x=0},b.prototype.cursorCharAbsolute=function(a){this._setCursor((a.params[0]||1)-1,this._bufferService.buffer.y)},b.prototype.cursorPosition=function(a){this._setCursor(2<=a.length?(a.params[1]||1)-1:0,(a.params[0]||1)-1)},b.prototype.charPosAbsolute=function(a){this._setCursor((a.params[0]||1)-1,this._bufferService.buffer.y)},
b.prototype.hPositionRelative=function(a){this._moveCursor(a.params[0]||1,0)},b.prototype.linePosAbsolute=function(a){this._setCursor(this._bufferService.buffer.x,(a.params[0]||1)-1)},b.prototype.vPositionRelative=function(a){this._moveCursor(0,a.params[0]||1)},b.prototype.hVPosition=function(a){this.cursorPosition(a)},b.prototype.tabClear=function(a){a=a.params[0];0===a?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===a&&(this._bufferService.buffer.tabs={})},b.prototype.cursorForwardTab=
function(a){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(a=a.params[0]||1;a--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},b.prototype.cursorBackwardTab=function(a){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){a=a.params[0]||1;for(var b=this._bufferService.buffer;a--;)b.x=b.prevStop()}},b.prototype._eraseInBufferLine=function(a,b,c,d){void 0===d&&(d=!1);a=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+a);a.replaceCells(b,
c,this._bufferService.buffer.getNullCell(this._terminal.eraseAttrData()));d&&(a.isWrapped=!1)},b.prototype._resetBufferLine=function(a){a=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+a);a.fill(this._bufferService.buffer.getNullCell(this._terminal.eraseAttrData()));a.isWrapped=!1},b.prototype.eraseInDisplay=function(a){switch(this._restrictCursor(),a.params[0]){case 0:a=this._bufferService.buffer.y;this._dirtyRowService.markDirty(a);for(this._eraseInBufferLine(a++,this._bufferService.buffer.x,
this._bufferService.cols,0===this._bufferService.buffer.x);a<this._bufferService.rows;a++)this._resetBufferLine(a);this._dirtyRowService.markDirty(a);break;case 1:a=this._bufferService.buffer.y;this._dirtyRowService.markDirty(a);this._eraseInBufferLine(a,0,this._bufferService.buffer.x+1,!0);for(this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(a+1).isWrapped=!1);a--;)this._resetBufferLine(a);this._dirtyRowService.markDirty(0);break;case 2:a=this._bufferService.rows;
for(this._dirtyRowService.markDirty(a-1);a--;)this._resetBufferLine(a);this._dirtyRowService.markDirty(0);break;case 3:a=this._bufferService.buffer.lines.length-this._bufferService.rows,0<a&&(this._bufferService.buffer.lines.trimStart(a),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-a,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-a,0),this._onScroll.fire(0))}},b.prototype.eraseInLine=function(a){switch(this._restrictCursor(),a.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,
this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},b.prototype.insertLines=function(a){this._restrictCursor();a=a.params[0]||1;var b=this._bufferService.buffer;if(!(b.y>b.scrollBottom||b.y<b.scrollTop)){for(var c=b.y+b.ybase,d=this._bufferService.rows-
1+b.ybase-(this._bufferService.rows-1-b.scrollBottom)+1;a--;)b.lines.splice(d-1,1),b.lines.splice(c,0,b.getBlankLine(this._terminal.eraseAttrData()));this._dirtyRowService.markRangeDirty(b.y,b.scrollBottom);b.x=0}},b.prototype.deleteLines=function(a){this._restrictCursor();a=a.params[0]||1;var b=this._bufferService.buffer;if(!(b.y>b.scrollBottom||b.y<b.scrollTop)){var c=b.y+b.ybase;var d=this._bufferService.rows-1-b.scrollBottom;for(d=this._bufferService.rows-1+b.ybase-d;a--;)b.lines.splice(c,1),
b.lines.splice(d,0,b.getBlankLine(this._terminal.eraseAttrData()));this._dirtyRowService.markRangeDirty(b.y,b.scrollBottom);b.x=0}},b.prototype.insertChars=function(a){this._restrictCursor();var b=this._bufferService.buffer.lines.get(this._bufferService.buffer.y+this._bufferService.buffer.ybase);b&&(b.insertCells(this._bufferService.buffer.x,a.params[0]||1,this._bufferService.buffer.getNullCell(this._terminal.eraseAttrData())),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},b.prototype.deleteChars=
function(a){this._restrictCursor();var b=this._bufferService.buffer.lines.get(this._bufferService.buffer.y+this._bufferService.buffer.ybase);b&&(b.deleteCells(this._bufferService.buffer.x,a.params[0]||1,this._bufferService.buffer.getNullCell(this._terminal.eraseAttrData())),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},b.prototype.scrollUp=function(a){a=a.params[0]||1;for(var b=this._bufferService.buffer;a--;)b.lines.splice(b.ybase+b.scrollTop,1),b.lines.splice(b.ybase+b.scrollBottom,
0,b.getBlankLine(this._terminal.eraseAttrData()));this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)},b.prototype.scrollDown=function(a){a=a.params[0]||1;for(var b=this._bufferService.buffer;a--;)b.lines.splice(b.ybase+b.scrollBottom,1),b.lines.splice(b.ybase+b.scrollTop,0,b.getBlankLine(v.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)},b.prototype.scrollLeft=function(a){var b=this._bufferService.buffer;if(!(b.y>b.scrollBottom||b.y<b.scrollTop)){a=
a.params[0]||1;for(var c=b.scrollTop;c<=b.scrollBottom;++c){var d=b.lines.get(b.ybase+c);d.deleteCells(0,a,b.getNullCell(this._terminal.eraseAttrData()));d.isWrapped=!1}this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)}},b.prototype.scrollRight=function(a){var b=this._bufferService.buffer;if(!(b.y>b.scrollBottom||b.y<b.scrollTop)){a=a.params[0]||1;for(var c=b.scrollTop;c<=b.scrollBottom;++c){var d=b.lines.get(b.ybase+c);d.insertCells(0,a,b.getNullCell(this._terminal.eraseAttrData()));
d.isWrapped=!1}this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)}},b.prototype.insertColumns=function(a){var b=this._bufferService.buffer;if(!(b.y>b.scrollBottom||b.y<b.scrollTop)){a=a.params[0]||1;for(var c=b.scrollTop;c<=b.scrollBottom;++c){var d=this._bufferService.buffer.lines.get(b.ybase+c);d.insertCells(b.x,a,b.getNullCell(this._terminal.eraseAttrData()));d.isWrapped=!1}this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)}},b.prototype.deleteColumns=function(a){var b=
this._bufferService.buffer;if(!(b.y>b.scrollBottom||b.y<b.scrollTop)){a=a.params[0]||1;for(var c=b.scrollTop;c<=b.scrollBottom;++c){var d=b.lines.get(b.ybase+c);d.deleteCells(b.x,a,b.getNullCell(this._terminal.eraseAttrData()));d.isWrapped=!1}this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)}},b.prototype.eraseChars=function(a){this._restrictCursor();var b=this._bufferService.buffer.lines.get(this._bufferService.buffer.y+this._bufferService.buffer.ybase);b&&(b.replaceCells(this._bufferService.buffer.x,
this._bufferService.buffer.x+(a.params[0]||1),this._bufferService.buffer.getNullCell(this._terminal.eraseAttrData())),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},b.prototype.repeatPrecedingCharacter=function(a){if(this._parser.precedingCodepoint){a=a.params[0]||1;for(var b=new Uint32Array(a),c=0;c<a;++c)b[c]=this._parser.precedingCodepoint;this.print(b,0,b.length)}},b.prototype.sendDeviceAttributesPrimary=function(a){0<a.params[0]||(this._terminal.is("xterm")||this._terminal.is("rxvt-unicode")||
this._terminal.is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._terminal.is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c"))},b.prototype.sendDeviceAttributesSecondary=function(a){0<a.params[0]||(this._terminal.is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._terminal.is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._terminal.is("linux")?this._coreService.triggerDataEvent(a.params[0]+"c"):this._terminal.is("screen")&&
this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c"))},b.prototype.setMode=function(a){for(var b=0;b<a.length;b++)switch(a.params[b]){case 4:this._terminal.insertMode=!0}},b.prototype.setModePrivate=function(a){for(var b=0;b<a.length;b++)switch(a.params[b]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._terminal.setgCharset(0,h.DEFAULT_CHARSET);this._terminal.setgCharset(1,h.DEFAULT_CHARSET);this._terminal.setgCharset(2,h.DEFAULT_CHARSET);this._terminal.setgCharset(3,
h.DEFAULT_CHARSET);break;case 3:this._terminal.savedCols=this._bufferService.cols;this._terminal.resize(132,this._bufferService.rows);this._terminal.reset();break;case 6:this._terminal.originMode=!0;this._setCursor(0,0);break;case 7:this._terminal.wraparoundMode=!0;break;case 66:this._logService.debug("Serial port requested application keypad.");this._terminal.applicationKeypad=!0;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();break;case 9:this._coreMouseService.activeProtocol=
"X10";break;case 1E3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._terminal.sendFocus=!0;break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;
break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._terminal.eraseAttrData());this._terminal.refresh(0,this._bufferService.rows-1);this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._terminal.showCursor();break;case 2004:this._terminal.bracketedPasteMode=!0}},b.prototype.resetMode=function(a){for(var b=0;b<a.length;b++)switch(a.params[b]){case 4:this._terminal.insertMode=!1}},b.prototype.resetModePrivate=
function(a){for(var b=0;b<a.length;b++)switch(a.params[b]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:132===this._bufferService.cols&&this._terminal.savedCols&&this._terminal.resize(this._terminal.savedCols,this._bufferService.rows);delete this._terminal.savedCols;this._terminal.reset();break;case 6:this._terminal.originMode=!1;this._setCursor(0,0);break;case 7:this._terminal.wraparoundMode=!1;break;case 66:this._logService.debug("Switching back to normal keypad.");
this._terminal.applicationKeypad=!1;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();break;case 9:case 1E3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._terminal.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=
!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer();1049===a.params[b]&&this.restoreCursor();this._terminal.refresh(0,this._bufferService.rows-1);this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._terminal.showCursor();break;case 2004:this._terminal.bracketedPasteMode=!1}},b.prototype._extractColor=function(a,b,c){var d=[0,0,-1,0,0,0],e=0,g=0;do{if(d[g+e]=a.params[b+g],a.hasSubParams(b+g)){a=a.getSubParams(b+
g);b=0;do 5===d[1]&&(e=1),d[g+b+1+e]=a[b];while(++b<a.length&&b+g+1+e<d.length);break}if(5===d[1]&&2<=g+e||2===d[1]&&5<=g+e)break;d[1]&&(e=1)}while(++g+b<a.length&&g+e<d.length);for(b=2;b<d.length;++b)-1===d[b]&&(d[b]=0);return 38===d[0]?2===d[1]?(c.fg|=50331648,c.fg&=-16777216,c.fg|=B.AttributeData.fromColorRGB([d[3],d[4],d[5]])):5===d[1]&&(c.fg&=-50331904,c.fg=c.fg|33554432|255&d[3]):48===d[0]&&(2===d[1]?(c.bg|=50331648,c.bg&=-16777216,c.bg|=B.AttributeData.fromColorRGB([d[3],d[4],d[5]])):5===d[1]&&
(c.bg&=-50331904,c.bg=c.bg|33554432|255&d[3])),g},b.prototype.charAttributes=function(a){if(1===a.length&&0===a.params[0])return this._terminal.curAttrData.fg=v.DEFAULT_ATTR_DATA.fg,void(this._terminal.curAttrData.bg=v.DEFAULT_ATTR_DATA.bg);for(var b,c=a.length,d=this._terminal.curAttrData,e=0;e<c;e++)30<=(b=a.params[e])&&37>=b?(d.fg&=-50331904,d.fg=d.fg|16777216|b-30):40<=b&&47>=b?(d.bg&=-50331904,d.bg=d.bg|16777216|b-40):90<=b&&97>=b?(d.fg&=-50331904,d.fg=d.fg|16777224|b-90):100<=b&&107>=b?(d.bg&=
-50331904,d.bg=d.bg|16777224|b-100):0===b?(d.fg=v.DEFAULT_ATTR_DATA.fg,d.bg=v.DEFAULT_ATTR_DATA.bg):1===b?d.fg|=134217728:3===b?d.bg|=67108864:4===b?d.fg|=268435456:5===b?d.fg|=536870912:7===b?d.fg|=67108864:8===b?d.fg|=1073741824:2===b?d.bg|=134217728:22===b?(d.fg&=-134217729,d.bg&=-134217729):23===b?d.bg&=-67108865:24===b?d.fg&=-268435457:25===b?d.fg&=-536870913:27===b?d.fg&=-67108865:28===b?d.fg&=-1073741825:39===b?(d.fg&=-67108864,d.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):49===b?(d.bg&=-67108864,
d.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):38===b||48===b?e+=this._extractColor(a,e,d):100===b?(d.fg&=-67108864,d.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,d.bg&=-67108864,d.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",b)},b.prototype.deviceStatus=function(a){switch(a.params[0]){case 5:this._coreService.triggerDataEvent(f.C0.ESC+"[0n");break;case 6:this._coreService.triggerDataEvent(f.C0.ESC+"["+(this._bufferService.buffer.y+1)+";"+(this._bufferService.buffer.x+1)+
"R")}},b.prototype.deviceStatusPrivate=function(a){switch(a.params[0]){case 6:this._coreService.triggerDataEvent(f.C0.ESC+"[?"+(this._bufferService.buffer.y+1)+";"+(this._bufferService.buffer.x+1)+"R")}},b.prototype.softReset=function(){this._coreService.isCursorHidden=!1;this._terminal.insertMode=!1;this._terminal.originMode=!1;this._terminal.wraparoundMode=!0;this._terminal.applicationKeypad=!1;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._coreService.decPrivateModes.applicationCursorKeys=
!1;this._bufferService.buffer.scrollTop=0;this._bufferService.buffer.scrollBottom=this._bufferService.rows-1;this._terminal.curAttrData=v.DEFAULT_ATTR_DATA.clone();this._bufferService.buffer.x=this._bufferService.buffer.y=0;this._terminal.charset=null;this._terminal.glevel=0;this._terminal.charsets=[null]},b.prototype.setCursorStyle=function(a){a=a.params[0]||1;switch(a){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";
break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}this._optionsService.options.cursorBlink=1==a%2},b.prototype.setScrollRegion=function(a){var b,c=a.params[0]||1;(2>a.length||(b=a.params[1])>this._bufferService.rows||0===b)&&(b=this._bufferService.rows);b>c&&(this._bufferService.buffer.scrollTop=c-1,this._bufferService.buffer.scrollBottom=b-1,this._setCursor(0,0))},b.prototype.saveCursor=function(){this._bufferService.buffer.savedX=this._bufferService.buffer.x;this._bufferService.buffer.savedY=
this._bufferService.buffer.ybase+this._bufferService.buffer.y;this._bufferService.buffer.savedCurAttrData.fg=this._terminal.curAttrData.fg;this._bufferService.buffer.savedCurAttrData.bg=this._terminal.curAttrData.bg;this._bufferService.buffer.savedCharset=this._terminal.charset},b.prototype.restoreCursor=function(){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0;this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0);this._terminal.curAttrData.fg=
this._bufferService.buffer.savedCurAttrData.fg;this._terminal.curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg;this._terminal.charset=this._savedCharset;this._bufferService.buffer.savedCharset&&(this._terminal.charset=this._bufferService.buffer.savedCharset);this._restrictCursor()},b.prototype.setTitle=function(a){this._terminal.handleTitle(a)},b.prototype.nextLine=function(){this._bufferService.buffer.x=0;this.index()},b.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad.");
this._terminal.applicationKeypad=!0;this._terminal.viewport&&this._terminal.viewport.syncScrollArea()},b.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad.");this._terminal.applicationKeypad=!1;this._terminal.viewport&&this._terminal.viewport.syncScrollArea()},b.prototype.selectDefaultCharset=function(){this._terminal.setgLevel(0);this._terminal.setgCharset(0,h.DEFAULT_CHARSET)},b.prototype.selectCharset=function(a){2===a.length?"/"!==a[0]&&this._terminal.setgCharset(M[a[0]],
h.CHARSETS[a[1]]||h.DEFAULT_CHARSET):this.selectDefaultCharset()},b.prototype.index=function(){this._restrictCursor();var a=this._bufferService.buffer;this._bufferService.buffer.y++;a.y===a.scrollBottom+1?(a.y--,this._terminal.scroll()):a.y>=this._bufferService.rows&&(a.y=this._bufferService.rows-1);this._restrictCursor()},b.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},b.prototype.reverseIndex=function(){this._restrictCursor();var a=this._bufferService.buffer;
a.y===a.scrollTop?(a.lines.shiftElements(a.y+a.ybase,a.scrollBottom-a.scrollTop,1),a.lines.set(a.y+a.ybase,a.getBlankLine(this._terminal.eraseAttrData())),this._dirtyRowService.markRangeDirty(a.scrollTop,a.scrollBottom)):(a.y--,this._restrictCursor())},b.prototype.reset=function(){this._parser.reset();this._terminal.reset()},b.prototype.setgLevel=function(a){this._terminal.setgLevel(a)},b.prototype.screenAlignmentPattern=function(){var a=new y.CellData;a.content=4194373;a.fg=this._terminal.curAttrData.fg;
a.bg=this._terminal.curAttrData.bg;var b=this._bufferService.buffer;this._setCursor(0,0);for(var c=0;c<this._bufferService.rows;++c){var d=b.y+b.ybase+c;b.lines.get(d).fill(a);b.lines.get(d).isWrapped=!1}this._dirtyRowService.markAllDirty();this._setCursor(0,0)},b}(a.Disposable);b.InputHandler=d},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&
(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});a=d(2);var f=d(15),h=d(20),k=d(21),r=d(23),q=function(){function a(a){this.table=new Uint8Array(a)}return a.prototype.setDefault=function(a,b){f.fill(this.table,a<<4|b)},a.prototype.add=function(a,b,c,d){this.table[b<<8|a]=c<<4|d},a.prototype.addMany=function(a,b,c,d){for(var e=0;e<a.length;e++)this.table[b<<
8|a[e]]=c<<4|d},a}();b.TransitionTable=q;b.VT500_TRANSITION_TABLE=function(){function a(a,b){return c.slice(a,b)}var b=new q(4095),c=Array.apply(null,Array(256)).map(function(a,b){return b}),d=a(32,127),e=a(0,24);e.push(25);e.push.apply(e,a(28,32));var g,f=a(0,14);for(g in b.setDefault(1,0),b.addMany(d,0,2,0),f)b.addMany([24,26,153,154],g,3,0),b.addMany(a(128,144),g,3,0),b.addMany(a(144,152),g,3,0),b.add(156,g,0,0),b.add(27,g,11,1),b.add(157,g,4,8),b.addMany([152,158,159],g,0,7),b.add(155,g,11,3),
b.add(144,g,11,9);return b.addMany(e,0,3,0),b.addMany(e,1,3,1),b.add(127,1,0,1),b.addMany(e,8,0,8),b.addMany(e,3,3,3),b.add(127,3,0,3),b.addMany(e,4,3,4),b.add(127,4,0,4),b.addMany(e,6,3,6),b.addMany(e,5,3,5),b.add(127,5,0,5),b.addMany(e,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(d,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(a(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(d,7,0,7),b.addMany(e,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(a(64,
127),3,7,0),b.addMany(a(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(a(48,60),4,8,4),b.addMany(a(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(a(32,64),6,0,6),b.add(127,6,0,6),b.addMany(a(64,127),6,0,0),b.addMany(a(32,48),3,9,5),b.addMany(a(32,48),5,9,5),b.addMany(a(48,64),5,0,6),b.addMany(a(64,127),5,7,0),b.addMany(a(32,48),4,9,5),b.addMany(a(32,48),1,9,2),b.addMany(a(32,48),2,9,2),b.addMany(a(48,127),2,10,0),b.addMany(a(48,80),1,10,0),b.addMany(a(81,88),1,10,0),b.addMany([89,
90,92],1,10,0),b.addMany(a(96,127),1,10,0),b.add(80,1,11,9),b.addMany(e,9,0,9),b.add(127,9,0,9),b.addMany(a(28,32),9,0,9),b.addMany(a(32,48),9,9,12),b.addMany(a(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(e,11,0,11),b.addMany(a(32,128),11,0,11),b.addMany(a(28,32),11,0,11),b.addMany(e,10,0,10),b.add(127,10,0,10),b.addMany(a(28,32),10,0,10),b.addMany(a(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(a(32,48),10,9,12),b.addMany(e,12,0,12),b.add(127,12,0,12),b.addMany(a(28,32),
12,0,12),b.addMany(a(32,48),12,9,12),b.addMany(a(48,64),12,0,11),b.addMany(a(64,127),12,12,13),b.addMany(a(64,127),10,12,13),b.addMany(a(64,127),9,12,13),b.addMany(e,13,13,13),b.addMany(d,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(160,0,2,0),b.add(160,8,5,8),b.add(160,6,0,6),b.add(160,11,0,11),b.add(160,13,13,13),b}();d=function(a){function c(c){void 0===c&&(c=b.VT500_TRANSITION_TABLE);var d=a.call(this)||this;return d.TRANSITIONS=c,d.initialState=0,d.currentState=d.initialState,
d._params=new h.Params,d._params.addParam(0),d._collect=0,d.precedingCodepoint=0,d._printHandlerFb=function(){},d._executeHandlerFb=function(){},d._csiHandlerFb=function(){},d._escHandlerFb=function(){},d._errorHandlerFb=function(a){return a},d._printHandler=d._printHandlerFb,d._executeHandlers=Object.create(null),d._csiHandlers=Object.create(null),d._escHandlers=Object.create(null),d._oscParser=new k.OscParser,d._dcsParser=new r.DcsParser,d._errorHandler=d._errorHandlerFb,d.setEscHandler({final:"\\"},
function(){}),d}return g(c,a),c.prototype._identifier=function(a,b){void 0===b&&(b=[64,126]);var c=0;if(a.prefix){if(1<a.prefix.length)throw Error("only one byte as prefix supported");if((c=a.prefix.charCodeAt(0))&&60>c||63<c)throw Error("prefix must be in range 0x3c .. 0x3f");}if(a.intermediates){if(2<a.intermediates.length)throw Error("only two bytes as intermediates are supported");for(var d=0;d<a.intermediates.length;++d){var e=a.intermediates.charCodeAt(d);if(32>e||47<e)throw Error("intermediate must be in range 0x20 .. 0x2f");
c<<=8;c|=e}}if(1!==a.final.length)throw Error("final must be a single byte");a=a.final.charCodeAt(0);if(b[0]>a||a>b[1])throw Error("final must be in range "+b[0]+" .. "+b[1]);return c<<=8,c|a},c.prototype.identToString=function(a){for(var b=[];a;)b.push(String.fromCharCode(255&a)),a>>=8;return b.reverse().join("")},c.prototype.dispose=function(){this._csiHandlers=Object.create(null);this._executeHandlers=Object.create(null);this._escHandlers=Object.create(null);this._oscParser.dispose();this._dcsParser.dispose()},
c.prototype.setPrintHandler=function(a){this._printHandler=a},c.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},c.prototype.addEscHandler=function(a,b){a=this._identifier(a,[48,126]);void 0===this._escHandlers[a]&&(this._escHandlers[a]=[]);var c=this._escHandlers[a];return c.push(b),{dispose:function(){var a=c.indexOf(b);-1!==a&&c.splice(a,1)}}},c.prototype.setEscHandler=function(a,b){this._escHandlers[this._identifier(a,[48,126])]=[b]},c.prototype.clearEscHandler=
function(a){this._escHandlers[this._identifier(a,[48,126])]&&delete this._escHandlers[this._identifier(a,[48,126])]},c.prototype.setEscHandlerFallback=function(a){this._escHandlerFb=a},c.prototype.setExecuteHandler=function(a,b){this._executeHandlers[a.charCodeAt(0)]=b},c.prototype.clearExecuteHandler=function(a){this._executeHandlers[a.charCodeAt(0)]&&delete this._executeHandlers[a.charCodeAt(0)]},c.prototype.setExecuteHandlerFallback=function(a){this._executeHandlerFb=a},c.prototype.addCsiHandler=
function(a,b){a=this._identifier(a);void 0===this._csiHandlers[a]&&(this._csiHandlers[a]=[]);var c=this._csiHandlers[a];return c.push(b),{dispose:function(){var a=c.indexOf(b);-1!==a&&c.splice(a,1)}}},c.prototype.setCsiHandler=function(a,b){this._csiHandlers[this._identifier(a)]=[b]},c.prototype.clearCsiHandler=function(a){this._csiHandlers[this._identifier(a)]&&delete this._csiHandlers[this._identifier(a)]},c.prototype.setCsiHandlerFallback=function(a){this._csiHandlerFb=a},c.prototype.addDcsHandler=
function(a,b){return this._dcsParser.addHandler(this._identifier(a),b)},c.prototype.setDcsHandler=function(a,b){this._dcsParser.setHandler(this._identifier(a),b)},c.prototype.clearDcsHandler=function(a){this._dcsParser.clearHandler(this._identifier(a))},c.prototype.setDcsHandlerFallback=function(a){this._dcsParser.setHandlerFallback(a)},c.prototype.addOscHandler=function(a,b){return this._oscParser.addHandler(a,b)},c.prototype.setOscHandler=function(a,b){this._oscParser.setHandler(a,b)},c.prototype.clearOscHandler=
function(a){this._oscParser.clearHandler(a)},c.prototype.setOscHandlerFallback=function(a){this._oscParser.setHandlerFallback(a)},c.prototype.setErrorHandler=function(a){this._errorHandler=a},c.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},c.prototype.reset=function(){this.currentState=this.initialState;this._oscParser.reset();this._dcsParser.reset();this._params.reset();this._params.addParam(0);this.precedingCodepoint=this._collect=0},c.prototype.parse=function(a,
b){for(var c=0,d,e=this.currentState,g=this._oscParser,f=this._dcsParser,q=this._collect,l=this._params,h=this.TRANSITIONS.table,k=0;k<b;++k){switch((d=h[e<<8|(160>(c=a[k])?c:160)])>>4){case 2:for(e=k+1;;++e){if(e>=b||32>(c=a[e])||126<c&&160>c){this._printHandler(a,k,e);k=e-1;break}if(++e>=b||32>(c=a[e])||126<c&&160>c){this._printHandler(a,k,e);k=e-1;break}if(++e>=b||32>(c=a[e])||126<c&&160>c){this._printHandler(a,k,e);k=e-1;break}if(++e>=b||32>(c=a[e])||126<c&&160>c){this._printHandler(a,k,e);k=
e-1;break}}break;case 3:this._executeHandlers[c]?this._executeHandlers[c]():this._executeHandlerFb(c);this.precedingCodepoint=0;break;case 1:if(this._errorHandler({position:k,code:c,currentState:e,collect:q,params:l,abort:!1}).abort)return;break;case 7:for(var r=(e=this._csiHandlers[q<<8|c])?e.length-1:-1;0<=r&&!1===e[r](l);r--);0>r&&this._csiHandlerFb(q<<8|c,l);this.precedingCodepoint=0;break;case 8:do switch(c){case 59:l.addParam(0);break;case 58:l.addSubParam(-1);break;default:l.addDigit(c-48)}while(++k<
b&&47<(c=a[k])&&60>c);k--;break;case 9:q<<=8;q|=c;break;case 10:for(r=(e=this._escHandlers[q<<8|c])?e.length-1:-1;0<=r&&!1===e[r]();r--);0>r&&this._escHandlerFb(q<<8|c);this.precedingCodepoint=0;break;case 11:l.reset();l.addParam(0);q=0;break;case 12:f.hook(q<<8|c,l);break;case 13:for(e=k+1;;++e)if(e>=b||24===(c=a[e])||26===c||27===c||127<c&&160>c){f.put(a,k,e);k=e-1;break}break;case 14:f.unhook(24!==c&&26!==c);27===c&&(d|=1);l.reset();l.addParam(0);this.precedingCodepoint=q=0;break;case 4:g.start();
break;case 5:for(e=k+1;;e++)if(e>=b||32>(c=a[e])||127<c&&159>=c){g.put(a,k,e);k=e-1;break}break;case 6:g.end(24!==c&&26!==c),27===c&&(d|=1),l.reset(),l.addParam(0),this.precedingCodepoint=q=0}e=15&d}this._collect=q;this.currentState=e},c}(a.Disposable);b.EscapeSequenceParser=d},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,
b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)}),f=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var q=a.length-1;0<=q;q--)(e=a[q])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},h=this&&this.__param||function(a,
b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var k=d(41),r=d(47),q=d(48),t=d(49),v=d(28);a=d(2);var l=d(4),n=d(0),y=d(24),B=d(1),O=1;d=function(a){function b(b,c,d,e,g,f,l,h){var n=a.call(this)||this;n._colors=b;n._screenElement=c;n._linkifier=d;n._bufferService=e;n._charSizeService=g;n._optionsService=f;n.coreService=l;n.coreBrowserService=h;n._id=O++;n._onRequestRefreshRows=new B.EventEmitter;b=n._optionsService.options.allowTransparency;return n._characterJoinerRegistry=
new v.CharacterJoinerRegistry(n._bufferService),n._renderLayers=[new k.TextRenderLayer(n._screenElement,0,n._colors,n._characterJoinerRegistry,b,n._id,n._bufferService,f),new r.SelectionRenderLayer(n._screenElement,1,n._colors,n._id,n._bufferService,f),new t.LinkRenderLayer(n._screenElement,2,n._colors,n._id,n._linkifier,n._bufferService,f),new q.CursorRenderLayer(n._screenElement,3,n._colors,n._id,n._onRequestRefreshRows,n._bufferService,f,l,h)],n.dimensions={scaledCharWidth:0,scaledCharHeight:0,
scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},n._devicePixelRatio=window.devicePixelRatio,n._updateDimensions(),n.onOptionsChanged(),n}return g(b,a),Object.defineProperty(b.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!0,configurable:!0}),b.prototype.dispose=function(){a.prototype.dispose.call(this);this._renderLayers.forEach(function(a){return a.dispose()});
y.removeTerminalFromCache(this._id)},b.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},b.prototype.setColors=function(a){var b=this;this._colors=a;this._renderLayers.forEach(function(a){a.setColors(b._colors);a.reset()})},b.prototype.onResize=function(){var a=this;this._updateDimensions();this._renderLayers.forEach(function(b){return b.resize(a.dimensions)});
this._screenElement.style.width=this.dimensions.canvasWidth+"px";this._screenElement.style.height=this.dimensions.canvasHeight+"px"},b.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},b.prototype.onBlur=function(){this._runOperation(function(a){return a.onBlur()})},b.prototype.onFocus=function(){this._runOperation(function(a){return a.onFocus()})},b.prototype.onSelectionChanged=function(a,b,c){void 0===c&&(c=!1);this._runOperation(function(d){return d.onSelectionChanged(a,
b,c)})},b.prototype.onCursorMove=function(){this._runOperation(function(a){return a.onCursorMove()})},b.prototype.onOptionsChanged=function(){this._runOperation(function(a){return a.onOptionsChanged()})},b.prototype.clear=function(){this._runOperation(function(a){return a.reset()})},b.prototype._runOperation=function(a){this._renderLayers.forEach(function(b){return a(b)})},b.prototype.renderRows=function(a,b){this._renderLayers.forEach(function(c){return c.onGridChanged(a,b)})},b.prototype._updateDimensions=
function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=1===this._optionsService.options.lineHeight?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/
2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=
Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},b.prototype.registerCharacterJoiner=function(a){return this._characterJoinerRegistry.registerCharacterJoiner(a)},b.prototype.deregisterCharacterJoiner=function(a){return this._characterJoinerRegistry.deregisterCharacterJoiner(a)},b=f([h(3,n.IBufferService),
h(4,l.ICharSizeService),h(5,n.IOptionsService),h(6,n.ICoreService),h(7,l.ICoreBrowserService)],b)}(a.Disposable);b.Renderer=d},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,
"__esModule",{value:!0});var f=d(42);a=d(13);var h=d(6),k=d(3),r=d(28),q=d(5);d=function(a){function b(b,c,d,e,g,k,h,r){b=a.call(this,b,"text",c,g,d,k,h,r)||this;return b.bufferService=h,b.optionsService=r,b._characterWidth=0,b._characterFont="",b._characterOverlapCache={},b._workCell=new q.CellData,b._state=new f.GridCache,b._characterJoinerRegistry=e,b}return g(b,a),b.prototype.resize=function(b){a.prototype.resize.call(this,b);var c=this._getFont(!1,!1);this._characterWidth===b.scaledCharWidth&&
this._characterFont===c||(this._characterWidth=b.scaledCharWidth,this._characterFont=c,this._characterOverlapCache={});this._state.clear();this._state.resize(this._bufferService.cols,this._bufferService.rows)},b.prototype.reset=function(){this._state.clear();this._clearAll()},b.prototype._forEachCell=function(a,b,c,d){for(;a<=b;a++){var e=a+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.lines.get(e);e=c?c.getJoinedCharacters(e):[];for(var f=0;f<this._bufferService.cols;f++){g.loadCell(f,
this._workCell);var q=this._workCell,l=!1,h=f;0!==q.getWidth()&&(0<e.length&&f===e[0][0]&&(l=!0,h=e.shift(),q=new r.JoinedCellData(this._workCell,g.translateToString(!0,h[0],h[1]),h[1]-h[0]),h=h[1]-1),!l&&this._isOverlapping(q)&&h<g.length-1&&g.getCodePoint(h+1)===k.NULL_CELL_CODE&&(q.content&=-12582913,q.content|=8388608),d(q,f,a),f=h)}}},b.prototype._drawBackground=function(a,b){var c=this,d=this._ctx,e=this._bufferService.cols,g=0,f=0,q=null;d.save();this._forEachCell(a,b,null,function(a,b,l){var k=
null;a.isInverse()?k=a.isFgDefault()?c._colors.foreground.css:a.isFgRGB()?"rgb("+h.AttributeData.toColorRGB(a.getFgColor()).join(",")+")":c._colors.ansi[a.getFgColor()].css:a.isBgRGB()?k="rgb("+h.AttributeData.toColorRGB(a.getBgColor()).join(",")+")":a.isBgPalette()&&(k=c._colors.ansi[a.getBgColor()].css);null===q&&(g=b,f=l);l!==f?(d.fillStyle=q||"",c._fillCells(g,f,e-g,1),g=b,f=l):q!==k&&(d.fillStyle=q||"",c._fillCells(g,f,b-g,1),g=b,f=l);q=k});null!==q&&(d.fillStyle=q,this._fillCells(g,f,e-g,1));
d.restore()},b.prototype._drawForeground=function(a,b){var c=this;this._forEachCell(a,b,this._characterJoinerRegistry,function(a,b,d){if(!a.isInvisible()&&(c._drawChars(a,b,d),a.isUnderline())){if(c._ctx.save(),a.isInverse())if(a.isBgDefault())c._ctx.fillStyle=c._colors.background.css;else if(a.isBgRGB())c._ctx.fillStyle="rgb("+h.AttributeData.toColorRGB(a.getBgColor()).join(",")+")";else{var e=a.getBgColor();c._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&8>e&&(e+=8);c._ctx.fillStyle=
c._colors.ansi[e].css}else a.isFgDefault()?c._ctx.fillStyle=c._colors.foreground.css:a.isFgRGB()?c._ctx.fillStyle="rgb("+h.AttributeData.toColorRGB(a.getFgColor()).join(",")+")":(e=a.getFgColor(),c._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&8>e&&(e+=8),c._ctx.fillStyle=c._colors.ansi[e].css);c._fillBottomLineAtCells(b,d,a.getWidth());c._ctx.restore()}})},b.prototype.onGridChanged=function(a,b){0!==this._state.cache.length&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,
a,this._bufferService.cols,b-a+1),this._drawBackground(a,b),this._drawForeground(a,b))},b.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},b.prototype._isOverlapping=function(a){if(1!==a.getWidth()||256>a.getCode())return!1;a=a.getChars();if(this._characterOverlapCache.hasOwnProperty(a))return this._characterOverlapCache[a];this._ctx.save();this._ctx.font=this._characterFont;var b=Math.floor(this._ctx.measureText(a).width)>this._characterWidth;
return this._ctx.restore(),this._characterOverlapCache[a]=b,b},b}(a.BaseRenderLayer);b.TextRenderLayer=d},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this.cache=[]}return a.prototype.resize=function(a,b){for(var c=0;c<a;c++){this.cache.length<=c&&this.cache.push([]);for(var d=this.cache[c].length;d<b;d++)this.cache[c].push(void 0);this.cache[c].length=b}this.cache.length=a},a.prototype.clear=function(){for(var a=0;a<this.cache.length;a++)for(var b=0;b<
this.cache[a].length;b++)this.cache[a][b]=void 0},a}();b.GridCache=a},function(a,b,d){function c(a){return a.code<<21|a.bg<<12|a.fg<<3|(a.bold?0:4)+(a.dim?0:2)+(a.italic?0:1)}var g,f=this&&this.__extends||(g=function(a,b){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function c(){this.constructor=a}g(a,b);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,
new c)});Object.defineProperty(b,"__esModule",{value:!0});var h=d(9);a=d(44);var k=d(26),r=d(46),q=d(11),t=d(27),v=d(10),l={css:"rgba(0, 0, 0, 0)",rgba:0};b.getGlyphCacheKey=c;d=function(a){function b(b,c){var d=a.call(this)||this;d._config=c;d._drawToCacheCount=0;d._glyphsWaitingOnBitmap=[];d._bitmapCommitTimeout=null;d._bitmap=null;d._cacheCanvas=b.createElement("canvas");d._cacheCanvas.width=1024;d._cacheCanvas.height=1024;d._cacheCtx=t.throwIfFalsy(d._cacheCanvas.getContext("2d",{alpha:!0}));
b=b.createElement("canvas");b.width=d._config.scaledCharWidth;b.height=d._config.scaledCharHeight;d._tmpCtx=t.throwIfFalsy(b.getContext("2d",{alpha:d._config.allowTransparency}));d._width=Math.floor(1024/d._config.scaledCharWidth);d._height=Math.floor(1024/d._config.scaledCharHeight);b=d._width*d._height;return d._cacheMap=new r.LRUMap(b),d._cacheMap.prealloc(b),d}return f(b,a),b.prototype.dispose=function(){null!==this._bitmapCommitTimeout&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=
null)},b.prototype.beginFrame=function(){this._drawToCacheCount=0},b.prototype.draw=function(a,b,d,e){if(32===b.code)return!0;if(!this._canCache(b))return!1;var g=c(b),f=this._cacheMap.get(g);return null!=f?(this._drawFromCache(a,f,d,e),!0):100>this._drawToCacheCount?(f=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index,b=this._drawToCache(b,f),this._cacheMap.set(g,b),this._drawFromCache(a,b,d,e),!0):!1},b.prototype._canCache=function(a){return 256>a.code},
b.prototype._toCoordinateX=function(a){return a%this._width*this._config.scaledCharWidth},b.prototype._toCoordinateY=function(a){return Math.floor(a/this._width)*this._config.scaledCharHeight},b.prototype._drawFromCache=function(a,b,c,d){if(!b.isEmpty){var e=this._toCoordinateX(b.index),g=this._toCoordinateY(b.index);a.drawImage(b.inBitmap?this._bitmap:this._cacheCanvas,e,g,this._config.scaledCharWidth,this._config.scaledCharHeight,c,d,this._config.scaledCharWidth,this._config.scaledCharHeight)}},
b.prototype._getColorFromAnsiIndex=function(a){return a<this._config.colors.ansi.length?this._config.colors.ansi[a]:k.DEFAULT_ANSI_COLORS[a]},b.prototype._getBackgroundColor=function(a){return this._config.allowTransparency?l:a.bg===h.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:256>a.bg?this._getColorFromAnsiIndex(a.bg):this._config.colors.background},b.prototype._getForegroundColor=function(a){return a.fg===h.INVERTED_DEFAULT_COLOR?v.opaque(this._config.colors.background):256>a.fg?this._getColorFromAnsiIndex(a.fg):
this._config.colors.foreground},b.prototype._drawToCache=function(a,b){this._drawToCacheCount++;this._tmpCtx.save();var c=this._getBackgroundColor(a);this._tmpCtx.globalCompositeOperation="copy";this._tmpCtx.fillStyle=c.css;this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight);this._tmpCtx.globalCompositeOperation="source-over";this._tmpCtx.font=(a.italic?"italic":"")+" "+(a.bold?this._config.fontWeightBold:this._config.fontWeight)+" "+this._config.fontSize*this._config.devicePixelRatio+
"px "+this._config.fontFamily;this._tmpCtx.textBaseline="middle";this._tmpCtx.fillStyle=this._getForegroundColor(a).css;a.dim&&(this._tmpCtx.globalAlpha=h.DIM_OPACITY);this._tmpCtx.fillText(a.chars,0,this._config.scaledCharHeight/2);this._tmpCtx.restore();a=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight);var d=!1;if(!this._config.allowTransparency){d=!0;var e=c.rgba>>>24,g=c.rgba>>>16&255;c=c.rgba>>>8&255;for(var f=0;f<a.data.length;f+=4)a.data[f]===e&&a.data[f+
1]===g&&a.data[f+2]===c?a.data[f+3]=0:d=!1}c=this._toCoordinateX(b);e=this._toCoordinateY(b);this._cacheCtx.putImageData(a,c,e);b={index:b,isEmpty:d,inBitmap:!1};return this._addGlyphToBitmap(b),b},b.prototype._addGlyphToBitmap=function(a){var b=this;"createImageBitmap"in window&&!q.isFirefox&&!q.isSafari&&(this._glyphsWaitingOnBitmap.push(a),null===this._bitmapCommitTimeout&&(this._bitmapCommitTimeout=window.setTimeout(function(){return b._generateBitmap()},100)))},b.prototype._generateBitmap=function(){var a=
this,b=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[];window.createImageBitmap(this._cacheCanvas).then(function(c){a._bitmap=c;for(c=0;c<b.length;c++)b[c].inBitmap=!0});this._bitmapCommitTimeout=null},b}(a.BaseCharAtlas);b.DynamicCharAtlas=d;d=function(a){function b(){return a.call(this)||this}return f(b,a),b.prototype.draw=function(){return!1},b}(a.BaseCharAtlas);b.NoneCharAtlas=d},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this._didWarmUp=
!1}return a.prototype.dispose=function(){},a.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},a.prototype._doWarmUp=function(){},a.prototype.beginFrame=function(){},a}();b.BaseCharAtlas=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this._color={};this._rgba={}}return a.prototype.clear=function(){this._color={};this._rgba={}},a.prototype.setCss=function(a,b,c){this._rgba[a]||(this._rgba[a]={});this._rgba[a][b]=c},a.prototype.getCss=
function(a,b){return this._rgba[a]?this._rgba[a][b]:void 0},a.prototype.setColor=function(a,b,c){this._color[a]||(this._color[a]={});this._color[a][b]=c},a.prototype.getColor=function(a,b){return this._color[a]?this._color[a][b]:void 0},a}();b.ColorContrastCache=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(a){this.capacity=a;this._map={};this._tail=this._head=null;this._nodePool=[];this.size=0}return a.prototype._unlinkNode=function(a){var b=a.prev,c=a.next;
a===this._head&&(this._head=c);a===this._tail&&(this._tail=b);null!==b&&(b.next=c);null!==c&&(c.prev=b)},a.prototype._appendNode=function(a){var b=this._tail;null!==b&&(b.next=a);a.prev=b;a.next=null;this._tail=a;null===this._head&&(this._head=a)},a.prototype.prealloc=function(a){for(var b=this._nodePool,c=0;c<a;c++)b.push({prev:null,next:null,key:null,value:null})},a.prototype.get=function(a){a=this._map[a];return void 0!==a?(this._unlinkNode(a),this._appendNode(a),a.value):null},a.prototype.peekValue=
function(a){a=this._map[a];return void 0!==a?a.value:null},a.prototype.peek=function(){var a=this._head;return null===a?null:a.value},a.prototype.set=function(a,b){var c=this._map[a];if(void 0!==c)c=this._map[a],this._unlinkNode(c),c.value=b;else if(this.size>=this.capacity)c=this._head,this._unlinkNode(c),delete this._map[c.key],c.key=a,c.value=b,this._map[a]=c;else{var d=this._nodePool;0<d.length?((c=d.pop()).key=a,c.value=b):c={prev:null,next:null,key:a,value:b};this._map[a]=c;this.size++}this._appendNode(c)},
a}();b.LRUMap=a},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});a=function(a){function b(b,c,d,e,g,f){b=a.call(this,b,"selection",c,!0,d,e,g,f)||this;
return b.bufferService=g,b.optionsService=f,b._clearState(),b}return g(b,a),b.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},b.prototype.resize=function(b){a.prototype.resize.call(this,b);this._clearState()},b.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},b.prototype.onSelectionChanged=function(a,b,c){if(this._didStateChange(a,b,c,this._bufferService.buffer.ydisp))if(this._clearAll(),
a&&b){var d=a[1]-this._bufferService.buffer.ydisp,e=b[1]-this._bufferService.buffer.ydisp,g=Math.max(d,0),f=Math.min(e,this._bufferService.rows-1);g>=this._bufferService.rows||0>f||((this._ctx.fillStyle=this._colors.selection.css,c)?(d=a[0],this._fillCells(d,g,b[0]-d,f-g+1)):(d=d===g?a[0]:0,this._fillCells(d,g,(g===f?b[0]:this._bufferService.cols)-d,1),(this._fillCells(0,g+1,this._bufferService.cols,Math.max(f-g-1,0)),g!==f)&&this._fillCells(0,f,e===f?b[0]:this._bufferService.cols,1)),this._state.start=
[a[0],a[1]],this._state.end=[b[0],b[1]],this._state.columnSelectMode=c,this._state.ydisp=this._bufferService.buffer.ydisp)}else this._clearState()},b.prototype._didStateChange=function(a,b,c,d){return!this._areCoordinatesEqual(a,this._state.start)||!this._areCoordinatesEqual(b,this._state.end)||c!==this._state.columnSelectMode||d!==this._state.ydisp},b.prototype._areCoordinatesEqual=function(a,b){return!(!a||!b)&&a[0]===b[0]&&a[1]===b[1]},b}(d(13).BaseRenderLayer);b.SelectionRenderLayer=a},function(a,
b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});a=d(13);var f=d(5);d=function(a){function b(b,c,d,e,g,h,k,r,X){b=a.call(this,b,"cursor",c,!0,d,e,h,k)||this;return b._onRequestRefreshRowsEvent=
g,b.bufferService=h,b.optionsService=k,b._coreService=r,b._coreBrowserService=X,b._cell=new f.CellData,b._state={x:0,y:0,isFocused:!1,style:"",width:0},b._cursorRenderers={bar:b._renderBarCursor.bind(b),block:b._renderBlockCursor.bind(b),underline:b._renderUnderlineCursor.bind(b)},b}return g(b,a),b.prototype.resize=function(b){a.prototype.resize.call(this,b);this._state={x:0,y:0,isFocused:!1,style:"",width:0}},b.prototype.reset=function(){this._clearCursor();this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),
this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},b.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause();this._onRequestRefreshRowsEvent.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},b.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRefreshRowsEvent.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},b.prototype.onOptionsChanged=
function(){var a,b=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new h(this._coreBrowserService.isFocused,function(){b._render(!0)})):(null===(a=this._cursorBlinkStateManager)||void 0===a||a.dispose(),this._cursorBlinkStateManager=void 0);this._onRequestRefreshRowsEvent.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},b.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},
b.prototype.onGridChanged=function(){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},b.prototype._render=function(){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var a=this._bufferService.buffer.ybase+this._bufferService.buffer.y,b=a-this._bufferService.buffer.ydisp;if(0>b||b>=this._bufferService.rows)this._clearCursor();else if(this._bufferService.buffer.lines.get(a).loadCell(this._bufferService.buffer.x,
this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused)return this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,a=this._optionsService.options.cursorStyle,a&&"block"!==a?this._cursorRenderers[a](this._bufferService.buffer.x,b,this._cell):this._renderBlurCursor(this._bufferService.buffer.x,b,this._cell),this._ctx.restore(),this._state.x=this._bufferService.buffer.x,this._state.y=b,this._state.isFocused=!1,this._state.style=a,void(this._state.width=
this._cell.getWidth());if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===this._bufferService.buffer.x&&this._state.y===b&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save();this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](this._bufferService.buffer.x,b,
this._cell);this._ctx.restore();this._state.x=this._bufferService.buffer.x;this._state.y=b;this._state.isFocused=!1;this._state.style=this._optionsService.options.cursorStyle;this._state.width=this._cell.getWidth()}else this._clearCursor()}}else this._clearCursor()},b.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},b.prototype._renderBarCursor=function(a,b){this._ctx.save();this._ctx.fillStyle=
this._colors.cursor.css;this._fillLeftLineAtCell(a,b);this._ctx.restore()},b.prototype._renderBlockCursor=function(a,b,c){this._ctx.save();this._ctx.fillStyle=this._colors.cursor.css;this._fillCells(a,b,c.getWidth(),1);this._ctx.fillStyle=this._colors.cursorAccent.css;this._fillCharTrueColor(c,a,b);this._ctx.restore()},b.prototype._renderUnderlineCursor=function(a,b){this._ctx.save();this._ctx.fillStyle=this._colors.cursor.css;this._fillBottomLineAtCells(a,b);this._ctx.restore()},b.prototype._renderBlurCursor=
function(a,b,c){this._ctx.save();this._ctx.strokeStyle=this._colors.cursor.css;this._strokeRectAtCell(a,b,c.getWidth(),1);this._ctx.restore()},b}(a.BaseRenderLayer);b.CursorRenderLayer=d;var h=function(){function a(a,b){this._renderCallback=b;this.isCursorVisible=!0;a&&this._restartInterval()}return Object.defineProperty(a.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!0,configurable:!0}),a.prototype.dispose=function(){this._blinkInterval&&
(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0);this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0);this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},a.prototype.restartBlinkAnimation=function(){var a=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){a._renderCallback();
a._animationFrame=void 0})))},a.prototype._restartInterval=function(a){var b=this;void 0===a&&(a=600);this._blinkInterval&&window.clearInterval(this._blinkInterval);this._blinkStartTimeout=setTimeout(function(){if(b._animationTimeRestarted){var a=600-(Date.now()-b._animationTimeRestarted);if(b._animationTimeRestarted=void 0,0<a)return void b._restartInterval(a)}b.isCursorVisible=!1;b._animationFrame=window.requestAnimationFrame(function(){b._renderCallback();b._animationFrame=void 0});b._blinkInterval=
setInterval(function(){if(b._animationTimeRestarted){var a=600-(Date.now()-b._animationTimeRestarted);return b._animationTimeRestarted=void 0,void b._restartInterval(a)}b.isCursorVisible=!b.isCursorVisible;b._animationFrame=window.requestAnimationFrame(function(){b._renderCallback();b._animationFrame=void 0})},600)},a)},a.prototype.pause=function(){this.isCursorVisible=!0;this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0);this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),
this._blinkStartTimeout=void 0);this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},a.prototype.resume=function(){this._animationTimeRestarted=void 0;this._restartInterval();this.restartBlinkAnimation()},a}()},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=
a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});a=d(13);var f=d(9),h=d(25);d=function(a){function b(b,c,d,e,g,f,h){var l=a.call(this,b,"link",c,!0,d,e,f,h)||this;return l.bufferService=f,l.optionsService=h,g.onLinkHover(function(a){return l._onLinkHover(a)}),g.onLinkLeave(function(a){return l._onLinkLeave(a)}),l}return g(b,a),b.prototype.resize=function(b){a.prototype.resize.call(this,b);this._state=void 0},b.prototype.reset=
function(){this._clearCurrentLink()},b.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var a=this._state.y2-this._state.y1-1;0<a&&this._clearCells(0,this._state.y1+1,this._state.cols,a);this._clearCells(0,this._state.y2,this._state.x2,1);this._state=void 0}},b.prototype._onLinkHover=function(a){if(a.fg===f.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:a.fg&&h.is256Color(a.fg)?this._ctx.fillStyle=
this._colors.ansi[a.fg].css:this._ctx.fillStyle=this._colors.foreground.css,a.y1===a.y2)this._fillBottomLineAtCells(a.x1,a.y1,a.x2-a.x1);else{this._fillBottomLineAtCells(a.x1,a.y1,a.cols-a.x1);for(var b=a.y1+1;b<a.y2;b++)this._fillBottomLineAtCells(0,b,a.cols);this._fillBottomLineAtCells(0,a.y2,a.x2)}this._state=a},b.prototype._onLinkLeave=function(){this._clearCurrentLink()},b}(a.BaseRenderLayer);b.LinkRenderLayer=d},function(a,b,d){function c(a,b,c,d,e,g,f,n,y){this.x1=a;this.y1=b;this.x2=c;this.y2=
d;this.clickCallback=e;this.hoverCallback=g;this.tooltipCallback=f;this.leaveCallback=n;this.willLinkActivate=y}Object.defineProperty(b,"__esModule",{value:!0});var g=d(19),f=d(1);a=function(){function a(a,b){this._bufferService=a;this._logService=b;this._linkMatchers=[];this._nextLinkMatcherId=0;this._onLinkHover=new f.EventEmitter;this._onLinkLeave=new f.EventEmitter;this._onLinkTooltip=new f.EventEmitter;this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(a.prototype,"onLinkHover",
{get:function(){return this._onLinkHover.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onLinkLeave",{get:function(){return this._onLinkLeave.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!0,configurable:!0}),a.prototype.attachToDom=function(a,b){this._element=a;this._mouseZoneManager=b},a.prototype.linkifyRows=function(b,c){var d=this;this._mouseZoneManager&&(void 0===
this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=b,this._rowsToLinkify.end=c):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,b),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,c)),this._mouseZoneManager.clearAll(b,c),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return d._linkifyRows()},a._timeBeforeLatency))},a.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var a=this._bufferService.buffer;
if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var b=a.ydisp+this._rowsToLinkify.start;if(!(b>=a.lines.length)){var c=Math.ceil(2E3/this._bufferService.cols);for(a=this._bufferService.buffer.iterator(!1,b,a.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,c,c);a.hasNext();)for(b=a.next(),c=0;c<this._linkMatchers.length;c++)this._doLinkifyRow(b.range.first,b.content,this._linkMatchers[c]);this._rowsToLinkify.start=void 0;this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},
a.prototype.registerLinkMatcher=function(a,b,c){if(void 0===c&&(c={}),!b)throw Error("handler must be defined");a={id:this._nextLinkMatcherId++,regex:a,handler:b,matchIndex:c.matchIndex,validationCallback:c.validationCallback,hoverTooltipCallback:c.tooltipCallback,hoverLeaveCallback:c.leaveCallback,willLinkActivate:c.willLinkActivate,priority:c.priority||0};return this._addLinkMatcherToList(a),a.id},a.prototype._addLinkMatcherToList=function(a){if(0!==this._linkMatchers.length){for(var b=this._linkMatchers.length-
1;0<=b;b--)if(a.priority<=this._linkMatchers[b].priority)return void this._linkMatchers.splice(b+1,0,a);this._linkMatchers.splice(0,0,a)}else this._linkMatchers.push(a)},a.prototype.deregisterLinkMatcher=function(a){for(var b=0;b<this._linkMatchers.length;b++)if(this._linkMatchers[b].id===a)return this._linkMatchers.splice(b,1),!0;return!1},a.prototype._doLinkifyRow=function(a,b,c){function d(){var d=e["number"!=typeof c.matchIndex?0:c.matchIndex];if(!d)return q._logService.debug("match found without corresponding matchIndex",
e,c),"break";if(h=b.indexOf(d,h+1),f.lastIndex=h+d.length,0>h)return"break";var l=q._bufferService.buffer.stringIndexToBufferIndex(a,h);if(0>l[0])return"break";var k=q._bufferService.buffer.lines.get(l[0]);if(!k)return"break";var r=(k=k.getFg(l[1]))?k>>9&511:void 0;c.validationCallback?c.validationCallback(d,function(a){g._rowsTimeoutId||a&&g._addLink(l[1],l[0]-g._bufferService.buffer.ydisp,d,c,r)}):q._addLink(l[1],l[0]-q._bufferService.buffer.ydisp,d,c,r)}for(var e,g=this,f=new RegExp(c.regex.source,
(c.regex.flags||"")+"g"),h=-1,q=this;null!==(e=f.exec(b))&&"break"!==d(););},a.prototype._addLink=function(a,b,d,e,f){var l=this;if(this._mouseZoneManager&&this._element){var h=g.getStringCellWidth(d),q=a%this._bufferService.cols,k=b+Math.floor(a/this._bufferService.cols),r=(q+h)%this._bufferService.cols,t=k+Math.floor((q+h)/this._bufferService.cols);0===r&&(r=this._bufferService.cols,t--);this._mouseZoneManager.add(new c(q+1,k+1,r+1,t+1,function(a){if(e.handler)return e.handler(a,d);window.open(d,
"_blank")},function(){l._onLinkHover.fire(l._createLinkHoverEvent(q,k,r,t,f));l._element.classList.add("xterm-cursor-pointer")},function(a){l._onLinkTooltip.fire(l._createLinkHoverEvent(q,k,r,t,f));e.hoverTooltipCallback&&e.hoverTooltipCallback(a,d,{start:{x:q,y:k},end:{x:r,y:t}})},function(){l._onLinkLeave.fire(l._createLinkHoverEvent(q,k,r,t,f));l._element.classList.remove("xterm-cursor-pointer");e.hoverLeaveCallback&&e.hoverLeaveCallback()},function(a){return!e.willLinkActivate||e.willLinkActivate(a,
d)}))}},a.prototype._createLinkHoverEvent=function(a,b,c,d,e){return{x1:a,y1:b,x2:c,y2:d,cols:this._bufferService.cols,fg:e}},a._timeBeforeLatency=200,a}();b.Linkifier=a;b.MouseZone=c},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)(e=a[l])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||
f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(11),h=d(52),k=d(5),r=d(1),q=d(4),t=d(0),v=d(29),l=d(53);a=String.fromCharCode(160);var n=new RegExp(a,"g");a=function(){function a(a,b,c,d,e,g,f,l){var q=this;this._scrollLines=a;this._element=b;this._screenElement=c;this._charSizeService=d;this._bufferService=e;this._coreService=g;this._mouseService=f;this._optionsService=l;
this._dragScrollAmount=0;this._enabled=!0;this._workCell=new k.CellData;this._mouseDownTimeStamp=0;this._onLinuxMouseSelection=new r.EventEmitter;this._onRedrawRequest=new r.EventEmitter;this._onSelectionChange=new r.EventEmitter;this._mouseMoveListener=function(a){return q._onMouseMove(a)};this._mouseUpListener=function(a){return q._onMouseUp(a)};this._coreService.onUserInput(function(){q.hasSelection&&q.clearSelection()});this._trimListener=this._bufferService.buffer.lines.onTrim(function(a){return q._onTrim(a)});
this._bufferService.buffers.onBufferActivate(function(a){return q._onBufferActivate(a)});this.enable();this._model=new h.SelectionModel(this._bufferService);this._activeSelectionMode=0}return Object.defineProperty(a.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onRedrawRequest",{get:function(){return this._onRedrawRequest.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,
"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!0,configurable:!0}),a.prototype.dispose=function(){this._removeMouseDownListeners()},a.prototype.reset=function(){this.clearSelection()},a.prototype.disable=function(){this.clearSelection();this._enabled=!1},a.prototype.enable=function(){this._enabled=!0},Object.defineProperty(a.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,
"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"hasSelection",{get:function(){var a=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;return!(!a||!b)&&(a[0]!==b[0]||a[1]!==b[1])},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"selectionText",{get:function(){var a=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;if(!a||!b)return"";var c=this._bufferService.buffer,
d=[];if(3===this._activeSelectionMode){if(a[0]===b[0])return"";for(var e=a[1];e<=b[1];e++){var g=c.translateBufferLineToString(e,!0,a[0],b[0]);d.push(g)}}else{d.push(c.translateBufferLineToString(a[1],!0,a[0],a[1]===b[1]?b[0]:void 0));for(e=a[1]+1;e<=b[1]-1;e++){var l=c.lines.get(e);g=c.translateBufferLineToString(e,!0);l&&l.isWrapped?d[d.length-1]+=g:d.push(g)}a[1]!==b[1]&&(l=c.lines.get(b[1]),g=c.translateBufferLineToString(b[1],!0,0,b[0]),l&&l.isWrapped?d[d.length-1]+=g:d.push(g))}return d.map(function(a){return a.replace(n,
" ")}).join(f.isWindows?"\r\n":"\n")},enumerable:!0,configurable:!0}),a.prototype.clearSelection=function(){this._model.clearSelection();this._removeMouseDownListeners();this.refresh();this._onSelectionChange.fire()},a.prototype.refresh=function(a){var b=this;(this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return b._refresh()})),f.isLinux&&a)&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},a.prototype._refresh=function(){this._refreshAnimationFrame=
void 0;this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},a.prototype.isClickInSelection=function(a){a=this._getMouseBufferCoords(a);var b=this._model.finalSelectionStart,c=this._model.finalSelectionEnd;return!!(b&&c&&a)&&this._areCoordsInSelection(a,b,c)},a.prototype._areCoordsInSelection=function(a,b,c){return a[1]>b[1]&&a[1]<c[1]||b[1]===c[1]&&a[1]===b[1]&&a[0]>=b[0]&&a[0]<c[0]||b[1]<c[1]&&a[1]===
c[1]&&a[0]<c[0]||b[1]<c[1]&&a[1]===b[1]&&a[0]>=b[0]},a.prototype.selectWordAtCursor=function(a){(a=this._getMouseBufferCoords(a))&&(this._selectWordAt(a,!1),this._model.selectionEnd=void 0,this.refresh(!0))},a.prototype.selectAll=function(){this._model.isSelectAllActive=!0;this.refresh();this._onSelectionChange.fire()},a.prototype.selectLines=function(a,b){this._model.clearSelection();a=Math.max(a,0);b=Math.min(b,this._bufferService.buffer.lines.length-1);this._model.selectionStart=[0,a];this._model.selectionEnd=
[this._bufferService.cols,b];this.refresh();this._onSelectionChange.fire()},a.prototype._onTrim=function(a){this._model.onTrim(a)&&this.refresh()},a.prototype._getMouseBufferCoords=function(a){if(a=this._mouseService.getCoords(a,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0))return a[0]--,a[1]--,a[1]+=this._bufferService.buffer.ydisp,a},a.prototype._getMouseEventScrollAmount=function(a){a=v.getCoordsRelativeToElement(a,this._screenElement)[1];var b=this._bufferService.rows*
Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight);return 0<=a&&a<=b?0:(a>b&&(a-=b),a=Math.min(Math.max(a,-50),50),(a/=50)/Math.abs(a)+Math.round(14*a))},a.prototype.shouldForceSelection=function(a){return f.isMac?a.altKey&&this._optionsService.options.macOptionClickForcesSelection:a.shiftKey},a.prototype.onMouseDown=function(a){if(this._mouseDownTimeStamp=a.timeStamp,(2!==a.button||!this.hasSelection)&&0===a.button){if(!this._enabled){if(!this.shouldForceSelection(a))return;
a.stopPropagation()}a.preventDefault();this._dragScrollAmount=0;this._enabled&&a.shiftKey?this._onIncrementalClick(a):1===a.detail?this._onSingleClick(a):2===a.detail?this._onDoubleClick(a):3===a.detail&&this._onTripleClick(a);this._addMouseDownListeners();this.refresh(!0)}},a.prototype._addMouseDownListeners=function(){var a=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",
this._mouseUpListener));this._dragScrollIntervalTimer=window.setInterval(function(){return a._dragScroll()},50)},a.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener));clearInterval(this._dragScrollIntervalTimer);this._dragScrollIntervalTimer=void 0},a.prototype._onIncrementalClick=function(a){this._model.selectionStart&&
(this._model.selectionEnd=this._getMouseBufferCoords(a))},a.prototype._onSingleClick=function(a){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(a)?3:0,this._model.selectionStart=this._getMouseBufferCoords(a),this._model.selectionStart)this._model.selectionEnd=void 0,(a=this._bufferService.buffer.lines.get(this._model.selectionStart[1]))&&a.length!==this._model.selectionStart[0]&&0===a.hasWidth(this._model.selectionStart[0])&&
this._model.selectionStart[0]++},a.prototype._onDoubleClick=function(a){(a=this._getMouseBufferCoords(a))&&(this._activeSelectionMode=1,this._selectWordAt(a,!0))},a.prototype._onTripleClick=function(a){(a=this._getMouseBufferCoords(a))&&(this._activeSelectionMode=2,this._selectLineAt(a[1]))},a.prototype.shouldColumnSelect=function(a){return a.altKey&&!(f.isMac&&this._optionsService.options.macOptionClickForcesSelection)},a.prototype._onMouseMove=function(a){if(a.stopImmediatePropagation(),this._model.selectionStart){var b=
this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;(this._model.selectionEnd=this._getMouseBufferCoords(a),this._model.selectionEnd)?(2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(a),3!==this._activeSelectionMode&&
(0<this._dragScrollAmount?this._model.selectionEnd[0]=this._bufferService.cols:0>this._dragScrollAmount&&(this._model.selectionEnd[0]=0)),a=this._bufferService.buffer,this._model.selectionEnd[1]<a.lines.length&&(a=a.lines.get(this._model.selectionEnd[1]))&&0===a.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]++,b&&b[0]===this._model.selectionEnd[0]&&b[1]===this._model.selectionEnd[1]||this.refresh(!0)):this.refresh(!0)}},a.prototype._dragScroll=function(){if(this._model.selectionEnd&&
this._model.selectionStart&&this._dragScrollAmount){this._scrollLines(this._dragScrollAmount,!1);var a=this._bufferService.buffer;0<this._dragScrollAmount?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(a.ydisp+this._bufferService.rows,a.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=a.ydisp);this.refresh()}},a.prototype._onMouseUp=function(a){var b=a.timeStamp-
this._mouseDownTimeStamp;(this._removeMouseDownListeners(),1>=this.selectionText.length&&500>b)?a.altKey&&this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp&&(a=this._mouseService.getCoords(a,this._element,this._bufferService.cols,this._bufferService.rows,!1))&&void 0!==a[0]&&void 0!==a[1]&&(a=l.moveToCellSequence(a[0]-1,a[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys),this._coreService.triggerDataEvent(a,!0)):this.hasSelection&&this._onSelectionChange.fire()},
a.prototype._onBufferActivate=function(a){var b=this;this.clearSelection();this._trimListener.dispose();this._trimListener=a.activeBuffer.lines.onTrim(function(a){return b._onTrim(a)})},a.prototype._convertViewportColToCharacterIndex=function(a,b){for(var c=b[0],d=0;b[0]>=d;d++){var e=a.loadCell(d,this._workCell).getChars().length;0===this._workCell.getWidth()?c--:1<e&&b[0]!==d&&(c+=e-1)}return c},a.prototype.setSelection=function(a,b,c){this._model.clearSelection();this._removeMouseDownListeners();
this._model.selectionStart=[a,b];this._model.selectionStartLength=c;this.refresh()},a.prototype._getWordAt=function(a,b,c,d){if(void 0===c&&(c=!0),void 0===d&&(d=!0),!(a[0]>=this._bufferService.cols)){var e=this._bufferService.buffer,g=e.lines.get(a[1]);if(g){var f=e.translateBufferLineToString(a[1],!1),l=this._convertViewportColToCharacterIndex(g,a),h=l,q=a[0]-l,k=0,r=0,n=0,t=0;if(" "===f.charAt(l)){for(;0<l&&" "===f.charAt(l-1);)l--;for(;h<f.length&&" "===f.charAt(h+1);)h++}else{var v=a[0],y=a[0];
0===g.getWidth(v)&&(k++,v--);2===g.getWidth(y)&&(r++,y++);var B=g.getString(y).length;for(1<B&&(t+=B-1,h+=B-1);0<v&&0<l&&!this._isCharWordSeparator(g.loadCell(v-1,this._workCell));)g.loadCell(v-1,this._workCell),B=this._workCell.getChars().length,0===this._workCell.getWidth()?(k++,v--):1<B&&(n+=B-1,l-=B-1),l--,v--;for(;y<g.length&&h+1<f.length&&!this._isCharWordSeparator(g.loadCell(y+1,this._workCell));)g.loadCell(y+1,this._workCell),v=this._workCell.getChars().length,2===this._workCell.getWidth()?
(r++,y++):1<v&&(t+=v-1,h+=v-1),h++,y++}h++;q=l+q-k+n;k=Math.min(this._bufferService.cols,h-l+k+r-n-t);if(b||""!==f.slice(l,h).trim())return c&&0===q&&32!==g.getCodePoint(0)&&(b=e.lines.get(a[1]-1))&&g.isWrapped&&32!==b.getCodePoint(this._bufferService.cols-1)&&(b=this._getWordAt([this._bufferService.cols-1,a[1]-1],!1,!0,!1))&&(b=this._bufferService.cols-b.start,q-=b,k+=b),d&&q+k===this._bufferService.cols&&32!==g.getCodePoint(this._bufferService.cols-1)&&(d=e.lines.get(a[1]+1))&&d.isWrapped&&32!==
d.getCodePoint(0)&&(a=this._getWordAt([0,a[1]+1],!1,!1,!0))&&(k+=a.length),{start:q,length:k}}}},a.prototype._selectWordAt=function(a,b){if(b=this._getWordAt(a,b)){for(;0>b.start;)b.start+=this._bufferService.cols,a[1]--;this._model.selectionStart=[b.start,a[1]];this._model.selectionStartLength=b.length}},a.prototype._selectToWordAt=function(a){var b=this._getWordAt(a,!0);if(b){for(a=a[1];0>b.start;)b.start+=this._bufferService.cols,a--;if(!this._model.areSelectionValuesReversed())for(;b.start+b.length>
this._bufferService.cols;)b.length-=this._bufferService.cols,a++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?b.start:b.start+b.length,a]}},a.prototype._isCharWordSeparator=function(a){return 0!==a.getWidth()&&0<=this._optionsService.options.wordSeparator.indexOf(a.getChars())},a.prototype._selectLineAt=function(a){a=this._bufferService.buffer.getWrappedRangeForLine(a);this._model.selectionStart=[0,a.first];this._model.selectionEnd=[this._bufferService.cols,a.last];this._model.selectionStartLength=
0},a=c([g(3,q.ICharSizeService),g(4,t.IBufferService),g(5,t.ICoreService),g(6,q.IMouseService),g(7,t.IOptionsService)],a)}();b.SelectionService=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(a){this._bufferService=a;this.isSelectAllActive=!1;this.selectionStartLength=0}return a.prototype.clearSelection=function(){this.selectionEnd=this.selectionStart=void 0;this.isSelectAllActive=!1;this.selectionStartLength=0},Object.defineProperty(a.prototype,"finalSelectionStart",
{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var a=this.selectionStart[0]+this.selectionStartLength;
return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!0,configurable:!0}),a.prototype.areSelectionValuesReversed=function(){var a=this.selectionStart,b=this.selectionEnd;return!(!a||!b)&&(a[1]>
b[1]||a[1]===b[1]&&a[0]>b[0])},a.prototype.onTrim=function(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&0>this.selectionEnd[1]?(this.clearSelection(),!0):(this.selectionStart&&0>this.selectionStart[1]&&(this.selectionStart[1]=0),!1)},a}();b.SelectionModel=a},function(a,b,d){function c(a,b,c,d){var e=a-g(c,a),f=b-g(c,b);e=Math.abs(e-f);f=0;for(var l=a-g(c,a),h=b-g(c,b),q=0;q<Math.abs(l-h);q++){var n=c.buffer.lines.get(l+
("A"===(a>b?"A":"B")?-1:1)*q);n&&n.isWrapped&&f++}return r(e-f,k(a>b?"A":"B",d))}function g(a,b){for(var c=0,d=a.buffer.lines.get(b),e=d&&d.isWrapped;e&&0<=b&&b<a.rows;)c++,e=(d=a.buffer.lines.get(--b))&&d.isWrapped;return c}function f(a,b,d,e,f,h){var l;return l=0<c(d,e,f,h).length?e-g(f,e):b,a<d&&l<=e||a>=d&&l<e?"C":"D"}function h(a,b,c,d,e,g){for(var f=a,l="";f!==c||b!==d;)f+=e?1:-1,e&&f>g.cols-1?(l+=g.buffer.translateBufferLineToString(b,!1,a,f),f=0,a=0,b++):!e&&0>f&&(l+=g.buffer.translateBufferLineToString(b,
!1,0,a+1),a=f=g.cols-1,b--);return l+g.buffer.translateBufferLineToString(b,!1,a,f)}function k(a,b){return q.C0.ESC+(b?"O":"[")+a}function r(a,b){a=Math.floor(a);for(var c="",d=0;d<a;d++)c+=b;return c}Object.defineProperty(b,"__esModule",{value:!0});var q=d(12);b.moveToCellSequence=function(a,b,d,e){var l=d.buffer.x,q=d.buffer.y;return d.buffer.hasScrollback?function(a,b,c,d,e,g){b=f(a,b,c,d,e,g);return r(Math.abs(a-c),k(b,g))}(l,q,a,b,d,e):function(a,b,d,e,f,l){return 0===c(b,e,f,l).length?"":r(h(a,
b,a,b-g(f,b),!1,f).length,k("D",l))}(l,q,0,b,d,e)+c(q,b,d,e)+function(a,b,d,e,l,q){var n=0<c(b,e,l,q).length?e-g(l,e):b;b=f(a,b,d,e,l,q);return r(h(a,n,d,e,"C"===b,l).length,k(b,q))}(l,q,a,b,d,e)}},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,
c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(0);a=function(){function a(a){this._optionsService=a}return Object.defineProperty(a,"audioContext",{get:function(){if(!a._audioContext){var b=window.AudioContext||window.webkitAudioContext;if(!b)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;
a._audioContext=new b}return a._audioContext},enumerable:!0,configurable:!0}),a.prototype.playBellSound=function(){var b=a.audioContext;if(b){var c=b.createBufferSource();b.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(a){c.buffer=a;c.connect(b.destination);c.start(0)})}},a.prototype._base64ToArrayBuffer=function(a){a=window.atob(a);for(var b=a.length,c=new Uint8Array(b),d=0;d<b;d++)c[d]=a.charCodeAt(d);return c.buffer},a.prototype._removeMimeType=
function(a){return a.split(",")[1]},a=c([g(0,f.IOptionsService)],a)}();b.SoundService=a},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)}),f=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,
f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)(e=a[l])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},h=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});a=d(2);var k=d(7),r=d(4),q=d(0);d=function(a){function b(b,c,d,e,g){var f=a.call(this)||this;return f._element=
b,f._screenElement=c,f._bufferService=d,f._mouseService=e,f._selectionService=g,f._zones=[],f._areZonesActive=!1,f._lastHoverCoords=[void 0,void 0],f._initialSelectionLength=0,f.register(k.addDisposableDomListener(f._element,"mousedown",function(a){return f._onMouseDown(a)})),f._mouseMoveListener=function(a){return f._onMouseMove(a)},f._mouseLeaveListener=function(a){return f._onMouseLeave(a)},f._clickListener=function(a){return f._onClick(a)},f}return g(b,a),b.prototype.dispose=function(){a.prototype.dispose.call(this);
this._deactivate()},b.prototype.add=function(a){this._zones.push(a);1===this._zones.length&&this._activate()},b.prototype.clearAll=function(a,b){if(0!==this._zones.length){a&&b||(a=0,b=this._bufferService.rows-1);for(var c=0;c<this._zones.length;c++){var d=this._zones[c];(d.y1>a&&d.y1<=b+1||d.y2>a&&d.y2<=b+1||d.y1<a&&d.y2>b+1)&&(this._currentZone&&this._currentZone===d&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(c--,1))}0===this._zones.length&&this._deactivate()}},
b.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},b.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),
this._element.removeEventListener("click",this._clickListener))},b.prototype._onMouseMove=function(a){this._lastHoverCoords[0]===a.pageX&&this._lastHoverCoords[1]===a.pageY||(this._onHover(a),this._lastHoverCoords=[a.pageX,a.pageY])},b.prototype._onHover=function(a){var b=this,c=this._findZoneEventAt(a);c!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),c&&(this._currentZone=c,c.hoverCallback&&
c.hoverCallback(a),this._tooltipTimeout=setTimeout(function(){return b._onTooltip(a)},500)))},b.prototype._onTooltip=function(a){this._tooltipTimeout=void 0;var b=this._findZoneEventAt(a);b&&b.tooltipCallback&&b.tooltipCallback(a)},b.prototype._onMouseDown=function(a){var b;(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive)&&(null===(b=this._findZoneEventAt(a))||void 0===b?0:b.willLinkActivate(a))&&(a.preventDefault(),a.stopImmediatePropagation())},b.prototype._onMouseLeave=
function(){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},b.prototype._onClick=function(a){var b=this._findZoneEventAt(a),c=this._getSelectionLength();b&&c===this._initialSelectionLength&&(b.clickCallback(a),a.preventDefault(),a.stopImmediatePropagation())},b.prototype._getSelectionLength=function(){var a=this._selectionService.selectionText;return a?a.length:0},b.prototype._findZoneEventAt=function(a){var b=
this._mouseService.getCoords(a,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(b){a=b[0];b=b[1];for(var c=0;c<this._zones.length;c++){var d=this._zones[c];if(d.y1===d.y2){if(b===d.y1&&a>=d.x1&&a<d.x2)return d}else if(b===d.y1&&a>=d.x1||b===d.y2&&a<d.x2||b>d.y1&&b<d.y2)return d}}},b=f([h(2,q.IBufferService),h(3,r.IMouseService),h(4,r.ISelectionService)],b)}(a.Disposable);b.MouseZoneManager=d},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||
{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});var f=d(17),h=d(11),k=d(30),r=d(7);a=d(2);var q=d(31);d=function(a){function b(b,c){var d=a.call(this)||this;d._terminal=b;d._renderService=c;d._liveRegionLineCount=0;d._charsToConsume=[];d._charsToAnnounce=
"";d._accessibilityTreeRoot=document.createElement("div");d._accessibilityTreeRoot.classList.add("xterm-accessibility");d._rowContainer=document.createElement("div");d._rowContainer.classList.add("xterm-accessibility-tree");d._rowElements=[];for(b=0;b<d._terminal.rows;b++)d._rowElements[b]=d._createAccessibilityTreeNode(),d._rowContainer.appendChild(d._rowElements[b]);return d._topBoundaryFocusListener=function(a){return d._onBoundaryFocus(a,0)},d._bottomBoundaryFocusListener=function(a){return d._onBoundaryFocus(a,
1)},d._rowElements[0].addEventListener("focus",d._topBoundaryFocusListener),d._rowElements[d._rowElements.length-1].addEventListener("focus",d._bottomBoundaryFocusListener),d._refreshRowsDimensions(),d._accessibilityTreeRoot.appendChild(d._rowContainer),d._renderRowsDebouncer=new k.RenderDebouncer(d._renderRows.bind(d)),d._refreshRows(),d._liveRegion=document.createElement("div"),d._liveRegion.classList.add("live-region"),d._liveRegion.setAttribute("aria-live","assertive"),d._accessibilityTreeRoot.appendChild(d._liveRegion),
d._terminal.element.insertAdjacentElement("afterbegin",d._accessibilityTreeRoot),d.register(d._renderRowsDebouncer),d.register(d._terminal.onResize(function(a){return d._onResize(a.rows)})),d.register(d._terminal.onRender(function(a){return d._refreshRows(a.start,a.end)})),d.register(d._terminal.onScroll(function(){return d._refreshRows()})),d.register(d._terminal.onA11yChar(function(a){return d._onChar(a)})),d.register(d._terminal.onLineFeed(function(){return d._onChar("\n")})),d.register(d._terminal.onA11yTab(function(a){return d._onTab(a)})),
d.register(d._terminal.onKey(function(a){return d._onKey(a.key)})),d.register(d._terminal.onBlur(function(){return d._clearLiveRegion()})),d.register(d._renderService.onDimensionsChange(function(){return d._refreshRowsDimensions()})),d._screenDprMonitor=new q.ScreenDprMonitor,d.register(d._screenDprMonitor),d._screenDprMonitor.setListener(function(){return d._refreshRowsDimensions()}),d.register(r.addDisposableDomListener(window,"resize",function(){return d._refreshRowsDimensions()})),d}return g(b,
a),b.prototype.dispose=function(){a.prototype.dispose.call(this);this._terminal.element.removeChild(this._accessibilityTreeRoot);this._rowElements.length=0},b.prototype._onBoundaryFocus=function(a,b){var c=a.target,d=this._rowElements[0===b?1:this._rowElements.length-2];if(c.getAttribute("aria-posinset")!==(0===b?"1":""+this._terminal.buffer.lines.length)&&a.relatedTarget===d){var e,g;(0===b?(e=c,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(e=this._rowElements.shift(),g=c,this._rowContainer.removeChild(e)),
e.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),0===b)?(c=this._createAccessibilityTreeNode(),this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)):(c=this._createAccessibilityTreeNode(),this._rowElements.push(c),this._rowContainer.appendChild(c));this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener);this._rowElements[this._rowElements.length-1].addEventListener("focus",
this._bottomBoundaryFocusListener);this._terminal.scrollLines(0===b?-1:1);this._rowElements[0===b?1:this._rowElements.length-2].focus();a.preventDefault();a.stopImmediatePropagation()}},b.prototype._onResize=function(a){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var b=this._rowContainer.children.length;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);
for(;this._rowElements.length>a;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener);this._refreshRowsDimensions()},b.prototype._createAccessibilityTreeNode=function(){var a=document.createElement("div");return a.setAttribute("role","listitem"),a.tabIndex=-1,this._refreshRowDimensions(a),a},b.prototype._onTab=function(a){for(var b=0;b<a;b++)this._onChar(" ")},b.prototype._onChar=function(a){var b=
this;21>this._liveRegionLineCount&&(0<this._charsToConsume.length?this._charsToConsume.shift()!==a&&(this._charsToAnnounce+=a):this._charsToAnnounce+=a,"\n"===a&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=f.tooMuchOutput)),h.isMac&&this._liveRegion.textContent&&0<this._liveRegion.textContent.length&&!this._liveRegion.parentNode&&setTimeout(function(){b._accessibilityTreeRoot.appendChild(b._liveRegion)},0))},b.prototype._clearLiveRegion=function(){this._liveRegion.textContent=
"";this._liveRegionLineCount=0;h.isMac&&this._liveRegion.parentNode&&this._accessibilityTreeRoot.removeChild(this._liveRegion)},b.prototype._onKey=function(a){this._clearLiveRegion();this._charsToConsume.push(a)},b.prototype._refreshRows=function(a,b){this._renderRowsDebouncer.refresh(a,b,this._terminal.rows)},b.prototype._renderRows=function(a,b){for(var c=this._terminal.buffer,d=c.lines.length.toString();a<=b;a++){var e=c.translateBufferLineToString(c.ydisp+a,!0),g=(c.ydisp+a+1).toString(),f=this._rowElements[a];
f&&(0===e.length?f.innerHTML="&nbsp;":f.textContent=e,f.setAttribute("aria-posinset",g),f.setAttribute("aria-setsize",d))}this._announceCharacters()},b.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var a=0;a<this._terminal.rows;a++)this._refreshRowDimensions(this._rowElements[a])}},b.prototype._refreshRowDimensions=function(a){a.style.height=this._renderService.dimensions.actualCellHeight+
"px"},b.prototype._announceCharacters=function(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},b}(a.Disposable);b.AccessibilityManager=d},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===
b?Object.create(b):(d.prototype=b.prototype,new d)}),f=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},h=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",
{value:!0});var k=d(58),r=d(9);a=d(2);var q=d(4),t=d(0),v=d(1),l=d(10),n=1;d=function(a){function b(b,c,d,e,g,f,h,q){var l=a.call(this)||this;return l._colors=b,l._element=c,l._screenElement=d,l._viewportElement=e,l._linkifier=g,l._charSizeService=f,l._optionsService=h,l._bufferService=q,l._terminalClass=n++,l._rowElements=[],l._onRequestRefreshRows=new v.EventEmitter,l._rowContainer=document.createElement("div"),l._rowContainer.classList.add("xterm-rows"),l._rowContainer.style.lineHeight="normal",
l._rowContainer.setAttribute("aria-hidden","true"),l._refreshRowElements(l._bufferService.cols,l._bufferService.rows),l._selectionContainer=document.createElement("div"),l._selectionContainer.classList.add("xterm-selection"),l._selectionContainer.setAttribute("aria-hidden","true"),l.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},
l._updateDimensions(),l._injectCss(),l._rowFactory=new k.DomRendererRowFactory(document,l._optionsService,l._colors),l._element.classList.add("xterm-dom-renderer-owner-"+l._terminalClass),l._screenElement.appendChild(l._rowContainer),l._screenElement.appendChild(l._selectionContainer),l._linkifier.onLinkHover(function(a){return l._onLinkHover(a)}),l._linkifier.onLinkLeave(function(a){return l._onLinkLeave(a)}),l}return g(b,a),Object.defineProperty(b.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},
enumerable:!0,configurable:!0}),b.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass);this._screenElement.removeChild(this._rowContainer);this._screenElement.removeChild(this._selectionContainer);this._screenElement.removeChild(this._themeStyleElement);this._screenElement.removeChild(this._dimensionsStyleElement);a.prototype.dispose.call(this)},b.prototype._updateDimensions=function(){var a=this;this.dimensions.scaledCharWidth=this._charSizeService.width*
window.devicePixelRatio;this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio);this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing);this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight);this.dimensions.scaledCharLeft=0;this.dimensions.scaledCharTop=0;this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols;
this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows;this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio);this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio);this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols;this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;this._rowElements.forEach(function(b){b.style.width=
a.dimensions.canvasWidth+"px";b.style.height=a.dimensions.actualCellHeight+"px";b.style.lineHeight=a.dimensions.actualCellHeight+"px";b.style.overflow="hidden"});this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));this._dimensionsStyleElement.innerHTML=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";
this._selectionContainer.style.height=this._viewportElement.style.height;this._screenElement.style.width=this.dimensions.canvasWidth+"px";this._screenElement.style.height=this.dimensions.canvasHeight+"px"},b.prototype.setColors=function(a){this._colors=a;this._injectCss()},b.prototype._injectCss=function(){var a=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var b=this._terminalSelector+" .xterm-rows { color: "+
this._colors.foreground.css+"; background-color: "+this._colors.background.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";b+=this._terminalSelector+" span:not(."+k.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+k.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+k.ITALIC_CLASS+" { font-style: italic;}";
b+="@keyframes blink_box_shadow { 50% { box-shadow: none; }}";b+="@keyframes blink_block { 0% { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+"; } 50% { background-color: "+this._colors.cursorAccent.css+"; color: "+this._colors.cursor.css+"; }}";b+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+k.CURSOR_CLASS+"."+k.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+
k.CURSOR_CLASS+"."+k.CURSOR_BLINK_CLASS+":not(."+k.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+k.CURSOR_CLASS+"."+k.CURSOR_BLINK_CLASS+"."+k.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+k.CURSOR_CLASS+"."+k.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+
" .xterm-rows ."+k.CURSOR_CLASS+"."+k.CURSOR_STYLE_BAR_CLASS+" { box-shadow: 1px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+k.CURSOR_CLASS+"."+k.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}";b+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selection.css+
";}";this._colors.ansi.forEach(function(c,d){b+=a._terminalSelector+" .xterm-fg-"+d+" { color: "+c.css+"; }"+a._terminalSelector+" .xterm-bg-"+d+" { background-color: "+c.css+"; }"});b+=this._terminalSelector+" .xterm-fg-"+r.INVERTED_DEFAULT_COLOR+" { color: "+l.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+r.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }";this._themeStyleElement.innerHTML=b},b.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},
b.prototype._refreshRowElements=function(a,b){for(a=this._rowElements.length;a<=b;a++){var c=document.createElement("div");this._rowContainer.appendChild(c);this._rowElements.push(c)}for(;this._rowElements.length>b;)this._rowContainer.removeChild(this._rowElements.pop())},b.prototype.onResize=function(a,b){this._refreshRowElements(a,b);this._updateDimensions()},b.prototype.onCharSizeChanged=function(){this._updateDimensions()},b.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},
b.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},b.prototype.onSelectionChanged=function(a,b,c){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(a&&b){var d=a[1]-this._bufferService.buffer.ydisp,e=b[1]-this._bufferService.buffer.ydisp,g=Math.max(d,0),f=Math.min(e,this._bufferService.rows-1);if(!(g>=this._bufferService.rows||0>f)){var h=document.createDocumentFragment();c?h.appendChild(this._createSelectionElement(g,
a[0],b[0],f-g+1)):(h.appendChild(this._createSelectionElement(g,d===g?a[0]:0,g===f?b[0]:this._bufferService.cols)),(h.appendChild(this._createSelectionElement(g+1,0,this._bufferService.cols,f-g-1)),g!==f)&&h.appendChild(this._createSelectionElement(f,0,e===f?b[0]:this._bufferService.cols)));this._selectionContainer.appendChild(h)}}},b.prototype._createSelectionElement=function(a,b,c,d){void 0===d&&(d=1);var e=document.createElement("div");return e.style.height=d*this.dimensions.actualCellHeight+"px",
e.style.top=a*this.dimensions.actualCellHeight+"px",e.style.left=b*this.dimensions.actualCellWidth+"px",e.style.width=this.dimensions.actualCellWidth*(c-b)+"px",e},b.prototype.onCursorMove=function(){},b.prototype.onOptionsChanged=function(){this._updateDimensions();this._injectCss()},b.prototype.clear=function(){this._rowElements.forEach(function(a){return a.innerHTML=""})},b.prototype.renderRows=function(a,b){for(var c=this._bufferService.buffer.ybase+this._bufferService.buffer.y,d=this._bufferService.buffer.x,
e=this._optionsService.options.cursorBlink;a<=b;a++){var g=this._rowElements[a];g.innerHTML="";var f=a+this._bufferService.buffer.ydisp,h=this._bufferService.buffer.lines.get(f);g.appendChild(this._rowFactory.createRow(h,f===c,this._optionsService.options.cursorStyle,d,e,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(b.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!0,configurable:!0}),b.prototype.registerCharacterJoiner=
function(){return-1},b.prototype.deregisterCharacterJoiner=function(){return!1},b.prototype._onLinkHover=function(a){this._setCellUnderline(a.x1,a.x2,a.y1,a.y2,a.cols,!0)},b.prototype._onLinkLeave=function(a){this._setCellUnderline(a.x1,a.x2,a.y1,a.y2,a.cols,!1)},b.prototype._setCellUnderline=function(a,b,c,d,e,g){for(;a!==b||c!==d;){var f=this._rowElements[c];if(!f)break;(f=f.children[a])&&(f.style.textDecoration=g?"underline":"none");++a>=e&&(a=0,c++)}},b=f([h(5,q.ICharSizeService),h(6,t.IOptionsService),
h(7,t.IBufferService)],b)}(a.Disposable);b.DomRenderer=d},function(a,b,d){function c(a,b,c){for(;a.length<c;)a=b+a;return a}Object.defineProperty(b,"__esModule",{value:!0});var g=d(9),f=d(3),h=d(5),k=d(10);b.BOLD_CLASS="xterm-bold";b.DIM_CLASS="xterm-dim";b.ITALIC_CLASS="xterm-italic";b.UNDERLINE_CLASS="xterm-underline";b.CURSOR_CLASS="xterm-cursor";b.CURSOR_BLINK_CLASS="xterm-cursor-blink";b.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block";b.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar";b.CURSOR_STYLE_UNDERLINE_CLASS=
"xterm-cursor-underline";a=function(){function a(a,b,c){this._document=a;this._optionsService=b;this._colors=c;this._workCell=new h.CellData}return a.prototype.setColors=function(a){this._colors=a},a.prototype.createRow=function(a,d,e,h,r,y,B){var l=this._document.createDocumentFragment(),q=0;for(B=Math.min(a.length,B)-1;0<=B;B--)if(a.loadCell(B,this._workCell).getCode()!==f.NULL_CELL_CODE||d&&B===h){q=B+1;break}for(B=0;B<q;B++){a.loadCell(B,this._workCell);var t=this._workCell.getWidth();if(0!==
t){var n=this._document.createElement("span");if(1<t&&(n.style.width=y*t+"px"),d&&B===h)switch(n.classList.add(b.CURSOR_CLASS),r&&n.classList.add(b.CURSOR_BLINK_CLASS),e){case "bar":n.classList.add(b.CURSOR_STYLE_BAR_CLASS);break;case "underline":n.classList.add(b.CURSOR_STYLE_UNDERLINE_CLASS);break;default:n.classList.add(b.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&n.classList.add(b.BOLD_CLASS);this._workCell.isItalic()&&n.classList.add(b.ITALIC_CLASS);this._workCell.isDim()&&n.classList.add(b.DIM_CLASS);
this._workCell.isUnderline()&&n.classList.add(b.UNDERLINE_CLASS);n.textContent=this._workCell.getChars()||f.WHITESPACE_CELL_CHAR;t=this._workCell.getFgColor();var v=this._workCell.getFgColorMode(),C=this._workCell.getBgColor(),H=this._workCell.getBgColorMode(),qa=!!this._workCell.isInverse();if(qa){var V=t;t=C;C=V;V=v;v=H;H=V}switch(v){case 16777216:case 33554432:this._workCell.isBold()&&8>t&&this._optionsService.options.drawBoldTextInBrightColors&&(t+=8);this._applyMinimumContrast(n,this._colors.background,
this._colors.ansi[t])||n.classList.add("xterm-fg-"+t);break;case 50331648:v=k.rgbaToColor(t>>16&255,t>>8&255,255&t);this._applyMinimumContrast(n,this._colors.background,v)||this._addStyle(n,"color:#"+c(t.toString(16),"0",6));break;default:this._applyMinimumContrast(n,this._colors.background,this._colors.foreground)||qa&&n.classList.add("xterm-fg-"+g.INVERTED_DEFAULT_COLOR)}switch(H){case 16777216:case 33554432:n.classList.add("xterm-bg-"+C);break;case 50331648:this._addStyle(n,"background-color:#"+
c(C.toString(16),"0",6));break;default:qa&&n.classList.add("xterm-bg-"+g.INVERTED_DEFAULT_COLOR)}l.appendChild(n)}}return l},a.prototype._applyMinimumContrast=function(a,b,c){if(1===this._optionsService.options.minimumContrastRatio)return!1;var d=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===d&&(d=k.ensureContrastRatio(b,c,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=d?d:
null)),!!d&&(this._addStyle(a,"color:"+d.css),!0)},a.prototype._addStyle=function(a,b){a.setAttribute("style",""+(a.getAttribute("style")||"")+b+";")},a}();b.DomRendererRowFactory=a},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(12),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],
220:["\\","|"],221:["]","}"],222:["'",'"']};b.evaluateKeyboardEvent=function(a,b,d,e){var f={type:0,cancel:!1,key:void 0},h=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:"UIKeyInputUpArrow"===a.key?f.key=b?c.C0.ESC+"OA":c.C0.ESC+"[A":"UIKeyInputLeftArrow"===a.key?f.key=b?c.C0.ESC+"OD":c.C0.ESC+"[D":"UIKeyInputRightArrow"===a.key?f.key=b?c.C0.ESC+"OC":c.C0.ESC+"[C":"UIKeyInputDownArrow"===a.key&&(f.key=b?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:if(a.shiftKey){f.key=
c.C0.BS;break}if(a.altKey){f.key=c.C0.ESC+c.C0.DEL;break}f.key=c.C0.DEL;break;case 9:if(a.shiftKey){f.key=c.C0.ESC+"[Z";break}f.key=c.C0.HT;f.cancel=!0;break;case 13:f.key=c.C0.CR;f.cancel=!0;break;case 27:f.key=c.C0.ESC;f.cancel=!0;break;case 37:if(a.metaKey)break;h?(f.key=c.C0.ESC+"[1;"+(h+1)+"D",f.key===c.C0.ESC+"[1;3D"&&(f.key=c.C0.ESC+(d?"b":"[1;5D"))):f.key=b?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(a.metaKey)break;h?(f.key=c.C0.ESC+"[1;"+(h+1)+"C",f.key===c.C0.ESC+"[1;3C"&&(f.key=c.C0.ESC+
(d?"f":"[1;5C"))):f.key=b?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(a.metaKey)break;h?(f.key=c.C0.ESC+"[1;"+(h+1)+"A",d||f.key!==c.C0.ESC+"[1;3A"||(f.key=c.C0.ESC+"[1;5A")):f.key=b?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(a.metaKey)break;h?(f.key=c.C0.ESC+"[1;"+(h+1)+"B",d||f.key!==c.C0.ESC+"[1;3B"||(f.key=c.C0.ESC+"[1;5B")):f.key=b?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(f.key=c.C0.ESC+"[2~");break;case 46:f.key=h?c.C0.ESC+"[3;"+(h+1)+"~":c.C0.ESC+"[3~";break;case 36:f.key=
h?c.C0.ESC+"[1;"+(h+1)+"H":b?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:f.key=h?c.C0.ESC+"[1;"+(h+1)+"F":b?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:a.shiftKey?f.type=2:f.key=c.C0.ESC+"[5~";break;case 34:a.shiftKey?f.type=3:f.key=c.C0.ESC+"[6~";break;case 112:f.key=h?c.C0.ESC+"[1;"+(h+1)+"P":c.C0.ESC+"OP";break;case 113:f.key=h?c.C0.ESC+"[1;"+(h+1)+"Q":c.C0.ESC+"OQ";break;case 114:f.key=h?c.C0.ESC+"[1;"+(h+1)+"R":c.C0.ESC+"OR";break;case 115:f.key=h?c.C0.ESC+"[1;"+(h+1)+"S":c.C0.ESC+"OS";break;case 116:f.key=
h?c.C0.ESC+"[15;"+(h+1)+"~":c.C0.ESC+"[15~";break;case 117:f.key=h?c.C0.ESC+"[17;"+(h+1)+"~":c.C0.ESC+"[17~";break;case 118:f.key=h?c.C0.ESC+"[18;"+(h+1)+"~":c.C0.ESC+"[18~";break;case 119:f.key=h?c.C0.ESC+"[19;"+(h+1)+"~":c.C0.ESC+"[19~";break;case 120:f.key=h?c.C0.ESC+"[20;"+(h+1)+"~":c.C0.ESC+"[20~";break;case 121:f.key=h?c.C0.ESC+"[21;"+(h+1)+"~":c.C0.ESC+"[21~";break;case 122:f.key=h?c.C0.ESC+"[23;"+(h+1)+"~":c.C0.ESC+"[23~";break;case 123:f.key=h?c.C0.ESC+"[24;"+(h+1)+"~":c.C0.ESC+"[24~";break;
default:!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey?d&&!e||!a.altKey||a.metaKey?d&&!a.altKey&&!a.ctrlKey&&a.metaKey?65===a.keyCode&&(f.type=1):a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&48<=a.keyCode&&1===a.key.length?f.key=a.key:a.key&&a.ctrlKey&&"_"===a.key&&(f.key=c.C0.US):(b=(b=g[a.keyCode])&&b[a.shiftKey?1:0])?f.key=c.C0.ESC+b:65<=a.keyCode&&90>=a.keyCode&&(f.key=c.C0.ESC+String.fromCharCode(a.ctrlKey?a.keyCode-64:a.keyCode+32)):65<=a.keyCode&&90>=a.keyCode?f.key=String.fromCharCode(a.keyCode-
64):32===a.keyCode?f.key=c.C0.NUL:51<=a.keyCode&&55>=a.keyCode?f.key=String.fromCharCode(a.keyCode-51+27):56===a.keyCode?f.key=c.C0.DEL:219===a.keyCode?f.key=c.C0.ESC:220===a.keyCode?f.key=c.C0.FS:221===a.keyCode&&(f.key=c.C0.GS)}return f}},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(3);b.handleWindowsModeLineFeed=function(a){var b,d=null===(b=a.buffer.lines.get(a.buffer.ybase+a.buffer.y-1))||void 0===b?void 0:b.get(a.cols-1);(a=a.buffer.lines.get(a.buffer.ybase+a.buffer.y))&&
d&&(a.isWrapped=d[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&d[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)}),f=this&&this.__decorate||function(a,
b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},h=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var k=d(30),r=d(1);a=d(2);var q=d(31),t=d(7),v=d(0),l=d(4);d=function(a){function b(b,
c,d,e,g){var f=a.call(this)||this;if(f._renderer=b,f._rowCount=c,f.screenElement=d,f.optionsService=e,f.charSizeService=g,f._isPaused=!1,f._needsFullRefresh=!1,f._canvasWidth=0,f._canvasHeight=0,f._onDimensionsChange=new r.EventEmitter,f._onRender=new r.EventEmitter,f._onRefreshRequest=new r.EventEmitter,f._renderDebouncer=new k.RenderDebouncer(function(a,b){return f._renderRows(a,b)}),f.register(f._renderDebouncer),f._screenDprMonitor=new q.ScreenDprMonitor,f._screenDprMonitor.setListener(function(){return f.onDevicePixelRatioChange()}),
f.register(f._screenDprMonitor),f.register(e.onOptionChange(function(){return f._renderer.onOptionsChanged()})),f.register(g.onCharSizeChange(function(){return f.onCharSizeChanged()})),f._renderer.onRequestRefreshRows(function(a){return f.refreshRows(a.start,a.end)}),f.register(t.addDisposableDomListener(window,"resize",function(){return f.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var h=new IntersectionObserver(function(a){return f._onIntersectionChange(a[a.length-1])},{threshold:0});
h.observe(d);f.register({dispose:function(){return h.disconnect()}})}return f}return g(b,a),Object.defineProperty(b.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,
"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!0,configurable:!0}),b.prototype._onIntersectionChange=function(a){this._isPaused=0===a.intersectionRatio;!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},b.prototype.refreshRows=function(a,b){this._isPaused?this._needsFullRefresh=!0:this._renderDebouncer.refresh(a,b,this._rowCount)},b.prototype._renderRows=function(a,b){this._renderer.renderRows(a,b);this._onRender.fire({start:a,
end:b})},b.prototype.resize=function(a,b){this._rowCount=b;this._fireOnCanvasResize()},b.prototype.changeOptions=function(){this._renderer.onOptionsChanged();this.refreshRows(0,this._rowCount-1);this._fireOnCanvasResize()},b.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},b.prototype.dispose=function(){this._renderer.dispose();a.prototype.dispose.call(this)},
b.prototype.setRenderer=function(a){var b=this;this._renderer.dispose();this._renderer=a;this._renderer.onRequestRefreshRows(function(a){return b.refreshRows(a.start,a.end)});this.refreshRows(0,this._rowCount-1)},b.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},b.prototype.setColors=function(a){this._renderer.setColors(a);this._fullRefresh()},b.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange();
this.refreshRows(0,this._rowCount-1)},b.prototype.onResize=function(a,b){this._renderer.onResize(a,b);this._fullRefresh()},b.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},b.prototype.onBlur=function(){this._renderer.onBlur()},b.prototype.onFocus=function(){this._renderer.onFocus()},b.prototype.onSelectionChanged=function(a,b,c){this._renderer.onSelectionChanged(a,b,c)},b.prototype.onCursorMove=function(){this._renderer.onCursorMove()},b.prototype.clear=function(){this._renderer.clear()},
b.prototype.registerCharacterJoiner=function(a){return this._renderer.registerCharacterJoiner(a)},b.prototype.deregisterCharacterJoiner=function(a){return this._renderer.deregisterCharacterJoiner(a)},b=f([h(3,v.IOptionsService),h(4,l.ICharSizeService)],b)}(a.Disposable);b.RenderService=d},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(1);a=d(11);var g=d(32);b.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
b.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",bellSound:b.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,logLevel:"info",scrollback:1E3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,
allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:a.isMac,rendererType:"canvas",windowsMode:!1,convertEol:!1,termName:"xterm",screenKeys:!1,cancelEvents:!1,useFlowControl:!1,wordSeparator:" ()[]{}',:;\"`"});var f=["cols","rows"];d=function(){function a(a){var d=this;this._onOptionChange=new c.EventEmitter;this.options=g.clone(b.DEFAULT_OPTIONS);Object.keys(a).forEach(function(b){b in d.options&&(d.options[b]=a[b])})}return Object.defineProperty(a.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},
enumerable:!0,configurable:!0}),a.prototype.setOption=function(a,c){if(!(a in b.DEFAULT_OPTIONS))throw Error('No option with key "'+a+'"');if(-1!==f.indexOf(a))throw Error('Option "'+a+'" can only be set in the constructor');this.options[a]!==c&&(c=this._sanitizeAndValidateOption(a,c),this.options[a]!==c&&(this.options[a]=c,this._onOptionChange.fire(a)))},a.prototype._sanitizeAndValidateOption=function(a,c){switch(a){case "bellStyle":case "cursorStyle":case "fontWeight":case "fontWeightBold":case "rendererType":case "wordSeparator":c||
(c=b.DEFAULT_OPTIONS[a]);break;case "lineHeight":case "tabStopWidth":if(1>c)throw Error(a+" cannot be less than 1, value: "+c);break;case "minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));case "scrollback":if(0>(c=Math.min(c,4294967295)))throw Error(a+" cannot be less than 0, value: "+c);break;case "fastScrollSensitivity":case "scrollSensitivity":if(0>=c)throw Error(a+" cannot be less than or equal to 0, value: "+c);}return c},a.prototype.getOption=function(a){if(!(a in b.DEFAULT_OPTIONS))throw Error('No option with key "'+
a+'"');return this.options[a]},a}();b.OptionsService=d},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,
"__esModule",{value:!0});var f=d(0),h=d(1);a=function(){function a(a,b,c){this.document=a;this.parentElement=b;this._optionsService=c;this.height=this.width=0;this._onCharSizeChange=new h.EventEmitter;this._measureStrategy=new k(a,b,this._optionsService)}return Object.defineProperty(a.prototype,"hasValidSize",{get:function(){return 0<this.width&&0<this.height},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},
enumerable:!0,configurable:!0}),a.prototype.measure=function(){var a=this._measureStrategy.measure();a.width===this.width&&a.height===this.height||(this.width=a.width,this.height=a.height,this._onCharSizeChange.fire())},a=c([g(2,f.IOptionsService)],a)}();b.CharSizeService=a;var k=function(){function a(a,b,c){this._document=a;this._parentElement=b;this._optionsService=c;this._result={width:0,height:0};this._measureElement=this._document.createElement("span");this._measureElement.classList.add("xterm-char-measure-element");
this._measureElement.textContent="W";this._measureElement.setAttribute("aria-hidden","true");this._parentElement.appendChild(this._measureElement)}return a.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily;this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var a=this._measureElement.getBoundingClientRect();return 0!==a.width&&0!==a.height&&(this._result.width=a.width,this._result.height=Math.ceil(a.height)),this._result},
a}()},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(0),
h=d(65);b.MINIMUM_COLS=2;b.MINIMUM_ROWS=1;a=function(){function a(a){this._optionsService=a;this.cols=Math.max(a.options.cols,b.MINIMUM_COLS);this.rows=Math.max(a.options.rows,b.MINIMUM_ROWS);this.buffers=new h.BufferSet(a,this)}return Object.defineProperty(a.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!0,configurable:!0}),a.prototype.resize=function(a,b){this.cols=a;this.rows=b},a.prototype.reset=function(){this.buffers=new h.BufferSet(this._optionsService,this)},a=
c([g(0,f.IOptionsService)],a)}();b.BufferService=a},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(66),g=d(1);a=function(){function a(a,b){this.optionsService=a;this.bufferService=b;this._onBufferActivate=new g.EventEmitter;this._normal=new c.Buffer(!0,a,b);this._normal.fillViewportRows();this._alt=new c.Buffer(!1,a,b);this._activeBuffer=this._normal;this.setupTabStops()}return Object.defineProperty(a.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},
enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"normal",{get:function(){return this._normal},enumerable:!0,configurable:!0}),a.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,
this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},a.prototype.activateAltBuffer=function(a){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(a),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},a.prototype.resize=function(a,b){this._normal.resize(a,b);this._alt.resize(a,b)},a.prototype.setupTabStops=
function(a){this._normal.setupTabStops(a);this._alt.setupTabStops(a)},a}();b.BufferSet=a},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(67),g=d(16),f=d(5),h=d(3),k=d(68),r=d(69),q=d(18);b.MAX_BUFFER_SIZE=4294967295;a=function(){function a(a,b,d){this._hasScrollback=a;this._optionsService=b;this._bufferService=d;this.savedX=this.savedY=this.x=this.y=this.ybase=this.ydisp=0;this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone();this.savedCharset=q.DEFAULT_CHARSET;this.markers=
[];this._nullCell=f.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);this._whitespaceCell=f.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.WHITESPACE_CELL_CODE]);this._cols=this._bufferService.cols;this._rows=this._bufferService.rows;this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows));this.scrollTop=0;this.scrollBottom=this._rows-1;this.setupTabStops()}return a.prototype.getNullCell=function(a){return a?(this._nullCell.fg=
a.fg,this._nullCell.bg=a.bg):(this._nullCell.fg=0,this._nullCell.bg=0),this._nullCell},a.prototype.getWhitespaceCell=function(a){return a?(this._whitespaceCell.fg=a.fg,this._whitespaceCell.bg=a.bg):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0),this._whitespaceCell},a.prototype.getBlankLine=function(a,b){return new g.BufferLine(this._bufferService.cols,this.getNullCell(a),b)},Object.defineProperty(a.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>
this._rows},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"isCursorInViewport",{get:function(){var a=this.ybase+this.y-this.ydisp;return 0<=a&&a<this._rows},enumerable:!0,configurable:!0}),a.prototype._getCorrectBufferLength=function(a){if(!this._hasScrollback)return a;a+=this._optionsService.options.scrollback;return a>b.MAX_BUFFER_SIZE?b.MAX_BUFFER_SIZE:a},a.prototype.fillViewportRows=function(a){if(0===this.lines.length){void 0===a&&(a=g.DEFAULT_ATTR_DATA);for(var b=this._rows;b--;)this.lines.push(this.getBlankLine(a))}},
a.prototype.clear=function(){this.x=this.y=this.ybase=this.ydisp=0;this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows));this.scrollTop=0;this.scrollBottom=this._rows-1;this.setupTabStops()},a.prototype.resize=function(a,b){var c=this.getNullCell(g.DEFAULT_ATTR_DATA),d=this._getCorrectBufferLength(b);if(d>this.lines.maxLength&&(this.lines.maxLength=d),0<this.lines.length){if(this._cols<a)for(var e=0;e<this.lines.length;e++)this.lines.get(e).resize(a,c);e=0;if(this._rows<b)for(var f=
this._rows;f<b;f++)this.lines.length<b+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new g.BufferLine(a,c)):0<this.ybase&&this.lines.length<=this.ybase+this.y+e+1?(this.ybase--,e++,0<this.ydisp&&this.ydisp--):this.lines.push(new g.BufferLine(a,c)));else for(f=this._rows;f>b;f--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));d<this.lines.maxLength&&(f=this.lines.length-d,0<f&&(this.lines.trimStart(f),this.ybase=
Math.max(this.ybase-f,0),this.ydisp=Math.max(this.ydisp-f,0),this.savedY=Math.max(this.savedY-f,0)),this.lines.maxLength=d);this.x=Math.min(this.x,a-1);this.y=Math.min(this.y,b-1);e&&(this.y+=e);this.savedX=Math.min(this.savedX,a-1);this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(a,b),this._cols>a))for(e=0;e<this.lines.length;e++)this.lines.get(e).resize(a,c);this._cols=a;this._rows=b},Object.defineProperty(a.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&
!this._optionsService.options.windowsMode},enumerable:!0,configurable:!0}),a.prototype._reflow=function(a,b){this._cols!==a&&(a>this._cols?this._reflowLarger(a,b):this._reflowSmaller(a,b))},a.prototype._reflowLarger=function(a,b){var c=k.reflowLargerGetLinesToRemove(this.lines,this._cols,a,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));0<c.length&&(c=k.reflowLargerCreateNewLayout(this.lines,c),k.reflowLargerApplyNewLayout(this.lines,c.layout),this._reflowLargerAdjustViewport(a,b,c.countRemoved))},
a.prototype._reflowLargerAdjustViewport=function(a,b,c){for(var d=this.getNullCell(g.DEFAULT_ATTR_DATA),e=c;0<e--;)0===this.ybase?(0<this.y&&this.y--,this.lines.length<b&&this.lines.push(new g.BufferLine(a,d))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-c,0)},a.prototype._reflowSmaller=function(a,b){for(var c=this.getNullCell(g.DEFAULT_ATTR_DATA),d=[],e=0,f=this.lines.length-1;0<=f;f--){var h=this.lines.get(f);if(!(!h||!h.isWrapped&&h.getTrimmedLength()<=
a)){for(var l=[h];h.isWrapped&&0<f;)h=this.lines.get(--f),l.unshift(h);h=this.ybase+this.y;if(!(h>=f&&h<f+l.length)){var q=l[l.length-1].getTrimmedLength(),r=k.reflowSmallerGetNewLineLengths(l,this._cols,a),t=r.length-l.length;var n=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+t):Math.max(0,this.lines.length-this.lines.maxLength+t);var v=[];for(h=0;h<t;h++){var ra=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);v.push(ra)}0<v.length&&(d.push({start:f+l.length+e,newLines:v}),
e+=v.length);l.push.apply(l,v);h=r.length-1;v=r[h];0===v&&(v=r[--h]);for(ra=l.length-t-1;0<=ra;){var I=Math.min(q,v);if(l[h].copyCellsFrom(l[ra],q-I,v-I,I,!0),0===(v-=I)&&(v=r[--h]),0===(q-=I))ra--,q=k.getWrappedLineTrimmedLength(l,Math.max(ra,0),this._cols)}for(h=0;h<l.length;h++)r[h]<a&&l[h].setCell(r[h],c);for(h=t-n;0<h--;)0===this.ybase?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+e)-b&&(this.ybase===this.ydisp&&
this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+t,this.ybase+b-1)}}}if(0<d.length){a=[];c=[];for(h=0;h<this.lines.length;h++)c.push(this.lines.get(h));b=this.lines.length;f=b-1;l=0;t=d[l];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+e);r=0;for(h=Math.min(this.lines.maxLength-1,b+e-1);0<=h;h--)if(t&&t.start>f+r){for(n=t.newLines.length-1;0<=n;n--)this.lines.set(h--,t.newLines[n]);h++;a.push({index:f+1,amount:t.newLines.length});r+=t.newLines.length;t=d[++l]}else this.lines.set(h,
c[f--]);d=0;for(h=a.length-1;0<=h;h--)a[h].index+=d,this.lines.onInsertEmitter.fire(a[h]),d+=a[h].amount;e=Math.max(0,b+e-this.lines.maxLength);0<e&&this.lines.onTrimEmitter.fire(e)}},a.prototype.stringIndexToBufferIndex=function(a,b,c){for(void 0===c&&(c=!1);b;){var d=this.lines.get(a);if(!d)return[-1,-1];for(var e=c?d.getTrimmedLength():d.length,g=0;g<e;++g)if(d.get(g)[h.CHAR_DATA_WIDTH_INDEX]&&(b-=d.get(g)[h.CHAR_DATA_CHAR_INDEX].length||1),0>b)return[a,g];a++}return[a,0]},a.prototype.translateBufferLineToString=
function(a,b,c,d){void 0===c&&(c=0);return(a=this.lines.get(a))?a.translateToString(b,c,d):""},a.prototype.getWrappedRangeForLine=function(a){for(var b=a;0<b&&this.lines.get(b).isWrapped;)b--;for(;a+1<this.lines.length&&this.lines.get(a+1).isWrapped;)a++;return{first:b,last:a}},a.prototype.setupTabStops=function(a){for(null!=a?this.tabs[a]||(a=this.prevStop(a)):(this.tabs={},a=0);a<this._cols;a+=this._optionsService.options.tabStopWidth)this.tabs[a]=!0},a.prototype.prevStop=function(a){for(null==
a&&(a=this.x);!this.tabs[--a]&&0<a;);return a>=this._cols?this._cols-1:0>a?0:a},a.prototype.nextStop=function(a){for(null==a&&(a=this.x);!this.tabs[++a]&&a<this._cols;);return a>=this._cols?this._cols-1:0>a?0:a},a.prototype.addMarker=function(a){var b=this,c=new r.Marker(a);return this.markers.push(c),c.register(this.lines.onTrim(function(a){c.line-=a;0>c.line&&c.dispose()})),c.register(this.lines.onInsert(function(a){c.line>=a.index&&(c.line+=a.amount)})),c.register(this.lines.onDelete(function(a){c.line>=
a.index&&c.line<a.index+a.amount&&c.dispose();c.line>a.index&&(c.line-=a.amount)})),c.register(c.onDispose(function(){return b._removeMarker(c)})),c},a.prototype._removeMarker=function(a){this.markers.splice(this.markers.indexOf(a),1)},a.prototype.iterator=function(a,b,c,d,e){return new t(this,a,b,c,d,e)},a}();b.Buffer=a;var t=function(){function a(a,b,c,d,e,g){void 0===c&&(c=0);void 0===d&&(d=a.lines.length);void 0===e&&(e=0);void 0===g&&(g=0);this._buffer=a;this._trimRight=b;this._startIndex=c;
this._endIndex=d;this._startOverscan=e;this._endOverscan=g;0>this._startIndex&&(this._startIndex=0);this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length);this._current=this._startIndex}return a.prototype.hasNext=function(){return this._current<this._endIndex},a.prototype.next=function(){var a=this._buffer.getWrappedRangeForLine(this._current);a.first<this._startIndex-this._startOverscan&&(a.first=this._startIndex-this._startOverscan);a.last>this._endIndex+this._endOverscan&&
(a.last=this._endIndex+this._endOverscan);a.first=Math.max(a.first,0);a.last=Math.min(a.last,this._buffer.lines.length);for(var b="",c=a.first;c<=a.last;++c)b+=this._buffer.translateBufferLineToString(c,this._trimRight);return this._current=a.last+1,{range:a,content:b}},a}();b.BufferStringIterator=t},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});var c=d(1);a=function(){function a(a){this._maxLength=a;this.onDeleteEmitter=new c.EventEmitter;this.onInsertEmitter=new c.EventEmitter;
this.onTrimEmitter=new c.EventEmitter;this._array=Array(this._maxLength);this._length=this._startIndex=0}return Object.defineProperty(a.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,
"maxLength",{get:function(){return this._maxLength},set:function(a){if(this._maxLength!==a){for(var b=Array(a),c=0;c<Math.min(a,this.length);c++)b[c]=this._array[this._getCyclicIndex(c)];this._array=b;this._maxLength=a;this._startIndex=0}},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"length",{get:function(){return this._length},set:function(a){if(a>this._length)for(var b=this._length;b<a;b++)this._array[b]=void 0;this._length=a},enumerable:!0,configurable:!0}),a.prototype.get=
function(a){return this._array[this._getCyclicIndex(a)]},a.prototype.set=function(a,b){this._array[this._getCyclicIndex(a)]=b},a.prototype.push=function(a){this._array[this._getCyclicIndex(this._length)]=a;this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},a.prototype.recycle=function(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,
this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(a.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!0,configurable:!0}),a.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length-- -1)]},a.prototype.splice=function(a,b){for(var c=[],d=2;d<arguments.length;d++)c[d-2]=arguments[d];if(b){for(d=a;d<this._length-b;d++)this._array[this._getCyclicIndex(d)]=this._array[this._getCyclicIndex(d+b)];this._length-=
b}for(d=this._length-1;d>=a;d--)this._array[this._getCyclicIndex(d+c.length)]=this._array[this._getCyclicIndex(d)];for(d=0;d<c.length;d++)this._array[this._getCyclicIndex(a+d)]=c[d];this._length+c.length>this._maxLength?(c=this._length+c.length-this._maxLength,this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)):this._length+=c.length},a.prototype.trimStart=function(a){a>this._length&&(a=this._length);this._startIndex+=a;this._length-=a;this.onTrimEmitter.fire(a)},a.prototype.shiftElements=
function(a,b,c){if(!(0>=b)){if(0>a||a>=this._length)throw Error("start argument out of range");if(0>a+c)throw Error("Cannot shift elements in list beyond index 0");if(0<c){for(var d=b-1;0<=d;d--)this.set(a+d+c,this.get(a+d));a=a+b+c-this._length;if(0<a)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(d=0;d<b;d++)this.set(a+d+c,this.get(a+d))}},a.prototype._getCyclicIndex=function(a){return(this._startIndex+a)%this._maxLength},
a}();b.CircularList=a},function(a,b){function c(a,b,c){if(b===a.length-1)return a[b].getTrimmedLength();var d=!a[b].hasContent(c-1)&&1===a[b].getWidth(c-1);a=2===a[b+1].getWidth(0);return d&&a?c-1:c}Object.defineProperty(b,"__esModule",{value:!0});b.reflowLargerGetLinesToRemove=function(a,b,d,h,k){for(var e=[],g=0;g<a.length-1;g++){var f=g,v=a.get(++f);if(v.isWrapped){for(var l=[a.get(g)];f<a.length&&v.isWrapped;)l.push(v),v=a.get(++f);if(!(h>=g&&h<f)){f=0;v=c(l,f,b);for(var n=1,y=0;n<l.length;){var B=
c(l,n,b),O=Math.min(B-y,d-v);l[f].copyCellsFrom(l[n],y,v,O,!1);(v+=O)===d&&(f++,v=0);(y+=O)===B&&(n++,y=0);0===v&&0!==f&&2===l[f-1].getWidth(d-1)&&(l[f].copyCellsFrom(l[f-1],d-1,v++,1,!1),l[f-1].setCell(d-1,k))}l[f].replaceCells(v,d,k);v=0;for(n=l.length-1;0<n&&(n>f||0===l[n].getTrimmedLength());n--)v++;0<v&&(e.push(g+l.length-v),e.push(v))}g+=l.length-1}}return e};b.reflowLargerCreateNewLayout=function(a,b){for(var c=[],d=0,e=b[d],g=0,q=0;q<a.length;q++)e===q?(e=b[++d],a.onDeleteEmitter.fire({index:q-
g,amount:e}),q+=e-1,g+=e,e=b[++d]):c.push(q);return{layout:c,countRemoved:g}};b.reflowLargerApplyNewLayout=function(a,b){for(var c=[],d=0;d<b.length;d++)c.push(a.get(b[d]));for(d=0;d<c.length;d++)a.set(d,c[d]);a.length=b.length};b.reflowSmallerGetNewLineLengths=function(a,b,d){for(var e=[],g=a.map(function(d,e){return c(a,e,b)}).reduce(function(a,b){return a+b}),f=0,q=0,t=0;t<g;){if(g-t<d){e.push(g-t);break}f+=d;var v=c(a,q,b);f>v&&(f-=v,q++);(v=2===a[q].getWidth(f-1))&&f--;v=v?d-1:d;e.push(v);t+=
v}return e};b.getWrappedLineTrimmedLength=c},function(a,b,d){var c,g=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});var f=d(1);a=function(a){function b(c){var d=a.call(this)||
this;return d.line=c,d._id=b._nextId++,d.isDisposed=!1,d._onDispose=new f.EventEmitter,d}return g(b,a),Object.defineProperty(b.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!0,configurable:!0}),b.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},b._nextId=1,b}(d(2).Disposable);b.Marker=a},function(a,b,d){var c=
this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(4),h=d(29);a=function(){function a(a,
b){this._renderService=a;this._charSizeService=b}return a.prototype.getCoords=function(a,b,c,d,e){return h.getCoords(a,b,c,d,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,e)},a.prototype.getRawByteCoords=function(a,b,c,d){a=this.getCoords(a,b,c,d);return h.getRawByteCoords(a)},a=c([g(0,f.IRenderService),g(1,f.ICharSizeService)],a)}();b.MouseService=a},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,
g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(0),h=d(1),k=d(32),r=Object.freeze({applicationCursorKeys:!1});a=function(){function a(a,
b,c,d){this._scrollToBottom=a;this._bufferService=b;this._logService=c;this._optionsService=d;this.isCursorHidden=this.isCursorInitialized=!1;this._onData=new h.EventEmitter;this._onUserInput=new h.EventEmitter;this._onBinary=new h.EventEmitter;this.decPrivateModes=k.clone(r)}return Object.defineProperty(a.prototype,"onData",{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!0,
configurable:!0}),Object.defineProperty(a.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!0,configurable:!0}),a.prototype.reset=function(){this.decPrivateModes=k.clone(r)},a.prototype.triggerDataEvent=function(a,b){if(void 0===b&&(b=!1),!this._optionsService.options.disableStdin){var c=this._bufferService.buffer;c.ybase!==c.ydisp&&this._scrollToBottom();b&&this._onUserInput.fire();this._logService.debug('sending data "'+a+'"',function(){return a.split("").map(function(a){return a.charCodeAt(0)})});
this._onData.fire(a)}},a.prototype.triggerBinaryEvent=function(a){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+a+'"',function(){return a.split("").map(function(a){return a.charCodeAt(0)})}),this._onBinary.fire(a))},a=c([g(1,f.IBufferService),g(2,f.ILogService),g(3,f.IOptionsService)],a)}();b.CoreService=a},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==
typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}},f=this&&this.__spreadArrays||function(){for(var a=0,b=0,c=arguments.length;b<c;b++)a+=arguments[b].length;a=Array(a);var d=0;for(b=0;b<c;b++)for(var e=arguments[b],g=0,f=e.length;g<f;g++,d++)a[d]=e[g];return a};Object.defineProperty(b,
"__esModule",{value:!0});var h,k=d(0);!function(a){a[a.DEBUG=0]="DEBUG";a[a.INFO=1]="INFO";a[a.WARN=2]="WARN";a[a.ERROR=3]="ERROR";a[a.OFF=4]="OFF"}(h=b.LogLevel||(b.LogLevel={}));var r={debug:h.DEBUG,info:h.INFO,warn:h.WARN,error:h.ERROR,off:h.OFF};a=function(){function a(a){var b=this;this._optionsService=a;this._updateLogLevel();this._optionsService.onOptionChange(function(a){"logLevel"===a&&b._updateLogLevel()})}return a.prototype._updateLogLevel=function(){this._logLevel=r[this._optionsService.options.logLevel]},
a.prototype._evalLazyOptionalParams=function(a){for(var b=0;b<a.length;b++)"function"==typeof a[b]&&(a[b]=a[b]())},a.prototype._log=function(a,b,c){this._evalLazyOptionalParams(c);a.call.apply(a,f([console,"xterm.js: "+b],c))},a.prototype.debug=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];this._logLevel<=h.DEBUG&&this._log(console.log,a,b)},a.prototype.info=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];this._logLevel<=h.INFO&&this._log(console.info,
a,b)},a.prototype.warn=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];this._logLevel<=h.WARN&&this._log(console.warn,a,b)},a.prototype.error=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];this._logLevel<=h.ERROR&&this._log(console.error,a,b)},a=c([g(0,k.IOptionsService)],a)}();b.LogService=a},function(a,b,d){var c=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==
typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},g=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var f=d(0);a=function(){function a(a){this._bufferService=a;this.clearRange()}return Object.defineProperty(a.prototype,"start",{get:function(){return this._start},enumerable:!0,
configurable:!0}),Object.defineProperty(a.prototype,"end",{get:function(){return this._end},enumerable:!0,configurable:!0}),a.prototype.clearRange=function(){this._end=this._start=this._bufferService.buffer.y},a.prototype.markDirty=function(a){a<this._start?this._start=a:a>this._end&&(this._end=a)},a.prototype.markRangeDirty=function(a,b){if(a>b){var c=a;a=b;b=c}a<this._start&&(this._start=a);b>this._end&&(this._end=b)},a.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-
1)},a=c([g(0,f.IBufferService)],a)}();b.DirtyRowService=a},function(a,b,d){var c=this&&this.__spreadArrays||function(){for(var a=0,b=0,c=arguments.length;b<c;b++)a+=arguments[b].length;a=Array(a);var d=0;for(b=0;b<c;b++)for(var e=arguments[b],g=0,f=e.length;g<f;g++,d++)a[d]=e[g];return a};Object.defineProperty(b,"__esModule",{value:!0});var g=d(0),f=d(14),h=function(){function a(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];this._entries=new Map;for(b=0;b<a.length;b++){var c=a[b];this.set(c[0],
c[1])}}return a.prototype.set=function(a,b){var c=this._entries.get(a);return this._entries.set(a,b),c},a.prototype.forEach=function(a){this._entries.forEach(function(b,c){return a(c,b)})},a.prototype.has=function(a){return this._entries.has(a)},a.prototype.get=function(a){return this._entries.get(a)},a}();b.ServiceCollection=h;a=function(){function a(){this._services=new h;this._services.set(g.IInstantiationService,this)}return a.prototype.setService=function(a,b){this._services.set(a,b)},a.prototype.createInstance=
function(a){for(var b=[],d=1;d<arguments.length;d++)b[d-1]=arguments[d];var e=f.getServiceDependencies(a).sort(function(a,b){return a.index-b.index});d=[];for(var g=0;g<e.length;g++){var h=e[g],k=this._services.get(h.id);if(!k)throw Error("[createInstance] "+a.name+" depends on UNKNOWN service "+h.id+".");d.push(k)}e=0<e.length?e[0].index:b.length;if(b.length!==e)throw Error("[createInstance] First service dependency of "+a.name+" at position "+(e+1)+" conflicts with "+b.length+" static arguments");
return new (a.bind.apply(a,c([void 0],c(b,d))))},a}();b.InstantiationService=a},function(a,b,d){function c(a,b){var c=(a.ctrl?16:0)|(a.shift?4:0)|(a.alt?8:0);return 4===a.button?(c|=64,c|=a.action):(c|=3&a.button,4&a.button&&(c|=64),8&a.button&&(c|=128),32===a.action?c|=32:0!==a.action||b||(c|=3)),c}var g=this&&this.__decorate||function(a,b,c,d){var e,g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,
b,c,d);else for(var h=a.length-1;0<=h;h--)(e=a[h])&&(f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f);return 3<g&&f&&Object.defineProperty(b,c,f),f},f=this&&this.__param||function(a,b){return function(c,d){b(c,d,a)}};Object.defineProperty(b,"__esModule",{value:!0});var h=d(0),k=d(1),r={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(a){return 4!==a.button&&1===a.action&&(a.ctrl=!1,a.alt=!1,a.shift=!1,!0)}},VT200:{events:19,restrict:function(a){return 32!==a.action}},DRAG:{events:23,
restrict:function(a){return 32!==a.action||3!==a.button}},ANY:{events:31,restrict:function(){return!0}}},q=String.fromCharCode,t={DEFAULT:function(a){a=[c(a,!1)+32,a.col+32,a.row+32];return 255<a[0]||255<a[1]||255<a[2]?"":"\u001b[M"+q(a[0])+q(a[1])+q(a[2])},SGR:function(a){var b=0===a.action&&4!==a.button?"m":"M";return"\u001b[<"+c(a,!0)+";"+a.col+";"+a.row+b}};a=function(){function a(a,b){var c=this;this._bufferService=a;this._coreService=b;this._protocols={};this._encodings={};this._activeEncoding=
this._activeProtocol="";this._onProtocolChange=new k.EventEmitter;this._lastEvent=null;Object.keys(r).forEach(function(a){return c.addProtocol(a,r[a])});Object.keys(t).forEach(function(a){return c.addEncoding(a,t[a])});this.reset()}return a.prototype.addProtocol=function(a,b){this._protocols[a]=b},a.prototype.addEncoding=function(a,b){this._encodings[a]=b},Object.defineProperty(a.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(a){if(!this._protocols[a])throw Error('unknown protocol "'+
a+'"');this._activeProtocol=a;this._onProtocolChange.fire(this._protocols[a].events)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(a){if(!this._encodings[a])throw Error('unknown encoding "'+a+'"');this._activeEncoding=a},enumerable:!0,configurable:!0}),a.prototype.reset=function(){this.activeProtocol="NONE";this.activeEncoding="DEFAULT";this._lastEvent=null},Object.defineProperty(a.prototype,"onProtocolChange",
{get:function(){return this._onProtocolChange.event},enumerable:!0,configurable:!0}),a.prototype.triggerMouseEvent=function(a){if(0>a.col||a.col>=this._bufferService.cols||0>a.row||a.row>=this._bufferService.rows||4===a.button&&32===a.action||3===a.button&&32!==a.action||4!==a.button&&(2===a.action||3===a.action)||(a.col++,a.row++,32===a.action&&this._lastEvent&&this._compareEvents(this._lastEvent,a))||!this._protocols[this._activeProtocol].restrict(a))return!1;var b=this._encodings[this._activeEncoding](a);
return b&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(b):this._coreService.triggerDataEvent(b,!0)),this._lastEvent=a,!0},a.prototype.explainEvents=function(a){return{DOWN:!!(1&a),UP:!!(2&a),DRAG:!!(4&a),MOVE:!!(8&a),WHEEL:!!(16&a)}},a.prototype._compareEvents=function(a,b){return a.col===b.col&&a.row===b.row&&a.button===b.button&&a.action===b.action&&a.ctrl===b.ctrl&&a.alt===b.alt&&a.shift===b.shift},a=g([f(0,h.IBufferService),f(1,h.ICoreService)],a)}();b.CoreMouseService=
a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(a){this._action=a;this._writeBuffer=[];this._callbacks=[];this._bufferOffset=this._pendingData=0}return a.prototype.writeSync=function(a){if(this._writeBuffer.length){for(var b=this._bufferOffset;b<this._writeBuffer.length;++b){var c=this._callbacks[b];this._action(this._writeBuffer[b]);c&&c()}this._writeBuffer=[];this._callbacks=[];this._pendingData=0;this._bufferOffset=2147483647}this._action(a)},a.prototype.write=
function(a,b){var c=this;if(5E7<this._pendingData)throw Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return c._innerWrite()}));this._pendingData+=a.length;this._writeBuffer.push(a);this._callbacks.push(b)},a.prototype._innerWrite=function(){for(var a=this,b=Date.now();this._writeBuffer.length>this._bufferOffset;){var c=this._writeBuffer[this._bufferOffset],d=this._callbacks[this._bufferOffset];if(this._bufferOffset++,
this._action(c),this._pendingData-=c.length,d&&d(),12<=Date.now()-b)break}this._writeBuffer.length>this._bufferOffset?(50<this._bufferOffset&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return a._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},a}();b.WriteBuffer=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});
a=function(){function a(a){this._textarea=a}return Object.defineProperty(a.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!0,configurable:!0}),a}();b.CoreBrowserService=a},function(a,b){Object.defineProperty(b,"__esModule",{value:!0});a=function(){function a(){this._addons=[]}return a.prototype.dispose=function(){for(var a=this._addons.length-1;0<=a;a--)this._addons[a].instance.dispose()},a.prototype.loadAddon=function(a,b){var c=
this,d={instance:b,dispose:b.dispose,isDisposed:!1};this._addons.push(d);b.dispose=function(){return c._wrappedAddonDispose(d)};b.activate(a)},a.prototype._wrappedAddonDispose=function(a){if(!a.isDisposed){for(var b=-1,c=0;c<this._addons.length;c++)if(this._addons[c]===a){b=c;break}if(-1===b)throw Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0;a.dispose.apply(a.instance);this._addons.splice(b,1)}},a}();b.AddonManager=a}])})}),ea=aa(ca),fa=ca.Terminal,ka=ba(function(b){!function(a,
c){b.exports=c()}(window,function(){return function(a){function b(c){if(d[c])return d[c].exports;var e=d[c]={i:c,l:!1,exports:{}};return a[c].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var d={};return b.m=a,b.c=d,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})},b.t=function(a,c){if((1&c&&(a=
b(a)),8&c)||4&c&&"object"==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:a}),2&c&&"string"!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a.default}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s=0)}([function(a,b){Object.defineProperty(b,"__esModule",
{value:!0});a=function(){function a(){}return a.prototype.activate=function(a){this._terminal=a},a.prototype.dispose=function(){},a.prototype.fit=function(){var a=this.proposeDimensions();if(a&&this._terminal){var b=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(b._renderService.clear(),this._terminal.resize(a.cols,a.rows))}},a.prototype.proposeDimensions=function(){if(this._terminal&&this._terminal.element.parentElement){var a=this._terminal._core,b=window.getComputedStyle(this._terminal.element.parentElement),
c=parseInt(b.getPropertyValue("height"));b=Math.max(0,parseInt(b.getPropertyValue("width")));var d=window.getComputedStyle(this._terminal.element);c-=parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"));b=b-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-a.viewport.scrollBarWidth;return{cols:Math.floor(b/a._renderService.dimensions.actualCellWidth),rows:Math.floor(c/a._renderService.dimensions.actualCellHeight)}}},
a}();b.FitAddon=a}])})});aa(ka);
var la=ka.FitAddon,na=ba(function(b){!function(a,c){b.exports=c()}(window,function(){return function(a){function b(c){if(d[c])return d[c].exports;var e=d[c]={i:c,l:!1,exports:{}};return a[c].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var d={};return b.m=a,b.c=d,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",
{value:!0})},b.t=function(a,c){if((1&c&&(a=b(a)),8&c)||4&c&&"object"==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:a}),2&c&&"string"!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a.default}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s=0)}([function(a,
b){function c(a,b){window.open(b,"_blank")}Object.defineProperty(b,"__esModule",{value:!0});var e=/(?:^|[^\da-z\.-]+)((https?:\/\/)((([\da-z\.-]+)\.([a-z\.]{2,6}))|((\d{1,3}\.){3}\d{1,3})|(localhost))(:\d{1,5})?((\/[\/\w\.\-%~:+]*)*([^:"'\s]))?(\?[0-9\w\[\]\(\)\/\?\!#@$%&'*+,:;~\=\.\-]*)?(#[0-9\w\[\]\(\)\/\?\!#@$%&'*+,:;~\=\.\-]*)?)($|[^\/\w\.\-%]+)/;a=function(){function a(a,b){void 0===a&&(a=c);void 0===b&&(b={});this._handler=a;this._options=b;this._options.matchIndex=1}return a.prototype.activate=
function(a){this._terminal=a;this._linkMatcherId=this._terminal.registerLinkMatcher(e,this._handler,this._options)},a.prototype.dispose=function(){void 0!==this._linkMatcherId&&void 0!==this._terminal&&this._terminal.deregisterLinkMatcher(this._linkMatcherId)},a}();b.WebLinksAddon=a}])})});aa(na);var oa=na.WebLinksAddon,pa="undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{};
function va(b,a,c,d){return new (c||(c=Promise))(function(e,g){function f(a){try{k(d.next(a))}catch(q){g(q)}}function h(a){try{k(d["throw"](a))}catch(q){g(q)}}function k(a){a.done?e(a.value):(new c(function(b){b(a.value)})).then(f,h)}k((d=d.apply(b,a||[])).next())})}
function wa(b,a){function c(a){return function(b){return d([a,b])}}function d(c){if(g)throw new TypeError("Generator is already executing.");for(;e;)try{if(g=1,f&&(h=c[0]&2?f["return"]:c[0]?f["throw"]||((h=f["return"])&&h.call(f),0):f.next)&&!(h=h.call(f,c[1])).done)return h;if(f=0,h)c=[c[0]&2,h.value];switch(c[0]){case 0:case 1:h=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++;f=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(h=e.trys,h=0<h.length&&
h[h.length-1])&&(6===c[0]||2===c[0])){e=0;continue}if(3===c[0]&&(!h||c[1]>h[0]&&c[1]<h[3]))e.label=c[1];else if(6===c[0]&&e.label<h[1])e.label=h[1],h=c;else if(h&&e.label<h[2])e.label=h[2],e.ops.push(c);else{h[2]&&e.ops.pop();e.trys.pop();continue}}c=a.call(b,e)}catch(q){c=[6,q],f=0}finally{g=h=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}var e={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},g,f,h,k;return k={next:c(0),"throw":c(1),"return":c(2)},"function"===
typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k}function Aa(b){var a="function"===typeof Symbol&&b[Symbol.iterator],c=0;return a?a.call(b):{next:function(){b&&c>=b.length&&(b=void 0);return{value:b&&b[c++],done:!b}}}}
function Ba(b,a){var c="function"===typeof Symbol&&b[Symbol.iterator];if(!c)return b;b=c.call(b);var d,e=[];try{for(;(void 0===a||0<a--)&&!(d=b.next()).done;)e.push(d.value)}catch(f){var g={error:f}}finally{try{d&&!d.done&&(c=b["return"])&&c.call(b)}finally{if(g)throw g.error;}}return e}function Ca(){for(var b=[],a=0;a<arguments.length;a++)b=b.concat(Ba(arguments[a]));return b}
var x="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof pa?pa:"undefined"!==typeof self?self:{};function Da(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b["default"]:b}function Ea(b,a){return a={exports:{}},b(a,a.exports),a.exports}
var z=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});a.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,
S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});Da(z);
var Ja=Ea(function(b,a){a.default="function"===typeof BigInt?BigInt:function(){throw Error("BigInt is not supported in this environment.");}}),Ka=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});var c=z.constants.S_IFMT,d=z.constants.S_IFDIR,e=z.constants.S_IFREG,g=z.constants.S_IFBLK,f=z.constants.S_IFCHR,h=z.constants.S_IFLNK,k=z.constants.S_IFIFO,r=z.constants.S_IFSOCK;b=function(){function a(){}a.build=function(b,c){void 0===c&&(c=!1);var d=new a,e=b.gid,f=b.atime,g=b.mtime,h=
b.ctime;c=c?Ja.default:function(a){return a};d.uid=c(b.uid);d.gid=c(e);d.rdev=c(0);d.blksize=c(4096);d.ino=c(b.ino);d.size=c(b.getSize());d.blocks=c(1);d.atime=f;d.mtime=g;d.ctime=h;d.birthtime=h;d.atimeMs=c(f.getTime());d.mtimeMs=c(g.getTime());e=c(h.getTime());d.ctimeMs=e;d.birthtimeMs=e;d.dev=c(0);d.mode=c(b.mode);d.nlink=c(b.nlink);return d};a.prototype._checkModeProperty=function(a){return(Number(this.mode)&c)===a};a.prototype.isDirectory=function(){return this._checkModeProperty(d)};a.prototype.isFile=
function(){return this._checkModeProperty(e)};a.prototype.isBlockDevice=function(){return this._checkModeProperty(g)};a.prototype.isCharacterDevice=function(){return this._checkModeProperty(f)};a.prototype.isSymbolicLink=function(){return this._checkModeProperty(h)};a.prototype.isFIFO=function(){return this._checkModeProperty(k)};a.prototype.isSocket=function(){return this._checkModeProperty(r)};return a}();a.Stats=b;a.default=b});Da(Ka);
var La="undefined"!==typeof pa?pa:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},Ma=[],Na=[],Oa="undefined"!==typeof Uint8Array?Uint8Array:Array,Pa=!1;function Qa(){Pa=!0;for(var b=0;64>b;++b)Ma[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b],Na["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]=b;Na[45]=62;Na[95]=63}
function Ra(b,a,c){for(var d=[],e=a;e<c;e+=3)a=(b[e]<<16)+(b[e+1]<<8)+b[e+2],d.push(Ma[a>>18&63]+Ma[a>>12&63]+Ma[a>>6&63]+Ma[a&63]);return d.join("")}function Ta(b){Pa||Qa();for(var a=b.length,c=a%3,d="",e=[],g=0,f=a-c;g<f;g+=16383)e.push(Ra(b,g,g+16383>f?f:g+16383));1===c?(b=b[a-1],d+=Ma[b>>2],d+=Ma[b<<4&63],d+="=="):2===c&&(b=(b[a-2]<<8)+b[a-1],d+=Ma[b>>10],d+=Ma[b>>4&63],d+=Ma[b<<2&63],d+="=");e.push(d);return e.join("")}
function Ua(b,a,c,d,e){var g=8*e-d-1,f=(1<<g)-1,h=f>>1,k=-7;e=c?e-1:0;var r=c?-1:1,q=b[a+e];e+=r;c=q&(1<<-k)-1;q>>=-k;for(k+=g;0<k;c=256*c+b[a+e],e+=r,k-=8);g=c&(1<<-k)-1;c>>=-k;for(k+=d;0<k;g=256*g+b[a+e],e+=r,k-=8);if(0===c)c=1-h;else{if(c===f)return g?NaN:Infinity*(q?-1:1);g+=Math.pow(2,d);c-=h}return(q?-1:1)*g*Math.pow(2,c-d)}
function Va(b,a,c,d,e,g){var f,h=8*g-e-1,k=(1<<h)-1,r=k>>1,q=23===e?Math.pow(2,-24)-Math.pow(2,-77):0;g=d?0:g-1;var t=d?1:-1,v=0>a||0===a&&0>1/a?1:0;a=Math.abs(a);for(isNaN(a)||Infinity===a?(a=isNaN(a)?1:0,d=k):(d=Math.floor(Math.log(a)/Math.LN2),1>a*(f=Math.pow(2,-d))&&(d--,f*=2),a=1<=d+r?a+q/f:a+q*Math.pow(2,1-r),2<=a*f&&(d++,f/=2),d+r>=k?(a=0,d=k):1<=d+r?(a=(a*f-1)*Math.pow(2,e),d+=r):(a=a*Math.pow(2,r-1)*Math.pow(2,e),d=0));8<=e;b[c+g]=a&255,g+=t,a/=256,e-=8);d=d<<e|a;for(h+=e;0<h;b[c+g]=d&255,
g+=t,d/=256,h-=8);b[c+g-t]|=128*v}var Wa={}.toString,$a=Array.isArray||function(b){return"[object Array]"==Wa.call(b)};A.TYPED_ARRAY_SUPPORT=void 0!==La.TYPED_ARRAY_SUPPORT?La.TYPED_ARRAY_SUPPORT:!0;var ab=A.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function bb(b,a){if((A.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<a)throw new RangeError("Invalid typed array length");A.TYPED_ARRAY_SUPPORT?(b=new Uint8Array(a),b.__proto__=A.prototype):(null===b&&(b=new A(a)),b.length=a);return b}
function A(b,a,c){if(!(A.TYPED_ARRAY_SUPPORT||this instanceof A))return new A(b,a,c);if("number"===typeof b){if("string"===typeof a)throw Error("If encoding is specified then the first argument must be a string");return cb(this,b)}return db(this,b,a,c)}A.poolSize=8192;A._augment=function(b){b.__proto__=A.prototype;return b};
function db(b,a,c,d){if("number"===typeof a)throw new TypeError('"value" argument must not be a number');if("undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer){a.byteLength;if(0>c||a.byteLength<c)throw new RangeError("'offset' is out of bounds");if(a.byteLength<c+(d||0))throw new RangeError("'length' is out of bounds");a=void 0===c&&void 0===d?new Uint8Array(a):void 0===d?new Uint8Array(a,c):new Uint8Array(a,c,d);A.TYPED_ARRAY_SUPPORT?(b=a,b.__proto__=A.prototype):b=eb(b,a);return b}if("string"===
typeof a){d=b;b=c;if("string"!==typeof b||""===b)b="utf8";if(!A.isEncoding(b))throw new TypeError('"encoding" must be a valid string encoding');c=fb(a,b)|0;d=bb(d,c);a=d.write(a,b);a!==c&&(d=d.slice(0,a));return d}return jb(b,a)}A.from=function(b,a,c){return db(null,b,a,c)};A.TYPED_ARRAY_SUPPORT&&(A.prototype.__proto__=Uint8Array.prototype,A.__proto__=Uint8Array);
function kb(b){if("number"!==typeof b)throw new TypeError('"size" argument must be a number');if(0>b)throw new RangeError('"size" argument must not be negative');}A.alloc=function(b,a,c){kb(b);return b=0>=b?bb(null,b):void 0!==a?"string"===typeof c?bb(null,b).fill(a,c):bb(null,b).fill(a):bb(null,b)};function cb(b,a){kb(a);b=bb(b,0>a?0:lb(a)|0);if(!A.TYPED_ARRAY_SUPPORT)for(var c=0;c<a;++c)b[c]=0;return b}A.allocUnsafe=function(b){return cb(null,b)};A.allocUnsafeSlow=function(b){return cb(null,b)};
function eb(b,a){var c=0>a.length?0:lb(a.length)|0;b=bb(b,c);for(var d=0;d<c;d+=1)b[d]=a[d]&255;return b}
function jb(b,a){if(mb(a)){var c=lb(a.length)|0;b=bb(b,c);if(0===b.length)return b;a.copy(b,0,0,c);return b}if(a){if("undefined"!==typeof ArrayBuffer&&a.buffer instanceof ArrayBuffer||"length"in a)return(c="number"!==typeof a.length)||(c=a.length,c=c!==c),c?bb(b,0):eb(b,a);if("Buffer"===a.type&&$a(a.data))return eb(b,a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");}
function lb(b){if(b>=(A.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(A.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return b|0}A.isBuffer=nb;function mb(b){return!(null==b||!b._isBuffer)}
A.compare=function(b,a){if(!mb(b)||!mb(a))throw new TypeError("Arguments must be Buffers");if(b===a)return 0;for(var c=b.length,d=a.length,e=0,g=Math.min(c,d);e<g;++e)if(b[e]!==a[e]){c=b[e];d=a[e];break}return c<d?-1:d<c?1:0};A.isEncoding=function(b){switch(String(b).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "latin1":case "binary":case "base64":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return!0;default:return!1}};
A.concat=function(b,a){if(!$a(b))throw new TypeError('"list" argument must be an Array of Buffers');if(0===b.length)return A.alloc(0);var c;if(void 0===a)for(c=a=0;c<b.length;++c)a+=b[c].length;a=A.allocUnsafe(a);var d=0;for(c=0;c<b.length;++c){var e=b[c];if(!mb(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(a,d);d+=e.length}return a};
function fb(b,a){if(mb(b))return b.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(b)||b instanceof ArrayBuffer))return b.byteLength;"string"!==typeof b&&(b=""+b);var c=b.length;if(0===c)return 0;for(var d=!1;;)switch(a){case "ascii":case "latin1":case "binary":return c;case "utf8":case "utf-8":case void 0:return ob(b).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*c;case "hex":return c>>>1;case "base64":return pb(b).length;
default:if(d)return ob(b).length;a=(""+a).toLowerCase();d=!0}}A.byteLength=fb;
function rb(b,a,c){var d=!1;if(void 0===a||0>a)a=0;if(a>this.length)return"";if(void 0===c||c>this.length)c=this.length;if(0>=c)return"";c>>>=0;a>>>=0;if(c<=a)return"";for(b||(b="utf8");;)switch(b){case "hex":b=a;a=c;c=this.length;if(!b||0>b)b=0;if(!a||0>a||a>c)a=c;d="";for(c=b;c<a;++c)b=d,d=this[c],d=16>d?"0"+d.toString(16):d.toString(16),d=b+d;return d;case "utf8":case "utf-8":return sb(this,a,c);case "ascii":b="";for(c=Math.min(this.length,c);a<c;++a)b+=String.fromCharCode(this[a]&127);return b;
case "latin1":case "binary":b="";for(c=Math.min(this.length,c);a<c;++a)b+=String.fromCharCode(this[a]);return b;case "base64":return a=0===a&&c===this.length?Ta(this):Ta(this.slice(a,c)),a;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":a=this.slice(a,c);c="";for(b=0;b<a.length;b+=2)c+=String.fromCharCode(a[b]+256*a[b+1]);return c;default:if(d)throw new TypeError("Unknown encoding: "+b);b=(b+"").toLowerCase();d=!0}}A.prototype._isBuffer=!0;function tb(b,a,c){var d=b[a];b[a]=b[c];b[c]=d}
A.prototype.swap16=function(){var b=this.length;if(0!==b%2)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;a<b;a+=2)tb(this,a,a+1);return this};A.prototype.swap32=function(){var b=this.length;if(0!==b%4)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var a=0;a<b;a+=4)tb(this,a,a+3),tb(this,a+1,a+2);return this};
A.prototype.swap64=function(){var b=this.length;if(0!==b%8)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var a=0;a<b;a+=8)tb(this,a,a+7),tb(this,a+1,a+6),tb(this,a+2,a+5),tb(this,a+3,a+4);return this};A.prototype.toString=function(){var b=this.length|0;return 0===b?"":0===arguments.length?sb(this,0,b):rb.apply(this,arguments)};A.prototype.equals=function(b){if(!mb(b))throw new TypeError("Argument must be a Buffer");return this===b?!0:0===A.compare(this,b)};
A.prototype.inspect=function(){var b="";0<this.length&&(b=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(b+=" ... "));return"<Buffer "+b+">"};
A.prototype.compare=function(b,a,c,d,e){if(!mb(b))throw new TypeError("Argument must be a Buffer");void 0===a&&(a=0);void 0===c&&(c=b?b.length:0);void 0===d&&(d=0);void 0===e&&(e=this.length);if(0>a||c>b.length||0>d||e>this.length)throw new RangeError("out of range index");if(d>=e&&a>=c)return 0;if(d>=e)return-1;if(a>=c)return 1;a>>>=0;c>>>=0;d>>>=0;e>>>=0;if(this===b)return 0;var g=e-d,f=c-a,h=Math.min(g,f);d=this.slice(d,e);b=b.slice(a,c);for(a=0;a<h;++a)if(d[a]!==b[a]){g=d[a];f=b[a];break}return g<
f?-1:f<g?1:0};
function ub(b,a,c,d,e){if(0===b.length)return-1;"string"===typeof c?(d=c,c=0):2147483647<c?c=2147483647:-2147483648>c&&(c=-2147483648);c=+c;isNaN(c)&&(c=e?0:b.length-1);0>c&&(c=b.length+c);if(c>=b.length){if(e)return-1;c=b.length-1}else if(0>c)if(e)c=0;else return-1;"string"===typeof a&&(a=A.from(a,d));if(mb(a))return 0===a.length?-1:vb(b,a,c,d,e);if("number"===typeof a)return a&=255,A.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(b,a,c):
Uint8Array.prototype.lastIndexOf.call(b,a,c):vb(b,[a],c,d,e);throw new TypeError("val must be string, number or Buffer");}
function vb(b,a,c,d,e){function g(a,b){return 1===f?a[b]:a.readUInt16BE(b*f)}var f=1,h=b.length,k=a.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(2>b.length||2>a.length)return-1;f=2;h/=2;k/=2;c/=2}if(e)for(d=-1;c<h;c++)if(g(b,c)===g(a,-1===d?0:c-d)){if(-1===d&&(d=c),c-d+1===k)return d*f}else-1!==d&&(c-=c-d),d=-1;else for(c+k>h&&(c=h-k);0<=c;c--){h=!0;for(d=0;d<k;d++)if(g(b,c+d)!==g(a,d)){h=!1;break}if(h)return c}return-1}
A.prototype.includes=function(b,a,c){return-1!==this.indexOf(b,a,c)};A.prototype.indexOf=function(b,a,c){return ub(this,b,a,c,!0)};A.prototype.lastIndexOf=function(b,a,c){return ub(this,b,a,c,!1)};
A.prototype.write=function(b,a,c,d){if(void 0===a)d="utf8",c=this.length,a=0;else if(void 0===c&&"string"===typeof a)d=a,c=this.length,a=0;else if(isFinite(a))a|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var e=this.length-a;if(void 0===c||c>e)c=e;if(0<b.length&&(0>c||0>a)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(e=!1;;)switch(d){case "hex":a:{a=
Number(a)||0;d=this.length-a;c?(c=Number(c),c>d&&(c=d)):c=d;d=b.length;if(0!==d%2)throw new TypeError("Invalid hex string");c>d/2&&(c=d/2);for(d=0;d<c;++d){e=parseInt(b.substr(2*d,2),16);if(isNaN(e)){b=d;break a}this[a+d]=e}b=d}return b;case "utf8":case "utf-8":return wb(ob(b,this.length-a),this,a,c);case "ascii":return wb(xb(b),this,a,c);case "latin1":case "binary":return wb(xb(b),this,a,c);case "base64":return wb(pb(b),this,a,c);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":d=b;e=this.length-
a;for(var g=[],f=0;f<d.length&&!(0>(e-=2));++f){var h=d.charCodeAt(f);b=h>>8;h%=256;g.push(h);g.push(b)}return wb(g,this,a,c);default:if(e)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase();e=!0}};A.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};
function sb(b,a,c){c=Math.min(b.length,c);for(var d=[];a<c;){var e=b[a],g=null,f=239<e?4:223<e?3:191<e?2:1;if(a+f<=c)switch(f){case 1:128>e&&(g=e);break;case 2:var h=b[a+1];128===(h&192)&&(e=(e&31)<<6|h&63,127<e&&(g=e));break;case 3:h=b[a+1];var k=b[a+2];128===(h&192)&&128===(k&192)&&(e=(e&15)<<12|(h&63)<<6|k&63,2047<e&&(55296>e||57343<e)&&(g=e));break;case 4:h=b[a+1];k=b[a+2];var r=b[a+3];128===(h&192)&&128===(k&192)&&128===(r&192)&&(e=(e&15)<<18|(h&63)<<12|(k&63)<<6|r&63,65535<e&&1114112>e&&(g=
e))}null===g?(g=65533,f=1):65535<g&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|g&1023);d.push(g);a+=f}b=d.length;if(b<=yb)d=String.fromCharCode.apply(String,d);else{c="";for(a=0;a<b;)c+=String.fromCharCode.apply(String,d.slice(a,a+=yb));d=c}return d}var yb=4096;
A.prototype.slice=function(b,a){var c=this.length;b=~~b;a=void 0===a?c:~~a;0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c);0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c);a<b&&(a=b);if(A.TYPED_ARRAY_SUPPORT)a=this.subarray(b,a),a.__proto__=A.prototype;else{c=a-b;a=new A(c,void 0);for(var d=0;d<c;++d)a[d]=this[d+b]}return a};function D(b,a,c){if(0!==b%1||0>b)throw new RangeError("offset is not uint");if(b+a>c)throw new RangeError("Trying to access beyond buffer length");}
A.prototype.readUIntLE=function(b,a,c){b|=0;a|=0;c||D(b,a,this.length);c=this[b];for(var d=1,e=0;++e<a&&(d*=256);)c+=this[b+e]*d;return c};A.prototype.readUIntBE=function(b,a,c){b|=0;a|=0;c||D(b,a,this.length);c=this[b+--a];for(var d=1;0<a&&(d*=256);)c+=this[b+--a]*d;return c};A.prototype.readUInt8=function(b,a){a||D(b,1,this.length);return this[b]};A.prototype.readUInt16LE=function(b,a){a||D(b,2,this.length);return this[b]|this[b+1]<<8};
A.prototype.readUInt16BE=function(b,a){a||D(b,2,this.length);return this[b]<<8|this[b+1]};A.prototype.readUInt32LE=function(b,a){a||D(b,4,this.length);return(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]};A.prototype.readUInt32BE=function(b,a){a||D(b,4,this.length);return 16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])};A.prototype.readIntLE=function(b,a,c){b|=0;a|=0;c||D(b,a,this.length);c=this[b];for(var d=1,e=0;++e<a&&(d*=256);)c+=this[b+e]*d;c>=128*d&&(c-=Math.pow(2,8*a));return c};
A.prototype.readIntBE=function(b,a,c){b|=0;a|=0;c||D(b,a,this.length);c=a;for(var d=1,e=this[b+--c];0<c&&(d*=256);)e+=this[b+--c]*d;e>=128*d&&(e-=Math.pow(2,8*a));return e};A.prototype.readInt8=function(b,a){a||D(b,1,this.length);return this[b]&128?-1*(255-this[b]+1):this[b]};A.prototype.readInt16LE=function(b,a){a||D(b,2,this.length);b=this[b]|this[b+1]<<8;return b&32768?b|4294901760:b};
A.prototype.readInt16BE=function(b,a){a||D(b,2,this.length);b=this[b+1]|this[b]<<8;return b&32768?b|4294901760:b};A.prototype.readInt32LE=function(b,a){a||D(b,4,this.length);return this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24};A.prototype.readInt32BE=function(b,a){a||D(b,4,this.length);return this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]};A.prototype.readFloatLE=function(b,a){a||D(b,4,this.length);return Ua(this,b,!0,23,4)};
A.prototype.readFloatBE=function(b,a){a||D(b,4,this.length);return Ua(this,b,!1,23,4)};A.prototype.readDoubleLE=function(b,a){a||D(b,8,this.length);return Ua(this,b,!0,52,8)};A.prototype.readDoubleBE=function(b,a){a||D(b,8,this.length);return Ua(this,b,!1,52,8)};function zb(b,a,c,d,e,g){if(!mb(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>e||a<g)throw new RangeError('"value" argument is out of bounds');if(c+d>b.length)throw new RangeError("Index out of range");}
A.prototype.writeUIntLE=function(b,a,c,d){b=+b;a|=0;c|=0;d||zb(this,b,a,c,Math.pow(2,8*c)-1,0);d=1;var e=0;for(this[a]=b&255;++e<c&&(d*=256);)this[a+e]=b/d&255;return a+c};A.prototype.writeUIntBE=function(b,a,c,d){b=+b;a|=0;c|=0;d||zb(this,b,a,c,Math.pow(2,8*c)-1,0);d=c-1;var e=1;for(this[a+d]=b&255;0<=--d&&(e*=256);)this[a+d]=b/e&255;return a+c};A.prototype.writeUInt8=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,1,255,0);A.TYPED_ARRAY_SUPPORT||(b=Math.floor(b));this[a]=b&255;return a+1};
function Ab(b,a,c,d){0>a&&(a=65535+a+1);for(var e=0,g=Math.min(b.length-c,2);e<g;++e)b[c+e]=(a&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}A.prototype.writeUInt16LE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,2,65535,0);A.TYPED_ARRAY_SUPPORT?(this[a]=b&255,this[a+1]=b>>>8):Ab(this,b,a,!0);return a+2};A.prototype.writeUInt16BE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,2,65535,0);A.TYPED_ARRAY_SUPPORT?(this[a]=b>>>8,this[a+1]=b&255):Ab(this,b,a,!1);return a+2};
function Bb(b,a,c,d){0>a&&(a=4294967295+a+1);for(var e=0,g=Math.min(b.length-c,4);e<g;++e)b[c+e]=a>>>8*(d?e:3-e)&255}A.prototype.writeUInt32LE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,4,4294967295,0);A.TYPED_ARRAY_SUPPORT?(this[a+3]=b>>>24,this[a+2]=b>>>16,this[a+1]=b>>>8,this[a]=b&255):Bb(this,b,a,!0);return a+4};
A.prototype.writeUInt32BE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,4,4294967295,0);A.TYPED_ARRAY_SUPPORT?(this[a]=b>>>24,this[a+1]=b>>>16,this[a+2]=b>>>8,this[a+3]=b&255):Bb(this,b,a,!1);return a+4};A.prototype.writeIntLE=function(b,a,c,d){b=+b;a|=0;d||(d=Math.pow(2,8*c-1),zb(this,b,a,c,d-1,-d));d=0;var e=1,g=0;for(this[a]=b&255;++d<c&&(e*=256);)0>b&&0===g&&0!==this[a+d-1]&&(g=1),this[a+d]=(b/e>>0)-g&255;return a+c};
A.prototype.writeIntBE=function(b,a,c,d){b=+b;a|=0;d||(d=Math.pow(2,8*c-1),zb(this,b,a,c,d-1,-d));d=c-1;var e=1,g=0;for(this[a+d]=b&255;0<=--d&&(e*=256);)0>b&&0===g&&0!==this[a+d+1]&&(g=1),this[a+d]=(b/e>>0)-g&255;return a+c};A.prototype.writeInt8=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,1,127,-128);A.TYPED_ARRAY_SUPPORT||(b=Math.floor(b));0>b&&(b=255+b+1);this[a]=b&255;return a+1};
A.prototype.writeInt16LE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,2,32767,-32768);A.TYPED_ARRAY_SUPPORT?(this[a]=b&255,this[a+1]=b>>>8):Ab(this,b,a,!0);return a+2};A.prototype.writeInt16BE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,2,32767,-32768);A.TYPED_ARRAY_SUPPORT?(this[a]=b>>>8,this[a+1]=b&255):Ab(this,b,a,!1);return a+2};
A.prototype.writeInt32LE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,4,2147483647,-2147483648);A.TYPED_ARRAY_SUPPORT?(this[a]=b&255,this[a+1]=b>>>8,this[a+2]=b>>>16,this[a+3]=b>>>24):Bb(this,b,a,!0);return a+4};A.prototype.writeInt32BE=function(b,a,c){b=+b;a|=0;c||zb(this,b,a,4,2147483647,-2147483648);0>b&&(b=4294967295+b+1);A.TYPED_ARRAY_SUPPORT?(this[a]=b>>>24,this[a+1]=b>>>16,this[a+2]=b>>>8,this[a+3]=b&255):Bb(this,b,a,!1);return a+4};
function Cb(b,a,c,d){if(c+d>b.length)throw new RangeError("Index out of range");if(0>c)throw new RangeError("Index out of range");}A.prototype.writeFloatLE=function(b,a,c){c||Cb(this,b,a,4);Va(this,b,a,!0,23,4);return a+4};A.prototype.writeFloatBE=function(b,a,c){c||Cb(this,b,a,4);Va(this,b,a,!1,23,4);return a+4};A.prototype.writeDoubleLE=function(b,a,c){c||Cb(this,b,a,8);Va(this,b,a,!0,52,8);return a+8};A.prototype.writeDoubleBE=function(b,a,c){c||Cb(this,b,a,8);Va(this,b,a,!1,52,8);return a+8};
A.prototype.copy=function(b,a,c,d){c||(c=0);d||0===d||(d=this.length);a>=b.length&&(a=b.length);a||(a=0);0<d&&d<c&&(d=c);if(d===c||0===b.length||0===this.length)return 0;if(0>a)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length);b.length-a<d-c&&(d=b.length-a+c);var e=d-c;if(this===b&&c<a&&a<d)for(d=e-1;0<=d;--d)b[d+a]=this[d+c];else if(1E3>e||
!A.TYPED_ARRAY_SUPPORT)for(d=0;d<e;++d)b[d+a]=this[d+c];else Uint8Array.prototype.set.call(b,this.subarray(c,c+e),a);return e};
A.prototype.fill=function(b,a,c,d){if("string"===typeof b){"string"===typeof a?(d=a,a=0,c=this.length):"string"===typeof c&&(d=c,c=this.length);if(1===b.length){var e=b.charCodeAt(0);256>e&&(b=e)}if(void 0!==d&&"string"!==typeof d)throw new TypeError("encoding must be a string");if("string"===typeof d&&!A.isEncoding(d))throw new TypeError("Unknown encoding: "+d);}else"number"===typeof b&&(b&=255);if(0>a||this.length<a||this.length<c)throw new RangeError("Out of range index");if(c<=a)return this;a>>>=
0;c=void 0===c?this.length:c>>>0;b||(b=0);if("number"===typeof b)for(d=a;d<c;++d)this[d]=b;else for(b=mb(b)?b:ob((new A(b,d)).toString()),e=b.length,d=0;d<c-a;++d)this[d+a]=b[d%e];return this};var Db=/[^+\/0-9A-Za-z-_]/g;
function ob(b,a){a=a||Infinity;for(var c,d=b.length,e=null,g=[],f=0;f<d;++f){c=b.charCodeAt(f);if(55295<c&&57344>c){if(!e){if(56319<c){-1<(a-=3)&&g.push(239,191,189);continue}else if(f+1===d){-1<(a-=3)&&g.push(239,191,189);continue}e=c;continue}if(56320>c){-1<(a-=3)&&g.push(239,191,189);e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&-1<(a-=3)&&g.push(239,191,189);e=null;if(128>c){if(0>--a)break;g.push(c)}else if(2048>c){if(0>(a-=2))break;g.push(c>>6|192,c&63|128)}else if(65536>c){if(0>(a-=3))break;
g.push(c>>12|224,c>>6&63|128,c&63|128)}else if(1114112>c){if(0>(a-=4))break;g.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw Error("Invalid code point");}return g}function xb(b){for(var a=[],c=0;c<b.length;++c)a.push(b.charCodeAt(c)&255);return a}
function pb(b){b=(b.trim?b.trim():b.replace(/^\s+|\s+$/g,"")).replace(Db,"");if(2>b.length)b="";else for(;0!==b.length%4;)b+="=";Pa||Qa();var a=b.length;if(0<a%4)throw Error("Invalid string. Length must be a multiple of 4");var c="="===b[a-2]?2:"="===b[a-1]?1:0,d=new Oa(3*a/4-c),e=0<c?a-4:a,g=0;for(a=0;a<e;a+=4){var f=Na[b.charCodeAt(a)]<<18|Na[b.charCodeAt(a+1)]<<12|Na[b.charCodeAt(a+2)]<<6|Na[b.charCodeAt(a+3)];d[g++]=f>>16&255;d[g++]=f>>8&255;d[g++]=f&255}2===c?(f=Na[b.charCodeAt(a)]<<2|Na[b.charCodeAt(a+
1)]>>4,d[g++]=f&255):1===c&&(f=Na[b.charCodeAt(a)]<<10|Na[b.charCodeAt(a+1)]<<4|Na[b.charCodeAt(a+2)]>>2,d[g++]=f>>8&255,d[g++]=f&255);return d}function wb(b,a,c,d){for(var e=0;e<d&&!(e+c>=a.length||e>=b.length);++e)a[e+c]=b[e];return e}function nb(b){return null!=b&&(!!b._isBuffer||Eb(b)||"function"===typeof b.readFloatLE&&"function"===typeof b.slice&&Eb(b.slice(0,0)))}function Eb(b){return!!b.constructor&&"function"===typeof b.constructor.isBuffer&&b.constructor.isBuffer(b)}
var Fb=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:ab,Buffer:A,SlowBuffer:function(b){+b!=b&&(b=0);return A.alloc(+b)},isBuffer:nb}),E=Ea(function(b,a){function c(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];return new (Fb.Buffer.bind.apply(Fb.Buffer,d([void 0,a],b)))}var d=x&&x.__spreadArrays||function(){for(var a=0,b=0,c=arguments.length;b<c;b++)a+=arguments[b].length;a=Array(a);var d=0;for(b=0;b<c;b++)for(var k=arguments[b],r=0,q=k.length;r<q;r++,d++)a[d]=k[r];
return a};Object.defineProperty(a,"__esModule",{value:!0});a.Buffer=Fb.Buffer;a.bufferAllocUnsafe=Fb.Buffer.allocUnsafe||c;a.bufferFrom=Fb.Buffer.from||c});Da(E);function Gb(){throw Error("setTimeout has not been defined");}function Ib(){throw Error("clearTimeout has not been defined");}var Jb=Gb,Kb=Ib;"function"===typeof La.setTimeout&&(Jb=setTimeout);"function"===typeof La.clearTimeout&&(Kb=clearTimeout);
function Lb(b){if(Jb===setTimeout)return setTimeout(b,0);if((Jb===Gb||!Jb)&&setTimeout)return Jb=setTimeout,setTimeout(b,0);try{return Jb(b,0)}catch(a){try{return Jb.call(null,b,0)}catch(c){return Jb.call(this,b,0)}}}function Mb(b){if(Kb===clearTimeout)return clearTimeout(b);if((Kb===Ib||!Kb)&&clearTimeout)return Kb=clearTimeout,clearTimeout(b);try{return Kb(b)}catch(a){try{return Kb.call(null,b)}catch(c){return Kb.call(this,b)}}}var Nb=[],Ob=!1,Pb,Qb=-1;
function Rb(){Ob&&Pb&&(Ob=!1,Pb.length?Nb=Pb.concat(Nb):Qb=-1,Nb.length&&Vb())}function Vb(){if(!Ob){var b=Lb(Rb);Ob=!0;for(var a=Nb.length;a;){Pb=Nb;for(Nb=[];++Qb<a;)Pb&&Pb[Qb].run();Qb=-1;a=Nb.length}Pb=null;Ob=!1;Mb(b)}}function Wb(b){var a=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)a[c-1]=arguments[c];Nb.push(new Xb(b,a));1!==Nb.length||Ob||Lb(Vb)}function Xb(b,a){this.fun=b;this.array=a}Xb.prototype.run=function(){this.fun.apply(null,this.array)};
function Yb(){}
var Zb=La.performance||{},$b=Zb.now||Zb.mozNow||Zb.msNow||Zb.oNow||Zb.webkitNow||function(){return(new Date).getTime()},ac=new Date,bc={nextTick:Wb,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Yb,addListener:Yb,once:Yb,off:Yb,removeListener:Yb,removeAllListeners:Yb,emit:Yb,binding:function(){throw Error("process.binding is not supported");},cwd:function(){return"/"},chdir:function(){throw Error("process.chdir is not supported");},umask:function(){return 0},hrtime:function(b){var a=.001*
$b.call(Zb),c=Math.floor(a);a=Math.floor(a%1*1E9);b&&(c-=b[0],a-=b[1],0>a&&(c--,a+=1E9));return[c,a]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ac)/1E3}},cc="function"===typeof Object.create?function(b,a){b.super_=a;b.prototype=Object.create(a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}})}:function(b,a){function c(){}b.super_=a;c.prototype=a.prototype;b.prototype=new c;b.prototype.constructor=b},fc=/%[sdj%]/g;
function gc(b){if(!hc(b)){for(var a=[],c=0;c<arguments.length;c++)a.push(ic(arguments[c]));return a.join(" ")}c=1;var d=arguments,e=d.length;a=String(b).replace(fc,function(a){if("%%"===a)return"%";if(c>=e)return a;switch(a){case "%s":return String(d[c++]);case "%d":return Number(d[c++]);case "%j":try{return JSON.stringify(d[c++])}catch(h){return"[Circular]"}default:return a}});for(var g=d[c];c<e;g=d[++c])a=null!==g&&jc(g)?a+(" "+ic(g)):a+(" "+g);return a}
function kc(b,a){if(lc(La.process))return function(){return kc(b,a).apply(this,arguments)};if(!0===bc.noDeprecation)return b;var c=!1;return function(){if(!c){if(bc.throwDeprecation)throw Error(a);bc.traceDeprecation?console.trace(a):console.error(a);c=!0}return b.apply(this,arguments)}}var mc={},nc;
function oc(b){lc(nc)&&(nc=bc.env.NODE_DEBUG||"");b=b.toUpperCase();mc[b]||((new RegExp("\\b"+b+"\\b","i")).test(nc)?mc[b]=function(){var a=gc.apply(null,arguments);console.error("%s %d: %s",b,0,a)}:mc[b]=function(){});return mc[b]}
function ic(b,a){var c={seen:[],stylize:pc};3<=arguments.length&&(c.depth=arguments[2]);4<=arguments.length&&(c.colors=arguments[3]);xc(a)?c.showHidden=a:a&&yc(c,a);lc(c.showHidden)&&(c.showHidden=!1);lc(c.depth)&&(c.depth=2);lc(c.colors)&&(c.colors=!1);lc(c.customInspect)&&(c.customInspect=!0);c.colors&&(c.stylize=zc);return Ec(c,b,c.depth)}
ic.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};ic.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function zc(b,a){return(a=ic.styles[a])?"\u001b["+ic.colors[a][0]+"m"+b+"\u001b["+ic.colors[a][1]+"m":b}function pc(b){return b}
function Fc(b){var a={};b.forEach(function(b){a[b]=!0});return a}
function Ec(b,a,c){if(b.customInspect&&a&&Gc(a.inspect)&&a.inspect!==ic&&(!a.constructor||a.constructor.prototype!==a)){var d=a.inspect(c,b);hc(d)||(d=Ec(b,d,c));return d}if(d=Hc(b,a))return d;var e=Object.keys(a),g=Fc(e);b.showHidden&&(e=Object.getOwnPropertyNames(a));if(Ic(a)&&(0<=e.indexOf("message")||0<=e.indexOf("description")))return Jc(a);if(0===e.length){if(Gc(a))return b.stylize("[Function"+(a.name?": "+a.name:"")+"]","special");if(Kc(a))return b.stylize(RegExp.prototype.toString.call(a),
"regexp");if(Lc(a))return b.stylize(Date.prototype.toString.call(a),"date");if(Ic(a))return Jc(a)}d="";var f=!1,h=["{","}"];Mc(a)&&(f=!0,h=["[","]"]);Gc(a)&&(d=" [Function"+(a.name?": "+a.name:"")+"]");Kc(a)&&(d=" "+RegExp.prototype.toString.call(a));Lc(a)&&(d=" "+Date.prototype.toUTCString.call(a));Ic(a)&&(d=" "+Jc(a));if(0===e.length&&(!f||0==a.length))return h[0]+d+h[1];if(0>c)return Kc(a)?b.stylize(RegExp.prototype.toString.call(a),"regexp"):b.stylize("[Object]","special");b.seen.push(a);e=f?
Nc(b,a,c,g,e):e.map(function(d){return Oc(b,a,c,g,d,f)});b.seen.pop();return Wc(e,d,h)}function Hc(b,a){if(lc(a))return b.stylize("undefined","undefined");if(hc(a))return a="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",b.stylize(a,"string");if(Xc(a))return b.stylize(""+a,"number");if(xc(a))return b.stylize(""+a,"boolean");if(null===a)return b.stylize("null","null")}function Jc(b){return"["+Error.prototype.toString.call(b)+"]"}
function Nc(b,a,c,d,e){for(var g=[],f=0,h=a.length;f<h;++f)Object.prototype.hasOwnProperty.call(a,String(f))?g.push(Oc(b,a,c,d,String(f),!0)):g.push("");e.forEach(function(e){e.match(/^\d+$/)||g.push(Oc(b,a,c,d,e,!0))});return g}
function Oc(b,a,c,d,e,g){var f,h;a=Object.getOwnPropertyDescriptor(a,e)||{value:a[e]};a.get?h=a.set?b.stylize("[Getter/Setter]","special"):b.stylize("[Getter]","special"):a.set&&(h=b.stylize("[Setter]","special"));Object.prototype.hasOwnProperty.call(d,e)||(f="["+e+"]");h||(0>b.seen.indexOf(a.value)?(h=null===c?Ec(b,a.value,null):Ec(b,a.value,c-1),-1<h.indexOf("\n")&&(h=g?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):
h=b.stylize("[Circular]","special"));if(lc(f)){if(g&&e.match(/^\d+$/))return h;f=JSON.stringify(""+e);f.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(f=f.substr(1,f.length-2),f=b.stylize(f,"name")):(f=f.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),f=b.stylize(f,"string"))}return f+": "+h}
function Wc(b,a,c){return 60<b.reduce(function(a,b){b.indexOf("\n");return a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0)?c[0]+(""===a?"":a+"\n ")+" "+b.join(",\n ")+" "+c[1]:c[0]+a+" "+b.join(", ")+" "+c[1]}function Mc(b){return Array.isArray(b)}function xc(b){return"boolean"===typeof b}function Xc(b){return"number"===typeof b}function hc(b){return"string"===typeof b}function lc(b){return void 0===b}function Kc(b){return jc(b)&&"[object RegExp]"===Object.prototype.toString.call(b)}
function jc(b){return"object"===typeof b&&null!==b}function Lc(b){return jc(b)&&"[object Date]"===Object.prototype.toString.call(b)}function Ic(b){return jc(b)&&("[object Error]"===Object.prototype.toString.call(b)||b instanceof Error)}function Gc(b){return"function"===typeof b}function id(b){return null===b||"boolean"===typeof b||"number"===typeof b||"string"===typeof b||"symbol"===typeof b||"undefined"===typeof b}function jd(b){return 10>b?"0"+b.toString(10):b.toString(10)}var kd="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");
function ld(){var b=new Date,a=[jd(b.getHours()),jd(b.getMinutes()),jd(b.getSeconds())].join(":");return[b.getDate(),kd[b.getMonth()],a].join(" ")}function yc(b,a){if(!a||!jc(a))return b;for(var c=Object.keys(a),d=c.length;d--;)b[c[d]]=a[c[d]];return b}
var md={inherits:cc,_extend:yc,log:function(){console.log("%s - %s",ld(),gc.apply(null,arguments))},isBuffer:function(b){return nb(b)},isPrimitive:id,isFunction:Gc,isError:Ic,isDate:Lc,isObject:jc,isRegExp:Kc,isUndefined:lc,isSymbol:function(b){return"symbol"===typeof b},isString:hc,isNumber:Xc,isNullOrUndefined:function(b){return null==b},isNull:function(b){return null===b},isBoolean:xc,isArray:Mc,inspect:ic,deprecate:kc,format:gc,debuglog:oc};
function nd(b,a){if(b===a)return 0;for(var c=b.length,d=a.length,e=0,g=Math.min(c,d);e<g;++e)if(b[e]!==a[e]){c=b[e];d=a[e];break}return c<d?-1:d<c?1:0}var od=Object.prototype.hasOwnProperty,pd=Object.keys||function(b){var a=[],c;for(c in b)od.call(b,c)&&a.push(c);return a},qd=Array.prototype.slice,rd;function sd(){return"undefined"!==typeof rd?rd:rd=function(){return"foo"===function(){}.name}()}
function td(b){return nb(b)||"function"!==typeof La.ArrayBuffer?!1:"function"===typeof ArrayBuffer.isView?ArrayBuffer.isView(b):b?b instanceof DataView||b.buffer&&b.buffer instanceof ArrayBuffer?!0:!1:!1}function K(b,a){b||ud(b,!0,a,"==",vd)}var wd=/\s*function\s+([^\(\s]*)\s*/;function xd(b){if(Gc(b))return sd()?b.name:(b=b.toString().match(wd))&&b[1]}K.AssertionError=yd;
function yd(b){this.name="AssertionError";this.actual=b.actual;this.expected=b.expected;this.operator=b.operator;b.message?(this.message=b.message,this.generatedMessage=!1):(this.message=zd(Ad(this.actual),128)+" "+this.operator+" "+zd(Ad(this.expected),128),this.generatedMessage=!0);var a=b.stackStartFunction||ud;Error.captureStackTrace?Error.captureStackTrace(this,a):(b=Error(),b.stack&&(b=b.stack,a=xd(a),a=b.indexOf("\n"+a),0<=a&&(a=b.indexOf("\n",a+1),b=b.substring(a+1)),this.stack=b))}
cc(yd,Error);function zd(b,a){return"string"===typeof b?b.length<a?b:b.slice(0,a):b}function Ad(b){if(sd()||!Gc(b))return ic(b);b=xd(b);return"[Function"+(b?": "+b:"")+"]"}function ud(b,a,c,d,e){throw new yd({message:c,actual:b,expected:a,operator:d,stackStartFunction:e});}K.fail=ud;function vd(b,a){b||ud(b,!0,a,"==",vd)}K.ok=vd;K.equal=Bd;function Bd(b,a,c){b!=a&&ud(b,a,c,"==",Bd)}K.notEqual=Cd;function Cd(b,a,c){b==a&&ud(b,a,c,"!=",Cd)}K.deepEqual=Dd;
function Dd(b,a,c){Id(b,a,!1)||ud(b,a,c,"deepEqual",Dd)}K.deepStrictEqual=Jd;function Jd(b,a,c){Id(b,a,!0)||ud(b,a,c,"deepStrictEqual",Jd)}
function Id(b,a,c,d){if(b===a)return!0;if(nb(b)&&nb(a))return 0===nd(b,a);if(Lc(b)&&Lc(a))return b.getTime()===a.getTime();if(Kc(b)&&Kc(a))return b.source===a.source&&b.global===a.global&&b.multiline===a.multiline&&b.lastIndex===a.lastIndex&&b.ignoreCase===a.ignoreCase;if(null!==b&&"object"===typeof b||null!==a&&"object"===typeof a){if(!td(b)||!td(a)||Object.prototype.toString.call(b)!==Object.prototype.toString.call(a)||b instanceof Float32Array||b instanceof Float64Array){if(nb(b)!==nb(a))return!1;
d=d||{actual:[],expected:[]};var e=d.actual.indexOf(b);if(-1!==e&&e===d.expected.indexOf(a))return!0;d.actual.push(b);d.expected.push(a);return Kd(b,a,c,d)}return 0===nd(new Uint8Array(b.buffer),new Uint8Array(a.buffer))}return c?b===a:b==a}
function Kd(b,a,c,d){if(null===b||void 0===b||null===a||void 0===a)return!1;if(id(b)||id(a))return b===a;if(c&&Object.getPrototypeOf(b)!==Object.getPrototypeOf(a))return!1;var e="[object Arguments]"==Object.prototype.toString.call(b),g="[object Arguments]"==Object.prototype.toString.call(a);if(e&&!g||!e&&g)return!1;if(e)return b=qd.call(b),a=qd.call(a),Id(b,a,c);e=pd(b);var f=pd(a);if(e.length!==f.length)return!1;e.sort();f.sort();for(g=e.length-1;0<=g;g--)if(e[g]!==f[g])return!1;for(g=e.length-1;0<=
g;g--)if(f=e[g],!Id(b[f],a[f],c,d))return!1;return!0}K.notDeepEqual=Ld;function Ld(b,a,c){Id(b,a,!1)&&ud(b,a,c,"notDeepEqual",Ld)}K.notDeepStrictEqual=Md;function Md(b,a,c){Id(b,a,!0)&&ud(b,a,c,"notDeepStrictEqual",Md)}K.strictEqual=Nd;function Nd(b,a,c){b!==a&&ud(b,a,c,"===",Nd)}K.notStrictEqual=Od;function Od(b,a,c){b===a&&ud(b,a,c,"!==",Od)}
function Pd(b,a){if(!b||!a)return!1;if("[object RegExp]"==Object.prototype.toString.call(a))return a.test(b);try{if(b instanceof a)return!0}catch(c){}return Error.isPrototypeOf(a)?!1:!0===a.call({},b)}
function Qd(b,a,c,d){if("function"!==typeof a)throw new TypeError('"block" argument must be a function');"string"===typeof c&&(d=c,c=null);try{a()}catch(h){var e=h}a=e;d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:".");b&&!a&&ud(a,c,"Missing expected exception"+d);e="string"===typeof d;var g=!b&&Ic(a),f=!b&&a&&!c;(g&&e&&Pd(a,c)||f)&&ud(a,c,"Got unwanted exception"+d);if(b&&a&&c&&!Pd(a,c)||!b&&a)throw a;}K.throws=Rd;function Rd(b,a,c){Qd(!0,b,a,c)}K.doesNotThrow=Sd;function Sd(b,a,c){Qd(!1,b,a,c)}
K.ifError=Td;function Td(b){if(b)throw b;}
var Ud=Ea(function(b,a){function c(a){return function(a){function b(b){for(var c=[],e=1;e<arguments.length;e++)c[e-1]=arguments[e];c=a.call(this,d(b,c))||this;c.code=b;c[h]=b;c.name=a.prototype.name+" ["+c[h]+"]";return c}f(b,a);return b}(a)}function d(a,b){K.strictEqual(typeof a,"string");var c=k[a];K(c,"An invalid error message key was used: "+a+".");if("function"===typeof c)a=c;else{a=md.format;if(void 0===b||0===b.length)return c;b.unshift(c)}return String(a.apply(null,b))}function e(a,b){k[a]=
"function"===typeof b?b:String(b)}function g(a,b){K(a,"expected is required");K("string"===typeof b,"thing is required");if(Array.isArray(a)){var c=a.length;K(0<c,"At least one expected value needs to be specified");a=a.map(function(a){return String(a)});return 2<c?"one of "+b+" "+a.slice(0,c-1).join(", ")+", or "+a[c-1]:2===c?"one of "+b+" "+a[0]+" or "+a[1]:"of "+b+" "+a[0]}return"of "+b+" "+String(a)}var f=x&&x.__extends||function(){function a(b,c){a=Object.setPrototypeOf||{__proto__:[]}instanceof
Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return a(b,c)}return function(b,c){function d(){this.constructor=b}a(b,c);b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();Object.defineProperty(a,"__esModule",{value:!0});var h="undefined"===typeof Symbol?"_kCode":Symbol("code"),k={};b=function(b){function c(c){if("object"!==typeof c||null===c)throw new a.TypeError("ERR_INVALID_ARG_TYPE","options","object");var d=c.message?
b.call(this,c.message)||this:b.call(this,md.inspect(c.actual).slice(0,128)+" "+(c.operator+" "+md.inspect(c.expected).slice(0,128)))||this;d.generatedMessage=!c.message;d.name="AssertionError [ERR_ASSERTION]";d.code="ERR_ASSERTION";d.actual=c.actual;d.expected=c.expected;d.operator=c.operator;a.Error.captureStackTrace(d,c.stackStartFunction);return d}f(c,b);return c}(x.Error);a.AssertionError=b;a.message=d;a.E=e;a.Error=c(x.Error);a.TypeError=c(x.TypeError);a.RangeError=c(x.RangeError);e("ERR_ARG_NOT_ITERABLE",
"%s must be iterable");e("ERR_ASSERTION","%s");e("ERR_BUFFER_OUT_OF_BOUNDS",function(a,b){return b?"Attempt to write outside buffer bounds":'"'+a+'" is outside of buffer bounds'});e("ERR_CHILD_CLOSED_BEFORE_REPLY","Child closed before reply received");e("ERR_CONSOLE_WRITABLE_STREAM","Console expects a writable stream instance for %s");e("ERR_CPU_USAGE","Unable to obtain cpu usage %s");e("ERR_DNS_SET_SERVERS_FAILED",function(a,b){return'c-ares failed to set servers: "'+a+'" ['+b+"]"});e("ERR_FALSY_VALUE_REJECTION",
"Promise was rejected with falsy value");e("ERR_ENCODING_NOT_SUPPORTED",function(a){return'The "'+a+'" encoding is not supported'});e("ERR_ENCODING_INVALID_ENCODED_DATA",function(a){return"The encoded data was not valid for encoding "+a});e("ERR_HTTP_HEADERS_SENT","Cannot render headers after they are sent to the client");e("ERR_HTTP_INVALID_STATUS_CODE","Invalid status code: %s");e("ERR_HTTP_TRAILER_INVALID","Trailers are invalid with this transfer encoding");e("ERR_INDEX_OUT_OF_RANGE","Index out of range");
e("ERR_INVALID_ARG_TYPE",function(a,b,c){K(a,"name is required");if(b.includes("not ")){var d="must not be";b=b.split("not ")[1]}else d="must be";if(Array.isArray(a))d="The "+a.map(function(a){return'"'+a+'"'}).join(", ")+" arguments "+d+" "+g(b,"type");else if(a.includes(" argument"))d="The "+a+" "+d+" "+g(b,"type");else{var e=a.includes(".")?"property":"argument";d='The "'+a+'" '+e+" "+d+" "+g(b,"type")}3<=arguments.length&&(d+=". Received type "+(null!==c?typeof c:"null"));return d});e("ERR_INVALID_ARRAY_LENGTH",
function(a,b,c){K.strictEqual(typeof c,"number");return'The array "'+a+'" (length '+c+") must be of length "+b+"."});e("ERR_INVALID_BUFFER_SIZE","Buffer size must be a multiple of %s");e("ERR_INVALID_CALLBACK","Callback must be a function");e("ERR_INVALID_CHAR","Invalid character in %s");e("ERR_INVALID_CURSOR_POS","Cannot set cursor row without setting its column");e("ERR_INVALID_FD",'"fd" must be a positive integer: %s');e("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');
e("ERR_INVALID_FILE_URL_PATH","File URL path %s");e("ERR_INVALID_HANDLE_TYPE","This handle type cannot be sent");e("ERR_INVALID_IP_ADDRESS","Invalid IP address: %s");e("ERR_INVALID_OPT_VALUE",function(a,b){return'The value "'+String(b)+'" is invalid for option "'+a+'"'});e("ERR_INVALID_OPT_VALUE_ENCODING",function(a){return'The value "'+String(a)+'" is invalid for option "encoding"'});e("ERR_INVALID_REPL_EVAL_CONFIG",'Cannot specify both "breakEvalOnSigint" and "eval" for REPL');e("ERR_INVALID_SYNC_FORK_INPUT",
"Asynchronous forks do not support Buffer, Uint8Array or string input: %s");e("ERR_INVALID_THIS",'Value of "this" must be of type %s');e("ERR_INVALID_TUPLE","%s must be an iterable %s tuple");e("ERR_INVALID_URL","Invalid URL: %s");e("ERR_INVALID_URL_SCHEME",function(a){return"The URL must be "+g(a,"scheme")});e("ERR_IPC_CHANNEL_CLOSED","Channel closed");e("ERR_IPC_DISCONNECTED","IPC channel is already disconnected");e("ERR_IPC_ONE_PIPE","Child process can have only one IPC pipe");e("ERR_IPC_SYNC_FORK",
"IPC cannot be used with synchronous forks");e("ERR_MISSING_ARGS",function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];K(0<a.length,"At least one arg needs to be specified");b="The ";var c=a.length;a=a.map(function(a){return'"'+a+'"'});switch(c){case 1:b+=a[0]+" argument";break;case 2:b+=a[0]+" and "+a[1]+" arguments";break;default:b+=a.slice(0,c-1).join(", "),b+=", and "+a[c-1]+" arguments"}return b+" must be specified"});e("ERR_MULTIPLE_CALLBACK","Callback called multiple times");
e("ERR_NAPI_CONS_FUNCTION","Constructor must be a function");e("ERR_NAPI_CONS_PROTOTYPE_OBJECT","Constructor.prototype must be an object");e("ERR_NO_CRYPTO","Node.js is not compiled with OpenSSL crypto support");e("ERR_NO_LONGER_SUPPORTED","%s is no longer supported");e("ERR_PARSE_HISTORY_DATA","Could not parse history data in %s");e("ERR_SOCKET_ALREADY_BOUND","Socket is already bound");e("ERR_SOCKET_BAD_PORT","Port should be > 0 and < 65536");e("ERR_SOCKET_BAD_TYPE","Bad socket type specified. Valid types are: udp4, udp6");
e("ERR_SOCKET_CANNOT_SEND","Unable to send data");e("ERR_SOCKET_CLOSED","Socket is closed");e("ERR_SOCKET_DGRAM_NOT_RUNNING","Not running");e("ERR_STDERR_CLOSE","process.stderr cannot be closed");e("ERR_STDOUT_CLOSE","process.stdout cannot be closed");e("ERR_STREAM_WRAP","Stream has StringDecoder set or is in objectMode");e("ERR_TLS_CERT_ALTNAME_INVALID","Hostname/IP does not match certificate's altnames: %s");e("ERR_TLS_DH_PARAM_SIZE",function(a){return"DH parameter size "+a+" is less than 2048"});
e("ERR_TLS_HANDSHAKE_TIMEOUT","TLS handshake timeout");e("ERR_TLS_RENEGOTIATION_FAILED","Failed to renegotiate");e("ERR_TLS_REQUIRED_SERVER_NAME",'"servername" is required parameter for Server.addContext');e("ERR_TLS_SESSION_ATTACK","TSL session renegotiation attack detected");e("ERR_TRANSFORM_ALREADY_TRANSFORMING","Calling transform done when still transforming");e("ERR_TRANSFORM_WITH_LENGTH_0","Calling transform done when writableState.length != 0");e("ERR_UNKNOWN_ENCODING","Unknown encoding: %s");
e("ERR_UNKNOWN_SIGNAL","Unknown signal: %s");e("ERR_UNKNOWN_STDIN_TYPE","Unknown stdin file type");e("ERR_UNKNOWN_STREAM_TYPE","Unknown stream file type");e("ERR_V8BREAKITERATOR","Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl")});Da(Ud);
var Vd=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});a.ENCODING_UTF8="utf8";a.assertEncoding=function(a){if(a&&!E.Buffer.isEncoding(a))throw new Ud.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",a);};a.strToEncoding=function(b,d){return d&&d!==a.ENCODING_UTF8?"buffer"===d?new E.Buffer(b):(new E.Buffer(b)).toString(d):b}});Da(Vd);
var Wd=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});var c=z.constants.S_IFMT,d=z.constants.S_IFDIR,e=z.constants.S_IFREG,g=z.constants.S_IFBLK,f=z.constants.S_IFCHR,h=z.constants.S_IFLNK,k=z.constants.S_IFIFO,r=z.constants.S_IFSOCK;b=function(){function a(){this.name="";this.mode=0}a.build=function(b,c){var d=new a,e=b.getNode().mode;d.name=Vd.strToEncoding(b.getName(),c);d.mode=e;return d};a.prototype._checkModeProperty=function(a){return(this.mode&c)===a};a.prototype.isDirectory=
function(){return this._checkModeProperty(d)};a.prototype.isFile=function(){return this._checkModeProperty(e)};a.prototype.isBlockDevice=function(){return this._checkModeProperty(g)};a.prototype.isCharacterDevice=function(){return this._checkModeProperty(f)};a.prototype.isSymbolicLink=function(){return this._checkModeProperty(h)};a.prototype.isFIFO=function(){return this._checkModeProperty(k)};a.prototype.isSocket=function(){return this._checkModeProperty(r)};return a}();a.Dirent=b;a.default=b});
Da(Wd);function Xd(b,a){for(var c=0,d=b.length-1;0<=d;d--){var e=b[d];"."===e?b.splice(d,1):".."===e?(b.splice(d,1),c++):c&&(b.splice(d,1),c--)}if(a)for(;c--;c)b.unshift("..");return b}var Yd=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
function Zd(){for(var b="",a=!1,c=arguments.length-1;-1<=c&&!a;c--){var d=0<=c?arguments[c]:"/";if("string"!==typeof d)throw new TypeError("Arguments to path.resolve must be strings");d&&(b=d+"/"+b,a="/"===d.charAt(0))}b=Xd($d(b.split("/"),function(a){return!!a}),!a).join("/");return(a?"/":"")+b||"."}function ae(b){var a=be(b),c="/"===ce(b,-1);(b=Xd($d(b.split("/"),function(a){return!!a}),!a).join("/"))||a||(b=".");b&&c&&(b+="/");return(a?"/":"")+b}function be(b){return"/"===b.charAt(0)}
function de(b,a){function c(a){for(var b=0;b<a.length&&""===a[b];b++);for(var c=a.length-1;0<=c&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}b=Zd(b).substr(1);a=Zd(a).substr(1);b=c(b.split("/"));a=c(a.split("/"));for(var d=Math.min(b.length,a.length),e=d,g=0;g<d;g++)if(b[g]!==a[g]){e=g;break}d=[];for(g=e;g<b.length;g++)d.push("..");d=d.concat(a.slice(e));return d.join("/")}
var ee={extname:function(b){return Yd.exec(b).slice(1)[3]},basename:function(b,a){b=Yd.exec(b).slice(1)[2];a&&b.substr(-1*a.length)===a&&(b=b.substr(0,b.length-a.length));return b},dirname:function(b){var a=Yd.exec(b).slice(1);b=a[0];a=a[1];if(!b&&!a)return".";a&&(a=a.substr(0,a.length-1));return b+a},sep:"/",delimiter:":",relative:de,join:function(){var b=Array.prototype.slice.call(arguments,0);return ae($d(b,function(a){if("string"!==typeof a)throw new TypeError("Arguments to path.join must be strings");
return a}).join("/"))},isAbsolute:be,normalize:ae,resolve:Zd};function $d(b,a){if(b.filter)return b.filter(a);for(var c=[],d=0;d<b.length;d++)a(b[d],d,b)&&c.push(b[d]);return c}var ce="b"==="ab".substr(-1)?function(b,a,c){return b.substr(a,c)}:function(b,a,c){0>a&&(a=b.length+a);return b.substr(a,c)},fe=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});b="function"===typeof setImmediate?setImmediate.bind(x):setTimeout.bind(x);a.default=b});Da(fe);
var ge=Ea(function(b,a){function c(){var a=bc||{};a.getuid||(a.getuid=function(){return 0});a.getgid||(a.getgid=function(){return 0});a.cwd||(a.cwd=function(){return"/"});a.nextTick||(a.nextTick=fe.default);a.emitWarning||(a.emitWarning=function(a,b){console.warn(""+b+(b?": ":"")+a)});a.env||(a.env={});return a}Object.defineProperty(a,"__esModule",{value:!0});a.createProcess=c;a.default=c()});Da(ge);function he(){}he.prototype=Object.create(null);function L(){L.init.call(this)}L.EventEmitter=L;
L.usingDomains=!1;L.prototype.domain=void 0;L.prototype._events=void 0;L.prototype._maxListeners=void 0;L.defaultMaxListeners=10;L.init=function(){this.domain=null;this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new he,this._eventsCount=0);this._maxListeners=this._maxListeners||void 0};L.prototype.setMaxListeners=function(b){if("number"!==typeof b||0>b||isNaN(b))throw new TypeError('"n" argument must be a positive number');this._maxListeners=b;return this};
L.prototype.getMaxListeners=function(){return void 0===this._maxListeners?L.defaultMaxListeners:this._maxListeners};
L.prototype.emit=function(b){var a,c,d="error"===b;if(a=this._events)d=d&&null==a.error;else if(!d)return!1;var e=this.domain;if(d){a=arguments[1];if(e)a||(a=Error('Uncaught, unspecified "error" event')),a.domainEmitter=this,a.domain=e,a.domainThrown=!1,e.emit("error",a);else{if(a instanceof Error)throw a;e=Error('Uncaught, unspecified "error" event. ('+a+")");e.context=a;throw e;}return!1}e=a[b];if(!e)return!1;a="function"===typeof e;var g=arguments.length;switch(g){case 1:if(a)e.call(this);else for(a=
e.length,e=ie(e,a),d=0;d<a;++d)e[d].call(this);break;case 2:d=arguments[1];if(a)e.call(this,d);else for(a=e.length,e=ie(e,a),g=0;g<a;++g)e[g].call(this,d);break;case 3:d=arguments[1];g=arguments[2];if(a)e.call(this,d,g);else for(a=e.length,e=ie(e,a),c=0;c<a;++c)e[c].call(this,d,g);break;case 4:d=arguments[1];g=arguments[2];c=arguments[3];if(a)e.call(this,d,g,c);else{a=e.length;e=ie(e,a);for(var f=0;f<a;++f)e[f].call(this,d,g,c)}break;default:d=Array(g-1);for(c=1;c<g;c++)d[c-1]=arguments[c];if(a)e.apply(this,
d);else for(a=e.length,e=ie(e,a),g=0;g<a;++g)e[g].apply(this,d)}return!0};
function je(b,a,c,d){var e;if("function"!==typeof c)throw new TypeError('"listener" argument must be a function');if(e=b._events){e.newListener&&(b.emit("newListener",a,c.listener?c.listener:c),e=b._events);var g=e[a]}else e=b._events=new he,b._eventsCount=0;g?("function"===typeof g?g=e[a]=d?[c,g]:[g,c]:d?g.unshift(c):g.push(c),g.warned||(c=void 0===b._maxListeners?L.defaultMaxListeners:b._maxListeners)&&0<c&&g.length>c&&(g.warned=!0,c=Error("Possible EventEmitter memory leak detected. "+g.length+
" "+a+" listeners added. Use emitter.setMaxListeners() to increase limit"),c.name="MaxListenersExceededWarning",c.emitter=b,c.type=a,c.count=g.length,"function"===typeof console.warn?console.warn(c):console.log(c))):(e[a]=c,++b._eventsCount);return b}L.prototype.addListener=function(b,a){return je(this,b,a,!1)};L.prototype.on=L.prototype.addListener;L.prototype.prependListener=function(b,a){return je(this,b,a,!0)};
function ke(b,a,c){function d(){b.removeListener(a,d);e||(e=!0,c.apply(b,arguments))}var e=!1;d.listener=c;return d}L.prototype.once=function(b,a){if("function"!==typeof a)throw new TypeError('"listener" argument must be a function');this.on(b,ke(this,b,a));return this};L.prototype.prependOnceListener=function(b,a){if("function"!==typeof a)throw new TypeError('"listener" argument must be a function');this.prependListener(b,ke(this,b,a));return this};
L.prototype.removeListener=function(b,a){var c;if("function"!==typeof a)throw new TypeError('"listener" argument must be a function');var d=this._events;if(!d)return this;var e=d[b];if(!e)return this;if(e===a||e.listener&&e.listener===a)0===--this._eventsCount?this._events=new he:(delete d[b],d.removeListener&&this.emit("removeListener",b,e.listener||a));else if("function"!==typeof e){var g=-1;for(c=e.length;0<c--;)if(e[c]===a||e[c].listener&&e[c].listener===a){var f=e[c].listener;g=c;break}if(0>
g)return this;if(1===e.length){e[0]=void 0;if(0===--this._eventsCount)return this._events=new he,this;delete d[b]}else{c=g+1;for(var h=e.length;c<h;g+=1,c+=1)e[g]=e[c];e.pop()}d.removeListener&&this.emit("removeListener",b,f||a)}return this};
L.prototype.removeAllListeners=function(b){var a=this._events;if(!a)return this;if(!a.removeListener)return 0===arguments.length?(this._events=new he,this._eventsCount=0):a[b]&&(0===--this._eventsCount?this._events=new he:delete a[b]),this;if(0===arguments.length){a=Object.keys(a);for(var c=0,d;c<a.length;++c)d=a[c],"removeListener"!==d&&this.removeAllListeners(d);this.removeAllListeners("removeListener");this._events=new he;this._eventsCount=0;return this}a=a[b];if("function"===typeof a)this.removeListener(b,
a);else if(a){do this.removeListener(b,a[a.length-1]);while(a[0])}return this};L.prototype.listeners=function(b){var a=this._events;if(a)if(b=a[b])if("function"===typeof b)b=[b.listener||b];else{a=Array(b.length);for(var c=0;c<a.length;++c)a[c]=b[c].listener||b[c];b=a}else b=[];else b=[];return b};L.listenerCount=function(b,a){return"function"===typeof b.listenerCount?b.listenerCount(a):le.call(b,a)};L.prototype.listenerCount=le;
function le(b){var a=this._events;if(a){b=a[b];if("function"===typeof b)return 1;if(b)return b.length}return 0}L.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]};function ie(b,a){for(var c=Array(a);a--;)c[a]=b[a];return c}
var me=Ea(function(b,a){var c=x&&x.__extends||function(){function a(b,c){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return a(b,c)}return function(b,c){function d(){this.constructor=b}a(b,c);b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();Object.defineProperty(a,"__esModule",{value:!0});var d=z.constants.S_IFMT,e=z.constants.S_IFDIR,g=z.constants.S_IFREG,f=z.constants.S_IFLNK,
h=z.constants.O_APPEND;a.SEP="/";b=function(a){function b(b,c){void 0===c&&(c=438);var d=a.call(this)||this;d.uid=ge.default.getuid();d.gid=ge.default.getgid();d.atime=new Date;d.mtime=new Date;d.ctime=new Date;d.perm=438;d.mode=g;d.nlink=1;d.perm=c;d.mode|=c;d.ino=b;return d}c(b,a);b.prototype.getString=function(a){void 0===a&&(a="utf8");return this.getBuffer().toString(a)};b.prototype.setString=function(a){this.buf=E.bufferFrom(a,"utf8");this.touch()};b.prototype.getBuffer=function(){this.buf||
this.setBuffer(E.bufferAllocUnsafe(0));return E.bufferFrom(this.buf)};b.prototype.setBuffer=function(a){this.buf=E.bufferFrom(a);this.touch()};b.prototype.getSize=function(){return this.buf?this.buf.length:0};b.prototype.setModeProperty=function(a){this.mode=this.mode&~d|a};b.prototype.setIsFile=function(){this.setModeProperty(g)};b.prototype.setIsDirectory=function(){this.setModeProperty(e)};b.prototype.setIsSymlink=function(){this.setModeProperty(f)};b.prototype.isFile=function(){return(this.mode&
d)===g};b.prototype.isDirectory=function(){return(this.mode&d)===e};b.prototype.isSymlink=function(){return(this.mode&d)===f};b.prototype.makeSymlink=function(a){this.symlink=a;this.setIsSymlink()};b.prototype.write=function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=a.length);void 0===d&&(d=0);this.buf||(this.buf=E.bufferAllocUnsafe(0));if(d+c>this.buf.length){var e=E.bufferAllocUnsafe(d+c);this.buf.copy(e,0,0,this.buf.length);this.buf=e}a.copy(this.buf,d,b,b+c);this.touch();return c};b.prototype.read=
function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=a.byteLength);void 0===d&&(d=0);this.buf||(this.buf=E.bufferAllocUnsafe(0));c>a.byteLength&&(c=a.byteLength);c+d>this.buf.length&&(c=this.buf.length-d);this.buf.copy(a,b,d,d+c);return c};b.prototype.truncate=function(a){void 0===a&&(a=0);if(a)if(this.buf||(this.buf=E.bufferAllocUnsafe(0)),a<=this.buf.length)this.buf=this.buf.slice(0,a);else{var b=E.bufferAllocUnsafe(0);this.buf.copy(b);b.fill(0,a)}else this.buf=E.bufferAllocUnsafe(0);this.touch()};
b.prototype.chmod=function(a){this.perm=a;this.mode=this.mode&-512|a;this.touch()};b.prototype.chown=function(a,b){this.uid=a;this.gid=b;this.touch()};b.prototype.touch=function(){this.mtime=new Date;this.emit("change",this)};b.prototype.canRead=function(a,b){void 0===a&&(a=ge.default.getuid());void 0===b&&(b=ge.default.getgid());return this.perm&4||b===this.gid&&this.perm&32||a===this.uid&&this.perm&256?!0:!1};b.prototype.canWrite=function(a,b){void 0===a&&(a=ge.default.getuid());void 0===b&&(b=
ge.default.getgid());return this.perm&2||b===this.gid&&this.perm&16||a===this.uid&&this.perm&128?!0:!1};b.prototype.del=function(){this.emit("delete",this)};b.prototype.toJSON=function(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}};return b}(L.EventEmitter);a.Node=b;b=function(b){function d(a,c,d){var e=b.call(this)||this;e.children=
{};e.steps=[];e.ino=0;e.length=0;e.vol=a;e.parent=c;e.steps=c?c.steps.concat([d]):[d];return e}c(d,b);d.prototype.setNode=function(a){this.node=a;this.ino=a.ino};d.prototype.getNode=function(){return this.node};d.prototype.createChild=function(a,b){void 0===b&&(b=this.vol.createNode());var c=new d(this.vol,this,a);c.setNode(b);b.isDirectory();this.setChild(a,c);return c};d.prototype.setChild=function(a,b){void 0===b&&(b=new d(this.vol,this,a));this.children[a]=b;b.parent=this;this.length++;this.emit("child:add",
b,this);return b};d.prototype.deleteChild=function(a){delete this.children[a.getName()];this.length--;this.emit("child:delete",a,this)};d.prototype.getChild=function(a){if(Object.hasOwnProperty.call(this.children,a))return this.children[a]};d.prototype.getPath=function(){return this.steps.join(a.SEP)};d.prototype.getName=function(){return this.steps[this.steps.length-1]};d.prototype.walk=function(a,b,c){void 0===b&&(b=a.length);void 0===c&&(c=0);if(c>=a.length||c>=b)return this;var d=this.getChild(a[c]);
return d?d.walk(a,b,c+1):null};d.prototype.toJSON=function(){return{steps:this.steps,ino:this.ino,children:Object.keys(this.children)}};return d}(L.EventEmitter);a.Link=b;b=function(){function a(a,b,c,d){this.position=0;this.link=a;this.node=b;this.flags=c;this.fd=d}a.prototype.getString=function(){return this.node.getString()};a.prototype.setString=function(a){this.node.setString(a)};a.prototype.getBuffer=function(){return this.node.getBuffer()};a.prototype.setBuffer=function(a){this.node.setBuffer(a)};
a.prototype.getSize=function(){return this.node.getSize()};a.prototype.truncate=function(a){this.node.truncate(a)};a.prototype.seekTo=function(a){this.position=a};a.prototype.stats=function(){return Ka.default.build(this.node)};a.prototype.write=function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=a.length);"number"!==typeof d&&(d=this.position);this.flags&h&&(d=this.getSize());a=this.node.write(a,b,c,d);this.position=d+a;return a};a.prototype.read=function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=
a.byteLength);"number"!==typeof d&&(d=this.position);a=this.node.read(a,b,c,d);this.position=d+a;return a};a.prototype.chmod=function(a){this.node.chmod(a)};a.prototype.chown=function(a,b){this.node.chown(a,b)};return a}();a.File=b});Da(me);var pe=me.Node,qe=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});a.default=function(a,b,e){var c=setTimeout.apply(null,arguments);c&&"object"===typeof c&&"function"===typeof c.unref&&c.unref();return c}});Da(qe);
function re(){this.tail=this.head=null;this.length=0}re.prototype.push=function(b){b={data:b,next:null};0<this.length?this.tail.next=b:this.head=b;this.tail=b;++this.length};re.prototype.unshift=function(b){b={data:b,next:this.head};0===this.length&&(this.tail=b);this.head=b;++this.length};re.prototype.shift=function(){if(0!==this.length){var b=this.head.data;this.head=1===this.length?this.tail=null:this.head.next;--this.length;return b}};
re.prototype.clear=function(){this.head=this.tail=null;this.length=0};re.prototype.join=function(b){if(0===this.length)return"";for(var a=this.head,c=""+a.data;a=a.next;)c+=b+a.data;return c};re.prototype.concat=function(b){if(0===this.length)return A.alloc(0);if(1===this.length)return this.head.data;b=A.allocUnsafe(b>>>0);for(var a=this.head,c=0;a;)a.data.copy(b,c),c+=a.data.length,a=a.next;return b};
var se=A.isEncoding||function(b){switch(b&&b.toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "binary":case "base64":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":case "raw":return!0;default:return!1}};
function te(b){this.encoding=(b||"utf8").toLowerCase().replace(/[-_]/,"");if(b&&!se(b))throw Error("Unknown encoding: "+b);switch(this.encoding){case "utf8":this.surrogateSize=3;break;case "ucs2":case "utf16le":this.surrogateSize=2;this.detectIncompleteChar=ue;break;case "base64":this.surrogateSize=3;this.detectIncompleteChar=Ee;break;default:this.write=Fe;return}this.charBuffer=new A(6);this.charLength=this.charReceived=0}
te.prototype.write=function(b){for(var a="";this.charLength;){a=b.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:b.length;b.copy(this.charBuffer,this.charReceived,0,a);this.charReceived+=a;if(this.charReceived<this.charLength)return"";b=b.slice(a,b.length);a=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var c=a.charCodeAt(a.length-1);if(55296<=c&&56319>=c)this.charLength+=this.surrogateSize,a="";else{this.charReceived=this.charLength=0;if(0===b.length)return a;
break}}this.detectIncompleteChar(b);var d=b.length;this.charLength&&(b.copy(this.charBuffer,0,b.length-this.charReceived,d),d-=this.charReceived);a+=b.toString(this.encoding,0,d);d=a.length-1;c=a.charCodeAt(d);return 55296<=c&&56319>=c?(c=this.surrogateSize,this.charLength+=c,this.charReceived+=c,this.charBuffer.copy(this.charBuffer,c,0,c),b.copy(this.charBuffer,0,0,c),a.substring(0,d)):a};
te.prototype.detectIncompleteChar=function(b){for(var a=3<=b.length?3:b.length;0<a;a--){var c=b[b.length-a];if(1==a&&6==c>>5){this.charLength=2;break}if(2>=a&&14==c>>4){this.charLength=3;break}if(3>=a&&30==c>>3){this.charLength=4;break}}this.charReceived=a};te.prototype.end=function(b){var a="";b&&b.length&&(a=this.write(b));this.charReceived&&(b=this.encoding,a+=this.charBuffer.slice(0,this.charReceived).toString(b));return a};function Fe(b){return b.toString(this.encoding)}
function ue(b){this.charLength=(this.charReceived=b.length%2)?2:0}function Ee(b){this.charLength=(this.charReceived=b.length%3)?3:0}N.ReadableState=Ge;var Q=oc("stream");cc(N,L);function He(b,a,c){if("function"===typeof b.prependListener)return b.prependListener(a,c);if(b._events&&b._events[a])Array.isArray(b._events[a])?b._events[a].unshift(c):b._events[a]=[c,b._events[a]];else b.on(a,c)}
function Ge(b,a){b=b||{};this.objectMode=!!b.objectMode;a instanceof Ie&&(this.objectMode=this.objectMode||!!b.readableObjectMode);a=b.highWaterMark;var c=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:c;this.highWaterMark=~~this.highWaterMark;this.buffer=new re;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.reading=this.endEmitted=this.ended=!1;this.sync=!0;this.resumeScheduled=this.readableListening=this.emittedReadable=this.needReadable=!1;this.defaultEncoding=b.defaultEncoding||
"utf8";this.ranOut=!1;this.awaitDrain=0;this.readingMore=!1;this.encoding=this.decoder=null;b.encoding&&(this.decoder=new te(b.encoding),this.encoding=b.encoding)}function N(b){if(!(this instanceof N))return new N(b);this._readableState=new Ge(b,this);this.readable=!0;b&&"function"===typeof b.read&&(this._read=b.read);L.call(this)}
N.prototype.push=function(b,a){var c=this._readableState;c.objectMode||"string"!==typeof b||(a=a||c.defaultEncoding,a!==c.encoding&&(b=A.from(b,a),a=""));return Je(this,c,b,a,!1)};N.prototype.unshift=function(b){return Je(this,this._readableState,b,"",!0)};N.prototype.isPaused=function(){return!1===this._readableState.flowing};
function Je(b,a,c,d,e){var g=c,f=null;nb(g)||"string"===typeof g||null===g||void 0===g||a.objectMode||(f=new TypeError("Invalid non-string/buffer chunk"));if(g=f)b.emit("error",g);else if(null===c)a.reading=!1,a.ended||(a.decoder&&(c=a.decoder.end())&&c.length&&(a.buffer.push(c),a.length+=a.objectMode?1:c.length),a.ended=!0,Ke(b));else if(a.objectMode||c&&0<c.length)if(a.ended&&!e)b.emit("error",Error("stream.push() after EOF"));else if(a.endEmitted&&e)b.emit("error",Error("stream.unshift() after end event"));
else{if(a.decoder&&!e&&!d){c=a.decoder.write(c);var h=!a.objectMode&&0===c.length}e||(a.reading=!1);h||(a.flowing&&0===a.length&&!a.sync?(b.emit("data",c),b.read(0)):(a.length+=a.objectMode?1:c.length,e?a.buffer.unshift(c):a.buffer.push(c),a.needReadable&&Ke(b)));a.readingMore||(a.readingMore=!0,Wb(Le,b,a))}else e||(a.reading=!1);return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}
N.prototype.setEncoding=function(b){this._readableState.decoder=new te(b);this._readableState.encoding=b;return this};function Me(b,a){if(0>=b||0===a.length&&a.ended)return 0;if(a.objectMode)return 1;if(b!==b)return a.flowing&&a.length?a.buffer.head.data.length:a.length;if(b>a.highWaterMark){var c=b;8388608<=c?c=8388608:(c--,c|=c>>>1,c|=c>>>2,c|=c>>>4,c|=c>>>8,c|=c>>>16,c++);a.highWaterMark=c}return b<=a.length?b:a.ended?a.length:(a.needReadable=!0,0)}
N.prototype.read=function(b){Q("read",b);b=parseInt(b,10);var a=this._readableState,c=b;0!==b&&(a.emittedReadable=!1);if(0===b&&a.needReadable&&(a.length>=a.highWaterMark||a.ended))return Q("read: emitReadable",a.length,a.ended),0===a.length&&a.ended?Ne(this):Ke(this),null;b=Me(b,a);if(0===b&&a.ended)return 0===a.length&&Ne(this),null;var d=a.needReadable;Q("need readable",d);if(0===a.length||a.length-b<a.highWaterMark)d=!0,Q("length less than watermark",d);a.ended||a.reading?Q("reading or ended",
!1):d&&(Q("do read"),a.reading=!0,a.sync=!0,0===a.length&&(a.needReadable=!0),this._read(a.highWaterMark),a.sync=!1,a.reading||(b=Me(c,a)));d=0<b?Oe(b,a):null;null===d?(a.needReadable=!0,b=0):a.length-=b;0===a.length&&(a.ended||(a.needReadable=!0),c!==b&&a.ended&&Ne(this));null!==d&&this.emit("data",d);return d};function Ke(b){var a=b._readableState;a.needReadable=!1;a.emittedReadable||(Q("emitReadable",a.flowing),a.emittedReadable=!0,a.sync?Wb(Pe,b):Pe(b))}
function Pe(b){Q("emit readable");b.emit("readable");Qe(b)}function Le(b,a){for(var c=a.length;!a.reading&&!a.flowing&&!a.ended&&a.length<a.highWaterMark&&(Q("maybeReadMore read 0"),b.read(0),c!==a.length);)c=a.length;a.readingMore=!1}N.prototype._read=function(){this.emit("error",Error("not implemented"))};
N.prototype.pipe=function(b,a){function c(a){Q("onunpipe");a===q&&e()}function d(){Q("onend");b.end()}function e(){Q("cleanup");b.removeListener("close",h);b.removeListener("finish",k);b.removeListener("drain",v);b.removeListener("error",f);b.removeListener("unpipe",c);q.removeListener("end",d);q.removeListener("end",e);q.removeListener("data",g);l=!0;!t.awaitDrain||b._writableState&&!b._writableState.needDrain||v()}function g(a){Q("ondata");n=!1;!1!==b.write(a)||n||((1===t.pipesCount&&t.pipes===
b||1<t.pipesCount&&-1!==Re(t.pipes,b))&&!l&&(Q("false write response, pause",q._readableState.awaitDrain),q._readableState.awaitDrain++,n=!0),q.pause())}function f(a){Q("onerror",a);r();b.removeListener("error",f);0===b.listeners("error").length&&b.emit("error",a)}function h(){b.removeListener("finish",k);r()}function k(){Q("onfinish");b.removeListener("close",h);r()}function r(){Q("unpipe");q.unpipe(b)}var q=this,t=this._readableState;switch(t.pipesCount){case 0:t.pipes=b;break;case 1:t.pipes=[t.pipes,
b];break;default:t.pipes.push(b)}t.pipesCount+=1;Q("pipe count=%d opts=%j",t.pipesCount,a);a=a&&!1===a.end?e:d;if(t.endEmitted)Wb(a);else q.once("end",a);b.on("unpipe",c);var v=Se(q);b.on("drain",v);var l=!1,n=!1;q.on("data",g);He(b,"error",f);b.once("close",h);b.once("finish",k);b.emit("pipe",q);t.flowing||(Q("pipe resume"),q.resume());return b};
function Se(b){return function(){var a=b._readableState;Q("pipeOnDrain",a.awaitDrain);a.awaitDrain&&a.awaitDrain--;0===a.awaitDrain&&b.listeners("data").length&&(a.flowing=!0,Qe(b))}}
N.prototype.unpipe=function(b){var a=this._readableState;if(0===a.pipesCount)return this;if(1===a.pipesCount){if(b&&b!==a.pipes)return this;b||(b=a.pipes);a.pipes=null;a.pipesCount=0;a.flowing=!1;b&&b.emit("unpipe",this);return this}if(!b){b=a.pipes;var c=a.pipesCount;a.pipes=null;a.pipesCount=0;a.flowing=!1;for(a=0;a<c;a++)b[a].emit("unpipe",this);return this}c=Re(a.pipes,b);if(-1===c)return this;a.pipes.splice(c,1);--a.pipesCount;1===a.pipesCount&&(a.pipes=a.pipes[0]);b.emit("unpipe",this);return this};
N.prototype.on=function(b,a){a=L.prototype.on.call(this,b,a);"data"===b?!1!==this._readableState.flowing&&this.resume():"readable"===b&&(b=this._readableState,b.endEmitted||b.readableListening||(b.readableListening=b.needReadable=!0,b.emittedReadable=!1,b.reading?b.length&&Ke(this):Wb(Te,this)));return a};N.prototype.addListener=N.prototype.on;function Te(b){Q("readable nexttick read 0");b.read(0)}
N.prototype.resume=function(){var b=this._readableState;b.flowing||(Q("resume"),b.flowing=!0,b.resumeScheduled||(b.resumeScheduled=!0,Wb(Ue,this,b)));return this};function Ue(b,a){a.reading||(Q("resume read 0"),b.read(0));a.resumeScheduled=!1;a.awaitDrain=0;b.emit("resume");Qe(b);a.flowing&&!a.reading&&b.read(0)}N.prototype.pause=function(){Q("call pause flowing=%j",this._readableState.flowing);!1!==this._readableState.flowing&&(Q("pause"),this._readableState.flowing=!1,this.emit("pause"));return this};
function Qe(b){var a=b._readableState;for(Q("flow",a.flowing);a.flowing&&null!==b.read(););}
N.prototype.wrap=function(b){var a=this._readableState,c=!1,d=this;b.on("end",function(){Q("wrapped end");if(a.decoder&&!a.ended){var b=a.decoder.end();b&&b.length&&d.push(b)}d.push(null)});b.on("data",function(e){Q("wrapped data");a.decoder&&(e=a.decoder.write(e));a.objectMode&&(null===e||void 0===e)||!(a.objectMode||e&&e.length)||d.push(e)||(c=!0,b.pause())});for(var e in b)void 0===this[e]&&"function"===typeof b[e]&&(this[e]=function(a){return function(){return b[a].apply(b,arguments)}}(e));Ve(["error",
"close","destroy","pause","resume"],function(a){b.on(a,d.emit.bind(d,a))});d._read=function(a){Q("wrapped _read",a);c&&(c=!1,b.resume())};return d};N._fromList=Oe;
function Oe(b,a){if(0===a.length)return null;if(a.objectMode)var c=a.buffer.shift();else if(!b||b>=a.length)c=a.decoder?a.buffer.join(""):1===a.buffer.length?a.buffer.head.data:a.buffer.concat(a.length),a.buffer.clear();else{c=a.buffer;a=a.decoder;if(b<c.head.data.length)a=c.head.data.slice(0,b),c.head.data=c.head.data.slice(b);else{if(b===c.head.data.length)c=c.shift();else if(a){a=c.head;var d=1,e=a.data;for(b-=e.length;a=a.next;){var g=a.data,f=b>g.length?g.length:b;e=f===g.length?e+g:e+g.slice(0,
b);b-=f;if(0===b){f===g.length?(++d,c.head=a.next?a.next:c.tail=null):(c.head=a,a.data=g.slice(f));break}++d}c.length-=d;c=e}else{a=A.allocUnsafe(b);d=c.head;e=1;d.data.copy(a);for(b-=d.data.length;d=d.next;){g=d.data;f=b>g.length?g.length:b;g.copy(a,a.length-b,0,f);b-=f;if(0===b){f===g.length?(++e,c.head=d.next?d.next:c.tail=null):(c.head=d,d.data=g.slice(f));break}++e}c.length-=e;c=a}a=c}c=a}return c}
function Ne(b){var a=b._readableState;if(0<a.length)throw Error('"endReadable()" called on non-empty stream');a.endEmitted||(a.ended=!0,Wb(We,a,b))}function We(b,a){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}function Ve(b,a){for(var c=0,d=b.length;c<d;c++)a(b[c],c)}function Re(b,a){for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1}Xe.WritableState=Ye;cc(Xe,L);function Ze(){}function $e(b,a,c){this.chunk=b;this.encoding=a;this.callback=c;this.next=null}
function Ye(b,a){Object.defineProperty(this,"buffer",{get:kc(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")});b=b||{};this.objectMode=!!b.objectMode;a instanceof Ie&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var c=b.highWaterMark,d=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:d;this.highWaterMark=~~this.highWaterMark;this.finished=this.ended=this.ending=this.needDrain=!1;this.decodeStrings=!1!==b.decodeStrings;
this.defaultEncoding=b.defaultEncoding||"utf8";this.length=0;this.writing=!1;this.corked=0;this.sync=!0;this.bufferProcessing=!1;this.onwrite=function(b){var c=a._writableState,d=c.sync,e=c.writecb;c.writing=!1;c.writecb=null;c.length-=c.writelen;c.writelen=0;b?(--c.pendingcb,d?Wb(e,b):e(b),a._writableState.errorEmitted=!0,a.emit("error",b)):((b=af(c))||c.corked||c.bufferProcessing||!c.bufferedRequest||bf(a,c),d?Wb(cf,a,c,b,e):cf(a,c,b,e))};this.writecb=null;this.writelen=0;this.lastBufferedRequest=
this.bufferedRequest=null;this.pendingcb=0;this.errorEmitted=this.prefinished=!1;this.bufferedRequestCount=0;this.corkedRequestsFree=new df(this)}Ye.prototype.getBuffer=function(){for(var b=this.bufferedRequest,a=[];b;)a.push(b),b=b.next;return a};function Xe(b){if(!(this instanceof Xe||this instanceof Ie))return new Xe(b);this._writableState=new Ye(b,this);this.writable=!0;b&&("function"===typeof b.write&&(this._write=b.write),"function"===typeof b.writev&&(this._writev=b.writev));L.call(this)}
Xe.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};
Xe.prototype.write=function(b,a,c){var d=this._writableState,e=!1;"function"===typeof a&&(c=a,a=null);A.isBuffer(b)?a="buffer":a||(a=d.defaultEncoding);"function"!==typeof c&&(c=Ze);if(d.ended)d=c,b=Error("write after end"),this.emit("error",b),Wb(d,b);else{var g=c,f=!0,h=!1;null===b?h=new TypeError("May not write null values to stream"):A.isBuffer(b)||"string"===typeof b||void 0===b||d.objectMode||(h=new TypeError("Invalid non-string/buffer chunk"));h&&(this.emit("error",h),Wb(g,h),f=!1);f&&(d.pendingcb++,
e=a,d.objectMode||!1===d.decodeStrings||"string"!==typeof b||(b=A.from(b,e)),A.isBuffer(b)&&(e="buffer"),g=d.objectMode?1:b.length,d.length+=g,a=d.length<d.highWaterMark,a||(d.needDrain=!0),d.writing||d.corked?(g=d.lastBufferedRequest,d.lastBufferedRequest=new $e(b,e,c),g?g.next=d.lastBufferedRequest:d.bufferedRequest=d.lastBufferedRequest,d.bufferedRequestCount+=1):ef(this,d,!1,g,b,e,c),e=a)}return e};Xe.prototype.cork=function(){this._writableState.corked++};
Xe.prototype.uncork=function(){var b=this._writableState;b.corked&&(b.corked--,b.writing||b.corked||b.finished||b.bufferProcessing||!b.bufferedRequest||bf(this,b))};Xe.prototype.setDefaultEncoding=function(b){"string"===typeof b&&(b=b.toLowerCase());if(!(-1<"hex utf8 utf-8 ascii binary base64 ucs2 ucs-2 utf16le utf-16le raw".split(" ").indexOf((b+"").toLowerCase())))throw new TypeError("Unknown encoding: "+b);this._writableState.defaultEncoding=b;return this};
function ef(b,a,c,d,e,g,f){a.writelen=d;a.writecb=f;a.writing=!0;a.sync=!0;c?b._writev(e,a.onwrite):b._write(e,g,a.onwrite);a.sync=!1}function cf(b,a,c,d){!c&&0===a.length&&a.needDrain&&(a.needDrain=!1,b.emit("drain"));a.pendingcb--;d();ff(b,a)}
function bf(b,a){a.bufferProcessing=!0;var c=a.bufferedRequest;if(b._writev&&c&&c.next){var d=Array(a.bufferedRequestCount),e=a.corkedRequestsFree;e.entry=c;for(var g=0;c;)d[g]=c,c=c.next,g+=1;ef(b,a,!0,a.length,d,"",e.finish);a.pendingcb++;a.lastBufferedRequest=null;e.next?(a.corkedRequestsFree=e.next,e.next=null):a.corkedRequestsFree=new df(a)}else{for(;c&&(d=c.chunk,ef(b,a,!1,a.objectMode?1:d.length,d,c.encoding,c.callback),c=c.next,!a.writing););null===c&&(a.lastBufferedRequest=null)}a.bufferedRequestCount=
0;a.bufferedRequest=c;a.bufferProcessing=!1}Xe.prototype._write=function(b,a,c){c(Error("not implemented"))};Xe.prototype._writev=null;Xe.prototype.end=function(b,a,c){var d=this._writableState;"function"===typeof b?(c=b,a=b=null):"function"===typeof a&&(c=a,a=null);null!==b&&void 0!==b&&this.write(b,a);d.corked&&(d.corked=1,this.uncork());if(!d.ending&&!d.finished){b=c;d.ending=!0;ff(this,d);if(b)if(d.finished)Wb(b);else this.once("finish",b);d.ended=!0;this.writable=!1}};
function af(b){return b.ending&&0===b.length&&null===b.bufferedRequest&&!b.finished&&!b.writing}function ff(b,a){var c=af(a);c&&(0===a.pendingcb?(a.prefinished||(a.prefinished=!0,b.emit("prefinish")),a.finished=!0,b.emit("finish")):a.prefinished||(a.prefinished=!0,b.emit("prefinish")));return c}
function df(b){var a=this;this.entry=this.next=null;this.finish=function(c){var d=a.entry;for(a.entry=null;d;){var e=d.callback;b.pendingcb--;e(c);d=d.next}b.corkedRequestsFree?b.corkedRequestsFree.next=a:b.corkedRequestsFree=a}}cc(Ie,N);for(var gf=Object.keys(Xe.prototype),hf=0;hf<gf.length;hf++){var jf=gf[hf];Ie.prototype[jf]||(Ie.prototype[jf]=Xe.prototype[jf])}
function Ie(b){if(!(this instanceof Ie))return new Ie(b);N.call(this,b);Xe.call(this,b);b&&!1===b.readable&&(this.readable=!1);b&&!1===b.writable&&(this.writable=!1);this.allowHalfOpen=!0;b&&!1===b.allowHalfOpen&&(this.allowHalfOpen=!1);this.once("end",kf)}function kf(){this.allowHalfOpen||this._writableState.ended||Wb(lf,this)}function lf(b){b.end()}cc(mf,Ie);
function nf(b){this.afterTransform=function(a,c){var d=b._transformState;d.transforming=!1;var e=d.writecb;e?(d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&b.push(c),e(a),a=b._readableState,a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&b._read(a.highWaterMark),a=void 0):a=b.emit("error",Error("no writecb in Transform class"));return a};this.transforming=this.needTransform=!1;this.writeencoding=this.writechunk=this.writecb=null}
function mf(b){if(!(this instanceof mf))return new mf(b);Ie.call(this,b);this._transformState=new nf(this);var a=this;this._readableState.needReadable=!0;this._readableState.sync=!1;b&&("function"===typeof b.transform&&(this._transform=b.transform),"function"===typeof b.flush&&(this._flush=b.flush));this.once("prefinish",function(){"function"===typeof this._flush?this._flush(function(b){of(a,b)}):of(a)})}
mf.prototype.push=function(b,a){this._transformState.needTransform=!1;return Ie.prototype.push.call(this,b,a)};mf.prototype._transform=function(){throw Error("Not implemented");};mf.prototype._write=function(b,a,c){var d=this._transformState;d.writecb=c;d.writechunk=b;d.writeencoding=a;d.transforming||(b=this._readableState,(d.needTransform||b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark))};
mf.prototype._read=function(){var b=this._transformState;null!==b.writechunk&&b.writecb&&!b.transforming?(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform)):b.needTransform=!0};function of(b,a){if(a)return b.emit("error",a);a=b._transformState;if(b._writableState.length)throw Error("Calling transform done when ws.length != 0");if(a.transforming)throw Error("Calling transform done when still transforming");return b.push(null)}cc(pf,mf);
function pf(b){if(!(this instanceof pf))return new pf(b);mf.call(this,b)}pf.prototype._transform=function(b,a,c){c(null,b)};cc(qf,L);qf.Readable=N;qf.Writable=Xe;qf.Duplex=Ie;qf.Transform=mf;qf.PassThrough=pf;qf.Stream=qf;function qf(){L.call(this)}
qf.prototype.pipe=function(b,a){function c(a){b.writable&&!1===b.write(a)&&k.pause&&k.pause()}function d(){k.readable&&k.resume&&k.resume()}function e(){r||(r=!0,b.end())}function g(){r||(r=!0,"function"===typeof b.destroy&&b.destroy())}function f(a){h();if(0===L.listenerCount(this,"error"))throw a;}function h(){k.removeListener("data",c);b.removeListener("drain",d);k.removeListener("end",e);k.removeListener("close",g);k.removeListener("error",f);b.removeListener("error",f);k.removeListener("end",
h);k.removeListener("close",h);b.removeListener("close",h)}var k=this;k.on("data",c);b.on("drain",d);b._isStdio||a&&!1===a.end||(k.on("end",e),k.on("close",g));var r=!1;k.on("error",f);b.on("error",f);k.on("end",h);k.on("close",h);b.on("close",h);b.emit("pipe",k);return b};
var rf=Array.prototype.slice,tf={extend:function sf(b,a){for(var d in a)b[d]=a[d];return 3>arguments.length?b:sf.apply(null,[b].concat(rf.call(arguments,2)))}},uf=Ea(function(b,a){function c(a,b,c){void 0===c&&(c=function(a){return a});return function(){for(var e=[],f=0;f<arguments.length;f++)e[f]=arguments[f];return new Promise(function(f,g){a[b].bind(a).apply(void 0,d(e,[function(a,b){return a?g(a):f(c(b))}]))})}}var d=x&&x.__spreadArrays||function(){for(var a=0,b=0,c=arguments.length;b<c;b++)a+=
arguments[b].length;a=Array(a);var d=0;for(b=0;b<c;b++)for(var e=arguments[b],q=0,t=e.length;q<t;q++,d++)a[d]=e[q];return a};Object.defineProperty(a,"__esModule",{value:!0});var e=function(){function a(a,b){this.vol=a;this.fd=b}a.prototype.appendFile=function(a,b){return c(this.vol,"appendFile")(this.fd,a,b)};a.prototype.chmod=function(a){return c(this.vol,"fchmod")(this.fd,a)};a.prototype.chown=function(a,b){return c(this.vol,"fchown")(this.fd,a,b)};a.prototype.close=function(){return c(this.vol,
"close")(this.fd)};a.prototype.datasync=function(){return c(this.vol,"fdatasync")(this.fd)};a.prototype.read=function(a,b,d,e){return c(this.vol,"read",function(b){return{bytesRead:b,buffer:a}})(this.fd,a,b,d,e)};a.prototype.readFile=function(a){return c(this.vol,"readFile")(this.fd,a)};a.prototype.stat=function(a){return c(this.vol,"fstat")(this.fd,a)};a.prototype.sync=function(){return c(this.vol,"fsync")(this.fd)};a.prototype.truncate=function(a){return c(this.vol,"ftruncate")(this.fd,a)};a.prototype.utimes=
function(a,b){return c(this.vol,"futimes")(this.fd,a,b)};a.prototype.write=function(a,b,d,e){return c(this.vol,"write",function(b){return{bytesWritten:b,buffer:a}})(this.fd,a,b,d,e)};a.prototype.writeFile=function(a,b){return c(this.vol,"writeFile")(this.fd,a,b)};return a}();a.FileHandle=e;a.default=function(a){return"undefined"===typeof Promise?null:{FileHandle:e,access:function(b,d){return c(a,"access")(b,d)},appendFile:function(b,d,g){return c(a,"appendFile")(b instanceof e?b.fd:b,d,g)},chmod:function(b,
d){return c(a,"chmod")(b,d)},chown:function(b,d,e){return c(a,"chown")(b,d,e)},copyFile:function(b,d,e){return c(a,"copyFile")(b,d,e)},lchmod:function(b,d){return c(a,"lchmod")(b,d)},lchown:function(b,d,e){return c(a,"lchown")(b,d,e)},link:function(b,d){return c(a,"link")(b,d)},lstat:function(b,d){return c(a,"lstat")(b,d)},mkdir:function(b,d){return c(a,"mkdir")(b,d)},mkdtemp:function(b,d){return c(a,"mkdtemp")(b,d)},open:function(b,d,g){return c(a,"open",function(b){return new e(a,b)})(b,d,g)},readdir:function(b,
d){return c(a,"readdir")(b,d)},readFile:function(b,d){return c(a,"readFile")(b instanceof e?b.fd:b,d)},readlink:function(b,d){return c(a,"readlink")(b,d)},realpath:function(b,d){return c(a,"realpath")(b,d)},rename:function(b,d){return c(a,"rename")(b,d)},rmdir:function(b){return c(a,"rmdir")(b)},stat:function(b,d){return c(a,"stat")(b,d)},symlink:function(b,d,e){return c(a,"symlink")(b,d,e)},truncate:function(b,d){return c(a,"truncate")(b,d)},unlink:function(b){return c(a,"unlink")(b)},utimes:function(b,
d,e){return c(a,"utimes")(b,d,e)},writeFile:function(b,d,g){return c(a,"writeFile")(b instanceof e?b.fd:b,d,g)}}}});Da(uf);var vf=/[^\x20-\x7E]/,wf=/[\x2E\u3002\uFF0E\uFF61]/g,xf={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},yf=Math.floor,zf=String.fromCharCode;
function Af(b,a){var c=b.split("@"),d="";1<c.length&&(d=c[0]+"@",b=c[1]);b=b.replace(wf,".");b=b.split(".");c=b.length;for(var e=[];c--;)e[c]=a(b[c]);a=e.join(".");return d+a}function Bf(b,a){return b+22+75*(26>b)-((0!=a)<<5)}
function Cf(b){return Af(b,function(a){if(vf.test(a)){var b,d=[],e=[],g=0;for(b=a.length;g<b;){var f=a.charCodeAt(g++);if(55296<=f&&56319>=f&&g<b){var h=a.charCodeAt(g++);56320==(h&64512)?e.push(((f&1023)<<10)+(h&1023)+65536):(e.push(f),g--)}else e.push(f)}a=e;h=a.length;e=128;var k=0,r=72;for(f=0;f<h;++f){var q=a[f];128>q&&d.push(zf(q))}for((g=b=d.length)&&d.push("-");g<h;){var t=2147483647;for(f=0;f<h;++f)q=a[f],q>=e&&q<t&&(t=q);var v=g+1;if(t-e>yf((2147483647-k)/v))throw new RangeError(xf.overflow);
k+=(t-e)*v;e=t;for(f=0;f<h;++f){q=a[f];if(q<e&&2147483647<++k)throw new RangeError(xf.overflow);if(q==e){var l=k;for(t=36;;t+=36){q=t<=r?1:t>=r+26?26:t-r;if(l<q)break;var n=l-q;l=36-q;d.push(zf(Bf(q+n%l,0)));l=yf(n/l)}d.push(zf(Bf(l,0)));r=v;t=0;k=g==b?yf(k/700):k>>1;for(k+=yf(k/r);455<k;t+=36)k=yf(k/35);r=yf(t+36*k/(k+38));k=0;++g}}++k;++e}d="xn--"+d.join("")}else d=a;return d})}var Df=Array.isArray||function(b){return"[object Array]"===Object.prototype.toString.call(b)};
function Ef(b){switch(typeof b){case "string":return b;case "boolean":return b?"true":"false";case "number":return isFinite(b)?b:"";default:return""}}function Ff(b,a,c,d){a=a||"&";c=c||"=";null===b&&(b=void 0);return"object"===typeof b?Gf(Hf(b),function(d){var e=encodeURIComponent(Ef(d))+c;return Df(b[d])?Gf(b[d],function(a){return e+encodeURIComponent(Ef(a))}).join(a):e+encodeURIComponent(Ef(b[d]))}).join(a):d?encodeURIComponent(Ef(d))+c+encodeURIComponent(Ef(b)):""}
function Gf(b,a){if(b.map)return b.map(a);for(var c=[],d=0;d<b.length;d++)c.push(a(b[d],d));return c}var Hf=Object.keys||function(b){var a=[],c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&a.push(c);return a};
function If(b,a,c,d){c=c||"=";var e={};if("string"!==typeof b||0===b.length)return e;var g=/\+/g;b=b.split(a||"&");a=1E3;d&&"number"===typeof d.maxKeys&&(a=d.maxKeys);d=b.length;0<a&&d>a&&(d=a);for(a=0;a<d;++a){var f=b[a].replace(g,"%20"),h=f.indexOf(c);if(0<=h){var k=f.substr(0,h);f=f.substr(h+1)}else k=f,f="";k=decodeURIComponent(k);f=decodeURIComponent(f);Object.prototype.hasOwnProperty.call(e,k)?Df(e[k])?e[k].push(f):e[k]=[e[k],f]:e[k]=f}return e}
var Of={parse:Jf,resolve:Kf,resolveObject:Lf,format:Mf,Url:Nf};function Nf(){this.href=this.path=this.pathname=this.query=this.search=this.hash=this.hostname=this.port=this.host=this.auth=this.slashes=this.protocol=null}
var Pf=/^([a-z0-9.+-]+:)/i,Qf=/:[0-9]*$/,Rf=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Sf="{}|\\^`".split("").concat('<>"` \r\n\t'.split("")),Tf=["'"].concat(Sf),Uf=["%","/","?",";","#"].concat(Tf),Vf=["/","?","#"],Wf=255,Xf=/^[+a-z0-9A-Z_-]{0,63}$/,Yf=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Zf={javascript:!0,"javascript:":!0},$f={javascript:!0,"javascript:":!0},ag={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};
function Jf(b,a,c){if(b&&jc(b)&&b instanceof Nf)return b;var d=new Nf;d.parse(b,a,c);return d}Nf.prototype.parse=function(b,a,c){return bg(this,b,a,c)};
function bg(b,a,c,d){if(!hc(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var e=a.indexOf("?");e=-1!==e&&e<a.indexOf("#")?"?":"#";a=a.split(e);a[0]=a[0].replace(/\\/g,"/");a=a.join(e);e=a.trim();if(!d&&1===a.split("#").length&&(a=Rf.exec(e)))return b.path=e,b.href=e,b.pathname=a[1],a[2]?(b.search=a[2],b.query=c?If(b.search.substr(1)):b.search.substr(1)):c&&(b.search="",b.query={}),b;if(a=Pf.exec(e)){a=a[0];var g=a.toLowerCase();b.protocol=g;e=e.substr(a.length)}if(d||a||
e.match(/^\/\/[^@\/]+@[^@\/]+/)){var f="//"===e.substr(0,2);!f||a&&$f[a]||(e=e.substr(2),b.slashes=!0)}if(!$f[a]&&(f||a&&!ag[a])){a=-1;for(d=0;d<Vf.length;d++)f=e.indexOf(Vf[d]),-1!==f&&(-1===a||f<a)&&(a=f);f=-1===a?e.lastIndexOf("@"):e.lastIndexOf("@",a);-1!==f&&(d=e.slice(0,f),e=e.slice(f+1),b.auth=decodeURIComponent(d));a=-1;for(d=0;d<Uf.length;d++)f=e.indexOf(Uf[d]),-1!==f&&(-1===a||f<a)&&(a=f);-1===a&&(a=e.length);b.host=e.slice(0,a);e=e.slice(a);cg(b);b.hostname=b.hostname||"";f="["===b.hostname[0]&&
"]"===b.hostname[b.hostname.length-1];if(!f){var h=b.hostname.split(/\./);d=0;for(a=h.length;d<a;d++){var k=h[d];if(k&&!k.match(Xf)){for(var r="",q=0,t=k.length;q<t;q++)r=127<k.charCodeAt(q)?r+"x":r+k[q];if(!r.match(Xf)){a=h.slice(0,d);d=h.slice(d+1);if(k=k.match(Yf))a.push(k[1]),d.unshift(k[2]);d.length&&(e="/"+d.join(".")+e);b.hostname=a.join(".");break}}}}b.hostname=b.hostname.length>Wf?"":b.hostname.toLowerCase();f||(b.hostname=Cf(b.hostname));d=b.port?":"+b.port:"";b.host=(b.hostname||"")+d;
b.href+=b.host;f&&(b.hostname=b.hostname.substr(1,b.hostname.length-2),"/"!==e[0]&&(e="/"+e))}if(!Zf[g])for(d=0,a=Tf.length;d<a;d++)f=Tf[d],-1!==e.indexOf(f)&&(k=encodeURIComponent(f),k===f&&(k=escape(f)),e=e.split(f).join(k));d=e.indexOf("#");-1!==d&&(b.hash=e.substr(d),e=e.slice(0,d));d=e.indexOf("?");-1!==d?(b.search=e.substr(d),b.query=e.substr(d+1),c&&(b.query=If(b.query)),e=e.slice(0,d)):c&&(b.search="",b.query={});e&&(b.pathname=e);ag[g]&&b.hostname&&!b.pathname&&(b.pathname="/");if(b.pathname||
b.search)d=b.pathname||"",b.path=d+(b.search||"");b.href=dg(b);return b}function Mf(b){hc(b)&&(b=bg({},b));return dg(b)}
function dg(b){var a=b.auth||"";a&&(a=encodeURIComponent(a),a=a.replace(/%3A/i,":"),a+="@");var c=b.protocol||"",d=b.pathname||"",e=b.hash||"",g=!1,f="";b.host?g=a+b.host:b.hostname&&(g=a+(-1===b.hostname.indexOf(":")?b.hostname:"["+this.hostname+"]"),b.port&&(g+=":"+b.port));b.query&&jc(b.query)&&Object.keys(b.query).length&&(f=Ff(b.query));a=b.search||f&&"?"+f||"";c&&":"!==c.substr(-1)&&(c+=":");b.slashes||(!c||ag[c])&&!1!==g?(g="//"+(g||""),d&&"/"!==d.charAt(0)&&(d="/"+d)):g||(g="");e&&"#"!==e.charAt(0)&&
(e="#"+e);a&&"?"!==a.charAt(0)&&(a="?"+a);d=d.replace(/[?#]/g,function(a){return encodeURIComponent(a)});a=a.replace("#","%23");return c+g+d+a+e}Nf.prototype.format=function(){return dg(this)};function Kf(b,a){return Jf(b,!1,!0).resolve(a)}Nf.prototype.resolve=function(b){return this.resolveObject(Jf(b,!1,!0)).format()};function Lf(b,a){return b?Jf(b,!1,!0).resolveObject(a):a}
Nf.prototype.resolveObject=function(b){if(hc(b)){var a=new Nf;a.parse(b,!1,!0);b=a}a=new Nf;for(var c=Object.keys(this),d=0;d<c.length;d++){var e=c[d];a[e]=this[e]}a.hash=b.hash;if(""===b.href)return a.href=a.format(),a;if(b.slashes&&!b.protocol){c=Object.keys(b);for(d=0;d<c.length;d++)e=c[d],"protocol"!==e&&(a[e]=b[e]);ag[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/");a.href=a.format();return a}var g;if(b.protocol&&b.protocol!==a.protocol){if(!ag[b.protocol]){c=Object.keys(b);for(d=
0;d<c.length;d++)e=c[d],a[e]=b[e];a.href=a.format();return a}a.protocol=b.protocol;if(b.host||$f[b.protocol])a.pathname=b.pathname;else{for(g=(b.pathname||"").split("/");g.length&&!(b.host=g.shift()););b.host||(b.host="");b.hostname||(b.hostname="");""!==g[0]&&g.unshift("");2>g.length&&g.unshift("");a.pathname=g.join("/")}a.search=b.search;a.query=b.query;a.host=b.host||"";a.auth=b.auth;a.hostname=b.hostname||b.host;a.port=b.port;if(a.pathname||a.search)a.path=(a.pathname||"")+(a.search||"");a.slashes=
a.slashes||b.slashes;a.href=a.format();return a}c=a.pathname&&"/"===a.pathname.charAt(0);var f=b.host||b.pathname&&"/"===b.pathname.charAt(0),h=c=f||c||a.host&&b.pathname;d=a.pathname&&a.pathname.split("/")||[];e=a.protocol&&!ag[a.protocol];g=b.pathname&&b.pathname.split("/")||[];e&&(a.hostname="",a.port=null,a.host&&(""===d[0]?d[0]=a.host:d.unshift(a.host)),a.host="",b.protocol&&(b.hostname=null,b.port=null,b.host&&(""===g[0]?g[0]=b.host:g.unshift(b.host)),b.host=null),c=c&&(""===g[0]||""===d[0]));
if(f)a.host=b.host||""===b.host?b.host:a.host,a.hostname=b.hostname||""===b.hostname?b.hostname:a.hostname,a.search=b.search,a.query=b.query,d=g;else if(g.length)d||(d=[]),d.pop(),d=d.concat(g),a.search=b.search,a.query=b.query;else if(null!=b.search){e&&(a.hostname=a.host=d.shift(),e=a.host&&0<a.host.indexOf("@")?a.host.split("@"):!1)&&(a.auth=e.shift(),a.host=a.hostname=e.shift());a.search=b.search;a.query=b.query;if(null!==a.pathname||null!==a.search)a.path=(a.pathname?a.pathname:"")+(a.search?
a.search:"");a.href=a.format();return a}if(!d.length)return a.pathname=null,a.path=a.search?"/"+a.search:null,a.href=a.format(),a;f=d.slice(-1)[0];g=(a.host||b.host||1<d.length)&&("."===f||".."===f)||""===f;for(var k=0,r=d.length;0<=r;r--)f=d[r],"."===f?d.splice(r,1):".."===f?(d.splice(r,1),k++):k&&(d.splice(r,1),k--);if(!c&&!h)for(;k--;k)d.unshift("..");!c||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift("");g&&"/"!==d.join("/").substr(-1)&&d.push("");h=""===d[0]||d[0]&&"/"===d[0].charAt(0);e&&
(a.hostname=a.host=h?"":d.length?d.shift():"",e=a.host&&0<a.host.indexOf("@")?a.host.split("@"):!1)&&(a.auth=e.shift(),a.host=a.hostname=e.shift());(c||a.host&&d.length)&&!h&&d.unshift("");d.length?a.pathname=d.join("/"):(a.pathname=null,a.path=null);if(null!==a.pathname||null!==a.search)a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"");a.auth=b.auth||a.auth;a.slashes=a.slashes||b.slashes;a.href=a.format();return a};Nf.prototype.parseHost=function(){return cg(this)};
function cg(b){var a=b.host,c=Qf.exec(a);c&&(c=c[0],":"!==c&&(b.port=c.substr(1)),a=a.substr(0,a.length-c.length));a&&(b.hostname=a)}
var eg=Ea(function(b,a){function c(a,b){a=a[b];return 0<b&&("/"===a||e&&"\\"===a)}function d(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:!0;if(e){var d=a;if("string"!==typeof d)throw new TypeError("expected a string");d=d.replace(/[\\\/]+/g,"/");if(!1!==b)if(b=d,d=b.length-1,2>d)d=b;else{for(;c(b,d);)d--;d=b.substr(0,d+1)}return d.replace(/^([a-zA-Z]+:|\.\/)/,"")}return a}Object.defineProperty(a,"__esModule",{value:!0});a.unixify=d;a.correctPath=function(a){return d(a.replace(/^\\\\\?\\.:\\/,
"\\"))};var e="win32"===bc.platform});Da(eg);
var fg=Ea(function(b,a){function c(a,b){void 0===b&&(b=ge.default.cwd());return Fa(b,a)}function d(a,b){return"function"===typeof a?[e(),a]:[e(a),t(b)]}function e(a){void 0===a&&(a={});return ja({},Sb,a)}function g(a){return"number"===typeof a?ja({},Qc,{mode:a}):ja({},Qc,a)}function f(a,b,c,d){void 0===b&&(b="");void 0===c&&(c="");void 0===d&&(d="");var e="";c&&(e=" '"+c+"'");d&&(e+=" -> '"+d+"'");switch(a){case "ENOENT":return"ENOENT: no such file or directory, "+b+e;case "EBADF":return"EBADF: bad file descriptor, "+
b+e;case "EINVAL":return"EINVAL: invalid argument, "+b+e;case "EPERM":return"EPERM: operation not permitted, "+b+e;case "EPROTO":return"EPROTO: protocol error, "+b+e;case "EEXIST":return"EEXIST: file already exists, "+b+e;case "ENOTDIR":return"ENOTDIR: not a directory, "+b+e;case "EISDIR":return"EISDIR: illegal operation on a directory, "+b+e;case "EACCES":return"EACCES: permission denied, "+b+e;case "ENOTEMPTY":return"ENOTEMPTY: directory not empty, "+b+e;case "EMFILE":return"EMFILE: too many open files, "+
b+e;case "ENOSYS":return"ENOSYS: function not implemented, "+b+e;default:return a+": error occurred, "+b+e}}function h(a,b,c,d,e){void 0===b&&(b="");void 0===c&&(c="");void 0===d&&(d="");void 0===e&&(e=Error);b=new e(f(a,b,c,d));b.code=a;return b}function k(a){if("number"===typeof a)return a;if("string"===typeof a){var b=Ia[a];if("undefined"!==typeof b)return b}throw new Ud.TypeError("ERR_INVALID_OPT_VALUE","flags",a);}function r(a,b){if(b){var c=typeof b;switch(c){case "string":a=ja({},a,{encoding:b});
break;case "object":a=ja({},a,b);break;default:throw TypeError("Expected options to be either an object or a string, but got "+c+" instead");}}else return a;"buffer"!==a.encoding&&Vd.assertEncoding(a.encoding);return a}function q(a){return function(b){return r(a,b)}}function t(a){if("function"!==typeof a)throw TypeError(za.CB);return a}function v(a){return function(b,c){return"function"===typeof b?[a(),b]:[a(b),t(c)]}}function l(a){if("string"!==typeof a&&!E.Buffer.isBuffer(a)){try{if(!(a instanceof
Of.URL))throw new TypeError(za.PATH_STR);}catch(hb){throw new TypeError(za.PATH_STR);}if(""!==a.hostname)throw new Ud.TypeError("ERR_INVALID_FILE_URL_HOST",ge.default.platform);a=a.pathname;for(var b=0;b<a.length;b++)if("%"===a[b]){var c=a.codePointAt(b+2)|32;if("2"===a[b+1]&&102===c)throw new Ud.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters");}a=decodeURIComponent(a)}a=String(a);X(a);return a}function n(a,b){return(a=c(a,b).substr(1))?a.split(ia):[]}function y(a){return n(l(a))}
function B(a,b){void 0===b&&(b=Vd.ENCODING_UTF8);return E.Buffer.isBuffer(a)?a:a instanceof Uint8Array?E.bufferFrom(a):E.bufferFrom(String(a),b)}function O(a,b){return b&&"buffer"!==b?a.toString(b):a}function X(a,b){if(-1!==(""+a).indexOf("\x00")){a=Error("Path must be a string without null bytes");a.code="ENOENT";if("function"!==typeof b)throw a;ge.default.nextTick(b,a);return!1}return!0}function M(a,b){a="number"===typeof a?a:"string"===typeof a?parseInt(a,8):b?M(b):void 0;if("number"!==typeof a||
isNaN(a))throw new TypeError(za.MODE_INT);return a}function ha(a){if(a>>>0!==a)throw TypeError(za.FD);}function R(a){if("string"===typeof a&&+a==a)return+a;if(a instanceof Date)return a.getTime()/1E3;if(isFinite(a))return 0>a?Date.now()/1E3:a;throw Error("Cannot parse time: "+a);}function C(a){if("number"!==typeof a)throw TypeError(za.UID);}function H(a){if("number"!==typeof a)throw TypeError(za.GID);}function qa(a){a.emit("stop")}function V(a,b,c){if(!(this instanceof V))return new V(a,b,c);this._vol=
a;c=ja({},r(c,{}));void 0===c.highWaterMark&&(c.highWaterMark=65536);qf.Readable.call(this,c);this.path=l(b);this.fd=void 0===c.fd?null:c.fd;this.flags=void 0===c.flags?"r":c.flags;this.mode=void 0===c.mode?438:c.mode;this.start=c.start;this.end=c.end;this.autoClose=void 0===c.autoClose?!0:c.autoClose;this.pos=void 0;this.bytesRead=0;if(void 0!==this.start){if("number"!==typeof this.start)throw new TypeError('"start" option must be a Number');if(void 0===this.end)this.end=Infinity;else if("number"!==
typeof this.end)throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw Error('"start" option must be <= "end" option');this.pos=this.start}"number"!==typeof this.fd&&this.open();this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}function ra(){this.close()}function I(a,b,c){if(!(this instanceof I))return new I(a,b,c);this._vol=a;c=ja({},r(c,{}));qf.Writable.call(this,c);this.path=l(b);this.fd=void 0===c.fd?null:c.fd;this.flags=void 0===c.flags?"w":c.flags;
this.mode=void 0===c.mode?438:c.mode;this.start=c.start;this.autoClose=void 0===c.autoClose?!0:!!c.autoClose;this.pos=void 0;this.bytesWritten=0;if(void 0!==this.start){if("number"!==typeof this.start)throw new TypeError('"start" option must be a Number');if(0>this.start)throw Error('"start" must be >= zero');this.pos=this.start}c.encoding&&this.setDefaultEncoding(c.encoding);"number"!==typeof this.fd&&this.open();this.once("finish",function(){this.autoClose&&this.close()})}var sa=x&&x.__extends||
function(){function a(b,c){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return a(b,c)}return function(b,c){function d(){this.constructor=b}a(b,c);b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),ta=x&&x.__spreadArrays||function(){for(var a=0,b=0,c=arguments.length;b<c;b++)a+=arguments[b].length;a=Array(a);var d=0;for(b=0;b<c;b++)for(var e=arguments[b],f=0,g=e.length;f<
g;f++,d++)a[d]=e[f];return a};Object.defineProperty(a,"__esModule",{value:!0});var ja=tf.extend,Fa=ee.resolve,Sa=z.constants.O_RDONLY,xa=z.constants.O_WRONLY,ma=z.constants.O_RDWR,P=z.constants.O_CREAT,ya=z.constants.O_EXCL,ua=z.constants.O_TRUNC,J=z.constants.O_APPEND,G=z.constants.O_SYNC,da=z.constants.O_DIRECTORY,Hb=z.constants.F_OK,Ed=z.constants.COPYFILE_EXCL,Fd=z.constants.COPYFILE_FICLONE_FORCE,ia=ee.sep,qb=ee.relative,p="win32"===ge.default.platform,za={PATH_STR:"path must be a string or Buffer",
FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"},Ia;(function(a){a[a.r=Sa]="r";a[a["r+"]=
ma]="r+";a[a.rs=Sa|G]="rs";a[a.sr=a.rs]="sr";a[a["rs+"]=ma|G]="rs+";a[a["sr+"]=a["rs+"]]="sr+";a[a.w=xa|P|ua]="w";a[a.wx=xa|P|ua|ya]="wx";a[a.xw=a.wx]="xw";a[a["w+"]=ma|P|ua]="w+";a[a["wx+"]=ma|P|ua|ya]="wx+";a[a["xw+"]=a["wx+"]]="xw+";a[a.a=xa|J|P]="a";a[a.ax=xa|J|P|ya]="ax";a[a.xa=a.ax]="xa";a[a["a+"]=ma|J|P]="a+";a[a["ax+"]=ma|J|P|ya]="ax+";a[a["xa+"]=a["ax+"]]="xa+"})(Ia=a.FLAGS||(a.FLAGS={}));a.flagsToNumber=k;b={encoding:"utf8"};var u=q(b),Dc=v(u),Ga=q({flag:"r"}),dc={encoding:"utf8",mode:438,
flag:Ia[Ia.w]},Bc=q(dc),ec={encoding:"utf8",mode:438,flag:Ia[Ia.a]},Ac=q(ec),Gd=v(Ac),Cc=q(b),Hd=v(Cc),Qc={mode:511,recursive:!1},qc={recursive:!1},rc=q({encoding:"utf8",withFileTypes:!1}),ne=v(rc),Sb={bigint:!1};a.pathToFilename=l;if(p){var Rc=c,Ub=eg.unixify;c=function(a,b){return Ub(Rc(a,b))}}a.filenameToSteps=n;a.pathToSteps=y;a.dataToStr=function(a,b){void 0===b&&(b=Vd.ENCODING_UTF8);return E.Buffer.isBuffer(a)?a.toString(b):a instanceof Uint8Array?E.bufferFrom(a).toString(b):String(a)};a.dataToBuffer=
B;a.bufferToEncoding=O;a.toUnixTimestamp=R;b=function(){function a(a){void 0===a&&(a={});this.ino=0;this.inodes={};this.releasedInos=[];this.fds={};this.releasedFds=[];this.maxFiles=1E4;this.openFiles=0;this.promisesApi=uf.default(this);this.statWatchers={};this.props=ja({Node:me.Node,Link:me.Link,File:me.File},a);a=this.createLink();a.setNode(this.createNode(!0));var b=this;this.StatWatcher=function(a){function c(){return a.call(this,b)||this}sa(c,a);return c}(sc);this.ReadStream=function(a){function c(){for(var c=
[],d=0;d<arguments.length;d++)c[d]=arguments[d];return a.apply(this,ta([b],c))||this}sa(c,a);return c}(V);this.WriteStream=function(a){function c(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];return a.apply(this,ta([b],c))||this}sa(c,a);return c}(I);this.FSWatcher=function(a){function c(){return a.call(this,b)||this}sa(c,a);return c}(tc);this.root=a}a.fromJSON=function(b,c){var d=new a;d.fromJSON(b,c);return d};Object.defineProperty(a.prototype,"promises",{get:function(){if(null===this.promisesApi)throw Error("Promise is not supported in this environment.");
return this.promisesApi},enumerable:!0,configurable:!0});a.prototype.createLink=function(a,b,c,d){void 0===c&&(c=!1);if(!a)return new this.props.Link(this,null,"");if(!b)throw Error("createLink: name cannot be empty");return a.createChild(b,this.createNode(c,d))};a.prototype.deleteLink=function(a){var b=a.parent;return b?(b.deleteChild(a),!0):!1};a.prototype.newInoNumber=function(){var a=this.releasedInos.pop();return a?a:this.ino=(this.ino+1)%4294967295};a.prototype.newFdNumber=function(){var b=
this.releasedFds.pop();return"number"===typeof b?b:a.fd--};a.prototype.createNode=function(a,b){void 0===a&&(a=!1);b=new this.props.Node(this.newInoNumber(),b);a&&b.setIsDirectory();return this.inodes[b.ino]=b};a.prototype.getNode=function(a){return this.inodes[a]};a.prototype.deleteNode=function(a){a.del();delete this.inodes[a.ino];this.releasedInos.push(a.ino)};a.prototype.genRndStr=function(){var a=(Math.random()+1).toString(36).substr(2,6);return 6===a.length?a:this.genRndStr()};a.prototype.getLink=
function(a){return this.root.walk(a)};a.prototype.getLinkOrThrow=function(a,b){var c=n(a);c=this.getLink(c);if(!c)throw h("ENOENT",b,a);return c};a.prototype.getResolvedLink=function(a){a="string"===typeof a?n(a):a;for(var b=this.root,c=0;c<a.length;){b=b.getChild(a[c]);if(!b)return null;var d=b.getNode();d.isSymlink()?(a=d.symlink.concat(a.slice(c+1)),b=this.root,c=0):c++}return b};a.prototype.getResolvedLinkOrThrow=function(a,b){var c=this.getResolvedLink(a);if(!c)throw h("ENOENT",b,a);return c};
a.prototype.resolveSymlinks=function(a){return this.getResolvedLink(a.steps.slice(1))};a.prototype.getLinkAsDirOrThrow=function(a,b){var c=this.getLinkOrThrow(a,b);if(!c.getNode().isDirectory())throw h("ENOTDIR",b,a);return c};a.prototype.getLinkParent=function(a){return this.root.walk(a,a.length-1)};a.prototype.getLinkParentAsDirOrThrow=function(a,b){a=a instanceof Array?a:n(a);var c=this.getLinkParent(a);if(!c)throw h("ENOENT",b,ia+a.join(ia));if(!c.getNode().isDirectory())throw h("ENOTDIR",b,ia+
a.join(ia));return c};a.prototype.getFileByFd=function(a){return this.fds[String(a)]};a.prototype.getFileByFdOrThrow=function(a,b){if(a>>>0!==a)throw TypeError(za.FD);a=this.getFileByFd(a);if(!a)throw h("EBADF",b);return a};a.prototype.getNodeByIdOrCreate=function(a,b,c){if("number"===typeof a){a=this.getFileByFd(a);if(!a)throw Error("File nto found");return a.node}var d=y(a),e=this.getLink(d);if(e)return e.getNode();if(b&P&&(b=this.getLinkParent(d)))return e=this.createLink(b,d[d.length-1],!1,c),
e.getNode();throw h("ENOENT","getNodeByIdOrCreate",l(a));};a.prototype.wrapAsync=function(a,b,c){var d=this;t(c);fe.default(function(){try{c(null,a.apply(d,b))}catch(Ya){c(Ya)}})};a.prototype._toJSON=function(a,b,c){var d;void 0===a&&(a=this.root);void 0===b&&(b={});var e=!0,f=a.children;a.getNode().isFile()&&(f=(d={},d[a.getName()]=a.parent.getChild(a.getName()),d),a=a.parent);for(var g in f){e=!1;f=a.getChild(g);if(!f)throw Error("_toJSON: unexpected undefined");d=f.getNode();d.isFile()?(f=f.getPath(),
c&&(f=qb(c,f)),b[f]=d.getString()):d.isDirectory()&&this._toJSON(f,b,c)}a=a.getPath();c&&(a=qb(c,a));a&&e&&(b[a]=null);return b};a.prototype.toJSON=function(a,b,c){void 0===b&&(b={});void 0===c&&(c=!1);var d=[];if(a){a instanceof Array||(a=[a]);for(var e=0;e<a.length;e++){var f=l(a[e]);(f=this.getResolvedLink(f))&&d.push(f)}}else d.push(this.root);if(!d.length)return b;for(e=0;e<d.length;e++)f=d[e],this._toJSON(f,b,c?f.getPath():"");return b};a.prototype.fromJSON=function(a,b){void 0===b&&(b=ge.default.cwd());
for(var d in a){var e=a[d];if("string"===typeof e){d=c(d,b);var f=n(d);1<f.length&&(f=ia+f.slice(0,f.length-1).join(ia),this.mkdirpBase(f,511));this.writeFileSync(d,e)}else this.mkdirpBase(d,511)}};a.prototype.reset=function(){this.ino=0;this.inodes={};this.releasedInos=[];this.fds={};this.releasedFds=[];this.openFiles=0;this.root=this.createLink();this.root.setNode(this.createNode(!0))};a.prototype.mountSync=function(a,b){this.fromJSON(b,a)};a.prototype.openLink=function(a,b,c){void 0===c&&(c=!0);
if(this.openFiles>=this.maxFiles)throw h("EMFILE","open",a.getPath());var d=a;c&&(d=this.resolveSymlinks(a));if(!d)throw h("ENOENT","open",a.getPath());c=d.getNode();if(c.isDirectory()){if((b&(Sa|ma|xa))!==Sa)throw h("EISDIR","open",a.getPath());}else if(b&da)throw h("ENOTDIR","open",a.getPath());if(!(b&xa||c.canRead()))throw h("EACCES","open",a.getPath());a=new this.props.File(a,c,b,this.newFdNumber());this.fds[a.fd]=a;this.openFiles++;b&ua&&a.truncate();return a};a.prototype.openFile=function(a,
b,c,d){void 0===d&&(d=!0);var e=n(a),f=d?this.getResolvedLink(e):this.getLink(e);if(!f&&b&P){var g=this.getResolvedLink(e.slice(0,e.length-1));if(!g)throw h("ENOENT","open",ia+e.join(ia));b&P&&"number"===typeof c&&(f=this.createLink(g,e[e.length-1],!1,c))}if(f)return this.openLink(f,b,d);throw h("ENOENT","open",a);};a.prototype.openBase=function(a,b,c,d){void 0===d&&(d=!0);b=this.openFile(a,b,c,d);if(!b)throw h("ENOENT","open",a);return b.fd};a.prototype.openSync=function(a,b,c){void 0===c&&(c=438);
c=M(c);a=l(a);b=k(b);return this.openBase(a,b,c)};a.prototype.open=function(a,b,c,d){var e=c;"function"===typeof c&&(e=438,d=c);c=M(e||438);a=l(a);b=k(b);this.wrapAsync(this.openBase,[a,b,c],d)};a.prototype.closeFile=function(a){this.fds[a.fd]&&(this.openFiles--,delete this.fds[a.fd],this.releasedFds.push(a.fd))};a.prototype.closeSync=function(a){ha(a);a=this.getFileByFdOrThrow(a,"close");this.closeFile(a)};a.prototype.close=function(a,b){ha(a);this.wrapAsync(this.closeSync,[a],b)};a.prototype.openFileOrGetById=
function(a,b,c){if("number"===typeof a){a=this.fds[a];if(!a)throw h("ENOENT");return a}return this.openFile(l(a),b,c)};a.prototype.readBase=function(a,b,c,d,e){return this.getFileByFdOrThrow(a).read(b,Number(c),Number(d),e)};a.prototype.readSync=function(a,b,c,d,e){ha(a);return this.readBase(a,b,c,d,e)};a.prototype.read=function(a,b,c,d,e,f){var g=this;t(f);if(0===d)return ge.default.nextTick(function(){f&&f(null,0,b)});fe.default(function(){try{var h=g.readBase(a,b,c,d,e);f(null,h,b)}catch(Tc){f(Tc)}})};
a.prototype.readFileBase=function(a,b,c){var d="number"===typeof a&&a>>>0===a;if(!d){var e=l(a);e=n(e);if((e=this.getResolvedLink(e))&&e.getNode().isDirectory())throw h("EISDIR","open",e.getPath());a=this.openSync(a,b)}try{var f=O(this.getFileByFdOrThrow(a).getBuffer(),c)}finally{d||this.closeSync(a)}return f};a.prototype.readFileSync=function(a,b){b=Ga(b);var c=k(b.flag);return this.readFileBase(a,c,b.encoding)};a.prototype.readFile=function(a,b,c){c=v(Ga)(b,c);b=c[0];c=c[1];var d=k(b.flag);this.wrapAsync(this.readFileBase,
[a,d,b.encoding],c)};a.prototype.writeBase=function(a,b,c,d,e){return this.getFileByFdOrThrow(a,"write").write(b,c,d,e)};a.prototype.writeSync=function(a,b,c,d,e){ha(a);var f="string"!==typeof b;if(f){var g=(c||0)|0,h=d;c=e}else var k=d;b=B(b,k);f?"undefined"===typeof h&&(h=b.length):(g=0,h=b.length);return this.writeBase(a,b,g,h,c)};a.prototype.write=function(a,b,c,d,e,f){var g=this;ha(a);var h=typeof b,k=typeof c,l=typeof d,p=typeof e;if("string"!==h)if("function"===k)var n=c;else if("function"===
l){var q=c|0;n=d}else if("function"===p){q=c|0;var gb=d;n=e}else{q=c|0;gb=d;var Xa=e;n=f}else if("function"===k)n=c;else if("function"===l)Xa=c,n=d;else if("function"===p){Xa=c;var r=d;n=e}var hb=B(b,r);"string"!==h?"undefined"===typeof gb&&(gb=hb.length):(q=0,gb=hb.length);var C=t(n);fe.default(function(){try{var c=g.writeBase(a,hb,q,gb,Xa);"string"!==h?C(null,c,hb):C(null,c,b)}catch(oe){C(oe)}})};a.prototype.writeFileBase=function(a,b,c,d){var e="number"===typeof a;a=e?a:this.openBase(l(a),c,d);
d=0;var f=b.length;c=c&J?void 0:0;try{for(;0<f;){var g=this.writeSync(a,b,d,f,c);d+=g;f-=g;void 0!==c&&(c+=g)}}finally{e||this.closeSync(a)}};a.prototype.writeFileSync=function(a,b,c){var d=Bc(c);c=k(d.flag);var e=M(d.mode);b=B(b,d.encoding);this.writeFileBase(a,b,c,e)};a.prototype.writeFile=function(a,b,c,d){var e=c;"function"===typeof c&&(e=dc,d=c);c=t(d);var f=Bc(e);e=k(f.flag);d=M(f.mode);b=B(b,f.encoding);this.wrapAsync(this.writeFileBase,[a,b,e,d],c)};a.prototype.linkBase=function(a,b){var c=
n(a),d=this.getLink(c);if(!d)throw h("ENOENT","link",a,b);var e=n(b);c=this.getLinkParent(e);if(!c)throw h("ENOENT","link",a,b);e=e[e.length-1];if(c.getChild(e))throw h("EEXIST","link",a,b);a=d.getNode();a.nlink++;c.createChild(e,a)};a.prototype.copyFileBase=function(a,b,c){var d=this.readFileSync(a);if(c&Ed&&this.existsSync(b))throw h("EEXIST","copyFile",a,b);if(c&Fd)throw h("ENOSYS","copyFile",a,b);this.writeFileBase(b,d,Ia.w,438)};a.prototype.copyFileSync=function(a,b,c){a=l(a);b=l(b);return this.copyFileBase(a,
b,(c||0)|0)};a.prototype.copyFile=function(a,b,c,d){a=l(a);b=l(b);if("function"===typeof c)var e=0;else e=c,c=d;t(c);this.wrapAsync(this.copyFileBase,[a,b,e],c)};a.prototype.linkSync=function(a,b){a=l(a);b=l(b);this.linkBase(a,b)};a.prototype.link=function(a,b,c){a=l(a);b=l(b);this.wrapAsync(this.linkBase,[a,b],c)};a.prototype.unlinkBase=function(a){var b=n(a);b=this.getLink(b);if(!b)throw h("ENOENT","unlink",a);if(b.length)throw Error("Dir not empty...");this.deleteLink(b);a=b.getNode();a.nlink--;
0>=a.nlink&&this.deleteNode(a)};a.prototype.unlinkSync=function(a){a=l(a);this.unlinkBase(a)};a.prototype.unlink=function(a,b){a=l(a);this.wrapAsync(this.unlinkBase,[a],b)};a.prototype.symlinkBase=function(a,b){var c=n(b),d=this.getLinkParent(c);if(!d)throw h("ENOENT","symlink",a,b);c=c[c.length-1];if(d.getChild(c))throw h("EEXIST","symlink",a,b);b=d.createChild(c);b.getNode().makeSymlink(n(a));return b};a.prototype.symlinkSync=function(a,b){a=l(a);b=l(b);this.symlinkBase(a,b)};a.prototype.symlink=
function(a,b,c,d){c=t("function"===typeof c?c:d);a=l(a);b=l(b);this.wrapAsync(this.symlinkBase,[a,b],c)};a.prototype.realpathBase=function(a,b){var c=n(a);c=this.getResolvedLink(c);if(!c)throw h("ENOENT","realpath",a);return Vd.strToEncoding(c.getPath(),b)};a.prototype.realpathSync=function(a,b){return this.realpathBase(l(a),Cc(b).encoding)};a.prototype.realpath=function(a,b,c){c=Hd(b,c);b=c[0];c=c[1];a=l(a);this.wrapAsync(this.realpathBase,[a,b.encoding],c)};a.prototype.lstatBase=function(a,b){void 0===
b&&(b=!1);var c=this.getLink(n(a));if(!c)throw h("ENOENT","lstat",a);return Ka.default.build(c.getNode(),b)};a.prototype.lstatSync=function(a,b){return this.lstatBase(l(a),e(b).bigint)};a.prototype.lstat=function(a,b,c){c=d(b,c);b=c[0];c=c[1];this.wrapAsync(this.lstatBase,[l(a),b.bigint],c)};a.prototype.statBase=function(a,b){void 0===b&&(b=!1);var c=this.getResolvedLink(n(a));if(!c)throw h("ENOENT","stat",a);return Ka.default.build(c.getNode(),b)};a.prototype.statSync=function(a,b){return this.statBase(l(a),
e(b).bigint)};a.prototype.stat=function(a,b,c){c=d(b,c);b=c[0];c=c[1];this.wrapAsync(this.statBase,[l(a),b.bigint],c)};a.prototype.fstatBase=function(a,b){void 0===b&&(b=!1);a=this.getFileByFd(a);if(!a)throw h("EBADF","fstat");return Ka.default.build(a.node,b)};a.prototype.fstatSync=function(a,b){return this.fstatBase(a,e(b).bigint)};a.prototype.fstat=function(a,b,c){b=d(b,c);this.wrapAsync(this.fstatBase,[a,b[0].bigint],b[1])};a.prototype.renameBase=function(a,b){var c=this.getLink(n(a));if(!c)throw h("ENOENT",
"rename",a,b);var d=n(b),e=this.getLinkParent(d);if(!e)throw h("ENOENT","rename",a,b);(a=c.parent)&&a.deleteChild(c);c.steps=ta(e.steps,[d[d.length-1]]);e.setChild(c.getName(),c)};a.prototype.renameSync=function(a,b){a=l(a);b=l(b);this.renameBase(a,b)};a.prototype.rename=function(a,b,c){a=l(a);b=l(b);this.wrapAsync(this.renameBase,[a,b],c)};a.prototype.existsBase=function(a){return!!this.statBase(a)};a.prototype.existsSync=function(a){try{return this.existsBase(l(a))}catch(Xa){return!1}};a.prototype.exists=
function(a,b){var c=this,d=l(a);if("function"!==typeof b)throw Error(za.CB);fe.default(function(){try{b(c.existsBase(d))}catch(Ya){b(!1)}})};a.prototype.accessBase=function(a){this.getLinkOrThrow(a,"access")};a.prototype.accessSync=function(a,b){void 0===b&&(b=Hb);a=l(a);this.accessBase(a,b|0)};a.prototype.access=function(a,b,c){var d=Hb;"function"!==typeof b&&(d=b|0,b=t(c));a=l(a);this.wrapAsync(this.accessBase,[a,d],b)};a.prototype.appendFileSync=function(a,b,c){void 0===c&&(c=ec);c=Ac(c);c.flag&&
a>>>0!==a||(c.flag="a");this.writeFileSync(a,b,c)};a.prototype.appendFile=function(a,b,c,d){d=Gd(c,d);c=d[0];d=d[1];c.flag&&a>>>0!==a||(c.flag="a");this.writeFile(a,b,c,d)};a.prototype.readdirBase=function(a,b){var c=n(a);c=this.getResolvedLink(c);if(!c)throw h("ENOENT","readdir",a);if(!c.getNode().isDirectory())throw h("ENOTDIR","scandir",a);if(b.withFileTypes){var d=[];for(e in c.children)(a=c.getChild(e))&&d.push(Wd.default.build(a,b.encoding));p||"buffer"===b.encoding||d.sort(function(a,b){return a.name<
b.name?-1:a.name>b.name?1:0});return d}var e=[];for(d in c.children)e.push(Vd.strToEncoding(d,b.encoding));p||"buffer"===b.encoding||e.sort();return e};a.prototype.readdirSync=function(a,b){b=rc(b);a=l(a);return this.readdirBase(a,b)};a.prototype.readdir=function(a,b,c){c=ne(b,c);b=c[0];c=c[1];a=l(a);this.wrapAsync(this.readdirBase,[a,b],c)};a.prototype.readlinkBase=function(a,b){var c=this.getLinkOrThrow(a,"readlink").getNode();if(!c.isSymlink())throw h("EINVAL","readlink",a);a=ia+c.symlink.join(ia);
return Vd.strToEncoding(a,b)};a.prototype.readlinkSync=function(a,b){b=u(b);a=l(a);return this.readlinkBase(a,b.encoding)};a.prototype.readlink=function(a,b,c){c=Dc(b,c);b=c[0];c=c[1];a=l(a);this.wrapAsync(this.readlinkBase,[a,b.encoding],c)};a.prototype.fsyncBase=function(a){this.getFileByFdOrThrow(a,"fsync")};a.prototype.fsyncSync=function(a){this.fsyncBase(a)};a.prototype.fsync=function(a,b){this.wrapAsync(this.fsyncBase,[a],b)};a.prototype.fdatasyncBase=function(a){this.getFileByFdOrThrow(a,"fdatasync")};
a.prototype.fdatasyncSync=function(a){this.fdatasyncBase(a)};a.prototype.fdatasync=function(a,b){this.wrapAsync(this.fdatasyncBase,[a],b)};a.prototype.ftruncateBase=function(a,b){this.getFileByFdOrThrow(a,"ftruncate").truncate(b)};a.prototype.ftruncateSync=function(a,b){this.ftruncateBase(a,b)};a.prototype.ftruncate=function(a,b,c){var d="number"===typeof b?b:0;b=t("number"===typeof b?c:b);this.wrapAsync(this.ftruncateBase,[a,d],b)};a.prototype.truncateBase=function(a,b){a=this.openSync(a,"r+");try{this.ftruncateSync(a,
b)}finally{this.closeSync(a)}};a.prototype.truncateSync=function(a,b){if(a>>>0===a)return this.ftruncateSync(a,b);this.truncateBase(a,b)};a.prototype.truncate=function(a,b,c){var d="number"===typeof b?b:0;b=t("number"===typeof b?c:b);if(a>>>0===a)return this.ftruncate(a,d,b);this.wrapAsync(this.truncateBase,[a,d],b)};a.prototype.futimesBase=function(a,b,c){a=this.getFileByFdOrThrow(a,"futimes").node;a.atime=new Date(1E3*b);a.mtime=new Date(1E3*c)};a.prototype.futimesSync=function(a,b,c){this.futimesBase(a,
R(b),R(c))};a.prototype.futimes=function(a,b,c,d){this.wrapAsync(this.futimesBase,[a,R(b),R(c)],d)};a.prototype.utimesBase=function(a,b,c){a=this.openSync(a,"r+");try{this.futimesBase(a,b,c)}finally{this.closeSync(a)}};a.prototype.utimesSync=function(a,b,c){this.utimesBase(l(a),R(b),R(c))};a.prototype.utimes=function(a,b,c,d){this.wrapAsync(this.utimesBase,[l(a),R(b),R(c)],d)};a.prototype.mkdirBase=function(a,b){var c=n(a);if(!c.length)throw h("EISDIR","mkdir",a);var d=this.getLinkParentAsDirOrThrow(a,
"mkdir");c=c[c.length-1];if(d.getChild(c))throw h("EEXIST","mkdir",a);d.createChild(c,this.createNode(!0,b))};a.prototype.mkdirpBase=function(a,b){a=n(a);for(var c=this.root,d=0;d<a.length;d++){var e=a[d];if(!c.getNode().isDirectory())throw h("ENOTDIR","mkdir",c.getPath());var f=c.getChild(e);if(f)if(f.getNode().isDirectory())c=f;else throw h("ENOTDIR","mkdir",f.getPath());else c=c.createChild(e,this.createNode(!0,b))}};a.prototype.mkdirSync=function(a,b){b=g(b);var c=M(b.mode,511);a=l(a);b.recursive?
this.mkdirpBase(a,c):this.mkdirBase(a,c)};a.prototype.mkdir=function(a,b,c){var d=g(b);b=t("function"===typeof b?b:c);c=M(d.mode,511);a=l(a);d.recursive?this.wrapAsync(this.mkdirpBase,[a,c],b):this.wrapAsync(this.mkdirBase,[a,c],b)};a.prototype.mkdirpSync=function(a,b){this.mkdirSync(a,{mode:b,recursive:!0})};a.prototype.mkdirp=function(a,b,c){var d="function"===typeof b?void 0:b;b=t("function"===typeof b?b:c);this.mkdir(a,{mode:d,recursive:!0},b)};a.prototype.mkdtempBase=function(a,b,c){void 0===
c&&(c=5);var d=a+this.genRndStr();try{return this.mkdirBase(d,511),Vd.strToEncoding(d,b)}catch(Ya){if("EEXIST"===Ya.code){if(1<c)return this.mkdtempBase(a,b,c-1);throw Error("Could not create temp dir.");}throw Ya;}};a.prototype.mkdtempSync=function(a,b){b=u(b).encoding;if(!a||"string"!==typeof a)throw new TypeError("filename prefix is required");X(a);return this.mkdtempBase(a,b)};a.prototype.mkdtemp=function(a,b,c){c=Dc(b,c);b=c[0].encoding;c=c[1];if(!a||"string"!==typeof a)throw new TypeError("filename prefix is required");
X(a)&&this.wrapAsync(this.mkdtempBase,[a,b],c)};a.prototype.rmdirBase=function(a,b){b=ja({},qc,b);var c=this.getLinkAsDirOrThrow(a,"rmdir");if(c.length&&!b.recursive)throw h("ENOTEMPTY","rmdir",a);this.deleteLink(c)};a.prototype.rmdirSync=function(a,b){this.rmdirBase(l(a),b)};a.prototype.rmdir=function(a,b,c){var d=ja({},qc,b);b=t("function"===typeof b?b:c);this.wrapAsync(this.rmdirBase,[l(a),d],b)};a.prototype.fchmodBase=function(a,b){this.getFileByFdOrThrow(a,"fchmod").chmod(b)};a.prototype.fchmodSync=
function(a,b){this.fchmodBase(a,M(b))};a.prototype.fchmod=function(a,b,c){this.wrapAsync(this.fchmodBase,[a,M(b)],c)};a.prototype.chmodBase=function(a,b){a=this.openSync(a,"r+");try{this.fchmodBase(a,b)}finally{this.closeSync(a)}};a.prototype.chmodSync=function(a,b){b=M(b);a=l(a);this.chmodBase(a,b)};a.prototype.chmod=function(a,b,c){b=M(b);a=l(a);this.wrapAsync(this.chmodBase,[a,b],c)};a.prototype.lchmodBase=function(a,b){a=this.openBase(a,ma,0,!1);try{this.fchmodBase(a,b)}finally{this.closeSync(a)}};
a.prototype.lchmodSync=function(a,b){b=M(b);a=l(a);this.lchmodBase(a,b)};a.prototype.lchmod=function(a,b,c){b=M(b);a=l(a);this.wrapAsync(this.lchmodBase,[a,b],c)};a.prototype.fchownBase=function(a,b,c){this.getFileByFdOrThrow(a,"fchown").chown(b,c)};a.prototype.fchownSync=function(a,b,c){C(b);H(c);this.fchownBase(a,b,c)};a.prototype.fchown=function(a,b,c,d){C(b);H(c);this.wrapAsync(this.fchownBase,[a,b,c],d)};a.prototype.chownBase=function(a,b,c){this.getResolvedLinkOrThrow(a,"chown").getNode().chown(b,
c)};a.prototype.chownSync=function(a,b,c){C(b);H(c);this.chownBase(l(a),b,c)};a.prototype.chown=function(a,b,c,d){C(b);H(c);this.wrapAsync(this.chownBase,[l(a),b,c],d)};a.prototype.lchownBase=function(a,b,c){this.getLinkOrThrow(a,"lchown").getNode().chown(b,c)};a.prototype.lchownSync=function(a,b,c){C(b);H(c);this.lchownBase(l(a),b,c)};a.prototype.lchown=function(a,b,c,d){C(b);H(c);this.wrapAsync(this.lchownBase,[l(a),b,c],d)};a.prototype.watchFile=function(a,b,c){a=l(a);var d=b;"function"===typeof d&&
(c=b,d=null);if("function"!==typeof c)throw Error('"watchFile()" requires a listener function');b=5007;var e=!0;d&&"object"===typeof d&&("number"===typeof d.interval&&(b=d.interval),"boolean"===typeof d.persistent&&(e=d.persistent));(d=this.statWatchers[a])||(d=new this.StatWatcher,d.start(a,e,b),this.statWatchers[a]=d);d.addListener("change",c);return d};a.prototype.unwatchFile=function(a,b){a=l(a);var c=this.statWatchers[a];c&&("function"===typeof b?c.removeListener("change",b):c.removeAllListeners("change"),
0===c.listenerCount("change")&&(c.stop(),delete this.statWatchers[a]))};a.prototype.createReadStream=function(a,b){return new this.ReadStream(a,b)};a.prototype.createWriteStream=function(a,b){return new this.WriteStream(a,b)};a.prototype.watch=function(a,b,c){a=l(a);var d=b;"function"===typeof b&&(c=b,d=null);var e=u(d);b=e.persistent;d=e.recursive;e=e.encoding;void 0===b&&(b=!0);void 0===d&&(d=!1);var f=new this.FSWatcher;f.start(a,b,d,e);c&&f.addListener("change",c);return f};a.fd=2147483647;return a}();
a.Volume=b;var sc=function(a){function b(b){var c=a.call(this)||this;c.onInterval=function(){try{var a=c.vol.statSync(c.filename);c.hasChanged(a)&&(c.emit("change",a,c.prev),c.prev=a)}finally{c.loop()}};c.vol=b;return c}sa(b,a);b.prototype.loop=function(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)};b.prototype.hasChanged=function(a){return a.mtimeMs>this.prev.mtimeMs||a.nlink!==this.prev.nlink?!0:!1};b.prototype.start=function(a,b,c){void 0===b&&(b=!0);void 0===c&&(c=5007);this.filename=
l(a);this.setTimeout=b?setTimeout:qe.default;this.interval=c;this.prev=this.vol.statSync(this.filename);this.loop()};b.prototype.stop=function(){clearTimeout(this.timeoutRef);ge.default.nextTick(qa,this)};return b}(L.EventEmitter);a.StatWatcher=sc;var Z;md.inherits(V,qf.Readable);a.ReadStream=V;V.prototype.open=function(){var a=this;this._vol.open(this.path,this.flags,this.mode,function(b,c){b?(a.autoClose&&a.destroy&&a.destroy(),a.emit("error",b)):(a.fd=c,a.emit("open",c),a.read())})};V.prototype._read=
function(a){if("number"!==typeof this.fd)return this.once("open",function(){this._read(a)});if(!this.destroyed){if(!Z||128>Z.length-Z.used)Z=E.bufferAllocUnsafe(this._readableState.highWaterMark),Z.used=0;var b=Z,c=Math.min(Z.length-Z.used,a),d=Z.used;void 0!==this.pos&&(c=Math.min(this.end-this.pos+1,c));if(0>=c)return this.push(null);var e=this;this._vol.read(this.fd,Z,Z.used,c,this.pos,function(a,c){a?(e.autoClose&&e.destroy&&e.destroy(),e.emit("error",a)):(a=null,0<c&&(e.bytesRead+=c,a=b.slice(d,
d+c)),e.push(a))});void 0!==this.pos&&(this.pos+=c);Z.used+=c}};V.prototype._destroy=function(a,b){this.close(function(c){b(a||c)})};V.prototype.close=function(a){var b=this;if(a)this.once("close",a);if(this.closed||"number"!==typeof this.fd){if("number"!==typeof this.fd){this.once("open",ra);return}return ge.default.nextTick(function(){return b.emit("close")})}this.closed=!0;this._vol.close(this.fd,function(a){a?b.emit("error",a):b.emit("close")});this.fd=null};md.inherits(I,qf.Writable);a.WriteStream=
I;I.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(a,b){a?(this.autoClose&&this.destroy&&this.destroy(),this.emit("error",a)):(this.fd=b,this.emit("open",b))}.bind(this))};I.prototype._write=function(a,b,c){if(!(a instanceof E.Buffer))return this.emit("error",Error("Invalid data"));if("number"!==typeof this.fd)return this.once("open",function(){this._write(a,b,c)});var d=this;this._vol.write(this.fd,a,0,a.length,this.pos,function(a,b){if(a)return d.autoClose&&d.destroy&&
d.destroy(),c(a);d.bytesWritten+=b;c()});void 0!==this.pos&&(this.pos+=a.length)};I.prototype._writev=function(a,b){if("number"!==typeof this.fd)return this.once("open",function(){this._writev(a,b)});for(var c=this,d=a.length,e=Array(d),f=0,g=0;g<d;g++){var h=a[g].chunk;e[g]=h;f+=h.length}d=E.Buffer.concat(e);this._vol.write(this.fd,d,0,d.length,this.pos,function(a,d){if(a)return c.destroy&&c.destroy(),b(a);c.bytesWritten+=d;b()});void 0!==this.pos&&(this.pos+=f)};I.prototype._destroy=V.prototype._destroy;
I.prototype.close=V.prototype.close;I.prototype.destroySoon=I.prototype.end;var tc=function(a){function b(b){var c=a.call(this)||this;c._filename="";c._filenameEncoded="";c._recursive=!1;c._encoding=Vd.ENCODING_UTF8;c._onNodeChange=function(){c._emit("change")};c._onParentChild=function(a){a.getName()===c._getName()&&c._emit("rename")};c._emit=function(a){c.emit("change",a,c._filenameEncoded)};c._persist=function(){c._timer=setTimeout(c._persist,1E6)};c._vol=b;return c}sa(b,a);b.prototype._getName=
function(){return this._steps[this._steps.length-1]};b.prototype.start=function(a,b,c,d){void 0===b&&(b=!0);void 0===c&&(c=!1);void 0===d&&(d=Vd.ENCODING_UTF8);this._filename=l(a);this._steps=n(this._filename);this._filenameEncoded=Vd.strToEncoding(this._filename);this._recursive=c;this._encoding=d;try{this._link=this._vol.getLinkOrThrow(this._filename,"FSWatcher")}catch(ib){throw b=Error("watch "+this._filename+" "+ib.code),b.code=ib.code,b.errno=ib.code,b;}this._link.getNode().on("change",this._onNodeChange);
this._link.on("child:add",this._onNodeChange);this._link.on("child:delete",this._onNodeChange);if(a=this._link.parent)a.setMaxListeners(a.getMaxListeners()+1),a.on("child:delete",this._onParentChild);b&&this._persist()};b.prototype.close=function(){clearTimeout(this._timer);this._link.getNode().removeListener("change",this._onNodeChange);var a=this._link.parent;a&&a.removeListener("child:delete",this._onParentChild)};return b}(L.EventEmitter);a.FSWatcher=tc});Da(fg);
var gg=fg.pathToFilename,hg=fg.filenameToSteps,ig=fg.Volume,jg=Ea(function(b,a){Object.defineProperty(a,"__esModule",{value:!0});a.fsProps="constants F_OK R_OK W_OK X_OK Stats".split(" ");a.fsSyncMethods="renameSync ftruncateSync truncateSync chownSync fchownSync lchownSync chmodSync fchmodSync lchmodSync statSync lstatSync fstatSync linkSync symlinkSync readlinkSync realpathSync unlinkSync rmdirSync mkdirSync mkdirpSync readdirSync closeSync openSync utimesSync futimesSync fsyncSync writeSync readSync readFileSync writeFileSync appendFileSync existsSync accessSync fdatasyncSync mkdtempSync copyFileSync createReadStream createWriteStream".split(" ");
a.fsAsyncMethods="rename ftruncate truncate chown fchown lchown chmod fchmod lchmod stat lstat fstat link symlink readlink realpath unlink rmdir mkdir mkdirp readdir close open utimes futimes fsync write read readFile writeFile appendFile exists access fdatasync mkdtemp copyFile watchFile unwatchFile watch".split(" ")});Da(jg);
var kg=Ea(function(b,a){function c(a){for(var b={F_OK:f,R_OK:h,W_OK:k,X_OK:r,constants:z.constants,Stats:Ka.default,Dirent:Wd.default},c=0,d=e;c<d.length;c++){var n=d[c];"function"===typeof a[n]&&(b[n]=a[n].bind(a))}c=0;for(d=g;c<d.length;c++)n=d[c],"function"===typeof a[n]&&(b[n]=a[n].bind(a));b.StatWatcher=a.StatWatcher;b.FSWatcher=a.FSWatcher;b.WriteStream=a.WriteStream;b.ReadStream=a.ReadStream;b.promises=a.promises;b._toUnixTimestamp=fg.toUnixTimestamp;return b}var d=x&&x.__assign||function(){d=
Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++){b=arguments[c];for(var e in b)Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e])}return a};return d.apply(this,arguments)};Object.defineProperty(a,"__esModule",{value:!0});var e=jg.fsSyncMethods,g=jg.fsAsyncMethods,f=z.constants.F_OK,h=z.constants.R_OK,k=z.constants.W_OK,r=z.constants.X_OK;a.Volume=fg.Volume;a.vol=new fg.Volume;a.createFsFromVolume=c;a.fs=c(a.vol);b.exports=d(d({},b.exports),a.fs);b.exports.semantic=!0});Da(kg);
var lg=kg.createFsFromVolume;pe.prototype.emit=function(b){for(var a,c,d=[],e=1;e<arguments.length;e++)d[e-1]=arguments[e];e=this.listeners(b);try{for(var g=Aa(e),f=g.next();!f.done;f=g.next()){var h=f.value;try{h.apply(void 0,Ca(d))}catch(k){console.error(k)}}}catch(k){a={error:k}}finally{try{f&&!f.done&&(c=g.return)&&c.call(g)}finally{if(a)throw a.error;}}return 0<e.length};
var mg=function(){function b(){this.volume=new ig;this.fs=lg(this.volume);this.fromJSON({"/dev/stdin":"","/dev/stdout":"","/dev/stderr":""})}b.prototype._toJSON=function(a,b,d){void 0===b&&(b={});var c=!0,g;for(g in a.children){c=!1;var f=a.getChild(g);if(f){var h=f.getNode();h&&h.isFile()?(f=f.getPath(),d&&(f=de(d,f)),b[f]=h.getBuffer()):h&&h.isDirectory()&&this._toJSON(f,b,d)}}a=a.getPath();d&&(a=de(d,a));a&&c&&(b[a]=null);return b};b.prototype.toJSON=function(a,b,d){var c,g;void 0===b&&(b={});
void 0===d&&(d=!1);var f=[];if(a){a instanceof Array||(a=[a]);try{for(var h=Aa(a),k=h.next();!k.done;k=h.next()){var r=gg(k.value),q=this.volume.getResolvedLink(r);q&&f.push(q)}}catch(y){var t={error:y}}finally{try{k&&!k.done&&(c=h.return)&&c.call(h)}finally{if(t)throw t.error;}}}else f.push(this.volume.root);if(!f.length)return b;try{for(var v=Aa(f),l=v.next();!l.done;l=v.next())q=l.value,this._toJSON(q,b,d?q.getPath():"")}catch(y){var n={error:y}}finally{try{l&&!l.done&&(g=v.return)&&g.call(v)}finally{if(n)throw n.error;
}}return b};b.prototype.fromJSONFixed=function(a,b){for(var c in b){var e=b[c];if(e?null!==Object.getPrototypeOf(e):null!==e){var g=hg(c);1<g.length&&(g="/"+g.slice(0,g.length-1).join("/"),a.mkdirpBase(g,511));a.writeFileSync(c,e||"")}else a.mkdirpBase(c,511)}};b.prototype.fromJSON=function(a){this.volume=new ig;this.fromJSONFixed(this.volume,a);this.fs=lg(this.volume);this.volume.releasedFds=[0,1,2];a=this.volume.openSync("/dev/stderr","w");var b=this.volume.openSync("/dev/stdout","w"),d=this.volume.openSync("/dev/stdin",
"r");if(2!==a)throw Error("invalid handle for stderr: "+a);if(1!==b)throw Error("invalid handle for stdout: "+b);if(0!==d)throw Error("invalid handle for stdin: "+d);};b.prototype.getStdOut=function(){return va(this,void 0,void 0,function(){var a,b=this;return wa(this,function(){a=new Promise(function(a){a(b.fs.readFileSync("/dev/stdout","utf8"))});return[2,a]})})};return b}();
function ng(b){if(!b)throw Error("You must provide a config for the Wasm terminal.");if(!b.fetchCommand)throw Error("You must provide a fetchCommand for the Wasm terminal config, to handle fetching commands to be run");b.processWorkerUrl||console.warn("Note: It is HIGHLY reccomended you pass in the processWorkerUrl in the terminal config to create process workers. Without this, some wasi programs will not work.");b.processWorkerUrl&&console.warn("The unoptimized bundle of wasm-terminal is currently being used. The process worker does not need to be passed, as it is already inlined into the bundle. If you would like to pass in the process worker url and improve performance, please use the optimized bundle. Instructions can be found in the documentation.");
this.fetchCommand=b.fetchCommand;this.processWorkerUrl=b.processWorkerUrl;this.wasmFs=b.wasmFs?b.wasmFs:new mg}function og(b,a){og=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return og(b,a)}function pg(b,a){function c(){this.constructor=b}og(b,a);b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}
function qg(){qg=Object.assign||function(b){for(var a,c=1,d=arguments.length;c<d;c++){a=arguments[c];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(b[e]=a[e])}return b};return qg.apply(this,arguments)}function rg(b,a,c,d){return new (c||(c=Promise))(function(e,g){function f(a){try{k(d.next(a))}catch(q){g(q)}}function h(a){try{k(d["throw"](a))}catch(q){g(q)}}function k(a){a.done?e(a.value):(new c(function(b){b(a.value)})).then(f,h)}k((d=d.apply(b,a||[])).next())})}
function sg(b,a){function c(a){return function(b){return d([a,b])}}function d(c){if(g)throw new TypeError("Generator is already executing.");for(;e;)try{if(g=1,f&&(h=c[0]&2?f["return"]:c[0]?f["throw"]||((h=f["return"])&&h.call(f),0):f.next)&&!(h=h.call(f,c[1])).done)return h;if(f=0,h)c=[c[0]&2,h.value];switch(c[0]){case 0:case 1:h=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++;f=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(h=e.trys,h=0<h.length&&
h[h.length-1])&&(6===c[0]||2===c[0])){e=0;continue}if(3===c[0]&&(!h||c[1]>h[0]&&c[1]<h[3]))e.label=c[1];else if(6===c[0]&&e.label<h[1])e.label=h[1],h=c;else if(h&&e.label<h[2])e.label=h[2],e.ops.push(c);else{h[2]&&e.ops.pop();e.trys.pop();continue}}c=a.call(b,e)}catch(q){c=[6,q],f=0}finally{g=h=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}var e={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},g,f,h,k;return k={next:c(0),"throw":c(1),"return":c(2)},"function"===
typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k}function tg(b,a){var c="function"===typeof Symbol&&b[Symbol.iterator];if(!c)return b;b=c.call(b);var d,e=[];try{for(;(void 0===a||0<a--)&&!(d=b.next()).done;)e.push(d.value)}catch(f){var g={error:f}}finally{try{d&&!d.done&&(c=b["return"])&&c.call(b)}finally{if(g)throw g.error;}}return e}function ug(){for(var b=[],a=0;a<arguments.length;a++)b=b.concat(tg(arguments[a]));return b}
function vg(b,a,c){for(var d=0,e=0,g=0;g<a;++g)"\n"===b.charAt(g)?(e=0,d+=1):(e+=1,e>c&&(e=0,d+=1));return{row:d,col:e}}
for(var wg=function(){function b(a){this._firstInit=!0;this.xterm=a;this._termSize={cols:this.xterm.cols,rows:this.xterm.rows};this._input=this._continuationPromptPrefix=this._promptPrefix="";this._cursor=0}b.prototype._getAsyncRead=function(){var a=this,b,d;return{promise:new Promise(function(c,g){b=function(b){a._promptPrefix="";a._continuationPromptPrefix="";c(b)};d=g}),resolve:b,reject:d}};b.prototype.read=function(a,b){void 0===b&&(b="> ");0<a.length&&this.print(a);this._firstInit=!0;this._promptPrefix=
a;this._continuationPromptPrefix=b;this._input="";this._cursor=0;return qg({promptPrefix:a,continuationPromptPrefix:b},this._getAsyncRead())};b.prototype.readChar=function(a){0<a.length&&this.print(a);return qg({promptPrefix:a},this._getAsyncRead())};b.prototype.println=function(a){this.print(a+"\n")};b.prototype.print=function(a,b){var c=this;a=a.replace(/[\r\n]+/g,"\n").replace(/\n/g,"\r\n");b?(this.xterm._core.writeSync(a),this.xterm._core._renderService._renderer._runOperation(function(a){return a.onGridChanged(0,
c.xterm.rows-1)})):this.xterm.write(a)};b.prototype.printWide=function(a,b){void 0===b&&(b=2);if(0===a.length)return this.println("");b=a.reduce(function(a,b){return Math.max(a,b.length)},0)+b;for(var c=Math.floor(this._termSize.cols/b),e=Math.ceil(a.length/c),g=0,f=0;f<e;++f){for(var h="",k=0;k<c;++k)if(g<a.length){var r=a[g++];r+=" ".repeat(b-r.length);h+=r}this.println(h)}};b.prototype.printStatus=function(a,b){this.print("\u001b[s",b);this.print(a,b)};b.prototype.clearStatus=function(a){this.print("\u001b[u",
a);this.print("\u001b[1000D",a);this.print("\u001b[0J",a)};b.prototype.applyPrompts=function(a){return this._promptPrefix+a.replace(/\n/g,"\n"+this._continuationPromptPrefix)};b.prototype.applyPromptOffset=function(a,b){return this.applyPrompts(a.substr(0,b)).length};b.prototype.clearInput=function(){var a=this.applyPrompts(this._input),b=vg(a,a.length,this._termSize.cols).row+1,d=this.applyPromptOffset(this._input,this._cursor);a=vg(a,d,this._termSize.cols).row;a=b-a-1;for(d=0;d<a;++d)this.xterm.write("\u001b[E");
this.xterm.write("\r\u001b[K");for(d=1;d<b;++d)this.xterm.write("\u001b[F\u001b[K")};b.prototype.clearTty=function(){this.xterm.write("\u001b[2J");this.xterm.write("\u001b[0;0H");this._cursor=0};b.prototype.getFirstInit=function(){return this._firstInit};b.prototype.getPromptPrefix=function(){return this._promptPrefix};b.prototype.getContinuationPromptPrefix=function(){return this._continuationPromptPrefix};b.prototype.getTermSize=function(){return this._termSize};b.prototype.getInput=function(){return this._input};
b.prototype.getCursor=function(){return this._cursor};b.prototype.getSize=function(){return this._termSize};b.prototype.getBuffer=function(){return this.xterm.buffer};b.prototype.setInput=function(a,b){void 0===b&&(b=!1);b||this.clearInput();var c=this.applyPrompts(a);this.print(c);this._cursor>a.length&&(this._cursor=a.length);var e=this.applyPromptOffset(a,this._cursor);b=vg(c,c.length,this._termSize.cols).row+1;e=vg(c,e,this._termSize.cols);c=e.col;b=b-e.row-1;this.xterm.write("\r");for(e=0;e<
b;++e)this.xterm.write("\u001b[F");for(e=0;e<c;++e)this.xterm.write("\u001b[C");this._input=a};b.prototype.setCursor=function(a){0>a&&(a=0);a>this._input.length&&(a=this._input.length);this._writeCursorPosition(a)};b.prototype.setCursorDirectly=function(a){this._writeCursorPosition(a)};b.prototype._writeCursorPosition=function(a){var b=this.applyPrompts(this._input);vg(b,b.length,this._termSize.cols);var d=this.applyPromptOffset(this._input,this._cursor),e=vg(b,d,this._termSize.cols);d=e.col;e=e.row;
var g=this.applyPromptOffset(this._input,a);g=vg(b,g,this._termSize.cols);b=g.col;g=g.row;if(g>e)for(var f=e;f<g;++f)this.xterm.write("\u001b[B");else for(f=g;f<e;++f)this.xterm.write("\u001b[A");if(b>d)for(f=d;f<b;++f)this.xterm.write("\u001b[C");else for(f=b;f<d;++f)this.xterm.write("\u001b[D");this._cursor=a};b.prototype.setTermSize=function(a,b){this._termSize={cols:a,rows:b}};b.prototype.setFirstInit=function(a){this._firstInit=a};b.prototype.setPromptPrefix=function(a){this._promptPrefix=a};
b.prototype.setContinuationPromptPrefix=function(a){this._continuationPromptPrefix=a};return b}(),Cg="",Dg=0;4>Dg;Dg++)Cg+=(Math.pow(16,8)*Math.random()).toString(16);function Eg(b,a,c){b=Fg(b,a,c);return"function"!==typeof a?b:b.reduce(function(a,b){if("object"===typeof b)return a.concat(b);b=b.split(RegExp("("+Cg+".*?"+Cg+")","g"));return 1===b.length?a.concat(b[0]):a.concat(b.filter(Boolean).map(function(a){return RegExp("^"+Cg).test(a)?JSON.parse(a.split(Cg)[1]):a}))},[])}
function Fg(b,a,c){var d=b.match(/((?:\|\||\&\&|;;|\|\&|\<\(|>>|>\&|[&;()|<>]))|((\\['"|&;()<> \t]|[^\s'"|&;()<> \t])+|"((\\"|[^"])*?)"|'((\\'|[^'])*?)')*/g).filter(Boolean),e=!1;if(!d)return[];a||(a={});c||(c={});return d.map(function(b,f){function g(){l+=1;if("{"===b.charAt(l)){l+=1;if("}"===b.charAt(l))throw Error("Bad substitution: "+b.substr(l-2,3));var c=b.indexOf("}",l);if(0>c)throw Error("Bad substitution: "+b.substr(l));var d=b.substr(l,c-l);l=c}else/[*@#?$!_\-]/.test(b.charAt(l))?(d=b.charAt(l),
l+=1):(c=b.substr(l).match(/[^\w\d_]/))?(d=b.substr(l,c.index),l+=c.index-1):(d=b.substr(l),l=b.length);c=d;d="function"===typeof a?a(c):a[c];void 0===d&&""!=c?d="":void 0===d&&(d="$");c="object"===typeof d?""+Cg+JSON.stringify(d)+Cg:""+d;return c}if(!e){if(/^(?:\|\||\&\&|;;|\|\&|\<\(|>>|>\&|[&;()|<>])$/.test(b))return{op:b};for(var k=c.escape||"\\",r=!1,q=!1,t="",v=!1,l=0,n=b.length;l<n;l++){var y=b.charAt(l);v=v||!r&&("*"===y||"?"===y);if(q)t+=y,q=!1;else if(r)y===r?r=!1:"'"==r?t+=y:y===k?(l+=1,
y=b.charAt(l),t='"'===y||y===k||"$"===y?t+y:t+(k+y)):t="$"===y?t+g():t+y;else if('"'===y||"'"===y)r=y;else{if(/^(?:\|\||\&\&|;;|\|\&|\<\(|>>|>\&|[&;()|<>])$/.test(y))return{op:b};if(/^#$/.test(y))return e=!0,t.length?[t,{comment:b.slice(l+1)+d.slice(f+1).join(" ")}]:[{comment:b.slice(l+1)+d.slice(f+1).join(" ")}];y===k?q=!0:t="$"===y?t+g():t+y}}return v?{op:"glob",pattern:t}:t}}).reduce(function(a,b){return void 0===b?a:a.concat(b)},[])}
function Gg(b,a){void 0===a&&(a=!0);var c,d=[],e=/\w+/g;for(c=e.exec(b);c;)a?d.push(c.index):d.push(c.index+c[0].length),c=e.exec(b);return d}function Hg(b,a){b=Gg(b,!0).reverse().find(function(b){return b<a});return void 0===b?0:b}function Ig(b,a){var c=Gg(b,!1).find(function(b){return b>a});return void 0===c?b.length:c}
function Jg(b){return""===b.trim()?!1:0!==(b.match(/'/g)||[]).length%2||0!==(b.match(/"/g)||[]).length%2||""===b.split(/(\|\||\||&&)/g).pop().trim()||b.endsWith("\\")&&!b.endsWith("\\\\")?!0:!1}function Kg(b){return null!==b.match(/[^\\][ \t]$/m)}function Lg(b){return""===b.trim()||Kg(b)?"":Eg(b).pop()||""}
function Mg(b,a){var c=Eg(a),d=c.length-1,e=c[d]||"";""===a.trim()?(d=0,e=""):Kg(a)&&(d+=1,e="");return b.reduce(function(a,b){try{var e=b(d,c);return a.concat(e)}catch(k){return console.error("Auto-complete error:",k),a}},[]).filter(function(a){return a.startsWith(e)})}
var Ng=function(){function b(a){this.size=a;this.entries=[];this.cursor=0}b.prototype.push=function(a){""!==a.trim()&&a!==this.entries[this.entries.length-1]&&(this.entries.push(a),this.entries.length>this.size&&this.entries.pop(),this.cursor=this.entries.length)};b.prototype.includes=function(a){return this.entries.includes(a)};b.prototype.rewind=function(){this.cursor=this.entries.length};b.prototype.getPrevious=function(){var a=Math.max(0,this.cursor-1);this.cursor=a;return this.entries[a]};b.prototype.getNext=
function(){var a=Math.min(this.entries.length,this.cursor+1);this.cursor=a;return this.entries[a]};return b}();
let Og=Symbol("Comlink.proxy"),Pg=Symbol("Comlink.endpoint"),Qg=Symbol("Comlink.releaseProxy"),Rg=new WeakSet,zh=new Map([["proxy",{canHandle:b=>b&&b[Og],serialize(b){const {port1:a,port2:c}=new MessageChannel;Sg(b,a);return[c,[c]]},deserialize:b=>{b.start();return yh(b,[],void 0)}}],["throw",{canHandle:b=>Rg.has(b),serialize(b){const a=b instanceof Error;let c=b;a&&(c={isError:a,message:b.message,stack:b.stack});return[c,[]]},deserialize(b){if(b.isError)throw Object.assign(Error(),b);throw b;}}]]);
function Sg(b,a=self){a.addEventListener("message",function e(d){if(d&&d.data){var {id:g,type:f,path:h}=Object.assign({path:[]},d.data),k=(d.data.argumentList||[]).map(Ah);try{let a=h.slice(0,-1).reduce((a,b)=>a[b],b),e=h.reduce((a,b)=>a[b],b);switch(f){case 0:var r=e;break;case 1:a[h.slice(-1)[0]]=Ah(d.data.value);r=!0;break;case 2:r=e.apply(a,k);break;case 3:{let a=new e(...k);r=Bh(a)}break;case 4:{let {port1:a,port2:d}=new MessageChannel;Sg(b,d);r=Ch(a,[a])}break;case 5:r=void 0}}catch(q){r=q,
Rg.add(q)}Promise.resolve(r).catch(a=>{Rg.add(a);return a}).then(b=>{let [d,h]=Dh(b);a.postMessage(Object.assign(Object.assign({},d),{id:g}),h);5===f&&(a.removeEventListener("message",e),"MessagePort"===a.constructor.name&&a.close())})}});a.start&&a.start()}function Eh(b){if(b)throw Error("Proxy has been released and is not useable");}
function yh(b,a=[],c=function(){}){let d=!1,e=new Proxy(c,{get(c,f){Eh(d);if(f===Qg)return()=>Fh(b,{type:5,path:a.map(a=>a.toString())}).then(()=>{"MessagePort"===b.constructor.name&&b.close();d=!0});if("then"===f){if(0===a.length)return{then:()=>e};c=Fh(b,{type:0,path:a.map(a=>a.toString())}).then(Ah);return c.then.bind(c)}return yh(b,[...a,f])},set(c,e,h){Eh(d);const [f,g]=Dh(h);return Fh(b,{type:1,path:[...a,e].map(a=>a.toString()),value:f},g).then(Ah)},apply(c,e,h){Eh(d);c=a[a.length-1];if(c===
Pg)return Fh(b,{type:4}).then(Ah);if("bind"===c)return yh(b,a.slice(0,-1));const [f,g]=Gh(h);return Fh(b,{type:2,path:a.map(a=>a.toString()),argumentList:f},g).then(Ah)},construct(c,e){Eh(d);const [f,g]=Gh(e);return Fh(b,{type:3,path:a.map(a=>a.toString()),argumentList:f},g).then(Ah)}});return e}function Gh(b){b=b.map(Dh);return[b.map(a=>a[0]),Array.prototype.concat.apply([],b.map(a=>a[1]))]}let Hh=new WeakMap;function Ch(b,a){Hh.set(b,a);return b}
function Bh(b){return Object.assign(b,{[Og]:!0})}function Dh(b){for(let [a,c]of zh)if(c.canHandle(b)){let [d,e]=c.serialize(b);return[{type:3,name:a,value:d},e]}return[{type:0,value:b},Hh.get(b)||[]]}function Ah(b){switch(b.type){case 3:return zh.get(b.name).deserialize(b.value);case 0:return b.value}}
function Fh(b,a,c){return new Promise(d=>{let e=Ih();b.addEventListener("message",function h(a){a.data&&a.data.id&&a.data.id===e&&(b.removeEventListener("message",h),d(a.data))});b.start&&b.start();b.postMessage(Object.assign({id:e},a),c)})}function Ih(){return Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Jh=Array.isArray||function(b){return"[object Array]"==Object.prototype.toString.call(b)};
function Kh(b,a){if(b.map)return b.map(a);for(var c=[],d=0;d<b.length;d++){var e=b[d];Lh.call(b,d)&&c.push(a(e,d,b))}return c}var Lh=Object.prototype.hasOwnProperty;function Mh(b,a){a?"string"==typeof a&&(a={startRule:a}):a={};return Nh.parse(b,a)}
var Nh=function(){function b(a,b,e,g,f,h){this.message=a;this.expected=b;this.found=e;this.offset=g;this.line=f;this.column=h;this.name="SyntaxError"}function a(c){function d(a){a=a.map(function(a){return Tg(a)?Hb(a):a});return ia(a)}function e(a,b,c,d){var e={type:"command",command:b,args:[],redirects:[],env:{},control:";",next:null};Yc(a,Ed).concat(Yc(c,Fd)).forEach(function(a){if(a&&a.type)switch(a.type){case "moveFd":case "duplicateFd":case "redirectFd":return e.redirects.push(a);case "variableAssignment":return e.env[a.name]=
a.value;default:e.args.push(a)}});d&&e.redirects.push(d[1]);return e}function g(a,b){var c=[a],d=a;Yc(b,function(a){for(var b=d;b.next;)b=b.next;b.control=a[1];c.push(d=a[3])});return c}function f(a){var b=[];Yc(a,function(a){b=b.concat(a[1])});return b}function h(a){if(uc!==a){uc>a&&(uc=0,ve={line:1,column:1,seenCR:!1});var b=ve,d;for(d=uc;d<a;d++){var e=c.charAt(d);"\n"===e?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===e||"\u2028"===e||"\u2029"===e?(b.line++,b.column=1,b.seenCR=!0):(b.column++,
b.seenCR=!1)}uc=a}return ve}function k(a){m<Zc||(m>Zc&&(Zc=m,we=[]),we.push(a))}function r(){var a,b;var c=m;var d=[];var e=m;var g=[];for(a=G();a!==p;)g.push(a),a=G();if(g!==p)if(a=q(),a!==p){var h=[];for(b=G();b!==p;)h.push(b),b=G();h!==p?e=g=[g,a,h]:(m=e,e=u)}else m=e,e=u;else m=e,e=u;if(e!==p)for(;e!==p;){d.push(e);e=m;g=[];for(a=G();a!==p;)g.push(a),a=G();if(g!==p)if(a=q(),a!==p){h=[];for(b=G();b!==p;)h.push(b),b=G();h!==p?e=g=[g,a,h]:(m=e,e=u)}else m=e,e=u;else m=e,e=u}else d=u;d!==p&&(F=c,
d=f(d));return d}function q(){var a,b;w++;var c=m;var d=t();if(d!==p){var e=[];var f=m;var h=[];for(a=J();a!==p;)h.push(a),a=J();if(h!==p)if(a=v(),a!==p){var l=[];for(b=G();b!==p;)l.push(b),b=G();l!==p?(b=t(),b!==p?f=h=[h,a,l,b]:(m=f,f=u)):(m=f,f=u)}else m=f,f=u;else m=f,f=u;for(;f!==p;){e.push(f);f=m;h=[];for(a=J();a!==p;)h.push(a),a=J();if(h!==p)if(a=v(),a!==p){l=[];for(b=G();b!==p;)l.push(b),b=G();l!==p?(b=t(),b!==p?f=h=[h,a,l,b]:(m=f,f=u)):(m=f,f=u)}else m=f,f=u;else m=f,f=u}if(e!==p){f=m;h=[];
for(a=J();a!==p;)h.push(a),a=J();h!==p?(a=v(),a!==p?f=h=[h,a]:(m=f,f=u)):(m=f,f=u);f===p&&(f=Ga);f!==p?(F=c,c=d=g(d,e)):(m=c,c=u)}else m=c,c=u}else m=c,c=u;w--;c===p&&0===w&&k(Dc);return c}function t(){var a=m;var b=l();if(b===p&&(b=B(),b===p)){var d;var e=m;c.substr(m,5)===Sb?(b=Sb,m+=5):(b=p,0===w&&k(Rc));b===p&&(c.substr(m,5)===Ub?(b=Ub,m+=5):(b=p,0===w&&k(sc)));if(b!==p){var f=[];var g=G();if(g!==p)for(;g!==p;)f.push(g),g=G();else f=u;if(f!==p)if(g=y(),g!==p){f=[];for(d=G();d!==p;)f.push(d),d=
G();f!==p?(c.substr(m,2)===Z?(d=Z,m+=2):(d=p,0===w&&k(tc)),d!==p?(f=G(),f!==p?(f=r(),f!==p?(c.substr(m,4)===Pc?(d=Pc,m+=4):(d=p,0===w&&k(gb)),d!==p?(F=e,e=b={type:b+"-loop",test:g,body:f}):(m=e,e=u)):(m=e,e=u)):(m=e,e=u)):(m=e,e=u)):(m=e,e=u)}else m=e,e=u;else m=e,e=u}else m=e,e=u;b=e;if(b===p){e=m;c.substr(m,2)===Xa?(b=Xa,m+=2):(b=p,0===w&&k(hb));if(b!==p){g=[];b=G();if(b!==p)for(;b!==p;)g.push(b),b=G();else g=u;if(g!==p)if(b=r(),b!==p)if(c.substr(m,4)===Tb?(g=Tb,m+=4):(g=p,0===w&&k(Ya)),g!==p){f=
[];g=G();if(g!==p)for(;g!==p;)f.push(g),g=G();else f=u;if(f!==p)if(g=r(),g!==p){f=[];for(d=n();d!==p;)f.push(d),d=n();if(f!==p){d=m;if(c.substr(m,4)===ib){var h=ib;m+=4}else h=p,0===w&&k(xg);if(h!==p){var q=r();q!==p?d=h=[h,q]:(m=d,d=u)}else m=d,d=u;d===p&&(d=Ga);d!==p?(c.substr(m,2)===Sc?(h=Sc,m+=2):(h=p,0===w&&k(Tc)),h!==p?(F=e,e=b={type:"ifElse",test:b,body:g,elifBlocks:f.length?f:null,elseBody:d?d[1]:null}):(m=e,e=u)):(m=e,e=u)}else m=e,e=u}else m=e,e=u;else m=e,e=u}else m=e,e=u;else m=e,e=u;
else m=e,e=u}else m=e,e=u;b=e}}if(b!==p){e=m;g=[];for(f=J();f!==p;)g.push(f),f=J();if(g!==p){f=m;c.substr(m,2)===dc?(d=dc,m+=2):(d=p,0===w&&k(Bc));d===p&&(c.substr(m,2)===ec?(d=ec,m+=2):(d=p,0===w&&k(Ac)));if(d!==p){h=[];for(q=G();q!==p;)h.push(q),q=G();h!==p?(q=t(),q!==p?(F=f,f=d=[d,q]):(m=f,f=u)):(m=f,f=u)}else m=f,f=u;f!==p?e=g=[g,f]:(m=e,e=u)}else m=e,e=u;e===p&&(e=Ga);e!==p?(F=a,a=b,"undefined"!==typeof e&&e?(e=e[1],a.control=e[0],a.next=e[1]):(a.control=";",a.next=null)):(m=a,a=u)}else m=a,
a=u;return a}function v(){var a=m;if(38===c.charCodeAt(m)){var b=Gd;m++}else b=p,0===w&&k(Cc);b===p&&(59===c.charCodeAt(m)?(b=Hd,m++):(b=p,0===w&&k(Qc)),b===p&&(10===c.charCodeAt(m)?(b=qc,m++):(b=p,0===w&&k(rc))));b!==p&&(F=a,b="\n"==b?";":b);return b}function l(){w++;var a=m;var b=[];var d=m;var f=B();f===p&&(f=ya());if(f!==p){var g=[];var h=J();if(h!==p)for(;h!==p;)g.push(h),h=J();else g=u;g!==p?d=f=[f,g]:(m=d,d=u)}else m=d,d=u;for(;d!==p;)if(b.push(d),d=m,f=B(),f===p&&(f=ya()),f!==p){g=[];h=J();
if(h!==p)for(;h!==p;)g.push(h),h=J();else g=u;g!==p?d=f=[f,g]:(m=d,d=u)}else m=d,d=u;if(b!==p)if(d=O(),d===p&&(d=X()),d!==p){f=[];g=m;h=[];var n=J();if(n!==p)for(;n!==p;)h.push(n),n=J();else h=u;h!==p?(n=ya(),n===p&&(n=M()),n!==p?g=h=[h,n]:(m=g,g=u)):(m=g,g=u);for(;g!==p;){f.push(g);g=m;h=[];n=J();if(n!==p)for(;n!==p;)h.push(n),n=J();else h=u;h!==p?(n=ya(),n===p&&(n=M()),n!==p?g=h=[h,n]:(m=g,g=u)):(m=g,g=u)}if(f!==p){g=m;h=[];for(n=J();n!==p;)h.push(n),n=J();if(h!==p){var q;n=m;if(124===c.charCodeAt(m)){var r=
Wj;m++}else r=p,0===w&&k(Xj);if(r!==p){r=[];for(q=G();q!==p;)r.push(q),q=G();r!==p?(q=l(),q!==p?(F=n,n=r={type:"pipe",command:q}):(m=n,n=u)):(m=n,n=u)}else m=n,n=u;n!==p?g=h=[h,n]:(m=g,g=u)}else m=g,g=u;g===p&&(g=Ga);g!==p?(F=a,a=b=e(b,d,f,g)):(m=a,a=u)}else m=a,a=u}else m=a,a=u;else m=a,a=u;w--;a===p&&0===w&&k(ne);return a}function n(){var a=m;if(c.substr(m,4)===Uc){var b=Uc;m+=4}else b=p,0===w&&k(yg);if(b!==p){var d=[];b=G();if(b!==p)for(;b!==p;)d.push(b),b=G();else d=u;if(d!==p)if(b=y(),b!==p)if(c.substr(m,
4)===Tb?(d=Tb,m+=4):(d=p,0===w&&k(Ya)),d!==p){d=[];var e=G();if(e!==p)for(;e!==p;)d.push(e),e=G();else d=u;d!==p?(e=r(),e!==p?(F=a,a=b={type:"ifElse",test:b,body:e}):(m=a,a=u)):(m=a,a=u)}else m=a,a=u;else m=a,a=u;else m=a,a=u}else m=a,a=u;return a}function y(){var a=m;var b=r();b!==p&&(F=a);return b}function B(){var a=m;var b=Sa();if(b!==p){if(61===c.charCodeAt(m)){var d=Cj;m++}else d=p,0===w&&k(Dj);d!==p?(d=M(),d!==p?(F=a,a=b={type:"variableAssignment",name:b,value:d}):(m=a,a=u)):(m=a,a=u)}else m=
a,a=u;return a}function O(){var a;w++;var b=a=m;w++;var c=ya();w--;c===p?b=Ha:(m=b,b=u);if(b!==p)if(c=m,w++,b=da(),w--,b===p?c=Ha:(m=c,c=u),c!==p)if(b=m,w++,c=B(),w--,c===p?b=Ha:(m=b,b=u),b!==p){c=m;b=[];var d=H();d===p&&(d=ha(),d===p&&(d=Fa(),d===p&&(d=xa(),d===p&&(d=ma(),d===p&&(d=ra(),d===p&&(d=I()))))));if(d!==p)for(;d!==p;)b.push(d),d=H(),d===p&&(d=ha(),d===p&&(d=Fa(),d===p&&(d=xa(),d===p&&(d=ma(),d===p&&(d=ra(),d===p&&(d=I()))))));else b=u;b!==p&&(F=c,b=ia(b));c=b;c===p&&(c=X());c!==p?(F=a,
a=c):(m=a,a=u)}else m=a,a=u;else m=a,a=u;else m=a,a=u;w--;a===p&&0===w&&k(Ej);return a}function X(){if(91===c.charCodeAt(m)){var a=zg;m++}else a=p,0===w&&k(Ag);a===p&&(c.substr(m,2)===Vc?(a=Vc,m+=2):(a=p,0===w&&k(Bg)));return a}function M(){w++;var a=O();if(a===p){a=m;if(Yj.test(c.charAt(m))){var b=c.charAt(m);m++}else b=p,0===w&&k(Zj);if(b!==p){if(40===c.charCodeAt(m)){var d=Ug;m++}else d=p,0===w&&k(Vg);if(d!==p)if(d=q(),d!==p){if(41===c.charCodeAt(m)){var e=Wg;m++}else e=p,0===w&&k(Xg);e!==p?(F=
a,a=b={type:"processSubstitution",readWrite:b,commands:d}):(m=a,a=u)}else m=a,a=u;else m=a,a=u}else m=a,a=u}w--;a===p&&0===w&&k(oe);return a}function ha(){var a=m;var b=[];var c=R();if(c!==p)for(;c!==p;)b.push(c),c=R();else b=u;b!==p&&(F=a,b=Hb(b));return b}function R(){var a=m;if(92===c.charCodeAt(m)){var b=Yg;m++}else b=p,0===w&&k(Zg);if(b!==p){var d=C();d!==p?(F=a,a=d):(m=a,a=u)}else m=a,a=u;a===p&&(b=a=m,w++,d=C(),w--,d===p?b=Ha:(m=b,b=u),b!==p?(c.length>m?(d=c.charAt(m),m++):(d=p,0===w&&k(Za)),
d!==p?(F=a,a=d):(m=a,a=u)):(m=a,a=u));return a}function C(){if(ak.test(c.charAt(m))){var a=c.charAt(m);m++}else a=p,0===w&&k(bk);return a}function H(){var a;var b=m;var d=[];for(a=R();a!==p;)d.push(a),a=R();if(d!==p){a=[];42===c.charCodeAt(m)?(d=$g,m++):(d=p,0===w&&k(ah));d===p&&(63===c.charCodeAt(m)?(d=xe,m++):(d=p,0===w&&k(ye)),d===p&&(d=qa(),d===p&&(d=V())));if(d!==p)for(;d!==p;)a.push(d),42===c.charCodeAt(m)?(d=$g,m++):(d=p,0===w&&k(ah)),d===p&&(63===c.charCodeAt(m)?(d=xe,m++):(d=p,0===w&&k(ye)),
d===p&&(d=qa(),d===p&&(d=V())));else a=u;if(a!==p){d=[];for(a=R();a!==p;)d.push(a),a=R();d!==p?(F=b,b=d={type:"glob",value:c.substring(F,m)}):(m=b,b=u)}else m=b,b=u}else m=b,b=u;return b}function qa(){var a;var b=a=m;if(91===c.charCodeAt(m)){var d=zg;m++}else d=p,0===w&&k(Ag);if(d!==p){var e=m;w++;if(45===c.charCodeAt(m)){var f=$c;m++}else f=p,0===w&&k(ad);w--;f===p?e=Ha:(m=e,e=u);if(e!==p)if(c.length>m?(f=c.charAt(m),m++):(f=p,0===w&&k(Za)),f!==p){if(45===c.charCodeAt(m)){var g=$c;m++}else g=p,0===
w&&k(ad);if(g!==p){var h=m;w++;if(45===c.charCodeAt(m)){var l=$c;m++}else l=p,0===w&&k(ad);w--;l===p?h=Ha:(m=h,h=u);if(h!==p)if(c.length>m?(l=c.charAt(m),m++):(l=p,0===w&&k(Za)),l!==p){if(93===c.charCodeAt(m)){var n=ck;m++}else n=p,0===w&&k(dk);n!==p?b=d=[d,e,f,g,h,l,n]:(m=b,b=u)}else m=b,b=u;else m=b,b=u}else m=b,b=u}else m=b,b=u;else m=b,b=u}else m=b,b=u;b!==p&&(b=c.substring(a,m));return b}function V(){var a;var b=a=m;if(c.length>m){var d=c.charAt(m);m++}else d=p,0===w&&k(Za);d===p&&(d=Ga);if(d!==
p){var e=m;w++;if(36===c.charCodeAt(m)){var f=ze;m++}else f=p,0===w&&k(Ae);w--;f===p?e=Ha:(m=e,e=u);e!==p?b=d=[d,e]:(m=b,b=u)}else m=b,b=u;if(b!==p)if(123===c.charCodeAt(m)?(d=ek,m++):(d=p,0===w&&k(fk)),d!==p){e=[];f=R();if(f!==p)for(;f!==p;)e.push(f),f=R();else e=u;e!==p?(125===c.charCodeAt(m)?(f=bh,m++):(f=p,0===w&&k(ch)),f!==p?a=b=[b,d,e,f]:(m=a,a=u)):(m=a,a=u)}else m=a,a=u;else m=a,a=u;return a}function ra(){var a=m;if(39===c.charCodeAt(m)){var b=Be;m++}else b=p,0===w&&k(Ce);if(b!==p){b=m;var d=
[];if(dh.test(c.charAt(m))){var e=c.charAt(m);m++}else e=p,0===w&&k(eh);for(;e!==p;)d.push(e),dh.test(c.charAt(m))?(e=c.charAt(m),m++):(e=p,0===w&&k(eh));d!==p&&(d=c.substring(b,m));b=d;b!==p?(39===c.charCodeAt(m)?(d=Be,m++):(d=p,0===w&&k(Ce)),d!==p?(F=a,a=b=Hb(b)):(m=a,a=u)):(m=a,a=u)}else m=a,a=u;return a}function I(){var a=m;if(34===c.charCodeAt(m)){var b=bd;m++}else b=p,0===w&&k(cd);if(b!==p){b=[];var e=ja();if(e===p){e=[];var f=sa();if(f!==p)for(;f!==p;)e.push(f),f=sa();else e=u}for(;e!==p;)if(b.push(e),
e=ja(),e===p)if(e=[],f=sa(),f!==p)for(;f!==p;)e.push(f),f=sa();else e=u;b!==p?(34===c.charCodeAt(m)?(e=bd,m++):(e=p,0===w&&k(cd)),e!==p?(F=a,a=b=d(b)):(m=a,a=u)):(m=a,a=u)}else m=a,a=u;return a}function sa(){var a=m;if(92===c.charCodeAt(m)){var b=Yg;m++}else b=p,0===w&&k(Zg);if(b!==p){var d=ta();d!==p?(F=a,a=d):(m=a,a=u)}else m=a,a=u;a===p&&(a=m,c.substr(m,2)===dd?(b=dd,m+=2):(b=p,0===w&&k(fh)),b!==p&&(F=a,b="\\"),a=b,a===p&&(b=a=m,w++,d=ta(),w--,d===p?b=Ha:(m=b,b=u),b!==p?(c.length>m?(d=c.charAt(m),
m++):(d=p,0===w&&k(Za)),d!==p?(F=a,a=d):(m=a,a=u)):(m=a,a=u)));return a}function ta(){if(34===c.charCodeAt(m)){var a=bd;m++}else a=p,0===w&&k(cd);a===p&&(36===c.charCodeAt(m)?(a=ze,m++):(a=p,0===w&&k(Ae)),a===p&&(96===c.charCodeAt(m)?(a=vc,m++):(a=p,0===w&&k(wc))));return a}function ja(){var a=ma();a===p&&(a=Fa(),a===p&&(a=xa()));return a}function Fa(){var a=m;if(36===c.charCodeAt(m)){var b=ze;m++}else b=p,0===w&&k(Ae);b!==p?(b=Sa(),b===p&&(63===c.charCodeAt(m)?(b=xe,m++):(b=p,0===w&&k(ye))),b!==
p?(F=a,a=b={type:"variable",name:b}):(m=a,a=u)):(m=a,a=u);return a}function Sa(){var a=m;var b=[];if(gh.test(c.charAt(m))){var d=c.charAt(m);m++}else d=p,0===w&&k(hh);if(d!==p)for(;d!==p;)b.push(d),gh.test(c.charAt(m))?(d=c.charAt(m),m++):(d=p,0===w&&k(hh));else b=u;b!==p&&(F=a,b=c.substring(F,m));return b}function xa(){var a=m;if(c.substr(m,2)===ed){var b=ed;m+=2}else b=p,0===w&&k(ih);if(b!==p){b=[];if(jh.test(c.charAt(m))){var d=c.charAt(m);m++}else d=p,0===w&&k(kh);for(;d!==p;)b.push(d),jh.test(c.charAt(m))?
(d=c.charAt(m),m++):(d=p,0===w&&k(kh));b!==p?(125===c.charCodeAt(m)?(d=bh,m++):(d=p,0===w&&k(ch)),d!==p?(F=a,a=b={type:"variableSubstitution",expression:b.join("")}):(m=a,a=u)):(m=a,a=u)}else m=a,a=u;return a}function ma(){var b=m;if(c.substr(m,2)===fd){var d=fd;m+=2}else d=p,0===w&&k(lh);if(d!==p)if(d=q(),d!==p){if(41===c.charCodeAt(m)){var e=Wg;m++}else e=p,0===w&&k(Xg);e!==p?(F=b,b=d={type:"commandSubstitution",commands:d}):(m=b,b=u)}else m=b,b=u;else m=b,b=u;if(b===p)if(b=m,96===c.charCodeAt(m)?
(d=vc,m++):(d=p,0===w&&k(wc)),d!==p){d=[];e=P();if(e!==p)for(;e!==p;)d.push(e),e=P();else d=u;d!==p?(96===c.charCodeAt(m)?(e=vc,m++):(e=p,0===w&&k(wc)),e!==p?(F=b,b=d={type:"commandSubstitution",commands:a(d.join(""))}):(m=b,b=u)):(m=b,b=u)}else m=b,b=u;return b}function P(){var a=m;if(c.substr(m,2)===mh){var b=mh;m+=2}else b=p,0===w&&k(gk);b!==p&&(F=a,b="`");a=b;if(a===p&&(a=m,c.substr(m,2)===dd?(b=dd,m+=2):(b=p,0===w&&k(fh)),b!==p&&(F=a,b="\\"),a=b,a===p)){b=a=m;w++;if(96===c.charCodeAt(m)){var d=
vc;m++}else d=p,0===w&&k(wc);w--;d===p?b=Ha:(m=b,b=u);b!==p?(c.length>m?(d=c.charAt(m),m++):(d=p,0===w&&k(Za)),d!==p?(F=a,a=d):(m=a,a=u)):(m=a,a=u)}return a}function ya(){var a=m;var b=ua();b===p&&(b=Ga);if(b!==p){if(c.substr(m,2)===gd){var d=gd;m+=2}else d=p,0===w&&k(nh);d===p&&(c.substr(m,2)===hd?(d=hd,m+=2):(d=p,0===w&&k(oh)));if(d!==p){var e=ua();if(e!==p){if(45===c.charCodeAt(m)){var f=$c;m++}else f=p,0===w&&k(ad);f!==p?(F=a,a=b,null==a&&(a="<"==d[0]?0:1),a=b={type:"moveFd",fd:a,op:d,dest:e}):
(m=a,a=u)}else m=a,a=u}else m=a,a=u}else m=a,a=u;d=a;if(d===p){a=m;b=ua();b===p&&(b=Ga);if(b!==p)if(c.substr(m,2)===gd?(d=gd,m+=2):(d=p,0===w&&k(nh)),d===p&&(c.substr(m,2)===hd?(d=hd,m+=2):(d=p,0===w&&k(oh))),d!==p){f=[];for(e=J();e!==p;)f.push(e),e=J();f!==p?(e=ua(),e!==p?(F=a,a=b,null==a&&(a="<"==d[0]?0:1),a=b={type:"duplicateFd",srcFd:a,op:d,destFd:e}):(m=a,a=u)):(m=a,a=u)}else m=a,a=u;else m=a,a=u;d=a;if(d===p)if(d=m,e=ua(),e===p&&(e=Ga),e!==p)if(60===c.charCodeAt(m)?(a=hk,m++):(a=p,0===w&&k(ik)),
a===p&&(62===c.charCodeAt(m)?(a=jk,m++):(a=p,0===w&&k(kk)),a===p&&(c.substr(m,2)===ph?(a=ph,m+=2):(a=p,0===w&&k(lk)),a===p&&(c.substr(m,2)===qh?(a=qh,m+=2):(a=p,0===w&&k(mk)),a===p&&(c.substr(m,2)===rh?(a=rh,m+=2):(a=p,0===w&&k(nk)),a===p&&(c.substr(m,3)===sh?(a=sh,m+=3):(a=p,0===w&&k(ok))))))),a!==p){f=[];for(b=J();b!==p;)f.push(b),b=J();f!==p?(b=M(),b!==p?(F=d,d=e,null==d&&(d="<"==a[0]?0:1),d=e={type:"redirectFd",fd:d,op:a,filename:b}):(m=d,d=u)):(m=d,d=u)}else m=d,d=u;else m=d,d=u}return d}function ua(){var a=
m;var b=[];if(th.test(c.charAt(m))){var d=c.charAt(m);m++}else d=p,0===w&&k(uh);if(d!==p)for(;d!==p;)b.push(d),th.test(c.charAt(m))?(d=c.charAt(m),m++):(d=p,0===w&&k(uh));else b=u;b!==p&&(F=a,b=parseInt(b.join(""),10));return b}function J(){if(32===c.charCodeAt(m)){var a=pk;m++}else a=p,0===w&&k(qk);a===p&&(9===c.charCodeAt(m)?(a=rk,m++):(a=p,0===w&&k(sk)));return a}function G(){var a=J();a===p&&(10===c.charCodeAt(m)?(a=qc,m++):(a=p,0===w&&k(rc)));return a}function da(){var a=m;if(c.substr(m,5)===
Sb){var b=Sb;m+=5}else b=p,0===w&&k(Rc);b===p&&(c.substr(m,5)===Ub?(b=Ub,m+=5):(b=p,0===w&&k(sc)),b===p&&(c.substr(m,3)===vh?(b=vh,m+=3):(b=p,0===w&&k(tk)),b===p&&(c.substr(m,4)===Pc?(b=Pc,m+=4):(b=p,0===w&&k(gb)),b===p&&(c.substr(m,2)===Z?(b=Z,m+=2):(b=p,0===w&&k(tc)),b===p&&(c.substr(m,4)===wh?(b=wh,m+=4):(b=p,0===w&&k(uk)),b===p&&(c.substr(m,4)===xh?(b=xh,m+=4):(b=p,0===w&&k(vk)),b===p&&(c.substr(m,2)===Xa?(b=Xa,m+=2):(b=p,0===w&&k(hb)),b===p&&(c.substr(m,4)===Tb?(b=Tb,m+=4):(b=p,0===w&&k(Ya)),
b===p&&(c.substr(m,4)===ib?(b=ib,m+=4):(b=p,0===w&&k(xg)),b===p&&(c.substr(m,4)===Uc?(b=Uc,m+=4):(b=p,0===w&&k(yg)),b===p&&(c.substr(m,2)===Sc?(b=Sc,m+=2):(b=p,0===w&&k(Tc)),b===p&&(c.substr(m,2)===Vc?(b=Vc,m+=2):(b=p,0===w&&k(Bg))))))))))))));if(b!==p){var d=[];var e=G();if(e!==p)for(;e!==p;)d.push(e),e=G();else d=u;d===p&&(d=m,w++,c.length>m?(e=c.charAt(m),m++):(e=p,0===w&&k(Za)),w--,e===p?d=Ha:(m=d,d=u));d!==p?a=b=[b,d]:(m=a,a=u)}else m=a,a=u;return a}function Hb(a){return{type:"literal",value:Tg(a)?
a.join(""):a}}function Ed(a){return a[0]}function Fd(a){return a[1]}function ia(a){for(var b=[a[0]],c=a.length,d=a[0],e,f=1;f<c;f++)e=a[f],"concatenation"==e.type&&(e=ia(e.pieces)),"concatenation"==e.type?b=b.concat(e.pieces):"literal"!=e.type&&"glob"!=e.type||"literal"!=d.type&&"glob"!=d.type?(b.push(e),d=e):(d.value+=e.value,"glob"!=d.type&&"glob"==e.type&&(d.type="glob"));return 1==b.length?b[0]:{type:"concatenation",pieces:b}}var qb=1<arguments.length?arguments[1]:{},p={},za={script:r,command:l,
argument:M,continuationStart:function(){var a;var b=a=m;w++;var d=da();d===p&&(34===c.charCodeAt(m)?(d=bd,m++):(d=p,0===w&&k(cd)),d===p&&(39===c.charCodeAt(m)?(d=Be,m++):(d=p,0===w&&k(Ce)),d===p&&(96===c.charCodeAt(m)?(d=vc,m++):(d=p,0===w&&k(wc)),d===p&&(c.substr(m,2)===fd?(d=fd,m+=2):(d=p,0===w&&k(lh)),d===p&&(c.substr(m,2)===ed?(d=ed,m+=2):(d=p,0===w&&k(ih)),d===p&&(40===c.charCodeAt(m)?(d=Ug,m++):(d=p,0===w&&k(Vg))))))));w--;d!==p?(m=b,b=Ha):b=u;if(b!==p){d=[];if(c.length>m){var e=c.charAt(m);
m++}else e=p,0===w&&k(Za);for(;e!==p;)d.push(e),c.length>m?(e=c.charAt(m),m++):(e=p,0===w&&k(Za));d!==p?a=b=[b,d]:(m=a,a=u)}else m=a,a=u;return a}},Ia=r,u=p,Dc={type:"other",description:"a list of statements"},Ga=null,dc="&&",Bc={type:"literal",value:"&&",description:'"&&"'},ec="||",Ac={type:"literal",value:"||",description:'"||"'},Gd="&",Cc={type:"literal",value:"&",description:'"&"'},Hd=";",Qc={type:"literal",value:";",description:'";"'},qc="\n",rc={type:"literal",value:"\n",description:'"\\n"'},
ne={type:"other",description:"a single command"},Sb="while",Rc={type:"literal",value:"while",description:'"while"'},Ub="until",sc={type:"literal",value:"until",description:'"until"'},Z="do",tc={type:"literal",value:"do",description:'"do"'},Pc="done",gb={type:"literal",value:"done",description:'"done"'},Xa="if",hb={type:"literal",value:"if",description:'"if"'},Tb="then",Ya={type:"literal",value:"then",description:'"then"'},ib="else",xg={type:"literal",value:"else",description:'"else"'},Sc="fi",Tc=
{type:"literal",value:"fi",description:'"fi"'},Uc="elif",yg={type:"literal",value:"elif",description:'"elif"'},Cj="=",Dj={type:"literal",value:"=",description:'"="'},Ej={type:"other",description:"command name"},Ha=void 0,zg="[",Ag={type:"literal",value:"[",description:'"["'},Vc="[[",Bg={type:"literal",value:"[[",description:'"[["'},oe={type:"other",description:"command argument"},Yg="\\",Zg={type:"literal",value:"\\",description:'"\\\\"'},Za={type:"any",description:"any character"},ak=/^[$"';&<>\n()[*?|` ]/,
bk={type:"class",value:"[$\"';&<>\\n()[*?|` ]",description:"[$\"';&<>\\n()[*?|` ]"},$g="*",ah={type:"literal",value:"*",description:'"*"'},xe="?",ye={type:"literal",value:"?",description:'"?"'},$c="-",ad={type:"literal",value:"-",description:'"-"'},ck="]",dk={type:"literal",value:"]",description:'"]"'},ze="$",Ae={type:"literal",value:"$",description:'"$"'},ek="{",fk={type:"literal",value:"{",description:'"{"'},bh="}",ch={type:"literal",value:"}",description:'"}"'},Be="'",Ce={type:"literal",value:"'",
description:'"\'"'},dh=/^[^']/,eh={type:"class",value:"[^']",description:"[^']"},bd='"',cd={type:"literal",value:'"',description:'"\\""'},dd="\\\\",fh={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},vc="`",wc={type:"literal",value:"`",description:'"`"'},gh=/^[a-zA-Z0-9_]/,hh={type:"class",value:"[a-zA-Z0-9_]",description:"[a-zA-Z0-9_]"},ed="${",ih={type:"literal",value:"${",description:'"${"'},jh=/^[^}]/,kh={type:"class",value:"[^}]",description:"[^}]"},fd="$(",lh={type:"literal",value:"$(",
description:'"$("'},Wg=")",Xg={type:"literal",value:")",description:'")"'},mh="\\`",gk={type:"literal",value:"\\`",description:'"\\\\`"'},Yj=/^[<>]/,Zj={type:"class",value:"[<>]",description:"[<>]"},Ug="(",Vg={type:"literal",value:"(",description:'"("'},Wj="|",Xj={type:"literal",value:"|",description:'"|"'},gd="<&",nh={type:"literal",value:"<&",description:'"<&"'},hd=">&",oh={type:"literal",value:">&",description:'">&"'},hk="<",ik={type:"literal",value:"<",description:'"<"'},jk=">",kk={type:"literal",
value:">",description:'">"'},ph=">|",lk={type:"literal",value:">|",description:'">|"'},qh="&>",mk={type:"literal",value:"&>",description:'"&>"'},rh=">>",nk={type:"literal",value:">>",description:'">>"'},sh="&>>",ok={type:"literal",value:"&>>",description:'"&>>"'},th=/^[0-9]/,uh={type:"class",value:"[0-9]",description:"[0-9]"},pk=" ",qk={type:"literal",value:" ",description:'" "'},rk="\t",sk={type:"literal",value:"\t",description:'"\\t"'},vh="for",tk={type:"literal",value:"for",description:'"for"'},
wh="case",uk={type:"literal",value:"case",description:'"case"'},xh="esac",vk={type:"literal",value:"esac",description:'"esac"'},m=0,F=0,uc=0,ve={line:1,column:1,seenCR:!1},Zc=0,we=[],w=0;if("startRule"in qb){if(!(qb.startRule in za))throw Error("Can't start parsing from rule \""+qb.startRule+'".');Ia=za[qb.startRule]}var Tg=Jh,Yc=Kh;var De=Ia();if(De!==p&&m===c.length)return De;De!==p&&m<c.length&&k({type:"end",description:"end of input"});throw function(a,d,e){function f(a){var b=1;for(a.sort(function(a,
b){return a.description<b.description?-1:a.description>b.description?1:0});b<a.length;)a[b-1]===a[b]?a.splice(b,1):b++}function g(a,b){function c(a){function b(a){return a.charCodeAt(0).toString(16).toUpperCase()}return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(a){return"\\x0"+b(a)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(a){return"\\x"+b(a)}).replace(/[\u0180-\u0FFF]/g,
function(a){return"\\u0"+b(a)}).replace(/[\u1080-\uFFFF]/g,function(a){return"\\u"+b(a)})}var d=Array(a.length),e;for(e=0;e<a.length;e++)d[e]=a[e].description;a=1<a.length?d.slice(0,-1).join(", ")+" or "+d[a.length-1]:d[0];b=b?'"'+c(b)+'"':"end of input";return"Expected "+a+" but "+b+" found."}var k=h(e),l=e<c.length?c.charAt(e):null;null!==d&&f(d);return new b(null!==a?a:g(d,l),d,l,e,k.line,k.column)}(null,we,Zc);}(function(a,b){function c(){this.constructor=a}c.prototype=b.prototype;a.prototype=
new c})(b,Error);return{SyntaxError:b,parse:a}}(),SyntaxError=Nh.SyntaxError;Mh.SyntaxError=SyntaxError;var Oh={FILE_PATH:{DEVICE_FRAMEBUFFER_ZERO:{PATH:"/_wasmer/dev/fb0",FRAME_BUFFER:"/_wasmer/dev/fb0/fb",VIRTUAL_SIZE:"/_wasmer/dev/fb0/virtual_size",DRAW:"/_wasmer/dev/fb0/draw",INPUT:"/_wasmer/dev/fb0/input"}}},Ph=void 0;"object"===typeof window?Ph=window.TextDecoder:"object"===typeof self?Ph=self.TextDecoder:"function"===typeof require&&(Ph=require("util").TextDecoder);
var Qh=function(){function b(a){this.wasmFs=a;this.wasmFs.volume.mkdirSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.PATH,{recursive:!0});this.wasmFs.volume.writeFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.FRAME_BUFFER,"");this.wasmFs.volume.writeFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.VIRTUAL_SIZE,"");this.wasmFs.volume.writeFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.DRAW,"");this.wasmFs.volume.writeFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.INPUT,"");this.windowSizeCallback=function(){};
this.bufferIndexDisplayCallback=function(){};this.inputCallback=function(){return new Uint8Array};this.fdFrameBuffer=this.wasmFs.volume.openSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.FRAME_BUFFER,"w+");this.fdBufferIndexDisplay=this.wasmFs.volume.openSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.DRAW,"w+");this.fdWindowSize=this.wasmFs.fs.openSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.VIRTUAL_SIZE,"w+");this.fdInput=this.wasmFs.volume.openSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.INPUT,"w+");var b=this,
d=this.wasmFs.volume.fds[this.fdInput].node.read;this.wasmFs.volume.fds[this.fdInput].node.read=function(){var a=b.inputCallback();b.wasmFs.volume.writeFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.INPUT,a);a=Array.prototype.slice.call(arguments);return d.apply(b.wasmFs.volume.fds[b.fdInput].node,a)};var e=this.wasmFs.volume.fds[this.fdWindowSize].node.write;this.wasmFs.volume.fds[this.fdWindowSize].node.write=function(){var a=Array.prototype.slice.call(arguments);a=e.apply(b.wasmFs.volume.fds[b.fdWindowSize].node,
a);b.windowSizeCallback();return a};var g=this.wasmFs.volume.fds[this.fdBufferIndexDisplay].node.write;this.wasmFs.volume.fds[this.fdBufferIndexDisplay].node.write=function(){var a=Array.prototype.slice.call(arguments);a=g.apply(b.wasmFs.volume.fds[b.fdBufferIndexDisplay].node,a);b.bufferIndexDisplayCallback();return a}}b.prototype.getFrameBuffer=function(){return this.wasmFs.fs.readFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.FRAME_BUFFER)};b.prototype.getWindowSize=function(){var a=this.wasmFs.fs.readFileSync(Oh.FILE_PATH.DEVICE_FRAMEBUFFER_ZERO.VIRTUAL_SIZE);
return 0<a.length?(a=(new Ph("utf-8")).decode(a).split("x"),[parseInt(a[0],10),parseInt(a[1],10)]):[0,0]};b.prototype.setWindowSizeCallback=function(a){this.windowSizeCallback=a};b.prototype.setBufferIndexDisplayCallback=function(a){this.bufferIndexDisplayCallback=a};b.prototype.setInputCallback=function(a){this.inputCallback=a};return b}();
function Rh(b,a){Rh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return Rh(b,a)}function Sh(b,a){function c(){this.constructor=b}Rh(b,a);b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function Th(b){var a="function"===typeof Symbol&&b[Symbol.iterator],c=0;return a?a.call(b):{next:function(){b&&c>=b.length&&(b=void 0);return{value:b&&b[c++],done:!b}}}}
function Uh(b,a){var c="function"===typeof Symbol&&b[Symbol.iterator];if(!c)return b;b=c.call(b);var d,e=[];try{for(;(void 0===a||0<a--)&&!(d=b.next()).done;)e.push(d.value)}catch(f){var g={error:f}}finally{try{d&&!d.done&&(c=b["return"])&&c.call(b)}finally{if(g)throw g.error;}}return e}function Vh(){for(var b=[],a=0;a<arguments.length;a++)b=b.concat(Uh(arguments[a]));return b}
var Wh="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof pa?pa:{},S="undefined"!==typeof BigInt?BigInt:Wh.BigInt||Number,Xh=DataView;
Xh.prototype.setBigUint64||(Xh.prototype.setBigUint64=function(b,a,c){if(a<Math.pow(2,32)){a=Number(a);var d=0}else{d=a.toString(2);a="";for(var e=0;e<64-d.length;e++)a+="0";a+=d;d=parseInt(a.substring(0,32),2);a=parseInt(a.substring(32),2)}this.setUint32(b+(c?0:4),a,c);this.setUint32(b+(c?4:0),d,c)},Xh.prototype.getBigUint64=function(b,a){var c=this.getUint32(b+(a?0:4),a);b=this.getUint32(b+(a?4:0),a);c=c.toString(2);b=b.toString(2);a="";for(var d=0;d<32-c.length;d++)a+="0";return S("0b"+b+(a+c))});
var Yh="undefined"!==typeof pa?pa:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},Zh=[],$h=[],ai="undefined"!==typeof Uint8Array?Uint8Array:Array,bi=!1;function ci(){bi=!0;for(var b=0;64>b;++b)Zh[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b],$h["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]=b;$h[45]=62;$h[95]=63}
function di(b,a,c){for(var d=[],e=a;e<c;e+=3)a=(b[e]<<16)+(b[e+1]<<8)+b[e+2],d.push(Zh[a>>18&63]+Zh[a>>12&63]+Zh[a>>6&63]+Zh[a&63]);return d.join("")}function ei(b){bi||ci();for(var a=b.length,c=a%3,d="",e=[],g=0,f=a-c;g<f;g+=16383)e.push(di(b,g,g+16383>f?f:g+16383));1===c?(b=b[a-1],d+=Zh[b>>2],d+=Zh[b<<4&63],d+="=="):2===c&&(b=(b[a-2]<<8)+b[a-1],d+=Zh[b>>10],d+=Zh[b>>4&63],d+=Zh[b<<2&63],d+="=");e.push(d);return e.join("")}
function fi(b,a,c,d,e){var g=8*e-d-1,f=(1<<g)-1,h=f>>1,k=-7;e=c?e-1:0;var r=c?-1:1,q=b[a+e];e+=r;c=q&(1<<-k)-1;q>>=-k;for(k+=g;0<k;c=256*c+b[a+e],e+=r,k-=8);g=c&(1<<-k)-1;c>>=-k;for(k+=d;0<k;g=256*g+b[a+e],e+=r,k-=8);if(0===c)c=1-h;else{if(c===f)return g?NaN:Infinity*(q?-1:1);g+=Math.pow(2,d);c-=h}return(q?-1:1)*g*Math.pow(2,c-d)}
function gi(b,a,c,d,e,g){var f,h=8*g-e-1,k=(1<<h)-1,r=k>>1,q=23===e?Math.pow(2,-24)-Math.pow(2,-77):0;g=d?0:g-1;var t=d?1:-1,v=0>a||0===a&&0>1/a?1:0;a=Math.abs(a);for(isNaN(a)||Infinity===a?(a=isNaN(a)?1:0,d=k):(d=Math.floor(Math.log(a)/Math.LN2),1>a*(f=Math.pow(2,-d))&&(d--,f*=2),a=1<=d+r?a+q/f:a+q*Math.pow(2,1-r),2<=a*f&&(d++,f/=2),d+r>=k?(a=0,d=k):1<=d+r?(a=(a*f-1)*Math.pow(2,e),d+=r):(a=a*Math.pow(2,r-1)*Math.pow(2,e),d=0));8<=e;b[c+g]=a&255,g+=t,a/=256,e-=8);d=d<<e|a;for(h+=e;0<h;b[c+g]=d&255,
g+=t,d/=256,h-=8);b[c+g-t]|=128*v}var hi={}.toString,ii=Array.isArray||function(b){return"[object Array]"==hi.call(b)};T.TYPED_ARRAY_SUPPORT=void 0!==Yh.TYPED_ARRAY_SUPPORT?Yh.TYPED_ARRAY_SUPPORT:!0;var ji=T.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ki(b,a){if((T.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<a)throw new RangeError("Invalid typed array length");T.TYPED_ARRAY_SUPPORT?(b=new Uint8Array(a),b.__proto__=T.prototype):(null===b&&(b=new T(a)),b.length=a);return b}
function T(b,a,c){if(!(T.TYPED_ARRAY_SUPPORT||this instanceof T))return new T(b,a,c);if("number"===typeof b){if("string"===typeof a)throw Error("If encoding is specified then the first argument must be a string");return li(this,b)}return mi(this,b,a,c)}T.poolSize=8192;T._augment=function(b){b.__proto__=T.prototype;return b};
function mi(b,a,c,d){if("number"===typeof a)throw new TypeError('"value" argument must not be a number');if("undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer){a.byteLength;if(0>c||a.byteLength<c)throw new RangeError("'offset' is out of bounds");if(a.byteLength<c+(d||0))throw new RangeError("'length' is out of bounds");a=void 0===c&&void 0===d?new Uint8Array(a):void 0===d?new Uint8Array(a,c):new Uint8Array(a,c,d);T.TYPED_ARRAY_SUPPORT?(b=a,b.__proto__=T.prototype):b=ni(b,a);return b}if("string"===
typeof a){d=b;b=c;if("string"!==typeof b||""===b)b="utf8";if(!T.isEncoding(b))throw new TypeError('"encoding" must be a valid string encoding');c=oi(a,b)|0;d=ki(d,c);a=d.write(a,b);a!==c&&(d=d.slice(0,a));return d}return pi(b,a)}T.from=function(b,a,c){return mi(null,b,a,c)};T.TYPED_ARRAY_SUPPORT&&(T.prototype.__proto__=Uint8Array.prototype,T.__proto__=Uint8Array);
function qi(b){if("number"!==typeof b)throw new TypeError('"size" argument must be a number');if(0>b)throw new RangeError('"size" argument must not be negative');}T.alloc=function(b,a,c){qi(b);return b=0>=b?ki(null,b):void 0!==a?"string"===typeof c?ki(null,b).fill(a,c):ki(null,b).fill(a):ki(null,b)};function li(b,a){qi(a);b=ki(b,0>a?0:ri(a)|0);if(!T.TYPED_ARRAY_SUPPORT)for(var c=0;c<a;++c)b[c]=0;return b}T.allocUnsafe=function(b){return li(null,b)};T.allocUnsafeSlow=function(b){return li(null,b)};
function ni(b,a){var c=0>a.length?0:ri(a.length)|0;b=ki(b,c);for(var d=0;d<c;d+=1)b[d]=a[d]&255;return b}
function pi(b,a){if(si(a)){var c=ri(a.length)|0;b=ki(b,c);if(0===b.length)return b;a.copy(b,0,0,c);return b}if(a){if("undefined"!==typeof ArrayBuffer&&a.buffer instanceof ArrayBuffer||"length"in a)return(c="number"!==typeof a.length)||(c=a.length,c=c!==c),c?ki(b,0):ni(b,a);if("Buffer"===a.type&&ii(a.data))return ni(b,a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");}
function ri(b){if(b>=(T.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(T.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return b|0}T.isBuffer=ti;function si(b){return!(null==b||!b._isBuffer)}
T.compare=function(b,a){if(!si(b)||!si(a))throw new TypeError("Arguments must be Buffers");if(b===a)return 0;for(var c=b.length,d=a.length,e=0,g=Math.min(c,d);e<g;++e)if(b[e]!==a[e]){c=b[e];d=a[e];break}return c<d?-1:d<c?1:0};T.isEncoding=function(b){switch(String(b).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "latin1":case "binary":case "base64":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return!0;default:return!1}};
T.concat=function(b,a){if(!ii(b))throw new TypeError('"list" argument must be an Array of Buffers');if(0===b.length)return T.alloc(0);var c;if(void 0===a)for(c=a=0;c<b.length;++c)a+=b[c].length;a=T.allocUnsafe(a);var d=0;for(c=0;c<b.length;++c){var e=b[c];if(!si(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(a,d);d+=e.length}return a};
function oi(b,a){if(si(b))return b.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(b)||b instanceof ArrayBuffer))return b.byteLength;"string"!==typeof b&&(b=""+b);var c=b.length;if(0===c)return 0;for(var d=!1;;)switch(a){case "ascii":case "latin1":case "binary":return c;case "utf8":case "utf-8":case void 0:return ui(b).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*c;case "hex":return c>>>1;case "base64":return vi(b).length;
default:if(d)return ui(b).length;a=(""+a).toLowerCase();d=!0}}T.byteLength=oi;
function wi(b,a,c){var d=!1;if(void 0===a||0>a)a=0;if(a>this.length)return"";if(void 0===c||c>this.length)c=this.length;if(0>=c)return"";c>>>=0;a>>>=0;if(c<=a)return"";for(b||(b="utf8");;)switch(b){case "hex":b=a;a=c;c=this.length;if(!b||0>b)b=0;if(!a||0>a||a>c)a=c;d="";for(c=b;c<a;++c)b=d,d=this[c],d=16>d?"0"+d.toString(16):d.toString(16),d=b+d;return d;case "utf8":case "utf-8":return xi(this,a,c);case "ascii":b="";for(c=Math.min(this.length,c);a<c;++a)b+=String.fromCharCode(this[a]&127);return b;
case "latin1":case "binary":b="";for(c=Math.min(this.length,c);a<c;++a)b+=String.fromCharCode(this[a]);return b;case "base64":return a=0===a&&c===this.length?ei(this):ei(this.slice(a,c)),a;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":a=this.slice(a,c);c="";for(b=0;b<a.length;b+=2)c+=String.fromCharCode(a[b]+256*a[b+1]);return c;default:if(d)throw new TypeError("Unknown encoding: "+b);b=(b+"").toLowerCase();d=!0}}T.prototype._isBuffer=!0;function yi(b,a,c){var d=b[a];b[a]=b[c];b[c]=d}
T.prototype.swap16=function(){var b=this.length;if(0!==b%2)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;a<b;a+=2)yi(this,a,a+1);return this};T.prototype.swap32=function(){var b=this.length;if(0!==b%4)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var a=0;a<b;a+=4)yi(this,a,a+3),yi(this,a+1,a+2);return this};
T.prototype.swap64=function(){var b=this.length;if(0!==b%8)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var a=0;a<b;a+=8)yi(this,a,a+7),yi(this,a+1,a+6),yi(this,a+2,a+5),yi(this,a+3,a+4);return this};T.prototype.toString=function(){var b=this.length|0;return 0===b?"":0===arguments.length?xi(this,0,b):wi.apply(this,arguments)};T.prototype.equals=function(b){if(!si(b))throw new TypeError("Argument must be a Buffer");return this===b?!0:0===T.compare(this,b)};
T.prototype.inspect=function(){var b="";0<this.length&&(b=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(b+=" ... "));return"<Buffer "+b+">"};
T.prototype.compare=function(b,a,c,d,e){if(!si(b))throw new TypeError("Argument must be a Buffer");void 0===a&&(a=0);void 0===c&&(c=b?b.length:0);void 0===d&&(d=0);void 0===e&&(e=this.length);if(0>a||c>b.length||0>d||e>this.length)throw new RangeError("out of range index");if(d>=e&&a>=c)return 0;if(d>=e)return-1;if(a>=c)return 1;a>>>=0;c>>>=0;d>>>=0;e>>>=0;if(this===b)return 0;var g=e-d,f=c-a,h=Math.min(g,f);d=this.slice(d,e);b=b.slice(a,c);for(a=0;a<h;++a)if(d[a]!==b[a]){g=d[a];f=b[a];break}return g<
f?-1:f<g?1:0};
function zi(b,a,c,d,e){if(0===b.length)return-1;"string"===typeof c?(d=c,c=0):2147483647<c?c=2147483647:-2147483648>c&&(c=-2147483648);c=+c;isNaN(c)&&(c=e?0:b.length-1);0>c&&(c=b.length+c);if(c>=b.length){if(e)return-1;c=b.length-1}else if(0>c)if(e)c=0;else return-1;"string"===typeof a&&(a=T.from(a,d));if(si(a))return 0===a.length?-1:Ai(b,a,c,d,e);if("number"===typeof a)return a&=255,T.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(b,a,c):
Uint8Array.prototype.lastIndexOf.call(b,a,c):Ai(b,[a],c,d,e);throw new TypeError("val must be string, number or Buffer");}
function Ai(b,a,c,d,e){function g(a,b){return 1===f?a[b]:a.readUInt16BE(b*f)}var f=1,h=b.length,k=a.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(2>b.length||2>a.length)return-1;f=2;h/=2;k/=2;c/=2}if(e)for(d=-1;c<h;c++)if(g(b,c)===g(a,-1===d?0:c-d)){if(-1===d&&(d=c),c-d+1===k)return d*f}else-1!==d&&(c-=c-d),d=-1;else for(c+k>h&&(c=h-k);0<=c;c--){h=!0;for(d=0;d<k;d++)if(g(b,c+d)!==g(a,d)){h=!1;break}if(h)return c}return-1}
T.prototype.includes=function(b,a,c){return-1!==this.indexOf(b,a,c)};T.prototype.indexOf=function(b,a,c){return zi(this,b,a,c,!0)};T.prototype.lastIndexOf=function(b,a,c){return zi(this,b,a,c,!1)};
T.prototype.write=function(b,a,c,d){if(void 0===a)d="utf8",c=this.length,a=0;else if(void 0===c&&"string"===typeof a)d=a,c=this.length,a=0;else if(isFinite(a))a|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var e=this.length-a;if(void 0===c||c>e)c=e;if(0<b.length&&(0>c||0>a)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(e=!1;;)switch(d){case "hex":a:{a=
Number(a)||0;d=this.length-a;c?(c=Number(c),c>d&&(c=d)):c=d;d=b.length;if(0!==d%2)throw new TypeError("Invalid hex string");c>d/2&&(c=d/2);for(d=0;d<c;++d){e=parseInt(b.substr(2*d,2),16);if(isNaN(e)){b=d;break a}this[a+d]=e}b=d}return b;case "utf8":case "utf-8":return Bi(ui(b,this.length-a),this,a,c);case "ascii":return Bi(Ci(b),this,a,c);case "latin1":case "binary":return Bi(Ci(b),this,a,c);case "base64":return Bi(vi(b),this,a,c);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":d=b;e=this.length-
a;for(var g=[],f=0;f<d.length&&!(0>(e-=2));++f){var h=d.charCodeAt(f);b=h>>8;h%=256;g.push(h);g.push(b)}return Bi(g,this,a,c);default:if(e)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase();e=!0}};T.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};
function xi(b,a,c){c=Math.min(b.length,c);for(var d=[];a<c;){var e=b[a],g=null,f=239<e?4:223<e?3:191<e?2:1;if(a+f<=c)switch(f){case 1:128>e&&(g=e);break;case 2:var h=b[a+1];128===(h&192)&&(e=(e&31)<<6|h&63,127<e&&(g=e));break;case 3:h=b[a+1];var k=b[a+2];128===(h&192)&&128===(k&192)&&(e=(e&15)<<12|(h&63)<<6|k&63,2047<e&&(55296>e||57343<e)&&(g=e));break;case 4:h=b[a+1];k=b[a+2];var r=b[a+3];128===(h&192)&&128===(k&192)&&128===(r&192)&&(e=(e&15)<<18|(h&63)<<12|(k&63)<<6|r&63,65535<e&&1114112>e&&(g=
e))}null===g?(g=65533,f=1):65535<g&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|g&1023);d.push(g);a+=f}b=d.length;if(b<=Di)d=String.fromCharCode.apply(String,d);else{c="";for(a=0;a<b;)c+=String.fromCharCode.apply(String,d.slice(a,a+=Di));d=c}return d}var Di=4096;
T.prototype.slice=function(b,a){var c=this.length;b=~~b;a=void 0===a?c:~~a;0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c);0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c);a<b&&(a=b);if(T.TYPED_ARRAY_SUPPORT)a=this.subarray(b,a),a.__proto__=T.prototype;else{c=a-b;a=new T(c,void 0);for(var d=0;d<c;++d)a[d]=this[d+b]}return a};function Ei(b,a,c){if(0!==b%1||0>b)throw new RangeError("offset is not uint");if(b+a>c)throw new RangeError("Trying to access beyond buffer length");}
T.prototype.readUIntLE=function(b,a,c){b|=0;a|=0;c||Ei(b,a,this.length);c=this[b];for(var d=1,e=0;++e<a&&(d*=256);)c+=this[b+e]*d;return c};T.prototype.readUIntBE=function(b,a,c){b|=0;a|=0;c||Ei(b,a,this.length);c=this[b+--a];for(var d=1;0<a&&(d*=256);)c+=this[b+--a]*d;return c};T.prototype.readUInt8=function(b,a){a||Ei(b,1,this.length);return this[b]};T.prototype.readUInt16LE=function(b,a){a||Ei(b,2,this.length);return this[b]|this[b+1]<<8};
T.prototype.readUInt16BE=function(b,a){a||Ei(b,2,this.length);return this[b]<<8|this[b+1]};T.prototype.readUInt32LE=function(b,a){a||Ei(b,4,this.length);return(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]};T.prototype.readUInt32BE=function(b,a){a||Ei(b,4,this.length);return 16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])};
T.prototype.readIntLE=function(b,a,c){b|=0;a|=0;c||Ei(b,a,this.length);c=this[b];for(var d=1,e=0;++e<a&&(d*=256);)c+=this[b+e]*d;c>=128*d&&(c-=Math.pow(2,8*a));return c};T.prototype.readIntBE=function(b,a,c){b|=0;a|=0;c||Ei(b,a,this.length);c=a;for(var d=1,e=this[b+--c];0<c&&(d*=256);)e+=this[b+--c]*d;e>=128*d&&(e-=Math.pow(2,8*a));return e};T.prototype.readInt8=function(b,a){a||Ei(b,1,this.length);return this[b]&128?-1*(255-this[b]+1):this[b]};
T.prototype.readInt16LE=function(b,a){a||Ei(b,2,this.length);b=this[b]|this[b+1]<<8;return b&32768?b|4294901760:b};T.prototype.readInt16BE=function(b,a){a||Ei(b,2,this.length);b=this[b+1]|this[b]<<8;return b&32768?b|4294901760:b};T.prototype.readInt32LE=function(b,a){a||Ei(b,4,this.length);return this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24};T.prototype.readInt32BE=function(b,a){a||Ei(b,4,this.length);return this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]};
T.prototype.readFloatLE=function(b,a){a||Ei(b,4,this.length);return fi(this,b,!0,23,4)};T.prototype.readFloatBE=function(b,a){a||Ei(b,4,this.length);return fi(this,b,!1,23,4)};T.prototype.readDoubleLE=function(b,a){a||Ei(b,8,this.length);return fi(this,b,!0,52,8)};T.prototype.readDoubleBE=function(b,a){a||Ei(b,8,this.length);return fi(this,b,!1,52,8)};
function Fi(b,a,c,d,e,g){if(!si(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>e||a<g)throw new RangeError('"value" argument is out of bounds');if(c+d>b.length)throw new RangeError("Index out of range");}T.prototype.writeUIntLE=function(b,a,c,d){b=+b;a|=0;c|=0;d||Fi(this,b,a,c,Math.pow(2,8*c)-1,0);d=1;var e=0;for(this[a]=b&255;++e<c&&(d*=256);)this[a+e]=b/d&255;return a+c};
T.prototype.writeUIntBE=function(b,a,c,d){b=+b;a|=0;c|=0;d||Fi(this,b,a,c,Math.pow(2,8*c)-1,0);d=c-1;var e=1;for(this[a+d]=b&255;0<=--d&&(e*=256);)this[a+d]=b/e&255;return a+c};T.prototype.writeUInt8=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,1,255,0);T.TYPED_ARRAY_SUPPORT||(b=Math.floor(b));this[a]=b&255;return a+1};function Gi(b,a,c,d){0>a&&(a=65535+a+1);for(var e=0,g=Math.min(b.length-c,2);e<g;++e)b[c+e]=(a&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}
T.prototype.writeUInt16LE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,2,65535,0);T.TYPED_ARRAY_SUPPORT?(this[a]=b&255,this[a+1]=b>>>8):Gi(this,b,a,!0);return a+2};T.prototype.writeUInt16BE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,2,65535,0);T.TYPED_ARRAY_SUPPORT?(this[a]=b>>>8,this[a+1]=b&255):Gi(this,b,a,!1);return a+2};function Hi(b,a,c,d){0>a&&(a=4294967295+a+1);for(var e=0,g=Math.min(b.length-c,4);e<g;++e)b[c+e]=a>>>8*(d?e:3-e)&255}
T.prototype.writeUInt32LE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,4,4294967295,0);T.TYPED_ARRAY_SUPPORT?(this[a+3]=b>>>24,this[a+2]=b>>>16,this[a+1]=b>>>8,this[a]=b&255):Hi(this,b,a,!0);return a+4};T.prototype.writeUInt32BE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,4,4294967295,0);T.TYPED_ARRAY_SUPPORT?(this[a]=b>>>24,this[a+1]=b>>>16,this[a+2]=b>>>8,this[a+3]=b&255):Hi(this,b,a,!1);return a+4};
T.prototype.writeIntLE=function(b,a,c,d){b=+b;a|=0;d||(d=Math.pow(2,8*c-1),Fi(this,b,a,c,d-1,-d));d=0;var e=1,g=0;for(this[a]=b&255;++d<c&&(e*=256);)0>b&&0===g&&0!==this[a+d-1]&&(g=1),this[a+d]=(b/e>>0)-g&255;return a+c};T.prototype.writeIntBE=function(b,a,c,d){b=+b;a|=0;d||(d=Math.pow(2,8*c-1),Fi(this,b,a,c,d-1,-d));d=c-1;var e=1,g=0;for(this[a+d]=b&255;0<=--d&&(e*=256);)0>b&&0===g&&0!==this[a+d+1]&&(g=1),this[a+d]=(b/e>>0)-g&255;return a+c};
T.prototype.writeInt8=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,1,127,-128);T.TYPED_ARRAY_SUPPORT||(b=Math.floor(b));0>b&&(b=255+b+1);this[a]=b&255;return a+1};T.prototype.writeInt16LE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,2,32767,-32768);T.TYPED_ARRAY_SUPPORT?(this[a]=b&255,this[a+1]=b>>>8):Gi(this,b,a,!0);return a+2};T.prototype.writeInt16BE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,2,32767,-32768);T.TYPED_ARRAY_SUPPORT?(this[a]=b>>>8,this[a+1]=b&255):Gi(this,b,a,!1);return a+2};
T.prototype.writeInt32LE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,4,2147483647,-2147483648);T.TYPED_ARRAY_SUPPORT?(this[a]=b&255,this[a+1]=b>>>8,this[a+2]=b>>>16,this[a+3]=b>>>24):Hi(this,b,a,!0);return a+4};T.prototype.writeInt32BE=function(b,a,c){b=+b;a|=0;c||Fi(this,b,a,4,2147483647,-2147483648);0>b&&(b=4294967295+b+1);T.TYPED_ARRAY_SUPPORT?(this[a]=b>>>24,this[a+1]=b>>>16,this[a+2]=b>>>8,this[a+3]=b&255):Hi(this,b,a,!1);return a+4};
function Ii(b,a,c,d){if(c+d>b.length)throw new RangeError("Index out of range");if(0>c)throw new RangeError("Index out of range");}T.prototype.writeFloatLE=function(b,a,c){c||Ii(this,b,a,4);gi(this,b,a,!0,23,4);return a+4};T.prototype.writeFloatBE=function(b,a,c){c||Ii(this,b,a,4);gi(this,b,a,!1,23,4);return a+4};T.prototype.writeDoubleLE=function(b,a,c){c||Ii(this,b,a,8);gi(this,b,a,!0,52,8);return a+8};T.prototype.writeDoubleBE=function(b,a,c){c||Ii(this,b,a,8);gi(this,b,a,!1,52,8);return a+8};
T.prototype.copy=function(b,a,c,d){c||(c=0);d||0===d||(d=this.length);a>=b.length&&(a=b.length);a||(a=0);0<d&&d<c&&(d=c);if(d===c||0===b.length||0===this.length)return 0;if(0>a)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length);b.length-a<d-c&&(d=b.length-a+c);var e=d-c;if(this===b&&c<a&&a<d)for(d=e-1;0<=d;--d)b[d+a]=this[d+c];else if(1E3>e||
!T.TYPED_ARRAY_SUPPORT)for(d=0;d<e;++d)b[d+a]=this[d+c];else Uint8Array.prototype.set.call(b,this.subarray(c,c+e),a);return e};
T.prototype.fill=function(b,a,c,d){if("string"===typeof b){"string"===typeof a?(d=a,a=0,c=this.length):"string"===typeof c&&(d=c,c=this.length);if(1===b.length){var e=b.charCodeAt(0);256>e&&(b=e)}if(void 0!==d&&"string"!==typeof d)throw new TypeError("encoding must be a string");if("string"===typeof d&&!T.isEncoding(d))throw new TypeError("Unknown encoding: "+d);}else"number"===typeof b&&(b&=255);if(0>a||this.length<a||this.length<c)throw new RangeError("Out of range index");if(c<=a)return this;a>>>=
0;c=void 0===c?this.length:c>>>0;b||(b=0);if("number"===typeof b)for(d=a;d<c;++d)this[d]=b;else for(b=si(b)?b:ui((new T(b,d)).toString()),e=b.length,d=0;d<c-a;++d)this[d+a]=b[d%e];return this};var Ji=/[^+\/0-9A-Za-z-_]/g;
function ui(b,a){a=a||Infinity;for(var c,d=b.length,e=null,g=[],f=0;f<d;++f){c=b.charCodeAt(f);if(55295<c&&57344>c){if(!e){if(56319<c){-1<(a-=3)&&g.push(239,191,189);continue}else if(f+1===d){-1<(a-=3)&&g.push(239,191,189);continue}e=c;continue}if(56320>c){-1<(a-=3)&&g.push(239,191,189);e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&-1<(a-=3)&&g.push(239,191,189);e=null;if(128>c){if(0>--a)break;g.push(c)}else if(2048>c){if(0>(a-=2))break;g.push(c>>6|192,c&63|128)}else if(65536>c){if(0>(a-=3))break;
g.push(c>>12|224,c>>6&63|128,c&63|128)}else if(1114112>c){if(0>(a-=4))break;g.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw Error("Invalid code point");}return g}function Ci(b){for(var a=[],c=0;c<b.length;++c)a.push(b.charCodeAt(c)&255);return a}
function vi(b){b=(b.trim?b.trim():b.replace(/^\s+|\s+$/g,"")).replace(Ji,"");if(2>b.length)b="";else for(;0!==b.length%4;)b+="=";bi||ci();var a=b.length;if(0<a%4)throw Error("Invalid string. Length must be a multiple of 4");var c="="===b[a-2]?2:"="===b[a-1]?1:0,d=new ai(3*a/4-c),e=0<c?a-4:a,g=0;for(a=0;a<e;a+=4){var f=$h[b.charCodeAt(a)]<<18|$h[b.charCodeAt(a+1)]<<12|$h[b.charCodeAt(a+2)]<<6|$h[b.charCodeAt(a+3)];d[g++]=f>>16&255;d[g++]=f>>8&255;d[g++]=f&255}2===c?(f=$h[b.charCodeAt(a)]<<2|$h[b.charCodeAt(a+
1)]>>4,d[g++]=f&255):1===c&&(f=$h[b.charCodeAt(a)]<<10|$h[b.charCodeAt(a+1)]<<4|$h[b.charCodeAt(a+2)]>>2,d[g++]=f>>8&255,d[g++]=f&255);return d}function Bi(b,a,c,d){for(var e=0;e<d&&!(e+c>=a.length||e>=b.length);++e)a[e+c]=b[e];return e}function ti(b){return null!=b&&(!!b._isBuffer||Ki(b)||"function"===typeof b.readFloatLE&&"function"===typeof b.slice&&Ki(b.slice(0,0)))}function Ki(b){return!!b.constructor&&"function"===typeof b.constructor.isBuffer&&b.constructor.isBuffer(b)}
var Li=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:ji,Buffer:T,SlowBuffer:function(b){+b!=b&&(b=0);return T.alloc(+b)},isBuffer:ti}),U=T,Mi="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof pa?pa:"undefined"!==typeof self?self:{};function Ni(b,a){return a={exports:{}},b(a,a.exports),a.exports}function Oi(){throw Error("setTimeout has not been defined");}function Pi(){throw Error("clearTimeout has not been defined");}var Qi=Oi,Ri=Pi;
"function"===typeof Yh.setTimeout&&(Qi=setTimeout);"function"===typeof Yh.clearTimeout&&(Ri=clearTimeout);function Si(b){if(Qi===setTimeout)return setTimeout(b,0);if((Qi===Oi||!Qi)&&setTimeout)return Qi=setTimeout,setTimeout(b,0);try{return Qi(b,0)}catch(a){try{return Qi.call(null,b,0)}catch(c){return Qi.call(this,b,0)}}}
function Ti(b){if(Ri===clearTimeout)return clearTimeout(b);if((Ri===Pi||!Ri)&&clearTimeout)return Ri=clearTimeout,clearTimeout(b);try{return Ri(b)}catch(a){try{return Ri.call(null,b)}catch(c){return Ri.call(this,b)}}}var Ui=[],Vi=!1,Wi,Xi=-1;function Yi(){Vi&&Wi&&(Vi=!1,Wi.length?Ui=Wi.concat(Ui):Xi=-1,Ui.length&&Zi())}function Zi(){if(!Vi){var b=Si(Yi);Vi=!0;for(var a=Ui.length;a;){Wi=Ui;for(Ui=[];++Xi<a;)Wi&&Wi[Xi].run();Xi=-1;a=Ui.length}Wi=null;Vi=!1;Ti(b)}}
function $i(b){var a=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)a[c-1]=arguments[c];Ui.push(new aj(b,a));1!==Ui.length||Vi||Si(Zi)}function aj(b,a){this.fun=b;this.array=a}aj.prototype.run=function(){this.fun.apply(null,this.array)};function bj(){}
var cj=Yh.performance||{},dj=cj.now||cj.mozNow||cj.msNow||cj.oNow||cj.webkitNow||function(){return(new Date).getTime()},ej=new Date,fj={nextTick:$i,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:bj,addListener:bj,once:bj,off:bj,removeListener:bj,removeAllListeners:bj,emit:bj,binding:function(){throw Error("process.binding is not supported");},cwd:function(){return"/"},chdir:function(){throw Error("process.chdir is not supported");},umask:function(){return 0},hrtime:function(b){var a=
.001*dj.call(cj),c=Math.floor(a);a=Math.floor(a%1*1E9);b&&(c-=b[0],a-=b[1],0>a&&(c--,a+=1E9));return[c,a]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ej)/1E3}},gj=Ni(function(b,a){function c(a,b){for(var c in a)b[c]=a[c]}function d(a,b,c){return e(a,b,c)}var e=Li.Buffer;e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?b.exports=Li:(c(Li,a),a.Buffer=d);d.prototype=Object.create(e.prototype);c(e,d);d.from=function(a,b,c){if("number"===typeof a)throw new TypeError("Argument must not be a number");
return e(a,b,c)};d.alloc=function(a,b,c){if("number"!==typeof a)throw new TypeError("Argument must be a number");a=e(a);void 0!==b?"string"===typeof c?a.fill(b,c):a.fill(b):a.fill(0);return a};d.allocUnsafe=function(a){if("number"!==typeof a)throw new TypeError("Argument must be a number");return e(a)};d.allocUnsafeSlow=function(a){if("number"!==typeof a)throw new TypeError("Argument must be a number");return Li.SlowBuffer(a)}}),hj=Ni(function(b,a){function c(){throw Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11");
}function d(a,b){if("number"!==typeof a||a!==a)throw new TypeError("offset must be a number");if(a>t||0>a)throw new TypeError("offset must be a uint32");if(a>r||a>b)throw new RangeError("offset out of range");}function e(a,b,c){if("number"!==typeof a||a!==a)throw new TypeError("size must be a number");if(a>t||0>a)throw new TypeError("size must be a uint32");if(a+b>c||a>r)throw new RangeError("buffer too small");}function g(a,b,c,g){if(!(k.isBuffer(a)||a instanceof Mi.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
if("function"===typeof b)g=b,b=0,c=a.length;else if("function"===typeof c)g=c,c=a.length-b;else if("function"!==typeof g)throw new TypeError('"cb" argument must be a function');d(b,a.length);e(c,b,a.length);return f(a,b,c,g)}function f(a,b,c,d){b=new Uint8Array(a.buffer,b,c);q.getRandomValues(b);if(d)$i(function(){d(null,a)});else return a}function h(a,b,c){"undefined"===typeof b&&(b=0);if(!(k.isBuffer(a)||a instanceof Mi.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
d(b,a.length);void 0===c&&(c=a.length-b);e(c,b,a.length);return f(a,b,c)}var k=gj.Buffer,r=gj.kMaxLength,q=Mi.crypto||Mi.msCrypto,t=Math.pow(2,32)-1;q&&q.getRandomValues?(a.randomFill=g,a.randomFillSync=h):(a.randomFill=c,a.randomFillSync=c)}),ij=Ni(function(b){b.exports=hj}).randomFillSync,jj=Math.floor(.001*(Date.now()-performance.now()));function kj(b){if("string"!==typeof b)throw new TypeError("Path must be a string. Received "+JSON.stringify(b));}
function lj(b,a){for(var c="",d=0,e=-1,g=0,f,h=0;h<=b.length;++h){if(h<b.length)f=b.charCodeAt(h);else if(47===f)break;else f=47;if(47===f){if(e!==h-1&&1!==g)if(e!==h-1&&2===g){if(2>c.length||2!==d||46!==c.charCodeAt(c.length-1)||46!==c.charCodeAt(c.length-2))if(2<c.length){if(e=c.lastIndexOf("/"),e!==c.length-1){-1===e?(c="",d=0):(c=c.slice(0,e),d=c.length-1-c.lastIndexOf("/"));e=h;g=0;continue}}else if(2===c.length||1===c.length){c="";d=0;e=h;g=0;continue}a&&(c=0<c.length?c+"/..":"..",d=2)}else c=
0<c.length?c+("/"+b.slice(e+1,h)):b.slice(e+1,h),d=h-e-1;e=h;g=0}else 46===f&&-1!==g?++g:g=-1}return c}
var mj={resolve:function(){for(var b="",a=!1,c,d=arguments.length-1;-1<=d&&!a;d--){if(0<=d)var e=arguments[d];else void 0===c&&(c=fj.cwd()),e=c;kj(e);0!==e.length&&(b=e+"/"+b,a=47===e.charCodeAt(0))}b=lj(b,!a);return a?0<b.length?"/"+b:"/":0<b.length?b:"."},normalize:function(b){kj(b);if(0===b.length)return".";var a=47===b.charCodeAt(0),c=47===b.charCodeAt(b.length-1);b=lj(b,!a);0!==b.length||a||(b=".");0<b.length&&c&&(b+="/");return a?"/"+b:b},isAbsolute:function(b){kj(b);return 0<b.length&&47===
b.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var b,a=0;a<arguments.length;++a){var c=arguments[a];kj(c);0<c.length&&(b=void 0===b?c:b+("/"+c))}return void 0===b?".":mj.normalize(b)},relative:function(b,a){kj(b);kj(a);if(b===a)return"";b=mj.resolve(b);a=mj.resolve(a);if(b===a)return"";for(var c=1;c<b.length&&47===b.charCodeAt(c);++c);for(var d=b.length,e=d-c,g=1;g<a.length&&47===a.charCodeAt(g);++g);for(var f=a.length-g,h=e<f?e:f,k=-1,r=0;r<=h;++r){if(r===h){if(f>h){if(47===
a.charCodeAt(g+r))return a.slice(g+r+1);if(0===r)return a.slice(g+r)}else e>h&&(47===b.charCodeAt(c+r)?k=r:0===r&&(k=0));break}var q=b.charCodeAt(c+r),t=a.charCodeAt(g+r);if(q!==t)break;else 47===q&&(k=r)}e="";for(r=c+k+1;r<=d;++r)if(r===d||47===b.charCodeAt(r))e=0===e.length?e+"..":e+"/..";if(0<e.length)return e+a.slice(g+k);g+=k;47===a.charCodeAt(g)&&++g;return a.slice(g)},_makeLong:function(b){return b},dirname:function(b){kj(b);if(0===b.length)return".";for(var a=b.charCodeAt(0),c=47===a,d=-1,
e=!0,g=b.length-1;1<=g;--g)if(a=b.charCodeAt(g),47===a){if(!e){d=g;break}}else e=!1;return-1===d?c?"/":".":c&&1===d?"//":b.slice(0,d)},basename:function(b,a){if(void 0!==a&&"string"!==typeof a)throw new TypeError('"ext" argument must be a string');kj(b);var c=0,d=-1,e=!0,g;if(void 0!==a&&0<a.length&&a.length<=b.length){if(a.length===b.length&&a===b)return"";var f=a.length-1,h=-1;for(g=b.length-1;0<=g;--g){var k=b.charCodeAt(g);if(47===k){if(!e){c=g+1;break}}else-1===h&&(e=!1,h=g+1),0<=f&&(k===a.charCodeAt(f)?
-1===--f&&(d=g):(f=-1,d=h))}c===d?d=h:-1===d&&(d=b.length);return b.slice(c,d)}for(g=b.length-1;0<=g;--g)if(47===b.charCodeAt(g)){if(!e){c=g+1;break}}else-1===d&&(e=!1,d=g+1);return-1===d?"":b.slice(c,d)},extname:function(b){kj(b);for(var a=-1,c=0,d=-1,e=!0,g=0,f=b.length-1;0<=f;--f){var h=b.charCodeAt(f);if(47===h){if(!e){c=f+1;break}}else-1===d&&(e=!1,d=f+1),46===h?-1===a?a=f:1!==g&&(g=1):-1!==a&&(g=-1)}return-1===a||-1===d||0===g||1===g&&a===d-1&&a===c+1?"":b.slice(a,d)},format:function(b){if(null===
b||"object"!==typeof b)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof b);var a=b.dir||b.root,c=b.base||(b.name||"")+(b.ext||"");return b=a?a===b.root?a+c:a+"/"+c:c},parse:function(b){kj(b);var a={root:"",dir:"",base:"",ext:"",name:""};if(0===b.length)return a;var c=b.charCodeAt(0),d=47===c;if(d){a.root="/";var e=1}else e=0;for(var g=-1,f=0,h=-1,k=!0,r=b.length-1,q=0;r>=e;--r)if(c=b.charCodeAt(r),47===c){if(!k){f=r+1;break}}else-1===h&&(k=!1,h=r+1),46===
c?-1===g?g=r:1!==q&&(q=1):-1!==g&&(q=-1);-1===g||-1===h||0===q||1===q&&g===h-1&&g===f+1?-1!==h&&(a.base=0===f&&d?a.name=b.slice(1,h):a.name=b.slice(f,h)):(0===f&&d?(a.name=b.slice(1,g),a.base=b.slice(1,h)):(a.name=b.slice(f,g),a.base=b.slice(f,h)),a.ext=b.slice(g,h));0<f?a.dir=b.slice(0,f-1):d&&(a.dir="/");return a},sep:"/",delimiter:":",win32:null,posix:null},nj=mj.posix=mj,oj=Object.freeze({__proto__:null,"default":nj,__moduleExports:nj}),rj={hrtime:function(b){return function(a){a=b(a);return 1E9*
a[0]+a[1]}}(function(b){var a=.001*performance.now(),c=Math.floor(a)+jj;a=Math.floor(a%1*1E9);b&&(c-=b[0],a-=b[1],0>a&&(c--,a+=1E9));return[c,a]}),exit:function(b){throw new pj(b);},kill:function(b){throw new qj(b);},randomFillSync:ij,isTTY:function(){return!0},path:oj,fs:null},W,sj=S(1),tj=S(2),uj=S(4),vj=S(8),wj=S(16),xj=S(32),yj=S(64),zj=S(128),Aj=S(256),Bj=S(512),Fj=S(1024),Gj=S(2048),Hj=S(4096),Ij=S(8192),Jj=S(16384),Kj=S(32768),Lj=S(65536),Mj=S(131072),Nj=S(262144),Oj=S(524288),Pj=S(1048576),
Qj=S(2097152),Rj=S(4194304),Sj=S(8388608),Tj=S(16777216),Uj=S(33554432),Vj=S(67108864),wk=S(134217728),xk=S(268435456),yk=sj|tj|uj|vj|wj|xj|yj|zj|Aj|Bj|Fj|Gj|Hj|Ij|Jj|Kj|Lj|Mj|Nj|Oj|Pj|Qj|Sj|Rj|Tj|Vj|Uj|wk|xk,zk=sj|tj|uj|vj|wj|xj|yj|zj|Aj|Qj|Rj|Sj|wk,Ak=S(0),Bk=vj|wj|zj|Bj|Fj|Gj|Hj|Ij|Jj|Kj|Lj|Mj|Nj|Oj|Pj|Qj|Sj|Tj|Vj|Uj|wk,Ck=Bk|zk,Dk=tj|vj|yj|Qj|wk|xk,Ek=tj|vj|yj|Qj|wk,Fk=S(0),Gk={E2BIG:1,EACCES:2,EADDRINUSE:3,EADDRNOTAVAIL:4,EAFNOSUPPORT:5,EALREADY:7,EAGAIN:6,EBADF:8,EBADMSG:9,EBUSY:10,ECANCELED:11,
ECHILD:12,ECONNABORTED:13,ECONNREFUSED:14,ECONNRESET:15,EDEADLOCK:16,EDESTADDRREQ:17,EDOM:18,EDQUOT:19,EEXIST:20,EFAULT:21,EFBIG:22,EHOSTDOWN:23,EHOSTUNREACH:23,EIDRM:24,EILSEQ:25,EINPROGRESS:26,EINTR:27,EINVAL:28,EIO:29,EISCONN:30,EISDIR:31,ELOOP:32,EMFILE:33,EMLINK:34,EMSGSIZE:35,EMULTIHOP:36,ENAMETOOLONG:37,ENETDOWN:38,ENETRESET:39,ENETUNREACH:40,ENFILE:41,ENOBUFS:42,ENODEV:43,ENOENT:44,ENOEXEC:45,ENOLCK:46,ENOLINK:47,ENOMEM:48,ENOMSG:49,ENOPROTOOPT:50,ENOSPC:51,ENOSYS:52,ENOTCONN:53,ENOTDIR:54,
ENOTEMPTY:55,ENOTRECOVERABLE:56,ENOTSOCK:57,ENOTTY:59,ENXIO:60,EOVERFLOW:61,EOWNERDEAD:62,EPERM:63,EPIPE:64,EPROTO:65,EPROTONOSUPPORT:66,EPROTOTYPE:67,ERANGE:68,EROFS:69,ESPIPE:70,ESRCH:71,ESTALE:72,ETIMEDOUT:73,ETXTBSY:74,EXDEV:75},Hk=(W={},W[6]="SIGHUP",W[8]="SIGINT",W[11]="SIGQUIT",W[7]="SIGILL",W[15]="SIGTRAP",W[0]="SIGABRT",W[2]="SIGBUS",W[5]="SIGFPE",W[9]="SIGKILL",W[20]="SIGUSR1",W[12]="SIGSEGV",W[21]="SIGUSR2",W[10]="SIGPIPE",W[1]="SIGALRM",W[14]="SIGTERM",W[3]="SIGCHLD",W[4]="SIGCONT",W[13]=
"SIGSTOP",W[16]="SIGTSTP",W[17]="SIGTTIN",W[18]="SIGTTOU",W[19]="SIGURG",W[23]="SIGXCPU",W[24]="SIGXFSZ",W[22]="SIGVTALRM",W),Ik=sj|tj|wj|zj|Qj|wk,Jk=sj|yj|wj|zj|Qj|wk;function Kk(b){var a=Math.trunc(b);b=S(Math.round(1E6*(b-a)));return S(a)*S(1E6)+b}function Lk(b){"number"===typeof b&&(b=Math.trunc(b));b=S(b);return Number(b/S(1E6))}
function Y(b){return function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];try{return b.apply(void 0,Vh(a))}catch(d){if(d&&d.code&&"string"===typeof d.code)return Gk[d.code]||28;if(d instanceof Mk)return d.errno;throw d;}}}function Nk(b,a){var c=b.FD_MAP.get(a);if(!c)throw new Mk(8);if(void 0===c.filetype){var d=b.bindings.fs.fstatSync(c.real);b=Ok(b,a,d);a=b.rightsBase;d=b.rightsInheriting;c.filetype=b.filetype;c.rights||(c.rights={base:a,inheriting:d})}return c}
function Ok(b,a,c){switch(!0){case c.isBlockDevice():return{filetype:1,rightsBase:yk,rightsInheriting:yk};case c.isCharacterDevice():return void 0!==a&&b.bindings.isTTY(a)?{filetype:2,rightsBase:Ek,rightsInheriting:Fk}:{filetype:2,rightsBase:yk,rightsInheriting:yk};case c.isDirectory():return{filetype:3,rightsBase:Bk,rightsInheriting:Ck};case c.isFIFO():return{filetype:6,rightsBase:Dk,rightsInheriting:yk};case c.isFile():return{filetype:4,rightsBase:zk,rightsInheriting:Ak};case c.isSocket():return{filetype:6,
rightsBase:Dk,rightsInheriting:yk};case c.isSymbolicLink():return{filetype:7,rightsBase:S(0),rightsInheriting:S(0)};default:return{filetype:0,rightsBase:S(0),rightsInheriting:S(0)}}}
var Mk=function(b){function a(c){var d=b.call(this)||this;d.errno=c;Object.setPrototypeOf(d,a.prototype);return d}Sh(a,b);return a}(Error),pj=function(b){function a(c){var d=b.call(this,"WASI Exit error: "+c)||this;d.code=c;Object.setPrototypeOf(d,a.prototype);return d}Sh(a,b);return a}(Error),qj=function(b){function a(c){var d=b.call(this,"WASI Kill signal: "+c)||this;d.signal=c;Object.setPrototypeOf(d,a.prototype);return d}Sh(a,b);return a}(Error),Pk=function(){function b(a){function b(a){switch(a){case 1:return q.hrtime();
case 0:return Kk(Date.now());case 2:case 3:return q.hrtime()-R;default:return null}}function d(a,b){a=Nk(f,a);if(b!==S(0)&&(a.rights.base&b)===S(0))throw new Mk(63);return a}function e(a,b){f.refreshMemory();return Array.from({length:b},function(b,c){c=a+8*c;b=f.view.getUint32(c,!0);c=f.view.getUint32(c+4,!0);return new Uint8Array(f.memory.buffer,b,c)})}var g,f=this,h={};a&&a.preopens?h=a.preopens:a&&a.preopenDirectories&&(h=a.preopenDirectories);var k={};a&&a.env&&(k=a.env);var r=[];a&&a.args&&(r=
a.args);var q=rj;a&&a.bindings&&(q=a.bindings);this.view=this.memory=void 0;this.bindings=q;this.FD_MAP=new Map([[0,{real:0,filetype:2,rights:{base:Ik,inheriting:S(0)},path:void 0}],[1,{real:1,filetype:2,rights:{base:Jk,inheriting:S(0)},path:void 0}],[2,{real:2,filetype:2,rights:{base:Jk,inheriting:S(0)},path:void 0}]]);var t=this.bindings.fs,v=this.bindings.path;try{for(var l=Th(Object.entries(h)),n=l.next();!n.done;n=l.next()){var y=Uh(n.value,2),B=y[0],O=y[1],X=t.openSync(O,t.constants.O_RDONLY),
M=Vh(this.FD_MAP.keys()).reverse()[0]+1;this.FD_MAP.set(M,{real:X,filetype:3,rights:{base:Bk,inheriting:Ck},fakePath:B,path:O})}}catch(C){var ha={error:C}}finally{try{n&&!n.done&&(g=l.return)&&g.call(l)}finally{if(ha)throw ha.error;}}var R=q.hrtime();this.wasiImport={args_get:function(a,b){f.refreshMemory();var c=a,d=b;r.forEach(function(a){f.view.setUint32(c,d,!0);c+=4;d+=U.from(f.memory.buffer).write(a+"\x00",d)});return 0},args_sizes_get:function(a,b){f.refreshMemory();f.view.setUint32(a,r.length,
!0);a=r.reduce(function(a,b){return a+U.byteLength(b)+1},0);f.view.setUint32(b,a,!0);return 0},environ_get:function(a,b){f.refreshMemory();var c=a,d=b;Object.entries(k).forEach(function(a){var b=Uh(a,2);a=b[0];b=b[1];f.view.setUint32(c,d,!0);c+=4;d+=U.from(f.memory.buffer).write(a+"="+b+"\x00",d)});return 0},environ_sizes_get:function(a,b){f.refreshMemory();var c=Object.entries(k).map(function(a){a=Uh(a,2);return a[0]+"="+a[1]+"\x00"}),d=c.reduce(function(a,b){return a+U.byteLength(b)},0);f.view.setUint32(a,
c.length,!0);f.view.setUint32(b,d,!0);return 0},clock_res_get:function(a,b){switch(a){case 1:case 2:case 3:var c=S(1);break;case 0:c=S(1E3)}f.view.setBigUint64(b,c);return 0},clock_time_get:function(a,c,d){f.refreshMemory();a=b(a);if(null===a)return 28;f.view.setBigUint64(d,S(a),!0);return 0},fd_advise:Y(function(a){d(a,zj);return 52}),fd_allocate:Y(function(a){d(a,Aj);return 52}),fd_close:Y(function(a){var b=d(a,S(0));t.closeSync(b.real);f.FD_MAP.delete(a);return 0}),fd_datasync:Y(function(a){a=
d(a,sj);t.fdatasyncSync(a.real);return 0}),fd_fdstat_get:Y(function(a,b){a=d(a,S(0));f.refreshMemory();f.view.setUint8(b,a.filetype);f.view.setUint16(b+2,0,!0);f.view.setUint16(b+4,0,!0);f.view.setBigUint64(b+8,S(a.rights.base),!0);f.view.setBigUint64(b+8+8,S(a.rights.inheriting),!0);return 0}),fd_fdstat_set_flags:Y(function(a){d(a,vj);return 52}),fd_fdstat_set_rights:Y(function(a,b,c){a=d(a,S(0));if((a.rights.base|b)>a.rights.base||(a.rights.inheriting|c)>a.rights.inheriting)return 63;a.rights.base=
b;a.rights.inheriting=c;return 0}),fd_filestat_get:Y(function(a,b){a=d(a,Qj);var c=t.fstatSync(a.real);f.refreshMemory();f.view.setBigUint64(b,S(c.dev),!0);b+=8;f.view.setBigUint64(b,S(c.ino),!0);b+=8;f.view.setUint8(b,a.filetype);b+=8;f.view.setBigUint64(b,S(c.nlink),!0);b+=8;f.view.setBigUint64(b,S(c.size),!0);b+=8;f.view.setBigUint64(b,Kk(c.atimeMs),!0);b+=8;f.view.setBigUint64(b,Kk(c.mtimeMs),!0);f.view.setBigUint64(b+8,Kk(c.ctimeMs),!0);return 0}),fd_filestat_set_size:Y(function(a,b){a=d(a,Rj);
t.ftruncateSync(a.real,Number(b));return 0}),fd_filestat_set_times:Y(function(a,c,e,f){a=d(a,Sj);var g=t.fstatSync(a.real),h=g.atime;g=g.mtime;var k=Lk(b(0));if(3===(f&3)||12===(f&12))return 28;1===(f&1)?h=Lk(c):2===(f&2)&&(h=k);4===(f&4)?g=Lk(e):8===(f&8)&&(g=k);t.futimesSync(a.real,new Date(h),new Date(g));return 0}),fd_prestat_get:Y(function(a,b){a=d(a,S(0));if(!a.path)return 28;f.refreshMemory();f.view.setUint8(b,0);f.view.setUint32(b+4,U.byteLength(a.fakePath),!0);return 0}),fd_prestat_dir_name:Y(function(a,
b,c){a=d(a,S(0));if(!a.path)return 28;f.refreshMemory();U.from(f.memory.buffer).write(a.fakePath,b,c,"utf8");return 0}),fd_pwrite:Y(function(a,b,c,g,h){var k=d(a,yj|uj),l=0;e(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=t.writeSync(k.real,a,b,a.byteLength-b,Number(g)+l+b);l+=b});f.view.setUint32(h,l,!0);return 0}),fd_write:Y(function(a,b,c,g){var h=d(a,yj),k=0;e(b,c).forEach(function(a){for(var b=0;b<a.byteLength;){var c=t.writeSync(h.real,a,b,a.byteLength-b,h.offset?Number(h.offset):null);
h.offset&&(h.offset+=S(c));b+=c}k+=b});f.view.setUint32(g,k,!0);return 0}),fd_pread:Y(function(a,b,c,g,h){var k;a=d(a,tj|uj);var l=0;try{var n=Th(e(b,c)),q=n.next();a:for(;!q.done;q=n.next()){var r=q.value;for(b=0;b<r.byteLength;){var v=r.byteLength-b,C=t.readSync(a.real,r,b,r.byteLength-b,Number(g)+l+b);b+=C;l+=C;if(0===C||C<v)break a}l+=b}}catch(P){var H={error:P}}finally{try{q&&!q.done&&(k=n.return)&&k.call(n)}finally{if(H)throw H.error;}}f.view.setUint32(h,l,!0);return 0}),fd_read:Y(function(a,
b,c,g){var h;a=d(a,tj);var k=0===a.real,l=0;try{var n=Th(e(b,c)),q=n.next();a:for(;!q.done;q=n.next()){var r=q.value;for(b=0;b<r.byteLength;){var v=r.byteLength-b,C=t.readSync(a.real,r,b,v,k||void 0===a.offset?null:Number(a.offset));k||(a.offset=(a.offset?a.offset:S(0))+S(C));b+=C;l+=C;if(0===C||C<v)break a}}}catch(P){var H={error:P}}finally{try{q&&!q.done&&(h=n.return)&&h.call(n)}finally{if(H)throw H.error;}}f.view.setUint32(g,l,!0);return 0}),fd_readdir:Y(function(a,b,c,e,g){a=d(a,Jj);f.refreshMemory();
var h=t.readdirSync(a.path,{withFileTypes:!0}),k=b;for(e=Number(e);e<h.length;e+=1){var l=h[e],n=U.byteLength(l.name);if(b-k>c)break;f.view.setBigUint64(b,S(e+1),!0);b+=8;if(b-k>c)break;var q=t.statSync(v.resolve(a.path,l.name));f.view.setBigUint64(b,S(q.ino),!0);b+=8;if(b-k>c)break;f.view.setUint32(b,n,!0);b+=4;if(b-k>c)break;switch(!0){case q.isBlockDevice():q=1;break;case q.isCharacterDevice():q=2;break;case q.isDirectory():q=3;break;case q.isFIFO():q=6;break;case q.isFile():q=4;break;case q.isSocket():q=
6;break;case q.isSymbolicLink():q=7;break;default:q=0}f.view.setUint8(b,q);b+=1;b+=3;if(b+n>=k+c)break;U.from(f.memory.buffer).write(l.name,b);b+=n}f.view.setUint32(g,Math.min(b-k,c),!0);return 0}),fd_renumber:Y(function(a,b){d(a,S(0));d(b,S(0));t.closeSync(f.FD_MAP.get(a).real);f.FD_MAP.set(a,f.FD_MAP.get(b));f.FD_MAP.delete(b);return 0}),fd_seek:Y(function(a,b,c,e){a=d(a,uj);f.refreshMemory();switch(c){case 1:a.offset=(a.offset?a.offset:S(0))+S(b);break;case 2:c=t.fstatSync(a.real).size;a.offset=
S(c)+S(b);break;case 0:a.offset=S(b)}f.view.setBigUint64(e,a.offset,!0);return 0}),fd_tell:Y(function(a,b){a=d(a,xj);f.refreshMemory();a.offset||(a.offset=S(0));f.view.setBigUint64(b,a.offset,!0);return 0}),fd_sync:Y(function(a){a=d(a,wj);t.fsyncSync(a.real);return 0}),path_create_directory:Y(function(a,b,c){a=d(a,Bj);if(!a.path)return 28;f.refreshMemory();b=U.from(f.memory.buffer,b,c).toString();t.mkdirSync(v.resolve(a.path,b));return 0}),path_filestat_get:Y(function(a,b,c,e,g){a=d(a,Nj);if(!a.path)return 28;
f.refreshMemory();c=U.from(f.memory.buffer,c,e).toString();c=t.statSync(v.resolve(a.path,c));f.view.setBigUint64(g,S(c.dev),!0);g+=8;f.view.setBigUint64(g,S(c.ino),!0);g+=8;f.view.setUint8(g,Ok(f,void 0,c).filetype);g+=8;f.view.setBigUint64(g,S(c.nlink),!0);g+=8;f.view.setBigUint64(g,S(c.size),!0);g+=8;f.view.setBigUint64(g,Kk(c.atimeMs),!0);g+=8;f.view.setBigUint64(g,Kk(c.mtimeMs),!0);f.view.setBigUint64(g+8,Kk(c.ctimeMs),!0);return 0}),path_filestat_set_times:Y(function(a,c,e,g,h,k,l){a=d(a,Pj);
if(!a.path)return 28;f.refreshMemory();var n=t.fstatSync(a.real);c=n.atime;n=n.mtime;var q=Lk(b(0));if(3===(l&3)||12===(l&12))return 28;1===(l&1)?c=Lk(h):2===(l&2)&&(c=q);4===(l&4)?n=Lk(k):8===(l&8)&&(n=q);e=U.from(f.memory.buffer,e,g).toString();t.utimesSync(v.resolve(a.path,e),new Date(c),new Date(n));return 0}),path_link:Y(function(a,b,c,e,g,h,k){a=d(a,Gj);g=d(g,Hj);if(!a.path||!g.path)return 28;f.refreshMemory();c=U.from(f.memory.buffer,c,e).toString();h=U.from(f.memory.buffer,h,k).toString();
t.linkSync(v.resolve(a.path,c),v.resolve(g.path,h));return 0}),path_open:Y(function(a,b,c,e,g,h,k,l,n){b=d(a,Ij);h=S(h);k=S(k);a=(h&(tj|Jj))!==S(0);var q=(h&(sj|yj|Aj|Rj))!==S(0);if(q&&a)var r=t.constants.O_RDWR;else a?r=t.constants.O_RDONLY:q&&(r=t.constants.O_WRONLY);a=h|Ij;h|=k;0!==(g&1)&&(r|=t.constants.O_CREAT,a|=Fj);0!==(g&2)&&(r|=t.constants.O_DIRECTORY);0!==(g&4)&&(r|=t.constants.O_EXCL);0!==(g&8)&&(r|=t.constants.O_TRUNC,a|=Oj);0!==(l&1)&&(r|=t.constants.O_APPEND);0!==(l&2)&&(r=t.constants.O_DSYNC?
r|t.constants.O_DSYNC:r|t.constants.O_SYNC,h|=sj);0!==(l&4)&&(r|=t.constants.O_NONBLOCK);0!==(l&8)&&(r=t.constants.O_RSYNC?r|t.constants.O_RSYNC:r|t.constants.O_SYNC,h|=wj);0!==(l&16)&&(r|=t.constants.O_SYNC,h|=wj);q&&0===(r&(t.constants.O_APPEND|t.constants.O_TRUNC))&&(h|=uj);f.refreshMemory();c=U.from(f.memory.buffer,c,e).toString();c=v.resolve(b.path,c);if(v.relative(b.path,c).startsWith(".."))return 76;try{var y=t.realpathSync(c);if(v.relative(b.path,y).startsWith(".."))return 76}catch(P){if("ENOENT"===
P.code)y=c;else throw P;}try{var C=t.statSync(y).isDirectory()}catch(P){}r=!q&&C?t.openSync(y,t.constants.O_RDONLY):t.openSync(y,r);C=Vh(f.FD_MAP.keys()).reverse()[0]+1;f.FD_MAP.set(C,{real:r,filetype:void 0,rights:{base:a,inheriting:h},path:y});Nk(f,C);f.view.setUint32(n,C,!0);return 0}),path_readlink:Y(function(a,b,c,e,g,h){a=d(a,Kj);if(!a.path)return 28;f.refreshMemory();b=U.from(f.memory.buffer,b,c).toString();b=v.resolve(a.path,b);b=t.readlinkSync(b);e=U.from(f.memory.buffer).write(b,e,g);f.view.setUint32(h,
e,!0);return 0}),path_remove_directory:Y(function(a,b,c){a=d(a,Uj);if(!a.path)return 28;f.refreshMemory();b=U.from(f.memory.buffer,b,c).toString();t.rmdirSync(v.resolve(a.path,b));return 0}),path_rename:Y(function(a,b,c,e,g,h){a=d(a,Lj);e=d(e,Mj);if(!a.path||!e.path)return 28;f.refreshMemory();b=U.from(f.memory.buffer,b,c).toString();g=U.from(f.memory.buffer,g,h).toString();t.renameSync(v.resolve(a.path,b),v.resolve(e.path,g));return 0}),path_symlink:Y(function(a,b,c,e,g){c=d(c,Tj);if(!c.path)return 28;
f.refreshMemory();a=U.from(f.memory.buffer,a,b).toString();e=U.from(f.memory.buffer,e,g).toString();t.symlinkSync(a,v.resolve(c.path,e));return 0}),path_unlink_file:Y(function(a,b,c){a=d(a,Vj);if(!a.path)return 28;f.refreshMemory();b=U.from(f.memory.buffer,b,c).toString();t.unlinkSync(v.resolve(a.path,b));return 0}),poll_oneoff:function(a,c,d,e){var g=0,h=0;f.refreshMemory();for(var k=0;k<d;k+=1){var l=f.view.getBigUint64(a,!0);a+=8;var n=f.view.getUint8(a);a+=1;switch(n){case 0:a+=7;f.view.getBigUint64(a,
!0);a+=8;var r=f.view.getUint32(a,!0);a+=4;a+=4;n=f.view.getBigUint64(a,!0);a+=8;f.view.getBigUint64(a,!0);a+=8;var t=f.view.getUint16(a,!0);a+=2;a+=6;var v=1===t;t=0;r=S(b(r));null===r?t=28:(n=v?n:r+n,h=n>h?n:h);f.view.setBigUint64(c,l,!0);c+=8;f.view.setUint16(c,t,!0);c+=2;f.view.setUint8(c,0);c+=1;c+=5;g+=1;break;case 1:case 2:a+=3;f.view.getUint32(a,!0);a+=4;f.view.setBigUint64(c,l,!0);c+=8;f.view.setUint16(c,52,!0);c+=2;f.view.setUint8(c,n);c+=1;c+=5;g+=1;break;default:return 28}}for(f.view.setUint32(e,
g,!0);q.hrtime()<h;);return 0},proc_exit:function(a){q.exit(a);return 0},proc_raise:function(a){if(!(a in Hk))return 28;q.kill(Hk[a]);return 0},random_get:function(a,b){f.refreshMemory();q.randomFillSync(new Uint8Array(f.memory.buffer),a,b);return 0},sched_yield:function(){return 0},sock_recv:function(){return 52},sock_send:function(){return 52},sock_shutdown:function(){return 52}};a.traceSyscalls&&Object.keys(this.wasiImport).forEach(function(a){var b=f.wasiImport[a];f.wasiImport[a]=function(){for(var c=
[],d=0;d<arguments.length;d++)c[d]=arguments[d];console.log("WASI: wasiImport called: "+a+" ("+c+")");try{var e=b.apply(void 0,Vh(c));console.log("WASI: => "+e);return e}catch(I){throw console.log("Catched error: "+I),I;}}})}b.prototype.refreshMemory=function(){this.view&&0!==this.view.buffer.byteLength||(this.view=new Xh(this.memory.buffer))};b.prototype.setMemory=function(a){this.memory=a};b.prototype.start=function(a){a=a.exports;if(null===a||"object"!==typeof a)throw Error("instance.exports must be an Object. Received "+
a+".");var b=a.memory;if(!(b instanceof WebAssembly.Memory))throw Error("instance.exports.memory must be a WebAssembly.Memory. Recceived "+b+".");this.setMemory(b);a._start&&a._start()};b.prototype.getImportNamespace=function(a){var b,d=null;try{for(var e=Th(WebAssembly.Module.imports(a)),g=e.next();!g.done;g=e.next()){var f=g.value;if("function"===f.kind&&f.module.startsWith("wasi_"))if(!d)d=f.module;else if(d!==f.module)throw Error("Multiple namespaces detected.");}}catch(k){var h={error:k}}finally{try{g&&
!g.done&&(b=e.return)&&b.call(e)}finally{if(h)throw h.error;}}return d};b.prototype.getImports=function(a){switch(this.getImportNamespace(a)){case "wasi_unstable":return{wasi_unstable:this.wasiImport};case "wasi_snapshot_preview1":return{wasi_snapshot_preview1:this.wasiImport};default:throw Error("Can't detect a WASI namespace for the WebAssembly Module");}};b.defaultBindings=rj;return b}(),Qk=function(){function b(a){this.options=a}b.prototype.run=function(){return rg(this,void 0,void 0,function(){return sg(this,
function(){throw Error("run not implemented by the Command subclass");})})};return b}(),Rk=function(b){function a(a){var c=b.call(this,a)||this;if(!a.module)throw Error("Did not find a WebAssembly.Module for the WASI Command");return c}pg(a,b);a.prototype.run=function(a){return rg(this,void 0,void 0,function(){var b,c,g,f;return sg(this,function(d){switch(d.label){case 0:return b={preopens:qg({".":".","/":"/"},this.options.preopens||{}),env:this.options.env,args:this.options.args,bindings:qg(qg({},
Pk.defaultBindings),{fs:a.fs})},c=new Pk(b),g=this.options.module,[4,WebAssembly.instantiate(g,qg({},c.getImports(g)))];case 1:return f=d.sent(),c.start(f),[2]}})})};return a}(Qk),Sk=function(b){function a(a){var c=b.call(this,a)||this;if(!a.callback)throw Error("The Command Options provided are not for a Callback Command");c.callback=a.callback;return c}pg(a,b);a.prototype.run=function(a){return rg(this,void 0,void 0,function(){var b;return sg(this,function(c){switch(c.label){case 0:return[4,Promise.resolve(this.callback(this.options,
a))];case 1:return b=c.sent(),"string"==typeof b&&a.fs.writeFileSync("/dev/stdout",(new TextEncoder).encode(b+"\n")),[2]}})})};return a}(Qk),Tk=function(){function b(a,b,d,e,g,f,h,k,r){var c=this;this.stdinPrompt="";this.commandOptions=a;this.wasmFs=new mg;this.wasmFs.fromJSON(b);this.originalWasmFsJson=b;this.ioDevices=new Qh(this.wasmFs);this.ioDeviceWindow=f;this.ioDevices.setWindowSizeCallback(function(){var a=c.ioDevices.getWindowSize();c.ioDeviceWindow.resize(a[0],a[1])});this.ioDevices.setBufferIndexDisplayCallback(function(){var a=
c.ioDevices.getFrameBuffer();c.ioDeviceWindow.drawRgbaArrayToFrameBuffer(a)});this.ioDevices.setInputCallback(function(){if(c.sharedIoDeviceInput){c.ioDeviceWindow.getInputBuffer();Atomics.wait(c.sharedIoDeviceInput,0,-1);var a=c.sharedIoDeviceInput[0];c.sharedIoDeviceInput[0]=-1;if(0<a){for(var b=new Uint8Array(a),d=0;d<a;d++)b[d]=c.sharedIoDeviceInput[d+1];return b}return new Uint8Array}return c.ioDeviceWindow.getInputBuffer()});this.dataCallback=d;this.endCallback=e;this.errorCallback=g;b=void 0;
h&&(b=new Int32Array(h));this.sharedIoDeviceInput=b;h=void 0;k&&(h=new Int32Array(k));this.command=a.module?new Rk(a):new Sk(a);this.wasmFs.volume.fds[0].node.read=this.stdinRead.bind(this);this.wasmFs.volume.fds[1].node.write=this.stdoutWrite.bind(this);this.wasmFs.volume.fds[2].node.write=this.stdoutWrite.bind(this);a=this.wasmFs.volume.openSync("/dev/tty","w+");this.wasmFs.volume.fds[a].node.read=this.stdinRead.bind(this);this.wasmFs.volume.fds[a].node.write=this.stdoutWrite.bind(this);this.sharedStdin=
h;this.startStdinReadCallback=r;this.readStdinCounter=0;this.pipedStdin=""}b.prototype.start=function(a){return rg(this,void 0,void 0,function(){var b,d,e,g=this;return sg(this,function(c){switch(c.label){case 0:b=function(){g.ioDeviceWindow.resize(0,0);setTimeout(function(){g.endCallback(g.wasmFs.toJSON())},50)},c.label=1;case 1:return c.trys.push([1,3,,4]),a&&(this.pipedStdin=(new TextDecoder("utf-8")).decode(a)),[4,this.command.run(this.wasmFs)];case 2:return c.sent(),b(),[3,4];case 3:d=c.sent();
if(d instanceof pj)return b(),[2];e="Unknown Error";if(void 0!==d.code)e="exited with code: "+d.code;else if(void 0!==d.signal)e="killed with signal: "+d.signal;else if(void 0!==d.user)return b(),[2];console.error(d);this.errorCallback(e,this.wasmFs.toJSON(),void 0!==d.user);return[3,4];case 4:return[2]}})})};b.prototype.stdoutWrite=function(a){this.dataCallback&&this.dataCallback(a);var b=(new TextDecoder("utf-8")).decode(a).split("\n");this.stdinPrompt=0<b.length?b[b.length-1].replace(/[\u001B\u009B][[\]()#;?]*(?:(?:(?:[a-zA-Z\d]*(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><~]))/g,
""):"";return a.length};b.prototype.stdinRead=function(a){if(0!==this.readStdinCounter%2)return this.readStdinCounter++,0;if(this.pipedStdin){var b=this.pipedStdin;this.pipedStdin="";this.readStdinCounter++}else if(this.sharedStdin&&this.startStdinReadCallback){this.startStdinReadCallback();Atomics.wait(this.sharedStdin,0,-1);b=this.sharedStdin[0];this.sharedStdin[0]=-1;for(var d=new Uint8Array(b),e=0;e<b;e++)d[e]=this.sharedStdin[1+e];b=(new TextDecoder("utf-8")).decode(d)}else{b=prompt("Please enter text for stdin:\n"+
this.stdinPrompt);if(null===b)throw this.dataCallback&&this.dataCallback((new TextEncoder).encode("\n")),a=Error("Process killed by user"),a.user=!0,a;b+="\n";this.dataCallback&&this.dataCallback((new TextEncoder).encode(b))}if(!b)return 0;b=(new TextEncoder).encode(b);for(d=0;d<b.length;++d)a[d]=b[d];return b.length};return b}(),Uk=function(){function b(a){this.oldPopupKeyCodes=[];this.popupKeyCodes=[];this.oldMouseMovePosition={x:0,y:0};this.mouseMovePosition={x:0,y:0};this.mouseMiddleClickPosition=
this.mouseRightClickPosition=this.mouseLeftClickPosition=void 0;a&&(this.sharedIoDeviceInput=new Int32Array(a))}b.prototype.resize=function(a,b){0===a&&0===b?this.close():this.popupWindow&&this.popupCanvas&&this.popupCanvasContext?(this.popupCanvas.width=a,this.popupCanvas.height=b,this.popupImageData=this.popupCanvasContext.getImageData(0,0,a,b)):this._open(a,b)};b.prototype.close=function(){this.popupWindow&&(this.popupWindow.close(),this.popupWindow=void 0)};b.prototype.drawRgbaArrayToFrameBuffer=
function(a){this.popupCanvas&&this.popupCanvasContext&&this.popupImageData&&(this.popupImageData.data.set(a),this.popupCanvasContext.putImageData(this.popupImageData,0,0))};b.prototype.getInputBuffer=function(){var a=this,b=[];this.popupKeyCodes.forEach(function(c){a.oldPopupKeyCodes.includes(c)||(b.push(1),b.push(c))});if(this.oldMouseMovePosition.x!==this.mouseMovePosition.x||this.oldMouseMovePosition.y!==this.mouseMovePosition.y)b.push(2),this._append32BitIntToByteArray(this.mouseMovePosition.x,
b),this._append32BitIntToByteArray(this.mouseMovePosition.y,b);this.oldMouseMovePosition=this.mouseMovePosition;this.oldPopupKeyCodes.forEach(function(c){a.popupKeyCodes.includes(c)||(b.push(3),b.push(c))});this.oldPopupKeyCodes=this.popupKeyCodes.slice(0);this.mouseLeftClickPosition&&(b.push(4),this._append32BitIntToByteArray(this.mouseLeftClickPosition.x,b),this._append32BitIntToByteArray(this.mouseLeftClickPosition.y,b),this.mouseLeftClickPosition=void 0);this.mouseRightClickPosition&&(b.push(5),
this._append32BitIntToByteArray(this.mouseRightClickPosition.x,b),this._append32BitIntToByteArray(this.mouseRightClickPosition.y,b),this.mouseRightClickPosition=void 0);this.mouseMiddleClickPosition&&(b.push(4),this._append32BitIntToByteArray(this.mouseMiddleClickPosition.x,b),this._append32BitIntToByteArray(this.mouseMiddleClickPosition.y,b),this.mouseMiddleClickPosition=void 0);var d=new Uint8Array(b);if(this.sharedIoDeviceInput){for(var e=0;e<d.length;e++)this.sharedIoDeviceInput[e+1]=d[e];this.sharedIoDeviceInput[0]=
d.length;Atomics.notify(this.sharedIoDeviceInput,0,1)}return d};b.prototype._open=function(a,b){var c=Math.min(Math.floor(screen.width/a),Math.floor(screen.height/b));this.popupWindow=window.open("about:blank","WasmerExperimentalFramebuffer","width="+a*c+",height="+b*c);this.popupWindow.document.body.innerHTML='\n <style>\n html, body {\n width: 100%;\n height: 100%;\n }\n\n body {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n margin: 0px;\n margin-left: auto;\n margin-right: auto;\n }\n\n #io-device-framebuffer {\n\n width: 100%;\n height: auto;\n\n /* Will Keep pixel art looking good */\n image-rendering: pixelated;\n image-rendering: -moz-crisp-edges;\n image-rendering: crisp-edges;\n }\n </style>\n <canvas id="io-device-framebuffer" width="'+
a+'" height="'+b+'"></canvas>\n ';this.popupWindow.document.head.innerHTML="\n <title>Wasmer Experimental Framebuffer</title>\n ";this.popupCanvas=this.popupWindow.document.querySelector("#io-device-framebuffer");this.popupCanvasContext=this.popupCanvas.getContext("2d");this.popupImageData=this.popupCanvasContext.getImageData(0,0,a,b);this.popupWindow.document.addEventListener("keydown",this._eventListenerKeydown.bind(this));this.popupWindow.document.addEventListener("keyup",this._eventListenerKeyup.bind(this));
this.popupWindow.document.addEventListener("mousemove",this._eventListenerMousemove.bind(this));this.popupWindow.document.addEventListener("click",this._eventListenerClick.bind(this))};b.prototype._append32BitIntToByteArray=function(a,b){for(var c=0;4>c;c++){var e=a;e&=255<<8*c;e>>=8*c;b.push(e)}};b.prototype._eventListenerKeydown=function(a){a.preventDefault();this.popupKeyCodes.includes(a.keyCode)||this.popupKeyCodes.push(a.keyCode)};b.prototype._eventListenerKeyup=function(a){a.preventDefault();
a=this.popupKeyCodes.indexOf(a.keyCode);-1<a&&this.popupKeyCodes.splice(a,1)};b.prototype._eventListenerMousemove=function(a){a=this._getPositionFromMouseEvent(a);void 0!==a&&(this.mouseMovePosition=a)};b.prototype._eventListenerClick=function(a){var b=this._getPositionFromMouseEvent(a);void 0!==b&&(0===a.button?this.mouseLeftClickPosition=b:1===a.button?this.mouseMiddleClickPosition=b:2===a.button&&(this.mouseRightClickPosition=b))};b.prototype._getPositionFromMouseEvent=function(a){if(this.popupCanvas){var b=
this.popupCanvas.getBoundingClientRect(),d=b.x,e=b.x+b.width,g=b.y,f=b.y+b.height,h=void 0,k=void 0;a.x>=d&&a.x<=e&&(h=a.x-d);a.y>=g&&a.y<=f&&(k=a.y-g);if(void 0!==h&&void 0!==k)return{x:this.popupCanvas.width/b.width*h,y:this.popupCanvas.height/b.height*k}}};return b}();function Vk(b){return b&&("[object Function]"===Object.prototype.toString.call(b)||"function"===typeof b||b instanceof Function)}
var Wk,Xk=function(){function b(a,b,d,e,g){this.wasmTerminalConfig=a;this.commandString=b;this.commandStartReadCallback=d;this.commandEndCallback=e;g&&(this.wasmTty=g);this.commandOptionsForProcessesToRun=[];this.spawnedProcessObjects=[];this.spawnedProcesses=0;this.pipedStdinDataForNextProcess=new Uint8Array;this.isRunning=!1;this.supportsSharedArrayBuffer=this.wasmTerminalConfig.processWorkerUrl&&window.SharedArrayBuffer&&window.Atomics}b.prototype.runCommand=function(){return rg(this,void 0,void 0,
function(){var a,b,d;return sg(this,function(c){switch(c.label){case 0:a=Mh(this.commandString),c.label=1;case 1:c.trys.push([1,3,,4]);if(1<a.length)throw Error("Only one command permitted");if("command"!==a[0].type)throw Error("Only commands allowed");b=this;return[4,this._getCommandOptionsFromAST(a[0],this.wasmTerminalConfig,this.wasmTty)];case 2:return b.commandOptionsForProcessesToRun=c.sent(),[3,4];case 3:return d=c.sent(),this.wasmTty&&(this.wasmTty.print("\r\n"),this.wasmTty.print("wasm shell: parse error ("+
d.toString()+")\r\n")),console.error(d),this.commandEndCallback(),[2];case 4:return this.isRunning=!0,[4,this._tryToSpawnProcess(0)];case 5:return c.sent(),[2]}})})};b.prototype.kill=function(){this.isRunning&&(this.spawnedProcessObjects.forEach(function(a){a.worker&&a.worker.terminate();a.ioDeviceWindow&&a.ioDeviceWindow.close()}),this.commandOptionsForProcessesToRun=[],this.spawnedProcessObjects=[],this.isRunning=!1,this.commandEndCallback())};b.prototype._addStdinToSharedStdin=function(a,b){if(this.spawnedProcessObjects[b]){var c=
this.spawnedProcessObjects[b].sharedStdin,e=1;0<c[0]&&(e=c[0]);a.forEach(function(a,b){c[e+b]=a});c[0]=e+a.length-1;Atomics.notify(c,0,1)}};b.prototype._tryToSpawnProcess=function(a){return rg(this,void 0,void 0,function(){return sg(this,function(b){switch(b.label){case 0:if(!(a+1>this.spawnedProcesses&&2>this.spawnedProcessObjects.length&&a<this.commandOptionsForProcessesToRun.length))return[3,2];this.spawnedProcesses++;return[4,this._spawnProcess(a)];case 1:b.sent(),b.label=2;case 2:return[2]}})})};
b.prototype._spawnProcess=function(a){return rg(this,void 0,void 0,function(){var b,d;return sg(this,function(c){switch(c.label){case 0:return b=void 0,this.commandOptionsForProcessesToRun[a].module&&this.supportsSharedArrayBuffer?[4,this._spawnProcessAsWorker(a)]:[3,2];case 1:return b=c.sent(),[3,4];case 2:return[4,this._spawnProcessAsService(a)];case 3:b=c.sent(),c.label=4;case 4:return this.spawnedProcessObjects.push(b),b.process.start(0<this.pipedStdinDataForNextProcess.length?this.pipedStdinDataForNextProcess:
void 0),0<this.pipedStdinDataForNextProcess.length&&(this.pipedStdinDataForNextProcess=new Uint8Array),d=!1,this.commandOptionsForProcessesToRun.length>a+1&&(d=void 0!==this.commandOptionsForProcessesToRun[a+1].callback),this.supportsSharedArrayBuffer&&!d&&this._tryToSpawnProcess(a+1),[2]}})})};b.prototype._spawnProcessAsWorker=function(a){return rg(this,void 0,void 0,function(){var b,d,e,g,f,h,k,r,q,t;return sg(this,function(c){switch(c.label){case 0:if(!this.wasmTerminalConfig.processWorkerUrl)throw Error("Terminal Config missing the Process Worker URL");
b=this.wasmTerminalConfig.processWorkerUrl;b="data:application/javascript;base64,LyoKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBDb3B5cmlnaHQgKGMpIE1pY3Jvc29mdCBDb3Jwb3JhdGlvbi4gQWxsIHJpZ2h0cyByZXNlcnZlZC4KICAgIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSAiTGljZW5zZSIpOyB5b3UgbWF5IG5vdCB1c2UKICAgIHRoaXMgZmlsZSBleGNlcHQgaW4gY29tcGxpYW5jZSB3aXRoIHRoZSBMaWNlbnNlLiBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlCiAgICBMaWNlbnNlIGF0IGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlc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ZGF0YUNhbGxiYWNrKChuZXcgVGV4dEVuY29kZXIpLmVuY29kZShkKSl9aWYoIWQpcmV0dXJuIDA7ZD0obmV3IFRleHRFbmNvZGVyKS5lbmNvZGUoZCk7Zm9yKGU9MDtlPGQubGVuZ3RoOysrZSlhW2VdPWRbZV07cmV0dXJuIGQubGVuZ3RofTtyZXR1cm4gYX0oKTttYyh3aCl9KSgpCg==";
return[4,this._getBlobUrlForProcessWorker(b,this.wasmTty)];case 1:return d=c.sent(),e=new Worker(d),g=yh(e,[],void 0),f=new SharedArrayBuffer(8192),h=this.wasmTerminalConfig.wasmFs.toJSON(),k=new SharedArrayBuffer(8192),r=new Uk(k),[4,new g(this.commandOptionsForProcessesToRun[a],h,Bh(this._processDataCallback.bind(this,{commandOptionIndex:a,sync:!1})),Bh(this._processEndCallback.bind(this,{commandOptionIndex:a,processWorker:e})),Bh(this._processErrorCallback.bind(this,{commandOptionIndex:a})),Bh(r),
k,f,Bh(this._processStartStdinReadCallback.bind(this)))];case 2:return q=c.sent(),t=new Int32Array(f),t[0]=-1,[2,{process:q,commandOptionIndex:a,ioDeviceWindow:r,worker:e,sharedStdin:t}]}})})};b.prototype._spawnProcessAsService=function(a){return rg(this,void 0,void 0,function(){var b,d,e;return sg(this,function(){b=this.wasmTerminalConfig.wasmFs.toJSON();d=new Uk;e=new Tk(this.commandOptionsForProcessesToRun[a],b,this._processDataCallback.bind(this,{commandOptionIndex:a,sync:!0}),this._processEndCallback.bind(this,
{commandOptionIndex:a}),this._processErrorCallback.bind(this,{commandOptionIndex:a}),d);return[2,{process:e,commandOptionIndex:a,ioDeviceWindow:d}]})})};b.prototype._processDataCallback=function(a,b){var c=a.commandOptionIndex;a=a.sync;this.isRunning&&(c<this.commandOptionsForProcessesToRun.length-1?this.supportsSharedArrayBuffer&&1<this.spawnedProcessObjects.length&&this.spawnedProcessObjects[this.spawnedProcessObjects.length-1].commandOptionIndex>c?this._addStdinToSharedStdin(b,1):(c=new Uint8Array(b.length+
this.pipedStdinDataForNextProcess.length),c.set(this.pipedStdinDataForNextProcess),c.set(b,this.pipedStdinDataForNextProcess.length),this.pipedStdinDataForNextProcess=c):(b=(new TextDecoder("utf-8")).decode(b),this.wasmTty&&this.wasmTty.print(b,a)))};b.prototype._processEndCallback=function(a,b){var c=a.commandOptionIndex;(a=a.processWorker)&&a.terminate();b&&this.wasmTerminalConfig.wasmFs.fromJSON(b);c<this.commandOptionsForProcessesToRun.length-1?this._tryToSpawnProcess(c+1):(this.isRunning=!1,
this.commandEndCallback());this.spawnedProcessObjects.shift()};b.prototype._processErrorCallback=function(a,b,d){console.error(this.commandOptionsForProcessesToRun[a.commandOptionIndex].args[0]+": "+b);d&&this.wasmTerminalConfig.wasmFs.fromJSON(d);this.kill();this.commandEndCallback()};b.prototype._processStartStdinReadCallback=function(){var a=this;this.commandStartReadCallback().then(function(b){b=(new TextEncoder).encode(b+"\n");a._addStdinToSharedStdin(b,0)})};b.prototype._getBlobUrlForProcessWorker=
function(a,b){return rg(this,void 0,void 0,function(){var c,e;return sg(this,function(d){switch(d.label){case 0:if(Wk)return[2,Wk];b&&b.printStatus("[INFO] Downloading the process Web Worker (This happens once)...");return[4,Promise.all([fetch(a).then(function(a){return a.text()}),new Promise(function(a){return setTimeout(a,500)})]).then(function(a){return a[0]})];case 1:return c=d.sent(),b&&b.clearStatus(),e=new Blob([c]),Wk=window.URL.createObjectURL(e),[2,Wk]}})})};b.prototype._getCommandOptionsFromAST=
function(a,b,d){return rg(this,void 0,void 0,function(){var c,g,f,h,k,r,q,t,v,l,n,y,B=this;return sg(this,function(e){switch(e.label){case 0:return c=[],g=a.command.value,f=a.args.map(function(a){return a.value}),h=ug([g],f),k=Object.entries(a.env).map(function(a){a=tg(a,2);return[a[0],a[1].value]}),r={},k.forEach(function(a){a=tg(a,2);r[a[0]]=a[1]}),d&&(q=d.getTermSize(),t=q.rows,v=q.cols,r.LINES=t,r.COLUMNS=v),l=function(){return rg(B,void 0,void 0,function(){var e,f;return sg(this,function(g){switch(g.label){case 0:return a.redirects?
(e=a.redirects[0])&&"pipe"===e.type?[4,this._getCommandOptionsFromAST(e.command,b,d)]:[3,2]:[3,2];case 1:f=g.sent(),c=c.concat(f),g.label=2;case 2:return[2]}})})},[4,l()];case 1:return e.sent(),d&&d.printStatus("[INFO] Fetching the command "+g+" ..."),[4,b.fetchCommand({args:h,env:r})];case 2:return n=e.sent(),d&&d.clearStatus(),n instanceof Uint8Array?[4,WebAssembly.compile(n)]:[3,4];case 3:return y=e.sent(),c.unshift({args:h,env:r,module:y}),[3,5];case 4:Vk(n)?c.unshift({args:h,env:r,callback:n}):
c.unshift(n),e.label=5;case 5:return[2,c]}})})};return b}(),Yk=function(){function b(a,b,d){var c=this;void 0===d&&(d={historySize:10,maxAutocompleteEntries:100});this.handleCursorMove=function(a){0<a?(a=Math.min(a,c.wasmTty.getInput().length-c.wasmTty.getCursor()),c.wasmTty.setCursorDirectly(c.wasmTty.getCursor()+a)):0>a&&(a=Math.max(a,-c.wasmTty.getCursor()),c.wasmTty.setCursorDirectly(c.wasmTty.getCursor()+a))};this.handleCursorErase=function(a){a?0>=c.wasmTty.getCursor()||(a=c.wasmTty.getInput().substr(0,
c.wasmTty.getCursor()-1)+c.wasmTty.getInput().substr(c.wasmTty.getCursor()),c.wasmTty.clearInput(),c.wasmTty.setCursorDirectly(c.wasmTty.getCursor()-1),c.wasmTty.setInput(a,!0)):(a=c.wasmTty.getInput().substr(0,c.wasmTty.getCursor())+c.wasmTty.getInput().substr(c.wasmTty.getCursor()+1),c.wasmTty.setInput(a))};this.handleCursorInsert=function(a){var b=c.wasmTty.getInput().substr(0,c.wasmTty.getCursor())+a+c.wasmTty.getInput().substr(c.wasmTty.getCursor());c.wasmTty.setCursorDirectly(c.wasmTty.getCursor()+
a.length);c.wasmTty.setInput(b)};this.handleReadComplete=function(){c._activePrompt&&c._activePrompt.resolve&&(c._activePrompt.resolve(c.wasmTty.getInput()),c._activePrompt=void 0);c.wasmTty.print("\r\n");c._active=!1};this.handleTermData=function(a){if(c._active||"\u0003"===a){if(c.wasmTty.getFirstInit()&&c._activePrompt){var b=c.wasmTty.getBuffer().getLine(c.wasmTty.getBuffer().cursorY+c.wasmTty.getBuffer().baseY).translateToString(!1,0,c.wasmTty.getBuffer().cursorX);c._activePrompt.promptPrefix=
b;c.wasmTty.setPromptPrefix(b);c.wasmTty.setFirstInit(!1)}c._activeCharPrompt&&c._activeCharPrompt.resolve?(c._activeCharPrompt.resolve(a),c._activeCharPrompt=void 0,c.wasmTty.print("\r\n")):3<a.length&&27!==a.charCodeAt(0)?(a=a.replace(/[\r\n]+/g,"\r"),Array.from(a).forEach(function(a){return c.handleData(a)})):c.handleData(a)}};this.handleData=function(a){if(c._active||"\u0003"===a){var b=a.charCodeAt(0);if(27===b)switch(a.substr(1)){case "[A":c.history&&(a=c.history.getPrevious())&&(c.wasmTty.setInput(a),
c.wasmTty.setCursor(a.length));break;case "[B":c.history&&((a=c.history.getNext())||(a=""),c.wasmTty.setInput(a),c.wasmTty.setCursor(a.length));break;case "[D":c.handleCursorMove(-1);break;case "[C":c.handleCursorMove(1);break;case "[3~":c.handleCursorErase(!1);break;case "[F":c.wasmTty.setCursor(c.wasmTty.getInput().length);break;case "[H":c.wasmTty.setCursor(0);break;case "b":(a=Hg(c.wasmTty.getInput(),c.wasmTty.getCursor()))&&c.wasmTty.setCursor(a);break;case "f":(a=Ig(c.wasmTty.getInput(),c.wasmTty.getCursor()))&&
c.wasmTty.setCursor(a);break;case "\u007f":if(a=Hg(c.wasmTty.getInput(),c.wasmTty.getCursor()))c.wasmTty.setInput(c.wasmTty.getInput().substr(0,a)+c.wasmTty.getInput().substr(c.wasmTty.getCursor())),c.wasmTty.setCursor(a)}else if(32>b||127===b)switch(a){case "\r":case "\n":case "\r":Jg(c.wasmTty.getInput())?c.handleCursorInsert("\n"):c.handleReadComplete();break;case "\u007f":case "\b":case "\u0004":c.handleCursorErase(!0);break;case "\t":if(0<c._autocompleteHandlers.length){a=c.wasmTty.getInput().substr(0,
c.wasmTty.getCursor());b=Kg(a);var d=Mg(c._autocompleteHandlers,a);d.sort();0===d.length?b||c.handleCursorInsert(" "):1===d.length?(a=Lg(a),c.handleCursorInsert(d[0].substr(a.length)+" ")):d.length<=c.maxAutocompleteEntries?c.printAndRestartPrompt(function(){c.wasmTty.printWide(d)}):c.printAndRestartPrompt(function(){return c.wasmTty.readChar("Display all "+d.length+" possibilities? (y or n)").promise.then(function(a){"y"!==a&&"Y"!==a||c.wasmTty.printWide(d)})})}else c.handleCursorInsert(" ");
break;case "\u0001":c.wasmTty.setCursor(0);break;case "\u0002":c.handleCursorMove(-1);break;case "\u0003":case "\u001a":a=c.wasmTty.getInput();c.wasmTty.setCursor(a.length);c.wasmTty.setInput("");c.wasmTty.setCursorDirectly(0);c.wasmTty.print(a+"^C\r\n");c.history&&c.history.rewind();c.commandRunner&&(c.commandRunner.kill(),c.commandRunner=void 0);c.resolveActiveRead();break;case "\u0005":c.wasmTty.setCursor(c.wasmTty.getInput().length);break;case "\u0006":c.handleCursorMove(1);break;case "\u0007":c.history&&
c.history.rewind();c.wasmTty.setInput("");break;case "\x0B":c.wasmTty.setInput(c.wasmTty.getInput().substring(0,c.wasmTty.getCursor()));c.wasmTty.setCursor(c.wasmTty.getInput().length);break;case "\f":c.wasmTty.clearTty();c.wasmTty.print("$ "+c.wasmTty.getInput());break;case "\u000e":c.history&&((a=c.history.getNext())||(a=""),c.wasmTty.setInput(a),c.wasmTty.setCursor(a.length));break;case "\u0010":c.history&&(a=c.history.getPrevious())&&(c.wasmTty.setInput(a),c.wasmTty.setCursor(a.length));break;
case "\u0015":c.wasmTty.setInput(c.wasmTty.getInput().substring(c.wasmTty.getCursor())),c.wasmTty.setCursor(0)}else c.handleCursorInsert(a)}};this.wasmTerminalConfig=a;this.wasmTty=b;this.history=new Ng(d.historySize);this.commandRunner=void 0;this.maxAutocompleteEntries=d.maxAutocompleteEntries;this._autocompleteHandlers=[function(){return c.history.entries}];this._active=!1}b.prototype.prompt=function(){return rg(this,void 0,void 0,function(){var a,b;return sg(this,function(c){switch(c.label){case 0:if(this._activePrompt)return[2];
c.label=1;case 1:return c.trys.push([1,4,,5]),this._activePrompt=this.wasmTty.read("$ "),this._active=!0,[4,this._activePrompt.promise];case 2:a=c.sent();this.commandRunner&&this.commandRunner.kill();if(""===a)return this.prompt(),[2];if("!!"===a)if(this.history&&0<this.history.entries.length)a=this.history.entries[this.history.entries.length-1];else throw Error("No Previous command in History");else this.history&&this.history.push(this.wasmTty.getInput());this.commandRunner=this.getCommandRunner(a);
return[4,this.commandRunner.runCommand()];case 3:return c.sent(),[3,5];case 4:return b=c.sent(),this.wasmTty.println(""+b.toString()),this.prompt(),[3,5];case 5:return[2]}})})};b.prototype.isPrompting=function(){return this._active};b.prototype.getCommandRunner=function(a){var b=this;return new Xk(this.wasmTerminalConfig,a,function(){return rg(b,void 0,void 0,function(){return sg(this,function(){this._activePrompt=this.wasmTty.read("");this._active=!0;return[2,this._activePrompt.promise]})})},function(){setTimeout(function(){b.prompt()})},
this.wasmTty)};b.prototype.printAndRestartPrompt=function(a){function b(){d.wasmTty.setCursor(d.wasmTty.getCursor());d.wasmTty.setInput(d.wasmTty.getInput())}var d=this;this.wasmTty.getCursor();this.wasmTty.setCursor(this.wasmTty.getInput().length);this.wasmTty.print("\r\n");(a=a())?a.then(b):b()};b.prototype.resolveActiveRead=function(){this._activePrompt&&this._activePrompt.resolve&&(this._activePrompt.resolve(""),this._activePrompt=void 0);this._activeCharPrompt&&this._activeCharPrompt.resolve&&
(this._activeCharPrompt.resolve(""),this._activeCharPrompt=void 0);this._active=!1};b.prototype.rejectActiveRead=function(a){void 0===a&&(a="aborted");(this._activePrompt||this._activeCharPrompt)&&this.wasmTty.print("\r\n");this._activePrompt&&this._activePrompt.reject&&(this._activePrompt.reject(Error(a)),this._activePrompt=void 0);this._activeCharPrompt&&this._activeCharPrompt.reject&&(this._activeCharPrompt.reject(Error(a)),this._activeCharPrompt=void 0);this._active=!1};return b}(),Zk=fa||ea.Terminal,
$k=["click","tap"],al=function(){function b(a){var b=this;this.handleTermResize=function(a){var c=a.rows;a=a.cols;b.wasmTty.clearInput();b.wasmTty.setTermSize(a,c);b.wasmTty.setInput(b.wasmTty.getInput(),!0)};this.wasmTerminalConfig=new ng(a);this.xterm=new Zk({});this.resizeEvent=this.xterm.onResize(this.handleTermResize);this.xterm.onKey(function(a){if(" "===a.key)return a.domEvent.preventDefault(),!1});this.container=void 0;this.webLinksAddon=new oa;this.fitAddon=new la;this.xterm.loadAddon(this.fitAddon);
this.xterm.loadAddon(this.webLinksAddon);this.wasmTerminalConfig=new ng(a);this.wasmTty=new wg(this.xterm);this.wasmShell=new Yk(this.wasmTerminalConfig,this.wasmTty);this.dataEvent=this.xterm.onData(this.wasmShell.handleTermData);this.isOpen=!1;this.pendingPrintOnOpen=""}b.prototype.open=function(a){var b=this,d=this.focus.bind(this);void 0!==this.container&&$k.forEach(function(a){b.container.removeEventListener(a,d)});this.container=a;this.xterm.open(a);this.isOpen=!0;setTimeout(function(){void 0!==
b.container&&$k.forEach(function(a){b.container.addEventListener(a,d)});b.pendingPrintOnOpen&&(b.wasmTty.print(b.pendingPrintOnOpen+"\n"),b.pendingPrintOnOpen="");b.wasmShell.prompt()})};b.prototype.fit=function(){this.fitAddon.fit()};b.prototype.focus=function(){this.xterm.focus();this.scrollToCursor()};b.prototype.scrollToCursor=function(){if(this.container){var a=this.wasmTty.getBuffer().cursorY,b=this.wasmTty.getSize(),d=this.container.getBoundingClientRect(),e=d.left;a=d.top+a/b.rows*d.height+
10;0>e&&(e=0);a>document.body.scrollHeight&&(a=document.body.scrollHeight);window.scrollTo(e,a)}};b.prototype.print=function(a,b){var c=this;a=a.replace(/\n\n/g,"\n \n");this.isOpen?this.wasmShell.isPrompting?this.wasmShell.printAndRestartPrompt(function(){c.wasmTty.print(a+"\n",b)}):this.wasmTty.print(a,b):this.pendingPrintOnOpen=this.pendingPrintOnOpen?this.pendingPrintOnOpen+a:a};b.prototype.runCommand=function(a){this.wasmShell.isPrompting()&&(this.wasmTty.setInput(a),this.wasmShell.handleReadComplete())};
b.prototype.destroy=function(){this.xterm.dispose();delete this.xterm};b.prototype.onPaste=function(a){this.wasmTty.print(a)};return b}();
function bl(b){return rg(void 0,void 0,void 0,function(){var a,c,d,e;return sg(this,function(g){switch(g.label){case 0:return[4,fetch("https://registry.wapm.io/graphql",{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({operationName:"shellGetCommandQuery",query:"query shellGetCommandQuery($command: String!) {\n command: getCommand(name: $command) {\n command\n module {\n abi\n publicUrl\n }\n packageVersion {\n package {\n displayName\n }\n }\n }\n}",variables:{command:b}})})];
case 1:return a=g.sent(),[4,a.json()];case 2:c=g.sent();d=function(a,b){a=a[b[0]];b.shift();return a?1<b.length?d(a,b):!0:!1};if(d(c,["data","command","module","publicUrl"])){e=c.data.command.module;if("wasi"!==e.abi)throw Error(b+" does not use the wasi abi. Currently, only the wasi abi is supported on the wapm shell.");return[2,e.publicUrl]}throw Error("command not found "+b);}})})}
function cl(b){return rg(void 0,void 0,void 0,function(){var a,c;return sg(this,function(d){switch(d.label){case 0:return[4,fetch(b)];case 1:return a=d.sent(),[4,a.arrayBuffer()];case 2:return c=d.sent(),[2,new Uint8Array(c)]}})})}export default al;function fetchCommandFromWAPM$1(b){var a=b.args;return rg(void 0,void 0,void 0,function(){var b,d;return sg(this,function(c){switch(c.label){case 0:return b=a[0],[4,bl(b)];case 1:return d=c.sent(),[4,cl(d)];case 2:return[2,c.sent()]}})})};export{fetchCommandFromWAPM$1 as fetchCommandFromWAPM}