2 lines
285 KiB
JavaScript
2 lines
285 KiB
JavaScript
var ve={exports:{}},Se;function ke(){return Se||(Se=1,(function(se,le){(function(Y,V){se.exports=V()})(globalThis,(()=>(()=>{var Y={4567:function(T,r,o){var c=this&&this.__decorate||function(s,t,i,l){var _,p=arguments.length,m=p<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,t,i,l);else for(var a=s.length-1;a>=0;a--)(_=s[a])&&(m=(p<3?_(m):p>3?_(t,i,m):_(t,i))||m);return p>3&&m&&Object.defineProperty(t,i,m),m},f=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=o(9042),d=o(9924),u=o(844),v=o(4725),h=o(2585);let e=r.AccessibilityManager=class extends u.Disposable{constructor(s,t,i,l){super(),this._terminal=s,this._coreBrowserService=i,this._renderService=l,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let _=0;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);if(this._topBoundaryFocusListener=_=>this._handleBoundaryFocus(_,0),this._bottomBoundaryFocusListener=_=>this._handleBoundaryFocus(_,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((_=>this._handleResize(_.rows)))),this.register(this._terminal.onRender((_=>this._refreshRows(_.start,_.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((_=>this._handleChar(_)))),this.register(this._terminal.onLineFeed((()=>this._handleChar("\n")))),this.register(this._terminal.onA11yTab((_=>this._handleTab(_)))),this.register(this._terminal.onKey((_=>this._handleKey(_.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,u.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(s){for(let t=0;t<s;t++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s==="\n"&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(s){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,t){this._liveRegionDebouncer.refresh(s,t,this._terminal.rows)}_renderRows(s,t){const i=this._terminal.buffer,l=i.lines.length.toString();for(let _=s;_<=t;_++){const p=i.translateBufferLineToString(i.ydisp+_,!0),m=(i.ydisp+_+1).toString(),a=this._rowElements[_];a&&(p.length===0?a.innerText=" ":a.textContent=p,a.setAttribute("aria-posinset",m),a.setAttribute("aria-setsize",l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,t){const i=s.target,l=this._rowElements[t===0?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(t===0?"1":"".concat(this._terminal.buffer.lines.length))||s.relatedTarget!==l)return;let _,p;if(t===0?(_=i,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(_=this._rowElements.shift(),p=i,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){const m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{const m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}_handleResize(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const s=this._coreBrowserService.mainDocument.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width="".concat(this._renderService.dimensions.css.canvas.width,"px"),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}}_refreshRowDimensions(s){s.style.height="".concat(this._renderService.dimensions.css.cell.height,"px")}};r.AccessibilityManager=e=c([f(1,h.IInstantiationService),f(2,v.ICoreBrowserService),f(3,v.IRenderService)],e)},3614:(T,r)=>{function o(d){return d.replace(/\r?\n/g,"\r")}function c(d,u){return u?"\x1B[200~"+d+"\x1B[201~":d}function f(d,u,v,h){d=c(d=o(d),v.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(d,!0),u.value=""}function n(d,u,v){const h=v.getBoundingClientRect(),e=d.clientX-h.left-10,s=d.clientY-h.top-10;u.style.width="20px",u.style.height="20px",u.style.left="".concat(e,"px"),u.style.top="".concat(s,"px"),u.style.zIndex="1000",u.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=c,r.copyHandler=function(d,u){d.clipboardData&&d.clipboardData.setData("text/plain",u.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,u,v,h){d.stopPropagation(),d.clipboardData&&f(d.clipboardData.getData("text/plain"),u,v,h)},r.paste=f,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,u,v,h,e){n(d,u,v),e&&h.rightClickSelect(d),u.value=h.selectionText,u.select()}},7239:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=o(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,n,d){this._css.set(f,n,d)}getCss(f,n){return this._css.get(f,n)}setColor(f,n,d){this._color.set(f,n,d)}getColor(f,n){return this._color.get(f,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,c,f,n){o.addEventListener(c,f,n);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,f,n))}}}},6465:function(T,r,o){var c=this&&this.__decorate||function(e,s,t,i){var l,_=arguments.length,p=_<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(l=e[m])&&(p=(_<3?l(p):_>3?l(s,t,p):l(s,t))||p);return _>3&&p&&Object.defineProperty(s,t,p),p},f=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const n=o(3656),d=o(8460),u=o(844),v=o(2585);let h=r.Linkifier2=class extends u.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,u.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,u.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const s=this._linkProviders.indexOf(e);s!==-1&&this._linkProviders.splice(s,1)}}}attachToDom(e,s,t){this._element=e,this._mouseService=s,this._renderService=t,this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const t=e.composedPath();for(let i=0;i<t.length;i++){const l=t[i];if(l.classList.contains("xterm"))break;if(l.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,s){var i,l;this._activeProviderReplies&&s||((i=this._activeProviderReplies)==null||i.forEach((_=>{_==null||_.forEach((p=>{p.link.dispose&&p.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let t=!1;for(const[_,p]of this._linkProviders.entries())s?(l=this._activeProviderReplies)!=null&&l.get(_)&&(t=this._checkLinkProviderResult(_,e,t)):p.provideLinks(e.y,(m=>{var g,y;if(this._isMouseOut)return;const a=m==null?void 0:m.map((k=>({link:k})));(g=this._activeProviderReplies)==null||g.set(_,a),t=this._checkLinkProviderResult(_,e,t),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,s){const t=new Set;for(let i=0;i<s.size;i++){const l=s.get(i);if(l)for(let _=0;_<l.length;_++){const p=l[_],m=p.link.range.start.y<e?0:p.link.range.start.x,a=p.link.range.end.y>e?this._bufferService.cols:p.link.range.end.x;for(let g=m;g<=a;g++){if(t.has(g)){l.splice(_--,1);break}t.add(g)}}}}_checkLinkProviderResult(e,s,t){var _;if(!this._activeProviderReplies)return t;const i=this._activeProviderReplies.get(e);let l=!1;for(let p=0;p<e;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(l=!0);if(!l&&i){const p=i.find((m=>this._linkAtPosition(m.link,s)));p&&(t=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let p=0;p<this._activeProviderReplies.size;p++){const m=(_=this._activeProviderReplies.get(p))==null?void 0:_.find((a=>this._linkAtPosition(a.link,s)));if(m){t=!0,this._handleNewLink(m);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const 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,u.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const 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?void 0:t.state)==null?void 0:i.decorations.pointerCursor},set:t=>{var i,l;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((l=this._element)==null||l.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)==null?void 0:t.state)==null?void 0:i.decorations.underline},set:t=>{var i,l,_;(i=this._currentLink)!=null&&i.state&&((_=(l=this._currentLink)==null?void 0:l.state)==null?void 0:_.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;const i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(i,l),this._lastMouseEvent&&this._element)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}}))))}_linkHover(e,s,t){var i;(i=this._currentLink)!=null&&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){const t=e.range,i=this._bufferService.buffer.ydisp,l=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(l)}_linkLeave(e,s,t){var i;(i=this._currentLink)!=null&&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){const t=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,l=s.y*this._bufferService.cols+s.x;return t<=l&&l<=i}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,l){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:l}}};r.Linkifier2=h=c([f(0,v.IBufferService)],h)},9042:(T,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(T,r,o){var c=this&&this.__decorate||function(h,e,s,t){var i,l=arguments.length,_=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(h,e,s,t);else for(var p=h.length-1;p>=0;p--)(i=h[p])&&(_=(l<3?i(_):l>3?i(e,s,_):i(e,s))||_);return l>3&&_&&Object.defineProperty(e,s,_),_},f=this&&this.__param||function(h,e){return function(s,t){e(s,t,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=o(511),d=o(2585);let u=r.OscLinkProvider=class{constructor(h,e,s){this._bufferService=h,this._optionsService=e,this._oscLinkService=s}provideLinks(h,e){var g;const s=this._bufferService.buffer.lines.get(h-1);if(!s)return void e(void 0);const t=[],i=this._optionsService.rawOptions.linkHandler,l=new n.CellData,_=s.getTrimmedLength();let p=-1,m=-1,a=!1;for(let y=0;y<_;y++)if(m!==-1||s.hasContent(y)){if(s.loadCell(y,l),l.hasExtendedAttrs()&&l.extended.urlId){if(m===-1){m=y,p=l.extended.urlId;continue}a=l.extended.urlId!==p}else m!==-1&&(a=!0);if(a||m!==-1&&y===_-1){const k=(g=this._oscLinkService.getLinkData(p))==null?void 0:g.uri;if(k){const b={start:{x:m+1,y:h},end:{x:y+(a||y!==_-1?0:1),y:h}};let L=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{const B=new URL(k);["http:","https:"].includes(B.protocol)||(L=!0)}catch(B){L=!0}L||t.push({text:k,range:b,activate:(B,M)=>i?i.activate(B,M,b):v(0,M),hover:(B,M)=>{var P;return(P=i==null?void 0:i.hover)==null?void 0:P.call(i,B,M,b)},leave:(B,M)=>{var P;return(P=i==null?void 0:i.leave)==null?void 0:P.call(i,B,M,b)}})}a=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=y,p=l.extended.urlId):(m=-1,p=-1)}}e(t)}};function v(h,e){if(confirm("Do you want to navigate to ".concat(e,"?\n\nWARNING: This link could potentially be dangerous"))){const s=window.open();if(s){try{s.opener=null}catch(t){}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=u=c([f(0,d.IBufferService),f(1,d.IOptionsService),f(2,d.IOscLinkService)],u)},6193:(T,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,f){this._rowCount=f,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();const 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(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=o(3614),f=o(3656),n=o(6465),d=o(9042),u=o(3730),v=o(1680),h=o(3107),e=o(5744),s=o(2950),t=o(1296),i=o(428),l=o(4269),_=o(5114),p=o(8934),m=o(3230),a=o(9312),g=o(4725),y=o(6731),k=o(8055),b=o(8969),L=o(8460),B=o(844),M=o(6114),P=o(8437),F=o(2584),W=o(7399),S=o(5941),w=o(9074),E=o(2585),D=o(5435),I=o(4567);class H extends b.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(x={}){super(x),this.browser=M,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new L.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new L.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new L.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new L.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new L.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new L.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new L.EventEmitter),this._onBlur=this.register(new L.EventEmitter),this._onA11yCharEmitter=this.register(new L.EventEmitter),this._onA11yTabEmitter=this.register(new L.EventEmitter),this._onWillOpen=this.register(new L.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(n.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(u.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(w.DecorationService),this._instantiationService.setService(E.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((A,C)=>this.refresh(A,C)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((A=>this._reportWindowsOptions(A)))),this.register(this._inputHandler.onColor((A=>this._handleColorEvent(A)))),this.register((0,L.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,L.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,L.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,L.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((A=>this._afterResize(A.cols,A.rows)))),this.register((0,B.toDisposable)((()=>{var A,C;this._customKeyEventHandler=void 0,(C=(A=this.element)==null?void 0:A.parentNode)==null||C.removeChild(this.element)})))}_handleColorEvent(x){if(this._themeService)for(const A of x){let C,O="";switch(A.index){case 256:C="foreground",O="10";break;case 257:C="background",O="11";break;case 258:C="cursor",O="12";break;default:C="ansi",O="4;"+A.index}switch(A.type){case 0:const U=k.color.toColorRGB(C==="ansi"?this._themeService.colors.ansi[A.index]:this._themeService.colors[C]);this.coreService.triggerDataEvent("".concat(F.C0.ESC,"]").concat(O,";").concat((0,S.toRgbString)(U)).concat(F.C1_ESCAPED.ST));break;case 1:if(C==="ansi")this._themeService.modifyColors((R=>R.ansi[A.index]=k.rgba.toColor(...A.color)));else{const R=C;this._themeService.modifyColors((X=>X[R]=k.rgba.toColor(...A.color)))}break;case 2:this._themeService.restoreColor(A.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(x){x?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(I.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(x){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.C0.ESC+"[I"),this.updateCursorStyle(x),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var x;return(x=this.textarea)==null?void 0:x.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const x=this.buffer.ybase+this.buffer.y,A=this.buffer.lines.get(x);if(!A)return;const C=Math.min(this.buffer.x,this.cols-1),O=this._renderService.dimensions.css.cell.height,U=A.getWidth(C),R=this._renderService.dimensions.css.cell.width*U,X=this.buffer.y*this._renderService.dimensions.css.cell.height,j=C*this._renderService.dimensions.css.cell.width;this.textarea.style.left=j+"px",this.textarea.style.top=X+"px",this.textarea.style.width=R+"px",this.textarea.style.height=O+"px",this.textarea.style.lineHeight=O+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(A=>{this.hasSelection()&&(0,c.copyHandler)(A,this._selectionService)})));const x=A=>(0,c.handlePasteEvent)(A,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",x)),this.register((0,f.addDisposableDomListener)(this.element,"paste",x)),M.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(A=>{A.button===2&&(0,c.rightClickHandler)(A,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(A=>{(0,c.rightClickHandler)(A,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),M.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(A=>{A.button===1&&(0,c.moveTextAreaUnderMouseCursor)(A,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(x=>this._keyUp(x)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(x=>this._keyDown(x)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(x=>this._keyPress(x)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(x=>this._compositionHelper.compositionupdate(x)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(x=>this._inputEvent(x)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(x){var C,O,U;if(!x)throw new Error("Terminal requires a parent element.");if(x.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((C=this.element)==null?void 0:C.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=x.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),x.appendChild(this.element);const A=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),A.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),A.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),M.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.register(this._instantiationService.createInstance(_.CoreBrowserService,this.textarea,(O=x.ownerDocument.defaultView)!=null?O:window,((U=this._document)!=null?U:typeof window<"u")?window.document:null)),this._instantiationService.setService(g.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(R=>this._handleTextAreaFocus(R)))),this.register((0,f.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(g.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(g.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(l.CharacterJoinerService),this._instantiationService.setService(g.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(g.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((R=>this._onRender.fire(R)))),this.onResize((R=>this._renderService.resize(R.cols,R.rows))),this._compositionView=this._document.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(A);try{this._onWillOpen.fire(this.element)}catch(R){}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(g.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(v.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((R=>this.scrollLines(R.amount,R.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(a.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(g.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((R=>this.scrollLines(R.amount,R.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((R=>this._renderService.handleSelectionChanged(R.start,R.end,R.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((R=>{this.textarea.value=R,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((R=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(R=>this._selectionService.handleMouseDown(R)))),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(I.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(R=>this._handleScreenReaderModeOptionChange(R)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(R=>{!this._overviewRulerRenderer&&R&&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._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier2)}bindMouse(){const x=this,A=this.element;function C(R){const X=x._mouseService.getMouseReportCoords(R,x.screenElement);if(!X)return!1;let j,G;switch(R.overrideType||R.type){case"mousemove":G=32,R.buttons===void 0?(j=3,R.button!==void 0&&(j=R.button<3?R.button:3)):j=1&R.buttons?0:4&R.buttons?1:2&R.buttons?2:3;break;case"mouseup":G=0,j=R.button<3?R.button:3;break;case"mousedown":G=1,j=R.button<3?R.button:3;break;case"wheel":if(x.viewport.getLinesScrolled(R)===0)return!1;G=R.deltaY<0?0:1,j=4;break;default:return!1}return!(G===void 0||j===void 0||j>4)&&x.coreMouseService.triggerMouseEvent({col:X.col,row:X.row,x:X.x,y:X.y,button:j,action:G,ctrl:R.ctrlKey,alt:R.altKey,shift:R.shiftKey})}const O={mouseup:null,wheel:null,mousedrag:null,mousemove:null},U={mouseup:R=>(C(R),R.buttons||(this._document.removeEventListener("mouseup",O.mouseup),O.mousedrag&&this._document.removeEventListener("mousemove",O.mousedrag)),this.cancel(R)),wheel:R=>(C(R),this.cancel(R,!0)),mousedrag:R=>{R.buttons&&C(R)},mousemove:R=>{R.buttons||C(R)}};this.register(this.coreMouseService.onProtocolChange((R=>{R?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(R)),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&R?O.mousemove||(A.addEventListener("mousemove",U.mousemove),O.mousemove=U.mousemove):(A.removeEventListener("mousemove",O.mousemove),O.mousemove=null),16&R?O.wheel||(A.addEventListener("wheel",U.wheel,{passive:!1}),O.wheel=U.wheel):(A.removeEventListener("wheel",O.wheel),O.wheel=null),2&R?O.mouseup||(O.mouseup=U.mouseup):(this._document.removeEventListener("mouseup",O.mouseup),O.mouseup=null),4&R?O.mousedrag||(O.mousedrag=U.mousedrag):(this._document.removeEventListener("mousemove",O.mousedrag),O.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(A,"mousedown",(R=>{if(R.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(R))return C(R),O.mouseup&&this._document.addEventListener("mouseup",O.mouseup),O.mousedrag&&this._document.addEventListener("mousemove",O.mousedrag),this.cancel(R)}))),this.register((0,f.addDisposableDomListener)(A,"wheel",(R=>{if(!O.wheel){if(!this.buffer.hasScrollback){const X=this.viewport.getLinesScrolled(R);if(X===0)return;const j=F.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(R.deltaY<0?"A":"B");let G="";for(let J=0;J<Math.abs(X);J++)G+=j;return this.coreService.triggerDataEvent(G,!0),this.cancel(R,!0)}return this.viewport.handleWheel(R)?this.cancel(R):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(A,"touchstart",(R=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(R),this.cancel(R)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(A,"touchmove",(R=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(R)?void 0:this.cancel(R)}),{passive:!1}))}refresh(x,A){var C;(C=this._renderService)==null||C.refreshRows(x,A)}updateCursorStyle(x){var A;(A=this._selectionService)!=null&&A.shouldColumnSelect(x)?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(x,A,C=0){var O;C===1?(super.scrollLines(x,A,C),this.refresh(0,this.rows-1)):(O=this.viewport)==null||O.scrollLines(x)}paste(x){(0,c.paste)(x,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(x){this._customKeyEventHandler=x}registerLinkProvider(x){return this.linkifier2.registerLinkProvider(x)}registerCharacterJoiner(x){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const A=this._characterJoinerService.register(x);return this.refresh(0,this.rows-1),A}deregisterCharacterJoiner(x){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(x)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(x){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+x)}registerDecoration(x){return this._decorationService.registerDecoration(x)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(x,A,C){this._selectionService.setSelection(x,A,C)}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 x;(x=this._selectionService)==null||x.clearSelection()}selectAll(){var x;(x=this._selectionService)==null||x.selectAll()}selectLines(x,A){var C;(C=this._selectionService)==null||C.selectLines(x,A)}_keyDown(x){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(x)===!1)return!1;const A=this.browser.isMac&&this.options.macOptionIsMeta&&x.altKey;if(!A&&!this._compositionHelper.keydown(x))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;A||x.key!=="Dead"&&x.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const C=(0,W.evaluateKeyboardEvent)(x,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(x),C.type===3||C.type===2){const O=this.rows-1;return this.scrollLines(C.type===2?-O:O),this.cancel(x,!0)}return C.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,x)||(C.cancel&&this.cancel(x,!0),!C.key||!!(x.key&&!x.ctrlKey&&!x.altKey&&!x.metaKey&&x.key.length===1&&x.key.charCodeAt(0)>=65&&x.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(C.key!==F.C0.ETX&&C.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:C.key,domEvent:x}),this._showCursor(),this.coreService.triggerDataEvent(C.key,!0),!this.optionsService.rawOptions.screenReaderMode||x.altKey||x.ctrlKey?this.cancel(x,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(x,A){const C=x.isMac&&!this.options.macOptionIsMeta&&A.altKey&&!A.ctrlKey&&!A.metaKey||x.isWindows&&A.altKey&&A.ctrlKey&&!A.metaKey||x.isWindows&&A.getModifierState("AltGraph");return A.type==="keypress"?C:C&&(!A.keyCode||A.keyCode>47)}_keyUp(x){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(x)===!1||((function(A){return A.keyCode===16||A.keyCode===17||A.keyCode===18})(x)||this.focus(),this.updateCursorStyle(x),this._keyPressHandled=!1)}_keyPress(x){let A;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(x)===!1)return!1;if(this.cancel(x),x.charCode)A=x.charCode;else if(x.which===null||x.which===void 0)A=x.keyCode;else{if(x.which===0||x.charCode===0)return!1;A=x.which}return!(!A||(x.altKey||x.ctrlKey||x.metaKey)&&!this._isThirdLevelShift(this.browser,x)||(A=String.fromCharCode(A),this._onKey.fire({key:A,domEvent:x}),this._showCursor(),this.coreService.triggerDataEvent(A,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(x){if(x.data&&x.inputType==="insertText"&&(!x.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const A=x.data;return this.coreService.triggerDataEvent(A,!0),this.cancel(x),!0}return!1}resize(x,A){x!==this.cols||A!==this.rows?super.resize(x,A):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(x,A){var C,O;(C=this._charSizeService)==null||C.measure(),(O=this.viewport)==null||O.syncScrollArea(!0)}clear(){var x;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 A=1;A<this.rows;A++)this.buffer.lines.push(this.buffer.getBlankLine(P.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(x=this.viewport)==null||x.reset(),this.refresh(0,this.rows-1)}}reset(){var A,C;this.options.rows=this.rows,this.options.cols=this.cols;const x=this._customKeyEventHandler;this._setup(),super.reset(),(A=this._selectionService)==null||A.reset(),this._decorationService.reset(),(C=this.viewport)==null||C.reset(),this._customKeyEventHandler=x,this.refresh(0,this.rows-1)}clearTextureAtlas(){var x;(x=this._renderService)==null||x.clearTextureAtlas()}_reportFocus(){var x;(x=this.element)!=null&&x.classList.contains("focus")?this.coreService.triggerDataEvent(F.C0.ESC+"[I"):this.coreService.triggerDataEvent(F.C0.ESC+"[O")}_reportWindowsOptions(x){if(this._renderService)switch(x){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const A=this._renderService.dimensions.css.canvas.width.toFixed(0),C=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent("".concat(F.C0.ESC,"[4;").concat(C,";").concat(A,"t"));break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const O=this._renderService.dimensions.css.cell.width.toFixed(0),U=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent("".concat(F.C0.ESC,"[6;").concat(U,";").concat(O,"t"))}}cancel(x,A){if(this.options.cancelEvents||A)return x.preventDefault(),x.stopPropagation(),!1}}r.Terminal=H},9924:(T,r)=>{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,f){this._rowCount=f,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;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=n-this._lastRefreshMs,u=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),u)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const 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(T,r,o){var c=this&&this.__decorate||function(s,t,i,l){var _,p=arguments.length,m=p<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,t,i,l);else for(var a=s.length-1;a>=0;a--)(_=s[a])&&(m=(p<3?_(m):p>3?_(t,i,m):_(t,i))||m);return p>3&&m&&Object.defineProperty(t,i,m),m},f=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const n=o(3656),d=o(4725),u=o(8460),v=o(844),h=o(2585);let e=r.Viewport=class extends v.Disposable{constructor(s,t,i,l,_,p,m,a){super(),this._viewportElement=s,this._scrollArea=t,this._bufferService=i,this._optionsService=l,this._charSizeService=_,this._renderService=p,this._coreBrowserService=m,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 u.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((g=>this._activeBuffer=g.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((g=>this._renderDimensions=g))),this._handleThemeChange(a.colors),this.register(a.onChangeColors((g=>this._handleThemeChange(g)))),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._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const 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});const 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;const 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){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&i<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){const t=this._getPixelsScrolled(s);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(s,t))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const t=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let t=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(s,t){var a;let i,l="";const _=[],p=t!=null?t:this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let g=s;g<p;g++){const y=m.get(g);if(!y)continue;const k=(a=m.get(g+1))==null?void 0:a.isWrapped;if(l+=y.translateToString(!k),!k||g===m.length-1){const b=document.createElement("div");b.textContent=l,_.push(b),l.length>0&&(i=b),l=""}}return{bufferElements:_,cursorElement:i}}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){const 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){const 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([f(2,h.IBufferService),f(3,h.IOptionsService),f(4,d.ICharSizeService),f(5,d.IRenderService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],e)},3107:function(T,r,o){var c=this&&this.__decorate||function(h,e,s,t){var i,l=arguments.length,_=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(h,e,s,t);else for(var p=h.length-1;p>=0;p--)(i=h[p])&&(_=(l<3?i(_):l>3?i(e,s,_):i(e,s))||_);return l>3&&_&&Object.defineProperty(e,s,_),_},f=this&&this.__param||function(h,e){return function(s,t){e(s,t,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const n=o(4725),d=o(844),u=o(2585);let v=r.BufferDecorationRenderer=class extends d.Disposable{constructor(h,e,s,t,i){super(),this._screenElement=h,this._bufferService=e,this._coreBrowserService=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(this._coreBrowserService.onDprChange((()=>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((l=>this._removeDecoration(l)))),this.register((0,d.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(const h of this._decorationService.decorations)this._renderDecoration(h);this._dimensionsChanged=!1}_renderDecoration(h){this._refreshStyle(h),this._dimensionsChanged&&this._refreshXPosition(h)}_createElement(h){var t,i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((t=h==null?void 0:h.options)==null?void 0:t.layer)==="top"),e.style.width="".concat(Math.round((h.options.width||1)*this._renderService.dimensions.css.cell.width),"px"),e.style.height=(h.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(h.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight="".concat(this._renderService.dimensions.css.cell.height,"px");const s=(i=h.options.x)!=null?i:0;return s&&s>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(h,e),e}_refreshStyle(h){const e=h.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)h.element&&(h.element.style.display="none",h.onRenderEmitter.fire(h.element));else{let s=this._decorationElements.get(h);s||(s=this._createElement(h),h.element=s,this._decorationElements.set(h,s),this._container.appendChild(s),h.onDispose((()=>{this._decorationElements.delete(h),s.remove()}))),s.style.top=e*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",h.onRenderEmitter.fire(s)}}_refreshXPosition(h,e=h.element){var t;if(!e)return;const s=(t=h.options.x)!=null?t:0;(h.options.anchor||"left")==="right"?e.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(h){var e;(e=this._decorationElements.get(h))==null||e.remove(),this._decorationElements.delete(h),h.dispose()}};r.BufferDecorationRenderer=v=c([f(1,u.IBufferService),f(2,n.ICoreBrowserService),f(3,u.IDecorationService),f(4,n.IRenderService)],v)},5871:(T,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(const 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<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,f){return c>=o.startBufferLine-this._linePadding[f||"full"]&&c<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(T,r,o){var c=this&&this.__decorate||function(i,l,_,p){var m,a=arguments.length,g=a<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,_):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,l,_,p);else for(var y=i.length-1;y>=0;y--)(m=i[y])&&(g=(a<3?m(g):a>3?m(l,_,g):m(l,_))||g);return a>3&&g&&Object.defineProperty(l,_,g),g},f=this&&this.__param||function(i,l){return function(_,p){l(_,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const n=o(5871),d=o(4725),u=o(844),v=o(2585),h={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let t=r.OverviewRulerRenderer=class extends u.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(i,l,_,p,m,a,g){var k;super(),this._viewportElement=i,this._screenElement=l,this._bufferService=_,this._decorationService=p,this._renderService=m,this._optionsService=a,this._coreBrowserService=g,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(k=this._viewportElement.parentElement)==null||k.insertBefore(this._canvas,this._viewportElement);const 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,u.toDisposable)((()=>{var b;(b=this._canvas)==null||b.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(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const i=Math.floor(this._canvas.width/3),l=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=i,e.center=l,e.right=i,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=e.left,s.right=e.left+e.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);const i=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(i,12),6)*this._coreBrowserService.dpr);h.left=l,h.center=l,h.right=l}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width="".concat(this._width,"px"),this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height="".concat(this._screenElement.clientHeight,"px"),this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;const i=this._colorZoneStore.zones;for(const l of i)l.position!=="full"&&this._renderColorZone(l);for(const l of i)l.position==="full"&&this._renderColorZone(l);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(i){this._ctx.fillStyle=i.color,this._ctx.fillRect(s[i.position||"full"],Math.round((this._canvas.height-1)*(i.startBufferLine/this._bufferService.buffers.active.lines.length)-h[i.position||"full"]/2),e[i.position||"full"],Math.round((this._canvas.height-1)*((i.endBufferLine-i.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[i.position||"full"]))}_queueRefresh(i,l){this._shouldUpdateDimensions=i||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=t=c([f(2,v.IBufferService),f(3,v.IDecorationService),f(4,d.IRenderService),f(5,v.IOptionsService),f(6,d.ICoreBrowserService)],t)},2950:function(T,r,o){var c=this&&this.__decorate||function(h,e,s,t){var i,l=arguments.length,_=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(h,e,s,t);else for(var p=h.length-1;p>=0;p--)(i=h[p])&&(_=(l<3?i(_):l>3?i(e,s,_):i(e,s))||_);return l>3&&_&&Object.defineProperty(e,s,_),_},f=this&&this.__param||function(h,e){return function(s,t){e(s,t,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const n=o(4725),d=o(2585),u=o(2584);let v=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,e,s,t,i,l){this._textarea=h,this._compositionView=e,this._bufferService=s,this._optionsService=t,this._coreService=i,this._renderService=l,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(h){this._compositionView.textContent=h.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(h){if(this._isComposing||this._isSendingComposition){if(h.keyCode===229||h.keyCode===16||h.keyCode===17||h.keyCode===18)return!1;this._finalizeComposition(!1)}return h.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(h){if(this._compositionView.classList.remove("active"),this._isComposing=!1,h){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const h=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,s=e.replace(h,"");this._dataAlreadySent=s,e.length>h.length?this._coreService.triggerDataEvent(s,!0):e.length<h.length?this._coreService.triggerDataEvent("".concat(u.C0.DEL),!0):e.length===h.length&&e!==h&&this._coreService.triggerDataEvent(e,!0)}}),0)}updateCompositionElements(h){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const 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";const l=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=t+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=v=c([f(2,d.IBufferService),f(3,d.IOptionsService),f(4,d.ICoreService),f(5,n.IRenderService)],v)},9806:(T,r)=>{function o(c,f,n){const d=n.getBoundingClientRect(),u=c.getComputedStyle(n),v=parseInt(u.getPropertyValue("padding-left")),h=parseInt(u.getPropertyValue("padding-top"));return[f.clientX-d.left-v,f.clientY-d.top-h]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(c,f,n,d,u,v,h,e,s){if(!v)return;const t=o(c,f,n);return t?(t[0]=Math.ceil((t[0]+(s?h/2:0))/h),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),u),t):void 0}},9504:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=o(2584);function f(e,s,t,i){const l=e-n(e,t),_=s-n(s,t),p=Math.abs(l-_)-(function(m,a,g){let y=0;const k=m-n(m,g),b=a-n(a,g);for(let L=0;L<Math.abs(k-b);L++){const B=d(m,a)==="A"?-1:1,M=g.buffer.lines.get(k+B*L);M!=null&&M.isWrapped&&y++}return y})(e,s,t);return h(p,v(d(e,s),i))}function n(e,s){let t=0,i=s.buffer.lines.get(e),l=i==null?void 0:i.isWrapped;for(;l&&e>=0&&e<s.rows;)t++,i=s.buffer.lines.get(--e),l=i==null?void 0:i.isWrapped;return t}function d(e,s){return e>s?"A":"B"}function u(e,s,t,i,l,_){let p=e,m=s,a="";for(;p!==t||m!==i;)p+=l?1:-1,l&&p>_.cols-1?(a+=_.buffer.translateBufferLineToString(m,!1,e,p),p=0,e=0,m++):!l&&p<0&&(a+=_.buffer.translateBufferLineToString(m,!1,0,e+1),p=_.cols-1,e=p,m--);return a+_.buffer.translateBufferLineToString(m,!1,e,p)}function v(e,s){const t=s?"O":"[";return c.C0.ESC+t+e}function h(e,s){e=Math.floor(e);let t="";for(let i=0;i<e;i++)t+=s;return t}r.moveToCellSequence=function(e,s,t,i){const l=t.buffer.x,_=t.buffer.y;if(!t.buffer.hasScrollback)return(function(a,g,y,k,b,L){return f(g,k,b,L).length===0?"":h(u(a,g,a,g-n(g,b),!1,b).length,v("D",L))})(l,_,0,s,t,i)+f(_,s,t,i)+(function(a,g,y,k,b,L){let B;B=f(g,k,b,L).length>0?k-n(k,b):g;const M=k,P=(function(F,W,S,w,E,D){let I;return I=f(S,w,E,D).length>0?w-n(w,E):W,F<S&&I<=w||F>=S&&I<w?"C":"D"})(a,g,y,k,b,L);return h(u(a,B,y,M,P==="C",b).length,v(P,L))})(l,_,e,s,t,i);let p;if(_===s)return p=l>e?"D":"C",h(Math.abs(l-e),v(p,i));p=_>s?"D":"C";const m=Math.abs(_-s);return h((function(a,g){return g.cols-a})(_>s?e:l,t)+(m-1)*t.cols+1+((_>s?l:e)-1),v(p,i))}},1296:function(T,r,o){var c=this&&this.__decorate||function(b,L,B,M){var P,F=arguments.length,W=F<3?L:M===null?M=Object.getOwnPropertyDescriptor(L,B):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(b,L,B,M);else for(var S=b.length-1;S>=0;S--)(P=b[S])&&(W=(F<3?P(W):F>3?P(L,B,W):P(L,B))||W);return F>3&&W&&Object.defineProperty(L,B,W),W},f=this&&this.__param||function(b,L){return function(B,M){L(B,M,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const n=o(3787),d=o(2550),u=o(2223),v=o(6171),h=o(4725),e=o(8055),s=o(8460),t=o(844),i=o(2585),l="xterm-dom-renderer-owner-",_="xterm-rows",p="xterm-fg-",m="xterm-bg-",a="xterm-focus",g="xterm-selection";let y=1,k=r.DomRenderer=class extends t.Disposable{constructor(b,L,B,M,P,F,W,S,w,E,D,I){super(),this._document=b,this._element=L,this._screenElement=B,this._viewportElement=M,this._helperContainer=P,this._linkifier2=F,this._charSizeService=S,this._optionsService=w,this._bufferService=E,this._coreBrowserService=D,this._themeService=I,this._terminalClass=y++,this._rowElements=[],this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(g),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((H=>this._injectCss(H)))),this._injectCss(this._themeService.colors),this._rowFactory=W.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(l+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((H=>this._handleLinkHover(H)))),this.register(this._linkifier2.onHideLinkUnderline((H=>this._handleLinkLeave(H)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(l+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const b=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*b,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*b),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/b),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/b),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(const B of this._rowElements)B.style.width="".concat(this.dimensions.css.canvas.width,"px"),B.style.height="".concat(this.dimensions.css.cell.height,"px"),B.style.lineHeight="".concat(this.dimensions.css.cell.height,"px"),B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const L="".concat(this._terminalSelector," .").concat(_," span { display: inline-block; height: 100%; vertical-align: top;}");this._dimensionsStyleElement.textContent=L,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width="".concat(this.dimensions.css.canvas.width,"px"),this._screenElement.style.height="".concat(this.dimensions.css.canvas.height,"px")}_injectCss(b){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let L="".concat(this._terminalSelector," .").concat(_," { color: ").concat(b.foreground.css,"; font-family: ").concat(this._optionsService.rawOptions.fontFamily,"; font-size: ").concat(this._optionsService.rawOptions.fontSize,"px; font-kerning: none; white-space: pre}");L+="".concat(this._terminalSelector," .").concat(_," .xterm-dim { color: ").concat(e.color.multiplyOpacity(b.foreground,.5).css,";}"),L+="".concat(this._terminalSelector," span:not(.xterm-bold) { font-weight: ").concat(this._optionsService.rawOptions.fontWeight,";}").concat(this._terminalSelector," span.xterm-bold { font-weight: ").concat(this._optionsService.rawOptions.fontWeightBold,";}").concat(this._terminalSelector," span.xterm-italic { font-style: italic;}"),L+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",L+="@keyframes blink_block_"+this._terminalClass+" { 0% {"+" background-color: ".concat(b.cursor.css,";")+" color: ".concat(b.cursorAccent.css,"; } 50% { background-color: inherit;")+" color: ".concat(b.cursor.css,"; }}"),L+="".concat(this._terminalSelector," .").concat(_,".").concat(a," .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_")+this._terminalClass+" 1s step-end infinite;}"+"".concat(this._terminalSelector," .").concat(_,".").concat(a," .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_")+this._terminalClass+" 1s step-end infinite;}"+"".concat(this._terminalSelector," .").concat(_," .xterm-cursor.xterm-cursor-block {")+" background-color: ".concat(b.cursor.css," !important;")+" color: ".concat(b.cursorAccent.css," !important;}")+"".concat(this._terminalSelector," .").concat(_," .xterm-cursor.xterm-cursor-outline {")+" outline: 1px solid ".concat(b.cursor.css,"; outline-offset: -1px;}")+"".concat(this._terminalSelector," .").concat(_," .xterm-cursor.xterm-cursor-bar {")+" box-shadow: ".concat(this._optionsService.rawOptions.cursorWidth,"px 0 0 ").concat(b.cursor.css," inset;}")+"".concat(this._terminalSelector," .").concat(_," .xterm-cursor.xterm-cursor-underline {")+" border-bottom: 1px ".concat(b.cursor.css,"; border-bottom-style: solid; height: calc(100% - 1px);}"),L+="".concat(this._terminalSelector," .").concat(g," { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}").concat(this._terminalSelector,".focus .").concat(g," div { position: absolute; background-color: ").concat(b.selectionBackgroundOpaque.css,";}").concat(this._terminalSelector," .").concat(g," div { position: absolute; background-color: ").concat(b.selectionInactiveBackgroundOpaque.css,";}");for(const[B,M]of b.ansi.entries())L+="".concat(this._terminalSelector," .").concat(p).concat(B," { color: ").concat(M.css,"; }").concat(this._terminalSelector," .").concat(p).concat(B,".xterm-dim { color: ").concat(e.color.multiplyOpacity(M,.5).css,"; }").concat(this._terminalSelector," .").concat(m).concat(B," { background-color: ").concat(M.css,"; }");L+="".concat(this._terminalSelector," .").concat(p).concat(u.INVERTED_DEFAULT_COLOR," { color: ").concat(e.color.opaque(b.background).css,"; }").concat(this._terminalSelector," .").concat(p).concat(u.INVERTED_DEFAULT_COLOR,".xterm-dim { color: ").concat(e.color.multiplyOpacity(e.color.opaque(b.background),.5).css,"; }").concat(this._terminalSelector," .").concat(m).concat(u.INVERTED_DEFAULT_COLOR," { background-color: ").concat(b.foreground.css,"; }"),this._themeStyleElement.textContent=L}_setDefaultSpacing(){const b=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing="".concat(b,"px"),this._rowFactory.defaultSpacing=b}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(b,L){for(let B=this._rowElements.length;B<=L;B++){const M=this._document.createElement("div");this._rowContainer.appendChild(M),this._rowElements.push(M)}for(;this._rowElements.length>L;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(b,L){this._refreshRowElements(b,L),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(a),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(a),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(b,L,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(b,L,B),this.renderRows(0,this._bufferService.rows-1),!b||!L)return;const M=b[1]-this._bufferService.buffer.ydisp,P=L[1]-this._bufferService.buffer.ydisp,F=Math.max(M,0),W=Math.min(P,this._bufferService.rows-1);if(F>=this._bufferService.rows||W<0)return;const S=this._document.createDocumentFragment();if(B){const w=b[0]>L[0];S.appendChild(this._createSelectionElement(F,w?L[0]:b[0],w?b[0]:L[0],W-F+1))}else{const w=M===F?b[0]:0,E=F===P?L[0]:this._bufferService.cols;S.appendChild(this._createSelectionElement(F,w,E));const D=W-F-1;if(S.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,D)),F!==W){const I=P===W?L[0]:this._bufferService.cols;S.appendChild(this._createSelectionElement(W,0,I))}}this._selectionContainer.appendChild(S)}_createSelectionElement(b,L,B,M=1){const P=this._document.createElement("div");return P.style.height=M*this.dimensions.css.cell.height+"px",P.style.top=b*this.dimensions.css.cell.height+"px",P.style.left=L*this.dimensions.css.cell.width+"px",P.style.width=this.dimensions.css.cell.width*(B-L)+"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(const b of this._rowElements)b.replaceChildren()}renderRows(b,L){const B=this._bufferService.buffer,M=B.ybase+B.y,P=Math.min(B.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,W=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=b;w<=L;w++){const E=w+B.ydisp,D=this._rowElements[w],I=B.lines.get(E);if(!D||!I)break;D.replaceChildren(...this._rowFactory.createRow(I,E,E===M,W,S,P,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return".".concat(l).concat(this._terminalClass)}_handleLinkHover(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!0)}_handleLinkLeave(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!1)}_setCellUnderline(b,L,B,M,P,F){B<0&&(b=0),M<0&&(L=0);const W=this._bufferService.rows-1;B=Math.max(Math.min(B,W),0),M=Math.max(Math.min(M,W),0),P=Math.min(P,this._bufferService.cols);const S=this._bufferService.buffer,w=S.ybase+S.y,E=Math.min(S.x,P-1),D=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,H=this._optionsService.rawOptions.cursorInactiveStyle;for(let N=B;N<=M;++N){const x=N+S.ydisp,A=this._rowElements[N],C=S.lines.get(x);if(!A||!C)break;A.replaceChildren(...this._rowFactory.createRow(C,x,x===w,I,H,E,D,this.dimensions.css.cell.width,this._widthCache,F?N===B?b:0:-1,F?(N===M?L:P)-1:-1))}}};r.DomRenderer=k=c([f(6,i.IInstantiationService),f(7,h.ICharSizeService),f(8,i.IOptionsService),f(9,i.IBufferService),f(10,h.ICoreBrowserService),f(11,h.IThemeService)],k)},3787:function(T,r,o){var c=this&&this.__decorate||function(p,m,a,g){var y,k=arguments.length,b=k<3?m:g===null?g=Object.getOwnPropertyDescriptor(m,a):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,m,a,g);else for(var L=p.length-1;L>=0;L--)(y=p[L])&&(b=(k<3?y(b):k>3?y(m,a,b):y(m,a))||b);return k>3&&b&&Object.defineProperty(m,a,b),b},f=this&&this.__param||function(p,m){return function(a,g){m(a,g,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const n=o(2223),d=o(643),u=o(511),v=o(2585),h=o(8055),e=o(4725),s=o(4269),t=o(6171),i=o(3734);let l=r.DomRendererRowFactory=class{constructor(p,m,a,g,y,k,b){this._document=p,this._characterJoinerService=m,this._optionsService=a,this._coreBrowserService=g,this._coreService=y,this._decorationService=k,this._themeService=b,this._workCell=new u.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,m,a){this._selectionStart=p,this._selectionEnd=m,this._columnSelectMode=a}createRow(p,m,a,g,y,k,b,L,B,M,P){const F=[],W=this._characterJoinerService.getJoinedCharacters(m),S=this._themeService.colors;let w,E=p.getNoBgTrimmedLength();a&&E<k+1&&(E=k+1);let D=0,I="",H=0,N=0,x=0,A=!1,C=0,O=!1,U=0;const R=[],X=M!==-1&&P!==-1;for(let j=0;j<E;j++){p.loadCell(j,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let J=!1,Q=j,$=this._workCell;if(W.length>0&&j===W[0][0]){J=!0;const q=W.shift();$=new s.JoinedCellData(this._workCell,p.translateToString(!0,q[0],q[1]),q[1]-q[0]),Q=q[1]-1,G=$.getWidth()}const re=this._isCellInSelection(j,m),de=a&&j===k,_e=X&&j>=M&&j<=P;let ue=!1;this._decorationService.forEachDecorationAtCell(j,m,void 0,(q=>{ue=!0}));let he=$.getChars()||d.WHITESPACE_CELL_CHAR;if(he===" "&&($.isUnderline()||$.isOverline())&&(he=" "),U=G*L-B.get(he,$.isBold(),$.isItalic()),w){if(D&&(re&&O||!re&&!O&&$.bg===H)&&(re&&O&&S.selectionForeground||$.fg===N)&&$.extended.ext===x&&_e===A&&U===C&&!de&&!J&&!ue){$.isInvisible()?I+=d.WHITESPACE_CELL_CHAR:I+=he,D++;continue}D&&(w.textContent=I),w=this._document.createElement("span"),D=0,I=""}else w=this._document.createElement("span");if(H=$.bg,N=$.fg,x=$.extended.ext,A=_e,C=U,O=re,J&&k>=j&&k<=Q&&(k=j),!this._coreService.isCursorHidden&&de&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&R.push("xterm-cursor-blink"),R.push(g==="bar"?"xterm-cursor-bar":g==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":R.push("xterm-cursor-outline");break;case"block":R.push("xterm-cursor-block");break;case"bar":R.push("xterm-cursor-bar");break;case"underline":R.push("xterm-cursor-underline")}}if($.isBold()&&R.push("xterm-bold"),$.isItalic()&&R.push("xterm-italic"),$.isDim()&&R.push("xterm-dim"),I=$.isInvisible()?d.WHITESPACE_CELL_CHAR:$.getChars()||d.WHITESPACE_CELL_CHAR,$.isUnderline()&&(R.push("xterm-underline-".concat($.extended.underlineStyle)),I===" "&&(I=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())w.style.textDecorationColor="rgb(".concat(i.AttributeData.toColorRGB($.getUnderlineColor()).join(","),")");else{let q=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&q<8&&(q+=8),w.style.textDecorationColor=S.ansi[q].css}$.isOverline()&&(R.push("xterm-overline"),I===" "&&(I=" ")),$.isStrikethrough()&&R.push("xterm-strikethrough"),_e&&(w.style.textDecoration="underline");let Z=$.getFgColor(),ne=$.getFgColorMode(),ee=$.getBgColor(),oe=$.getBgColorMode();const fe=!!$.isInverse();if(fe){const q=Z;Z=ee,ee=q;const Ee=ne;ne=oe,oe=Ee}let te,ce,ie,ae=!1;switch(this._decorationService.forEachDecorationAtCell(j,m,void 0,(q=>{q.options.layer!=="top"&&ae||(q.backgroundColorRGB&&(oe=50331648,ee=q.backgroundColorRGB.rgba>>8&16777215,te=q.backgroundColorRGB),q.foregroundColorRGB&&(ne=50331648,Z=q.foregroundColorRGB.rgba>>8&16777215,ce=q.foregroundColorRGB),ae=q.options.layer==="top")})),!ae&&re&&(te=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ee=te.rgba>>8&16777215,oe=50331648,ae=!0,S.selectionForeground&&(ne=50331648,Z=S.selectionForeground.rgba>>8&16777215,ce=S.selectionForeground)),ae&&R.push("xterm-decoration-top"),oe){case 16777216:case 33554432:ie=S.ansi[ee],R.push("xterm-bg-".concat(ee));break;case 50331648:ie=h.rgba.toColor(ee>>16,ee>>8&255,255&ee),this._addStyle(w,"background-color:#".concat(_((ee>>>0).toString(16),"0",6)));break;default:fe?(ie=S.foreground,R.push("xterm-bg-".concat(n.INVERTED_DEFAULT_COLOR))):ie=S.background}switch(te||$.isDim()&&(te=h.color.multiplyOpacity(ie,.5)),ne){case 16777216:case 33554432:$.isBold()&&Z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Z+=8),this._applyMinimumContrast(w,ie,S.ansi[Z],$,te,void 0)||R.push("xterm-fg-".concat(Z));break;case 50331648:const q=h.rgba.toColor(Z>>16&255,Z>>8&255,255&Z);this._applyMinimumContrast(w,ie,q,$,te,ce)||this._addStyle(w,"color:#".concat(_(Z.toString(16),"0",6)));break;default:this._applyMinimumContrast(w,ie,S.foreground,$,te,ce)||fe&&R.push("xterm-fg-".concat(n.INVERTED_DEFAULT_COLOR))}R.length&&(w.className=R.join(" "),R.length=0),de||J||ue?w.textContent=I:D++,U!==this.defaultSpacing&&(w.style.letterSpacing="".concat(U,"px")),F.push(w),j=Q}return w&&D&&(w.textContent=I),F}_applyMinimumContrast(p,m,a,g,y,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(g.getCode()))return!1;const b=this._getContrastCache(g);let L;if(y||k||(L=b.getColor(m.rgba,a.rgba)),L===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(g.isDim()?2:1);L=h.color.ensureContrastRatio(y||m,k||a,B),b.setColor((y||m).rgba,(k||a).rgba,L!=null?L:null)}return!!L&&(this._addStyle(p,"color:".concat(L.css)),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,m){p.setAttribute("style","".concat(p.getAttribute("style")||"").concat(m,";"))}_isCellInSelection(p,m){const a=this._selectionStart,g=this._selectionEnd;return!(!a||!g)&&(this._columnSelectMode?a[0]<=g[0]?p>=a[0]&&m>=a[1]&&p<g[0]&&m<=g[1]:p<a[0]&&m>=a[1]&&p>=g[0]&&m<=g[1]:m>a[1]&&m<g[1]||a[1]===g[1]&&m===a[1]&&p>=a[0]&&p<g[0]||a[1]<g[1]&&m===g[1]&&p<g[0]||a[1]<g[1]&&m===a[1]&&p>=a[0])}};function _(p,m,a){for(;p.length<a;)p=m+p;return p}r.DomRendererRowFactory=l=c([f(1,e.ICharacterJoinerService),f(2,v.IOptionsService),f(3,e.ICoreBrowserService),f(4,v.ICoreService),f(5,v.IDecorationService),f(6,e.IThemeService)],l)},2550:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o,c){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.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=o.createElement("span");f.classList.add("xterm-char-measure-element");const n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";const u=o.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold",u.style.fontStyle="italic",this._measureElements=[f,n,d,u],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(d),this._container.appendChild(u),c.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,f,n){o===this._font&&c===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=o,this._fontSize=c,this._weight=f,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize="".concat(this._fontSize,"px"),this._measureElements[0].style.fontWeight="".concat(f),this._measureElements[1].style.fontWeight="".concat(n),this._measureElements[2].style.fontWeight="".concat(f),this._measureElements[3].style.fontWeight="".concat(n),this.clear())}get(o,c,f){let n=0;if(!c&&!f&&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"),f&&(d+="I");let u=this._holey.get(d);if(u===void 0){let v=0;c&&(v|=1),f&&(v|=2),u=this._measure(o,v),this._holey.set(d,u)}return u}_measure(o,c){const f=this._measureElements[c];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(T,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(f){return 9472<=f&&f<=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:(T,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()){const 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]){const 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(){const 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(T,r,o){var c=this&&this.__decorate||function(e,s,t,i){var l,_=arguments.length,p=_<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(l=e[m])&&(p=(_<3?l(p):_>3?l(s,t,p):l(s,t))||p);return _>3&&p&&Object.defineProperty(s,t,p),p},f=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const n=o(2585),d=o(8460),u=o(844);let v=r.CharSizeService=class extends u.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 h(e,s,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const 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=v=c([f(2,n.IOptionsService)],v);class h{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="".concat(this._optionsService.rawOptions.fontSize,"px");const 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(T,r,o){var c=this&&this.__decorate||function(s,t,i,l){var _,p=arguments.length,m=p<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,t,i,l);else for(var a=s.length-1;a>=0;a--)(_=s[a])&&(m=(p<3?_(m):p>3?_(t,i,m):_(t,i))||m);return p>3&&m&&Object.defineProperty(t,i,m),m},f=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const n=o(3734),d=o(643),u=o(511),v=o(2585);class h extends n.AttributeData{constructor(t,i,l){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=l}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=h;let e=r.CharacterJoinerService=class ye{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new u.CellData}register(t){const i={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(i),i.id}deregister(t){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===t)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];const i=this._bufferService.buffer.lines.get(t);if(!i||i.length===0)return[];const l=[],_=i.translateToString(!0);let p=0,m=0,a=0,g=i.getFg(0),y=i.getBg(0);for(let k=0;k<i.getTrimmedLength();k++)if(i.loadCell(k,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==g||this._workCell.bg!==y){if(k-p>1){const b=this._getJoinedRanges(_,a,m,i,p);for(let L=0;L<b.length;L++)l.push(b[L])}p=k,a=m,g=this._workCell.fg,y=this._workCell.bg}m+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){const k=this._getJoinedRanges(_,a,m,i,p);for(let b=0;b<k.length;b++)l.push(k[b])}return l}_getJoinedRanges(t,i,l,_,p){const m=t.substring(i,l);let a=[];try{a=this._characterJoiners[0].handler(m)}catch(g){console.error(g)}for(let g=1;g<this._characterJoiners.length;g++)try{const y=this._characterJoiners[g].handler(m);for(let k=0;k<y.length;k++)ye._mergeRanges(a,y[k])}catch(y){console.error(y)}return this._stringRangesToCellRanges(a,_,p),a}_stringRangesToCellRanges(t,i,l){let _=0,p=!1,m=0,a=t[_];if(a){for(let g=l;g<this._bufferService.cols;g++){const y=i.getWidth(g),k=i.getString(g).length||d.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!p&&a[0]<=m&&(a[0]=g,p=!0),a[1]<=m){if(a[1]=g,a=t[++_],!a)break;a[0]<=m?(a[0]=g,p=!0):p=!1}m+=k}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(t,i){let l=!1;for(let _=0;_<t.length;_++){const p=t[_];if(l){if(i[1]<=p[0])return t[_-1][1]=i[1],t;if(i[1]<=p[1])return t[_-1][1]=Math.max(i[1],p[1]),t.splice(_,1),t;t.splice(_,1),_--}else{if(i[1]<=p[0])return t.splice(_,0,i),t;if(i[1]<=p[1])return p[0]=Math.min(i[0],p[0]),t;i[0]<p[1]&&(p[0]=Math.min(i[0],p[0]),l=!0)}}return l?t[t.length-1][1]=i[1]:t.push(i),t}};r.CharacterJoinerService=e=c([f(0,v.IBufferService)],e)},5114:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const c=o(844),f=o(8460),n=o(3656);class d extends c.Disposable{constructor(h,e,s){super(),this._textarea=h,this._window=e,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new u(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((t=>this._screenDprMonitor.setWindow(t)))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(h){this._window!==h&&(this._window=h,this._onWindowChange.fire(this._window))}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}}r.CoreBrowserService=d;class u extends c.Disposable{constructor(h){super(),this._parentWindow=h,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)((()=>this.clearListener())))}setWindow(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var h;this._outerListener&&((h=this._resolutionMediaMatchList)==null||h.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia("screen and (resolution: ".concat(this._parentWindow.devicePixelRatio,"dppx)")),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},8934:function(T,r,o){var c=this&&this.__decorate||function(v,h,e,s){var t,i=arguments.length,l=i<3?h:s===null?s=Object.getOwnPropertyDescriptor(h,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(v,h,e,s);else for(var _=v.length-1;_>=0;_--)(t=v[_])&&(l=(i<3?t(l):i>3?t(h,e,l):t(h,e))||l);return i>3&&l&&Object.defineProperty(h,e,l),l},f=this&&this.__param||function(v,h){return function(e,s){h(e,s,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const n=o(4725),d=o(9806);let u=r.MouseService=class{constructor(v,h){this._renderService=v,this._charSizeService=h}getCoords(v,h,e,s,t){return(0,d.getCoords)(window,v,h,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(v,h){const e=(0,d.getCoordsRelativeToElement)(window,v,h);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=u=c([f(0,n.IRenderService),f(1,n.ICharSizeService)],u)},3230:function(T,r,o){var c=this&&this.__decorate||function(t,i,l,_){var p,m=arguments.length,a=m<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,l):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,i,l,_);else for(var g=t.length-1;g>=0;g--)(p=t[g])&&(a=(m<3?p(a):m>3?p(i,l,a):p(i,l))||a);return m>3&&a&&Object.defineProperty(i,l,a),a},f=this&&this.__param||function(t,i){return function(l,_){i(l,_,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const n=o(6193),d=o(4725),u=o(8460),v=o(844),h=o(7226),e=o(2585);let s=r.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(t,i,l,_,p,m,a,g,y){if(super(),this._rowCount=t,this._charSizeService=_,this._renderer=this.register(new v.MutableDisposable),this._pausedResizeTask=new h.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 u.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new u.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new u.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new u.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(a.window,((k,b)=>this._renderRows(k,b))),this.register(this._renderDebouncer),this.register(a.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(m.onResize((()=>this._fullRefresh()))),this.register(m.buffers.onBufferActivate((()=>{var k;return(k=this._renderer.value)==null?void 0:k.clear()}))),this.register(l.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(p.onDecorationRegistered((()=>this._fullRefresh()))),this.register(p.onDecorationRemoved((()=>this._fullRefresh()))),this.register(l.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()}))),this.register(l.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(m.buffer.y,m.buffer.y,!0)))),this.register(y.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in a.window){const k=new a.window.IntersectionObserver((b=>this._handleIntersectionChange(b[b.length-1])),{threshold:0});k.observe(i),this.register({dispose:()=>k.disconnect()})}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.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(t,i,l=!1){this._isPaused?this._needsFullRefresh=!0:(l||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,i,this._rowCount))}_renderRows(t,i){this._renderer.value&&(t=Math.min(t,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(t,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:i}),this._onRender.fire({start:t,end:i}),this._isNextRenderRedrawOnly=!0)}resize(t,i){this._rowCount=i,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(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw((i=>this.refreshRows(i.start,i.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var t,i;this._renderer.value&&((i=(t=this._renderer.value).clearTextureAtlas)==null||i.call(t),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(t,i))):this._renderer.value.handleResize(t,i),this._fullRefresh())}handleCharSizeChanged(){var t;(t=this._renderer.value)==null||t.handleCharSizeChanged()}handleBlur(){var t;(t=this._renderer.value)==null||t.handleBlur()}handleFocus(){var t;(t=this._renderer.value)==null||t.handleFocus()}handleSelectionChanged(t,i,l){var _;this._selectionState.start=t,this._selectionState.end=i,this._selectionState.columnSelectMode=l,(_=this._renderer.value)==null||_.handleSelectionChanged(t,i,l)}handleCursorMove(){var t;(t=this._renderer.value)==null||t.handleCursorMove()}clear(){var t;(t=this._renderer.value)==null||t.clear()}};r.RenderService=s=c([f(2,e.IOptionsService),f(3,d.ICharSizeService),f(4,e.IDecorationService),f(5,e.IBufferService),f(6,d.ICoreBrowserService),f(7,e.IInstantiationService),f(8,d.IThemeService)],s)},9312:function(T,r,o){var c=this&&this.__decorate||function(a,g,y,k){var b,L=arguments.length,B=L<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(a,g,y,k);else for(var M=a.length-1;M>=0;M--)(b=a[M])&&(B=(L<3?b(B):L>3?b(g,y,B):b(g,y))||B);return L>3&&B&&Object.defineProperty(g,y,B),B},f=this&&this.__param||function(a,g){return function(y,k){g(y,k,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const n=o(9806),d=o(9504),u=o(456),v=o(4725),h=o(8460),e=o(844),s=o(6114),t=o(4841),i=o(511),l=o(2585),_=" ",p=new RegExp(_,"g");let m=r.SelectionService=class extends e.Disposable{constructor(a,g,y,k,b,L,B,M,P){super(),this._element=a,this._screenElement=g,this._linkifier=y,this._bufferService=k,this._coreService=b,this._mouseService=L,this._optionsService=B,this._renderService=M,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 h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=F=>this._handleMouseMove(F),this._mouseUpListener=F=>this._handleMouseUp(F),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((F=>this._handleTrim(F))),this.register(this._bufferService.buffers.onBufferActivate((F=>this._handleBufferActivate(F)))),this.enable(),this._model=new u.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(){const a=this._model.finalSelectionStart,g=this._model.finalSelectionEnd;return!(!a||!g||a[0]===g[0]&&a[1]===g[1])}get selectionText(){const a=this._model.finalSelectionStart,g=this._model.finalSelectionEnd;if(!a||!g)return"";const y=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(a[0]===g[0])return"";const b=a[0]<g[0]?a[0]:g[0],L=a[0]<g[0]?g[0]:a[0];for(let B=a[1];B<=g[1];B++){const M=y.translateBufferLineToString(B,!0,b,L);k.push(M)}}else{const b=a[1]===g[1]?g[0]:void 0;k.push(y.translateBufferLineToString(a[1],!0,a[0],b));for(let L=a[1]+1;L<=g[1]-1;L++){const B=y.lines.get(L),M=y.translateBufferLineToString(L,!0);B!=null&&B.isWrapped?k[k.length-1]+=M:k.push(M)}if(a[1]!==g[1]){const L=y.lines.get(g[1]),B=y.translateBufferLineToString(g[1],!0,0,g[0]);L&&L.isWrapped?k[k.length-1]+=B:k.push(B)}}return k.map((b=>b.replace(p," "))).join(s.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(a){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.isLinux&&a&&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(a){const g=this._getMouseBufferCoords(a),y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(y&&k&&g)&&this._areCoordsInSelection(g,y,k)}isCellInSelection(a,g){const y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!y||!k)&&this._areCoordsInSelection([a,g],y,k)}_areCoordsInSelection(a,g,y){return a[1]>g[1]&&a[1]<y[1]||g[1]===y[1]&&a[1]===g[1]&&a[0]>=g[0]&&a[0]<y[0]||g[1]<y[1]&&a[1]===y[1]&&a[0]<y[0]||g[1]<y[1]&&a[1]===g[1]&&a[0]>=g[0]}_selectWordAtCursor(a,g){var b,L;const y=(L=(b=this._linkifier.currentLink)==null?void 0:b.link)==null?void 0:L.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;const k=this._getMouseBufferCoords(a);return!!k&&(this._selectWordAt(k,g),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(a,g){this._model.clearSelection(),a=Math.max(a,0),g=Math.min(g,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,a],this._model.selectionEnd=[this._bufferService.cols,g],this.refresh(),this._onSelectionChange.fire()}_handleTrim(a){this._model.handleTrim(a)&&this.refresh()}_getMouseBufferCoords(a){const g=this._mouseService.getCoords(a,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(g)return g[0]--,g[1]--,g[1]+=this._bufferService.buffer.ydisp,g}_getMouseEventScrollAmount(a){let g=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,a,this._screenElement)[1];const y=this._renderService.dimensions.css.canvas.height;return g>=0&&g<=y?0:(g>y&&(g-=y),g=Math.min(Math.max(g,-50),50),g/=50,g/Math.abs(g)+Math.round(14*g))}shouldForceSelection(a){return s.isMac?a.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:a.shiftKey}handleMouseDown(a){if(this._mouseDownTimeStamp=a.timeStamp,(a.button!==2||!this.hasSelection)&&a.button===0){if(!this._enabled){if(!this.shouldForceSelection(a))return;a.stopPropagation()}a.preventDefault(),this._dragScrollAmount=0,this._enabled&&a.shiftKey?this._handleIncrementalClick(a):a.detail===1?this._handleSingleClick(a):a.detail===2?this._handleDoubleClick(a):a.detail===3&&this._handleTripleClick(a),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(a){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(a))}_handleSingleClick(a){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(a)?3:0,this._model.selectionStart=this._getMouseBufferCoords(a),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const g=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);g&&g.length!==this._model.selectionStart[0]&&g.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(a){this._selectWordAtCursor(a,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(a){const g=this._getMouseBufferCoords(a);g&&(this._activeSelectionMode=2,this._selectLineAt(g[1]))}shouldColumnSelect(a){return a.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(a){if(a.stopImmediatePropagation(),!this._model.selectionStart)return;const g=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(a),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(a),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const y=this._bufferService.buffer;if(this._model.selectionEnd[1]<y.lines.length){const k=y.lines.get(this._model.selectionEnd[1]);k&&k.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}g&&g[0]===this._model.selectionEnd[0]&&g[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const a=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(a.ydisp+this._bufferService.rows,a.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=a.ydisp),this.refresh()}}_handleMouseUp(a){const g=a.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&g<500&&a.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const y=this._mouseService.getCoords(a,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){const k=(0,d.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const a=this._model.finalSelectionStart,g=this._model.finalSelectionEnd,y=!(!a||!g||a[0]===g[0]&&a[1]===g[1]);y?a&&g&&(this._oldSelectionStart&&this._oldSelectionEnd&&a[0]===this._oldSelectionStart[0]&&a[1]===this._oldSelectionStart[1]&&g[0]===this._oldSelectionEnd[0]&&g[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(a,g,y)):this._oldHasSelection&&this._fireOnSelectionChange(a,g,y)}_fireOnSelectionChange(a,g,y){this._oldSelectionStart=a,this._oldSelectionEnd=g,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(a){this.clearSelection(),this._trimListener.dispose(),this._trimListener=a.activeBuffer.lines.onTrim((g=>this._handleTrim(g)))}_convertViewportColToCharacterIndex(a,g){let y=g;for(let k=0;g>=k;k++){const b=a.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:b>1&&g!==k&&(y+=b-1)}return y}setSelection(a,g,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[a,g],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(a){this._isClickInSelection(a)||(this._selectWordAtCursor(a,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(a,g,y=!0,k=!0){if(a[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,L=b.lines.get(a[1]);if(!L)return;const B=b.translateBufferLineToString(a[1],!1);let M=this._convertViewportColToCharacterIndex(L,a[0]),P=M;const F=a[0]-M;let W=0,S=0,w=0,E=0;if(B.charAt(M)===" "){for(;M>0&&B.charAt(M-1)===" ";)M--;for(;P<B.length&&B.charAt(P+1)===" ";)P++}else{let H=a[0],N=a[0];L.getWidth(H)===0&&(W++,H--),L.getWidth(N)===2&&(S++,N++);const x=L.getString(N).length;for(x>1&&(E+=x-1,P+=x-1);H>0&&M>0&&!this._isCharWordSeparator(L.loadCell(H-1,this._workCell));){L.loadCell(H-1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,H--):A>1&&(w+=A-1,M-=A-1),M--,H--}for(;N<L.length&&P+1<B.length&&!this._isCharWordSeparator(L.loadCell(N+1,this._workCell));){L.loadCell(N+1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,N++):A>1&&(E+=A-1,P+=A-1),P++,N++}}P++;let D=M+F-W+w,I=Math.min(this._bufferService.cols,P-M+W+S-w-E);if(g||B.slice(M,P).trim()!==""){if(y&&D===0&&L.getCodePoint(0)!==32){const H=b.lines.get(a[1]-1);if(H&&L.isWrapped&&H.getCodePoint(this._bufferService.cols-1)!==32){const N=this._getWordAt([this._bufferService.cols-1,a[1]-1],!1,!0,!1);if(N){const x=this._bufferService.cols-N.start;D-=x,I+=x}}}if(k&&D+I===this._bufferService.cols&&L.getCodePoint(this._bufferService.cols-1)!==32){const H=b.lines.get(a[1]+1);if(H!=null&&H.isWrapped&&H.getCodePoint(0)!==32){const N=this._getWordAt([0,a[1]+1],!1,!1,!0);N&&(I+=N.length)}}return{start:D,length:I}}}_selectWordAt(a,g){const y=this._getWordAt(a,g);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,a[1]--;this._model.selectionStart=[y.start,a[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(a){const g=this._getWordAt(a,!0);if(g){let y=a[1];for(;g.start<0;)g.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;g.start+g.length>this._bufferService.cols;)g.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?g.start:g.start+g.length,y]}}_isCharWordSeparator(a){return a.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(a.getChars())>=0}_selectLineAt(a){const g=this._bufferService.buffer.getWrappedRangeForLine(a),y={start:{x:0,y:g.first},end:{x:this._bufferService.cols-1,y:g.last}};this._model.selectionStart=[0,g.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,t.getRangeLength)(y,this._bufferService.cols)}};r.SelectionService=m=c([f(3,l.IBufferService),f(4,l.ICoreService),f(5,v.IMouseService),f(6,l.IOptionsService),f(7,v.IRenderService),f(8,v.ICoreBrowserService)],m)},4725:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const c=o(8343);r.ICharSizeService=(0,c.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),r.IMouseService=(0,c.createDecorator)("MouseService"),r.IRenderService=(0,c.createDecorator)("RenderService"),r.ISelectionService=(0,c.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,c.createDecorator)("ThemeService")},6731:function(T,r,o){var c=this&&this.__decorate||function(m,a,g,y){var k,b=arguments.length,L=b<3?a:y===null?y=Object.getOwnPropertyDescriptor(a,g):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(m,a,g,y);else for(var B=m.length-1;B>=0;B--)(k=m[B])&&(L=(b<3?k(L):b>3?k(a,g,L):k(a,g))||L);return b>3&&L&&Object.defineProperty(a,g,L),L},f=this&&this.__param||function(m,a){return function(g,y){a(g,y,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const n=o(7239),d=o(8055),u=o(8460),v=o(844),h=o(2585),e=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),t=d.css.toColor("#ffffff"),i=d.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],a=[0,95,135,175,215,255];for(let g=0;g<216;g++){const y=a[g/36%6|0],k=a[g/6%6|0],b=a[g%6];m.push({css:d.channels.toCss(y,k,b),rgba:d.channels.toRgba(y,k,b)})}for(let g=0;g<24;g++){const y=8+10*g;m.push({css:d.channels.toCss(y,y,y),rgba:d.channels.toRgba(y,y,y)})}return m})());let _=r.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new u.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:s,cursor:t,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:l,selectionBackgroundOpaque:d.color.blend(s,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:d.color.blend(s,l),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(m={}){const a=this._colors;if(a.foreground=p(m.foreground,e),a.background=p(m.background,s),a.cursor=p(m.cursor,t),a.cursorAccent=p(m.cursorAccent,i),a.selectionBackgroundTransparent=p(m.selectionBackground,l),a.selectionBackgroundOpaque=d.color.blend(a.background,a.selectionBackgroundTransparent),a.selectionInactiveBackgroundTransparent=p(m.selectionInactiveBackground,a.selectionBackgroundTransparent),a.selectionInactiveBackgroundOpaque=d.color.blend(a.background,a.selectionInactiveBackgroundTransparent),a.selectionForeground=m.selectionForeground?p(m.selectionForeground,d.NULL_COLOR):void 0,a.selectionForeground===d.NULL_COLOR&&(a.selectionForeground=void 0),d.color.isOpaque(a.selectionBackgroundTransparent)&&(a.selectionBackgroundTransparent=d.color.opacity(a.selectionBackgroundTransparent,.3)),d.color.isOpaque(a.selectionInactiveBackgroundTransparent)&&(a.selectionInactiveBackgroundTransparent=d.color.opacity(a.selectionInactiveBackgroundTransparent,.3)),a.ansi=r.DEFAULT_ANSI_COLORS.slice(),a.ansi[0]=p(m.black,r.DEFAULT_ANSI_COLORS[0]),a.ansi[1]=p(m.red,r.DEFAULT_ANSI_COLORS[1]),a.ansi[2]=p(m.green,r.DEFAULT_ANSI_COLORS[2]),a.ansi[3]=p(m.yellow,r.DEFAULT_ANSI_COLORS[3]),a.ansi[4]=p(m.blue,r.DEFAULT_ANSI_COLORS[4]),a.ansi[5]=p(m.magenta,r.DEFAULT_ANSI_COLORS[5]),a.ansi[6]=p(m.cyan,r.DEFAULT_ANSI_COLORS[6]),a.ansi[7]=p(m.white,r.DEFAULT_ANSI_COLORS[7]),a.ansi[8]=p(m.brightBlack,r.DEFAULT_ANSI_COLORS[8]),a.ansi[9]=p(m.brightRed,r.DEFAULT_ANSI_COLORS[9]),a.ansi[10]=p(m.brightGreen,r.DEFAULT_ANSI_COLORS[10]),a.ansi[11]=p(m.brightYellow,r.DEFAULT_ANSI_COLORS[11]),a.ansi[12]=p(m.brightBlue,r.DEFAULT_ANSI_COLORS[12]),a.ansi[13]=p(m.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),a.ansi[14]=p(m.brightCyan,r.DEFAULT_ANSI_COLORS[14]),a.ansi[15]=p(m.brightWhite,r.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const g=Math.min(a.ansi.length-16,m.extendedAnsi.length);for(let y=0;y<g;y++)a.ansi[y+16]=p(m.extendedAnsi[y],r.DEFAULT_ANSI_COLORS[y+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[m]=this._restoreColors.ansi[m]}else for(let a=0;a<this._restoreColors.ansi.length;++a)this._colors.ansi[a]=this._restoreColors.ansi[a]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function p(m,a){if(m!==void 0)try{return d.css.toColor(m)}catch(g){}return a}r.ThemeService=_=c([f(0,h.IOptionsService)],_)},6349:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=o(8460),f=o(844);class n extends f.Disposable{constructor(u){super(),this._maxLength=u,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(u){if(this._maxLength===u)return;const v=new Array(u);for(let h=0;h<Math.min(u,this.length);h++)v[h]=this._array[this._getCyclicIndex(h)];this._array=v,this._maxLength=u,this._startIndex=0}get length(){return this._length}set length(u){if(u>this._length)for(let v=this._length;v<u;v++)this._array[v]=void 0;this._length=u}get(u){return this._array[this._getCyclicIndex(u)]}set(u,v){this._array[this._getCyclicIndex(u)]=v}push(u){this._array[this._getCyclicIndex(this._length)]=u,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(u,v,...h){if(v){for(let e=u;e<this._length-v;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+v)];this._length-=v,this.onDeleteEmitter.fire({index:u,amount:v})}for(let e=this._length-1;e>=u;e--)this._array[this._getCyclicIndex(e+h.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<h.length;e++)this._array[this._getCyclicIndex(u+e)]=h[e];if(h.length&&this.onInsertEmitter.fire({index:u,amount:h.length}),this._length+h.length>this._maxLength){const e=this._length+h.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=h.length}trimStart(u){u>this._length&&(u=this._length),this._startIndex+=u,this._length-=u,this.onTrimEmitter.fire(u)}shiftElements(u,v,h){if(!(v<=0)){if(u<0||u>=this._length)throw new Error("start argument out of range");if(u+h<0)throw new Error("Cannot shift elements in list beyond index 0");if(h>0){for(let s=v-1;s>=0;s--)this.set(u+s+h,this.get(u+s));const e=u+v+h-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<v;e++)this.set(u+e+h,this.get(u+e))}}_getCyclicIndex(u){return(this._startIndex+u)%this._maxLength}}r.CircularList=n},1439:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(c,f=5){if(typeof c!="object")return c;const n=Array.isArray(c)?[]:{};for(const d in c)n[d]=f<=1?c[d]:c[d]&&o(c[d],f-1);return n}},8055:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const c=o(6114);let f=0,n=0,d=0,u=0;var v,h,e,s,t;function i(_){const p=_.toString(16);return p.length<2?"0"+p:p}function l(_,p){return _<p?(p+.05)/(_+.05):(_+.05)/(p+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(p,m,a,g){return g!==void 0?"#".concat(i(p)).concat(i(m)).concat(i(a)).concat(i(g)):"#".concat(i(p)).concat(i(m)).concat(i(a))},_.toRgba=function(p,m,a,g=255){return(p<<24|m<<16|a<<8|g)>>>0}})(v||(r.channels=v={})),(function(_){function p(m,a){return u=Math.round(255*a),[f,n,d]=t.toChannels(m.rgba),{css:v.toCss(f,n,d,u),rgba:v.toRgba(f,n,d,u)}}_.blend=function(m,a){if(u=(255&a.rgba)/255,u===1)return{css:a.css,rgba:a.rgba};const g=a.rgba>>24&255,y=a.rgba>>16&255,k=a.rgba>>8&255,b=m.rgba>>24&255,L=m.rgba>>16&255,B=m.rgba>>8&255;return f=b+Math.round((g-b)*u),n=L+Math.round((y-L)*u),d=B+Math.round((k-B)*u),{css:v.toCss(f,n,d),rgba:v.toRgba(f,n,d)}},_.isOpaque=function(m){return(255&m.rgba)==255},_.ensureContrastRatio=function(m,a,g){const y=t.ensureContrastRatio(m.rgba,a.rgba,g);if(y)return t.toColor(y>>24&255,y>>16&255,y>>8&255)},_.opaque=function(m){const a=(255|m.rgba)>>>0;return[f,n,d]=t.toChannels(a),{css:v.toCss(f,n,d),rgba:a}},_.opacity=p,_.multiplyOpacity=function(m,a){return u=255&m.rgba,p(m,u*a/255)},_.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}})(h||(r.color=h={})),(function(_){let p,m;if(!c.isNode){const a=document.createElement("canvas");a.width=1,a.height=1;const g=a.getContext("2d",{willReadFrequently:!0});g&&(p=g,p.globalCompositeOperation="copy",m=p.createLinearGradient(0,0,1,1))}_.toColor=function(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return f=parseInt(a.slice(1,2).repeat(2),16),n=parseInt(a.slice(2,3).repeat(2),16),d=parseInt(a.slice(3,4).repeat(2),16),t.toColor(f,n,d);case 5:return f=parseInt(a.slice(1,2).repeat(2),16),n=parseInt(a.slice(2,3).repeat(2),16),d=parseInt(a.slice(3,4).repeat(2),16),u=parseInt(a.slice(4,5).repeat(2),16),t.toColor(f,n,d,u);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}const g=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return f=parseInt(g[1]),n=parseInt(g[2]),d=parseInt(g[3]),u=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),t.toColor(f,n,d,u);if(!p||!m)throw new Error("css.toColor: Unsupported css format");if(p.fillStyle=m,p.fillStyle=a,typeof p.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(p.fillRect(0,0,1,1),[f,n,d,u]=p.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(f,n,d,u),css:a}}})(e||(r.css=e={})),(function(_){function p(m,a,g){const y=m/255,k=a/255,b=g/255;return .2126*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))+.7152*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.0722*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))}_.relativeLuminance=function(m){return p(m>>16&255,m>>8&255,255&m)},_.relativeLuminance2=p})(s||(r.rgb=s={})),(function(_){function p(a,g,y){const k=a>>24&255,b=a>>16&255,L=a>>8&255;let B=g>>24&255,M=g>>16&255,P=g>>8&255,F=l(s.relativeLuminance2(B,M,P),s.relativeLuminance2(k,b,L));for(;F<y&&(B>0||M>0||P>0);)B-=Math.max(0,Math.ceil(.1*B)),M-=Math.max(0,Math.ceil(.1*M)),P-=Math.max(0,Math.ceil(.1*P)),F=l(s.relativeLuminance2(B,M,P),s.relativeLuminance2(k,b,L));return(B<<24|M<<16|P<<8|255)>>>0}function m(a,g,y){const k=a>>24&255,b=a>>16&255,L=a>>8&255;let B=g>>24&255,M=g>>16&255,P=g>>8&255,F=l(s.relativeLuminance2(B,M,P),s.relativeLuminance2(k,b,L));for(;F<y&&(B<255||M<255||P<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),M=Math.min(255,M+Math.ceil(.1*(255-M))),P=Math.min(255,P+Math.ceil(.1*(255-P))),F=l(s.relativeLuminance2(B,M,P),s.relativeLuminance2(k,b,L));return(B<<24|M<<16|P<<8|255)>>>0}_.ensureContrastRatio=function(a,g,y){const k=s.relativeLuminance(a>>8),b=s.relativeLuminance(g>>8);if(l(k,b)<y){if(b<k){const M=p(a,g,y),P=l(k,s.relativeLuminance(M>>8));if(P<y){const F=m(a,g,y);return P>l(k,s.relativeLuminance(F>>8))?M:F}return M}const L=m(a,g,y),B=l(k,s.relativeLuminance(L>>8));if(B<y){const M=p(a,g,y);return B>l(k,s.relativeLuminance(M>>8))?L:M}return L}},_.reduceLuminance=p,_.increaseLuminance=m,_.toChannels=function(a){return[a>>24&255,a>>16&255,a>>8&255,255&a]},_.toColor=function(a,g,y,k){return{css:v.toCss(a,g,y,k),rgba:v.toRgba(a,g,y,k)}}})(t||(r.rgba=t={})),r.toPaddedHex=i,r.contrastRatio=l},8969:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=o(844),f=o(2585),n=o(4348),d=o(7866),u=o(744),v=o(7302),h=o(6975),e=o(8460),s=o(1753),t=o(1480),i=o(7994),l=o(9282),_=o(5435),p=o(5981),m=o(2660);let a=!1;class g extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((k=>{var b;(b=this._onScrollApi)==null||b.fire(k.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(k){for(const b in k)this.optionsService.options[b]=k[b]}constructor(k){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new v.OptionsService(k)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(u.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(h.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(t.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((b=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((b=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new p.WriteBuffer(((b,L)=>this._inputHandler.parse(b,L)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(k,b){this._writeBuffer.write(k,b)}writeSync(k,b){this._logService.logLevel<=f.LogLevelEnum.WARN&&!a&&(this._logService.warn("writeSync is unreliable and will be removed soon."),a=!0),this._writeBuffer.writeSync(k,b)}resize(k,b){isNaN(k)||isNaN(b)||(k=Math.max(k,u.MINIMUM_COLS),b=Math.max(b,u.MINIMUM_ROWS),this._bufferService.resize(k,b))}scroll(k,b=!1){this._bufferService.scroll(k,b)}scrollLines(k,b,L){this._bufferService.scrollLines(k,b,L)}scrollPages(k){this.scrollLines(k*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(k){const b=k-this._bufferService.buffer.ydisp;b!==0&&this.scrollLines(b)}registerEscHandler(k,b){return this._inputHandler.registerEscHandler(k,b)}registerDcsHandler(k,b){return this._inputHandler.registerDcsHandler(k,b)}registerCsiHandler(k,b){return this._inputHandler.registerCsiHandler(k,b)}registerOscHandler(k,b){return this._inputHandler.registerOscHandler(k,b)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let k=!1;const b=this.optionsService.rawOptions.windowsPty;b&&b.buildNumber!==void 0&&b.buildNumber!==void 0?k=b.backend==="conpty"&&b.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(k=!0),k?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const k=[];k.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),k.push(this.registerCsiHandler({final:"H"},(()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const b of k)b.dispose()}))}}}r.CoreTerminal=g},8460:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const f=[];for(let n=0;n<this._listeners.length;n++)f.push(this._listeners[n]);for(let n=0;n<f.length;n++)f[n].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(o,c){return o((f=>c.fire(f)))},r.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},5435:function(T,r,o){var c=this&&this.__decorate||function(W,S,w,E){var D,I=arguments.length,H=I<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(W,S,w,E);else for(var N=W.length-1;N>=0;N--)(D=W[N])&&(H=(I<3?D(H):I>3?D(S,w,H):D(S,w))||H);return I>3&&H&&Object.defineProperty(S,w,H),H},f=this&&this.__param||function(W,S){return function(w,E){S(w,E,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const n=o(2584),d=o(7116),u=o(2015),v=o(844),h=o(482),e=o(8437),s=o(8460),t=o(643),i=o(511),l=o(3734),_=o(2585),p=o(1480),m=o(6242),a=o(6351),g=o(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},k=131072;function b(W,S){if(W>24)return S.setWinLines||!1;switch(W){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var L;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(L||(r.WindowsOptionsReportType=L={}));let B=0;class M extends v.Disposable{getAttrData(){return this._curAttrData}constructor(S,w,E,D,I,H,N,x,A=new u.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=w,this._coreService=E,this._logService=D,this._optionsService=I,this._oscLinkService=H,this._coreMouseService=N,this._unicodeService=x,this._parser=A,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new h.StringToUtf32,this._utf8Decoder=new h.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((C=>this._activeBuffer=C.activeBuffer))),this._parser.setCsiHandlerFallback(((C,O)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(C),params:O.toArray()})})),this._parser.setEscHandlerFallback((C=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(C)})})),this._parser.setExecuteHandlerFallback((C=>{this._logService.debug("Unknown EXECUTE code: ",{code:C})})),this._parser.setOscHandlerFallback(((C,O,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:C,action:O,data:U})})),this._parser.setDcsHandlerFallback(((C,O,U)=>{O==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(C),action:O,payload:U})})),this._parser.setPrintHandler(((C,O,U)=>this.print(C,O,U))),this._parser.registerCsiHandler({final:"@"},(C=>this.insertChars(C))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(C=>this.scrollLeft(C))),this._parser.registerCsiHandler({final:"A"},(C=>this.cursorUp(C))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(C=>this.scrollRight(C))),this._parser.registerCsiHandler({final:"B"},(C=>this.cursorDown(C))),this._parser.registerCsiHandler({final:"C"},(C=>this.cursorForward(C))),this._parser.registerCsiHandler({final:"D"},(C=>this.cursorBackward(C))),this._parser.registerCsiHandler({final:"E"},(C=>this.cursorNextLine(C))),this._parser.registerCsiHandler({final:"F"},(C=>this.cursorPrecedingLine(C))),this._parser.registerCsiHandler({final:"G"},(C=>this.cursorCharAbsolute(C))),this._parser.registerCsiHandler({final:"H"},(C=>this.cursorPosition(C))),this._parser.registerCsiHandler({final:"I"},(C=>this.cursorForwardTab(C))),this._parser.registerCsiHandler({final:"J"},(C=>this.eraseInDisplay(C,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(C=>this.eraseInDisplay(C,!0))),this._parser.registerCsiHandler({final:"K"},(C=>this.eraseInLine(C,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(C=>this.eraseInLine(C,!0))),this._parser.registerCsiHandler({final:"L"},(C=>this.insertLines(C))),this._parser.registerCsiHandler({final:"M"},(C=>this.deleteLines(C))),this._parser.registerCsiHandler({final:"P"},(C=>this.deleteChars(C))),this._parser.registerCsiHandler({final:"S"},(C=>this.scrollUp(C))),this._parser.registerCsiHandler({final:"T"},(C=>this.scrollDown(C))),this._parser.registerCsiHandler({final:"X"},(C=>this.eraseChars(C))),this._parser.registerCsiHandler({final:"Z"},(C=>this.cursorBackwardTab(C))),this._parser.registerCsiHandler({final:"`"},(C=>this.charPosAbsolute(C))),this._parser.registerCsiHandler({final:"a"},(C=>this.hPositionRelative(C))),this._parser.registerCsiHandler({final:"b"},(C=>this.repeatPrecedingCharacter(C))),this._parser.registerCsiHandler({final:"c"},(C=>this.sendDeviceAttributesPrimary(C))),this._parser.registerCsiHandler({prefix:">",final:"c"},(C=>this.sendDeviceAttributesSecondary(C))),this._parser.registerCsiHandler({final:"d"},(C=>this.linePosAbsolute(C))),this._parser.registerCsiHandler({final:"e"},(C=>this.vPositionRelative(C))),this._parser.registerCsiHandler({final:"f"},(C=>this.hVPosition(C))),this._parser.registerCsiHandler({final:"g"},(C=>this.tabClear(C))),this._parser.registerCsiHandler({final:"h"},(C=>this.setMode(C))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(C=>this.setModePrivate(C))),this._parser.registerCsiHandler({final:"l"},(C=>this.resetMode(C))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(C=>this.resetModePrivate(C))),this._parser.registerCsiHandler({final:"m"},(C=>this.charAttributes(C))),this._parser.registerCsiHandler({final:"n"},(C=>this.deviceStatus(C))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(C=>this.deviceStatusPrivate(C))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(C=>this.softReset(C))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(C=>this.setCursorStyle(C))),this._parser.registerCsiHandler({final:"r"},(C=>this.setScrollRegion(C))),this._parser.registerCsiHandler({final:"s"},(C=>this.saveCursor(C))),this._parser.registerCsiHandler({final:"t"},(C=>this.windowOptions(C))),this._parser.registerCsiHandler({final:"u"},(C=>this.restoreCursor(C))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(C=>this.insertColumns(C))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(C=>this.deleteColumns(C))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(C=>this.selectProtected(C))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(C=>this.requestMode(C,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(C=>this.requestMode(C,!1))),this._parser.setExecuteHandler(n.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(n.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(n.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(n.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(n.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(n.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(n.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(n.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(n.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new m.OscHandler((C=>(this.setTitle(C),this.setIconName(C),!0)))),this._parser.registerOscHandler(1,new m.OscHandler((C=>this.setIconName(C)))),this._parser.registerOscHandler(2,new m.OscHandler((C=>this.setTitle(C)))),this._parser.registerOscHandler(4,new m.OscHandler((C=>this.setOrReportIndexedColor(C)))),this._parser.registerOscHandler(8,new m.OscHandler((C=>this.setHyperlink(C)))),this._parser.registerOscHandler(10,new m.OscHandler((C=>this.setOrReportFgColor(C)))),this._parser.registerOscHandler(11,new m.OscHandler((C=>this.setOrReportBgColor(C)))),this._parser.registerOscHandler(12,new m.OscHandler((C=>this.setOrReportCursorColor(C)))),this._parser.registerOscHandler(104,new m.OscHandler((C=>this.restoreIndexedColor(C)))),this._parser.registerOscHandler(110,new m.OscHandler((C=>this.restoreFgColor(C)))),this._parser.registerOscHandler(111,new m.OscHandler((C=>this.restoreBgColor(C)))),this._parser.registerOscHandler(112,new m.OscHandler((C=>this.restoreCursorColor(C)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const C in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:C},(()=>this.selectCharset("("+C))),this._parser.registerEscHandler({intermediates:")",final:C},(()=>this.selectCharset(")"+C))),this._parser.registerEscHandler({intermediates:"*",final:C},(()=>this.selectCharset("*"+C))),this._parser.registerEscHandler({intermediates:"+",final:C},(()=>this.selectCharset("+"+C))),this._parser.registerEscHandler({intermediates:"-",final:C},(()=>this.selectCharset("-"+C))),this._parser.registerEscHandler({intermediates:".",final:C},(()=>this.selectCharset("."+C))),this._parser.registerEscHandler({intermediates:"/",final:C},(()=>this.selectCharset("/"+C)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((C=>(this._logService.error("Parsing error: ",C),C))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new a.DcsHandler(((C,O)=>this.requestStatusString(C,O))))}_preserveStack(S,w,E,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=w,this._parseStack.decodedLength=E,this._parseStack.position=D}_logSlowResolvingAsync(S){this._logService.logLevel<=_.LogLevelEnum.WARN&&Promise.race([S,new Promise(((w,E)=>setTimeout((()=>E("#SLOW_TIMEOUT")),5e3)))]).catch((w=>{if(w!=="#SLOW_TIMEOUT")throw w;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,w){let E,D=this._activeBuffer.x,I=this._activeBuffer.y,H=0;const N=this._parseStack.paused;if(N){if(E=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,w))return this._logSlowResolvingAsync(E),E;D=this._parseStack.cursorStartX,I=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>k&&(H=this._parseStack.position+k)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?' "'.concat(S,'"'):' "'.concat(Array.prototype.map.call(S,(C=>String.fromCharCode(C))).join(""),'"')),typeof S=="string"?S.split("").map((C=>C.charCodeAt(0))):S),this._parseBuffer.length<S.length&&this._parseBuffer.length<k&&(this._parseBuffer=new Uint32Array(Math.min(S.length,k))),N||this._dirtyRowTracker.clearRange(),S.length>k)for(let C=H;C<S.length;C+=k){const O=C+k<S.length?C+k:S.length,U=typeof S=="string"?this._stringDecoder.decode(S.substring(C,O),this._parseBuffer):this._utf8Decoder.decode(S.subarray(C,O),this._parseBuffer);if(E=this._parser.parse(this._parseBuffer,U))return this._preserveStack(D,I,U,C),this._logSlowResolvingAsync(E),E}else if(!N){const C=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(E=this._parser.parse(this._parseBuffer,C))return this._preserveStack(D,I,C,0),this._logSlowResolvingAsync(E),E}this._activeBuffer.x===D&&this._activeBuffer.y===I||this._onCursorMove.fire();const x=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),A=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);A<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(A,this._bufferService.rows-1),Math.min(x,this._bufferService.rows-1))}print(S,w,E){let D,I;const H=this._charsetService.charset,N=this._optionsService.rawOptions.screenReaderMode,x=this._bufferService.cols,A=this._coreService.decPrivateModes.wraparound,C=this._coreService.modes.insertMode,O=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&E-w>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodePoint(this._activeBuffer.x-1,0,1,O.fg,O.bg,O.extended);let R=this._parser.precedingJoinState;for(let X=w;X<E;++X){if(D=S[X],D<127&&H){const Q=H[String.fromCharCode(D)];Q&&(D=Q.charCodeAt(0))}const j=this._unicodeService.charProperties(D,R);I=p.UnicodeService.extractWidth(j);const G=p.UnicodeService.extractShouldJoin(j),J=G?p.UnicodeService.extractWidth(R):0;if(R=j,N&&this._onA11yChar.fire((0,h.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+I-J>x){if(A){const Q=U;let $=this._activeBuffer.x-J;for(this._activeBuffer.x=J,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),J>0&&U instanceof e.BufferLine&&U.copyCellsFrom(Q,$,0,J,!1);$<x;)Q.setCellFromCodePoint($++,0,1,O.fg,O.bg,O.extended)}else if(this._activeBuffer.x=x-1,I===2)continue}if(G&&this._activeBuffer.x){const Q=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-Q,D,I);for(let $=I-J;--$>=0;)U.setCellFromCodePoint(this._activeBuffer.x++,0,0,O.fg,O.bg,O.extended)}else if(C&&(U.insertCells(this._activeBuffer.x,I-J,this._activeBuffer.getNullCell(O),O),U.getWidth(x-1)===2&&U.setCellFromCodePoint(x-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,O.fg,O.bg,O.extended)),U.setCellFromCodePoint(this._activeBuffer.x++,D,I,O.fg,O.bg,O.extended),I>0)for(;--I;)U.setCellFromCodePoint(this._activeBuffer.x++,0,0,O.fg,O.bg,O.extended)}this._parser.precedingJoinState=R,this._activeBuffer.x<x&&E-w>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodePoint(this._activeBuffer.x,0,1,O.fg,O.bg,O.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,w){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,w):this._parser.registerCsiHandler(S,(E=>!b(E.params[0],this._optionsService.rawOptions.windowOptions)||w(E)))}registerDcsHandler(S,w){return this._parser.registerDcsHandler(S,new a.DcsHandler(w))}registerEscHandler(S,w){return this._parser.registerEscHandler(S,w)}registerOscHandler(S,w){return this._parser.registerOscHandler(S,new m.OscHandler(w))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var S;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&S.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);w.hasWidth(this._activeBuffer.x)&&!w.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const S=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-S),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(S=this._bufferService.cols-1){this._activeBuffer.x=Math.min(S,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(S,w){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+w):(this._activeBuffer.x=S,this._activeBuffer.y=w),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,w){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+w)}cursorUp(S){const w=this._activeBuffer.y-this._activeBuffer.scrollTop;return w>=0?this._moveCursor(0,-Math.min(w,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){const w=this._activeBuffer.scrollBottom-this._activeBuffer.y;return w>=0?this._moveCursor(0,Math.min(w,S.params[0]||1)):this._moveCursor(0,S.params[0]||1),!0}cursorForward(S){return this._moveCursor(S.params[0]||1,0),!0}cursorBackward(S){return this._moveCursor(-(S.params[0]||1),0),!0}cursorNextLine(S){return this.cursorDown(S),this._activeBuffer.x=0,!0}cursorPrecedingLine(S){return this.cursorUp(S),this._activeBuffer.x=0,!0}cursorCharAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(S){return this._setCursor(S.length>=2?(S.params[1]||1)-1:0,(S.params[0]||1)-1),!0}charPosAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(S){return this._moveCursor(S.params[0]||1,0),!0}linePosAbsolute(S){return this._setCursor(this._activeBuffer.x,(S.params[0]||1)-1),!0}vPositionRelative(S){return this._moveCursor(0,S.params[0]||1),!0}hVPosition(S){return this.cursorPosition(S),!0}tabClear(S){const w=S.params[0];return w===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:w===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=S.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=S.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){const w=S.params[0];return w===1&&(this._curAttrData.bg|=536870912),w!==2&&w!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,w,E,D=!1,I=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);H.replaceCells(w,E,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),I),D&&(H.isWrapped=!1)}_resetBufferLine(S,w=!1){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);E&&(E.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),w),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),E.isWrapped=!1)}eraseInDisplay(S,w=!1){let E;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(E=this._activeBuffer.y,this._dirtyRowTracker.markDirty(E),this._eraseInBufferLine(E++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);E<this._bufferService.rows;E++)this._resetBufferLine(E,w);this._dirtyRowTracker.markDirty(E);break;case 1:for(E=this._activeBuffer.y,this._dirtyRowTracker.markDirty(E),this._eraseInBufferLine(E,0,this._activeBuffer.x+1,!0,w),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(E+1).isWrapped=!1);E--;)this._resetBufferLine(E,w);this._dirtyRowTracker.markDirty(0);break;case 2:for(E=this._bufferService.rows,this._dirtyRowTracker.markDirty(E-1);E--;)this._resetBufferLine(E,w);this._dirtyRowTracker.markDirty(0);break;case 3:const D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(S,w=!1){switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,w);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,w)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(S){this._restrictCursor();let w=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,I=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;w--;)this._activeBuffer.lines.splice(I-1,1),this._activeBuffer.lines.splice(E,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let w=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=this._activeBuffer.ybase+this._activeBuffer.y;let D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;w--;)this._activeBuffer.lines.splice(E,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(S){this._restrictCursor();const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.insertCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(S){this._restrictCursor();const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let w=S.params[0]||1;for(;w--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(S){let w=S.params[0]||1;for(;w--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=S.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);D.deleteCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=S.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);D.insertCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=S.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);D.insertCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=S.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);D.deleteCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(S.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(S){const w=this._parser.precedingJoinState;if(!w)return!0;const E=S.params[0]||1,D=p.UnicodeService.extractWidth(w),I=this._activeBuffer.x-D,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(I),N=new Uint32Array(H.length*E);let x=0;for(let C=0;C<H.length;){const O=H.codePointAt(C)||0;N[x++]=O,C+=O>65535?2:1}let A=x;for(let C=1;C<E;++C)N.copyWithin(A,0,x),A+=x;return this.print(N,0,A),!0}sendDeviceAttributesPrimary(S){return S.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(S){return(this._optionsService.rawOptions.termName+"").indexOf(S)===0}setMode(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let w=0;w<S.length;w++)switch(S.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),S.params[w]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(S,w){const E=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:I}=this._coreMouseService,H=this._coreService,{buffers:N,cols:x}=this._bufferService,{active:A,alt:C}=N,O=this._optionsService.rawOptions,U=G=>G?1:2,R=S.params[0];return X=R,j=w?R===2?4:R===4?U(H.modes.insertMode):R===12?3:R===20?U(O.convertEol):0:R===1?U(E.applicationCursorKeys):R===3?O.windowOptions.setWinLines?x===80?2:x===132?1:0:0:R===6?U(E.origin):R===7?U(E.wraparound):R===8?3:R===9?U(D==="X10"):R===12?U(O.cursorBlink):R===25?U(!H.isCursorHidden):R===45?U(E.reverseWraparound):R===66?U(E.applicationKeypad):R===67?4:R===1e3?U(D==="VT200"):R===1002?U(D==="DRAG"):R===1003?U(D==="ANY"):R===1004?U(E.sendFocus):R===1005?4:R===1006?U(I==="SGR"):R===1015?4:R===1016?U(I==="SGR_PIXELS"):R===1048?1:R===47||R===1047||R===1049?U(A===C):R===2004?U(E.bracketedPasteMode):0,H.triggerDataEvent("".concat(n.C0.ESC,"[").concat(w?"":"?").concat(X,";").concat(j,"$y")),!0;var X,j}_updateAttrColor(S,w,E,D,I){return w===2?(S|=50331648,S&=-16777216,S|=l.AttributeData.fromColorRGB([E,D,I])):w===5&&(S&=-50331904,S|=33554432|255&E),S}_extractColor(S,w,E){const D=[0,0,-1,0,0,0];let I=0,H=0;do{if(D[H+I]=S.params[w+H],S.hasSubParams(w+H)){const N=S.getSubParams(w+H);let x=0;do D[1]===5&&(I=1),D[H+x+1+I]=N[x];while(++x<N.length&&x+H+1+I<D.length);break}if(D[1]===5&&H+I>=2||D[1]===2&&H+I>=5)break;D[1]&&(I=1)}while(++H+w<S.length&&H+I<D.length);for(let N=2;N<D.length;++N)D[N]===-1&&(D[N]=0);switch(D[0]){case 38:E.fg=this._updateAttrColor(E.fg,D[1],D[3],D[4],D[5]);break;case 48:E.bg=this._updateAttrColor(E.bg,D[1],D[3],D[4],D[5]);break;case 58:E.extended=E.extended.clone(),E.extended.underlineColor=this._updateAttrColor(E.extended.underlineColor,D[1],D[3],D[4],D[5])}return H}_processUnderline(S,w){w.extended=w.extended.clone(),(!~S||S>5)&&(S=1),w.extended.underlineStyle=S,w.fg|=268435456,S===0&&(w.fg&=-268435457),w.updateExtended()}_processSGR0(S){S.fg=e.DEFAULT_ATTR_DATA.fg,S.bg=e.DEFAULT_ATTR_DATA.bg,S.extended=S.extended.clone(),S.extended.underlineStyle=0,S.extended.underlineColor&=-67108864,S.updateExtended()}charAttributes(S){if(S.length===1&&S.params[0]===0)return this._processSGR0(this._curAttrData),!0;const w=S.length;let E;const D=this._curAttrData;for(let I=0;I<w;I++)E=S.params[I],E>=30&&E<=37?(D.fg&=-50331904,D.fg|=16777216|E-30):E>=40&&E<=47?(D.bg&=-50331904,D.bg|=16777216|E-40):E>=90&&E<=97?(D.fg&=-50331904,D.fg|=16777224|E-90):E>=100&&E<=107?(D.bg&=-50331904,D.bg|=16777224|E-100):E===0?this._processSGR0(D):E===1?D.fg|=134217728:E===3?D.bg|=67108864:E===4?(D.fg|=268435456,this._processUnderline(S.hasSubParams(I)?S.getSubParams(I)[0]:1,D)):E===5?D.fg|=536870912:E===7?D.fg|=67108864:E===8?D.fg|=1073741824:E===9?D.fg|=2147483648:E===2?D.bg|=134217728:E===21?this._processUnderline(2,D):E===22?(D.fg&=-134217729,D.bg&=-134217729):E===23?D.bg&=-67108865:E===24?(D.fg&=-268435457,this._processUnderline(0,D)):E===25?D.fg&=-536870913:E===27?D.fg&=-67108865:E===28?D.fg&=-1073741825:E===29?D.fg&=2147483647:E===39?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):E===49?(D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):E===38||E===48||E===58?I+=this._extractColor(S,I,D):E===53?D.bg|=1073741824:E===55?D.bg&=-1073741825:E===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):E===100?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",E);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent("".concat(n.C0.ESC,"[0n"));break;case 6:const w=this._activeBuffer.y+1,E=this._activeBuffer.x+1;this._coreService.triggerDataEvent("".concat(n.C0.ESC,"[").concat(w,";").concat(E,"R"))}return!0}deviceStatusPrivate(S){if(S.params[0]===6){const w=this._activeBuffer.y+1,E=this._activeBuffer.x+1;this._coreService.triggerDataEvent("".concat(n.C0.ESC,"[?").concat(w,";").concat(E,"R"))}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){const w=S.params[0]||1;switch(w){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const E=w%2==1;return this._optionsService.options.cursorBlink=E,!0}setScrollRegion(S){const w=S.params[0]||1;let E;return(S.length<2||(E=S.params[1])>this._bufferService.rows||E===0)&&(E=this._bufferService.rows),E>w&&(this._activeBuffer.scrollTop=w-1,this._activeBuffer.scrollBottom=E-1,this._setCursor(0,0)),!0}windowOptions(S){if(!b(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;const w=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:w!==2&&this._onRequestWindowsOptionsReport.fire(L.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(L.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent("".concat(n.C0.ESC,"[8;").concat(this._bufferService.rows,";").concat(this._bufferService.cols,"t"));break;case 22:w!==0&&w!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),w!==0&&w!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:w!==0&&w!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),w!==0&&w!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(S){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(S){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(S){return this._windowTitle=S,this._onTitleChange.fire(S),!0}setIconName(S){return this._iconName=S,!0}setOrReportIndexedColor(S){const w=[],E=S.split(";");for(;E.length>1;){const D=E.shift(),I=E.shift();if(/^\d+$/.exec(D)){const H=parseInt(D);if(F(H))if(I==="?")w.push({type:0,index:H});else{const N=(0,g.parseColor)(I);N&&w.push({type:1,index:H,color:N})}}}return w.length&&this._onColor.fire(w),!0}setHyperlink(S){const w=S.split(";");return!(w.length<2)&&(w[1]?this._createHyperlink(w[0],w[1]):!w[0]&&this._finishHyperlink())}_createHyperlink(S,w){this._getCurrentLinkId()&&this._finishHyperlink();const E=S.split(":");let D;const I=E.findIndex((H=>H.startsWith("id=")));return I!==-1&&(D=E[I].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:w}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(S,w){const E=S.split(";");for(let D=0;D<E.length&&!(w>=this._specialColors.length);++D,++w)if(E[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[w]}]);else{const I=(0,g.parseColor)(E[D]);I&&this._onColor.fire([{type:1,index:this._specialColors[w],color:I}])}return!0}setOrReportFgColor(S){return this._setOrReportSpecialColor(S,0)}setOrReportBgColor(S){return this._setOrReportSpecialColor(S,1)}setOrReportCursorColor(S){return this._setOrReportSpecialColor(S,2)}restoreIndexedColor(S){if(!S)return this._onColor.fire([{type:2}]),!0;const w=[],E=S.split(";");for(let D=0;D<E.length;++D)if(/^\d+$/.exec(E[D])){const I=parseInt(E[D]);F(I)&&w.push({type:2,index:I})}return w.length&&this._onColor.fire(w),!0}restoreFgColor(S){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(S){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(S){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(S){return S.length!==2?(this.selectDefaultCharset(),!0):(S[0]==="/"||this._charsetService.setgCharset(y[S[0]],d.CHARSETS[S[1]]||d.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const S=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,S,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(S){return this._charsetService.setgLevel(S),!0}screenAlignmentPattern(){const S=new i.CellData;S.content=4194373,S.fg=this._curAttrData.fg,S.bg=this._curAttrData.bg,this._setCursor(0,0);for(let w=0;w<this._bufferService.rows;++w){const E=this._activeBuffer.ybase+this._activeBuffer.y+w,D=this._activeBuffer.lines.get(E);D&&(D.fill(S),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,w){const E=this._bufferService.buffer,D=this._optionsService.rawOptions;return(I=>(this._coreService.triggerDataEvent("".concat(n.C0.ESC).concat(I).concat(n.C0.ESC,"\\")),!0))(S==='"q'?"P1$r".concat(this._curAttrData.isProtected()?1:0,'"q'):S==='"p'?'P1$r61;1"p':S==="r"?"P1$r".concat(E.scrollTop+1,";").concat(E.scrollBottom+1,"r"):S==="m"?"P1$r0m":S===" q"?"P1$r".concat({block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)," q"):"P0$r")}markRangeDirty(S,w){this._dirtyRowTracker.markRangeDirty(S,w)}}r.InputHandler=M;let P=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,S){W>S&&(B=W,W=S,S=B),W<this.start&&(this.start=W),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(W){return 0<=W&&W<256}P=c([f(0,_.IBufferService)],P)},844:(T,r)=>{function o(c){for(const f of c)f.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var f;this._isDisposed||c===this._value||((f=this._value)==null||f.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=o,r.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,n,d){this._data[f]||(this._data[f]={}),this._data[f][n]=d}get(f,n){return this._data[f]?this._data[f][n]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(c,f,n,d,u){this._data.get(c,f)||this._data.set(c,f,new o),this._data.get(c,f).set(n,d,u)}get(c,f,n,d){var u;return(u=this._data.get(c,f))==null?void 0:u.get(n,d)}clear(){this._data.clear()}}},6114:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u";const o=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;const f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),r.isIpad=c==="iPad",r.isIphone=c==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),r.isLinux=c.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(o)},6106:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const f=this._getKey(c);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,f){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let f=0,n=this._array.length-1;for(;n>=f;){let d=f+n>>1;const u=this._getKey(this._array[d]);if(u>c)n=d-1;else{if(!(u<c)){for(;d>0&&this._getKey(this._array[d-1])===c;)d--;return d}f=d+1}}return f}}},7226:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(u){this._tasks.push(u),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(u){this._idleCallback=void 0;let v=0,h=0,e=u.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),h=Math.max(v,h),s=u.timeRemaining(),1.5*h>s)return e-v<-20&&console.warn("task queue exceeded allotted deadline by ".concat(Math.abs(Math.round(e-v)),"ms")),void this._start();e=s}this.clear()}}class n extends f{_requestCallback(u){return setTimeout((()=>u(this._createDeadline(16))))}_cancelCallback(u){clearTimeout(u)}_createDeadline(u){const v=Date.now()+u;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const c=o(643);r.updateWindowsModeWrappedState=function(f){const n=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),d=n==null?void 0:n.get(f.cols-1),u=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);u&&d&&(u.isWrapped=d[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&d[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new o;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}constructor(n=0,d=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=d}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const c=o(6349),f=o(7226),n=o(3734),d=o(8437),u=o(4634),v=o(511),h=o(643),e=o(4863),s=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,i,l){this._hasScrollback=t,this._optionsService=i,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,i){return new d.BufferLine(this._bufferService.cols,this.getNullCell(t),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;const i=t+this._optionsService.rawOptions.scrollback;return i>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=d.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,i){const l=this.getNullCell(d.DEFAULT_ATTR_DATA);let _=0;const p=this._getCorrectBufferLength(i);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<t)for(let a=0;a<this.lines.length;a++)_+=+this.lines.get(a).resize(t,l);let m=0;if(this._rows<i)for(let a=this._rows;a<i;a++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(t,l)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(t,l)));else for(let a=this._rows;a>i;a--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){const a=this.lines.length-p;a>0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=p}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,i-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(t,i),this._cols>t))for(let m=0;m<this.lines.length;m++)_+=+this.lines.get(m).resize(t,l);this._cols=t,this._rows=i,this._memoryCleanupQueue.clear(),_>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>100)return!0;return t}get _isReflowEnabled(){const t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,i){this._cols!==t&&(t>this._cols?this._reflowLarger(t,i):this._reflowSmaller(t,i))}_reflowLarger(t,i){const l=(0,u.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(l.length>0){const _=(0,u.reflowLargerCreateNewLayout)(this.lines,l);(0,u.reflowLargerApplyNewLayout)(this.lines,_.layout),this._reflowLargerAdjustViewport(t,i,_.countRemoved)}}_reflowLargerAdjustViewport(t,i,l){const _=this.getNullCell(d.DEFAULT_ATTR_DATA);let p=l;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new d.BufferLine(t,_))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)}_reflowSmaller(t,i){const l=this.getNullCell(d.DEFAULT_ATTR_DATA),_=[];let p=0;for(let m=this.lines.length-1;m>=0;m--){let a=this.lines.get(m);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;const g=[a];for(;a.isWrapped&&m>0;)a=this.lines.get(--m),g.unshift(a);const y=this.ybase+this.y;if(y>=m&&y<m+g.length)continue;const k=g[g.length-1].getTrimmedLength(),b=(0,u.reflowSmallerGetNewLineLengths)(g,this._cols,t),L=b.length-g.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+L):Math.max(0,this.lines.length-this.lines.maxLength+L);const M=[];for(let E=0;E<L;E++){const D=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);M.push(D)}M.length>0&&(_.push({start:m+g.length+p,newLines:M}),p+=M.length),g.push(...M);let P=b.length-1,F=b[P];F===0&&(P--,F=b[P]);let W=g.length-L-1,S=k;for(;W>=0;){const E=Math.min(S,F);if(g[P]===void 0)break;if(g[P].copyCellsFrom(g[W],S-E,F-E,E,!0),F-=E,F===0&&(P--,F=b[P]),S-=E,S===0){W--;const D=Math.max(W,0);S=(0,u.getWrappedLineTrimmedLength)(g,D,this._cols)}}for(let E=0;E<g.length;E++)b[E]<t&&g[E].setCell(b[E],l);let w=L-B;for(;w-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+L,this.ybase+i-1)}if(_.length>0){const m=[],a=[];for(let P=0;P<this.lines.length;P++)a.push(this.lines.get(P));const g=this.lines.length;let y=g-1,k=0,b=_[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let L=0;for(let P=Math.min(this.lines.maxLength-1,g+p-1);P>=0;P--)if(b&&b.start>y+L){for(let F=b.newLines.length-1;F>=0;F--)this.lines.set(P--,b.newLines[F]);P++,m.push({index:y+1,amount:b.newLines.length}),L+=b.newLines.length,b=_[++k]}else this.lines.set(P,a[y--]);let B=0;for(let P=m.length-1;P>=0;P--)m[P].index+=B,this.lines.onInsertEmitter.fire(m[P]),B+=m[P].amount;const M=Math.max(0,g+p-this.lines.maxLength);M>0&&this.lines.onTrimEmitter.fire(M)}}translateBufferLineToString(t,i,l=0,_){const p=this.lines.get(t);return p?p.translateToString(i,l,_):""}getWrappedRangeForLine(t){let i=t,l=t;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:i,last:l}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===t&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose(),this.markers.splice(t--,1);this._isClearing=!1}addMarker(t){const i=new e.Marker(t);return this.markers.push(i),i.register(this.lines.onTrim((l=>{i.line-=l,i.line<0&&i.dispose()}))),i.register(this.lines.onInsert((l=>{i.line>=l.index&&(i.line+=l.amount)}))),i.register(this.lines.onDelete((l=>{i.line>=l.index&&i.line<l.index+l.amount&&i.dispose(),i.line>l.index&&(i.line-=l.amount)}))),i.register(i.onDispose((()=>this._removeMarker(i)))),i}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}}},8437:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const c=o(3734),f=o(511),n=o(643),d=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let u=0;class v{constructor(e,s,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const i=s||f.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let l=0;l<e;++l)this.setCell(l,i);this.length=e}get(e){const s=this._data[3*e+0],t=2097151&s;return[this._data[3*e+1],2097152&s?this._combined[e]:t?(0,d.stringFromCodePoint)(t):"",s>>22,2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,s){this._data[3*e+1]=s[n.CHAR_DATA_ATTR_INDEX],s[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=s[1],this._data[3*e+0]=2097152|e|s[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=s[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&s}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e]:2097151&s?(0,d.stringFromCodePoint)(2097151&s):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,s){return u=3*e,s.content=this._data[u+0],s.fg=this._data[u+1],s.bg=this._data[u+2],2097152&s.content&&(s.combinedData=this._combined[e]),268435456&s.bg&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){2097152&s.content&&(this._combined[e]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=s.content,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}setCellFromCodePoint(e,s,t,i,l,_){268435456&l&&(this._extendedAttrs[e]=_),this._data[3*e+0]=s|t<<22,this._data[3*e+1]=i,this._data[3*e+2]=l}addCodepointToCell(e,s,t){let i=this._data[3*e+0];2097152&i?this._combined[e]+=(0,d.stringFromCodePoint)(s):2097151&i?(this._combined[e]=(0,d.stringFromCodePoint)(2097151&i)+(0,d.stringFromCodePoint)(s),i&=-2097152,i|=2097152):i=s|4194304,t&&(i&=-12582913,i|=t<<22),this._data[3*e+0]=i}insertCells(e,s,t,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs),s<this.length-e){const l=new f.CellData;for(let _=this.length-e-s-1;_>=0;--_)this.setCell(e+s+_,this.loadCell(e+_,l));for(let _=0;_<s;++_)this.setCell(e+_,t)}else for(let l=e;l<this.length;++l)this.setCell(l,t);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs)}deleteCells(e,s,t,i){if(e%=this.length,s<this.length-e){const l=new f.CellData;for(let _=0;_<this.length-e-s;++_)this.setCell(e+_,this.loadCell(e+s+_,l));for(let _=this.length-s;_<this.length;++_)this.setCell(_,t)}else for(let l=e;l<this.length;++l)this.setCell(l,t);e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs)}replaceCells(e,s,t,i,l=!1){if(l)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodePoint(s,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs);e<s&&e<this.length;)this.isProtected(e)||this.setCell(e,t),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new c.ExtendedAttrs);e<s&&e<this.length;)this.setCell(e++,t)}resize(e,s){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const t=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*t)this._data=new Uint32Array(this._data.buffer,0,t);else{const i=new Uint32Array(t);i.set(this._data),this._data=i}for(let i=this.length;i<e;++i)this.setCell(i,s)}else{this._data=this._data.subarray(0,t);const i=Object.keys(this._combined);for(let _=0;_<i.length;_++){const p=parseInt(i[_],10);p>=e&&delete this._combined[p]}const l=Object.keys(this._extendedAttrs);for(let _=0;_<l.length;_++){const p=parseInt(l[_],10);p>=e&&delete this._extendedAttrs[p]}}return this.length=e,4*t*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,s=!1){if(s)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const s in e._combined)this._combined[s]=e._combined[s];this._extendedAttrs={};for(const s in e._extendedAttrs)this._extendedAttrs[s]=e._extendedAttrs[s];this.isWrapped=e.isWrapped}clone(){const e=new v(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const s in this._combined)e._combined[s]=this._combined[s];for(const s in this._extendedAttrs)e._extendedAttrs[s]=this._extendedAttrs[s];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,s,t,i,l){const _=e._data;if(l)for(let m=i-1;m>=0;m--){for(let a=0;a<3;a++)this._data[3*(t+m)+a]=_[3*(s+m)+a];268435456&_[3*(s+m)+2]&&(this._extendedAttrs[t+m]=e._extendedAttrs[s+m])}else for(let m=0;m<i;m++){for(let a=0;a<3;a++)this._data[3*(t+m)+a]=_[3*(s+m)+a];268435456&_[3*(s+m)+2]&&(this._extendedAttrs[t+m]=e._extendedAttrs[s+m])}const p=Object.keys(e._combined);for(let m=0;m<p.length;m++){const a=parseInt(p[m],10);a>=s&&(this._combined[a-s+t]=e._combined[a])}}translateToString(e=!1,s=0,t=this.length){e&&(t=Math.min(t,this.getTrimmedLength()));let i="";for(;s<t;){const l=this._data[3*s+0],_=2097151&l;i+=2097152&l?this._combined[s]:_?(0,d.stringFromCodePoint)(_):n.WHITESPACE_CELL_CHAR,s+=l>>22||1}return i}}r.BufferLine=v},4841:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error("Buffer range end (".concat(o.end.x,", ").concat(o.end.y,") cannot be before start (").concat(o.start.x,", ").concat(o.start.y,")"));return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(T,r)=>{function o(c,f,n){if(f===c.length-1)return c[f].getTrimmedLength();const d=!c[f].hasContent(n-1)&&c[f].getWidth(n-1)===1,u=c[f+1].getWidth(0)===2;return d&&u?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,f,n,d,u){const v=[];for(let h=0;h<c.length-1;h++){let e=h,s=c.get(++e);if(!s.isWrapped)continue;const t=[c.get(h)];for(;e<c.length&&s.isWrapped;)t.push(s),s=c.get(++e);if(d>=h&&d<e){h+=t.length-1;continue}let i=0,l=o(t,i,f),_=1,p=0;for(;_<t.length;){const a=o(t,_,f),g=a-p,y=n-l,k=Math.min(g,y);t[i].copyCellsFrom(t[_],p,l,k,!1),l+=k,l===n&&(i++,l=0),p+=k,p===a&&(_++,p=0),l===0&&i!==0&&t[i-1].getWidth(n-1)===2&&(t[i].copyCellsFrom(t[i-1],n-1,l++,1,!1),t[i-1].setCell(n-1,u))}t[i].replaceCells(l,n,u);let m=0;for(let a=t.length-1;a>0&&(a>i||t[a].getTrimmedLength()===0);a--)m++;m>0&&(v.push(h+t.length-m),v.push(m)),h+=t.length-1}return v},r.reflowLargerCreateNewLayout=function(c,f){const n=[];let d=0,u=f[d],v=0;for(let h=0;h<c.length;h++)if(u===h){const e=f[++d];c.onDeleteEmitter.fire({index:h-v,amount:e}),h+=e-1,v+=e,u=f[++d]}else n.push(h);return{layout:n,countRemoved:v}},r.reflowLargerApplyNewLayout=function(c,f){const n=[];for(let d=0;d<f.length;d++)n.push(c.get(f[d]));for(let d=0;d<n.length;d++)c.set(d,n[d]);c.length=f.length},r.reflowSmallerGetNewLineLengths=function(c,f,n){const d=[],u=c.map(((s,t)=>o(c,t,f))).reduce(((s,t)=>s+t));let v=0,h=0,e=0;for(;e<u;){if(u-e<n){d.push(u-e);break}v+=n;const s=o(c,h,f);v>s&&(v-=s,h++);const t=c[h].getWidth(v-1)===2;t&&v--;const i=t?n-1:n;d.push(i),e+=i}return d},r.getWrappedLineTrimmedLength=o},5295:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const c=o(8460),f=o(844),n=o(9092);class d extends f.Disposable{constructor(v,h){super(),this._optionsService=v,this._bufferService=h,this._onBufferActivate=this.register(new c.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(v,h){this._normal.resize(v,h),this._alt.resize(v,h),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}r.BufferSet=d},511:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const c=o(482),f=o(643),n=o(3734);class d extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const h=new d;return h.setFromCharData(v),h}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let h=!1;if(v[f.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(v[f.CHAR_DATA_CHAR_INDEX].length===2){const e=v[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[f.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=v[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[f.CHAR_DATA_WIDTH_INDEX]<<22;h&&(this.combinedData=v[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=d},643:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const c=o(8460),f=o(844);class n{get id(){return this._id}constructor(u){this.line=u,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(u){return this._disposables.push(u),u}}r.Marker=n,n._nextId=1},7116:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(T,r)=>{var o,c,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF="\n",n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""})(o||(r.C0=o={})),(function(n){n.PAD="",n.HOP="",n.BPH="",n.NBH="",n.IND="",n.NEL="
",n.SSA="",n.ESA="",n.HTS="",n.HTJ="",n.VTS="",n.PLD="",n.PLU="",n.RI="",n.SS2="",n.SS3="",n.DCS="",n.PU1="",n.PU2="",n.STS="",n.CCH="",n.MW="",n.SPA="",n.EPA="",n.SOS="",n.SGCI="",n.SCI="",n.CSI="",n.ST="",n.OSC="",n.PM="",n.APC=""})(c||(r.C1=c={})),(function(n){n.ST="".concat(o.ESC,"\\")})(f||(r.C1_ESCAPED=f={}))},7399:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const c=o(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(n,d,u,v){const h={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?h.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?h.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?h.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(h.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:if(n.altKey){h.key=c.C0.ESC+c.C0.DEL;break}h.key=c.C0.DEL;break;case 9:if(n.shiftKey){h.key=c.C0.ESC+"[Z";break}h.key=c.C0.HT,h.cancel=!0;break;case 13:h.key=n.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,h.cancel=!0;break;case 27:h.key=c.C0.ESC,n.altKey&&(h.key=c.C0.ESC+c.C0.ESC),h.cancel=!0;break;case 37:if(n.metaKey)break;e?(h.key=c.C0.ESC+"[1;"+(e+1)+"D",h.key===c.C0.ESC+"[1;3D"&&(h.key=c.C0.ESC+(u?"b":"[1;5D"))):h.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(h.key=c.C0.ESC+"[1;"+(e+1)+"C",h.key===c.C0.ESC+"[1;3C"&&(h.key=c.C0.ESC+(u?"f":"[1;5C"))):h.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(h.key=c.C0.ESC+"[1;"+(e+1)+"A",u||h.key!==c.C0.ESC+"[1;3A"||(h.key=c.C0.ESC+"[1;5A")):h.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(h.key=c.C0.ESC+"[1;"+(e+1)+"B",u||h.key!==c.C0.ESC+"[1;3B"||(h.key=c.C0.ESC+"[1;5B")):h.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(h.key=c.C0.ESC+"[2~");break;case 46:h.key=e?c.C0.ESC+"[3;"+(e+1)+"~":c.C0.ESC+"[3~";break;case 36:h.key=e?c.C0.ESC+"[1;"+(e+1)+"H":d?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:h.key=e?c.C0.ESC+"[1;"+(e+1)+"F":d?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:n.shiftKey?h.type=2:n.ctrlKey?h.key=c.C0.ESC+"[5;"+(e+1)+"~":h.key=c.C0.ESC+"[5~";break;case 34:n.shiftKey?h.type=3:n.ctrlKey?h.key=c.C0.ESC+"[6;"+(e+1)+"~":h.key=c.C0.ESC+"[6~";break;case 112:h.key=e?c.C0.ESC+"[1;"+(e+1)+"P":c.C0.ESC+"OP";break;case 113:h.key=e?c.C0.ESC+"[1;"+(e+1)+"Q":c.C0.ESC+"OQ";break;case 114:h.key=e?c.C0.ESC+"[1;"+(e+1)+"R":c.C0.ESC+"OR";break;case 115:h.key=e?c.C0.ESC+"[1;"+(e+1)+"S":c.C0.ESC+"OS";break;case 116:h.key=e?c.C0.ESC+"[15;"+(e+1)+"~":c.C0.ESC+"[15~";break;case 117:h.key=e?c.C0.ESC+"[17;"+(e+1)+"~":c.C0.ESC+"[17~";break;case 118:h.key=e?c.C0.ESC+"[18;"+(e+1)+"~":c.C0.ESC+"[18~";break;case 119:h.key=e?c.C0.ESC+"[19;"+(e+1)+"~":c.C0.ESC+"[19~";break;case 120:h.key=e?c.C0.ESC+"[20;"+(e+1)+"~":c.C0.ESC+"[20~";break;case 121:h.key=e?c.C0.ESC+"[21;"+(e+1)+"~":c.C0.ESC+"[21~";break;case 122:h.key=e?c.C0.ESC+"[23;"+(e+1)+"~":c.C0.ESC+"[23~";break;case 123:h.key=e?c.C0.ESC+"[24;"+(e+1)+"~":c.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(u&&!v||!n.altKey||n.metaKey)!u||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?h.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(h.key=c.C0.US),n.key==="@"&&(h.key=c.C0.NUL)):n.keyCode===65&&(h.type=1);else{const s=f[n.keyCode],t=s==null?void 0:s[n.shiftKey?1:0];if(t)h.key=c.C0.ESC+t;else if(n.keyCode>=65&&n.keyCode<=90){const i=n.ctrlKey?n.keyCode-64:n.keyCode+32;let l=String.fromCharCode(i);n.shiftKey&&(l=l.toUpperCase()),h.key=c.C0.ESC+l}else if(n.keyCode===32)h.key=c.C0.ESC+(n.ctrlKey?c.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let i=n.code.slice(3,4);n.shiftKey||(i=i.toLowerCase()),h.key=c.C0.ESC+i,h.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?h.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?h.key=c.C0.NUL:n.keyCode>=51&&n.keyCode<=55?h.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?h.key=c.C0.DEL:n.keyCode===219?h.key=c.C0.ESC:n.keyCode===220?h.key=c.C0.FS:n.keyCode===221&&(h.key=c.C0.GS)}return h}},482:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,c=0,f=o.length){let n="";for(let d=c;d<f;++d){let u=o[d];u>65535?(u-=65536,n+=String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):n+=String.fromCharCode(u)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const f=o.length;if(!f)return 0;let n=0,d=0;if(this._interim){const u=o.charCodeAt(d++);56320<=u&&u<=57343?c[n++]=1024*(this._interim-55296)+u-56320+65536:(c[n++]=this._interim,c[n++]=u),this._interim=0}for(let u=d;u<f;++u){const v=o.charCodeAt(u);if(55296<=v&&v<=56319){if(++u>=f)return this._interim=v,n;const h=o.charCodeAt(u);56320<=h&&h<=57343?c[n++]=1024*(v-55296)+h-56320+65536:(c[n++]=v,c[n++]=h)}else v!==65279&&(c[n++]=v)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const f=o.length;if(!f)return 0;let n,d,u,v,h=0,e=0,s=0;if(this.interim[0]){let l=!1,_=this.interim[0];_&=(224&_)==192?31:(240&_)==224?15:7;let p,m=0;for(;(p=63&this.interim[++m])&&m<4;)_<<=6,_|=p;const a=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,g=a-m;for(;s<g;){if(s>=f)return 0;if(p=o[s++],(192&p)!=128){s--,l=!0;break}this.interim[m++]=p,_<<=6,_|=63&p}l||(a===2?_<128?s--:c[h++]=_:a===3?_<2048||_>=55296&&_<=57343||_===65279||(c[h++]=_):_<65536||_>1114111||(c[h++]=_)),this.interim.fill(0)}const t=f-4;let i=s;for(;i<f;){for(;!(!(i<t)||128&(n=o[i])||128&(d=o[i+1])||128&(u=o[i+2])||128&(v=o[i+3]));)c[h++]=n,c[h++]=d,c[h++]=u,c[h++]=v,i+=4;if(n=o[i++],n<128)c[h++]=n;else if((224&n)==192){if(i>=f)return this.interim[0]=n,h;if(d=o[i++],(192&d)!=128){i--;continue}if(e=(31&n)<<6|63&d,e<128){i--;continue}c[h++]=e}else if((240&n)==224){if(i>=f)return this.interim[0]=n,h;if(d=o[i++],(192&d)!=128){i--;continue}if(i>=f)return this.interim[0]=n,this.interim[1]=d,h;if(u=o[i++],(192&u)!=128){i--;continue}if(e=(15&n)<<12|(63&d)<<6|63&u,e<2048||e>=55296&&e<=57343||e===65279)continue;c[h++]=e}else if((248&n)==240){if(i>=f)return this.interim[0]=n,h;if(d=o[i++],(192&d)!=128){i--;continue}if(i>=f)return this.interim[0]=n,this.interim[1]=d,h;if(u=o[i++],(192&u)!=128){i--;continue}if(i>=f)return this.interim[0]=n,this.interim[1]=d,this.interim[2]=u,h;if(v=o[i++],(192&v)!=128){i--;continue}if(e=(7&n)<<18|(63&d)<<12|(63&u)<<6|63&v,e<65536||e>1114111)continue;c[h++]=e}}return h}}},225:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const c=o(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let d;r.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let u=0;u<f.length;++u)d.fill(0,f[u][0],f[u][1]+1)}}wcwidth(u){return u<32?0:u<127?1:u<65536?d[u]:(function(v,h){let e,s=0,t=h.length-1;if(v<h[0][0]||v>h[t][1])return!1;for(;t>=s;)if(e=s+t>>1,v>h[e][1])s=e+1;else{if(!(v<h[e][0]))return!0;t=e-1}return!1})(u,n)?0:u>=131072&&u<=196605||u>=196608&&u<=262141?2:1}charProperties(u,v){let h=this.wcwidth(u),e=h===0&&v!==0;if(e){const s=c.UnicodeService.extractWidth(v);s===0?e=!1:s>h&&(h=s)}return c.UnicodeService.createPropertyValue(0,h,e)}}},5981:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const c=o(8460),f=o(844);class n extends f.Disposable{constructor(u){super(),this._action=u,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(u,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=u.length,this._writeBuffer.push(u),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let h;for(this._isSyncWriting=!0;h=this._writeBuffer.shift();){this._action(h);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(u,v){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=u.length,this._writeBuffer.push(u),this._callbacks.push(v),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=u.length,this._writeBuffer.push(u),this._callbacks.push(v)}_innerWrite(u=0,v=!0){const h=u||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,v);if(s){const i=l=>Date.now()-h>=12?setTimeout((()=>this._innerWrite(0,l))):this._innerWrite(h,l);return void s.catch((l=>(queueMicrotask((()=>{throw l})),Promise.resolve(!1)))).then(i)}const t=this._callbacks[this._bufferOffset];if(t&&t(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-h>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=n},5941:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function f(n,d){const u=n.toString(16),v=u.length<2?"0"+u:u;switch(d){case 4:return u[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}r.parseColor=function(n){if(!n)return;let d=n.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const u=o.exec(d);if(u){const v=u[1]?15:u[4]?255:u[7]?4095:65535;return[Math.round(parseInt(u[1]||u[4]||u[7]||u[10],16)/v*255),Math.round(parseInt(u[2]||u[5]||u[8]||u[11],16)/v*255),Math.round(parseInt(u[3]||u[6]||u[9]||u[12],16)/v*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),c.exec(d)&&[3,6,9,12].includes(d.length))){const u=d.length/3,v=[0,0,0];for(let h=0;h<3;++h){const e=parseInt(d.slice(u*h,u*h+u),16);v[h]=u===1?e<<4:u===2?e:u===3?e>>4:e>>8}return v}},r.toRgbString=function(n,d=16){const[u,v,h]=n;return"rgb:".concat(f(u,d),"/").concat(f(v,d),"/").concat(f(h,d))}},5770:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const c=o(482),f=o(8742),n=o(5770),d=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(v,h){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(h),{dispose:()=>{const s=e.indexOf(h);s!==-1&&e.splice(s,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(v,h){if(this.reset(),this._ident=v,this._active=this._handlers[v]||d,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(h);else this._handlerFb(this._ident,"HOOK",h)}put(v,h,e){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(v,h,e);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(v,h,e))}unhook(v,h=!0){if(this._active.length){let e=!1,s=this._active.length-1,t=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,e=h,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;s>=0&&(e=this._active[s].unhook(v),e!==!0);s--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,e;s--}for(;s>=0;s--)if(e=this._active[s].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=d,this._ident=0}};const u=new f.Params;u.addParam(0),r.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=u,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():u,this._data="",this._hitLimit=!1}put(v,h,e){this._hitLimit||(this._data+=(0,c.utf32ToString)(v,h,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let h=!1;if(this._hitLimit)h=!1;else if(v&&(h=this._handler(this._data,this._params),h instanceof Promise))return h.then((e=>(this._params=u,this._data="",this._hitLimit=!1,e)));return this._params=u,this._data="",this._hitLimit=!1,h}}},2015:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const c=o(844),f=o(8742),n=o(6242),d=o(6351);class u{constructor(s){this.table=new Uint8Array(s)}setDefault(s,t){this.table.fill(s<<4|t)}add(s,t,i,l){this.table[t<<8|s]=i<<4|l}addMany(s,t,i,l){for(let _=0;_<s.length;_++)this.table[t<<8|s[_]]=i<<4|l}}r.TransitionTable=u;const v=160;r.VT500_TRANSITION_TABLE=(function(){const e=new u(4095),s=Array.apply(null,Array(256)).map(((m,a)=>a)),t=(m,a)=>s.slice(m,a),i=t(32,127),l=t(0,24);l.push(25),l.push.apply(l,t(28,32));const _=t(0,14);let p;for(p in e.setDefault(1,0),e.addMany(i,0,2,0),_)e.addMany([24,26,153,154],p,3,0),e.addMany(t(128,144),p,3,0),e.addMany(t(144,152),p,3,0),e.add(156,p,0,0),e.add(27,p,11,1),e.add(157,p,4,8),e.addMany([152,158,159],p,0,7),e.add(155,p,11,3),e.add(144,p,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(t(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(t(64,127),3,7,0),e.addMany(t(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(t(48,60),4,8,4),e.addMany(t(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(t(32,64),6,0,6),e.add(127,6,0,6),e.addMany(t(64,127),6,0,0),e.addMany(t(32,48),3,9,5),e.addMany(t(32,48),5,9,5),e.addMany(t(48,64),5,0,6),e.addMany(t(64,127),5,7,0),e.addMany(t(32,48),4,9,5),e.addMany(t(32,48),1,9,2),e.addMany(t(32,48),2,9,2),e.addMany(t(48,127),2,10,0),e.addMany(t(48,80),1,10,0),e.addMany(t(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(t(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(t(28,32),9,0,9),e.addMany(t(32,48),9,9,12),e.addMany(t(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(t(32,128),11,0,11),e.addMany(t(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(t(28,32),10,0,10),e.addMany(t(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(t(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(t(28,32),12,0,12),e.addMany(t(32,48),12,9,12),e.addMany(t(48,64),12,0,11),e.addMany(t(64,127),12,12,13),e.addMany(t(64,127),10,12,13),e.addMany(t(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,13,13,13),e})();class h extends c.Disposable{constructor(s=r.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,l)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,t=[64,126]){let i=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=s.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let _=0;_<s.intermediates.length;++_){const p=s.intermediates.charCodeAt(_);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=p}}if(s.final.length!==1)throw new Error("final must be a single byte");const l=s.final.charCodeAt(0);if(t[0]>l||l>t[1])throw new Error("final must be in range ".concat(t[0]," .. ").concat(t[1]));return i<<=8,i|=l,i}identToString(s){const t=[];for(;s;)t.push(String.fromCharCode(255&s)),s>>=8;return t.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,t){const i=this._identifier(s,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);const l=this._escHandlers[i];return l.push(t),{dispose:()=>{const _=l.indexOf(t);_!==-1&&l.splice(_,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,t){this._executeHandlers[s.charCodeAt(0)]=t}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,t){const i=this._identifier(s);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);const l=this._csiHandlers[i];return l.push(t),{dispose:()=>{const _=l.indexOf(t);_!==-1&&l.splice(_,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,t){return this._dcsParser.registerHandler(this._identifier(s),t)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,t){return this._oscParser.registerHandler(s,t)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,t,i,l,_){this._parseStack.state=s,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=l,this._parseStack.chunkPos=_}parse(s,t,i){let l,_=0,p=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const a=this._parseStack.handlers;let g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&g>-1){for(;g>=0&&(l=a[g](this._params),l!==!0);g--)if(l instanceof Promise)return this._parseStack.handlerPos=g,l}this._parseStack.handlers=[];break;case 4:if(i===!1&&g>-1){for(;g>=0&&(l=a[g](),l!==!0);g--)if(l instanceof Promise)return this._parseStack.handlerPos=g,l}this._parseStack.handlers=[];break;case 6:if(_=s[this._parseStack.chunkPos],l=this._dcsParser.unhook(_!==24&&_!==26,i),l)return l;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(_=s[this._parseStack.chunkPos],l=this._oscParser.end(_!==24&&_!==26,i),l)return l;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let a=m;a<t;++a){switch(_=s[a],p=this._transitions.table[this.currentState<<8|(_<160?_:v)],p>>4){case 2:for(let L=a+1;;++L){if(L>=t||(_=s[L])<32||_>126&&_<v){this._printHandler(s,a,L),a=L-1;break}if(++L>=t||(_=s[L])<32||_>126&&_<v){this._printHandler(s,a,L),a=L-1;break}if(++L>=t||(_=s[L])<32||_>126&&_<v){this._printHandler(s,a,L),a=L-1;break}if(++L>=t||(_=s[L])<32||_>126&&_<v){this._printHandler(s,a,L),a=L-1;break}}break;case 3:this._executeHandlers[_]?this._executeHandlers[_]():this._executeHandlerFb(_),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:_,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const g=this._csiHandlers[this._collect<<8|_];let y=g?g.length-1:-1;for(;y>=0&&(l=g[y](this._params),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(3,g,y,p,a),l;y<0&&this._csiHandlerFb(this._collect<<8|_,this._params),this.precedingJoinState=0;break;case 8:do switch(_){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(_-48)}while(++a<t&&(_=s[a])>47&&_<60);a--;break;case 9:this._collect<<=8,this._collect|=_;break;case 10:const k=this._escHandlers[this._collect<<8|_];let b=k?k.length-1:-1;for(;b>=0&&(l=k[b](),l!==!0);b--)if(l instanceof Promise)return this._preserveStack(4,k,b,p,a),l;b<0&&this._escHandlerFb(this._collect<<8|_),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|_,this._params);break;case 13:for(let L=a+1;;++L)if(L>=t||(_=s[L])===24||_===26||_===27||_>127&&_<v){this._dcsParser.put(s,a,L),a=L-1;break}break;case 14:if(l=this._dcsParser.unhook(_!==24&&_!==26),l)return this._preserveStack(6,[],0,p,a),l;_===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let L=a+1;;L++)if(L>=t||(_=s[L])<32||_>127&&_<v){this._oscParser.put(s,a,L),a=L-1;break}break;case 6:if(l=this._oscParser.end(_!==24&&_!==26),l)return this._preserveStack(5,[],0,p,a),l;_===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}r.EscapeSequenceParser=h},6242:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const c=o(5770),f=o(482),n=[];r.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,u){this._handlers[d]===void 0&&(this._handlers[d]=[]);const v=this._handlers[d];return v.push(u),{dispose:()=>{const h=v.indexOf(u);h!==-1&&v.splice(h,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,u,v){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(d,u,v);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(d,u,v))}start(){this.reset(),this._state=1}put(d,u,v){if(this._state!==3){if(this._state===1)for(;u<v;){const h=d[u++];if(h===59){this._state=2,this._start();break}if(h<48||57<h)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+h-48}this._state===2&&v-u>0&&this._put(d,u,v)}}end(d,u=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,h=this._active.length-1,e=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,v=u,e=this._stack.fallThrough,this._stack.paused=!1),!e&&v===!1){for(;h>=0&&(v=this._active[h].end(d),v!==!0);h--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,v;h--}for(;h>=0;h--)if(v=this._active[h].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",d);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,u,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(d,u,v),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let u=!1;if(this._hitLimit)u=!1;else if(d&&(u=this._handler(this._data),u instanceof Promise))return u.then((v=>(this._data="",this._hitLimit=!1,v)));return this._data="",this._hitLimit=!1,u}}},8742:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const o=2147483647;class c{static fromArray(n){const d=new c;if(!n.length)return d;for(let u=Array.isArray(n[0])?1:0;u<n.length;++u){const v=n[u];if(Array.isArray(v))for(let h=0;h<v.length;++h)d.addSubParam(v[h]);else d.addParam(v)}return d}constructor(n=32,d=32){if(this.maxLength=n,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new c(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let d=0;d<this.length;++d){n.push(this.params[d]);const u=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];v-u>0&&n.push(Array.prototype.slice.call(this._subParams,u,v))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>o?o:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>o?o:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const d=this._subParamsIdx[n]>>8,u=255&this._subParamsIdx[n];return u-d>0?this._subParams.subarray(d,u):null}getSubParamsAll(){const n={};for(let d=0;d<this.length;++d){const u=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];v-u>0&&(n[d]=this._subParams.slice(u,v))}return n}addDigit(n){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const u=this._digitIsSub?this._subParams:this.params,v=u[d-1];u[d-1]=~v?Math.min(10*v+n,o):n}}r.Params=c},5741:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){const f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const c=o(3785),f=o(511);r.BufferApiView=class{constructor(n,d){this._buffer=n,this.type=d}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){const d=this._buffer.lines.get(n);if(d)return new c.BufferLineApiView(d)}getNullCell(){return new f.CellData}}},3785:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const c=o(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,n){if(!(f<0||f>=this._line.length))return n?(this._line.loadCell(f,n),n):this._line.loadCell(f,new c.CellData)}translateToString(f,n,d){return this._line.translateToString(f,n,d)}}},8285:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const c=o(8771),f=o(8460),n=o(844);class d extends n.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=d},7975:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(f=>c(f.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((f,n)=>c(f,n.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(T,r,o){var c=this&&this.__decorate||function(e,s,t,i){var l,_=arguments.length,p=_<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(l=e[m])&&(p=(_<3?l(p):_>3?l(s,t,p):l(s,t))||p);return _>3&&p&&Object.defineProperty(s,t,p),p},f=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const n=o(8460),d=o(844),u=o(5295),v=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let h=r.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new u.BufferSet(e,this))}resize(e,s){this.cols=e,this.rows=s,this.buffers.resize(e,s),this._onResize.fire({cols:e,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,s=!1){const t=this.buffer;let i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=t.getBlankLine(e,s),this._cachedBlankLine=i),i.isWrapped=s;const l=t.ybase+t.scrollTop,_=t.ybase+t.scrollBottom;if(t.scrollTop===0){const p=t.lines.isFull;_===t.lines.length-1?p?t.lines.recycle().copyFrom(i):t.lines.push(i.clone()):t.lines.splice(_+1,0,i.clone()),p?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const p=_-l+1;t.lines.shiftElements(l+1,p-1,-1),t.lines.set(_,i.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,s,t){const i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const l=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),l!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}};r.BufferService=h=c([f(0,v.IOptionsService)],h)},7994:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(T,r,o){var c=this&&this.__decorate||function(i,l,_,p){var m,a=arguments.length,g=a<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,_):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,l,_,p);else for(var y=i.length-1;y>=0;y--)(m=i[y])&&(g=(a<3?m(g):a>3?m(l,_,g):m(l,_))||g);return a>3&&g&&Object.defineProperty(l,_,g),g},f=this&&this.__param||function(i,l){return function(_,p){l(_,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const n=o(2585),d=o(8460),u=o(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function h(i,l){let _=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(_|=64,_|=i.action):(_|=3&i.button,4&i.button&&(_|=64),8&i.button&&(_|=128),i.action===32?_|=32:i.action!==0||l||(_|=3)),_}const e=String.fromCharCode,s={DEFAULT:i=>{const l=[h(i,!1)+32,i.col+32,i.row+32];return l[0]>255||l[1]>255||l[2]>255?"":"\x1B[M".concat(e(l[0])).concat(e(l[1])).concat(e(l[2]))},SGR:i=>{const l=i.action===0&&i.button!==4?"m":"M";return"\x1B[<".concat(h(i,!0),";").concat(i.col,";").concat(i.row).concat(l)},SGR_PIXELS:i=>{const l=i.action===0&&i.button!==4?"m":"M";return"\x1B[<".concat(h(i,!0),";").concat(i.x,";").concat(i.y).concat(l)}};let t=r.CoreMouseService=class extends u.Disposable{constructor(i,l){super(),this._bufferService=i,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const _ of Object.keys(v))this.addProtocol(_,v[_]);for(const _ of Object.keys(s))this.addEncoding(_,s[_]);this.reset()}addProtocol(i,l){this._protocols[i]=l}addEncoding(i,l){this._encodings[i]=l}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error('unknown protocol "'.concat(i,'"'));this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error('unknown encoding "'.concat(i,'"'));this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;const l=this._encodings[this._activeEncoding](i);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,l,_){if(_){if(i.x!==l.x||i.y!==l.y)return!1}else if(i.col!==l.col||i.row!==l.row)return!1;return i.button===l.button&&i.action===l.action&&i.ctrl===l.ctrl&&i.alt===l.alt&&i.shift===l.shift}};r.CoreMouseService=t=c([f(0,n.IBufferService),f(1,n.ICoreService)],t)},6975:function(T,r,o){var c=this&&this.__decorate||function(t,i,l,_){var p,m=arguments.length,a=m<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,l):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,i,l,_);else for(var g=t.length-1;g>=0;g--)(p=t[g])&&(a=(m<3?p(a):m>3?p(i,l,a):p(i,l))||a);return m>3&&a&&Object.defineProperty(i,l,a),a},f=this&&this.__param||function(t,i){return function(l,_){i(l,_,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const n=o(1439),d=o(8460),u=o(844),v=o(2585),h=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let s=r.CoreService=class extends u.Disposable{constructor(t,i,l){super(),this._bufferService=t,this._logService=i,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(h),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(h),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(t,i=!1){if(this._optionsService.rawOptions.disableStdin)return;const l=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug('sending data "'.concat(t,'"'),(()=>t.split("").map((_=>_.charCodeAt(0))))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug('sending binary "'.concat(t,'"'),(()=>t.split("").map((i=>i.charCodeAt(0))))),this._onBinary.fire(t))}};r.CoreService=s=c([f(0,v.IBufferService),f(1,v.ILogService),f(2,v.IOptionsService)],s)},9074:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const c=o(8055),f=o(8460),n=o(844),d=o(6106);let u=0,v=0;class h extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((t=>t==null?void 0:t.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)((()=>this.reset())))}registerDecoration(t){if(t.marker.isDisposed)return;const i=new e(t);if(i){const l=i.marker.onDispose((()=>i.dispose()));i.onDispose((()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),l.dispose())})),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(const t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,i,l){var m,a,g;let _=0,p=0;for(const y of this._decorations.getKeyIterator(i))_=(m=y.options.x)!=null?m:0,p=_+((a=y.options.width)!=null?a:1),t>=_&&t<p&&(!l||((g=y.options.layer)!=null?g:"bottom")===l)&&(yield y)}forEachDecorationAtCell(t,i,l,_){this._decorations.forEachByKey(i,(p=>{var m,a,g;u=(m=p.options.x)!=null?m:0,v=u+((a=p.options.width)!=null?a:1),t>=u&&t<v&&(!l||((g=p.options.layer)!=null?g:"bottom")===l)&&_(p)}))}}r.DecorationService=h;class e extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(t){super(),this.options=t,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const c=o(2585),f=o(8343);class n{constructor(...u){this._entries=new Map;for(const[v,h]of u)this.set(v,h)}set(u,v){const h=this._entries.get(u);return this._entries.set(u,v),h}forEach(u){for(const[v,h]of this._entries.entries())u(v,h)}has(u){return this._entries.has(u)}get(u){return this._entries.get(u)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(c.IInstantiationService,this)}setService(d,u){this._services.set(d,u)}getService(d){return this._services.get(d)}createInstance(d,...u){const v=(0,f.getServiceDependencies)(d).sort(((s,t)=>s.index-t.index)),h=[];for(const s of v){const t=this._services.get(s.id);if(!t)throw new Error("[createInstance] ".concat(d.name," depends on UNKNOWN service ").concat(s.id,"."));h.push(t)}const e=v.length>0?v[0].index:u.length;if(u.length!==e)throw new Error("[createInstance] First service dependency of ".concat(d.name," at position ").concat(e+1," conflicts with ").concat(u.length," static arguments"));return new d(...u,...h)}}},7866:function(T,r,o){var c=this&&this.__decorate||function(e,s,t,i){var l,_=arguments.length,p=_<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(l=e[m])&&(p=(_<3?l(p):_>3?l(s,t,p):l(s,t))||p);return _>3&&p&&Object.defineProperty(s,t,p),p},f=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const n=o(844),d=o(2585),u={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF};let v,h=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=u[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;s<e.length;s++)typeof e[s]=="function"&&(e[s]=e[s]())}_log(e,s,t){this._evalLazyOptionalParams(t),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...t)}trace(e,...s){var t,i;this._logLevel<=d.LogLevelEnum.TRACE&&this._log((i=(t=this._optionsService.options.logger)==null?void 0:t.trace.bind(this._optionsService.options.logger))!=null?i:console.log,e,s)}debug(e,...s){var t,i;this._logLevel<=d.LogLevelEnum.DEBUG&&this._log((i=(t=this._optionsService.options.logger)==null?void 0:t.debug.bind(this._optionsService.options.logger))!=null?i:console.log,e,s)}info(e,...s){var t,i;this._logLevel<=d.LogLevelEnum.INFO&&this._log((i=(t=this._optionsService.options.logger)==null?void 0:t.info.bind(this._optionsService.options.logger))!=null?i:console.info,e,s)}warn(e,...s){var t,i;this._logLevel<=d.LogLevelEnum.WARN&&this._log((i=(t=this._optionsService.options.logger)==null?void 0:t.warn.bind(this._optionsService.options.logger))!=null?i:console.warn,e,s)}error(e,...s){var t,i;this._logLevel<=d.LogLevelEnum.ERROR&&this._log((i=(t=this._optionsService.options.logger)==null?void 0:t.error.bind(this._optionsService.options.logger))!=null?i:console.error,e,s)}};r.LogService=h=c([f(0,d.IOptionsService)],h),r.setTraceLogger=function(e){v=e},r.traceCall=function(e,s,t){if(typeof t.value!="function")throw new Error("not supported");const i=t.value;t.value=function(...l){if(v.logLevel!==d.LogLevelEnum.TRACE)return i.apply(this,l);v.trace("GlyphRenderer#".concat(i.name,"(").concat(l.map((p=>JSON.stringify(p))).join(", "),")"));const _=i.apply(this,l);return v.trace("GlyphRenderer#".concat(i.name," return"),_),_}}},7302:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const c=o(8460),f=o(844),n=o(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const d=["normal","bold","100","200","300","400","500","600","700","800","900"];class u extends f.Disposable{constructor(h){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...r.DEFAULT_OPTIONS};for(const s in h)if(s in e)try{const t=h[s];e[s]=this._sanitizeAndValidateOption(s,t)}catch(t){console.error(t)}this.rawOptions=e,this.options={...e},this._setupOptions()}onSpecificOptionChange(h,e){return this.onOptionChange((s=>{s===h&&e(this.rawOptions[h])}))}onMultipleOptionChange(h,e){return this.onOptionChange((s=>{h.indexOf(s)!==-1&&e()}))}_setupOptions(){const h=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error('No option with key "'.concat(s,'"'));return this.rawOptions[s]},e=(s,t)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error('No option with key "'.concat(s,'"'));t=this._sanitizeAndValidateOption(s,t),this.rawOptions[s]!==t&&(this.rawOptions[s]=t,this._onOptionChange.fire(s))};for(const s in this.rawOptions){const t={get:h.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this.options,s,t)}}_sanitizeAndValidateOption(h,e){switch(h){case"cursorStyle":if(e||(e=r.DEFAULT_OPTIONS[h]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(e))throw new Error('"'.concat(e,'" is not a valid value for ').concat(h));break;case"wordSeparator":e||(e=r.DEFAULT_OPTIONS[h]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=d.includes(e)?e:r.DEFAULT_OPTIONS[h];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error("".concat(h," cannot be less than 1, value: ").concat(e));break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error("".concat(h," cannot be less than 0, value: ").concat(e));break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error("".concat(h," cannot be less than or equal to 0, value: ").concat(e));break;case"rows":case"cols":if(!e&&e!==0)throw new Error("".concat(h," must be numeric, value: ").concat(e));break;case"windowsPty":e=e!=null?e:{}}return e}}r.OptionsService=u},2660:function(T,r,o){var c=this&&this.__decorate||function(u,v,h,e){var s,t=arguments.length,i=t<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,h):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(u,v,h,e);else for(var l=u.length-1;l>=0;l--)(s=u[l])&&(i=(t<3?s(i):t>3?s(v,h,i):s(v,h))||i);return t>3&&i&&Object.defineProperty(v,h,i),i},f=this&&this.__param||function(u,v){return function(h,e){v(h,e,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const n=o(2585);let d=r.OscLinkService=class{constructor(u){this._bufferService=u,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(u){const v=this._bufferService.buffer;if(u.id===void 0){const l=v.addMarker(v.ybase+v.y),_={data:u,id:this._nextId++,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(_,l))),this._dataByLinkId.set(_.id,_),_.id}const h=u,e=this._getEntryIdKey(h),s=this._entriesWithId.get(e);if(s)return this.addLineToLink(s.id,v.ybase+v.y),s.id;const t=v.addMarker(v.ybase+v.y),i={id:this._nextId++,key:this._getEntryIdKey(h),data:h,lines:[t]};return t.onDispose((()=>this._removeMarkerFromLink(i,t))),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(u,v){const h=this._dataByLinkId.get(u);if(h&&h.lines.every((e=>e.line!==v))){const e=this._bufferService.buffer.addMarker(v);h.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(h,e)))}}getLinkData(u){var v;return(v=this._dataByLinkId.get(u))==null?void 0:v.data}_getEntryIdKey(u){return"".concat(u.id,";;").concat(u.uri)}_removeMarkerFromLink(u,v){const h=u.lines.indexOf(v);h!==-1&&(u.lines.splice(h,1),u.lines.length===0&&(u.data.id!==void 0&&this._entriesWithId.delete(u.key),this._dataByLinkId.delete(u.id)))}};r.OscLinkService=d=c([f(0,n.IBufferService)],d)},8343:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const o="di$target",c="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[c]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);const n=function(d,u,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(h,e,s){e[o]===e?e[c].push({id:h,index:s}):(e[c]=[{id:h,index:s}],e[o]=e)})(n,d,v)};return n.toString=()=>f,r.serviceRegistry.set(f,n),n}},2585:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const c=o(8343);var f;r.IBufferService=(0,c.createDecorator)("BufferService"),r.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),r.ICoreService=(0,c.createDecorator)("CoreService"),r.ICharsetService=(0,c.createDecorator)("CharsetService"),r.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"})(f||(r.LogLevelEnum=f={})),r.ILogService=(0,c.createDecorator)("LogService"),r.IOptionsService=(0,c.createDecorator)("OptionsService"),r.IOscLinkService=(0,c.createDecorator)("OscLinkService"),r.IUnicodeService=(0,c.createDecorator)("UnicodeService"),r.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const c=o(8460),f=o(225);class n{static extractShouldJoin(u){return(1&u)!=0}static extractWidth(u){return u>>1&3}static extractCharKind(u){return u>>3}static createPropertyValue(u,v,h=!1){return(16777215&u)<<3|(3&v)<<1|(h?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const u=new f.UnicodeV6;this.register(u),this._active=u.version,this._activeProvider=u}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(u){if(!this._providers[u])throw new Error('unknown Unicode version "'.concat(u,'"'));this._active=u,this._activeProvider=this._providers[u],this._onChange.fire(u)}register(u){this._providers[u.version]=u}wcwidth(u){return this._activeProvider.wcwidth(u)}getStringCellWidth(u){let v=0,h=0;const e=u.length;for(let s=0;s<e;++s){let t=u.charCodeAt(s);if(55296<=t&&t<=56319){if(++s>=e)return v+this.wcwidth(t);const _=u.charCodeAt(s);56320<=_&&_<=57343?t=1024*(t-55296)+_-56320+65536:v+=this.wcwidth(_)}const i=this.charProperties(t,h);let l=n.extractWidth(i);n.extractShouldJoin(i)&&(l-=n.extractWidth(h)),v+=l,h=i}return v}charProperties(u,v){return this._activeProvider.charProperties(u,v)}}r.UnicodeService=n}},V={};function K(T){var r=V[T];if(r!==void 0)return r.exports;var o=V[T]={exports:{}};return Y[T].call(o.exports,o,o.exports,K),o.exports}var z={};return(()=>{var T=z;Object.defineProperty(T,"__esModule",{value:!0}),T.Terminal=void 0;const r=K(9042),o=K(3236),c=K(844),f=K(5741),n=K(8285),d=K(7975),u=K(7090),v=["cols","rows"];class h extends c.Disposable{constructor(s){super(),this._core=this.register(new o.Terminal(s)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};const t=l=>this._core.options[l],i=(l,_)=>{this._checkReadonlyOptions(l),this._core.options[l]=_};for(const l in this._core.options){const _={get:t.bind(this,l),set:i.bind(this,l)};Object.defineProperty(this._publicOptions,l,_)}}_checkReadonlyOptions(s){if(v.includes(s))throw new Error('Option "'.concat(s,'" can only be set in the constructor'))}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new u.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const s=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(const t in s)this._publicOptions[t]=s[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(s,t){this._verifyIntegers(s,t),this._core.resize(s,t)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){var t,i,l;return this._checkProposedApi(),this._verifyPositiveIntegers((t=s.x)!=null?t:0,(i=s.width)!=null?i:0,(l=s.height)!=null?l:0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,t,i){this._verifyIntegers(s,t,i),this._core.select(s,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,t){this._verifyIntegers(s,t),this._core.selectLines(s,t)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,t){this._core.write(s,t)}writeln(s,t){this._core.write(s),this._core.write("\r\n",t)}paste(s){this._core.paste(s)}refresh(s,t){this._verifyIntegers(s,t),this._core.refresh(s,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return r}_verifyIntegers(...s){for(const t of s)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(const t of s)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}T.Terminal=h})(),z})()))})(ve)),ve.exports}var Re=ke(),pe={exports:{}},Ce;function Le(){return Ce||(Ce=1,(function(se,le){(function(Y,V){se.exports=V()})(self,(()=>(()=>{var Y={};return(()=>{var V=Y;Object.defineProperty(V,"__esModule",{value:!0}),V.FitAddon=void 0,V.FitAddon=class{activate(K){this._terminal=K}dispose(){}fit(){const K=this.proposeDimensions();if(!K||!this._terminal||isNaN(K.cols)||isNaN(K.rows))return;const z=this._terminal._core;this._terminal.rows===K.rows&&this._terminal.cols===K.cols||(z._renderService.clear(),this._terminal.resize(K.cols,K.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const K=this._terminal._core,z=K._renderService.dimensions;if(z.css.cell.width===0||z.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:K.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),c=Math.max(0,parseInt(r.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),n=o-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),d=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(d/z.css.cell.width)),rows:Math.max(1,Math.floor(n/z.css.cell.height))}}}})(),Y})()))})(pe)),pe.exports}var Ae=Le(),ge={exports:{}},be;function De(){return be||(be=1,(function(se,le){(function(Y,V){se.exports=V()})(self,(()=>(()=>{var Y={};return(()=>{var V=Y;function K(z,T,r){return z.addEventListener(T,r),{dispose:()=>{r&&z.removeEventListener(T,r)}}}Object.defineProperty(V,"__esModule",{value:!0}),V.AttachAddon=void 0,V.AttachAddon=class{constructor(z,T){this._disposables=[],this._socket=z,this._socket.binaryType="arraybuffer",this._bidirectional=!(T&&T.bidirectional===!1)}activate(z){this._disposables.push(K(this._socket,"message",(T=>{const r=T.data;z.write(typeof r=="string"?r:new Uint8Array(r))}))),this._bidirectional&&(this._disposables.push(z.onData((T=>this._sendData(T)))),this._disposables.push(z.onBinary((T=>this._sendBinary(T))))),this._disposables.push(K(this._socket,"close",(()=>this.dispose()))),this._disposables.push(K(this._socket,"error",(()=>this.dispose())))}dispose(){for(const z of this._disposables)z.dispose()}_sendData(z){this._checkOpenSocket()&&this._socket.send(z)}_sendBinary(z){if(!this._checkOpenSocket())return;const T=new Uint8Array(z.length);for(let r=0;r<z.length;++r)T[r]=255&z.charCodeAt(r);this._socket.send(T)}_checkOpenSocket(){switch(this._socket.readyState){case WebSocket.OPEN:return!0;case WebSocket.CONNECTING:throw new Error("Attach addon was loaded before socket was open");case WebSocket.CLOSING:return console.warn("Attach addon socket is closing"),!1;case WebSocket.CLOSED:throw new Error("Attach addon socket is closed");default:throw new Error("Unexpected socket state")}}}})(),Y})()))})(ge)),ge.exports}var Be=De(),me={exports:{}},we;function xe(){return we||(we=1,(function(se,le){(function(Y,V){se.exports=V()})(self,(()=>(()=>{var Y={6:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkComputer=r.WebLinkProvider=void 0,r.WebLinkProvider=class{constructor(c,f,n,d={}){this._terminal=c,this._regex=f,this._handler=n,this._options=d}provideLinks(c,f){const n=o.computeLink(c,this._regex,this._terminal,this._handler);f(this._addCallbacks(n))}_addCallbacks(c){return c.map((f=>(f.leave=this._options.leave,f.hover=(n,d)=>{if(this._options.hover){const{range:u}=f;this._options.hover(n,d,u)}},f)))}};class o{static computeLink(f,n,d,u){const v=new RegExp(n.source,(n.flags||"")+"g"),[h,e]=o._getWindowedLineStrings(f-1,d),s=h.join("");let t;const i=[];for(;t=v.exec(s);){const l=t[0];try{const y=new URL(l),k=decodeURI(y.toString());if(l!==k&&l+"/"!==k)continue}catch(y){continue}const[_,p]=o._mapStrIdx(d,e,0,t.index),[m,a]=o._mapStrIdx(d,_,p,l.length);if(_===-1||p===-1||m===-1||a===-1)continue;const g={start:{x:p+1,y:_+1},end:{x:a,y:m+1}};i.push({range:g,text:l,activate:u})}return i}static _getWindowedLineStrings(f,n){let d,u=f,v=f,h=0,e="";const s=[];if(d=n.buffer.active.getLine(f)){const t=d.translateToString(!0);if(d.isWrapped&&t[0]!==" "){for(h=0;(d=n.buffer.active.getLine(--u))&&h<2048&&(e=d.translateToString(!0),h+=e.length,s.push(e),d.isWrapped&&e.indexOf(" ")===-1););s.reverse()}for(s.push(t),h=0;(d=n.buffer.active.getLine(++v))&&d.isWrapped&&h<2048&&(e=d.translateToString(!0),h+=e.length,s.push(e),e.indexOf(" ")===-1););}return[s,u]}static _mapStrIdx(f,n,d,u){const v=f.buffer.active,h=v.getNullCell();let e=d;for(;u;){const s=v.getLine(n);if(!s)return[-1,-1];for(let t=e;t<s.length;++t){s.getCell(t,h);const i=h.getChars();if(h.getWidth()&&(u-=i.length||1,t===s.length-1&&i==="")){const l=v.getLine(n+1);l&&l.isWrapped&&(l.getCell(0,h),h.getWidth()===2&&(u+=1))}if(u<0)return[n,t]}n++,e=0}return[n,e]}}r.LinkComputer=o}},V={};function K(T){var r=V[T];if(r!==void 0)return r.exports;var o=V[T]={exports:{}};return Y[T](o,o.exports,K),o.exports}var z={};return(()=>{var T=z;Object.defineProperty(T,"__esModule",{value:!0}),T.WebLinksAddon=void 0;const r=K(6),o=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function c(f,n){const d=window.open();if(d){try{d.opener=null}catch(u){}d.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}T.WebLinksAddon=class{constructor(f=c,n={}){this._handler=f,this._options=n}activate(f){this._terminal=f;const n=this._options,d=n.urlRegex||o;this._linkProvider=this._terminal.registerLinkProvider(new r.WebLinkProvider(this._terminal,d,this._handler,n))}dispose(){var f;(f=this._linkProvider)===null||f===void 0||f.dispose()}}})(),z})()))})(me)),me.exports}var Te=xe();export{Ae as a,Te as b,Be as c,Re as x};
|