this._linkAtPosition(h.link,s));if(g){t=!0,this._handleNewLink(g);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;let s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!s||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(e.link,s)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.pointerCursor},set:t=>{var i,a;!((i=this._currentLink)===null||i===void 0)&&i.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((a=this._element)===null||a===void 0||a.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.underline},set:t=>{var i,a,l;!((i=this._currentLink)===null||i===void 0)&&i.state&&((l=(a=this._currentLink)===null||a===void 0?void 0:a.state)===null||l===void 0?void 0:l.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;let i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(i,a),this._lastMouseEvent&&this._element)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(t,s.text)}_fireUnderlineEvent(e,s){let t=e.range,i=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-i-1,t.end.x,t.end.y-i-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(t,s.text)}_linkAtPosition(e,s){let t=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,a=s.y*this._bufferService.cols+s.x;return t<=a&&a<=i}_positionFromMouseEvent(e,s,t){let 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,a){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:a}}};r.Linkifier2=_=c([u(0,m.IBufferService)],_)},9042:(L,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"},3730:function(L,r,o){var c=this&&this.__decorate||function(_,e,s,t){var i,a=arguments.length,l=a<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,e,s,t);else for(var p=_.length-1;p>=0;p--)(i=_[p])&&(l=(a<3?i(l):a>3?i(e,s,l):i(e,s))||l);return a>3&&l&&Object.defineProperty(e,s,l),l},u=this&&this.__param||function(_,e){return function(s,t){e(s,t,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let n=o(511),d=o(2585),f=r.OscLinkProvider=class{constructor(_,e,s){this._bufferService=_,this._optionsService=e,this._oscLinkService=s}provideLinks(_,e){var s;let t=this._bufferService.buffer.lines.get(_-1);if(!t)return void e(void 0);let i=[],a=this._optionsService.rawOptions.linkHandler,l=new n.CellData,p=t.getTrimmedLength(),g=-1,h=-1,v=!1;for(let b=0;ba?a.activate(R,B,y):m(0,B),hover:(R,B)=>{var P;return(P=a?.hover)===null||P===void 0?void 0:P.call(a,R,B,y)},leave:(R,B)=>{var P;return(P=a?.leave)===null||P===void 0?void 0:P.call(a,R,B,y)}})}v=!1,l.hasExtendedAttrs()&&l.extended.urlId?(h=b,g=l.extended.urlId):(h=-1,g=-1)}}e(i)}};function m(_,e){if(confirm(`Do you want to navigate to ${e}?
+
+WARNING: This link could potentially be dangerous`)){let 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")}}r.OscLinkProvider=f=c([u(0,d.IBufferService),u(1,d.IOptionsService),u(2,d.IOscLinkService)],f)},6193:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,c){this._parentWindow=o,this._renderCallback=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,c,u){this._rowCount=u,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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();let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},5596:(L,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;let c=o(844);class u extends c.Disposable{constructor(d){super(),this._parentWindow=d,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,c.toDisposable)(()=>{this.clearListener()}))}setListener(d){this._listener&&this.clearListener(),this._listener=d,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var d;this._outerListener&&((d=this._resolutionMediaMatchList)===null||d===void 0||d.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=u},3236:(L,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let c=o(3614),u=o(3656),n=o(6465),d=o(9042),f=o(3730),m=o(1680),_=o(3107),e=o(5744),s=o(2950),t=o(1296),i=o(428),a=o(4269),l=o(5114),p=o(8934),g=o(3230),h=o(9312),v=o(4725),b=o(6731),T=o(8055),y=o(8969),k=o(8460),R=o(844),B=o(6114),P=o(8437),I=o(2584),C=o(7399),w=o(5941),E=o(9074),x=o(2585),F=o(5435),N=o(4567),z=typeof window<"u"?window.document:null;class j extends y.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(S={}){super(S),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.MutableDisposable),this._onCursorMove=this.register(new k.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new k.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new k.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new k.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new k.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new k.EventEmitter),this._onBlur=this.register(new k.EventEmitter),this._onA11yCharEmitter=this.register(new k.EventEmitter),this._onA11yTabEmitter=this.register(new k.EventEmitter),this._onWillOpen=this.register(new k.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(n.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(x.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((D,M)=>this.refresh(D,M))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(D=>this._reportWindowsOptions(D))),this.register(this._inputHandler.onColor(D=>this._handleColorEvent(D))),this.register((0,k.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,k.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(D=>this._afterResize(D.cols,D.rows))),this.register((0,R.toDisposable)(()=>{var D,M;this._customKeyEventHandler=void 0,(M=(D=this.element)===null||D===void 0?void 0:D.parentNode)===null||M===void 0||M.removeChild(this.element)}))}_handleColorEvent(S){if(this._themeService)for(let D of S){let M,A="";switch(D.index){case 256:M="foreground",A="10";break;case 257:M="background",A="11";break;case 258:M="cursor",A="12";break;default:M="ansi",A="4;"+D.index}switch(D.type){case 0:let K=T.color.toColorRGB(M==="ansi"?this._themeService.colors.ansi[D.index]:this._themeService.colors[M]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${A};${(0,w.toRgbString)(K)}${I.C1_ESCAPED.ST}`);break;case 1:if(M==="ansi")this._themeService.modifyColors(U=>U.ansi[D.index]=T.rgba.toColor(...D.color));else{let U=M;this._themeService.modifyColors(V=>V[U]=T.rgba.toColor(...D.color))}break;case 2:this._themeService.restoreColor(D.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(S){S?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(S){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[I"),this.updateCursorStyle(S),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var S;return(S=this.textarea)===null||S===void 0?void 0:S.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let S=this.buffer.ybase+this.buffer.y,D=this.buffer.lines.get(S);if(!D)return;let M=Math.min(this.buffer.x,this.cols-1),A=this._renderService.dimensions.css.cell.height,K=D.getWidth(M),U=this._renderService.dimensions.css.cell.width*K,V=this.buffer.y*this._renderService.dimensions.css.cell.height,Z=M*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Z+"px",this.textarea.style.top=V+"px",this.textarea.style.width=U+"px",this.textarea.style.height=A+"px",this.textarea.style.lineHeight=A+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",D=>{this.hasSelection()&&(0,c.copyHandler)(D,this._selectionService)}));let S=D=>(0,c.handlePasteEvent)(D,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",S)),this.register((0,u.addDisposableDomListener)(this.element,"paste",S)),B.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",D=>{D.button===2&&(0,c.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",D=>{(0,c.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),B.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",D=>{D.button===1&&(0,c.moveTextAreaUnderMouseCursor)(D,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",S=>this._keyUp(S),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",S=>this._keyDown(S),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",S=>this._keyPress(S),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",S=>this._compositionHelper.compositionupdate(S))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,u.addDisposableDomListener)(this.textarea,"input",S=>this._inputEvent(S),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(S){var D;if(!S)throw new Error("Terminal requires a parent element.");S.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=S.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),S.appendChild(this.element);let M=z.createDocumentFragment();this._viewportElement=z.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),M.appendChild(this._viewportElement),this._viewportScrollArea=z.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=z.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=z.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),M.appendChild(this.screenElement),this.textarea=z.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),B.isChromeOS||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._coreBrowserService=this._instantiationService.createInstance(l.CoreBrowserService,this.textarea,(D=this._document.defaultView)!==null&&D!==void 0?D:window),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",A=>this._handleTextAreaFocus(A))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(a.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(A=>this._onRender.fire(A))),this.onResize(A=>this._renderService.resize(A.cols,A.rows)),this._compositionView=z.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(M);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(m.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(A=>this.scrollLines(A.amount,A.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(h.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(A=>this.scrollLines(A.amount,A.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(A=>this._renderService.handleSelectionChanged(A.start,A.end,A.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(A=>{this.textarea.value=A,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(A=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",A=>this._selectionService.handleMouseDown(A))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",A=>this._handleScreenReaderModeOptionChange(A))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",A=>{!this._overviewRulerRenderer&&A&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(t.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){let S=this,D=this.element;function M(U){let V=S._mouseService.getMouseReportCoords(U,S.screenElement);if(!V)return!1;let Z,re;switch(U.overrideType||U.type){case"mousemove":re=32,U.buttons===void 0?(Z=3,U.button!==void 0&&(Z=U.button<3?U.button:3)):Z=1&U.buttons?0:4&U.buttons?1:2&U.buttons?2:3;break;case"mouseup":re=0,Z=U.button<3?U.button:3;break;case"mousedown":re=1,Z=U.button<3?U.button:3;break;case"wheel":if(S.viewport.getLinesScrolled(U)===0)return!1;re=U.deltaY<0?0:1,Z=4;break;default:return!1}return!(re===void 0||Z===void 0||Z>4)&&S.coreMouseService.triggerMouseEvent({col:V.col,row:V.row,x:V.x,y:V.y,button:Z,action:re,ctrl:U.ctrlKey,alt:U.altKey,shift:U.shiftKey})}let A={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:U=>(M(U),U.buttons||(this._document.removeEventListener("mouseup",A.mouseup),A.mousedrag&&this._document.removeEventListener("mousemove",A.mousedrag)),this.cancel(U)),wheel:U=>(M(U),this.cancel(U,!0)),mousedrag:U=>{U.buttons&&M(U)},mousemove:U=>{U.buttons||M(U)}};this.register(this.coreMouseService.onProtocolChange(U=>{U?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(U)),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&U?A.mousemove||(D.addEventListener("mousemove",K.mousemove),A.mousemove=K.mousemove):(D.removeEventListener("mousemove",A.mousemove),A.mousemove=null),16&U?A.wheel||(D.addEventListener("wheel",K.wheel,{passive:!1}),A.wheel=K.wheel):(D.removeEventListener("wheel",A.wheel),A.wheel=null),2&U?A.mouseup||(D.addEventListener("mouseup",K.mouseup),A.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",A.mouseup),D.removeEventListener("mouseup",A.mouseup),A.mouseup=null),4&U?A.mousedrag||(A.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",A.mousedrag),A.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(D,"mousedown",U=>{if(U.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(U))return M(U),A.mouseup&&this._document.addEventListener("mouseup",A.mouseup),A.mousedrag&&this._document.addEventListener("mousemove",A.mousedrag),this.cancel(U)})),this.register((0,u.addDisposableDomListener)(D,"wheel",U=>{if(!A.wheel){if(!this.buffer.hasScrollback){let V=this.viewport.getLinesScrolled(U);if(V===0)return;let Z=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(U.deltaY<0?"A":"B"),re="";for(let be=0;be{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(U),this.cancel(U)},{passive:!0})),this.register((0,u.addDisposableDomListener)(D,"touchmove",U=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(U)?void 0:this.cancel(U)},{passive:!1}))}refresh(S,D){var M;(M=this._renderService)===null||M===void 0||M.refreshRows(S,D)}updateCursorStyle(S){var D;!((D=this._selectionService)===null||D===void 0)&&D.shouldColumnSelect(S)?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(S,D,M=0){var A;M===1?(super.scrollLines(S,D,M),this.refresh(0,this.rows-1)):(A=this.viewport)===null||A===void 0||A.scrollLines(S)}paste(S){(0,c.paste)(S,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(S){this._customKeyEventHandler=S}registerLinkProvider(S){return this.linkifier2.registerLinkProvider(S)}registerCharacterJoiner(S){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let D=this._characterJoinerService.register(S);return this.refresh(0,this.rows-1),D}deregisterCharacterJoiner(S){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(S)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(S){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+S)}registerDecoration(S){return this._decorationService.registerDecoration(S)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(S,D,M){this._selectionService.setSelection(S,D,M)}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 S;(S=this._selectionService)===null||S===void 0||S.clearSelection()}selectAll(){var S;(S=this._selectionService)===null||S===void 0||S.selectAll()}selectLines(S,D){var M;(M=this._selectionService)===null||M===void 0||M.selectLines(S,D)}_keyDown(S){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(S)===!1)return!1;let D=this.browser.isMac&&this.options.macOptionIsMeta&&S.altKey;if(!D&&!this._compositionHelper.keydown(S))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;D||S.key!=="Dead"&&S.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let M=(0,C.evaluateKeyboardEvent)(S,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(S),M.type===3||M.type===2){let A=this.rows-1;return this.scrollLines(M.type===2?-A:A),this.cancel(S,!0)}return M.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,S)||(M.cancel&&this.cancel(S,!0),!M.key||!!(S.key&&!S.ctrlKey&&!S.altKey&&!S.metaKey&&S.key.length===1&&S.key.charCodeAt(0)>=65&&S.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(M.key!==I.C0.ETX&&M.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:M.key,domEvent:S}),this._showCursor(),this.coreService.triggerDataEvent(M.key,!0),!this.optionsService.rawOptions.screenReaderMode||S.altKey||S.ctrlKey?this.cancel(S,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(S,D){let M=S.isMac&&!this.options.macOptionIsMeta&&D.altKey&&!D.ctrlKey&&!D.metaKey||S.isWindows&&D.altKey&&D.ctrlKey&&!D.metaKey||S.isWindows&&D.getModifierState("AltGraph");return D.type==="keypress"?M:M&&(!D.keyCode||D.keyCode>47)}_keyUp(S){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(S)===!1||(function(D){return D.keyCode===16||D.keyCode===17||D.keyCode===18}(S)||this.focus(),this.updateCursorStyle(S),this._keyPressHandled=!1)}_keyPress(S){let D;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(S)===!1)return!1;if(this.cancel(S),S.charCode)D=S.charCode;else if(S.which===null||S.which===void 0)D=S.keyCode;else{if(S.which===0||S.charCode===0)return!1;D=S.which}return!(!D||(S.altKey||S.ctrlKey||S.metaKey)&&!this._isThirdLevelShift(this.browser,S)||(D=String.fromCharCode(D),this._onKey.fire({key:D,domEvent:S}),this._showCursor(),this.coreService.triggerDataEvent(D,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(S){if(S.data&&S.inputType==="insertText"&&(!S.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let D=S.data;return this.coreService.triggerDataEvent(D,!0),this.cancel(S),!0}return!1}resize(S,D){S!==this.cols||D!==this.rows?super.resize(S,D):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(S,D){var M,A;(M=this._charSizeService)===null||M===void 0||M.measure(),(A=this.viewport)===null||A===void 0||A.syncScrollArea(!0)}clear(){var S;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 D=1;D{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,u){this._rowCount=u,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let d=n-this._lastRefreshMs,f=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},f)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(L,r,o){var c=this&&this.__decorate||function(s,t,i,a){var l,p=arguments.length,g=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,t,i,a);else for(var h=s.length-1;h>=0;h--)(l=s[h])&&(g=(p<3?l(g):p>3?l(t,i,g):l(t,i))||g);return p>3&&g&&Object.defineProperty(t,i,g),g},u=this&&this.__param||function(s,t){return function(i,a){t(i,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let n=o(3656),d=o(4725),f=o(8460),m=o(844),_=o(2585),e=r.Viewport=class extends m.Disposable{constructor(s,t,i,a,l,p,g,h){super(),this._viewportElement=s,this._scrollArea=t,this._bufferService=i,this._optionsService=a,this._charSizeService=l,this._renderService=p,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=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._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(v=>this._activeBuffer=v.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(v=>this._renderDimensions=v)),this._handleThemeChange(h.colors),this.register(h.onChangeColors(v=>this._handleThemeChange(v))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(s){if(s)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.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<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(s,t){let i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&i0&&(a=y),l=""}}return{bufferElements:p,cursorElement:a}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let t=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(s,t){let i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&t.altKey||i==="ctrl"&&t.ctrlKey||i==="shift"&&t.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let t=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(s,t))}};r.Viewport=e=c([u(2,_.IBufferService),u(3,_.IOptionsService),u(4,d.ICharSizeService),u(5,d.IRenderService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],e)},3107:function(L,r,o){var c=this&&this.__decorate||function(e,s,t,i){var a,l=arguments.length,p=l<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 g=e.length-1;g>=0;g--)(a=e[g])&&(p=(l<3?a(p):l>3?a(s,t,p):a(s,t))||p);return l>3&&p&&Object.defineProperty(s,t,p),p},u=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let n=o(3656),d=o(4725),f=o(844),m=o(2585),_=r.BufferDecorationRenderer=class extends f.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._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register((0,n.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(a=>this._removeDecoration(a))),this.register((0,f.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let 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,t;let i=document.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((s=e?.options)===null||s===void 0?void 0:s.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let a=(t=e.options.x)!==null&&t!==void 0?t:0;return a&&a>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let 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||(t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t),e.onDispose(()=>{this._decorationElements.delete(e),t.remove()})),t.style.top=s*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,s=e.element){var t;if(!s)return;let i=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?s.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":s.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var s;(s=this._decorationElements.get(e))===null||s===void 0||s.remove(),this._decorationElements.delete(e),e.dispose()}};r.BufferDecorationRenderer=_=c([u(1,m.IBufferService),u(2,m.IDecorationService),u(3,d.IRenderService)],_)},5871:(L,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(o){if(o.options.overviewRulerOptions){for(let c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,u){return c>=o.startBufferLine-this._linePadding[u||"full"]&&c<=o.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(L,r,o){var c=this&&this.__decorate||function(a,l,p,g){var h,v=arguments.length,b=v<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,p):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(a,l,p,g);else for(var T=a.length-1;T>=0;T--)(h=a[T])&&(b=(v<3?h(b):v>3?h(l,p,b):h(l,p))||b);return v>3&&b&&Object.defineProperty(l,p,b),b},u=this&&this.__param||function(a,l){return function(p,g){l(p,g,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let n=o(5871),d=o(3656),f=o(4725),m=o(844),_=o(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},i=r.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(a,l,p,g,h,v,b){var T;super(),this._viewportElement=a,this._screenElement=l,this._bufferService=p,this._decorationService=g,this._renderService=h,this._optionsService=v,this._coreBrowseService=b,this._colorZoneStore=new n.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(),(T=this._viewportElement.parentElement)===null||T===void 0||T.insertBefore(this._canvas,this._viewportElement);let y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,m.toDisposable)(()=>{var k;(k=this._canvas)===null||k===void 0||k.remove()}))}_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.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register((0,d.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){let a=Math.floor(this._canvas.width/3),l=Math.ceil(this._canvas.width/3);s.full=this._canvas.width,s.left=a,s.center=l,s.right=a,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);let a=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(a,12),6)*this._coreBrowseService.dpr);e.left=l,e.center=l,e.right=l}_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(let l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;let a=this._colorZoneStore.zones;for(let l of a)l.position!=="full"&&this._renderColorZone(l);for(let l of a)l.position==="full"&&this._renderColorZone(l);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(a){this._ctx.fillStyle=a.color,this._ctx.fillRect(t[a.position||"full"],Math.round((this._canvas.height-1)*(a.startBufferLine/this._bufferService.buffers.active.lines.length)-e[a.position||"full"]/2),s[a.position||"full"],Math.round((this._canvas.height-1)*((a.endBufferLine-a.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[a.position||"full"]))}_queueRefresh(a,l){this._shouldUpdateDimensions=a||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=i=c([u(2,_.IBufferService),u(3,_.IDecorationService),u(4,f.IRenderService),u(5,_.IOptionsService),u(6,f.ICoreBrowserService)],i)},2950:function(L,r,o){var c=this&&this.__decorate||function(_,e,s,t){var i,a=arguments.length,l=a<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,e,s,t);else for(var p=_.length-1;p>=0;p--)(i=_[p])&&(l=(a<3?i(l):a>3?i(e,s,l):i(e,s))||l);return a>3&&l&&Object.defineProperty(e,s,l),l},u=this&&this.__param||function(_,e){return function(s,t){e(s,t,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let n=o(4725),d=o(2585),f=o(2584),m=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,e,s,t,i,a){this._textarea=_,this._compositionView=e,this._bufferService=s,this._optionsService=t,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){let 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;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let _=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,s=e.replace(_,"");this._dataAlreadySent=s,e.length>_.length?this._coreService.triggerDataEvent(s,!0):e.length<_.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):e.length===_.length&&e!==_&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,t=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=t+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=t+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}_||setTimeout(()=>this.updateCompositionElements(!0),0)}}};r.CompositionHelper=m=c([u(2,d.IBufferService),u(3,d.IOptionsService),u(4,d.ICoreService),u(5,n.IRenderService)],m)},9806:(L,r)=>{function o(c,u,n){let d=n.getBoundingClientRect(),f=c.getComputedStyle(n),m=parseInt(f.getPropertyValue("padding-left")),_=parseInt(f.getPropertyValue("padding-top"));return[u.clientX-d.left-m,u.clientY-d.top-_]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(c,u,n,d,f,m,_,e,s){if(!m)return;let t=o(c,u,n);return t?(t[0]=Math.ceil((t[0]+(s?_/2:0))/_),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),d+(s?1:0)),t[1]=Math.min(Math.max(t[1],1),f),t):void 0}},9504:(L,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let c=o(2584);function u(e,s,t,i){let a=e-n(e,t),l=s-n(s,t),p=Math.abs(a-l)-function(g,h,v){let b=0,T=g-n(g,v),y=h-n(h,v);for(let k=0;k=0&&es?"A":"B"}function f(e,s,t,i,a,l){let p=e,g=s,h="";for(;p!==t||g!==i;)p+=a?1:-1,a&&p>l.cols-1?(h+=l.buffer.translateBufferLineToString(g,!1,e,p),p=0,e=0,g++):!a&&p<0&&(h+=l.buffer.translateBufferLineToString(g,!1,0,e+1),p=l.cols-1,e=p,g--);return h+l.buffer.translateBufferLineToString(g,!1,e,p)}function m(e,s){let t=s?"O":"[";return c.C0.ESC+t+e}function _(e,s){e=Math.floor(e);let t="";for(let i=0;i0?T-n(T,y):v;let B=T,P=function(I,C,w,E,x,F){let N;return N=u(w,E,x,F).length>0?E-n(E,x):C,I=w&&Ne?"D":"C",_(Math.abs(a-e),m(p,i));p=l>s?"D":"C";let g=Math.abs(l-s);return _(function(h,v){return v.cols-h}(l>s?e:a,t)+(g-1)*t.cols+1+((l>s?a:e)-1),m(p,i))}},1296:function(L,r,o){var c=this&&this.__decorate||function(y,k,R,B){var P,I=arguments.length,C=I<3?k:B===null?B=Object.getOwnPropertyDescriptor(k,R):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(y,k,R,B);else for(var w=y.length-1;w>=0;w--)(P=y[w])&&(C=(I<3?P(C):I>3?P(k,R,C):P(k,R))||C);return I>3&&C&&Object.defineProperty(k,R,C),C},u=this&&this.__param||function(y,k){return function(R,B){k(R,B,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let n=o(3787),d=o(2550),f=o(2223),m=o(6171),_=o(4725),e=o(8055),s=o(8460),t=o(844),i=o(2585),a="xterm-dom-renderer-owner-",l="xterm-rows",p="xterm-fg-",g="xterm-bg-",h="xterm-focus",v="xterm-selection",b=1,T=r.DomRenderer=class extends t.Disposable{constructor(y,k,R,B,P,I,C,w,E,x){super(),this._element=y,this._screenElement=k,this._viewportElement=R,this._linkifier2=B,this._charSizeService=I,this._optionsService=C,this._bufferService=w,this._coreBrowserService=E,this._themeService=x,this._terminalClass=b++,this._rowElements=[],this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(l),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(v),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,m.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(F=>this._injectCss(F))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(a+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(F=>this._handleLinkHover(F))),this.register(this._linkifier2.onHideLinkUnderline(F=>this._handleLinkLeave(F))),this.register((0,t.toDisposable)(()=>{this._element.classList.remove(a+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new d.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let y=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*y,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*y),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/y),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/y),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let R of this._rowElements)R.style.width=`${this.dimensions.css.canvas.width}px`,R.style.height=`${this.dimensions.css.cell.height}px`,R.style.lineHeight=`${this.dimensions.css.cell.height}px`,R.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let k=`${this._terminalSelector} .${l} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=k,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(y){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let k=`${this._terminalSelector} .${l} { color: ${y.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;k+=`${this._terminalSelector} .${l} .xterm-dim { color: ${e.color.multiplyOpacity(y.foreground,.5).css};}`,k+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`,k+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",k+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css}; } 50% { background-color: inherit; color: ${y.cursor.css}; }}`,k+=`${this._terminalSelector} .${l}.${h} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${l}.${h} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-block { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css};}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${y.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${y.cursor.css} inset;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${y.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,k+=`${this._terminalSelector} .${v} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${v} div { position: absolute; background-color: ${y.selectionBackgroundOpaque.css};}${this._terminalSelector} .${v} div { position: absolute; background-color: ${y.selectionInactiveBackgroundOpaque.css};}`;for(let[R,B]of y.ansi.entries())k+=`${this._terminalSelector} .${p}${R} { color: ${B.css}; }${this._terminalSelector} .${p}${R}.xterm-dim { color: ${e.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${g}${R} { background-color: ${B.css}; }`;k+=`${this._terminalSelector} .${p}${f.INVERTED_DEFAULT_COLOR} { color: ${e.color.opaque(y.background).css}; }${this._terminalSelector} .${p}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${e.color.multiplyOpacity(e.color.opaque(y.background),.5).css}; }${this._terminalSelector} .${g}${f.INVERTED_DEFAULT_COLOR} { background-color: ${y.foreground.css}; }`,this._themeStyleElement.textContent=k}_setDefaultSpacing(){let y=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${y}px`,this._rowFactory.defaultSpacing=y}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(y,k){for(let R=this._rowElements.length;R<=k;R++){let B=document.createElement("div");this._rowContainer.appendChild(B),this._rowElements.push(B)}for(;this._rowElements.length>k;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(y,k){this._refreshRowElements(y,k),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(h)}handleFocus(){this._rowContainer.classList.add(h),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(y,k,R){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(y,k,R),this.renderRows(0,this._bufferService.rows-1),!y||!k)return;let B=y[1]-this._bufferService.buffer.ydisp,P=k[1]-this._bufferService.buffer.ydisp,I=Math.max(B,0),C=Math.min(P,this._bufferService.rows-1);if(I>=this._bufferService.rows||C<0)return;let w=document.createDocumentFragment();if(R){let E=y[0]>k[0];w.appendChild(this._createSelectionElement(I,E?k[0]:y[0],E?y[0]:k[0],C-I+1))}else{let E=B===I?y[0]:0,x=I===P?k[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(I,E,x));let F=C-I-1;if(w.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,F)),I!==C){let N=P===C?k[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(C,0,N))}}this._selectionContainer.appendChild(w)}_createSelectionElement(y,k,R,B=1){let P=document.createElement("div");return P.style.height=B*this.dimensions.css.cell.height+"px",P.style.top=y*this.dimensions.css.cell.height+"px",P.style.left=k*this.dimensions.css.cell.width+"px",P.style.width=this.dimensions.css.cell.width*(R-k)+"px",P}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let y of this._rowElements)y.replaceChildren()}renderRows(y,k){let R=this._bufferService.buffer,B=R.ybase+R.y,P=Math.min(R.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let E=y;E<=k;E++){let x=E+R.ydisp,F=this._rowElements[E],N=R.lines.get(x);if(!F||!N)break;F.replaceChildren(...this._rowFactory.createRow(N,x,x===B,C,w,P,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${a}${this._terminalClass}`}_handleLinkHover(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!0)}_handleLinkLeave(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!1)}_setCellUnderline(y,k,R,B,P,I){R<0&&(y=0),B<0&&(k=0);let C=this._bufferService.rows-1;R=Math.max(Math.min(R,C),0),B=Math.max(Math.min(B,C),0),P=Math.min(P,this._bufferService.cols);let w=this._bufferService.buffer,E=w.ybase+w.y,x=Math.min(w.x,P-1),F=this._optionsService.rawOptions.cursorBlink,N=this._optionsService.rawOptions.cursorStyle,z=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=R;j<=B;++j){let Y=j+w.ydisp,S=this._rowElements[j],D=w.lines.get(Y);if(!S||!D)break;S.replaceChildren(...this._rowFactory.createRow(D,Y,Y===E,N,z,x,F,this.dimensions.css.cell.width,this._widthCache,I?j===R?y:0:-1,I?(j===B?k:P)-1:-1))}}};r.DomRenderer=T=c([u(4,i.IInstantiationService),u(5,_.ICharSizeService),u(6,i.IOptionsService),u(7,i.IBufferService),u(8,_.ICoreBrowserService),u(9,_.IThemeService)],T)},3787:function(L,r,o){var c=this&&this.__decorate||function(p,g,h,v){var b,T=arguments.length,y=T<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(p,g,h,v);else for(var k=p.length-1;k>=0;k--)(b=p[k])&&(y=(T<3?b(y):T>3?b(g,h,y):b(g,h))||y);return T>3&&y&&Object.defineProperty(g,h,y),y},u=this&&this.__param||function(p,g){return function(h,v){g(h,v,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let n=o(2223),d=o(643),f=o(511),m=o(2585),_=o(8055),e=o(4725),s=o(4269),t=o(6171),i=o(3734),a=r.DomRendererRowFactory=class{constructor(p,g,h,v,b,T,y){this._document=p,this._characterJoinerService=g,this._optionsService=h,this._coreBrowserService=v,this._coreService=b,this._decorationService=T,this._themeService=y,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,g,h){this._selectionStart=p,this._selectionEnd=g,this._columnSelectMode=h}createRow(p,g,h,v,b,T,y,k,R,B,P){let I=[],C=this._characterJoinerService.getJoinedCharacters(g),w=this._themeService.colors,E,x=p.getNoBgTrimmedLength();h&&x0&&V===C[0][0]){re=!0;let J=C.shift();q=new s.JoinedCellData(this._workCell,p.translateToString(!0,J[0],J[1]),J[1]-J[0]),be=J[1]-1,Z=q.getWidth()}let Re=this._isCellInSelection(V,g),dt=h&&V===T,_t=U&&V>=B&&V<=P,ut=!1;this._decorationService.forEachDecorationAtCell(V,g,void 0,J=>{ut=!0});let Pe=q.getChars()||d.WHITESPACE_CELL_CHAR;if(Pe===" "&&(q.isUnderline()||q.isOverline())&&(Pe="\xA0"),A=Z*k-R.get(Pe,q.isBold(),q.isItalic()),E){if(F&&(Re&&M||!Re&&!M&&q.bg===z)&&(Re&&M&&w.selectionForeground||q.fg===j)&&q.extended.ext===Y&&_t===S&&A===D&&!dt&&!re&&!ut){N+=Pe,F++;continue}F&&(E.textContent=N),E=this._document.createElement("span"),F=0,N=""}else E=this._document.createElement("span");if(z=q.bg,j=q.fg,Y=q.extended.ext,S=_t,D=A,M=Re,re&&T>=V&&T<=be&&(T=V),!this._coreService.isCursorHidden&&dt){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)y&&K.push("xterm-cursor-blink"),K.push(v==="bar"?"xterm-cursor-bar":v==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(b)switch(b){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline")}}if(q.isBold()&&K.push("xterm-bold"),q.isItalic()&&K.push("xterm-italic"),q.isDim()&&K.push("xterm-dim"),N=q.isInvisible()?d.WHITESPACE_CELL_CHAR:q.getChars()||d.WHITESPACE_CELL_CHAR,q.isUnderline()&&(K.push(`xterm-underline-${q.extended.underlineStyle}`),N===" "&&(N="\xA0"),!q.isUnderlineColorDefault()))if(q.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(q.getUnderlineColor()).join(",")})`;else{let J=q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&q.isBold()&&J<8&&(J+=8),E.style.textDecorationColor=w.ansi[J].css}q.isOverline()&&(K.push("xterm-overline"),N===" "&&(N="\xA0")),q.isStrikethrough()&&K.push("xterm-strikethrough"),_t&&(E.style.textDecoration="underline");let ne=q.getFgColor(),Ae=q.getFgColorMode(),he=q.getBgColor(),Me=q.getBgColorMode(),ft=!!q.isInverse();if(ft){let J=ne;ne=he,he=J;let bi=Ae;Ae=Me,Me=bi}let pe,pt,ve,Be=!1;switch(this._decorationService.forEachDecorationAtCell(V,g,void 0,J=>{J.options.layer!=="top"&&Be||(J.backgroundColorRGB&&(Me=50331648,he=J.backgroundColorRGB.rgba>>8&16777215,pe=J.backgroundColorRGB),J.foregroundColorRGB&&(Ae=50331648,ne=J.foregroundColorRGB.rgba>>8&16777215,pt=J.foregroundColorRGB),Be=J.options.layer==="top")}),!Be&&Re&&(pe=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,he=pe.rgba>>8&16777215,Me=50331648,Be=!0,w.selectionForeground&&(Ae=50331648,ne=w.selectionForeground.rgba>>8&16777215,pt=w.selectionForeground)),Be&&K.push("xterm-decoration-top"),Me){case 16777216:case 33554432:ve=w.ansi[he],K.push(`xterm-bg-${he}`);break;case 50331648:ve=_.rgba.toColor(he>>16,he>>8&255,255&he),this._addStyle(E,`background-color:#${l((he>>>0).toString(16),"0",6)}`);break;default:ft?(ve=w.foreground,K.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ve=w.background}switch(pe||q.isDim()&&(pe=_.color.multiplyOpacity(ve,.5)),Ae){case 16777216:case 33554432:q.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(E,ve,w.ansi[ne],q,pe,void 0)||K.push(`xterm-fg-${ne}`);break;case 50331648:let J=_.rgba.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(E,ve,J,q,pe,pt)||this._addStyle(E,`color:#${l(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ve,w.foreground,q,pe,void 0)||ft&&K.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}K.length&&(E.className=K.join(" "),K.length=0),dt||re||ut?E.textContent=N:F++,A!==this.defaultSpacing&&(E.style.letterSpacing=`${A}px`),I.push(E),V=be}return E&&F&&(E.textContent=N),I}_applyMinimumContrast(p,g,h,v,b,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(v.getCode()))return!1;let y=this._getContrastCache(v),k;if(b||T||(k=y.getColor(g.rgba,h.rgba)),k===void 0){let R=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);k=_.color.ensureContrastRatio(b||g,T||h,R),y.setColor((b||g).rgba,(T||h).rgba,k??null)}return!!k&&(this._addStyle(p,`color:${k.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,g){p.setAttribute("style",`${p.getAttribute("style")||""}${g};`)}_isCellInSelection(p,g){let h=this._selectionStart,v=this._selectionEnd;return!(!h||!v)&&(this._columnSelectMode?h[0]<=v[0]?p>=h[0]&&g>=h[1]&&p=h[1]&&p>=v[0]&&g<=v[1]:g>h[1]&&g=h[0]&&p=h[0])}};function l(p,g,h){for(;p.length{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let c=o.createElement("span"),u=o.createElement("span");u.style.fontWeight="bold";let n=o.createElement("span");n.style.fontStyle="italic";let d=o.createElement("span");d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[c,u,n,d],this._container.appendChild(c),this._container.appendChild(u),this._container.appendChild(n),this._container.appendChild(d),o.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(o,c,u,n){o===this._font&&c===this._fontSize&&u===this._weight&&n===this._weightBold||(this._font=o,this._fontSize=c,this._weight=u,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(o,c,u){let n=0;if(!c&&!u&&o.length===1&&(n=o.charCodeAt(0))<256)return this._flat[n]!==-9999?this._flat[n]:this._flat[n]=this._measure(o,0);let d=o;c&&(d+="B"),u&&(d+="I");let f=this._holey.get(d);if(f===void 0){let m=0;c&&(m|=1),u&&(m|=2),f=this._measure(o,m),this._holey.set(d,f)}return f}_measure(o,c){let u=this._measureElements[c];return u.textContent=o.repeat(32),u.offsetWidth/32}}},2223:(L,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let c=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(L,r)=>{function o(c){return 57508<=c&&c<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},r.excludeFromContrastRatioDemands=function(c){return o(c)||function(u){return 9472<=u&&u<=9631}(c)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,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()){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(L,r,o){var c=this&&this.__decorate||function(e,s,t,i){var a,l=arguments.length,p=l<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 g=e.length-1;g>=0;g--)(a=e[g])&&(p=(l<3?a(p):l>3?a(s,t,p):a(s,t))||p);return l>3&&p&&Object.defineProperty(s,t,p),p},u=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let n=o(2585),d=o(8460),f=o(844),m=r.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,t){super(),this._optionsService=t,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new _(e,s,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=m=c([u(2,n.IOptionsService)],m);class _{constructor(s,t,i){this._document=s,this._parentElement=t,this._optionsService=i,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;let s={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return s.width!==0&&s.height!==0&&(this._result.width=s.width/32,this._result.height=Math.ceil(s.height)),this._result}}},4269:function(L,r,o){var c=this&&this.__decorate||function(s,t,i,a){var l,p=arguments.length,g=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,t,i,a);else for(var h=s.length-1;h>=0;h--)(l=s[h])&&(g=(p<3?l(g):p>3?l(t,i,g):l(t,i))||g);return p>3&&g&&Object.defineProperty(t,i,g),g},u=this&&this.__param||function(s,t){return function(i,a){t(i,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let n=o(3734),d=o(643),f=o(511),m=o(2585);class _ extends n.AttributeData{constructor(t,i,a){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=a}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=_;let e=r.CharacterJoinerService=class ni{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(t){let i={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(i),i.id}deregister(t){for(let i=0;i1){let y=this._getJoinedRanges(l,h,g,i,p);for(let k=0;k1){let T=this._getJoinedRanges(l,h,g,i,p);for(let y=0;y{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(o,c){this._textarea=o,this.window=c,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}},8934:function(L,r,o){var c=this&&this.__decorate||function(m,_,e,s){var t,i=arguments.length,a=i<3?_:s===null?s=Object.getOwnPropertyDescriptor(_,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(m,_,e,s);else for(var l=m.length-1;l>=0;l--)(t=m[l])&&(a=(i<3?t(a):i>3?t(_,e,a):t(_,e))||a);return i>3&&a&&Object.defineProperty(_,e,a),a},u=this&&this.__param||function(m,_){return function(e,s){_(e,s,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let n=o(4725),d=o(9806),f=r.MouseService=class{constructor(m,_){this._renderService=m,this._charSizeService=_}getCoords(m,_,e,s,t){return(0,d.getCoords)(window,m,_,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(m,_){let e=(0,d.getCoordsRelativeToElement)(window,m,_);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};r.MouseService=f=c([u(0,n.IRenderService),u(1,n.ICharSizeService)],f)},3230:function(L,r,o){var c=this&&this.__decorate||function(a,l,p,g){var h,v=arguments.length,b=v<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,p):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(a,l,p,g);else for(var T=a.length-1;T>=0;T--)(h=a[T])&&(b=(v<3?h(b):v>3?h(l,p,b):h(l,p))||b);return v>3&&b&&Object.defineProperty(l,p,b),b},u=this&&this.__param||function(a,l){return function(p,g){l(p,g,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let n=o(3656),d=o(6193),f=o(5596),m=o(4725),_=o(8460),e=o(844),s=o(7226),t=o(2585),i=r.RenderService=class extends e.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(a,l,p,g,h,v,b,T){if(super(),this._rowCount=a,this._charSizeService=g,this._renderer=this.register(new e.MutableDisposable),this._pausedResizeTask=new s.DebouncedIdleTask,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=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(b.window,(y,k)=>this._renderRows(y,k)),this.register(this._renderDebouncer),this._screenDprMonitor=new f.ScreenDprMonitor(b.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(v.onResize(()=>this._fullRefresh())),this.register(v.buffers.onBufferActivate(()=>{var y;return(y=this._renderer.value)===null||y===void 0?void 0:y.clear()})),this.register(p.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(h.onDecorationRegistered(()=>this._fullRefresh())),this.register(h.onDecorationRemoved(()=>this._fullRefresh())),this.register(p.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(v.cols,v.rows),this._fullRefresh()})),this.register(p.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(v.buffer.y,v.buffer.y,!0))),this.register((0,n.addDisposableDomListener)(b.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(T.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in b.window){let y=new b.window.IntersectionObserver(k=>this._handleIntersectionChange(k[k.length-1]),{threshold:0});y.observe(l),this.register({dispose:()=>y.disconnect()})}}_handleIntersectionChange(a){this._isPaused=a.isIntersecting===void 0?a.intersectionRatio===0:!a.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(a,l,p=!1){this._isPaused?this._needsFullRefresh=!0:(p||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(a,l,this._rowCount))}_renderRows(a,l){this._renderer.value&&(a=Math.min(a,this._rowCount-1),l=Math.min(l,this._rowCount-1),this._renderer.value.renderRows(a,l),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:a,end:l}),this._onRender.fire({start:a,end:l}),this._isNextRenderRedrawOnly=!0)}resize(a,l){this._rowCount=l,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(a){this._renderer.value=a,this._renderer.value.onRequestRedraw(l=>this.refreshRows(l.start,l.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(a){return this._renderDebouncer.addRefreshCallback(a)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var a,l;this._renderer.value&&((l=(a=this._renderer.value).clearTextureAtlas)===null||l===void 0||l.call(a),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(a,l){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(a,l)):this._renderer.value.handleResize(a,l),this._fullRefresh())}handleCharSizeChanged(){var a;(a=this._renderer.value)===null||a===void 0||a.handleCharSizeChanged()}handleBlur(){var a;(a=this._renderer.value)===null||a===void 0||a.handleBlur()}handleFocus(){var a;(a=this._renderer.value)===null||a===void 0||a.handleFocus()}handleSelectionChanged(a,l,p){var g;this._selectionState.start=a,this._selectionState.end=l,this._selectionState.columnSelectMode=p,(g=this._renderer.value)===null||g===void 0||g.handleSelectionChanged(a,l,p)}handleCursorMove(){var a;(a=this._renderer.value)===null||a===void 0||a.handleCursorMove()}clear(){var a;(a=this._renderer.value)===null||a===void 0||a.clear()}};r.RenderService=i=c([u(2,t.IOptionsService),u(3,m.ICharSizeService),u(4,t.IDecorationService),u(5,t.IBufferService),u(6,m.ICoreBrowserService),u(7,m.IThemeService)],i)},9312:function(L,r,o){var c=this&&this.__decorate||function(h,v,b,T){var y,k=arguments.length,R=k<3?v:T===null?T=Object.getOwnPropertyDescriptor(v,b):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(h,v,b,T);else for(var B=h.length-1;B>=0;B--)(y=h[B])&&(R=(k<3?y(R):k>3?y(v,b,R):y(v,b))||R);return k>3&&R&&Object.defineProperty(v,b,R),R},u=this&&this.__param||function(h,v){return function(b,T){v(b,T,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let n=o(9806),d=o(9504),f=o(456),m=o(4725),_=o(8460),e=o(844),s=o(6114),t=o(4841),i=o(511),a=o(2585),l="\xA0",p=new RegExp(l,"g"),g=r.SelectionService=class extends e.Disposable{constructor(h,v,b,T,y,k,R,B,P){super(),this._element=h,this._screenElement=v,this._linkifier=b,this._bufferService=T,this._coreService=y,this._mouseService=k,this._optionsService=R,this._renderService=B,this._coreBrowserService=P,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(I=>this._handleTrim(I)),this.register(this._bufferService.buffers.onBufferActivate(I=>this._handleBufferActivate(I))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)(()=>{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(){let h=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;return!(!h||!v||h[0]===v[0]&&h[1]===v[1])}get selectionText(){let h=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;if(!h||!v)return"";let b=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(h[0]===v[0])return"";let y=h[0]y.replace(p," ")).join(s.isWindows?`\r
+`:`
+`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(h){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&h&&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(h){let v=this._getMouseBufferCoords(h),b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(b&&T&&v)&&this._areCoordsInSelection(v,b,T)}isCellInSelection(h,v){let b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!b||!T)&&this._areCoordsInSelection([h,v],b,T)}_areCoordsInSelection(h,v,b){return h[1]>v[1]&&h[1]=v[0]&&h[0]=v[0]}_selectWordAtCursor(h,v){var b,T;let y=(T=(b=this._linkifier.currentLink)===null||b===void 0?void 0:b.link)===null||T===void 0?void 0:T.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let k=this._getMouseBufferCoords(h);return!!k&&(this._selectWordAt(k,v),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(h,v){this._model.clearSelection(),h=Math.max(h,0),v=Math.min(v,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,h],this._model.selectionEnd=[this._bufferService.cols,v],this.refresh(),this._onSelectionChange.fire()}_handleTrim(h){this._model.handleTrim(h)&&this.refresh()}_getMouseBufferCoords(h){let v=this._mouseService.getCoords(h,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(v)return v[0]--,v[1]--,v[1]+=this._bufferService.buffer.ydisp,v}_getMouseEventScrollAmount(h){let v=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,h,this._screenElement)[1],b=this._renderService.dimensions.css.canvas.height;return v>=0&&v<=b?0:(v>b&&(v-=b),v=Math.min(Math.max(v,-50),50),v/=50,v/Math.abs(v)+Math.round(14*v))}shouldForceSelection(h){return s.isMac?h.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:h.shiftKey}handleMouseDown(h){if(this._mouseDownTimeStamp=h.timeStamp,(h.button!==2||!this.hasSelection)&&h.button===0){if(!this._enabled){if(!this.shouldForceSelection(h))return;h.stopPropagation()}h.preventDefault(),this._dragScrollAmount=0,this._enabled&&h.shiftKey?this._handleIncrementalClick(h):h.detail===1?this._handleSingleClick(h):h.detail===2?this._handleDoubleClick(h):h.detail===3&&this._handleTripleClick(h),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}_handleIncrementalClick(h){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(h))}_handleSingleClick(h){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(h)?3:0,this._model.selectionStart=this._getMouseBufferCoords(h),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let v=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);v&&v.length!==this._model.selectionStart[0]&&v.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(h){this._selectWordAtCursor(h,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(h){let v=this._getMouseBufferCoords(h);v&&(this._activeSelectionMode=2,this._selectLineAt(v[1]))}shouldColumnSelect(h){return h.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(h){if(h.stopImmediatePropagation(),!this._model.selectionStart)return;let v=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(h),!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));let b=this._bufferService.buffer;if(this._model.selectionEnd[1]