@xiaoqiong0v0/opencode-ssh-tool 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web/app.js CHANGED
@@ -1,11 +1,12 @@
1
- "use strict";(()=>{var pt=Object.create;var ze=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var St=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var bt=(D,B,A)=>B in D?ze(D,B,{enumerable:!0,configurable:!0,writable:!0,value:A}):D[B]=A;var wt=(D,B)=>()=>{try{return B||D((B={exports:{}}).exports,B),B.exports}catch(A){throw B=0,A}};var yt=(D,B,A,I)=>{if(B&&typeof B=="object"||typeof B=="function")for(let L of mt(B))!Ct.call(D,L)&&L!==A&&ze(D,L,{get:()=>B[L],enumerable:!(I=gt(B,L))||I.enumerable});return D};var Et=(D,B,A)=>(A=D!=null?pt(St(D)):{},yt(B||!D||!D.__esModule?ze(A,"default",{value:D,enumerable:!0}):A,D));var ne=(D,B,A)=>bt(D,typeof B!="symbol"?B+"":B,A);var et=wt((Te,Ke)=>{(function(D,B){if(typeof Te=="object"&&typeof Ke=="object")Ke.exports=B();else if(typeof define=="function"&&define.amd)define([],B);else{var A=B();for(var I in A)(typeof Te=="object"?Te:D)[I]=A[I]}})(globalThis,(()=>(()=>{"use strict";var D={4567:function(L,r,n){var a=this&&this.__decorate||function(e,t,h,v){var f,p=arguments.length,l=p<3?t:v===null?v=Object.getOwnPropertyDescriptor(t,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,h,v);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(p<3?f(l):p>3?f(t,h,l):f(t,h))||l);return p>3&&l&&Object.defineProperty(t,h,l),l},u=this&&this.__param||function(e,t){return function(h,v){t(h,v,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let o=n(9042),d=n(9924),_=n(844),g=n(4725),c=n(2585),i=n(3656),s=r.AccessibilityManager=class extends _.Disposable{constructor(e,t,h,v){super(),this._terminal=e,this._coreBrowserService=h,this._renderService=v,this._rowColumns=new WeakMap,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 f=0;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);if(this._topBoundaryFocusListener=f=>this._handleBoundaryFocus(f,0),this._bottomBoundaryFocusListener=f=>this._handleBoundaryFocus(f,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((f=>this._handleResize(f.rows)))),this.register(this._terminal.onRender((f=>this._refreshRows(f.start,f.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((f=>this._handleChar(f)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
- `)))),this.register(this._terminal.onA11yTab((f=>this._handleTab(f)))),this.register(this._terminal.onKey((f=>this._handleKey(f.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
3
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let h=this._terminal.buffer,v=h.lines.length.toString();for(let f=e;f<=t;f++){let p=h.lines.get(h.ydisp+f),l=[],m=p?.translateToString(!0,void 0,void 0,l)||"",E=(h.ydisp+f+1).toString(),k=this._rowElements[f];k&&(m.length===0?(k.innerText="\xA0",this._rowColumns.set(k,[0,1])):(k.textContent=m,this._rowColumns.set(k,l)),k.setAttribute("aria-posinset",E),k.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let h=e.target,v=this._rowElements[t===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==v)return;let f,p;if(t===0?(f=h,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(f=this._rowElements.shift(),p=h,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}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(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},h={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===h.node&&t.offset>h.offset)&&([t,h]=[h,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let v=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:v,offset:v.textContent?.length??0}),!this._rowContainer.contains(h.node))return;let f=({node:m,offset:E})=>{let k=m instanceof Text?m.parentNode:m,x=parseInt(k?.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(k);if(!b)return console.warn("columns is null. Race condition?"),null;let M=E<b.length?b[E]:b.slice(-1)[0]+1;return M>=this._terminal.cols&&(++x,M=0),{row:x,column:M}},p=f(t),l=f(h);if(p&&l){if(p.row>l.row||p.row===l.row&&p.column>=l.column)throw new Error("invalid range");this._terminal.select(p.column,p.row,(l.row-p.row)*this._terminal.cols-p.column+l.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=s=a([u(1,c.IInstantiationService),u(2,g.ICoreBrowserService),u(3,g.IRenderService)],s)},3614:(L,r)=>{function n(d){return d.replace(/\r?\n/g,"\r")}function a(d,_){return _?"\x1B[200~"+d+"\x1B[201~":d}function u(d,_,g,c){d=a(d=n(d),g.decPrivateModes.bracketedPasteMode&&c.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(d,!0),_.value=""}function o(d,_,g){let c=g.getBoundingClientRect(),i=d.clientX-c.left-10,s=d.clientY-c.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${i}px`,_.style.top=`${s}px`,_.style.zIndex="1000",_.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=n,r.bracketTextForPaste=a,r.copyHandler=function(d,_){d.clipboardData&&d.clipboardData.setData("text/plain",_.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,_,g,c){d.stopPropagation(),d.clipboardData&&u(d.clipboardData.getData("text/plain"),_,g,c)},r.paste=u,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(d,_,g,c,i){o(d,_,g),i&&c.rightClickSelect(d),_.value=c.selectionText,_.select()}},7239:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let a=n(1505);r.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(u,o,d){this._css.set(u,o,d)}getCss(u,o){return this._css.get(u,o)}setColor(u,o,d){this._color.set(u,o,d)}getColor(u,o){return this._color.get(u,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,a,u,o){n.addEventListener(a,u,o);let d=!1;return{dispose:()=>{d||(d=!0,n.removeEventListener(a,u,o))}}}},3551:function(L,r,n){var a=this&&this.__decorate||function(s,e,t,h){var v,f=arguments.length,p=f<3?e:h===null?h=Object.getOwnPropertyDescriptor(e,t):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,h);else for(var l=s.length-1;l>=0;l--)(v=s[l])&&(p=(f<3?v(p):f>3?v(e,t,p):v(e,t))||p);return f>3&&p&&Object.defineProperty(e,t,p),p},u=this&&this.__param||function(s,e){return function(t,h){e(t,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=n(3656),d=n(8460),_=n(844),g=n(2585),c=n(4725),i=r.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,h,v){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=h,this._linkProviderService=v,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,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=s.composedPath();for(let h=0;h<t.length;h++){let v=t[h];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((h=>{h?.forEach((v=>{v.link.dispose&&v.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(let[h,v]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(h)&&(t=this._checkLinkProviderResult(h,s,t)):v.provideLinks(s.y,(f=>{if(this._isMouseOut)return;let p=f?.map((l=>({link:l})));this._activeProviderReplies?.set(h,p),t=this._checkLinkProviderResult(h,s,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)}))}_removeIntersectingLinks(s,e){let t=new Set;for(let h=0;h<e.size;h++){let v=e.get(h);if(v)for(let f=0;f<v.length;f++){let p=v[f],l=p.link.range.start.y<s?0:p.link.range.start.x,m=p.link.range.end.y>s?this._bufferService.cols:p.link.range.end.x;for(let E=l;E<=m;E++){if(t.has(E)){v.splice(f--,1);break}t.add(E)}}}}_checkLinkProviderResult(s,e,t){if(!this._activeProviderReplies)return t;let h=this._activeProviderReplies.get(s),v=!1;for(let f=0;f<s;f++)this._activeProviderReplies.has(f)&&!this._activeProviderReplies.get(f)||(v=!0);if(!v&&h){let f=h.find((p=>this._linkAtPosition(p.link,e)));f&&(t=!0,this._handleNewLink(f))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let f=0;f<this._activeProviderReplies.size;f++){let p=this._activeProviderReplies.get(f)?.find((l=>this._linkAtPosition(l.link,e)));if(p){t=!0,this._handleNewLink(p);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;let h=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(h,v),this._lastMouseEvent)){let f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._askForLink(f,!1)}}))))}_linkHover(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){let t=s.range,h=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-h-1,t.end.x,t.end.y-h-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){let t=s.range.start.y*this._bufferService.cols+s.range.start.x,h=s.range.end.y*this._bufferService.cols+s.range.end.x,v=e.y*this._bufferService.cols+e.x;return t<=v&&v<=h}_positionFromMouseEvent(s,e,t){let h=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,h,v){return{x1:s,y1:e,x2:t,y2:h,cols:this._bufferService.cols,fg:v}}};r.Linkifier=i=a([u(1,c.IMouseService),u(2,c.IRenderService),u(3,g.IBufferService),u(4,c.ILinkProviderService)],i)},9042:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(L,r,n){var a=this&&this.__decorate||function(c,i,s,e){var t,h=arguments.length,v=h<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(c,i,s,e);else for(var f=c.length-1;f>=0;f--)(t=c[f])&&(v=(h<3?t(v):h>3?t(i,s,v):t(i,s))||v);return h>3&&v&&Object.defineProperty(i,s,v),v},u=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=n(511),d=n(2585),_=r.OscLinkProvider=class{constructor(c,i,s){this._bufferService=c,this._optionsService=i,this._oscLinkService=s}provideLinks(c,i){let s=this._bufferService.buffer.lines.get(c-1);if(!s)return void i(void 0);let e=[],t=this._optionsService.rawOptions.linkHandler,h=new o.CellData,v=s.getTrimmedLength(),f=-1,p=-1,l=!1;for(let m=0;m<v;m++)if(p!==-1||s.hasContent(m)){if(s.loadCell(m,h),h.hasExtendedAttrs()&&h.extended.urlId){if(p===-1){p=m,f=h.extended.urlId;continue}l=h.extended.urlId!==f}else p!==-1&&(l=!0);if(l||p!==-1&&m===v-1){let E=this._oscLinkService.getLinkData(f)?.uri;if(E){let k={start:{x:p+1,y:c},end:{x:m+(l||m!==v-1?0:1),y:c}},x=!1;if(!t?.allowNonHttpProtocols)try{let b=new URL(E);["http:","https:"].includes(b.protocol)||(x=!0)}catch{x=!0}x||e.push({text:E,range:k,activate:(b,M)=>t?t.activate(b,M,k):g(0,M),hover:(b,M)=>t?.hover?.(b,M,k),leave:(b,M)=>t?.leave?.(b,M,k)})}l=!1,h.hasExtendedAttrs()&&h.extended.urlId?(p=m,f=h.extended.urlId):(p=-1,f=-1)}}i(e)}};function g(c,i){if(confirm(`Do you want to navigate to ${i}?
1
+ "use strict";(()=>{var kt=Object.create;var Ke=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var Tt=(T,I,U)=>I in T?Ke(T,I,{enumerable:!0,configurable:!0,writable:!0,value:U}):T[I]=U;var it=(T,I)=>()=>{try{return I||T((I={exports:{}}).exports,I),I.exports}catch(U){throw I=0,U}};var xt=(T,I,U,z)=>{if(I&&typeof I=="object"||typeof I=="function")for(let R of Bt(I))!At.call(T,R)&&R!==U&&Ke(T,R,{get:()=>I[R],enumerable:!(z=Lt(I,R))||z.enumerable});return T};var st=(T,I,U)=>(U=T!=null?kt(Dt(T)):{},xt(I||!T||!T.__esModule?Ke(U,"default",{value:T,enumerable:!0}):U,T));var Re=(T,I,U)=>Tt(T,typeof I!="symbol"?I+"":I,U);var nt=it((Me,Ve)=>{(function(T,I){if(typeof Me=="object"&&typeof Ve=="object")Ve.exports=I();else if(typeof define=="function"&&define.amd)define([],I);else{var U=I();for(var z in U)(typeof Me=="object"?Me:T)[z]=U[z]}})(globalThis,(()=>(()=>{"use strict";var T={4567:function(R,d,f){var n=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.AccessibilityManager=void 0;let h=f(9042),_=f(9924),c=f(844),p=f(4725),o=f(2585),i=f(3656),s=d.AccessibilityManager=class extends c.Disposable{constructor(e,t,r,a){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=a,this._rowColumns=new WeakMap,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 u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,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 _.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((u=>this._handleResize(u.rows)))),this.register(this._terminal.onRender((u=>this._refreshRows(u.start,u.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((u=>this._handleChar(u)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
+ `)))),this.register(this._terminal.onA11yTab((u=>this._handleTab(u)))),this.register(this._terminal.onKey((u=>this._handleKey(u.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,c.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
3
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,a=r.lines.length.toString();for(let u=e;u<=t;u++){let g=r.lines.get(r.ydisp+u),v=[],S=g?.translateToString(!0,void 0,void 0,v)||"",y=(r.ydisp+u+1).toString(),D=this._rowElements[u];D&&(S.length===0?(D.innerText="\xA0",this._rowColumns.set(D,[0,1])):(D.textContent=S,this._rowColumns.set(D,v)),D.setAttribute("aria-posinset",y),D.setAttribute("aria-setsize",a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,a=this._rowElements[t===0?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==a)return;let u,g;if(t===0?(u=r,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(u=this._rowElements.shift(),g=r,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let v=this._createAccessibilityTreeNode();this._rowElements.unshift(v),this._rowContainer.insertAdjacentElement("afterbegin",v)}else{let v=this._createAccessibilityTreeNode();this._rowElements.push(v),this._rowContainer.appendChild(v)}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(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let a=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let u=({node:S,offset:y})=>{let D=S instanceof Text?S.parentNode:S,M=parseInt(D?.getAttribute("aria-posinset"),10)-1;if(isNaN(M))return console.warn("row is invalid. Race condition?"),null;let E=this._rowColumns.get(D);if(!E)return console.warn("columns is null. Race condition?"),null;let x=y<E.length?E[y]:E.slice(-1)[0]+1;return x>=this._terminal.cols&&(++M,x=0),{row:M,column:x}},g=u(t),v=u(r);if(g&&v){if(g.row>v.row||g.row===v.row&&g.column>=v.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(v.row-g.row)*this._terminal.cols-g.column+v.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};d.AccessibilityManager=s=n([l(1,o.IInstantiationService),l(2,p.ICoreBrowserService),l(3,p.IRenderService)],s)},3614:(R,d)=>{function f(_){return _.replace(/\r?\n/g,"\r")}function n(_,c){return c?"\x1B[200~"+_+"\x1B[201~":_}function l(_,c,p,o){_=n(_=f(_),p.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(_,!0),c.value=""}function h(_,c,p){let o=p.getBoundingClientRect(),i=_.clientX-o.left-10,s=_.clientY-o.top-10;c.style.width="20px",c.style.height="20px",c.style.left=`${i}px`,c.style.top=`${s}px`,c.style.zIndex="1000",c.focus()}Object.defineProperty(d,"__esModule",{value:!0}),d.rightClickHandler=d.moveTextAreaUnderMouseCursor=d.paste=d.handlePasteEvent=d.copyHandler=d.bracketTextForPaste=d.prepareTextForTerminal=void 0,d.prepareTextForTerminal=f,d.bracketTextForPaste=n,d.copyHandler=function(_,c){_.clipboardData&&_.clipboardData.setData("text/plain",c.selectionText),_.preventDefault()},d.handlePasteEvent=function(_,c,p,o){_.stopPropagation(),_.clipboardData&&l(_.clipboardData.getData("text/plain"),c,p,o)},d.paste=l,d.moveTextAreaUnderMouseCursor=h,d.rightClickHandler=function(_,c,p,o,i){h(_,c,p),i&&o.rightClickSelect(_),c.value=o.selectionText,c.select()}},7239:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ColorContrastCache=void 0;let n=f(1505);d.ColorContrastCache=class{constructor(){this._color=new n.TwoKeyMap,this._css=new n.TwoKeyMap}setCss(l,h,_){this._css.set(l,h,_)}getCss(l,h){return this._css.get(l,h)}setColor(l,h,_){this._color.set(l,h,_)}getColor(l,h){return this._color.get(l,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.addDisposableDomListener=void 0,d.addDisposableDomListener=function(f,n,l,h){f.addEventListener(n,l,h);let _=!1;return{dispose:()=>{_||(_=!0,f.removeEventListener(n,l,h))}}}},3551:function(R,d,f){var n=this&&this.__decorate||function(s,e,t,r){var a,u=arguments.length,g=u<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,r);else for(var v=s.length-1;v>=0;v--)(a=s[v])&&(g=(u<3?a(g):u>3?a(e,t,g):a(e,t))||g);return u>3&&g&&Object.defineProperty(e,t,g),g},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.Linkifier=void 0;let h=f(3656),_=f(8460),c=f(844),p=f(2585),o=f(4725),i=d.Linkifier=class extends c.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,r,a){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=r,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,c.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,c.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=s.composedPath();for(let r=0;r<t.length;r++){let a=t[r];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((r=>{r?.forEach((a=>{a.link.dispose&&a.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(let[r,a]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(r)&&(t=this._checkLinkProviderResult(r,s,t)):a.provideLinks(s.y,(u=>{if(this._isMouseOut)return;let g=u?.map((v=>({link:v})));this._activeProviderReplies?.set(r,g),t=this._checkLinkProviderResult(r,s,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)}))}_removeIntersectingLinks(s,e){let t=new Set;for(let r=0;r<e.size;r++){let a=e.get(r);if(a)for(let u=0;u<a.length;u++){let g=a[u],v=g.link.range.start.y<s?0:g.link.range.start.x,S=g.link.range.end.y>s?this._bufferService.cols:g.link.range.end.x;for(let y=v;y<=S;y++){if(t.has(y)){a.splice(u--,1);break}t.add(y)}}}}_checkLinkProviderResult(s,e,t){if(!this._activeProviderReplies)return t;let r=this._activeProviderReplies.get(s),a=!1;for(let u=0;u<s;u++)this._activeProviderReplies.has(u)&&!this._activeProviderReplies.get(u)||(a=!0);if(!a&&r){let u=r.find((g=>this._linkAtPosition(g.link,e)));u&&(t=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let u=0;u<this._activeProviderReplies.size;u++){let g=this._activeProviderReplies.get(u)?.find((v=>this._linkAtPosition(v.link,e)));if(g){t=!0,this._handleNewLink(g);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,c.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;let r=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(r,a),this._lastMouseEvent)){let u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}}))))}_linkHover(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){let t=s.range,r=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-r-1,t.end.x,t.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){let t=s.range.start.y*this._bufferService.cols+s.range.start.x,r=s.range.end.y*this._bufferService.cols+s.range.end.x,a=e.y*this._bufferService.cols+e.x;return t<=a&&a<=r}_positionFromMouseEvent(s,e,t){let r=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,r,a){return{x1:s,y1:e,x2:t,y2:r,cols:this._bufferService.cols,fg:a}}};d.Linkifier=i=n([l(1,o.IMouseService),l(2,o.IRenderService),l(3,p.IBufferService),l(4,o.ILinkProviderService)],i)},9042:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.tooMuchOutput=d.promptLabel=void 0,d.promptLabel="Terminal input",d.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(R,d,f){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var u=o.length-1;u>=0;u--)(t=o[u])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OscLinkProvider=void 0;let h=f(511),_=f(2585),c=d.OscLinkProvider=class{constructor(o,i,s){this._bufferService=o,this._optionsService=i,this._oscLinkService=s}provideLinks(o,i){let s=this._bufferService.buffer.lines.get(o-1);if(!s)return void i(void 0);let e=[],t=this._optionsService.rawOptions.linkHandler,r=new h.CellData,a=s.getTrimmedLength(),u=-1,g=-1,v=!1;for(let S=0;S<a;S++)if(g!==-1||s.hasContent(S)){if(s.loadCell(S,r),r.hasExtendedAttrs()&&r.extended.urlId){if(g===-1){g=S,u=r.extended.urlId;continue}v=r.extended.urlId!==u}else g!==-1&&(v=!0);if(v||g!==-1&&S===a-1){let y=this._oscLinkService.getLinkData(u)?.uri;if(y){let D={start:{x:g+1,y:o},end:{x:S+(v||S!==a-1?0:1),y:o}},M=!1;if(!t?.allowNonHttpProtocols)try{let E=new URL(y);["http:","https:"].includes(E.protocol)||(M=!0)}catch{M=!0}M||e.push({text:y,range:D,activate:(E,x)=>t?t.activate(E,x,D):p(0,x),hover:(E,x)=>t?.hover?.(E,x,D),leave:(E,x)=>t?.leave?.(E,x,D)})}v=!1,r.hasExtendedAttrs()&&r.extended.urlId?(g=S,u=r.extended.urlId):(g=-1,u=-1)}}i(e)}};function p(o,i){if(confirm(`Do you want to navigate to ${i}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=_=a([u(0,d.IBufferService),u(1,d.IOptionsService),u(2,d.IOscLinkService)],_)},6193:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(n,a){this._renderCallback=n,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let a=n(3614),u=n(3656),o=n(3551),d=n(9042),_=n(3730),g=n(1680),c=n(3107),i=n(5744),s=n(2950),e=n(1296),t=n(428),h=n(4269),v=n(5114),f=n(8934),p=n(3230),l=n(9312),m=n(4725),E=n(6731),k=n(8055),x=n(8969),b=n(8460),M=n(844),H=n(6114),N=n(8437),z=n(2584),W=n(7399),S=n(5941),w=n(9074),y=n(2585),R=n(5435),P=n(4567),U=n(779);class K extends x.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(T={}){super(T),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new M.MutableDisposable),this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new b.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new b.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new b.EventEmitter),this._onBlur=this.register(new b.EventEmitter),this._onA11yCharEmitter=this.register(new b.EventEmitter),this._onA11yTabEmitter=this.register(new b.EventEmitter),this._onWillOpen=this.register(new b.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(w.DecorationService),this._instantiationService.setService(y.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(U.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((C,O)=>this.refresh(C,O)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((C=>this._reportWindowsOptions(C)))),this.register(this._inputHandler.onColor((C=>this._handleColorEvent(C)))),this.register((0,b.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,b.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((C=>this._afterResize(C.cols,C.rows)))),this.register((0,M.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(T){if(this._themeService)for(let C of T){let O,F="";switch(C.index){case 256:O="foreground",F="10";break;case 257:O="background",F="11";break;case 258:O="cursor",F="12";break;default:O="ansi",F="4;"+C.index}switch(C.type){case 0:let j=k.color.toColorRGB(O==="ansi"?this._themeService.colors.ansi[C.index]:this._themeService.colors[O]);this.coreService.triggerDataEvent(`${z.C0.ESC}]${F};${(0,S.toRgbString)(j)}${z.C1_ESCAPED.ST}`);break;case 1:if(O==="ansi")this._themeService.modifyColors(($=>$.ansi[C.index]=k.channels.toColor(...C.color)));else{let $=O;this._themeService.modifyColors((G=>G[$]=k.channels.toColor(...C.color)))}break;case 2:this._themeService.restoreColor(C.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(T){T?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(T){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let T=this.buffer.ybase+this.buffer.y,C=this.buffer.lines.get(T);if(!C)return;let O=Math.min(this.buffer.x,this.cols-1),F=this._renderService.dimensions.css.cell.height,j=C.getWidth(O),$=this._renderService.dimensions.css.cell.width*j,G=this.buffer.y*this._renderService.dimensions.css.cell.height,Y=O*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Y+"px",this.textarea.style.top=G+"px",this.textarea.style.width=$+"px",this.textarea.style.height=F+"px",this.textarea.style.lineHeight=F+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(C=>{this.hasSelection()&&(0,a.copyHandler)(C,this._selectionService)})));let T=C=>(0,a.handlePasteEvent)(C,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",T)),this.register((0,u.addDisposableDomListener)(this.element,"paste",T)),H.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(C=>{C.button===2&&(0,a.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(C=>{(0,a.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(C=>{C.button===1&&(0,a.moveTextAreaUnderMouseCursor)(C,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(T=>this._keyUp(T)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(T=>this._keyDown(T)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(T=>this._keyPress(T)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(T=>this._compositionHelper.compositionupdate(T)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(T=>this._inputEvent(T)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(T){if(!T)throw new Error("Terminal requires a parent element.");if(T.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=T.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"),T.appendChild(this.element);let C=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),C.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.register((0,u.addDisposableDomListener)(this.screenElement,"mousemove",(O=>this.updateCursorStyle(O)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),C.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),H.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(v.CoreBrowserService,this.textarea,T.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",(O=>this._handleTextAreaFocus(O)))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(E.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(h.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(p.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((O=>this._onRender.fire(O)))),this.onResize((O=>this._renderService.resize(O.cols,O.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._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(C);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((O=>this.scrollLines(O.amount,O.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(l.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((O=>this.scrollLines(O.amount,O.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((O=>this._renderService.handleSelectionChanged(O.start,O.end,O.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((O=>{this.textarea.value=O,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((O=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(O=>this._selectionService.handleMouseDown(O)))),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(P.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(O=>this._handleScreenReaderModeOptionChange(O)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(O=>{!this._overviewRulerRenderer&&O&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let T=this,C=this.element;function O($){let G=T._mouseService.getMouseReportCoords($,T.screenElement);if(!G)return!1;let Y,Z;switch($.overrideType||$.type){case"mousemove":Z=32,$.buttons===void 0?(Y=3,$.button!==void 0&&(Y=$.button<3?$.button:3)):Y=1&$.buttons?0:4&$.buttons?1:2&$.buttons?2:3;break;case"mouseup":Z=0,Y=$.button<3?$.button:3;break;case"mousedown":Z=1,Y=$.button<3?$.button:3;break;case"wheel":if(T._customWheelEventHandler&&T._customWheelEventHandler($)===!1||T.viewport.getLinesScrolled($)===0)return!1;Z=$.deltaY<0?0:1,Y=4;break;default:return!1}return!(Z===void 0||Y===void 0||Y>4)&&T.coreMouseService.triggerMouseEvent({col:G.col,row:G.row,x:G.x,y:G.y,button:Y,action:Z,ctrl:$.ctrlKey,alt:$.altKey,shift:$.shiftKey})}let F={mouseup:null,wheel:null,mousedrag:null,mousemove:null},j={mouseup:$=>(O($),$.buttons||(this._document.removeEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.removeEventListener("mousemove",F.mousedrag)),this.cancel($)),wheel:$=>(O($),this.cancel($,!0)),mousedrag:$=>{$.buttons&&O($)},mousemove:$=>{$.buttons||O($)}};this.register(this.coreMouseService.onProtocolChange(($=>{$?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents($)),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&$?F.mousemove||(C.addEventListener("mousemove",j.mousemove),F.mousemove=j.mousemove):(C.removeEventListener("mousemove",F.mousemove),F.mousemove=null),16&$?F.wheel||(C.addEventListener("wheel",j.wheel,{passive:!1}),F.wheel=j.wheel):(C.removeEventListener("wheel",F.wheel),F.wheel=null),2&$?F.mouseup||(F.mouseup=j.mouseup):(this._document.removeEventListener("mouseup",F.mouseup),F.mouseup=null),4&$?F.mousedrag||(F.mousedrag=j.mousedrag):(this._document.removeEventListener("mousemove",F.mousedrag),F.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(C,"mousedown",($=>{if($.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection($))return O($),F.mouseup&&this._document.addEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.addEventListener("mousemove",F.mousedrag),this.cancel($)}))),this.register((0,u.addDisposableDomListener)(C,"wheel",($=>{if(!F.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler($)===!1)return!1;if(!this.buffer.hasScrollback){let G=this.viewport.getLinesScrolled($);if(G===0)return;let Y=z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+($.deltaY<0?"A":"B"),Z="";for(let te=0;te<Math.abs(G);te++)Z+=Y;return this.coreService.triggerDataEvent(Z,!0),this.cancel($,!0)}return this.viewport.handleWheel($)?this.cancel($):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(C,"touchstart",($=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart($),this.cancel($)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(C,"touchmove",($=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove($)?void 0:this.cancel($)}),{passive:!1}))}refresh(T,C){this._renderService?.refreshRows(T,C)}updateCursorStyle(T){this._selectionService?.shouldColumnSelect(T)?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(T,C,O=0){O===1?(super.scrollLines(T,C,O),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(T)}paste(T){(0,a.paste)(T,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(T){this._customKeyEventHandler=T}attachCustomWheelEventHandler(T){this._customWheelEventHandler=T}registerLinkProvider(T){return this._linkProviderService.registerLinkProvider(T)}registerCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let C=this._characterJoinerService.register(T);return this.refresh(0,this.rows-1),C}deregisterCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(T)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(T){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+T)}registerDecoration(T){return this._decorationService.registerDecoration(T)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(T,C,O){this._selectionService.setSelection(T,C,O)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(T,C){this._selectionService?.selectLines(T,C)}_keyDown(T){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;let C=this.browser.isMac&&this.options.macOptionIsMeta&&T.altKey;if(!C&&!this._compositionHelper.keydown(T))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;C||T.key!=="Dead"&&T.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let O=(0,W.evaluateKeyboardEvent)(T,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),O.type===3||O.type===2){let F=this.rows-1;return this.scrollLines(O.type===2?-F:F),this.cancel(T,!0)}return O.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||(O.cancel&&this.cancel(T,!0),!O.key||!!(T.key&&!T.ctrlKey&&!T.altKey&&!T.metaKey&&T.key.length===1&&T.key.charCodeAt(0)>=65&&T.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(O.key!==z.C0.ETX&&O.key!==z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:O.key,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(O.key,!0),!this.optionsService.rawOptions.screenReaderMode||T.altKey||T.ctrlKey?this.cancel(T,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(T,C){let O=T.isMac&&!this.options.macOptionIsMeta&&C.altKey&&!C.ctrlKey&&!C.metaKey||T.isWindows&&C.altKey&&C.ctrlKey&&!C.metaKey||T.isWindows&&C.getModifierState("AltGraph");return C.type==="keypress"?O:O&&(!C.keyCode||C.keyCode>47)}_keyUp(T){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||((function(C){return C.keyCode===16||C.keyCode===17||C.keyCode===18})(T)||this.focus(),this.updateCursorStyle(T),this._keyPressHandled=!1)}_keyPress(T){let C;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)C=T.charCode;else if(T.which===null||T.which===void 0)C=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;C=T.which}return!(!C||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(C=String.fromCharCode(C),this._onKey.fire({key:C,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(C,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(T){if(T.data&&T.inputType==="insertText"&&(!T.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let C=T.data;return this.coreService.triggerDataEvent(C,!0),this.cancel(T),!0}return!1}resize(T,C){T!==this.cols||C!==this.rows?super.resize(T,C):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(T,C){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let T=1;T<this.rows;T++)this.buffer.lines.push(this.buffer.getBlankLine(N.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let T=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=T,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(z.C0.ESC+"[I"):this.coreService.triggerDataEvent(z.C0.ESC+"[O")}_reportWindowsOptions(T){if(this._renderService)switch(T){case R.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let C=this._renderService.dimensions.css.canvas.width.toFixed(0),O=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[4;${O};${C}t`);break;case R.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let F=this._renderService.dimensions.css.cell.width.toFixed(0),j=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[6;${j};${F}t`)}}cancel(T,C){if(this.options.cancelEvents||C)return T.preventDefault(),T.stopPropagation(),!1}}r.Terminal=K},9924:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(n,a=1e3){this._renderCallback=n,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let d=o-this._lastRefreshMs,_=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a)}}},1680:function(L,r,n){var a=this&&this.__decorate||function(s,e,t,h){var v,f=arguments.length,p=f<3?e:h===null?h=Object.getOwnPropertyDescriptor(e,t):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,h);else for(var l=s.length-1;l>=0;l--)(v=s[l])&&(p=(f<3?v(p):f>3?v(e,t,p):v(e,t))||p);return f>3&&p&&Object.defineProperty(e,t,p),p},u=this&&this.__param||function(s,e){return function(t,h){e(t,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=n(3656),d=n(4725),_=n(8460),g=n(844),c=n(2585),i=r.Viewport=class extends g.Disposable{constructor(s,e,t,h,v,f,p,l){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=h,this._charSizeService=v,this._renderService=f,this._coreBrowserService=p,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 _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((m=>this._handleThemeChange(m)))),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;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,e){let t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){let e=this._getPixelsScrolled(s);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,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 e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let t,h="",v=[],f=e??this._bufferService.buffer.lines.length,p=this._bufferService.buffer.lines;for(let l=s;l<f;l++){let m=p.get(l);if(!m)continue;let E=p.get(l+1)?.isWrapped;if(h+=m.translateToString(!E),!E||l===p.length-1){let k=document.createElement("div");k.textContent=h,v.push(k),h.length>0&&(t=k),h=""}}return{bufferElements:v,cursorElement:t}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){let t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};r.Viewport=i=a([u(2,c.IBufferService),u(3,c.IOptionsService),u(4,d.ICharSizeService),u(5,d.IRenderService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],i)},3107:function(L,r,n){var a=this&&this.__decorate||function(c,i,s,e){var t,h=arguments.length,v=h<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(c,i,s,e);else for(var f=c.length-1;f>=0;f--)(t=c[f])&&(v=(h<3?t(v):h>3?t(i,s,v):t(i,s))||v);return h>3&&v&&Object.defineProperty(i,s,v),v},u=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=n(4725),d=n(844),_=n(2585),g=r.BufferDecorationRenderer=class extends d.Disposable{constructor(c,i,s,e,t){super(),this._screenElement=c,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,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((h=>this._removeDecoration(h)))),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(let c of this._decorationService.decorations)this._renderDecoration(c);this._dimensionsChanged=!1}_renderDecoration(c){this._refreshStyle(c),this._dimensionsChanged&&this._refreshXPosition(c)}_createElement(c){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",c?.options?.layer==="top"),i.style.width=`${Math.round((c.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(c.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(c.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=c.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(c,i),i}_refreshStyle(c){let i=c.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)c.element&&(c.element.style.display="none",c.onRenderEmitter.fire(c.element));else{let s=this._decorationElements.get(c);s||(s=this._createElement(c),c.element=s,this._decorationElements.set(c,s),this._container.appendChild(s),c.onDispose((()=>{this._decorationElements.delete(c),s.remove()}))),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",c.onRenderEmitter.fire(s)}}_refreshXPosition(c,i=c.element){if(!i)return;let s=c.options.x??0;(c.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(c){this._decorationElements.get(c)?.remove(),this._decorationElements.delete(c),c.dispose()}};r.BufferDecorationRenderer=g=a([u(1,_.IBufferService),u(2,o.ICoreBrowserService),u(3,_.IDecorationService),u(4,o.IRenderService)],g)},5871:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(n){if(n.options.overviewRulerOptions){for(let a of this._zones)if(a.color===n.options.overviewRulerOptions.color&&a.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,n.marker.line))return;if(this._lineAdjacentToZone(a,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(a,n.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=n.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=n.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=n.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=n.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:n.options.overviewRulerOptions.color,position:n.options.overviewRulerOptions.position,startBufferLine:n.marker.line,endBufferLine:n.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(n){this._linePadding=n}_lineIntersectsZone(n,a){return a>=n.startBufferLine&&a<=n.endBufferLine}_lineAdjacentToZone(n,a,u){return a>=n.startBufferLine-this._linePadding[u||"full"]&&a<=n.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(n,a){n.startBufferLine=Math.min(n.startBufferLine,a),n.endBufferLine=Math.max(n.endBufferLine,a)}}},5744:function(L,r,n){var a=this&&this.__decorate||function(t,h,v,f){var p,l=arguments.length,m=l<3?h:f===null?f=Object.getOwnPropertyDescriptor(h,v):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,h,v,f);else for(var E=t.length-1;E>=0;E--)(p=t[E])&&(m=(l<3?p(m):l>3?p(h,v,m):p(h,v))||m);return l>3&&m&&Object.defineProperty(h,v,m),m},u=this&&this.__param||function(t,h){return function(v,f){h(v,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=n(5871),d=n(4725),_=n(844),g=n(2585),c={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=r.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,h,v,f,p,l,m){super(),this._viewportElement=t,this._screenElement=h,this._bufferService=v,this._decorationService=f,this._renderService=p,this._optionsService=l,this._coreBrowserService=m,this._colorZoneStore=new o.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let E=this._canvas.getContext("2d");if(!E)throw new Error("Ctx cannot be null");this._ctx=E,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{this._canvas?.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(){let t=Math.floor(this._canvas.width/3),h=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=h,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){c.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,h=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);c.left=h,c.center=h,c.right=h}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${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(let h of this._decorationService.decorations)this._colorZoneStore.addDecoration(h);this._ctx.lineWidth=1;let t=this._colorZoneStore.zones;for(let h of t)h.position!=="full"&&this._renderColorZone(h);for(let h of t)h.position==="full"&&this._renderColorZone(h);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-c[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+c[t.position||"full"]))}_queueRefresh(t,h){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=h||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=e=a([u(2,g.IBufferService),u(3,g.IDecorationService),u(4,d.IRenderService),u(5,g.IOptionsService),u(6,d.ICoreBrowserService)],e)},2950:function(L,r,n){var a=this&&this.__decorate||function(c,i,s,e){var t,h=arguments.length,v=h<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(c,i,s,e);else for(var f=c.length-1;f>=0;f--)(t=c[f])&&(v=(h<3?t(v):h>3?t(i,s,v):t(i,s))||v);return h>3&&v&&Object.defineProperty(i,s,v),v},u=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=n(4725),d=n(2585),_=n(2584),g=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(c,i,s,e,t,h){this._textarea=c,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=h,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(c){this._compositionView.textContent=c.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(c){if(this._isComposing||this._isSendingComposition){if(c.keyCode===229||c.keyCode===16||c.keyCode===17||c.keyCode===18)return!1;this._finalizeComposition(!1)}return c.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(c){if(this._compositionView.classList.remove("active"),this._isComposing=!1,c){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let c=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(c,"");this._dataAlreadySent=s,i.length>c.length?this._coreService.triggerDataEvent(s,!0):i.length<c.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):i.length===c.length&&i!==c&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(c){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,t=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=t+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=t+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}c||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=g=a([u(2,d.IBufferService),u(3,d.IOptionsService),u(4,d.ICoreService),u(5,o.IRenderService)],g)},9806:(L,r)=>{function n(a,u,o){let d=o.getBoundingClientRect(),_=a.getComputedStyle(o),g=parseInt(_.getPropertyValue("padding-left")),c=parseInt(_.getPropertyValue("padding-top"));return[u.clientX-d.left-g,u.clientY-d.top-c]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(a,u,o,d,_,g,c,i,s){if(!g)return;let e=n(a,u,o);return e?(e[0]=Math.ceil((e[0]+(s?c/2:0))/c),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),d+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),_),e):void 0}},9504:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let a=n(2584);function u(i,s,e,t){let h=i-o(i,e),v=s-o(s,e),f=Math.abs(h-v)-(function(p,l,m){let E=0,k=p-o(p,m),x=l-o(l,m);for(let b=0;b<Math.abs(k-x);b++){let M=d(p,l)==="A"?-1:1;m.buffer.lines.get(k+M*b)?.isWrapped&&E++}return E})(i,s,e);return c(f,g(d(i,s),t))}function o(i,s){let e=0,t=s.buffer.lines.get(i),h=t?.isWrapped;for(;h&&i>=0&&i<s.rows;)e++,t=s.buffer.lines.get(--i),h=t?.isWrapped;return e}function d(i,s){return i>s?"A":"B"}function _(i,s,e,t,h,v){let f=i,p=s,l="";for(;f!==e||p!==t;)f+=h?1:-1,h&&f>v.cols-1?(l+=v.buffer.translateBufferLineToString(p,!1,i,f),f=0,i=0,p++):!h&&f<0&&(l+=v.buffer.translateBufferLineToString(p,!1,0,i+1),f=v.cols-1,i=f,p--);return l+v.buffer.translateBufferLineToString(p,!1,i,f)}function g(i,s){let e=s?"O":"[";return a.C0.ESC+e+i}function c(i,s){i=Math.floor(i);let e="";for(let t=0;t<i;t++)e+=s;return e}r.moveToCellSequence=function(i,s,e,t){let h=e.buffer.x,v=e.buffer.y;if(!e.buffer.hasScrollback)return(function(l,m,E,k,x,b){return u(m,k,x,b).length===0?"":c(_(l,m,l,m-o(m,x),!1,x).length,g("D",b))})(h,v,0,s,e,t)+u(v,s,e,t)+(function(l,m,E,k,x,b){let M;M=u(m,k,x,b).length>0?k-o(k,x):m;let H=k,N=(function(z,W,S,w,y,R){let P;return P=u(S,w,y,R).length>0?w-o(w,y):W,z<S&&P<=w||z>=S&&P<w?"C":"D"})(l,m,E,k,x,b);return c(_(l,M,E,H,N==="C",x).length,g(N,b))})(h,v,i,s,e,t);let f;if(v===s)return f=h>i?"D":"C",c(Math.abs(h-i),g(f,t));f=v>s?"D":"C";let p=Math.abs(v-s);return c((function(l,m){return m.cols-l})(v>s?i:h,e)+(p-1)*e.cols+1+((v>s?h:i)-1),g(f,t))}},1296:function(L,r,n){var a=this&&this.__decorate||function(b,M,H,N){var z,W=arguments.length,S=W<3?M:N===null?N=Object.getOwnPropertyDescriptor(M,H):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,M,H,N);else for(var w=b.length-1;w>=0;w--)(z=b[w])&&(S=(W<3?z(S):W>3?z(M,H,S):z(M,H))||S);return W>3&&S&&Object.defineProperty(M,H,S),S},u=this&&this.__param||function(b,M){return function(H,N){M(H,N,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=n(3787),d=n(2550),_=n(2223),g=n(6171),c=n(6052),i=n(4725),s=n(8055),e=n(8460),t=n(844),h=n(2585),v="xterm-dom-renderer-owner-",f="xterm-rows",p="xterm-fg-",l="xterm-bg-",m="xterm-focus",E="xterm-selection",k=1,x=r.DomRenderer=class extends t.Disposable{constructor(b,M,H,N,z,W,S,w,y,R,P,U,K){super(),this._terminal=b,this._document=M,this._element=H,this._screenElement=N,this._viewportElement=z,this._helperContainer=W,this._linkifier2=S,this._charSizeService=y,this._optionsService=R,this._bufferService=P,this._coreBrowserService=U,this._themeService=K,this._terminalClass=k++,this._rowElements=[],this._selectionRenderModel=(0,c.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(f),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(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((q=>this._injectCss(q)))),this._injectCss(this._themeService.colors),this._rowFactory=w.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((q=>this._handleLinkHover(q)))),this.register(this._linkifier2.onHideLinkUnderline((q=>this._handleLinkLeave(q)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(v+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(){let 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(let H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let M=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=M,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(b){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let M=`${this._terminalSelector} .${f} { color: ${b.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;M+=`${this._terminalSelector} .${f} .xterm-dim { color: ${s.color.multiplyOpacity(b.foreground,.5).css};}`,M+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let H=`blink_underline_${this._terminalClass}`,N=`blink_bar_${this._terminalClass}`,z=`blink_block_${this._terminalClass}`;M+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,M+=`@keyframes ${N} { 50% { box-shadow: none; }}`,M+=`@keyframes ${z} { 0% { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css}; } 50% { background-color: inherit; color: ${b.cursor.css}; }}`,M+=`${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${b.cursor.css} !important; color: ${b.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${b.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${b.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${b.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,M+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${b.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${b.selectionInactiveBackgroundOpaque.css};}`;for(let[W,S]of b.ansi.entries())M+=`${this._terminalSelector} .${p}${W} { color: ${S.css}; }${this._terminalSelector} .${p}${W}.xterm-dim { color: ${s.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${l}${W} { background-color: ${S.css}; }`;M+=`${this._terminalSelector} .${p}${_.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(b.background).css}; }${this._terminalSelector} .${p}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(b.background),.5).css}; }${this._terminalSelector} .${l}${_.INVERTED_DEFAULT_COLOR} { background-color: ${b.foreground.css}; }`,this._themeStyleElement.textContent=M}_setDefaultSpacing(){let b=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${b}px`,this._rowFactory.defaultSpacing=b}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(b,M){for(let H=this._rowElements.length;H<=M;H++){let N=this._document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>M;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(b,M){this._refreshRowElements(b,M),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(b,M,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(b,M,H),this.renderRows(0,this._bufferService.rows-1),!b||!M)return;this._selectionRenderModel.update(this._terminal,b,M,H);let N=this._selectionRenderModel.viewportStartRow,z=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||S<0)return;let w=this._document.createDocumentFragment();if(H){let y=b[0]>M[0];w.appendChild(this._createSelectionElement(W,y?M[0]:b[0],y?b[0]:M[0],S-W+1))}else{let y=N===W?b[0]:0,R=W===z?M[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(W,y,R));let P=S-W-1;if(w.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,P)),W!==S){let U=z===S?M[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(S,0,U))}}this._selectionContainer.appendChild(w)}_createSelectionElement(b,M,H,N=1){let z=this._document.createElement("div"),W=M*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(H-M);return W+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-W),z.style.height=N*this.dimensions.css.cell.height+"px",z.style.top=b*this.dimensions.css.cell.height+"px",z.style.left=`${W}px`,z.style.width=`${S}px`,z}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let b of this._rowElements)b.replaceChildren()}renderRows(b,M){let H=this._bufferService.buffer,N=H.ybase+H.y,z=Math.min(H.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=b;y<=M;y++){let R=y+H.ydisp,P=this._rowElements[y],U=H.lines.get(R);if(!P||!U)break;P.replaceChildren(...this._rowFactory.createRow(U,R,R===N,S,w,z,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${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,M,H,N,z,W){H<0&&(b=0),N<0&&(M=0);let S=this._bufferService.rows-1;H=Math.max(Math.min(H,S),0),N=Math.max(Math.min(N,S),0),z=Math.min(z,this._bufferService.cols);let w=this._bufferService.buffer,y=w.ybase+w.y,R=Math.min(w.x,z-1),P=this._optionsService.rawOptions.cursorBlink,U=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let q=H;q<=N;++q){let T=q+w.ydisp,C=this._rowElements[q],O=w.lines.get(T);if(!C||!O)break;C.replaceChildren(...this._rowFactory.createRow(O,T,T===y,U,K,R,P,this.dimensions.css.cell.width,this._widthCache,W?q===H?b:0:-1,W?(q===N?M:z)-1:-1))}}};r.DomRenderer=x=a([u(7,h.IInstantiationService),u(8,i.ICharSizeService),u(9,h.IOptionsService),u(10,h.IBufferService),u(11,i.ICoreBrowserService),u(12,i.IThemeService)],x)},3787:function(L,r,n){var a=this&&this.__decorate||function(f,p,l,m){var E,k=arguments.length,x=k<3?p:m===null?m=Object.getOwnPropertyDescriptor(p,l):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,p,l,m);else for(var b=f.length-1;b>=0;b--)(E=f[b])&&(x=(k<3?E(x):k>3?E(p,l,x):E(p,l))||x);return k>3&&x&&Object.defineProperty(p,l,x),x},u=this&&this.__param||function(f,p){return function(l,m){p(l,m,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=n(2223),d=n(643),_=n(511),g=n(2585),c=n(8055),i=n(4725),s=n(4269),e=n(6171),t=n(3734),h=r.DomRendererRowFactory=class{constructor(f,p,l,m,E,k,x){this._document=f,this._characterJoinerService=p,this._optionsService=l,this._coreBrowserService=m,this._coreService=E,this._decorationService=k,this._themeService=x,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,p,l){this._selectionStart=f,this._selectionEnd=p,this._columnSelectMode=l}createRow(f,p,l,m,E,k,x,b,M,H,N){let z=[],W=this._characterJoinerService.getJoinedCharacters(p),S=this._themeService.colors,w,y=f.getNoBgTrimmedLength();l&&y<k+1&&(y=k+1);let R=0,P="",U=0,K=0,q=0,T=!1,C=0,O=!1,F=0,j=[],$=H!==-1&&N!==-1;for(let G=0;G<y;G++){f.loadCell(G,this._workCell);let Y=this._workCell.getWidth();if(Y===0)continue;let Z=!1,te=G,V=this._workCell;if(W.length>0&&G===W[0][0]){Z=!0;let J=W.shift();V=new s.JoinedCellData(this._workCell,f.translateToString(!0,J[0],J[1]),J[1]-J[0]),te=J[1]-1,Y=V.getWidth()}let we=this._isCellInSelection(G,p),Ne=l&&G===k,Ue=$&&G>=H&&G<=N,$e=!1;this._decorationService.forEachDecorationAtCell(G,p,void 0,(J=>{$e=!0}));let Be=V.getChars()||d.WHITESPACE_CELL_CHAR;if(Be===" "&&(V.isUnderline()||V.isOverline())&&(Be="\xA0"),F=Y*b-M.get(Be,V.isBold(),V.isItalic()),w){if(R&&(we&&O||!we&&!O&&V.bg===U)&&(we&&O&&S.selectionForeground||V.fg===K)&&V.extended.ext===q&&Ue===T&&F===C&&!Ne&&!Z&&!$e){V.isInvisible()?P+=d.WHITESPACE_CELL_CHAR:P+=Be,R++;continue}R&&(w.textContent=P),w=this._document.createElement("span"),R=0,P=""}else w=this._document.createElement("span");if(U=V.bg,K=V.fg,q=V.extended.ext,T=Ue,C=F,O=we,Z&&k>=G&&k<=te&&(k=G),!this._coreService.isCursorHidden&&Ne&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)x&&j.push("xterm-cursor-blink"),j.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(E)switch(E){case"outline":j.push("xterm-cursor-outline");break;case"block":j.push("xterm-cursor-block");break;case"bar":j.push("xterm-cursor-bar");break;case"underline":j.push("xterm-cursor-underline")}}if(V.isBold()&&j.push("xterm-bold"),V.isItalic()&&j.push("xterm-italic"),V.isDim()&&j.push("xterm-dim"),P=V.isInvisible()?d.WHITESPACE_CELL_CHAR:V.getChars()||d.WHITESPACE_CELL_CHAR,V.isUnderline()&&(j.push(`xterm-underline-${V.extended.underlineStyle}`),P===" "&&(P="\xA0"),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let J=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&J<8&&(J+=8),w.style.textDecorationColor=S.ansi[J].css}V.isOverline()&&(j.push("xterm-overline"),P===" "&&(P="\xA0")),V.isStrikethrough()&&j.push("xterm-strikethrough"),Ue&&(w.style.textDecoration="underline");let se=V.getFgColor(),ye=V.getFgColorMode(),oe=V.getBgColor(),Ee=V.getBgColorMode(),je=!!V.isInverse();if(je){let J=se;se=oe,oe=J;let vt=ye;ye=Ee,Ee=vt}let ce,xe,le,ke=!1;switch(this._decorationService.forEachDecorationAtCell(G,p,void 0,(J=>{J.options.layer!=="top"&&ke||(J.backgroundColorRGB&&(Ee=50331648,oe=J.backgroundColorRGB.rgba>>8&16777215,ce=J.backgroundColorRGB),J.foregroundColorRGB&&(ye=50331648,se=J.foregroundColorRGB.rgba>>8&16777215,xe=J.foregroundColorRGB),ke=J.options.layer==="top")})),!ke&&we&&(ce=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,oe=ce.rgba>>8&16777215,Ee=50331648,ke=!0,S.selectionForeground&&(ye=50331648,se=S.selectionForeground.rgba>>8&16777215,xe=S.selectionForeground)),ke&&j.push("xterm-decoration-top"),Ee){case 16777216:case 33554432:le=S.ansi[oe],j.push(`xterm-bg-${oe}`);break;case 50331648:le=c.channels.toColor(oe>>16,oe>>8&255,255&oe),this._addStyle(w,`background-color:#${v((oe>>>0).toString(16),"0",6)}`);break;default:je?(le=S.foreground,j.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):le=S.background}switch(ce||V.isDim()&&(ce=c.color.multiplyOpacity(le,.5)),ye){case 16777216:case 33554432:V.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(w,le,S.ansi[se],V,ce,void 0)||j.push(`xterm-fg-${se}`);break;case 50331648:let J=c.channels.toColor(se>>16&255,se>>8&255,255&se);this._applyMinimumContrast(w,le,J,V,ce,xe)||this._addStyle(w,`color:#${v(se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,le,S.foreground,V,ce,xe)||je&&j.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}j.length&&(w.className=j.join(" "),j.length=0),Ne||Z||$e?w.textContent=P:R++,F!==this.defaultSpacing&&(w.style.letterSpacing=`${F}px`),z.push(w),G=te}return w&&R&&(w.textContent=P),z}_applyMinimumContrast(f,p,l,m,E,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let x=this._getContrastCache(m),b;if(E||k||(b=x.getColor(p.rgba,l.rgba)),b===void 0){let M=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);b=c.color.ensureContrastRatio(E||p,k||l,M),x.setColor((E||p).rgba,(k||l).rgba,b??null)}return!!b&&(this._addStyle(f,`color:${b.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,p){f.setAttribute("style",`${f.getAttribute("style")||""}${p};`)}_isCellInSelection(f,p){let l=this._selectionStart,m=this._selectionEnd;return!(!l||!m)&&(this._columnSelectMode?l[0]<=m[0]?f>=l[0]&&p>=l[1]&&f<m[0]&&p<=m[1]:f<l[0]&&p>=l[1]&&f>=m[0]&&p<=m[1]:p>l[1]&&p<m[1]||l[1]===m[1]&&p===l[1]&&f>=l[0]&&f<m[0]||l[1]<m[1]&&p===m[1]&&f<m[0]||l[1]<m[1]&&p===l[1]&&f>=l[0])}};function v(f,p,l){for(;f.length<l;)f=p+f;return f}r.DomRendererRowFactory=h=a([u(1,i.ICharacterJoinerService),u(2,g.IOptionsService),u(3,i.ICoreBrowserService),u(4,g.ICoreService),u(5,g.IDecorationService),u(6,i.IThemeService)],h)},2550:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(n,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.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";let u=n.createElement("span");u.classList.add("xterm-char-measure-element");let o=n.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let d=n.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";let _=n.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[u,o,d,_],this._container.appendChild(u),this._container.appendChild(o),this._container.appendChild(d),this._container.appendChild(_),a.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(n,a,u,o){n===this._font&&a===this._fontSize&&u===this._weight&&o===this._weightBold||(this._font=n,this._fontSize=a,this._weight=u,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(n,a,u){let o=0;if(!a&&!u&&n.length===1&&(o=n.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let g=this._measure(n,0);return g>0&&(this._flat[o]=g),g}let d=n;a&&(d+="B"),u&&(d+="I");let _=this._holey.get(d);if(_===void 0){let g=0;a&&(g|=1),u&&(g|=2),_=this._measure(n,g),_>0&&this._holey.set(d,_)}return _}_measure(n,a){let u=this._measureElements[a];return u.textContent=n.repeat(32),u.offsetWidth/32}}},2223:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let a=n(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(L,r)=>{function n(u){return 57508<=u&&u<=57558}function a(u){return u>=128512&&u<=128591||u>=127744&&u<=128511||u>=128640&&u<=128767||u>=9728&&u<=9983||u>=9984&&u<=10175||u>=65024&&u<=65039||u>=129280&&u<=129535||u>=127462&&u<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(u){if(!u)throw new Error("value must not be falsy");return u},r.isPowerlineGlyph=n,r.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},r.isEmoji=a,r.allowRescaling=function(u,o,d,_){return o===1&&d>Math.ceil(1.5*_)&&u!==void 0&&u>255&&!a(u)&&!n(u)&&!(function(g){return 57344<=g&&g<=63743})(u)},r.treatGlyphAsBackgroundColor=function(u){return n(u)||(function(o){return 9472<=o&&o<=9631})(u)},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}}}},r.computeNextVariantOffset=function(u,o,d=0){return(u-(2*Math.round(o)-d))%(2*Math.round(o))}},6052:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(u,o,d,_=!1){if(this.selectionStart=o,this.selectionEnd=d,!o||!d||o[0]===d[0]&&o[1]===d[1])return void this.clear();let g=u.buffers.active.ydisp,c=o[1]-g,i=d[1]-g,s=Math.max(c,0),e=Math.min(i,u.rows-1);s>=u.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=c,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=d[0])}isCellSelected(u,o,d){return!!this.hasSelection&&(d-=u.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&d>=this.viewportCappedStartRow&&o<this.endCol&&d<=this.viewportCappedEndRow:o<this.startCol&&d>=this.viewportCappedStartRow&&o>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new n}},456:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(n){this._bufferService=n,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let n=this.selectionStart,a=this.selectionEnd;return!(!n||!a)&&(n[1]>a[1]||n[1]===a[1]&&n[0]>a[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(L,r,n){var a=this&&this.__decorate||function(e,t,h,v){var f,p=arguments.length,l=p<3?t:v===null?v=Object.getOwnPropertyDescriptor(t,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,h,v);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(p<3?f(l):p>3?f(t,h,l):f(t,h))||l);return p>3&&l&&Object.defineProperty(t,h,l),l},u=this&&this.__param||function(e,t){return function(h,v){t(h,v,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=n(2585),d=n(8460),_=n(844),g=r.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=g=a([u(2,o.IOptionsService)],g);class c extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,h){t!==void 0&&t>0&&h!==void 0&&h>0&&(this._result.width=t,this._result.height=h)}}class i extends c{constructor(t,h,v){super(),this._document=t,this._parentElement=h,this._optionsService=v,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(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends c{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let h=this._ctx.measureText("W");if(!("width"in h&&"fontBoundingBoxAscent"in h&&"fontBoundingBoxDescent"in h))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(L,r,n){var a=this&&this.__decorate||function(s,e,t,h){var v,f=arguments.length,p=f<3?e:h===null?h=Object.getOwnPropertyDescriptor(e,t):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,h);else for(var l=s.length-1;l>=0;l--)(v=s[l])&&(p=(f<3?v(p):f>3?v(e,t,p):v(e,t))||p);return f>3&&p&&Object.defineProperty(e,t,p),p},u=this&&this.__param||function(s,e){return function(t,h){e(t,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=n(3734),d=n(643),_=n(511),g=n(2585);class c extends o.AttributeData{constructor(e,t,h){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=h}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=c;let i=r.CharacterJoinerService=class Qe{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let h=[],v=t.translateToString(!0),f=0,p=0,l=0,m=t.getFg(0),E=t.getBg(0);for(let k=0;k<t.getTrimmedLength();k++)if(t.loadCell(k,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==E){if(k-f>1){let x=this._getJoinedRanges(v,l,p,t,f);for(let b=0;b<x.length;b++)h.push(x[b])}f=k,l=p,m=this._workCell.fg,E=this._workCell.bg}p+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){let k=this._getJoinedRanges(v,l,p,t,f);for(let x=0;x<k.length;x++)h.push(k[x])}return h}_getJoinedRanges(e,t,h,v,f){let p=e.substring(t,h),l=[];try{l=this._characterJoiners[0].handler(p)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let E=this._characterJoiners[m].handler(p);for(let k=0;k<E.length;k++)Qe._mergeRanges(l,E[k])}catch(E){console.error(E)}return this._stringRangesToCellRanges(l,v,f),l}_stringRangesToCellRanges(e,t,h){let v=0,f=!1,p=0,l=e[v];if(l){for(let m=h;m<this._bufferService.cols;m++){let E=t.getWidth(m),k=t.getString(m).length||d.WHITESPACE_CELL_CHAR.length;if(E!==0){if(!f&&l[0]<=p&&(l[0]=m,f=!0),l[1]<=p){if(l[1]=m,l=e[++v],!l)break;l[0]<=p?(l[0]=m,f=!0):f=!1}p+=k}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let h=!1;for(let v=0;v<e.length;v++){let f=e[v];if(h){if(t[1]<=f[0])return e[v-1][1]=t[1],e;if(t[1]<=f[1])return e[v-1][1]=Math.max(t[1],f[1]),e.splice(v,1),e;e.splice(v,1),v--}else{if(t[1]<=f[0])return e.splice(v,0,t),e;if(t[1]<=f[1])return f[0]=Math.min(t[0],f[0]),e;t[0]<f[1]&&(f[0]=Math.min(t[0],f[0]),h=!0)}}return h?e[e.length-1][1]=t[1]:e.push(t),e}};r.CharacterJoinerService=i=a([u(0,g.IBufferService)],i)},5114:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let a=n(844),u=n(8460),o=n(3656);class d extends a.Disposable{constructor(c,i,s){super(),this._textarea=c,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new u.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,u.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(c){this._window!==c&&(this._window=c,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 _ extends a.Disposable{constructor(c){super(),this._parentWindow=c,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,a.toDisposable)((()=>this.clearListener())))}setWindow(c){this._parentWindow=c,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let a=n(844);class u extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{let _=this.linkProviders.indexOf(d);_!==-1&&this.linkProviders.splice(_,1)}}}}r.LinkProviderService=u},8934:function(L,r,n){var a=this&&this.__decorate||function(g,c,i,s){var e,t=arguments.length,h=t<3?c:s===null?s=Object.getOwnPropertyDescriptor(c,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(g,c,i,s);else for(var v=g.length-1;v>=0;v--)(e=g[v])&&(h=(t<3?e(h):t>3?e(c,i,h):e(c,i))||h);return t>3&&h&&Object.defineProperty(c,i,h),h},u=this&&this.__param||function(g,c){return function(i,s){c(i,s,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=n(4725),d=n(9806),_=r.MouseService=class{constructor(g,c){this._renderService=g,this._charSizeService=c}getCoords(g,c,i,s,e){return(0,d.getCoords)(window,g,c,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(g,c){let i=(0,d.getCoordsRelativeToElement)(window,g,c);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};r.MouseService=_=a([u(0,o.IRenderService),u(1,o.ICharSizeService)],_)},3230:function(L,r,n){var a=this&&this.__decorate||function(e,t,h,v){var f,p=arguments.length,l=p<3?t:v===null?v=Object.getOwnPropertyDescriptor(t,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,h,v);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(p<3?f(l):p>3?f(t,h,l):f(t,h))||l);return p>3&&l&&Object.defineProperty(t,h,l),l},u=this&&this.__param||function(e,t){return function(h,v){t(h,v,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=n(6193),d=n(4725),_=n(8460),g=n(844),c=n(7226),i=n(2585),s=r.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,h,v,f,p,l,m){super(),this._rowCount=e,this._charSizeService=v,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(((E,k)=>this._renderRows(E,k)),l),this.register(this._renderDebouncer),this.register(l.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(p.onResize((()=>this._fullRefresh()))),this.register(p.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(h.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(f.onDecorationRegistered((()=>this._fullRefresh()))),this.register(f.onDecorationRemoved((()=>this._fullRefresh()))),this.register(h.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(p.cols,p.rows),this._fullRefresh()}))),this.register(h.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(p.buffer.y,p.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(l.window,t),this.register(l.onWindowChange((E=>this._registerIntersectionObserver(E,t))))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let h=new e.IntersectionObserver((v=>this._handleIntersectionChange(v[v.length-1])),{threshold:0});h.observe(t),this._observerDisposable.value=(0,g.toDisposable)((()=>h.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,h=!1){this._isPaused?this._needsFullRefresh=!0:(h||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((t=>this.refreshRows(t.start,t.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,h){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=h,this._renderer.value?.handleSelectionChanged(e,t,h)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=s=a([u(2,i.IOptionsService),u(3,d.ICharSizeService),u(4,i.IDecorationService),u(5,i.IBufferService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],s)},9312:function(L,r,n){var a=this&&this.__decorate||function(l,m,E,k){var x,b=arguments.length,M=b<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(l,m,E,k);else for(var H=l.length-1;H>=0;H--)(x=l[H])&&(M=(b<3?x(M):b>3?x(m,E,M):x(m,E))||M);return b>3&&M&&Object.defineProperty(m,E,M),M},u=this&&this.__param||function(l,m){return function(E,k){m(E,k,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=n(9806),d=n(9504),_=n(456),g=n(4725),c=n(8460),i=n(844),s=n(6114),e=n(4841),t=n(511),h=n(2585),v="\xA0",f=new RegExp(v,"g"),p=r.SelectionService=class extends i.Disposable{constructor(l,m,E,k,x,b,M,H,N){super(),this._element=l,this._screenElement=m,this._linkifier=E,this._bufferService=k,this._coreService=x,this._mouseService=b,this._optionsService=M,this._renderService=H,this._coreBrowserService=N,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=z=>this._handleMouseMove(z),this._mouseUpListener=z=>this._handleMouseUp(z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((z=>this._handleTrim(z))),this.register(this._bufferService.buffers.onBufferActivate((z=>this._handleBufferActivate(z)))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let l=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!l||!m||l[0]===m[0]&&l[1]===m[1])}get selectionText(){let l=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!l||!m)return"";let E=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(l[0]===m[0])return"";let x=l[0]<m[0]?l[0]:m[0],b=l[0]<m[0]?m[0]:l[0];for(let M=l[1];M<=m[1];M++){let H=E.translateBufferLineToString(M,!0,x,b);k.push(H)}}else{let x=l[1]===m[1]?m[0]:void 0;k.push(E.translateBufferLineToString(l[1],!0,l[0],x));for(let b=l[1]+1;b<=m[1]-1;b++){let M=E.lines.get(b),H=E.translateBufferLineToString(b,!0);M?.isWrapped?k[k.length-1]+=H:k.push(H)}if(l[1]!==m[1]){let b=E.lines.get(m[1]),M=E.translateBufferLineToString(m[1],!0,0,m[0]);b&&b.isWrapped?k[k.length-1]+=M:k.push(M)}}return k.map((x=>x.replace(f," "))).join(s.isWindows?`\r
5
+ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}d.OscLinkProvider=c=n([l(0,_.IBufferService),l(1,_.IOptionsService),l(2,_.IOscLinkService)],c)},6193:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.RenderDebouncer=void 0,d.RenderDebouncer=class{constructor(f,n){this._renderCallback=f,this._coreBrowserService=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(f){return this._refreshCallbacks.push(f),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(f,n,l){this._rowCount=l,f=f!==void 0?f:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,f):f,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let f=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(f,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let f of this._refreshCallbacks)f(0);this._refreshCallbacks=[]}}},3236:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Terminal=void 0;let n=f(3614),l=f(3656),h=f(3551),_=f(9042),c=f(3730),p=f(1680),o=f(3107),i=f(5744),s=f(2950),e=f(1296),t=f(428),r=f(4269),a=f(5114),u=f(8934),g=f(3230),v=f(9312),S=f(4725),y=f(6731),D=f(8055),M=f(8969),E=f(8460),x=f(844),O=f(6114),q=f(8437),K=f(2584),N=f(7399),C=f(5941),B=f(9074),m=f(2585),b=f(5435),k=f(4567),A=f(779);class W extends M.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(P={}){super(P),this.browser=O,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new E.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new E.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new E.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new E.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new E.EventEmitter),this._onBlur=this.register(new E.EventEmitter),this._onA11yCharEmitter=this.register(new E.EventEmitter),this._onA11yTabEmitter=this.register(new E.EventEmitter),this._onWillOpen=this.register(new E.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService(m.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(A.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(c.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((w,F)=>this.refresh(w,F)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((w=>this._reportWindowsOptions(w)))),this.register(this._inputHandler.onColor((w=>this._handleColorEvent(w)))),this.register((0,E.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,E.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((w=>this._afterResize(w.cols,w.rows)))),this.register((0,x.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(P){if(this._themeService)for(let w of P){let F,L="";switch(w.index){case 256:F="foreground",L="10";break;case 257:F="background",L="11";break;case 258:F="cursor",L="12";break;default:F="ansi",L="4;"+w.index}switch(w.type){case 0:let $=D.color.toColorRGB(F==="ansi"?this._themeService.colors.ansi[w.index]:this._themeService.colors[F]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${L};${(0,C.toRgbString)($)}${K.C1_ESCAPED.ST}`);break;case 1:if(F==="ansi")this._themeService.modifyColors((H=>H.ansi[w.index]=D.channels.toColor(...w.color)));else{let H=F;this._themeService.modifyColors((V=>V[H]=D.channels.toColor(...w.color)))}break;case 2:this._themeService.restoreColor(w.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(k.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let P=this.buffer.ybase+this.buffer.y,w=this.buffer.lines.get(P);if(!w)return;let F=Math.min(this.buffer.x,this.cols-1),L=this._renderService.dimensions.css.cell.height,$=w.getWidth(F),H=this._renderService.dimensions.css.cell.width*$,V=this.buffer.y*this._renderService.dimensions.css.cell.height,X=F*this._renderService.dimensions.css.cell.width;this.textarea.style.left=X+"px",this.textarea.style.top=V+"px",this.textarea.style.width=H+"px",this.textarea.style.height=L+"px",this.textarea.style.lineHeight=L+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(w=>{this.hasSelection()&&(0,n.copyHandler)(w,this._selectionService)})));let P=w=>(0,n.handlePasteEvent)(w,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),O.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(w=>{w.button===2&&(0,n.rightClickHandler)(w,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(w=>{(0,n.rightClickHandler)(w,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),O.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(w=>{w.button===1&&(0,n.moveTextAreaUnderMouseCursor)(w,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(P=>this._keyUp(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(P=>this._keyDown(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(P=>this._keyPress(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(P=>this._compositionHelper.compositionupdate(P)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(P=>this._inputEvent(P)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(P){if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.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"),P.appendChild(this.element);let w=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),w.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.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",(F=>this.updateCursorStyle(F)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),w.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),O.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(a.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(F=>this._handleTextAreaFocus(F)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(r.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((F=>this._onRender.fire(F)))),this.onResize((F=>this._renderService.resize(F.cols,F.rows))),this._compositionView=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._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(w);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((F=>this.scrollLines(F.amount,F.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(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((F=>this.scrollLines(F.amount,F.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((F=>this._renderService.handleSelectionChanged(F.start,F.end,F.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((F=>{this.textarea.value=F,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((F=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(F=>this._selectionService.handleMouseDown(F)))),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(k.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(F=>this._handleScreenReaderModeOptionChange(F)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(F=>{!this._overviewRulerRenderer&&F&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let P=this,w=this.element;function F(H){let V=P._mouseService.getMouseReportCoords(H,P.screenElement);if(!V)return!1;let X,J;switch(H.overrideType||H.type){case"mousemove":J=32,H.buttons===void 0?(X=3,H.button!==void 0&&(X=H.button<3?H.button:3)):X=1&H.buttons?0:4&H.buttons?1:2&H.buttons?2:3;break;case"mouseup":J=0,X=H.button<3?H.button:3;break;case"mousedown":J=1,X=H.button<3?H.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(H)===!1||P.viewport.getLinesScrolled(H)===0)return!1;J=H.deltaY<0?0:1,X=4;break;default:return!1}return!(J===void 0||X===void 0||X>4)&&P.coreMouseService.triggerMouseEvent({col:V.col,row:V.row,x:V.x,y:V.y,button:X,action:J,ctrl:H.ctrlKey,alt:H.altKey,shift:H.shiftKey})}let L={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:H=>(F(H),H.buttons||(this._document.removeEventListener("mouseup",L.mouseup),L.mousedrag&&this._document.removeEventListener("mousemove",L.mousedrag)),this.cancel(H)),wheel:H=>(F(H),this.cancel(H,!0)),mousedrag:H=>{H.buttons&&F(H)},mousemove:H=>{H.buttons||F(H)}};this.register(this.coreMouseService.onProtocolChange((H=>{H?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(H)),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&H?L.mousemove||(w.addEventListener("mousemove",$.mousemove),L.mousemove=$.mousemove):(w.removeEventListener("mousemove",L.mousemove),L.mousemove=null),16&H?L.wheel||(w.addEventListener("wheel",$.wheel,{passive:!1}),L.wheel=$.wheel):(w.removeEventListener("wheel",L.wheel),L.wheel=null),2&H?L.mouseup||(L.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",L.mouseup),L.mouseup=null),4&H?L.mousedrag||(L.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",L.mousedrag),L.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(w,"mousedown",(H=>{if(H.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(H))return F(H),L.mouseup&&this._document.addEventListener("mouseup",L.mouseup),L.mousedrag&&this._document.addEventListener("mousemove",L.mousedrag),this.cancel(H)}))),this.register((0,l.addDisposableDomListener)(w,"wheel",(H=>{if(!L.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(H)===!1)return!1;if(!this.buffer.hasScrollback){let V=this.viewport.getLinesScrolled(H);if(V===0)return;let X=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(H.deltaY<0?"A":"B"),J="";for(let ee=0;ee<Math.abs(V);ee++)J+=X;return this.coreService.triggerDataEvent(J,!0),this.cancel(H,!0)}return this.viewport.handleWheel(H)?this.cancel(H):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(w,"touchstart",(H=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(H),this.cancel(H)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(w,"touchmove",(H=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(H)?void 0:this.cancel(H)}),{passive:!1}))}refresh(P,w){this._renderService?.refreshRows(P,w)}updateCursorStyle(P){this._selectionService?.shouldColumnSelect(P)?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(P,w,F=0){F===1?(super.scrollLines(P,w,F),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(P)}paste(P){(0,n.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let w=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),w}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,w,F){this._selectionService.setSelection(P,w,F)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(P,w){this._selectionService?.selectLines(P,w)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;let w=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!w&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;w||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let F=(0,N.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),F.type===3||F.type===2){let L=this.rows-1;return this.scrollLines(F.type===2?-L:L),this.cancel(P,!0)}return F.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(F.cancel&&this.cancel(P,!0),!F.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(F.key!==K.C0.ETX&&F.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:F.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(F.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,w){let F=P.isMac&&!this.options.macOptionIsMeta&&w.altKey&&!w.ctrlKey&&!w.metaKey||P.isWindows&&w.altKey&&w.ctrlKey&&!w.metaKey||P.isWindows&&w.getModifierState("AltGraph");return w.type==="keypress"?F:F&&(!w.keyCode||w.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||((function(w){return w.keyCode===16||w.keyCode===17||w.keyCode===18})(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let w;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)w=P.charCode;else if(P.which===null||P.which===void 0)w=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;w=P.which}return!(!w||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(w=String.fromCharCode(w),this._onKey.fire({key:w,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(w,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let w=P.data;return this.coreService.triggerDataEvent(w,!0),this.cancel(P),!0}return!1}resize(P,w){P!==this.cols||w!==this.rows?super.resize(P,w):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,w){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let P=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case b.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let w=this._renderService.dimensions.css.canvas.width.toFixed(0),F=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${F};${w}t`);break;case b.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let L=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${$};${L}t`)}}cancel(P,w){if(this.options.cancelEvents||w)return P.preventDefault(),P.stopPropagation(),!1}}d.Terminal=W},9924:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.TimeBasedDebouncer=void 0,d.TimeBasedDebouncer=class{constructor(f,n=1e3){this._renderCallback=f,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(f,n,l){this._rowCount=l,f=f!==void 0?f:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,f):f,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;let h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=h-this._lastRefreshMs,c=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let f=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(f,n)}}},1680:function(R,d,f){var n=this&&this.__decorate||function(s,e,t,r){var a,u=arguments.length,g=u<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,r);else for(var v=s.length-1;v>=0;v--)(a=s[v])&&(g=(u<3?a(g):u>3?a(e,t,g):a(e,t))||g);return u>3&&g&&Object.defineProperty(e,t,g),g},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.Viewport=void 0;let h=f(3656),_=f(4725),c=f(8460),p=f(844),o=f(2585),i=d.Viewport=class extends p.Disposable{constructor(s,e,t,r,a,u,g,v){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=r,this._charSizeService=a,this._renderService=u,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((S=>this._renderDimensions=S))),this._handleThemeChange(v.colors),this.register(v.onChangeColors((S=>this._handleThemeChange(S)))),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;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,e){let t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){let e=this._getPixelsScrolled(s);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,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 e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let t,r="",a=[],u=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let v=s;v<u;v++){let S=g.get(v);if(!S)continue;let y=g.get(v+1)?.isWrapped;if(r+=S.translateToString(!y),!y||v===g.length-1){let D=document.createElement("div");D.textContent=r,a.push(D),r.length>0&&(t=D),r=""}}return{bufferElements:a,cursorElement:t}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){let t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};d.Viewport=i=n([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,_.ICharSizeService),l(5,_.IRenderService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],i)},3107:function(R,d,f){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var u=o.length-1;u>=0;u--)(t=o[u])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.BufferDecorationRenderer=void 0;let h=f(4725),_=f(844),c=f(2585),p=d.BufferDecorationRenderer=class extends _.Disposable{constructor(o,i,s,e,t){super(),this._screenElement=o,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,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((r=>this._removeDecoration(r)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",o?.options?.layer==="top"),i.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=o.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(o,i),i}_refreshStyle(o){let i=o.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let s=this._decorationElements.get(o);s||(s=this._createElement(o),o.element=s,this._decorationElements.set(o,s),this._container.appendChild(s),o.onDispose((()=>{this._decorationElements.delete(o),s.remove()}))),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(s)}}_refreshXPosition(o,i=o.element){if(!i)return;let s=o.options.x??0;(o.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){this._decorationElements.get(o)?.remove(),this._decorationElements.delete(o),o.dispose()}};d.BufferDecorationRenderer=p=n([l(1,c.IBufferService),l(2,h.ICoreBrowserService),l(3,c.IDecorationService),l(4,h.IRenderService)],p)},5871:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ColorZoneStore=void 0,d.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(f){if(f.options.overviewRulerOptions){for(let n of this._zones)if(n.color===f.options.overviewRulerOptions.color&&n.position===f.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,f.marker.line))return;if(this._lineAdjacentToZone(n,f.marker.line,f.options.overviewRulerOptions.position))return void this._addLineToZone(n,f.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=f.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=f.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=f.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=f.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:f.options.overviewRulerOptions.color,position:f.options.overviewRulerOptions.position,startBufferLine:f.marker.line,endBufferLine:f.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(f){this._linePadding=f}_lineIntersectsZone(f,n){return n>=f.startBufferLine&&n<=f.endBufferLine}_lineAdjacentToZone(f,n,l){return n>=f.startBufferLine-this._linePadding[l||"full"]&&n<=f.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(f,n){f.startBufferLine=Math.min(f.startBufferLine,n),f.endBufferLine=Math.max(f.endBufferLine,n)}}},5744:function(R,d,f){var n=this&&this.__decorate||function(t,r,a,u){var g,v=arguments.length,S=v<3?r:u===null?u=Object.getOwnPropertyDescriptor(r,a):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,r,a,u);else for(var y=t.length-1;y>=0;y--)(g=t[y])&&(S=(v<3?g(S):v>3?g(r,a,S):g(r,a))||S);return v>3&&S&&Object.defineProperty(r,a,S),S},l=this&&this.__param||function(t,r){return function(a,u){r(a,u,t)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OverviewRulerRenderer=void 0;let h=f(5871),_=f(4725),c=f(844),p=f(2585),o={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=d.OverviewRulerRenderer=class extends c.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,r,a,u,g,v,S){super(),this._viewportElement=t,this._screenElement=r,this._bufferService=a,this._decorationService=u,this._renderService=g,this._optionsService=v,this._coreBrowserService=S,this._colorZoneStore=new h.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,c.toDisposable)((()=>{this._canvas?.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(){let t=Math.floor(this._canvas.width/3),r=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=r,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,r=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);o.left=r,o.center=r,o.right=r}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${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(let r of this._decorationService.decorations)this._colorZoneStore.addDecoration(r);this._ctx.lineWidth=1;let t=this._colorZoneStore.zones;for(let r of t)r.position!=="full"&&this._renderColorZone(r);for(let r of t)r.position==="full"&&this._renderColorZone(r);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-o[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[t.position||"full"]))}_queueRefresh(t,r){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=r||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};d.OverviewRulerRenderer=e=n([l(2,p.IBufferService),l(3,p.IDecorationService),l(4,_.IRenderService),l(5,p.IOptionsService),l(6,_.ICoreBrowserService)],e)},2950:function(R,d,f){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var u=o.length-1;u>=0;u--)(t=o[u])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CompositionHelper=void 0;let h=f(4725),_=f(2585),c=f(2584),p=d.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,i,s,e,t,r){this._textarea=o,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=r,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(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let o=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(o,"");this._dataAlreadySent=s,i.length>o.length?this._coreService.triggerDataEvent(s,!0):i.length<o.length?this._coreService.triggerDataEvent(`${c.C0.DEL}`,!0):i.length===o.length&&i!==o&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,t=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=t+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let r=this._compositionView.getBoundingClientRect();this._textarea.style.left=t+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};d.CompositionHelper=p=n([l(2,_.IBufferService),l(3,_.IOptionsService),l(4,_.ICoreService),l(5,h.IRenderService)],p)},9806:(R,d)=>{function f(n,l,h){let _=h.getBoundingClientRect(),c=n.getComputedStyle(h),p=parseInt(c.getPropertyValue("padding-left")),o=parseInt(c.getPropertyValue("padding-top"));return[l.clientX-_.left-p,l.clientY-_.top-o]}Object.defineProperty(d,"__esModule",{value:!0}),d.getCoords=d.getCoordsRelativeToElement=void 0,d.getCoordsRelativeToElement=f,d.getCoords=function(n,l,h,_,c,p,o,i,s){if(!p)return;let e=f(n,l,h);return e?(e[0]=Math.ceil((e[0]+(s?o/2:0))/o),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),_+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),c),e):void 0}},9504:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.moveToCellSequence=void 0;let n=f(2584);function l(i,s,e,t){let r=i-h(i,e),a=s-h(s,e),u=Math.abs(r-a)-(function(g,v,S){let y=0,D=g-h(g,S),M=v-h(v,S);for(let E=0;E<Math.abs(D-M);E++){let x=_(g,v)==="A"?-1:1;S.buffer.lines.get(D+x*E)?.isWrapped&&y++}return y})(i,s,e);return o(u,p(_(i,s),t))}function h(i,s){let e=0,t=s.buffer.lines.get(i),r=t?.isWrapped;for(;r&&i>=0&&i<s.rows;)e++,t=s.buffer.lines.get(--i),r=t?.isWrapped;return e}function _(i,s){return i>s?"A":"B"}function c(i,s,e,t,r,a){let u=i,g=s,v="";for(;u!==e||g!==t;)u+=r?1:-1,r&&u>a.cols-1?(v+=a.buffer.translateBufferLineToString(g,!1,i,u),u=0,i=0,g++):!r&&u<0&&(v+=a.buffer.translateBufferLineToString(g,!1,0,i+1),u=a.cols-1,i=u,g--);return v+a.buffer.translateBufferLineToString(g,!1,i,u)}function p(i,s){let e=s?"O":"[";return n.C0.ESC+e+i}function o(i,s){i=Math.floor(i);let e="";for(let t=0;t<i;t++)e+=s;return e}d.moveToCellSequence=function(i,s,e,t){let r=e.buffer.x,a=e.buffer.y;if(!e.buffer.hasScrollback)return(function(v,S,y,D,M,E){return l(S,D,M,E).length===0?"":o(c(v,S,v,S-h(S,M),!1,M).length,p("D",E))})(r,a,0,s,e,t)+l(a,s,e,t)+(function(v,S,y,D,M,E){let x;x=l(S,D,M,E).length>0?D-h(D,M):S;let O=D,q=(function(K,N,C,B,m,b){let k;return k=l(C,B,m,b).length>0?B-h(B,m):N,K<C&&k<=B||K>=C&&k<B?"C":"D"})(v,S,y,D,M,E);return o(c(v,x,y,O,q==="C",M).length,p(q,E))})(r,a,i,s,e,t);let u;if(a===s)return u=r>i?"D":"C",o(Math.abs(r-i),p(u,t));u=a>s?"D":"C";let g=Math.abs(a-s);return o((function(v,S){return S.cols-v})(a>s?i:r,e)+(g-1)*e.cols+1+((a>s?r:i)-1),p(u,t))}},1296:function(R,d,f){var n=this&&this.__decorate||function(E,x,O,q){var K,N=arguments.length,C=N<3?x:q===null?q=Object.getOwnPropertyDescriptor(x,O):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,x,O,q);else for(var B=E.length-1;B>=0;B--)(K=E[B])&&(C=(N<3?K(C):N>3?K(x,O,C):K(x,O))||C);return N>3&&C&&Object.defineProperty(x,O,C),C},l=this&&this.__param||function(E,x){return function(O,q){x(O,q,E)}};Object.defineProperty(d,"__esModule",{value:!0}),d.DomRenderer=void 0;let h=f(3787),_=f(2550),c=f(2223),p=f(6171),o=f(6052),i=f(4725),s=f(8055),e=f(8460),t=f(844),r=f(2585),a="xterm-dom-renderer-owner-",u="xterm-rows",g="xterm-fg-",v="xterm-bg-",S="xterm-focus",y="xterm-selection",D=1,M=d.DomRenderer=class extends t.Disposable{constructor(E,x,O,q,K,N,C,B,m,b,k,A,W){super(),this._terminal=E,this._document=x,this._element=O,this._screenElement=q,this._viewportElement=K,this._helperContainer=N,this._linkifier2=C,this._charSizeService=m,this._optionsService=b,this._bufferService=k,this._coreBrowserService=A,this._themeService=W,this._terminalClass=D++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((j=>this._injectCss(j)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(a+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((j=>this._handleLinkHover(j)))),this.register(this._linkifier2.onHideLinkUnderline((j=>this._handleLinkLeave(j)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(a+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.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(){let E=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*E,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*E),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/E),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/E),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let O of this._rowElements)O.style.width=`${this.dimensions.css.canvas.width}px`,O.style.height=`${this.dimensions.css.cell.height}px`,O.style.lineHeight=`${this.dimensions.css.cell.height}px`,O.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let x=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=x,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(E){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let x=`${this._terminalSelector} .${u} { color: ${E.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;x+=`${this._terminalSelector} .${u} .xterm-dim { color: ${s.color.multiplyOpacity(E.foreground,.5).css};}`,x+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let O=`blink_underline_${this._terminalClass}`,q=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;x+=`@keyframes ${O} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${q} { 50% { box-shadow: none; }}`,x+=`@keyframes ${K} { 0% { background-color: ${E.cursor.css}; color: ${E.cursorAccent.css}; } 50% { background-color: inherit; color: ${E.cursor.css}; }}`,x+=`${this._terminalSelector} .${u}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${u}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${u}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${E.cursor.css}; color: ${E.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${E.cursor.css} !important; color: ${E.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${E.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${E.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${E.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,x+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${E.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${E.selectionInactiveBackgroundOpaque.css};}`;for(let[N,C]of E.ansi.entries())x+=`${this._terminalSelector} .${g}${N} { color: ${C.css}; }${this._terminalSelector} .${g}${N}.xterm-dim { color: ${s.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${v}${N} { background-color: ${C.css}; }`;x+=`${this._terminalSelector} .${g}${c.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(E.background).css}; }${this._terminalSelector} .${g}${c.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(E.background),.5).css}; }${this._terminalSelector} .${v}${c.INVERTED_DEFAULT_COLOR} { background-color: ${E.foreground.css}; }`,this._themeStyleElement.textContent=x}_setDefaultSpacing(){let E=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${E}px`,this._rowFactory.defaultSpacing=E}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(E,x){for(let O=this._rowElements.length;O<=x;O++){let q=this._document.createElement("div");this._rowContainer.appendChild(q),this._rowElements.push(q)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(E,x){this._refreshRowElements(E,x),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(S),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(E,x,O){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(E,x,O),this.renderRows(0,this._bufferService.rows-1),!E||!x)return;this._selectionRenderModel.update(this._terminal,E,x,O);let q=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,N=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(N>=this._bufferService.rows||C<0)return;let B=this._document.createDocumentFragment();if(O){let m=E[0]>x[0];B.appendChild(this._createSelectionElement(N,m?x[0]:E[0],m?E[0]:x[0],C-N+1))}else{let m=q===N?E[0]:0,b=N===K?x[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(N,m,b));let k=C-N-1;if(B.appendChild(this._createSelectionElement(N+1,0,this._bufferService.cols,k)),N!==C){let A=K===C?x[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(C,0,A))}}this._selectionContainer.appendChild(B)}_createSelectionElement(E,x,O,q=1){let K=this._document.createElement("div"),N=x*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(O-x);return N+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-N),K.style.height=q*this.dimensions.css.cell.height+"px",K.style.top=E*this.dimensions.css.cell.height+"px",K.style.left=`${N}px`,K.style.width=`${C}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let E of this._rowElements)E.replaceChildren()}renderRows(E,x){let O=this._bufferService.buffer,q=O.ybase+O.y,K=Math.min(O.x,this._bufferService.cols-1),N=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=E;m<=x;m++){let b=m+O.ydisp,k=this._rowElements[m],A=O.lines.get(b);if(!k||!A)break;k.replaceChildren(...this._rowFactory.createRow(A,b,b===q,C,B,K,N,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${a}${this._terminalClass}`}_handleLinkHover(E){this._setCellUnderline(E.x1,E.x2,E.y1,E.y2,E.cols,!0)}_handleLinkLeave(E){this._setCellUnderline(E.x1,E.x2,E.y1,E.y2,E.cols,!1)}_setCellUnderline(E,x,O,q,K,N){O<0&&(E=0),q<0&&(x=0);let C=this._bufferService.rows-1;O=Math.max(Math.min(O,C),0),q=Math.max(Math.min(q,C),0),K=Math.min(K,this._bufferService.cols);let B=this._bufferService.buffer,m=B.ybase+B.y,b=Math.min(B.x,K-1),k=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,W=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=O;j<=q;++j){let P=j+B.ydisp,w=this._rowElements[j],F=B.lines.get(P);if(!w||!F)break;w.replaceChildren(...this._rowFactory.createRow(F,P,P===m,A,W,b,k,this.dimensions.css.cell.width,this._widthCache,N?j===O?E:0:-1,N?(j===q?x:K)-1:-1))}}};d.DomRenderer=M=n([l(7,r.IInstantiationService),l(8,i.ICharSizeService),l(9,r.IOptionsService),l(10,r.IBufferService),l(11,i.ICoreBrowserService),l(12,i.IThemeService)],M)},3787:function(R,d,f){var n=this&&this.__decorate||function(u,g,v,S){var y,D=arguments.length,M=D<3?g:S===null?S=Object.getOwnPropertyDescriptor(g,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(u,g,v,S);else for(var E=u.length-1;E>=0;E--)(y=u[E])&&(M=(D<3?y(M):D>3?y(g,v,M):y(g,v))||M);return D>3&&M&&Object.defineProperty(g,v,M),M},l=this&&this.__param||function(u,g){return function(v,S){g(v,S,u)}};Object.defineProperty(d,"__esModule",{value:!0}),d.DomRendererRowFactory=void 0;let h=f(2223),_=f(643),c=f(511),p=f(2585),o=f(8055),i=f(4725),s=f(4269),e=f(6171),t=f(3734),r=d.DomRendererRowFactory=class{constructor(u,g,v,S,y,D,M){this._document=u,this._characterJoinerService=g,this._optionsService=v,this._coreBrowserService=S,this._coreService=y,this._decorationService=D,this._themeService=M,this._workCell=new c.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,g,v){this._selectionStart=u,this._selectionEnd=g,this._columnSelectMode=v}createRow(u,g,v,S,y,D,M,E,x,O,q){let K=[],N=this._characterJoinerService.getJoinedCharacters(g),C=this._themeService.colors,B,m=u.getNoBgTrimmedLength();v&&m<D+1&&(m=D+1);let b=0,k="",A=0,W=0,j=0,P=!1,w=0,F=!1,L=0,$=[],H=O!==-1&&q!==-1;for(let V=0;V<m;V++){u.loadCell(V,this._workCell);let X=this._workCell.getWidth();if(X===0)continue;let J=!1,ee=V,G=this._workCell;if(N.length>0&&V===N[0][0]){J=!0;let Z=N.shift();G=new s.JoinedCellData(this._workCell,u.translateToString(!0,Z[0],Z[1]),Z[1]-Z[0]),ee=Z[1]-1,X=G.getWidth()}let ie=this._isCellInSelection(V,g),he=v&&V===D,je=H&&V>=O&&V<=q,ze=!1;this._decorationService.forEachDecorationAtCell(V,g,void 0,(Z=>{ze=!0}));let Te=G.getChars()||_.WHITESPACE_CELL_CHAR;if(Te===" "&&(G.isUnderline()||G.isOverline())&&(Te="\xA0"),L=X*E-x.get(Te,G.isBold(),G.isItalic()),B){if(b&&(ie&&F||!ie&&!F&&G.bg===A)&&(ie&&F&&C.selectionForeground||G.fg===W)&&G.extended.ext===j&&je===P&&L===w&&!he&&!J&&!ze){G.isInvisible()?k+=_.WHITESPACE_CELL_CHAR:k+=Te,b++;continue}b&&(B.textContent=k),B=this._document.createElement("span"),b=0,k=""}else B=this._document.createElement("span");if(A=G.bg,W=G.fg,j=G.extended.ext,P=je,w=L,F=ie,J&&D>=V&&D<=ee&&(D=V),!this._coreService.isCursorHidden&&he&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&$.push("xterm-cursor-blink"),$.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline")}}if(G.isBold()&&$.push("xterm-bold"),G.isItalic()&&$.push("xterm-italic"),G.isDim()&&$.push("xterm-dim"),k=G.isInvisible()?_.WHITESPACE_CELL_CHAR:G.getChars()||_.WHITESPACE_CELL_CHAR,G.isUnderline()&&($.push(`xterm-underline-${G.extended.underlineStyle}`),k===" "&&(k="\xA0"),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let Z=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&Z<8&&(Z+=8),B.style.textDecorationColor=C.ansi[Z].css}G.isOverline()&&($.push("xterm-overline"),k===" "&&(k="\xA0")),G.isStrikethrough()&&$.push("xterm-strikethrough"),je&&(B.style.textDecoration="underline");let re=G.getFgColor(),we=G.getFgColorMode(),oe=G.getBgColor(),Ee=G.getBgColorMode(),qe=!!G.isInverse();if(qe){let Z=re;re=oe,oe=Z;let Et=we;we=Ee,Ee=Et}let le,xe,de,ke=!1;switch(this._decorationService.forEachDecorationAtCell(V,g,void 0,(Z=>{Z.options.layer!=="top"&&ke||(Z.backgroundColorRGB&&(Ee=50331648,oe=Z.backgroundColorRGB.rgba>>8&16777215,le=Z.backgroundColorRGB),Z.foregroundColorRGB&&(we=50331648,re=Z.foregroundColorRGB.rgba>>8&16777215,xe=Z.foregroundColorRGB),ke=Z.options.layer==="top")})),!ke&&ie&&(le=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,oe=le.rgba>>8&16777215,Ee=50331648,ke=!0,C.selectionForeground&&(we=50331648,re=C.selectionForeground.rgba>>8&16777215,xe=C.selectionForeground)),ke&&$.push("xterm-decoration-top"),Ee){case 16777216:case 33554432:de=C.ansi[oe],$.push(`xterm-bg-${oe}`);break;case 50331648:de=o.channels.toColor(oe>>16,oe>>8&255,255&oe),this._addStyle(B,`background-color:#${a((oe>>>0).toString(16),"0",6)}`);break;default:qe?(de=C.foreground,$.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):de=C.background}switch(le||G.isDim()&&(le=o.color.multiplyOpacity(de,.5)),we){case 16777216:case 33554432:G.isBold()&&re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(re+=8),this._applyMinimumContrast(B,de,C.ansi[re],G,le,void 0)||$.push(`xterm-fg-${re}`);break;case 50331648:let Z=o.channels.toColor(re>>16&255,re>>8&255,255&re);this._applyMinimumContrast(B,de,Z,G,le,xe)||this._addStyle(B,`color:#${a(re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,de,C.foreground,G,le,xe)||qe&&$.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}$.length&&(B.className=$.join(" "),$.length=0),he||J||ze?B.textContent=k:b++,L!==this.defaultSpacing&&(B.style.letterSpacing=`${L}px`),K.push(B),V=ee}return B&&b&&(B.textContent=k),K}_applyMinimumContrast(u,g,v,S,y,D){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(S.getCode()))return!1;let M=this._getContrastCache(S),E;if(y||D||(E=M.getColor(g.rgba,v.rgba)),E===void 0){let x=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);E=o.color.ensureContrastRatio(y||g,D||v,x),M.setColor((y||g).rgba,(D||v).rgba,E??null)}return!!E&&(this._addStyle(u,`color:${E.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,g){u.setAttribute("style",`${u.getAttribute("style")||""}${g};`)}_isCellInSelection(u,g){let v=this._selectionStart,S=this._selectionEnd;return!(!v||!S)&&(this._columnSelectMode?v[0]<=S[0]?u>=v[0]&&g>=v[1]&&u<S[0]&&g<=S[1]:u<v[0]&&g>=v[1]&&u>=S[0]&&g<=S[1]:g>v[1]&&g<S[1]||v[1]===S[1]&&g===v[1]&&u>=v[0]&&u<S[0]||v[1]<S[1]&&g===S[1]&&u<S[0]||v[1]<S[1]&&g===v[1]&&u>=v[0])}};function a(u,g,v){for(;u.length<v;)u=g+u;return u}d.DomRendererRowFactory=r=n([l(1,i.ICharacterJoinerService),l(2,p.IOptionsService),l(3,i.ICoreBrowserService),l(4,p.ICoreService),l(5,p.IDecorationService),l(6,i.IThemeService)],r)},2550:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WidthCache=void 0,d.WidthCache=class{constructor(f,n){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=f.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";let l=f.createElement("span");l.classList.add("xterm-char-measure-element");let h=f.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";let _=f.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let c=f.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[l,h,_,c],this._container.appendChild(l),this._container.appendChild(h),this._container.appendChild(_),this._container.appendChild(c),n.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(f,n,l,h){f===this._font&&n===this._fontSize&&l===this._weight&&h===this._weightBold||(this._font=f,this._fontSize=n,this._weight=l,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(f,n,l){let h=0;if(!n&&!l&&f.length===1&&(h=f.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];let p=this._measure(f,0);return p>0&&(this._flat[h]=p),p}let _=f;n&&(_+="B"),l&&(_+="I");let c=this._holey.get(_);if(c===void 0){let p=0;n&&(p|=1),l&&(p|=2),c=this._measure(f,p),c>0&&this._holey.set(_,c)}return c}_measure(f,n){let l=this._measureElements[n];return l.textContent=f.repeat(32),l.offsetWidth/32}}},2223:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.TEXT_BASELINE=d.DIM_OPACITY=d.INVERTED_DEFAULT_COLOR=void 0;let n=f(6114);d.INVERTED_DEFAULT_COLOR=257,d.DIM_OPACITY=.5,d.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},6171:(R,d)=>{function f(l){return 57508<=l&&l<=57558}function n(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(d,"__esModule",{value:!0}),d.computeNextVariantOffset=d.createRenderDimensions=d.treatGlyphAsBackgroundColor=d.allowRescaling=d.isEmoji=d.isRestrictedPowerlineGlyph=d.isPowerlineGlyph=d.throwIfFalsy=void 0,d.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},d.isPowerlineGlyph=f,d.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},d.isEmoji=n,d.allowRescaling=function(l,h,_,c){return h===1&&_>Math.ceil(1.5*c)&&l!==void 0&&l>255&&!n(l)&&!f(l)&&!(function(p){return 57344<=p&&p<=63743})(l)},d.treatGlyphAsBackgroundColor=function(l){return f(l)||(function(h){return 9472<=h&&h<=9631})(l)},d.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}}}},d.computeNextVariantOffset=function(l,h,_=0){return(l-(2*Math.round(h)-_))%(2*Math.round(h))}},6052:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.createSelectionRenderModel=void 0;class f{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,h,_,c=!1){if(this.selectionStart=h,this.selectionEnd=_,!h||!_||h[0]===_[0]&&h[1]===_[1])return void this.clear();let p=l.buffers.active.ydisp,o=h[1]-p,i=_[1]-p,s=Math.max(o,0),e=Math.min(i,l.rows-1);s>=l.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=c,this.viewportStartRow=o,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=h[0],this.endCol=_[0])}isCellSelected(l,h,_){return!!this.hasSelection&&(_-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&_>=this.viewportCappedStartRow&&h<this.endCol&&_<=this.viewportCappedEndRow:h<this.startCol&&_>=this.viewportCappedStartRow&&h>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&h>=this.startCol)}}d.createSelectionRenderModel=function(){return new f}},456:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.SelectionModel=void 0,d.SelectionModel=class{constructor(f){this._bufferService=f,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let f=this.selectionStart[0]+this.selectionStartLength;return f>this._bufferService.cols?f%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(f/this._bufferService.cols)-1]:[f%this._bufferService.cols,this.selectionStart[1]+Math.floor(f/this._bufferService.cols)]:[f,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let f=this.selectionStart[0]+this.selectionStartLength;return f>this._bufferService.cols?[f%this._bufferService.cols,this.selectionStart[1]+Math.floor(f/this._bufferService.cols)]:[Math.max(f,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let f=this.selectionStart,n=this.selectionEnd;return!(!f||!n)&&(f[1]>n[1]||f[1]===n[1]&&f[0]>n[0])}handleTrim(f){return this.selectionStart&&(this.selectionStart[1]-=f),this.selectionEnd&&(this.selectionEnd[1]-=f),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(R,d,f){var n=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CharSizeService=void 0;let h=f(2585),_=f(8460),c=f(844),p=d.CharSizeService=class extends c.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};d.CharSizeService=p=n([l(2,h.IOptionsService)],p);class o extends c.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,r){t!==void 0&&t>0&&r!==void 0&&r>0&&(this._result.width=t,this._result.height=r)}}class i extends o{constructor(t,r,a){super(),this._document=t,this._parentElement=r,this._optionsService=a,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(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends o{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let r=this._ctx.measureText("W");if(!("width"in r&&"fontBoundingBoxAscent"in r&&"fontBoundingBoxDescent"in r))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(R,d,f){var n=this&&this.__decorate||function(s,e,t,r){var a,u=arguments.length,g=u<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,r);else for(var v=s.length-1;v>=0;v--)(a=s[v])&&(g=(u<3?a(g):u>3?a(e,t,g):a(e,t))||g);return u>3&&g&&Object.defineProperty(e,t,g),g},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CharacterJoinerService=d.JoinedCellData=void 0;let h=f(3734),_=f(643),c=f(511),p=f(2585);class o extends h.AttributeData{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}d.JoinedCellData=o;let i=d.CharacterJoinerService=class rt{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new c.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],a=t.translateToString(!0),u=0,g=0,v=0,S=t.getFg(0),y=t.getBg(0);for(let D=0;D<t.getTrimmedLength();D++)if(t.loadCell(D,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==y){if(D-u>1){let M=this._getJoinedRanges(a,v,g,t,u);for(let E=0;E<M.length;E++)r.push(M[E])}u=D,v=g,S=this._workCell.fg,y=this._workCell.bg}g+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1){let D=this._getJoinedRanges(a,v,g,t,u);for(let M=0;M<D.length;M++)r.push(D[M])}return r}_getJoinedRanges(e,t,r,a,u){let g=e.substring(t,r),v=[];try{v=this._characterJoiners[0].handler(g)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{let y=this._characterJoiners[S].handler(g);for(let D=0;D<y.length;D++)rt._mergeRanges(v,y[D])}catch(y){console.error(y)}return this._stringRangesToCellRanges(v,a,u),v}_stringRangesToCellRanges(e,t,r){let a=0,u=!1,g=0,v=e[a];if(v){for(let S=r;S<this._bufferService.cols;S++){let y=t.getWidth(S),D=t.getString(S).length||_.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!u&&v[0]<=g&&(v[0]=S,u=!0),v[1]<=g){if(v[1]=S,v=e[++a],!v)break;v[0]<=g?(v[0]=S,u=!0):u=!1}g+=D}}v&&(v[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let a=0;a<e.length;a++){let u=e[a];if(r){if(t[1]<=u[0])return e[a-1][1]=t[1],e;if(t[1]<=u[1])return e[a-1][1]=Math.max(t[1],u[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=u[0])return e.splice(a,0,t),e;if(t[1]<=u[1])return u[0]=Math.min(t[0],u[0]),e;t[0]<u[1]&&(u[0]=Math.min(t[0],u[0]),r=!0)}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};d.CharacterJoinerService=i=n([l(0,p.IBufferService)],i)},5114:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CoreBrowserService=void 0;let n=f(844),l=f(8460),h=f(3656);class _ extends n.Disposable{constructor(o,i,s){super(),this._textarea=o,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new c(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,l.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(o){this._window!==o&&(this._window=o,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}}d.CoreBrowserService=_;class c extends n.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new n.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,n.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.LinkProviderService=void 0;let n=f(844);class l extends n.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,n.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let c=this.linkProviders.indexOf(_);c!==-1&&this.linkProviders.splice(c,1)}}}}d.LinkProviderService=l},8934:function(R,d,f){var n=this&&this.__decorate||function(p,o,i,s){var e,t=arguments.length,r=t<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(p,o,i,s);else for(var a=p.length-1;a>=0;a--)(e=p[a])&&(r=(t<3?e(r):t>3?e(o,i,r):e(o,i))||r);return t>3&&r&&Object.defineProperty(o,i,r),r},l=this&&this.__param||function(p,o){return function(i,s){o(i,s,p)}};Object.defineProperty(d,"__esModule",{value:!0}),d.MouseService=void 0;let h=f(4725),_=f(9806),c=d.MouseService=class{constructor(p,o){this._renderService=p,this._charSizeService=o}getCoords(p,o,i,s,e){return(0,_.getCoords)(window,p,o,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(p,o){let i=(0,_.getCoordsRelativeToElement)(window,p,o);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};d.MouseService=c=n([l(0,h.IRenderService),l(1,h.ICharSizeService)],c)},3230:function(R,d,f){var n=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.RenderService=void 0;let h=f(6193),_=f(4725),c=f(8460),p=f(844),o=f(7226),i=f(2585),s=d.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,r,a,u,g,v,S){super(),this._rowCount=e,this._charSizeService=a,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new p.MutableDisposable),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 c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((y,D)=>this._renderRows(y,D)),v),this.register(this._renderDebouncer),this.register(v.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(r.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(u.onDecorationRegistered((()=>this._fullRefresh()))),this.register(u.onDecorationRemoved((()=>this._fullRefresh()))),this.register(r.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(r.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register(S.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(v.window,t),this.register(v.onWindowChange((y=>this._registerIntersectionObserver(y,t))))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver((a=>this._handleIntersectionChange(a[a.length-1])),{threshold:0});r.observe(t),this._observerDisposable.value=(0,p.toDisposable)((()=>r.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,r=!1){this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((t=>this.refreshRows(t.start,t.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,t,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};d.RenderService=s=n([l(2,i.IOptionsService),l(3,_.ICharSizeService),l(4,i.IDecorationService),l(5,i.IBufferService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],s)},9312:function(R,d,f){var n=this&&this.__decorate||function(v,S,y,D){var M,E=arguments.length,x=E<3?S:D===null?D=Object.getOwnPropertyDescriptor(S,y):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(v,S,y,D);else for(var O=v.length-1;O>=0;O--)(M=v[O])&&(x=(E<3?M(x):E>3?M(S,y,x):M(S,y))||x);return E>3&&x&&Object.defineProperty(S,y,x),x},l=this&&this.__param||function(v,S){return function(y,D){S(y,D,v)}};Object.defineProperty(d,"__esModule",{value:!0}),d.SelectionService=void 0;let h=f(9806),_=f(9504),c=f(456),p=f(4725),o=f(8460),i=f(844),s=f(6114),e=f(4841),t=f(511),r=f(2585),a="\xA0",u=new RegExp(a,"g"),g=d.SelectionService=class extends i.Disposable{constructor(v,S,y,D,M,E,x,O,q){super(),this._element=v,this._screenElement=S,this._linkifier=y,this._bufferService=D,this._coreService=M,this._mouseService=E,this._optionsService=x,this._renderService=O,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new c.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let v=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!v||!S||v[0]===S[0]&&v[1]===S[1])}get selectionText(){let v=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!v||!S)return"";let y=this._bufferService.buffer,D=[];if(this._activeSelectionMode===3){if(v[0]===S[0])return"";let M=v[0]<S[0]?v[0]:S[0],E=v[0]<S[0]?S[0]:v[0];for(let x=v[1];x<=S[1];x++){let O=y.translateBufferLineToString(x,!0,M,E);D.push(O)}}else{let M=v[1]===S[1]?S[0]:void 0;D.push(y.translateBufferLineToString(v[1],!0,v[0],M));for(let E=v[1]+1;E<=S[1]-1;E++){let x=y.lines.get(E),O=y.translateBufferLineToString(E,!0);x?.isWrapped?D[D.length-1]+=O:D.push(O)}if(v[1]!==S[1]){let E=y.lines.get(S[1]),x=y.translateBufferLineToString(S[1],!0,0,S[0]);E&&E.isWrapped?D[D.length-1]+=x:D.push(x)}}return D.map((M=>M.replace(u," "))).join(s.isWindows?`\r
6
6
  `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(l){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.isLinux&&l&&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(l){let m=this._getMouseBufferCoords(l),E=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(E&&k&&m)&&this._areCoordsInSelection(m,E,k)}isCellInSelection(l,m){let E=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!E||!k)&&this._areCoordsInSelection([l,m],E,k)}_areCoordsInSelection(l,m,E){return l[1]>m[1]&&l[1]<E[1]||m[1]===E[1]&&l[1]===m[1]&&l[0]>=m[0]&&l[0]<E[0]||m[1]<E[1]&&l[1]===E[1]&&l[0]<E[0]||m[1]<E[1]&&l[1]===m[1]&&l[0]>=m[0]}_selectWordAtCursor(l,m){let E=this._linkifier.currentLink?.link?.range;if(E)return this._model.selectionStart=[E.start.x-1,E.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(E,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let k=this._getMouseBufferCoords(l);return!!k&&(this._selectWordAt(k,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(l,m){this._model.clearSelection(),l=Math.max(l,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,l],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(l){this._model.handleTrim(l)&&this.refresh()}_getMouseBufferCoords(l){let m=this._mouseService.getCoords(l,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(l){let m=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,l,this._screenElement)[1],E=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=E?0:(m>E&&(m-=E),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(l){return s.isMac?l.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:l.shiftKey}handleMouseDown(l){if(this._mouseDownTimeStamp=l.timeStamp,(l.button!==2||!this.hasSelection)&&l.button===0){if(!this._enabled){if(!this.shouldForceSelection(l))return;l.stopPropagation()}l.preventDefault(),this._dragScrollAmount=0,this._enabled&&l.shiftKey?this._handleIncrementalClick(l):l.detail===1?this._handleSingleClick(l):l.detail===2?this._handleDoubleClick(l):l.detail===3&&this._handleTripleClick(l),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(l){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(l))}_handleSingleClick(l){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(l)?3:0,this._model.selectionStart=this._getMouseBufferCoords(l),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(l){this._selectWordAtCursor(l,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(l){let m=this._getMouseBufferCoords(l);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(l){return l.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(l){if(l.stopImmediatePropagation(),!this._model.selectionStart)return;let m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(l),!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(l),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let E=this._bufferService.buffer;if(this._model.selectionEnd[1]<E.lines.length){let k=E.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]++}m&&m[0]===this._model.selectionEnd[0]&&m[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});let l=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(l.ydisp+this._bufferService.rows,l.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=l.ydisp),this.refresh()}}_handleMouseUp(l){let m=l.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&l.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let E=this._mouseService.getCoords(l,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(E&&E[0]!==void 0&&E[1]!==void 0){let k=(0,d.moveToCellSequence)(E[0]-1,E[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let l=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,E=!(!l||!m||l[0]===m[0]&&l[1]===m[1]);E?l&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&l[0]===this._oldSelectionStart[0]&&l[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(l,m,E)):this._oldHasSelection&&this._fireOnSelectionChange(l,m,E)}_fireOnSelectionChange(l,m,E){this._oldSelectionStart=l,this._oldSelectionEnd=m,this._oldHasSelection=E,this._onSelectionChange.fire()}_handleBufferActivate(l){this.clearSelection(),this._trimListener.dispose(),this._trimListener=l.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(l,m){let E=m;for(let k=0;m>=k;k++){let x=l.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?E--:x>1&&m!==k&&(E+=x-1)}return E}setSelection(l,m,E){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[l,m],this._model.selectionStartLength=E,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(l){this._isClickInSelection(l)||(this._selectWordAtCursor(l,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(l,m,E=!0,k=!0){if(l[0]>=this._bufferService.cols)return;let x=this._bufferService.buffer,b=x.lines.get(l[1]);if(!b)return;let M=x.translateBufferLineToString(l[1],!1),H=this._convertViewportColToCharacterIndex(b,l[0]),N=H,z=l[0]-H,W=0,S=0,w=0,y=0;if(M.charAt(H)===" "){for(;H>0&&M.charAt(H-1)===" ";)H--;for(;N<M.length&&M.charAt(N+1)===" ";)N++}else{let U=l[0],K=l[0];b.getWidth(U)===0&&(W++,U--),b.getWidth(K)===2&&(S++,K++);let q=b.getString(K).length;for(q>1&&(y+=q-1,N+=q-1);U>0&&H>0&&!this._isCharWordSeparator(b.loadCell(U-1,this._workCell));){b.loadCell(U-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,U--):T>1&&(w+=T-1,H-=T-1),H--,U--}for(;K<b.length&&N+1<M.length&&!this._isCharWordSeparator(b.loadCell(K+1,this._workCell));){b.loadCell(K+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,K++):T>1&&(y+=T-1,N+=T-1),N++,K++}}N++;let R=H+z-W+w,P=Math.min(this._bufferService.cols,N-H+W+S-w-y);if(m||M.slice(H,N).trim()!==""){if(E&&R===0&&b.getCodePoint(0)!==32){let U=x.lines.get(l[1]-1);if(U&&b.isWrapped&&U.getCodePoint(this._bufferService.cols-1)!==32){let K=this._getWordAt([this._bufferService.cols-1,l[1]-1],!1,!0,!1);if(K){let q=this._bufferService.cols-K.start;R-=q,P+=q}}}if(k&&R+P===this._bufferService.cols&&b.getCodePoint(this._bufferService.cols-1)!==32){let U=x.lines.get(l[1]+1);if(U?.isWrapped&&U.getCodePoint(0)!==32){let K=this._getWordAt([0,l[1]+1],!1,!1,!0);K&&(P+=K.length)}}return{start:R,length:P}}}_selectWordAt(l,m){let E=this._getWordAt(l,m);if(E){for(;E.start<0;)E.start+=this._bufferService.cols,l[1]--;this._model.selectionStart=[E.start,l[1]],this._model.selectionStartLength=E.length}}_selectToWordAt(l){let m=this._getWordAt(l,!0);if(m){let E=l[1];for(;m.start<0;)m.start+=this._bufferService.cols,E--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,E++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,E]}}_isCharWordSeparator(l){return l.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(l.getChars())>=0}_selectLineAt(l){let m=this._bufferService.buffer.getWrappedRangeForLine(l),E={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(E,this._bufferService.cols)}};r.SelectionService=p=a([u(3,h.IBufferService),u(4,h.ICoreService),u(5,g.IMouseService),u(6,h.IOptionsService),u(7,g.IRenderService),u(8,g.ICoreBrowserService)],p)},4725:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;let a=n(8343);r.ICharSizeService=(0,a.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),r.IMouseService=(0,a.createDecorator)("MouseService"),r.IRenderService=(0,a.createDecorator)("RenderService"),r.ISelectionService=(0,a.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,a.createDecorator)("ThemeService"),r.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(L,r,n){var a=this&&this.__decorate||function(p,l,m,E){var k,x=arguments.length,b=x<3?l:E===null?E=Object.getOwnPropertyDescriptor(l,m):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,l,m,E);else for(var M=p.length-1;M>=0;M--)(k=p[M])&&(b=(x<3?k(b):x>3?k(l,m,b):k(l,m))||b);return x>3&&b&&Object.defineProperty(l,m,b),b},u=this&&this.__param||function(p,l){return function(m,E){l(m,E,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=n(7239),d=n(8055),_=n(8460),g=n(844),c=n(2585),i=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),e=d.css.toColor("#ffffff"),t=d.css.toColor("#000000"),h={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let p=[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")],l=[0,95,135,175,215,255];for(let m=0;m<216;m++){let E=l[m/36%6|0],k=l[m/6%6|0],x=l[m%6];p.push({css:d.channels.toCss(E,k,x),rgba:d.channels.toRgba(E,k,x)})}for(let m=0;m<24;m++){let E=8+10*m;p.push({css:d.channels.toCss(E,E,E),rgba:d.channels.toRgba(E,E,E)})}return p})());let v=r.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(p){super(),this._optionsService=p,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:s,cursor:e,cursorAccent:t,selectionForeground:void 0,selectionBackgroundTransparent:h,selectionBackgroundOpaque:d.color.blend(s,h),selectionInactiveBackgroundTransparent:h,selectionInactiveBackgroundOpaque:d.color.blend(s,h),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(p={}){let l=this._colors;if(l.foreground=f(p.foreground,i),l.background=f(p.background,s),l.cursor=f(p.cursor,e),l.cursorAccent=f(p.cursorAccent,t),l.selectionBackgroundTransparent=f(p.selectionBackground,h),l.selectionBackgroundOpaque=d.color.blend(l.background,l.selectionBackgroundTransparent),l.selectionInactiveBackgroundTransparent=f(p.selectionInactiveBackground,l.selectionBackgroundTransparent),l.selectionInactiveBackgroundOpaque=d.color.blend(l.background,l.selectionInactiveBackgroundTransparent),l.selectionForeground=p.selectionForeground?f(p.selectionForeground,d.NULL_COLOR):void 0,l.selectionForeground===d.NULL_COLOR&&(l.selectionForeground=void 0),d.color.isOpaque(l.selectionBackgroundTransparent)&&(l.selectionBackgroundTransparent=d.color.opacity(l.selectionBackgroundTransparent,.3)),d.color.isOpaque(l.selectionInactiveBackgroundTransparent)&&(l.selectionInactiveBackgroundTransparent=d.color.opacity(l.selectionInactiveBackgroundTransparent,.3)),l.ansi=r.DEFAULT_ANSI_COLORS.slice(),l.ansi[0]=f(p.black,r.DEFAULT_ANSI_COLORS[0]),l.ansi[1]=f(p.red,r.DEFAULT_ANSI_COLORS[1]),l.ansi[2]=f(p.green,r.DEFAULT_ANSI_COLORS[2]),l.ansi[3]=f(p.yellow,r.DEFAULT_ANSI_COLORS[3]),l.ansi[4]=f(p.blue,r.DEFAULT_ANSI_COLORS[4]),l.ansi[5]=f(p.magenta,r.DEFAULT_ANSI_COLORS[5]),l.ansi[6]=f(p.cyan,r.DEFAULT_ANSI_COLORS[6]),l.ansi[7]=f(p.white,r.DEFAULT_ANSI_COLORS[7]),l.ansi[8]=f(p.brightBlack,r.DEFAULT_ANSI_COLORS[8]),l.ansi[9]=f(p.brightRed,r.DEFAULT_ANSI_COLORS[9]),l.ansi[10]=f(p.brightGreen,r.DEFAULT_ANSI_COLORS[10]),l.ansi[11]=f(p.brightYellow,r.DEFAULT_ANSI_COLORS[11]),l.ansi[12]=f(p.brightBlue,r.DEFAULT_ANSI_COLORS[12]),l.ansi[13]=f(p.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),l.ansi[14]=f(p.brightCyan,r.DEFAULT_ANSI_COLORS[14]),l.ansi[15]=f(p.brightWhite,r.DEFAULT_ANSI_COLORS[15]),p.extendedAnsi){let m=Math.min(l.ansi.length-16,p.extendedAnsi.length);for(let E=0;E<m;E++)l.ansi[E+16]=f(p.extendedAnsi[E],r.DEFAULT_ANSI_COLORS[E+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(p){this._restoreColor(p),this._onChangeColors.fire(this.colors)}_restoreColor(p){if(p!==void 0)switch(p){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[p]=this._restoreColors.ansi[p]}else for(let l=0;l<this._restoreColors.ansi.length;++l)this._colors.ansi[l]=this._restoreColors.ansi[l]}modifyColors(p){p(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 f(p,l){if(p!==void 0)try{return d.css.toColor(p)}catch{}return l}r.ThemeService=v=a([u(0,c.IOptionsService)],v)},6349:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let a=n(8460),u=n(844);class o extends u.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new a.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new a.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new a.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(_){if(this._maxLength===_)return;let g=new Array(_);for(let c=0;c<Math.min(_,this.length);c++)g[c]=this._array[this._getCyclicIndex(c)];this._array=g,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let g=this._length;g<_;g++)this._array[g]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,g){this._array[this._getCyclicIndex(_)]=g}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,g,...c){if(g){for(let i=_;i<this._length-g;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+g)];this._length-=g,this.onDeleteEmitter.fire({index:_,amount:g})}for(let i=this._length-1;i>=_;i--)this._array[this._getCyclicIndex(i+c.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<c.length;i++)this._array[this._getCyclicIndex(_+i)]=c[i];if(c.length&&this.onInsertEmitter.fire({index:_,amount:c.length}),this._length+c.length>this._maxLength){let i=this._length+c.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=c.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,g,c){if(!(g<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+c<0)throw new Error("Cannot shift elements in list beyond index 0");if(c>0){for(let s=g-1;s>=0;s--)this.set(_+s+c,this.get(_+s));let i=_+g+c-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<g;i++)this.set(_+i+c,this.get(_+i))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}r.CircularList=o},1439:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(a,u=5){if(typeof a!="object")return a;let o=Array.isArray(a)?[]:{};for(let d in a)o[d]=u<=1?a[d]:a[d]&&n(a[d],u-1);return o}},8055:(L,r)=>{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;let n=0,a=0,u=0,o=0;var d,_,g,c,i;function s(t){let h=t.toString(16);return h.length<2?"0"+h:h}function e(t,h){return t<h?(h+.05)/(t+.05):(t+.05)/(h+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(t){t.toCss=function(h,v,f,p){return p!==void 0?`#${s(h)}${s(v)}${s(f)}${s(p)}`:`#${s(h)}${s(v)}${s(f)}`},t.toRgba=function(h,v,f,p=255){return(h<<24|v<<16|f<<8|p)>>>0},t.toColor=function(h,v,f,p){return{css:t.toCss(h,v,f,p),rgba:t.toRgba(h,v,f,p)}}})(d||(r.channels=d={})),(function(t){function h(v,f){return o=Math.round(255*f),[n,a,u]=i.toChannels(v.rgba),{css:d.toCss(n,a,u,o),rgba:d.toRgba(n,a,u,o)}}t.blend=function(v,f){if(o=(255&f.rgba)/255,o===1)return{css:f.css,rgba:f.rgba};let p=f.rgba>>24&255,l=f.rgba>>16&255,m=f.rgba>>8&255,E=v.rgba>>24&255,k=v.rgba>>16&255,x=v.rgba>>8&255;return n=E+Math.round((p-E)*o),a=k+Math.round((l-k)*o),u=x+Math.round((m-x)*o),{css:d.toCss(n,a,u),rgba:d.toRgba(n,a,u)}},t.isOpaque=function(v){return(255&v.rgba)==255},t.ensureContrastRatio=function(v,f,p){let l=i.ensureContrastRatio(v.rgba,f.rgba,p);if(l)return d.toColor(l>>24&255,l>>16&255,l>>8&255)},t.opaque=function(v){let f=(255|v.rgba)>>>0;return[n,a,u]=i.toChannels(f),{css:d.toCss(n,a,u),rgba:f}},t.opacity=h,t.multiplyOpacity=function(v,f){return o=255&v.rgba,h(v,o*f/255)},t.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}})(_||(r.color=_={})),(function(t){let h,v;try{let f=document.createElement("canvas");f.width=1,f.height=1;let p=f.getContext("2d",{willReadFrequently:!0});p&&(h=p,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}t.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return n=parseInt(f.slice(1,2).repeat(2),16),a=parseInt(f.slice(2,3).repeat(2),16),u=parseInt(f.slice(3,4).repeat(2),16),d.toColor(n,a,u);case 5:return n=parseInt(f.slice(1,2).repeat(2),16),a=parseInt(f.slice(2,3).repeat(2),16),u=parseInt(f.slice(3,4).repeat(2),16),o=parseInt(f.slice(4,5).repeat(2),16),d.toColor(n,a,u,o);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}let p=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(p)return n=parseInt(p[1]),a=parseInt(p[2]),u=parseInt(p[3]),o=Math.round(255*(p[5]===void 0?1:parseFloat(p[5]))),d.toColor(n,a,u,o);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=f,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[n,a,u,o]=h.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(n,a,u,o),css:f}}})(g||(r.css=g={})),(function(t){function h(v,f,p){let l=v/255,m=f/255,E=p/255;return .2126*(l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))}t.relativeLuminance=function(v){return h(v>>16&255,v>>8&255,255&v)},t.relativeLuminance2=h})(c||(r.rgb=c={})),(function(t){function h(f,p,l){let m=f>>24&255,E=f>>16&255,k=f>>8&255,x=p>>24&255,b=p>>16&255,M=p>>8&255,H=e(c.relativeLuminance2(x,b,M),c.relativeLuminance2(m,E,k));for(;H<l&&(x>0||b>0||M>0);)x-=Math.max(0,Math.ceil(.1*x)),b-=Math.max(0,Math.ceil(.1*b)),M-=Math.max(0,Math.ceil(.1*M)),H=e(c.relativeLuminance2(x,b,M),c.relativeLuminance2(m,E,k));return(x<<24|b<<16|M<<8|255)>>>0}function v(f,p,l){let m=f>>24&255,E=f>>16&255,k=f>>8&255,x=p>>24&255,b=p>>16&255,M=p>>8&255,H=e(c.relativeLuminance2(x,b,M),c.relativeLuminance2(m,E,k));for(;H<l&&(x<255||b<255||M<255);)x=Math.min(255,x+Math.ceil(.1*(255-x))),b=Math.min(255,b+Math.ceil(.1*(255-b))),M=Math.min(255,M+Math.ceil(.1*(255-M))),H=e(c.relativeLuminance2(x,b,M),c.relativeLuminance2(m,E,k));return(x<<24|b<<16|M<<8|255)>>>0}t.blend=function(f,p){if(o=(255&p)/255,o===1)return p;let l=p>>24&255,m=p>>16&255,E=p>>8&255,k=f>>24&255,x=f>>16&255,b=f>>8&255;return n=k+Math.round((l-k)*o),a=x+Math.round((m-x)*o),u=b+Math.round((E-b)*o),d.toRgba(n,a,u)},t.ensureContrastRatio=function(f,p,l){let m=c.relativeLuminance(f>>8),E=c.relativeLuminance(p>>8);if(e(m,E)<l){if(E<m){let b=h(f,p,l),M=e(m,c.relativeLuminance(b>>8));if(M<l){let H=v(f,p,l);return M>e(m,c.relativeLuminance(H>>8))?b:H}return b}let k=v(f,p,l),x=e(m,c.relativeLuminance(k>>8));if(x<l){let b=h(f,p,l);return x>e(m,c.relativeLuminance(b>>8))?k:b}return k}},t.reduceLuminance=h,t.increaseLuminance=v,t.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}})(i||(r.rgba=i={})),r.toPaddedHex=s,r.contrastRatio=e},8969:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let a=n(844),u=n(2585),o=n(4348),d=n(7866),_=n(744),g=n(7302),c=n(6975),i=n(8460),s=n(1753),e=n(1480),t=n(7994),h=n(9282),v=n(5435),f=n(5981),p=n(2660),l=!1;class m extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((k=>{this._onScrollApi?.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(let x in k)this.optionsService.options[x]=k[x]}constructor(k){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new g.OptionsService(k)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(t.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(p.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((x=>{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((x=>{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 f.WriteBuffer(((x,b)=>this._inputHandler.parse(x,b)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(k,x){this._writeBuffer.write(k,x)}writeSync(k,x){this._logService.logLevel<=u.LogLevelEnum.WARN&&!l&&(this._logService.warn("writeSync is unreliable and will be removed soon."),l=!0),this._writeBuffer.writeSync(k,x)}input(k,x=!0){this.coreService.triggerDataEvent(k,x)}resize(k,x){isNaN(k)||isNaN(x)||(k=Math.max(k,_.MINIMUM_COLS),x=Math.max(x,_.MINIMUM_ROWS),this._bufferService.resize(k,x))}scroll(k,x=!1){this._bufferService.scroll(k,x)}scrollLines(k,x,b){this._bufferService.scrollLines(k,x,b)}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){let x=k-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)}registerEscHandler(k,x){return this._inputHandler.registerEscHandler(k,x)}registerDcsHandler(k,x){return this._inputHandler.registerDcsHandler(k,x)}registerCsiHandler(k,x){return this._inputHandler.registerCsiHandler(k,x)}registerOscHandler(k,x){return this._inputHandler.registerOscHandler(k,x)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let k=!1,x=this.optionsService.rawOptions.windowsPty;x&&x.buildNumber!==void 0&&x.buildNumber!==void 0?k=x.backend==="conpty"&&x.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(k=!0),k?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let k=[];k.push(this.onLineFeed(h.updateWindowsModeWrappedState.bind(null,this._bufferService))),k.push(this.registerCsiHandler({final:"H"},(()=>((0,h.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let x of k)x.dispose()}))}}}r.CoreTerminal=m},8460:(L,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=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===n)return void this._listeners.splice(a,1)}}})),this._event}fire(n,a){let u=[];for(let o=0;o<this._listeners.length;o++)u.push(this._listeners[o]);for(let o=0;o<u.length;o++)u[o].call(void 0,n,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,a){return n((u=>a.fire(u)))},r.runAndSubscribe=function(n,a){return a(void 0),n((u=>a(u)))}},5435:function(L,r,n){var a=this&&this.__decorate||function(W,S,w,y){var R,P=arguments.length,U=P<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,w):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(W,S,w,y);else for(var K=W.length-1;K>=0;K--)(R=W[K])&&(U=(P<3?R(U):P>3?R(S,w,U):R(S,w))||U);return P>3&&U&&Object.defineProperty(S,w,U),U},u=this&&this.__param||function(W,S){return function(w,y){S(w,y,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=n(2584),d=n(7116),_=n(2015),g=n(844),c=n(482),i=n(8437),s=n(8460),e=n(643),t=n(511),h=n(3734),v=n(2585),f=n(1480),p=n(6242),l=n(6351),m=n(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},k=131072;function x(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 b;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(b||(r.WindowsOptionsReportType=b={}));let M=0;class H extends g.Disposable{getAttrData(){return this._curAttrData}constructor(S,w,y,R,P,U,K,q,T=new _.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=w,this._coreService=y,this._logService=R,this._optionsService=P,this._oscLinkService=U,this._coreMouseService=K,this._unicodeService=q,this._parser=T,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new t.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new 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 N(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,F)=>{this._logService.debug("Unknown OSC code: ",{identifier:C,action:O,data:F})})),this._parser.setDcsHandlerFallback(((C,O,F)=>{O==="HOOK"&&(F=F.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(C),action:O,payload:F})})),this._parser.setPrintHandler(((C,O,F)=>this.print(C,O,F))),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(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new p.OscHandler((C=>(this.setTitle(C),this.setIconName(C),!0)))),this._parser.registerOscHandler(1,new p.OscHandler((C=>this.setIconName(C)))),this._parser.registerOscHandler(2,new p.OscHandler((C=>this.setTitle(C)))),this._parser.registerOscHandler(4,new p.OscHandler((C=>this.setOrReportIndexedColor(C)))),this._parser.registerOscHandler(8,new p.OscHandler((C=>this.setHyperlink(C)))),this._parser.registerOscHandler(10,new p.OscHandler((C=>this.setOrReportFgColor(C)))),this._parser.registerOscHandler(11,new p.OscHandler((C=>this.setOrReportBgColor(C)))),this._parser.registerOscHandler(12,new p.OscHandler((C=>this.setOrReportCursorColor(C)))),this._parser.registerOscHandler(104,new p.OscHandler((C=>this.restoreIndexedColor(C)))),this._parser.registerOscHandler(110,new p.OscHandler((C=>this.restoreFgColor(C)))),this._parser.registerOscHandler(111,new p.OscHandler((C=>this.restoreBgColor(C)))),this._parser.registerOscHandler(112,new p.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(let 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 l.DcsHandler(((C,O)=>this.requestStatusString(C,O))))}_preserveStack(S,w,y,R){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=w,this._parseStack.decodedLength=y,this._parseStack.position=R}_logSlowResolvingAsync(S){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([S,new Promise(((w,y)=>setTimeout((()=>y("#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 y,R=this._activeBuffer.x,P=this._activeBuffer.y,U=0,K=this._parseStack.paused;if(K){if(y=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,w))return this._logSlowResolvingAsync(y),y;R=this._parseStack.cursorStartX,P=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>k&&(U=this._parseStack.position+k)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?` "${S}"`:` "${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))),K||this._dirtyRowTracker.clearRange(),S.length>k)for(let C=U;C<S.length;C+=k){let O=C+k<S.length?C+k:S.length,F=typeof S=="string"?this._stringDecoder.decode(S.substring(C,O),this._parseBuffer):this._utf8Decoder.decode(S.subarray(C,O),this._parseBuffer);if(y=this._parser.parse(this._parseBuffer,F))return this._preserveStack(R,P,F,C),this._logSlowResolvingAsync(y),y}else if(!K){let C=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(y=this._parser.parse(this._parseBuffer,C))return this._preserveStack(R,P,C,0),this._logSlowResolvingAsync(y),y}this._activeBuffer.x===R&&this._activeBuffer.y===P||this._onCursorMove.fire();let q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),T=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);T<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(T,this._bufferService.rows-1),Math.min(q,this._bufferService.rows-1))}print(S,w,y){let R,P,U=this._charsetService.charset,K=this._optionsService.rawOptions.screenReaderMode,q=this._bufferService.cols,T=this._coreService.decPrivateModes.wraparound,C=this._coreService.modes.insertMode,O=this._curAttrData,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&y-w>0&&F.getWidth(this._activeBuffer.x-1)===2&&F.setCellFromCodepoint(this._activeBuffer.x-1,0,1,O);let j=this._parser.precedingJoinState;for(let $=w;$<y;++$){if(R=S[$],R<127&&U){let te=U[String.fromCharCode(R)];te&&(R=te.charCodeAt(0))}let G=this._unicodeService.charProperties(R,j);P=f.UnicodeService.extractWidth(G);let Y=f.UnicodeService.extractShouldJoin(G),Z=Y?f.UnicodeService.extractWidth(j):0;if(j=G,K&&this._onA11yChar.fire((0,c.stringFromCodePoint)(R)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+P-Z>q){if(T){let te=F,V=this._activeBuffer.x-Z;for(this._activeBuffer.x=Z,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),F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Z>0&&F instanceof i.BufferLine&&F.copyCellsFrom(te,V,0,Z,!1);V<q;)te.setCellFromCodepoint(V++,0,1,O)}else if(this._activeBuffer.x=q-1,P===2)continue}if(Y&&this._activeBuffer.x){let te=F.getWidth(this._activeBuffer.x-1)?1:2;F.addCodepointToCell(this._activeBuffer.x-te,R,P);for(let V=P-Z;--V>=0;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,O)}else if(C&&(F.insertCells(this._activeBuffer.x,P-Z,this._activeBuffer.getNullCell(O)),F.getWidth(q-1)===2&&F.setCellFromCodepoint(q-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,O)),F.setCellFromCodepoint(this._activeBuffer.x++,R,P,O),P>0)for(;--P;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,O)}this._parser.precedingJoinState=j,this._activeBuffer.x<q&&y-w>0&&F.getWidth(this._activeBuffer.x)===0&&!F.hasContent(this._activeBuffer.x)&&F.setCellFromCodepoint(this._activeBuffer.x,0,1,O),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,(y=>!x(y.params[0],this._optionsService.rawOptions.windowOptions)||w(y)))}registerDcsHandler(S,w){return this._parser.registerDcsHandler(S,new l.DcsHandler(w))}registerEscHandler(S,w){return this._parser.registerEscHandler(S,w)}registerOscHandler(S,w){return this._parser.registerOscHandler(S,new p.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(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);S.hasWidth(this._activeBuffer.x)&&!S.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let 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){let 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){let 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){let 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){let w=S.params[0];return w===1&&(this._curAttrData.bg|=536870912),w!==2&&w!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,w,y,R=!1,P=!1){let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);U.replaceCells(w,y,this._activeBuffer.getNullCell(this._eraseAttrData()),P),R&&(U.isWrapped=!1)}_resetBufferLine(S,w=!1){let y=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);y&&(y.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),w),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),y.isWrapped=!1)}eraseInDisplay(S,w=!1){let y;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(y=this._activeBuffer.y,this._dirtyRowTracker.markDirty(y),this._eraseInBufferLine(y++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);y<this._bufferService.rows;y++)this._resetBufferLine(y,w);this._dirtyRowTracker.markDirty(y);break;case 1:for(y=this._activeBuffer.y,this._dirtyRowTracker.markDirty(y),this._eraseInBufferLine(y,0,this._activeBuffer.x+1,!0,w),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(y+1).isWrapped=!1);y--;)this._resetBufferLine(y,w);this._dirtyRowTracker.markDirty(0);break;case 2:for(y=this._bufferService.rows,this._dirtyRowTracker.markDirty(y-1);y--;)this._resetBufferLine(y,w);this._dirtyRowTracker.markDirty(0);break;case 3:let R=this._activeBuffer.lines.length-this._bufferService.rows;R>0&&(this._activeBuffer.lines.trimStart(R),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-R,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-R,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;let y=this._activeBuffer.ybase+this._activeBuffer.y,R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-R+1;for(;w--;)this._activeBuffer.lines.splice(P-1,1),this._activeBuffer.lines.splice(y,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;let y=this._activeBuffer.ybase+this._activeBuffer.y,R;for(R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,R=this._bufferService.rows-1+this._activeBuffer.ybase-R;w--;)this._activeBuffer.lines.splice(y,1),this._activeBuffer.lines.splice(R,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();let 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._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(S){this._restrictCursor();let 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._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(i.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;let w=S.params[0]||1;for(let y=this._activeBuffer.scrollTop;y<=this._activeBuffer.scrollBottom;++y){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);R.deleteCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData())),R.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;let w=S.params[0]||1;for(let y=this._activeBuffer.scrollTop;y<=this._activeBuffer.scrollBottom;++y){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);R.insertCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData())),R.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;let w=S.params[0]||1;for(let y=this._activeBuffer.scrollTop;y<=this._activeBuffer.scrollBottom;++y){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);R.insertCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData())),R.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;let w=S.params[0]||1;for(let y=this._activeBuffer.scrollTop;y<=this._activeBuffer.scrollBottom;++y){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);R.deleteCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let 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._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(S){let w=this._parser.precedingJoinState;if(!w)return!0;let y=S.params[0]||1,R=f.UnicodeService.extractWidth(w),P=this._activeBuffer.x-R,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(P),K=new Uint32Array(U.length*y),q=0;for(let C=0;C<U.length;){let O=U.codePointAt(C)||0;K[q++]=O,C+=O>65535?2:1}let T=q;for(let C=1;C<y;++C)K.copyWithin(T,0,q),T+=q;return this.print(K,0,T),!0}sendDeviceAttributesPrimary(S){return S.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.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){let y=this._coreService.decPrivateModes,{activeProtocol:R,activeEncoding:P}=this._coreMouseService,U=this._coreService,{buffers:K,cols:q}=this._bufferService,{active:T,alt:C}=K,O=this._optionsService.rawOptions,F=Y=>Y?1:2,j=S.params[0];return $=j,G=w?j===2?4:j===4?F(U.modes.insertMode):j===12?3:j===20?F(O.convertEol):0:j===1?F(y.applicationCursorKeys):j===3?O.windowOptions.setWinLines?q===80?2:q===132?1:0:0:j===6?F(y.origin):j===7?F(y.wraparound):j===8?3:j===9?F(R==="X10"):j===12?F(O.cursorBlink):j===25?F(!U.isCursorHidden):j===45?F(y.reverseWraparound):j===66?F(y.applicationKeypad):j===67?4:j===1e3?F(R==="VT200"):j===1002?F(R==="DRAG"):j===1003?F(R==="ANY"):j===1004?F(y.sendFocus):j===1005?4:j===1006?F(P==="SGR"):j===1015?4:j===1016?F(P==="SGR_PIXELS"):j===1048?1:j===47||j===1047||j===1049?F(T===C):j===2004?F(y.bracketedPasteMode):0,U.triggerDataEvent(`${o.C0.ESC}[${w?"":"?"}${$};${G}$y`),!0;var $,G}_updateAttrColor(S,w,y,R,P){return w===2?(S|=50331648,S&=-16777216,S|=h.AttributeData.fromColorRGB([y,R,P])):w===5&&(S&=-50331904,S|=33554432|255&y),S}_extractColor(S,w,y){let R=[0,0,-1,0,0,0],P=0,U=0;do{if(R[U+P]=S.params[w+U],S.hasSubParams(w+U)){let K=S.getSubParams(w+U),q=0;do R[1]===5&&(P=1),R[U+q+1+P]=K[q];while(++q<K.length&&q+U+1+P<R.length);break}if(R[1]===5&&U+P>=2||R[1]===2&&U+P>=5)break;R[1]&&(P=1)}while(++U+w<S.length&&U+P<R.length);for(let K=2;K<R.length;++K)R[K]===-1&&(R[K]=0);switch(R[0]){case 38:y.fg=this._updateAttrColor(y.fg,R[1],R[3],R[4],R[5]);break;case 48:y.bg=this._updateAttrColor(y.bg,R[1],R[3],R[4],R[5]);break;case 58:y.extended=y.extended.clone(),y.extended.underlineColor=this._updateAttrColor(y.extended.underlineColor,R[1],R[3],R[4],R[5])}return U}_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=i.DEFAULT_ATTR_DATA.fg,S.bg=i.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;let w=S.length,y,R=this._curAttrData;for(let P=0;P<w;P++)y=S.params[P],y>=30&&y<=37?(R.fg&=-50331904,R.fg|=16777216|y-30):y>=40&&y<=47?(R.bg&=-50331904,R.bg|=16777216|y-40):y>=90&&y<=97?(R.fg&=-50331904,R.fg|=16777224|y-90):y>=100&&y<=107?(R.bg&=-50331904,R.bg|=16777224|y-100):y===0?this._processSGR0(R):y===1?R.fg|=134217728:y===3?R.bg|=67108864:y===4?(R.fg|=268435456,this._processUnderline(S.hasSubParams(P)?S.getSubParams(P)[0]:1,R)):y===5?R.fg|=536870912:y===7?R.fg|=67108864:y===8?R.fg|=1073741824:y===9?R.fg|=2147483648:y===2?R.bg|=134217728:y===21?this._processUnderline(2,R):y===22?(R.fg&=-134217729,R.bg&=-134217729):y===23?R.bg&=-67108865:y===24?(R.fg&=-268435457,this._processUnderline(0,R)):y===25?R.fg&=-536870913:y===27?R.fg&=-67108865:y===28?R.fg&=-1073741825:y===29?R.fg&=2147483647:y===39?(R.fg&=-67108864,R.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):y===49?(R.bg&=-67108864,R.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):y===38||y===48||y===58?P+=this._extractColor(S,P,R):y===53?R.bg|=1073741824:y===55?R.bg&=-1073741825:y===59?(R.extended=R.extended.clone(),R.extended.underlineColor=-1,R.updateExtended()):y===100?(R.fg&=-67108864,R.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,R.bg&=-67108864,R.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",y);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let w=this._activeBuffer.y+1,y=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${w};${y}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let w=this._activeBuffer.y+1,y=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${w};${y}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=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){let 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"}let y=w%2==1;return this._optionsService.options.cursorBlink=y,!0}setScrollRegion(S){let w=S.params[0]||1,y;return(S.length<2||(y=S.params[1])>this._bufferService.rows||y===0)&&(y=this._bufferService.rows),y>w&&(this._activeBuffer.scrollTop=w-1,this._activeBuffer.scrollBottom=y-1,this._setCursor(0,0)),!0}windowOptions(S){if(!x(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let w=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:w!==2&&this._onRequestWindowsOptionsReport.fire(b.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(b.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${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){let w=[],y=S.split(";");for(;y.length>1;){let R=y.shift(),P=y.shift();if(/^\d+$/.exec(R)){let U=parseInt(R);if(z(U))if(P==="?")w.push({type:0,index:U});else{let K=(0,m.parseColor)(P);K&&w.push({type:1,index:U,color:K})}}}return w.length&&this._onColor.fire(w),!0}setHyperlink(S){let 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();let y=S.split(":"),R,P=y.findIndex((U=>U.startsWith("id=")));return P!==-1&&(R=y[P].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:R,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){let y=S.split(";");for(let R=0;R<y.length&&!(w>=this._specialColors.length);++R,++w)if(y[R]==="?")this._onColor.fire([{type:0,index:this._specialColors[w]}]);else{let P=(0,m.parseColor)(y[R]);P&&this._onColor.fire([{type:1,index:this._specialColors[w],color:P}])}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;let w=[],y=S.split(";");for(let R=0;R<y.length;++R)if(/^\d+$/.exec(y[R])){let P=parseInt(y[R]);z(P)&&w.push({type:2,index:P})}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(E[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){let 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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.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(){let S=new t.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){let y=this._activeBuffer.ybase+this._activeBuffer.y+w,R=this._activeBuffer.lines.get(y);R&&(R.fill(S),R.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,w){let y=this._bufferService.buffer,R=this._optionsService.rawOptions;return(P=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${P}${o.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${y.scrollTop+1};${y.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[R.cursorStyle]-(R.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,w){this._dirtyRowTracker.markRangeDirty(S,w)}}r.InputHandler=H;let N=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&&(M=W,W=S,S=M),W<this.start&&(this.start=W),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function z(W){return 0<=W&&W<256}N=a([u(0,v.IBufferService)],N)},844:(L,r)=>{function n(a){for(let u of a)u.dispose();a.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(let a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let u=this._disposables.indexOf(a);u!==-1&&this._disposables.splice(u,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){this._isDisposed||a===this._value||(this._value?.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(a){return{dispose:a}},r.disposeArray=n,r.getDisposeArrayDisposable=function(a){return{dispose:()=>n(a)}}},1505:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(u,o,d){this._data[u]||(this._data[u]={}),this._data[u][o]=d}get(u,o){return this._data[u]?this._data[u][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(a,u,o,d,_){this._data.get(a,u)||this._data.set(a,u,new n),this._data.get(a,u).set(o,d,_)}get(a,u,o,d){return this._data.get(a,u)?.get(o,d)}clear(){this._data.clear()}}},6114:(L,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"&&"title"in process;let n=r.isNode?"node":navigator.userAgent,a=r.isNode?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.getSafariVersion=function(){if(!r.isSafari)return 0;let u=n.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),r.isIpad=a==="iPad",r.isIphone=a==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),r.isLinux=a.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(n=this._search(this._getKey(a)),this._array.splice(n,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let u=this._getKey(a);if(u===void 0||(n=this._search(u),n===-1)||this._getKey(this._array[n])!==u)return!1;do if(this._array[n]===a)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===u);return!1}*getKeyIterator(a){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===a)}forEachByKey(a,u){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do u(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===a)}values(){return[...this._array].values()}_search(a){let u=0,o=this._array.length-1;for(;o>=u;){let d=u+o>>1,_=this._getKey(this._array[d]);if(_>a)o=d-1;else{if(!(_<a)){for(;d>0&&this._getKey(this._array[d-1])===a;)d--;return d}u=d+1}}return u}}},7226:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let a=n(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let g=0,c=0,i=_.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),c=Math.max(g,c),s=_.timeRemaining(),1.5*c>s)return i-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-g))}ms`),void this._start();i=s}this.clear()}}class o extends u{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){let g=Date.now()+_;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let a=n(643);r.updateWindowsModeWrappedState=function(u){let o=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),d=o?.get(u.cols-1),_=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);_&&d&&(_.isWrapped=d[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&d[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){let o=new n;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}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}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=n;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}get underlineVariantOffset(){let o=(3758096384&this._ext)>>29;return o<0?4294967288^o:o}set underlineVariantOffset(o){this._ext&=536870911,this._ext|=o<<29&3758096384}constructor(o=0,d=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=d}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=a},9092:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let a=n(6349),u=n(7226),o=n(3734),d=n(8437),_=n(4634),g=n(511),c=n(643),i=n(4863),s=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,t,h){this._hasScrollback=e,this._optionsService=t,this._bufferService=h,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=g.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new d.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=d.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let h=this.getNullCell(d.DEFAULT_ATTR_DATA),v=0,f=this._getCorrectBufferLength(t);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)v+=+this.lines.get(l).resize(e,h);let p=0;if(this._rows<t)for(let l=this._rows;l<t;l++)this.lines.length<t+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(e,h)):this.ybase>0&&this.lines.length<=this.ybase+this.y+p+1?(this.ybase--,p++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(e,h)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){let l=this.lines.length-f;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=f}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),p&&(this.y+=p),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let p=0;p<this.lines.length;p++)v+=+this.lines.get(p).resize(e,h);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let h=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(h.length>0){let v=(0,_.reflowLargerCreateNewLayout)(this.lines,h);(0,_.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(e,t,v.countRemoved)}}_reflowLargerAdjustViewport(e,t,h){let v=this.getNullCell(d.DEFAULT_ATTR_DATA),f=h;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new d.BufferLine(e,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-h,0)}_reflowSmaller(e,t){let h=this.getNullCell(d.DEFAULT_ATTR_DATA),v=[],f=0;for(let p=this.lines.length-1;p>=0;p--){let l=this.lines.get(p);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let m=[l];for(;l.isWrapped&&p>0;)l=this.lines.get(--p),m.unshift(l);let E=this.ybase+this.y;if(E>=p&&E<p+m.length)continue;let k=m[m.length-1].getTrimmedLength(),x=(0,_.reflowSmallerGetNewLineLengths)(m,this._cols,e),b=x.length-m.length,M;M=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+b):Math.max(0,this.lines.length-this.lines.maxLength+b);let H=[];for(let y=0;y<b;y++){let R=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);H.push(R)}H.length>0&&(v.push({start:p+m.length+f,newLines:H}),f+=H.length),m.push(...H);let N=x.length-1,z=x[N];z===0&&(N--,z=x[N]);let W=m.length-b-1,S=k;for(;W>=0;){let y=Math.min(S,z);if(m[N]===void 0)break;if(m[N].copyCellsFrom(m[W],S-y,z-y,y,!0),z-=y,z===0&&(N--,z=x[N]),S-=y,S===0){W--;let R=Math.max(W,0);S=(0,_.getWrappedLineTrimmedLength)(m,R,this._cols)}}for(let y=0;y<m.length;y++)x[y]<e&&m[y].setCell(x[y],h);let w=b-M;for(;w-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+b,this.ybase+t-1)}if(v.length>0){let p=[],l=[];for(let N=0;N<this.lines.length;N++)l.push(this.lines.get(N));let m=this.lines.length,E=m-1,k=0,x=v[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let b=0;for(let N=Math.min(this.lines.maxLength-1,m+f-1);N>=0;N--)if(x&&x.start>E+b){for(let z=x.newLines.length-1;z>=0;z--)this.lines.set(N--,x.newLines[z]);N++,p.push({index:E+1,amount:x.newLines.length}),b+=x.newLines.length,x=v[++k]}else this.lines.set(N,l[E--]);let M=0;for(let N=p.length-1;N>=0;N--)p[N].index+=M,this.lines.onInsertEmitter.fire(p[N]),M+=p[N].amount;let H=Math.max(0,m+f-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(e,t,h=0,v){let f=this.lines.get(e);return f?f.translateToString(t,h,v):""}getWrappedRangeForLine(e){let t=e,h=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;h+1<this.lines.length&&this.lines.get(h+1).isWrapped;)h++;return{first:t,last:h}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new i.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((h=>{t.line-=h,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((h=>{t.line>=h.index&&(t.line+=h.amount)}))),t.register(this.lines.onDelete((h=>{t.line>=h.index&&t.line<h.index+h.amount&&t.dispose(),t.line>h.index&&(t.line-=h.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let a=n(3734),u=n(511),o=n(643),d=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let _=0;class g{constructor(i,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let t=s||u.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let h=0;h<i;++h)this.setCell(h,t);this.length=i}get(i){let s=this._data[3*i+0],e=2097151&s;return[this._data[3*i+1],2097152&s?this._combined[i]:e?(0,d.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,s){this._data[3*i+1]=s[o.CHAR_DATA_ATTR_INDEX],s[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=s[1],this._data[3*i+0]=2097152|i|s[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=s[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&s}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i]:2097151&s?(0,d.stringFromCodePoint)(2097151&s):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,s){return _=3*i,s.content=this._data[_+0],s.fg=this._data[_+1],s.bg=this._data[_+2],2097152&s.content&&(s.combinedData=this._combined[i]),268435456&s.bg&&(s.extended=this._extendedAttrs[i]),s}setCell(i,s){2097152&s.content&&(this._combined[i]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=s.content,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}setCellFromCodepoint(i,s,e,t){268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=s|e<<22,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}addCodepointToCell(i,s,e){let t=this._data[3*i+0];2097152&t?this._combined[i]+=(0,d.stringFromCodePoint)(s):2097151&t?(this._combined[i]=(0,d.stringFromCodePoint)(2097151&t)+(0,d.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,e&&(t&=-12582913,t|=e<<22),this._data[3*i+0]=t}insertCells(i,s,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length-i){let t=new u.CellData;for(let h=this.length-i-s-1;h>=0;--h)this.setCell(i+s+h,this.loadCell(i+h,t));for(let h=0;h<s;++h)this.setCell(i+h,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,s,e){if(i%=this.length,s<this.length-i){let t=new u.CellData;for(let h=0;h<this.length-i-s;++h)this.setCell(i+h,this.loadCell(i+s+h,t));for(let h=this.length-s;h<this.length;++h)this.setCell(h,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,s,e,t=!1){if(t)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.setCell(i++,e)}resize(i,s){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let t=new Uint32Array(e);t.set(this._data),this._data=t}for(let t=this.length;t<i;++t)this.setCell(t,s)}else{this._data=this._data.subarray(0,e);let t=Object.keys(this._combined);for(let v=0;v<t.length;v++){let f=parseInt(t[v],10);f>=i&&delete this._combined[f]}let h=Object.keys(this._extendedAttrs);for(let v=0;v<h.length;v++){let f=parseInt(h[v],10);f>=i&&delete this._extendedAttrs[f]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let s in i._combined)this._combined[s]=i._combined[s];this._extendedAttrs={};for(let s in i._extendedAttrs)this._extendedAttrs[s]=i._extendedAttrs[s];this.isWrapped=i.isWrapped}clone(){let i=new g(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let s in this._combined)i._combined[s]=this._combined[s];for(let s in this._extendedAttrs)i._extendedAttrs[s]=this._extendedAttrs[s];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,s,e,t,h){let v=i._data;if(h)for(let p=t-1;p>=0;p--){for(let l=0;l<3;l++)this._data[3*(e+p)+l]=v[3*(s+p)+l];268435456&v[3*(s+p)+2]&&(this._extendedAttrs[e+p]=i._extendedAttrs[s+p])}else for(let p=0;p<t;p++){for(let l=0;l<3;l++)this._data[3*(e+p)+l]=v[3*(s+p)+l];268435456&v[3*(s+p)+2]&&(this._extendedAttrs[e+p]=i._extendedAttrs[s+p])}let f=Object.keys(i._combined);for(let p=0;p<f.length;p++){let l=parseInt(f[p],10);l>=s&&(this._combined[l-s+e]=i._combined[l])}}translateToString(i,s,e,t){s=s??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),t&&(t.length=0);let h="";for(;s<e;){let v=this._data[3*s+0],f=2097151&v,p=2097152&v?this._combined[s]:f?(0,d.stringFromCodePoint)(f):o.WHITESPACE_CELL_CHAR;if(h+=p,t)for(let l=0;l<p.length;++l)t.push(s);s+=v>>22||1}return t&&t.push(s),h}}r.BufferLine=g},4841:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,a){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return a*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(L,r)=>{function n(a,u,o){if(u===a.length-1)return a[u].getTrimmedLength();let d=!a[u].hasContent(o-1)&&a[u].getWidth(o-1)===1,_=a[u+1].getWidth(0)===2;return d&&_?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(a,u,o,d,_){let g=[];for(let c=0;c<a.length-1;c++){let i=c,s=a.get(++i);if(!s.isWrapped)continue;let e=[a.get(c)];for(;i<a.length&&s.isWrapped;)e.push(s),s=a.get(++i);if(d>=c&&d<i){c+=e.length-1;continue}let t=0,h=n(e,t,u),v=1,f=0;for(;v<e.length;){let l=n(e,v,u),m=l-f,E=o-h,k=Math.min(m,E);e[t].copyCellsFrom(e[v],f,h,k,!1),h+=k,h===o&&(t++,h=0),f+=k,f===l&&(v++,f=0),h===0&&t!==0&&e[t-1].getWidth(o-1)===2&&(e[t].copyCellsFrom(e[t-1],o-1,h++,1,!1),e[t-1].setCell(o-1,_))}e[t].replaceCells(h,o,_);let p=0;for(let l=e.length-1;l>0&&(l>t||e[l].getTrimmedLength()===0);l--)p++;p>0&&(g.push(c+e.length-p),g.push(p)),c+=e.length-1}return g},r.reflowLargerCreateNewLayout=function(a,u){let o=[],d=0,_=u[d],g=0;for(let c=0;c<a.length;c++)if(_===c){let i=u[++d];a.onDeleteEmitter.fire({index:c-g,amount:i}),c+=i-1,g+=i,_=u[++d]}else o.push(c);return{layout:o,countRemoved:g}},r.reflowLargerApplyNewLayout=function(a,u){let o=[];for(let d=0;d<u.length;d++)o.push(a.get(u[d]));for(let d=0;d<o.length;d++)a.set(d,o[d]);a.length=u.length},r.reflowSmallerGetNewLineLengths=function(a,u,o){let d=[],_=a.map(((s,e)=>n(a,e,u))).reduce(((s,e)=>s+e)),g=0,c=0,i=0;for(;i<_;){if(_-i<o){d.push(_-i);break}g+=o;let s=n(a,c,u);g>s&&(g-=s,c++);let e=a[c].getWidth(g-1)===2;e&&g--;let t=e?o-1:o;d.push(t),i+=t}return d},r.getWrappedLineTrimmedLength=n},5295:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let a=n(8460),u=n(844),o=n(9092);class d extends u.Disposable{constructor(g,c){super(),this._optionsService=g,this._bufferService=c,this._onBufferActivate=this.register(new a.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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.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(g){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(g),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(g,c){this._normal.resize(g,c),this._alt.resize(g,c),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}r.BufferSet=d},511:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let a=n(482),u=n(643),o=n(3734);class d extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(g){let c=new d;return c.setFromCharData(g),c}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let c=!1;if(g[u.CHAR_DATA_CHAR_INDEX].length>2)c=!0;else if(g[u.CHAR_DATA_CHAR_INDEX].length===2){let i=g[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let s=g[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|g[u.CHAR_DATA_WIDTH_INDEX]<<22:c=!0}else c=!0}else this.content=g[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[u.CHAR_DATA_WIDTH_INDEX]<<22;c&&(this.combinedData=g[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=d},643:(L,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:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let a=n(8460),u=n(844);class o{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new a.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,u.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}r.Marker=o,o._nextId=1},7116:(L,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]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(L,r)=>{var n,a,u;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
8
- `,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="\x7F"})(n||(r.C0=n={})),(function(o){o.PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F"})(a||(r.C1=a={})),(function(o){o.ST=`${n.ESC}\\`})(u||(r.C1_ESCAPED=u={}))},7399:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let a=n(2584),u={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(o,d,_,g){let c={type:0,cancel:!1,key:void 0},i=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?c.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?c.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?c.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(c.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:c.key=o.ctrlKey?"\b":a.C0.DEL,o.altKey&&(c.key=a.C0.ESC+c.key);break;case 9:if(o.shiftKey){c.key=a.C0.ESC+"[Z";break}c.key=a.C0.HT,c.cancel=!0;break;case 13:c.key=o.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,c.cancel=!0;break;case 27:c.key=a.C0.ESC,o.altKey&&(c.key=a.C0.ESC+a.C0.ESC),c.cancel=!0;break;case 37:if(o.metaKey)break;i?(c.key=a.C0.ESC+"[1;"+(i+1)+"D",c.key===a.C0.ESC+"[1;3D"&&(c.key=a.C0.ESC+(_?"b":"[1;5D"))):c.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(o.metaKey)break;i?(c.key=a.C0.ESC+"[1;"+(i+1)+"C",c.key===a.C0.ESC+"[1;3C"&&(c.key=a.C0.ESC+(_?"f":"[1;5C"))):c.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(o.metaKey)break;i?(c.key=a.C0.ESC+"[1;"+(i+1)+"A",_||c.key!==a.C0.ESC+"[1;3A"||(c.key=a.C0.ESC+"[1;5A")):c.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(o.metaKey)break;i?(c.key=a.C0.ESC+"[1;"+(i+1)+"B",_||c.key!==a.C0.ESC+"[1;3B"||(c.key=a.C0.ESC+"[1;5B")):c.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(c.key=a.C0.ESC+"[2~");break;case 46:c.key=i?a.C0.ESC+"[3;"+(i+1)+"~":a.C0.ESC+"[3~";break;case 36:c.key=i?a.C0.ESC+"[1;"+(i+1)+"H":d?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:c.key=i?a.C0.ESC+"[1;"+(i+1)+"F":d?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:o.shiftKey?c.type=2:o.ctrlKey?c.key=a.C0.ESC+"[5;"+(i+1)+"~":c.key=a.C0.ESC+"[5~";break;case 34:o.shiftKey?c.type=3:o.ctrlKey?c.key=a.C0.ESC+"[6;"+(i+1)+"~":c.key=a.C0.ESC+"[6~";break;case 112:c.key=i?a.C0.ESC+"[1;"+(i+1)+"P":a.C0.ESC+"OP";break;case 113:c.key=i?a.C0.ESC+"[1;"+(i+1)+"Q":a.C0.ESC+"OQ";break;case 114:c.key=i?a.C0.ESC+"[1;"+(i+1)+"R":a.C0.ESC+"OR";break;case 115:c.key=i?a.C0.ESC+"[1;"+(i+1)+"S":a.C0.ESC+"OS";break;case 116:c.key=i?a.C0.ESC+"[15;"+(i+1)+"~":a.C0.ESC+"[15~";break;case 117:c.key=i?a.C0.ESC+"[17;"+(i+1)+"~":a.C0.ESC+"[17~";break;case 118:c.key=i?a.C0.ESC+"[18;"+(i+1)+"~":a.C0.ESC+"[18~";break;case 119:c.key=i?a.C0.ESC+"[19;"+(i+1)+"~":a.C0.ESC+"[19~";break;case 120:c.key=i?a.C0.ESC+"[20;"+(i+1)+"~":a.C0.ESC+"[20~";break;case 121:c.key=i?a.C0.ESC+"[21;"+(i+1)+"~":a.C0.ESC+"[21~";break;case 122:c.key=i?a.C0.ESC+"[23;"+(i+1)+"~":a.C0.ESC+"[23~";break;case 123:c.key=i?a.C0.ESC+"[24;"+(i+1)+"~":a.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(_&&!g||!o.altKey||o.metaKey)!_||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?c.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(c.key=a.C0.US),o.key==="@"&&(c.key=a.C0.NUL)):o.keyCode===65&&(c.type=1);else{let s=u[o.keyCode],e=s?.[o.shiftKey?1:0];if(e)c.key=a.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let t=o.ctrlKey?o.keyCode-64:o.keyCode+32,h=String.fromCharCode(t);o.shiftKey&&(h=h.toUpperCase()),c.key=a.C0.ESC+h}else if(o.keyCode===32)c.key=a.C0.ESC+(o.ctrlKey?a.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let t=o.code.slice(3,4);o.shiftKey||(t=t.toLowerCase()),c.key=a.C0.ESC+t,c.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?c.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?c.key=a.C0.NUL:o.keyCode>=51&&o.keyCode<=55?c.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?c.key=a.C0.DEL:o.keyCode===219?c.key=a.C0.ESC:o.keyCode===220?c.key=a.C0.FS:o.keyCode===221&&(c.key=a.C0.GS)}return c}},482:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},r.utf32ToString=function(n,a=0,u=n.length){let o="";for(let d=a;d<u;++d){let _=n[d];_>65535?(_-=65536,o+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):o+=String.fromCharCode(_)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,a){let u=n.length;if(!u)return 0;let o=0,d=0;if(this._interim){let _=n.charCodeAt(d++);56320<=_&&_<=57343?a[o++]=1024*(this._interim-55296)+_-56320+65536:(a[o++]=this._interim,a[o++]=_),this._interim=0}for(let _=d;_<u;++_){let g=n.charCodeAt(_);if(55296<=g&&g<=56319){if(++_>=u)return this._interim=g,o;let c=n.charCodeAt(_);56320<=c&&c<=57343?a[o++]=1024*(g-55296)+c-56320+65536:(a[o++]=g,a[o++]=c)}else g!==65279&&(a[o++]=g)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,a){let u=n.length;if(!u)return 0;let o,d,_,g,c=0,i=0,s=0;if(this.interim[0]){let h=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let f,p=0;for(;(f=63&this.interim[++p])&&p<4;)v<<=6,v|=f;let l=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=l-p;for(;s<m;){if(s>=u)return 0;if(f=n[s++],(192&f)!=128){s--,h=!0;break}this.interim[p++]=f,v<<=6,v|=63&f}h||(l===2?v<128?s--:a[c++]=v:l===3?v<2048||v>=55296&&v<=57343||v===65279||(a[c++]=v):v<65536||v>1114111||(a[c++]=v)),this.interim.fill(0)}let e=u-4,t=s;for(;t<u;){for(;!(!(t<e)||128&(o=n[t])||128&(d=n[t+1])||128&(_=n[t+2])||128&(g=n[t+3]));)a[c++]=o,a[c++]=d,a[c++]=_,a[c++]=g,t+=4;if(o=n[t++],o<128)a[c++]=o;else if((224&o)==192){if(t>=u)return this.interim[0]=o,c;if(d=n[t++],(192&d)!=128){t--;continue}if(i=(31&o)<<6|63&d,i<128){t--;continue}a[c++]=i}else if((240&o)==224){if(t>=u)return this.interim[0]=o,c;if(d=n[t++],(192&d)!=128){t--;continue}if(t>=u)return this.interim[0]=o,this.interim[1]=d,c;if(_=n[t++],(192&_)!=128){t--;continue}if(i=(15&o)<<12|(63&d)<<6|63&_,i<2048||i>=55296&&i<=57343||i===65279)continue;a[c++]=i}else if((248&o)==240){if(t>=u)return this.interim[0]=o,c;if(d=n[t++],(192&d)!=128){t--;continue}if(t>=u)return this.interim[0]=o,this.interim[1]=d,c;if(_=n[t++],(192&_)!=128){t--;continue}if(t>=u)return this.interim[0]=o,this.interim[1]=d,this.interim[2]=_,c;if(g=n[t++],(192&g)!=128){t--;continue}if(i=(7&o)<<18|(63&d)<<12|(63&_)<<6|63&g,i<65536||i>1114111)continue;a[c++]=i}}return c}}},225:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let a=n(1480),u=[[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]],o=[[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]],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 _=0;_<u.length;++_)d.fill(0,u[_][0],u[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?d[_]:(function(g,c){let i,s=0,e=c.length-1;if(g<c[0][0]||g>c[e][1])return!1;for(;e>=s;)if(i=s+e>>1,g>c[i][1])s=i+1;else{if(!(g<c[i][0]))return!0;e=i-1}return!1})(_,o)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,g){let c=this.wcwidth(_),i=c===0&&g!==0;if(i){let s=a.UnicodeService.extractWidth(g);s===0?i=!1:s>c&&(c=s)}return a.UnicodeService.createPropertyValue(0,c,i)}}},5981:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let a=n(8460),u=n(844);class o extends u.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let c;for(this._isSyncWriting=!0;c=this._writeBuffer.shift();){this._action(c);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,g){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(g),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(g)}_innerWrite(_=0,g=!0){let c=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,g);if(s){let t=h=>Date.now()-c>=12?setTimeout((()=>this._innerWrite(0,h))):this._innerWrite(c,h);return void s.catch((h=>(queueMicrotask((()=>{throw h})),Promise.resolve(!1)))).then(t)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-c>=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=o},5941:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let n=/^([\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})$/,a=/^[\da-f]+$/;function u(o,d){let _=o.toString(16),g=_.length<2?"0"+_:_;switch(d){case 4:return _[0];case 8:return g;case 12:return(g+g).slice(0,3);default:return g+g}}r.parseColor=function(o){if(!o)return;let d=o.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);let _=n.exec(d);if(_){let g=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/g*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/g*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/g*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),a.exec(d)&&[3,6,9,12].includes(d.length))){let _=d.length/3,g=[0,0,0];for(let c=0;c<3;++c){let i=parseInt(d.slice(_*c,_*c+_),16);g[c]=_===1?i<<4:_===2?i:_===3?i>>4:i>>8}return g}},r.toRgbString=function(o,d=16){let[_,g,c]=o;return`rgb:${u(_,d)}/${u(g,d)}/${u(c,d)}`}},5770:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let a=n(482),u=n(8742),o=n(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(g,c){this._handlers[g]===void 0&&(this._handlers[g]=[]);let i=this._handlers[g];return i.push(c),{dispose:()=>{let s=i.indexOf(c);s!==-1&&i.splice(s,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}reset(){if(this._active.length)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(g,c){if(this.reset(),this._ident=g,this._active=this._handlers[g]||d,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(c);else this._handlerFb(this._ident,"HOOK",c)}put(g,c,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(g,c,i);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(g,c,i))}unhook(g,c=!0){if(this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=c,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].unhook(g),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",g);this._active=d,this._ident=0}};let _=new u.Params;_.addParam(0),r.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=_,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():_,this._data="",this._hitLimit=!1}put(g,c,i){this._hitLimit||(this._data+=(0,a.utf32ToString)(g,c,i),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let c=!1;if(this._hitLimit)c=!1;else if(g&&(c=this._handler(this._data,this._params),c instanceof Promise))return c.then((i=>(this._params=_,this._data="",this._hitLimit=!1,i)));return this._params=_,this._data="",this._hitLimit=!1,c}}},2015:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let a=n(844),u=n(8742),o=n(6242),d=n(6351);class _{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,t,h){this.table[e<<8|s]=t<<4|h}addMany(s,e,t,h){for(let v=0;v<s.length;v++)this.table[e<<8|s[v]]=t<<4|h}}r.TransitionTable=_;let g=160;r.VT500_TRANSITION_TABLE=(function(){let i=new _(4095),s=Array.apply(null,Array(256)).map(((p,l)=>l)),e=(p,l)=>s.slice(p,l),t=e(32,127),h=e(0,24);h.push(25),h.push.apply(h,e(28,32));let v=e(0,14),f;for(f in i.setDefault(1,0),i.addMany(t,0,2,0),v)i.addMany([24,26,153,154],f,3,0),i.addMany(e(128,144),f,3,0),i.addMany(e(144,152),f,3,0),i.add(156,f,0,0),i.add(27,f,11,1),i.add(157,f,4,8),i.addMany([152,158,159],f,0,7),i.add(155,f,11,3),i.add(144,f,11,9);return i.addMany(h,0,3,0),i.addMany(h,1,3,1),i.add(127,1,0,1),i.addMany(h,8,0,8),i.addMany(h,3,3,3),i.add(127,3,0,3),i.addMany(h,4,3,4),i.add(127,4,0,4),i.addMany(h,6,3,6),i.addMany(h,5,3,5),i.add(127,5,0,5),i.addMany(h,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(t,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(t,7,0,7),i.addMany(h,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(h,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(h,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(h,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(h,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(h,13,13,13),i.addMany(t,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(g,0,2,0),i.add(g,8,5,8),i.add(g,6,0,6),i.add(g,11,0,11),i.add(g,13,13,13),i})();class c extends a.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 u.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,h)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,a.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,e=[64,126]){let t=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=s.prefix.charCodeAt(0),t&&60>t||t>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 v=0;v<s.intermediates.length;++v){let f=s.intermediates.charCodeAt(v);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=f}}if(s.final.length!==1)throw new Error("final must be a single byte");let h=s.final.charCodeAt(0);if(e[0]>h||h>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return t<<=8,t|=h,t}identToString(s){let e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){let t=this._identifier(s,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);let h=this._escHandlers[t];return h.push(e),{dispose:()=>{let v=h.indexOf(e);v!==-1&&h.splice(v,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,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){let t=this._identifier(s);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);let h=this._csiHandlers[t];return h.push(e),{dispose:()=>{let v=h.indexOf(e);v!==-1&&h.splice(v,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}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,e,t,h,v){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=h,this._parseStack.chunkPos=v}parse(s,e,t){let h,v=0,f=0,p=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,p=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&m>-1){for(;m>=0&&(h=l[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 4:if(t===!1&&m>-1){for(;m>=0&&(h=l[m](),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 6:if(v=s[this._parseStack.chunkPos],h=this._dcsParser.unhook(v!==24&&v!==26,t),h)return h;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(v=s[this._parseStack.chunkPos],h=this._oscParser.end(v!==24&&v!==26,t),h)return h;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,p=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let l=p;l<e;++l){switch(v=s[l],f=this._transitions.table[this.currentState<<8|(v<160?v:g)],f>>4){case 2:for(let b=l+1;;++b){if(b>=e||(v=s[b])<32||v>126&&v<g){this._printHandler(s,l,b),l=b-1;break}if(++b>=e||(v=s[b])<32||v>126&&v<g){this._printHandler(s,l,b),l=b-1;break}if(++b>=e||(v=s[b])<32||v>126&&v<g){this._printHandler(s,l,b),l=b-1;break}if(++b>=e||(v=s[b])<32||v>126&&v<g){this._printHandler(s,l,b),l=b-1;break}}break;case 3:this._executeHandlers[v]?this._executeHandlers[v]():this._executeHandlerFb(v),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:v,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|v],E=m?m.length-1:-1;for(;E>=0&&(h=m[E](this._params),h!==!0);E--)if(h instanceof Promise)return this._preserveStack(3,m,E,f,l),h;E<0&&this._csiHandlerFb(this._collect<<8|v,this._params),this.precedingJoinState=0;break;case 8:do switch(v){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(v-48)}while(++l<e&&(v=s[l])>47&&v<60);l--;break;case 9:this._collect<<=8,this._collect|=v;break;case 10:let k=this._escHandlers[this._collect<<8|v],x=k?k.length-1:-1;for(;x>=0&&(h=k[x](),h!==!0);x--)if(h instanceof Promise)return this._preserveStack(4,k,x,f,l),h;x<0&&this._escHandlerFb(this._collect<<8|v),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|v,this._params);break;case 13:for(let b=l+1;;++b)if(b>=e||(v=s[b])===24||v===26||v===27||v>127&&v<g){this._dcsParser.put(s,l,b),l=b-1;break}break;case 14:if(h=this._dcsParser.unhook(v!==24&&v!==26),h)return this._preserveStack(6,[],0,f,l),h;v===27&&(f|=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 b=l+1;;b++)if(b>=e||(v=s[b])<32||v>127&&v<g){this._oscParser.put(s,l,b),l=b-1;break}break;case 6:if(h=this._oscParser.end(v!==24&&v!==26),h)return this._preserveStack(5,[],0,f,l),h;v===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&f}}}r.EscapeSequenceParser=c},6242:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let a=n(5770),u=n(482),o=[];r.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,_){this._handlers[d]===void 0&&(this._handlers[d]=[]);let g=this._handlers[d];return g.push(_),{dispose:()=>{let c=g.indexOf(_);c!==-1&&g.splice(c,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=o}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=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,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,_,g){if(this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].put(d,_,g);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(d,_,g))}start(){this.reset(),this._state=1}put(d,_,g){if(this._state!==3){if(this._state===1)for(;_<g;){let c=d[_++];if(c===59){this._state=2,this._start();break}if(c<48||57<c)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+c-48}this._state===2&&g-_>0&&this._put(d,_,g)}}end(d,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,c=this._active.length-1,i=!1;if(this._stack.paused&&(c=this._stack.loopPosition-1,g=_,i=this._stack.fallThrough,this._stack.paused=!1),!i&&g===!1){for(;c>=0&&(g=this._active[c].end(d),g!==!0);c--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!1,g;c--}for(;c>=0;c--)if(g=this._active[c].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",d);this._active=o,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,_,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(d,_,g),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let _=!1;if(this._hitLimit)_=!1;else if(d&&(_=this._handler(this._data),_ instanceof Promise))return _.then((g=>(this._data="",this._hitLimit=!1,g)));return this._data="",this._hitLimit=!1,_}}},8742:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let n=2147483647;class a{static fromArray(o){let d=new a;if(!o.length)return d;for(let _=Array.isArray(o[0])?1:0;_<o.length;++_){let g=o[_];if(Array.isArray(g))for(let c=0;c<g.length;++c)d.addSubParam(g[c]);else d.addParam(g)}return d}constructor(o=32,d=32){if(this.maxLength=o,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new a(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){let o=[];for(let d=0;d<this.length;++d){o.push(this.params[d]);let _=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-_>0&&o.push(Array.prototype.slice.call(this._subParams,_,g))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>n?n:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>n?n:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let d=this._subParamsIdx[o]>>8,_=255&this._subParamsIdx[o];return _-d>0?this._subParams.subarray(d,_):null}getSubParamsAll(){let o={};for(let d=0;d<this.length;++d){let _=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-_>0&&(o[d]=this._subParams.slice(_,g))}return o}addDigit(o){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let _=this._digitIsSub?this._subParams:this.params,g=_[d-1];_[d-1]=~g?Math.min(10*g+o,n):o}}r.Params=a},5741:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,a){let u={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(u),a.dispose=()=>this._wrappedAddonDispose(u),a.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let a=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===n){a=u;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(a,1)}}},8771:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let a=n(3785),u=n(511);r.BufferApiView=class{constructor(o,d){this._buffer=o,this.type=d}init(o){return this._buffer=o,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(o){let d=this._buffer.lines.get(o);if(d)return new a.BufferLineApiView(d)}getNullCell(){return new u.CellData}}},3785:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let a=n(511);r.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,o){if(!(u<0||u>=this._line.length))return o?(this._line.loadCell(u,o),o):this._line.loadCell(u,new a.CellData)}translateToString(u,o,d){return this._line.translateToString(u,o,d)}}},8285:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let a=n(8771),u=n(8460),o=n(844);class d extends o.Disposable{constructor(g){super(),this._core=g,this._onBufferChange=this.register(new u.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new a.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new a.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:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,a){return this._core.registerCsiHandler(n,(u=>a(u.toArray())))}addCsiHandler(n,a){return this.registerCsiHandler(n,a)}registerDcsHandler(n,a){return this._core.registerDcsHandler(n,((u,o)=>a(u,o.toArray())))}addDcsHandler(n,a){return this.registerDcsHandler(n,a)}registerEscHandler(n,a){return this._core.registerEscHandler(n,a)}addEscHandler(n,a){return this.registerEscHandler(n,a)}registerOscHandler(n,a){return this._core.registerOscHandler(n,a)}addOscHandler(n,a){return this.registerOscHandler(n,a)}}},7090:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(L,r,n){var a=this&&this.__decorate||function(i,s,e,t){var h,v=arguments.length,f=v<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,s,e,t);else for(var p=i.length-1;p>=0;p--)(h=i[p])&&(f=(v<3?h(f):v>3?h(s,e,f):h(s,e))||f);return v>3&&f&&Object.defineProperty(s,e,f),f},u=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=n(8460),d=n(844),_=n(5295),g=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let c=r.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(i,this))}resize(i,s){this.cols=i,this.rows=s,this.buffers.resize(i,s),this._onResize.fire({cols:i,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,s=!1){let e=this.buffer,t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===i.fg&&t.getBg(0)===i.bg||(t=e.getBlankLine(i,s),this._cachedBlankLine=t),t.isWrapped=s;let h=e.ybase+e.scrollTop,v=e.ybase+e.scrollBottom;if(e.scrollTop===0){let f=e.lines.isFull;v===e.lines.length-1?f?e.lines.recycle().copyFrom(t):e.lines.push(t.clone()):e.lines.splice(v+1,0,t.clone()),f?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let f=v-h+1;e.lines.shiftElements(h+1,f-1,-1),e.lines.set(v,t.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,s,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let h=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),h!==t.ydisp&&(s||this._onScroll.fire(t.ydisp))}};r.BufferService=c=a([u(0,g.IOptionsService)],c)},7994:(L,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(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,a){this._charsets[n]=a,this.glevel===n&&(this.charset=a)}}},1753:function(L,r,n){var a=this&&this.__decorate||function(t,h,v,f){var p,l=arguments.length,m=l<3?h:f===null?f=Object.getOwnPropertyDescriptor(h,v):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,h,v,f);else for(var E=t.length-1;E>=0;E--)(p=t[E])&&(m=(l<3?p(m):l>3?p(h,v,m):p(h,v))||m);return l>3&&m&&Object.defineProperty(h,v,m),m},u=this&&this.__param||function(t,h){return function(v,f){h(v,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=n(2585),d=n(8460),_=n(844),g={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function c(t,h){let v=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(v|=64,v|=t.action):(v|=3&t.button,4&t.button&&(v|=64),8&t.button&&(v|=128),t.action===32?v|=32:t.action!==0||h||(v|=3)),v}let i=String.fromCharCode,s={DEFAULT:t=>{let h=[c(t,!1)+32,t.col+32,t.row+32];return h[0]>255||h[1]>255||h[2]>255?"":`\x1B[M${i(h[0])}${i(h[1])}${i(h[2])}`},SGR:t=>{let h=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${c(t,!0)};${t.col};${t.row}${h}`},SGR_PIXELS:t=>{let h=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${c(t,!0)};${t.x};${t.y}${h}`}},e=r.CoreMouseService=class extends _.Disposable{constructor(t,h){super(),this._bufferService=t,this._coreService=h,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let v of Object.keys(g))this.addProtocol(v,g[v]);for(let v of Object.keys(s))this.addEncoding(v,s[v]);this.reset()}addProtocol(t,h){this._protocols[t]=h}addEncoding(t,h){this._encodings[t]=h}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let h=this._encodings[this._activeEncoding](t);return h&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(h):this._coreService.triggerDataEvent(h,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,h,v){if(v){if(t.x!==h.x||t.y!==h.y)return!1}else if(t.col!==h.col||t.row!==h.row)return!1;return t.button===h.button&&t.action===h.action&&t.ctrl===h.ctrl&&t.alt===h.alt&&t.shift===h.shift}};r.CoreMouseService=e=a([u(0,o.IBufferService),u(1,o.ICoreService)],e)},6975:function(L,r,n){var a=this&&this.__decorate||function(e,t,h,v){var f,p=arguments.length,l=p<3?t:v===null?v=Object.getOwnPropertyDescriptor(t,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,h,v);else for(var m=e.length-1;m>=0;m--)(f=e[m])&&(l=(p<3?f(l):p>3?f(t,h,l):f(t,h))||l);return p>3&&l&&Object.defineProperty(t,h,l),l},u=this&&this.__param||function(e,t){return function(h,v){t(h,v,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=n(1439),d=n(8460),_=n(844),g=n(2585),c=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=r.CoreService=class extends _.Disposable{constructor(e,t,h){super(),this._bufferService=e,this._logService=t,this._optionsService=h,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,o.clone)(c),this.decPrivateModes=(0,o.clone)(i)}reset(){this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(i)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let h=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&h.ybase!==h.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((v=>v.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((t=>t.charCodeAt(0))))),this._onBinary.fire(e))}};r.CoreService=s=a([u(0,g.IBufferService),u(1,g.ILogService),u(2,g.IOptionsService)],s)},9074:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let a=n(8055),u=n(8460),o=n(844),d=n(6106),_=0,g=0;class c extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new i(e);if(t){let h=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),h.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,h){let v=0,f=0;for(let p of this._decorations.getKeyIterator(t))v=p.options.x??0,f=v+(p.options.width??1),e>=v&&e<f&&(!h||(p.options.layer??"bottom")===h)&&(yield p)}forEachDecorationAtCell(e,t,h,v){this._decorations.forEachByKey(t,(f=>{_=f.options.x??0,g=_+(f.options.width??1),e>=_&&e<g&&(!h||(f.options.layer??"bottom")===h)&&v(f)}))}}r.DecorationService=c;class i extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=a.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=a.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let a=n(2585),u=n(8343);class o{constructor(..._){this._entries=new Map;for(let[g,c]of _)this.set(g,c)}set(_,g){let c=this._entries.get(_);return this._entries.set(_,g),c}forEach(_){for(let[g,c]of this._entries.entries())_(g,c)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(a.IInstantiationService,this)}setService(d,_){this._services.set(d,_)}getService(d){return this._services.get(d)}createInstance(d,..._){let g=(0,u.getServiceDependencies)(d).sort(((s,e)=>s.index-e.index)),c=[];for(let s of g){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${s.id}.`);c.push(e)}let i=g.length>0?g[0].index:_.length;if(_.length!==i)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${i+1} conflicts with ${_.length} static arguments`);return new d(..._,...c)}}},7866:function(L,r,n){var a=this&&this.__decorate||function(i,s,e,t){var h,v=arguments.length,f=v<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,s,e,t);else for(var p=i.length-1;p>=0;p--)(h=i[p])&&(f=(v<3?h(f):v>3?h(s,e,f):h(s,e))||f);return v>3&&f&&Object.defineProperty(s,e,f),f},u=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=n(844),d=n(2585),_={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF},g,c=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),g=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let s=0;s<i.length;s++)typeof i[s]=="function"&&(i[s]=i[s]())}_log(i,s,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(i,...s){this._logLevel<=d.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,s)}debug(i,...s){this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,s)}info(i,...s){this._logLevel<=d.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,s)}warn(i,...s){this._logLevel<=d.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,s)}error(i,...s){this._logLevel<=d.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,s)}};r.LogService=c=a([u(0,d.IOptionsService)],c),r.setTraceLogger=function(i){g=i},r.traceCall=function(i,s,e){if(typeof e.value!="function")throw new Error("not supported");let t=e.value;e.value=function(...h){if(g.logLevel!==d.LogLevelEnum.TRACE)return t.apply(this,h);g.trace(`GlyphRenderer#${t.name}(${h.map((f=>JSON.stringify(f))).join(", ")})`);let v=t.apply(this,h);return g.trace(`GlyphRenderer#${t.name} return`,v),v}}},7302:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let a=n(8460),u=n(844),o=n(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:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let d=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends u.Disposable{constructor(c){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...r.DEFAULT_OPTIONS};for(let s in c)if(s in i)try{let e=c[s];i[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,u.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(c,i){return this.onOptionChange((s=>{s===c&&i(this.rawOptions[c])}))}onMultipleOptionChange(c,i){return this.onOptionChange((s=>{c.indexOf(s)!==-1&&i()}))}_setupOptions(){let c=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,e)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let e={get:c.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(c,i){switch(c){case"cursorStyle":if(i||(i=r.DEFAULT_OPTIONS[c]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${c}`);break;case"wordSeparator":i||(i=r.DEFAULT_OPTIONS[c]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=d.includes(i)?i:r.DEFAULT_OPTIONS[c];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${c} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${c} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${c} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${c} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}r.OptionsService=_},2660:function(L,r,n){var a=this&&this.__decorate||function(_,g,c,i){var s,e=arguments.length,t=e<3?g:i===null?i=Object.getOwnPropertyDescriptor(g,c):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(_,g,c,i);else for(var h=_.length-1;h>=0;h--)(s=_[h])&&(t=(e<3?s(t):e>3?s(g,c,t):s(g,c))||t);return e>3&&t&&Object.defineProperty(g,c,t),t},u=this&&this.__param||function(_,g){return function(c,i){g(c,i,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=n(2585),d=r.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){let g=this._bufferService.buffer;if(_.id===void 0){let h=g.addMarker(g.ybase+g.y),v={data:_,id:this._nextId++,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(v,h))),this._dataByLinkId.set(v.id,v),v.id}let c=_,i=this._getEntryIdKey(c),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,g.ybase+g.y),s.id;let e=g.addMarker(g.ybase+g.y),t={id:this._nextId++,key:this._getEntryIdKey(c),data:c,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(t,e))),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(_,g){let c=this._dataByLinkId.get(_);if(c&&c.lines.every((i=>i.line!==g))){let i=this._bufferService.buffer.addMarker(g);c.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(c,i)))}}getLinkData(_){return this._dataByLinkId.get(_)?.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,g){let c=_.lines.indexOf(g);c!==-1&&(_.lines.splice(c,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};r.OscLinkService=d=a([u(0,o.IBufferService)],d)},8343:(L,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let n="di$target",a="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(u){return u[a]||[]},r.createDecorator=function(u){if(r.serviceRegistry.has(u))return r.serviceRegistry.get(u);let o=function(d,_,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(c,i,s){i[n]===i?i[a].push({id:c,index:s}):(i[a]=[{id:c,index:s}],i[n]=i)})(o,d,g)};return o.toString=()=>u,r.serviceRegistry.set(u,o),o}},2585:(L,r,n)=>{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;let a=n(8343);var u;r.IBufferService=(0,a.createDecorator)("BufferService"),r.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),r.ICoreService=(0,a.createDecorator)("CoreService"),r.ICharsetService=(0,a.createDecorator)("CharsetService"),r.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(u||(r.LogLevelEnum=u={})),r.ILogService=(0,a.createDecorator)("LogService"),r.IOptionsService=(0,a.createDecorator)("OptionsService"),r.IOscLinkService=(0,a.createDecorator)("OscLinkService"),r.IUnicodeService=(0,a.createDecorator)("UnicodeService"),r.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(L,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let a=n(8460),u=n(225);class o{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,g,c=!1){return(16777215&_)<<3|(3&g)<<1|(c?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let _=new u.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let g=0,c=0,i=_.length;for(let s=0;s<i;++s){let e=_.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=i)return g+this.wcwidth(e);let v=_.charCodeAt(s);56320<=v&&v<=57343?e=1024*(e-55296)+v-56320+65536:g+=this.wcwidth(v)}let t=this.charProperties(e,c),h=o.extractWidth(t);o.extractShouldJoin(t)&&(h-=o.extractWidth(c)),g+=h,c=t}return g}charProperties(_,g){return this._activeProvider.charProperties(_,g)}}r.UnicodeService=o}},B={};function A(L){var r=B[L];if(r!==void 0)return r.exports;var n=B[L]={exports:{}};return D[L].call(n.exports,n,n.exports,A),n.exports}var I={};return(()=>{var L=I;Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;let r=A(9042),n=A(3236),a=A(844),u=A(5741),o=A(8285),d=A(7975),_=A(7090),g=["cols","rows"];class c extends a.Disposable{constructor(s){super(),this._core=this.register(new n.Terminal(s)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};let e=h=>this._core.options[h],t=(h,v)=>{this._checkReadonlyOptions(h),this._core.options[h]=v};for(let h in this._core.options){let v={get:e.bind(this,h),set:t.bind(this,h)};Object.defineProperty(this._publicOptions,h,v)}}_checkReadonlyOptions(s){if(g.includes(s))throw new Error(`Option "${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 _.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 o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let s=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(let e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(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){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,t){this._verifyIntegers(s,e,t),this._core.select(s,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}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,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r
9
- `,e)}paste(s){this._core.paste(s)}refresh(s,e){this._verifyIntegers(s,e),this._core.refresh(s,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return r}_verifyIntegers(...s){for(let e of s)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(let e of s)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}L.Terminal=c})(),I})()))});var st=Et(et(),1);function kt(D){let B=D.match(Ge);if(B&&B.length>0){let A=B[B.length-1].match(/(-?\d+)>$/),I=A?parseInt(A[1],10):NaN;return{text:D.replace(Ge,""),exitCode:isNaN(I)?void 0:I}}return{text:D}}var he=window.__I18N__,De=window.__PTY_COLS__||120,Lt=window.__PTY_ROWS__||40,tt=["#010101","#de382b","#39b54a","#ffc005","#006fb8","#762671","#2cb3e9","#c9d1d9"],it=["#666666","#ff7b72","#3fb950","#d29922","#58a6ff","#bc8cff","#39c5cf","#f0f6fc"],Se=class{constructor(B){ne(this,"cols");ne(this,"grid",[]);ne(this,"r",0);ne(this,"c",0);ne(this,"fg",null);ne(this,"bg",null);ne(this,"bold",!1);ne(this,"sr",0);ne(this,"sc",0);ne(this,"altGrid",null);this.cols=B}_row(B){for(;this.grid.length<=B;){let A=[];for(let I=0;I<this.cols;I++)A.push({ch:" ",fg:null,bg:null,bold:!1});this.grid.push(A)}return this.grid[B]}_put(B){let A=this._row(this.r);A[this.c]={ch:B,fg:this.fg,bg:this.bg,bold:this.bold},this.c++,this.c>=this.cols&&(this.c=0,this.r++)}write(B){let A=0,I=B.length;for(;A<I;){let L=B[A];if(L==="\x1B"){if(A+1<I&&B[A+1]==="]"){let r=A+2;for(;r<I&&B[r]!=="\x07"&&!(B[r]==="\x1B"&&B[r+1]==="\\");)r++;if(r>=I)break;A=B[r]==="\x07"?r+1:r+2;continue}if(A+1<I&&B[A+1]==="["){let r=A+2,n=r;for(;r<I&&!/[A-Za-z@]/.test(B[r]);)r++;if(r>=I)break;this._csi(B.slice(n,r),B[r]),A=r+1;continue}if(B[A+1]==="7"){this.sr=this.r,this.sc=this.c,A+=2;continue}if(B[A+1]==="8"){this.r=Math.min(this.sr,this.grid.length-1),this.c=this.sc,A+=2;continue}A+=2;continue}if(L==="\r"){this.c=0,A++;continue}if(L===`
10
- `){this.r++,this.c=0,A++;continue}if(L==="\b"){this.c>0&&this.c--,A++;continue}if(L===" "){this.c=(Math.floor(this.c/8)+1)*8,this.c>=this.cols&&(this.c=0,this.r++),A++;continue}if(L.charCodeAt(0)<32){A++;continue}this._put(L),A++}}_csi(B,A){let I=B.replace(/^[?]/,"");if(A==="m"){let n=I?I.split(";").map(a=>parseInt(a,10)):[0];(!I||n.indexOf(0)>=0)&&(this.fg=null,this.bg=null,this.bold=!1);for(let a of n)a===1?this.bold=!0:a===22?this.bold=!1:a>=30&&a<=37?this.fg=tt[a-30]:a===39?this.fg=null:a>=90&&a<=97?this.fg=it[a-90]:a>=40&&a<=47?this.bg=tt[a-40]:a===49?this.bg=null:a>=100&&a<=107&&(this.bg=it[a-100]);return}let L=n=>{let a=parseInt(n,10);return Number.isFinite(a)&&a>0?a:1},r=n=>{let a=parseInt(n,10);return Number.isFinite(a)&&a>=0?a:0};if(A==="A")this.r=Math.max(0,this.r-L(I));else if(A==="B")this.r+=L(I);else if(A==="C")this.c=Math.min(this.cols-1,this.c+L(I));else if(A==="D")this.c=Math.max(0,this.c-L(I));else if(A==="H"||A==="f"){let n=I.split(";");this.r=L(n[0])-1,this.c=L(n[1])-1}else if(A==="G"||A.charCodeAt(0)===96)this.c=Math.max(0,L(I)-1);else if(A==="d")this.r=Math.max(0,L(I)-1);else if(A==="J"){let n=r(I);if(n===2||n===3){for(let a=0;a<this.grid.length;a++){let u=this._row(a);for(let o=0;o<this.cols;o++)u[o]={ch:" ",fg:null,bg:null,bold:!1}}this.r=0,this.c=0}else if(n===1)for(let a=0;a<=this.r;a++){let u=this._row(a),o=a===this.r?this.c:this.cols;for(let d=0;d<o;d++)u[d]={ch:" ",fg:null,bg:null,bold:!1}}else for(let a=this.r;a<this.grid.length;a++){let u=this._row(a),o=a===this.r?this.c:0;for(let d=o;d<this.cols;d++)u[d]={ch:" ",fg:null,bg:null,bold:!1}}}else if(A==="K"){let n=r(I),a=this._row(this.r);if(n===2)for(let u=0;u<this.cols;u++)a[u]={ch:" ",fg:null,bg:null,bold:!1};else if(n===1)for(let u=0;u<=this.c;u++)a[u]={ch:" ",fg:null,bg:null,bold:!1};else for(let u=this.c;u<this.cols;u++)a[u]={ch:" ",fg:null,bg:null,bold:!1}}else A==="s"?(this.sr=this.r,this.sc=this.c):A==="u"?(this.r=Math.min(this.sr,this.grid.length-1),this.c=this.sc):(A==="h"||A==="l")&&B.startsWith("?")&&r(B.slice(1).split(";")[0])===1049&&(A==="h"?(this.altGrid=this.grid.map(a=>a.slice()),this.sr=this.r,this.sc=this.c,this.grid=[],this.r=0,this.c=0):this.altGrid&&(this.grid=this.altGrid,this.altGrid=null,this.r=Math.min(this.sr,this.grid.length-1),this.c=this.sc))}render(){let B=I=>I.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),A=[];for(let I=0;I<this.grid.length;I++){let L=this.grid[I],r=this.cols;for(;r>0&&L[r-1].ch===" ";)r--;if(r===0)continue;let n="",a=null;for(let u=0;u<r;u++){let o=L[u],d=[];o.bold&&d.push("font-weight:bold"),o.fg&&d.push("color:"+o.fg),o.bg&&d.push("background-color:"+o.bg);let _=d.join(";");_!==a&&(a&&(n+="</span>"),a=_,_&&(n+='<span style="'+_+'">')),n+=B(o.ch)}a&&(n+="</span>"),A.push(n)}return A}},Q=null,ee=[],Ce=!0,ue=null,fe=null,re=!1,He=localStorage.getItem("debugMode")==="1";function rt(){return He}function Dt(){Q=new WebSocket("ws://"+window.location.host+"/ws"),Q.onopen=()=>{Q.send(JSON.stringify({type:"list"})),at()},Q.onmessage=D=>{let B;try{B=JSON.parse(D.data)}catch{return}switch(B.type){case"sessions":Rt(B);break;case"snapshot":Bt(B);break;case"meta":Tt(B);break;case"diff":xt(B);break;case"raw":At(B);break}},Q.onclose=()=>{let D=document.getElementById("term");D.textContent="WebSocket disconnected"}}function nt(){let D=document.getElementById("session"),B=document.getElementById("terminal"),A=document.getElementById("term");D.innerHTML="",B.innerHTML="",A.innerHTML='<div class="row"><span class="c">'+(he.noSession||"")+"</span></div>",document.getElementById("meta").textContent="",ie=[],pe="",ge="",He=!1,re=!1,localStorage.removeItem("debugMode");let I=document.getElementById("debugMode");I.checked=!1,We(),ot()}function Rt(D){let B=D.sessions||[],A=document.getElementById("session");if(ee=B,B.length===0){nt();return}let I=B.map(n=>n.sessionID+"|"+n.terminals.length).join(","),L=A.value,r=document.getElementById("terminal").value;A.innerHTML="";for(let n of ee){let a=document.createElement("option");a.value=n.sessionID,a.textContent=ut(n)+" ("+n.terminals.length+" "+he.terminals+")",A.appendChild(a)}L&&[...A.options].some(n=>n.value===L)?A.value=L:A.selectedIndex=ee.length?0:-1,Fe(r)}function ot(){let D=!ee.find(L=>L.sessionID===document.getElementById("session").value)?.terminals.find(L=>(L.name||"default")===document.getElementById("terminal").value)?.connected,B=document.getElementById("cmdKey");B.classList.toggle("disabled",D),B.title=D?"":he.sendCtrlC||"";let A=document.getElementById("debugMode"),I=document.getElementById("rawToggle");A.disabled=!1,I&&I.classList.remove("disabled"),A.checked=He,re=rt(),re?Ze():We()}function Fe(D,B=!1){let A=document.getElementById("session"),I=document.getElementById("terminal"),L=document.getElementById("delTerm"),r=A.value,n=ee.find(d=>d.sessionID===r),a=I.value;I.innerHTML="";for(let d of n?n.terminals:[]){let _=document.createElement("option");_.value=d.name||"default",_.textContent=(d.name||"default")+(d.kind==="local"?" ["+he.local+"]":"")+" "+(d.connected?"\u25CF":"\u25CB")+(d.busy?" \u23F3":""),I.appendChild(_)}D&&[...I.options].some(d=>d.value===D)?I.value=D:I.selectedIndex=I.options.length?0:-1;let u=n?.terminals.find(d=>(d.name||"default")===I.value);L.classList.toggle("show",!!(u&&!u.connected)),ot(),Je();let o=I.value;(B||o!==a)&&(pe="",ge="",at())}var pe="",ge="",ie=[];function at(){let D=document.getElementById("session").value,B=document.getElementById("terminal").value;!D||!B||!Q||Q.readyState!==WebSocket.OPEN||D===pe&&B===ge||(pe=D,ge=B,ue=null,Q.send(JSON.stringify({type:"subscribe",sessionID:D,name:B,mode:re?"raw":"transcript"})))}function Bt(D){let B=document.getElementById("term"),A=document.getElementById("toBottom");if(D.notFound){B.innerHTML='<div class="row"><span class="t"></span><span class="c">'+he.sessionGone+"</span></div>",document.getElementById("meta").textContent="",It(D.sessionID,D.name);return}let I=D.pairs||[],L=!re&&document.getElementById("showTime").checked;document.body.classList.toggle("show-time",L);let r=I.filter(n=>n.type==="cmd").length;Je(r),ie=I,!re&&(ue=null,fe=null,B.innerHTML=Mt(I,L),qe(B,A))}function Je(D){let B=document.getElementById("session").value,A=document.getElementById("terminal").value;if(!B){document.getElementById("meta").textContent="";return}let L=ee.find(o=>o.sessionID===B)?.terminals.find(o=>(o.name||"default")===A),r=L?L.host?L.host+(L.port?":"+L.port:""):L.program||"":"",n=r?" ["+r+"]":"",u=" \xB7 "+(D??ie.filter(o=>o.type==="cmd").length)+" "+he.commands;document.getElementById("meta").textContent=B+"/"+A+n+u}function qe(D,B){Ce?(D.scrollTop=D.scrollHeight,B.style.display="none"):B.style.display=D.scrollHeight>D.clientHeight?"inline-block":"none"}function xt(D){if(re)return;let B=document.getElementById("term"),A=document.getElementById("toBottom"),I=document.getElementById("showTime").checked;if(D.event==="cmd"){if(!D.command)return;let L=fe;L&&L.dataset.finalized!=="1"&&L.remove(),fe=null,ue=null;let r=I?_t(Date.now()):"",n=document.createElement("div");n.className="row cmdline",n.innerHTML='<span class="t">'+r+'</span><span class="c">'+ct(D.command)+"</span>",B.appendChild(n),ie.push({type:"cmd",ts:typeof D.ts=="number"?D.ts:Date.now(),text:D.command})}else if(D.event==="out"){if(!D.data)return;let L=fe;if((!L||L.parentNode!==B)&&(L=document.createElement("div"),L.className="runBlock",B.appendChild(L),fe=L),D.final){ue=new Se(De);let n=ie[ie.length-1];n&&n.type==="out"?n.text=D.data:ie.push({type:"out",text:D.data})}else{ue||(ue=new Se(De));let n=ie[ie.length-1];n&&n.type==="out"?n.text+=D.data:ie.push({type:"out",text:D.data})}ue.write(lt(D.data));let r=ue.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");L.innerHTML=r,qe(B,A)}else if(D.event==="done"){let L=[...ie].reverse().find(a=>a.type==="cmd"),r=fe;if((!r||r.parentNode!==B)&&L&&(r=document.createElement("div"),r.className="runBlock",B.appendChild(r),fe=r),r&&r.parentNode===B){let a=I?dt({ts:L?.ts,endTs:D.endTs},D.exitCode):"";if(r.childElementCount===0&&L){let u=document.createElement("div");u.className="row",u.innerHTML='<span class="t">'+a+'</span><span class="c">&nbsp;</span>',r.appendChild(u)}else{let u=r.lastElementChild;if(u){let o=u.querySelector(".t");o&&(o.innerHTML=a)}}}let n=ie[ie.length-1];n&&n.type==="out"&&(n.endTs=D.endTs,n.exitCode=D.exitCode),r&&r.parentNode===B&&(r.dataset.finalized="1"),qe(B,A)}}function Tt(D){typeof D.commands=="number"&&Je(D.commands)}var me=null,Pe=!0,Ve=!0,Le=null;function Ye(){let D=document.getElementById("xt");!D||!Ve||D.scrollHeight>D.clientHeight&&(D.scrollTop=D.scrollHeight)}function ht(){if(me)return me;let D=document.getElementById("xt");if(!D){D=document.createElement("div"),D.id="xt";let A=document.getElementById("term");(A?.parentNode??document.body).insertBefore(D,A?.nextSibling??null)}let B=new st.Terminal({cols:De,rows:Lt,scrollback:2e3,fontFamily:'"CaskaydiaCove Nerd Font Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "Noto Sans Mono", "Hack", Consolas, "Courier New", monospace',fontSize:13,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",selectionBackground:"#30363d",black:"#010409",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#c9d1d9",brightBlack:"#666666",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});return B.open(D),D.addEventListener("scroll",()=>{Ve=D.scrollTop+D.clientHeight>=D.scrollHeight-2}),Le=()=>{Ve=!0,Ye(),Pe&&B.scrollToBottom()},window.addEventListener("resize",Le),B.onScroll(()=>{Pe=B.buffer.active.viewportY>=B.buffer.active.baseY}),me=B,B}function Ze(){document.body.classList.add("debug");let D=ht(),B=document.getElementById("toBottom");B.style.display="none",Pe&&D.scrollToBottom(),Ye()}function We(){document.body.classList.remove("debug"),Le&&(window.removeEventListener("resize",Le),Le=null),me&&(me.dispose(),me=null)}function At(D){if(!re)return;let B=ht();D.reset?(B.reset(),B.write(D.data||"")):D.data&&B.write(D.data),Pe&&B.scrollToBottom(),Ye()}function ct(D){return D.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var Ge=/<SSH_DONE:(?:\d+:)?(-?\d+)>/g;function lt(D){return D.replace(Ge,"")}function Mt(D,B){let A=[],I=null;for(let L of D){if(L.type==="sep"){A.push('<div class="sep"><hr></div>');continue}if(L.type==="cmd"){I={ts:L.ts,endTs:L.endTs};let r=L.ts?_t(L.ts):"";A.push('<div class="row cmdline"><span class="t">'+r+'</span><span class="c">'+ct(L.text)+"</span></div>")}else if(L.type==="run"){let r=new Se(De);r.write(lt(L.text));let n=r.render().map(a=>'<div class="row"><span class="t"></span><span class="c">'+a+"</span></div>").join("");A.push('<div class="runBlock">'+n+"</div>")}else{let r=kt(L.text),n=new Se(De);n.write(r.text);let a=n.render(),u=B?dt(I,r.exitCode??L.exitCode):"",o=(d,_)=>'<div class="row"><span class="t">'+d+'</span><span class="c">'+_+"</span></div>";a.length===0?A.push(o(u,"&nbsp;")):a.forEach((d,_)=>A.push(o(_===a.length-1?u:"",d))),I=null}}return A.join("")}function dt(D,B){let A=[];if(D&&D.ts&&D.endTs&&A.push("+"+((D.endTs-D.ts)/1e3).toFixed(3)+"s"),B!==void 0){let I=B===0?"#3fb950":"#ff7b72";A.push('<span style="color:'+I+'">'+(B===0?"\u2713":"\u2717 "+B)+"</span>")}return A.join(" ")}function ut(D){if(D.title&&D.title.trim())return D.title;let B=D.terminals&&D.terminals[0];return B&&B.host?(B.user?B.user+"@":"")+B.host:D.sessionID.slice(0,8)+"\u2026"}function _t(D){let B=new Date(D),A=I=>String(I).padStart(2,"0");return B.getFullYear()+"-"+A(B.getMonth()+1)+"-"+A(B.getDate())+" "+A(B.getHours())+":"+A(B.getMinutes())+":"+A(B.getSeconds())}function It(D,B){let A=ee.find(n=>n.sessionID===D);A&&(A.terminals=A.terminals.filter(n=>(n.name||"default")!==B),A.terminals.length===0&&(ee=ee.filter(n=>n.sessionID!==D)));let I=document.getElementById("session"),L=I.value;I.innerHTML="";for(let n of ee){let a=document.createElement("option");a.value=n.sessionID,a.textContent=ut(n)+" ("+n.terminals.length+" "+he.terminals+")",I.appendChild(a)}L&&[...I.options].some(n=>n.value===L)?I.value=L:I.selectedIndex=ee.length?0:-1;let r=document.getElementById("terminal").value;Fe(r)}function Ot(D){D&&(Ce=!0);let B=document.getElementById("terminal").value;Fe(B,!0)}function Pt(){let D=document.getElementById("showTime");localStorage.setItem("showTime",D.checked?"1":"0"),document.body.classList.toggle("show-time",D.checked)}function Ht(){let D=document.getElementById("debugMode");He=D.checked,localStorage.setItem("debugMode",D.checked?"1":"0");let B=rt();re=B,B?Ze():We(),Q&&Q.readyState===WebSocket.OPEN&&pe&&ge&&Q.send(JSON.stringify({type:"setMode",mode:B?"raw":"transcript"}))}function Ft(){let D=document.getElementById("session").value,B=document.getElementById("terminal").value;if(!B||!Q||Q.readyState!==WebSocket.OPEN)return;let A=ee.find(r=>r.sessionID===D),I=A?.terminals.find(r=>(r.name||"default")===B);if(!I||I.connected)return;if(Q.send(JSON.stringify({type:"deleteTerminal",sessionID:D,name:B})),A&&(A.terminals=A.terminals.filter(r=>(r.name||"default")!==B),A.terminals.length===0&&(ee=ee.filter(r=>r.sessionID!==D))),ee.length===0){nt();return}let L=document.getElementById("terminal").value;Fe(L!==B?L:void 0)}function Wt(){let D=document.getElementById("term"),B=document.getElementById("toBottom");D.scrollTop=D.scrollHeight,Ce=!0,B.style.display="none"}var ft=document.getElementById("showTime");ft.checked=localStorage.getItem("showTime")==="1";document.body.classList.toggle("show-time",ft.checked);var Nt=document.getElementById("debugMode");re=localStorage.getItem("debugMode")==="1";Nt.checked=re;re?Ze():We();var Ae=document.getElementById("term"),Ut=document.getElementById("toBottom");Ae.addEventListener("scroll",()=>{Ae.scrollTop+Ae.clientHeight>=Ae.scrollHeight-30?(Ce=!0,Ut.style.display="none"):Ce=!1});var _e=[],de=-1,Me=-1,Ie="",X=document.getElementById("cmdInput");X.placeholder=he.cmdPlaceholder||"";X.addEventListener("keydown",D=>{if(D.key==="Tab"){D.preventDefault();let r=X.value.trim();if(!r)return;Ie!==r&&(Me=-1,Ie=r);let n=_e.filter(a=>a.startsWith(Ie));if(n.length===0)return;Me=(Me+1)%n.length,X.value=n[Me],ve();return}if(Ie="",D.key==="ArrowUp"){D.preventDefault(),de>0&&(de--,X.value=_e[de],ve());return}if(D.key==="ArrowDown"){D.preventDefault(),de<_e.length-1?(de++,X.value=_e[de],ve()):(de=_e.length,X.value="",ve());return}if(D.key!=="Enter")return;if(D.preventDefault(),D.shiftKey){let r=X.selectionStart??X.value.length,n=X.selectionEnd??X.value.length;X.value=X.value.slice(0,r)+`
11
- `+X.value.slice(n),X.selectionStart=X.selectionEnd=r+1,ve();return}let B=document.getElementById("session").value,A=document.getElementById("terminal").value;if(!B||!Q||Q.readyState!==WebSocket.OPEN)return;let I=X.value;if(X.value="",ve(),!I.trim())return;(pe!==B||ge!==A)&&(pe=B,ge=A,Q.send(JSON.stringify({type:"subscribe",sessionID:B,name:A})));let L=I.trim();_e.push(L),de=_e.length,Q.send(JSON.stringify({type:"exec",sessionID:B,name:A,command:L})),Ce=!0});function ve(){X.style.height="auto",X.style.height=Math.min(X.scrollHeight,120)+"px"}X.addEventListener("input",ve);var ae=document.getElementById("cmdKey"),Re=he.sendCtrlC||"Ctrl-C",be=!1,Oe=!1;ae.textContent=Re;function Xe(D){if(!be)return;let B=document.getElementById("session").value,A=document.getElementById("terminal").value;if(!B||!Q||Q.readyState!==WebSocket.OPEN)return;let I,L;if(D.ctrlKey&&D.key!=="Control"){let r=D.key.toLowerCase().charCodeAt(0)-96;r>=1&&r<=26?(I="\\x"+r.toString(16).padStart(2,"0"),L="Ctrl-"+D.key.toUpperCase()):(I="",L="")}else if(D.key==="Enter")I="\\r",L="\u21B5";else if(D.key==="Escape")I="\\x1b",L="Esc";else if(D.key==="Tab")I="\\t",L="Tab";else if(D.key==="Backspace")I="\\x7f",L="\u232B";else if(D.key===" "||D.key==="Space")I=" ",L="Space";else if(D.key==="ArrowUp")I="\\x1b[A",L="\u2191";else if(D.key==="ArrowDown")I="\\x1b[B",L="\u2193";else if(D.key==="ArrowRight")I="\\x1b[C",L="\u2192";else if(D.key==="ArrowLeft")I="\\x1b[D",L="\u2190";else if(D.key==="Home")I="\\x1b[H",L="Home";else if(D.key==="End")I="\\x1b[F",L="End";else if(D.key==="PageUp")I="\\x1b[5~",L="PgUp";else if(D.key==="PageDown")I="\\x1b[6~",L="PgDn";else if(/^F[1-4]$/.test(D.key))I="\\x1bO"+"PQRS"[Number(D.key.slice(1))-1],L=D.key;else if(/^F([5-9]|1[0-2])$/.test(D.key)){let r=Number(D.key.slice(1));I="\\x1b["+{5:15,6:17,7:18,8:19,9:20,10:21,11:23,12:24}[r]+"~",L=D.key}else if(D.key.length===1)I=D.key,L=D.key;else return;I&&Q.send(JSON.stringify({type:"send",sessionID:B,name:A,text:I})),ae.textContent=L||Re,setTimeout(()=>{be||(ae.textContent=Re)},1500)}ae.addEventListener("click",()=>{document.getElementById("session").value&&(Oe=!Oe,Oe?(be=!0,ae.classList.add("capture"),ae.textContent="...",document.addEventListener("keyup",Xe),X.blur()):(be=!1,ae.classList.remove("capture"),document.removeEventListener("keyup",Xe),ae.textContent=Re))});X.addEventListener("focus",()=>{be&&(Oe=!1,be=!1,ae.classList.remove("capture"),document.removeEventListener("keyup",Xe),ae.textContent=Re)});Object.assign(window,{onSessionChange:Ot,onShowTimeChange:Pt,onDebugModeChange:Ht,deleteTerminal:Ft,scrollToNewest:Wt});Dt();})();
7
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(v){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.isLinux&&v&&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(v){let S=this._getMouseBufferCoords(v),y=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!!(y&&D&&S)&&this._areCoordsInSelection(S,y,D)}isCellInSelection(v,S){let y=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!y||!D)&&this._areCoordsInSelection([v,S],y,D)}_areCoordsInSelection(v,S,y){return v[1]>S[1]&&v[1]<y[1]||S[1]===y[1]&&v[1]===S[1]&&v[0]>=S[0]&&v[0]<y[0]||S[1]<y[1]&&v[1]===y[1]&&v[0]<y[0]||S[1]<y[1]&&v[1]===S[1]&&v[0]>=S[0]}_selectWordAtCursor(v,S){let y=this._linkifier.currentLink?.link?.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let D=this._getMouseBufferCoords(v);return!!D&&(this._selectWordAt(D,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(v,S){this._model.clearSelection(),v=Math.max(v,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,v],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_handleTrim(v){this._model.handleTrim(v)&&this.refresh()}_getMouseBufferCoords(v){let S=this._mouseService.getCoords(v,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(v){let S=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,v,this._screenElement)[1],y=this._renderService.dimensions.css.canvas.height;return S>=0&&S<=y?0:(S>y&&(S-=y),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(v){return s.isMac?v.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:v.shiftKey}handleMouseDown(v){if(this._mouseDownTimeStamp=v.timeStamp,(v.button!==2||!this.hasSelection)&&v.button===0){if(!this._enabled){if(!this.shouldForceSelection(v))return;v.stopPropagation()}v.preventDefault(),this._dragScrollAmount=0,this._enabled&&v.shiftKey?this._handleIncrementalClick(v):v.detail===1?this._handleSingleClick(v):v.detail===2?this._handleDoubleClick(v):v.detail===3&&this._handleTripleClick(v),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(v){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(v))}_handleSingleClick(v){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(v)?3:0,this._model.selectionStart=this._getMouseBufferCoords(v),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(v){this._selectWordAtCursor(v,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(v){let S=this._getMouseBufferCoords(v);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(v){return v.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(v){if(v.stopImmediatePropagation(),!this._model.selectionStart)return;let S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(v),!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(v),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let y=this._bufferService.buffer;if(this._model.selectionEnd[1]<y.lines.length){let D=y.lines.get(this._model.selectionEnd[1]);D&&D.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}S&&S[0]===this._model.selectionEnd[0]&&S[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});let v=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(v.ydisp+this._bufferService.rows,v.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=v.ydisp),this.refresh()}}_handleMouseUp(v){let S=v.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&v.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let y=this._mouseService.getCoords(v,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){let D=(0,_.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(D,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let v=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,y=!(!v||!S||v[0]===S[0]&&v[1]===S[1]);y?v&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&v[0]===this._oldSelectionStart[0]&&v[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(v,S,y)):this._oldHasSelection&&this._fireOnSelectionChange(v,S,y)}_fireOnSelectionChange(v,S,y){this._oldSelectionStart=v,this._oldSelectionEnd=S,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(v){this.clearSelection(),this._trimListener.dispose(),this._trimListener=v.activeBuffer.lines.onTrim((S=>this._handleTrim(S)))}_convertViewportColToCharacterIndex(v,S){let y=S;for(let D=0;S>=D;D++){let M=v.loadCell(D,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:M>1&&S!==D&&(y+=M-1)}return y}setSelection(v,S,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[v,S],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(v){this._isClickInSelection(v)||(this._selectWordAtCursor(v,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(v,S,y=!0,D=!0){if(v[0]>=this._bufferService.cols)return;let M=this._bufferService.buffer,E=M.lines.get(v[1]);if(!E)return;let x=M.translateBufferLineToString(v[1],!1),O=this._convertViewportColToCharacterIndex(E,v[0]),q=O,K=v[0]-O,N=0,C=0,B=0,m=0;if(x.charAt(O)===" "){for(;O>0&&x.charAt(O-1)===" ";)O--;for(;q<x.length&&x.charAt(q+1)===" ";)q++}else{let A=v[0],W=v[0];E.getWidth(A)===0&&(N++,A--),E.getWidth(W)===2&&(C++,W++);let j=E.getString(W).length;for(j>1&&(m+=j-1,q+=j-1);A>0&&O>0&&!this._isCharWordSeparator(E.loadCell(A-1,this._workCell));){E.loadCell(A-1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===0?(N++,A--):P>1&&(B+=P-1,O-=P-1),O--,A--}for(;W<E.length&&q+1<x.length&&!this._isCharWordSeparator(E.loadCell(W+1,this._workCell));){E.loadCell(W+1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,W++):P>1&&(m+=P-1,q+=P-1),q++,W++}}q++;let b=O+K-N+B,k=Math.min(this._bufferService.cols,q-O+N+C-B-m);if(S||x.slice(O,q).trim()!==""){if(y&&b===0&&E.getCodePoint(0)!==32){let A=M.lines.get(v[1]-1);if(A&&E.isWrapped&&A.getCodePoint(this._bufferService.cols-1)!==32){let W=this._getWordAt([this._bufferService.cols-1,v[1]-1],!1,!0,!1);if(W){let j=this._bufferService.cols-W.start;b-=j,k+=j}}}if(D&&b+k===this._bufferService.cols&&E.getCodePoint(this._bufferService.cols-1)!==32){let A=M.lines.get(v[1]+1);if(A?.isWrapped&&A.getCodePoint(0)!==32){let W=this._getWordAt([0,v[1]+1],!1,!1,!0);W&&(k+=W.length)}}return{start:b,length:k}}}_selectWordAt(v,S){let y=this._getWordAt(v,S);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,v[1]--;this._model.selectionStart=[y.start,v[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(v){let S=this._getWordAt(v,!0);if(S){let y=v[1];for(;S.start<0;)S.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,y]}}_isCharWordSeparator(v){return v.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(v.getChars())>=0}_selectLineAt(v){let S=this._bufferService.buffer.getWrappedRangeForLine(v),y={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols)}};d.SelectionService=g=n([l(3,r.IBufferService),l(4,r.ICoreService),l(5,p.IMouseService),l(6,r.IOptionsService),l(7,p.IRenderService),l(8,p.ICoreBrowserService)],g)},4725:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ILinkProviderService=d.IThemeService=d.ICharacterJoinerService=d.ISelectionService=d.IRenderService=d.IMouseService=d.ICoreBrowserService=d.ICharSizeService=void 0;let n=f(8343);d.ICharSizeService=(0,n.createDecorator)("CharSizeService"),d.ICoreBrowserService=(0,n.createDecorator)("CoreBrowserService"),d.IMouseService=(0,n.createDecorator)("MouseService"),d.IRenderService=(0,n.createDecorator)("RenderService"),d.ISelectionService=(0,n.createDecorator)("SelectionService"),d.ICharacterJoinerService=(0,n.createDecorator)("CharacterJoinerService"),d.IThemeService=(0,n.createDecorator)("ThemeService"),d.ILinkProviderService=(0,n.createDecorator)("LinkProviderService")},6731:function(R,d,f){var n=this&&this.__decorate||function(g,v,S,y){var D,M=arguments.length,E=M<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(g,v,S,y);else for(var x=g.length-1;x>=0;x--)(D=g[x])&&(E=(M<3?D(E):M>3?D(v,S,E):D(v,S))||E);return M>3&&E&&Object.defineProperty(v,S,E),E},l=this&&this.__param||function(g,v){return function(S,y){v(S,y,g)}};Object.defineProperty(d,"__esModule",{value:!0}),d.ThemeService=d.DEFAULT_ANSI_COLORS=void 0;let h=f(7239),_=f(8055),c=f(8460),p=f(844),o=f(2585),i=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),e=_.css.toColor("#ffffff"),t=_.css.toColor("#000000"),r={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};d.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let g=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],v=[0,95,135,175,215,255];for(let S=0;S<216;S++){let y=v[S/36%6|0],D=v[S/6%6|0],M=v[S%6];g.push({css:_.channels.toCss(y,D,M),rgba:_.channels.toRgba(y,D,M)})}for(let S=0;S<24;S++){let y=8+10*S;g.push({css:_.channels.toCss(y,y,y),rgba:_.channels.toRgba(y,y,y)})}return g})());let a=d.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new c.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:s,cursor:e,cursorAccent:t,selectionForeground:void 0,selectionBackgroundTransparent:r,selectionBackgroundOpaque:_.color.blend(s,r),selectionInactiveBackgroundTransparent:r,selectionInactiveBackgroundOpaque:_.color.blend(s,r),ansi:d.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(g={}){let v=this._colors;if(v.foreground=u(g.foreground,i),v.background=u(g.background,s),v.cursor=u(g.cursor,e),v.cursorAccent=u(g.cursorAccent,t),v.selectionBackgroundTransparent=u(g.selectionBackground,r),v.selectionBackgroundOpaque=_.color.blend(v.background,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundTransparent=u(g.selectionInactiveBackground,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundOpaque=_.color.blend(v.background,v.selectionInactiveBackgroundTransparent),v.selectionForeground=g.selectionForeground?u(g.selectionForeground,_.NULL_COLOR):void 0,v.selectionForeground===_.NULL_COLOR&&(v.selectionForeground=void 0),_.color.isOpaque(v.selectionBackgroundTransparent)&&(v.selectionBackgroundTransparent=_.color.opacity(v.selectionBackgroundTransparent,.3)),_.color.isOpaque(v.selectionInactiveBackgroundTransparent)&&(v.selectionInactiveBackgroundTransparent=_.color.opacity(v.selectionInactiveBackgroundTransparent,.3)),v.ansi=d.DEFAULT_ANSI_COLORS.slice(),v.ansi[0]=u(g.black,d.DEFAULT_ANSI_COLORS[0]),v.ansi[1]=u(g.red,d.DEFAULT_ANSI_COLORS[1]),v.ansi[2]=u(g.green,d.DEFAULT_ANSI_COLORS[2]),v.ansi[3]=u(g.yellow,d.DEFAULT_ANSI_COLORS[3]),v.ansi[4]=u(g.blue,d.DEFAULT_ANSI_COLORS[4]),v.ansi[5]=u(g.magenta,d.DEFAULT_ANSI_COLORS[5]),v.ansi[6]=u(g.cyan,d.DEFAULT_ANSI_COLORS[6]),v.ansi[7]=u(g.white,d.DEFAULT_ANSI_COLORS[7]),v.ansi[8]=u(g.brightBlack,d.DEFAULT_ANSI_COLORS[8]),v.ansi[9]=u(g.brightRed,d.DEFAULT_ANSI_COLORS[9]),v.ansi[10]=u(g.brightGreen,d.DEFAULT_ANSI_COLORS[10]),v.ansi[11]=u(g.brightYellow,d.DEFAULT_ANSI_COLORS[11]),v.ansi[12]=u(g.brightBlue,d.DEFAULT_ANSI_COLORS[12]),v.ansi[13]=u(g.brightMagenta,d.DEFAULT_ANSI_COLORS[13]),v.ansi[14]=u(g.brightCyan,d.DEFAULT_ANSI_COLORS[14]),v.ansi[15]=u(g.brightWhite,d.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){let S=Math.min(v.ansi.length-16,g.extendedAnsi.length);for(let y=0;y<S;y++)v.ansi[y+16]=u(g.extendedAnsi[y],d.DEFAULT_ANSI_COLORS[y+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){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[g]=this._restoreColors.ansi[g]}else for(let v=0;v<this._restoreColors.ansi.length;++v)this._colors.ansi[v]=this._restoreColors.ansi[v]}modifyColors(g){g(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 u(g,v){if(g!==void 0)try{return _.css.toColor(g)}catch{}return v}d.ThemeService=a=n([l(0,o.IOptionsService)],a)},6349:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CircularList=void 0;let n=f(8460),l=f(844);class h extends l.Disposable{constructor(c){super(),this._maxLength=c,this.onDeleteEmitter=this.register(new n.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new n.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new n.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(c){if(this._maxLength===c)return;let p=new Array(c);for(let o=0;o<Math.min(c,this.length);o++)p[o]=this._array[this._getCyclicIndex(o)];this._array=p,this._maxLength=c,this._startIndex=0}get length(){return this._length}set length(c){if(c>this._length)for(let p=this._length;p<c;p++)this._array[p]=void 0;this._length=c}get(c){return this._array[this._getCyclicIndex(c)]}set(c,p){this._array[this._getCyclicIndex(c)]=p}push(c){this._array[this._getCyclicIndex(this._length)]=c,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(c,p,...o){if(p){for(let i=c;i<this._length-p;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+p)];this._length-=p,this.onDeleteEmitter.fire({index:c,amount:p})}for(let i=this._length-1;i>=c;i--)this._array[this._getCyclicIndex(i+o.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<o.length;i++)this._array[this._getCyclicIndex(c+i)]=o[i];if(o.length&&this.onInsertEmitter.fire({index:c,amount:o.length}),this._length+o.length>this._maxLength){let i=this._length+o.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=o.length}trimStart(c){c>this._length&&(c=this._length),this._startIndex+=c,this._length-=c,this.onTrimEmitter.fire(c)}shiftElements(c,p,o){if(!(p<=0)){if(c<0||c>=this._length)throw new Error("start argument out of range");if(c+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let s=p-1;s>=0;s--)this.set(c+s+o,this.get(c+s));let i=c+p+o-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<p;i++)this.set(c+i+o,this.get(c+i))}}_getCyclicIndex(c){return(this._startIndex+c)%this._maxLength}}d.CircularList=h},1439:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.clone=void 0,d.clone=function f(n,l=5){if(typeof n!="object")return n;let h=Array.isArray(n)?[]:{};for(let _ in n)h[_]=l<=1?n[_]:n[_]&&f(n[_],l-1);return h}},8055:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.contrastRatio=d.toPaddedHex=d.rgba=d.rgb=d.css=d.color=d.channels=d.NULL_COLOR=void 0;let f=0,n=0,l=0,h=0;var _,c,p,o,i;function s(t){let r=t.toString(16);return r.length<2?"0"+r:r}function e(t,r){return t<r?(r+.05)/(t+.05):(t+.05)/(r+.05)}d.NULL_COLOR={css:"#00000000",rgba:0},(function(t){t.toCss=function(r,a,u,g){return g!==void 0?`#${s(r)}${s(a)}${s(u)}${s(g)}`:`#${s(r)}${s(a)}${s(u)}`},t.toRgba=function(r,a,u,g=255){return(r<<24|a<<16|u<<8|g)>>>0},t.toColor=function(r,a,u,g){return{css:t.toCss(r,a,u,g),rgba:t.toRgba(r,a,u,g)}}})(_||(d.channels=_={})),(function(t){function r(a,u){return h=Math.round(255*u),[f,n,l]=i.toChannels(a.rgba),{css:_.toCss(f,n,l,h),rgba:_.toRgba(f,n,l,h)}}t.blend=function(a,u){if(h=(255&u.rgba)/255,h===1)return{css:u.css,rgba:u.rgba};let g=u.rgba>>24&255,v=u.rgba>>16&255,S=u.rgba>>8&255,y=a.rgba>>24&255,D=a.rgba>>16&255,M=a.rgba>>8&255;return f=y+Math.round((g-y)*h),n=D+Math.round((v-D)*h),l=M+Math.round((S-M)*h),{css:_.toCss(f,n,l),rgba:_.toRgba(f,n,l)}},t.isOpaque=function(a){return(255&a.rgba)==255},t.ensureContrastRatio=function(a,u,g){let v=i.ensureContrastRatio(a.rgba,u.rgba,g);if(v)return _.toColor(v>>24&255,v>>16&255,v>>8&255)},t.opaque=function(a){let u=(255|a.rgba)>>>0;return[f,n,l]=i.toChannels(u),{css:_.toCss(f,n,l),rgba:u}},t.opacity=r,t.multiplyOpacity=function(a,u){return h=255&a.rgba,r(a,h*u/255)},t.toColorRGB=function(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}})(c||(d.color=c={})),(function(t){let r,a;try{let u=document.createElement("canvas");u.width=1,u.height=1;let g=u.getContext("2d",{willReadFrequently:!0});g&&(r=g,r.globalCompositeOperation="copy",a=r.createLinearGradient(0,0,1,1))}catch{}t.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return f=parseInt(u.slice(1,2).repeat(2),16),n=parseInt(u.slice(2,3).repeat(2),16),l=parseInt(u.slice(3,4).repeat(2),16),_.toColor(f,n,l);case 5:return f=parseInt(u.slice(1,2).repeat(2),16),n=parseInt(u.slice(2,3).repeat(2),16),l=parseInt(u.slice(3,4).repeat(2),16),h=parseInt(u.slice(4,5).repeat(2),16),_.toColor(f,n,l,h);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}let g=u.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]),l=parseInt(g[3]),h=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),_.toColor(f,n,l,h);if(!r||!a)throw new Error("css.toColor: Unsupported css format");if(r.fillStyle=a,r.fillStyle=u,typeof r.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(r.fillRect(0,0,1,1),[f,n,l,h]=r.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(f,n,l,h),css:u}}})(p||(d.css=p={})),(function(t){function r(a,u,g){let v=a/255,S=u/255,y=g/255;return .2126*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.7152*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}t.relativeLuminance=function(a){return r(a>>16&255,a>>8&255,255&a)},t.relativeLuminance2=r})(o||(d.rgb=o={})),(function(t){function r(u,g,v){let S=u>>24&255,y=u>>16&255,D=u>>8&255,M=g>>24&255,E=g>>16&255,x=g>>8&255,O=e(o.relativeLuminance2(M,E,x),o.relativeLuminance2(S,y,D));for(;O<v&&(M>0||E>0||x>0);)M-=Math.max(0,Math.ceil(.1*M)),E-=Math.max(0,Math.ceil(.1*E)),x-=Math.max(0,Math.ceil(.1*x)),O=e(o.relativeLuminance2(M,E,x),o.relativeLuminance2(S,y,D));return(M<<24|E<<16|x<<8|255)>>>0}function a(u,g,v){let S=u>>24&255,y=u>>16&255,D=u>>8&255,M=g>>24&255,E=g>>16&255,x=g>>8&255,O=e(o.relativeLuminance2(M,E,x),o.relativeLuminance2(S,y,D));for(;O<v&&(M<255||E<255||x<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),E=Math.min(255,E+Math.ceil(.1*(255-E))),x=Math.min(255,x+Math.ceil(.1*(255-x))),O=e(o.relativeLuminance2(M,E,x),o.relativeLuminance2(S,y,D));return(M<<24|E<<16|x<<8|255)>>>0}t.blend=function(u,g){if(h=(255&g)/255,h===1)return g;let v=g>>24&255,S=g>>16&255,y=g>>8&255,D=u>>24&255,M=u>>16&255,E=u>>8&255;return f=D+Math.round((v-D)*h),n=M+Math.round((S-M)*h),l=E+Math.round((y-E)*h),_.toRgba(f,n,l)},t.ensureContrastRatio=function(u,g,v){let S=o.relativeLuminance(u>>8),y=o.relativeLuminance(g>>8);if(e(S,y)<v){if(y<S){let E=r(u,g,v),x=e(S,o.relativeLuminance(E>>8));if(x<v){let O=a(u,g,v);return x>e(S,o.relativeLuminance(O>>8))?E:O}return E}let D=a(u,g,v),M=e(S,o.relativeLuminance(D>>8));if(M<v){let E=r(u,g,v);return M>e(S,o.relativeLuminance(E>>8))?D:E}return D}},t.reduceLuminance=r,t.increaseLuminance=a,t.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}})(i||(d.rgba=i={})),d.toPaddedHex=s,d.contrastRatio=e},8969:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CoreTerminal=void 0;let n=f(844),l=f(2585),h=f(4348),_=f(7866),c=f(744),p=f(7302),o=f(6975),i=f(8460),s=f(1753),e=f(1480),t=f(7994),r=f(9282),a=f(5435),u=f(5981),g=f(2660),v=!1;class S extends n.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((D=>{this._onScrollApi?.fire(D.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(D){for(let M in D)this.optionsService.options[M]=D[M]}constructor(D){super(),this._windowsWrappingHeuristics=this.register(new n.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new p.OptionsService(D)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(c.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(t.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new a.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((M=>{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((M=>{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 u.WriteBuffer(((M,E)=>this._inputHandler.parse(M,E)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(D,M){this._writeBuffer.write(D,M)}writeSync(D,M){this._logService.logLevel<=l.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(D,M)}input(D,M=!0){this.coreService.triggerDataEvent(D,M)}resize(D,M){isNaN(D)||isNaN(M)||(D=Math.max(D,c.MINIMUM_COLS),M=Math.max(M,c.MINIMUM_ROWS),this._bufferService.resize(D,M))}scroll(D,M=!1){this._bufferService.scroll(D,M)}scrollLines(D,M,E){this._bufferService.scrollLines(D,M,E)}scrollPages(D){this.scrollLines(D*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(D){let M=D-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(D,M){return this._inputHandler.registerEscHandler(D,M)}registerDcsHandler(D,M){return this._inputHandler.registerDcsHandler(D,M)}registerCsiHandler(D,M){return this._inputHandler.registerCsiHandler(D,M)}registerOscHandler(D,M){return this._inputHandler.registerOscHandler(D,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let D=!1,M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?D=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(D=!0),D?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let D=[];D.push(this.onLineFeed(r.updateWindowsModeWrappedState.bind(null,this._bufferService))),D.push(this.registerCsiHandler({final:"H"},(()=>((0,r.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,n.toDisposable)((()=>{for(let M of D)M.dispose()}))}}}d.CoreTerminal=S},8460:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.runAndSubscribe=d.forwardEvent=d.EventEmitter=void 0,d.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=f=>(this._listeners.push(f),{dispose:()=>{if(!this._disposed){for(let n=0;n<this._listeners.length;n++)if(this._listeners[n]===f)return void this._listeners.splice(n,1)}}})),this._event}fire(f,n){let l=[];for(let h=0;h<this._listeners.length;h++)l.push(this._listeners[h]);for(let h=0;h<l.length;h++)l[h].call(void 0,f,n)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},d.forwardEvent=function(f,n){return f((l=>n.fire(l)))},d.runAndSubscribe=function(f,n){return n(void 0),f((l=>n(l)))}},5435:function(R,d,f){var n=this&&this.__decorate||function(N,C,B,m){var b,k=arguments.length,A=k<3?C:m===null?m=Object.getOwnPropertyDescriptor(C,B):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(N,C,B,m);else for(var W=N.length-1;W>=0;W--)(b=N[W])&&(A=(k<3?b(A):k>3?b(C,B,A):b(C,B))||A);return k>3&&A&&Object.defineProperty(C,B,A),A},l=this&&this.__param||function(N,C){return function(B,m){C(B,m,N)}};Object.defineProperty(d,"__esModule",{value:!0}),d.InputHandler=d.WindowsOptionsReportType=void 0;let h=f(2584),_=f(7116),c=f(2015),p=f(844),o=f(482),i=f(8437),s=f(8460),e=f(643),t=f(511),r=f(3734),a=f(2585),u=f(1480),g=f(6242),v=f(6351),S=f(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},D=131072;function M(N,C){if(N>24)return C.setWinLines||!1;switch(N){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var E;(function(N){N[N.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",N[N.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(E||(d.WindowsOptionsReportType=E={}));let x=0;class O extends p.Disposable{getAttrData(){return this._curAttrData}constructor(C,B,m,b,k,A,W,j,P=new c.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=B,this._coreService=m,this._logService=b,this._optionsService=k,this._oscLinkService=A,this._coreMouseService=W,this._unicodeService=j,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new t.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new 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 q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((w=>this._activeBuffer=w.activeBuffer))),this._parser.setCsiHandlerFallback(((w,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(w),params:F.toArray()})})),this._parser.setEscHandlerFallback((w=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(w)})})),this._parser.setExecuteHandlerFallback((w=>{this._logService.debug("Unknown EXECUTE code: ",{code:w})})),this._parser.setOscHandlerFallback(((w,F,L)=>{this._logService.debug("Unknown OSC code: ",{identifier:w,action:F,data:L})})),this._parser.setDcsHandlerFallback(((w,F,L)=>{F==="HOOK"&&(L=L.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(w),action:F,payload:L})})),this._parser.setPrintHandler(((w,F,L)=>this.print(w,F,L))),this._parser.registerCsiHandler({final:"@"},(w=>this.insertChars(w))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(w=>this.scrollLeft(w))),this._parser.registerCsiHandler({final:"A"},(w=>this.cursorUp(w))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(w=>this.scrollRight(w))),this._parser.registerCsiHandler({final:"B"},(w=>this.cursorDown(w))),this._parser.registerCsiHandler({final:"C"},(w=>this.cursorForward(w))),this._parser.registerCsiHandler({final:"D"},(w=>this.cursorBackward(w))),this._parser.registerCsiHandler({final:"E"},(w=>this.cursorNextLine(w))),this._parser.registerCsiHandler({final:"F"},(w=>this.cursorPrecedingLine(w))),this._parser.registerCsiHandler({final:"G"},(w=>this.cursorCharAbsolute(w))),this._parser.registerCsiHandler({final:"H"},(w=>this.cursorPosition(w))),this._parser.registerCsiHandler({final:"I"},(w=>this.cursorForwardTab(w))),this._parser.registerCsiHandler({final:"J"},(w=>this.eraseInDisplay(w,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(w=>this.eraseInDisplay(w,!0))),this._parser.registerCsiHandler({final:"K"},(w=>this.eraseInLine(w,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(w=>this.eraseInLine(w,!0))),this._parser.registerCsiHandler({final:"L"},(w=>this.insertLines(w))),this._parser.registerCsiHandler({final:"M"},(w=>this.deleteLines(w))),this._parser.registerCsiHandler({final:"P"},(w=>this.deleteChars(w))),this._parser.registerCsiHandler({final:"S"},(w=>this.scrollUp(w))),this._parser.registerCsiHandler({final:"T"},(w=>this.scrollDown(w))),this._parser.registerCsiHandler({final:"X"},(w=>this.eraseChars(w))),this._parser.registerCsiHandler({final:"Z"},(w=>this.cursorBackwardTab(w))),this._parser.registerCsiHandler({final:"`"},(w=>this.charPosAbsolute(w))),this._parser.registerCsiHandler({final:"a"},(w=>this.hPositionRelative(w))),this._parser.registerCsiHandler({final:"b"},(w=>this.repeatPrecedingCharacter(w))),this._parser.registerCsiHandler({final:"c"},(w=>this.sendDeviceAttributesPrimary(w))),this._parser.registerCsiHandler({prefix:">",final:"c"},(w=>this.sendDeviceAttributesSecondary(w))),this._parser.registerCsiHandler({final:"d"},(w=>this.linePosAbsolute(w))),this._parser.registerCsiHandler({final:"e"},(w=>this.vPositionRelative(w))),this._parser.registerCsiHandler({final:"f"},(w=>this.hVPosition(w))),this._parser.registerCsiHandler({final:"g"},(w=>this.tabClear(w))),this._parser.registerCsiHandler({final:"h"},(w=>this.setMode(w))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(w=>this.setModePrivate(w))),this._parser.registerCsiHandler({final:"l"},(w=>this.resetMode(w))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(w=>this.resetModePrivate(w))),this._parser.registerCsiHandler({final:"m"},(w=>this.charAttributes(w))),this._parser.registerCsiHandler({final:"n"},(w=>this.deviceStatus(w))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(w=>this.deviceStatusPrivate(w))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(w=>this.softReset(w))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(w=>this.setCursorStyle(w))),this._parser.registerCsiHandler({final:"r"},(w=>this.setScrollRegion(w))),this._parser.registerCsiHandler({final:"s"},(w=>this.saveCursor(w))),this._parser.registerCsiHandler({final:"t"},(w=>this.windowOptions(w))),this._parser.registerCsiHandler({final:"u"},(w=>this.restoreCursor(w))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(w=>this.insertColumns(w))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(w=>this.deleteColumns(w))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(w=>this.selectProtected(w))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(w=>this.requestMode(w,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(w=>this.requestMode(w,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((w=>(this.setTitle(w),this.setIconName(w),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((w=>this.setIconName(w)))),this._parser.registerOscHandler(2,new g.OscHandler((w=>this.setTitle(w)))),this._parser.registerOscHandler(4,new g.OscHandler((w=>this.setOrReportIndexedColor(w)))),this._parser.registerOscHandler(8,new g.OscHandler((w=>this.setHyperlink(w)))),this._parser.registerOscHandler(10,new g.OscHandler((w=>this.setOrReportFgColor(w)))),this._parser.registerOscHandler(11,new g.OscHandler((w=>this.setOrReportBgColor(w)))),this._parser.registerOscHandler(12,new g.OscHandler((w=>this.setOrReportCursorColor(w)))),this._parser.registerOscHandler(104,new g.OscHandler((w=>this.restoreIndexedColor(w)))),this._parser.registerOscHandler(110,new g.OscHandler((w=>this.restoreFgColor(w)))),this._parser.registerOscHandler(111,new g.OscHandler((w=>this.restoreBgColor(w)))),this._parser.registerOscHandler(112,new g.OscHandler((w=>this.restoreCursorColor(w)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let w in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:w},(()=>this.selectCharset("("+w))),this._parser.registerEscHandler({intermediates:")",final:w},(()=>this.selectCharset(")"+w))),this._parser.registerEscHandler({intermediates:"*",final:w},(()=>this.selectCharset("*"+w))),this._parser.registerEscHandler({intermediates:"+",final:w},(()=>this.selectCharset("+"+w))),this._parser.registerEscHandler({intermediates:"-",final:w},(()=>this.selectCharset("-"+w))),this._parser.registerEscHandler({intermediates:".",final:w},(()=>this.selectCharset("."+w))),this._parser.registerEscHandler({intermediates:"/",final:w},(()=>this.selectCharset("/"+w)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((w=>(this._logService.error("Parsing error: ",w),w))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler(((w,F)=>this.requestStatusString(w,F))))}_preserveStack(C,B,m,b){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=m,this._parseStack.position=b}_logSlowResolvingAsync(C){this._logService.logLevel<=a.LogLevelEnum.WARN&&Promise.race([C,new Promise(((B,m)=>setTimeout((()=>m("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,B){let m,b=this._activeBuffer.x,k=this._activeBuffer.y,A=0,W=this._parseStack.paused;if(W){if(m=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync(m),m;b=this._parseStack.cursorStartX,k=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>D&&(A=this._parseStack.position+D)}if(this._logService.logLevel<=a.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(w=>String.fromCharCode(w))).join("")}"`),typeof C=="string"?C.split("").map((w=>w.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<D&&(this._parseBuffer=new Uint32Array(Math.min(C.length,D))),W||this._dirtyRowTracker.clearRange(),C.length>D)for(let w=A;w<C.length;w+=D){let F=w+D<C.length?w+D:C.length,L=typeof C=="string"?this._stringDecoder.decode(C.substring(w,F),this._parseBuffer):this._utf8Decoder.decode(C.subarray(w,F),this._parseBuffer);if(m=this._parser.parse(this._parseBuffer,L))return this._preserveStack(b,k,L,w),this._logSlowResolvingAsync(m),m}else if(!W){let w=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(m=this._parser.parse(this._parseBuffer,w))return this._preserveStack(b,k,w,0),this._logSlowResolvingAsync(m),m}this._activeBuffer.x===b&&this._activeBuffer.y===k||this._onCursorMove.fire();let j=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(j,this._bufferService.rows-1))}print(C,B,m){let b,k,A=this._charsetService.charset,W=this._optionsService.rawOptions.screenReaderMode,j=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,w=this._coreService.modes.insertMode,F=this._curAttrData,L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&m-B>0&&L.getWidth(this._activeBuffer.x-1)===2&&L.setCellFromCodepoint(this._activeBuffer.x-1,0,1,F);let $=this._parser.precedingJoinState;for(let H=B;H<m;++H){if(b=C[H],b<127&&A){let ee=A[String.fromCharCode(b)];ee&&(b=ee.charCodeAt(0))}let V=this._unicodeService.charProperties(b,$);k=u.UnicodeService.extractWidth(V);let X=u.UnicodeService.extractShouldJoin(V),J=X?u.UnicodeService.extractWidth($):0;if($=V,W&&this._onA11yChar.fire((0,o.stringFromCodePoint)(b)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+k-J>j){if(P){let ee=L,G=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),L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),J>0&&L instanceof i.BufferLine&&L.copyCellsFrom(ee,G,0,J,!1);G<j;)ee.setCellFromCodepoint(G++,0,1,F)}else if(this._activeBuffer.x=j-1,k===2)continue}if(X&&this._activeBuffer.x){let ee=L.getWidth(this._activeBuffer.x-1)?1:2;L.addCodepointToCell(this._activeBuffer.x-ee,b,k);for(let G=k-J;--G>=0;)L.setCellFromCodepoint(this._activeBuffer.x++,0,0,F)}else if(w&&(L.insertCells(this._activeBuffer.x,k-J,this._activeBuffer.getNullCell(F)),L.getWidth(j-1)===2&&L.setCellFromCodepoint(j-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,F)),L.setCellFromCodepoint(this._activeBuffer.x++,b,k,F),k>0)for(;--k;)L.setCellFromCodepoint(this._activeBuffer.x++,0,0,F)}this._parser.precedingJoinState=$,this._activeBuffer.x<j&&m-B>0&&L.getWidth(this._activeBuffer.x)===0&&!L.hasContent(this._activeBuffer.x)&&L.setCellFromCodepoint(this._activeBuffer.x,0,1,F),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,B){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,B):this._parser.registerCsiHandler(C,(m=>!M(m.params[0],this._optionsService.rawOptions.windowOptions)||B(m)))}registerDcsHandler(C,B){return this._parser.registerDcsHandler(C,new v.DcsHandler(B))}registerEscHandler(C,B){return this._parser.registerEscHandler(C,B)}registerOscHandler(C,B){return this._parser.registerOscHandler(C,new g.OscHandler(B))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,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(C,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=C,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+B)}cursorUp(C){let B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){let B=C.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=C.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=C.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let B=C.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,B,m,b=!1,k=!1){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);A.replaceCells(B,m,this._activeBuffer.getNullCell(this._eraseAttrData()),k),b&&(A.isWrapped=!1)}_resetBufferLine(C,B=!1){let m=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);m&&(m.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),m.isWrapped=!1)}eraseInDisplay(C,B=!1){let m;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(m=this._activeBuffer.y,this._dirtyRowTracker.markDirty(m),this._eraseInBufferLine(m++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);m<this._bufferService.rows;m++)this._resetBufferLine(m,B);this._dirtyRowTracker.markDirty(m);break;case 1:for(m=this._activeBuffer.y,this._dirtyRowTracker.markDirty(m),this._eraseInBufferLine(m,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(m+1).isWrapped=!1);m--;)this._resetBufferLine(m,B);this._dirtyRowTracker.markDirty(0);break;case 2:for(m=this._bufferService.rows,this._dirtyRowTracker.markDirty(m-1);m--;)this._resetBufferLine(m,B);this._dirtyRowTracker.markDirty(0);break;case 3:let b=this._activeBuffer.lines.length-this._bufferService.rows;b>0&&(this._activeBuffer.lines.trimStart(b),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-b,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-b,0),this._onScroll.fire(0))}return!0}eraseInLine(C,B=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let B=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let m=this._activeBuffer.ybase+this._activeBuffer.y,b=this._bufferService.rows-1-this._activeBuffer.scrollBottom,k=this._bufferService.rows-1+this._activeBuffer.ybase-b+1;for(;B--;)this._activeBuffer.lines.splice(k-1,1),this._activeBuffer.lines.splice(m,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let B=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let m=this._activeBuffer.ybase+this._activeBuffer.y,b;for(b=this._bufferService.rows-1-this._activeBuffer.scrollBottom,b=this._bufferService.rows-1+this._activeBuffer.ybase-b;B--;)this._activeBuffer.lines.splice(m,1),this._activeBuffer.lines.splice(b,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();let B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();let B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let B=C.params[0]||1;for(;B--;)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(C){let B=C.params[0]||1;for(;B--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let B=C.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);b.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),b.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let B=C.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);b.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),b.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let B=C.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);b.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),b.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let B=C.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);b.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),b.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){let B=this._parser.precedingJoinState;if(!B)return!0;let m=C.params[0]||1,b=u.UnicodeService.extractWidth(B),k=this._activeBuffer.x-b,A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(k),W=new Uint32Array(A.length*m),j=0;for(let w=0;w<A.length;){let F=A.codePointAt(w)||0;W[j++]=F,w+=F>65535?2:1}let P=j;for(let w=1;w<m;++w)W.copyWithin(P,0,j),P+=j;return this.print(W,0,P),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let B=0;B<C.length;B++)switch(C.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let B=0;B<C.length;B++)switch(C.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.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(C){for(let B=0;B<C.length;B++)switch(C.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let B=0;B<C.length;B++)switch(C.params[B]){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(),C.params[B]===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(C,B){let m=this._coreService.decPrivateModes,{activeProtocol:b,activeEncoding:k}=this._coreMouseService,A=this._coreService,{buffers:W,cols:j}=this._bufferService,{active:P,alt:w}=W,F=this._optionsService.rawOptions,L=X=>X?1:2,$=C.params[0];return H=$,V=B?$===2?4:$===4?L(A.modes.insertMode):$===12?3:$===20?L(F.convertEol):0:$===1?L(m.applicationCursorKeys):$===3?F.windowOptions.setWinLines?j===80?2:j===132?1:0:0:$===6?L(m.origin):$===7?L(m.wraparound):$===8?3:$===9?L(b==="X10"):$===12?L(F.cursorBlink):$===25?L(!A.isCursorHidden):$===45?L(m.reverseWraparound):$===66?L(m.applicationKeypad):$===67?4:$===1e3?L(b==="VT200"):$===1002?L(b==="DRAG"):$===1003?L(b==="ANY"):$===1004?L(m.sendFocus):$===1005?4:$===1006?L(k==="SGR"):$===1015?4:$===1016?L(k==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?L(P===w):$===2004?L(m.bracketedPasteMode):0,A.triggerDataEvent(`${h.C0.ESC}[${B?"":"?"}${H};${V}$y`),!0;var H,V}_updateAttrColor(C,B,m,b,k){return B===2?(C|=50331648,C&=-16777216,C|=r.AttributeData.fromColorRGB([m,b,k])):B===5&&(C&=-50331904,C|=33554432|255&m),C}_extractColor(C,B,m){let b=[0,0,-1,0,0,0],k=0,A=0;do{if(b[A+k]=C.params[B+A],C.hasSubParams(B+A)){let W=C.getSubParams(B+A),j=0;do b[1]===5&&(k=1),b[A+j+1+k]=W[j];while(++j<W.length&&j+A+1+k<b.length);break}if(b[1]===5&&A+k>=2||b[1]===2&&A+k>=5)break;b[1]&&(k=1)}while(++A+B<C.length&&A+k<b.length);for(let W=2;W<b.length;++W)b[W]===-1&&(b[W]=0);switch(b[0]){case 38:m.fg=this._updateAttrColor(m.fg,b[1],b[3],b[4],b[5]);break;case 48:m.bg=this._updateAttrColor(m.bg,b[1],b[3],b[4],b[5]);break;case 58:m.extended=m.extended.clone(),m.extended.underlineColor=this._updateAttrColor(m.extended.underlineColor,b[1],b[3],b[4],b[5])}return A}_processUnderline(C,B){B.extended=B.extended.clone(),(!~C||C>5)&&(C=1),B.extended.underlineStyle=C,B.fg|=268435456,C===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(C){C.fg=i.DEFAULT_ATTR_DATA.fg,C.bg=i.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;let B=C.length,m,b=this._curAttrData;for(let k=0;k<B;k++)m=C.params[k],m>=30&&m<=37?(b.fg&=-50331904,b.fg|=16777216|m-30):m>=40&&m<=47?(b.bg&=-50331904,b.bg|=16777216|m-40):m>=90&&m<=97?(b.fg&=-50331904,b.fg|=16777224|m-90):m>=100&&m<=107?(b.bg&=-50331904,b.bg|=16777224|m-100):m===0?this._processSGR0(b):m===1?b.fg|=134217728:m===3?b.bg|=67108864:m===4?(b.fg|=268435456,this._processUnderline(C.hasSubParams(k)?C.getSubParams(k)[0]:1,b)):m===5?b.fg|=536870912:m===7?b.fg|=67108864:m===8?b.fg|=1073741824:m===9?b.fg|=2147483648:m===2?b.bg|=134217728:m===21?this._processUnderline(2,b):m===22?(b.fg&=-134217729,b.bg&=-134217729):m===23?b.bg&=-67108865:m===24?(b.fg&=-268435457,this._processUnderline(0,b)):m===25?b.fg&=-536870913:m===27?b.fg&=-67108865:m===28?b.fg&=-1073741825:m===29?b.fg&=2147483647:m===39?(b.fg&=-67108864,b.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):m===49?(b.bg&=-67108864,b.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):m===38||m===48||m===58?k+=this._extractColor(C,k,b):m===53?b.bg|=1073741824:m===55?b.bg&=-1073741825:m===59?(b.extended=b.extended.clone(),b.extended.underlineColor=-1,b.updateExtended()):m===100?(b.fg&=-67108864,b.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,b.bg&=-67108864,b.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",m);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:let B=this._activeBuffer.y+1,m=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${B};${m}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let B=this._activeBuffer.y+1,m=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${B};${m}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){let B=C.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let m=B%2==1;return this._optionsService.options.cursorBlink=m,!0}setScrollRegion(C){let B=C.params[0]||1,m;return(C.length<2||(m=C.params[1])>this._bufferService.rows||m===0)&&(m=this._bufferService.rows),m>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=m-1,this._setCursor(0,0)),!0}windowOptions(C){if(!M(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let B=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(E.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(E.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){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(C){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(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){let B=[],m=C.split(";");for(;m.length>1;){let b=m.shift(),k=m.shift();if(/^\d+$/.exec(b)){let A=parseInt(b);if(K(A))if(k==="?")B.push({type:0,index:A});else{let W=(0,S.parseColor)(k);W&&B.push({type:1,index:A,color:W})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(C){let B=C.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(C,B){this._getCurrentLinkId()&&this._finishHyperlink();let m=C.split(":"),b,k=m.findIndex((A=>A.startsWith("id=")));return k!==-1&&(b=m[k].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:b,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,B){let m=C.split(";");for(let b=0;b<m.length&&!(B>=this._specialColors.length);++b,++B)if(m[b]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{let k=(0,S.parseColor)(m[b]);k&&this._onColor.fire([{type:1,index:this._specialColors[B],color:k}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;let B=[],m=C.split(";");for(let b=0;b<m.length;++b)if(/^\d+$/.exec(m[b])){let k=parseInt(m[b]);K(k)&&B.push({type:2,index:k})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){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,_.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(y[C[0]],_.CHARSETS[C[1]]||_.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){let C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){let C=new t.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){let m=this._activeBuffer.ybase+this._activeBuffer.y+B,b=this._activeBuffer.lines.get(m);b&&(b.fill(C),b.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,B){let m=this._bufferService.buffer,b=this._optionsService.rawOptions;return(k=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${k}${h.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${m.scrollTop+1};${m.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[b.cursorStyle]-(b.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,B){this._dirtyRowTracker.markRangeDirty(C,B)}}d.InputHandler=O;let q=class{constructor(N){this._bufferService=N,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(N){N<this.start?this.start=N:N>this.end&&(this.end=N)}markRangeDirty(N,C){N>C&&(x=N,N=C,C=x),N<this.start&&(this.start=N),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(N){return 0<=N&&N<256}q=n([l(0,a.IBufferService)],q)},844:(R,d)=>{function f(n){for(let l of n)l.dispose();n.length=0}Object.defineProperty(d,"__esModule",{value:!0}),d.getDisposeArrayDisposable=d.disposeArray=d.toDisposable=d.MutableDisposable=d.Disposable=void 0,d.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let n of this._disposables)n.dispose();this._disposables.length=0}register(n){return this._disposables.push(n),n}unregister(n){let l=this._disposables.indexOf(n);l!==-1&&this._disposables.splice(l,1)}},d.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(n){this._isDisposed||n===this._value||(this._value?.dispose(),this._value=n)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},d.toDisposable=function(n){return{dispose:n}},d.disposeArray=f,d.getDisposeArrayDisposable=function(n){return{dispose:()=>f(n)}}},1505:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.FourKeyMap=d.TwoKeyMap=void 0;class f{constructor(){this._data={}}set(l,h,_){this._data[l]||(this._data[l]={}),this._data[l][h]=_}get(l,h){return this._data[l]?this._data[l][h]:void 0}clear(){this._data={}}}d.TwoKeyMap=f,d.FourKeyMap=class{constructor(){this._data=new f}set(n,l,h,_,c){this._data.get(n,l)||this._data.set(n,l,new f),this._data.get(n,l).set(h,_,c)}get(n,l,h,_){return this._data.get(n,l)?.get(h,_)}clear(){this._data.clear()}}},6114:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.isChromeOS=d.isLinux=d.isWindows=d.isIphone=d.isIpad=d.isMac=d.getSafariVersion=d.isSafari=d.isLegacyEdge=d.isFirefox=d.isNode=void 0,d.isNode=typeof process<"u"&&"title"in process;let f=d.isNode?"node":navigator.userAgent,n=d.isNode?"node":navigator.platform;d.isFirefox=f.includes("Firefox"),d.isLegacyEdge=f.includes("Edge"),d.isSafari=/^((?!chrome|android).)*safari/i.test(f),d.getSafariVersion=function(){if(!d.isSafari)return 0;let l=f.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},d.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),d.isIpad=n==="iPad",d.isIphone=n==="iPhone",d.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),d.isLinux=n.indexOf("Linux")>=0,d.isChromeOS=/\bCrOS\b/.test(f)},6106:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.SortedList=void 0;let f=0;d.SortedList=class{constructor(n){this._getKey=n,this._array=[]}clear(){this._array.length=0}insert(n){this._array.length!==0?(f=this._search(this._getKey(n)),this._array.splice(f,0,n)):this._array.push(n)}delete(n){if(this._array.length===0)return!1;let l=this._getKey(n);if(l===void 0||(f=this._search(l),f===-1)||this._getKey(this._array[f])!==l)return!1;do if(this._array[f]===n)return this._array.splice(f,1),!0;while(++f<this._array.length&&this._getKey(this._array[f])===l);return!1}*getKeyIterator(n){if(this._array.length!==0&&(f=this._search(n),!(f<0||f>=this._array.length)&&this._getKey(this._array[f])===n))do yield this._array[f];while(++f<this._array.length&&this._getKey(this._array[f])===n)}forEachByKey(n,l){if(this._array.length!==0&&(f=this._search(n),!(f<0||f>=this._array.length)&&this._getKey(this._array[f])===n))do l(this._array[f]);while(++f<this._array.length&&this._getKey(this._array[f])===n)}values(){return[...this._array].values()}_search(n){let l=0,h=this._array.length-1;for(;h>=l;){let _=l+h>>1,c=this._getKey(this._array[_]);if(c>n)h=_-1;else{if(!(c<n)){for(;_>0&&this._getKey(this._array[_-1])===n;)_--;return _}l=_+1}}return l}}},7226:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DebouncedIdleTask=d.IdleTaskQueue=d.PriorityTaskQueue=void 0;let n=f(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(c){this._tasks.push(c),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(c){this._idleCallback=void 0;let p=0,o=0,i=c.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),o=Math.max(p,o),s=c.timeRemaining(),1.5*o>s)return i-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-p))}ms`),void this._start();i=s}this.clear()}}class h extends l{_requestCallback(c){return setTimeout((()=>c(this._createDeadline(16))))}_cancelCallback(c){clearTimeout(c)}_createDeadline(c){let p=Date.now()+c;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}d.PriorityTaskQueue=h,d.IdleTaskQueue=!n.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:h,d.DebouncedIdleTask=class{constructor(){this._queue=new d.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.updateWindowsModeWrappedState=void 0;let n=f(643);d.updateWindowsModeWrappedState=function(l){let h=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),_=h?.get(l.cols-1),c=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);c&&_&&(c.isWrapped=_[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&_[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},3734:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ExtendedAttrs=d.AttributeData=void 0;class f{constructor(){this.fg=0,this.bg=0,this.extended=new n}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){let h=new f;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}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}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}d.AttributeData=f;class n{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){let h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,_=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=_}clone(){return new n(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}d.ExtendedAttrs=n},9092:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Buffer=d.MAX_BUFFER_SIZE=void 0;let n=f(6349),l=f(7226),h=f(3734),_=f(8437),c=f(4634),p=f(511),o=f(643),i=f(4863),s=f(7116);d.MAX_BUFFER_SIZE=4294967295,d.Buffer=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new _.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>d.MAX_BUFFER_SIZE?d.MAX_BUFFER_SIZE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=_.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(_.DEFAULT_ATTR_DATA),a=0,u=this._getCorrectBufferLength(t);if(u>this.lines.maxLength&&(this.lines.maxLength=u),this.lines.length>0){if(this._cols<e)for(let v=0;v<this.lines.length;v++)a+=+this.lines.get(v).resize(e,r);let g=0;if(this._rows<t)for(let v=this._rows;v<t;v++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(e,r)));else for(let v=this._rows;v>t;v--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(u<this.lines.maxLength){let v=this.lines.length-u;v>0&&(this.lines.trimStart(v),this.ybase=Math.max(this.ybase-v,0),this.ydisp=Math.max(this.ydisp-v,0),this.savedY=Math.max(this.savedY-v,0)),this.lines.maxLength=u}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let g=0;g<this.lines.length;g++)a+=+this.lines.get(g).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),a>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=(0,c.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(r.length>0){let a=(0,c.reflowLargerCreateNewLayout)(this.lines,r);(0,c.reflowLargerApplyNewLayout)(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let a=this.getNullCell(_.DEFAULT_ATTR_DATA),u=r;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new _.BufferLine(e,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this.getNullCell(_.DEFAULT_ATTR_DATA),a=[],u=0;for(let g=this.lines.length-1;g>=0;g--){let v=this.lines.get(g);if(!v||!v.isWrapped&&v.getTrimmedLength()<=e)continue;let S=[v];for(;v.isWrapped&&g>0;)v=this.lines.get(--g),S.unshift(v);let y=this.ybase+this.y;if(y>=g&&y<g+S.length)continue;let D=S[S.length-1].getTrimmedLength(),M=(0,c.reflowSmallerGetNewLineLengths)(S,this._cols,e),E=M.length-S.length,x;x=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+E):Math.max(0,this.lines.length-this.lines.maxLength+E);let O=[];for(let m=0;m<E;m++){let b=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);O.push(b)}O.length>0&&(a.push({start:g+S.length+u,newLines:O}),u+=O.length),S.push(...O);let q=M.length-1,K=M[q];K===0&&(q--,K=M[q]);let N=S.length-E-1,C=D;for(;N>=0;){let m=Math.min(C,K);if(S[q]===void 0)break;if(S[q].copyCellsFrom(S[N],C-m,K-m,m,!0),K-=m,K===0&&(q--,K=M[q]),C-=m,C===0){N--;let b=Math.max(N,0);C=(0,c.getWrappedLineTrimmedLength)(S,b,this._cols)}}for(let m=0;m<S.length;m++)M[m]<e&&S[m].setCell(M[m],r);let B=E-x;for(;B-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+u)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+E,this.ybase+t-1)}if(a.length>0){let g=[],v=[];for(let q=0;q<this.lines.length;q++)v.push(this.lines.get(q));let S=this.lines.length,y=S-1,D=0,M=a[D];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+u);let E=0;for(let q=Math.min(this.lines.maxLength-1,S+u-1);q>=0;q--)if(M&&M.start>y+E){for(let K=M.newLines.length-1;K>=0;K--)this.lines.set(q--,M.newLines[K]);q++,g.push({index:y+1,amount:M.newLines.length}),E+=M.newLines.length,M=a[++D]}else this.lines.set(q,v[y--]);let x=0;for(let q=g.length-1;q>=0;q--)g[q].index+=x,this.lines.onInsertEmitter.fire(g[q]),x+=g[q].amount;let O=Math.max(0,S+u-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}}translateBufferLineToString(e,t,r=0,a){let u=this.lines.get(e);return u?u.translateToString(t,r,a):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new i.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((r=>{t.line-=r,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((r=>{t.line>=r.index&&(t.line+=r.amount)}))),t.register(this.lines.onDelete((r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferLine=d.DEFAULT_ATTR_DATA=void 0;let n=f(3734),l=f(511),h=f(643),_=f(482);d.DEFAULT_ATTR_DATA=Object.freeze(new n.AttributeData);let c=0;class p{constructor(i,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let t=s||l.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let r=0;r<i;++r)this.setCell(r,t);this.length=i}get(i){let s=this._data[3*i+0],e=2097151&s;return[this._data[3*i+1],2097152&s?this._combined[i]:e?(0,_.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,s){this._data[3*i+1]=s[h.CHAR_DATA_ATTR_INDEX],s[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=s[1],this._data[3*i+0]=2097152|i|s[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=s[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&s}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i]:2097151&s?(0,_.stringFromCodePoint)(2097151&s):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,s){return c=3*i,s.content=this._data[c+0],s.fg=this._data[c+1],s.bg=this._data[c+2],2097152&s.content&&(s.combinedData=this._combined[i]),268435456&s.bg&&(s.extended=this._extendedAttrs[i]),s}setCell(i,s){2097152&s.content&&(this._combined[i]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=s.content,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}setCellFromCodepoint(i,s,e,t){268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=s|e<<22,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}addCodepointToCell(i,s,e){let t=this._data[3*i+0];2097152&t?this._combined[i]+=(0,_.stringFromCodePoint)(s):2097151&t?(this._combined[i]=(0,_.stringFromCodePoint)(2097151&t)+(0,_.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,e&&(t&=-12582913,t|=e<<22),this._data[3*i+0]=t}insertCells(i,s,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length-i){let t=new l.CellData;for(let r=this.length-i-s-1;r>=0;--r)this.setCell(i+s+r,this.loadCell(i+r,t));for(let r=0;r<s;++r)this.setCell(i+r,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,s,e){if(i%=this.length,s<this.length-i){let t=new l.CellData;for(let r=0;r<this.length-i-s;++r)this.setCell(i+r,this.loadCell(i+s+r,t));for(let r=this.length-s;r<this.length;++r)this.setCell(r,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,s,e,t=!1){if(t)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.setCell(i++,e)}resize(i,s){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let t=new Uint32Array(e);t.set(this._data),this._data=t}for(let t=this.length;t<i;++t)this.setCell(t,s)}else{this._data=this._data.subarray(0,e);let t=Object.keys(this._combined);for(let a=0;a<t.length;a++){let u=parseInt(t[a],10);u>=i&&delete this._combined[u]}let r=Object.keys(this._extendedAttrs);for(let a=0;a<r.length;a++){let u=parseInt(r[a],10);u>=i&&delete this._extendedAttrs[u]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let s in i._combined)this._combined[s]=i._combined[s];this._extendedAttrs={};for(let s in i._extendedAttrs)this._extendedAttrs[s]=i._extendedAttrs[s];this.isWrapped=i.isWrapped}clone(){let i=new p(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let s in this._combined)i._combined[s]=this._combined[s];for(let s in this._extendedAttrs)i._extendedAttrs[s]=this._extendedAttrs[s];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,s,e,t,r){let a=i._data;if(r)for(let g=t-1;g>=0;g--){for(let v=0;v<3;v++)this._data[3*(e+g)+v]=a[3*(s+g)+v];268435456&a[3*(s+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[s+g])}else for(let g=0;g<t;g++){for(let v=0;v<3;v++)this._data[3*(e+g)+v]=a[3*(s+g)+v];268435456&a[3*(s+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[s+g])}let u=Object.keys(i._combined);for(let g=0;g<u.length;g++){let v=parseInt(u[g],10);v>=s&&(this._combined[v-s+e]=i._combined[v])}}translateToString(i,s,e,t){s=s??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),t&&(t.length=0);let r="";for(;s<e;){let a=this._data[3*s+0],u=2097151&a,g=2097152&a?this._combined[s]:u?(0,_.stringFromCodePoint)(u):h.WHITESPACE_CELL_CHAR;if(r+=g,t)for(let v=0;v<g.length;++v)t.push(s);s+=a>>22||1}return t&&t.push(s),r}}d.BufferLine=p},4841:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.getRangeLength=void 0,d.getRangeLength=function(f,n){if(f.start.y>f.end.y)throw new Error(`Buffer range end (${f.end.x}, ${f.end.y}) cannot be before start (${f.start.x}, ${f.start.y})`);return n*(f.end.y-f.start.y)+(f.end.x-f.start.x+1)}},4634:(R,d)=>{function f(n,l,h){if(l===n.length-1)return n[l].getTrimmedLength();let _=!n[l].hasContent(h-1)&&n[l].getWidth(h-1)===1,c=n[l+1].getWidth(0)===2;return _&&c?h-1:h}Object.defineProperty(d,"__esModule",{value:!0}),d.getWrappedLineTrimmedLength=d.reflowSmallerGetNewLineLengths=d.reflowLargerApplyNewLayout=d.reflowLargerCreateNewLayout=d.reflowLargerGetLinesToRemove=void 0,d.reflowLargerGetLinesToRemove=function(n,l,h,_,c){let p=[];for(let o=0;o<n.length-1;o++){let i=o,s=n.get(++i);if(!s.isWrapped)continue;let e=[n.get(o)];for(;i<n.length&&s.isWrapped;)e.push(s),s=n.get(++i);if(_>=o&&_<i){o+=e.length-1;continue}let t=0,r=f(e,t,l),a=1,u=0;for(;a<e.length;){let v=f(e,a,l),S=v-u,y=h-r,D=Math.min(S,y);e[t].copyCellsFrom(e[a],u,r,D,!1),r+=D,r===h&&(t++,r=0),u+=D,u===v&&(a++,u=0),r===0&&t!==0&&e[t-1].getWidth(h-1)===2&&(e[t].copyCellsFrom(e[t-1],h-1,r++,1,!1),e[t-1].setCell(h-1,c))}e[t].replaceCells(r,h,c);let g=0;for(let v=e.length-1;v>0&&(v>t||e[v].getTrimmedLength()===0);v--)g++;g>0&&(p.push(o+e.length-g),p.push(g)),o+=e.length-1}return p},d.reflowLargerCreateNewLayout=function(n,l){let h=[],_=0,c=l[_],p=0;for(let o=0;o<n.length;o++)if(c===o){let i=l[++_];n.onDeleteEmitter.fire({index:o-p,amount:i}),o+=i-1,p+=i,c=l[++_]}else h.push(o);return{layout:h,countRemoved:p}},d.reflowLargerApplyNewLayout=function(n,l){let h=[];for(let _=0;_<l.length;_++)h.push(n.get(l[_]));for(let _=0;_<h.length;_++)n.set(_,h[_]);n.length=l.length},d.reflowSmallerGetNewLineLengths=function(n,l,h){let _=[],c=n.map(((s,e)=>f(n,e,l))).reduce(((s,e)=>s+e)),p=0,o=0,i=0;for(;i<c;){if(c-i<h){_.push(c-i);break}p+=h;let s=f(n,o,l);p>s&&(p-=s,o++);let e=n[o].getWidth(p-1)===2;e&&p--;let t=e?h-1:h;_.push(t),i+=t}return _},d.getWrappedLineTrimmedLength=f},5295:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferSet=void 0;let n=f(8460),l=f(844),h=f(9092);class _ extends l.Disposable{constructor(p,o){super(),this._optionsService=p,this._bufferService=o,this._onBufferActivate=this.register(new n.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 h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.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(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,o){this._normal.resize(p,o),this._alt.resize(p,o),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}d.BufferSet=_},511:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CellData=void 0;let n=f(482),l=f(643),h=f(3734);class _ extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(p){let o=new _;return o.setFromCharData(p),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,n.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(p[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(p[l.CHAR_DATA_CHAR_INDEX].length===2){let i=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let s=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|p[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=p[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}d.CellData=_},643:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WHITESPACE_CELL_CODE=d.WHITESPACE_CELL_WIDTH=d.WHITESPACE_CELL_CHAR=d.NULL_CELL_CODE=d.NULL_CELL_WIDTH=d.NULL_CELL_CHAR=d.CHAR_DATA_CODE_INDEX=d.CHAR_DATA_WIDTH_INDEX=d.CHAR_DATA_CHAR_INDEX=d.CHAR_DATA_ATTR_INDEX=d.DEFAULT_EXT=d.DEFAULT_ATTR=d.DEFAULT_COLOR=void 0,d.DEFAULT_COLOR=0,d.DEFAULT_ATTR=256|d.DEFAULT_COLOR<<9,d.DEFAULT_EXT=0,d.CHAR_DATA_ATTR_INDEX=0,d.CHAR_DATA_CHAR_INDEX=1,d.CHAR_DATA_WIDTH_INDEX=2,d.CHAR_DATA_CODE_INDEX=3,d.NULL_CELL_CHAR="",d.NULL_CELL_WIDTH=1,d.NULL_CELL_CODE=0,d.WHITESPACE_CELL_CHAR=" ",d.WHITESPACE_CELL_WIDTH=1,d.WHITESPACE_CELL_CODE=32},4863:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Marker=void 0;let n=f(8460),l=f(844);class h{get id(){return this._id}constructor(c){this.line=c,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new n.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(c){return this._disposables.push(c),c}}d.Marker=h,h._nextId=1},7116:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DEFAULT_CHARSET=d.CHARSETS=void 0,d.CHARSETS={},d.DEFAULT_CHARSET=d.CHARSETS.B,d.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},d.CHARSETS.A={"#":"\xA3"},d.CHARSETS.B=void 0,d.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},d.CHARSETS.C=d.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},d.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},d.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},d.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},d.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},d.CHARSETS.E=d.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},d.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},d.CHARSETS.H=d.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},d.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(R,d)=>{var f,n,l;Object.defineProperty(d,"__esModule",{value:!0}),d.C1_ESCAPED=d.C1=d.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
8
+ `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL="\x7F"})(f||(d.C0=f={})),(function(h){h.PAD="\x80",h.HOP="\x81",h.BPH="\x82",h.NBH="\x83",h.IND="\x84",h.NEL="\x85",h.SSA="\x86",h.ESA="\x87",h.HTS="\x88",h.HTJ="\x89",h.VTS="\x8A",h.PLD="\x8B",h.PLU="\x8C",h.RI="\x8D",h.SS2="\x8E",h.SS3="\x8F",h.DCS="\x90",h.PU1="\x91",h.PU2="\x92",h.STS="\x93",h.CCH="\x94",h.MW="\x95",h.SPA="\x96",h.EPA="\x97",h.SOS="\x98",h.SGCI="\x99",h.SCI="\x9A",h.CSI="\x9B",h.ST="\x9C",h.OSC="\x9D",h.PM="\x9E",h.APC="\x9F"})(n||(d.C1=n={})),(function(h){h.ST=`${f.ESC}\\`})(l||(d.C1_ESCAPED=l={}))},7399:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.evaluateKeyboardEvent=void 0;let n=f(2584),l={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:["'",'"']};d.evaluateKeyboardEvent=function(h,_,c,p){let o={type:0,cancel:!1,key:void 0},i=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?o.key=_?n.C0.ESC+"OA":n.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?o.key=_?n.C0.ESC+"OD":n.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?o.key=_?n.C0.ESC+"OC":n.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(o.key=_?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:o.key=h.ctrlKey?"\b":n.C0.DEL,h.altKey&&(o.key=n.C0.ESC+o.key);break;case 9:if(h.shiftKey){o.key=n.C0.ESC+"[Z";break}o.key=n.C0.HT,o.cancel=!0;break;case 13:o.key=h.altKey?n.C0.ESC+n.C0.CR:n.C0.CR,o.cancel=!0;break;case 27:o.key=n.C0.ESC,h.altKey&&(o.key=n.C0.ESC+n.C0.ESC),o.cancel=!0;break;case 37:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"D",o.key===n.C0.ESC+"[1;3D"&&(o.key=n.C0.ESC+(c?"b":"[1;5D"))):o.key=_?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"C",o.key===n.C0.ESC+"[1;3C"&&(o.key=n.C0.ESC+(c?"f":"[1;5C"))):o.key=_?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"A",c||o.key!==n.C0.ESC+"[1;3A"||(o.key=n.C0.ESC+"[1;5A")):o.key=_?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"B",c||o.key!==n.C0.ESC+"[1;3B"||(o.key=n.C0.ESC+"[1;5B")):o.key=_?n.C0.ESC+"OB":n.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(o.key=n.C0.ESC+"[2~");break;case 46:o.key=i?n.C0.ESC+"[3;"+(i+1)+"~":n.C0.ESC+"[3~";break;case 36:o.key=i?n.C0.ESC+"[1;"+(i+1)+"H":_?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:o.key=i?n.C0.ESC+"[1;"+(i+1)+"F":_?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:h.shiftKey?o.type=2:h.ctrlKey?o.key=n.C0.ESC+"[5;"+(i+1)+"~":o.key=n.C0.ESC+"[5~";break;case 34:h.shiftKey?o.type=3:h.ctrlKey?o.key=n.C0.ESC+"[6;"+(i+1)+"~":o.key=n.C0.ESC+"[6~";break;case 112:o.key=i?n.C0.ESC+"[1;"+(i+1)+"P":n.C0.ESC+"OP";break;case 113:o.key=i?n.C0.ESC+"[1;"+(i+1)+"Q":n.C0.ESC+"OQ";break;case 114:o.key=i?n.C0.ESC+"[1;"+(i+1)+"R":n.C0.ESC+"OR";break;case 115:o.key=i?n.C0.ESC+"[1;"+(i+1)+"S":n.C0.ESC+"OS";break;case 116:o.key=i?n.C0.ESC+"[15;"+(i+1)+"~":n.C0.ESC+"[15~";break;case 117:o.key=i?n.C0.ESC+"[17;"+(i+1)+"~":n.C0.ESC+"[17~";break;case 118:o.key=i?n.C0.ESC+"[18;"+(i+1)+"~":n.C0.ESC+"[18~";break;case 119:o.key=i?n.C0.ESC+"[19;"+(i+1)+"~":n.C0.ESC+"[19~";break;case 120:o.key=i?n.C0.ESC+"[20;"+(i+1)+"~":n.C0.ESC+"[20~";break;case 121:o.key=i?n.C0.ESC+"[21;"+(i+1)+"~":n.C0.ESC+"[21~";break;case 122:o.key=i?n.C0.ESC+"[23;"+(i+1)+"~":n.C0.ESC+"[23~";break;case 123:o.key=i?n.C0.ESC+"[24;"+(i+1)+"~":n.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(c&&!p||!h.altKey||h.metaKey)!c||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?o.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(o.key=n.C0.US),h.key==="@"&&(o.key=n.C0.NUL)):h.keyCode===65&&(o.type=1);else{let s=l[h.keyCode],e=s?.[h.shiftKey?1:0];if(e)o.key=n.C0.ESC+e;else if(h.keyCode>=65&&h.keyCode<=90){let t=h.ctrlKey?h.keyCode-64:h.keyCode+32,r=String.fromCharCode(t);h.shiftKey&&(r=r.toUpperCase()),o.key=n.C0.ESC+r}else if(h.keyCode===32)o.key=n.C0.ESC+(h.ctrlKey?n.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let t=h.code.slice(3,4);h.shiftKey||(t=t.toLowerCase()),o.key=n.C0.ESC+t,o.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?o.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?o.key=n.C0.NUL:h.keyCode>=51&&h.keyCode<=55?o.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?o.key=n.C0.DEL:h.keyCode===219?o.key=n.C0.ESC:h.keyCode===220?o.key=n.C0.FS:h.keyCode===221&&(o.key=n.C0.GS)}return o}},482:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Utf8ToUtf32=d.StringToUtf32=d.utf32ToString=d.stringFromCodePoint=void 0,d.stringFromCodePoint=function(f){return f>65535?(f-=65536,String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):String.fromCharCode(f)},d.utf32ToString=function(f,n=0,l=f.length){let h="";for(let _=n;_<l;++_){let c=f[_];c>65535?(c-=65536,h+=String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):h+=String.fromCharCode(c)}return h},d.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(f,n){let l=f.length;if(!l)return 0;let h=0,_=0;if(this._interim){let c=f.charCodeAt(_++);56320<=c&&c<=57343?n[h++]=1024*(this._interim-55296)+c-56320+65536:(n[h++]=this._interim,n[h++]=c),this._interim=0}for(let c=_;c<l;++c){let p=f.charCodeAt(c);if(55296<=p&&p<=56319){if(++c>=l)return this._interim=p,h;let o=f.charCodeAt(c);56320<=o&&o<=57343?n[h++]=1024*(p-55296)+o-56320+65536:(n[h++]=p,n[h++]=o)}else p!==65279&&(n[h++]=p)}return h}},d.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(f,n){let l=f.length;if(!l)return 0;let h,_,c,p,o=0,i=0,s=0;if(this.interim[0]){let r=!1,a=this.interim[0];a&=(224&a)==192?31:(240&a)==224?15:7;let u,g=0;for(;(u=63&this.interim[++g])&&g<4;)a<<=6,a|=u;let v=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=v-g;for(;s<S;){if(s>=l)return 0;if(u=f[s++],(192&u)!=128){s--,r=!0;break}this.interim[g++]=u,a<<=6,a|=63&u}r||(v===2?a<128?s--:n[o++]=a:v===3?a<2048||a>=55296&&a<=57343||a===65279||(n[o++]=a):a<65536||a>1114111||(n[o++]=a)),this.interim.fill(0)}let e=l-4,t=s;for(;t<l;){for(;!(!(t<e)||128&(h=f[t])||128&(_=f[t+1])||128&(c=f[t+2])||128&(p=f[t+3]));)n[o++]=h,n[o++]=_,n[o++]=c,n[o++]=p,t+=4;if(h=f[t++],h<128)n[o++]=h;else if((224&h)==192){if(t>=l)return this.interim[0]=h,o;if(_=f[t++],(192&_)!=128){t--;continue}if(i=(31&h)<<6|63&_,i<128){t--;continue}n[o++]=i}else if((240&h)==224){if(t>=l)return this.interim[0]=h,o;if(_=f[t++],(192&_)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=_,o;if(c=f[t++],(192&c)!=128){t--;continue}if(i=(15&h)<<12|(63&_)<<6|63&c,i<2048||i>=55296&&i<=57343||i===65279)continue;n[o++]=i}else if((248&h)==240){if(t>=l)return this.interim[0]=h,o;if(_=f[t++],(192&_)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=_,o;if(c=f[t++],(192&c)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=_,this.interim[2]=c,o;if(p=f[t++],(192&p)!=128){t--;continue}if(i=(7&h)<<18|(63&_)<<12|(63&c)<<6|63&p,i<65536||i>1114111)continue;n[o++]=i}}return o}}},225:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeV6=void 0;let n=f(1480),l=[[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]],h=[[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]],_;d.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let c=0;c<l.length;++c)_.fill(0,l[c][0],l[c][1]+1)}}wcwidth(c){return c<32?0:c<127?1:c<65536?_[c]:(function(p,o){let i,s=0,e=o.length-1;if(p<o[0][0]||p>o[e][1])return!1;for(;e>=s;)if(i=s+e>>1,p>o[i][1])s=i+1;else{if(!(p<o[i][0]))return!0;e=i-1}return!1})(c,h)?0:c>=131072&&c<=196605||c>=196608&&c<=262141?2:1}charProperties(c,p){let o=this.wcwidth(c),i=o===0&&p!==0;if(i){let s=n.UnicodeService.extractWidth(p);s===0?i=!1:s>o&&(o=s)}return n.UnicodeService.createPropertyValue(0,o,i)}}},5981:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WriteBuffer=void 0;let n=f(8460),l=f(844);class h extends l.Disposable{constructor(c){super(),this._action=c,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(c,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(c,p){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+=c.length,this._writeBuffer.push(c),this._callbacks.push(p),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(p)}_innerWrite(c=0,p=!0){let o=c||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,p);if(s){let t=r=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,r))):this._innerWrite(o,r);return void s.catch((r=>(queueMicrotask((()=>{throw r})),Promise.resolve(!1)))).then(t)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-o>=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()}}d.WriteBuffer=h},5941:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.toRgbString=d.parseColor=void 0;let f=/^([\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})$/,n=/^[\da-f]+$/;function l(h,_){let c=h.toString(16),p=c.length<2?"0"+c:c;switch(_){case 4:return c[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}d.parseColor=function(h){if(!h)return;let _=h.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let c=f.exec(_);if(c){let p=c[1]?15:c[4]?255:c[7]?4095:65535;return[Math.round(parseInt(c[1]||c[4]||c[7]||c[10],16)/p*255),Math.round(parseInt(c[2]||c[5]||c[8]||c[11],16)/p*255),Math.round(parseInt(c[3]||c[6]||c[9]||c[12],16)/p*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),n.exec(_)&&[3,6,9,12].includes(_.length))){let c=_.length/3,p=[0,0,0];for(let o=0;o<3;++o){let i=parseInt(_.slice(c*o,c*o+c),16);p[o]=c===1?i<<4:c===2?i:c===3?i>>4:i>>8}return p}},d.toRgbString=function(h,_=16){let[c,p,o]=h;return`rgb:${l(c,_)}/${l(p,_)}/${l(o,_)}`}},5770:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.PAYLOAD_LIMIT=void 0,d.PAYLOAD_LIMIT=1e7},6351:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DcsHandler=d.DcsParser=void 0;let n=f(482),l=f(8742),h=f(5770),_=[];d.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(o),{dispose:()=>{let s=i.indexOf(o);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(p,o){if(this.reset(),this._ident=p,this._active=this._handlers[p]||_,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(p,o,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,o,i);else this._handlerFb(this._ident,"PUT",(0,n.utf32ToString)(p,o,i))}unhook(p,o=!0){if(this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=o,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].unhook(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",p);this._active=_,this._ident=0}};let c=new l.Params;c.addParam(0),d.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=c,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():c,this._data="",this._hitLimit=!1}put(p,o,i){this._hitLimit||(this._data+=(0,n.utf32ToString)(p,o,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then((i=>(this._params=c,this._data="",this._hitLimit=!1,i)));return this._params=c,this._data="",this._hitLimit=!1,o}}},2015:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.EscapeSequenceParser=d.VT500_TRANSITION_TABLE=d.TransitionTable=void 0;let n=f(844),l=f(8742),h=f(6242),_=f(6351);class c{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,t,r){this.table[e<<8|s]=t<<4|r}addMany(s,e,t,r){for(let a=0;a<s.length;a++)this.table[e<<8|s[a]]=t<<4|r}}d.TransitionTable=c;let p=160;d.VT500_TRANSITION_TABLE=(function(){let i=new c(4095),s=Array.apply(null,Array(256)).map(((g,v)=>v)),e=(g,v)=>s.slice(g,v),t=e(32,127),r=e(0,24);r.push(25),r.push.apply(r,e(28,32));let a=e(0,14),u;for(u in i.setDefault(1,0),i.addMany(t,0,2,0),a)i.addMany([24,26,153,154],u,3,0),i.addMany(e(128,144),u,3,0),i.addMany(e(144,152),u,3,0),i.add(156,u,0,0),i.add(27,u,11,1),i.add(157,u,4,8),i.addMany([152,158,159],u,0,7),i.add(155,u,11,3),i.add(144,u,11,9);return i.addMany(r,0,3,0),i.addMany(r,1,3,1),i.add(127,1,0,1),i.addMany(r,8,0,8),i.addMany(r,3,3,3),i.add(127,3,0,3),i.addMany(r,4,3,4),i.add(127,4,0,4),i.addMany(r,6,3,6),i.addMany(r,5,3,5),i.add(127,5,0,5),i.addMany(r,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(t,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(t,7,0,7),i.addMany(r,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(r,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(r,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(r,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(r,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(r,13,13,13),i.addMany(t,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(p,0,2,0),i.add(p,8,5,8),i.add(p,6,0,6),i.add(p,11,0,11),i.add(p,13,13,13),i})();class o extends n.Disposable{constructor(s=d.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 l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,n.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,e=[64,126]){let t=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=s.prefix.charCodeAt(0),t&&60>t||t>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 a=0;a<s.intermediates.length;++a){let u=s.intermediates.charCodeAt(a);if(32>u||u>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=u}}if(s.final.length!==1)throw new Error("final must be a single byte");let r=s.final.charCodeAt(0);if(e[0]>r||r>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return t<<=8,t|=r,t}identToString(s){let e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){let t=this._identifier(s,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);let r=this._escHandlers[t];return r.push(e),{dispose:()=>{let a=r.indexOf(e);a!==-1&&r.splice(a,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,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){let t=this._identifier(s);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);let r=this._csiHandlers[t];return r.push(e),{dispose:()=>{let a=r.indexOf(e);a!==-1&&r.splice(a,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}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,e,t,r,a){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=r,this._parseStack.chunkPos=a}parse(s,e,t){let r,a=0,u=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let v=this._parseStack.handlers,S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&S>-1){for(;S>=0&&(r=v[S](this._params),r!==!0);S--)if(r instanceof Promise)return this._parseStack.handlerPos=S,r}this._parseStack.handlers=[];break;case 4:if(t===!1&&S>-1){for(;S>=0&&(r=v[S](),r!==!0);S--)if(r instanceof Promise)return this._parseStack.handlerPos=S,r}this._parseStack.handlers=[];break;case 6:if(a=s[this._parseStack.chunkPos],r=this._dcsParser.unhook(a!==24&&a!==26,t),r)return r;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=s[this._parseStack.chunkPos],r=this._oscParser.end(a!==24&&a!==26,t),r)return r;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let v=g;v<e;++v){switch(a=s[v],u=this._transitions.table[this.currentState<<8|(a<160?a:p)],u>>4){case 2:for(let E=v+1;;++E){if(E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}if(++E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}if(++E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}if(++E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:v,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let S=this._csiHandlers[this._collect<<8|a],y=S?S.length-1:-1;for(;y>=0&&(r=S[y](this._params),r!==!0);y--)if(r instanceof Promise)return this._preserveStack(3,S,y,u,v),r;y<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++v<e&&(a=s[v])>47&&a<60);v--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let D=this._escHandlers[this._collect<<8|a],M=D?D.length-1:-1;for(;M>=0&&(r=D[M](),r!==!0);M--)if(r instanceof Promise)return this._preserveStack(4,D,M,u,v),r;M<0&&this._escHandlerFb(this._collect<<8|a),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|a,this._params);break;case 13:for(let E=v+1;;++E)if(E>=e||(a=s[E])===24||a===26||a===27||a>127&&a<p){this._dcsParser.put(s,v,E),v=E-1;break}break;case 14:if(r=this._dcsParser.unhook(a!==24&&a!==26),r)return this._preserveStack(6,[],0,u,v),r;a===27&&(u|=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 E=v+1;;E++)if(E>=e||(a=s[E])<32||a>127&&a<p){this._oscParser.put(s,v,E),v=E-1;break}break;case 6:if(r=this._oscParser.end(a!==24&&a!==26),r)return this._preserveStack(5,[],0,u,v),r;a===27&&(u|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&u}}}d.EscapeSequenceParser=o},6242:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.OscHandler=d.OscParser=void 0;let n=f(5770),l=f(482),h=[];d.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,c){this._handlers[_]===void 0&&(this._handlers[_]=[]);let p=this._handlers[_];return p.push(c),{dispose:()=>{let o=p.indexOf(c);o!==-1&&p.splice(o,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,c,p){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(_,c,p);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(_,c,p))}start(){this.reset(),this._state=1}put(_,c,p){if(this._state!==3){if(this._state===1)for(;c<p;){let o=_[c++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&p-c>0&&this._put(_,c,p)}}end(_,c=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,o=this._active.length-1,i=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,p=c,i=this._stack.fallThrough,this._stack.paused=!1),!i&&p===!1){for(;o>=0&&(p=this._active[o].end(_),p!==!0);o--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,p;o--}for(;o>=0;o--)if(p=this._active[o].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",_);this._active=h,this._id=-1,this._state=0}}},d.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,c,p){this._hitLimit||(this._data+=(0,l.utf32ToString)(_,c,p),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let c=!1;if(this._hitLimit)c=!1;else if(_&&(c=this._handler(this._data),c instanceof Promise))return c.then((p=>(this._data="",this._hitLimit=!1,p)));return this._data="",this._hitLimit=!1,c}}},8742:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Params=void 0;let f=2147483647;class n{static fromArray(h){let _=new n;if(!h.length)return _;for(let c=Array.isArray(h[0])?1:0;c<h.length;++c){let p=h[c];if(Array.isArray(p))for(let o=0;o<p.length;++o)_.addSubParam(p[o]);else _.addParam(p)}return _}constructor(h=32,_=32){if(this.maxLength=h,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let h=new n(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){let h=[];for(let _=0;_<this.length;++_){h.push(this.params[_]);let c=this._subParamsIdx[_]>>8,p=255&this._subParamsIdx[_];p-c>0&&h.push(Array.prototype.slice.call(this._subParams,c,p))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>f?f:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>f?f:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){let _=this._subParamsIdx[h]>>8,c=255&this._subParamsIdx[h];return c-_>0?this._subParams.subarray(_,c):null}getSubParamsAll(){let h={};for(let _=0;_<this.length;++_){let c=this._subParamsIdx[_]>>8,p=255&this._subParamsIdx[_];p-c>0&&(h[_]=this._subParams.slice(c,p))}return h}addDigit(h){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let c=this._digitIsSub?this._subParams:this.params,p=c[_-1];c[_-1]=~p?Math.min(10*p+h,f):h}}d.Params=n},5741:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.AddonManager=void 0,d.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let f=this._addons.length-1;f>=0;f--)this._addons[f].instance.dispose()}loadAddon(f,n){let l={instance:n,dispose:n.dispose,isDisposed:!1};this._addons.push(l),n.dispose=()=>this._wrappedAddonDispose(l),n.activate(f)}_wrappedAddonDispose(f){if(f.isDisposed)return;let n=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===f){n=l;break}if(n===-1)throw new Error("Could not dispose an addon that has not been loaded");f.isDisposed=!0,f.dispose.apply(f.instance),this._addons.splice(n,1)}}},8771:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferApiView=void 0;let n=f(3785),l=f(511);d.BufferApiView=class{constructor(h,_){this._buffer=h,this.type=_}init(h){return this._buffer=h,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(h){let _=this._buffer.lines.get(h);if(_)return new n.BufferLineApiView(_)}getNullCell(){return new l.CellData}}},3785:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferLineApiView=void 0;let n=f(511);d.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,h){if(!(l<0||l>=this._line.length))return h?(this._line.loadCell(l,h),h):this._line.loadCell(l,new n.CellData)}translateToString(l,h,_){return this._line.translateToString(l,h,_)}}},8285:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferNamespaceApi=void 0;let n=f(8771),l=f(8460),h=f(844);class _ extends h.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new n.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new n.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)}}d.BufferNamespaceApi=_},7975:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ParserApi=void 0,d.ParserApi=class{constructor(f){this._core=f}registerCsiHandler(f,n){return this._core.registerCsiHandler(f,(l=>n(l.toArray())))}addCsiHandler(f,n){return this.registerCsiHandler(f,n)}registerDcsHandler(f,n){return this._core.registerDcsHandler(f,((l,h)=>n(l,h.toArray())))}addDcsHandler(f,n){return this.registerDcsHandler(f,n)}registerEscHandler(f,n){return this._core.registerEscHandler(f,n)}addEscHandler(f,n){return this.registerEscHandler(f,n)}registerOscHandler(f,n){return this._core.registerOscHandler(f,n)}addOscHandler(f,n){return this.registerOscHandler(f,n)}}},7090:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeApi=void 0,d.UnicodeApi=class{constructor(f){this._core=f}register(f){this._core.unicodeService.register(f)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(f){this._core.unicodeService.activeVersion=f}}},744:function(R,d,f){var n=this&&this.__decorate||function(i,s,e,t){var r,a=arguments.length,u=a<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(r=i[g])&&(u=(a<3?r(u):a>3?r(s,e,u):r(s,e))||u);return a>3&&u&&Object.defineProperty(s,e,u),u},l=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(d,"__esModule",{value:!0}),d.BufferService=d.MINIMUM_ROWS=d.MINIMUM_COLS=void 0;let h=f(8460),_=f(844),c=f(5295),p=f(2585);d.MINIMUM_COLS=2,d.MINIMUM_ROWS=1;let o=d.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,d.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,d.MINIMUM_ROWS),this.buffers=this.register(new c.BufferSet(i,this))}resize(i,s){this.cols=i,this.rows=s,this.buffers.resize(i,s),this._onResize.fire({cols:i,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,s=!1){let e=this.buffer,t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===i.fg&&t.getBg(0)===i.bg||(t=e.getBlankLine(i,s),this._cachedBlankLine=t),t.isWrapped=s;let r=e.ybase+e.scrollTop,a=e.ybase+e.scrollBottom;if(e.scrollTop===0){let u=e.lines.isFull;a===e.lines.length-1?u?e.lines.recycle().copyFrom(t):e.lines.push(t.clone()):e.lines.splice(a+1,0,t.clone()),u?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let u=a-r+1;e.lines.shiftElements(r+1,u-1,-1),e.lines.set(a,t.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,s,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let r=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),r!==t.ydisp&&(s||this._onScroll.fire(t.ydisp))}};d.BufferService=o=n([l(0,p.IOptionsService)],o)},7994:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CharsetService=void 0,d.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(f){this.glevel=f,this.charset=this._charsets[f]}setgCharset(f,n){this._charsets[f]=n,this.glevel===f&&(this.charset=n)}}},1753:function(R,d,f){var n=this&&this.__decorate||function(t,r,a,u){var g,v=arguments.length,S=v<3?r:u===null?u=Object.getOwnPropertyDescriptor(r,a):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,r,a,u);else for(var y=t.length-1;y>=0;y--)(g=t[y])&&(S=(v<3?g(S):v>3?g(r,a,S):g(r,a))||S);return v>3&&S&&Object.defineProperty(r,a,S),S},l=this&&this.__param||function(t,r){return function(a,u){r(a,u,t)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CoreMouseService=void 0;let h=f(2585),_=f(8460),c=f(844),p={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function o(t,r){let a=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(a|=64,a|=t.action):(a|=3&t.button,4&t.button&&(a|=64),8&t.button&&(a|=128),t.action===32?a|=32:t.action!==0||r||(a|=3)),a}let i=String.fromCharCode,s={DEFAULT:t=>{let r=[o(t,!1)+32,t.col+32,t.row+32];return r[0]>255||r[1]>255||r[2]>255?"":`\x1B[M${i(r[0])}${i(r[1])}${i(r[2])}`},SGR:t=>{let r=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${o(t,!0)};${t.col};${t.row}${r}`},SGR_PIXELS:t=>{let r=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${o(t,!0)};${t.x};${t.y}${r}`}},e=d.CoreMouseService=class extends c.Disposable{constructor(t,r){super(),this._bufferService=t,this._coreService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(p))this.addProtocol(a,p[a]);for(let a of Object.keys(s))this.addEncoding(a,s[a]);this.reset()}addProtocol(t,r){this._protocols[t]=r}addEncoding(t,r){this._encodings[t]=r}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let r=this._encodings[this._activeEncoding](t);return r&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(r):this._coreService.triggerDataEvent(r,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,r,a){if(a){if(t.x!==r.x||t.y!==r.y)return!1}else if(t.col!==r.col||t.row!==r.row)return!1;return t.button===r.button&&t.action===r.action&&t.ctrl===r.ctrl&&t.alt===r.alt&&t.shift===r.shift}};d.CoreMouseService=e=n([l(0,h.IBufferService),l(1,h.ICoreService)],e)},6975:function(R,d,f){var n=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CoreService=void 0;let h=f(1439),_=f(8460),c=f(844),p=f(2585),o=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=d.CoreService=class extends c.Disposable{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(o),this.decPrivateModes=(0,h.clone)(i)}reset(){this.modes=(0,h.clone)(o),this.decPrivateModes=(0,h.clone)(i)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((a=>a.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((t=>t.charCodeAt(0))))),this._onBinary.fire(e))}};d.CoreService=s=n([l(0,p.IBufferService),l(1,p.ILogService),l(2,p.IOptionsService)],s)},9074:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DecorationService=void 0;let n=f(8055),l=f(8460),h=f(844),_=f(6106),c=0,p=0;class o extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new i(e);if(t){let r=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let a=0,u=0;for(let g of this._decorations.getKeyIterator(t))a=g.options.x??0,u=a+(g.options.width??1),e>=a&&e<u&&(!r||(g.options.layer??"bottom")===r)&&(yield g)}forEachDecorationAtCell(e,t,r,a){this._decorations.forEachByKey(t,(u=>{c=u.options.x??0,p=c+(u.options.width??1),e>=c&&e<p&&(!r||(u.options.layer??"bottom")===r)&&a(u)}))}}d.DecorationService=o;class i extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=n.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=n.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.InstantiationService=d.ServiceCollection=void 0;let n=f(2585),l=f(8343);class h{constructor(...c){this._entries=new Map;for(let[p,o]of c)this.set(p,o)}set(c,p){let o=this._entries.get(c);return this._entries.set(c,p),o}forEach(c){for(let[p,o]of this._entries.entries())c(p,o)}has(c){return this._entries.has(c)}get(c){return this._entries.get(c)}}d.ServiceCollection=h,d.InstantiationService=class{constructor(){this._services=new h,this._services.set(n.IInstantiationService,this)}setService(_,c){this._services.set(_,c)}getService(_){return this._services.get(_)}createInstance(_,...c){let p=(0,l.getServiceDependencies)(_).sort(((s,e)=>s.index-e.index)),o=[];for(let s of p){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${s.id}.`);o.push(e)}let i=p.length>0?p[0].index:c.length;if(c.length!==i)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${i+1} conflicts with ${c.length} static arguments`);return new _(...c,...o)}}},7866:function(R,d,f){var n=this&&this.__decorate||function(i,s,e,t){var r,a=arguments.length,u=a<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(r=i[g])&&(u=(a<3?r(u):a>3?r(s,e,u):r(s,e))||u);return a>3&&u&&Object.defineProperty(s,e,u),u},l=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(d,"__esModule",{value:!0}),d.traceCall=d.setTraceLogger=d.LogService=void 0;let h=f(844),_=f(2585),c={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},p,o=d.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),p=this}_updateLogLevel(){this._logLevel=c[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let s=0;s<i.length;s++)typeof i[s]=="function"&&(i[s]=i[s]())}_log(i,s,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(i,...s){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,s)}debug(i,...s){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,s)}info(i,...s){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,s)}warn(i,...s){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,s)}error(i,...s){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,s)}};d.LogService=o=n([l(0,_.IOptionsService)],o),d.setTraceLogger=function(i){p=i},d.traceCall=function(i,s,e){if(typeof e.value!="function")throw new Error("not supported");let t=e.value;e.value=function(...r){if(p.logLevel!==_.LogLevelEnum.TRACE)return t.apply(this,r);p.trace(`GlyphRenderer#${t.name}(${r.map((u=>JSON.stringify(u))).join(", ")})`);let a=t.apply(this,r);return p.trace(`GlyphRenderer#${t.name} return`,a),a}}},7302:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.OptionsService=d.DEFAULT_OPTIONS=void 0;let n=f(8460),l=f(844),h=f(6114);d.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:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class c extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new n.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...d.DEFAULT_OPTIONS};for(let s in o)if(s in i)try{let e=o[s];i[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,l.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(o,i){return this.onOptionChange((s=>{s===o&&i(this.rawOptions[o])}))}onMultipleOptionChange(o,i){return this.onOptionChange((s=>{o.indexOf(s)!==-1&&i()}))}_setupOptions(){let o=s=>{if(!(s in d.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,e)=>{if(!(s in d.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let e={get:o.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(o,i){switch(o){case"cursorStyle":if(i||(i=d.DEFAULT_OPTIONS[o]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${o}`);break;case"wordSeparator":i||(i=d.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=_.includes(i)?i:d.DEFAULT_OPTIONS[o];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${o} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${o} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}d.OptionsService=c},2660:function(R,d,f){var n=this&&this.__decorate||function(c,p,o,i){var s,e=arguments.length,t=e<3?p:i===null?i=Object.getOwnPropertyDescriptor(p,o):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(c,p,o,i);else for(var r=c.length-1;r>=0;r--)(s=c[r])&&(t=(e<3?s(t):e>3?s(p,o,t):s(p,o))||t);return e>3&&t&&Object.defineProperty(p,o,t),t},l=this&&this.__param||function(c,p){return function(o,i){p(o,i,c)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OscLinkService=void 0;let h=f(2585),_=d.OscLinkService=class{constructor(c){this._bufferService=c,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(c){let p=this._bufferService.buffer;if(c.id===void 0){let r=p.addMarker(p.ybase+p.y),a={data:c,id:this._nextId++,lines:[r]};return r.onDispose((()=>this._removeMarkerFromLink(a,r))),this._dataByLinkId.set(a.id,a),a.id}let o=c,i=this._getEntryIdKey(o),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,p.ybase+p.y),s.id;let e=p.addMarker(p.ybase+p.y),t={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(t,e))),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(c,p){let o=this._dataByLinkId.get(c);if(o&&o.lines.every((i=>i.line!==p))){let i=this._bufferService.buffer.addMarker(p);o.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(o,i)))}}getLinkData(c){return this._dataByLinkId.get(c)?.data}_getEntryIdKey(c){return`${c.id};;${c.uri}`}_removeMarkerFromLink(c,p){let o=c.lines.indexOf(p);o!==-1&&(c.lines.splice(o,1),c.lines.length===0&&(c.data.id!==void 0&&this._entriesWithId.delete(c.key),this._dataByLinkId.delete(c.id)))}};d.OscLinkService=_=n([l(0,h.IBufferService)],_)},8343:(R,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.createDecorator=d.getServiceDependencies=d.serviceRegistry=void 0;let f="di$target",n="di$dependencies";d.serviceRegistry=new Map,d.getServiceDependencies=function(l){return l[n]||[]},d.createDecorator=function(l){if(d.serviceRegistry.has(l))return d.serviceRegistry.get(l);let h=function(_,c,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,i,s){i[f]===i?i[n].push({id:o,index:s}):(i[n]=[{id:o,index:s}],i[f]=i)})(h,_,p)};return h.toString=()=>l,d.serviceRegistry.set(l,h),h}},2585:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.IDecorationService=d.IUnicodeService=d.IOscLinkService=d.IOptionsService=d.ILogService=d.LogLevelEnum=d.IInstantiationService=d.ICharsetService=d.ICoreService=d.ICoreMouseService=d.IBufferService=void 0;let n=f(8343);var l;d.IBufferService=(0,n.createDecorator)("BufferService"),d.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),d.ICoreService=(0,n.createDecorator)("CoreService"),d.ICharsetService=(0,n.createDecorator)("CharsetService"),d.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(l||(d.LogLevelEnum=l={})),d.ILogService=(0,n.createDecorator)("LogService"),d.IOptionsService=(0,n.createDecorator)("OptionsService"),d.IOscLinkService=(0,n.createDecorator)("OscLinkService"),d.IUnicodeService=(0,n.createDecorator)("UnicodeService"),d.IDecorationService=(0,n.createDecorator)("DecorationService")},1480:(R,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeService=void 0;let n=f(8460),l=f(225);class h{static extractShouldJoin(c){return(1&c)!=0}static extractWidth(c){return c>>1&3}static extractCharKind(c){return c>>3}static createPropertyValue(c,p,o=!1){return(16777215&c)<<3|(3&p)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter,this.onChange=this._onChange.event;let c=new l.UnicodeV6;this.register(c),this._active=c.version,this._activeProvider=c}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(c){if(!this._providers[c])throw new Error(`unknown Unicode version "${c}"`);this._active=c,this._activeProvider=this._providers[c],this._onChange.fire(c)}register(c){this._providers[c.version]=c}wcwidth(c){return this._activeProvider.wcwidth(c)}getStringCellWidth(c){let p=0,o=0,i=c.length;for(let s=0;s<i;++s){let e=c.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=i)return p+this.wcwidth(e);let a=c.charCodeAt(s);56320<=a&&a<=57343?e=1024*(e-55296)+a-56320+65536:p+=this.wcwidth(a)}let t=this.charProperties(e,o),r=h.extractWidth(t);h.extractShouldJoin(t)&&(r-=h.extractWidth(o)),p+=r,o=t}return p}charProperties(c,p){return this._activeProvider.charProperties(c,p)}}d.UnicodeService=h}},I={};function U(R){var d=I[R];if(d!==void 0)return d.exports;var f=I[R]={exports:{}};return T[R].call(f.exports,f,f.exports,U),f.exports}var z={};return(()=>{var R=z;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;let d=U(9042),f=U(3236),n=U(844),l=U(5741),h=U(8285),_=U(7975),c=U(7090),p=["cols","rows"];class o extends n.Disposable{constructor(s){super(),this._core=this.register(new f.Terminal(s)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],t=(r,a)=>{this._checkReadonlyOptions(r),this._core.options[r]=a};for(let r in this._core.options){let a={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this._publicOptions,r,a)}}_checkReadonlyOptions(s){if(p.includes(s))throw new Error(`Option "${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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.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 h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let s=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(let e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(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){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,t){this._verifyIntegers(s,e,t),this._core.select(s,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}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,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r
9
+ `,e)}paste(s){this._core.paste(s)}refresh(s,e){this._verifyIntegers(s,e),this._core.refresh(s,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return d}_verifyIntegers(...s){for(let e of s)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(let e of s)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}R.Terminal=o})(),z})()))});var at=it(ot=>{(()=>{"use strict";var T={349:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;let h=l(460),_=l(844);class c extends _.Disposable{constructor(o){super(),this._maxLength=o,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.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(o){if(this._maxLength===o)return;let i=new Array(o);for(let s=0;s<Math.min(o,this.length);s++)i[s]=this._array[this._getCyclicIndex(s)];this._array=i,this._maxLength=o,this._startIndex=0}get length(){return this._length}set length(o){if(o>this._length)for(let i=this._length;i<o;i++)this._array[i]=void 0;this._length=o}get(o){return this._array[this._getCyclicIndex(o)]}set(o,i){this._array[this._getCyclicIndex(o)]=i}push(o){this._array[this._getCyclicIndex(this._length)]=o,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(o,i,...s){if(i){for(let e=o;e<this._length-i;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+i)];this._length-=i,this.onDeleteEmitter.fire({index:o,amount:i})}for(let e=this._length-1;e>=o;e--)this._array[this._getCyclicIndex(e+s.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<s.length;e++)this._array[this._getCyclicIndex(o+e)]=s[e];if(s.length&&this.onInsertEmitter.fire({index:o,amount:s.length}),this._length+s.length>this._maxLength){let e=this._length+s.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=s.length}trimStart(o){o>this._length&&(o=this._length),this._startIndex+=o,this._length-=o,this.onTrimEmitter.fire(o)}shiftElements(o,i,s){if(!(i<=0)){if(o<0||o>=this._length)throw new Error("start argument out of range");if(o+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let t=i-1;t>=0;t--)this.set(o+t+s,this.get(o+t));let e=o+i+s-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<i;e++)this.set(o+e+s,this.get(o+e))}}_getCyclicIndex(o){return(this._startIndex+o)%this._maxLength}}n.CircularList=c},439:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function l(h,_=5){if(typeof h!="object")return h;let c=Array.isArray(h)?[]:{};for(let p in h)c[p]=_<=1?h[p]:h[p]&&l(h[p],_-1);return c}},969:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;let h=l(844),_=l(585),c=l(348),p=l(866),o=l(744),i=l(302),s=l(83),e=l(460),t=l(753),r=l(480),a=l(994),u=l(282),g=l(435),v=l(981),S=l(660),y=!1;class D extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((E=>{this._onScrollApi?.fire(E.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(E){for(let x in E)this.optionsService.options[x]=E[x]}constructor(E){super(),this._windowsWrappingHeuristics=this.register(new h.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 c.InstantiationService,this.optionsService=this.register(new i.OptionsService(E)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(o.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(s.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(a.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.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((x=>{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((x=>{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 v.WriteBuffer(((x,O)=>this._inputHandler.parse(x,O)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,x){this._writeBuffer.write(E,x)}writeSync(E,x){this._logService.logLevel<=_.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(E,x)}input(E,x=!0){this.coreService.triggerDataEvent(E,x)}resize(E,x){isNaN(E)||isNaN(x)||(E=Math.max(E,o.MINIMUM_COLS),x=Math.max(x,o.MINIMUM_ROWS),this._bufferService.resize(E,x))}scroll(E,x=!1){this._bufferService.scroll(E,x)}scrollLines(E,x,O){this._bufferService.scrollLines(E,x,O)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){let x=E-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)}registerEscHandler(E,x){return this._inputHandler.registerEscHandler(E,x)}registerDcsHandler(E,x){return this._inputHandler.registerDcsHandler(E,x)}registerCsiHandler(E,x){return this._inputHandler.registerCsiHandler(E,x)}registerOscHandler(E,x){return this._inputHandler.registerOscHandler(E,x)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1,x=this.optionsService.rawOptions.windowsPty;x&&x.buildNumber!==void 0&&x.buildNumber!==void 0?E=x.backend==="conpty"&&x.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let E=[];E.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},(()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(let x of E)x.dispose()}))}}}n.CoreTerminal=D},460:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let _=0;_<this._listeners.length;_++)if(this._listeners[_]===l)return void this._listeners.splice(_,1)}}})),this._event}fire(l,h){let _=[];for(let c=0;c<this._listeners.length;c++)_.push(this._listeners[c]);for(let c=0;c<_.length;c++)_[c].call(void 0,l,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(l,h){return l((_=>h.fire(_)))},n.runAndSubscribe=function(l,h){return h(void 0),l((_=>h(_)))}},435:function(f,n,l){var h=this&&this.__decorate||function(B,m,b,k){var A,W=arguments.length,j=W<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(B,m,b,k);else for(var P=B.length-1;P>=0;P--)(A=B[P])&&(j=(W<3?A(j):W>3?A(m,b,j):A(m,b))||j);return W>3&&j&&Object.defineProperty(m,b,j),j},_=this&&this.__param||function(B,m){return function(b,k){m(b,k,B)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;let c=l(584),p=l(116),o=l(15),i=l(844),s=l(482),e=l(437),t=l(460),r=l(643),a=l(511),u=l(734),g=l(585),v=l(480),S=l(242),y=l(351),D=l(941),M={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=131072;function x(B,m){if(B>24)return m.setWinLines||!1;switch(B){case 1:return!!m.restoreWin;case 2:return!!m.minimizeWin;case 3:return!!m.setWinPosition;case 4:return!!m.setWinSizePixels;case 5:return!!m.raiseWin;case 6:return!!m.lowerWin;case 7:return!!m.refreshWin;case 8:return!!m.setWinSizeChars;case 9:return!!m.maximizeWin;case 10:return!!m.fullscreenWin;case 11:return!!m.getWinState;case 13:return!!m.getWinPosition;case 14:return!!m.getWinSizePixels;case 15:return!!m.getScreenSizePixels;case 16:return!!m.getCellSizePixels;case 18:return!!m.getWinSizeChars;case 19:return!!m.getScreenSizeChars;case 20:return!!m.getIconTitle;case 21:return!!m.getWinTitle;case 22:return!!m.pushTitle;case 23:return!!m.popTitle;case 24:return!!m.setWinLines}return!1}var O;(function(B){B[B.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",B[B.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(O||(n.WindowsOptionsReportType=O={}));let q=0;class K extends i.Disposable{getAttrData(){return this._curAttrData}constructor(m,b,k,A,W,j,P,w,F=new o.EscapeSequenceParser){super(),this._bufferService=m,this._charsetService=b,this._coreService=k,this._logService=A,this._optionsService=W,this._oscLinkService=j,this._coreMouseService=P,this._unicodeService=w,this._parser=F,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new s.StringToUtf32,this._utf8Decoder=new s.Utf8ToUtf32,this._workCell=new a.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 t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.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 N(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._parser.setCsiHandlerFallback(((L,$)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:$.toArray()})})),this._parser.setEscHandlerFallback((L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})})),this._parser.setExecuteHandlerFallback((L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})})),this._parser.setOscHandlerFallback(((L,$,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:$,data:H})})),this._parser.setDcsHandlerFallback(((L,$,H)=>{$==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:$,payload:H})})),this._parser.setPrintHandler(((L,$,H)=>this.print(L,$,H))),this._parser.registerCsiHandler({final:"@"},(L=>this.insertChars(L))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(L=>this.scrollLeft(L))),this._parser.registerCsiHandler({final:"A"},(L=>this.cursorUp(L))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(L=>this.scrollRight(L))),this._parser.registerCsiHandler({final:"B"},(L=>this.cursorDown(L))),this._parser.registerCsiHandler({final:"C"},(L=>this.cursorForward(L))),this._parser.registerCsiHandler({final:"D"},(L=>this.cursorBackward(L))),this._parser.registerCsiHandler({final:"E"},(L=>this.cursorNextLine(L))),this._parser.registerCsiHandler({final:"F"},(L=>this.cursorPrecedingLine(L))),this._parser.registerCsiHandler({final:"G"},(L=>this.cursorCharAbsolute(L))),this._parser.registerCsiHandler({final:"H"},(L=>this.cursorPosition(L))),this._parser.registerCsiHandler({final:"I"},(L=>this.cursorForwardTab(L))),this._parser.registerCsiHandler({final:"J"},(L=>this.eraseInDisplay(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(L=>this.eraseInDisplay(L,!0))),this._parser.registerCsiHandler({final:"K"},(L=>this.eraseInLine(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(L=>this.eraseInLine(L,!0))),this._parser.registerCsiHandler({final:"L"},(L=>this.insertLines(L))),this._parser.registerCsiHandler({final:"M"},(L=>this.deleteLines(L))),this._parser.registerCsiHandler({final:"P"},(L=>this.deleteChars(L))),this._parser.registerCsiHandler({final:"S"},(L=>this.scrollUp(L))),this._parser.registerCsiHandler({final:"T"},(L=>this.scrollDown(L))),this._parser.registerCsiHandler({final:"X"},(L=>this.eraseChars(L))),this._parser.registerCsiHandler({final:"Z"},(L=>this.cursorBackwardTab(L))),this._parser.registerCsiHandler({final:"`"},(L=>this.charPosAbsolute(L))),this._parser.registerCsiHandler({final:"a"},(L=>this.hPositionRelative(L))),this._parser.registerCsiHandler({final:"b"},(L=>this.repeatPrecedingCharacter(L))),this._parser.registerCsiHandler({final:"c"},(L=>this.sendDeviceAttributesPrimary(L))),this._parser.registerCsiHandler({prefix:">",final:"c"},(L=>this.sendDeviceAttributesSecondary(L))),this._parser.registerCsiHandler({final:"d"},(L=>this.linePosAbsolute(L))),this._parser.registerCsiHandler({final:"e"},(L=>this.vPositionRelative(L))),this._parser.registerCsiHandler({final:"f"},(L=>this.hVPosition(L))),this._parser.registerCsiHandler({final:"g"},(L=>this.tabClear(L))),this._parser.registerCsiHandler({final:"h"},(L=>this.setMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(L=>this.setModePrivate(L))),this._parser.registerCsiHandler({final:"l"},(L=>this.resetMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(L=>this.resetModePrivate(L))),this._parser.registerCsiHandler({final:"m"},(L=>this.charAttributes(L))),this._parser.registerCsiHandler({final:"n"},(L=>this.deviceStatus(L))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(L=>this.deviceStatusPrivate(L))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(L=>this.softReset(L))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(L=>this.setCursorStyle(L))),this._parser.registerCsiHandler({final:"r"},(L=>this.setScrollRegion(L))),this._parser.registerCsiHandler({final:"s"},(L=>this.saveCursor(L))),this._parser.registerCsiHandler({final:"t"},(L=>this.windowOptions(L))),this._parser.registerCsiHandler({final:"u"},(L=>this.restoreCursor(L))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(L=>this.insertColumns(L))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(L=>this.deleteColumns(L))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(L=>this.selectProtected(L))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(L=>this.requestMode(L,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(L=>this.requestMode(L,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new S.OscHandler((L=>(this.setTitle(L),this.setIconName(L),!0)))),this._parser.registerOscHandler(1,new S.OscHandler((L=>this.setIconName(L)))),this._parser.registerOscHandler(2,new S.OscHandler((L=>this.setTitle(L)))),this._parser.registerOscHandler(4,new S.OscHandler((L=>this.setOrReportIndexedColor(L)))),this._parser.registerOscHandler(8,new S.OscHandler((L=>this.setHyperlink(L)))),this._parser.registerOscHandler(10,new S.OscHandler((L=>this.setOrReportFgColor(L)))),this._parser.registerOscHandler(11,new S.OscHandler((L=>this.setOrReportBgColor(L)))),this._parser.registerOscHandler(12,new S.OscHandler((L=>this.setOrReportCursorColor(L)))),this._parser.registerOscHandler(104,new S.OscHandler((L=>this.restoreIndexedColor(L)))),this._parser.registerOscHandler(110,new S.OscHandler((L=>this.restoreFgColor(L)))),this._parser.registerOscHandler(111,new S.OscHandler((L=>this.restoreBgColor(L)))),this._parser.registerOscHandler(112,new S.OscHandler((L=>this.restoreCursorColor(L)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let L in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},(()=>this.selectCharset("("+L))),this._parser.registerEscHandler({intermediates:")",final:L},(()=>this.selectCharset(")"+L))),this._parser.registerEscHandler({intermediates:"*",final:L},(()=>this.selectCharset("*"+L))),this._parser.registerEscHandler({intermediates:"+",final:L},(()=>this.selectCharset("+"+L))),this._parser.registerEscHandler({intermediates:"-",final:L},(()=>this.selectCharset("-"+L))),this._parser.registerEscHandler({intermediates:".",final:L},(()=>this.selectCharset("."+L))),this._parser.registerEscHandler({intermediates:"/",final:L},(()=>this.selectCharset("/"+L)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((L=>(this._logService.error("Parsing error: ",L),L))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new y.DcsHandler(((L,$)=>this.requestStatusString(L,$))))}_preserveStack(m,b,k,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=m,this._parseStack.cursorStartY=b,this._parseStack.decodedLength=k,this._parseStack.position=A}_logSlowResolvingAsync(m){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([m,new Promise(((b,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((b=>{if(b!=="#SLOW_TIMEOUT")throw b;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(m,b){let k,A=this._activeBuffer.x,W=this._activeBuffer.y,j=0,P=this._parseStack.paused;if(P){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,b))return this._logSlowResolvingAsync(k),k;A=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,m.length>E&&(j=this._parseStack.position+E)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof m=="string"?` "${m}"`:` "${Array.prototype.map.call(m,(L=>String.fromCharCode(L))).join("")}"`),typeof m=="string"?m.split("").map((L=>L.charCodeAt(0))):m),this._parseBuffer.length<m.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(m.length,E))),P||this._dirtyRowTracker.clearRange(),m.length>E)for(let L=j;L<m.length;L+=E){let $=L+E<m.length?L+E:m.length,H=typeof m=="string"?this._stringDecoder.decode(m.substring(L,$),this._parseBuffer):this._utf8Decoder.decode(m.subarray(L,$),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,H))return this._preserveStack(A,W,H,L),this._logSlowResolvingAsync(k),k}else if(!P){let L=typeof m=="string"?this._stringDecoder.decode(m,this._parseBuffer):this._utf8Decoder.decode(m,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,L))return this._preserveStack(A,W,L,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===A&&this._activeBuffer.y===W||this._onCursorMove.fire();let w=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),F=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);F<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(F,this._bufferService.rows-1),Math.min(w,this._bufferService.rows-1))}print(m,b,k){let A,W,j=this._charsetService.charset,P=this._optionsService.rawOptions.screenReaderMode,w=this._bufferService.cols,F=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,$=this._curAttrData,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-b>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$);let V=this._parser.precedingJoinState;for(let X=b;X<k;++X){if(A=m[X],A<127&&j){let ie=j[String.fromCharCode(A)];ie&&(A=ie.charCodeAt(0))}let J=this._unicodeService.charProperties(A,V);W=v.UnicodeService.extractWidth(J);let ee=v.UnicodeService.extractShouldJoin(J),G=ee?v.UnicodeService.extractWidth(V):0;if(V=J,P&&this._onA11yChar.fire((0,s.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-G>w){if(F){let ie=H,he=this._activeBuffer.x-G;for(this._activeBuffer.x=G,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),G>0&&H instanceof e.BufferLine&&H.copyCellsFrom(ie,he,0,G,!1);he<w;)ie.setCellFromCodepoint(he++,0,1,$)}else if(this._activeBuffer.x=w-1,W===2)continue}if(ee&&this._activeBuffer.x){let ie=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ie,A,W);for(let he=W-G;--he>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}else if(L&&(H.insertCells(this._activeBuffer.x,W-G,this._activeBuffer.getNullCell($)),H.getWidth(w-1)===2&&H.setCellFromCodepoint(w-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,$)),H.setCellFromCodepoint(this._activeBuffer.x++,A,W,$),W>0)for(;--W;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}this._parser.precedingJoinState=V,this._activeBuffer.x<w&&k-b>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,$),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(m,b){return m.final!=="t"||m.prefix||m.intermediates?this._parser.registerCsiHandler(m,b):this._parser.registerCsiHandler(m,(k=>!x(k.params[0],this._optionsService.rawOptions.windowOptions)||b(k)))}registerDcsHandler(m,b){return this._parser.registerDcsHandler(m,new y.DcsHandler(b))}registerEscHandler(m,b){return this._parser.registerEscHandler(m,b)}registerOscHandler(m,b){return this._parser.registerOscHandler(m,new S.OscHandler(b))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);m.hasWidth(this._activeBuffer.x)&&!m.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let m=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-m),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(m=this._bufferService.cols-1){this._activeBuffer.x=Math.min(m,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(m,b){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=m,this._activeBuffer.y=this._activeBuffer.scrollTop+b):(this._activeBuffer.x=m,this._activeBuffer.y=b),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(m,b){this._restrictCursor(),this._setCursor(this._activeBuffer.x+m,this._activeBuffer.y+b)}cursorUp(m){let b=this._activeBuffer.y-this._activeBuffer.scrollTop;return b>=0?this._moveCursor(0,-Math.min(b,m.params[0]||1)):this._moveCursor(0,-(m.params[0]||1)),!0}cursorDown(m){let b=this._activeBuffer.scrollBottom-this._activeBuffer.y;return b>=0?this._moveCursor(0,Math.min(b,m.params[0]||1)):this._moveCursor(0,m.params[0]||1),!0}cursorForward(m){return this._moveCursor(m.params[0]||1,0),!0}cursorBackward(m){return this._moveCursor(-(m.params[0]||1),0),!0}cursorNextLine(m){return this.cursorDown(m),this._activeBuffer.x=0,!0}cursorPrecedingLine(m){return this.cursorUp(m),this._activeBuffer.x=0,!0}cursorCharAbsolute(m){return this._setCursor((m.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(m){return this._setCursor(m.length>=2?(m.params[1]||1)-1:0,(m.params[0]||1)-1),!0}charPosAbsolute(m){return this._setCursor((m.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(m){return this._moveCursor(m.params[0]||1,0),!0}linePosAbsolute(m){return this._setCursor(this._activeBuffer.x,(m.params[0]||1)-1),!0}vPositionRelative(m){return this._moveCursor(0,m.params[0]||1),!0}hVPosition(m){return this.cursorPosition(m),!0}tabClear(m){let b=m.params[0];return b===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:b===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(m){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=m.params[0]||1;for(;b--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(m){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=m.params[0]||1;for(;b--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(m){let b=m.params[0];return b===1&&(this._curAttrData.bg|=536870912),b!==2&&b!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(m,b,k,A=!1,W=!1){let j=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);j.replaceCells(b,k,this._activeBuffer.getNullCell(this._eraseAttrData()),W),A&&(j.isWrapped=!1)}_resetBufferLine(m,b=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),b),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+m),k.isWrapped=!1)}eraseInDisplay(m,b=!1){let k;switch(this._restrictCursor(this._bufferService.cols),m.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,b);k<this._bufferService.rows;k++)this._resetBufferLine(k,b);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,b),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,b);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,b);this._dirtyRowTracker.markDirty(0);break;case 3:let A=this._activeBuffer.lines.length-this._bufferService.rows;A>0&&(this._activeBuffer.lines.trimStart(A),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-A,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-A,0),this._onScroll.fire(0))}return!0}eraseInLine(m,b=!1){switch(this._restrictCursor(this._bufferService.cols),m.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,b);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,b);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,b)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(m){this._restrictCursor();let b=m.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;b--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(m){this._restrictCursor();let b=m.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A;for(A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-A;b--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(m){this._restrictCursor();let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return b&&(b.insertCells(this._activeBuffer.x,m.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(m){this._restrictCursor();let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return b&&(b.deleteCells(this._activeBuffer.x,m.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(m){let b=m.params[0]||1;for(;b--;)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(m){let b=m.params[0]||1;for(;b--;)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(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(0,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(0,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(this._activeBuffer.x,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(this._activeBuffer.x,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(m){this._restrictCursor();let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return b&&(b.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(m.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(m){let b=this._parser.precedingJoinState;if(!b)return!0;let k=m.params[0]||1,A=v.UnicodeService.extractWidth(b),W=this._activeBuffer.x-A,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),P=new Uint32Array(j.length*k),w=0;for(let L=0;L<j.length;){let $=j.codePointAt(L)||0;P[w++]=$,L+=$>65535?2:1}let F=w;for(let L=1;L<k;++L)P.copyWithin(F,0,w),F+=w;return this.print(P,0,F),!0}sendDeviceAttributesPrimary(m){return m.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(m){return m.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(m.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(m){return(this._optionsService.rawOptions.termName+"").indexOf(m)===0}setMode(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(m){for(let b=0;b<m.length;b++)switch(m.params[b]){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(),m.params[b]===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(m,b){let k=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:W}=this._coreMouseService,j=this._coreService,{buffers:P,cols:w}=this._bufferService,{active:F,alt:L}=P,$=this._optionsService.rawOptions,H=ee=>ee?1:2,V=m.params[0];return X=V,J=b?V===2?4:V===4?H(j.modes.insertMode):V===12?3:V===20?H($.convertEol):0:V===1?H(k.applicationCursorKeys):V===3?$.windowOptions.setWinLines?w===80?2:w===132?1:0:0:V===6?H(k.origin):V===7?H(k.wraparound):V===8?3:V===9?H(A==="X10"):V===12?H($.cursorBlink):V===25?H(!j.isCursorHidden):V===45?H(k.reverseWraparound):V===66?H(k.applicationKeypad):V===67?4:V===1e3?H(A==="VT200"):V===1002?H(A==="DRAG"):V===1003?H(A==="ANY"):V===1004?H(k.sendFocus):V===1005?4:V===1006?H(W==="SGR"):V===1015?4:V===1016?H(W==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?H(F===L):V===2004?H(k.bracketedPasteMode):0,j.triggerDataEvent(`${c.C0.ESC}[${b?"":"?"}${X};${J}$y`),!0;var X,J}_updateAttrColor(m,b,k,A,W){return b===2?(m|=50331648,m&=-16777216,m|=u.AttributeData.fromColorRGB([k,A,W])):b===5&&(m&=-50331904,m|=33554432|255&k),m}_extractColor(m,b,k){let A=[0,0,-1,0,0,0],W=0,j=0;do{if(A[j+W]=m.params[b+j],m.hasSubParams(b+j)){let P=m.getSubParams(b+j),w=0;do A[1]===5&&(W=1),A[j+w+1+W]=P[w];while(++w<P.length&&w+j+1+W<A.length);break}if(A[1]===5&&j+W>=2||A[1]===2&&j+W>=5)break;A[1]&&(W=1)}while(++j+b<m.length&&j+W<A.length);for(let P=2;P<A.length;++P)A[P]===-1&&(A[P]=0);switch(A[0]){case 38:k.fg=this._updateAttrColor(k.fg,A[1],A[3],A[4],A[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,A[1],A[3],A[4],A[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,A[1],A[3],A[4],A[5])}return j}_processUnderline(m,b){b.extended=b.extended.clone(),(!~m||m>5)&&(m=1),b.extended.underlineStyle=m,b.fg|=268435456,m===0&&(b.fg&=-268435457),b.updateExtended()}_processSGR0(m){m.fg=e.DEFAULT_ATTR_DATA.fg,m.bg=e.DEFAULT_ATTR_DATA.bg,m.extended=m.extended.clone(),m.extended.underlineStyle=0,m.extended.underlineColor&=-67108864,m.updateExtended()}charAttributes(m){if(m.length===1&&m.params[0]===0)return this._processSGR0(this._curAttrData),!0;let b=m.length,k,A=this._curAttrData;for(let W=0;W<b;W++)k=m.params[W],k>=30&&k<=37?(A.fg&=-50331904,A.fg|=16777216|k-30):k>=40&&k<=47?(A.bg&=-50331904,A.bg|=16777216|k-40):k>=90&&k<=97?(A.fg&=-50331904,A.fg|=16777224|k-90):k>=100&&k<=107?(A.bg&=-50331904,A.bg|=16777224|k-100):k===0?this._processSGR0(A):k===1?A.fg|=134217728:k===3?A.bg|=67108864:k===4?(A.fg|=268435456,this._processUnderline(m.hasSubParams(W)?m.getSubParams(W)[0]:1,A)):k===5?A.fg|=536870912:k===7?A.fg|=67108864:k===8?A.fg|=1073741824:k===9?A.fg|=2147483648:k===2?A.bg|=134217728:k===21?this._processUnderline(2,A):k===22?(A.fg&=-134217729,A.bg&=-134217729):k===23?A.bg&=-67108865:k===24?(A.fg&=-268435457,this._processUnderline(0,A)):k===25?A.fg&=-536870913:k===27?A.fg&=-67108865:k===28?A.fg&=-1073741825:k===29?A.fg&=2147483647:k===39?(A.fg&=-67108864,A.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):k===49?(A.bg&=-67108864,A.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?W+=this._extractColor(m,W,A):k===53?A.bg|=1073741824:k===55?A.bg&=-1073741825:k===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):k===100?(A.fg&=-67108864,A.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(m){switch(m.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:let b=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${b};${k}R`)}return!0}deviceStatusPrivate(m){if(m.params[0]===6){let b=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${b};${k}R`)}return!0}softReset(m){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(m){let b=m.params[0]||1;switch(b){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let k=b%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(m){let b=m.params[0]||1,k;return(m.length<2||(k=m.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>b&&(this._activeBuffer.scrollTop=b-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(m){if(!x(m.params[0],this._optionsService.rawOptions.windowOptions))return!0;let b=m.length>1?m.params[1]:0;switch(m.params[0]){case 14:b!==2&&this._onRequestWindowsOptionsReport.fire(O.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(O.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:b!==0&&b!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),b!==0&&b!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:b!==0&&b!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),b!==0&&b!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(m){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(m){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(m){return this._windowTitle=m,this._onTitleChange.fire(m),!0}setIconName(m){return this._iconName=m,!0}setOrReportIndexedColor(m){let b=[],k=m.split(";");for(;k.length>1;){let A=k.shift(),W=k.shift();if(/^\d+$/.exec(A)){let j=parseInt(A);if(C(j))if(W==="?")b.push({type:0,index:j});else{let P=(0,D.parseColor)(W);P&&b.push({type:1,index:j,color:P})}}}return b.length&&this._onColor.fire(b),!0}setHyperlink(m){let b=m.split(";");return!(b.length<2)&&(b[1]?this._createHyperlink(b[0],b[1]):!b[0]&&this._finishHyperlink())}_createHyperlink(m,b){this._getCurrentLinkId()&&this._finishHyperlink();let k=m.split(":"),A,W=k.findIndex((j=>j.startsWith("id=")));return W!==-1&&(A=k[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:b}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(m,b){let k=m.split(";");for(let A=0;A<k.length&&!(b>=this._specialColors.length);++A,++b)if(k[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[b]}]);else{let W=(0,D.parseColor)(k[A]);W&&this._onColor.fire([{type:1,index:this._specialColors[b],color:W}])}return!0}setOrReportFgColor(m){return this._setOrReportSpecialColor(m,0)}setOrReportBgColor(m){return this._setOrReportSpecialColor(m,1)}setOrReportCursorColor(m){return this._setOrReportSpecialColor(m,2)}restoreIndexedColor(m){if(!m)return this._onColor.fire([{type:2}]),!0;let b=[],k=m.split(";");for(let A=0;A<k.length;++A)if(/^\d+$/.exec(k[A])){let W=parseInt(k[A]);C(W)&&b.push({type:2,index:W})}return b.length&&this._onColor.fire(b),!0}restoreFgColor(m){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(m){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(m){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,p.DEFAULT_CHARSET),!0}selectCharset(m){return m.length!==2?(this.selectDefaultCharset(),!0):(m[0]==="/"||this._charsetService.setgCharset(M[m[0]],p.CHARSETS[m[1]]||p.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){let m=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,m,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(m){return this._charsetService.setgLevel(m),!0}screenAlignmentPattern(){let m=new a.CellData;m.content=4194373,m.fg=this._curAttrData.fg,m.bg=this._curAttrData.bg,this._setCursor(0,0);for(let b=0;b<this._bufferService.rows;++b){let k=this._activeBuffer.ybase+this._activeBuffer.y+b,A=this._activeBuffer.lines.get(k);A&&(A.fill(m),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(m,b){let k=this._bufferService.buffer,A=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${W}${c.C0.ESC}\\`),!0))(m==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:m==='"p'?'P1$r61;1"p':m==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:m==="m"?"P1$r0m":m===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(m,b){this._dirtyRowTracker.markRangeDirty(m,b)}}n.InputHandler=K;let N=class{constructor(B){this._bufferService=B,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(B){B<this.start?this.start=B:B>this.end&&(this.end=B)}markRangeDirty(B,m){B>m&&(q=B,B=m,m=q),B<this.start&&(this.start=B),m>this.end&&(this.end=m)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function C(B){return 0<=B&&B<256}N=h([_(0,g.IBufferService)],N)},844:(f,n)=>{function l(h){for(let _ of h)_.dispose();h.length=0}Object.defineProperty(n,"__esModule",{value:!0}),n.getDisposeArrayDisposable=n.disposeArray=n.toDisposable=n.MutableDisposable=n.Disposable=void 0,n.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){let _=this._disposables.indexOf(h);_!==-1&&this._disposables.splice(_,1)}},n.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){this._isDisposed||h===this._value||(this._value?.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},n.toDisposable=function(h){return{dispose:h}},n.disposeArray=l,n.getDisposeArrayDisposable=function(h){return{dispose:()=>l(h)}}},114:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;let l=n.isNode?"node":navigator.userAgent,h=n.isNode?"node":navigator.platform;n.isFirefox=l.includes("Firefox"),n.isLegacyEdge=l.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(l),n.getSafariVersion=function(){if(!n.isSafari)return 0;let _=l.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},n.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),n.isIpad=h==="iPad",n.isIphone=h==="iPhone",n.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),n.isLinux=h.indexOf("Linux")>=0,n.isChromeOS=/\bCrOS\b/.test(l)},226:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;let h=l(114);class _{constructor(){this._tasks=[],this._i=0}enqueue(o){this._tasks.push(o),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(o){this._idleCallback=void 0;let i=0,s=0,e=o.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(i=Date.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,Date.now()-i),s=Math.max(i,s),t=o.timeRemaining(),1.5*s>t)return e-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-i))}ms`),void this._start();e=t}this.clear()}}class c extends _{_requestCallback(o){return setTimeout((()=>o(this._createDeadline(16))))}_cancelCallback(o){clearTimeout(o)}_createDeadline(o){let i=Date.now()+o;return{timeRemaining:()=>Math.max(0,i-Date.now())}}}n.PriorityTaskQueue=c,n.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:c,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},282:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;let h=l(643);n.updateWindowsModeWrappedState=function(_){let c=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=c?.get(_.cols-1),o=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);o&&p&&(o.isWrapped=p[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&p[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},734:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){let c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}n.AttributeData=l;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){let c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,p=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=p}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=h},92:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;let h=l(349),_=l(226),c=l(734),p=l(437),o=l(634),i=l(511),s=l(643),e=l(863),t=l(116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(r,a,u){this._hasScrollback=r,this._optionsService=a,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=i.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=i.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,a){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),a)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows}_getCorrectBufferLength(r){if(!this._hasScrollback)return r;let a=r+this._optionsService.rawOptions.scrollback;return a>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:a}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let a=this._rows;for(;a--;)this.lines.push(this.getBlankLine(r))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(r,a){let u=this.getNullCell(p.DEFAULT_ATTR_DATA),g=0,v=this._getCorrectBufferLength(a);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols<r)for(let y=0;y<this.lines.length;y++)g+=+this.lines.get(y).resize(r,u);let S=0;if(this._rows<a)for(let y=this._rows;y<a;y++)this.lines.length<a+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(r,u)));else for(let y=this._rows;y>a;y--)this.lines.length>a+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v<this.lines.maxLength){let y=this.lines.length-v;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=v}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,a-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=a-1,this._isReflowEnabled&&(this._reflow(r,a),this._cols>r))for(let S=0;S<this.lines.length;S++)g+=+this.lines.get(S).resize(r,u);this._cols=r,this._rows=a,this._memoryCleanupQueue.clear(),g>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let r=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,r=!1);let a=0;for(;this._memoryCleanupPosition<this.lines.length;)if(a+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),a>100)return!0;return r}get _isReflowEnabled(){let r=this._optionsService.rawOptions.windowsPty;return r&&r.buildNumber?this._hasScrollback&&r.backend==="conpty"&&r.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(r,a){this._cols!==r&&(r>this._cols?this._reflowLarger(r,a):this._reflowSmaller(r,a))}_reflowLarger(r,a){let u=(0,o.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(u.length>0){let g=(0,o.reflowLargerCreateNewLayout)(this.lines,u);(0,o.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(r,a,g.countRemoved)}}_reflowLargerAdjustViewport(r,a,u){let g=this.getNullCell(p.DEFAULT_ATTR_DATA),v=u;for(;v-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<a&&this.lines.push(new p.BufferLine(r,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(r,a){let u=this.getNullCell(p.DEFAULT_ATTR_DATA),g=[],v=0;for(let S=this.lines.length-1;S>=0;S--){let y=this.lines.get(S);if(!y||!y.isWrapped&&y.getTrimmedLength()<=r)continue;let D=[y];for(;y.isWrapped&&S>0;)y=this.lines.get(--S),D.unshift(y);let M=this.ybase+this.y;if(M>=S&&M<S+D.length)continue;let E=D[D.length-1].getTrimmedLength(),x=(0,o.reflowSmallerGetNewLineLengths)(D,this._cols,r),O=x.length-D.length,q;q=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+O):Math.max(0,this.lines.length-this.lines.maxLength+O);let K=[];for(let k=0;k<O;k++){let A=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);K.push(A)}K.length>0&&(g.push({start:S+D.length+v,newLines:K}),v+=K.length),D.push(...K);let N=x.length-1,C=x[N];C===0&&(N--,C=x[N]);let B=D.length-O-1,m=E;for(;B>=0;){let k=Math.min(m,C);if(D[N]===void 0)break;if(D[N].copyCellsFrom(D[B],m-k,C-k,k,!0),C-=k,C===0&&(N--,C=x[N]),m-=k,m===0){B--;let A=Math.max(B,0);m=(0,o.getWrappedLineTrimmedLength)(D,A,this._cols)}}for(let k=0;k<D.length;k++)x[k]<r&&D[k].setCell(x[k],u);let b=O-q;for(;b-- >0;)this.ybase===0?this.y<a-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+v)-a&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+O,this.ybase+a-1)}if(g.length>0){let S=[],y=[];for(let N=0;N<this.lines.length;N++)y.push(this.lines.get(N));let D=this.lines.length,M=D-1,E=0,x=g[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+v);let O=0;for(let N=Math.min(this.lines.maxLength-1,D+v-1);N>=0;N--)if(x&&x.start>M+O){for(let C=x.newLines.length-1;C>=0;C--)this.lines.set(N--,x.newLines[C]);N++,S.push({index:M+1,amount:x.newLines.length}),O+=x.newLines.length,x=g[++E]}else this.lines.set(N,y[M--]);let q=0;for(let N=S.length-1;N>=0;N--)S[N].index+=q,this.lines.onInsertEmitter.fire(S[N]),q+=S[N].amount;let K=Math.max(0,D+v-this.lines.maxLength);K>0&&this.lines.onTrimEmitter.fire(K)}}translateBufferLineToString(r,a,u=0,g){let v=this.lines.get(r);return v?v.translateToString(a,u,g):""}getWrappedRangeForLine(r){let a=r,u=r;for(;a>0&&this.lines.get(a).isWrapped;)a--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:a,last:u}}setupTabStops(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.rawOptions.tabStopWidth)this.tabs[r]=!0}prevStop(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r}nextStop(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r}clearMarkers(r){this._isClearing=!0;for(let a=0;a<this.markers.length;a++)this.markers[a].line===r&&(this.markers[a].dispose(),this.markers.splice(a--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].dispose(),this.markers.splice(r--,1);this._isClearing=!1}addMarker(r){let a=new e.Marker(r);return this.markers.push(a),a.register(this.lines.onTrim((u=>{a.line-=u,a.line<0&&a.dispose()}))),a.register(this.lines.onInsert((u=>{a.line>=u.index&&(a.line+=u.amount)}))),a.register(this.lines.onDelete((u=>{a.line>=u.index&&a.line<u.index+u.amount&&a.dispose(),a.line>u.index&&(a.line-=u.amount)}))),a.register(a.onDispose((()=>this._removeMarker(a)))),a}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},437:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;let h=l(734),_=l(511),c=l(643),p=l(482);n.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let o=0;class i{constructor(e,t,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let a=t||_.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let u=0;u<e;++u)this.setCell(u,a);this.length=e}get(e){let t=this._data[3*e+0],r=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:r?(0,p.stringFromCodePoint)(r):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,t){this._data[3*e+1]=t[c.CHAR_DATA_ATTR_INDEX],t[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[c.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){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,p.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return o=3*e,t.content=this._data[o+0],t.fg=this._data[o+1],t.bg=this._data[o+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,r,a){268435456&a.bg&&(this._extendedAttrs[e]=a.extended),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=a.fg,this._data[3*e+2]=a.bg}addCodepointToCell(e,t,r){let a=this._data[3*e+0];2097152&a?this._combined[e]+=(0,p.stringFromCodePoint)(t):2097151&a?(this._combined[e]=(0,p.stringFromCodePoint)(2097151&a)+(0,p.stringFromCodePoint)(t),a&=-2097152,a|=2097152):a=t|4194304,r&&(a&=-12582913,a|=r<<22),this._data[3*e+0]=a}insertCells(e,t,r){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length-e){let a=new _.CellData;for(let u=this.length-e-t-1;u>=0;--u)this.setCell(e+t+u,this.loadCell(e+u,a));for(let u=0;u<t;++u)this.setCell(e+u,r)}else for(let a=e;a<this.length;++a)this.setCell(a,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,t,r){if(e%=this.length,t<this.length-e){let a=new _.CellData;for(let u=0;u<this.length-e-t;++u)this.setCell(e+u,this.loadCell(e+t+u,a));for(let u=this.length-t;u<this.length;++u)this.setCell(u,r)}else for(let a=e;a<this.length;++a)this.setCell(a,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,t,r,a=!1){if(a)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.setCell(e++,r)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let a=new Uint32Array(r);a.set(this._data),this._data=a}for(let a=this.length;a<e;++a)this.setCell(a,t)}else{this._data=this._data.subarray(0,r);let a=Object.keys(this._combined);for(let g=0;g<a.length;g++){let v=parseInt(a[g],10);v>=e&&delete this._combined[v]}let u=Object.keys(this._extendedAttrs);for(let g=0;g<u.length;g++){let v=parseInt(u[g],10);v>=e&&delete this._extendedAttrs[v]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new i(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];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,t,r,a,u){let g=e._data;if(u)for(let S=a-1;S>=0;S--){for(let y=0;y<3;y++)this._data[3*(r+S)+y]=g[3*(t+S)+y];268435456&g[3*(t+S)+2]&&(this._extendedAttrs[r+S]=e._extendedAttrs[t+S])}else for(let S=0;S<a;S++){for(let y=0;y<3;y++)this._data[3*(r+S)+y]=g[3*(t+S)+y];268435456&g[3*(t+S)+2]&&(this._extendedAttrs[r+S]=e._extendedAttrs[t+S])}let v=Object.keys(e._combined);for(let S=0;S<v.length;S++){let y=parseInt(v[S],10);y>=t&&(this._combined[y-t+r]=e._combined[y])}}translateToString(e,t,r,a){t=t??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),a&&(a.length=0);let u="";for(;t<r;){let g=this._data[3*t+0],v=2097151&g,S=2097152&g?this._combined[t]:v?(0,p.stringFromCodePoint)(v):c.WHITESPACE_CELL_CHAR;if(u+=S,a)for(let y=0;y<S.length;++y)a.push(t);t+=g>>22||1}return a&&a.push(t),u}}n.BufferLine=i},634:(f,n)=>{function l(h,_,c){if(_===h.length-1)return h[_].getTrimmedLength();let p=!h[_].hasContent(c-1)&&h[_].getWidth(c-1)===1,o=h[_+1].getWidth(0)===2;return p&&o?c-1:c}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(h,_,c,p,o){let i=[];for(let s=0;s<h.length-1;s++){let e=s,t=h.get(++e);if(!t.isWrapped)continue;let r=[h.get(s)];for(;e<h.length&&t.isWrapped;)r.push(t),t=h.get(++e);if(p>=s&&p<e){s+=r.length-1;continue}let a=0,u=l(r,a,_),g=1,v=0;for(;g<r.length;){let y=l(r,g,_),D=y-v,M=c-u,E=Math.min(D,M);r[a].copyCellsFrom(r[g],v,u,E,!1),u+=E,u===c&&(a++,u=0),v+=E,v===y&&(g++,v=0),u===0&&a!==0&&r[a-1].getWidth(c-1)===2&&(r[a].copyCellsFrom(r[a-1],c-1,u++,1,!1),r[a-1].setCell(c-1,o))}r[a].replaceCells(u,c,o);let S=0;for(let y=r.length-1;y>0&&(y>a||r[y].getTrimmedLength()===0);y--)S++;S>0&&(i.push(s+r.length-S),i.push(S)),s+=r.length-1}return i},n.reflowLargerCreateNewLayout=function(h,_){let c=[],p=0,o=_[p],i=0;for(let s=0;s<h.length;s++)if(o===s){let e=_[++p];h.onDeleteEmitter.fire({index:s-i,amount:e}),s+=e-1,i+=e,o=_[++p]}else c.push(s);return{layout:c,countRemoved:i}},n.reflowLargerApplyNewLayout=function(h,_){let c=[];for(let p=0;p<_.length;p++)c.push(h.get(_[p]));for(let p=0;p<c.length;p++)h.set(p,c[p]);h.length=_.length},n.reflowSmallerGetNewLineLengths=function(h,_,c){let p=[],o=h.map(((t,r)=>l(h,r,_))).reduce(((t,r)=>t+r)),i=0,s=0,e=0;for(;e<o;){if(o-e<c){p.push(o-e);break}i+=c;let t=l(h,s,_);i>t&&(i-=t,s++);let r=h[s].getWidth(i-1)===2;r&&i--;let a=r?c-1:c;p.push(a),e+=a}return p},n.getWrappedLineTrimmedLength=l},295:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;let h=l(460),_=l(844),c=l(92);class p extends _.Disposable{constructor(i,s){super(),this._optionsService=i,this._bufferService=s,this._onBufferActivate=this.register(new h.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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.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(i){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(i),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(i,s){this._normal.resize(i,s),this._alt.resize(i,s),this.setupTabStops(i)}setupTabStops(i){this._normal.setupTabStops(i),this._alt.setupTabStops(i)}}n.BufferSet=p},511:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;let h=l(482),_=l(643),c=l(734);class p extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(i){let s=new p;return s.setFromCharData(i),s}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(i){this.fg=i[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let s=!1;if(i[_.CHAR_DATA_CHAR_INDEX].length>2)s=!0;else if(i[_.CHAR_DATA_CHAR_INDEX].length===2){let e=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){let t=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(e-55296)+t-56320+65536|i[_.CHAR_DATA_WIDTH_INDEX]<<22:s=!0}else s=!0}else this.content=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[_.CHAR_DATA_WIDTH_INDEX]<<22;s&&(this.combinedData=i[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|i[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=p},643:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WHITESPACE_CELL_CODE=n.WHITESPACE_CELL_WIDTH=n.WHITESPACE_CELL_CHAR=n.NULL_CELL_CODE=n.NULL_CELL_WIDTH=n.NULL_CELL_CHAR=n.CHAR_DATA_CODE_INDEX=n.CHAR_DATA_WIDTH_INDEX=n.CHAR_DATA_CHAR_INDEX=n.CHAR_DATA_ATTR_INDEX=n.DEFAULT_EXT=n.DEFAULT_ATTR=n.DEFAULT_COLOR=void 0,n.DEFAULT_COLOR=0,n.DEFAULT_ATTR=256|n.DEFAULT_COLOR<<9,n.DEFAULT_EXT=0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32},863:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;let h=l(460),_=l(844);class c{get id(){return this._id}constructor(o){this.line=o,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(o){return this._disposables.push(o),o}}n.Marker=c,c._nextId=1},116:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_CHARSET=n.CHARSETS=void 0,n.CHARSETS={},n.DEFAULT_CHARSET=n.CHARSETS.B,n.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},n.CHARSETS.A={"#":"\xA3"},n.CHARSETS.B=void 0,n.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},n.CHARSETS.C=n.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},n.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},n.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},n.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},n.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},n.CHARSETS.E=n.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},n.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},n.CHARSETS.H=n.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},n.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},584:(f,n)=>{var l,h,_;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
10
+ `,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL="\x7F"})(l||(n.C0=l={})),(function(c){c.PAD="\x80",c.HOP="\x81",c.BPH="\x82",c.NBH="\x83",c.IND="\x84",c.NEL="\x85",c.SSA="\x86",c.ESA="\x87",c.HTS="\x88",c.HTJ="\x89",c.VTS="\x8A",c.PLD="\x8B",c.PLU="\x8C",c.RI="\x8D",c.SS2="\x8E",c.SS3="\x8F",c.DCS="\x90",c.PU1="\x91",c.PU2="\x92",c.STS="\x93",c.CCH="\x94",c.MW="\x95",c.SPA="\x96",c.EPA="\x97",c.SOS="\x98",c.SGCI="\x99",c.SCI="\x9A",c.CSI="\x9B",c.ST="\x9C",c.OSC="\x9D",c.PM="\x9E",c.APC="\x9F"})(h||(n.C1=h={})),(function(c){c.ST=`${l.ESC}\\`})(_||(n.C1_ESCAPED=_={}))},482:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},n.utf32ToString=function(l,h=0,_=l.length){let c="";for(let p=h;p<_;++p){let o=l[p];o>65535?(o-=65536,c+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):c+=String.fromCharCode(o)}return c},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,h){let _=l.length;if(!_)return 0;let c=0,p=0;if(this._interim){let o=l.charCodeAt(p++);56320<=o&&o<=57343?h[c++]=1024*(this._interim-55296)+o-56320+65536:(h[c++]=this._interim,h[c++]=o),this._interim=0}for(let o=p;o<_;++o){let i=l.charCodeAt(o);if(55296<=i&&i<=56319){if(++o>=_)return this._interim=i,c;let s=l.charCodeAt(o);56320<=s&&s<=57343?h[c++]=1024*(i-55296)+s-56320+65536:(h[c++]=i,h[c++]=s)}else i!==65279&&(h[c++]=i)}return c}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,h){let _=l.length;if(!_)return 0;let c,p,o,i,s=0,e=0,t=0;if(this.interim[0]){let u=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let v,S=0;for(;(v=63&this.interim[++S])&&S<4;)g<<=6,g|=v;let y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,D=y-S;for(;t<D;){if(t>=_)return 0;if(v=l[t++],(192&v)!=128){t--,u=!0;break}this.interim[S++]=v,g<<=6,g|=63&v}u||(y===2?g<128?t--:h[s++]=g:y===3?g<2048||g>=55296&&g<=57343||g===65279||(h[s++]=g):g<65536||g>1114111||(h[s++]=g)),this.interim.fill(0)}let r=_-4,a=t;for(;a<_;){for(;!(!(a<r)||128&(c=l[a])||128&(p=l[a+1])||128&(o=l[a+2])||128&(i=l[a+3]));)h[s++]=c,h[s++]=p,h[s++]=o,h[s++]=i,a+=4;if(c=l[a++],c<128)h[s++]=c;else if((224&c)==192){if(a>=_)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(e=(31&c)<<6|63&p,e<128){a--;continue}h[s++]=e}else if((240&c)==224){if(a>=_)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(a>=_)return this.interim[0]=c,this.interim[1]=p,s;if(o=l[a++],(192&o)!=128){a--;continue}if(e=(15&c)<<12|(63&p)<<6|63&o,e<2048||e>=55296&&e<=57343||e===65279)continue;h[s++]=e}else if((248&c)==240){if(a>=_)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(a>=_)return this.interim[0]=c,this.interim[1]=p,s;if(o=l[a++],(192&o)!=128){a--;continue}if(a>=_)return this.interim[0]=c,this.interim[1]=p,this.interim[2]=o,s;if(i=l[a++],(192&i)!=128){a--;continue}if(e=(7&c)<<18|(63&p)<<12|(63&o)<<6|63&i,e<65536||e>1114111)continue;h[s++]=e}}return s}}},225:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;let h=l(480),_=[[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]],c=[[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]],p;n.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let o=0;o<_.length;++o)p.fill(0,_[o][0],_[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?p[o]:(function(i,s){let e,t=0,r=s.length-1;if(i<s[0][0]||i>s[r][1])return!1;for(;r>=t;)if(e=t+r>>1,i>s[e][1])t=e+1;else{if(!(i<s[e][0]))return!0;r=e-1}return!1})(o,c)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1}charProperties(o,i){let s=this.wcwidth(o),e=s===0&&i!==0;if(e){let t=h.UnicodeService.extractWidth(i);t===0?e=!1:t>s&&(s=t)}return h.UnicodeService.createPropertyValue(0,s,e)}}},981:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;let h=l(460),_=l(844);class c extends _.Disposable{constructor(o){super(),this._action=o,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(o,i){if(i!==void 0&&this._syncCalls>i)return void(this._syncCalls=0);if(this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let s;for(this._isSyncWriting=!0;s=this._writeBuffer.shift();){this._action(s);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(o,i){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+=o.length,this._writeBuffer.push(o),this._callbacks.push(i),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(i)}_innerWrite(o=0,i=!0){let s=o||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],t=this._action(e,i);if(t){let a=u=>Date.now()-s>=12?setTimeout((()=>this._innerWrite(0,u))):this._innerWrite(s,u);return void t.catch((u=>(queueMicrotask((()=>{throw u})),Promise.resolve(!1)))).then(a)}let r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-s>=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()}}n.WriteBuffer=c},941:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.parseColor=void 0;let l=/^([\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})$/,h=/^[\da-f]+$/;function _(c,p){let o=c.toString(16),i=o.length<2?"0"+o:o;switch(p){case 4:return o[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}n.parseColor=function(c){if(!c)return;let p=c.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);let o=l.exec(p);if(o){let i=o[1]?15:o[4]?255:o[7]?4095:65535;return[Math.round(parseInt(o[1]||o[4]||o[7]||o[10],16)/i*255),Math.round(parseInt(o[2]||o[5]||o[8]||o[11],16)/i*255),Math.round(parseInt(o[3]||o[6]||o[9]||o[12],16)/i*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),h.exec(p)&&[3,6,9,12].includes(p.length))){let o=p.length/3,i=[0,0,0];for(let s=0;s<3;++s){let e=parseInt(p.slice(o*s,o*s+o),16);i[s]=o===1?e<<4:o===2?e:o===3?e>>4:e>>8}return i}},n.toRgbString=function(c,p=16){let[o,i,s]=c;return`rgb:${_(o,p)}/${_(i,p)}/${_(s,p)}`}},770:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},351:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;let h=l(482),_=l(742),c=l(770),p=[];n.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(i,s){this._handlers[i]===void 0&&(this._handlers[i]=[]);let e=this._handlers[i];return e.push(s),{dispose:()=>{let t=e.indexOf(s);t!==-1&&e.splice(t,1)}}}clearHandler(i){this._handlers[i]&&delete this._handlers[i]}setHandlerFallback(i){this._handlerFb=i}reset(){if(this._active.length)for(let i=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;i>=0;--i)this._active[i].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(i,s){if(this.reset(),this._ident=i,this._active=this._handlers[i]||p,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(s);else this._handlerFb(this._ident,"HOOK",s)}put(i,s,e){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(i,s,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(i,s,e))}unhook(i,s=!0){if(this._active.length){let e=!1,t=this._active.length-1,r=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,e=s,r=this._stack.fallThrough,this._stack.paused=!1),!r&&e===!1){for(;t>=0&&(e=this._active[t].unhook(i),e!==!0);t--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,e;t--}for(;t>=0;t--)if(e=this._active[t].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",i);this._active=p,this._ident=0}};let o=new _.Params;o.addParam(0),n.DcsHandler=class{constructor(i){this._handler=i,this._data="",this._params=o,this._hitLimit=!1}hook(i){this._params=i.length>1||i.params[0]?i.clone():o,this._data="",this._hitLimit=!1}put(i,s,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(i,s,e),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(i){let s=!1;if(this._hitLimit)s=!1;else if(i&&(s=this._handler(this._data,this._params),s instanceof Promise))return s.then((e=>(this._params=o,this._data="",this._hitLimit=!1,e)));return this._params=o,this._data="",this._hitLimit=!1,s}}},15:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;let h=l(844),_=l(742),c=l(242),p=l(351);class o{constructor(t){this.table=new Uint8Array(t)}setDefault(t,r){this.table.fill(t<<4|r)}add(t,r,a,u){this.table[r<<8|t]=a<<4|u}addMany(t,r,a,u){for(let g=0;g<t.length;g++)this.table[r<<8|t[g]]=a<<4|u}}n.TransitionTable=o;let i=160;n.VT500_TRANSITION_TABLE=(function(){let e=new o(4095),t=Array.apply(null,Array(256)).map(((S,y)=>y)),r=(S,y)=>t.slice(S,y),a=r(32,127),u=r(0,24);u.push(25),u.push.apply(u,r(28,32));let g=r(0,14),v;for(v in e.setDefault(1,0),e.addMany(a,0,2,0),g)e.addMany([24,26,153,154],v,3,0),e.addMany(r(128,144),v,3,0),e.addMany(r(144,152),v,3,0),e.add(156,v,0,0),e.add(27,v,11,1),e.add(157,v,4,8),e.addMany([152,158,159],v,0,7),e.add(155,v,11,3),e.add(144,v,11,9);return e.addMany(u,0,3,0),e.addMany(u,1,3,1),e.add(127,1,0,1),e.addMany(u,8,0,8),e.addMany(u,3,3,3),e.add(127,3,0,3),e.addMany(u,4,3,4),e.add(127,4,0,4),e.addMany(u,6,3,6),e.addMany(u,5,3,5),e.add(127,5,0,5),e.addMany(u,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(a,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(a,7,0,7),e.addMany(u,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(u,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(u,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(u,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(u,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(u,13,13,13),e.addMany(a,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(i,0,2,0),e.add(i,8,5,8),e.add(i,6,0,6),e.add(i,11,0,11),e.add(i,13,13,13),e})();class s extends h.Disposable{constructor(t=n.VT500_TRANSITION_TABLE){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,a,u)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,a)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,r=[64,126]){let a=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(a=t.prefix.charCodeAt(0),a&&60>a||a>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<t.intermediates.length;++g){let v=t.intermediates.charCodeAt(g);if(32>v||v>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");a<<=8,a|=v}}if(t.final.length!==1)throw new Error("final must be a single byte");let u=t.final.charCodeAt(0);if(r[0]>u||u>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return a<<=8,a|=u,a}identToString(t){let r=[];for(;t;)r.push(String.fromCharCode(255&t)),t>>=8;return r.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,r){let a=this._identifier(t,[48,126]);this._escHandlers[a]===void 0&&(this._escHandlers[a]=[]);let u=this._escHandlers[a];return u.push(r),{dispose:()=>{let g=u.indexOf(r);g!==-1&&u.splice(g,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,r){this._executeHandlers[t.charCodeAt(0)]=r}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,r){let a=this._identifier(t);this._csiHandlers[a]===void 0&&(this._csiHandlers[a]=[]);let u=this._csiHandlers[a];return u.push(r),{dispose:()=>{let g=u.indexOf(r);g!==-1&&u.splice(g,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,r){return this._dcsParser.registerHandler(this._identifier(t),r)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,r){return this._oscParser.registerHandler(t,r)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,r,a,u,g){this._parseStack.state=t,this._parseStack.handlers=r,this._parseStack.handlerPos=a,this._parseStack.transition=u,this._parseStack.chunkPos=g}parse(t,r,a){let u,g=0,v=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=this._parseStack.chunkPos+1;else{if(a===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let y=this._parseStack.handlers,D=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(a===!1&&D>-1){for(;D>=0&&(u=y[D](this._params),u!==!0);D--)if(u instanceof Promise)return this._parseStack.handlerPos=D,u}this._parseStack.handlers=[];break;case 4:if(a===!1&&D>-1){for(;D>=0&&(u=y[D](),u!==!0);D--)if(u instanceof Promise)return this._parseStack.handlerPos=D,u}this._parseStack.handlers=[];break;case 6:if(g=t[this._parseStack.chunkPos],u=this._dcsParser.unhook(g!==24&&g!==26,a),u)return u;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=t[this._parseStack.chunkPos],u=this._oscParser.end(g!==24&&g!==26,a),u)return u;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let y=S;y<r;++y){switch(g=t[y],v=this._transitions.table[this.currentState<<8|(g<160?g:i)],v>>4){case 2:for(let O=y+1;;++O){if(O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}if(++O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}if(++O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}if(++O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:y,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let D=this._csiHandlers[this._collect<<8|g],M=D?D.length-1:-1;for(;M>=0&&(u=D[M](this._params),u!==!0);M--)if(u instanceof Promise)return this._preserveStack(3,D,M,v,y),u;M<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++y<r&&(g=t[y])>47&&g<60);y--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:let E=this._escHandlers[this._collect<<8|g],x=E?E.length-1:-1;for(;x>=0&&(u=E[x](),u!==!0);x--)if(u instanceof Promise)return this._preserveStack(4,E,x,v,y),u;x<0&&this._escHandlerFb(this._collect<<8|g),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|g,this._params);break;case 13:for(let O=y+1;;++O)if(O>=r||(g=t[O])===24||g===26||g===27||g>127&&g<i){this._dcsParser.put(t,y,O),y=O-1;break}break;case 14:if(u=this._dcsParser.unhook(g!==24&&g!==26),u)return this._preserveStack(6,[],0,v,y),u;g===27&&(v|=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 O=y+1;;O++)if(O>=r||(g=t[O])<32||g>127&&g<i){this._oscParser.put(t,y,O),y=O-1;break}break;case 6:if(u=this._oscParser.end(g!==24&&g!==26),u)return this._preserveStack(5,[],0,v,y),u;g===27&&(v|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&v}}}n.EscapeSequenceParser=s},242:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;let h=l(770),_=l(482),c=[];n.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(o),{dispose:()=>{let s=i.indexOf(o);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,o,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,o,i);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,o,i))}start(){this.reset(),this._state=1}put(p,o,i){if(this._state!==3){if(this._state===1)for(;o<i;){let s=p[o++];if(s===59){this._state=2,this._start();break}if(s<48||57<s)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+s-48}this._state===2&&i-o>0&&this._put(p,o,i)}}end(p,o=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=o,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].end(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",p);this._active=c,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,o,i){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,o,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data),o instanceof Promise))return o.then((i=>(this._data="",this._hitLimit=!1,i)));return this._data="",this._hitLimit=!1,o}}},742:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;let l=2147483647;class h{static fromArray(c){let p=new h;if(!c.length)return p;for(let o=Array.isArray(c[0])?1:0;o<c.length;++o){let i=c[o];if(Array.isArray(i))for(let s=0;s<i.length;++s)p.addSubParam(i[s]);else p.addParam(i)}return p}constructor(c=32,p=32){if(this.maxLength=c,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let c=new h(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){let c=[];for(let p=0;p<this.length;++p){c.push(this.params[p]);let o=this._subParamsIdx[p]>>8,i=255&this._subParamsIdx[p];i-o>0&&c.push(Array.prototype.slice.call(this._subParams,o,i))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){let p=this._subParamsIdx[c]>>8,o=255&this._subParamsIdx[c];return o-p>0?this._subParams.subarray(p,o):null}getSubParamsAll(){let c={};for(let p=0;p<this.length;++p){let o=this._subParamsIdx[p]>>8,i=255&this._subParamsIdx[p];i-o>0&&(c[p]=this._subParams.slice(o,i))}return c}addDigit(c){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let o=this._digitIsSub?this._subParams:this.params,i=o[p-1];o[p-1]=~i?Math.min(10*i+c,l):c}}n.Params=h},741:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,h){let _={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(_),h.dispose=()=>this._wrappedAddonDispose(_),h.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let h=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===l){h=_;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(h,1)}}},771:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;let h=l(785),_=l(511);n.BufferApiView=class{constructor(c,p){this._buffer=c,this.type=p}init(c){return this._buffer=c,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(c){let p=this._buffer.lines.get(c);if(p)return new h.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},785:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;let h=l(511);n.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,c){if(!(_<0||_>=this._line.length))return c?(this._line.loadCell(_,c),c):this._line.loadCell(_,new h.CellData)}translateToString(_,c,p){return this._line.translateToString(_,c,p)}}},285:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;let h=l(771),_=l(460),c=l(844);class p extends c.Disposable{constructor(i){super(),this._core=i,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.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)}}n.BufferNamespaceApi=p},975:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,h){return this._core.registerCsiHandler(l,(_=>h(_.toArray())))}addCsiHandler(l,h){return this.registerCsiHandler(l,h)}registerDcsHandler(l,h){return this._core.registerDcsHandler(l,((_,c)=>h(_,c.toArray())))}addDcsHandler(l,h){return this.registerDcsHandler(l,h)}registerEscHandler(l,h){return this._core.registerEscHandler(l,h)}addEscHandler(l,h){return this.registerEscHandler(l,h)}registerOscHandler(l,h){return this._core.registerOscHandler(l,h)}addOscHandler(l,h){return this.registerOscHandler(l,h)}}},90:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(f,n,l){var h=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},_=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;let c=l(460),p=l(844),o=l(295),i=l(585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let s=n.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new o.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,a;a=this._cachedBlankLine,a&&a.length===this.cols&&a.getFg(0)===e.fg&&a.getBg(0)===e.bg||(a=r.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let u=r.ybase+r.scrollTop,g=r.ybase+r.scrollBottom;if(r.scrollTop===0){let v=r.lines.isFull;g===r.lines.length-1?v?r.lines.recycle().copyFrom(a):r.lines.push(a.clone()):r.lines.splice(g+1,0,a.clone()),v?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let v=g-u+1;r.lines.shiftElements(u+1,v-1,-1),r.lines.set(g,a.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t,r){let a=this.buffer;if(e<0){if(a.ydisp===0)return;this.isUserScrolling=!0}else e+a.ydisp>=a.ybase&&(this.isUserScrolling=!1);let u=a.ydisp;a.ydisp=Math.max(Math.min(a.ydisp+e,a.ybase),0),u!==a.ydisp&&(t||this._onScroll.fire(a.ydisp))}};n.BufferService=s=h([_(0,i.IOptionsService)],s)},994:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,h){this._charsets[l]=h,this.glevel===l&&(this.charset=h)}}},753:function(f,n,l){var h=this&&this.__decorate||function(a,u,g,v){var S,y=arguments.length,D=y<3?u:v===null?v=Object.getOwnPropertyDescriptor(u,g):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(a,u,g,v);else for(var M=a.length-1;M>=0;M--)(S=a[M])&&(D=(y<3?S(D):y>3?S(u,g,D):S(u,g))||D);return y>3&&D&&Object.defineProperty(u,g,D),D},_=this&&this.__param||function(a,u){return function(g,v){u(g,v,a)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;let c=l(585),p=l(460),o=l(844),i={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:a=>a.button!==4&&a.action===1&&(a.ctrl=!1,a.alt=!1,a.shift=!1,!0)},VT200:{events:19,restrict:a=>a.action!==32},DRAG:{events:23,restrict:a=>a.action!==32||a.button!==3},ANY:{events:31,restrict:a=>!0}};function s(a,u){let g=(a.ctrl?16:0)|(a.shift?4:0)|(a.alt?8:0);return a.button===4?(g|=64,g|=a.action):(g|=3&a.button,4&a.button&&(g|=64),8&a.button&&(g|=128),a.action===32?g|=32:a.action!==0||u||(g|=3)),g}let e=String.fromCharCode,t={DEFAULT:a=>{let u=[s(a,!1)+32,a.col+32,a.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${e(u[0])}${e(u[1])}${e(u[2])}`},SGR:a=>{let u=a.action===0&&a.button!==4?"m":"M";return`\x1B[<${s(a,!0)};${a.col};${a.row}${u}`},SGR_PIXELS:a=>{let u=a.action===0&&a.button!==4?"m":"M";return`\x1B[<${s(a,!0)};${a.x};${a.y}${u}`}},r=n.CoreMouseService=class extends o.Disposable{constructor(a,u){super(),this._bufferService=a,this._coreService=u,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let g of Object.keys(i))this.addProtocol(g,i[g]);for(let g of Object.keys(t))this.addEncoding(g,t[g]);this.reset()}addProtocol(a,u){this._protocols[a]=u}addEncoding(a,u){this._encodings[a]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(a){if(!this._protocols[a])throw new Error(`unknown protocol "${a}"`);this._activeProtocol=a,this._onProtocolChange.fire(this._protocols[a].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(a){if(!this._encodings[a])throw new Error(`unknown encoding "${a}"`);this._activeEncoding=a}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(a){if(a.col<0||a.col>=this._bufferService.cols||a.row<0||a.row>=this._bufferService.rows||a.button===4&&a.action===32||a.button===3&&a.action!==32||a.button!==4&&(a.action===2||a.action===3)||(a.col++,a.row++,a.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,a,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(a))return!1;let u=this._encodings[this._activeEncoding](a);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=a,!0}explainEvents(a){return{down:!!(1&a),up:!!(2&a),drag:!!(4&a),move:!!(8&a),wheel:!!(16&a)}}_equalEvents(a,u,g){if(g){if(a.x!==u.x||a.y!==u.y)return!1}else if(a.col!==u.col||a.row!==u.row)return!1;return a.button===u.button&&a.action===u.action&&a.ctrl===u.ctrl&&a.alt===u.alt&&a.shift===u.shift}};n.CoreMouseService=r=h([_(0,c.IBufferService),_(1,c.ICoreService)],r)},83:function(f,n,l){var h=this&&this.__decorate||function(r,a,u,g){var v,S=arguments.length,y=S<3?a:g===null?g=Object.getOwnPropertyDescriptor(a,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(r,a,u,g);else for(var D=r.length-1;D>=0;D--)(v=r[D])&&(y=(S<3?v(y):S>3?v(a,u,y):v(a,u))||y);return S>3&&y&&Object.defineProperty(a,u,y),y},_=this&&this.__param||function(r,a){return function(u,g){a(u,g,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;let c=l(439),p=l(460),o=l(844),i=l(585),s=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=n.CoreService=class extends o.Disposable{constructor(r,a,u){super(),this._bufferService=r,this._logService=a,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(s),this.decPrivateModes=(0,c.clone)(e)}reset(){this.modes=(0,c.clone)(s),this.decPrivateModes=(0,c.clone)(e)}triggerDataEvent(r,a=!1){if(this._optionsService.rawOptions.disableStdin)return;let u=this._bufferService.buffer;a&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),a&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,(()=>r.split("").map((g=>g.charCodeAt(0))))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,(()=>r.split("").map((a=>a.charCodeAt(0))))),this._onBinary.fire(r))}};n.CoreService=t=h([_(0,i.IBufferService),_(1,i.ILogService),_(2,i.IOptionsService)],t)},348:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;let h=l(585),_=l(343);class c{constructor(...o){this._entries=new Map;for(let[i,s]of o)this.set(i,s)}set(o,i){let s=this._entries.get(o);return this._entries.set(o,i),s}forEach(o){for(let[i,s]of this._entries.entries())o(i,s)}has(o){return this._entries.has(o)}get(o){return this._entries.get(o)}}n.ServiceCollection=c,n.InstantiationService=class{constructor(){this._services=new c,this._services.set(h.IInstantiationService,this)}setService(p,o){this._services.set(p,o)}getService(p){return this._services.get(p)}createInstance(p,...o){let i=(0,_.getServiceDependencies)(p).sort(((t,r)=>t.index-r.index)),s=[];for(let t of i){let r=this._services.get(t.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${t.id}.`);s.push(r)}let e=i.length>0?i[0].index:o.length;if(o.length!==e)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${e+1} conflicts with ${o.length} static arguments`);return new p(...o,...s)}}},866:function(f,n,l){var h=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},_=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;let c=l(844),p=l(585),o={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF},i,s=n.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),i=this}_updateLogLevel(){this._logLevel=o[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...r)}trace(e,...t){this._logLevel<=p.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=p.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=p.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=p.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};n.LogService=s=h([_(0,p.IOptionsService)],s),n.setTraceLogger=function(e){i=e},n.traceCall=function(e,t,r){if(typeof r.value!="function")throw new Error("not supported");let a=r.value;r.value=function(...u){if(i.logLevel!==p.LogLevelEnum.TRACE)return a.apply(this,u);i.trace(`GlyphRenderer#${a.name}(${u.map((v=>JSON.stringify(v))).join(", ")})`);let g=a.apply(this,u);return i.trace(`GlyphRenderer#${a.name} return`,g),g}}},302:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;let h=l(460),_=l(844),c=l(114);n.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:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let p=["normal","bold","100","200","300","400","500","600","700","800","900"];class o extends _.Disposable{constructor(s){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let e={...n.DEFAULT_OPTIONS};for(let t in s)if(t in e)try{let r=s[t];e[t]=this._sanitizeAndValidateOption(t,r)}catch(r){console.error(r)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(s,e){return this.onOptionChange((t=>{t===s&&e(this.rawOptions[s])}))}onMultipleOptionChange(s,e){return this.onOptionChange((t=>{s.indexOf(t)!==-1&&e()}))}_setupOptions(){let s=t=>{if(!(t in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},e=(t,r)=>{if(!(t in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);r=this._sanitizeAndValidateOption(t,r),this.rawOptions[t]!==r&&(this.rawOptions[t]=r,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let r={get:s.bind(this,t),set:e.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(s,e){switch(s){case"cursorStyle":if(e||(e=n.DEFAULT_OPTIONS[s]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${s}`);break;case"wordSeparator":e||(e=n.DEFAULT_OPTIONS[s]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=p.includes(e)?e:n.DEFAULT_OPTIONS[s];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${s} cannot be less than 1, value: ${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(`${s} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${s} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${s} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}n.OptionsService=o},660:function(f,n,l){var h=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var u=o.length-1;u>=0;u--)(t=o[u])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},_=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;let c=l(585),p=n.OscLinkService=class{constructor(o){this._bufferService=o,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(o){let i=this._bufferService.buffer;if(o.id===void 0){let u=i.addMarker(i.ybase+i.y),g={data:o,id:this._nextId++,lines:[u]};return u.onDispose((()=>this._removeMarkerFromLink(g,u))),this._dataByLinkId.set(g.id,g),g.id}let s=o,e=this._getEntryIdKey(s),t=this._entriesWithId.get(e);if(t)return this.addLineToLink(t.id,i.ybase+i.y),t.id;let r=i.addMarker(i.ybase+i.y),a={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[r]};return r.onDispose((()=>this._removeMarkerFromLink(a,r))),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(o,i){let s=this._dataByLinkId.get(o);if(s&&s.lines.every((e=>e.line!==i))){let e=this._bufferService.buffer.addMarker(i);s.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(s,e)))}}getLinkData(o){return this._dataByLinkId.get(o)?.data}_getEntryIdKey(o){return`${o.id};;${o.uri}`}_removeMarkerFromLink(o,i){let s=o.lines.indexOf(i);s!==-1&&(o.lines.splice(s,1),o.lines.length===0&&(o.data.id!==void 0&&this._entriesWithId.delete(o.key),this._dataByLinkId.delete(o.id)))}};n.OscLinkService=p=h([_(0,c.IBufferService)],p)},343:(f,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;let l="di$target",h="di$dependencies";n.serviceRegistry=new Map,n.getServiceDependencies=function(_){return _[h]||[]},n.createDecorator=function(_){if(n.serviceRegistry.has(_))return n.serviceRegistry.get(_);let c=function(p,o,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(s,e,t){e[l]===e?e[h].push({id:s,index:t}):(e[h]=[{id:s,index:t}],e[l]=e)})(c,p,i)};return c.toString=()=>_,n.serviceRegistry.set(_,c),c}},585:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;let h=l(343);var _;n.IBufferService=(0,h.createDecorator)("BufferService"),n.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),n.ICoreService=(0,h.createDecorator)("CoreService"),n.ICharsetService=(0,h.createDecorator)("CharsetService"),n.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(_||(n.LogLevelEnum=_={})),n.ILogService=(0,h.createDecorator)("LogService"),n.IOptionsService=(0,h.createDecorator)("OptionsService"),n.IOscLinkService=(0,h.createDecorator)("OscLinkService"),n.IUnicodeService=(0,h.createDecorator)("UnicodeService"),n.IDecorationService=(0,h.createDecorator)("DecorationService")},480:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;let h=l(460),_=l(225);class c{static extractShouldJoin(o){return(1&o)!=0}static extractWidth(o){return o>>1&3}static extractCharKind(o){return o>>3}static createPropertyValue(o,i,s=!1){return(16777215&o)<<3|(3&i)<<1|(s?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let o=new _.UnicodeV6;this.register(o),this._active=o.version,this._activeProvider=o}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(o){if(!this._providers[o])throw new Error(`unknown Unicode version "${o}"`);this._active=o,this._activeProvider=this._providers[o],this._onChange.fire(o)}register(o){this._providers[o.version]=o}wcwidth(o){return this._activeProvider.wcwidth(o)}getStringCellWidth(o){let i=0,s=0,e=o.length;for(let t=0;t<e;++t){let r=o.charCodeAt(t);if(55296<=r&&r<=56319){if(++t>=e)return i+this.wcwidth(r);let g=o.charCodeAt(t);56320<=g&&g<=57343?r=1024*(r-55296)+g-56320+65536:i+=this.wcwidth(g)}let a=this.charProperties(r,s),u=c.extractWidth(a);c.extractShouldJoin(a)&&(u-=c.extractWidth(s)),i+=u,s=a}return i}charProperties(o,i){return this._activeProvider.charProperties(o,i)}}n.UnicodeService=c},781:(f,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;let h=l(437),_=l(969),c=l(460);class p extends _.CoreTerminal{constructor(i={}){super(i),this._onBell=this.register(new c.EventEmitter),this.onBell=this._onBell.event,this._onCursorMove=this.register(new c.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this.register(new c.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this.register(new c.EventEmitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this.register(new c.EventEmitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this.register(this._inputHandler.onRequestBell((()=>this.bell()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register((0,c.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,c.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,c.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,c.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(i){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+i)}bell(){this._onBell.fire()}input(i,s=!0){this.coreService.triggerDataEvent(i,s)}resize(i,s){i===this.cols&&s===this.rows||super.resize(i,s)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){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 i=1;i<this.rows;i++)this.buffer.lines.push(this.buffer.getBlankLine(h.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}n.Terminal=p}},I={};function U(f){var n=I[f];if(n!==void 0)return n.exports;var l=I[f]={exports:{}};return T[f].call(l.exports,l,l.exports,U),l.exports}var z={};(()=>{var f=z;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;let n=U(285),l=U(975),h=U(90),_=U(781),c=U(741),p=U(844),o=["cols","rows"];class i extends p.Disposable{constructor(e){super(),this._core=this.register(new _.Terminal(e)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],r=(a,u)=>{this._checkReadonlyOptions(a),this._core.options[a]=u};for(let a in this._core.options){Object.defineProperty(this._publicOptions,a,{get:()=>this._core.options[a],set:g=>{this._checkReadonlyOptions(a),this._core.options[a]=g}});let u={get:t.bind(this,a),set:r.bind(this,a)};Object.defineProperty(this._publicOptions,a,u)}}_checkReadonlyOptions(e){if(o.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.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 onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new h.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,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:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}registerMarker(e=0){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)}addMarker(e){return this.registerMarker(e)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
11
+ `,t)}reset(){this._core.reset()}loadAddon(e){this._addonManager.loadAddon(this,e)}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}}f.Terminal=i})();var R=ot;for(var d in z)R[d]=z[d];z.__esModule&&Object.defineProperty(R,"__esModule",{value:!0})})()});var ht=st(nt(),1),ct=st(at(),1);function Rt(T){let I=T.match(Ye);if(I&&I.length>0){let U=I[I.length-1].match(/(-?\d+)>$/),z=U?parseInt(U[1],10):NaN;return{text:T.replace(Ye,""),exitCode:isNaN(z)?void 0:z}}return{text:T}}var ce=window.__I18N__,Be=window.__PTY_COLS__||120,lt=window.__PTY_ROWS__||40,Mt=["#010101","#de382b","#39b54a","#ffc005","#006fb8","#762671","#2cb3e9","#c9d1d9"],Pt=["#666666","#ff7b72","#3fb950","#d29922","#58a6ff","#bc8cff","#39c5cf","#f0f6fc"],dt=2e3,It=1e4,Ge=[0,95,135,175,215,255];function Fe(T,I,U){let z=R=>R.toString(16).padStart(2,"0");return"#"+z(T)+z(I)+z(U)}function _t(T){if(T>=0&&T<8)return Mt[T];if(T>=8&&T<16)return Pt[T-8];if(T>=16&&T<232){let I=T-16;return Fe(Ge[Math.floor(I/36)],Ge[Math.floor(I%36/6)],Ge[I%6])}if(T>=232&&T<256){let I=8+(T-232)*10;return Fe(I,I,I)}return null}function Ot(T){if(T.isFgDefault())return null;let I=T.getFgColor();return T.isFgPalette()?_t(I):Fe(I>>16&255,I>>8&255,I&255)}function Ht(T){if(T.isBgDefault())return null;let I=T.getBgColor();return T.isBgPalette()?_t(I):Fe(I>>16&255,I>>8&255,I&255)}var be=class{constructor(I){Re(this,"term");Re(this,"queue",Promise.resolve());Re(this,"disposed",!1);this.term=new ct.Terminal({cols:I,rows:lt,scrollback:dt,allowProposedApi:!0})}write(I){return this.queue=this.queue.then(()=>this.writeOnce(I)),this.queue}writeOnce(I){return this.disposed?Promise.resolve():new Promise(U=>{let z=!1,R=()=>{z||(z=!0,U())},d=setTimeout(R,It);this.term.write(I,()=>{clearTimeout(d),R()})})}render(){if(this.disposed)return[];let I=R=>R.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),U=this.term.buffer.active,z=[];for(let R=0;R<U.length;R++){let d=U.getLine(R);if(!d)continue;let f=d.length;for(;f>0;){let _=d.getCell(f-1)?.getChars()??"";if(_!==""&&_!==" ")break;f--}if(f===0)continue;let n="",l=null;for(let h=0;h<f;h++){let _=d.getCell(h);if(!_||_.getWidth()===0)continue;let c=[];_.isBold()&&c.push("font-weight:bold");let p=Ot(_);p&&c.push("color:"+p);let o=Ht(_);o&&c.push("background-color:"+o);let i=c.join(";");i!==l&&(l&&(n+="</span>"),l=i,i&&(n+='<span style="'+i+'">')),n+=I(_.getChars()||" ")}l&&(n+="</span>"),z.push(n)}return z}dispose(){this.disposed||(this.disposed=!0,this.term.dispose())}},Q=null,te=[],Ce=!0,ue=null,ge=null,ne=!1,Ne=localStorage.getItem("debugMode")==="1";function ut(){return Ne}function De(){ue&&ue.dispose(),ue=null}function Ft(){Q=new WebSocket("ws://"+window.location.host+"/ws"),Q.onopen=()=>{Q.send(JSON.stringify({type:"list"})),vt()},Q.onmessage=T=>{let I;try{I=JSON.parse(T.data)}catch{return}switch(I.type){case"sessions":Wt(I);break;case"snapshot":Nt(I);break;case"meta":$t(I);break;case"diff":Ut(I);break;case"raw":jt(I);break}},Q.onclose=()=>{let T=document.getElementById("term");T.textContent="WebSocket disconnected"}}function ft(){let T=document.getElementById("session"),I=document.getElementById("terminal"),U=document.getElementById("term");T.innerHTML="",I.innerHTML="",U.innerHTML='<div class="row"><span class="c">'+(ce.noSession||"")+"</span></div>",document.getElementById("meta").textContent="",se=[],De(),fe="",pe="",Ne=!1,ne=!1,localStorage.removeItem("debugMode");let z=document.getElementById("debugMode");z.checked=!1,$e(),pt()}function Wt(T){let I=T.sessions||[],U=document.getElementById("session");if(te=I,I.length===0){ft();return}let z=I.map(f=>f.sessionID+"|"+f.terminals.length).join(","),R=U.value,d=document.getElementById("terminal").value;U.innerHTML="";for(let f of te){let n=document.createElement("option");n.value=f.sessionID,n.textContent=Ct(f)+" ("+f.terminals.length+" "+ce.terminals+")",U.appendChild(n)}R&&[...U.options].some(f=>f.value===R)?U.value=R:U.selectedIndex=te.length?0:-1,Ue(d)}function pt(){let T=!te.find(R=>R.sessionID===document.getElementById("session").value)?.terminals.find(R=>(R.name||"default")===document.getElementById("terminal").value)?.connected,I=document.getElementById("cmdKey");I.classList.toggle("disabled",T),I.title=T?"":ce.sendCtrlC||"";let U=document.getElementById("debugMode"),z=document.getElementById("rawToggle");U.disabled=!1,z&&z.classList.remove("disabled"),U.checked=Ne,ne=ut(),ne?tt():$e()}function Ue(T,I=!1){let U=document.getElementById("session"),z=document.getElementById("terminal"),R=document.getElementById("delTerm"),d=U.value,f=te.find(_=>_.sessionID===d),n=z.value;z.innerHTML="";for(let _ of f?f.terminals:[]){let c=document.createElement("option");c.value=_.name||"default",c.textContent=(_.name||"default")+(_.kind==="local"?" ["+ce.local+"]":"")+" "+(_.connected?"\u25CF":"\u25CB")+(_.busy?" \u23F3":""),z.appendChild(c)}T&&[...z.options].some(_=>_.value===T)?z.value=T:z.selectedIndex=z.options.length?0:-1;let l=f?.terminals.find(_=>(_.name||"default")===z.value);R.classList.toggle("show",!!(l&&!l.connected)),pt(),Qe();let h=z.value;(I||h!==n)&&(fe="",pe="",vt())}var fe="",pe="",se=[];function vt(){let T=document.getElementById("session").value,I=document.getElementById("terminal").value;!T||!I||!Q||Q.readyState!==WebSocket.OPEN||T===fe&&I===pe||(fe=T,pe=I,De(),Q.send(JSON.stringify({type:"subscribe",sessionID:T,name:I,mode:ne?"raw":"transcript"})))}async function Nt(T){let I=document.getElementById("term"),U=document.getElementById("toBottom");if(T.notFound){I.innerHTML='<div class="row"><span class="t"></span><span class="c">'+ce.sessionGone+"</span></div>",document.getElementById("meta").textContent="",qt(T.sessionID,T.name);return}let z=T.pairs||[],R=!ne&&document.getElementById("showTime").checked;document.body.classList.toggle("show-time",R);let d=z.filter(n=>n.type==="cmd").length;if(Qe(d),se=z,ne)return;De(),ge=null;let f=await zt(z,R);T.sessionID!==fe||T.name!==pe||(I.innerHTML=f,Xe(I,U))}function Qe(T){let I=document.getElementById("session").value,U=document.getElementById("terminal").value;if(!I){document.getElementById("meta").textContent="";return}let R=te.find(h=>h.sessionID===I)?.terminals.find(h=>(h.name||"default")===U),d=R?R.host?R.host+(R.port?":"+R.port:""):R.program||"":"",f=d?" ["+d+"]":"",l=" \xB7 "+(T??se.filter(h=>h.type==="cmd").length)+" "+ce.commands;document.getElementById("meta").textContent=I+"/"+U+f+l}function Xe(T,I){Ce?(T.scrollTop=T.scrollHeight,I.style.display="none"):I.style.display=T.scrollHeight>T.clientHeight?"inline-block":"none"}async function Ut(T){if(ne)return;let I=document.getElementById("term"),U=document.getElementById("toBottom"),z=document.getElementById("showTime").checked;if(T.event==="cmd"){if(!T.command)return;let R=ge;R&&R.dataset.finalized!=="1"&&R.remove(),ge=null,De();let d=z?yt(Date.now()):"",f=document.createElement("div");f.className="row cmdline",f.innerHTML='<span class="t">'+d+'</span><span class="c">'+mt(T.command)+"</span>",I.appendChild(f),se.push({type:"cmd",ts:typeof T.ts=="number"?T.ts:Date.now(),text:T.command})}else if(T.event==="out"){if(!T.data)return;let R=ge;if((!R||R.parentNode!==I)&&(R=document.createElement("div"),R.className="runBlock",I.appendChild(R),ge=R),T.final){De(),ue=new be(Be);let n=se[se.length-1];n&&n.type==="out"?n.text=T.data:se.push({type:"out",text:T.data})}else{ue||(ue=new be(Be));let n=se[se.length-1];n&&n.type==="out"?n.text+=T.data:se.push({type:"out",text:T.data})}let d=ue;if(!d||(await d.write(St(T.data)),ue!==d))return;let f=d.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");R.innerHTML=f,Xe(I,U)}else if(T.event==="done"){let R=[...se].reverse().find(n=>n.type==="cmd"),d=ge;if((!d||d.parentNode!==I)&&R&&(d=document.createElement("div"),d.className="runBlock",I.appendChild(d),ge=d),d&&d.parentNode===I){let n=z?bt({ts:R?.ts,endTs:T.endTs},T.exitCode):"";if(d.childElementCount===0&&R){let l=document.createElement("div");l.className="row",l.innerHTML='<span class="t">'+n+'</span><span class="c">&nbsp;</span>',d.appendChild(l)}else{let l=d.lastElementChild;if(l){let h=l.querySelector(".t");h&&(h.innerHTML=n)}}}let f=se[se.length-1];f&&f.type==="out"&&(f.endTs=T.endTs,f.exitCode=T.exitCode),d&&d.parentNode===I&&(d.dataset.finalized="1"),Xe(I,U)}}function $t(T){typeof T.commands=="number"&&Qe(T.commands)}var Se=null,We=!0,Je=!0,Le=null;function et(){let T=document.getElementById("xt");!T||!Je||T.scrollHeight>T.clientHeight&&(T.scrollTop=T.scrollHeight)}function gt(){if(Se)return Se;let T=document.getElementById("xt");if(!T){T=document.createElement("div"),T.id="xt";let U=document.getElementById("term");(U?.parentNode??document.body).insertBefore(T,U?.nextSibling??null)}let I=new ht.Terminal({cols:Be,rows:lt,scrollback:dt,fontFamily:'"CaskaydiaCove Nerd Font Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "Noto Sans Mono", "Hack", Consolas, "Courier New", monospace',fontSize:13,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",selectionBackground:"#30363d",black:"#010409",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#c9d1d9",brightBlack:"#666666",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});return I.open(T),T.addEventListener("scroll",()=>{Je=T.scrollTop+T.clientHeight>=T.scrollHeight-2}),Le=()=>{Je=!0,et(),We&&I.scrollToBottom()},window.addEventListener("resize",Le),I.onScroll(()=>{We=I.buffer.active.viewportY>=I.buffer.active.baseY}),Se=I,I}function tt(){document.body.classList.add("debug");let T=gt(),I=document.getElementById("toBottom");I.style.display="none",We&&T.scrollToBottom(),et()}function $e(){document.body.classList.remove("debug"),Le&&(window.removeEventListener("resize",Le),Le=null),Se&&(Se.dispose(),Se=null)}function jt(T){if(!ne)return;let I=gt();T.reset?(I.reset(),I.write(T.data||"")):T.data&&I.write(T.data),We&&I.scrollToBottom(),et()}function mt(T){return T.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var Ye=/<SSH_DONE:(?:\d+:)?(-?\d+)>/g;function St(T){return T.replace(Ye,"")}async function zt(T,I){let U=[],z=null;for(let R of T){if(R.type==="sep"){U.push('<div class="sep"><hr></div>');continue}if(R.type==="cmd"){z={ts:R.ts,endTs:R.endTs};let d=R.ts?yt(R.ts):"";U.push('<div class="row cmdline"><span class="t">'+d+'</span><span class="c">'+mt(R.text)+"</span></div>")}else if(R.type==="run"){let d=new be(Be);await d.write(St(R.text));let f=d.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");d.dispose(),U.push('<div class="runBlock">'+f+"</div>")}else{let d=Rt(R.text),f=new be(Be);await f.write(d.text);let n=f.render();f.dispose();let l=I?bt(z,d.exitCode??R.exitCode):"",h=(_,c)=>'<div class="row"><span class="t">'+_+'</span><span class="c">'+c+"</span></div>";n.length===0?U.push(h(l,"&nbsp;")):n.forEach((_,c)=>U.push(h(c===n.length-1?l:"",_))),z=null}}return U.join("")}function bt(T,I){let U=[];if(T&&T.ts&&T.endTs&&U.push("+"+((T.endTs-T.ts)/1e3).toFixed(3)+"s"),I!==void 0){let z=I===0?"#3fb950":"#ff7b72";U.push('<span style="color:'+z+'">'+(I===0?"\u2713":"\u2717 "+I)+"</span>")}return U.join(" ")}function Ct(T){if(T.title&&T.title.trim())return T.title;let I=T.terminals&&T.terminals[0];return I&&I.host?(I.user?I.user+"@":"")+I.host:T.sessionID.slice(0,8)+"\u2026"}function yt(T){let I=new Date(T),U=z=>String(z).padStart(2,"0");return I.getFullYear()+"-"+U(I.getMonth()+1)+"-"+U(I.getDate())+" "+U(I.getHours())+":"+U(I.getMinutes())+":"+U(I.getSeconds())}function qt(T,I){let U=te.find(f=>f.sessionID===T);U&&(U.terminals=U.terminals.filter(f=>(f.name||"default")!==I),U.terminals.length===0&&(te=te.filter(f=>f.sessionID!==T)));let z=document.getElementById("session"),R=z.value;z.innerHTML="";for(let f of te){let n=document.createElement("option");n.value=f.sessionID,n.textContent=Ct(f)+" ("+f.terminals.length+" "+ce.terminals+")",z.appendChild(n)}R&&[...z.options].some(f=>f.value===R)?z.value=R:z.selectedIndex=te.length?0:-1;let d=document.getElementById("terminal").value;Ue(d)}function Kt(T){T&&(Ce=!0);let I=document.getElementById("terminal").value;Ue(I,!0)}function Vt(){let T=document.getElementById("showTime");localStorage.setItem("showTime",T.checked?"1":"0"),document.body.classList.toggle("show-time",T.checked)}function Gt(){let T=document.getElementById("debugMode");Ne=T.checked,localStorage.setItem("debugMode",T.checked?"1":"0");let I=ut();ne=I,I?tt():$e(),Q&&Q.readyState===WebSocket.OPEN&&fe&&pe&&Q.send(JSON.stringify({type:"setMode",mode:I?"raw":"transcript"}))}function Xt(){let T=document.getElementById("session").value,I=document.getElementById("terminal").value;if(!I||!Q||Q.readyState!==WebSocket.OPEN)return;let U=te.find(d=>d.sessionID===T),z=U?.terminals.find(d=>(d.name||"default")===I);if(!z||z.connected)return;if(Q.send(JSON.stringify({type:"deleteTerminal",sessionID:T,name:I})),U&&(U.terminals=U.terminals.filter(d=>(d.name||"default")!==I),U.terminals.length===0&&(te=te.filter(d=>d.sessionID!==T))),te.length===0){ft();return}let R=document.getElementById("terminal").value;Ue(R!==I?R:void 0)}function Jt(){let T=document.getElementById("term"),I=document.getElementById("toBottom");T.scrollTop=T.scrollHeight,Ce=!0,I.style.display="none"}var wt=document.getElementById("showTime");wt.checked=localStorage.getItem("showTime")==="1";document.body.classList.toggle("show-time",wt.checked);var Yt=document.getElementById("debugMode");ne=localStorage.getItem("debugMode")==="1";Yt.checked=ne;ne?tt():$e();var Pe=document.getElementById("term"),Zt=document.getElementById("toBottom");Pe.addEventListener("scroll",()=>{Pe.scrollTop+Pe.clientHeight>=Pe.scrollHeight-30?(Ce=!0,Zt.style.display="none"):Ce=!1});var ve=[],_e=-1,Ie=-1,Oe="",Y=document.getElementById("cmdInput");Y.placeholder=ce.cmdPlaceholder||"";Y.addEventListener("keydown",T=>{if(T.key==="Tab"){T.preventDefault();let d=Y.value.trim();if(!d)return;Oe!==d&&(Ie=-1,Oe=d);let f=ve.filter(n=>n.startsWith(Oe));if(f.length===0)return;Ie=(Ie+1)%f.length,Y.value=f[Ie],me();return}if(Oe="",T.key==="ArrowUp"){T.preventDefault(),_e>0&&(_e--,Y.value=ve[_e],me());return}if(T.key==="ArrowDown"){T.preventDefault(),_e<ve.length-1?(_e++,Y.value=ve[_e],me()):(_e=ve.length,Y.value="",me());return}if(T.key!=="Enter")return;if(T.preventDefault(),T.shiftKey){let d=Y.selectionStart??Y.value.length,f=Y.selectionEnd??Y.value.length;Y.value=Y.value.slice(0,d)+`
12
+ `+Y.value.slice(f),Y.selectionStart=Y.selectionEnd=d+1,me();return}let I=document.getElementById("session").value,U=document.getElementById("terminal").value;if(!I||!Q||Q.readyState!==WebSocket.OPEN)return;let z=Y.value;if(Y.value="",me(),!z.trim())return;(fe!==I||pe!==U)&&(fe=I,pe=U,Q.send(JSON.stringify({type:"subscribe",sessionID:I,name:U})));let R=z.trim();ve.push(R),_e=ve.length,Q.send(JSON.stringify({type:"exec",sessionID:I,name:U,command:R})),Ce=!0});function me(){Y.style.height="auto",Y.style.height=Math.min(Y.scrollHeight,120)+"px"}Y.addEventListener("input",me);var ae=document.getElementById("cmdKey"),Ae=ce.sendCtrlC||"Ctrl-C",ye=!1,He=!1;ae.textContent=Ae;function Ze(T){if(!ye)return;let I=document.getElementById("session").value,U=document.getElementById("terminal").value;if(!I||!Q||Q.readyState!==WebSocket.OPEN)return;let z,R;if(T.ctrlKey&&T.key!=="Control"){let d=T.key.toLowerCase().charCodeAt(0)-96;d>=1&&d<=26?(z="\\x"+d.toString(16).padStart(2,"0"),R="Ctrl-"+T.key.toUpperCase()):(z="",R="")}else if(T.key==="Enter")z="\\r",R="\u21B5";else if(T.key==="Escape")z="\\x1b",R="Esc";else if(T.key==="Tab")z="\\t",R="Tab";else if(T.key==="Backspace")z="\\x7f",R="\u232B";else if(T.key===" "||T.key==="Space")z=" ",R="Space";else if(T.key==="ArrowUp")z="\\x1b[A",R="\u2191";else if(T.key==="ArrowDown")z="\\x1b[B",R="\u2193";else if(T.key==="ArrowRight")z="\\x1b[C",R="\u2192";else if(T.key==="ArrowLeft")z="\\x1b[D",R="\u2190";else if(T.key==="Home")z="\\x1b[H",R="Home";else if(T.key==="End")z="\\x1b[F",R="End";else if(T.key==="PageUp")z="\\x1b[5~",R="PgUp";else if(T.key==="PageDown")z="\\x1b[6~",R="PgDn";else if(/^F[1-4]$/.test(T.key))z="\\x1bO"+"PQRS"[Number(T.key.slice(1))-1],R=T.key;else if(/^F([5-9]|1[0-2])$/.test(T.key)){let d=Number(T.key.slice(1));z="\\x1b["+{5:15,6:17,7:18,8:19,9:20,10:21,11:23,12:24}[d]+"~",R=T.key}else if(T.key.length===1)z=T.key,R=T.key;else return;z&&Q.send(JSON.stringify({type:"send",sessionID:I,name:U,text:z})),ae.textContent=R||Ae,setTimeout(()=>{ye||(ae.textContent=Ae)},1500)}ae.addEventListener("click",()=>{document.getElementById("session").value&&(He=!He,He?(ye=!0,ae.classList.add("capture"),ae.textContent="...",document.addEventListener("keyup",Ze),Y.blur()):(ye=!1,ae.classList.remove("capture"),document.removeEventListener("keyup",Ze),ae.textContent=Ae))});Y.addEventListener("focus",()=>{ye&&(He=!1,ye=!1,ae.classList.remove("capture"),document.removeEventListener("keyup",Ze),ae.textContent=Ae)});Object.assign(window,{onSessionChange:Kt,onShowTimeChange:Vt,onDebugModeChange:Gt,deleteTerminal:Xt,scrollToNewest:Jt});Ft();})();