s.y;return(t&&e.range.start.x<=s.x&&e.range.end.x>=s.x||i&&e.range.end.x>=s.x||c&&e.range.start.x<=s.x||i&&c)&&e.range.start.y<=s.y&&e.range.end.y>=s.y}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,c){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:c}}};o=n([_(0,h.IBufferService)],o),r.Linkifier2=o},9042:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},2962:function(D,r,a){var n=this&&this.__decorate||function(o,e,s,t){var i,c=arguments.length,f=c<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,t);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(f=(c<3?i(f):c>3?i(e,s,f):i(e,s))||f);return c>3&&f&&Object.defineProperty(e,s,f),f},_=this&&this.__param||function(o,e){return function(s,t){e(s,t,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const h=a(511),u=a(2585);let d=class{constructor(o,e,s){this._bufferService=o,this._optionsService=e,this._oscLinkService=s}provideLinks(o,e){var s;const t=this._bufferService.buffer.lines.get(o-1);if(!t)return void e(void 0);const i=[],c=this._optionsService.rawOptions.linkHandler,f=new h.CellData,p=t.getTrimmedLength();let m=-1,g=-1,S=!1;for(let w=0;wc?c.activate(v,C,L):l(0,C),hover:(v,C)=>{var b;return(b=c==null?void 0:c.hover)===null||b===void 0?void 0:b.call(c,v,C,L)},leave:(v,C)=>{var b;return(b=c==null?void 0:c.leave)===null||b===void 0?void 0:b.call(c,v,C,L)}})}S=!1,f.hasExtendedAttrs()&&f.extended.urlId?(g=w,m=f.extended.urlId):(g=-1,m=-1)}}e(i)}};function l(o,e){if(confirm(`Do you want to navigate to ${e}?`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}d=n([_(0,u.IBufferService),_(1,u.IOptionsService),_(2,u.IOscLinkService)],d),r.OscLinkProvider=d},6193:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(a,n){this._parentWindow=a,this._renderCallback=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,n,_){this._rowCount=_,a=a!==void 0?a:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},5596:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const n=a(844);class _ extends n.Disposable{constructor(u){super(),this._parentWindow=u,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio}setListener(u){this._listener&&this.clearListener(),this._listener=u,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}dispose(){super.dispose(),this.clearListener()}_updateDpr(){var u;this._outerListener&&((u=this._resolutionMediaMatchList)===null||u===void 0||u.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=_},3236:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const n=a(2950),_=a(1680),h=a(3614),u=a(2584),d=a(5435),l=a(9312),o=a(6114),e=a(3656),s=a(9042),t=a(4567),i=a(1296),c=a(7399),f=a(8460),p=a(8437),m=a(5680),g=a(3230),S=a(4725),w=a(428),k=a(8934),L=a(6465),v=a(5114),C=a(8969),b=a(8055),E=a(4269),A=a(5941),H=a(3107),$=a(5744),U=a(9074),P=a(2585),W=a(2962),y=typeof window!="undefined"?window.document:null;class T extends C.CoreTerminal{constructor(R={}){super(R),this.browser=o,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._onCursorMove=new f.EventEmitter,this._onKey=new f.EventEmitter,this._onRender=new f.EventEmitter,this._onSelectionChange=new f.EventEmitter,this._onTitleChange=new f.EventEmitter,this._onBell=new f.EventEmitter,this._onFocus=new f.EventEmitter,this._onBlur=new f.EventEmitter,this._onA11yCharEmitter=new f.EventEmitter,this._onA11yTabEmitter=new f.EventEmitter,this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(L.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(W.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(U.DecorationService),this._instantiationService.setService(P.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((x,B)=>this.refresh(x,B))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(x=>this._reportWindowsOptions(x))),this.register(this._inputHandler.onColor(x=>this._handleColorEvent(x))),this.register((0,f.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,f.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,f.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,f.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(x=>this._afterResize(x.cols,x.rows)))}get onCursorMove(){return this._onCursorMove.event}get onKey(){return this._onKey.event}get onRender(){return this._onRender.event}get onSelectionChange(){return this._onSelectionChange.event}get onTitleChange(){return this._onTitleChange.event}get onBell(){return this._onBell.event}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}_handleColorEvent(R){var x,B;if(this._colorManager){for(const I of R){let F,M="";switch(I.index){case 256:F="foreground",M="10";break;case 257:F="background",M="11";break;case 258:F="cursor",M="12";break;default:F="ansi",M="4;"+I.index}switch(I.type){case 0:const K=b.color.toColorRGB(F==="ansi"?this._colorManager.colors.ansi[I.index]:this._colorManager.colors[F]);this.coreService.triggerDataEvent(`${u.C0.ESC}]${M};${(0,A.toRgbString)(K)}${u.C1_ESCAPED.ST}`);break;case 1:F==="ansi"?this._colorManager.colors.ansi[I.index]=b.rgba.toColor(...I.color):this._colorManager.colors[F]=b.rgba.toColor(...I.color);break;case 2:this._colorManager.restoreColor(I.index)}}(x=this._renderService)===null||x===void 0||x.setColors(this._colorManager.colors),(B=this.viewport)===null||B===void 0||B.onThemeChange(this._colorManager.colors)}}dispose(){var R,x,B;this._isDisposed||(super.dispose(),(R=this._renderService)===null||R===void 0||R.dispose(),this._customKeyEventHandler=void 0,this.write=()=>{},(B=(x=this.element)===null||x===void 0?void 0:x.parentNode)===null||B===void 0||B.removeChild(this.element))}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_updateOptions(R){var x,B,I,F;switch(super._updateOptions(R),R){case"fontFamily":case"fontSize":(x=this._renderService)===null||x===void 0||x.clear(),(B=this._charSizeService)===null||B===void 0||B.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"customGlyphs":case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"scrollback":(I=this.viewport)===null||I===void 0||I.syncScrollArea();break;case"screenReaderMode":this.optionsService.rawOptions.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new t.AccessibilityManager(this,this._renderService)):((F=this._accessibilityManager)===null||F===void 0||F.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.rawOptions.theme)}}_onTextAreaFocus(R){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(u.C0.ESC+"[I"),this.updateCursorStyle(R),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var R;return(R=this.textarea)===null||R===void 0?void 0:R.blur()}_onTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(u.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const R=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(R);if(!x)return;const B=Math.min(this.buffer.x,this.cols-1),I=this._renderService.dimensions.actualCellHeight,F=x.getWidth(B),M=this._renderService.dimensions.actualCellWidth*F,K=this.buffer.y*this._renderService.dimensions.actualCellHeight,j=B*this._renderService.dimensions.actualCellWidth;this.textarea.style.left=j+"px",this.textarea.style.top=K+"px",this.textarea.style.width=M+"px",this.textarea.style.height=I+"px",this.textarea.style.lineHeight=I+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,e.addDisposableDomListener)(this.element,"copy",x=>{this.hasSelection()&&(0,h.copyHandler)(x,this._selectionService)}));const R=x=>(0,h.handlePasteEvent)(x,this.textarea,this.coreService);this.register((0,e.addDisposableDomListener)(this.textarea,"paste",R)),this.register((0,e.addDisposableDomListener)(this.element,"paste",R)),o.isFirefox?this.register((0,e.addDisposableDomListener)(this.element,"mousedown",x=>{x.button===2&&(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,e.addDisposableDomListener)(this.element,"contextmenu",x=>{(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),o.isLinux&&this.register((0,e.addDisposableDomListener)(this.element,"auxclick",x=>{x.button===1&&(0,h.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,e.addDisposableDomListener)(this.textarea,"keyup",R=>this._keyUp(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"keydown",R=>this._keyDown(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"keypress",R=>this._keyPress(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionupdate",R=>this._compositionHelper.compositionupdate(R))),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,e.addDisposableDomListener)(this.textarea,"input",R=>this._inputEvent(R),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(R){var x;if(!R)throw new Error("Terminal requires a parent element.");R.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=R.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"),R.appendChild(this.element);const B=y.createDocumentFragment();this._viewportElement=y.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),B.appendChild(this._viewportElement),this._viewportScrollArea=y.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=y.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=y.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),B.appendChild(this.screenElement),this.textarea=y.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",s.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((0,e.addDisposableDomListener)(this.textarea,"focus",F=>this._onTextAreaFocus(F))),this.register((0,e.addDisposableDomListener)(this.textarea,"blur",()=>this._onTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._coreBrowserService=this._instantiationService.createInstance(v.CoreBrowserService,this.textarea,(x=this._document.defaultView)!==null&&x!==void 0?x:window),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this._charSizeService=this._instantiationService.createInstance(w.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._theme=this.options.theme||this._theme,this._colorManager=new m.ColorManager(y,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(F=>this._colorManager.onOptionsChange(F,this.optionsService.rawOptions[F]))),this._colorManager.setTheme(this._theme),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService);const I=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,I,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(F=>this._onRender.fire(F))),this.onResize(F=>this._renderService.resize(F.cols,F.rows)),this._compositionView=y.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(B),this._mouseService=this._instantiationService.createInstance(k.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(_.Viewport,F=>this.scrollLines(F,!0,1),this._viewportElement,this._viewportScrollArea,this.element),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.onCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.onResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.onBlur())),this.register(this.onFocus(()=>this._renderService.onFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(l.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(F=>this.scrollLines(F.amount,F.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(F=>this._renderService.onSelectionChanged(F.start,F.end,F.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(F=>{this.textarea.value=F,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(F=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,e.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(H.BufferDecorationRenderer,this.screenElement)),this.register((0,e.addDisposableDomListener)(this.element,"mousedown",F=>this._selectionService.onMouseDown(F))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new t.AccessibilityManager(this,this._renderService)),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance($.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onOptionChange(()=>{!this._overviewRulerRenderer&&this.options.overviewRulerWidth&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance($.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier2)}_setTheme(R){var x,B,I;this._theme=R,(x=this._colorManager)===null||x===void 0||x.setTheme(R),(B=this._renderService)===null||B===void 0||B.setColors(this._colorManager.colors),(I=this.viewport)===null||I===void 0||I.onThemeChange(this._colorManager.colors)}bindMouse(){const R=this,x=this.element;function B(M){const K=R._mouseService.getMouseReportCoords(M,R.screenElement);if(!K)return!1;let j,X;switch(M.overrideType||M.type){case"mousemove":X=32,M.buttons===void 0?(j=3,M.button!==void 0&&(j=M.button<3?M.button:3)):j=1&M.buttons?0:4&M.buttons?1:2&M.buttons?2:3;break;case"mouseup":X=0,j=M.button<3?M.button:3;break;case"mousedown":X=1,j=M.button<3?M.button:3;break;case"wheel":if(R.viewport.getLinesScrolled(M)===0)return!1;X=M.deltaY<0?0:1,j=4;break;default:return!1}return!(X===void 0||j===void 0||j>4)&&R.coreMouseService.triggerMouseEvent({col:K.col,row:K.row,x:K.x,y:K.y,button:j,action:X,ctrl:M.ctrlKey,alt:M.altKey,shift:M.shiftKey})}const I={mouseup:null,wheel:null,mousedrag:null,mousemove:null},F={mouseup:M=>(B(M),M.buttons||(this._document.removeEventListener("mouseup",I.mouseup),I.mousedrag&&this._document.removeEventListener("mousemove",I.mousedrag)),this.cancel(M)),wheel:M=>(B(M),this.cancel(M,!0)),mousedrag:M=>{M.buttons&&B(M)},mousemove:M=>{M.buttons||B(M)}};this.register(this.coreMouseService.onProtocolChange(M=>{M?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(M)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&M?I.mousemove||(x.addEventListener("mousemove",F.mousemove),I.mousemove=F.mousemove):(x.removeEventListener("mousemove",I.mousemove),I.mousemove=null),16&M?I.wheel||(x.addEventListener("wheel",F.wheel,{passive:!1}),I.wheel=F.wheel):(x.removeEventListener("wheel",I.wheel),I.wheel=null),2&M?I.mouseup||(I.mouseup=F.mouseup):(this._document.removeEventListener("mouseup",I.mouseup),I.mouseup=null),4&M?I.mousedrag||(I.mousedrag=F.mousedrag):(this._document.removeEventListener("mousemove",I.mousedrag),I.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,e.addDisposableDomListener)(x,"mousedown",M=>{if(M.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(M))return B(M),I.mouseup&&this._document.addEventListener("mouseup",I.mouseup),I.mousedrag&&this._document.addEventListener("mousemove",I.mousedrag),this.cancel(M)})),this.register((0,e.addDisposableDomListener)(x,"wheel",M=>{if(!I.wheel){if(!this.buffer.hasScrollback){const K=this.viewport.getLinesScrolled(M);if(K===0)return;const j=u.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(M.deltaY<0?"A":"B");let X="";for(let J=0;J{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.onTouchStart(M),this.cancel(M)},{passive:!0})),this.register((0,e.addDisposableDomListener)(x,"touchmove",M=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.onTouchMove(M)?void 0:this.cancel(M)},{passive:!1}))}refresh(R,x){var B;(B=this._renderService)===null||B===void 0||B.refreshRows(R,x)}updateCursorStyle(R){var x;!((x=this._selectionService)===null||x===void 0)&&x.shouldColumnSelect(R)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(R,x,B=0){super.scrollLines(R,x,B),this.refresh(0,this.rows-1)}paste(R){(0,h.paste)(R,this.textarea,this.coreService)}attachCustomKeyEventHandler(R){this._customKeyEventHandler=R}registerLinkProvider(R){return this.linkifier2.registerLinkProvider(R)}registerCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const x=this._characterJoinerService.register(R);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(R)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}addMarker(R){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+R)}registerDecoration(R){return this._decorationService.registerDecoration(R)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(R,x,B){this._selectionService.setSelection(R,x,B)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var R;(R=this._selectionService)===null||R===void 0||R.clearSelection()}selectAll(){var R;(R=this._selectionService)===null||R===void 0||R.selectAll()}selectLines(R,x){var B;(B=this._selectionService)===null||B===void 0||B.selectLines(R,x)}_keyDown(R){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;const x=this.browser.isMac&&this.options.macOptionIsMeta&&R.altKey;if(!x&&!this._compositionHelper.keydown(R))return this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;x||R.key!=="Dead"&&R.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const B=(0,c.evaluateKeyboardEvent)(R,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(R),B.type===3||B.type===2){const I=this.rows-1;return this.scrollLines(B.type===2?-I:I),this.cancel(R,!0)}return B.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,R)||(B.cancel&&this.cancel(R,!0),!B.key||!!(R.key&&!R.ctrlKey&&!R.altKey&&!R.metaKey&&R.key.length===1&&R.key.charCodeAt(0)>=65&&R.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(B.key!==u.C0.ETX&&B.key!==u.C0.CR||(this.textarea.value=""),this._onKey.fire({key:B.key,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(B.key,!0),this.optionsService.rawOptions.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(R,!0))))}_isThirdLevelShift(R,x){const B=R.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||R.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||R.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?B:B&&(!x.keyCode||x.keyCode>47)}_keyUp(R){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1||(function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18}(R)||this.focus(),this.updateCursorStyle(R),this._keyPressHandled=!1)}_keyPress(R){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;if(this.cancel(R),R.charCode)x=R.charCode;else if(R.which===null||R.which===void 0)x=R.keyCode;else{if(R.which===0||R.charCode===0)return!1;x=R.which}return!(!x||(R.altKey||R.ctrlKey||R.metaKey)&&!this._isThirdLevelShift(this.browser,R)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(R){if(R.data&&R.inputType==="insertText"&&(!R.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const x=R.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(R),!0}return!1}resize(R,x){R!==this.cols||x!==this.rows?super.resize(R,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(R,x){var B,I;(B=this._charSizeService)===null||B===void 0||B.measure(),(I=this.viewport)===null||I===void 0||I.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),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(let R=1;R{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(a,n=1e3){this._renderCallback=a,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,n,_){this._rowCount=_,a=a!==void 0?a:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const u=h-this._lastRefreshMs,d=this._debounceThresholdMS-u;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,n)}}},1680:function(D,r,a){var n=this&&this.__decorate||function(e,s,t,i){var c,f=arguments.length,p=f<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(c=e[m])&&(p=(f<3?c(p):f>3?c(s,t,p):c(s,t))||p);return f>3&&p&&Object.defineProperty(s,t,p),p},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const h=a(844),u=a(3656),d=a(4725),l=a(2585);let o=class extends h.Disposable{constructor(e,s,t,i,c,f,p,m,g){super(),this._scrollLines=e,this._viewportElement=s,this._scrollArea=t,this._element=i,this._bufferService=c,this._optionsService=f,this._charSizeService=p,this._renderService=m,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentScaledCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._onScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(S=>this._activeBuffer=S.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(S=>this._renderDimensions=S)),setTimeout(()=>this.syncScrollArea(),0)}onThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/this._coreBrowserService.dpr,this._currentScaledCellHeight=this._renderService.dimensions.scaledCellHeight,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.scaledCellHeight===this._currentScaledCellHeight||this._refresh(e)}_onScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);const s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(s)}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,s){const t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&t0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,s){const t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&s.altKey||t==="ctrl"&&s.ctrlKey||t==="shift"&&s.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}onTouchStart(e){this._lastTouchY=e.touches[0].pageY}onTouchMove(e){const s=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(e,s))}};o=n([_(4,l.IBufferService),_(5,l.IOptionsService),_(6,d.ICharSizeService),_(7,d.IRenderService),_(8,d.ICoreBrowserService)],o),r.Viewport=o},3107:function(D,r,a){var n=this&&this.__decorate||function(e,s,t,i){var c,f=arguments.length,p=f<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(c=e[m])&&(p=(f<3?c(p):f>3?c(s,t,p):c(s,t))||p);return f>3&&p&&Object.defineProperty(s,t,p),p},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const h=a(3656),u=a(4725),d=a(844),l=a(2585);let o=class extends d.Disposable{constructor(e,s,t,i){super(),this._screenElement=e,this._bufferService=s,this._decorationService=t,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register((0,h.addDisposableDomListener)(window,"resize",()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c)))}dispose(){this._container.remove(),this._decorationElements.clear(),super.dispose()}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this.refreshDecorations(),this._animationFrame=void 0}))}refreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;const t=document.createElement("div");t.classList.add("xterm-decoration"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.actualCellWidth)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.actualCellHeight+"px",t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.actualCellHeight+"px",t.style.lineHeight=`${this._renderService.dimensions.actualCellHeight}px`;const i=(s=e.options.x)!==null&&s!==void 0?s:0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const s=e.marker.line-this._bufferService.buffers.active.ydisp;if(s<0||s>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let t=this._decorationElements.get(e);t||(e.onDispose(()=>this._removeDecoration(e)),t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t)),t.style.top=s*this._renderService.dimensions.actualCellHeight+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,s=e.element){var t;if(!s)return;const i=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?s.style.right=i?i*this._renderService.dimensions.actualCellWidth+"px":"":s.style.left=i?i*this._renderService.dimensions.actualCellWidth+"px":""}_removeDecoration(e){var s;(s=this._decorationElements.get(e))===null||s===void 0||s.remove(),this._decorationElements.delete(e)}};o=n([_(1,l.IBufferService),_(2,l.IDecorationService),_(3,u.IRenderService)],o),r.BufferDecorationRenderer=o},5871:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const n of this._zones)if(n.color===a.options.overviewRulerOptions.color&&n.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,a.marker.line))return;if(this._lineAdjacentToZone(n,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(n,a.marker.line)}if(this._zonePoolIndex=a.startBufferLine&&n<=a.endBufferLine}_lineAdjacentToZone(a,n,_){return n>=a.startBufferLine-this._linePadding[_||"full"]&&n<=a.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(a,n){a.startBufferLine=Math.min(a.startBufferLine,n),a.endBufferLine=Math.max(a.endBufferLine,n)}}},5744:function(D,r,a){var n=this&&this.__decorate||function(c,f,p,m){var g,S=arguments.length,w=S<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,f,p,m);else for(var k=c.length-1;k>=0;k--)(g=c[k])&&(w=(S<3?g(w):S>3?g(f,p,w):g(f,p))||w);return S>3&&w&&Object.defineProperty(f,p,w),w},_=this&&this.__param||function(c,f){return function(p,m){f(p,m,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const h=a(5871),u=a(3656),d=a(4725),l=a(844),o=a(2585),e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0};let i=class extends l.Disposable{constructor(c,f,p,m,g,S,w){var k;super(),this._viewportElement=c,this._screenElement=f,this._bufferService=p,this._decorationService=m,this._renderService=g,this._optionsService=S,this._coreBrowseService=w,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(k=this._viewportElement.parentElement)===null||k===void 0||k.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners()}get _width(){return this._optionsService.options.overviewRulerWidth||0}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onOptionChange(c=>{c==="overviewRulerWidth"&&this._queueRefresh(!0)})),this.register((0,u.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>{this._queueRefresh(!0)})),this._queueRefresh(!0)}dispose(){var c;(c=this._canvas)===null||c===void 0||c.remove(),super.dispose()}_refreshDrawConstants(){const c=Math.floor(this._canvas.width/3),f=Math.ceil(this._canvas.width/3);s.full=this._canvas.width,s.left=c,s.center=f,s.right=c,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=s.left,t.right=s.left+s.center}_refreshDrawHeightConstants(){e.full=Math.round(2*this._coreBrowseService.dpr);const c=this._canvas.height/this._bufferService.buffer.lines.length,f=Math.round(Math.max(Math.min(c,12),6)*this._coreBrowseService.dpr);e.left=f,e.center=f,e.right=f}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const f of this._decorationService.decorations)this._colorZoneStore.addDecoration(f);this._ctx.lineWidth=1;const c=this._colorZoneStore.zones;for(const f of c)f.position!=="full"&&this._renderColorZone(f);for(const f of c)f.position==="full"&&this._renderColorZone(f);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(c){this._ctx.fillStyle=c.color,this._ctx.fillRect(t[c.position||"full"],Math.round((this._canvas.height-1)*(c.startBufferLine/this._bufferService.buffers.active.lines.length)-e[c.position||"full"]/2),s[c.position||"full"],Math.round((this._canvas.height-1)*((c.endBufferLine-c.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[c.position||"full"]))}_queueRefresh(c,f){this._shouldUpdateDimensions=c||this._shouldUpdateDimensions,this._shouldUpdateAnchor=f||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};i=n([_(2,o.IBufferService),_(3,o.IDecorationService),_(4,d.IRenderService),_(5,o.IOptionsService),_(6,d.ICoreBrowserService)],i),r.OverviewRulerRenderer=i},2950:function(D,r,a){var n=this&&this.__decorate||function(o,e,s,t){var i,c=arguments.length,f=c<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,t);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(f=(c<3?i(f):c>3?i(e,s,f):i(e,s))||f);return c>3&&f&&Object.defineProperty(e,s,f),f},_=this&&this.__param||function(o,e){return function(s,t){e(s,t,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const h=a(4725),u=a(2585),d=a(2584);let l=class{constructor(o,e,s,t,i,c){this._textarea=o,this._compositionView=e,this._bufferService=s,this._optionsService=t,this._coreService=i,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,s=e.replace(o,"");this._dataAlreadySent=s,e.length>o.length?this._coreService.triggerDataEvent(s,!0):e.lengththis.updateCompositionElements(!0),0)}}};l=n([_(2,u.IBufferService),_(3,u.IOptionsService),_(4,u.ICoreService),_(5,h.IRenderService)],l),r.CompositionHelper=l},9806:(D,r)=>{function a(n,_,h){const u=h.getBoundingClientRect(),d=n.getComputedStyle(h),l=parseInt(d.getPropertyValue("padding-left")),o=parseInt(d.getPropertyValue("padding-top"));return[_.clientX-u.left-l,_.clientY-u.top-o]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=a,r.getCoords=function(n,_,h,u,d,l,o,e,s){if(!l)return;const t=a(n,_,h);return t?(t[0]=Math.ceil((t[0]+(s?o/2:0))/o),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),u+(s?1:0)),t[1]=Math.min(Math.max(t[1],1),d),t):void 0}},9504:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const n=a(2584);function _(e,s,t,i){const c=e-h(t,e),f=s-h(t,s),p=Math.abs(c-f)-function(m,g,S){let w=0;const k=m-h(S,m),L=g-h(S,g);for(let v=0;v=0&&ss?"A":"B"}function d(e,s,t,i,c,f){let p=e,m=s,g="";for(;p!==t||m!==i;)p+=c?1:-1,c&&p>f.cols-1?(g+=f.buffer.translateBufferLineToString(m,!1,e,p),p=0,e=0,m++):!c&&p<0&&(g+=f.buffer.translateBufferLineToString(m,!1,0,e+1),p=f.cols-1,e=p,m--);return g+f.buffer.translateBufferLineToString(m,!1,e,p)}function l(e,s){const t=s?"O":"[";return n.C0.ESC+t+e}function o(e,s){e=Math.floor(e);let t="";for(let i=0;i0?k-h(L,k):S;const b=k,E=function(A,H,$,U,P,W){let y;return y=_($,U,P,W).length>0?U-h(P,U):H,A<$&&y<=U||A>=$&&ye?"D":"C",o(Math.abs(c-e),l(p,i));p=f>s?"D":"C";const m=Math.abs(f-s);return o(function(g,S){return S.cols-g}(f>s?e:c,t)+(m-1)*t.cols+1+((f>s?c:e)-1),l(p,i))}},8036:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const n=a(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},1752:(D,r)=>{function a(n){return 57508<=n&&n<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(n){if(!n)throw new Error("value must not be falsy");return n},r.isPowerlineGlyph=a,r.isRestrictedPowerlineGlyph=function(n){return 57520<=n&&n<=57527},r.excludeFromContrastRatioDemands=function(n){return a(n)||function(_){return 9472<=_&&_<=9631}(n)}},1296:function(D,r,a){var n=this&&this.__decorate||function(m,g,S,w){var k,L=arguments.length,v=L<3?g:w===null?w=Object.getOwnPropertyDescriptor(g,S):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(m,g,S,w);else for(var C=m.length-1;C>=0;C--)(k=m[C])&&(v=(L<3?k(v):L>3?k(g,S,v):k(g,S))||v);return L>3&&v&&Object.defineProperty(g,S,v),v},_=this&&this.__param||function(m,g){return function(S,w){g(S,w,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const h=a(3787),u=a(8036),d=a(844),l=a(4725),o=a(2585),e=a(8460),s=a(8055),t=a(9631),i="xterm-dom-renderer-owner-",c="xterm-focus";let f=1,p=class extends d.Disposable{constructor(m,g,S,w,k,L,v,C,b,E){super(),this._colors=m,this._element=g,this._screenElement=S,this._viewportElement=w,this._linkifier2=k,this._charSizeService=v,this._optionsService=C,this._bufferService=b,this._coreBrowserService=E,this._terminalClass=f++,this._rowElements=[],this._rowContainer=document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.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},this._updateDimensions(),this._injectCss(),this._rowFactory=L.createInstance(h.DomRendererRowFactory,document,this._colors),this._element.classList.add(i+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(A=>this._onLinkHover(A))),this.register(this._linkifier2.onHideLinkUnderline(A=>this._onLinkLeave(A)))}get onRequestRedraw(){return new e.EventEmitter().event}dispose(){this._element.classList.remove(i+this._terminalClass),(0,t.removeElementFromParent)(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),super.dispose()}_updateDimensions(){const m=this._coreBrowserService.dpr;this.dimensions.scaledCharWidth=this._charSizeService.width*m,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*m),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.rawOptions.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/m),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/m),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(const S of this._rowElements)S.style.width=`${this.dimensions.canvasWidth}px`,S.style.height=`${this.dimensions.actualCellHeight}px`,S.style.lineHeight=`${this.dimensions.actualCellHeight}px`,S.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const g=`${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: ${this.dimensions.actualCellWidth}px}`;this._dimensionsStyleElement.textContent=g,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.canvasWidth}px`,this._screenElement.style.height=`${this.dimensions.canvasHeight}px`}setColors(m){this._colors=m,this._injectCss()}_injectCss(){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let m=`${this._terminalSelector} .xterm-rows { color: ${this._colors.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px;}`;m+=`${this._terminalSelector} span:not(.${h.BOLD_CLASS}) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.${h.BOLD_CLASS} { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.${h.ITALIC_CLASS} { font-style: italic;}`,m+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",m+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css}; } 50% { background-color: ${this._colors.cursorAccent.css}; color: ${this._colors.cursor.css}; }}`,m+=`${this._terminalSelector} .xterm-rows:not(.xterm-focus) .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { outline: 1px solid ${this._colors.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}:not(.${h.CURSOR_STYLE_BLOCK_CLASS}) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css};}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BAR_CLASS} { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${this._colors.cursor.css} inset;}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_UNDERLINE_CLASS} { box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;}`,m+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${this._colors.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${this._colors.selectionInactiveBackgroundOpaque.css};}`,this._colors.ansi.forEach((g,S)=>{m+=`${this._terminalSelector} .xterm-fg-${S} { color: ${g.css}; }${this._terminalSelector} .xterm-bg-${S} { background-color: ${g.css}; }`}),m+=`${this._terminalSelector} .xterm-fg-${u.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(this._colors.background).css}; }${this._terminalSelector} .xterm-bg-${u.INVERTED_DEFAULT_COLOR} { background-color: ${this._colors.foreground.css}; }`,this._themeStyleElement.textContent=m}onDevicePixelRatioChange(){this._updateDimensions()}_refreshRowElements(m,g){for(let S=this._rowElements.length;S<=g;S++){const w=document.createElement("div");this._rowContainer.appendChild(w),this._rowElements.push(w)}for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop())}onResize(m,g){this._refreshRowElements(m,g),this._updateDimensions()}onCharSizeChanged(){this._updateDimensions()}onBlur(){this._rowContainer.classList.remove(c)}onFocus(){this._rowContainer.classList.add(c)}onSelectionChanged(m,g,S){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(this._rowFactory.onSelectionChanged(m,g,S),this.renderRows(0,this._bufferService.rows-1),!m||!g)return;const w=m[1]-this._bufferService.buffer.ydisp,k=g[1]-this._bufferService.buffer.ydisp,L=Math.max(w,0),v=Math.min(k,this._bufferService.rows-1);if(L>=this._bufferService.rows||v<0)return;const C=document.createDocumentFragment();if(S){const b=m[0]>g[0];C.appendChild(this._createSelectionElement(L,b?g[0]:m[0],b?m[0]:g[0],v-L+1))}else{const b=w===L?m[0]:0,E=L===k?g[0]:this._bufferService.cols;C.appendChild(this._createSelectionElement(L,b,E));const A=v-L-1;if(C.appendChild(this._createSelectionElement(L+1,0,this._bufferService.cols,A)),L!==v){const H=k===v?g[0]:this._bufferService.cols;C.appendChild(this._createSelectionElement(v,0,H))}}this._selectionContainer.appendChild(C)}_createSelectionElement(m,g,S,w=1){const k=document.createElement("div");return k.style.height=w*this.dimensions.actualCellHeight+"px",k.style.top=m*this.dimensions.actualCellHeight+"px",k.style.left=g*this.dimensions.actualCellWidth+"px",k.style.width=this.dimensions.actualCellWidth*(S-g)+"px",k}onCursorMove(){}onOptionsChanged(){this._updateDimensions(),this._injectCss()}clear(){for(const m of this._rowElements)m.innerText=""}renderRows(m,g){const S=this._bufferService.buffer.ybase+this._bufferService.buffer.y,w=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),k=this._optionsService.rawOptions.cursorBlink;for(let L=m;L<=g;L++){const v=this._rowElements[L];v.innerText="";const C=L+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.lines.get(C),E=this._optionsService.rawOptions.cursorStyle;v.appendChild(this._rowFactory.createRow(b,C,C===S,E,w,k,this.dimensions.actualCellWidth,this._bufferService.cols))}}get _terminalSelector(){return`.${i}${this._terminalClass}`}_onLinkHover(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!0)}_onLinkLeave(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!1)}_setCellUnderline(m,g,S,w,k,L){for(;m!==g||S!==w;){const v=this._rowElements[S];if(!v)return;const C=v.children[m];C&&(C.style.textDecoration=L?"underline":"none"),++m>=k&&(m=0,S++)}}};p=n([_(5,o.IInstantiationService),_(6,l.ICharSizeService),_(7,o.IOptionsService),_(8,o.IBufferService),_(9,l.ICoreBrowserService)],p),r.DomRenderer=p},3787:function(D,r,a){var n=this&&this.__decorate||function(p,m,g,S){var w,k=arguments.length,L=k<3?m:S===null?S=Object.getOwnPropertyDescriptor(m,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(p,m,g,S);else for(var v=p.length-1;v>=0;v--)(w=p[v])&&(L=(k<3?w(L):k>3?w(m,g,L):w(m,g))||L);return k>3&&L&&Object.defineProperty(m,g,L),L},_=this&&this.__param||function(p,m){return function(g,S){m(g,S,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=r.CURSOR_STYLE_UNDERLINE_CLASS=r.CURSOR_STYLE_BAR_CLASS=r.CURSOR_STYLE_BLOCK_CLASS=r.CURSOR_BLINK_CLASS=r.CURSOR_CLASS=r.STRIKETHROUGH_CLASS=r.UNDERLINE_CLASS=r.ITALIC_CLASS=r.DIM_CLASS=r.BOLD_CLASS=void 0;const h=a(8036),u=a(643),d=a(511),l=a(2585),o=a(8055),e=a(4725),s=a(4269),t=a(1752),i=a(3734);r.BOLD_CLASS="xterm-bold",r.DIM_CLASS="xterm-dim",r.ITALIC_CLASS="xterm-italic",r.UNDERLINE_CLASS="xterm-underline",r.STRIKETHROUGH_CLASS="xterm-strikethrough",r.CURSOR_CLASS="xterm-cursor",r.CURSOR_BLINK_CLASS="xterm-cursor-blink",r.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",r.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",r.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";let c=class{constructor(p,m,g,S,w,k,L){this._document=p,this._colors=m,this._characterJoinerService=g,this._optionsService=S,this._coreBrowserService=w,this._coreService=k,this._decorationService=L,this._workCell=new d.CellData,this._columnSelectMode=!1}setColors(p){this._colors=p}onSelectionChanged(p,m,g){this._selectionStart=p,this._selectionEnd=m,this._columnSelectMode=g}createRow(p,m,g,S,w,k,L,v){const C=this._document.createDocumentFragment(),b=this._characterJoinerService.getJoinedCharacters(m);let E=0;for(let A=Math.min(p.length,v)-1;A>=0;A--)if(p.loadCell(A,this._workCell).getCode()!==u.NULL_CELL_CODE||g&&A===w){E=A+1;break}for(let A=0;A0&&A===b[0][0]){$=!0;const j=b.shift();P=new s.JoinedCellData(this._workCell,p.translateToString(!0,j[0],j[1]),j[1]-j[0]),U=j[1]-1,H=P.getWidth()}const W=this._document.createElement("span");if(H>1&&(W.style.width=L*H+"px"),$&&(W.style.display="inline",w>=A&&w<=U&&(w=A)),!this._coreService.isCursorHidden&&g&&A===w)switch(W.classList.add(r.CURSOR_CLASS),k&&W.classList.add(r.CURSOR_BLINK_CLASS),S){case"bar":W.classList.add(r.CURSOR_STYLE_BAR_CLASS);break;case"underline":W.classList.add(r.CURSOR_STYLE_UNDERLINE_CLASS);break;default:W.classList.add(r.CURSOR_STYLE_BLOCK_CLASS)}if(P.isBold()&&W.classList.add(r.BOLD_CLASS),P.isItalic()&&W.classList.add(r.ITALIC_CLASS),P.isDim()&&W.classList.add(r.DIM_CLASS),P.isInvisible()?W.textContent=u.WHITESPACE_CELL_CHAR:W.textContent=P.getChars()||u.WHITESPACE_CELL_CHAR,P.isUnderline()&&(W.classList.add(`${r.UNDERLINE_CLASS}-${P.extended.underlineStyle}`),W.textContent===" "&&(W.innerHTML=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())W.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let j=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&j<8&&(j+=8),W.style.textDecorationColor=this._colors.ansi[j].css}P.isStrikethrough()&&W.classList.add(r.STRIKETHROUGH_CLASS);let y=P.getFgColor(),T=P.getFgColorMode(),O=P.getBgColor(),R=P.getBgColorMode();const x=!!P.isInverse();if(x){const j=y;y=O,O=j;const X=T;T=R,R=X}let B,I,F=!1;this._decorationService.forEachDecorationAtCell(A,m,void 0,j=>{j.options.layer!=="top"&&F||(j.backgroundColorRGB&&(R=50331648,O=j.backgroundColorRGB.rgba>>8&16777215,B=j.backgroundColorRGB),j.foregroundColorRGB&&(T=50331648,y=j.foregroundColorRGB.rgba>>8&16777215,I=j.foregroundColorRGB),F=j.options.layer==="top")});const M=this._isCellInSelection(A,m);let K;switch(F||this._colors.selectionForeground&&M&&(T=50331648,y=this._colors.selectionForeground.rgba>>8&16777215,I=this._colors.selectionForeground),M&&(B=this._coreBrowserService.isFocused?this._colors.selectionBackgroundOpaque:this._colors.selectionInactiveBackgroundOpaque,F=!0),F&&W.classList.add("xterm-decoration-top"),R){case 16777216:case 33554432:K=this._colors.ansi[O],W.classList.add(`xterm-bg-${O}`);break;case 50331648:K=o.rgba.toColor(O>>16,O>>8&255,255&O),this._addStyle(W,`background-color:#${f((O>>>0).toString(16),"0",6)}`);break;default:x?(K=this._colors.foreground,W.classList.add(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):K=this._colors.background}switch(B||P.isDim()&&(B=o.color.multiplyOpacity(K,.5)),T){case 16777216:case 33554432:P.isBold()&&y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(y+=8),this._applyMinimumContrast(W,K,this._colors.ansi[y],P,B,void 0)||W.classList.add(`xterm-fg-${y}`);break;case 50331648:const j=o.rgba.toColor(y>>16&255,y>>8&255,255&y);this._applyMinimumContrast(W,K,j,P,B,I)||this._addStyle(W,`color:#${f(y.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(W,K,this._colors.foreground,P,B,void 0)||x&&W.classList.add(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}C.appendChild(W),A=U}return C}_applyMinimumContrast(p,m,g,S,w,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(S.getCode()))return!1;let L;return w||k||(L=this._colors.contrastCache.getColor(m.rgba,g.rgba)),L===void 0&&(L=o.color.ensureContrastRatio(w||m,k||g,this._optionsService.rawOptions.minimumContrastRatio),this._colors.contrastCache.setColor((w||m).rgba,(k||g).rgba,L!=null?L:null)),!!L&&(this._addStyle(p,`color:${L.css}`),!0)}_addStyle(p,m){p.setAttribute("style",`${p.getAttribute("style")||""}${m};`)}_isCellInSelection(p,m){const g=this._selectionStart,S=this._selectionEnd;return!(!g||!S)&&(this._columnSelectMode?g[0]<=S[0]?p>=g[0]&&m>=g[1]&&p=g[1]&&p>=S[0]&&m<=S[1]:m>g[1]&&m=g[0]&&p=g[0])}};function f(p,m,g){for(;p.length{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,n=this.selectionEnd;return!(!a||!n)&&(a[1]>n[1]||a[1]===n[1]&&a[0]>n[0])}onTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,r,a){var n=this&&this.__decorate||function(o,e,s,t){var i,c=arguments.length,f=c<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,t);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(f=(c<3?i(f):c>3?i(e,s,f):i(e,s))||f);return c>3&&f&&Object.defineProperty(e,s,f),f},_=this&&this.__param||function(o,e){return function(s,t){e(s,t,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const h=a(2585),u=a(8460);let d=class{constructor(o,e,s){this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=new u.EventEmitter,this._measureStrategy=new l(o,e,this._optionsService)}get hasValidSize(){return this.width>0&&this.height>0}get onCharSizeChange(){return this._onCharSizeChange.event}measure(){const o=this._measureStrategy.measure();o.width===this.width&&o.height===this.height||(this.width=o.width,this.height=o.height,this._onCharSizeChange.fire())}};d=n([_(2,h.IOptionsService)],d),r.CharSizeService=d;class l{constructor(e,s,t){this._document=e,this._parentElement=s,this._optionsService=t,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)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const e=this._measureElement.getBoundingClientRect();return e.width!==0&&e.height!==0&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(D,r,a){var n=this&&this.__decorate||function(s,t,i,c){var f,p=arguments.length,m=p<3?t:c===null?c=Object.getOwnPropertyDescriptor(t,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,t,i,c);else for(var g=s.length-1;g>=0;g--)(f=s[g])&&(m=(p<3?f(m):p>3?f(t,i,m):f(t,i))||m);return p>3&&m&&Object.defineProperty(t,i,m),m},_=this&&this.__param||function(s,t){return function(i,c){t(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const h=a(3734),u=a(643),d=a(511),l=a(2585);class o extends h.AttributeData{constructor(t,i,c){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=c}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=o;let e=class ie{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(t){const i={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(i),i.id}deregister(t){for(let i=0;i1){const L=this._getJoinedRanges(f,g,m,i,p);for(let v=0;v1){const k=this._getJoinedRanges(f,g,m,i,p);for(let L=0;L{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(a,n){this._textarea=a,this.window=n}get dpr(){return this.window.devicePixelRatio}get isFocused(){return(this._textarea.getRootNode?this._textarea.getRootNode():this._textarea.ownerDocument).activeElement===this._textarea&&this._textarea.ownerDocument.hasFocus()}}},8934:function(D,r,a){var n=this&&this.__decorate||function(l,o,e,s){var t,i=arguments.length,c=i<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(l,o,e,s);else for(var f=l.length-1;f>=0;f--)(t=l[f])&&(c=(i<3?t(c):i>3?t(o,e,c):t(o,e))||c);return i>3&&c&&Object.defineProperty(o,e,c),c},_=this&&this.__param||function(l,o){return function(e,s){o(e,s,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const h=a(4725),u=a(9806);let d=class{constructor(l,o){this._renderService=l,this._charSizeService=o}getCoords(l,o,e,s,t){return(0,u.getCoords)(window,l,o,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,t)}getMouseReportCoords(l,o){const e=(0,u.getCoordsRelativeToElement)(window,l,o);if(!(!this._charSizeService.hasValidSize||e[0]<0||e[1]<0||e[0]>=this._renderService.dimensions.canvasWidth||e[1]>=this._renderService.dimensions.canvasHeight))return{col:Math.floor(e[0]/this._renderService.dimensions.actualCellWidth),row:Math.floor(e[1]/this._renderService.dimensions.actualCellHeight),x:Math.floor(e[0]),y:Math.floor(e[1])}}};d=n([_(0,h.IRenderService),_(1,h.ICharSizeService)],d),r.MouseService=d},3230:function(D,r,a){var n=this&&this.__decorate||function(i,c,f,p){var m,g=arguments.length,S=g<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,c,f,p);else for(var w=i.length-1;w>=0;w--)(m=i[w])&&(S=(g<3?m(S):g>3?m(c,f,S):m(c,f))||S);return g>3&&S&&Object.defineProperty(c,f,S),S},_=this&&this.__param||function(i,c){return function(f,p){c(f,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const h=a(6193),u=a(8460),d=a(844),l=a(5596),o=a(3656),e=a(2585),s=a(4725);let t=class extends d.Disposable{constructor(i,c,f,p,m,g,S,w){if(super(),this._renderer=i,this._rowCount=c,this._charSizeService=m,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=new u.EventEmitter,this._onRenderedViewportChange=new u.EventEmitter,this._onRender=new u.EventEmitter,this._onRefreshRequest=new u.EventEmitter,this.register({dispose:()=>this._renderer.dispose()}),this._renderDebouncer=new h.RenderDebouncer(w.window,(k,L)=>this._renderRows(k,L)),this.register(this._renderDebouncer),this._screenDprMonitor=new l.ScreenDprMonitor(w.window),this._screenDprMonitor.setListener(()=>this.onDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(S.onResize(()=>this._fullRefresh())),this.register(S.buffers.onBufferActivate(()=>{var k;return(k=this._renderer)===null||k===void 0?void 0:k.clear()})),this.register(p.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.onCharSizeChanged())),this.register(g.onDecorationRegistered(()=>this._fullRefresh())),this.register(g.onDecorationRemoved(()=>this._fullRefresh())),this._renderer.onRequestRedraw(k=>this.refreshRows(k.start,k.end,!0)),this.register((0,o.addDisposableDomListener)(w.window,"resize",()=>this.onDevicePixelRatioChange())),"IntersectionObserver"in w.window){const k=new w.window.IntersectionObserver(L=>this._onIntersectionChange(L[L.length-1]),{threshold:0});k.observe(f),this.register({dispose:()=>k.disconnect()})}}get onDimensionsChange(){return this._onDimensionsChange.event}get onRenderedViewportChange(){return this._onRenderedViewportChange.event}get onRender(){return this._onRender.event}get onRefreshRequest(){return this._onRefreshRequest.event}get dimensions(){return this._renderer.dimensions}_onIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,c,f=!1){this._isPaused?this._needsFullRefresh=!0:(f||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,c,this._rowCount))}_renderRows(i,c){this._renderer.renderRows(i,c),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:c}),this._onRender.fire({start:i,end:c}),this._isNextRenderRedrawOnly=!0}resize(i,c){this._rowCount=c,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()}_fireOnCanvasResize(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)}dispose(){super.dispose()}setRenderer(i){this._renderer.dispose(),this._renderer=i,this._renderer.onRequestRedraw(c=>this.refreshRows(c.start,c.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,c;(c=(i=this._renderer)===null||i===void 0?void 0:i.clearTextureAtlas)===null||c===void 0||c.call(i),this._fullRefresh()}setColors(i){this._renderer.setColors(i),this._fullRefresh()}onDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)}onResize(i,c){this._renderer.onResize(i,c),this._fullRefresh()}onCharSizeChanged(){this._renderer.onCharSizeChanged()}onBlur(){this._renderer.onBlur()}onFocus(){this._renderer.onFocus()}onSelectionChanged(i,c,f){this._selectionState.start=i,this._selectionState.end=c,this._selectionState.columnSelectMode=f,this._renderer.onSelectionChanged(i,c,f)}onCursorMove(){this._renderer.onCursorMove()}clear(){this._renderer.clear()}};t=n([_(3,e.IOptionsService),_(4,s.ICharSizeService),_(5,e.IDecorationService),_(6,e.IBufferService),_(7,s.ICoreBrowserService)],t),r.RenderService=t},9312:function(D,r,a){var n=this&&this.__decorate||function(g,S,w,k){var L,v=arguments.length,C=v<3?S:k===null?k=Object.getOwnPropertyDescriptor(S,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,S,w,k);else for(var b=g.length-1;b>=0;b--)(L=g[b])&&(C=(v<3?L(C):v>3?L(S,w,C):L(S,w))||C);return v>3&&C&&Object.defineProperty(S,w,C),C},_=this&&this.__param||function(g,S){return function(w,k){S(w,k,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const h=a(6114),u=a(456),d=a(511),l=a(8460),o=a(4725),e=a(2585),s=a(9806),t=a(9504),i=a(844),c=a(4841),f=String.fromCharCode(160),p=new RegExp(f,"g");let m=class extends i.Disposable{constructor(g,S,w,k,L,v,C,b,E){super(),this._element=g,this._screenElement=S,this._linkifier=w,this._bufferService=k,this._coreService=L,this._mouseService=v,this._optionsService=C,this._renderService=b,this._coreBrowserService=E,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new d.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this._onRedrawRequest=this.register(new l.EventEmitter),this._onSelectionChange=this.register(new l.EventEmitter),this._onRequestScrollLines=this.register(new l.EventEmitter),this._mouseMoveListener=A=>this._onMouseMove(A),this._mouseUpListener=A=>this._onMouseUp(A),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(A=>this._onTrim(A)),this.register(this._bufferService.buffers.onBufferActivate(A=>this._onBufferActivate(A))),this.enable(),this._model=new u.SelectionModel(this._bufferService),this._activeSelectionMode=0}get onLinuxMouseSelection(){return this._onLinuxMouseSelection.event}get onRequestRedraw(){return this._onRedrawRequest.event}get onSelectionChange(){return this._onSelectionChange.event}get onRequestScrollLines(){return this._onRequestScrollLines.event}dispose(){this._removeMouseDownListeners()}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!g||!S||g[0]===S[0]&&g[1]===S[1])}get selectionText(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!g||!S)return"";const w=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(g[0]===S[0])return"";const L=g[0]L.replace(p," ")).join(h.isWindows?`\r
+`:`
+`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),h.isLinux&&g&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(g){const S=this._getMouseBufferCoords(g),w=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(w&&k&&S)&&this._areCoordsInSelection(S,w,k)}isCellInSelection(g,S){const w=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!w||!k)&&this._areCoordsInSelection([g,S],w,k)}_areCoordsInSelection(g,S,w){return g[1]>S[1]&&g[1]=S[0]&&g[0]=S[0]}_selectWordAtCursor(g,S){var w,k;const L=(k=(w=this._linkifier.currentLink)===null||w===void 0?void 0:w.link)===null||k===void 0?void 0:k.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,c.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const v=this._getMouseBufferCoords(g);return!!v&&(this._selectWordAt(v,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,S){this._model.clearSelection(),g=Math.max(g,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_onTrim(g){this._model.onTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const S=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(g){let S=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const w=this._renderService.dimensions.canvasHeight;return S>=0&&S<=w?0:(S>w&&(S-=w),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(g){return h.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}onMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._onIncrementalClick(g):g.detail===1?this._onSingleClick(g):g.detail===2?this._onDoubleClick(g):g.detail===3&&this._onTripleClick(g),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_onIncrementalClick(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_onSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_onDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_onTripleClick(g){const S=this._getMouseBufferCoords(g);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(g){return g.altKey&&!(h.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_onMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const w=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_onMouseUp(g){const S=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const w=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(w&&w[0]!==void 0&&w[1]!==void 0){const k=(0,t.moveToCellSequence)(w[0]-1,w[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,w=!(!g||!S||g[0]===S[0]&&g[1]===S[1]);w?g&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,S,w)):this._oldHasSelection&&this._fireOnSelectionChange(g,S,w)}_fireOnSelectionChange(g,S,w){this._oldSelectionStart=g,this._oldSelectionEnd=S,this._oldHasSelection=w,this._onSelectionChange.fire()}_onBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(S=>this._onTrim(S))}_convertViewportColToCharacterIndex(g,S){let w=S[0];for(let k=0;S[0]>=k;k++){const L=g.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?w--:L>1&&S[0]!==k&&(w+=L-1)}return w}setSelection(g,S,w){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,S],this._model.selectionStartLength=w,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,S,w=!0,k=!0){if(g[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,v=L.lines.get(g[1]);if(!v)return;const C=L.translateBufferLineToString(g[1],!1);let b=this._convertViewportColToCharacterIndex(v,g),E=b;const A=g[0]-b;let H=0,$=0,U=0,P=0;if(C.charAt(b)===" "){for(;b>0&&C.charAt(b-1)===" ";)b--;for(;E1&&(P+=R-1,E+=R-1);T>0&&b>0&&!this._isCharWordSeparator(v.loadCell(T-1,this._workCell));){v.loadCell(T-1,this._workCell);const x=this._workCell.getChars().length;this._workCell.getWidth()===0?(H++,T--):x>1&&(U+=x-1,b-=x-1),b--,T--}for(;O1&&(P+=x-1,E+=x-1),E++,O++}}E++;let W=b+A-H+U,y=Math.min(this._bufferService.cols,E-b+H+$-U-P);if(S||C.slice(b,E).trim()!==""){if(w&&W===0&&v.getCodePoint(0)!==32){const T=L.lines.get(g[1]-1);if(T&&v.isWrapped&&T.getCodePoint(this._bufferService.cols-1)!==32){const O=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(O){const R=this._bufferService.cols-O.start;W-=R,y+=R}}}if(k&&W+y===this._bufferService.cols&&v.getCodePoint(this._bufferService.cols-1)!==32){const T=L.lines.get(g[1]+1);if((T==null?void 0:T.isWrapped)&&T.getCodePoint(0)!==32){const O=this._getWordAt([0,g[1]+1],!1,!1,!0);O&&(y+=O.length)}}return{start:W,length:y}}}_selectWordAt(g,S){const w=this._getWordAt(g,S);if(w){for(;w.start<0;)w.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[w.start,g[1]],this._model.selectionStartLength=w.length}}_selectToWordAt(g){const S=this._getWordAt(g,!0);if(S){let w=g[1];for(;S.start<0;)S.start+=this._bufferService.cols,w--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,w++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,w]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const S=this._bufferService.buffer.getWrappedRangeForLine(g),w={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,c.getRangeLength)(w,this._bufferService.cols)}};m=n([_(3,e.IBufferService),_(4,e.ICoreService),_(5,o.IMouseService),_(6,e.IOptionsService),_(7,o.IRenderService),_(8,o.ICoreBrowserService)],m),r.SelectionService=m},4725:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const n=a(8343);r.ICharSizeService=(0,n.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,n.createDecorator)("CoreBrowserService"),r.IMouseService=(0,n.createDecorator)("MouseService"),r.IRenderService=(0,n.createDecorator)("RenderService"),r.ISelectionService=(0,n.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,n.createDecorator)("CharacterJoinerService")},6349:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const n=a(8460);r.CircularList=class{constructor(_){this._maxLength=_,this.onDeleteEmitter=new n.EventEmitter,this.onInsertEmitter=new n.EventEmitter,this.onTrimEmitter=new n.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get onDelete(){return this.onDeleteEmitter.event}get onInsert(){return this.onInsertEmitter.event}get onTrim(){return this.onTrimEmitter.event}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const h=new Array(_);for(let u=0;uthis._length)for(let h=this._length;h<_;h++)this._array[h]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,h){this._array[this._getCyclicIndex(_)]=h}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,h,...u){if(h){for(let d=_;d=_;d--)this._array[this._getCyclicIndex(d+u.length)]=this._array[this._getCyclicIndex(d)];for(let d=0;dthis._maxLength){const d=this._length+u.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=u.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,h,u){if(!(h<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let l=h-1;l>=0;l--)this.set(_+l+u,this.get(_+l));const d=_+h+u-this._length;if(d>0)for(this._length+=d;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let d=0;d{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function a(n,_=5){if(typeof n!="object")return n;const h=Array.isArray(n)?[]:{};for(const u in n)h[u]=_<=1?n[u]:n[u]&&a(n[u],_-1);return h}},8055:(D,r)=>{var a,n,_;function h(d){const l=d.toString(16);return l.length<2?"0"+l:l}function u(d,l){return d>>0}}(a=r.channels||(r.channels={})),function(d){function l(o,e){const s=Math.round(255*e),[t,i,c]=_.toChannels(o.rgba);return{css:a.toCss(t,i,c,s),rgba:a.toRgba(t,i,c,s)}}d.blend=function(o,e){const s=(255&e.rgba)/255;if(s===1)return{css:e.css,rgba:e.rgba};const t=e.rgba>>24&255,i=e.rgba>>16&255,c=e.rgba>>8&255,f=o.rgba>>24&255,p=o.rgba>>16&255,m=o.rgba>>8&255,g=f+Math.round((t-f)*s),S=p+Math.round((i-p)*s),w=m+Math.round((c-m)*s);return{css:a.toCss(g,S,w),rgba:a.toRgba(g,S,w)}},d.isOpaque=function(o){return(255&o.rgba)==255},d.ensureContrastRatio=function(o,e,s){const t=_.ensureContrastRatio(o.rgba,e.rgba,s);if(t)return _.toColor(t>>24&255,t>>16&255,t>>8&255)},d.opaque=function(o){const e=(255|o.rgba)>>>0,[s,t,i]=_.toChannels(e);return{css:a.toCss(s,t,i),rgba:e}},d.opacity=l,d.multiplyOpacity=function(o,e){return l(o,(255&o.rgba)*e/255)},d.toColorRGB=function(o){return[o.rgba>>24&255,o.rgba>>16&255,o.rgba>>8&255]}}(r.color||(r.color={})),(r.css||(r.css={})).toColor=function(d){if(d.match(/#[0-9a-f]{3,8}/i))switch(d.length){case 4:{const o=parseInt(d.slice(1,2).repeat(2),16),e=parseInt(d.slice(2,3).repeat(2),16),s=parseInt(d.slice(3,4).repeat(2),16);return _.toColor(o,e,s)}case 5:{const o=parseInt(d.slice(1,2).repeat(2),16),e=parseInt(d.slice(2,3).repeat(2),16),s=parseInt(d.slice(3,4).repeat(2),16),t=parseInt(d.slice(4,5).repeat(2),16);return _.toColor(o,e,s,t)}case 7:return{css:d,rgba:(parseInt(d.slice(1),16)<<8|255)>>>0};case 9:return{css:d,rgba:parseInt(d.slice(1),16)>>>0}}const l=d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l){const o=parseInt(l[1]),e=parseInt(l[2]),s=parseInt(l[3]),t=Math.round(255*(l[5]===void 0?1:parseFloat(l[5])));return _.toColor(o,e,s,t)}throw new Error("css.toColor: Unsupported css format")},function(d){function l(o,e,s){const t=o/255,i=e/255,c=s/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4))}d.relativeLuminance=function(o){return l(o>>16&255,o>>8&255,255&o)},d.relativeLuminance2=l}(n=r.rgb||(r.rgb={})),function(d){function l(e,s,t){const i=e>>24&255,c=e>>16&255,f=e>>8&255;let p=s>>24&255,m=s>>16&255,g=s>>8&255,S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));for(;S0||m>0||g>0);)p-=Math.max(0,Math.ceil(.1*p)),m-=Math.max(0,Math.ceil(.1*m)),g-=Math.max(0,Math.ceil(.1*g)),S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));return(p<<24|m<<16|g<<8|255)>>>0}function o(e,s,t){const i=e>>24&255,c=e>>16&255,f=e>>8&255;let p=s>>24&255,m=s>>16&255,g=s>>8&255,S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));for(;S>>0}d.ensureContrastRatio=function(e,s,t){const i=n.relativeLuminance(e>>8),c=n.relativeLuminance(s>>8);if(u(i,c)>8));if(gu(i,n.relativeLuminance(S>>8))?m:S}return m}const f=o(e,s,t),p=u(i,n.relativeLuminance(f>>8));if(pu(i,n.relativeLuminance(m>>8))?f:m}return f}},d.reduceLuminance=l,d.increaseLuminance=o,d.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},d.toColor=function(e,s,t,i){return{css:a.toCss(e,s,t,i),rgba:a.toRgba(e,s,t,i)}}}(_=r.rgba||(r.rgba={})),r.toPaddedHex=h,r.contrastRatio=u},8969:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const n=a(844),_=a(2585),h=a(4348),u=a(7866),d=a(744),l=a(7302),o=a(6975),e=a(8460),s=a(1753),t=a(3730),i=a(1480),c=a(7994),f=a(9282),p=a(5435),m=a(5981),g=a(2660);let S=!1;class w extends n.Disposable{constructor(L){super(),this._onBinary=new e.EventEmitter,this._onData=new e.EventEmitter,this._onLineFeed=new e.EventEmitter,this._onResize=new e.EventEmitter,this._onScroll=new e.EventEmitter,this._onWriteParsed=new e.EventEmitter,this._instantiationService=new h.InstantiationService,this.optionsService=new l.OptionsService(L),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this._instantiationService.createInstance(u.LogService),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService,()=>this.scrollToBottom())),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this._instantiationService.createInstance(s.CoreMouseService),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this._dirtyRowService=this._instantiationService.createInstance(t.DirtyRowService),this._instantiationService.setService(_.IDirtyRowService,this._dirtyRowService),this.unicodeService=this._instantiationService.createInstance(i.UnicodeService),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=new p.InputHandler(this._bufferService,this._charsetService,this.coreService,this._dirtyRowService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.optionsService.onOptionChange(v=>this._updateOptions(v))),this.register(this._bufferService.onScroll(v=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(v=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=new m.WriteBuffer((v,C)=>this._inputHandler.parse(v,C)),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onBinary(){return this._onBinary.event}get onData(){return this._onData.event}get onLineFeed(){return this._onLineFeed.event}get onResize(){return this._onResize.event}get onWriteParsed(){return this._onWriteParsed.event}get onScroll(){return this._onScrollApi||(this._onScrollApi=new e.EventEmitter,this.register(this._onScroll.event(L=>{var v;(v=this._onScrollApi)===null||v===void 0||v.fire(L.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(L){for(const v in L)this.optionsService.options[v]=L[v]}dispose(){var L;this._isDisposed||(super.dispose(),(L=this._windowsMode)===null||L===void 0||L.dispose(),this._windowsMode=void 0)}write(L,v){this._writeBuffer.write(L,v)}writeSync(L,v){this._logService.logLevel<=_.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(L,v)}resize(L,v){isNaN(L)||isNaN(v)||(L=Math.max(L,d.MINIMUM_COLS),v=Math.max(v,d.MINIMUM_ROWS),this._bufferService.resize(L,v))}scroll(L,v=!1){this._bufferService.scroll(L,v)}scrollLines(L,v,C){this._bufferService.scrollLines(L,v,C)}scrollPages(L){this._bufferService.scrollPages(L)}scrollToTop(){this._bufferService.scrollToTop()}scrollToBottom(){this._bufferService.scrollToBottom()}scrollToLine(L){this._bufferService.scrollToLine(L)}registerEscHandler(L,v){return this._inputHandler.registerEscHandler(L,v)}registerDcsHandler(L,v){return this._inputHandler.registerDcsHandler(L,v)}registerCsiHandler(L,v){return this._inputHandler.registerCsiHandler(L,v)}registerOscHandler(L,v){return this._inputHandler.registerOscHandler(L,v)}_setup(){this.optionsService.rawOptions.windowsMode&&this._enableWindowsMode()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_updateOptions(L){var v;switch(L){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.rawOptions.windowsMode?this._enableWindowsMode():((v=this._windowsMode)===null||v===void 0||v.dispose(),this._windowsMode=void 0)}}_enableWindowsMode(){if(!this._windowsMode){const L=[];L.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsMode={dispose:()=>{for(const v of L)v.dispose()}}}}}r.CoreTerminal=w},8460:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let n=0;nn.fire(_))}},5435:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const n=a(2584),_=a(7116),h=a(2015),u=a(844),d=a(482),l=a(8437),o=a(8460),e=a(643),s=a(511),t=a(3734),i=a(2585),c=a(6242),f=a(6351),p=a(5941),m={"(":0,")":1,"*":2,"+":3,"-":1,".":2},g=131072;function S(L,v){if(L>24)return v.setWinLines||!1;switch(L){case 1:return!!v.restoreWin;case 2:return!!v.minimizeWin;case 3:return!!v.setWinPosition;case 4:return!!v.setWinSizePixels;case 5:return!!v.raiseWin;case 6:return!!v.lowerWin;case 7:return!!v.refreshWin;case 8:return!!v.setWinSizeChars;case 9:return!!v.maximizeWin;case 10:return!!v.fullscreenWin;case 11:return!!v.getWinState;case 13:return!!v.getWinPosition;case 14:return!!v.getWinSizePixels;case 15:return!!v.getScreenSizePixels;case 16:return!!v.getCellSizePixels;case 18:return!!v.getWinSizeChars;case 19:return!!v.getScreenSizeChars;case 20:return!!v.getIconTitle;case 21:return!!v.getWinTitle;case 22:return!!v.pushTitle;case 23:return!!v.popTitle;case 24:return!!v.setWinLines}return!1}var w;(function(L){L[L.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",L[L.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w=r.WindowsOptionsReportType||(r.WindowsOptionsReportType={}));class k extends u.Disposable{constructor(v,C,b,E,A,H,$,U,P,W=new h.EscapeSequenceParser){super(),this._bufferService=v,this._charsetService=C,this._coreService=b,this._dirtyRowService=E,this._logService=A,this._optionsService=H,this._oscLinkService=$,this._coreMouseService=U,this._unicodeService=P,this._parser=W,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new d.StringToUtf32,this._utf8Decoder=new d.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=new o.EventEmitter,this._onRequestRefreshRows=new o.EventEmitter,this._onRequestReset=new o.EventEmitter,this._onRequestSendFocus=new o.EventEmitter,this._onRequestSyncScrollBar=new o.EventEmitter,this._onRequestWindowsOptionsReport=new o.EventEmitter,this._onA11yChar=new o.EventEmitter,this._onA11yTab=new o.EventEmitter,this._onCursorMove=new o.EventEmitter,this._onLineFeed=new o.EventEmitter,this._onScroll=new o.EventEmitter,this._onTitleChange=new o.EventEmitter,this._onColor=new o.EventEmitter,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(y=>this._activeBuffer=y.activeBuffer)),this._parser.setCsiHandlerFallback((y,T)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(y),params:T.toArray()})}),this._parser.setEscHandlerFallback(y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(y)})}),this._parser.setExecuteHandlerFallback(y=>{this._logService.debug("Unknown EXECUTE code: ",{code:y})}),this._parser.setOscHandlerFallback((y,T,O)=>{this._logService.debug("Unknown OSC code: ",{identifier:y,action:T,data:O})}),this._parser.setDcsHandlerFallback((y,T,O)=>{T==="HOOK"&&(O=O.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(y),action:T,payload:O})}),this._parser.setPrintHandler((y,T,O)=>this.print(y,T,O)),this._parser.registerCsiHandler({final:"@"},y=>this.insertChars(y)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},y=>this.scrollLeft(y)),this._parser.registerCsiHandler({final:"A"},y=>this.cursorUp(y)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},y=>this.scrollRight(y)),this._parser.registerCsiHandler({final:"B"},y=>this.cursorDown(y)),this._parser.registerCsiHandler({final:"C"},y=>this.cursorForward(y)),this._parser.registerCsiHandler({final:"D"},y=>this.cursorBackward(y)),this._parser.registerCsiHandler({final:"E"},y=>this.cursorNextLine(y)),this._parser.registerCsiHandler({final:"F"},y=>this.cursorPrecedingLine(y)),this._parser.registerCsiHandler({final:"G"},y=>this.cursorCharAbsolute(y)),this._parser.registerCsiHandler({final:"H"},y=>this.cursorPosition(y)),this._parser.registerCsiHandler({final:"I"},y=>this.cursorForwardTab(y)),this._parser.registerCsiHandler({final:"J"},y=>this.eraseInDisplay(y,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},y=>this.eraseInDisplay(y,!0)),this._parser.registerCsiHandler({final:"K"},y=>this.eraseInLine(y,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},y=>this.eraseInLine(y,!0)),this._parser.registerCsiHandler({final:"L"},y=>this.insertLines(y)),this._parser.registerCsiHandler({final:"M"},y=>this.deleteLines(y)),this._parser.registerCsiHandler({final:"P"},y=>this.deleteChars(y)),this._parser.registerCsiHandler({final:"S"},y=>this.scrollUp(y)),this._parser.registerCsiHandler({final:"T"},y=>this.scrollDown(y)),this._parser.registerCsiHandler({final:"X"},y=>this.eraseChars(y)),this._parser.registerCsiHandler({final:"Z"},y=>this.cursorBackwardTab(y)),this._parser.registerCsiHandler({final:"`"},y=>this.charPosAbsolute(y)),this._parser.registerCsiHandler({final:"a"},y=>this.hPositionRelative(y)),this._parser.registerCsiHandler({final:"b"},y=>this.repeatPrecedingCharacter(y)),this._parser.registerCsiHandler({final:"c"},y=>this.sendDeviceAttributesPrimary(y)),this._parser.registerCsiHandler({prefix:">",final:"c"},y=>this.sendDeviceAttributesSecondary(y)),this._parser.registerCsiHandler({final:"d"},y=>this.linePosAbsolute(y)),this._parser.registerCsiHandler({final:"e"},y=>this.vPositionRelative(y)),this._parser.registerCsiHandler({final:"f"},y=>this.hVPosition(y)),this._parser.registerCsiHandler({final:"g"},y=>this.tabClear(y)),this._parser.registerCsiHandler({final:"h"},y=>this.setMode(y)),this._parser.registerCsiHandler({prefix:"?",final:"h"},y=>this.setModePrivate(y)),this._parser.registerCsiHandler({final:"l"},y=>this.resetMode(y)),this._parser.registerCsiHandler({prefix:"?",final:"l"},y=>this.resetModePrivate(y)),this._parser.registerCsiHandler({final:"m"},y=>this.charAttributes(y)),this._parser.registerCsiHandler({final:"n"},y=>this.deviceStatus(y)),this._parser.registerCsiHandler({prefix:"?",final:"n"},y=>this.deviceStatusPrivate(y)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},y=>this.softReset(y)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},y=>this.setCursorStyle(y)),this._parser.registerCsiHandler({final:"r"},y=>this.setScrollRegion(y)),this._parser.registerCsiHandler({final:"s"},y=>this.saveCursor(y)),this._parser.registerCsiHandler({final:"t"},y=>this.windowOptions(y)),this._parser.registerCsiHandler({final:"u"},y=>this.restoreCursor(y)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},y=>this.insertColumns(y)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},y=>this.deleteColumns(y)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},y=>this.selectProtected(y)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},y=>this.requestMode(y,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},y=>this.requestMode(y,!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 c.OscHandler(y=>(this.setTitle(y),this.setIconName(y),!0))),this._parser.registerOscHandler(1,new c.OscHandler(y=>this.setIconName(y))),this._parser.registerOscHandler(2,new c.OscHandler(y=>this.setTitle(y))),this._parser.registerOscHandler(4,new c.OscHandler(y=>this.setOrReportIndexedColor(y))),this._parser.registerOscHandler(8,new c.OscHandler(y=>this.setHyperlink(y))),this._parser.registerOscHandler(10,new c.OscHandler(y=>this.setOrReportFgColor(y))),this._parser.registerOscHandler(11,new c.OscHandler(y=>this.setOrReportBgColor(y))),this._parser.registerOscHandler(12,new c.OscHandler(y=>this.setOrReportCursorColor(y))),this._parser.registerOscHandler(104,new c.OscHandler(y=>this.restoreIndexedColor(y))),this._parser.registerOscHandler(110,new c.OscHandler(y=>this.restoreFgColor(y))),this._parser.registerOscHandler(111,new c.OscHandler(y=>this.restoreBgColor(y))),this._parser.registerOscHandler(112,new c.OscHandler(y=>this.restoreCursorColor(y))),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(const y in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:y},()=>this.selectCharset("("+y)),this._parser.registerEscHandler({intermediates:")",final:y},()=>this.selectCharset(")"+y)),this._parser.registerEscHandler({intermediates:"*",final:y},()=>this.selectCharset("*"+y)),this._parser.registerEscHandler({intermediates:"+",final:y},()=>this.selectCharset("+"+y)),this._parser.registerEscHandler({intermediates:"-",final:y},()=>this.selectCharset("-"+y)),this._parser.registerEscHandler({intermediates:".",final:y},()=>this.selectCharset("."+y)),this._parser.registerEscHandler({intermediates:"/",final:y},()=>this.selectCharset("/"+y));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(y=>(this._logService.error("Parsing error: ",y),y)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new f.DcsHandler((y,T)=>this.requestStatusString(y,T)))}getAttrData(){return this._curAttrData}get onRequestBell(){return this._onRequestBell.event}get onRequestRefreshRows(){return this._onRequestRefreshRows.event}get onRequestReset(){return this._onRequestReset.event}get onRequestSendFocus(){return this._onRequestSendFocus.event}get onRequestSyncScrollBar(){return this._onRequestSyncScrollBar.event}get onRequestWindowsOptionsReport(){return this._onRequestWindowsOptionsReport.event}get onA11yChar(){return this._onA11yChar.event}get onA11yTab(){return this._onA11yTab.event}get onCursorMove(){return this._onCursorMove.event}get onLineFeed(){return this._onLineFeed.event}get onScroll(){return this._onScroll.event}get onTitleChange(){return this._onTitleChange.event}get onColor(){return this._onColor.event}dispose(){super.dispose()}_preserveStack(v,C,b,E){this._parseStack.paused=!0,this._parseStack.cursorStartX=v,this._parseStack.cursorStartY=C,this._parseStack.decodedLength=b,this._parseStack.position=E}_logSlowResolvingAsync(v){this._logService.logLevel<=i.LogLevelEnum.WARN&&Promise.race([v,new Promise((C,b)=>setTimeout(()=>b("#SLOW_TIMEOUT"),5e3))]).catch(C=>{if(C!=="#SLOW_TIMEOUT")throw C;console.warn("async parser handler taking longer than 5000 ms")})}parse(v,C){let b,E=this._activeBuffer.x,A=this._activeBuffer.y,H=0;const $=this._parseStack.paused;if($){if(b=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,C))return this._logSlowResolvingAsync(b),b;E=this._parseStack.cursorStartX,A=this._parseStack.cursorStartY,this._parseStack.paused=!1,v.length>g&&(H=this._parseStack.position+g)}if(this._logService.logLevel<=i.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof v=="string"?` "${v}"`:` "${Array.prototype.map.call(v,U=>String.fromCharCode(U)).join("")}"`),typeof v=="string"?v.split("").map(U=>U.charCodeAt(0)):v),this._parseBuffer.lengthg)for(let U=H;U0&&T.getWidth(this._activeBuffer.x-1)===2&&T.setCellFromCodePoint(this._activeBuffer.x-1,0,1,y.fg,y.bg,y.extended);for(let O=C;O=U){if(P){for(;this._activeBuffer.x=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=U-1,A===2)continue}if(W&&(T.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(y),y),T.getWidth(U-1)===2&&T.setCellFromCodePoint(U-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,y.fg,y.bg,y.extended)),T.setCellFromCodePoint(this._activeBuffer.x++,E,A,y.fg,y.bg,y.extended),A>0)for(;--A;)T.setCellFromCodePoint(this._activeBuffer.x++,0,0,y.fg,y.bg,y.extended)}else T.getWidth(this._activeBuffer.x-1)?T.addCodepointToCell(this._activeBuffer.x-1,E):T.addCodepointToCell(this._activeBuffer.x-2,E)}b-C>0&&(T.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x0&&T.getWidth(this._activeBuffer.x)===0&&!T.hasContent(this._activeBuffer.x)&&T.setCellFromCodePoint(this._activeBuffer.x,0,1,y.fg,y.bg,y.extended),this._dirtyRowService.markDirty(this._activeBuffer.y)}registerCsiHandler(v,C){return v.final!=="t"||v.prefix||v.intermediates?this._parser.registerCsiHandler(v,C):this._parser.registerCsiHandler(v,b=>!S(b.params[0],this._optionsService.rawOptions.windowOptions)||C(b))}registerDcsHandler(v,C){return this._parser.registerDcsHandler(v,new f.DcsHandler(C))}registerEscHandler(v,C){return this._parser.registerEscHandler(v,C)}registerOscHandler(v,C){return this._parser.registerOscHandler(v,new c.OscHandler(C))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowService.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.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowService.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var v;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&&((v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||v===void 0?void 0:v.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const v=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-v),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(v=this._bufferService.cols-1){this._activeBuffer.x=Math.min(v,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._dirtyRowService.markDirty(this._activeBuffer.y)}_setCursor(v,C){this._dirtyRowService.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=v,this._activeBuffer.y=this._activeBuffer.scrollTop+C):(this._activeBuffer.x=v,this._activeBuffer.y=C),this._restrictCursor(),this._dirtyRowService.markDirty(this._activeBuffer.y)}_moveCursor(v,C){this._restrictCursor(),this._setCursor(this._activeBuffer.x+v,this._activeBuffer.y+C)}cursorUp(v){const C=this._activeBuffer.y-this._activeBuffer.scrollTop;return C>=0?this._moveCursor(0,-Math.min(C,v.params[0]||1)):this._moveCursor(0,-(v.params[0]||1)),!0}cursorDown(v){const C=this._activeBuffer.scrollBottom-this._activeBuffer.y;return C>=0?this._moveCursor(0,Math.min(C,v.params[0]||1)):this._moveCursor(0,v.params[0]||1),!0}cursorForward(v){return this._moveCursor(v.params[0]||1,0),!0}cursorBackward(v){return this._moveCursor(-(v.params[0]||1),0),!0}cursorNextLine(v){return this.cursorDown(v),this._activeBuffer.x=0,!0}cursorPrecedingLine(v){return this.cursorUp(v),this._activeBuffer.x=0,!0}cursorCharAbsolute(v){return this._setCursor((v.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(v){return this._setCursor(v.length>=2?(v.params[1]||1)-1:0,(v.params[0]||1)-1),!0}charPosAbsolute(v){return this._setCursor((v.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(v){return this._moveCursor(v.params[0]||1,0),!0}linePosAbsolute(v){return this._setCursor(this._activeBuffer.x,(v.params[0]||1)-1),!0}vPositionRelative(v){return this._moveCursor(0,v.params[0]||1),!0}hVPosition(v){return this.cursorPosition(v),!0}tabClear(v){const C=v.params[0];return C===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:C===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(v){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=v.params[0]||1;for(;C--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(v){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=v.params[0]||1;for(;C--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(v){const C=v.params[0];return C===1&&(this._curAttrData.bg|=536870912),C!==2&&C!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(v,C,b,E=!1,A=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+v);H.replaceCells(C,b,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),A),E&&(H.isWrapped=!1)}_resetBufferLine(v,C=!1){const b=this._activeBuffer.lines.get(this._activeBuffer.ybase+v);b.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),C),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+v),b.isWrapped=!1}eraseInDisplay(v,C=!1){let b;switch(this._restrictCursor(this._bufferService.cols),v.params[0]){case 0:for(b=this._activeBuffer.y,this._dirtyRowService.markDirty(b),this._eraseInBufferLine(b++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,C);b=this._bufferService.cols&&(this._activeBuffer.lines.get(b+1).isWrapped=!1);b--;)this._resetBufferLine(b,C);this._dirtyRowService.markDirty(0);break;case 2:for(b=this._bufferService.rows,this._dirtyRowService.markDirty(b-1);b--;)this._resetBufferLine(b,C);this._dirtyRowService.markDirty(0);break;case 3:const E=this._activeBuffer.lines.length-this._bufferService.rows;E>0&&(this._activeBuffer.lines.trimStart(E),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-E,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-E,0),this._onScroll.fire(0))}return!0}eraseInLine(v,C=!1){switch(this._restrictCursor(this._bufferService.cols),v.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,C);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,C);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,C)}return this._dirtyRowService.markDirty(this._activeBuffer.y),!0}insertLines(v){this._restrictCursor();let C=v.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y0||(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(v){return v.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(v.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(v){return(this._optionsService.rawOptions.termName+"").indexOf(v)===0}setMode(v){for(let C=0;CB?1:2,O=v.params[0];return R=O,x=C?O===2?3:O===4?T(H.modes.insertMode):O===12?4:O===20?T(y.convertEol):0:O===1?T(b.applicationCursorKeys):O===3?y.windowOptions.setWinLines?U===80?2:U===132?1:0:0:O===6?T(b.origin):O===7?T(b.wraparound):O===8?3:O===9?T(E==="X10"):O===12?T(y.cursorBlink):O===25?T(!H.isCursorHidden):O===45?T(b.reverseWraparound):O===66?T(b.applicationKeypad):O===1e3?T(E==="VT200"):O===1002?T(E==="DRAG"):O===1003?T(E==="ANY"):O===1004?T(b.sendFocus):O===1005?4:O===1006?T(A==="SGR"):O===1015?4:O===1016?T(A==="SGR_PIXELS"):O===1048?1:O===47||O===1047||O===1049?T(P===W):O===2004?T(b.bracketedPasteMode):0,H.triggerDataEvent(`${n.C0.ESC}[${C?"":"?"}${R};${x}$y`),!0;var R,x}_updateAttrColor(v,C,b,E,A){return C===2?(v|=50331648,v&=-16777216,v|=t.AttributeData.fromColorRGB([b,E,A])):C===5&&(v&=-50331904,v|=33554432|255&b),v}_extractColor(v,C,b){const E=[0,0,-1,0,0,0];let A=0,H=0;do{if(E[H+A]=v.params[C+H],v.hasSubParams(C+H)){const $=v.getSubParams(C+H);let U=0;do E[1]===5&&(A=1),E[H+U+1+A]=$[U];while(++U<$.length&&U+H+1+A=2||E[1]===2&&H+A>=5)break;E[1]&&(A=1)}while(++H+C5)&&(v=1),C.extended.underlineStyle=v,C.fg|=268435456,v===0&&(C.fg&=-268435457),C.updateExtended()}charAttributes(v){if(v.length===1&&v.params[0]===0)return this._curAttrData.fg=l.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=l.DEFAULT_ATTR_DATA.bg,!0;const C=v.length;let b;const E=this._curAttrData;for(let A=0;A=30&&b<=37?(E.fg&=-50331904,E.fg|=16777216|b-30):b>=40&&b<=47?(E.bg&=-50331904,E.bg|=16777216|b-40):b>=90&&b<=97?(E.fg&=-50331904,E.fg|=16777224|b-90):b>=100&&b<=107?(E.bg&=-50331904,E.bg|=16777224|b-100):b===0?(E.fg=l.DEFAULT_ATTR_DATA.fg,E.bg=l.DEFAULT_ATTR_DATA.bg):b===1?E.fg|=134217728:b===3?E.bg|=67108864:b===4?(E.fg|=268435456,this._processUnderline(v.hasSubParams(A)?v.getSubParams(A)[0]:1,E)):b===5?E.fg|=536870912:b===7?E.fg|=67108864:b===8?E.fg|=1073741824:b===9?E.fg|=2147483648:b===2?E.bg|=134217728:b===21?this._processUnderline(2,E):b===22?(E.fg&=-134217729,E.bg&=-134217729):b===23?E.bg&=-67108865:b===24?(E.fg&=-268435457,this._processUnderline(0,E)):b===25?E.fg&=-536870913:b===27?E.fg&=-67108865:b===28?E.fg&=-1073741825:b===29?E.fg&=2147483647:b===39?(E.fg&=-67108864,E.fg|=16777215&l.DEFAULT_ATTR_DATA.fg):b===49?(E.bg&=-67108864,E.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):b===38||b===48||b===58?A+=this._extractColor(v,A,E):b===59?(E.extended=E.extended.clone(),E.extended.underlineColor=-1,E.updateExtended()):b===100?(E.fg&=-67108864,E.fg|=16777215&l.DEFAULT_ATTR_DATA.fg,E.bg&=-67108864,E.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",b);return!0}deviceStatus(v){switch(v.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const C=this._activeBuffer.y+1,b=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${C};${b}R`)}return!0}deviceStatusPrivate(v){if(v.params[0]===6){const C=this._activeBuffer.y+1,b=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${C};${b}R`)}return!0}softReset(v){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=l.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(v){const C=v.params[0]||1;switch(C){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"}const b=C%2==1;return this._optionsService.options.cursorBlink=b,!0}setScrollRegion(v){const C=v.params[0]||1;let b;return(v.length<2||(b=v.params[1])>this._bufferService.rows||b===0)&&(b=this._bufferService.rows),b>C&&(this._activeBuffer.scrollTop=C-1,this._activeBuffer.scrollBottom=b-1,this._setCursor(0,0)),!0}windowOptions(v){if(!S(v.params[0],this._optionsService.rawOptions.windowOptions))return!0;const C=v.length>1?v.params[1]:0;switch(v.params[0]){case 14:C!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:C!==0&&C!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),C!==0&&C!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:C!==0&&C!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),C!==0&&C!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(v){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(v){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(v){return this._windowTitle=v,this._onTitleChange.fire(v),!0}setIconName(v){return this._iconName=v,!0}setOrReportIndexedColor(v){const C=[],b=v.split(";");for(;b.length>1;){const E=b.shift(),A=b.shift();if(/^\d+$/.exec(E)){const H=parseInt(E);if(0<=H&&H<256)if(A==="?")C.push({type:0,index:H});else{const $=(0,p.parseColor)(A);$&&C.push({type:1,index:H,color:$})}}}return C.length&&this._onColor.fire(C),!0}setHyperlink(v){const C=v.split(";");return!(C.length<2)&&(C[1]?this._createHyperlink(C[0],C[1]):!C[0]&&this._finishHyperlink())}_createHyperlink(v,C){this._currentLinkId!==void 0&&this._finishHyperlink();const b=v.split(":");let E;const A=b.findIndex(H=>H.startsWith("id="));return A!==-1&&(E=b[A].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._currentLinkId=this._oscLinkService.registerLink({id:E,uri:C}),this._curAttrData.extended.urlId=this._currentLinkId,this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),this._currentLinkId=void 0,!0}_setOrReportSpecialColor(v,C){const b=v.split(";");for(let E=0;E=this._specialColors.length);++E,++C)if(b[E]==="?")this._onColor.fire([{type:0,index:this._specialColors[C]}]);else{const A=(0,p.parseColor)(b[E]);A&&this._onColor.fire([{type:1,index:this._specialColors[C],color:A}])}return!0}setOrReportFgColor(v){return this._setOrReportSpecialColor(v,0)}setOrReportBgColor(v){return this._setOrReportSpecialColor(v,1)}setOrReportCursorColor(v){return this._setOrReportSpecialColor(v,2)}restoreIndexedColor(v){if(!v)return this._onColor.fire([{type:2}]),!0;const C=[],b=v.split(";");for(let E=0;E=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const v=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,v,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(v){return this._charsetService.setgLevel(v),!0}screenAlignmentPattern(){const v=new s.CellData;v.content=4194304|"E".charCodeAt(0),v.fg=this._curAttrData.fg,v.bg=this._curAttrData.bg,this._setCursor(0,0);for(let C=0;C(this._coreService.triggerDataEvent(`${n.C0.ESC}${A}${n.C0.ESC}\\`),!0))(v==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:v==='"p'?'P1$r61;1"p':v==="r"?`P1$r${b.scrollTop+1};${b.scrollBottom+1}r`:v==="m"?"P1$r0m":v===" q"?`P1$r${{block:2,underline:4,bar:6}[E.cursorStyle]-(E.cursorBlink?1:0)} q`:"P0$r")}}r.InputHandler=k},844:(D,r)=>{function a(n){for(const _ of n)_.dispose();n.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const n of this._disposables)n.dispose();this._disposables.length=0}register(n){return this._disposables.push(n),n}unregister(n){const _=this._disposables.indexOf(n);_!==-1&&this._disposables.splice(_,1)}},r.toDisposable=function(n){return{dispose:n}},r.disposeArray=a,r.getDisposeArrayDisposable=function(n){return{dispose:()=>a(n)}}},1505:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,h,u){this._data[_]||(this._data[_]={}),this._data[_][h]=u}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=a,r.FourKeyMap=class{constructor(){this._data=new a}set(n,_,h,u,d){this._data.get(n,_)||this._data.set(n,_,new a),this._data.get(n,_).set(h,u,d)}get(n,_,h,u){var d;return(d=this._data.get(n,_))===null||d===void 0?void 0:d.get(h,u)}clear(){this._data.clear()}}},6114:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.isSafari=r.isLegacyEdge=r.isFirefox=void 0;const a=typeof navigator=="undefined",n=a?"node":navigator.userAgent,_=a?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_),r.isIpad=_==="iPad",r.isIphone=_==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(_),r.isLinux=_.indexOf("Linux")>=0},6106:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let a=0;r.SortedList=class{constructor(n){this._getKey=n,this._array=[]}clear(){this._array.length=0}insert(n){this._array.length!==0?(a=this._search(this._getKey(n),0,this._array.length-1),this._array.splice(a,0,n)):this._array.push(n)}delete(n){if(this._array.length===0)return!1;const _=this._getKey(n);if(_===void 0||(a=this._search(_,0,this._array.length-1),a===-1)||this._getKey(this._array[a])!==_)return!1;do if(this._array[a]===n)return this._array.splice(a,1),!0;while(++a=this._array.length)&&this._getKey(this._array[a])===n))do yield this._array[a];while(++a=this._array.length)&&this._getKey(this._array[a])===n))do _(this._array[a]);while(++an)return this._search(n,_,u-1);if(d0&&this._getKey(this._array[u-1])===n;)u--;return u}}},8273:(D,r)=>{function a(n,_,h=0,u=n.length){if(h>=n.length)return n;h=(n.length+h)%n.length,u=u>=n.length?n.length:(n.length+u)%n.length;for(let d=h;d{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const n=a(643);r.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),u=h==null?void 0:h.get(_.cols-1),d=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);d&&u&&(d.isWrapped=u[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&u[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},3734:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new n}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=a;class n{constructor(h=0,u=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=u}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}clone(){return new n(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=n},9092:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferStringIterator=r.Buffer=r.MAX_BUFFER_SIZE=void 0;const n=a(6349),_=a(8437),h=a(511),u=a(643),d=a(4634),l=a(4863),o=a(7116),e=a(3734);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,i,c){this._hasScrollback=t,this._optionsService=i,this._bufferService=c,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=h.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=h.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new e.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new e.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,i){return new _.BufferLine(this._bufferService.cols,this.getNullCell(t),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&tr.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=_.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,i){const c=this.getNullCell(_.DEFAULT_ATTR_DATA),f=this._getCorrectBufferLength(i);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols