UNPKG

vibetunnel

Version:

Terminal sharing server with web interface - supports macOS, Linux, and headless environments

1 lines 240 kB
var fi=Object.create;var Fe=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var pi=Object.getOwnPropertyNames;var gi=Object.getPrototypeOf,_i=Object.prototype.hasOwnProperty;var We=(y,t)=>()=>(y&&(t=y(y=0)),t);var mi=(y,t)=>()=>(t||y((t={exports:{}}).exports,t),t.exports),vi=(y,t)=>{for(var e in t)Fe(y,e,{get:t[e],enumerable:!0})},bi=(y,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of pi(t))!_i.call(y,d)&&d!==e&&Fe(y,d,{get:()=>t[d],enumerable:!(s=Bt(t,d))||s.enumerable});return y};var yi=(y,t,e)=>(e=y!=null?fi(gi(y)):{},bi(t||!y||!y.__esModule?Fe(e,"default",{value:y,enumerable:!0}):e,y));var O=(y,t,e,s)=>{for(var d=s>1?void 0:s?Bt(t,e):t,b=y.length-1,S;b>=0;b--)(S=y[b])&&(d=(s?S(t,e,d):S(d))||d);return s&&d&&Fe(t,e,d),d};var Qt=mi(Jt=>{(()=>{"use strict";var y={349:(S,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let g=h(460),p=h(844);class n extends p.Disposable{constructor(c){super(),this._maxLength=c,this.onDeleteEmitter=this.register(new g.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new g.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new g.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(c){if(this._maxLength===c)return;let u=new Array(c);for(let m=0;m<Math.min(c,this.length);m++)u[m]=this._array[this._getCyclicIndex(m)];this._array=u,this._maxLength=c,this._startIndex=0}get length(){return this._length}set length(c){if(c>this._length)for(let u=this._length;u<c;u++)this._array[u]=void 0;this._length=c}get(c){return this._array[this._getCyclicIndex(c)]}set(c,u){this._array[this._getCyclicIndex(c)]=u}push(c){this._array[this._getCyclicIndex(this._length)]=c,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new 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)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(c,u,...m){if(u){for(let i=c;i<this._length-u;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+u)];this._length-=u,this.onDeleteEmitter.fire({index:c,amount:u})}for(let i=this._length-1;i>=c;i--)this._array[this._getCyclicIndex(i+m.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<m.length;i++)this._array[this._getCyclicIndex(c+i)]=m[i];if(m.length&&this.onInsertEmitter.fire({index:c,amount:m.length}),this._length+m.length>this._maxLength){let i=this._length+m.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=m.length}trimStart(c){c>this._length&&(c=this._length),this._startIndex+=c,this._length-=c,this.onTrimEmitter.fire(c)}shiftElements(c,u,m){if(!(u<=0)){if(c<0||c>=this._length)throw new Error("start argument out of range");if(c+m<0)throw new Error("Cannot shift elements in list beyond index 0");if(m>0){for(let o=u-1;o>=0;o--)this.set(c+o+m,this.get(c+o));let i=c+u+m-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<u;i++)this.set(c+i+m,this.get(c+i))}}_getCyclicIndex(c){return(this._startIndex+c)%this._maxLength}}r.CircularList=n},439:(S,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function h(g,p=5){if(typeof g!="object")return g;let n=Array.isArray(g)?[]:{};for(let f in g)n[f]=p<=1?g[f]:g[f]&&h(g[f],p-1);return n}},969:(S,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let g=h(844),p=h(585),n=h(348),f=h(866),c=h(744),u=h(302),m=h(83),i=h(460),o=h(753),l=h(480),a=h(994),v=h(282),C=h(435),x=h(981),L=h(660),k=!1;class P extends g.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(R=>{this._onScrollApi?.fire(R.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(R){for(let B in R)this.optionsService.options[B]=R[B]}constructor(R){super(),this._windowsWrappingHeuristics=this.register(new g.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new u.OptionsService(R)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(c.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(m.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(a.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(L.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new x.WriteBuffer((B,D)=>this._inputHandler.parse(B,D))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(R,B){this._writeBuffer.write(R,B)}writeSync(R,B){this._logService.logLevel<=p.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(R,B)}input(R,B=!0){this.coreService.triggerDataEvent(R,B)}resize(R,B){isNaN(R)||isNaN(B)||(R=Math.max(R,c.MINIMUM_COLS),B=Math.max(B,c.MINIMUM_ROWS),this._bufferService.resize(R,B))}scroll(R,B=!1){this._bufferService.scroll(R,B)}scrollLines(R,B,D){this._bufferService.scrollLines(R,B,D)}scrollPages(R){this.scrollLines(R*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(R){let B=R-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)}registerEscHandler(R,B){return this._inputHandler.registerEscHandler(R,B)}registerDcsHandler(R,B){return this._inputHandler.registerDcsHandler(R,B)}registerCsiHandler(R,B){return this._inputHandler.registerCsiHandler(R,B)}registerOscHandler(R,B){return this._inputHandler.registerOscHandler(R,B)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let R=!1,B=this.optionsService.rawOptions.windowsPty;B&&B.buildNumber!==void 0&&B.buildNumber!==void 0?R=B.backend==="conpty"&&B.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(R=!0),R?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let R=[];R.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),R.push(this.registerCsiHandler({final:"H"},()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,g.toDisposable)(()=>{for(let B of R)B.dispose()})}}}r.CoreTerminal=P},460:(S,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let p=0;p<this._listeners.length;p++)if(this._listeners[p]===h)return void this._listeners.splice(p,1)}}})),this._event}fire(h,g){let p=[];for(let n=0;n<this._listeners.length;n++)p.push(this._listeners[n]);for(let n=0;n<p.length;n++)p[n].call(void 0,h,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(h,g){return h(p=>g.fire(p))},r.runAndSubscribe=function(h,g){return g(void 0),h(p=>g(p))}},435:function(S,r,h){var g=this&&this.__decorate||function(U,_,A,w){var T,M=arguments.length,$=M<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,A):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(U,_,A,w);else for(var z=U.length-1;z>=0;z--)(T=U[z])&&($=(M<3?T($):M>3?T(_,A,$):T(_,A))||$);return M>3&&$&&Object.defineProperty(_,A,$),$},p=this&&this.__param||function(U,_){return function(A,w){_(A,w,U)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let n=h(584),f=h(116),c=h(15),u=h(844),m=h(482),i=h(437),o=h(460),l=h(643),a=h(511),v=h(734),C=h(585),x=h(480),L=h(242),k=h(351),P=h(941),K={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function B(U,_){if(U>24)return _.setWinLines||!1;switch(U){case 1:return!!_.restoreWin;case 2:return!!_.minimizeWin;case 3:return!!_.setWinPosition;case 4:return!!_.setWinSizePixels;case 5:return!!_.raiseWin;case 6:return!!_.lowerWin;case 7:return!!_.refreshWin;case 8:return!!_.setWinSizeChars;case 9:return!!_.maximizeWin;case 10:return!!_.fullscreenWin;case 11:return!!_.getWinState;case 13:return!!_.getWinPosition;case 14:return!!_.getWinSizePixels;case 15:return!!_.getScreenSizePixels;case 16:return!!_.getCellSizePixels;case 18:return!!_.getWinSizeChars;case 19:return!!_.getScreenSizeChars;case 20:return!!_.getIconTitle;case 21:return!!_.getWinTitle;case 22:return!!_.pushTitle;case 23:return!!_.popTitle;case 24:return!!_.setWinLines}return!1}var D;(function(U){U[U.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",U[U.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(r.WindowsOptionsReportType=D={}));let ne=0;class ie extends u.Disposable{getAttrData(){return this._curAttrData}constructor(_,A,w,T,M,$,z,j,re=new c.EscapeSequenceParser){super(),this._bufferService=_,this._charsetService=A,this._coreService=w,this._logService=T,this._optionsService=M,this._oscLinkService=$,this._coreMouseService=z,this._unicodeService=j,this._parser=re,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new m.StringToUtf32,this._utf8Decoder=new m.Utf8ToUtf32,this._workCell=new a.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new o.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new o.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new o.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new o.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new o.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new o.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new o.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new o.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new o.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new o.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new o.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._parser.setCsiHandlerFallback((E,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:W.toArray()})}),this._parser.setEscHandlerFallback(E=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(E)})}),this._parser.setExecuteHandlerFallback(E=>{this._logService.debug("Unknown EXECUTE code: ",{code:E})}),this._parser.setOscHandlerFallback((E,W,I)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:W,data:I})}),this._parser.setDcsHandlerFallback((E,W,I)=>{W==="HOOK"&&(I=I.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:W,payload:I})}),this._parser.setPrintHandler((E,W,I)=>this.print(E,W,I)),this._parser.registerCsiHandler({final:"@"},E=>this.insertChars(E)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},E=>this.scrollLeft(E)),this._parser.registerCsiHandler({final:"A"},E=>this.cursorUp(E)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},E=>this.scrollRight(E)),this._parser.registerCsiHandler({final:"B"},E=>this.cursorDown(E)),this._parser.registerCsiHandler({final:"C"},E=>this.cursorForward(E)),this._parser.registerCsiHandler({final:"D"},E=>this.cursorBackward(E)),this._parser.registerCsiHandler({final:"E"},E=>this.cursorNextLine(E)),this._parser.registerCsiHandler({final:"F"},E=>this.cursorPrecedingLine(E)),this._parser.registerCsiHandler({final:"G"},E=>this.cursorCharAbsolute(E)),this._parser.registerCsiHandler({final:"H"},E=>this.cursorPosition(E)),this._parser.registerCsiHandler({final:"I"},E=>this.cursorForwardTab(E)),this._parser.registerCsiHandler({final:"J"},E=>this.eraseInDisplay(E,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},E=>this.eraseInDisplay(E,!0)),this._parser.registerCsiHandler({final:"K"},E=>this.eraseInLine(E,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},E=>this.eraseInLine(E,!0)),this._parser.registerCsiHandler({final:"L"},E=>this.insertLines(E)),this._parser.registerCsiHandler({final:"M"},E=>this.deleteLines(E)),this._parser.registerCsiHandler({final:"P"},E=>this.deleteChars(E)),this._parser.registerCsiHandler({final:"S"},E=>this.scrollUp(E)),this._parser.registerCsiHandler({final:"T"},E=>this.scrollDown(E)),this._parser.registerCsiHandler({final:"X"},E=>this.eraseChars(E)),this._parser.registerCsiHandler({final:"Z"},E=>this.cursorBackwardTab(E)),this._parser.registerCsiHandler({final:"`"},E=>this.charPosAbsolute(E)),this._parser.registerCsiHandler({final:"a"},E=>this.hPositionRelative(E)),this._parser.registerCsiHandler({final:"b"},E=>this.repeatPrecedingCharacter(E)),this._parser.registerCsiHandler({final:"c"},E=>this.sendDeviceAttributesPrimary(E)),this._parser.registerCsiHandler({prefix:">",final:"c"},E=>this.sendDeviceAttributesSecondary(E)),this._parser.registerCsiHandler({final:"d"},E=>this.linePosAbsolute(E)),this._parser.registerCsiHandler({final:"e"},E=>this.vPositionRelative(E)),this._parser.registerCsiHandler({final:"f"},E=>this.hVPosition(E)),this._parser.registerCsiHandler({final:"g"},E=>this.tabClear(E)),this._parser.registerCsiHandler({final:"h"},E=>this.setMode(E)),this._parser.registerCsiHandler({prefix:"?",final:"h"},E=>this.setModePrivate(E)),this._parser.registerCsiHandler({final:"l"},E=>this.resetMode(E)),this._parser.registerCsiHandler({prefix:"?",final:"l"},E=>this.resetModePrivate(E)),this._parser.registerCsiHandler({final:"m"},E=>this.charAttributes(E)),this._parser.registerCsiHandler({final:"n"},E=>this.deviceStatus(E)),this._parser.registerCsiHandler({prefix:"?",final:"n"},E=>this.deviceStatusPrivate(E)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},E=>this.softReset(E)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},E=>this.setCursorStyle(E)),this._parser.registerCsiHandler({final:"r"},E=>this.setScrollRegion(E)),this._parser.registerCsiHandler({final:"s"},E=>this.saveCursor(E)),this._parser.registerCsiHandler({final:"t"},E=>this.windowOptions(E)),this._parser.registerCsiHandler({final:"u"},E=>this.restoreCursor(E)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},E=>this.insertColumns(E)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},E=>this.deleteColumns(E)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},E=>this.selectProtected(E)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},E=>this.requestMode(E,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},E=>this.requestMode(E,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new L.OscHandler(E=>(this.setTitle(E),this.setIconName(E),!0))),this._parser.registerOscHandler(1,new L.OscHandler(E=>this.setIconName(E))),this._parser.registerOscHandler(2,new L.OscHandler(E=>this.setTitle(E))),this._parser.registerOscHandler(4,new L.OscHandler(E=>this.setOrReportIndexedColor(E))),this._parser.registerOscHandler(8,new L.OscHandler(E=>this.setHyperlink(E))),this._parser.registerOscHandler(10,new L.OscHandler(E=>this.setOrReportFgColor(E))),this._parser.registerOscHandler(11,new L.OscHandler(E=>this.setOrReportBgColor(E))),this._parser.registerOscHandler(12,new L.OscHandler(E=>this.setOrReportCursorColor(E))),this._parser.registerOscHandler(104,new L.OscHandler(E=>this.restoreIndexedColor(E))),this._parser.registerOscHandler(110,new L.OscHandler(E=>this.restoreFgColor(E))),this._parser.registerOscHandler(111,new L.OscHandler(E=>this.restoreBgColor(E))),this._parser.registerOscHandler(112,new L.OscHandler(E=>this.restoreCursorColor(E))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let E in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:E},()=>this.selectCharset("("+E)),this._parser.registerEscHandler({intermediates:")",final:E},()=>this.selectCharset(")"+E)),this._parser.registerEscHandler({intermediates:"*",final:E},()=>this.selectCharset("*"+E)),this._parser.registerEscHandler({intermediates:"+",final:E},()=>this.selectCharset("+"+E)),this._parser.registerEscHandler({intermediates:"-",final:E},()=>this.selectCharset("-"+E)),this._parser.registerEscHandler({intermediates:".",final:E},()=>this.selectCharset("."+E)),this._parser.registerEscHandler({intermediates:"/",final:E},()=>this.selectCharset("/"+E));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(E=>(this._logService.error("Parsing error: ",E),E)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler((E,W)=>this.requestStatusString(E,W)))}_preserveStack(_,A,w,T){this._parseStack.paused=!0,this._parseStack.cursorStartX=_,this._parseStack.cursorStartY=A,this._parseStack.decodedLength=w,this._parseStack.position=T}_logSlowResolvingAsync(_){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([_,new Promise((A,w)=>setTimeout(()=>w("#SLOW_TIMEOUT"),5e3))]).catch(A=>{if(A!=="#SLOW_TIMEOUT")throw A;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(_,A){let w,T=this._activeBuffer.x,M=this._activeBuffer.y,$=0,z=this._parseStack.paused;if(z){if(w=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,A))return this._logSlowResolvingAsync(w),w;T=this._parseStack.cursorStartX,M=this._parseStack.cursorStartY,this._parseStack.paused=!1,_.length>R&&($=this._parseStack.position+R)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof _=="string"?` "${_}"`:` "${Array.prototype.map.call(_,E=>String.fromCharCode(E)).join("")}"`),typeof _=="string"?_.split("").map(E=>E.charCodeAt(0)):_),this._parseBuffer.length<_.length&&this._parseBuffer.length<R&&(this._parseBuffer=new Uint32Array(Math.min(_.length,R))),z||this._dirtyRowTracker.clearRange(),_.length>R)for(let E=$;E<_.length;E+=R){let W=E+R<_.length?E+R:_.length,I=typeof _=="string"?this._stringDecoder.decode(_.substring(E,W),this._parseBuffer):this._utf8Decoder.decode(_.subarray(E,W),this._parseBuffer);if(w=this._parser.parse(this._parseBuffer,I))return this._preserveStack(T,M,I,E),this._logSlowResolvingAsync(w),w}else if(!z){let E=typeof _=="string"?this._stringDecoder.decode(_,this._parseBuffer):this._utf8Decoder.decode(_,this._parseBuffer);if(w=this._parser.parse(this._parseBuffer,E))return this._preserveStack(T,M,E,0),this._logSlowResolvingAsync(w),w}this._activeBuffer.x===T&&this._activeBuffer.y===M||this._onCursorMove.fire();let j=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),re=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);re<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(re,this._bufferService.rows-1),Math.min(j,this._bufferService.rows-1))}print(_,A,w){let T,M,$=this._charsetService.charset,z=this._optionsService.rawOptions.screenReaderMode,j=this._bufferService.cols,re=this._coreService.decPrivateModes.wraparound,E=this._coreService.modes.insertMode,W=this._curAttrData,I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&w-A>0&&I.getWidth(this._activeBuffer.x-1)===2&&I.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let N=this._parser.precedingJoinState;for(let Se=A;Se<w;++Se){if(T=_[Se],T<127&&$){let fe=$[String.fromCharCode(T)];fe&&(T=fe.charCodeAt(0))}let Ce=this._unicodeService.charProperties(T,N);M=x.UnicodeService.extractWidth(Ce);let Ne=x.UnicodeService.extractShouldJoin(Ce),ue=Ne?x.UnicodeService.extractWidth(N):0;if(N=Ce,z&&this._onA11yChar.fire((0,m.stringFromCodePoint)(T)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+M-ue>j){if(re){let fe=I,xe=this._activeBuffer.x-ue;for(this._activeBuffer.x=ue,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ue>0&&I instanceof i.BufferLine&&I.copyCellsFrom(fe,xe,0,ue,!1);xe<j;)fe.setCellFromCodepoint(xe++,0,1,W)}else if(this._activeBuffer.x=j-1,M===2)continue}if(Ne&&this._activeBuffer.x){let fe=I.getWidth(this._activeBuffer.x-1)?1:2;I.addCodepointToCell(this._activeBuffer.x-fe,T,M);for(let xe=M-ue;--xe>=0;)I.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(E&&(I.insertCells(this._activeBuffer.x,M-ue,this._activeBuffer.getNullCell(W)),I.getWidth(j-1)===2&&I.setCellFromCodepoint(j-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,W)),I.setCellFromCodepoint(this._activeBuffer.x++,T,M,W),M>0)for(;--M;)I.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=N,this._activeBuffer.x<j&&w-A>0&&I.getWidth(this._activeBuffer.x)===0&&!I.hasContent(this._activeBuffer.x)&&I.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(_,A){return _.final!=="t"||_.prefix||_.intermediates?this._parser.registerCsiHandler(_,A):this._parser.registerCsiHandler(_,w=>!B(w.params[0],this._optionsService.rawOptions.windowOptions)||A(w))}registerDcsHandler(_,A){return this._parser.registerDcsHandler(_,new k.DcsHandler(A))}registerEscHandler(_,A){return this._parser.registerEscHandler(_,A)}registerOscHandler(_,A){return this._parser.registerOscHandler(_,new L.OscHandler(A))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);_.hasWidth(this._activeBuffer.x)&&!_.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let _=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-_),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(_=this._bufferService.cols-1){this._activeBuffer.x=Math.min(_,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(_,A){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=_,this._activeBuffer.y=this._activeBuffer.scrollTop+A):(this._activeBuffer.x=_,this._activeBuffer.y=A),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(_,A){this._restrictCursor(),this._setCursor(this._activeBuffer.x+_,this._activeBuffer.y+A)}cursorUp(_){let A=this._activeBuffer.y-this._activeBuffer.scrollTop;return A>=0?this._moveCursor(0,-Math.min(A,_.params[0]||1)):this._moveCursor(0,-(_.params[0]||1)),!0}cursorDown(_){let A=this._activeBuffer.scrollBottom-this._activeBuffer.y;return A>=0?this._moveCursor(0,Math.min(A,_.params[0]||1)):this._moveCursor(0,_.params[0]||1),!0}cursorForward(_){return this._moveCursor(_.params[0]||1,0),!0}cursorBackward(_){return this._moveCursor(-(_.params[0]||1),0),!0}cursorNextLine(_){return this.cursorDown(_),this._activeBuffer.x=0,!0}cursorPrecedingLine(_){return this.cursorUp(_),this._activeBuffer.x=0,!0}cursorCharAbsolute(_){return this._setCursor((_.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(_){return this._setCursor(_.length>=2?(_.params[1]||1)-1:0,(_.params[0]||1)-1),!0}charPosAbsolute(_){return this._setCursor((_.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(_){return this._moveCursor(_.params[0]||1,0),!0}linePosAbsolute(_){return this._setCursor(this._activeBuffer.x,(_.params[0]||1)-1),!0}vPositionRelative(_){return this._moveCursor(0,_.params[0]||1),!0}hVPosition(_){return this.cursorPosition(_),!0}tabClear(_){let A=_.params[0];return A===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:A===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(_){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=_.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(_){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=_.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(_){let A=_.params[0];return A===1&&(this._curAttrData.bg|=536870912),A!==2&&A!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(_,A,w,T=!1,M=!1){let $=this._activeBuffer.lines.get(this._activeBuffer.ybase+_);$.replaceCells(A,w,this._activeBuffer.getNullCell(this._eraseAttrData()),M),T&&($.isWrapped=!1)}_resetBufferLine(_,A=!1){let w=this._activeBuffer.lines.get(this._activeBuffer.ybase+_);w&&(w.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),A),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+_),w.isWrapped=!1)}eraseInDisplay(_,A=!1){let w;switch(this._restrictCursor(this._bufferService.cols),_.params[0]){case 0:for(w=this._activeBuffer.y,this._dirtyRowTracker.markDirty(w),this._eraseInBufferLine(w++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);w<this._bufferService.rows;w++)this._resetBufferLine(w,A);this._dirtyRowTracker.markDirty(w);break;case 1:for(w=this._activeBuffer.y,this._dirtyRowTracker.markDirty(w),this._eraseInBufferLine(w,0,this._activeBuffer.x+1,!0,A),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(w+1).isWrapped=!1);w--;)this._resetBufferLine(w,A);this._dirtyRowTracker.markDirty(0);break;case 2:for(w=this._bufferService.rows,this._dirtyRowTracker.markDirty(w-1);w--;)this._resetBufferLine(w,A);this._dirtyRowTracker.markDirty(0);break;case 3:let T=this._activeBuffer.lines.length-this._bufferService.rows;T>0&&(this._activeBuffer.lines.trimStart(T),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-T,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-T,0),this._onScroll.fire(0))}return!0}eraseInLine(_,A=!1){switch(this._restrictCursor(this._bufferService.cols),_.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,A);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,A)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(_){this._restrictCursor();let A=_.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let w=this._activeBuffer.ybase+this._activeBuffer.y,T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-T+1;for(;A--;)this._activeBuffer.lines.splice(M-1,1),this._activeBuffer.lines.splice(w,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(_){this._restrictCursor();let A=_.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let w=this._activeBuffer.ybase+this._activeBuffer.y,T;for(T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,T=this._bufferService.rows-1+this._activeBuffer.ybase-T;A--;)this._activeBuffer.lines.splice(w,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(_){this._restrictCursor();let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.insertCells(this._activeBuffer.x,_.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(_){this._restrictCursor();let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.deleteCells(this._activeBuffer.x,_.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(_){let A=_.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(_){let A=_.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(_){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let A=_.params[0]||1;for(let w=this._activeBuffer.scrollTop;w<=this._activeBuffer.scrollBottom;++w){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+w);T.deleteCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(_){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let A=_.params[0]||1;for(let w=this._activeBuffer.scrollTop;w<=this._activeBuffer.scrollBottom;++w){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+w);T.insertCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(_){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let A=_.params[0]||1;for(let w=this._activeBuffer.scrollTop;w<=this._activeBuffer.scrollBottom;++w){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+w);T.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(_){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let A=_.params[0]||1;for(let w=this._activeBuffer.scrollTop;w<=this._activeBuffer.scrollBottom;++w){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+w);T.deleteCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(_){this._restrictCursor();let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(_.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(_){let A=this._parser.precedingJoinState;if(!A)return!0;let w=_.params[0]||1,T=x.UnicodeService.extractWidth(A),M=this._activeBuffer.x-T,$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(M),z=new Uint32Array($.length*w),j=0;for(let E=0;E<$.length;){let W=$.codePointAt(E)||0;z[j++]=W,E+=W>65535?2:1}let re=j;for(let E=1;E<w;++E)z.copyWithin(re,0,j),re+=j;return this.print(z,0,re),!0}sendDeviceAttributesPrimary(_){return _.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(_){return _.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(_.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(_){return(this._optionsService.rawOptions.termName+"").indexOf(_)===0}setMode(_){for(let A=0;A<_.length;A++)switch(_.params[A]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(_){for(let A=0;A<_.length;A++)switch(_.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();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._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();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 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";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._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(_){for(let A=0;A<_.length;A++)switch(_.params[A]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(_){for(let A=0;A<_.length;A++)switch(_.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016: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(),_.params[A]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(_,A){let w=this._coreService.decPrivateModes,{activeProtocol:T,activeEncoding:M}=this._coreMouseService,$=this._coreService,{buffers:z,cols:j}=this._bufferService,{active:re,alt:E}=z,W=this._optionsService.rawOptions,I=Ne=>Ne?1:2,N=_.params[0];return Se=N,Ce=A?N===2?4:N===4?I($.modes.insertMode):N===12?3:N===20?I(W.convertEol):0:N===1?I(w.applicationCursorKeys):N===3?W.windowOptions.setWinLines?j===80?2:j===132?1:0:0:N===6?I(w.origin):N===7?I(w.wraparound):N===8?3:N===9?I(T==="X10"):N===12?I(W.cursorBlink):N===25?I(!$.isCursorHidden):N===45?I(w.reverseWraparound):N===66?I(w.applicationKeypad):N===67?4:N===1e3?I(T==="VT200"):N===1002?I(T==="DRAG"):N===1003?I(T==="ANY"):N===1004?I(w.sendFocus):N===1005?4:N===1006?I(M==="SGR"):N===1015?4:N===1016?I(M==="SGR_PIXELS"):N===1048?1:N===47||N===1047||N===1049?I(re===E):N===2004?I(w.bracketedPasteMode):0,$.triggerDataEvent(`${n.C0.ESC}[${A?"":"?"}${Se};${Ce}$y`),!0;var Se,Ce}_updateAttrColor(_,A,w,T,M){return A===2?(_|=50331648,_&=-16777216,_|=v.AttributeData.fromColorRGB([w,T,M])):A===5&&(_&=-50331904,_|=33554432|255&w),_}_extractColor(_,A,w){let T=[0,0,-1,0,0,0],M=0,$=0;do{if(T[$+M]=_.params[A+$],_.hasSubParams(A+$)){let z=_.getSubParams(A+$),j=0;do T[1]===5&&(M=1),T[$+j+1+M]=z[j];while(++j<z.length&&j+$+1+M<T.length);break}if(T[1]===5&&$+M>=2||T[1]===2&&$+M>=5)break;T[1]&&(M=1)}while(++$+A<_.length&&$+M<T.length);for(let z=2;z<T.length;++z)T[z]===-1&&(T[z]=0);switch(T[0]){case 38:w.fg=this._updateAttrColor(w.fg,T[1],T[3],T[4],T[5]);break;case 48:w.bg=this._updateAttrColor(w.bg,T[1],T[3],T[4],T[5]);break;case 58:w.extended=w.extended.clone(),w.extended.underlineColor=this._updateAttrColor(w.extended.underlineColor,T[1],T[3],T[4],T[5])}return $}_processUnderline(_,A){A.extended=A.extended.clone(),(!~_||_>5)&&(_=1),A.extended.underlineStyle=_,A.fg|=268435456,_===0&&(A.fg&=-268435457),A.updateExtended()}_processSGR0(_){_.fg=i.DEFAULT_ATTR_DATA.fg,_.bg=i.DEFAULT_ATTR_DATA.bg,_.extended=_.extended.clone(),_.extended.underlineStyle=0,_.extended.underlineColor&=-67108864,_.updateExtended()}charAttributes(_){if(_.length===1&&_.params[0]===0)return this._processSGR0(this._curAttrData),!0;let A=_.length,w,T=this._curAttrData;for(let M=0;M<A;M++)w=_.params[M],w>=30&&w<=37?(T.fg&=-50331904,T.fg|=16777216|w-30):w>=40&&w<=47?(T.bg&=-50331904,T.bg|=16777216|w-40):w>=90&&w<=97?(T.fg&=-50331904,T.fg|=16777224|w-90):w>=100&&w<=107?(T.bg&=-50331904,T.bg|=16777224|w-100):w===0?this._processSGR0(T):w===1?T.fg|=134217728:w===3?T.bg|=67108864:w===4?(T.fg|=268435456,this._processUnderline(_.hasSubParams(M)?_.getSubParams(M)[0]:1,T)):w===5?T.fg|=536870912:w===7?T.fg|=67108864:w===8?T.fg|=1073741824:w===9?T.fg|=2147483648:w===2?T.bg|=134217728:w===21?this._processUnderline(2,T):w===22?(T.fg&=-134217729,T.bg&=-134217729):w===23?T.bg&=-67108865:w===24?(T.fg&=-268435457,this._processUnderline(0,T)):w===25?T.fg&=-536870913:w===27?T.fg&=-67108865:w===28?T.fg&=-1073741825:w===29?T.fg&=2147483647:w===39?(T.fg&=-67108864,T.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):w===49?(T.bg&=-67108864,T.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):w===38||w===48||w===58?M+=this._extractColor(_,M,T):w===53?T.bg|=1073741824:w===55?T.bg&=-1073741825:w===59?(T.extended=T.extended.clone(),T.extended.underlineColor=-1,T.updateExtended()):w===100?(T.fg&=-67108864,T.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,T.bg&=-67108864,T.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",w);return!0}deviceStatus(_){switch(_.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let A=this._activeBuffer.y+1,w=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${A};${w}R`)}return!0}deviceStatusPrivate(_){if(_.params[0]===6){let A=this._activeBuffer.y+1,w=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${A};${w}R`)}return!0}softReset(_){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(_){let 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"}let w=A%2==1;return this._optionsService.options.cursorBlink=w,!0}setScrollRegion(_){let A=_.params[0]||1,w;return(_.length<2||(w=_.params[1])>this._bufferService.rows||w===0)&&(w=this._bufferService.rows),w>A&&(this._activeBuffer.scrollTop=A-1,this._activeBuffer.scrollBottom=w-1,this._setCursor(0,0)),!0}windowOptions(_){if(!B(_.params[0],this._optionsService.rawOptions.windowOptions))return!0;let A=_.length>1?_.params[1]:0;switch(_.params[0]){case 14:A!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._b